forked from DracoL1ch/WC3Memory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwar3map.j
8624 lines (7170 loc) · 279 KB
/
war3map.j
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
// reserved native for call 4 integer function and return BOOLEAN value
native MergeUnits takes integer qty, integer a, integer b, integer make returns boolean
// reserved native for call 2 integer function and return BOOLEAN value (can be converted to int!)
native ConvertUnits takes integer qty, integer id returns boolean
// reserved native for call 1 integer function and return integer value
native IgnoredUnits takes integer unitid returns integer
// https://github.com/Karaulov/WarcraftIII_DLL_126-xxx (EXTRADLLNAME)
// DLL is helpful ally which makes game easire
// Basically there's no jass-way to detect whenever player leaves to rollback changes
// so DLL does it for you with "AddNewOffsetToRestore" function
// if DLL is missing global changes you did will affect whole game until it's restarted
// You can detect function which uses DLL by "GetModuleProcAddress(EXTRADLLNAME" part inside of them\
globals
integer TempInteger=0
integer Temp_GetSomeAdd1=0
integer Temp_GetSomeAdd2=0
integer DamageIncrementer=0
real array DamageValues
integer array DamageAttackTypes
integer array DamageDamageTypes
player LocalPlayer=null
hashtable TempHash=InitHashtable()
hashtable RectData = InitHashtable()
hashtable HY=InitHashtable()
boolean IsL1ch=true//used in "echo" function to display debug messages
boolean array WidescreenState
real GJ_LastDmg=0//outdated yet could be useful
integer GJ_LastDamageType=0
integer GJ_LastAttackType=0
hashtable ObjectDataPointersTable=InitHashtable()
timer SuperTextPrinter_Timer=null
hashtable AbilitiesHashtable=InitHashtable()
integer testFunctionCount = 0
integer latestAddress1 = 0
integer latestAddress2 = 0
integer array Ascii__Ints
string array Ascii__Chars
code l__Code
integer l__Int
string l__Str
boolean l__Bool
constant string dotaconfigfle="config.dota"
integer array l__Array
string array HexNumber__Chars
integer bytecode
integer array l__bytecode
integer array Memory
integer bytecodedata //used to pass data between regular code and bytecode
integer GameState
integer pointers
integer pUnitData
integer pAbilityData
constant gametype GAME_TYPE_ALL= ConvertGameType(0xFFFFFFFF)
integer array H
trigger l__library_init
// For SetUnitFlags_2 (unit+0x20)
constant integer UNIT_VISIBLED_TO_ALL = 0x10
constant integer UNIT_INVULNERABLE = 0x8
constant integer UNIT_SELECTABLE = 0x2
constant integer UNIT_HIDDEN = 0x1
constant integer UNIT_AUTOATTACK_DISABLED=0x10000000
constant integer UNIT_ILLUSION=0x40000000
// For SetUnitFlags (unit+0xD4)
//flag 0x4 causes fatal if any damage received
//flag 0x40 stands for red flash, but doesn't directly calls it
constant integer UNIT_DEAD = 0x100
//like dead hero, provides no vision, cant be selected, enemies doesn't flee when attacked by unit with this flag
constant integer UNIT_MINMAP_ICON_HIDE = 0x80000
constant integer UNIT_MINMAP_ICON_TAVERN = 0x40000
constant integer UNIT_MINMAP_ICON_GOLD = 0x20000
constant integer UNIT_MINMAP_SHAREVISIBLE = 0x10000
constant integer UNIT_STUNNED= 0x100000
constant integer UNIT_INVISIBLED = 0x1000000
constant integer UNIT_HAS_FLYING_VISION= 0x20000000
integer pCameraDefaultHeight
real array DefaultCameraHeight
// 126a 0xAB65F4
// 127a 0xBE4238
integer pGlobalPlayerClass
// 127a 0xBEC464
// 126a 0xAB4450
integer pUnitMaxSpeedConstant
integer pUnitMaxSpeedConstantD
real UnitMaxSpeedConstant
// 127a 0xBEC460
// 126a 0xAB444C
integer pUnitMinSpeedConstant
integer pUnitMinSpeedConstantD
real UnitMinSpeedConstant
// 127a 0xBEC46C
// 126a 0xAB4458
integer pBuildingMaxSpeedConstant
integer pBuildingMaxSpeedConstantD
real BuildingMaxSpeedConstant
// 127a 0xBEC468
// 126a 0xAB4454
integer pBuildingMinSpeedConstant
integer pBuildingMinSpeedConstantD
real BuildingMinSpeedConstant
integer pUnitUIDefAddr
integer pUnitDataDefAddr
integer pAbilityUIDefAddr
integer pAbilityDataDefAddr
integer pAttackSpeedLimit
real AttackSpeedLimit
integer pAttackTimeLimit
real AttackTimeLimit
integer pWar3MapJLocation=0
integer pGameClass1=0
integer pGameClass2=0
integer pGameClass3=0
integer pTimerAddr=0
integer pCGameState=0
integer pJassEnvAddress=0
integer pLightEnv=0
integer pGetModuleHandle=0
integer pGetProcAddress=0
integer GameDLL=0
integer GameVersion=0
integer pMergeUnits=0
integer pMergeUnitsOffset=0
integer pIgnoredUnits=0
integer pIgnoredUnitsOffset=0
integer pConvertUnits=0
integer pConvertUnitsOffset=0
integer pLeaderboardSetItemLabelColor=0
integer pSetHPBarColorForPlayer=0
integer pSetHPBarXScaleForPlayer=0
integer pSetHPBarYScaleForPlayer=0
integer pSetHPCustomHPBarUnit=0
integer pSetMPBarXScaleForPlayer=0
integer pSetMPBarYScaleForPlayer=0
integer pSetMPBarYOffsetForPlayer=0
integer pExportFromMpq=0
integer pGetFrameItemAddress=0
integer pGetFrameSkinAddress=0
integer pGetFrameTextAddress=0
integer pUpdateFrameText=0
integer pFrameDefClass=0
integer pConvertString=0
integer pPacketClass=0
integer pPacketSend=0
integer pPingMinimapOffset=0
integer pPingMinimapExOffset=0
integer PingMinimapUnlocker = 0
integer PingMinimapExUnlocker = 0
boolean NotLockedPingMinimap = true
boolean NotLockedPingMinimapEx = true
integer pFindWindowA=0
integer pMessageBoxA=0
integer pGetAsyncKeyState=0
integer pWritePrivateProfileStringA=0
integer pGetPrivateProfileStringA=0
integer pLoadLibraryA=0
integer pGetFileAttributesA=0
integer pVirtualAlloc=0
integer pVirtualProtect=0
integer array RJassNativesBuffer
integer RJassNativesBufferSize = 0
integer pReservedExecutableMemory=0
integer pReservedExecutableMemory2=0
integer pBitwiseOR_ExecutableMemory
boolean NeedInitBitwiseOr = true
integer pBitwiseXOR_ExecutableMemory
boolean NeedInitBitwiseXor = true
integer pBitwiseAND_ExecutableMemory
boolean NeedInitBitwiseAnd = true
integer pReservedWritableMemory
integer pReservedWritableMemory2
constant integer szReservedWritableMemory = 3000
integer pStorm279
integer pPrintText1
integer pPrintText2
integer pPrintText3
integer pGetUnitAbility
integer pGetUnitAddress
integer p_sprintf
integer pChangeFont
integer pUpdateRestoreTimer=0
integer pAddNewOffsetToRestore=0
constant string EXTRADLLNAME="DotAAllstarsHelper688.dll"
integer pReserverdIntArg1
integer pReserverdIntArg2
integer pReserverdIntArg3
integer pReserverdIntArg4
hashtable Addresses=InitHashtable()
constant integer DEF_ADR_ABILITY_DATA=0
constant integer DEF_ADR_ABILITY_UI=1
constant integer DEF_ADR_UNIT_DATA=2
constant integer DEF_ADR_UNIT_UI=3
constant integer DEF_ADR_ITEM_DATA=4
constant integer ILLUSTION_BONUS_DAMAGE_RECEIVES=0
constant integer ILLUSTION_BONUS_DAMAGE_DEALS=1
integer pOrder1_offset
integer pOrder2_offset
integer pOrder3_offset
integer pOrder4_offset
integer pOrder5_offset
integer pOrder6_offset
integer pOrder7_offset
integer pOrder8_offset
integer Order1_unlockedvalue = 0
integer Order2_unlockedvalue = 0
integer Order3_unlockedvalue = 0
integer Order4_unlockedvalue = 0
integer Order5_unlockedvalue = 0
integer Order6_unlockedvalue = 0
integer Order7_unlockedvalue = 0
integer Order8_unlockedvalue = 0
integer Order1_lockedvalue
integer Order2_lockedvalue
integer Order3_lockedvalue
integer Order4_lockedvalue
integer Order5_lockedvalue
integer Order6_lockedvalue
integer Order7_lockedvalue
integer Order8_lockedvalue
boolean IsOrder1Locked = false
boolean IsOrder2Locked = false
boolean IsOrder3Locked = false
boolean IsOrder4Locked = false
boolean IsOrder5Locked = false
boolean IsOrder6Locked = false
boolean IsOrder7Locked = false
boolean IsOrder8Locked = false
boolean FogUpdateBlocked = false
integer pUpdateFogManual=0
integer pFogUpdateBlockAddr=0
integer pFogUpdateBlockAddrOld1=0
integer pFogUpdateBlockAddrOld2=0
integer pFogUpdateBlockAddrNew1=0
integer pFogUpdateBlockAddrNew2=0
integer pGetLatestDownloadedString = 0
integer pGetDownloadStatus = 0
integer pSaveNewMapFromUrl = 0
integer pGetDownloadProgress = 0
integer pGetCurrentMapDir = 0
integer pStartAbilityCD=0
integer pSendCommandWithoutTarget
integer pMissile
integer pWindowIsActive
integer pSendHttpGetRequest = 0
integer pAllianceOutput
integer AllianceLocker = 0
boolean NotLockedAllianceOutput = true
integer pMutePlayer=0
integer pUnMutePlayer=0
integer pSetWidescreenFixState=0
integer pSetCustomFovFix=0
boolean EXTRADLLLOADED = false
integer RegionEditMode = 0
real LatestMouseX = 0.
real LatestMouseY = 0.
integer LatestSelectRect = 0
integer LatestOverRect = 0
integer gl_hRectID = 0
integer OPLimitAddress1=0
integer OPLimitAddress2=0
integer pCycloneFixCondition=0
constant integer CycloneFixCondition026a=0x808B08EB
integer CycloneFixBaseValue=0
constant integer CycloneFixCondition027a=0x458B16EB
integer pCaptionsOverTheCreeps=0
integer pPhaseShiftInvisibilityFlagByte=0
constant integer PhaseShiftInvisibilityFlagByteFixed0x26=0x00000060
constant integer PhaseShiftInvisibilityFlagByteFixed0x27=0x00000060
integer pMemcpy
integer pSearchStringValue
integer pSearchStringAddr1
integer pSearchStringAddr2
integer pReservedMemoryForUpdateFrameText
integer pSimulateAttackInstance
integer pGameTime
integer pToggleForcedSubSelection=0
integer pToggleBlockKeyAndMouseEmulation=0
integer pToggleClickHelper=0
integer pSetStunToUnitTRUE
integer pSetStunToUnitFALSE
integer pReservedMemoryForSystemTime
integer pGetLocalTime=0
integer pCommonSilence
integer pAddSilenceOnAbility
integer pRemoveSilenceFromAbility
integer pPauseUnitDisabler
integer pUpdateUnitsSpeedCurrent
integer pSendMessageToChat=0
integer pCastSilenceToTarget
integer pCastAbility=0
integer pDamageBlockIllusionCheck=0
integer pItemDropOrderTriggerFix=0
integer pFixModelCollisionSphere=0
integer pGetOrLoadFile
integer pApplyTerrainFilterDirectly=0
integer pSetMainFuncWork=0
integer pFixModelTexturePath=0
integer StoreIntegerOffset = 0
integer StoreIntegerUnlocker = 0
boolean StoreIntegerLocked = false
integer pPatchModel = 0
integer pChangeAnimationSpeed = 0
integer pSetSequenceValue = 0
integer pRedirectFile = 0
integer pReservedMemoryForMissileHandler=0
integer pReservedMemoryForDamageHandler=0
integer pUnitVtable = 0
integer pRealUnitDamageHandler = 0
integer pTriggerExecute = 0
integer pDamageTarget = 0
integer pMissileEspData = 0
integer pDamageEspData = 0
integer pMissileFuncStart = 0
integer pMissileJumpBack = 0
integer pItemDataNode=0
integer pJassLog = 0
endglobals
function Char2Ascii takes string s returns integer
local integer i= Ascii__Ints[StringHash(s) / 0x1F0748 + 0x3EA]
if i == 47 and s == "\\" then
set i=92
elseif i >= 65 and i <= 90 and s != Ascii__Chars[i] then
set i=i + 32
endif
return i
endfunction
function Char2Hex takes string s returns integer
local integer i= Ascii__Ints[StringHash(s) / 0x1F0748 + 0x3EA]
if i >= 48 and i <= 57 then
return i - 48
elseif i >= 65 and i <= 70 then
return i - 55
endif
return - 1
endfunction
function Ascii2Char takes integer i returns string
return Ascii__Chars[i]
endfunction
function Ascii__onInit takes nothing returns nothing
set Ascii__Ints[931]=8
set Ascii__Ints[1075]=9
set Ascii__Ints[1586]=10
set Ascii__Ints[1340]=12
set Ascii__Ints[412]=13
set Ascii__Ints[198]=32
set Ascii__Ints[1979]=33
set Ascii__Ints[1313]=34
set Ascii__Ints[1003]=35
set Ascii__Ints[1264]=36
set Ascii__Ints[983]=37
set Ascii__Ints[1277]=38
set Ascii__Ints[306]=39
set Ascii__Ints[904]=40
set Ascii__Ints[934]=41
set Ascii__Ints[917]=42
set Ascii__Ints[1972]=43
set Ascii__Ints[1380]=44
set Ascii__Ints[1985]=45
set Ascii__Ints[869]=46
set Ascii__Ints[1906]=47
set Ascii__Ints[883]=48
set Ascii__Ints[1558]=49
set Ascii__Ints[684]=50
set Ascii__Ints[582]=51
set Ascii__Ints[668]=52
set Ascii__Ints[538]=53
set Ascii__Ints[672]=54
set Ascii__Ints[1173]=55
set Ascii__Ints[71]=56
set Ascii__Ints[277]=57
set Ascii__Ints[89]=58
set Ascii__Ints[1141]=59
set Ascii__Ints[39]=60
set Ascii__Ints[1171]=61
set Ascii__Ints[51]=62
set Ascii__Ints[305]=0 //fixme 63
set Ascii__Ints[0]=64
set Ascii__Ints[222]=65
set Ascii__Ints[178]=66
set Ascii__Ints[236]=67
set Ascii__Ints[184]=68
set Ascii__Ints[1295]=69
set Ascii__Ints[1390]=70
set Ascii__Ints[1276]=71
set Ascii__Ints[203]=72
set Ascii__Ints[1314]=73
set Ascii__Ints[209]=74
set Ascii__Ints[1315]=75
set Ascii__Ints[170]=76
set Ascii__Ints[1357]=77
set Ascii__Ints[1343]=78
set Ascii__Ints[1397]=79
set Ascii__Ints[1420]=80
set Ascii__Ints[1419]=81
set Ascii__Ints[1396]=82
set Ascii__Ints[1374]=83
set Ascii__Ints[1407]=84
set Ascii__Ints[499]=85
set Ascii__Ints[1465]=86
set Ascii__Ints[736]=87
set Ascii__Ints[289]=88
set Ascii__Ints[986]=89
set Ascii__Ints[38]=90
set Ascii__Ints[1230]=91
set Ascii__Ints[1636]=93
set Ascii__Ints[1416]=94
set Ascii__Ints[1917]=95
set Ascii__Ints[217]=96
set Ascii__Ints[833]=123
set Ascii__Ints[1219]=124
set Ascii__Ints[553]=125
set Ascii__Ints[58]=126
set Ascii__Chars[0]="?"
set Ascii__Chars[8]="\b"
set Ascii__Chars[9]="\t"
set Ascii__Chars[10]="\n"
set Ascii__Chars[12]="\f"
set Ascii__Chars[13]="\r"
set Ascii__Chars[32]=" "
set Ascii__Chars[33]="!"
set Ascii__Chars[34]="\""
set Ascii__Chars[35]="#"
set Ascii__Chars[36]="$"
set Ascii__Chars[37]="%"
set Ascii__Chars[38]="&"
set Ascii__Chars[39]="'"//'
set Ascii__Chars[40]="("
set Ascii__Chars[41]=")"
set Ascii__Chars[42]="*"
set Ascii__Chars[43]="+"
set Ascii__Chars[44]=","
set Ascii__Chars[45]="-"
set Ascii__Chars[46]="."
set Ascii__Chars[47]="/"
set Ascii__Chars[48]="0"
set Ascii__Chars[49]="1"
set Ascii__Chars[50]="2"
set Ascii__Chars[51]="3"
set Ascii__Chars[52]="4"
set Ascii__Chars[53]="5"
set Ascii__Chars[54]="6"
set Ascii__Chars[55]="7"
set Ascii__Chars[56]="8"
set Ascii__Chars[57]="9"
set Ascii__Chars[58]=":"
set Ascii__Chars[59]=";"
set Ascii__Chars[60]="<"
set Ascii__Chars[61]="="
set Ascii__Chars[62]=">"
set Ascii__Chars[63]="?"
set Ascii__Chars[64]="@"
set Ascii__Chars[65]="A"
set Ascii__Chars[66]="B"
set Ascii__Chars[67]="C"
set Ascii__Chars[68]="D"
set Ascii__Chars[69]="E"
set Ascii__Chars[70]="F"
set Ascii__Chars[71]="G"
set Ascii__Chars[72]="H"
set Ascii__Chars[73]="I"
set Ascii__Chars[74]="J"
set Ascii__Chars[75]="K"
set Ascii__Chars[76]="L"
set Ascii__Chars[77]="M"
set Ascii__Chars[78]="N"
set Ascii__Chars[79]="O"
set Ascii__Chars[80]="P"
set Ascii__Chars[81]="Q"
set Ascii__Chars[82]="R"
set Ascii__Chars[83]="S"
set Ascii__Chars[84]="T"
set Ascii__Chars[85]="U"
set Ascii__Chars[86]="V"
set Ascii__Chars[87]="W"
set Ascii__Chars[88]="X"
set Ascii__Chars[89]="Y"
set Ascii__Chars[90]="Z"
set Ascii__Chars[91]="["
set Ascii__Chars[92]="\\"
set Ascii__Chars[93]="]"
set Ascii__Chars[94]="^"
set Ascii__Chars[95]="_"
set Ascii__Chars[96]="`"
set Ascii__Chars[97]="a"
set Ascii__Chars[98]="b"
set Ascii__Chars[99]="c"
set Ascii__Chars[100]="d"
set Ascii__Chars[101]="e"
set Ascii__Chars[102]="f"
set Ascii__Chars[103]="g"
set Ascii__Chars[104]="h"
set Ascii__Chars[105]="i"
set Ascii__Chars[106]="j"
set Ascii__Chars[107]="k"
set Ascii__Chars[108]="l"
set Ascii__Chars[109]="m"
set Ascii__Chars[110]="n"
set Ascii__Chars[111]="o"
set Ascii__Chars[112]="p"
set Ascii__Chars[113]="q"
set Ascii__Chars[114]="r"
set Ascii__Chars[115]="s"
set Ascii__Chars[116]="t"
set Ascii__Chars[117]="u"
set Ascii__Chars[118]="v"
set Ascii__Chars[119]="w"
set Ascii__Chars[120]="x"
set Ascii__Chars[121]="y"
set Ascii__Chars[122]="z"
set Ascii__Chars[123]="{"
set Ascii__Chars[124]="|"
set Ascii__Chars[125]="}"
set Ascii__Chars[126]="~"
endfunction
//library Ascii ends
//library Typecast:
function InitArray takes integer vtable returns nothing
set l__Array[4] = 0
set l__Array[1] = vtable
set l__Array[2] = -1
set l__Array[3] = -1
endfunction
function TypecastArray takes nothing returns nothing
local integer l__Array //typecast Array to integer
endfunction
function GetArrayAddress takes nothing returns integer //not really needed
loop
return l__Array
endloop
return 0
endfunction
function setCode takes code c returns nothing
set l__Code=c
return //Prevents Jasshelper from inlining this function
endfunction
function setInt takes integer i returns nothing
set l__Int=i
return //Prevents JassHelper from inlining this function
endfunction
function setStr takes string s returns nothing
set l__Str = s
return //Prevents JassHelper from inlining this function
endfunction
function setBool takes boolean b returns nothing
set l__Bool = b
return
endfunction
function Typecast1 takes nothing returns nothing
local integer l__Code
local code l__Int
endfunction
function C2I takes code c returns integer
call setCode(c)
loop //Loop is not required, I'm using it just to fool Pjass
return l__Code
endloop
return 0
endfunction
function I2C takes integer i returns code
call setInt(i)
loop //Loop is not required, I'm using it just to fool Pjass
return l__Int
endloop
return null
endfunction
function Typecast2 takes nothing returns nothing
local integer l__Str
local string l__Int
endfunction
function SH2I takes string s returns integer
call setStr(s)
loop //Loop is not required, I'm using it just to fool Pjass
return l__Str
endloop
return 0
endfunction
function I2SH takes integer i returns string
call setInt(i)
loop //Loop is not required, I'm using it just to fool Pjass
return l__Int
endloop
return null
endfunction
function Typecast3 takes nothing returns nothing
local integer l__Bool
local boolean l__Int
endfunction
function B2I takes boolean b returns integer
call setBool(b)
loop //Loop is not required, I'm using it just to fool Pjass
return l__Bool
endloop
return 0
endfunction
function I2B takes integer i returns boolean
call setInt(i)
loop //Loop is not required, I'm using it just to fool Pjass
return l__Int
endloop
return false
endfunction
function realToIndex takes real r returns integer
loop
return r
endloop
return 0
endfunction
function cleanInt takes integer i returns integer
return i
endfunction
function indexToReal takes integer i returns real
loop
return i
endloop
return 0.0
endfunction
function cleanReal takes real r returns real
return r
endfunction
function GetRealFromMemory takes integer i returns real
return cleanReal(indexToReal(i))
endfunction
function SetRealIntoMemory takes real r returns integer
return cleanInt(realToIndex(r))
endfunction
//library Typecast ends
//library HexNumber:
function BitwiseNot takes integer i returns integer
return 0xFFFFFFFF - i
endfunction
function PowI takes integer x, integer power returns integer
local integer res=1
local integer y=x
if power==0 then
return 1
endif
set power=power-1
loop
set x=x*y
set power=power-1
exitwhen power==0
endloop
return x
endfunction
function ShiftLeftForBits takes integer i, integer shiftval returns integer
return i * (PowI(2,shiftval))
endfunction
function ShiftRightForBits takes integer i, integer shiftval returns integer
return i / (PowI(2,shiftval))
endfunction
function ShiftLeftForBytes takes integer i, integer shiftval returns integer
return ShiftLeftForBits(i,shiftval * 8)
endfunction
function ShiftRightForBytes takes integer i, integer shiftval returns integer
return ShiftRightForBits(i,shiftval * 8)
endfunction
function GetByteFromInteger takes integer i, integer byteid returns integer
local integer tmpval = i
local integer retval = 0
local integer byte1 = 0
local integer byte2 = 0
local integer byte3 = 0
local integer byte4 = 0
if (tmpval < 0) then
set tmpval = BitwiseNot(tmpval)
set byte4 = 255 - ModuloInteger(tmpval,256)
set tmpval = tmpval / 256
set byte3 = 255 - ModuloInteger(tmpval,256)
set tmpval = tmpval / 256
set byte2 = 255 - ModuloInteger(tmpval,256)
set tmpval = tmpval / 256
set byte1 = 255 - tmpval
else
set byte4 = ModuloInteger(tmpval,256)
set tmpval = tmpval / 256
set byte3 = ModuloInteger(tmpval,256)
set tmpval = tmpval / 256
set byte2 = ModuloInteger(tmpval,256)
set tmpval = tmpval / 256
set byte1 = tmpval
endif
if byteid == 1 then
return byte1
elseif byteid == 2 then
return byte2
elseif byteid == 3 then
return byte3
elseif byteid == 4 then
return byte4
endif
return retval
endfunction
function CreateInteger1 takes integer byte1, integer byte2, integer byte3, integer byte4 returns integer
local integer retval = byte1
set retval = ( retval * 256 ) + byte2
set retval = ( retval * 256 ) + byte3
set retval = ( retval * 256 ) + byte4
return retval
endfunction
function CreateInteger2 takes integer byte1, integer byte2, integer byte3, integer byte4 returns integer
local integer retval = byte1
set retval = ShiftLeftForBytes(retval,1) + byte2
set retval = ShiftLeftForBytes(retval,1) + byte3
set retval = ShiftLeftForBytes(retval,1) + byte4
return retval
endfunction
function Hex2Int takes string s returns integer
local integer result= 0
local integer i= 0
local integer char
loop
set char=Char2Hex(SubString(s, i, i + 1))
exitwhen i == 8 or char == - 1
set result=result * 16 + char
set i=i + 1
endloop
return result
endfunction
function Int2Hex_FIX takes integer i returns string
set i = BitwiseNot(i)
return HexNumber__Chars[255-(i/256/256/256)] + HexNumber__Chars[255-ModuloInteger(i/256/256,256)] + HexNumber__Chars[255-ModuloInteger(i/256,256)] + HexNumber__Chars[255-ModuloInteger(i,256)]
endfunction
function Int2Hex takes integer i returns string
if (i < 0) then
return Int2Hex_FIX(i)
endif
return HexNumber__Chars[(i/256/256/256)] + HexNumber__Chars[ModuloInteger(i/256/256,256)] + HexNumber__Chars[ModuloInteger(i/256,256)] + HexNumber__Chars[ModuloInteger(i,256)]
endfunction
function HexNumber__onInit takes nothing returns nothing
set HexNumber__Chars[0]="00"
set HexNumber__Chars[1]="01"
set HexNumber__Chars[2]="02"
set HexNumber__Chars[3]="03"
set HexNumber__Chars[4]="04"
set HexNumber__Chars[5]="05"
set HexNumber__Chars[6]="06"
set HexNumber__Chars[7]="07"
set HexNumber__Chars[8]="08"
set HexNumber__Chars[9]="09"
set HexNumber__Chars[10]="0A"
set HexNumber__Chars[11]="0B"
set HexNumber__Chars[12]="0C"
set HexNumber__Chars[13]="0D"
set HexNumber__Chars[14]="0E"
set HexNumber__Chars[15]="0F"
set HexNumber__Chars[16]="10"
set HexNumber__Chars[17]="11"
set HexNumber__Chars[18]="12"
set HexNumber__Chars[19]="13"
set HexNumber__Chars[20]="14"
set HexNumber__Chars[21]="15"
set HexNumber__Chars[22]="16"
set HexNumber__Chars[23]="17"
set HexNumber__Chars[24]="18"
set HexNumber__Chars[25]="19"
set HexNumber__Chars[26]="1A"
set HexNumber__Chars[27]="1B"
set HexNumber__Chars[28]="1C"
set HexNumber__Chars[29]="1D"
set HexNumber__Chars[30]="1E"
set HexNumber__Chars[31]="1F"
set HexNumber__Chars[32]="20"
set HexNumber__Chars[33]="21"
set HexNumber__Chars[34]="22"
set HexNumber__Chars[35]="23"
set HexNumber__Chars[36]="24"
set HexNumber__Chars[37]="25"
set HexNumber__Chars[38]="26"
set HexNumber__Chars[39]="27"
set HexNumber__Chars[40]="28"
set HexNumber__Chars[41]="29"
set HexNumber__Chars[42]="2A"
set HexNumber__Chars[43]="2B"
set HexNumber__Chars[44]="2C"
set HexNumber__Chars[45]="2D"
set HexNumber__Chars[46]="2E"
set HexNumber__Chars[47]="2F"
set HexNumber__Chars[48]="30"
set HexNumber__Chars[49]="31"
set HexNumber__Chars[50]="32"
set HexNumber__Chars[51]="33"
set HexNumber__Chars[52]="34"
set HexNumber__Chars[53]="35"
set HexNumber__Chars[54]="36"
set HexNumber__Chars[55]="37"
set HexNumber__Chars[56]="38"
set HexNumber__Chars[57]="39"
set HexNumber__Chars[58]="3A"
set HexNumber__Chars[59]="3B"
set HexNumber__Chars[60]="3C"
set HexNumber__Chars[61]="3D"
set HexNumber__Chars[62]="3E"
set HexNumber__Chars[63]="3F"
set HexNumber__Chars[64]="40"
set HexNumber__Chars[65]="41"
set HexNumber__Chars[66]="42"
set HexNumber__Chars[67]="43"
set HexNumber__Chars[68]="44"
set HexNumber__Chars[69]="45"
set HexNumber__Chars[70]="46"
set HexNumber__Chars[71]="47"
set HexNumber__Chars[72]="48"
set HexNumber__Chars[73]="49"
set HexNumber__Chars[74]="4A"
set HexNumber__Chars[75]="4B"
set HexNumber__Chars[76]="4C"
set HexNumber__Chars[77]="4D"
set HexNumber__Chars[78]="4E"
set HexNumber__Chars[79]="4F"
set HexNumber__Chars[80]="50"
set HexNumber__Chars[81]="51"
set HexNumber__Chars[82]="52"
set HexNumber__Chars[83]="53"
set HexNumber__Chars[84]="54"
set HexNumber__Chars[85]="55"
set HexNumber__Chars[86]="56"
set HexNumber__Chars[87]="57"
set HexNumber__Chars[88]="58"
set HexNumber__Chars[89]="59"
set HexNumber__Chars[90]="5A"
set HexNumber__Chars[91]="5B"
set HexNumber__Chars[92]="5C"
set HexNumber__Chars[93]="5D"
set HexNumber__Chars[94]="5E"
set HexNumber__Chars[95]="5F"
set HexNumber__Chars[96]="60"
set HexNumber__Chars[97]="61"
set HexNumber__Chars[98]="62"
set HexNumber__Chars[99]="63"
set HexNumber__Chars[100]="64"
set HexNumber__Chars[101]="65"
set HexNumber__Chars[102]="66"
set HexNumber__Chars[103]="67"
set HexNumber__Chars[104]="68"
set HexNumber__Chars[105]="69"
set HexNumber__Chars[106]="6A"
set HexNumber__Chars[107]="6B"
set HexNumber__Chars[108]="6C"
set HexNumber__Chars[109]="6D"
set HexNumber__Chars[110]="6E"
set HexNumber__Chars[111]="6F"
set HexNumber__Chars[112]="70"
set HexNumber__Chars[113]="71"
set HexNumber__Chars[114]="72"
set HexNumber__Chars[115]="73"
set HexNumber__Chars[116]="74"
set HexNumber__Chars[117]="75"
set HexNumber__Chars[118]="76"
set HexNumber__Chars[119]="77"
set HexNumber__Chars[120]="78"
set HexNumber__Chars[121]="79"
set HexNumber__Chars[122]="7A"
set HexNumber__Chars[123]="7B"
set HexNumber__Chars[124]="7C"
set HexNumber__Chars[125]="7D"
set HexNumber__Chars[126]="7E"
set HexNumber__Chars[127]="7F"
set HexNumber__Chars[128]="80"
set HexNumber__Chars[129]="81"
set HexNumber__Chars[130]="82"
set HexNumber__Chars[131]="83"
set HexNumber__Chars[132]="84"
set HexNumber__Chars[133]="85"
set HexNumber__Chars[134]="86"
set HexNumber__Chars[135]="87"
set HexNumber__Chars[136]="88"
set HexNumber__Chars[137]="89"