-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmodMain.bas
4690 lines (3991 loc) · 163 KB
/
modMain.bas
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
Attribute VB_Name = "modMain"
Option Explicit
Option Base 0
Global bHideRecordNumbers As Boolean
Global bOnlyInGame As Boolean
Global nNMRVer As Double
Global sCurrentDatabaseFile As String
'Global bOnlyLearnable As Boolean
Global nLastItemSortCol As Integer
Public Enum QBColorCode
Black = 0
Blue = 1
Green = 2
Cyan = 3
Red = 4
Magenta = 5
Yellow = 6
White = 7
Grey = 8
BrightBlue = 9
BrightGreen = 10
BrightCyan = 11
BrightRed = 12
BrightMagenta = 13
BrightYellow = 14
BrightWhite = 15
End Enum
Public Enum eExpandBy
Percent50 = 0
Percent75 = 1
DoubleWidth = 2
TripleWidth = 3
QuadWidth = 4
NoExpand = 5
End Enum
Public Enum eExpandType
WidthOnly = 0
HeightOnly = 1
HeightAndWidth = 2
End Enum
Private Const CB_SHOWDROPDOWN = &H14F
Private Const CB_GETITEMHEIGHT = &H154
Private Const CB_SETDROPPEDWIDTH = &H160
Private Const CB_GETDROPPEDWIDTH = &H15F
Private Const CB_SETDROPPEDCONTROLRECT = &H160
Private Const DT_CALCRECT = &H400
Public bPromptSave As Boolean
Public bCancelTerminate As Boolean
Public bAppTerminating As Boolean
Public sRecentFiles(1 To 5, 1 To 2) As String '1=shown, 2=filename
Public sRecentDBs(1 To 5, 1 To 2) As String '1=shown, 2=filename
Public nEquippedItem(0 To 19) As Long
Public nLearnedSpells(0 To 99) As Long
Public bLegit As Boolean
Public sSessionLastCharFile As String
Public sSessionLastLoadDir As String
Public sSessionLastLoadName As String
Public sSessionLastSaveDir As String
Public sSessionLastSaveName As String
Public clsMonAtkSim As clsMonsterAttackSim
Public Type POINTAPI
x As Long
y As Long
End Type
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Declare Function MoveWindow Lib "user32" _
(ByVal hwnd As Long, _
ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal bRepaint As Long) As Long
Public Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, _
lpRect As RECT) As Long
Public Declare Function ScreenToClient Lib "user32" _
(ByVal hwnd As Long, _
lpPoint As POINTAPI) As Long
Private Declare Function SendMessageLong Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function DrawText Lib "user32" Alias _
"DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, _
ByVal nCount As Long, lpRect As RECT, ByVal wFormat _
As Long) As Long
Public Declare Function CalcExpNeeded Lib "lltmmudxp" (ByVal Level As Long, ByVal Chart As Long) As Currency
Public Sub LearnOrUnlearnSpell(nSpell As Long)
On Error GoTo error:
If in_long_arr(ByVal nSpell, nLearnedSpells()) Then
Call UnLearnSpell(nSpell)
Else
Call LearnSpell(nSpell)
End If
out:
On Error Resume Next
Exit Sub
error:
Call HandleError("LearnOrUnlearnSpell")
Resume out:
End Sub
Public Sub LearnSpell(nSpell As Long)
Dim x As Integer
On Error GoTo error:
For x = 0 To 99
If nLearnedSpells(x) = 0 Then
nLearnedSpells(x) = nSpell
Exit For
End If
Next x
out:
On Error Resume Next
Exit Sub
error:
Call HandleError("LearnSpell")
Resume out:
End Sub
Public Sub UnLearnSpell(nSpell As Long)
Dim x As Integer
On Error GoTo error:
For x = 0 To 99
If nLearnedSpells(x) = nSpell Then
nLearnedSpells(x) = 0
End If
Next x
out:
On Error Resume Next
Exit Sub
error:
Call HandleError("UnLearnSpell")
Resume out:
End Sub
Public Sub ExpandCombo(ByRef Combo As ComboBox, ByVal ExpandType As eExpandType, _
ByVal ExpandBy As eExpandBy, Optional ByVal hFrame As Long)
Dim lRet As Long
Dim pt As POINTAPI
Dim rc As RECT
Dim lComboWidth As Long
Dim lNewHeight As Long
Dim lItemHeight As Long
If ExpandType <> HeightOnly Then
lComboWidth = (Combo.Width / Screen.TwipsPerPixelX)
Select Case ExpandBy
Case 0:
lComboWidth = lComboWidth + (lComboWidth * 0.5)
Case 1:
lComboWidth = lComboWidth + (lComboWidth * 0.75)
Case 2:
lComboWidth = lComboWidth * 2
Case 3:
lComboWidth = lComboWidth * 3
Case 4:
lComboWidth = lComboWidth * 4
End Select
lRet = SendMessage(Combo.hwnd, CB_SETDROPPEDCONTROLRECT, lComboWidth, 0)
End If
If ExpandType <> WidthOnly Then
lComboWidth = Combo.Width / Screen.TwipsPerPixelX
lItemHeight = SendMessage(Combo.hwnd, CB_GETITEMHEIGHT, 0, 0)
Select Case ExpandBy
Case 1:
'lComboWidth = lComboWidth + (lComboWidth * 0.75)
lNewHeight = lItemHeight * 16
Case 2:
'lComboWidth = lComboWidth * 2
lNewHeight = lItemHeight * 18
Case 3:
'lComboWidth = lComboWidth * 3
lNewHeight = lItemHeight * 26
Case 4:
'lComboWidth = lComboWidth * 4
lNewHeight = lItemHeight * 32
Case Else:
lNewHeight = lItemHeight * 14
'lComboWidth = lComboWidth + (lComboWidth * 0.5)
End Select
Call GetWindowRect(Combo.hwnd, rc)
pt.x = rc.Left
pt.y = rc.Top
Call ScreenToClient(hFrame, pt)
Call MoveWindow(Combo.hwnd, pt.x, pt.y, lComboWidth, lNewHeight, True)
End If
End Sub
Public Function AutoSizeDropDownWidth(Combo As Object) As Boolean
'**************************************************************
'PURPOSE: Automatically size the combo box drop down width
' based on the width of the longest item in the combo box
'PARAMETERS: Combo - ComboBox to size
'RETURNS: True if successful, false otherwise
'ASSUMPTIONS: 1. Form's Scale Mode is vbTwips, which is why
' conversion from twips to pixels are made.
' API functions require units in pixels
'
' 2. Combo Box's parent is a form or other
' container that support the hDC property
'EXAMPLE: AutoSizeDropDownWidth Combo1
'****************************************************************
Dim lRet As Long
Dim lCurrentWidth As Single
Dim rectCboText As RECT
Dim lParentHDC As Long
Dim lListCount As Long
Dim lCtr As Long
Dim lTempWidth As Long
Dim lWidth As Long
Dim sSavedFont As String
Dim sngSavedSize As Single
Dim bSavedBold As Boolean
Dim bSavedItalic As Boolean
Dim bSavedUnderline As Boolean
Dim bFontSaved As Boolean
On Error GoTo ErrorHandler
If Not TypeOf Combo Is ComboBox Then Exit Function
lParentHDC = Combo.Parent.hdc
If lParentHDC = 0 Then Exit Function
lListCount = Combo.ListCount
If lListCount = 0 Then Exit Function
'Change font of parent to combo box's font
'Save first so it can be reverted when finished
'this is necessary for drawtext API Function
'which is used to determine longest string in combo box
With Combo.Parent
sSavedFont = .FontName
sngSavedSize = .FontSize
bSavedBold = .FontBold
bSavedItalic = .FontItalic
bSavedUnderline = .FontUnderline
.FontName = Combo.FontName
.FontSize = Combo.FontSize
.FontBold = Combo.FontBold
.FontItalic = Combo.FontItalic
.FontUnderline = Combo.FontItalic
End With
bFontSaved = True
'Get the width of the largest item
For lCtr = 0 To lListCount
DrawText lParentHDC, Combo.List(lCtr), -1, rectCboText, _
DT_CALCRECT
'adjust the number added (20 in this case to
'achieve desired right margin
lTempWidth = rectCboText.Right - rectCboText.Left + 20
If (lTempWidth > lWidth) Then
lWidth = lTempWidth
End If
Next
lCurrentWidth = SendMessageLong(Combo.hwnd, CB_GETDROPPEDWIDTH, _
0, 0)
If lCurrentWidth > lWidth Then 'current drop-down width is
' sufficient
AutoSizeDropDownWidth = True
GoTo ErrorHandler
Exit Function
End If
'don't allow drop-down width to
'exceed screen.width
If lWidth > Screen.Width \ Screen.TwipsPerPixelX - 20 Then _
lWidth = Screen.Width \ Screen.TwipsPerPixelX - 20
lRet = SendMessageLong(Combo.hwnd, CB_SETDROPPEDWIDTH, lWidth, 0)
AutoSizeDropDownWidth = lRet > 0
ErrorHandler:
On Error Resume Next
If bFontSaved Then
'restore parent's font settings
With Combo.Parent
.FontName = sSavedFont
.FontSize = sngSavedSize
.FontUnderline = bSavedUnderline
.FontBold = bSavedBold
.FontItalic = bSavedItalic
End With
End If
End Function
Public Sub PullItemDetail(DetailTB As TextBox, LocationLV As ListView)
Dim sStr As String, sAbil As String, x As Integer, sCasts As String, nPercent As Integer
Dim sNegate As String, sClasses As String, sRaces As String, sClassOk As String
Dim sUses As String, sGetDrop As String, oLI As ListItem, nNumber As Long
Dim y As Integer, z As Integer, bCompareWeapon As Boolean, bCompareArmor As Boolean
Dim nInvenSlot1 As Integer, nInvenSlot2 As Integer
Dim sCompareText1 As String, sCompareText2 As String
Dim tabItems1 As Recordset, tabItems2 As Recordset
Dim sTemp1 As String, sTemp2 As String, sTemp3 As String, sArr() As String
Dim bFlag1 As Boolean, bFlag2 As Boolean, sOP As String
Dim nClassRestrictions(0 To 2, 0 To 9) As Long
Dim nRaceRestrictions(0 To 2, 0 To 9) As Long
Dim nNegateSpells(0 To 2, 0 To 9) As Long
Dim nAbils(0 To 2, 0 To 19, 0 To 2) As Long, sAbilText(0 To 2, 0 To 19) As String
Dim nReturnValue As Long, nMatchReturnValue As Long
Dim sClassOk1 As String, sClassOk2 As String
Dim sCastSp1 As String, sCastSp2 As String
Dim bCastSpFlag(0 To 2) As Boolean
Dim nPct(0 To 2) As Integer
nInvenSlot1 = -1
nInvenSlot2 = -1
'sStr = ClipNull(tabItems.Fields("Name")) & " (" & tabItems.Fields("Number") & ")"
On Error GoTo error:
nNumber = tabItems.Fields("Number")
Select Case tabItems.Fields("ItemType")
Case 0: 'armour
If tabItems.Fields("Worn") <= 0 Then
'nada
Else
If tabItems.Fields("Worn") <= UBound(nEquippedItem) Then
Select Case tabItems.Fields("Worn")
Case 0: '"Nowhere"
Case 1: '"Everywhere"
nInvenSlot1 = 19
Case 2: '"Head"
nInvenSlot1 = 0
Case 3: '"Hands"
nInvenSlot1 = 8
Case 4, 13: '"Finger"
If nEquippedItem(9) > 0 Then
nInvenSlot1 = 9
If nEquippedItem(10) > 0 Then nInvenSlot2 = 10
ElseIf nEquippedItem(10) > 0 Then
nInvenSlot1 = 10
End If
Case 5: '"Feet"
nInvenSlot1 = 13
Case 6: '"Arms"
nInvenSlot1 = 5
Case 7: '"Back"
nInvenSlot1 = 3
Case 8: '"Neck"
nInvenSlot1 = 2
Case 9: '"Legs"
nInvenSlot1 = 12
Case 10: '"Waist"
nInvenSlot1 = 11
Case 11: '"Torso"
nInvenSlot1 = 4
Case 12: '"Off-Hand"
nInvenSlot1 = 15
Case 14: '"Wrist"
If nEquippedItem(6) > 0 Then
nInvenSlot1 = 6
If nEquippedItem(7) > 0 Then nInvenSlot2 = 7
ElseIf nEquippedItem(7) > 0 Then
nInvenSlot1 = 7
End If
Case 15: '"Ears"
nInvenSlot1 = 1
Case 16: '"Worn"
nInvenSlot1 = 14
Case 18: '"Eyes"
nInvenSlot1 = 17
Case 19: '"Face"
nInvenSlot1 = 18
Case Else:
End Select
If nInvenSlot1 >= 0 Then
If nEquippedItem(nInvenSlot1) > 0 Then
bCompareArmor = True
Else
nInvenSlot1 = -1
End If
End If
If nInvenSlot2 >= 0 Then
If nEquippedItem(nInvenSlot2) > 0 Then
bCompareArmor = True
Else
nInvenSlot2 = -1
End If
End If
End If
End If
Case 1: 'weapons
nInvenSlot1 = 16
If nEquippedItem(nInvenSlot1) > 0 Then
bCompareWeapon = True
End If
Case Else: 'other
'nada
End Select
If Not bCompareWeapon And Not bCompareArmor Then
nInvenSlot1 = -1
nInvenSlot2 = -1
End If
If nInvenSlot1 >= 0 Then
If nEquippedItem(nInvenSlot1) = nNumber Then nInvenSlot1 = -1
End If
If nInvenSlot2 >= 0 Then
If nEquippedItem(nInvenSlot2) = nNumber Then nInvenSlot2 = -1
End If
If nInvenSlot2 >= 0 And nInvenSlot1 < 0 Then
nInvenSlot1 = nInvenSlot2
nInvenSlot2 = -1
End If
If nInvenSlot1 < 0 And nInvenSlot2 < 0 Then
bCompareWeapon = False
bCompareArmor = False
End If
If bCompareWeapon Or bCompareArmor And nInvenSlot1 >= 0 Then
Set tabItems1 = DB.OpenRecordset("Items")
tabItems1.Index = "pkItems"
tabItems1.Seek "=", nEquippedItem(nInvenSlot1)
If tabItems1.NoMatch = True Then
If nInvenSlot2 < 0 Then
bCompareWeapon = False
bCompareArmor = False
nInvenSlot1 = -1
nInvenSlot2 = -1
tabItems1.Close
Set tabItems1 = Nothing
End If
End If
If nInvenSlot2 >= 0 Then
Set tabItems2 = DB.OpenRecordset("Items")
tabItems2.Index = "pkItems"
tabItems2.Seek "=", nEquippedItem(nInvenSlot2)
If tabItems2.NoMatch = True Then
If nInvenSlot1 < 0 Then
bCompareWeapon = False
bCompareArmor = False
nInvenSlot1 = -1
nInvenSlot2 = -1
tabItems2.Close
Set tabItems2 = Nothing
End If
End If
End If
End If
'#################
If tabItems.Fields("UseCount") > 0 Then
sUses = tabItems.Fields("UseCount")
If tabItems.Fields("Retain After Uses") = 1 Then
sUses = sUses & " start/max"
Else
sUses = sUses & " (destroys after uses)"
End If
End If
If nInvenSlot1 >= 0 Then
If tabItems1.Fields("UseCount") > 0 Then
sTemp1 = tabItems1.Fields("UseCount")
If tabItems1.Fields("Retain After Uses") = 1 Then
sTemp1 = "Uses: " & sTemp1 & " start/max"
Else
sTemp1 = "Uses: " & sTemp1 & " (destroys after uses)"
End If
End If
If sTemp1 <> sUses Then sCompareText1 = AutoAppend(sCompareText1, sTemp1)
End If
If nInvenSlot2 >= 0 Then
If tabItems2.Fields("UseCount") > 0 Then
sTemp2 = tabItems2.Fields("UseCount")
If tabItems2.Fields("Retain After Uses") = 1 Then
sTemp2 = "Uses: " & sTemp2 & " start/max"
Else
sTemp2 = "Uses: " & sTemp2 & " (destroys after uses)"
End If
End If
If sTemp2 <> sUses Then sCompareText2 = AutoAppend(sCompareText2, sTemp2)
End If
'#################
If tabItems.Fields("Gettable") = 0 Then sGetDrop = AutoAppend(sGetDrop, "Not Getable")
If nInvenSlot1 >= 0 Then
If tabItems.Fields("Gettable") <> tabItems1.Fields("Gettable") Then
If tabItems1.Fields("Gettable") = 0 Then
sCompareText1 = AutoAppend(sCompareText1, "+Getable")
Else
sCompareText1 = AutoAppend(sCompareText1, "+Not Getable")
End If
End If
End If
If nInvenSlot2 >= 0 Then
If tabItems.Fields("Gettable") <> tabItems2.Fields("Gettable") Then
If tabItems2.Fields("Gettable") = 0 Then
sCompareText2 = AutoAppend(sCompareText2, "+Getable")
Else
sCompareText2 = AutoAppend(sCompareText2, "+Not Getable")
End If
End If
End If
'#################
If tabItems.Fields("Not Droppable") = 1 Then sGetDrop = AutoAppend(sGetDrop, "Not Droppable")
If nInvenSlot1 >= 0 Then
If tabItems.Fields("Not Droppable") <> tabItems1.Fields("Not Droppable") Then
If tabItems1.Fields("Not Droppable") = 1 Then
sCompareText1 = AutoAppend(sCompareText1, "+Droppable")
Else
sCompareText1 = AutoAppend(sCompareText1, "+Not Droppable")
End If
End If
End If
If nInvenSlot2 >= 0 Then
If tabItems.Fields("Not Droppable") <> tabItems2.Fields("Not Droppable") Then
If tabItems2.Fields("Not Droppable") = 1 Then
sCompareText2 = AutoAppend(sCompareText2, "+Droppable")
Else
sCompareText2 = AutoAppend(sCompareText2, "+Not Droppable")
End If
End If
End If
'#################
If tabItems.Fields("Destroy On Death") = 1 Then sGetDrop = AutoAppend(sGetDrop, "Destroys On Death")
If nInvenSlot1 >= 0 Then
If tabItems.Fields("Destroy On Death") <> tabItems1.Fields("Destroy On Death") Then
If tabItems1.Fields("Destroy On Death") = 1 Then
sCompareText1 = AutoAppend(sCompareText1, "-Destroy On Death")
Else
sCompareText1 = AutoAppend(sCompareText1, "+Destroy On Death")
End If
End If
End If
If nInvenSlot2 >= 0 Then
If tabItems.Fields("Destroy On Death") <> tabItems2.Fields("Destroy On Death") Then
If tabItems2.Fields("Destroy On Death") = 1 Then
sCompareText2 = AutoAppend(sCompareText2, "-Destroy On Death")
Else
sCompareText2 = AutoAppend(sCompareText2, "+Destroy On Death")
End If
End If
End If
'#################
For x = 0 To 19
If tabItems.Fields("Abil-" & x) > 0 Then
nAbils(0, x, 0) = tabItems.Fields("Abil-" & x)
'If getindex_array_long_3d(nAbils, nAbils(0, x, 0), nReturnValue, 2, 0, , , x, 0) Then
' nAbils(0, nReturnValue, 1) = nAbils(0, nReturnValue, 1) + tabItems.Fields("AbilVal-" & x)
' nAbils(0, x, 0) = 0
'Else
nAbils(0, x, 1) = tabItems.Fields("AbilVal-" & x)
'End If
End If
If nInvenSlot1 >= 0 Then
If tabItems1.Fields("Abil-" & x) > 0 Then
nAbils(1, x, 0) = tabItems1.Fields("Abil-" & x)
'If getindex_array_long_3d(nAbils, nAbils(1, x, 0), nReturnValue, 2, 1, , , x, 0) Then
' nAbils(1, nReturnValue, 1) = nAbils(1, nReturnValue, 1) + tabItems1.Fields("AbilVal-" & x)
' nAbils(1, x, 0) = 0
'Else
nAbils(1, x, 1) = tabItems1.Fields("AbilVal-" & x)
'End If
End If
End If
If nInvenSlot2 >= 0 Then
If tabItems2.Fields("Abil-" & x) > 0 Then
nAbils(2, x, 0) = tabItems2.Fields("Abil-" & x)
'If getindex_array_long_3d(nAbils, nAbils(2, x, 0), nReturnValue, 2, 2, , , x, 0) Then
' nAbils(2, nReturnValue, 1) = nAbils(2, nReturnValue, 1) + tabItems2.Fields("AbilVal-" & x)
' nAbils(2, x, 0) = 0
'Else
nAbils(2, x, 1) = tabItems2.Fields("AbilVal-" & x)
'End If
End If
End If
Next
For x = 0 To 19
If nAbils(0, x, 0) > 0 Then
Select Case nAbils(0, x, 0)
Case 116: '116-bsacc
If Not DetailTB.name = "txtWeaponCompareDetail" And _
Not DetailTB.name = "txtWeaponDetail" Then
sTemp1 = GetAbilityStats(nAbils(0, x, 0), nAbils(0, x, 1), LocationLV, , True)
sAbilText(0, x) = sTemp1
sAbil = AutoAppend(sAbil, sTemp1)
End If
Case 22, 105, 106, 135: '22-acc, 105-acc, 106-acc, 135-minlvl
If Not DetailTB.name = "txtWeaponCompareDetail" And _
Not DetailTB.name = "txtWeaponDetail" And _
Not DetailTB.name = "txtArmourCompareDetail" And _
Not DetailTB.name = "txtArmourDetail" Then
sTemp1 = GetAbilityStats(nAbils(0, x, 0), nAbils(0, x, 1), LocationLV, , True)
sAbilText(0, x) = sTemp1
sAbil = AutoAppend(sAbil, sTemp1)
End If
Case 59: 'class ok
sTemp1 = GetClassName(nAbils(0, x, 1))
sAbilText(0, x) = sTemp1
sClassOk = AutoAppend(sClassOk, sTemp1)
Case 43: 'casts spell
'nSpellNest = 0 'make sure this doesn't nest too deep
sCasts = AutoAppend(sCasts, "[" & GetSpellName(nAbils(0, x, 1), bHideRecordNumbers) _
& ", " & PullSpellEQ(True, 0, nAbils(0, x, 1), , , , True))
If Not nPercent = 0 Then
sCasts = sCasts & ", " & nPercent & "%]"
Else
sCasts = sCasts & "]"
End If
sAbilText(0, x) = sCasts
'Set oLI = LocationLV.ListItems.Add
'oLI.Text = ""
'oLI.ListSubItems.Add 1, , "Casts: " & GetSpellName(nAbils(0, x, 1), bHideRecordNumbers)
'oLI.ListSubItems(1).Tag = nAbils(0, x, 1)
Case 114: '%spell
nPercent = nAbils(0, x, 1)
Case Else:
sTemp1 = GetAbilityStats(nAbils(0, x, 0), nAbils(0, x, 1), LocationLV, , True)
sAbilText(0, x) = sTemp1
sAbil = AutoAppend(sAbil, sTemp1)
End Select
End If
Next x
If nInvenSlot1 >= 0 Then
sTemp1 = ""
sTemp2 = ""
bCastSpFlag(0) = False
bCastSpFlag(1) = False
bCastSpFlag(2) = False
bFlag1 = False
bFlag2 = False
For y = 0 To 2
nPct(0) = 0
nPct(1) = 0
nPct(2) = 0
For x = 0 To 19
nMatchReturnValue = -32000
If nAbils(y, x, 0) > 0 Then
If nAbils(y, x, 0) = 59 Then nMatchReturnValue = nAbils(y, x, 1) 'classok
If nAbils(y, x, 0) = 43 Then
nMatchReturnValue = nAbils(y, x, 1) 'casts spell
bCastSpFlag(y) = True
End If
If nAbils(y, x, 0) = 114 Then nPct(y) = nAbils(y, x, 1) '%spell
' If nAbils(y, x, 0) = 117 Then
' Debug.Print 1
' End If
If y = 0 Then
If Not getval_array_long_3d(nAbils, nAbils(y, x, 0), nReturnValue, 1, nMatchReturnValue, 1, , , , 0) Then
sTemp3 = GetAbilDiffText(nAbils(y, x, 0), nAbils(y, x, 1), 0, sAbilText(y, x), nPct(y))
If Len(sTemp3) > 0 Then
If nAbils(y, x, 0) = 59 Then 'classok
sClassOk1 = AutoAppend(sClassOk1, "+" & sTemp3)
ElseIf nAbils(y, x, 0) = 43 Then 'casts spell
sCastSp1 = AutoAppend(sCastSp1, "+" & sTemp3)
Else
bFlag1 = True
sTemp1 = AutoAppend(sTemp1, IIf(nAbils(y, x, 1) = 0, "+", "") & sTemp3)
End If
End If
ElseIf nReturnValue <> nAbils(y, x, 1) Then
sTemp3 = GetAbilDiffText(nAbils(y, x, 0), nAbils(y, x, 1), nReturnValue, sAbilText(y, x), nPct(y))
If Len(sTemp3) > 0 Then
bFlag1 = True
sTemp1 = AutoAppend(sTemp1, sTemp3)
End If
End If
If nInvenSlot2 >= 0 Then
If Not getval_array_long_3d(nAbils, nAbils(y, x, 0), nReturnValue, 1, nMatchReturnValue, 2, , , , 0) Then
sTemp3 = GetAbilDiffText(nAbils(y, x, 0), nAbils(y, x, 1), 0, sAbilText(y, x), nPct(y))
If Len(sTemp3) > 0 Then
If nAbils(y, x, 0) = 59 Then 'classok
sClassOk2 = AutoAppend(sClassOk2, "+" & sTemp3)
ElseIf nAbils(y, x, 0) = 43 Then 'casts spell
sCastSp2 = AutoAppend(sCastSp2, "+" & sTemp3)
Else
bFlag2 = True
sTemp2 = AutoAppend(sTemp2, IIf(nAbils(y, x, 1) = 0, "+", "") & sTemp3)
End If
End If
ElseIf nReturnValue <> nAbils(y, x, 1) Then
sTemp3 = GetAbilDiffText(nAbils(y, x, 0), nAbils(y, x, 1), nReturnValue, sAbilText(y, x), nPct(y))
If Len(sTemp3) > 0 Then
bFlag2 = True
sTemp2 = AutoAppend(sTemp2, sTemp3)
End If
End If
End If
Else
If Not getval_array_long_3d(nAbils, nAbils(y, x, 0), nReturnValue, 1, nMatchReturnValue, 0, , , , 0) Then
sTemp3 = GetAbilDiffText(nAbils(y, x, 0), nAbils(y, x, 1), 0, , nPct(y), True)
If Len(sTemp3) > 0 Then
If nAbils(y, x, 0) = 59 Then 'classok
If y = 1 Then
sClassOk1 = AutoAppend(sClassOk1, "-" & sTemp3)
Else
sClassOk2 = AutoAppend(sClassOk2, "-" & sTemp3)
End If
ElseIf nAbils(y, x, 0) = 43 Then 'casts spell
If y = 1 Then
sCastSp1 = AutoAppend(sCastSp1, "-" & sTemp3)
Else
sCastSp2 = AutoAppend(sCastSp2, "-" & sTemp3)
End If
Else
If y = 1 Then
bFlag1 = True
sTemp1 = AutoAppend(sTemp1, IIf(nAbils(y, x, 1) = 0, "-", "") & sTemp3)
Else
bFlag2 = True
sTemp2 = AutoAppend(sTemp2, IIf(nAbils(y, x, 1) = 0, "-", "") & sTemp3)
End If
End If
End If
End If
End If
End If
Next x
Next y
If Len(sTemp1) > 0 Then
sTemp3 = "Abilities"
If Len(sAbil) = 0 And bFlag1 Then
sTemp3 = sTemp3 & " [none]: " & sTemp1
Else
sTemp3 = sTemp3 & ": " & sTemp1
End If
sCompareText1 = AutoAppend(sCompareText1, sTemp3, " -- ")
End If
If Len(sTemp2) > 0 Then
sTemp3 = "Abilities"
If Len(sAbil) = 0 And bFlag2 Then
sTemp3 = sTemp3 & " [none]: " & sTemp2
Else
sTemp3 = sTemp3 & ": " & sTemp2
End If
sCompareText2 = AutoAppend(sCompareText2, sTemp3, " -- ")
End If
If Len(sCastSp1) > 0 Then
sTemp3 = "Casts"
If Len(sCasts) = 0 And bCastSpFlag(1) Then
sTemp3 = sTemp3 & " [none]: " & sCastSp1
Else
sTemp3 = sTemp3 & ": " & sCastSp1
End If
sCompareText1 = AutoAppend(sCompareText1, sTemp3, " -- ")
End If
If Len(sCastSp2) > 0 Then
sTemp3 = "Casts"
If Len(sCasts) = 0 And bCastSpFlag(2) Then
sTemp3 = sTemp3 & " [none]: " & sCastSp2
Else
sTemp3 = sTemp3 & ": " & sCastSp2
End If
sCompareText2 = AutoAppend(sCompareText2, sTemp3, " -- ")
End If
If Len(sClassOk1) > 0 Then
sTemp3 = "ClassOk"
sTemp3 = sTemp3 & ": " & sClassOk1
sCompareText1 = AutoAppend(sCompareText1, sTemp3, " -- ")
End If
If Len(sClassOk2) > 0 Then
sTemp3 = "ClassOk"
sTemp3 = sTemp3 & ": " & sClassOk2
sCompareText2 = AutoAppend(sCompareText2, sTemp3, " -- ")
End If
End If
'#################
For x = 0 To 9
If tabItems.Fields("ClassRest-" & x) <> 0 Then
sClasses = AutoAppend(sClasses, GetClassName(tabItems.Fields("ClassRest-" & x)))
nClassRestrictions(0, x) = tabItems.Fields("ClassRest-" & x)
End If
If nInvenSlot1 >= 0 Then
If tabItems1.Fields("ClassRest-" & x) <> 0 Then nClassRestrictions(1, x) = tabItems1.Fields("ClassRest-" & x)
End If
If nInvenSlot2 >= 0 Then
If tabItems2.Fields("ClassRest-" & x) <> 0 Then nClassRestrictions(2, x) = tabItems2.Fields("ClassRest-" & x)
End If
Next
If nInvenSlot1 >= 0 Then
sTemp1 = ""
sTemp2 = ""
bFlag1 = False
bFlag2 = False
For y = 0 To 2
For x = 0 To 9
If nClassRestrictions(y, x) > 0 Then
If y = 0 Then
If Not in_array_long_md(nClassRestrictions, nClassRestrictions(y, x), 1) Then
sTemp1 = AutoAppend(sTemp1, "+" & GetClassName(nClassRestrictions(y, x)))
End If
If nInvenSlot2 >= 0 Then
If Not in_array_long_md(nClassRestrictions, nClassRestrictions(y, x), 2) Then
sTemp2 = AutoAppend(sTemp2, "+" & GetClassName(nClassRestrictions(y, x)))
End If
End If
Else
If y = 1 Then 'mark that there are values found
bFlag1 = True
Else
bFlag2 = True
End If
If Not in_array_long_md(nClassRestrictions, nClassRestrictions(y, x), 0) Then
If y = 1 Then
sTemp1 = AutoAppend(sTemp1, "-" & GetClassName(nClassRestrictions(y, x)))
Else
sTemp2 = AutoAppend(sTemp2, "-" & GetClassName(nClassRestrictions(y, x)))
End If
End If
End If
End If
Next x
Next y
If Len(sTemp1) > 0 Then
sTemp3 = "Classes"
If Len(sClasses) = 0 Then
sTemp3 = sTemp3 & " [not-restricted]"
ElseIf Not bFlag1 Then
sTemp3 = sTemp3 & " [+restricted]" & ": " & sTemp1
Else
sTemp3 = sTemp3 & ": " & sTemp1
End If
sCompareText1 = AutoAppend(sCompareText1, sTemp3, " -- ")
End If
If Len(sTemp2) > 0 Then
sTemp3 = "Classes"
If Len(sClasses) = 0 Then
sTemp3 = sTemp3 & " [not-restricted]"
ElseIf Not bFlag2 Then
sTemp3 = sTemp3 & " [+restricted]" & ": " & sTemp2
Else
sTemp3 = sTemp3 & ": " & sTemp2
End If
sCompareText2 = AutoAppend(sCompareText2, sTemp3, " -- ")
End If
End If
'#################
For x = 0 To 9
If tabItems.Fields("RaceRest-" & x) <> 0 Then
sRaces = AutoAppend(sRaces, GetRaceName(tabItems.Fields("RaceRest-" & x)))
nRaceRestrictions(0, x) = tabItems.Fields("RaceRest-" & x)
End If
If nInvenSlot1 >= 0 Then
If tabItems1.Fields("RaceRest-" & x) <> 0 Then nRaceRestrictions(1, x) = tabItems1.Fields("RaceRest-" & x)
End If
If nInvenSlot2 >= 0 Then
If tabItems2.Fields("RaceRest-" & x) <> 0 Then nRaceRestrictions(2, x) = tabItems2.Fields("RaceRest-" & x)
End If
Next
If nInvenSlot1 >= 0 Then
sTemp1 = ""
sTemp2 = ""
bFlag1 = False
bFlag2 = False
For y = 0 To 2
For x = 0 To 9
If nRaceRestrictions(y, x) > 0 Then
If y = 0 Then
If Not in_array_long_md(nRaceRestrictions, nRaceRestrictions(y, x), 1) Then
sTemp1 = AutoAppend(sTemp1, "+" & GetRaceName(nRaceRestrictions(y, x)))
End If
If nInvenSlot2 >= 0 Then
If Not in_array_long_md(nRaceRestrictions, nRaceRestrictions(y, x), 2) Then
sTemp2 = AutoAppend(sTemp2, "+" & GetRaceName(nRaceRestrictions(y, x)))
End If
End If
Else
If y = 1 Then 'mark that there are values found
bFlag1 = True
Else
bFlag2 = True
End If
If Not in_array_long_md(nRaceRestrictions, nRaceRestrictions(y, x), 0) Then
If y = 1 Then
sTemp1 = AutoAppend(sTemp1, "-" & GetRaceName(nRaceRestrictions(y, x)))
Else
sTemp2 = AutoAppend(sTemp2, "-" & GetRaceName(nRaceRestrictions(y, x)))
End If
End If
End If
End If
Next x
Next y
If Len(sTemp1) > 0 Then
sTemp3 = "Races"
If Len(sRaces) = 0 Then
sTemp3 = sTemp3 & " [not-restricted]"
ElseIf Not bFlag1 Then
sTemp3 = sTemp3 & " [+restricted]" & ": " & sTemp1
Else
sTemp3 = sTemp3 & ": " & sTemp1