forked from Deantwo/HazeronAdviser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHObj.cs
739 lines (666 loc) · 30.7 KB
/
HObj.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HazeronAdviser
{
class HObj
{
public static string EventLogStyle(string log)
{
log = log.Replace("EVENT LOG", "Event Log:");
log = log.Replace("Time" + Environment.NewLine + "Note", "Time Note");
while (log.Contains(Environment.NewLine + "UTC:"))
{
int utcIndex = log.IndexOf(Environment.NewLine + "UTC:") + Environment.NewLine.Length;
log = log.Remove(utcIndex) + HMail.DecodeUTC(log.Substring(utcIndex, 12)).ToString("F", Hazeron.DateTimeFormat) + " " + log.Substring(utcIndex + 12 + Environment.NewLine.Length);
}
log = log.Replace(Environment.NewLine, Environment.NewLine + " ");
log = log.Replace(". ", "." + Environment.NewLine + " ");
log = log.Replace("! ", "!" + Environment.NewLine + " ");
log = log.Replace("? ", "?" + Environment.NewLine + " ");
return log;
}
protected string _name = "-"; // Name of the sender (city, ship, etc), this can change at any time.
public string Name
{
get { return _name; }
}
protected int _id = 0; // ID of the sender (city, ship, etc), used in mail file names.
public int ID
{
get { return _id; }
}
public string IdString
{
get { return HHelper.ToID(_id); }
}
protected string _systemName = "-"; // Name of the sender's system, may not be present.
public string SystemName
{
get { return _systemName; }
}
protected int _systemId = 0; // ID of the sender's system, may not be present.
public int SystemID
{
get { return _systemId; }
}
protected string _planetName = "-"; // Name of the sender's planet, may not be present.
public string PlanetName
{
get { return _planetName; }
}
protected int _planetId = 0; // ID of the sender's planet, may not be present.
public int PlanetID
{
get { return _planetId; }
}
protected string _overview = "";
public string Overview
{
get { return _overview; }
}
protected DateTime _lastUpdated = new DateTime(2000, 1, 1);
public DateTime LastUpdared
{
get { return _lastUpdated; }
}
public string LastUpdaredString
{
get
{
return LastUpdared.ToString("F", Hazeron.DateTimeFormat);
}
}
protected byte _attentionCode = 0x00; // 0b00000000
public byte AttentionCode
{
get { return _attentionCode; }
}
protected List<int> _owners = new List<int>();
public List<int> Onwers
{
get { return _owners; }
}
protected HMail _mail;
public HMail Mail
{
get { return _mail; }
}
public string MailBody
{
get { return HHelper.CleanText(_mail.Body); }
}
protected bool _initialized = false;
public bool Initialized
{
get { return _initialized; }
}
public HObj(HMail mail)
{
_id = mail.SenderID;
CompareMail(mail);
}
public virtual void CompareMail(HMail mail)
{
int tempOwner = mail.RecipientID;
if (!_owners.Contains(tempOwner))
_owners.Add(tempOwner);
if (DateTime.Compare(_lastUpdated, mail.DateTime) < 0)
{
_name = mail.From; // Incase sender changed name.
_systemId = mail.SystemID; // Incase ships or officers change system.
_systemName = mail.SystemName; // Incase city's system's name is changed.
_planetId = mail.PlanetID; // Incase ships or officers change system.
_planetName = mail.PlanetName; // Incase city's system's name is changed.
_lastUpdated = mail.DateTime;
_mail = mail;
}
}
protected string GetSectionText(string mailBody, List<string> reportSecions, string headline)
{
int subStart, subEnd;
subStart = mailBody.IndexOf(headline);
int index = reportSecions.IndexOf(headline) + 1;
if (reportSecions.Count != index)
subEnd = mailBody.IndexOf(reportSecions[index]) - subStart;
else
subEnd = mailBody.Length - 1 - subStart;
return mailBody.Substring(subStart, subEnd);
}
public virtual void Initialize()
{
_initialized = true;
}
}
class HShip : HObj
{
protected string _abandonmentColumn = "-";
public string AbandonmentColumn
{
get { return _abandonmentColumn; }
}
protected string _damageOverview = "";
public string DamageOverview
{
get { return _damageOverview; }
}
protected string _damageColumn = "-";
public string DamageColumn
{
get { return _damageColumn; }
}
protected string _accountOverview = "";
public string AccountOverview
{
get { return _accountOverview; }
}
protected string _accountColumn = "-";
public string AccountColumn
{
get { return _accountColumn; }
}
protected long _accountBalance = 0;
public long AccountBalance
{
get { return _accountBalance; }
}
protected string _fuelOverview = "";
public string FuelOverview
{
get { return _fuelOverview; }
}
protected string _fuelColumn = "-";
public string FuelColumn
{
get { return _fuelColumn; }
}
protected string _cargoOverview = "";
public string CargoOverview
{
get { return _cargoOverview; }
}
protected string _cargoColumn = "-";
public string CargoColumn
{
get { return _cargoColumn; }
}
protected string _missionOverview = "";
public string MissionOverview
{
get { return _missionOverview; }
}
protected string _missionColumn = "-";
public string MissionColumn
{
get { return _missionColumn; }
}
protected string _rosterOverview = "";
public string RosterOverview
{
get { return _rosterOverview; }
}
protected string _rosterColumn = "-";
public string RosterColumn
{
get { return _rosterColumn; }
}
protected string _officerName = "-";
public string OfficerName
{
get { return _officerName; }
}
protected string _officerHomeSystem = "-";
public string OfficerHomeSystem
{
get { return _officerHomeSystem; }
}
protected string _officerHomePlanet = "-";
public string OfficerHomePlanet
{
get { return _officerHomePlanet; }
}
protected string _eventOverview = "";
public string EventOverview
{
get { return _eventOverview; }
}
protected string _officerOverview = "";
public string OfficerOverview
{
get { return _officerOverview; }
}
public HShip(HMail mail)
: base(mail)
{
}
public override void Initialize()
{
// String working vars.
int subStart, subEnd;
string[] tempArray;
List<string> sectionsInReport = new List<string>();
// This is the order of the sections in the mail body, keep them in same order!
string[] sections = new string[] { "<b>EVENT LOG</b>"
, "<b>DAMAGE REPORT</b>"
, "<b>ACCOUNT</b>"
, "<b>FUEL</b>"
, "<b>CARGO</b>"
, "<b>MISSION</b>"
, "<b>ROSTER</b>"
};
// Time for Ship spicific things.
int abandonment = 0;
// Check for sections.
foreach (string section in sections)
if (_mail.Body.Contains(section))
sectionsInReport.Add(section);
// EVENT LOG
const string headlineEVENT = "<b>EVENT LOG</b>";
if (sectionsInReport.Contains(headlineEVENT))
{
string tempSection = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineEVENT));
//tempArray = tempSection.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
_eventOverview = HShip.EventLogStyle(tempSection);
}
// Decay
if (!_mail.Body.Contains("I miss my home; "))
{
subStart = _mail.Body.IndexOf("Commander,") + 10; // "Commander,".Length == 10
subEnd = _mail.Body.Substring(subStart).IndexOf("I was deployed from ");
string crewMorale = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
abandonment = 7;
switch (crewMorale)
{
case "The crew has high spirits. Every day seems filled with anticipation.":
abandonment *= 4;
break;
case "More than a week has passed since we were last hailed by command. The crew is quiet, intent on their work as they attend to their duties.":
abandonment *= 3;
break;
case "More than two weeks have passed since we last heard from command. There have been some tense confrontations between the crew members.":
abandonment *= 2;
break;
case "More than three weeks have passed since we lost contact with command. Some of the crew have become surly and insubordinate. Fighting among them is a daily occurance.":
abandonment *= 1;
break;
}
_abandonmentColumn = (abandonment / 7) + " /4 weeks";
}
else
{
subStart = _mail.Body.IndexOf("I miss my home; it's been ") + 26; // "I miss my home; it's been ".Length == 26
subEnd = _mail.Body.Substring(subStart).IndexOf(" days since I last heard from my family.");
abandonment = 7 - Convert.ToInt32(_mail.Body.Substring(subStart, subEnd));
_abandonmentColumn = " " + abandonment + " /7 days";
}
// DAMAGE REPORT
const string headlineDAMAGE = "<b>DAMAGE REPORT</b>";
if (sectionsInReport.Contains(headlineDAMAGE))
{
_damageOverview = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineDAMAGE));
//tempArray = _damageOverview.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
//_damageColumn = tempArray[temp.Length - 1];
}
// ACCOUNT
const string headlineACCOUNT = "<b>ACCOUNT</b>";
if (sectionsInReport.Contains(headlineACCOUNT))
{
_accountOverview = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineACCOUNT));
tempArray = _accountOverview.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
_accountColumn = tempArray[1].Remove(tempArray[1].IndexOf('¢') + 1).Replace(',', '\'').Replace('.', '\'');
_accountBalance = Convert.ToInt64(_accountColumn.Remove(_accountColumn.IndexOf('¢')).Replace("'", ""));
_accountColumn = _accountBalance.ToString("C", Hazeron.NumberFormat);
}
// FUEL
const string headlineFUEL = "<b>FUEL</b>";
if (sectionsInReport.Contains(headlineFUEL))
{
_fuelOverview = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineFUEL));
tempArray = _fuelOverview.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
_fuelColumn = tempArray[1];
}
// CARGO
const string headlineCARGO = "<b>CARGO</b>";
if (sectionsInReport.Contains(headlineCARGO))
{
_cargoOverview = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineCARGO));
//tempArray = _cargoOverview.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
//_cargoColumn = tempArray[tempArray.Length - 1];
}
// MISSION
const string headlineMISSION = "<b>MISSION</b>";
if (sectionsInReport.Contains(headlineMISSION))
{
_missionOverview = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineMISSION));
//tempArray = _missionOverview.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
//_missionColumn = tempArray[tempArray.Length - 1];
}
// ROSTER
const string headlineROSTER = "<b>ROSTER</b>";
if (sectionsInReport.Contains(headlineROSTER))
{
_rosterOverview = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, headlineROSTER));
//tempArray = _rosterOverview.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
//_rosterColumn = tempArray[tempArray.Length - 1];
}
// Officer Info
//// Name
subStart = _mail.Body.IndexOf("<p>") + 3; // "<p>".Length == 3
subEnd = _mail.Body.Substring(subStart).IndexOf("<div style");
_officerName = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
//// Home
_officerHomeSystem = "<system name>";
subStart = _mail.Body.IndexOf("I was deployed from ") + 20; // "I was deployed from ".Length == 20
subEnd = _mail.Body.Substring(subStart).IndexOf(" in ");
_officerHomePlanet = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
// Officer Overview
_officerOverview = "Location:" + Environment.NewLine;
_officerOverview += " " + _systemName + Environment.NewLine;
_officerOverview += " " + _planetName + Environment.NewLine;
_officerOverview += Environment.NewLine;
_officerOverview += "Officer:" + Environment.NewLine;
_officerOverview += " " + _officerName + Environment.NewLine;
_officerOverview += Environment.NewLine;
_officerOverview += "Officer Home:" + Environment.NewLine;
_officerOverview += " " + _officerHomeSystem;
_officerOverview += " " + _officerHomePlanet;
_officerOverview += Environment.NewLine + Environment.NewLine;
_officerOverview += "Stationed ship:" + Environment.NewLine;
_officerOverview += " " + _name;
// Overview
_overview = "Location:" + Environment.NewLine;
_overview += " " + _systemName + Environment.NewLine;
_overview += " " + _planetName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += _eventOverview;
// AttentionCodes
if (abandonment <= 14) // 2 weeks until decay.
_attentionCode = (byte)(_attentionCode | 0x08); // 0b00000001
if (abandonment <= 7) // 1 weeks until decay.
_attentionCode = (byte)(_attentionCode | 0x03); // 0b00000010
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x04); // 0b00000100
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x08); // 0b00001000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x10); // 0b00010000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x20); // 0b00100000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x40); // 0b01000000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x80); // 0b10000000
base.Initialize();
}
}
class HOfficer : HObj
{
protected string _homeSystem = "-";
public string HomeSystem
{
get { return _homeSystem; }
}
protected string _homePlanet = "-";
public string HomePlanet
{
get { return _homePlanet; }
}
protected string _ship = "-";
public string Ship
{
get { return _ship; }
}
public HOfficer(HMail mail)
: base(mail)
{
_id = mail.SenderID;
CompareMail(mail);
}
public override void Initialize()
{
// String working vars.
int subStart, subEnd;
string[] tempArray;
if (_mail.MessageType == 0x0C) // MSG_OfficerReady
{
_homeSystem = _systemName;
//subStart = _mail.Body.IndexOf("Assignment Request on ") + 22; // "Assignment Request on ".Length == 22
//subEnd = _mail.Body.IndexOf("<br><br>Commander,") - subStart;
//_homePlanet = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
_homePlanet = _planetName;
_ship = "";
}
else if (_mail.MessageType == 0x14) // MSG_OfficerContact
{
_homeSystem = "<system name>";
subStart = _mail.Body.IndexOf("I was deployed from ") + 20; // "I was deployed from ".Length == 20
subEnd = _mail.Body.Substring(subStart).IndexOf(" in ");
_homePlanet = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
_ship = "<ship name>";
}
// Overview
_overview = "Location:" + Environment.NewLine;
_overview += " " + _systemName + Environment.NewLine;
_overview += " " + _planetName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Officer:" + Environment.NewLine;
_overview += " " + _name + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Officer Home:" + Environment.NewLine;
_overview += " " + _homeSystem;
_overview += " " + _homePlanet;
if (_mail.MessageType == 0x14) // MSG_OfficerContact
{
_overview += Environment.NewLine + Environment.NewLine;
_overview += "Stationed ship:" + Environment.NewLine;
_overview += " " + _ship;
}
// AttentionCodes
if (_mail.MessageType == 0x14) // MSG_OfficerContact
_attentionCode = (byte)(_attentionCode | 0x01); // 0b00000001
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x03); // 0b00000010
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x04); // 0b00000100
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x08); // 0b00001000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x10); // 0b00010000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x20); // 0b00100000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x40); // 0b01000000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x80); // 0b10000000
base.Initialize();
}
}
class HEvent : HObj
{
protected int _messageId = 0;
public int MessageID
{
get { return _messageId; }
}
protected string _subject = "-";
public string Subject
{
get { return _subject; }
}
protected int _messageType = 0;
public int MessageType
{
get { return _messageType; }
}
public HEvent(HMail mail)
: base(mail)
{
}
public override void Initialize()
{
// String working vars.
int subStart, subEnd;
string[] tempArray;
_messageId = _mail.MessageID;
_subject = _mail.Subject;
_messageType = _mail.MessageType;
if (_messageType == 0x03) // MSG_CityOccupationReport
{
// ?
}
if (_messageType == 0x05) // MSG_CityIntelligenceReport
{
// ?
}
else if (_messageType == 0x12) // MSG_ShipLogFinal
{
subStart = _mail.Body.IndexOf("<p>") + 3; // "<p>".Length == 3
subEnd = _mail.Body.Substring(subStart).IndexOf("<div style");
string officerName = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
string officerHomeSystem = "<system name>";
subStart = _mail.Body.IndexOf("I was deployed from ") + 20; // "I was deployed from ".Length == 20
subEnd = _mail.Body.Substring(subStart).IndexOf(" in ");
string officerHomePlanet = HHelper.CleanText(_mail.Body.Substring(subStart, subEnd));
List<string> sectionsInReport = new List<string>{ "<b>SPACECRAFT DESTROYED</b>" };
if (_mail.Body.Contains("<b>EVENT LOG</b>"))
sectionsInReport.Add("<b>EVENT LOG</b>");
string shipDestruction = HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, "<b>SPACECRAFT DESTROYED</b>"));
shipDestruction = shipDestruction.Substring(("SPACECRAFT DESTROYED" + Environment.NewLine).Length);
shipDestruction = shipDestruction.Replace(Environment.NewLine, Environment.NewLine + " ");
shipDestruction = shipDestruction.Replace(". ", "." + Environment.NewLine + " ");
shipDestruction = shipDestruction.Replace("! ", "!" + Environment.NewLine + " ");
shipDestruction = shipDestruction.Replace("? ", "?" + Environment.NewLine + " ");
string shipEvent = "";
if (sectionsInReport.Contains("<b>EVENT LOG</b>"))
{
shipEvent = HEvent.EventLogStyle(HHelper.CleanText(GetSectionText(_mail.Body, sectionsInReport, "<b>EVENT LOG</b>")));
}
_overview = "Location:" + Environment.NewLine;
_overview += " " + _systemName + Environment.NewLine;
_overview += " " + _planetName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Ship:" + Environment.NewLine;
_overview += " " + _name + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Officer:" + Environment.NewLine;
_overview += " " + officerName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Officer Home:" + Environment.NewLine;
_overview += " " + officerHomeSystem + Environment.NewLine;
_overview += " " + officerHomePlanet + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "[color=red]Cause of destruction:" + Environment.NewLine;
_overview += " " + shipDestruction + "[/color]" + Environment.NewLine;
if (shipEvent != "")
{
_overview += Environment.NewLine;
_overview += shipEvent;
}
}
else if (_messageType == 0x13) // MSG_Government
{
if (_name == "State Department")
{
string tempSection = HHelper.CleanText(_mail.Body);
tempArray = tempSection.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
string empireName = tempArray[tempArray.Length - 6].Substring(4);
string empireEncounter = tempArray[tempArray.Length - 4];
string empireStance = tempArray[tempArray.Length - 3];
_overview = "Location:" + Environment.NewLine;
_overview += " " + _systemName + Environment.NewLine;
_overview += " " + _planetName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Empire:" + Environment.NewLine;
if (Hazeron.PirateEmpires.Contains(empireName))
_overview += " [color=red]" + empireName + " (NPC pirate empire)[/color]" + Environment.NewLine;
else
_overview += " " + empireName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Encounter:" + Environment.NewLine;
_overview += " " + empireEncounter + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Stance taken:" + Environment.NewLine;
if (!empireStance.Contains("competitive"))
_overview += " " + empireStance + Environment.NewLine;
else
_overview += " [color=red]" + empireStance + "[/color]" + Environment.NewLine;
}
else if (_name == "War Department")
{
// ?
}
else if (_name == "Treasury Department")
{
// Levy Tax?
}
}
else if (_messageType == 0x16) // MSG_OfficerDeath
{
string officerHomeSystem = "<system name>";
string officerHomePlanet = "<planet name>";
string tempSection = HHelper.CleanText(_mail.Body);
tempArray = tempSection.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
string officerDeath = tempArray[tempArray.Length - 3];
officerDeath = officerDeath.Replace(". ", "." + Environment.NewLine + " ");
officerDeath = officerDeath.Replace("! ", "!" + Environment.NewLine + " ");
officerDeath = officerDeath.Replace("? ", "?" + Environment.NewLine + " ");
_overview = "Location:" + Environment.NewLine;
_overview += " " + _systemName + Environment.NewLine;
_overview += " " + _planetName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Officer:" + Environment.NewLine;
_overview += " " + _name + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Officer Home:" + Environment.NewLine;
_overview += " " + officerHomeSystem + Environment.NewLine;
_overview += " " + officerHomePlanet + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "[color=red]Cause of death:" + Environment.NewLine;
_overview += " " + officerDeath + "[/color]";
}
else if (_messageType == 0x17) // MSG_CityFinalDecayReport
{
// ?
}
else if (_messageType == 0x18) // MSG_DiplomaticMessage
{
string tempSection = HHelper.CleanText(_mail.Body);
tempArray = tempSection.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
string diplomat = tempArray[tempArray.Length - 2];
diplomat = diplomat.Remove(diplomat.IndexOf(" has asked"));
string diplomaticMessage = tempArray[tempArray.Length - 1];
diplomaticMessage = diplomaticMessage.Replace(". ", "." + Environment.NewLine + " ");
diplomaticMessage = diplomaticMessage.Replace("! ", "!" + Environment.NewLine + " ");
diplomaticMessage = diplomaticMessage.Replace("? ", "?" + Environment.NewLine + " ");
_overview = "Location:" + Environment.NewLine;
_overview += " " + _systemName + Environment.NewLine;
_overview += " " + _planetName + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Diplomat:" + Environment.NewLine;
_overview += " " + diplomat + Environment.NewLine;
_overview += Environment.NewLine;
_overview += "Diplomatic Message:" + Environment.NewLine;
_overview += " " + diplomaticMessage;
}
// AttentionCodes
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x01); // 0b00000001
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x03); // 0b00000010
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x04); // 0b00000100
if (_messageType == 0x05) // MSG_CityIntelligenceReport
_attentionCode = (byte)(_attentionCode | 0x08); // 0b00001000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x10); // 0b00010000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x20); // 0b00100000
if (false) // Nothing yet!
_attentionCode = (byte)(_attentionCode | 0x40); // 0b01000000
if (_messageType == 0x03 || _messageType == 0x12 || _messageType == 0x16 || _messageType == 0x17) // MSG_CityOccupationReport, MSG_ShipLogFinal, MSG_OfficerDeath or MSG_CityFinalDecayReport
_attentionCode = (byte)(_attentionCode | 0x80); // 0b10000000
base.Initialize();
}
}
}