warscript 0.0.1-dev.ee2345e → 0.0.1-dev.f024cc2

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 (248) hide show
  1. package/attributes.d.ts +5 -1
  2. package/attributes.lua +8 -1
  3. package/binaryreader.d.ts +1 -0
  4. package/binaryreader.lua +3 -0
  5. package/config.d.ts +5 -0
  6. package/config.lua +10 -0
  7. package/core/types/effect.d.ts +14 -6
  8. package/core/types/effect.lua +131 -35
  9. package/core/types/frame.d.ts +8 -1
  10. package/core/types/frame.lua +103 -13
  11. package/core/types/group.d.ts +0 -1
  12. package/core/types/image.d.ts +0 -1
  13. package/core/types/missile.d.ts +2 -2
  14. package/core/types/missile.lua +8 -2
  15. package/core/types/player.lua +3 -1
  16. package/core/types/playerCamera.d.ts +2 -0
  17. package/core/types/playerCamera.lua +79 -5
  18. package/core/types/sound.d.ts +17 -24
  19. package/core/types/sound.lua +99 -24
  20. package/core/types/timer.d.ts +8 -8
  21. package/core/types/timer.lua +25 -23
  22. package/core/types/unit.lua +8 -0
  23. package/core/util.d.ts +1 -1
  24. package/core/util.lua +18 -1
  25. package/decl/index.d.ts +1 -0
  26. package/decl/native.d.ts +844 -788
  27. package/engine/ability.d.ts +1 -1
  28. package/engine/behavior.d.ts +12 -10
  29. package/engine/behavior.lua +59 -33
  30. package/engine/behaviour/ability/always-enabled.d.ts +7 -0
  31. package/engine/behaviour/ability/always-enabled.lua +31 -0
  32. package/engine/behaviour/ability/apply-buff.d.ts +8 -5
  33. package/engine/behaviour/ability/apply-buff.lua +32 -0
  34. package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
  35. package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
  36. package/engine/behaviour/ability/damage.d.ts +39 -11
  37. package/engine/behaviour/ability/damage.lua +83 -37
  38. package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
  39. package/engine/behaviour/ability/emulate-impact.lua +43 -0
  40. package/engine/behaviour/ability/heal.d.ts +33 -6
  41. package/engine/behaviour/ability/heal.lua +89 -10
  42. package/engine/behaviour/ability/instant-impact.d.ts +2 -2
  43. package/engine/behaviour/ability/instant-impact.lua +4 -15
  44. package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
  45. package/engine/behaviour/ability/on-command-impact.lua +25 -0
  46. package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
  47. package/engine/behaviour/ability/remove-buffs.lua +28 -0
  48. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  49. package/engine/behaviour/ability/restore-mana.lua +29 -0
  50. package/engine/behaviour/ability.d.ts +27 -4
  51. package/engine/behaviour/ability.lua +152 -26
  52. package/engine/behaviour/unit/stun-immunity.d.ts +5 -4
  53. package/engine/behaviour/unit/stun-immunity.lua +43 -27
  54. package/engine/behaviour/unit.d.ts +36 -2
  55. package/engine/behaviour/unit.lua +186 -0
  56. package/engine/buff.d.ts +104 -41
  57. package/engine/buff.lua +471 -212
  58. package/engine/game-map.d.ts +7 -0
  59. package/engine/game-map.lua +32 -0
  60. package/engine/internal/ability.d.ts +20 -13
  61. package/engine/internal/ability.lua +103 -76
  62. package/engine/internal/item/ability.lua +162 -4
  63. package/engine/internal/item+owner.lua +12 -6
  64. package/engine/internal/item.d.ts +7 -4
  65. package/engine/internal/item.lua +131 -28
  66. package/engine/internal/mechanics/ability-duration.lua +1 -1
  67. package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
  68. package/engine/internal/misc/ability-disable-counter.lua +13 -0
  69. package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
  70. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  71. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  72. package/engine/internal/misc/frame-coordinates.lua +21 -0
  73. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  74. package/engine/internal/misc/get-terrain-z.lua +11 -0
  75. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  76. package/engine/internal/misc/player-local-handle.lua +5 -0
  77. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  78. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  79. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  80. package/engine/internal/object-data/evasion-probability.lua +16 -0
  81. package/engine/internal/unit/ability.d.ts +45 -1
  82. package/engine/internal/unit/ability.lua +98 -14
  83. package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
  84. package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
  85. package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
  86. package/engine/internal/unit/add-item-to-slot.lua +52 -0
  87. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  88. package/engine/internal/unit/allowed-targets.lua +9 -1
  89. package/engine/internal/unit/bonus.d.ts +11 -8
  90. package/engine/internal/unit/bonus.lua +23 -1
  91. package/engine/internal/unit/ignore-events-items.d.ts +2 -0
  92. package/engine/internal/unit/ignore-events-items.lua +5 -0
  93. package/engine/internal/unit/item.d.ts +24 -0
  94. package/engine/internal/unit/item.lua +78 -0
  95. package/engine/internal/unit/main-selected.d.ts +13 -0
  96. package/engine/internal/unit/main-selected.lua +51 -0
  97. package/engine/internal/unit/order.d.ts +20 -0
  98. package/engine/internal/unit/order.lua +136 -0
  99. package/engine/internal/unit+ability.lua +3 -3
  100. package/engine/internal/unit+damage.d.ts +2 -11
  101. package/engine/internal/unit+damage.lua +10 -14
  102. package/engine/internal/unit+spellSteal.lua +1 -2
  103. package/engine/internal/unit+transport.lua +4 -10
  104. package/engine/internal/unit-missile-launch.lua +33 -7
  105. package/engine/internal/unit.d.ts +87 -22
  106. package/engine/internal/unit.lua +585 -195
  107. package/engine/internal/utility.lua +12 -0
  108. package/engine/lightning.d.ts +12 -5
  109. package/engine/lightning.lua +48 -14
  110. package/engine/local-client.d.ts +7 -2
  111. package/engine/local-client.lua +82 -0
  112. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  113. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  114. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  115. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  116. package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -3
  117. package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
  118. package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
  119. package/engine/object-data/auxiliary/attack-type.lua +42 -0
  120. package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
  121. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  122. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  123. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  124. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  125. package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
  126. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  127. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  128. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  129. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  130. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  131. package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
  132. package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
  133. package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
  134. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  135. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  136. package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
  137. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  138. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  139. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  140. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  141. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  142. package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
  143. package/engine/object-data/entry/ability-type/mine.lua +39 -0
  144. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  145. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  146. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  147. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  148. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  149. package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
  150. package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
  151. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  152. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  153. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  154. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  155. package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
  156. package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
  157. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  158. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  159. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  160. package/engine/object-data/entry/ability-type/web.lua +52 -0
  161. package/engine/object-data/entry/ability-type.d.ts +19 -18
  162. package/engine/object-data/entry/ability-type.lua +90 -36
  163. package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
  164. package/engine/object-data/entry/buff-type/applicable.lua +18 -37
  165. package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
  166. package/engine/object-data/entry/buff-type.d.ts +6 -13
  167. package/engine/object-data/entry/buff-type.lua +13 -29
  168. package/engine/object-data/entry/destructible-type.d.ts +1 -2
  169. package/engine/object-data/entry/item-type/blank.d.ts +0 -1
  170. package/engine/object-data/entry/item-type.d.ts +15 -2
  171. package/engine/object-data/entry/item-type.lua +93 -2
  172. package/engine/object-data/entry/lightning-type.d.ts +1 -2
  173. package/engine/object-data/entry/sound-preset.d.ts +33 -0
  174. package/engine/object-data/entry/sound-preset.lua +140 -0
  175. package/engine/object-data/entry/unit-type.d.ts +58 -7
  176. package/engine/object-data/entry/unit-type.lua +480 -75
  177. package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
  178. package/engine/object-data/entry/upgrade.d.ts +1 -2
  179. package/engine/object-data/entry/upgrade.lua +4 -4
  180. package/engine/object-data/entry.d.ts +18 -17
  181. package/engine/object-data/entry.lua +60 -32
  182. package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
  183. package/engine/object-field/ability.d.ts +26 -3
  184. package/engine/object-field/ability.lua +54 -1
  185. package/engine/object-field/unit.d.ts +57 -3
  186. package/engine/object-field/unit.lua +207 -7
  187. package/engine/object-field.d.ts +17 -7
  188. package/engine/object-field.lua +187 -89
  189. package/engine/random.d.ts +1 -0
  190. package/engine/random.lua +9 -0
  191. package/engine/standard/entries/buff-type.d.ts +3 -0
  192. package/engine/standard/entries/buff-type.lua +3 -0
  193. package/engine/standard/entries/sound-preset.d.ts +10 -0
  194. package/engine/standard/entries/sound-preset.lua +10 -0
  195. package/engine/standard/entries/unit-type.d.ts +39 -1
  196. package/engine/standard/entries/unit-type.lua +39 -1
  197. package/engine/standard/fields/ability.d.ts +3 -1
  198. package/engine/standard/fields/ability.lua +3 -1
  199. package/engine/standard/fields/unit.d.ts +4 -0
  200. package/engine/standard/fields/unit.lua +7 -0
  201. package/engine/text-tag.d.ts +36 -2
  202. package/engine/text-tag.lua +249 -10
  203. package/engine/unit.d.ts +4 -0
  204. package/engine/unit.lua +13 -2
  205. package/event.d.ts +2 -3
  206. package/event.lua +9 -5
  207. package/index.d.ts +1 -0
  208. package/index.lua +1 -0
  209. package/lualib_bundle.lua +146 -42
  210. package/math/vec2.d.ts +2 -9
  211. package/math.d.ts +0 -2
  212. package/net/socket.d.ts +7 -1
  213. package/net/socket.lua +45 -4
  214. package/network.d.ts +1 -0
  215. package/network.lua +3 -2
  216. package/objutil/ability.d.ts +0 -1
  217. package/objutil/buff.d.ts +0 -1
  218. package/objutil/buff.lua +2 -3
  219. package/objutil/object.d.ts +0 -1
  220. package/objutil/unit.d.ts +0 -1
  221. package/objutil/unit.lua +8 -0
  222. package/package.json +13 -14
  223. package/patch-lua.d.ts +0 -0
  224. package/patch-lua.lua +10 -0
  225. package/property.d.ts +55 -0
  226. package/property.lua +374 -0
  227. package/string.d.ts +30 -0
  228. package/string.lua +14 -0
  229. package/util/stream.d.ts +0 -1
  230. package/utility/arrays.d.ts +12 -5
  231. package/utility/arrays.lua +37 -3
  232. package/utility/bit-set.d.ts +0 -2
  233. package/utility/functions.d.ts +8 -0
  234. package/utility/functions.lua +13 -0
  235. package/utility/lazy.d.ts +2 -0
  236. package/utility/lazy.lua +14 -0
  237. package/utility/linked-set.d.ts +12 -3
  238. package/utility/linked-set.lua +8 -2
  239. package/utility/lua-maps.d.ts +5 -2
  240. package/utility/lua-maps.lua +20 -0
  241. package/utility/lua-sets.d.ts +3 -2
  242. package/utility/lua-sets.lua +7 -0
  243. package/utility/reflection.lua +11 -7
  244. package/utility/types.d.ts +1 -0
  245. package/core/mapbounds.d.ts +0 -8
  246. package/core/mapbounds.lua +0 -12
  247. package/core/types/order.d.ts +0 -25
  248. package/core/types/order.lua +0 -55
@@ -1,4 +1,5 @@
1
1
  /** @noSelfInFile */
2
+ import type { Unit } from "../../engine/internal/unit";
2
3
  export declare class PlayerCamera {
3
4
  private readonly player;
4
5
  private readonly isLocal;
@@ -28,5 +29,6 @@ export declare class PlayerCamera {
28
29
  get roll(): number;
29
30
  set roll(v: number);
30
31
  reset(): void;
32
+ static isUnitInView(unit: Unit): boolean;
31
33
  static of(player: jplayer): PlayerCamera;
32
34
  }
@@ -3,33 +3,49 @@ local __TS__Class = ____lualib.__TS__Class
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
5
  local ____exports = {}
6
+ local ____timer = require("core.types.timer")
7
+ local Timer = ____timer.Timer
8
+ local ____player_2Dlocal_2Dhandle = require("engine.internal.misc.player-local-handle")
9
+ local PLAYER_LOCAL_HANDLE = ____player_2Dlocal_2Dhandle.PLAYER_LOCAL_HANDLE
10
+ local ____preconditions = require("utility.preconditions")
11
+ local check = ____preconditions.check
12
+ local ____frame_2Dcoordinates = require("engine.internal.misc.frame-coordinates")
13
+ local FRAME_MAX_Y = ____frame_2Dcoordinates.FRAME_MAX_Y
14
+ local FRAME_MIN_Y = ____frame_2Dcoordinates.FRAME_MIN_Y
15
+ local getFrameMinXMaxX = ____frame_2Dcoordinates.getFrameMinXMaxX
6
16
  local getHandleId = GetHandleId
7
17
  local setCameraField = SetCameraField
8
18
  local getCameraField = GetCameraField
9
19
  local setCameraPosition = SetCameraPosition
20
+ local getCameraEyePositionX = GetCameraEyePositionX
21
+ local getCameraEyePositionY = GetCameraEyePositionY
22
+ local getCameraEyePositionZ = GetCameraEyePositionZ
10
23
  local getCameraTargetPositionX = GetCameraTargetPositionX
11
24
  local getCameraTargetPositionY = GetCameraTargetPositionY
12
25
  local resetToGameCamera = ResetToGameCamera
26
+ local cos = math.cos
13
27
  local deg = math.deg
14
- local localPlayer = GetLocalPlayer()
28
+ local sin = math.sin
15
29
  local memoized = {}
16
30
  ____exports.PlayerCamera = __TS__Class()
17
31
  local PlayerCamera = ____exports.PlayerCamera
18
32
  PlayerCamera.name = "PlayerCamera"
19
33
  function PlayerCamera.prototype.____constructor(self, player)
20
34
  local id = getHandleId(player)
21
- if memoized[id] then
22
- error("Double-constructor run player camera!")
23
- end
35
+ check(memoized[id] == nil)
24
36
  memoized[id] = self
25
37
  self.player = player
26
- self.isLocal = player == localPlayer
38
+ self.isLocal = player == PLAYER_LOCAL_HANDLE
27
39
  end
28
40
  function PlayerCamera.prototype.reset(self)
29
41
  if self.isLocal then
30
42
  resetToGameCamera(0)
31
43
  end
32
44
  end
45
+ function PlayerCamera.isUnitInView(self, unit)
46
+ local ____, ____, isInView = ____exports.worldCoordinatesToFrame(unit.x, unit.y, unit.z)
47
+ return isInView
48
+ end
33
49
  function PlayerCamera.of(self, player)
34
50
  return memoized[getHandleId(player)] or __TS__New(____exports.PlayerCamera, player)
35
51
  end
@@ -159,4 +175,62 @@ __TS__SetDescriptor(
159
175
  },
160
176
  true
161
177
  )
178
+ local cameraEyeX = 0
179
+ local cameraEyeY = 0
180
+ local cameraEyeZ = 0
181
+ local cameraAngleOfAttack = 0
182
+ local cameraAngleOfAttackCos = 0
183
+ local cameraAngleOfAttackSin = 0
184
+ local cameraRotation = 0
185
+ local cameraRotationCos = 0
186
+ local cameraRotationSin = 0
187
+ local cameraAngleOfAttackCosRotationCos = 0
188
+ local cameraAngleOfAttackCosRotationSin = 0
189
+ local cameraAngleOfAttackSinRotationCos = 0
190
+ local cameraAngleOfAttackSinRotationSin = 0
191
+ local yCenterScreenShift = 0
192
+ local scaleFactor = 0
193
+ local frameMinX = 0
194
+ local frameMaxX = 0
195
+ local isCameraViewPrecalculated = false
196
+ local function precalculateCameraView()
197
+ cameraEyeX = getCameraEyePositionX()
198
+ cameraEyeY = getCameraEyePositionY()
199
+ cameraEyeZ = getCameraEyePositionZ()
200
+ cameraAngleOfAttack = getCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK)
201
+ cameraAngleOfAttackCos = cos(cameraAngleOfAttack)
202
+ cameraAngleOfAttackSin = sin(cameraAngleOfAttack)
203
+ cameraRotation = getCameraField(CAMERA_FIELD_ROTATION)
204
+ cameraRotationCos = cos(cameraRotation)
205
+ cameraRotationSin = sin(cameraRotation)
206
+ cameraAngleOfAttackCosRotationCos = cameraAngleOfAttackCos * cameraRotationCos
207
+ cameraAngleOfAttackCosRotationSin = cameraAngleOfAttackCos * cameraRotationSin
208
+ cameraAngleOfAttackSinRotationCos = cameraAngleOfAttackSin * cameraRotationCos
209
+ cameraAngleOfAttackSinRotationSin = cameraAngleOfAttackSin * cameraRotationSin
210
+ yCenterScreenShift = 0.1284 * cameraAngleOfAttackCos
211
+ local cameraFieldOfView = getCameraField(CAMERA_FIELD_FIELD_OF_VIEW)
212
+ scaleFactor = 0.0524 * cameraFieldOfView ^ 3 - 0.0283 * cameraFieldOfView ^ 2 + 1.061 * cameraFieldOfView
213
+ frameMinX, frameMaxX = getFrameMinXMaxX()
214
+ isCameraViewPrecalculated = true
215
+ end
216
+ Timer.onPeriod[1 / 64]:addListener(
217
+ 4,
218
+ function()
219
+ isCameraViewPrecalculated = false
220
+ end
221
+ )
222
+ ---
223
+ -- @internal For use by internal systems only.
224
+ ____exports.worldCoordinatesToFrame = function(x, y, z)
225
+ if not isCameraViewPrecalculated then
226
+ precalculateCameraView()
227
+ end
228
+ local dx = x - cameraEyeX
229
+ local dy = y - cameraEyeY
230
+ local dz = z - cameraEyeZ
231
+ local xPrime = scaleFactor * (-cameraAngleOfAttackCosRotationCos * dx - cameraAngleOfAttackCosRotationSin * dy - cameraAngleOfAttackSin * dz)
232
+ local frameX = 0.4 + (cameraRotationCos * dy - cameraRotationSin * dx) / xPrime
233
+ local frameY = 0.42625 - yCenterScreenShift + (cameraAngleOfAttackSinRotationCos * dx + cameraAngleOfAttackSinRotationSin * dy - cameraAngleOfAttackCos * dz) / xPrime
234
+ return frameX, frameY, xPrime < 0 and frameX >= frameMinX and frameX <= frameMaxX and frameY >= FRAME_MIN_Y and frameY <= FRAME_MAX_Y
235
+ end
162
236
  return ____exports
@@ -1,6 +1,7 @@
1
1
  /** @noSelfInFile */
2
2
  import { Handle, HandleDestructor } from "./handle";
3
3
  import { Unit } from "./unit";
4
+ import { SoundEax } from "../../engine/object-data/auxiliary/sound-eax";
4
5
  export declare enum SoundChannel {
5
6
  General = 0,
6
7
  UnitSelection = 1,
@@ -18,16 +19,7 @@ export declare enum SoundChannel {
18
19
  Birth = 13,
19
20
  Fire = 14
20
21
  }
21
- export declare enum SoundEax {
22
- Default = "DefaultEAXON",
23
- Acknowledgements = "HeroAcksEAX",
24
- Environment = "DoodadsEAX",
25
- Drums = "KotoDrumsEAX",
26
- Attacks = "CombatSoundsEAX",
27
- Abilities = "SpellsEAX",
28
- Missiles = "MissilesEAX"
29
- }
30
- export type SoundPreset = Readonly<{
22
+ export type SoundSettings = Readonly<{
31
23
  channel?: SoundChannel;
32
24
  eax?: SoundEax;
33
25
  fadeInRate?: number;
@@ -36,19 +28,19 @@ export type SoundPreset = Readonly<{
36
28
  volume?: number;
37
29
  pitch?: number;
38
30
  }>;
39
- export type Sound3DPreset = SoundPreset & Readonly<{
31
+ export type Sound3DSettings = SoundSettings & Readonly<{
40
32
  stopWhenOutOfRange?: boolean;
41
33
  minDistance?: number;
42
34
  maxDistance?: number;
43
35
  distanceCutoff?: number;
44
36
  }>;
45
- export declare namespace SoundPreset {
46
- const UI: SoundPreset;
47
- const Music: SoundPreset;
48
- const Attack: Sound3DPreset;
49
- const Ability: Sound3DPreset;
50
- const AbilityLooping: Sound3DPreset;
51
- const Missile: Sound3DPreset;
37
+ export declare namespace SoundSettings {
38
+ const UI: SoundSettings;
39
+ const Music: SoundSettings;
40
+ const Attack: Sound3DSettings;
41
+ const Ability: Sound3DSettings;
42
+ const AbilityLooping: Sound3DSettings;
43
+ const Missile: Sound3DSettings;
52
44
  }
53
45
  export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
54
46
  private _volume?;
@@ -58,12 +50,13 @@ export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
58
50
  start(milliseconds?: number): void;
59
51
  stop(fadeOut?: boolean): void;
60
52
  restart(milliseconds?: number): void;
61
- static play(fileName: string, preset: SoundPreset): void;
62
- static create(fileName: string, preset: SoundPreset): Sound;
53
+ static play(fileName: string, preset: SoundSettings): void;
54
+ static create(fileName: string, preset: SoundSettings): Sound;
63
55
  }
64
56
  export declare class Sound3D extends Sound {
65
- static playAtPosition(fileName: string, preset: Sound3DPreset, x?: number, y?: number, z?: number): void;
66
- static playOnUnit(fileName: string, preset: Sound3DPreset, unit: Unit): void;
67
- static createAtPosition(fileName: string, preset: Sound3DPreset, x?: number, y?: number, z?: number): Sound3D;
68
- static createOnUnit(fileName: string, preset: Sound3DPreset, unit: Unit): Sound3D;
57
+ static playAtPosition(fileName: string, preset: Sound3DSettings, x?: number, y?: number, z?: number): void;
58
+ static playOnUnit(fileName: string, preset: Sound3DSettings, unit: Unit): void;
59
+ static playFromLabel(label: string, preset: Sound3DSettings, ...positionOrUnit: [Unit] | [number, number, number?]): void;
60
+ static createAtPosition(fileName: string, preset: Sound3DSettings, x?: number, y?: number, z?: number): Sound3D;
61
+ static createOnUnit(fileName: string, preset: Sound3DSettings, unit: Unit): Sound3D;
69
62
  }
@@ -5,15 +5,18 @@ local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
5
  local ____exports = {}
6
6
  local ____handle = require("core.types.handle")
7
7
  local Handle = ____handle.Handle
8
+ local ____sound_2Dpreset = require("engine.object-data.entry.sound-preset")
9
+ local SoundPreset = ____sound_2Dpreset.SoundPreset
10
+ local ____random = require("engine.random")
11
+ local randomInteger = ____random.randomInteger
8
12
  local createSound = CreateSound
13
+ local createSoundFromLabel = CreateSoundFromLabel
9
14
  local setSoundPitch = SetSoundPitch
10
15
  local setSoundChannel = SetSoundChannel
11
16
  local setSoundPosition = SetSoundPosition
12
17
  local setSoundVolume = SetSoundVolume
13
18
  local setSoundDistances = SetSoundDistances
14
19
  local setSoundDistanceCutoff = SetSoundDistanceCutoff
15
- local setSoundConeAngles = SetSoundConeAngles
16
- local setSoundConeOrientation = SetSoundConeOrientation
17
20
  local startSound = StartSound
18
21
  local setSoundPlayPosition = SetSoundPlayPosition
19
22
  local stopSound = StopSound
@@ -50,29 +53,21 @@ ____exports.SoundChannel.Birth = 13
50
53
  ____exports.SoundChannel[____exports.SoundChannel.Birth] = "Birth"
51
54
  ____exports.SoundChannel.Fire = 14
52
55
  ____exports.SoundChannel[____exports.SoundChannel.Fire] = "Fire"
53
- ____exports.SoundEax = SoundEax or ({})
54
- ____exports.SoundEax.Default = "DefaultEAXON"
55
- ____exports.SoundEax.Acknowledgements = "HeroAcksEAX"
56
- ____exports.SoundEax.Environment = "DoodadsEAX"
57
- ____exports.SoundEax.Drums = "KotoDrumsEAX"
58
- ____exports.SoundEax.Attacks = "CombatSoundsEAX"
59
- ____exports.SoundEax.Abilities = "SpellsEAX"
60
- ____exports.SoundEax.Missiles = "MissilesEAX"
61
- ____exports.SoundPreset = {}
62
- local SoundPreset = ____exports.SoundPreset
56
+ ____exports.SoundSettings = {}
57
+ local SoundSettings = ____exports.SoundSettings
63
58
  do
64
- SoundPreset.UI = {channel = ____exports.SoundChannel.UI, eax = ____exports.SoundEax.Default, fadeInRate = 12700, fadeOutRate = 12700}
65
- SoundPreset.Music = {
59
+ SoundSettings.UI = {channel = ____exports.SoundChannel.UI, eax = "DefaultEAXON", fadeInRate = 12700, fadeOutRate = 12700}
60
+ SoundSettings.Music = {
66
61
  channel = ____exports.SoundChannel.Music,
67
- eax = ____exports.SoundEax.Default,
62
+ eax = "DefaultEAXON",
68
63
  fadeInRate = 12700,
69
64
  fadeOutRate = 12700,
70
65
  looping = true
71
66
  }
72
- SoundPreset.Attack = {channel = ____exports.SoundChannel.Combat, eax = ____exports.SoundEax.Attacks, fadeInRate = 10, fadeOutRate = 10}
73
- SoundPreset.Ability = {
67
+ SoundSettings.Attack = {channel = ____exports.SoundChannel.Combat, eax = "CombatSoundsEAX", fadeInRate = 10, fadeOutRate = 10}
68
+ SoundSettings.Ability = {
74
69
  channel = ____exports.SoundChannel.Animations,
75
- eax = ____exports.SoundEax.Abilities,
70
+ eax = "SpellsEAX",
76
71
  stopWhenOutOfRange = true,
77
72
  volume = 127,
78
73
  fadeInRate = 1,
@@ -82,9 +77,9 @@ do
82
77
  maxDistance = 3500,
83
78
  distanceCutoff = 3000
84
79
  }
85
- SoundPreset.AbilityLooping = {
80
+ SoundSettings.AbilityLooping = {
86
81
  channel = ____exports.SoundChannel.Birth,
87
- eax = ____exports.SoundEax.Abilities,
82
+ eax = "SpellsEAX",
88
83
  looping = true,
89
84
  stopWhenOutOfRange = true,
90
85
  volume = 127,
@@ -95,9 +90,9 @@ do
95
90
  maxDistance = 3000,
96
91
  distanceCutoff = 3000
97
92
  }
98
- SoundPreset.Missile = {
93
+ SoundSettings.Missile = {
99
94
  channel = ____exports.SoundChannel.Animations,
100
- eax = ____exports.SoundEax.Missiles,
95
+ eax = "MissilesEAX",
101
96
  stopWhenOutOfRange = true,
102
97
  volume = 127,
103
98
  fadeInRate = 1,
@@ -108,6 +103,29 @@ do
108
103
  distanceCutoff = 3000
109
104
  }
110
105
  end
106
+ local customSoundPresetDataByLabel = postcompile(function()
107
+ local customSoundPresetDataByLabel = {}
108
+ for ____, soundPreset in ipairs(SoundPreset:getAll()) do
109
+ if soundPreset.isCustom then
110
+ customSoundPresetDataByLabel[soundPreset.id] = {
111
+ filePaths = soundPreset.filePaths,
112
+ volume = soundPreset.volume,
113
+ pitch = soundPreset.pitch,
114
+ channel = soundPreset.channel,
115
+ minimumDistance = soundPreset.minimumDistance,
116
+ maximumDistance = soundPreset.maximumDistance,
117
+ distanceCutoff = soundPreset.distanceCutoff,
118
+ eax = soundPreset.eax
119
+ }
120
+ end
121
+ end
122
+ return customSoundPresetDataByLabel
123
+ end)
124
+ ---
125
+ -- @internal For use by internal systems only.
126
+ ____exports.isSoundLabelCustom = function(label)
127
+ return customSoundPresetDataByLabel[label] ~= nil
128
+ end
111
129
  local function createPresetSound(fileName, preset)
112
130
  local ____fileName_1 = fileName
113
131
  local ____preset_looping_0 = preset.looping
@@ -121,7 +139,7 @@ local function createPresetSound(fileName, preset)
121
139
  true,
122
140
  preset.fadeInRate or 12700,
123
141
  preset.fadeOutRate or 12700,
124
- preset.eax or ____exports.SoundEax.Default
142
+ preset.eax or "DefaultEAXON"
125
143
  )
126
144
  setSoundChannel(sound, preset.channel or ____exports.SoundChannel.General)
127
145
  setSoundVolume(sound, preset.volume or 127)
@@ -144,7 +162,7 @@ local function createPreset3DSound(fileName, preset)
144
162
  ____preset_stopWhenOutOfRange_3,
145
163
  preset.fadeInRate or 12700,
146
164
  preset.fadeOutRate or 12700,
147
- preset.eax or ____exports.SoundEax.Default
165
+ preset.eax or "DefaultEAXON"
148
166
  )
149
167
  setSoundChannel(sound, preset.channel or ____exports.SoundChannel.General)
150
168
  setSoundVolume(sound, preset.volume or 127)
@@ -153,6 +171,53 @@ local function createPreset3DSound(fileName, preset)
153
171
  setSoundDistanceCutoff(sound, preset.distanceCutoff or 1500)
154
172
  return sound
155
173
  end
174
+ local function createPreset3DSoundFromLabel(label, preset)
175
+ local customSoundPresetData = customSoundPresetDataByLabel[label]
176
+ if customSoundPresetData == nil then
177
+ local ____label_7 = label
178
+ local ____preset_looping_5 = preset.looping
179
+ if ____preset_looping_5 == nil then
180
+ ____preset_looping_5 = false
181
+ end
182
+ local ____preset_stopWhenOutOfRange_6 = preset.stopWhenOutOfRange
183
+ if ____preset_stopWhenOutOfRange_6 == nil then
184
+ ____preset_stopWhenOutOfRange_6 = true
185
+ end
186
+ return createSoundFromLabel(
187
+ ____label_7,
188
+ ____preset_looping_5,
189
+ true,
190
+ ____preset_stopWhenOutOfRange_6,
191
+ preset.fadeInRate or 12700,
192
+ preset.fadeOutRate or 12700
193
+ )
194
+ else
195
+ local ____customSoundPresetData_filePaths_index_10 = customSoundPresetData.filePaths[randomInteger(#customSoundPresetData.filePaths - 1) + 1]
196
+ local ____preset_looping_8 = preset.looping
197
+ if ____preset_looping_8 == nil then
198
+ ____preset_looping_8 = false
199
+ end
200
+ local ____preset_stopWhenOutOfRange_9 = preset.stopWhenOutOfRange
201
+ if ____preset_stopWhenOutOfRange_9 == nil then
202
+ ____preset_stopWhenOutOfRange_9 = true
203
+ end
204
+ local sound = createSound(
205
+ ____customSoundPresetData_filePaths_index_10,
206
+ ____preset_looping_8,
207
+ true,
208
+ ____preset_stopWhenOutOfRange_9,
209
+ preset.fadeInRate or 12700,
210
+ preset.fadeOutRate or 12700,
211
+ customSoundPresetData.eax
212
+ )
213
+ setSoundChannel(sound, customSoundPresetData.channel)
214
+ setSoundVolume(sound, customSoundPresetData.volume)
215
+ setSoundPitch(sound, customSoundPresetData.pitch)
216
+ setSoundDistances(sound, customSoundPresetData.minimumDistance, customSoundPresetData.maximumDistance)
217
+ setSoundDistanceCutoff(sound, customSoundPresetData.distanceCutoff)
218
+ return sound
219
+ end
220
+ end
156
221
  ____exports.Sound = __TS__Class()
157
222
  local Sound = ____exports.Sound
158
223
  Sound.name = "Sound"
@@ -225,6 +290,16 @@ function Sound3D.playOnUnit(self, fileName, preset, unit)
225
290
  startSound(sound)
226
291
  killSoundWhenDone(sound)
227
292
  end
293
+ function Sound3D.playFromLabel(self, label, preset, unitOrX, y, z)
294
+ local sound = createPreset3DSoundFromLabel(label, preset)
295
+ if type(unitOrX) ~= "number" then
296
+ attachSoundToUnit(sound, unitOrX.handle)
297
+ else
298
+ setSoundPosition(sound, unitOrX, y or 0, z or 0)
299
+ end
300
+ startSound(sound)
301
+ killSoundWhenDone(sound)
302
+ end
228
303
  function Sound3D.createAtPosition(self, fileName, preset, x, y, z)
229
304
  if x == nil then
230
305
  x = 0
@@ -1,29 +1,29 @@
1
1
  /** @noSelfInFile */
2
2
  import { Event } from "../../event";
3
+ import { AbstractDestroyable, Destructor } from "../../destroyable";
3
4
  declare const enum TimerPropertyKey {
4
5
  HANDLE = 0,
5
- DESTROYED = 1,
6
- DESTROY_ON_EXPIRATION = 2,
7
- CALLBACK = 3,
8
- ARGS_LENGTH = 4
6
+ DESTROY_ON_EXPIRATION = 1,
7
+ CALLBACK = 2,
8
+ ARGS_LENGTH = 3
9
9
  }
10
- export declare class Timer implements Destroyable {
10
+ export declare class Timer extends AbstractDestroyable {
11
11
  private readonly [TimerPropertyKey.HANDLE];
12
- private [TimerPropertyKey.DESTROYED]?;
13
12
  private [TimerPropertyKey.DESTROY_ON_EXPIRATION]?;
14
13
  private [TimerPropertyKey.CALLBACK]?;
15
14
  private [TimerPropertyKey.ARGS_LENGTH]?;
16
15
  private constructor();
17
16
  get handle(): jtimer;
18
17
  start<Args extends any[]>(timeout: number, periodic: boolean, callback: (...args: Args) => void, ...args: Args): void;
18
+ onDestroy(): Destructor;
19
19
  get elapsed(): number;
20
20
  get remaining(): number;
21
21
  get timeout(): number;
22
22
  pause(): void;
23
23
  resume(): void;
24
- destroy(): void;
25
24
  static create(): Timer;
26
- static run<Args extends any[]>(callback: (...args: Args) => void, ...args: Args): void;
25
+ static run<T, K extends KeysOfType<T, (this: T, ...args: any) => any>>(object: T, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): void;
26
+ static run<Args extends any[]>(callback: (this: void, ...args: Args) => void, ...args: Args): void;
27
27
  static simple<Args extends any[]>(timeout: number, callback: (...args: Args) => void, ...args: Args): Timer;
28
28
  static periodic<Args extends any[]>(period: number, callback: (this: void, timer: Timer, ...args: Args) => void, ...args: Args): Timer;
29
29
  static counted(period: number, count: number, callback: (this: void, timer: Timer) => void): Timer;
@@ -1,6 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
3
  local __TS__Class = ____lualib.__TS__Class
4
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
5
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
6
  local __TS__Promise = ____lualib.__TS__Promise
6
7
  local ____exports = {}
@@ -9,8 +10,8 @@ local Event = ____event.Event
9
10
  local InitializingEvent = ____event.InitializingEvent
10
11
  local ____objectPool = require("util.objectPool")
11
12
  local ObjectPool = ____objectPool.ObjectPool
12
- local ____exception = require("exception")
13
- local IllegalStateException = ____exception.IllegalStateException
13
+ local ____destroyable = require("destroyable")
14
+ local AbstractDestroyable = ____destroyable.AbstractDestroyable
14
15
  local createTimer = CreateTimer
15
16
  local timerStart = TimerStart
16
17
  local pauseTimer = PauseTimer
@@ -23,6 +24,7 @@ local getHandleId = GetHandleId
23
24
  local ____pcall = _G.pcall
24
25
  local ____print = _G.print
25
26
  local select = _G.select
27
+ local ____type = _G.type
26
28
  local safeCall = warpack.safeCall
27
29
  local corunning = coroutine.running
28
30
  local coresume = coroutine.resume
@@ -35,14 +37,14 @@ local timerByHandleId = {}
35
37
  local function timerSafeCall()
36
38
  local timer = timerByHandleId[getHandleId(getExpiredTimer())]
37
39
  if timer ~= nil then
38
- if timer[2] then
40
+ if timer[1] then
39
41
  timer:destroy()
40
42
  end
41
- local callback = timer[3]
43
+ local callback = timer[2]
42
44
  if callback ~= nil then
43
45
  safeCall(
44
46
  callback,
45
- ____unpack(timer, 4 + 1, 4 + (timer[4] or 0))
47
+ ____unpack(timer, 3 + 1, 3 + (timer[3] or 0))
46
48
  )
47
49
  end
48
50
  end
@@ -50,46 +52,46 @@ end
50
52
  ____exports.Timer = __TS__Class()
51
53
  local Timer = ____exports.Timer
52
54
  Timer.name = "Timer"
55
+ __TS__ClassExtends(Timer, AbstractDestroyable)
53
56
  function Timer.prototype.____constructor(self)
57
+ AbstractDestroyable.prototype.____constructor(self)
54
58
  self[0] = get()
55
59
  timerByHandleId[getHandleId(self[0])] = self
56
60
  end
57
61
  function Timer.prototype.start(self, timeout, periodic, callback, ...)
58
- self[3] = callback
62
+ self[2] = callback
59
63
  local argsLength = select("#", ...)
60
- self[4] = argsLength
64
+ self[3] = argsLength
61
65
  for i = 1, argsLength do
62
- self[4 + i] = (select(i, ...))
66
+ self[3 + i] = (select(i, ...))
63
67
  end
64
68
  timerStart(self.handle, timeout, periodic, timerSafeCall)
65
69
  end
70
+ function Timer.prototype.onDestroy(self)
71
+ local handle = self[0]
72
+ timerByHandleId[getHandleId(handle)] = nil
73
+ release(handle)
74
+ return AbstractDestroyable.prototype.onDestroy(self)
75
+ end
66
76
  function Timer.prototype.pause(self)
67
77
  pauseTimer(self[0])
68
78
  end
69
79
  function Timer.prototype.resume(self)
70
80
  resumeTimer(self[0])
71
81
  end
72
- function Timer.prototype.destroy(self)
73
- if self[1] then
74
- error(
75
- __TS__New(IllegalStateException, "Double-destroy run for timer"),
76
- 0
77
- )
78
- end
79
- local handle = self[0]
80
- timerByHandleId[getHandleId(handle)] = nil
81
- release(handle)
82
- self[1] = true
83
- end
84
82
  function Timer.create(self)
85
83
  return __TS__New(____exports.Timer)
86
84
  end
87
- function Timer.run(self, callback, ...)
88
- ____exports.Timer:simple(0, callback, ...)
85
+ function Timer.run(self, objectOrCallback, keyOrFirstArg, ...)
86
+ if ____type(objectOrCallback) == "function" then
87
+ ____exports.Timer:simple(0, objectOrCallback, keyOrFirstArg, ...)
88
+ else
89
+ ____exports.Timer:simple(0, objectOrCallback[keyOrFirstArg], objectOrCallback, ...)
90
+ end
89
91
  end
90
92
  function Timer.simple(self, timeout, callback, ...)
91
93
  local timer = __TS__New(____exports.Timer)
92
- timer[2] = true
94
+ timer[1] = true
93
95
  timer:start(timeout, false, callback, ...)
94
96
  return timer
95
97
  end
@@ -21,4 +21,12 @@ do
21
21
  end
22
22
  end
23
23
  end
24
+ do
25
+ local ____export = require("engine.internal.unit+rally")
26
+ for ____exportKey, ____exportValue in pairs(____export) do
27
+ if ____exportKey ~= "default" then
28
+ ____exports[____exportKey] = ____exportValue
29
+ end
30
+ end
31
+ end
24
32
  return ____exports
package/core/util.d.ts CHANGED
@@ -54,7 +54,7 @@ declare global {
54
54
  function fourCC(id: string): number;
55
55
  }
56
56
  declare namespace inner {
57
- const orderId: (id: "blink" | "stop" | "load" | "sleep" | "absorb" | "acidbomb" | "acolyteharvest" | "ambush" | "ancestralspirit" | "ancestralspirittarget" | "animatedead" | "antimagicshell" | "attack" | "attackground" | "attackonce" | "attributemodskill" | "auraunholy" | "auravampiric" | "autodispel" | "autodispeloff" | "autodispelon" | "autoentangle" | "autoentangleinstant" | "autoharvestgold" | "autoharvestlumber" | "avatar" | "avengerform" | "awaken" | "banish" | "barkskin" | "barkskinoff" | "barkskinon" | "battleroar" | "battlestations" | "bearform" | "berserk" | "blackarrow" | "blackarrowoff" | "blackarrowon" | "blight" | "blizzard" | "bloodlust" | "bloodlustoff" | "bloodluston" | "board" | "breathoffire" | "breathoffrost" | "build" | "burrow" | "cannibalize" | "carrionscarabs" | "carrionscarabsinstant" | "carrionscarabsoff" | "carrionscarabson" | "carrionswarm" | "chainlightning" | "channel" | "charm" | "chemicalrage" | "cloudoffog" | "clusterrockets" | "coldarrows" | "coldarrowstarg" | "controlmagic" | "corporealform" | "corrosivebreath" | "coupleinstant" | "coupletarget" | "creepanimatedead" | "creepdevour" | "creepheal" | "creephealoff" | "creephealon" | "creepthunderbolt" | "creepthunderclap" | "cripple" | "curse" | "curseoff" | "curseon" | "cyclone" | "darkconversion" | "darkportal" | "darkritual" | "darksummoning" | "deathanddecay" | "deathcoil" | "deathpact" | "decouple" | "defend" | "detectaoe" | "detonate" | "devour" | "devourmagic" | "disassociate" | "disenchant" | "dismount" | "dispel" | "divineshield" | "doom" | "drain" | "dreadlordinferno" | "dropitem" | "drunkenhaze" | "earthquake" | "eattree" | "elementalfury" | "ensnare" | "ensnareoff" | "ensnareon" | "entangle" | "entangleinstant" | "entanglingroots" | "etherealform" | "evileye" | "faeriefire" | "faeriefireoff" | "faeriefireon" | "fanofknives" | "farsight" | "fingerofdeath" | "firebolt" | "flamestrike" | "flamingarrows" | "flamingarrowstarg" | "flamingattack" | "flamingattacktarg" | "flare" | "forceboard" | "forceofnature" | "forkedlightning" | "freezingbreath" | "frenzy" | "frenzyoff" | "frenzyon" | "frostarmor" | "frostarmoroff" | "frostarmoron" | "frostnova" | "getitem" | "gold2lumber" | "grabtree" | "harvest" | "heal" | "healingspray" | "healingward" | "healingwave" | "healoff" | "healon" | "hex" | "holdposition" | "holybolt" | "howlofterror" | "humanbuild" | "immolation" | "impale" | "incineratearrow" | "incineratearrowoff" | "incineratearrowon" | "inferno" | "innerfire" | "innerfireoff" | "innerfireon" | "instant" | "invisibility" | "lavamonster" | "lightningshield" | "loadarcher" | "loadcorpse" | "loadcorpseinstant" | "locustswarm" | "lumber2gold" | "magicdefense" | "magicleash" | "magicundefense" | "manaburn" | "manaflareoff" | "manaflareon" | "manashieldoff" | "manashieldon" | "massteleport" | "mechanicalcritter" | "metamorphosis" | "militia" | "militiaconvert" | "militiaoff" | "militiaunconvert" | "mindrot" | "mirrorimage" | "monsoon" | "mount" | "mounthippogryph" | "move" | "moveAI" | "nagabuild" | "neutraldetectaoe" | "neutralinteract" | "neutralspell" | "nightelfbuild" | "orcbuild" | "parasite" | "parasiteoff" | "parasiteon" | "patrol" | "patrolAI" | "phaseshift" | "phaseshiftinstant" | "phaseshiftoff" | "phaseshifton" | "phoenixfire" | "phoenixmorph" | "poisonarrows" | "poisonarrowstarg" | "polymorph" | "possession" | "preservation" | "purge" | "rainofchaos" | "rainoffire" | "raisedead" | "raisedeadoff" | "raisedeadon" | "ravenform" | "recharge" | "rechargeoff" | "rechargeon" | "rejuvination" | "renew" | "renewoff" | "renewon" | "repair" | "repairoff" | "repairon" | "replenish" | "replenishlife" | "replenishlifeoff" | "replenishlifeon" | "replenishmana" | "replenishmanaoff" | "replenishmanaon" | "replenishoff" | "replenishon" | "request_hero" | "requestsacrifice" | "restoration" | "restorationoff" | "restorationon" | "resumebuild" | "resumeharvesting" | "resurrection" | "returnresources" | "revenge" | "revive" | "roar" | "robogoblin" | "root" | "sacrifice" | "sanctuary" | "scout" | "selfdestruct" | "selfdestructoff" | "selfdestructon" | "sentinel" | "follow" | "smart" | "setrally" | "shadowsight" | "shadowstrike" | "shockwave" | "silence" | "slow" | "slowoff" | "slowon" | "soulburn" | "soulpreservation" | "spellshield" | "spellshieldaoe" | "spellsteal" | "spellstealoff" | "spellstealon" | "spies" | "spiritlink" | "spiritofvengeance" | "spirittroll" | "spiritwolf" | "stampede" | "standdown" | "starfall" | "stasistrap" | "steal" | "stomp" | "stoneform" | "stunned" | "submerge" | "summonfactory" | "summongrizzly" | "summonphoenix" | "summonquillbeast" | "summonwareagle" | "tankdroppilot" | "tankloadpilot" | "tankpilot" | "taunt" | "thunderbolt" | "thunderclap" | "tornado" | "townbelloff" | "townbellon" | "tranquility" | "transmute" | "unavatar" | "unavengerform" | "unbearform" | "unburrow" | "uncoldarrows" | "uncorporealform" | "undeadbuild" | "undefend" | "undivineshield" | "unetherealform" | "unflamingarrows" | "unflamingattack" | "unholyfrenzy" | "unimmolation" | "unload" | "unloadall" | "unloadallcorpses" | "unloadallinstant" | "unpoisonarrows" | "unravenform" | "unrobogoblin" | "unroot" | "unstableconcoction" | "unstoneform" | "unsubmerge" | "unsummon" | "unwindwalk" | "vengeance" | "vengeanceinstant" | "vengeanceoff" | "vengeanceon" | "volcano" | "voodoo" | "ward" | "waterelemental" | "wateryminion" | "web" | "weboff" | "webon" | "whirlwind" | "windwalk" | "wispharvest") => number;
57
+ const orderId: (id: "blink" | "stop" | "load" | "sleep" | "absorb" | "acidbomb" | "acolyteharvest" | "ambush" | "ancestralspirit" | "ancestralspirittarget" | "animatedead" | "antimagicshell" | "attack" | "attackground" | "attackonce" | "attributemodskill" | "auraunholy" | "auravampiric" | "autodispel" | "autodispeloff" | "autodispelon" | "autoentangle" | "autoentangleinstant" | "autoharvestgold" | "autoharvestlumber" | "avatar" | "avengerform" | "awaken" | "banish" | "barkskin" | "barkskinoff" | "barkskinon" | "battleroar" | "battlestations" | "bearform" | "berserk" | "blackarrow" | "blackarrowoff" | "blackarrowon" | "blight" | "blizzard" | "bloodlust" | "bloodlustoff" | "bloodluston" | "board" | "breathoffire" | "breathoffrost" | "build" | "burrow" | "cannibalize" | "carrionscarabs" | "carrionscarabsinstant" | "carrionscarabsoff" | "carrionscarabson" | "carrionswarm" | "chainlightning" | "channel" | "charm" | "chemicalrage" | "cloudoffog" | "clusterrockets" | "coldarrows" | "coldarrowstarg" | "controlmagic" | "corporealform" | "corrosivebreath" | "coupleinstant" | "coupletarget" | "creepanimatedead" | "creepdevour" | "creepheal" | "creephealoff" | "creephealon" | "creepthunderbolt" | "creepthunderclap" | "cripple" | "curse" | "curseoff" | "curseon" | "cyclone" | "darkconversion" | "darkportal" | "darkritual" | "darksummoning" | "deathanddecay" | "deathcoil" | "deathpact" | "decouple" | "defend" | "detectaoe" | "detonate" | "devour" | "devourmagic" | "disassociate" | "disenchant" | "dismount" | "dispel" | "divineshield" | "doom" | "drain" | "dreadlordinferno" | "dropitem" | "moveslot0" | "moveslot1" | "moveslot2" | "moveslot3" | "moveslot4" | "moveslot5" | "useslot0" | "useslot1" | "useslot2" | "useslot3" | "useslot4" | "useslot5" | "drunkenhaze" | "earthquake" | "eattree" | "elementalfury" | "ensnare" | "ensnareoff" | "ensnareon" | "entangle" | "entangleinstant" | "entanglingroots" | "etherealform" | "evileye" | "faeriefire" | "faeriefireoff" | "faeriefireon" | "fanofknives" | "farsight" | "fingerofdeath" | "firebolt" | "flamestrike" | "flamingarrows" | "flamingarrowstarg" | "flamingattack" | "flamingattacktarg" | "flare" | "forceboard" | "forceofnature" | "forkedlightning" | "freezingbreath" | "frenzy" | "frenzyoff" | "frenzyon" | "frostarmor" | "frostarmoroff" | "frostarmoron" | "frostnova" | "getitem" | "gold2lumber" | "grabtree" | "harvest" | "heal" | "healingspray" | "healingward" | "healingwave" | "healoff" | "healon" | "hex" | "holdposition" | "holybolt" | "howlofterror" | "humanbuild" | "immolation" | "impale" | "incineratearrow" | "incineratearrowoff" | "incineratearrowon" | "inferno" | "innerfire" | "innerfireoff" | "innerfireon" | "instant" | "invisibility" | "lavamonster" | "lightningshield" | "loadarcher" | "loadcorpse" | "loadcorpseinstant" | "locustswarm" | "lumber2gold" | "magicdefense" | "magicleash" | "magicundefense" | "manaburn" | "manaflareoff" | "manaflareon" | "manashieldoff" | "manashieldon" | "massteleport" | "mechanicalcritter" | "metamorphosis" | "militia" | "militiaconvert" | "militiaoff" | "militiaunconvert" | "mindrot" | "mirrorimage" | "monsoon" | "mount" | "mounthippogryph" | "move" | "moveAI" | "nagabuild" | "neutraldetectaoe" | "neutralinteract" | "neutralspell" | "nightelfbuild" | "orcbuild" | "parasite" | "parasiteoff" | "parasiteon" | "patrol" | "patrolAI" | "phaseshift" | "phaseshiftinstant" | "phaseshiftoff" | "phaseshifton" | "phoenixfire" | "phoenixmorph" | "poisonarrows" | "poisonarrowstarg" | "polymorph" | "possession" | "preservation" | "purge" | "rainofchaos" | "rainoffire" | "raisedead" | "raisedeadoff" | "raisedeadon" | "ravenform" | "recharge" | "rechargeoff" | "rechargeon" | "rejuvination" | "renew" | "renewoff" | "renewon" | "repair" | "repairoff" | "repairon" | "replenish" | "replenishlife" | "replenishlifeoff" | "replenishlifeon" | "replenishmana" | "replenishmanaoff" | "replenishmanaon" | "replenishoff" | "replenishon" | "request_hero" | "requestsacrifice" | "restoration" | "restorationoff" | "restorationon" | "resumebuild" | "resumeharvesting" | "resurrection" | "returnresources" | "revenge" | "revive" | "roar" | "robogoblin" | "root" | "sacrifice" | "sanctuary" | "scout" | "selfdestruct" | "selfdestructoff" | "selfdestructon" | "sentinel" | "follow" | "smart" | "setrally" | "shadowsight" | "shadowstrike" | "shockwave" | "silence" | "slow" | "slowoff" | "slowon" | "soulburn" | "soulpreservation" | "spellshield" | "spellshieldaoe" | "spellsteal" | "spellstealoff" | "spellstealon" | "spies" | "spiritlink" | "spiritofvengeance" | "spirittroll" | "spiritwolf" | "stampede" | "standdown" | "starfall" | "stasistrap" | "steal" | "stomp" | "stoneform" | "stunned" | "submerge" | "summonfactory" | "summongrizzly" | "summonphoenix" | "summonquillbeast" | "summonwareagle" | "tankdroppilot" | "tankloadpilot" | "tankpilot" | "taunt" | "thunderbolt" | "thunderclap" | "tornado" | "townbelloff" | "townbellon" | "tranquility" | "transmute" | "unavatar" | "unavengerform" | "unbearform" | "unburrow" | "uncoldarrows" | "uncorporealform" | "undeadbuild" | "undefend" | "undivineshield" | "unetherealform" | "unflamingarrows" | "unflamingattack" | "unholyfrenzy" | "unimmolation" | "unload" | "unloadall" | "unloadallcorpses" | "unloadallinstant" | "unpoisonarrows" | "unravenform" | "unrobogoblin" | "unroot" | "unstableconcoction" | "unstoneform" | "unsubmerge" | "unsummon" | "unwindwalk" | "vengeance" | "vengeanceinstant" | "vengeanceoff" | "vengeanceon" | "volcano" | "voodoo" | "ward" | "waterelemental" | "wateryminion" | "web" | "weboff" | "webon" | "whirlwind" | "windwalk" | "wispharvest") => number;
58
58
  }
59
59
  declare global {
60
60
  function orderId(...args: Parameters<typeof inner.orderId>): ReturnType<typeof inner.orderId>;
package/core/util.lua CHANGED
@@ -1,3 +1,5 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__StringPadEnd = ____lualib.__TS__StringPadEnd
1
3
  local ____exports = {}
2
4
  local ns = {}
3
5
  do
@@ -14,7 +16,10 @@ do
14
16
  if type(id) == "number" then
15
17
  return id
16
18
  else
17
- local numid = string.unpack(">I4", id)
19
+ local numid = string.unpack(
20
+ ">I4",
21
+ __TS__StringPadEnd(id, 4, "\0")
22
+ )
18
23
  return numid
19
24
  end
20
25
  end
@@ -196,6 +201,18 @@ do
196
201
  drain = 852487,
197
202
  dreadlordinferno = 852224,
198
203
  dropitem = 852001,
204
+ moveslot0 = 852002,
205
+ moveslot1 = 852003,
206
+ moveslot2 = 852004,
207
+ moveslot3 = 852005,
208
+ moveslot4 = 852006,
209
+ moveslot5 = 852007,
210
+ useslot0 = 852008,
211
+ useslot1 = 852009,
212
+ useslot2 = 852010,
213
+ useslot3 = 852011,
214
+ useslot4 = 852012,
215
+ useslot5 = 852013,
199
216
  drunkenhaze = 852585,
200
217
  earthquake = 852121,
201
218
  eattree = 852146,
package/decl/index.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  /// <reference path="./native.d.ts"/>
4
4
  /// <reference types="warpack-types/warpack"/>
5
5
  /// <reference types="lua-types/5.3"/>
6
+ /// <reference types="@warscript/language-extensions" />
6
7
 
7
8
  declare function setmetatable<
8
9
  T extends object,