-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.j
7298 lines (6537 loc) · 509 KB
/
common.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
//============================================================================
// Native types. All native functions take extended handle types when
// possible to help prevent passing bad values to native functions
//
type agent extends handle // all reference counted objects
type event extends agent // a reference to an event registration
type player extends agent // a single player reference
type war3image extends agent // an interactive game object that serves as a base to nearly every model-based object.
type widget extends war3image // an interactive game object with life
type unit extends widget // a single unit reference
type destructable extends widget
type item extends widget
type ability extends agent
type buff extends ability
type force extends agent
type group extends agent
type trigger extends agent
type triggercondition extends agent
type triggeraction extends agent
type timer extends agent
type location extends agent
type region extends agent
type rect extends agent
type boolexpr extends agent
type sound extends agent
type conditionfunc extends boolexpr
type filterfunc extends boolexpr
type unitpool extends handle
type itempool extends handle
type race extends handle
type alliancetype extends handle
type gamestate extends handle
type igamestate extends gamestate
type fgamestate extends gamestate
type playerstate extends handle
type playerscore extends handle
type playergameresult extends handle
type unitstate extends handle
type aidifficulty extends handle
type eventid extends handle
type gameevent extends eventid
type playerevent extends eventid
type playerunitevent extends eventid
type unitevent extends eventid
type limitop extends eventid
type widgetevent extends eventid
type dialogevent extends eventid
type unittype extends handle
type projectiletype extends handle
type gamespeed extends handle
type gamedifficulty extends handle
type mapvisibility extends handle
type mapsetting extends handle
type mapdensity extends handle
type mapcontrol extends handle
type minimapicon extends handle
type playerslotstate extends handle
type volumegroup extends handle
type camerafield extends handle
type camerasetup extends handle
type playercolor extends handle
type placement extends handle
type startlocprio extends handle
type raritycontrol extends handle
type blendmode extends handle
type texmapflags extends handle
type effect extends war3image
type effecttype extends handle
type weathereffect extends handle
type terraindeformation extends handle
type fogstate extends handle
type fogmodifier extends agent
type dialog extends agent
type button extends agent
type quest extends agent
type questitem extends agent
type defeatcondition extends agent
type timerdialog extends agent
type leaderboard extends agent
type multiboard extends agent
type multiboarditem extends agent
type trackable extends war3image
type gamecache extends agent
type version extends handle
type itemtype extends handle
type texttag extends handle
type attacktype extends handle
type damagetype extends handle
type weapontype extends handle
type soundtype extends handle
type lightning extends handle
type pathingtype extends handle
type mappedfield extends handle
type mappedtype extends handle
type attachmenttype extends mappedtype
type bonetype extends attachmenttype
type animtype extends mappedtype
type subanimtype extends animtype
type cursoranimtype extends mappedtype
type image extends handle
type ubersplat extends handle
type hashtable extends agent
type sprite extends war3image
type projectile extends war3image
type doodad extends war3image
type framehandle extends agent
type commandbuttoneffect extends handle
type originframetype extends handle
type framepointtype extends handle
type textaligntype extends handle
type frameeventtype extends handle
type oskeytype extends handle
type mousebuttontype extends handle
type agentdatafield extends handle
type abilityintegerfield extends agentdatafield
type abilityrealfield extends agentdatafield
type abilitybooleanfield extends agentdatafield
type abilitystringfield extends agentdatafield
type abilityintegerlevelfield extends abilityintegerfield
type abilityreallevelfield extends abilityrealfield
type abilitybooleanlevelfield extends abilitybooleanfield
type abilitystringlevelfield extends abilitystringfield
type abilityintegerlevelarrayfield extends abilityintegerlevelfield
type abilityreallevelarrayfield extends abilityreallevelfield
type abilitybooleanlevelarrayfield extends abilitybooleanlevelfield
type abilitystringlevelarrayfield extends abilitystringlevelfield
type destructablestringfield extends agentdatafield
type itemintegerfield extends agentdatafield
type itemrealfield extends agentdatafield
type itembooleanfield extends agentdatafield
type itemstringfield extends agentdatafield
type unitintegerfield extends agentdatafield
type unitrealfield extends agentdatafield
type unitbooleanfield extends agentdatafield
type unitstringfield extends agentdatafield
type unitweaponintegerfield extends agentdatafield
type unitweaponrealfield extends agentdatafield
type unitweaponbooleanfield extends agentdatafield
type unitweaponstringfield extends agentdatafield
type flagtype extends handle
type racepreference extends flagtype
type gametype extends flagtype
type mapflag extends flagtype
type movetype extends flagtype
type pathingaitype extends flagtype
type collisiontype extends flagtype
type targetflag extends flagtype
type unitcategory extends flagtype
type pathingflag extends flagtype
type layoutstyleflag extends flagtype
type gridstyleflag extends flagtype
type layerstyleflag extends flagtype
type controlstyleflag extends flagtype
type framestate extends flagtype
type abilitytype extends flagtype
type armortype extends handle
type heroattribute extends handle
type defensetype extends handle
type regentype extends handle
type timetype extends handle
type variabletype extends handle
type renderstage extends handle
type connectiontype extends handle
type jassthread extends handle
type handlelist extends agent
type textfilehandle extends agent
type orderhandle extends agent
type tradestate extends handle
constant native ConvertRace takes integer i returns race
constant native ConvertAllianceType takes integer i returns alliancetype
constant native ConvertRacePref takes integer i returns racepreference
constant native ConvertIGameState takes integer i returns igamestate
constant native ConvertFGameState takes integer i returns fgamestate
constant native ConvertPlayerState takes integer i returns playerstate
constant native ConvertPlayerScore takes integer i returns playerscore
constant native ConvertPlayerGameResult takes integer i returns playergameresult
constant native ConvertUnitState takes integer i returns unitstate
constant native ConvertAIDifficulty takes integer i returns aidifficulty
constant native ConvertGameEvent takes integer i returns gameevent
constant native ConvertPlayerEvent takes integer i returns playerevent
constant native ConvertPlayerUnitEvent takes integer i returns playerunitevent
constant native ConvertWidgetEvent takes integer i returns widgetevent
constant native ConvertDialogEvent takes integer i returns dialogevent
constant native ConvertUnitEvent takes integer i returns unitevent
constant native ConvertLimitOp takes integer i returns limitop
constant native ConvertUnitType takes integer i returns unittype
constant native ConvertGameSpeed takes integer i returns gamespeed
constant native ConvertPlacement takes integer i returns placement
constant native ConvertStartLocPrio takes integer i returns startlocprio
constant native ConvertGameDifficulty takes integer i returns gamedifficulty
constant native ConvertGameType takes integer i returns gametype
constant native ConvertMapFlag takes integer i returns mapflag
constant native ConvertMapVisibility takes integer i returns mapvisibility
constant native ConvertMapSetting takes integer i returns mapsetting
constant native ConvertMapDensity takes integer i returns mapdensity
constant native ConvertMapControl takes integer i returns mapcontrol
constant native ConvertPlayerColor takes integer i returns playercolor
constant native ConvertPlayerSlotState takes integer i returns playerslotstate
constant native ConvertVolumeGroup takes integer i returns volumegroup
constant native ConvertCameraField takes integer i returns camerafield
constant native ConvertBlendMode takes integer i returns blendmode
constant native ConvertRarityControl takes integer i returns raritycontrol
constant native ConvertTexMapFlags takes integer i returns texmapflags
constant native ConvertFogState takes integer i returns fogstate
constant native ConvertEffectType takes integer i returns effecttype
constant native ConvertVersion takes integer i returns version
constant native ConvertItemType takes integer i returns itemtype
constant native ConvertAttackType takes integer i returns attacktype
constant native ConvertDamageType takes integer i returns damagetype
constant native ConvertWeaponType takes integer i returns weapontype
constant native ConvertSoundType takes integer i returns soundtype
constant native ConvertPathingType takes integer i returns pathingtype
constant native ConvertProjectileType takes integer i returns projectiletype
constant native ConvertMappedField takes integer i returns mappedfield
constant native ConvertAttachmentType takes integer i returns attachmenttype
constant native ConvertBoneType takes integer i returns bonetype
constant native ConvertAnimType takes integer i returns animtype
constant native ConvertSubAnimType takes integer i returns subanimtype
constant native ConvertCursorAnimType takes integer i returns cursoranimtype
constant native ConvertOriginFrameType takes integer i returns originframetype
constant native ConvertFramePointType takes integer i returns framepointtype
constant native ConvertTextAlignType takes integer i returns textaligntype
constant native ConvertFrameEventType takes integer i returns frameeventtype
constant native ConvertOsKeyType takes integer i returns oskeytype
constant native ConvertMouseButtonType takes integer i returns mousebuttontype
constant native ConvertAbilityIntegerField takes integer i returns abilityintegerfield
constant native ConvertAbilityRealField takes integer i returns abilityrealfield
constant native ConvertAbilityBooleanField takes integer i returns abilitybooleanfield
constant native ConvertAbilityStringField takes integer i returns abilitystringfield
constant native ConvertAbilityIntegerLevelField takes integer i returns abilityintegerlevelfield
constant native ConvertAbilityRealLevelField takes integer i returns abilityreallevelfield
constant native ConvertAbilityBooleanLevelField takes integer i returns abilitybooleanlevelfield
constant native ConvertAbilityStringLevelField takes integer i returns abilitystringlevelfield
constant native ConvertAbilityIntegerLevelArrayField takes integer i returns abilityintegerlevelarrayfield
constant native ConvertAbilityRealLevelArrayField takes integer i returns abilityreallevelarrayfield
constant native ConvertAbilityBooleanLevelArrayField takes integer i returns abilitybooleanlevelarrayfield
constant native ConvertAbilityStringLevelArrayField takes integer i returns abilitystringlevelarrayfield
constant native ConvertDestructableStringField takes integer i returns destructablestringfield
constant native ConvertItemIntegerField takes integer i returns itemintegerfield
constant native ConvertItemRealField takes integer i returns itemrealfield
constant native ConvertItemBooleanField takes integer i returns itembooleanfield
constant native ConvertItemStringField takes integer i returns itemstringfield
constant native ConvertUnitIntegerField takes integer i returns unitintegerfield
constant native ConvertUnitRealField takes integer i returns unitrealfield
constant native ConvertUnitBooleanField takes integer i returns unitbooleanfield
constant native ConvertUnitStringField takes integer i returns unitstringfield
constant native ConvertUnitWeaponIntegerField takes integer i returns unitweaponintegerfield
constant native ConvertUnitWeaponRealField takes integer i returns unitweaponrealfield
constant native ConvertUnitWeaponBooleanField takes integer i returns unitweaponbooleanfield
constant native ConvertUnitWeaponStringField takes integer i returns unitweaponstringfield
constant native ConvertMoveType takes integer i returns movetype
constant native ConvertPathingAIType takes integer i returns pathingaitype
constant native ConvertCollisionType takes integer i returns collisiontype
constant native ConvertTargetFlag takes integer i returns targetflag
constant native ConvertArmorType takes integer i returns armortype
constant native ConvertHeroAttribute takes integer i returns heroattribute
constant native ConvertDefenseType takes integer i returns defensetype
constant native ConvertRegenType takes integer i returns regentype
constant native ConvertUnitCategory takes integer i returns unitcategory
constant native ConvertPathingFlag takes integer i returns pathingflag
constant native ConvertTimeType takes integer i returns timetype
constant native ConvertVariableType takes integer i returns variabletype
constant native ConvertRenderStage takes integer i returns renderstage
constant native ConvertLayoutStyleFlag takes integer i returns layoutstyleflag
constant native ConvertGridStyleFlag takes integer i returns gridstyleflag
constant native ConvertLayerStyleFlag takes integer i returns layerstyleflag
constant native ConvertControlStyleFlag takes integer i returns controlstyleflag
constant native ConvertFrameState takes integer i returns framestate
constant native ConvertAbilityType takes integer i returns abilitytype
constant native ConvertConnectionType takes integer i returns connectiontype
constant native ConvertTradeState takes integer i returns tradestate
constant native OrderId takes string orderNameString returns integer
constant native OrderId2String takes integer orderId returns string
constant native UnitId takes string unitTypeIdString returns integer
constant native UnitId2String takes integer unitTypeId returns string
// Not currently working correctly...
constant native AbilityId takes string abilityIdString returns integer
constant native AbilityId2String takes integer abilityTypeId returns string
// Looks up the "name" field for any object (unit, item, ability)
constant native GetObjectName takes integer objectTypeId returns string
constant native GetBJMaxPlayers takes nothing returns integer
constant native GetBJPlayerNeutralVictim takes nothing returns integer
constant native GetBJPlayerNeutralExtra takes nothing returns integer
constant native GetBJMaxPlayerSlots takes nothing returns integer
constant native GetPlayerNeutralPassive takes nothing returns integer
constant native GetPlayerNeutralAggressive takes nothing returns integer
constant native GetJassArrayLimit takes nothing returns integer
constant native GetTextTagLimit takes nothing returns integer
globals
//===================================================
// Game Constants
//===================================================
constant boolean FALSE = false
constant boolean TRUE = true
constant integer JASS_MAX_ARRAY_SIZE = GetJassArrayLimit( ) // Previously was hardcoded 262144, this is subject to change if needed.
constant integer TEXT_TAG_MAX_SIZE = GetTextTagLimit( ) // Original 100 limit raised to 1024, this is subject to change if needed.
constant integer PLAYER_NEUTRAL_PASSIVE = GetPlayerNeutralPassive( )
constant integer PLAYER_NEUTRAL_AGGRESSIVE = GetPlayerNeutralAggressive( )
constant playercolor PLAYER_COLOR_RED = ConvertPlayerColor(0)
constant playercolor PLAYER_COLOR_BLUE = ConvertPlayerColor(1)
constant playercolor PLAYER_COLOR_CYAN = ConvertPlayerColor(2)
constant playercolor PLAYER_COLOR_PURPLE = ConvertPlayerColor(3)
constant playercolor PLAYER_COLOR_YELLOW = ConvertPlayerColor(4)
constant playercolor PLAYER_COLOR_ORANGE = ConvertPlayerColor(5)
constant playercolor PLAYER_COLOR_GREEN = ConvertPlayerColor(6)
constant playercolor PLAYER_COLOR_PINK = ConvertPlayerColor(7)
constant playercolor PLAYER_COLOR_LIGHT_GRAY = ConvertPlayerColor(8)
constant playercolor PLAYER_COLOR_LIGHT_BLUE = ConvertPlayerColor(9)
constant playercolor PLAYER_COLOR_AQUA = ConvertPlayerColor(10)
constant playercolor PLAYER_COLOR_BROWN = ConvertPlayerColor(11)
constant playercolor PLAYER_COLOR_MAROON = ConvertPlayerColor(12)
constant playercolor PLAYER_COLOR_NAVY = ConvertPlayerColor(13)
constant playercolor PLAYER_COLOR_TURQUOISE = ConvertPlayerColor(14)
constant playercolor PLAYER_COLOR_VIOLET = ConvertPlayerColor(15)
constant playercolor PLAYER_COLOR_WHEAT = ConvertPlayerColor(16)
constant playercolor PLAYER_COLOR_PEACH = ConvertPlayerColor(17)
constant playercolor PLAYER_COLOR_MINT = ConvertPlayerColor(18)
constant playercolor PLAYER_COLOR_LAVENDER = ConvertPlayerColor(19)
constant playercolor PLAYER_COLOR_COAL = ConvertPlayerColor(20)
constant playercolor PLAYER_COLOR_SNOW = ConvertPlayerColor(21)
constant playercolor PLAYER_COLOR_EMERALD = ConvertPlayerColor(22)
constant playercolor PLAYER_COLOR_PEANUT = ConvertPlayerColor(23)
constant race RACE_HUMAN = ConvertRace(1)
constant race RACE_ORC = ConvertRace(2)
constant race RACE_UNDEAD = ConvertRace(3)
constant race RACE_NIGHTELF = ConvertRace(4)
constant race RACE_DEMON = ConvertRace(5)
constant race RACE_OTHER = ConvertRace(7)
constant playergameresult PLAYER_GAME_RESULT_VICTORY = ConvertPlayerGameResult(0)
constant playergameresult PLAYER_GAME_RESULT_DEFEAT = ConvertPlayerGameResult(1)
constant playergameresult PLAYER_GAME_RESULT_TIE = ConvertPlayerGameResult(2)
constant playergameresult PLAYER_GAME_RESULT_NEUTRAL = ConvertPlayerGameResult(3)
constant alliancetype ALLIANCE_PASSIVE = ConvertAllianceType(0)
constant alliancetype ALLIANCE_HELP_REQUEST = ConvertAllianceType(1)
constant alliancetype ALLIANCE_HELP_RESPONSE = ConvertAllianceType(2)
constant alliancetype ALLIANCE_SHARED_XP = ConvertAllianceType(3)
constant alliancetype ALLIANCE_SHARED_SPELLS = ConvertAllianceType(4)
constant alliancetype ALLIANCE_SHARED_VISION = ConvertAllianceType(5)
constant alliancetype ALLIANCE_SHARED_CONTROL = ConvertAllianceType(6)
constant alliancetype ALLIANCE_SHARED_ADVANCED_CONTROL = ConvertAllianceType(7)
constant alliancetype ALLIANCE_RESCUABLE = ConvertAllianceType(8)
constant alliancetype ALLIANCE_SHARED_VISION_FORCED = ConvertAllianceType(9)
constant version VERSION_REIGN_OF_CHAOS = ConvertVersion(0)
constant version VERSION_FROZEN_THRONE = ConvertVersion(1)
constant attacktype ATTACK_TYPE_NORMAL = ConvertAttackType(0)
constant attacktype ATTACK_TYPE_MELEE = ConvertAttackType(1)
constant attacktype ATTACK_TYPE_PIERCE = ConvertAttackType(2)
constant attacktype ATTACK_TYPE_SIEGE = ConvertAttackType(3)
constant attacktype ATTACK_TYPE_MAGIC = ConvertAttackType(4)
constant attacktype ATTACK_TYPE_CHAOS = ConvertAttackType(5)
constant attacktype ATTACK_TYPE_HERO = ConvertAttackType(6)
constant damagetype DAMAGE_TYPE_UNKNOWN = ConvertDamageType(0)
constant damagetype DAMAGE_TYPE_NORMAL = ConvertDamageType(4)
constant damagetype DAMAGE_TYPE_ENHANCED = ConvertDamageType(5)
constant damagetype DAMAGE_TYPE_FIRE = ConvertDamageType(8)
constant damagetype DAMAGE_TYPE_COLD = ConvertDamageType(9)
constant damagetype DAMAGE_TYPE_LIGHTNING = ConvertDamageType(10)
constant damagetype DAMAGE_TYPE_POISON = ConvertDamageType(11)
constant damagetype DAMAGE_TYPE_DISEASE = ConvertDamageType(12)
constant damagetype DAMAGE_TYPE_DIVINE = ConvertDamageType(13)
constant damagetype DAMAGE_TYPE_MAGIC = ConvertDamageType(14)
constant damagetype DAMAGE_TYPE_SONIC = ConvertDamageType(15)
constant damagetype DAMAGE_TYPE_ACID = ConvertDamageType(16)
constant damagetype DAMAGE_TYPE_FORCE = ConvertDamageType(17)