-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form_Monster.cs
838 lines (777 loc) · 33 KB
/
Form_Monster.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
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
/*******************************************************************************
*
* Space Trader for Windows 1.00
*
* Copyright (C) 2016 Keith Banner, All Rights Reserved
*
* Port to Windows by David Pierron & Jay French
* Original coding by Pieter Spronck, Sam Anderson, Samuel Goldstein, Matt Lee
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* If you'd like a copy of the GNU General Public License, go to
* http://www.gnu.org/copyleft/gpl.html.
*
* You can contact the author at [email protected]
*
******************************************************************************/
using System;
using System.Collections;
using System.Windows.Forms;
namespace SpaceTrader
{
public class FormMonster : System.Windows.Forms.Form
{
#region Constants
private const int SplitSystems = 31;
#endregion
#region Control Declarations
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Panel pnlMercs;
private System.Windows.Forms.Panel pnlQuests;
private System.Windows.Forms.Panel pnlShipyards;
private System.Windows.Forms.PictureBox picLine1;
private System.Windows.Forms.PictureBox picLine0;
private System.Windows.Forms.PictureBox picLine2;
private System.Windows.Forms.Label lblMercLabel;
private System.Windows.Forms.Label lblQuestsLabel;
private System.Windows.Forms.Label lblShipyardsLabel;
private System.Windows.Forms.LinkLabel lblMercIDLabel;
private System.Windows.Forms.LinkLabel lblMercNameLabel;
private System.Windows.Forms.LinkLabel lblMercSkillLabelPilot;
private System.Windows.Forms.LinkLabel lblMercSkillLabelFighter;
private System.Windows.Forms.LinkLabel lblMercSkillLabelTrader;
private System.Windows.Forms.LinkLabel lblMercSkillLabelEngineer;
private System.Windows.Forms.LinkLabel lblMercSystemLabel;
private System.Windows.Forms.LinkLabel lblQuestSystemLabel;
private System.Windows.Forms.LinkLabel lblQuestDescLabel;
private System.Windows.Forms.LinkLabel lblShipyardsSystemLabel;
private System.Windows.Forms.LinkLabel lblShipyardsDescLabel;
private System.Windows.Forms.Label lblMercIds;
private System.Windows.Forms.Label lblMercNames;
private System.Windows.Forms.Label lblMercSkillsPilot;
private System.Windows.Forms.Label lblMercSkillsFighter;
private System.Windows.Forms.Label lblMercSkillsTrader;
private System.Windows.Forms.Label lblMercSkillsEngineer;
private System.Windows.Forms.LinkLabel lblMercSystems;
private System.Windows.Forms.LinkLabel lblMercSystems2;
private System.Windows.Forms.LinkLabel lblQuestSystems;
private System.Windows.Forms.Label lblQuests;
private System.Windows.Forms.LinkLabel lblShipyardSystems;
private System.Windows.Forms.Label lblShipyards;
private System.ComponentModel.Container components = null;
#endregion
#region Member Declarations
private Game game = Game.CurrentGame;
private int[] mercIds;
private int[] questSystemIds;
private int[] shipyardSystemIds;
#endregion
#region Methods
public FormMonster()
{
InitializeComponent();
PopulateIdArrays();
SetLabelHeights();
UpdateAll();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
components.Dispose();
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnClose = new System.Windows.Forms.Button();
this.picLine1 = new System.Windows.Forms.PictureBox();
this.picLine0 = new System.Windows.Forms.PictureBox();
this.lblQuestsLabel = new System.Windows.Forms.Label();
this.lblMercLabel = new System.Windows.Forms.Label();
this.lblMercSkillLabelPilot = new System.Windows.Forms.LinkLabel();
this.lblMercSkillLabelFighter = new System.Windows.Forms.LinkLabel();
this.lblMercSkillLabelTrader = new System.Windows.Forms.LinkLabel();
this.lblMercSkillLabelEngineer = new System.Windows.Forms.LinkLabel();
this.lblMercSystemLabel = new System.Windows.Forms.LinkLabel();
this.lblQuestSystemLabel = new System.Windows.Forms.LinkLabel();
this.lblQuestDescLabel = new System.Windows.Forms.LinkLabel();
this.lblMercIDLabel = new System.Windows.Forms.LinkLabel();
this.lblMercNameLabel = new System.Windows.Forms.LinkLabel();
this.lblShipyardsDescLabel = new System.Windows.Forms.LinkLabel();
this.lblShipyardsSystemLabel = new System.Windows.Forms.LinkLabel();
this.lblShipyardsLabel = new System.Windows.Forms.Label();
this.pnlMercs = new System.Windows.Forms.Panel();
this.lblMercSkillsPilot = new System.Windows.Forms.Label();
this.lblMercSkillsFighter = new System.Windows.Forms.Label();
this.lblMercSkillsTrader = new System.Windows.Forms.Label();
this.lblMercSkillsEngineer = new System.Windows.Forms.Label();
this.lblMercSystems = new System.Windows.Forms.LinkLabel();
this.lblMercIds = new System.Windows.Forms.Label();
this.lblMercNames = new System.Windows.Forms.Label();
this.lblMercSystems2 = new System.Windows.Forms.LinkLabel();
this.pnlQuests = new System.Windows.Forms.Panel();
this.lblQuests = new System.Windows.Forms.Label();
this.lblQuestSystems = new System.Windows.Forms.LinkLabel();
this.pnlShipyards = new System.Windows.Forms.Panel();
this.lblShipyards = new System.Windows.Forms.Label();
this.lblShipyardSystems = new System.Windows.Forms.LinkLabel();
this.picLine2 = new System.Windows.Forms.PictureBox();
this.pnlMercs.SuspendLayout();
this.pnlQuests.SuspendLayout();
this.pnlShipyards.SuspendLayout();
this.SuspendLayout();
//
// btnClose
//
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Location = new System.Drawing.Point(-32, -32);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(32, 32);
this.btnClose.TabIndex = 32;
this.btnClose.TabStop = false;
this.btnClose.Text = "X";
//
// picLine1
//
this.picLine1.BackColor = System.Drawing.Color.DimGray;
this.picLine1.Location = new System.Drawing.Point(4, 40);
this.picLine1.Name = "picLine1";
this.picLine1.Size = new System.Drawing.Size(609, 1);
this.picLine1.TabIndex = 133;
this.picLine1.TabStop = false;
//
// picLine0
//
this.picLine0.BackColor = System.Drawing.Color.DimGray;
this.picLine0.Location = new System.Drawing.Point(234, 8);
this.picLine0.Name = "picLine0";
this.picLine0.Size = new System.Drawing.Size(1, 347);
this.picLine0.TabIndex = 132;
this.picLine0.TabStop = false;
//
// lblQuestsLabel
//
this.lblQuestsLabel.AutoSize = true;
this.lblQuestsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblQuestsLabel.Location = new System.Drawing.Point(88, 4);
this.lblQuestsLabel.Name = "lblQuestsLabel";
this.lblQuestsLabel.Size = new System.Drawing.Size(50, 19);
this.lblQuestsLabel.TabIndex = 134;
this.lblQuestsLabel.Text = "Quests";
//
// lblMercLabel
//
this.lblMercLabel.AutoSize = true;
this.lblMercLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercLabel.Location = new System.Drawing.Point(348, 4);
this.lblMercLabel.Name = "lblMercLabel";
this.lblMercLabel.Size = new System.Drawing.Size(84, 19);
this.lblMercLabel.TabIndex = 141;
this.lblMercLabel.Text = "Mercenaries";
//
// lblMercSkillLabelPilot
//
this.lblMercSkillLabelPilot.AutoSize = true;
this.lblMercSkillLabelPilot.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercSkillLabelPilot.Location = new System.Drawing.Point(341, 24);
this.lblMercSkillLabelPilot.Name = "lblMercSkillLabelPilot";
this.lblMercSkillLabelPilot.Size = new System.Drawing.Size(12, 16);
this.lblMercSkillLabelPilot.TabIndex = 7;
this.lblMercSkillLabelPilot.TabStop = true;
this.lblMercSkillLabelPilot.Text = "P";
this.lblMercSkillLabelPilot.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblMercSkillLabelPilot.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblMercSkillLabelFighter
//
this.lblMercSkillLabelFighter.AutoSize = true;
this.lblMercSkillLabelFighter.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercSkillLabelFighter.Location = new System.Drawing.Point(362, 24);
this.lblMercSkillLabelFighter.Name = "lblMercSkillLabelFighter";
this.lblMercSkillLabelFighter.Size = new System.Drawing.Size(11, 16);
this.lblMercSkillLabelFighter.TabIndex = 8;
this.lblMercSkillLabelFighter.TabStop = true;
this.lblMercSkillLabelFighter.Text = "F";
this.lblMercSkillLabelFighter.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblMercSkillLabelFighter.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblMercSkillLabelTrader
//
this.lblMercSkillLabelTrader.AutoSize = true;
this.lblMercSkillLabelTrader.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercSkillLabelTrader.Location = new System.Drawing.Point(382, 24);
this.lblMercSkillLabelTrader.Name = "lblMercSkillLabelTrader";
this.lblMercSkillLabelTrader.Size = new System.Drawing.Size(11, 16);
this.lblMercSkillLabelTrader.TabIndex = 9;
this.lblMercSkillLabelTrader.TabStop = true;
this.lblMercSkillLabelTrader.Text = "T";
this.lblMercSkillLabelTrader.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblMercSkillLabelTrader.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblMercSkillLabelEngineer
//
this.lblMercSkillLabelEngineer.AutoSize = true;
this.lblMercSkillLabelEngineer.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercSkillLabelEngineer.Location = new System.Drawing.Point(401, 24);
this.lblMercSkillLabelEngineer.Name = "lblMercSkillLabelEngineer";
this.lblMercSkillLabelEngineer.Size = new System.Drawing.Size(12, 16);
this.lblMercSkillLabelEngineer.TabIndex = 10;
this.lblMercSkillLabelEngineer.TabStop = true;
this.lblMercSkillLabelEngineer.Text = "E";
this.lblMercSkillLabelEngineer.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblMercSkillLabelEngineer.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblMercSystemLabel
//
this.lblMercSystemLabel.AutoSize = true;
this.lblMercSystemLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercSystemLabel.Location = new System.Drawing.Point(425, 24);
this.lblMercSystemLabel.Name = "lblMercSystemLabel";
this.lblMercSystemLabel.Size = new System.Drawing.Size(43, 16);
this.lblMercSystemLabel.TabIndex = 11;
this.lblMercSystemLabel.TabStop = true;
this.lblMercSystemLabel.Text = "System";
this.lblMercSystemLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblQuestSystemLabel
//
this.lblQuestSystemLabel.AutoSize = true;
this.lblQuestSystemLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblQuestSystemLabel.Location = new System.Drawing.Point(13, 24);
this.lblQuestSystemLabel.Name = "lblQuestSystemLabel";
this.lblQuestSystemLabel.Size = new System.Drawing.Size(43, 16);
this.lblQuestSystemLabel.TabIndex = 1;
this.lblQuestSystemLabel.TabStop = true;
this.lblQuestSystemLabel.Text = "System";
this.lblQuestSystemLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblQuestDescLabel
//
this.lblQuestDescLabel.AutoSize = true;
this.lblQuestDescLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblQuestDescLabel.Location = new System.Drawing.Point(85, 24);
this.lblQuestDescLabel.Name = "lblQuestDescLabel";
this.lblQuestDescLabel.Size = new System.Drawing.Size(63, 16);
this.lblQuestDescLabel.TabIndex = 2;
this.lblQuestDescLabel.TabStop = true;
this.lblQuestDescLabel.Text = "Description";
this.lblQuestDescLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblMercIDLabel
//
this.lblMercIDLabel.AutoSize = true;
this.lblMercIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercIDLabel.Location = new System.Drawing.Point(247, 24);
this.lblMercIDLabel.Name = "lblMercIDLabel";
this.lblMercIDLabel.Size = new System.Drawing.Size(16, 16);
this.lblMercIDLabel.TabIndex = 5;
this.lblMercIDLabel.TabStop = true;
this.lblMercIDLabel.Text = "ID";
this.lblMercIDLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.lblMercIDLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblMercNameLabel
//
this.lblMercNameLabel.AutoSize = true;
this.lblMercNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblMercNameLabel.Location = new System.Drawing.Point(268, 24);
this.lblMercNameLabel.Name = "lblMercNameLabel";
this.lblMercNameLabel.Size = new System.Drawing.Size(35, 16);
this.lblMercNameLabel.TabIndex = 6;
this.lblMercNameLabel.TabStop = true;
this.lblMercNameLabel.Text = "Name";
this.lblMercNameLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblShipyardsDescLabel
//
this.lblShipyardsDescLabel.AutoSize = true;
this.lblShipyardsDescLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblShipyardsDescLabel.Location = new System.Drawing.Point(85, 258);
this.lblShipyardsDescLabel.Name = "lblShipyardsDescLabel";
this.lblShipyardsDescLabel.Size = new System.Drawing.Size(63, 16);
this.lblShipyardsDescLabel.TabIndex = 4;
this.lblShipyardsDescLabel.TabStop = true;
this.lblShipyardsDescLabel.Text = "Description";
this.lblShipyardsDescLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblShipyardsSystemLabel
//
this.lblShipyardsSystemLabel.AutoSize = true;
this.lblShipyardsSystemLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblShipyardsSystemLabel.Location = new System.Drawing.Point(13, 258);
this.lblShipyardsSystemLabel.Name = "lblShipyardsSystemLabel";
this.lblShipyardsSystemLabel.Size = new System.Drawing.Size(43, 16);
this.lblShipyardsSystemLabel.TabIndex = 3;
this.lblShipyardsSystemLabel.TabStop = true;
this.lblShipyardsSystemLabel.Text = "System";
this.lblShipyardsSystemLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SortLinkClicked);
//
// lblShipyardsLabel
//
this.lblShipyardsLabel.AutoSize = true;
this.lblShipyardsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblShipyardsLabel.Location = new System.Drawing.Point(79, 238);
this.lblShipyardsLabel.Name = "lblShipyardsLabel";
this.lblShipyardsLabel.Size = new System.Drawing.Size(68, 19);
this.lblShipyardsLabel.TabIndex = 155;
this.lblShipyardsLabel.Text = "Shipyards";
//
// pnlMercs
//
this.pnlMercs.AutoScroll = true;
this.pnlMercs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlMercs.Controls.Add(this.lblMercSkillsPilot);
this.pnlMercs.Controls.Add(this.lblMercSkillsFighter);
this.pnlMercs.Controls.Add(this.lblMercSkillsTrader);
this.pnlMercs.Controls.Add(this.lblMercSkillsEngineer);
this.pnlMercs.Controls.Add(this.lblMercSystems);
this.pnlMercs.Controls.Add(this.lblMercIds);
this.pnlMercs.Controls.Add(this.lblMercNames);
this.pnlMercs.Controls.Add(this.lblMercSystems2);
this.pnlMercs.Location = new System.Drawing.Point(239, 44);
this.pnlMercs.Name = "pnlMercs";
this.pnlMercs.Size = new System.Drawing.Size(371, 307);
this.pnlMercs.TabIndex = 158;
//
// lblMercSkillsPilot
//
this.lblMercSkillsPilot.Location = new System.Drawing.Point(93, 4);
this.lblMercSkillsPilot.Name = "lblMercSkillsPilot";
this.lblMercSkillsPilot.Size = new System.Drawing.Size(20, 563);
this.lblMercSkillsPilot.TabIndex = 144;
this.lblMercSkillsPilot.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblMercSkillsFighter
//
this.lblMercSkillsFighter.Location = new System.Drawing.Point(113, 4);
this.lblMercSkillsFighter.Name = "lblMercSkillsFighter";
this.lblMercSkillsFighter.Size = new System.Drawing.Size(20, 563);
this.lblMercSkillsFighter.TabIndex = 145;
this.lblMercSkillsFighter.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblMercSkillsTrader
//
this.lblMercSkillsTrader.Location = new System.Drawing.Point(133, 4);
this.lblMercSkillsTrader.Name = "lblMercSkillsTrader";
this.lblMercSkillsTrader.Size = new System.Drawing.Size(20, 563);
this.lblMercSkillsTrader.TabIndex = 146;
this.lblMercSkillsTrader.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblMercSkillsEngineer
//
this.lblMercSkillsEngineer.Location = new System.Drawing.Point(153, 4);
this.lblMercSkillsEngineer.Name = "lblMercSkillsEngineer";
this.lblMercSkillsEngineer.Size = new System.Drawing.Size(20, 563);
this.lblMercSkillsEngineer.TabIndex = 147;
this.lblMercSkillsEngineer.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblMercSystems
//
this.lblMercSystems.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
this.lblMercSystems.Location = new System.Drawing.Point(185, 4);
this.lblMercSystems.Name = "lblMercSystems";
this.lblMercSystems.Size = new System.Drawing.Size(160, 387);
this.lblMercSystems.TabIndex = 14;
this.lblMercSystems.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SystemLinkClicked);
//
// lblMercIds
//
this.lblMercIds.Location = new System.Drawing.Point(0, 4);
this.lblMercIds.Name = "lblMercIds";
this.lblMercIds.Size = new System.Drawing.Size(23, 563);
this.lblMercIds.TabIndex = 142;
this.lblMercIds.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblMercNames
//
this.lblMercNames.Location = new System.Drawing.Point(28, 4);
this.lblMercNames.Name = "lblMercNames";
this.lblMercNames.Size = new System.Drawing.Size(69, 563);
this.lblMercNames.TabIndex = 141;
//
// lblMercSystems2
//
this.lblMercSystems2.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
this.lblMercSystems2.Location = new System.Drawing.Point(185, 391);
this.lblMercSystems2.Name = "lblMercSystems2";
this.lblMercSystems2.Size = new System.Drawing.Size(160, 175);
this.lblMercSystems2.TabIndex = 148;
this.lblMercSystems2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SystemLinkClicked);
//
// pnlQuests
//
this.pnlQuests.AutoScroll = true;
this.pnlQuests.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlQuests.Controls.Add(this.lblQuests);
this.pnlQuests.Controls.Add(this.lblQuestSystems);
this.pnlQuests.Location = new System.Drawing.Point(8, 44);
this.pnlQuests.Name = "pnlQuests";
this.pnlQuests.Size = new System.Drawing.Size(222, 182);
this.pnlQuests.TabIndex = 159;
//
// lblQuests
//
this.lblQuests.Location = new System.Drawing.Point(76, 4);
this.lblQuests.Name = "lblQuests";
this.lblQuests.Size = new System.Drawing.Size(120, 350);
this.lblQuests.TabIndex = 48;
//
// lblQuestSystems
//
this.lblQuestSystems.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
this.lblQuestSystems.Location = new System.Drawing.Point(4, 4);
this.lblQuestSystems.Name = "lblQuestSystems";
this.lblQuestSystems.Size = new System.Drawing.Size(68, 350);
this.lblQuestSystems.TabIndex = 12;
this.lblQuestSystems.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SystemLinkClicked);
//
// pnlShipyards
//
this.pnlShipyards.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlShipyards.Controls.Add(this.lblShipyards);
this.pnlShipyards.Controls.Add(this.lblShipyardSystems);
this.pnlShipyards.Location = new System.Drawing.Point(8, 278);
this.pnlShipyards.Name = "pnlShipyards";
this.pnlShipyards.Size = new System.Drawing.Size(222, 73);
this.pnlShipyards.TabIndex = 160;
//
// lblShipyards
//
this.lblShipyards.Location = new System.Drawing.Point(76, 4);
this.lblShipyards.Name = "lblShipyards";
this.lblShipyards.Size = new System.Drawing.Size(120, 63);
this.lblShipyards.TabIndex = 158;
//
// lblShipyardSystems
//
this.lblShipyardSystems.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
this.lblShipyardSystems.Location = new System.Drawing.Point(4, 4);
this.lblShipyardSystems.Name = "lblShipyardSystems";
this.lblShipyardSystems.Size = new System.Drawing.Size(68, 63);
this.lblShipyardSystems.TabIndex = 13;
this.lblShipyardSystems.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SystemLinkClicked);
//
// picLine2
//
this.picLine2.BackColor = System.Drawing.Color.DimGray;
this.picLine2.Location = new System.Drawing.Point(4, 274);
this.picLine2.Name = "picLine2";
this.picLine2.Size = new System.Drawing.Size(222, 1);
this.picLine2.TabIndex = 161;
this.picLine2.TabStop = false;
//
// FormMonster
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.btnClose;
this.ClientSize = new System.Drawing.Size(617, 358);
this.Controls.Add(this.picLine2);
this.Controls.Add(this.pnlShipyards);
this.Controls.Add(this.pnlQuests);
this.Controls.Add(this.picLine1);
this.Controls.Add(this.picLine0);
this.Controls.Add(this.pnlMercs);
this.Controls.Add(this.lblShipyardsLabel);
this.Controls.Add(this.lblShipyardsDescLabel);
this.Controls.Add(this.lblShipyardsSystemLabel);
this.Controls.Add(this.lblMercNameLabel);
this.Controls.Add(this.lblMercIDLabel);
this.Controls.Add(this.lblQuestDescLabel);
this.Controls.Add(this.lblQuestSystemLabel);
this.Controls.Add(this.lblMercSystemLabel);
this.Controls.Add(this.lblMercSkillLabelEngineer);
this.Controls.Add(this.lblMercSkillLabelTrader);
this.Controls.Add(this.lblMercSkillLabelFighter);
this.Controls.Add(this.lblMercSkillLabelPilot);
this.Controls.Add(this.lblMercLabel);
this.Controls.Add(this.lblQuestsLabel);
this.Controls.Add(this.btnClose);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormMonster";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Monster.com Job Listing";
this.pnlMercs.ResumeLayout(false);
this.pnlQuests.ResumeLayout(false);
this.pnlShipyards.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private int Compare(int a, int b, string sortWhat, string sortBy)
{
int compareVal = 0;
if (sortWhat == "M") // Mercenaries
{
CrewMember A = game.Mercenaries[a];
CrewMember B = game.Mercenaries[b];
bool strCompare = false;
object valA = null;
object valB = null;
switch (sortBy)
{
case "I": // Id
valA = (int)A.Id;
valB = (int)B.Id;
break;
case "N": // Name
valA = A.Name;
valB = B.Name;
strCompare = true;
break;
case "P": // Pilot
valA = A.Pilot;
valB = B.Pilot;
break;
case "F": // Fighter
valA = A.Fighter;
valB = B.Fighter;
break;
case "T": // Trader
valA = A.Trader;
valB = B.Trader;
break;
case "E": // Engineer
valA = A.Engineer;
valB = B.Engineer;
break;
case "S": // System
valA = CurrentSystemDisplay(A);
valB = CurrentSystemDisplay(B);
strCompare = true;
break;
}
if (strCompare)
compareVal = ((string)valA).CompareTo((string)valB);
else
compareVal = ((int)valA).CompareTo(valB);
// Secondary sort by Name
if (compareVal == 0 && sortBy != "N")
compareVal = A.Name.CompareTo(B.Name);
}
else
{
StarSystem A = game.Universe[a];
StarSystem B = game.Universe[b];
if (sortBy == "D") // Description
{
string nameA = "";
string nameB = "";
switch (sortWhat)
{
case "Q": // Quests
nameA = A.SpecialEvent.Title;
nameB = B.SpecialEvent.Title;
break;
case "S": // Shipyards
nameA = A.Shipyard.Name;
nameB = B.Shipyard.Name;
break;
}
compareVal = nameA.CompareTo(nameB);
}
if (compareVal == 0) // Default sort - System Name
{
compareVal = A.Name.CompareTo(B.Name);
}
}
return compareVal;
}
private string CurrentSystemDisplay(CrewMember merc)
{
return (merc.CurrentSystem == null ? Strings.Unknown : (game.Commander.Ship.HasCrew(merc.Id) ?
Functions.StringVars(Strings.MercOnBoard, merc.CurrentSystem.Name) : merc.CurrentSystem.Name));
}
private void PopulateIdArrays()
{
// Populate the mercenary ids array.
ArrayList ids = new ArrayList();
foreach (CrewMember merc in game.Mercenaries)
{
if (!Consts.SpecialCrewMemberIds.Contains(merc.Id))
ids.Add((int)merc.Id);
}
mercIds = (int[])ids.ToArray(System.Type.GetType("System.Int32"));
// Populate the quest and shipyard system ids arrays.
ArrayList quests = new ArrayList();
ArrayList shipyards = new ArrayList();
foreach (StarSystem system in game.Universe)
{
if (system.ShowSpecialButton())
quests.Add((int)system.Id);
if (system.ShipyardId != ShipyardId.Na)
shipyards.Add((int)system.Id);
}
questSystemIds = (int[])quests.ToArray(System.Type.GetType("System.Int32"));
shipyardSystemIds = (int[])shipyards.ToArray(System.Type.GetType("System.Int32"));
// Sort the arrays.
Sort("M", "N"); // Sort mercenaries by name.
Sort("Q", "S"); // Sort quests by system name.
Sort("S", "S"); // Sort shipyards by system name.
}
private void SetLabelHeights()
{
lblQuests.Height =
lblQuestSystems.Height = (int)Math.Ceiling(questSystemIds.Length * 12.5) + 1;
lblShipyards.Height =
lblShipyardSystems.Height = (int)Math.Ceiling(shipyardSystemIds.Length * 12.5) + 1;
lblMercIds.Height =
lblMercNames.Height =
lblMercSkillsPilot.Height =
lblMercSkillsFighter.Height =
lblMercSkillsTrader.Height =
lblMercSkillsEngineer.Height = (int)Math.Ceiling(mercIds.Length * 12.5) + 1;
// Due to a limitation of the LinkLabel control, no more than 32 links can exist in the LinkLabel.
lblMercSystems.Height = (int)Math.Ceiling(Math.Min(mercIds.Length, SplitSystems) * 12.5) + 1;
if (mercIds.Length > SplitSystems)
{
lblMercSystems2.Visible = true;
lblMercSystems2.Height = (int)Math.Ceiling((mercIds.Length - SplitSystems) * 12.5) + 1;
}
else
{
lblMercSystems2.Visible = false;
lblMercSystems2.Top = lblMercSystems.Top;
}
}
private void Sort(string sortWhat, string sortBy)
{
int[] array = null;
switch (sortWhat)
{
case "M":
array = mercIds;
break;
case "Q":
array = questSystemIds;
break;
case "S":
array = shipyardSystemIds;
break;
}
for (int i = 0; i < array.Length - 1; i++)
{
for (int j = 0; j < array.Length - i - 1; j++)
{
if (Compare(array[j], array[j + 1], sortWhat, sortBy) > 0)
{
int temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
}
private void UpdateAll()
{
UpdateMercs();
UpdateQuests();
UpdateShipyards();
}
private void UpdateMercs()
{
lblMercIds.Text = "";
lblMercNames.Text = "";
lblMercSkillsPilot.Text = "";
lblMercSkillsFighter.Text = "";
lblMercSkillsTrader.Text = "";
lblMercSkillsEngineer.Text = "";
lblMercSystems.Text = "";
lblMercSystems2.Text = "";
lblMercSystems.Links.Clear();
lblMercSystems2.Links.Clear();
for (int i = 0; i < mercIds.Length; i++)
{
CrewMember merc = game.Mercenaries[mercIds[i]];
bool link = merc.CurrentSystem != null && !game.Commander.Ship.HasCrew(merc.Id);
lblMercIds.Text += ((int)merc.Id).ToString() + Environment.NewLine;
lblMercNames.Text += merc.Name + Environment.NewLine;
lblMercSkillsPilot.Text += merc.Pilot.ToString() + Environment.NewLine;
lblMercSkillsFighter.Text += merc.Fighter.ToString() + Environment.NewLine;
lblMercSkillsTrader.Text += merc.Trader.ToString() + Environment.NewLine;
lblMercSkillsEngineer.Text += merc.Engineer.ToString() + Environment.NewLine;
if (i < SplitSystems)
{
int start = lblMercSystems.Text.Length;
lblMercSystems.Text += CurrentSystemDisplay(merc) + Environment.NewLine;
if (link)
lblMercSystems.Links.Add(start, merc.CurrentSystem.Name.Length, merc.CurrentSystem.Name);
}
else
{
int start = lblMercSystems2.Text.Length;
lblMercSystems2.Text += CurrentSystemDisplay(merc) + Environment.NewLine;
if (link)
lblMercSystems2.Links.Add(start, merc.CurrentSystem.Name.Length, merc.CurrentSystem.Name);
}
}
lblMercIds.Text = lblMercIds.Text.Trim();
lblMercNames.Text = lblMercNames.Text.Trim();
lblMercSkillsPilot.Text = lblMercSkillsPilot.Text.Trim();
lblMercSkillsFighter.Text = lblMercSkillsFighter.Text.Trim();
lblMercSkillsTrader.Text = lblMercSkillsTrader.Text.Trim();
lblMercSkillsEngineer.Text = lblMercSkillsEngineer.Text.Trim();
lblMercSystems.Text = lblMercSystems.Text.Trim();
lblMercSystems2.Text = lblMercSystems2.Text.Trim();
}
private void UpdateQuests()
{
lblQuestSystems.Text = "";
lblQuests.Text = "";
lblQuestSystems.Links.Clear();
for (int i = 0; i < questSystemIds.Length; i++)
{
StarSystem system = game.Universe[questSystemIds[i]];
int start = lblQuestSystems.Text.Length;
lblQuestSystems.Text += system.Name + Environment.NewLine;
lblQuests.Text += system.SpecialEvent.Title + Environment.NewLine;
lblQuestSystems.Links.Add(start, system.Name.Length, system.Name);
}
lblQuestSystems.Text = lblQuestSystems.Text.Trim();
lblQuests.Text = lblQuests.Text.Trim();
}
private void UpdateShipyards()
{
lblShipyardSystems.Text = "";
lblShipyards.Text = "";
lblShipyardSystems.Links.Clear();
for (int i = 0; i < shipyardSystemIds.Length; i++)
{
StarSystem system = game.Universe[shipyardSystemIds[i]];
int start = lblShipyardSystems.Text.Length;
lblShipyardSystems.Text += system.Name + Environment.NewLine;
lblShipyards.Text += system.Shipyard.Name + Environment.NewLine;
lblShipyardSystems.Links.Add(start, system.Name.Length, system.Name);
}
lblShipyardSystems.Text = lblShipyardSystems.Text.Trim();
lblShipyards.Text = lblShipyards.Text.Trim();
}
#endregion
#region Event Handlers
private void SystemLinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
Game.CurrentGame.SelectedSystemName = e.Link.LinkData.ToString();
Game.CurrentGame.ParentWindow.UpdateAll();
Close();
}
private void SortLinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
Sort(((LinkLabel)sender).Name.Substring(3, 1), ((LinkLabel)sender).Text.Substring(0, 1));
UpdateAll();
}
#endregion
}
}