-
Notifications
You must be signed in to change notification settings - Fork 0
/
ManufacturingFacility.vb
4383 lines (3710 loc) · 220 KB
/
ManufacturingFacility.vb
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
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.Data.SQLite
Public Class ManufacturingFacility
Private SelectedFacility As IndustryFacility ' This is the active facility for the control, if not loaded will use the default
Private SelectedView As FacilityView
Private SelectedLocation As ProgramLocation
Private SelectedCharacterID As Long
Private SelectedProductionType As ProductionType
Private SelectedControlForm As Form ' Where the control lives
Private SelectedBPTech As Integer
Private SelectedBPID As Integer
Private SelectedBPGroupID As Integer
Private SelectedBPCategoryID As Integer
' To check if we are loading and stop click events when changing values
Private LoadingActivities As Boolean
Private LoadingFacilityTypes As Boolean
Private LoadingRegions As Boolean
Private LoadingSystems As Boolean
Private LoadingFacilities As Boolean
Private ChangingUsageChecks As Boolean
' To save previous values for checking and loading
Private PreviousProductionType As ProductionType
Private PreviousFacilityType As FacilityTypes
Private PreviousRegion As String
Private PreviousSystem As String
Private PreviousEquipment As String
Private PreviousActivity As String
' Loaded variables
Private FacilityRegionsLoaded As Boolean
Private FacilitySystemsLoaded As Boolean
Private FacilityorArrayLoaded As Boolean
Private UpdatingManualBoxes As Boolean
' Save these options here in the facility and allow functions to get the values publically
Private FacilityIncludeCopyCost As Boolean
Private FacilityIncludeCopyTime As Boolean
Private FacilityIncludeInventionCost As Boolean
Private FacilityIncludeInventionTime As Boolean
' All locally saved facility variables will be here
Private SelectedManufacturingFacility As New IndustryFacility
Private SelectedComponentManufacturingFacility As New IndustryFacility
Private SelectedCapitalComponentManufacturingFacility As New IndustryFacility
Private SelectedCapitalManufacturingFacility As New IndustryFacility
Private SelectedSuperManufacturingFacility As New IndustryFacility
Private SelectedT3CruiserManufacturingFacility As New IndustryFacility
Private SelectedT3DestroyerManufacturingFacility As New IndustryFacility
Private SelectedSubsystemManufacturingFacility As New IndustryFacility
Private SelectedBoosterManufacturingFacility As New IndustryFacility
Private SelectedInventionFacility As New IndustryFacility
Private SelectedT3InventionFacility As New IndustryFacility
Private SelectedCopyFacility As New IndustryFacility
Private SelectedReactionsFacility As New IndustryFacility
' Special cases for POS Facilities where items can be produced at more than one array
Private SelectedPOSFuelBlockFacility As New IndustryFacility
Private SelectedPOSLargeShipFacility As New IndustryFacility
Private SelectedPOSModuleFacility As New IndustryFacility
' Save the default data for checking if the selected facility is a default and quick reference
Private DefaultPOSFuelBlockFacility As New IndustryFacility
Private DefaultPOSLargeShipFacility As New IndustryFacility
Private DefaultPOSModuleFacility As New IndustryFacility
Private DefaultManufacturingFacility As New IndustryFacility
Private DefaultComponentManufacturingFacility As New IndustryFacility
Private DefaultCapitalComponentManufacturingFacility As New IndustryFacility
Private DefaultCapitalManufacturingFacility As New IndustryFacility
Private DefaultSuperManufacturingFacility As New IndustryFacility
Private DefaultT3CruiserManufacturingFacility As New IndustryFacility
Private DefaultT3DestroyerManufacturingFacility As New IndustryFacility
Private DefaultSubsystemManufacturingFacility As New IndustryFacility
Private DefaultBoosterManufacturingFacility As New IndustryFacility
Private DefaultInventionFacility As New IndustryFacility
Private DefaultT3InventionFacility As New IndustryFacility
Private DefaultCopyFacility As New IndustryFacility
Private DefaultReactionsFacility As New IndustryFacility
' Constant activities
Public Const ActivityManufacturing As String = "Manufacturing"
Public Const ActivityComponentManufacturing As String = "Component Manufacturing"
Public Const ActivityCapComponentManufacturing As String = "Cap Component Manufacturing"
Public Const ActivityCopying As String = "Copying"
Public Const ActivityInvention As String = "Invention"
Public Const ActivityReactions As String = "Reactions"
' For verifying activity and facility type combos selected something
Private Const InitialTypeComboText = "Select Type"
Private Const InitialActivityComboText = "Select Activity"
Private Const InitialRegionComboText = "Select Region"
Private Const InitialSolarSystemComboText = "Select System"
Private Const InitialFacilityComboText = "Select Facility"
Public Const POSFacility As String = "POS"
Public Const StationFacility As String = "Station"
Public Const StructureFacility As String = "Structure"
Private FactionCitadelList As New List(Of Integer)
Private FacilityLabelDefaultColor As Color = SystemColors.Highlight
Private FacilityLabelNonDefaultColor As Color = SystemColors.ButtonShadow
Public Sub New()
FirstLoad = True
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
' Hide everything until constructed with the options sent
cmbFacilityActivities.Visible = False
lblFacilityActivity.Visible = False
lblFacilityUsage.Visible = False
chkFacilityToggle.Visible = False
lblFacilityFWUpgrade.Visible = False
cmbFacilityFWUpgrade.Visible = False
txtFacilityManualCost.Visible = False
lblFacilityManualCost.Visible = False
btnFacilityFitting.Visible = False
txtFacilityManualTax.Visible = False
lblFacilityManualTax.Visible = False
btnFacilitySave.Visible = False
txtFacilityManualTE.Visible = False
txtFacilityManualME.Visible = False
lblFacilityManualTE.Visible = False
lblFacilityManualME.Visible = False
lblInclude.Visible = False
chkFacilityIncludeUsage.Visible = False
chkFacilityIncludeTime.Visible = False
lblFacilityDefault.Visible = False
chkFacilityIncludeCost.Visible = False
cmbFacilityorArray.Visible = False
cmbFacilitySystem.Visible = False
cmbFacilityRegion.Visible = False
lblFacilityLocation.Visible = False
lblFacilityType.Visible = False
cmbFacilityType.Visible = False
cmbLargeShips.Visible = False
lblLargeShips.Visible = False
cmbFuelBlocks.Visible = False
lblFuelBlocks.Visible = False
cmbModules.Visible = False
lblModules.Visible = False
UpdatingManualBoxes = False
' For checking facilities later - will remove if we can get locations from ESI
FactionCitadelList.Add(47512) ' Moreau Fortizar
FactionCitadelList.Add(47513) ' Draccous Fortizar
FactionCitadelList.Add(47514) ' Horizion Fortizar
FactionCitadelList.Add(47515) ' Marginis Fortizar
FactionCitadelList.Add(47516) ' Prometheus Fortizar
FirstLoad = False
SelectedFacility = New IndustryFacility
End Sub
' Before any controls are shown, the control needs to be initilaized by sending the view type.
Public Sub InitializeControl(ByVal ViewType As FacilityView, ByVal SentSelectedCharacterID As Long, FormLocation As ProgramLocation,
ByVal InitialProductionType As ProductionType, ByRef ControlForm As Form)
Const SolarSystemWidthBP As Integer = 142
Const SolarSystemWidthCalc As Integer = 157
Const RegionWidthBP As Integer = 130
Const RegionWidthCalc As Integer = 133
Const FacilityArrayWidthBP As Integer = 274
Const FacilityArrayWidthCalc As Integer = 295
Const LeftObjectLocation As Integer = 3
Const LeftLabelLocation As Integer = 1
Const DefaultLabelWidthBP As Integer = 48
Const DefaultLabelHeightBP As Integer = 34
' Save for later
SelectedView = ViewType
SelectedLocation = FormLocation
SelectedProductionType = InitialProductionType
SelectedCharacterID = SentSelectedCharacterID
SelectedControlForm = ControlForm
' Move and show the selected controls depending on the view sent
Select Case ViewType
Case FacilityView.FullControls
lblFacilityActivity.Top = 2
lblFacilityActivity.Left = LeftLabelLocation
lblFacilityActivity.Visible = True
cmbFacilityActivities.Top = lblFacilityActivity.Top + lblFacilityActivity.Height + 1
cmbFacilityActivities.Left = LeftObjectLocation
cmbFacilityActivities.Visible = True
cmbFacilityActivities.Text = InitialActivityComboText
lblFacilityType.Top = 1
lblFacilityType.Left = cmbFacilityActivities.Left + cmbFacilityActivities.Width
lblFacilityType.Visible = True
cmbFacilityType.Top = cmbFacilityActivities.Top
cmbFacilityType.Left = cmbFacilityActivities.Left + cmbFacilityActivities.Width + 2
cmbFacilityType.Visible = True
cmbFacilityType.Text = InitialTypeComboText
lblFacilityDefault.Height = DefaultLabelHeightBP
lblFacilityDefault.Width = DefaultLabelWidthBP
Call lblFacilityDefault.SendToBack()
lblFacilityDefault.Top = lblFacilityType.Top + 5
lblFacilityDefault.Left = cmbFacilityType.Left + cmbFacilityType.Width - 2
lblFacilityDefault.Visible = True
lblFacilityLocation.Top = cmbFacilityActivities.Top + cmbFacilityActivities.Height + 3
lblFacilityLocation.Left = LeftLabelLocation
lblFacilityLocation.Visible = True
chkFacilityIncludeUsage.Top = lblFacilityLocation.Top - 1
chkFacilityIncludeUsage.Left = lblFacilityLocation.Left + lblFacilityLocation.Width + 27
chkFacilityIncludeUsage.Text = "Usage:"
chkFacilityIncludeUsage.Visible = True
lblFacilityUsage.Top = chkFacilityIncludeUsage.Top - 1
lblFacilityUsage.Left = chkFacilityIncludeUsage.Left + chkFacilityIncludeUsage.Width - 4
lblFacilityUsage.Width = SolarSystemWidthBP
lblFacilityUsage.Visible = True
cmbFacilityRegion.Top = lblFacilityLocation.Top + lblFacilityLocation.Height + 3
cmbFacilityRegion.Left = LeftObjectLocation
cmbFacilityRegion.Width = RegionWidthBP
cmbFacilityRegion.Text = InitialRegionComboText
cmbFacilityRegion.Visible = True
cmbFacilitySystem.Top = cmbFacilityRegion.Top
cmbFacilitySystem.Left = cmbFacilityRegion.Left + cmbFacilityRegion.Width + 2
cmbFacilitySystem.Width = SolarSystemWidthBP
cmbFacilitySystem.Text = InitialSolarSystemComboText
cmbFacilitySystem.Visible = True
cmbFacilityorArray.Top = cmbFacilityRegion.Top + cmbFacilityRegion.Height + 1
cmbFacilityorArray.Left = LeftObjectLocation
cmbFacilityorArray.Width = FacilityArrayWidthBP
cmbFacilityorArray.Text = InitialFacilityComboText
cmbFacilityorArray.Visible = True
btnFacilitySave.Top = cmbFacilityorArray.Top + cmbFacilityorArray.Height
btnFacilitySave.Left = (cmbFacilityorArray.Left + cmbFacilityorArray.Width) - btnFacilitySave.Width + 1
btnFacilitySave.Visible = True
btnFacilitySave.Enabled = False
btnFacilityFitting.Top = btnFacilitySave.Top
btnFacilityFitting.Left = btnFacilitySave.Left - (btnFacilityFitting.Width + 2)
btnFacilityFitting.Visible = False
btnFacilityFitting.Enabled = False
' Load all the manual lables and text
lblFacilityManualME.Top = cmbFacilityorArray.Top + cmbFacilityorArray.Height + 4
lblFacilityManualME.Left = LeftLabelLocation
lblFacilityManualME.Text = "ME:"
lblFacilityManualME.Visible = True
txtFacilityManualME.Top = cmbFacilityorArray.Top + cmbFacilityorArray.Height + 1
txtFacilityManualME.Left = lblFacilityManualME.Left + lblFacilityManualME.Width
txtFacilityManualME.Visible = True
lblFacilityManualCost.Top = lblFacilityManualME.Top + lblFacilityManualME.Height + 7
lblFacilityManualCost.Left = LeftLabelLocation
lblFacilityManualCost.Text = "Cost:"
lblFacilityManualCost.Visible = True
txtFacilityManualCost.Top = txtFacilityManualME.Top + txtFacilityManualME.Height + 1
txtFacilityManualCost.Left = lblFacilityManualCost.Left + lblFacilityManualCost.Width
txtFacilityManualCost.Visible = True
' Reset manual ME so it aligns with cost box
txtFacilityManualME.Left = txtFacilityManualCost.Left
lblFacilityManualTE.Top = lblFacilityManualME.Top
lblFacilityManualTE.Left = txtFacilityManualME.Left + txtFacilityManualME.Width + 3
lblFacilityManualTE.Text = "TE:"
lblFacilityManualTE.Visible = True
txtFacilityManualTE.Top = txtFacilityManualME.Top
txtFacilityManualTE.Left = lblFacilityManualTE.Left + lblFacilityManualTE.Width
txtFacilityManualTE.Visible = True
lblFacilityManualTax.Top = lblFacilityManualCost.Top
lblFacilityManualTax.Left = txtFacilityManualCost.Left + txtFacilityManualCost.Width + 3
lblFacilityManualTax.Text = "Tax:"
lblFacilityManualTax.Visible = True
txtFacilityManualTax.Top = txtFacilityManualCost.Top
txtFacilityManualTax.Left = lblFacilityManualTax.Left + lblFacilityManualTax.Width
txtFacilityManualTax.Visible = True
txtFacilityManualTE.Left = txtFacilityManualTax.Left
cmbFacilityFWUpgrade.Top = btnFacilitySave.Top + btnFacilitySave.Height
cmbFacilityFWUpgrade.Left = (cmbFacilityorArray.Left + cmbFacilityorArray.Width) - cmbFacilityFWUpgrade.Width
cmbFacilityFWUpgrade.Visible = False
lblFacilityFWUpgrade.Height = 30
lblFacilityFWUpgrade.Width = 51
lblFacilityFWUpgrade.Top = (cmbFacilityFWUpgrade.Top + cmbFacilityFWUpgrade.Height) - lblFacilityFWUpgrade.Height
lblFacilityFWUpgrade.Left = cmbFacilityFWUpgrade.Left - lblFacilityFWUpgrade.Width
lblFacilityFWUpgrade.Visible = False
Call lblFacilityFWUpgrade.SendToBack()
' Set initial settings to load
SelectedBPCategoryID = ItemIDs.ShipCategoryID
SelectedBPGroupID = ItemIDs.FrigateGroupID
SelectedBPTech = BPTechLevel.T1
' Load all the facilities for full controls tab
Call InitializeFacilities(FacilityView.FullControls)
Case FacilityView.LimitedControls
cmbFacilityActivities.Visible = False
lblFacilityType.Top = 5
lblFacilityType.Left = 0
lblFacilityType.Visible = True
cmbFacilityType.Top = lblFacilityType.Top - 2
cmbFacilityType.Left = lblFacilityType.Width + 2
cmbFacilityType.Visible = True
cmbFacilityType.Text = InitialTypeComboText
chkFacilityToggle.Top = lblFacilityType.Top - 2
chkFacilityToggle.Left = cmbFacilityType.Left + cmbFacilityType.Width + 5
chkFacilityIncludeUsage.Visible = True
chkFacilityIncludeUsage.Left = chkFacilityToggle.Left
chkFacilityIncludeUsage.Top = chkFacilityToggle.Top + chkFacilityToggle.Height - 1
chkFacilityIncludeUsage.Text = "Include Usage"
chkFacilityIncludeTime.Visible = False
chkFacilityIncludeCost.Visible = False
lblInclude.Visible = False
Select Case InitialProductionType
Case ProductionType.CapitalComponentManufacturing, ProductionType.ComponentManufacturing
chkFacilityToggle.Visible = True
chkFacilityToggle.Text = "Cap Parts"
If InitialProductionType = ProductionType.CapitalComponentManufacturing Then
chkFacilityToggle.Checked = True
End If
Case ProductionType.T3DestroyerManufacturing, ProductionType.T3CruiserManufacturing
chkFacilityToggle.Visible = True
chkFacilityToggle.Text = "Destroyers"
If InitialProductionType = ProductionType.T3DestroyerManufacturing Then
chkFacilityToggle.Checked = True
End If
Case ProductionType.Invention, ProductionType.T3Invention, ProductionType.Copying
chkFacilityIncludeUsage.Text = "Usage"
lblInclude.Top = lblFacilityType.Top
lblInclude.Left = chkFacilityIncludeUsage.Left - 2
lblInclude.Visible = True
chkFacilityIncludeCost.Top = chkFacilityIncludeUsage.Top
chkFacilityIncludeCost.Left = chkFacilityIncludeUsage.Left + chkFacilityIncludeUsage.Width
chkFacilityIncludeCost.Visible = True
chkFacilityIncludeTime.Top = chkFacilityIncludeUsage.Top
chkFacilityIncludeTime.Left = chkFacilityIncludeCost.Left + chkFacilityIncludeCost.Width
chkFacilityIncludeTime.Visible = True
Case Else
chkFacilityToggle.Visible = False
End Select
lblFacilityLocation.Visible = True
lblFacilityLocation.Left = 0
lblFacilityLocation.Top = chkFacilityIncludeUsage.Top + 2
cmbFacilityRegion.Left = LeftObjectLocation
cmbFacilityRegion.Top = lblFacilityLocation.Top + lblFacilityLocation.Height + 2
cmbFacilityRegion.Text = InitialRegionComboText
cmbFacilityRegion.Width = RegionWidthCalc
cmbFacilityRegion.Visible = True
cmbFacilitySystem.Top = cmbFacilityRegion.Top
cmbFacilitySystem.Left = chkFacilityIncludeUsage.Left
cmbFacilitySystem.Width = SolarSystemWidthCalc
cmbFacilitySystem.Text = InitialSolarSystemComboText
cmbFacilitySystem.Visible = True
cmbFacilityorArray.Top = cmbFacilityRegion.Top + cmbFacilityRegion.Height + 1
cmbFacilityorArray.Left = LeftObjectLocation
cmbFacilityorArray.Width = FacilityArrayWidthCalc
cmbFacilityorArray.Text = InitialFacilityComboText
cmbFacilityorArray.Visible = True
lblFacilityDefault.Visible = True
lblFacilityDefault.Top = chkFacilityToggle.Top
lblFacilityDefault.Left = (cmbFacilityorArray.Left + cmbFacilityorArray.Width) - lblFacilityDefault.Width
Call lblFacilityDefault.SendToBack()
btnFacilitySave.Top = cmbFacilityorArray.Top + cmbFacilityorArray.Height + 2
btnFacilitySave.Left = (cmbFacilityorArray.Left + cmbFacilityorArray.Width) - btnFacilitySave.Width + 1
btnFacilitySave.Visible = True
btnFacilitySave.Enabled = False
btnFacilityFitting.Top = btnFacilitySave.Top
btnFacilityFitting.Left = btnFacilitySave.Left - (btnFacilityFitting.Width + 2)
btnFacilityFitting.Visible = False
btnFacilityFitting.Enabled = False
' Manual text boxes and labels
lblFacilityManualME.Top = btnFacilitySave.Top + 6
lblFacilityManualME.Left = LeftLabelLocation
lblFacilityManualME.Text = "ME:"
lblFacilityManualME.Visible = False
txtFacilityManualME.Top = btnFacilitySave.Top + 2
txtFacilityManualME.Left = lblFacilityManualME.Left + lblFacilityManualME.Width
txtFacilityManualME.Visible = False
lblFacilityManualCost.Top = lblFacilityManualME.Top + lblFacilityManualME.Height + 7
lblFacilityManualCost.Left = LeftLabelLocation
lblFacilityManualCost.Text = "Cost:"
lblFacilityManualCost.Visible = False
txtFacilityManualCost.Top = txtFacilityManualME.Top + txtFacilityManualME.Height + 1
txtFacilityManualCost.Left = lblFacilityManualCost.Left + lblFacilityManualCost.Width
txtFacilityManualCost.Visible = False
' Reset manual ME so it aligns with cost box
txtFacilityManualME.Left = txtFacilityManualCost.Left
lblFacilityManualTE.Top = lblFacilityManualME.Top
lblFacilityManualTE.Left = txtFacilityManualME.Left + txtFacilityManualME.Width + 3
lblFacilityManualTE.Text = "TE:"
lblFacilityManualTE.Visible = False
txtFacilityManualTE.Top = txtFacilityManualME.Top
txtFacilityManualTE.Left = lblFacilityManualTE.Left + lblFacilityManualTE.Width
txtFacilityManualTE.Visible = False
lblFacilityManualTax.Top = lblFacilityManualCost.Top
lblFacilityManualTax.Left = txtFacilityManualCost.Left + txtFacilityManualCost.Width + 3
lblFacilityManualTax.Text = "Tax:"
lblFacilityManualTax.Visible = False
txtFacilityManualTax.Top = txtFacilityManualCost.Top
txtFacilityManualTax.Left = lblFacilityManualTax.Left + lblFacilityManualTax.Width
txtFacilityManualTax.Visible = False
txtFacilityManualTE.Left = txtFacilityManualTax.Left
' Visible will be set later
cmbFacilityFWUpgrade.Top = btnFacilitySave.Top + btnFacilitySave.Height + 4
cmbFacilityFWUpgrade.Left = (cmbFacilityorArray.Left + cmbFacilityorArray.Width) - cmbFacilityFWUpgrade.Width
cmbFacilityFWUpgrade.Visible = False
lblFacilityFWUpgrade.Height = 13
lblFacilityFWUpgrade.Width = 71
lblFacilityFWUpgrade.Top = cmbFacilityFWUpgrade.Top + 4
lblFacilityFWUpgrade.Left = cmbFacilityFWUpgrade.Left - lblFacilityFWUpgrade.Width
lblFacilityFWUpgrade.Visible = False
Call lblFacilityFWUpgrade.SendToBack()
' Position these but they will be shown later
lblModules.Top = cmbFacilityorArray.Top
lblModules.Left = 0
lblModules.Visible = False
Call lblModules.SendToBack()
cmbModules.Top = lblModules.Top + lblModules.Height - 3
cmbModules.Left = cmbFacilityRegion.Left
cmbModules.Visible = False
cmbFuelBlocks.Top = cmbModules.Top
cmbFuelBlocks.Left = cmbModules.Left + cmbModules.Width + 2
cmbFuelBlocks.Visible = False
cmbLargeShips.Top = cmbModules.Top + cmbModules.Height + 1
cmbLargeShips.Left = cmbModules.Left + cmbModules.Width + 2
cmbLargeShips.Visible = False
lblFuelBlocks.Top = cmbFuelBlocks.Top - lblFuelBlocks.Height - 1
lblFuelBlocks.Left = cmbFuelBlocks.Left - 2
lblFuelBlocks.Visible = False
lblLargeShips.Left = lblModules.Left
lblLargeShips.Top = lblFacilityFWUpgrade.Top
lblLargeShips.Visible = False
' Set the initial group/category IDs
' also set the activity combo text to show what type of activity this facility is, even if not visible
Call GetFacilityBPItemData(InitialProductionType, SelectedBPGroupID, SelectedBPCategoryID, SelectedBPTech, cmbFacilityActivities.Text)
' Load the defaults
Call InitializeFacilities(FacilityView.LimitedControls, InitialProductionType)
Case Else
' Leave, no valid option sent
Exit Sub
End Select
End Sub
' Loads all the facilities for the view type sent to include defaults
Public Sub InitializeFacilities(ViewType As FacilityView, Optional InitialProductionType As ProductionType = ProductionType.Manufacturing,
Optional RefreshSelectedOnly As Boolean = False)
If ViewType = FacilityView.FullControls And Not RefreshSelectedOnly Then
' Load all the facilities for tab - always start with manufacturing
Call SelectedFacility.InitalizeFacility(ProductionType.Manufacturing, ViewType, SelectedControlForm)
SelectedManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.ComponentManufacturing, ViewType, SelectedControlForm)
SelectedComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.CapitalComponentManufacturing, ViewType, SelectedControlForm)
SelectedCapitalComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCapitalComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.CapitalManufacturing, ViewType, SelectedControlForm)
SelectedCapitalManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCapitalManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.SuperManufacturing, ViewType, SelectedControlForm)
SelectedSuperManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultSuperManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.T3CruiserManufacturing, ViewType, SelectedControlForm)
SelectedT3CruiserManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3CruiserManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.SubsystemManufacturing, ViewType, SelectedControlForm)
SelectedSubsystemManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultSubsystemManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.BoosterManufacturing, ViewType, SelectedControlForm)
SelectedBoosterManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultBoosterManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.Copying, ViewType, SelectedControlForm)
SelectedCopyFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCopyFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.Invention, ViewType, SelectedControlForm)
SelectedInventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultInventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.Reactions, ViewType, SelectedControlForm)
SelectedReactionsFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultReactionsFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.T3Invention, ViewType, SelectedControlForm)
SelectedT3InventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3InventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.T3DestroyerManufacturing, ViewType, SelectedControlForm)
SelectedT3DestroyerManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3DestroyerManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
' POS Facilities
Call SelectedFacility.InitalizeFacility(ProductionType.POSFuelBlockManufacturing, ViewType, SelectedControlForm)
SelectedPOSFuelBlockFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultPOSFuelBlockFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.POSLargeShipManufacturing, ViewType, SelectedControlForm)
SelectedPOSLargeShipFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultPOSLargeShipFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.POSModuleManufacturing, ViewType, SelectedControlForm)
SelectedPOSModuleFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultPOSModuleFacility = CType(SelectedFacility.Clone, IndustryFacility)
ElseIf ViewType = FacilityView.LimitedControls Or RefreshSelectedOnly Then
' Load these if they will be used in manufacturing
If InitialProductionType = ProductionType.Manufacturing Then
Call SelectedFacility.InitalizeFacility(ProductionType.POSFuelBlockManufacturing, ViewType, SelectedControlForm)
SelectedPOSFuelBlockFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultPOSFuelBlockFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.POSLargeShipManufacturing, ViewType, SelectedControlForm)
SelectedPOSLargeShipFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultPOSLargeShipFacility = CType(SelectedFacility.Clone, IndustryFacility)
Call SelectedFacility.InitalizeFacility(ProductionType.POSModuleManufacturing, ViewType, SelectedControlForm)
SelectedPOSModuleFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultPOSModuleFacility = CType(SelectedFacility.Clone, IndustryFacility)
End If
' Select what facility to load based on the industry type
Call SelectedFacility.InitalizeFacility(InitialProductionType, ViewType, SelectedControlForm)
Call SetSelectedFacility(InitialProductionType, ViewType)
Else
' Leave, no valid option sent
Exit Sub
End If
' Reset these
' To save previous values for checking and loading
PreviousProductionType = ProductionType.None
PreviousFacilityType = FacilityTypes.None
PreviousRegion = ""
PreviousSystem = ""
PreviousEquipment = ""
PreviousActivity = ""
' Loaded variables
FacilityRegionsLoaded = False
FacilitySystemsLoaded = False
FacilityorArrayLoaded = False
LoadingActivities = False
LoadingFacilityTypes = False
LoadingRegions = False
LoadingSystems = False
LoadingFacilities = False
ChangingUsageChecks = False
' Load the selected facility with set bp
Call LoadFacility(SelectedBPID, SelectedBPGroupID, SelectedBPCategoryID, SelectedBPTech, True)
End Sub
Public Sub SetSelectedFacility(BuildType As ProductionType, ViewType As FacilityView, Optional LoadDualFacilities As Boolean = True)
'Now save the default and selected facility to the appropriate variable
Select Case BuildType
Case ProductionType.Manufacturing
SelectedManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.CapitalComponentManufacturing
SelectedCapitalComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCapitalComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
If LoadDualFacilities Then
' Load component too so we can click back and forth
Call SelectedFacility.InitalizeFacility(ProductionType.ComponentManufacturing, ViewType, SelectedControlForm)
SelectedComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
End If
Case ProductionType.ComponentManufacturing
SelectedComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
If LoadDualFacilities Then
' Load cap component too so we can click back and forth
Call SelectedFacility.InitalizeFacility(ProductionType.CapitalComponentManufacturing, ViewType, SelectedControlForm)
SelectedCapitalComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCapitalComponentManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
End If
Case ProductionType.CapitalManufacturing
SelectedCapitalManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCapitalManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.SuperManufacturing
SelectedSuperManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultSuperManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.T3CruiserManufacturing
SelectedT3CruiserManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3CruiserManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
If LoadDualFacilities Then
' Load T3 destroyers too so we can click back and forth
Call SelectedFacility.InitalizeFacility(ProductionType.T3DestroyerManufacturing, ViewType, SelectedControlForm)
SelectedT3DestroyerManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3DestroyerManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
End If
Case ProductionType.SubsystemManufacturing
SelectedSubsystemManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultSubsystemManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.BoosterManufacturing
SelectedBoosterManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultBoosterManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.Copying
SelectedCopyFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultCopyFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.Invention
SelectedInventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultInventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.Reactions
SelectedReactionsFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultReactionsFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.T3Invention
SelectedT3InventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3InventionFacility = CType(SelectedFacility.Clone, IndustryFacility)
Case ProductionType.T3DestroyerManufacturing
SelectedT3DestroyerManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3DestroyerManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
If LoadDualFacilities Then
' Load T3 cruisers too so we can click back and forth
Call SelectedFacility.InitalizeFacility(ProductionType.T3CruiserManufacturing, ViewType, SelectedControlForm)
SelectedT3CruiserManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
DefaultT3CruiserManufacturingFacility = CType(SelectedFacility.Clone, IndustryFacility)
End If
End Select
End Sub
' Loads the class facility and objects
Public Sub LoadFacility(ByVal ItemBPID As Integer, ByVal ItemGroupID As Integer, ByVal ItemCategoryID As Integer, ByVal BlueprintTech As Integer,
Optional ByVal LoadDefault As Boolean = False, Optional ByVal ActivityComboSelect As Boolean = False, Optional RefreshBP As Boolean = True)
' Save these for later use
SelectedBPID = ItemBPID
SelectedBPCategoryID = ItemCategoryID
SelectedBPGroupID = ItemGroupID
SelectedBPTech = BlueprintTech
' Process the activities combo if showing full controls
If SelectedView = FacilityView.FullControls Then
If Not ActivityComboSelect Then ' only load if from the activities combo
Call LoadFacilityActivities(ItemGroupID, ItemCategoryID, BlueprintTech, SelectedBPID)
End If
PreviousActivity = cmbFacilityActivities.Text
End If
' Get the production type, based on activity selected
SelectedProductionType = GetProductionType(ItemGroupID, ItemCategoryID, cmbFacilityActivities.Text)
Application.DoEvents()
' Look up Facility - activity set to facility inside
SelectedFacility = SelectFacility(SelectedProductionType, LoadDefault)
' Facility Type combo, load it if they want to change
Call LoadFacilityTypes(SelectedProductionType, SelectedFacility.Activity)
' Enable the type of facility and set
LoadingFacilityTypes = True
cmbFacilityType.Enabled = True
cmbFacilityType.Text = GetFacilityNamefromCode(SelectedFacility.FacilityType)
LoadingFacilityTypes = False
If SelectedFacility.FacilityType = FacilityTypes.None Then
' Just hide the boxes and exit
Call SetFacilityBonusBoxes(False)
SelectedFacility.FullyLoaded = True ' Even with none, it's loaded
Call SetNoFacility()
Exit Sub ' Leave, all loaded
End If
' Region name Combo
LoadingRegions = True
cmbFacilityRegion.Enabled = True
cmbFacilityRegion.Text = SelectedFacility.RegionName
LoadingRegions = False
' Systems combo
LoadingSystems = True
cmbFacilitySystem.Enabled = True
cmbFacilitySystem.Text = SelectedFacility.SolarSystemName
LoadingSystems = False
' Facility/Array combo
LoadingFacilities = True
cmbFacilityorArray.Enabled = True
Dim AutoLoad As Boolean = False
Call LoadFacilities(False, SelectedFacility.Activity, AutoLoad, SelectedFacility.FacilityName)
LoadingFacilities = False
' Usage checks
ChangingUsageChecks = True
chkFacilityIncludeUsage.Checked = SelectedFacility.IncludeActivityUsage
chkFacilityIncludeCost.Checked = SelectedFacility.IncludeActivityCost
chkFacilityIncludeTime.Checked = SelectedFacility.IncludeActivityTime
ChangingUsageChecks = False
' Finally show the results and save the facility locally
If Not AutoLoad Then
LoadingFacilities = True
With SelectedFacility
cmbFacilityorArray.Text = .FacilityName
Call DisplayFacilityBonus(.FacilityProductionType, ItemGroupID, ItemCategoryID, SelectedFacility.Activity,
GetFacilityTypeCode(cmbFacilityType.Text), cmbFacilityorArray.Text)
End With
LoadingFacilities = False
End If
Call ResetComboLoadVariables(False, False, False)
' All data loaded
SelectedFacility.FullyLoaded = True
' Facility is loaded, so save it to default and dynamic variable
If LoadDefault Then
Call SetSelectedFacility(SelectedProductionType, SelectedView, False)
End If
Call SetFacility(SelectedFacility, SelectedProductionType, False, False)
' Refresh the blueprint if it's the bp tab
If RefreshBP Then
Call UpdateBlueprint()
End If
End Sub
' Loads the facility activity combo - checks group and category ID's if it has components to set component activities
Public Sub LoadFacilityActivities(BPGroupID As Long, BPCategoryID As Long, BlueprintTech As Integer, BPID As Integer)
LoadingActivities = True
Dim HasComponents As Boolean = False
Dim ActivityText As String = cmbFacilityActivities.Text ' Save what is selected first
cmbFacilityActivities.BeginUpdate()
' If it's a reaction, only load that activity and manufacturing for fuel blocks
If BPGroupID = ItemIDs.ReactionBiochmeicalsGroupID Or BPGroupID = ItemIDs.ReactionCompositesGroupID Or BPGroupID = ItemIDs.ReactionPolymersGroupID Or BPGroupID = ItemIDs.ReactionsIntermediateGroupID Then
cmbFacilityActivities.Items.Clear()
cmbFacilityActivities.Items.Add(ActivityReactions)
cmbFacilityActivities.Items.Add(ActivityManufacturing)
' Start with reactions for a new facility because its a call to load not from combo
cmbFacilityActivities.Text = ActivityReactions
cmbFacilityActivities.EndUpdate()
LoadingActivities = False
Exit Sub
Else
Select Case BlueprintTech
Case BPTechLevel.T1
' Just manufacturing (add components later if there are any)
cmbFacilityActivities.Items.Clear()
cmbFacilityActivities.Items.Add(ActivityManufacturing)
Case BPTechLevel.T2
' Add only T2 activities to equipment
cmbFacilityActivities.Items.Clear()
cmbFacilityActivities.Items.Add(ActivityManufacturing)
cmbFacilityActivities.Items.Add(ActivityCopying)
cmbFacilityActivities.Items.Add(ActivityInvention)
Case BPTechLevel.T3
' Add only T3 activities to eqipment
cmbFacilityActivities.Items.Clear()
cmbFacilityActivities.Items.Add(ActivityManufacturing)
cmbFacilityActivities.Items.Add(ActivityInvention)
End Select
End If
Dim SQL As String
Dim readerBP As SQLiteDataReader
' See if this has buildable components
SQL = "SELECT DISTINCT 'X' FROM ALL_BLUEPRINTS "
SQL &= "WHERE ITEM_ID IN (SELECT MATERIAL_ID FROM ALL_BLUEPRINT_MATERIALS WHERE BLUEPRINT_ID = {0})"
DBCommand = New SQLiteCommand(String.Format(SQL, BPID), EVEDB.DBREf)
readerBP = DBCommand.ExecuteReader
If readerBP.Read Then
HasComponents = True
Else
HasComponents = False
End If
readerBP.Close()
' Add components as a manufacturing facility option if this bp has any
If HasComponents Then
Select Case BPGroupID
Case ItemIDs.TitanGroupID, ItemIDs.DreadnoughtGroupID, ItemIDs.CarrierGroupID, ItemIDs.SupercarrierGroupID, ItemIDs.CapitalIndustrialShipGroupID,
ItemIDs.IndustrialCommandShipGroupID, ItemIDs.FreighterGroupID, ItemIDs.JumpFreighterGroupID, ItemIDs.FAXGroupID
cmbFacilityActivities.Items.Add(ActivityCapComponentManufacturing)
If BPGroupID = ItemIDs.JumpFreighterGroupID Then
' Need to add both cap and components
cmbFacilityActivities.Items.Add(ActivityComponentManufacturing)
End If
Case Else
' Iif it's not a T2 component, then load the component manufacturing activity else it will get a reaction load below
If Not (BPCategoryID = ItemIDs.ComponentCategoryID Or BPGroupID = ItemIDs.AdvCapitalComponentGroupID) Then
' Just regular
cmbFacilityActivities.Items.Add(ActivityComponentManufacturing)
End If
End Select
SQL = ""
If UserApplicationSettings.BuildT2T3Materials = BuildMatType.ProcessedMaterials Then
SQL = "SELECT DISTINCT 'X' FROM ALL_BLUEPRINT_MATERIALS WHERE PRODUCT_ID IN "
SQL &= "(SELECT ITEM_ID FROM ALL_BLUEPRINTS "
SQL &= "WHERE ITEM_ID IN (SELECT MATERIAL_ID FROM ALL_BLUEPRINT_MATERIALS WHERE BLUEPRINT_ID = {0} "
SQL &= "AND MATERIAL_GROUP IN ('Composite')))"
ElseIf UserApplicationSettings.BuildT2T3Materials = BuildMatType.RawMaterials Then
SQL = "SELECT DISTINCT 'X' FROM ALL_BLUEPRINT_MATERIALS WHERE PRODUCT_ID IN "
SQL &= "(SELECT ITEM_ID FROM ALL_BLUEPRINTS WHERE ITEM_ID IN "
SQL &= "(SELECT MATERIAL_ID FROM ALL_BLUEPRINT_MATERIALS WHERE BLUEPRINT_ID = {0} "
SQL &= "AND MATERIAL_GROUP IN ('Composite','Hybrid Polymers','Intermediate Materials','Harvestable Cloud')))"
End If
If SQL <> "" Then
DBCommand = New SQLiteCommand(String.Format(SQL, BPID), EVEDB.DBREf)
readerBP = DBCommand.ExecuteReader
' If they want to drill down on reactions, add the reactions facility option
If readerBP.Read Then
cmbFacilityActivities.Items.Add(ActivityReactions)
End If
readerBP.Close()
End If
End If
cmbFacilityActivities.EndUpdate()
' Set default activity text if it's not in the list
If Not cmbFacilityActivities.Items.Contains(ActivityText) Then
cmbFacilityActivities.Text = ActivityManufacturing
Else
cmbFacilityActivities.Text = ActivityText
End If
LoadingActivities = False
End Sub
Private Sub cmbFacilityActivities_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbFacilityActivities.SelectedIndexChanged
If Not LoadingActivities And Not FirstLoad Then
SelectedProductionType = GetProductionType(SelectedBPGroupID, SelectedBPCategoryID, cmbFacilityActivities.Text)
' If they switch the activity and it changed from the previous, then load the selected facility for this activity
If SelectedProductionType <> PreviousProductionType Then
PreviousProductionType = SelectedProductionType
' Load the facility for this activity and flag that it was loaded from this combo
Call LoadFacility(SelectedBPID, SelectedBPGroupID, SelectedBPCategoryID, SelectedBPTech, False, True)
' Reset all previous to current list, since all the combos should be loaded
PreviousFacilityType = GetFacilityTypeCode(cmbFacilityType.Text)
PreviousEquipment = cmbFacilityorArray.Text
PreviousRegion = cmbFacilityRegion.Text
PreviousSystem = cmbFacilitySystem.Text
End If
' Make sure the usage is updated
Call frmMain.UpdateBPPriceLabels()
Call cmbFacilityType.Focus()
End If
End Sub
Private Sub cmbFacilityActivities_DropDown(sender As Object, e As System.EventArgs) Handles cmbFacilityActivities.DropDown
PreviousActivity = cmbFacilityActivities.Text
End Sub
Private Sub cmbFacilityActivities_GotFocus(sender As Object, e As EventArgs) Handles cmbFacilityActivities.GotFocus
Call cmbFacilityActivities.SelectAll()
End Sub
Private Sub cmbFacilityActivities_LostFocus(sender As Object, e As EventArgs) Handles cmbFacilityActivities.LostFocus
cmbFacilityActivities.SelectionLength = 0
End Sub
Private Sub cmbFacilityActivities_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles cmbFacilityActivities.KeyPress
e.Handled = True
End Sub
' Loads the facility types in the sent combo
Public Sub LoadFacilityTypes(FacilityProductionType As ProductionType, FacilityActivity As String)
Dim Station As String = GetFacilityNamefromCode(FacilityTypes.Station)
Dim POS As String = GetFacilityNamefromCode(FacilityTypes.POS)
Dim UpwellStructure As String = GetFacilityNamefromCode(FacilityTypes.UpwellStructure)
Dim NoneFacility As String = GetFacilityNamefromCode(FacilityTypes.None)
LoadingFacilityTypes = True
LoadingRegions = True
LoadingSystems = True
LoadingFacilities = True
' Clear the types each time for a fresh set of options
cmbFacilityType.Items.Clear()
' Load the facility type options
Select Case FacilityActivity
' Load up None for Invention/RE, Copy - they could buy the BP or T2 BPO
Case ActivityCopying, ActivityInvention
Select Case FacilityProductionType
Case ProductionType.T3Invention
' Can be invented in POS
If POS <> "" Then cmbFacilityType.Items.Add(POS)
If UpwellStructure <> "" Then cmbFacilityType.Items.Add(UpwellStructure)
If NoneFacility <> "" Then cmbFacilityType.Items.Add(NoneFacility)
Case Else
If Station <> "" Then cmbFacilityType.Items.Add(Station)
If POS <> "" Then cmbFacilityType.Items.Add(POS)
If UpwellStructure <> "" Then cmbFacilityType.Items.Add(UpwellStructure)
If NoneFacility <> "" Then cmbFacilityType.Items.Add(NoneFacility)
End Select
Case ActivityManufacturing
Select Case FacilityProductionType
Case ProductionType.SuperManufacturing, ProductionType.SubsystemManufacturing, ProductionType.T3CruiserManufacturing, ProductionType.T3DestroyerManufacturing
' Can be built in and POS and structure
If POS <> "" Then cmbFacilityType.Items.Add(POS)
If UpwellStructure <> "" Then cmbFacilityType.Items.Add(UpwellStructure)
Case Else
' Add all
If Station <> "" Then cmbFacilityType.Items.Add(Station)
If POS <> "" Then cmbFacilityType.Items.Add(POS)
If UpwellStructure <> "" Then cmbFacilityType.Items.Add(UpwellStructure)
End Select
Case ActivityComponentManufacturing, ActivityCapComponentManufacturing
' Can do these anywhere
If Station <> "" Then cmbFacilityType.Items.Add(Station)
If POS <> "" Then cmbFacilityType.Items.Add(POS)
If UpwellStructure <> "" Then cmbFacilityType.Items.Add(UpwellStructure)
Case ActivityReactions
' Only in upwells
If UpwellStructure <> "" Then cmbFacilityType.Items.Add(UpwellStructure)
End Select
' Only reset if they changed it
If FacilityProductionType <> PreviousProductionType Or FacilityActivity <> PreviousActivity Then
' Reset all other dropdowns
cmbFacilityType.Text = InitialTypeComboText
cmbFacilityRegion.Items.Clear()
cmbFacilityRegion.Text = InitialRegionComboText
cmbFacilityRegion.Enabled = False