-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTML_Char.cs
More file actions
694 lines (677 loc) · 34.6 KB
/
Copy pathHTML_Char.cs
File metadata and controls
694 lines (677 loc) · 34.6 KB
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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OlyCommonClasses
{
public class HTML_Char
{
public static void Write_Char_HTML_File(Character _mychar, string path, List<Character> _characters, List<Itemz> _items, List<Location> _locations, List<Ship> _ships, List<Skill> _skills, List<Player> _players)
{
using (FileStream fs = new FileStream(System.IO.Path.Combine(path, _mychar._CharId + ".html"), FileMode.Create))
{
using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
{
w.WriteLine("<HTML>");
w.WriteLine("<HEAD>");
w.WriteLine("<TITLE>" + _mychar._Name +
" [" + _mychar._CharId + "]" +
"</TITLE>");
w.WriteLine("</HEAD>");
w.WriteLine("<BODY>");
Write_Char_Page_Header(_mychar, w);
if (_mychar._CH_Prisoner == 1)
{
w.WriteLine("<p>" + _mychar._Name + " [" + _mychar._CharId + "] is being held prisoner.</p>");
}
Write_Char_Basic_Info(_mychar, w, _characters, _items, _locations, _ships, _skills, _players);
w.WriteLine("</BODY>");
w.WriteLine("</HTML>");
}
fs.Dispose();
}
}
private static void Write_Char_Page_Header(Character _myChar, StreamWriter w)
{
StringBuilder outline3 = new StringBuilder();
outline3.Append("<H3>");
outline3.Append(_myChar._Name);
outline3.Append(" [");
outline3.Append(_myChar._CharId);
outline3.Append("]");
outline3.Append("</H3>");
w.WriteLine(outline3);
}
private static void Write_Char_Basic_Info(Character _myChar, StreamWriter w, List<Character> _characters, List<Itemz> _items, List<Location> _locations, List<Ship> _ships, List<Skill> _skills, List<Player> _players)
{
w.WriteLine("<table>");
Write_Char_Location(_myChar, w, _characters, _locations, _ships);
if (_myChar._Char_Type.ToUpper() != "GARRISON")
{
Write_Char_Rank(_myChar, w);
Write_Char_Faction(_myChar, w, _players);
Write_Char_Loyalty(_myChar, w);
Write_Char_Stacked_Under(_myChar, w, _characters);
Write_Char_Stacked_Over(_myChar, w, _characters);
Write_Char_Health(_myChar, w);
Write_Char_Combat(_myChar, w);
Write_Char_Break_Point(_myChar, w);
Write_Char_Pledged_To(_myChar, w, _characters);
Write_Char_Pledged_To_Us(_myChar, w, _characters);
Write_Char_Concealed(_myChar, w, _characters, _items, _locations, _ships);
Write_Char_Aura(_myChar, w, _items);
// missing show appear common
Write_Char_Prisoners(_myChar, w, _characters);
}
w.WriteLine("</table>");
if (_myChar._Char_Type.ToUpper() != "GARRISON")
{
Write_Char_Skills_Known(_myChar, w, _skills);
}
Write_Char_Inventory(_myChar, w, _items);
if (_myChar._Char_Type.ToUpper() != "GARRISON")
{
Write_Char_Capacity(_myChar, w, _items);
Write_Char_Pending_Trades(_myChar, w, _items);
Write_Visions_Received(_myChar, w, _characters);
}
Write_Magic_Stuff(_myChar, w, _items, _skills, _locations, _ships);
}
private static void Write_Char_Faction(Character _myChar, StreamWriter w, List<Player> _players)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Faction:</td>");
w.WriteLine("<td>" + _players.Find(x => x._FactionId == _myChar._PlayerId)._Name + " [" + _players.Find(x => x._FactionId == _myChar._PlayerId)._FactionId_Conv + "]</td>");
w.WriteLine("</tr>");
}
private static void Write_Magic_Stuff(Character _MyChar, StreamWriter w, List<Itemz> _items, List<Skill> _skills, List<Location> _locations, List<Ship> _ships)
{
StringBuilder outline = new StringBuilder();
if (_MyChar._Item_List != null)
{
int iterations = _MyChar._Item_List.Count() / 2;
for (int i = 0; i < iterations; i++)
{
int _item = _MyChar._Item_List[(i * 2)];
Itemz _myitem = _items.Find(x => x._ItemId == _item);
if (_myitem != null)
{
if (_myitem._Item_Type == "0")
{
if (_myitem._IM_Use_Key == 2)
{
// healing potion
outline.Clear();
outline.Append("<p>");
outline.Append("Healing Potion ");
outline.Append(Utilities.Format_Anchor(_myitem._ItemId_Conv));
outline.Append("</p>");
w.WriteLine(outline);
}
else
{
if (_myitem._IM_Use_Key == 5)
{
// potion
outline.Clear();
outline.Append("<p>");
outline.Append("Projected Cast ");
outline.Append(Utilities.Format_Anchor(_myitem._ItemId_Conv));
outline.Append(" to ");
if (_myitem._IM_Project_Cast != 0)
{
Location _myloc = _locations.Find(x => x._LocId == _myitem._IM_Project_Cast);
if (_myloc != null)
{
outline.Append("location " + _myloc._Name + " " + Utilities.Format_Anchor(_myloc._LocId_Conv));
}
else
{
Ship _myship = _ships.Find(x => x._ShipId == _myitem._IM_Project_Cast);
if (_myship != null)
{
outline.Append("ship " + _myship._Name + " " + Utilities.Format_Anchor(_myship._ShipId.ToString()));
}
else
{
outline.Append("target [" + _myitem._IM_Project_Cast + "] no longer exists");
}
}
}
outline.Append("</p>");
w.WriteLine(outline);
}
}
}
else
{
if (_myitem._Item_Type == "scroll")
{
// scroll
//Scroll[p294] permits study of the following skills:
// Hinder meditation[814] (requires Magic)
Skill _myskill = _skills.Find(x => x._SkillId == _myitem._IM_May_Study);
outline.Clear();
outline.Append("<p>");
outline.Append("Scroll ");
outline.Append(Utilities.Format_Anchor(_myitem._ItemId_Conv));
outline.Append(" permits the study of the following skills:<br>");
outline.Append(" ");
if (_myskill == null)
{
outline.Append("???");
}
else
{
outline.Append(_myskill._Name + " ");
outline.Append(Utilities.Format_Anchor(_myskill._SkillId.ToString()));
if (_myskill._SK_Required_Skill != 0)
{
Skill _myskill_req = _skills.Find(x => x._SkillId == _myskill._SK_Required_Skill);
outline.Append(" (requires ");
outline.Append(_myskill_req._Name);
outline.Append(")");
}
}
outline.Append("</p>");
w.WriteLine(outline);
}
}
}
}
}
}
private static void Write_Char_Pending_Trades(Character _myChar, StreamWriter w, List<Itemz> _items)
{
if (_myChar._Trade_List != null)
{
int iterations = _myChar._Trade_List.Count() / 8;
w.WriteLine("<p>Pending Trades:</p>");
w.WriteLine("<table>");
w.WriteLine("<tr><td style=\"text-align:right\">trade</td><td style=\"text-align:right\">price</td><td style=\"text-align:right\">qty</td><td style=\"text-align:left\">item</td></tr>");
w.WriteLine("<tr><td style=\"text-align:right\">---</td><td style=\"text-align:right\">----</td><td style=\"text-align:left\">-----</td></tr>");
for (int i = 0; i < iterations; i++)
{
int _type = _myChar._Trade_List[(i * 8)];
int _item = _myChar._Trade_List[(i * 8) + 1];
int _qty = Convert.ToInt32(_myChar._Trade_List[(i * 8) + 2]);
int _cost = Convert.ToInt32(_myChar._Trade_List[(i * 8) + 3]);
w.WriteLine("<tr>");
Itemz _myitem = _items.Find(x => x._ItemId == Convert.ToInt32(_item));
if (_myitem != null)
{
w.WriteLine("<td style=\"text-align:right\">" + (_type == 1 ? "buy" : "sell") + "</td>");
w.WriteLine("<td style=\"text-align:right\">" + _cost + "</td>");
w.WriteLine("<td style=\"text-align:right\">" + _qty + "</td>");
w.WriteLine("<td style=\"text-align:left\">" + (_qty == 1 ? _myitem._Name : _myitem._Plural) + " [" + Utilities.To_Oid(_item.ToString()) + "]</td>");
}
w.WriteLine("</tr>");
}
w.WriteLine("</table>");
}
}
private static void Write_Char_Capacity(Character _myChar, StreamWriter w, List<Itemz> _items)
{
Weight myweight = Character.Determine_Unit_Weights(_myChar, _items);
StringBuilder outline = new StringBuilder();
outline.Append("<p>Capacity: ");
string land_pct = "";
if (myweight._land_cap > 0)
{
land_pct = " land (" + ((myweight._land_weight * 100) / myweight._land_cap).ToString("N0") + "%)";
}
outline.AppendFormat("{0}/{1}{2}", myweight._land_weight.ToString("N0"), myweight._land_cap.ToString("N0"), land_pct);
string ride_pct = "";
if (myweight._ride_cap > 0)
{
ride_pct = " ride (" + ((myweight._ride_weight * 100) / myweight._ride_cap).ToString("N0") + "%)";
outline.AppendFormat(" {0}/{1}{2}", myweight._ride_weight.ToString("N0"), myweight._ride_cap.ToString("N0"), ride_pct);
}
string fly_pct = "";
if (myweight._fly_cap > 0)
{
fly_pct = " fly: (" + ((myweight._fly_weight * 100) / myweight._fly_cap).ToString("N0") + "%)";
outline.AppendFormat(" {0}/{1}{2}", myweight._fly_weight.ToString("N0"), myweight._fly_cap.ToString("N0"), fly_pct);
}
outline.Append("</p>");
w.WriteLine(outline);
}
private static void Write_Char_Inventory(Character _myChar, StreamWriter w, List<Itemz> _items)
{
int total_weight = 0;
if (_myChar._Item_List != null)
{
int iterations = _myChar._Item_List.Count() / 2;
w.WriteLine("Inventory:");
w.WriteLine("<table>");
w.WriteLine("<tr><td style=\"text-align:right\">qty</td><td style=\"text-align:left\">name</td><td style=\"text-align:right\">weight</td><td style=\"text-align:left\"> </td></tr>");
w.WriteLine("<tr><td style=\"text-align:right\">---</td><td style=\"text-align:left\">----</td><td style=\"text-align:right\">-----</td></tr>");
for (int i = 0; i < iterations; i++)
{
int _item = _myChar._Item_List[(i * 2)];
int _qty = _myChar._Item_List[(i * 2) + 1];
w.WriteLine("<tr>");
w.WriteLine("<td style=\"text-align:right\">" + _qty.ToString("N0") + "</td>");
Itemz _myitem = _items.Find(x => x._ItemId == _item);
if (_myitem != null)
{
w.WriteLine("<td style=\"text-align:left\">" + (_qty == 1 ? _myitem._Name : _myitem._Plural) + " [" + Utilities.To_Oid(_item.ToString()) + "]</td>");
w.WriteLine("<td style=\"text-align:right\">" + (_myitem._Weight * _qty).ToString("N0") + "</td>");
total_weight += (_myitem._Weight * _qty);
StringBuilder outline = new StringBuilder();
outline.Append("<td>");
if (_myChar._Char_Type.ToUpper() != "GARRISON")
{
if (_myitem._Fly_Capacity > 0)
{
outline.Append("fly " + (_myitem._Fly_Capacity * _qty).ToString("N0"));
}
else
{
if (_myitem._Ride_Capacity > 0)
{
outline.Append("ride " + (_myitem._Ride_Capacity * _qty).ToString("N0"));
}
else
{
if (_myitem._Land_Capacity > 0)
{
outline.Append("cap " + (_myitem._Land_Capacity * _qty).ToString("N0"));
}
}
}
if (Itemz.Is_Fighter(_myitem))
{
outline.AppendFormat(" ({0},{1},{2})", _myitem._IT_Attack, _myitem._IT_Defense, _myitem._IT_Missile);
}
outline.Append(_myitem._IM_Attack_Bonus > 0 ? ("+" + _myitem._IM_Attack_Bonus + " attack") : "");
outline.Append(_myitem._IM_Defense_Bonus > 0 ? ("+" + _myitem._IM_Defense_Bonus + " defense") : "");
outline.Append(_myitem._IM_Missile_Bonus > 0 ? ("+" + _myitem._IM_Missile_Bonus + " missile") : "");
if (Character.Is_Magician(_myChar) && _myitem._IM_Aura_Bonus > 0)
{
outline.AppendFormat("+{0} aura)", _myitem._IM_Aura_Bonus);
}
outline.Append(" </td>");
w.WriteLine(outline);
}
else
{
w.WriteLine("<td>" + "undefined" + "</td>");
w.WriteLine("<td>" + 0 + "</td>");
w.WriteLine("<td> </td>");
}
w.WriteLine("</tr>");
}
}
if (_myChar._Char_Type.ToUpper() != "GARRISON")
{
w.WriteLine("<tr><td></td><td></td><td style=\"text-align:right\">=====</td><td> </td></tr>");
w.WriteLine("<tr><td></td><td></td><td style=\"text-align:right\">" + total_weight.ToString("N0") + "</td><td> </td></tr>");
}
w.WriteLine("</table>");
}
else
{
w.WriteLine("<p>" + _myChar._Name + " [" + _myChar._CharId + "] has no possessions.</p>");
}
}
private static void Write_Char_Skills_Known(Character _myChar, StreamWriter w, List<Skill> _skills)
{
if (_myChar._CH_Skills_List != null)
{
int iterations = _myChar._CH_Skills_List.Count() / 5;
bool printKnown = false;
bool printUnknown = false;
for (int i = 0; i < iterations; i++)
{
int _skill = _myChar._CH_Skills_List[(i * 5) + 0];
int _know = _myChar._CH_Skills_List[(i * 5) + 1];
int _days_studied = _myChar._CH_Skills_List[(i * 5) + 2];
if (_know == 2)
{
if (!printKnown)
{
w.WriteLine("<p>Skills known:</p>");
w.WriteLine("<ul style=\"list-style-type:none\">");
printKnown = true;
}
if (_skills.Find(x => x._SkillId == _skill) != null)
{
Skill _myskill = _skills.Find(x => x._SkillId == _skill);
w.WriteLine("<li>" + (_myskill._SK_Required_Skill != 0 ? " " : "") + _myskill._Name + " [" + _myskill._SkillId + "]</li>");
}
}
if (_know == 1)
{
if (!printUnknown)
{
if (printKnown)
{
w.WriteLine("</ul>");
}
w.WriteLine("<p>Partially known skills:</p>");
w.WriteLine("<ul style=\"list-style-type:none\">");
printUnknown = true;
}
if (_skills.Find(x => x._SkillId == _skill) != null)
{
Skill _myskill = _skills.Find(x => x._SkillId == _skill);
w.WriteLine("<li>" + _myskill._Name + " [" + _myskill._SkillId + "], {0}/{1}</li>", _days_studied, _myskill._SK_Time_to_learn);
}
}
}
if (printKnown || printUnknown)
{
w.WriteLine("</ul>");
}
}
}
private static void Write_Char_Prisoners(Character _myChar, StreamWriter w, List<Character> _characters)
{
List<Character> prisoner_list = _characters.FindAll(x => x._LI_Where == _myChar._CharId && x._CH_Prisoner == 1);
if (prisoner_list.Count > 0)
{
string label = "Prisoner:";
if (prisoner_list.Count > 1)
{
label = "Prisoners:";
}
foreach (Character _myprisoner in prisoner_list)
{
w.WriteLine("<tr>");
w.WriteLine("<td>" + label + "</td>");
label = "";
w.WriteLine("<td>" + _myprisoner._Name + " " + Utilities.Format_Anchor(_myprisoner._CharId.ToString()) + ", health " + _myprisoner._CH_Health + "</td>");
w.WriteLine("</tr>");
}
}
}
private static void Write_Char_Aura(Character _myChar, StreamWriter w, List<Itemz> _items)
{
if (_myChar._CM_Magician == 1)
{
if (_myChar._CM_Cur_Aura != 0)
{
w.WriteLine("<tr><td>Current Aura:</td><td>" + _myChar._CM_Cur_Aura + "</td></tr>");
}
if (_myChar._CM_Auraculum != null)
{
int AuraculumAura = _items.Find(x=>x._ItemId == _myChar._CM_Auraculum[0])._IM_Aura;
w.WriteLine("<tr><td>Max Aura:</td><td>" + (_myChar._CM_Max_Aura + AuraculumAura) + " (" + _myChar._CM_Max_Aura + " + " + AuraculumAura + ")</td></tr>");
}
else
{
w.WriteLine("<tr><td>Max Aura:</td><td>" + (_myChar._CM_Max_Aura) + "</td></tr>");
}
}
}
private static void Write_Char_Concealed(Character _myChar, StreamWriter w, List<Character> _characters, List<Itemz> _items, List<Location> _locations, List<Ship> _ships)
{
if (_myChar._CM_Hide_Self == 1)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Concealed:</td>");
w.WriteLine("<td>{0}</td>", Character.ReallyHidden(_myChar, _characters, _items, _locations, _ships) == true ? "Yes" : "Yes, but not alone");
w.WriteLine("</tr>");
}
}
private static void Write_Char_Pledged_To_Us(Character _myChar, StreamWriter w, List<Character> _characters)
{
List<Character> _pledgedlist = _characters.FindAll(x => x._CM_Pledged_To == _myChar._CharId);
if (_pledgedlist.Count > 0)
{
string pledgelabel = "Pledged to us:";
foreach (Character _pledgechar in _pledgedlist)
{
w.WriteLine("<tr>");
w.WriteLine("<td>" + pledgelabel + "</td>");
pledgelabel = " ";
w.WriteLine("<td>" + _pledgechar._Name + " " + Utilities.Format_Anchor(_pledgechar._CharId.ToString()) + " </td>");
w.WriteLine("</tr>");
}
}
}
private static void Write_Char_Pledged_To(Character _myChar, StreamWriter w, List<Character> _characters)
{
if (_myChar._CM_Pledged_To != 0)
{
Character _mychar2 = _characters.Find(x => x._CharId == _myChar._CM_Pledged_To);
if (_mychar2 != null)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Pledged to:</td>");
w.WriteLine("<td>" + _mychar2._Name + " " + Utilities.Format_Anchor(_mychar2._CharId.ToString()) + " </td>");
w.WriteLine("</tr>");
}
}
}
private static void Write_Char_Break_Point(Character _myChar, StreamWriter w)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Break Point:</td>");
w.WriteLine("<td>" + _myChar._CH_Break_Point + (_myChar._CH_Break_Point.Equals(0) ? "% (fight to the death)" : "%") + " </td>");
w.WriteLine("</tr>");
// vision protection
if (_myChar._CM_Vision_Protect != 0)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Receive Vision:</td>");
w.WriteLine("<td>" + _myChar._CM_Vision_Protect + " protection" + " </td>");
w.WriteLine("</tr>");
}
}
private static void Write_Char_Combat(Character _myChar, StreamWriter w)
{
StringBuilder outline = new StringBuilder();
w.WriteLine("<tr>");
w.WriteLine("<td>Combat:</td>");
outline.Append("<td>");
outline.Append("attack " + _myChar._CH_Attack);
outline.Append(", defense " + _myChar._CH_Defense);
outline.Append(", missile " + _myChar._CH_Missile);
outline.Append("</td>");
outline.Append("</tr>");
w.WriteLine(outline);
outline.Clear();
w.WriteLine("<tr>");
outline.Append("<td> </td>");
outline.Append("<td>");
outline.Append("behind " + _myChar._CH_Behind);
outline.Append(_myChar._CH_Behind.Equals(0) ? " (front line in combat)" : " (stay behind in combat)");
outline.Append("</td>");
w.WriteLine("</tr>");
w.WriteLine(outline);
}
private static void Write_Char_Health(Character _myChar, StreamWriter w)
{
StringBuilder outline = new StringBuilder();
outline.Append("<tr>");
outline.Append("<td>Health:</td>");
outline.Append("<td>");
outline.Append(_myChar._CH_Health + "%");
if (_myChar._CH_Health < 100)
{
outline.Append(_myChar._CH_Sick.Equals(1) ? " (getting worse)":" (getting better)");
}
outline.Append("</td>");
outline.Append("</tr>");
w.WriteLine(outline);
}
private static void Write_Char_Stacked_Over(Character _myChar, StreamWriter w, List<Character> _characters)
{
if (_myChar._LI_Here_List != null)
{
StringBuilder outline2 = new StringBuilder();
StringBuilder outline3 = new StringBuilder();
outline2.Append("Stacked Over:");
foreach (int _stacked_under in _myChar._LI_Here_List)
{
if (_characters.Find(x => x._CharId == _stacked_under) != null)
{
Character _mychar_over = _characters.Find(x => x._CharId == _stacked_under);
if (_mychar_over._Char_Type == "0")
{
outline2.Append("<br>");
outline3.Append(_mychar_over._Name + " " + Utilities.Format_Anchor(_mychar_over._CharId.ToString()) + "<br>");
}
}
}
w.WriteLine("<tr><td>" + outline2 + "</td><td>" + outline3 + "</td></tr>");
}
}
private static void Write_Char_Stacked_Under(Character _myChar, StreamWriter w, List<Character> _characters)
{
if (_characters.Find(x => x._CharId == Convert.ToInt32(_myChar._LI_Where)) != null)
{
Character _mychar_under = _characters.Find(x => x._CharId == Convert.ToInt32(_myChar._LI_Where));
if (_mychar_under._Char_Type == "0")
{
w.WriteLine("<tr>");
w.WriteLine("<td>Stacked Under:</td>");
w.WriteLine("<td>" + _mychar_under._Name + " " + Utilities.Format_Anchor(_mychar_under._CharId.ToString()) + "</td>");
w.WriteLine("</tr>");
}
}
}
private static void Write_Char_Loyalty(Character _myChar, StreamWriter w)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Loyalty:</td>");
w.WriteLine("<td>" + Utilities.Xlate_Loyalty(_myChar._CH_LOY_Kind, _myChar._CH_LOY_Rate) + "</td>");
w.WriteLine("</tr>");
}
private static void Write_Char_Rank(Character _myChar, StreamWriter w)
{
w.WriteLine("<tr>");
w.WriteLine("<td>Rank:</td>");
w.WriteLine("<td>" + Utilities.Xlate_Rank(_myChar._CH_Rank) + "</td>");
w.WriteLine("</tr>");
}
private static void Write_Char_Location(Character _myChar, StreamWriter w, List<Character> _characters, List<Location> _locations, List<Ship> _ships)
{
// location
StringBuilder outline = new StringBuilder();
w.WriteLine("<tr>");
w.WriteLine("<td>Location:</td>");
outline.Append("<td>");
Location _myloc = _locations.Find(x => x._LocId == Convert.ToInt32(_myChar._LI_Where));
if (_myloc != null)
{
Determine_Char_Location(outline, _myloc, _locations);
}
else
{
Character _mychar2 = _characters.Find(x => x._CharId == Convert.ToInt32(_myChar._LI_Where));
if (_mychar2 != null)
{
Location _myloca = _locations.Find(x => x._LocId == Convert.ToInt32(_mychar2._LI_Where));
if (_myloca != null)
{
Determine_Char_Location(outline, _myloca, _locations);
}
}
else
{
Ship _myship = _ships.Find(x => x._ShipId == Convert.ToInt32(_myChar._LI_Where));
if (_myship != null)
{
outline.Append(_myship._Name + " " + Utilities.Format_Anchor(_myship._ShipId.ToString()) + ", ");
Location _myloca = _locations.Find(x => x._LocId == _myship._LI_Where);
if (_myloca != null)
{
Determine_Char_Location(outline, _myloca, _locations);
}
}
}
}
outline.Append("</td>");
w.WriteLine(outline);
w.WriteLine("</tr>");
}
public static void Determine_Char_Location(StringBuilder outline, Location _myloc, List<Location> _locations)
{
outline.Append(_myloc._Name + " " + Utilities.Format_Anchor(_myloc._LocId_Conv));
if (_locations.Find(x => x._LocId == _myloc._LI_Where) != null)
{
Location _myloc2 = _locations.Find(x => x._LocId == _myloc._LI_Where);
if (_myloc2._Loc_Type != "region")
{
outline.Append(", in " + _myloc2._Name + " " + Utilities.Format_Anchor(_myloc2._LocId_Conv));
if (_locations.Find(x => x._LocId == _myloc2._LI_Where) != null)
{
Location _myloc3 = _locations.Find(x => x._LocId == _myloc2._LI_Where);
if (_myloc3._Loc_Type != "region")
{
outline.Append(", in " + _myloc3._Name + " " + Utilities.Format_Anchor(_myloc3._LocId_Conv));
if (_locations.Find(x => x._LocId == _myloc3._LI_Where) != null)
{
Location _myloc4 = _locations.Find(x => x._LocId == _myloc3._LI_Where);
if (_myloc4._Loc_Type != "region")
{
outline.Append(", in " + _myloc4._Name + " " + Utilities.Format_Anchor(_myloc4._LocId_Conv));
}
else
{
outline.Append(", in " + _myloc4._Name);
}
}
}
else
{
outline.Append(", in " + _myloc3._Name);
}
}
}
else
{
outline.Append(", in " + _myloc2._Name);
}
}
}
private static void Write_Visions_Received(Character _myChar, StreamWriter w, List<Character> _characters)
{
if (_myChar._CM_Already_Visioned != null)
{
if (_myChar._CM_Already_Visioned.Count > 0)
{
w.WriteLine("<p>Visions Received:</p>");
w.WriteLine("<table>");
int rows = (int)((_myChar._CM_Already_Visioned.Count / 2) + 0.5);
for (int i = 0; i < rows; i++)
{
w.WriteLine("<tr>");
Character mycharl = _characters.Find(x=>x._CharId == _myChar._CM_Already_Visioned[i]);
if (mycharl != null)
{
w.WriteLine("<td>{0} {1}</td>", mycharl._Name, Utilities.Format_Anchor(mycharl._CharId.ToString()));
}
else
{
w.WriteLine("<td>missing {0}</td>", _myChar._CM_Already_Visioned[i]);
}
if ((i + rows) <= _myChar._CM_Already_Visioned.Count)
{
Character mycharr = _characters.Find(x => x._CharId == _myChar._CM_Already_Visioned[i + rows]);
if (mycharr != null)
{
w.WriteLine("<td>{0} {1}</td>", mycharr._Name, Utilities.Format_Anchor(mycharr._CharId.ToString()));
}
else
{
w.WriteLine("<td>missing {0}</td>", _myChar._CM_Already_Visioned[i]);
}
}
else
{
w.WriteLine("<td> </td>");
}
w.WriteLine("</tr>");
}
w.WriteLine("</table>");
}
}
}
}
}