warscript 0.0.1-dev.4cfb266 → 0.0.1-dev.4f51f48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/attributes.d.ts +6 -0
  2. package/attributes.lua +17 -1
  3. package/core/types/frame.lua +24 -21
  4. package/core/types/player.d.ts +15 -0
  5. package/core/types/player.lua +56 -14
  6. package/core/types/playerCamera.d.ts +2 -0
  7. package/core/types/playerCamera.lua +123 -5
  8. package/core/types/tileCell.d.ts +11 -1
  9. package/core/types/tileCell.lua +97 -0
  10. package/core/types/timer.d.ts +3 -1
  11. package/core/types/timer.lua +27 -2
  12. package/decl/native.d.ts +6 -4
  13. package/engine/behavior.d.ts +5 -0
  14. package/engine/behavior.lua +106 -27
  15. package/engine/behaviour/ability/apply-buff.lua +1 -1
  16. package/engine/behaviour/ability/damage.d.ts +4 -2
  17. package/engine/behaviour/ability/damage.lua +24 -36
  18. package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
  19. package/engine/behaviour/ability/emulate-impact.lua +11 -3
  20. package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
  21. package/engine/behaviour/ability/remove-buffs.lua +21 -0
  22. package/engine/behaviour/ability/restore-mana.d.ts +1 -1
  23. package/engine/behaviour/ability/restore-mana.lua +6 -6
  24. package/engine/behaviour/ability.lua +8 -17
  25. package/engine/behaviour/unit/stun-immunity.d.ts +7 -3
  26. package/engine/behaviour/unit/stun-immunity.lua +52 -27
  27. package/engine/behaviour/unit.d.ts +33 -1
  28. package/engine/behaviour/unit.lua +190 -4
  29. package/engine/buff.d.ts +12 -5
  30. package/engine/buff.lua +125 -87
  31. package/engine/internal/ability.d.ts +7 -1
  32. package/engine/internal/ability.lua +49 -9
  33. package/engine/internal/item/ability.lua +63 -11
  34. package/engine/internal/item+owner.lua +12 -6
  35. package/engine/internal/item.d.ts +16 -16
  36. package/engine/internal/item.lua +135 -49
  37. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  38. package/engine/internal/misc/frame-coordinates.lua +21 -0
  39. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  40. package/engine/internal/misc/get-terrain-z.lua +11 -0
  41. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  42. package/engine/internal/misc/player-local-handle.lua +5 -0
  43. package/engine/internal/unit/ability.d.ts +35 -0
  44. package/engine/internal/unit/ability.lua +98 -9
  45. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  46. package/engine/internal/unit/allowed-targets.lua +9 -1
  47. package/engine/internal/unit/fly-height.d.ts +7 -0
  48. package/engine/internal/unit/fly-height.lua +20 -0
  49. package/engine/internal/unit/main-selected.lua +12 -27
  50. package/engine/internal/unit/order.d.ts +20 -0
  51. package/engine/internal/unit/order.lua +136 -0
  52. package/engine/internal/unit/scale.d.ts +7 -0
  53. package/engine/internal/unit/scale.lua +20 -0
  54. package/engine/internal/unit+ability.lua +10 -1
  55. package/engine/internal/unit-missile-launch.lua +45 -14
  56. package/engine/internal/unit.d.ts +29 -18
  57. package/engine/internal/unit.lua +257 -140
  58. package/engine/local-client.d.ts +2 -0
  59. package/engine/local-client.lua +30 -0
  60. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  61. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  62. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  63. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  64. package/engine/object-data/entry/ability-type.lua +5 -4
  65. package/engine/object-data/entry/unit-type.d.ts +11 -2
  66. package/engine/object-data/entry/unit-type.lua +59 -1
  67. package/engine/object-field/ability.d.ts +3 -3
  68. package/engine/object-field/ability.lua +7 -6
  69. package/engine/object-field/unit.d.ts +24 -1
  70. package/engine/object-field/unit.lua +91 -0
  71. package/engine/object-field.d.ts +15 -6
  72. package/engine/object-field.lua +219 -124
  73. package/engine/random.d.ts +9 -0
  74. package/engine/random.lua +13 -0
  75. package/engine/standard/fields/unit.d.ts +6 -0
  76. package/engine/standard/fields/unit.lua +11 -0
  77. package/engine/synchronization.d.ts +11 -0
  78. package/engine/synchronization.lua +77 -0
  79. package/engine/text-tag.d.ts +36 -2
  80. package/engine/text-tag.lua +250 -10
  81. package/engine/unit.d.ts +3 -0
  82. package/engine/unit.lua +3 -0
  83. package/net/socket.lua +1 -1
  84. package/objutil/buff.lua +1 -1
  85. package/package.json +2 -2
  86. package/patch-lualib.lua +1 -1
  87. package/utility/arrays.d.ts +1 -0
  88. package/utility/arrays.lua +8 -0
  89. package/utility/callback-array.d.ts +17 -0
  90. package/utility/callback-array.lua +61 -0
  91. package/utility/functions.d.ts +7 -0
  92. package/utility/functions.lua +12 -0
  93. package/utility/linked-set.d.ts +1 -0
  94. package/utility/linked-set.lua +19 -1
  95. package/utility/lua-maps.d.ts +12 -2
  96. package/utility/lua-maps.lua +37 -2
  97. package/utility/lua-sets.d.ts +1 -0
  98. package/utility/lua-sets.lua +4 -0
  99. package/utility/types.d.ts +3 -0
  100. package/core/types/order.d.ts +0 -25
  101. package/core/types/order.lua +0 -55
@@ -3,6 +3,7 @@ import { Unit } from "../core/types/unit";
3
3
  import { Async } from "../core/types/async";
4
4
  import { Event, TriggerEvent } from "../event";
5
5
  import { GraphicsMode } from "./index";
6
+ import { Color } from "../core/types/color";
6
7
  export declare class LocalClient {
7
8
  private constructor();
8
9
  static readonly locale: string;
@@ -11,6 +12,7 @@ export declare class LocalClient {
11
12
  static get isHD(): boolean;
12
13
  static get graphicsMode(): GraphicsMode;
13
14
  static get isActive(): boolean;
15
+ static pingMinimap(x: number, y: number, duration: number, ...parameters: [] | [red: number, green: number, blue: number, extraEffects?: boolean] | [color: Color, extraEffects?: boolean]): void;
14
16
  static get mouseFocusUnit(): Async<Unit> | undefined;
15
17
  static get mainSelectedUnit(): Async<Unit> | undefined;
16
18
  static get mainSelectedUnitChangeEvent(): Event<[
@@ -1,6 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
3
  local __TS__Class = ____lualib.__TS__Class
4
+ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
4
5
  local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
5
6
  local __TS__New = ____lualib.__TS__New
6
7
  local ____exports = {}
@@ -15,6 +16,8 @@ local ____player = require("core.types.player")
15
16
  local Player = ____player.Player
16
17
  local ____timer = require("core.types.timer")
17
18
  local Timer = ____timer.Timer
19
+ local ____color = require("core.types.color")
20
+ local Color = ____color.Color
18
21
  local loadTOCFile = BlzLoadTOCFile
19
22
  local getLocalClientWidth = BlzGetLocalClientWidth
20
23
  local getLocalClientHeight = BlzGetLocalClientHeight
@@ -25,6 +28,8 @@ local getMouseFocusUnit = BlzGetMouseFocusUnit
25
28
  local getUnitRealField = BlzGetUnitRealField
26
29
  local getUnitTypeId = GetUnitTypeId
27
30
  local getLocale = BlzGetLocale
31
+ local pingMinimap = PingMinimap
32
+ local pingMinimapEx = PingMinimapEx
28
33
  local tableSort = table.sort
29
34
  local tocPath = "_warscript\\IsHD.toc"
30
35
  compiletime(function()
@@ -62,6 +67,31 @@ local LocalClient = ____exports.LocalClient
62
67
  LocalClient.name = "LocalClient"
63
68
  function LocalClient.prototype.____constructor(self)
64
69
  end
70
+ function LocalClient.pingMinimap(self, x, y, duration, redOrColor, greenOrExtraEffects, blue, extraEffects)
71
+ if redOrColor == nil then
72
+ pingMinimap(x, y, duration)
73
+ elseif __TS__InstanceOf(redOrColor, Color) then
74
+ pingMinimapEx(
75
+ x,
76
+ y,
77
+ duration,
78
+ redOrColor.r,
79
+ redOrColor.g,
80
+ redOrColor.b,
81
+ greenOrExtraEffects or false
82
+ )
83
+ else
84
+ pingMinimapEx(
85
+ x,
86
+ y,
87
+ duration,
88
+ redOrColor,
89
+ greenOrExtraEffects,
90
+ blue,
91
+ extraEffects or false
92
+ )
93
+ end
94
+ end
65
95
  LocalClient.locale = getLocale()
66
96
  __TS__ObjectDefineProperty(
67
97
  LocalClient,
@@ -0,0 +1,11 @@
1
+ /** @noSelfInFile */
2
+ export declare const enum ArmorType {
3
+ LIGHT = 0,
4
+ MEDIUM = 1,
5
+ HEAVY = 2,
6
+ FORTIFIED = 3,
7
+ NORMAL = 4,
8
+ HERO = 5,
9
+ DIVINE = 6,
10
+ UNARMORED = 7
11
+ }
@@ -0,0 +1,46 @@
1
+ local ____exports = {}
2
+ local ____records = require("utility.records")
3
+ local invertRecord = ____records.invertRecord
4
+ local stringByArmorType = {
5
+ [0] = "small",
6
+ [1] = "medium",
7
+ [2] = "large",
8
+ [3] = "fort",
9
+ [4] = "normal",
10
+ [5] = "hero",
11
+ [6] = "divine",
12
+ [7] = "none"
13
+ }
14
+ local armorTypeByString = invertRecord(stringByArmorType)
15
+ local nativeByArmorType = {
16
+ [0] = DEFENSE_TYPE_LIGHT,
17
+ [1] = DEFENSE_TYPE_MEDIUM,
18
+ [2] = DEFENSE_TYPE_LARGE,
19
+ [3] = DEFENSE_TYPE_FORT,
20
+ [4] = DEFENSE_TYPE_NORMAL,
21
+ [5] = DEFENSE_TYPE_HERO,
22
+ [6] = DEFENSE_TYPE_DIVINE,
23
+ [7] = DEFENSE_TYPE_NONE
24
+ }
25
+ local armorTypeByNative = invertRecord(nativeByArmorType)
26
+ ---
27
+ -- @internal For use by internal systems only.
28
+ ____exports.armorTypeToString = function(armorType)
29
+ return stringByArmorType[armorType]
30
+ end
31
+ ---
32
+ -- @internal For use by internal systems only.
33
+ ____exports.stringToArmorType = function(____string)
34
+ return armorTypeByString[____string] or 7
35
+ end
36
+ ---
37
+ -- @internal For use by internal systems only.
38
+ ____exports.armorTypeToNative = function(armorType)
39
+ return nativeByArmorType[armorType]
40
+ end
41
+ ---
42
+ -- @internal For use by internal systems only.
43
+ ____exports.nativeToArmorType = function(armorType)
44
+ return armorTypeByNative[armorType]
45
+ end
46
+ return ____exports
@@ -0,0 +1,8 @@
1
+ /** @noSelfInFile */
2
+ import { AbilityType, AbilityTypeId } from "../ability-type";
3
+ import { ObjectDataEntryLevelFieldValueSupplier } from "../../entry";
4
+ export declare class PermanentInvisibilityAbilityType extends AbilityType {
5
+ static readonly BASE_ID: AbilityTypeId;
6
+ get shouldAutoAcquireAttackTargets(): boolean[];
7
+ set shouldAutoAcquireAttackTargets(shouldAutoAcquireAttackTargets: ObjectDataEntryLevelFieldValueSupplier<boolean>);
8
+ }
@@ -0,0 +1,26 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
+ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local ____exports = {}
6
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
7
+ local AbilityType = ____ability_2Dtype.AbilityType
8
+ ____exports.PermanentInvisibilityAbilityType = __TS__Class()
9
+ local PermanentInvisibilityAbilityType = ____exports.PermanentInvisibilityAbilityType
10
+ PermanentInvisibilityAbilityType.name = "PermanentInvisibilityAbilityType"
11
+ __TS__ClassExtends(PermanentInvisibilityAbilityType, AbilityType)
12
+ PermanentInvisibilityAbilityType.BASE_ID = fourCC("Apiv")
13
+ __TS__SetDescriptor(
14
+ PermanentInvisibilityAbilityType.prototype,
15
+ "shouldAutoAcquireAttackTargets",
16
+ {
17
+ get = function(self)
18
+ return self:getBooleanLevelField("Gho1")
19
+ end,
20
+ set = function(self, shouldAutoAcquireAttackTargets)
21
+ self:setBooleanLevelField("Gho1", shouldAutoAcquireAttackTargets)
22
+ end
23
+ },
24
+ true
25
+ )
26
+ return ____exports
@@ -38,6 +38,8 @@ local ____sound = require("core.types.sound")
38
38
  local isSoundLabelCustom = ____sound.isSoundLabelCustom
39
39
  local Sound3D = ____sound.Sound3D
40
40
  local SoundSettings = ____sound.SoundSettings
41
+ local ____lua_2Dsets = require("utility.lua-sets")
42
+ local luaSetOf = ____lua_2Dsets.luaSetOf
41
43
  local castAnimationFQNByAbilityTypeId = {}
42
44
  local isButtonVisibleFalseAbilityTypes = {}
43
45
  local casterCastingEffectPresetsByAbilityTypeId = {}
@@ -979,9 +981,7 @@ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnima
979
981
  4,
980
982
  function(caster, ability)
981
983
  if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
982
- Timer:run(function()
983
- caster:playAnimation(animationFQN)
984
- end)
984
+ Timer:run(caster, "playAnimation", animationFQN)
985
985
  end
986
986
  end
987
987
  )
@@ -1006,9 +1006,10 @@ for abilityTypeId, soundPresetId in pairs(postcompile(function() return targetEf
1006
1006
  )
1007
1007
  end
1008
1008
  end
1009
+ local unsupportedEffectSoundAbilityTypeIds = luaSetOf(fourCC("AAns"))
1009
1010
  Unit.abilityChannelingStartEvent:addListener(function(caster, ability)
1010
1011
  local soundPresetId = ability:getField(ABILITY_SF_EFFECT_SOUND)
1011
- if isSoundLabelCustom(soundPresetId) then
1012
+ if isSoundLabelCustom(soundPresetId) or soundPresetId ~= "" and unsupportedEffectSoundAbilityTypeIds[ability.parentTypeId] ~= nil then
1012
1013
  Sound3D:playFromLabel(soundPresetId, SoundSettings.Ability, caster)
1013
1014
  end
1014
1015
  end)
@@ -13,6 +13,7 @@ import type { AbilityTypeId } from "./ability-type";
13
13
  import type { UpgradeId } from "./upgrade";
14
14
  import { AnimationQualifier } from "../auxiliary/animation-qualifier";
15
15
  import { AttackType } from "../auxiliary/attack-type";
16
+ import { ArmorType } from "../auxiliary/armor-type";
16
17
  export type UnitTypeId = ObjectDataEntryId & number & {
17
18
  readonly __unitTypeId: unique symbol;
18
19
  };
@@ -144,6 +145,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
144
145
  set runSpeedSD(runSpeedSD: number);
145
146
  get runSpeedHD(): number;
146
147
  set runSpeedHD(runSpeedHD: number);
148
+ get selectionCircleHeight(): number;
149
+ set selectionCircleHeight(height: number);
147
150
  get selectionCircleScale(): number;
148
151
  set selectionCircleScale(selectionCircleScale: number);
149
152
  get selectionCircleScaleSD(): number;
@@ -182,16 +185,20 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
182
185
  set walkSpeedSD(walkSpeedSD: number);
183
186
  get walkSpeedHD(): number;
184
187
  set walkSpeedHD(walkSpeedHD: number);
188
+ get armor(): number;
189
+ set armor(armor: number);
185
190
  get armorSoundType(): ArmorSoundType;
186
191
  set armorSoundType(armorSoundType: ArmorSoundType);
187
192
  get armorSoundTypeSD(): ArmorSoundType;
188
193
  set armorSoundTypeSD(armorSoundTypeSD: ArmorSoundType);
189
194
  get armorSoundTypeHD(): ArmorSoundType;
190
195
  set armorSoundTypeHD(armorSoundTypeHD: ArmorSoundType);
196
+ get armorType(): ArmorType;
197
+ set armorType(armorType: ArmorType);
191
198
  get combatClassifications(): CombatClassifications;
192
199
  set combatClassifications(combatClassifications: CombatClassifications);
193
- get unitClassifications(): UnitClassifications;
194
- set unitClassifications(unitClassifications: UnitClassifications);
200
+ get classifications(): UnitClassifications;
201
+ set classifications(unitClassifications: UnitClassifications);
195
202
  get weapons(): TupleOf<UnitTypeWeapon, 2>;
196
203
  get firstWeapon(): UnitTypeWeapon;
197
204
  get secondWeapon(): UnitTypeWeapon;
@@ -225,6 +232,8 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
225
232
  set goldCost(goldCost: number);
226
233
  get healthRegenerationRate(): number;
227
234
  set healthRegenerationRate(healthRegenerationRate: number);
235
+ get level(): number;
236
+ set level(level: number);
228
237
  get manaRegenerationRate(): number;
229
238
  set manaRegenerationRate(manaRegenerationRate: number);
230
239
  get maximumHealth(): number;
@@ -27,6 +27,9 @@ local attackTypeToString = ____attack_2Dtype.attackTypeToString
27
27
  local stringToAttackType = ____attack_2Dtype.stringToAttackType
28
28
  local ____config = require("config")
29
29
  local WarscriptConfig = ____config.WarscriptConfig
30
+ local ____armor_2Dtype = require("engine.object-data.auxiliary.armor-type")
31
+ local armorTypeToString = ____armor_2Dtype.armorTypeToString
32
+ local stringToArmorType = ____armor_2Dtype.stringToArmorType
30
33
  local getOrCreateUnitTypeWeapons
31
34
  ____exports.UnitTypeWeapon = __TS__Class()
32
35
  local UnitTypeWeapon = ____exports.UnitTypeWeapon
@@ -936,6 +939,19 @@ __TS__SetDescriptor(
936
939
  },
937
940
  true
938
941
  )
942
+ __TS__SetDescriptor(
943
+ UnitType.prototype,
944
+ "selectionCircleHeight",
945
+ {
946
+ get = function(self)
947
+ return self:getNumberField("uslz")
948
+ end,
949
+ set = function(self, height)
950
+ self:setNumberField("uslz", height)
951
+ end
952
+ },
953
+ true
954
+ )
939
955
  __TS__SetDescriptor(
940
956
  UnitType.prototype,
941
957
  "selectionCircleScale",
@@ -1183,6 +1199,19 @@ __TS__SetDescriptor(
1183
1199
  },
1184
1200
  true
1185
1201
  )
1202
+ __TS__SetDescriptor(
1203
+ UnitType.prototype,
1204
+ "armor",
1205
+ {
1206
+ get = function(self)
1207
+ return self:getNumberField("udef")
1208
+ end,
1209
+ set = function(self, armor)
1210
+ self:setNumberField("udef", armor)
1211
+ end
1212
+ },
1213
+ true
1214
+ )
1186
1215
  __TS__SetDescriptor(
1187
1216
  UnitType.prototype,
1188
1217
  "armorSoundType",
@@ -1222,6 +1251,22 @@ __TS__SetDescriptor(
1222
1251
  },
1223
1252
  true
1224
1253
  )
1254
+ __TS__SetDescriptor(
1255
+ UnitType.prototype,
1256
+ "armorType",
1257
+ {
1258
+ get = function(self)
1259
+ return stringToArmorType(self:getStringField("udty"))
1260
+ end,
1261
+ set = function(self, armorType)
1262
+ self:setStringField(
1263
+ "udty",
1264
+ armorTypeToString(armorType)
1265
+ )
1266
+ end
1267
+ },
1268
+ true
1269
+ )
1225
1270
  __TS__SetDescriptor(
1226
1271
  UnitType.prototype,
1227
1272
  "combatClassifications",
@@ -1240,7 +1285,7 @@ __TS__SetDescriptor(
1240
1285
  )
1241
1286
  __TS__SetDescriptor(
1242
1287
  UnitType.prototype,
1243
- "unitClassifications",
1288
+ "classifications",
1244
1289
  {
1245
1290
  get = function(self)
1246
1291
  return stringArrayToUnitClassifications(self:getStringsField("utyp"))
@@ -1476,6 +1521,19 @@ __TS__SetDescriptor(
1476
1521
  },
1477
1522
  true
1478
1523
  )
1524
+ __TS__SetDescriptor(
1525
+ UnitType.prototype,
1526
+ "level",
1527
+ {
1528
+ get = function(self)
1529
+ return self:getNumberField("ulev")
1530
+ end,
1531
+ set = function(self, level)
1532
+ self:setNumberField("ulev", level)
1533
+ end
1534
+ },
1535
+ true
1536
+ )
1479
1537
  __TS__SetDescriptor(
1480
1538
  UnitType.prototype,
1481
1539
  "manaRegenerationRate",
@@ -12,7 +12,7 @@ import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
12
12
  export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
13
13
  protected get instanceClass(): typeof Ability;
14
14
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
15
- protected hasNativeFieldValue(instance: Ability): boolean;
15
+ protected hasNativeFieldValue(abilityTypeId: AbilityTypeId): boolean;
16
16
  static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<AbilityField>>;
17
17
  }
18
18
  export declare class AbilityBooleanField extends AbilityField<boolean, jabilitybooleanfield> {
@@ -48,7 +48,7 @@ export declare class AbilityStringField extends AbilityField<string, jabilitystr
48
48
  export declare abstract class AbilityArrayField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectArrayField<AbilityType, Ability, ValueType, NativeFieldType> {
49
49
  protected get instanceClass(): typeof Ability;
50
50
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
51
- protected hasNativeFieldValue(instance: Ability): boolean;
51
+ protected hasNativeFieldValue(abilityTypeId: AbilityTypeId): boolean;
52
52
  }
53
53
  export declare class AbilityStringArrayField extends AbilityArrayField<string, jabilitystringlevelfield> {
54
54
  protected get defaultValue(): string;
@@ -68,7 +68,7 @@ export declare abstract class AbilityLevelField<ValueType extends number | strin
68
68
  protected get instanceClass(): typeof Ability;
69
69
  protected getLevelCount(entry: AbilityType | Ability): number;
70
70
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
71
- protected hasNativeFieldValue(instance: Ability): boolean;
71
+ protected hasNativeFieldValue(abilityTypeId: AbilityTypeId): boolean;
72
72
  static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<ReadonlyObjectLevelFieldType<AbilityLevelField>>;
73
73
  }
74
74
  export declare class AbilityBooleanLevelField extends AbilityLevelField<boolean, boolean, jabilityintegerlevelfield> {
@@ -7,6 +7,7 @@ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
7
7
  local ____exports = {}
8
8
  local ____ability = require("engine.internal.ability")
9
9
  local Ability = ____ability.Ability
10
+ local abilityTypeHasField = ____ability.abilityTypeHasField
10
11
  local ____object_2Dfield = require("engine.object-field")
11
12
  local ObjectArrayField = ____object_2Dfield.ObjectArrayField
12
13
  local ObjectField = ____object_2Dfield.ObjectField
@@ -29,8 +30,8 @@ __TS__ClassExtends(AbilityField, ObjectField)
29
30
  function AbilityField.prototype.getObjectDataEntryId(self, instance)
30
31
  return instance.typeId
31
32
  end
32
- function AbilityField.prototype.hasNativeFieldValue(self, instance)
33
- return instance:hasField(self.nativeField)
33
+ function AbilityField.prototype.hasNativeFieldValue(self, abilityTypeId)
34
+ return abilityTypeHasField(abilityTypeId, self.nativeField)
34
35
  end
35
36
  __TS__SetDescriptor(
36
37
  AbilityField.prototype,
@@ -197,8 +198,8 @@ __TS__ClassExtends(AbilityArrayField, ObjectArrayField)
197
198
  function AbilityArrayField.prototype.getObjectDataEntryId(self, instance)
198
199
  return instance.typeId
199
200
  end
200
- function AbilityArrayField.prototype.hasNativeFieldValue(self, instance)
201
- return instance:hasField(self.nativeField)
201
+ function AbilityArrayField.prototype.hasNativeFieldValue(self, abilityTypeId)
202
+ return abilityTypeHasField(abilityTypeId, self.nativeField)
202
203
  end
203
204
  __TS__SetDescriptor(
204
205
  AbilityArrayField.prototype,
@@ -269,8 +270,8 @@ end
269
270
  function AbilityLevelField.prototype.getObjectDataEntryId(self, instance)
270
271
  return instance.typeId
271
272
  end
272
- function AbilityLevelField.prototype.hasNativeFieldValue(self, instance)
273
- return instance:hasField(self.nativeField)
273
+ function AbilityLevelField.prototype.hasNativeFieldValue(self, abilityTypeId)
274
+ return abilityTypeHasField(abilityTypeId, self.nativeField)
274
275
  end
275
276
  __TS__SetDescriptor(
276
277
  AbilityLevelField.prototype,
@@ -1,37 +1,43 @@
1
1
  /** @noSelfInFile */
2
2
  import { Unit } from "../internal/unit";
3
- import { ObjectField, ObjectLevelField, ObjectLevelFieldValueChangeEvent, ReadonlyObjectLevelFieldType } from "../object-field";
3
+ import { ObjectField, ObjectFieldValueChangeEvent, ObjectLevelField, ObjectLevelFieldValueChangeEvent, ReadonlyObjectFieldType, ReadonlyObjectLevelFieldType } from "../object-field";
4
4
  import { UnitType, UnitTypeId } from "../object-data/entry/unit-type";
5
5
  import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
6
6
  import { AttackType } from "../object-data/auxiliary/attack-type";
7
+ import { UnitClassifications } from "../object-data/auxiliary/unit-classification";
7
8
  export declare abstract class UnitField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType = any> extends ObjectField<UnitType, Unit, ValueType, NativeFieldType> {
8
9
  protected get instanceClass(): typeof Unit;
9
10
  protected getObjectDataEntryId(instance: Unit): UnitTypeId;
10
11
  protected hasNativeFieldValue(): boolean;
12
+ static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitField>>;
11
13
  }
12
14
  export declare class UnitBooleanField extends UnitField<boolean, junitbooleanfield> {
13
15
  protected get defaultValue(): boolean;
14
16
  protected getNativeFieldById(id: number): junitbooleanfield;
15
17
  protected getNativeFieldValue(instance: Unit): boolean;
16
18
  protected setNativeFieldValue(instance: Unit, value: boolean): boolean;
19
+ static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitBooleanField>>;
17
20
  }
18
21
  export declare class UnitFloatField extends UnitField<number, junitrealfield> {
19
22
  protected get defaultValue(): number;
20
23
  protected getNativeFieldById(id: number): junitrealfield;
21
24
  protected getNativeFieldValue(instance: Unit): number;
22
25
  protected setNativeFieldValue(instance: Unit, value: number): boolean;
26
+ static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitFloatField>>;
23
27
  }
24
28
  export declare class UnitIntegerField extends UnitField<number, junitintegerfield> {
25
29
  protected get defaultValue(): number;
26
30
  protected getNativeFieldById(id: number): junitintegerfield;
27
31
  protected getNativeFieldValue(instance: Unit): number;
28
32
  protected setNativeFieldValue(instance: Unit, value: number): boolean;
33
+ static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitIntegerField>>;
29
34
  }
30
35
  export declare class UnitStringField extends UnitField<string, junitstringfield> {
31
36
  protected get defaultValue(): string;
32
37
  protected getNativeFieldById(id: number): junitstringfield;
33
38
  protected getNativeFieldValue(instance: Unit): string;
34
39
  protected setNativeFieldValue(instance: Unit, value: string): boolean;
40
+ static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<UnitStringField>>;
35
41
  }
36
42
  type junitweaponfield = junitweaponbooleanfield | junitweaponintegerfield | junitweaponrealfield | junitweaponstringfield;
37
43
  export declare abstract class UnitWeaponField<ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType extends junitweaponfield = junitweaponfield> extends ObjectLevelField<UnitType, Unit, ValueType, InputValueType, NativeFieldType> {
@@ -56,4 +62,21 @@ export declare abstract class UnitEnumWeaponField<T extends number> extends Unit
56
62
  export declare class UnitAttackTypeWeaponField extends UnitEnumWeaponField<AttackType> {
57
63
  protected values: ReadonlyNonEmptyLinkedSet<AttackType>;
58
64
  }
65
+ export declare class UnitClassificationsField extends UnitField<UnitClassifications, junitintegerfield> {
66
+ protected get defaultValue(): UnitClassifications;
67
+ protected getNativeFieldById(id: number): junitintegerfield;
68
+ protected getNativeFieldValue(instance: Unit): UnitClassifications;
69
+ protected setNativeFieldValue(instance: Unit, value: UnitClassifications): boolean;
70
+ }
71
+ export declare class UnitFlyHeightField extends UnitFloatField {
72
+ protected getNativeFieldValue(instance: Unit): number;
73
+ protected setNativeFieldValue(instance: Unit, value: number): boolean;
74
+ }
75
+ export declare class UnitPropulsionWindowField extends UnitFloatField {
76
+ protected getNativeFieldValue(instance: Unit): number;
77
+ protected setNativeFieldValue(instance: Unit, value: number): boolean;
78
+ }
79
+ export declare class UnitScalingValueField extends UnitFloatField {
80
+ protected setNativeFieldValue(instance: Unit, value: number): boolean;
81
+ }
59
82
  export {};
@@ -18,6 +18,11 @@ local convertUnitStringField = ConvertUnitStringField
18
18
  local convertUnitWeaponIntegerField = ConvertUnitWeaponIntegerField
19
19
  local getUnitWeaponIntegerField = BlzGetUnitWeaponIntegerField
20
20
  local setUnitWeaponIntegerField = BlzSetUnitWeaponIntegerField
21
+ local getUnitFlyHeight = GetUnitFlyHeight
22
+ local setUnitFlyHeight = SetUnitFlyHeight
23
+ local getUnitPropulsionWindow = GetUnitPropWindow
24
+ local setUnitPropulsionWindow = SetUnitPropWindow
25
+ local setUnitScale = SetUnitScale
21
26
  ____exports.UnitField = __TS__Class()
22
27
  local UnitField = ____exports.UnitField
23
28
  UnitField.name = "UnitField"
@@ -36,6 +41,13 @@ __TS__SetDescriptor(
36
41
  end},
37
42
  true
38
43
  )
44
+ __TS__ObjectDefineProperty(
45
+ UnitField,
46
+ "valueChangeEvent",
47
+ {get = function(self)
48
+ return self:getOrCreateValueChangeEvent()
49
+ end}
50
+ )
39
51
  ____exports.UnitBooleanField = __TS__Class()
40
52
  local UnitBooleanField = ____exports.UnitBooleanField
41
53
  UnitBooleanField.name = "UnitBooleanField"
@@ -57,6 +69,13 @@ __TS__SetDescriptor(
57
69
  end},
58
70
  true
59
71
  )
72
+ __TS__ObjectDefineProperty(
73
+ UnitBooleanField,
74
+ "valueChangeEvent",
75
+ {get = function(self)
76
+ return self:getOrCreateValueChangeEvent()
77
+ end}
78
+ )
60
79
  ____exports.UnitFloatField = __TS__Class()
61
80
  local UnitFloatField = ____exports.UnitFloatField
62
81
  UnitFloatField.name = "UnitFloatField"
@@ -78,6 +97,13 @@ __TS__SetDescriptor(
78
97
  end},
79
98
  true
80
99
  )
100
+ __TS__ObjectDefineProperty(
101
+ UnitFloatField,
102
+ "valueChangeEvent",
103
+ {get = function(self)
104
+ return self:getOrCreateValueChangeEvent()
105
+ end}
106
+ )
81
107
  ____exports.UnitIntegerField = __TS__Class()
82
108
  local UnitIntegerField = ____exports.UnitIntegerField
83
109
  UnitIntegerField.name = "UnitIntegerField"
@@ -99,6 +125,13 @@ __TS__SetDescriptor(
99
125
  end},
100
126
  true
101
127
  )
128
+ __TS__ObjectDefineProperty(
129
+ UnitIntegerField,
130
+ "valueChangeEvent",
131
+ {get = function(self)
132
+ return self:getOrCreateValueChangeEvent()
133
+ end}
134
+ )
102
135
  ____exports.UnitStringField = __TS__Class()
103
136
  local UnitStringField = ____exports.UnitStringField
104
137
  UnitStringField.name = "UnitStringField"
@@ -120,6 +153,13 @@ __TS__SetDescriptor(
120
153
  end},
121
154
  true
122
155
  )
156
+ __TS__ObjectDefineProperty(
157
+ UnitStringField,
158
+ "valueChangeEvent",
159
+ {get = function(self)
160
+ return self:getOrCreateValueChangeEvent()
161
+ end}
162
+ )
123
163
  ____exports.UnitWeaponField = __TS__Class()
124
164
  local UnitWeaponField = ____exports.UnitWeaponField
125
165
  UnitWeaponField.name = "UnitWeaponField"
@@ -215,4 +255,55 @@ function UnitAttackTypeWeaponField.prototype.____constructor(self, ...)
215
255
  6
216
256
  )
217
257
  end
258
+ ____exports.UnitClassificationsField = __TS__Class()
259
+ local UnitClassificationsField = ____exports.UnitClassificationsField
260
+ UnitClassificationsField.name = "UnitClassificationsField"
261
+ __TS__ClassExtends(UnitClassificationsField, ____exports.UnitField)
262
+ function UnitClassificationsField.prototype.getNativeFieldById(self, id)
263
+ return convertUnitIntegerField(id)
264
+ end
265
+ function UnitClassificationsField.prototype.getNativeFieldValue(self, instance)
266
+ return instance:getField(self.nativeField)
267
+ end
268
+ function UnitClassificationsField.prototype.setNativeFieldValue(self, instance, value)
269
+ return instance:setField(self.nativeField, value)
270
+ end
271
+ __TS__SetDescriptor(
272
+ UnitClassificationsField.prototype,
273
+ "defaultValue",
274
+ {get = function(self)
275
+ return 0
276
+ end},
277
+ true
278
+ )
279
+ ____exports.UnitFlyHeightField = __TS__Class()
280
+ local UnitFlyHeightField = ____exports.UnitFlyHeightField
281
+ UnitFlyHeightField.name = "UnitFlyHeightField"
282
+ __TS__ClassExtends(UnitFlyHeightField, ____exports.UnitFloatField)
283
+ function UnitFlyHeightField.prototype.getNativeFieldValue(self, instance)
284
+ return getUnitFlyHeight(instance.handle)
285
+ end
286
+ function UnitFlyHeightField.prototype.setNativeFieldValue(self, instance, value)
287
+ setUnitFlyHeight(instance.handle, value, 100000)
288
+ return true
289
+ end
290
+ ____exports.UnitPropulsionWindowField = __TS__Class()
291
+ local UnitPropulsionWindowField = ____exports.UnitPropulsionWindowField
292
+ UnitPropulsionWindowField.name = "UnitPropulsionWindowField"
293
+ __TS__ClassExtends(UnitPropulsionWindowField, ____exports.UnitFloatField)
294
+ function UnitPropulsionWindowField.prototype.getNativeFieldValue(self, instance)
295
+ return getUnitPropulsionWindow(instance.handle)
296
+ end
297
+ function UnitPropulsionWindowField.prototype.setNativeFieldValue(self, instance, value)
298
+ setUnitPropulsionWindow(instance.handle, value)
299
+ return true
300
+ end
301
+ ____exports.UnitScalingValueField = __TS__Class()
302
+ local UnitScalingValueField = ____exports.UnitScalingValueField
303
+ UnitScalingValueField.name = "UnitScalingValueField"
304
+ __TS__ClassExtends(UnitScalingValueField, ____exports.UnitFloatField)
305
+ function UnitScalingValueField.prototype.setNativeFieldValue(self, instance, value)
306
+ setUnitScale(instance.handle, value, value, value)
307
+ return UnitScalingValueField.____super.prototype.setNativeFieldValue(self, instance, value)
308
+ end
218
309
  return ____exports