warscript 0.0.1-dev.1858ab2 → 0.0.1-dev.19d0f81
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.
- package/attributes.d.ts +12 -0
- package/attributes.lua +16 -0
- package/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +14 -6
- package/core/types/effect.lua +131 -35
- package/core/types/frame.d.ts +8 -1
- package/core/types/frame.lua +93 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +99 -24
- package/core/types/timer.d.ts +6 -7
- package/core/types/timer.lua +18 -21
- package/core/types/unit.lua +8 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +18 -1
- package/decl/index.d.ts +1 -0
- package/decl/native.d.ts +840 -786
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +10 -10
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +13 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +32 -9
- package/engine/behaviour/ability/damage.d.ts +37 -11
- package/engine/behaviour/ability/damage.lua +90 -32
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +35 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -15
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -0
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +27 -4
- package/engine/behaviour/ability.lua +152 -17
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/behaviour/unit.d.ts +10 -2
- package/engine/behaviour/unit.lua +27 -0
- package/engine/buff.d.ts +103 -41
- package/engine/buff.lua +465 -212
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +17 -14
- package/engine/internal/ability.lua +80 -76
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/item.d.ts +4 -3
- package/engine/internal/item.lua +56 -25
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +3 -1
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -14
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/bonus.d.ts +11 -8
- package/engine/internal/unit/bonus.lua +23 -1
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +11 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +25 -6
- package/engine/internal/unit.d.ts +75 -17
- package/engine/internal/unit.lua +452 -162
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -3
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +20 -18
- package/engine/object-data/entry/ability-type.lua +90 -33
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.lua +39 -102
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +6 -13
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +1 -2
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +15 -2
- package/engine/object-data/entry/item-type.lua +93 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -2
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +50 -3
- package/engine/object-data/entry/unit-type.lua +452 -61
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +1 -2
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +18 -17
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +33 -8
- package/engine/object-field/ability.lua +60 -1
- package/engine/object-field/unit.d.ts +46 -2
- package/engine/object-field/unit.lua +173 -4
- package/engine/object-field.d.ts +11 -3
- package/engine/object-field.lua +174 -84
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/entries/unit-type.d.ts +42 -1
- package/engine/standard/entries/unit-type.lua +42 -1
- package/engine/standard/fields/ability.d.ts +3 -1
- package/engine/standard/fields/ability.lua +3 -1
- package/engine/unit.d.ts +4 -0
- package/engine/unit.lua +13 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- package/global/vec2.lua +1 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +146 -42
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/buff.lua +2 -3
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/objutil/unit.lua +8 -0
- package/package.json +13 -14
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +12 -5
- package/utility/arrays.lua +37 -3
- package/utility/bit-set.d.ts +0 -2
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +12 -3
- package/utility/linked-set.lua +8 -2
- package/utility/lua-maps.d.ts +4 -2
- package/utility/lua-maps.lua +16 -0
- package/utility/lua-sets.d.ts +2 -2
- package/utility/lua-sets.lua +3 -0
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +3 -2
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/internal/unit.lua
CHANGED
|
@@ -5,9 +5,12 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
5
5
|
local __TS__New = ____lualib.__TS__New
|
|
6
6
|
local __TS__Class = ____lualib.__TS__Class
|
|
7
7
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
8
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
8
9
|
local __TS__ArraySetLength = ____lualib.__TS__ArraySetLength
|
|
10
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
11
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
12
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
9
13
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
10
|
-
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
11
14
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
12
15
|
local Set = ____lualib.Set
|
|
13
16
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
@@ -48,11 +51,19 @@ local ____arrays = require("utility.arrays")
|
|
|
48
51
|
local forEach = ____arrays.forEach
|
|
49
52
|
local ____math = require("math")
|
|
50
53
|
local min = ____math.min
|
|
54
|
+
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
|
+
local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
56
|
+
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
57
|
+
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
58
|
+
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
59
|
+
local ____unit_2Bdamage = require("engine.internal.unit+damage")
|
|
60
|
+
local damageMetadataByTarget = ____unit_2Bdamage.damageMetadataByTarget
|
|
51
61
|
local match = string.match
|
|
52
62
|
local ____tostring = _G.tostring
|
|
53
63
|
local setUnitAnimation = SetUnitAnimation
|
|
54
64
|
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
55
65
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
66
|
+
local resetUnitAnimation = ResetUnitAnimation
|
|
56
67
|
local queueUnitAnimation = QueueUnitAnimation
|
|
57
68
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
58
69
|
local getUnitRealField = BlzGetUnitRealField
|
|
@@ -72,9 +83,9 @@ local setUnitScale = SetUnitScale
|
|
|
72
83
|
local setUnitPosition = SetUnitPosition
|
|
73
84
|
local setUnitTimeScale = SetUnitTimeScale
|
|
74
85
|
local getHandleId = GetHandleId
|
|
86
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
75
87
|
local createUnit = CreateUnit
|
|
76
88
|
local killUnit = KillUnit
|
|
77
|
-
local setUnitExploded = SetUnitExploded
|
|
78
89
|
local removeUnit = RemoveUnit
|
|
79
90
|
local getUnitTypeId = GetUnitTypeId
|
|
80
91
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -90,8 +101,10 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
90
101
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
91
102
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
92
103
|
local isUnitInRange = IsUnitInRange
|
|
93
|
-
local
|
|
94
|
-
local
|
|
104
|
+
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
105
|
+
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
106
|
+
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
107
|
+
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
95
108
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
96
109
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
97
110
|
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
@@ -118,8 +131,6 @@ local isUnitType = IsUnitType
|
|
|
118
131
|
local isUnitAlly = IsUnitAlly
|
|
119
132
|
local isUnitEnemy = IsUnitEnemy
|
|
120
133
|
local getOwningPlayer = GetOwningPlayer
|
|
121
|
-
local setUnitColor = SetUnitColor
|
|
122
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
123
134
|
____exports.UnitClassification = {}
|
|
124
135
|
local UnitClassification = ____exports.UnitClassification
|
|
125
136
|
do
|
|
@@ -275,16 +286,14 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
|
|
|
275
286
|
end
|
|
276
287
|
local function dispatch(event, idGetter, argsGetter)
|
|
277
288
|
local initialized = false
|
|
278
|
-
local x = {}
|
|
279
289
|
return setmetatable(
|
|
280
|
-
|
|
290
|
+
{},
|
|
281
291
|
{
|
|
282
292
|
__index = function(self, id)
|
|
283
293
|
if type(id) ~= "number" then
|
|
284
294
|
return event[id]
|
|
285
295
|
end
|
|
286
296
|
if not initialized then
|
|
287
|
-
local invoke = Event.invoke
|
|
288
297
|
event:addListener(function(...)
|
|
289
298
|
local id = idGetter(...)
|
|
290
299
|
local dispatched = rawget(self, id)
|
|
@@ -322,7 +331,6 @@ local function dispatchAbility(event)
|
|
|
322
331
|
return event[id]
|
|
323
332
|
end
|
|
324
333
|
if not initialized then
|
|
325
|
-
local invoke = Event.invoke
|
|
326
334
|
event:addListener(function(unit, ability, ...)
|
|
327
335
|
local dispatched = rawget(self, ability.typeId)
|
|
328
336
|
if dispatched ~= nil then
|
|
@@ -350,7 +358,14 @@ local function damageEventPreventDeath(self, callback, ...)
|
|
|
350
358
|
rawset(self, 1 + i, (select(i, ...)))
|
|
351
359
|
end
|
|
352
360
|
end
|
|
353
|
-
local damageSetters = {
|
|
361
|
+
local damageSetters = {
|
|
362
|
+
amount = BlzSetEventDamage,
|
|
363
|
+
attackType = function(attackType)
|
|
364
|
+
return BlzSetEventAttackType(attackTypeToNative(attackType))
|
|
365
|
+
end,
|
|
366
|
+
damageType = BlzSetEventDamageType,
|
|
367
|
+
weaponType = BlzSetEventWeaponType
|
|
368
|
+
}
|
|
354
369
|
local jlimitopByOperator = {
|
|
355
370
|
[0] = LESS_THAN_OR_EQUAL,
|
|
356
371
|
[1] = LESS_THAN_OR_EQUAL,
|
|
@@ -387,51 +402,158 @@ local getters = {
|
|
|
387
402
|
return BlzGetUnitArmor(unit)
|
|
388
403
|
end
|
|
389
404
|
}
|
|
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
|
-
|
|
405
|
+
____exports.UnitWeapon = __TS__Class()
|
|
406
|
+
local UnitWeapon = ____exports.UnitWeapon
|
|
407
|
+
UnitWeapon.name = "UnitWeapon"
|
|
408
|
+
function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
409
|
+
self.unit = unit
|
|
410
|
+
self.index = index
|
|
411
|
+
end
|
|
412
|
+
__TS__SetDescriptor(
|
|
413
|
+
UnitWeapon.prototype,
|
|
414
|
+
"cooldown",
|
|
415
|
+
{
|
|
416
|
+
get = function(self)
|
|
417
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index)
|
|
418
|
+
end,
|
|
419
|
+
set = function(self, cooldown)
|
|
420
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index, cooldown)
|
|
421
|
+
end
|
|
422
|
+
},
|
|
423
|
+
true
|
|
424
|
+
)
|
|
425
|
+
__TS__SetDescriptor(
|
|
426
|
+
UnitWeapon.prototype,
|
|
427
|
+
"damage",
|
|
428
|
+
{
|
|
429
|
+
get = function(self)
|
|
430
|
+
local minimumDamage = self.damageBase + self.damageDiceCount
|
|
431
|
+
local maximumDamage = self.damageBase + self.damageDiceCount * self.damageDiceSideCount
|
|
432
|
+
return {minimumDamage, maximumDamage}
|
|
433
|
+
end,
|
|
434
|
+
set = function(self, ____bindingPattern0)
|
|
435
|
+
local maximumDamage
|
|
436
|
+
local minimumDamage
|
|
437
|
+
minimumDamage = ____bindingPattern0[1]
|
|
438
|
+
maximumDamage = ____bindingPattern0[2]
|
|
439
|
+
self.damageBase = minimumDamage - 1
|
|
440
|
+
self.damageDiceCount = 1
|
|
441
|
+
self.damageDiceSideCount = maximumDamage - minimumDamage + 1
|
|
442
|
+
end
|
|
443
|
+
},
|
|
444
|
+
true
|
|
445
|
+
)
|
|
446
|
+
__TS__SetDescriptor(
|
|
447
|
+
UnitWeapon.prototype,
|
|
448
|
+
"damageBase",
|
|
449
|
+
{
|
|
450
|
+
get = function(self)
|
|
451
|
+
return BlzGetUnitBaseDamage(self.unit.handle, self.index)
|
|
452
|
+
end,
|
|
453
|
+
set = function(self, damageBase)
|
|
454
|
+
BlzSetUnitBaseDamage(self.unit.handle, self.index, damageBase)
|
|
455
|
+
end
|
|
456
|
+
},
|
|
457
|
+
true
|
|
458
|
+
)
|
|
459
|
+
__TS__SetDescriptor(
|
|
460
|
+
UnitWeapon.prototype,
|
|
461
|
+
"damageDiceCount",
|
|
462
|
+
{
|
|
463
|
+
get = function(self)
|
|
464
|
+
return BlzGetUnitDiceNumber(self.unit.handle, self.index)
|
|
465
|
+
end,
|
|
466
|
+
set = function(self, damageDiceCount)
|
|
467
|
+
BlzSetUnitDiceNumber(self.unit.handle, self.index, damageDiceCount)
|
|
468
|
+
end
|
|
469
|
+
},
|
|
470
|
+
true
|
|
471
|
+
)
|
|
472
|
+
__TS__SetDescriptor(
|
|
473
|
+
UnitWeapon.prototype,
|
|
474
|
+
"damageDiceSideCount",
|
|
475
|
+
{
|
|
476
|
+
get = function(self)
|
|
477
|
+
return BlzGetUnitDiceSides(self.unit.handle, self.index)
|
|
478
|
+
end,
|
|
479
|
+
set = function(self, damageDiceSideCount)
|
|
480
|
+
BlzSetUnitDiceSides(self.unit.handle, self.index, damageDiceSideCount)
|
|
481
|
+
end
|
|
482
|
+
},
|
|
483
|
+
true
|
|
484
|
+
)
|
|
485
|
+
__TS__SetDescriptor(
|
|
486
|
+
UnitWeapon.prototype,
|
|
487
|
+
"range",
|
|
488
|
+
{
|
|
489
|
+
get = function(self)
|
|
490
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_RANGE, self.index)
|
|
491
|
+
end,
|
|
492
|
+
set = function(self, range)
|
|
493
|
+
local handle = self.unit.handle
|
|
494
|
+
local index = self.index
|
|
495
|
+
setUnitWeaponRealField(
|
|
496
|
+
handle,
|
|
497
|
+
UNIT_WEAPON_RF_ATTACK_RANGE,
|
|
498
|
+
index + 1,
|
|
499
|
+
getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1) + (range - getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index))
|
|
500
|
+
)
|
|
501
|
+
end
|
|
502
|
+
},
|
|
503
|
+
true
|
|
504
|
+
)
|
|
505
|
+
__TS__SetDescriptor(
|
|
506
|
+
UnitWeapon.prototype,
|
|
507
|
+
"impactDelay",
|
|
508
|
+
{
|
|
509
|
+
get = function(self)
|
|
510
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index)
|
|
511
|
+
end,
|
|
512
|
+
set = function(self, impactDelay)
|
|
513
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index, impactDelay)
|
|
514
|
+
end
|
|
515
|
+
},
|
|
516
|
+
true
|
|
517
|
+
)
|
|
518
|
+
__TS__SetDescriptor(
|
|
519
|
+
UnitWeapon.prototype,
|
|
520
|
+
"missileArc",
|
|
521
|
+
{
|
|
522
|
+
get = function(self)
|
|
523
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index)
|
|
524
|
+
end,
|
|
525
|
+
set = function(self, missileArc)
|
|
526
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index, missileArc)
|
|
527
|
+
end
|
|
528
|
+
},
|
|
529
|
+
true
|
|
530
|
+
)
|
|
531
|
+
__TS__SetDescriptor(
|
|
532
|
+
UnitWeapon.prototype,
|
|
533
|
+
"missileModelPath",
|
|
534
|
+
{
|
|
535
|
+
get = function(self)
|
|
536
|
+
return getUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index)
|
|
537
|
+
end,
|
|
538
|
+
set = function(self, missileModelPath)
|
|
539
|
+
setUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index, missileModelPath)
|
|
540
|
+
end
|
|
541
|
+
},
|
|
542
|
+
true
|
|
543
|
+
)
|
|
544
|
+
__TS__SetDescriptor(
|
|
545
|
+
UnitWeapon.prototype,
|
|
546
|
+
"missileSpeed",
|
|
547
|
+
{
|
|
548
|
+
get = function(self)
|
|
549
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index)
|
|
550
|
+
end,
|
|
551
|
+
set = function(self, missileSpeed)
|
|
552
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index, missileSpeed)
|
|
553
|
+
end
|
|
554
|
+
},
|
|
555
|
+
true
|
|
556
|
+
)
|
|
435
557
|
local unitInventorySize = UnitInventorySize
|
|
436
558
|
local unitItemInSlot = UnitItemInSlot
|
|
437
559
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -442,8 +564,6 @@ local getAbilityName = GetAbilityName
|
|
|
442
564
|
local unitAddAbility = UnitAddAbility
|
|
443
565
|
local getUnitGoldCost = GetUnitGoldCost
|
|
444
566
|
local getUnitLumberCost = GetUnitWoodCost
|
|
445
|
-
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
446
|
-
local unitAddItem = UnitAddItem
|
|
447
567
|
local unitRemoveAbility = UnitRemoveAbility
|
|
448
568
|
local function retrieveAbility(unit, ability, abilityId)
|
|
449
569
|
if ability == nil then
|
|
@@ -453,17 +573,6 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
453
573
|
____exports.Unit:of(unit)
|
|
454
574
|
)
|
|
455
575
|
end
|
|
456
|
-
if not unitAddAbility(unit, abilityId) then
|
|
457
|
-
if getUnitAbility(unit, abilityId) == ability then
|
|
458
|
-
return UnitAbility:of(
|
|
459
|
-
ability,
|
|
460
|
-
abilityId,
|
|
461
|
-
____exports.Unit:of(unit)
|
|
462
|
-
)
|
|
463
|
-
end
|
|
464
|
-
else
|
|
465
|
-
unitRemoveAbility(unit, abilityId)
|
|
466
|
-
end
|
|
467
576
|
for i = 0, unitInventorySize(unit) - 1 do
|
|
468
577
|
local item = unitItemInSlot(unit, i)
|
|
469
578
|
if getItemAbility(item, abilityId) == ability then
|
|
@@ -520,12 +629,35 @@ for ____, player in ipairs(Player.all) do
|
|
|
520
629
|
ShowUnit(dummy, false)
|
|
521
630
|
dummies[player] = dummy
|
|
522
631
|
end
|
|
632
|
+
local function delayHealthChecksCallback(unit)
|
|
633
|
+
local counter = (unit[103] or 0) - 1
|
|
634
|
+
if counter ~= 0 then
|
|
635
|
+
unit[103] = counter
|
|
636
|
+
return
|
|
637
|
+
end
|
|
638
|
+
unit[103] = nil
|
|
639
|
+
local healthBonus = unit[104]
|
|
640
|
+
if healthBonus ~= nil then
|
|
641
|
+
unit[104] = nil
|
|
642
|
+
local handle = unit.handle
|
|
643
|
+
BlzSetUnitMaxHP(
|
|
644
|
+
handle,
|
|
645
|
+
BlzGetUnitMaxHP(handle) - healthBonus
|
|
646
|
+
)
|
|
647
|
+
end
|
|
648
|
+
end
|
|
649
|
+
local nextSyncId = 1
|
|
650
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
651
|
+
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
523
652
|
____exports.Unit = __TS__Class()
|
|
524
653
|
local Unit = ____exports.Unit
|
|
525
654
|
Unit.name = "Unit"
|
|
526
655
|
__TS__ClassExtends(Unit, Handle)
|
|
527
656
|
function Unit.prototype.____constructor(self, handle)
|
|
528
657
|
Handle.prototype.____constructor(self, handle)
|
|
658
|
+
local ____nextSyncId_0 = nextSyncId
|
|
659
|
+
nextSyncId = ____nextSyncId_0 + 1
|
|
660
|
+
self.syncId = ____nextSyncId_0
|
|
529
661
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
530
662
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
531
663
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -538,6 +670,7 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
538
670
|
fourCC("Amrf")
|
|
539
671
|
))
|
|
540
672
|
end
|
|
673
|
+
unitBySyncId[self.syncId] = self
|
|
541
674
|
local ____ = self.abilities
|
|
542
675
|
end
|
|
543
676
|
function Unit.prototype.getEvent(self, event, collector)
|
|
@@ -556,6 +689,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
556
689
|
end
|
|
557
690
|
function Unit.prototype.onDestroy(self)
|
|
558
691
|
local handle = self.handle
|
|
692
|
+
self[107] = getUnitX(handle)
|
|
693
|
+
self[108] = getUnitY(handle)
|
|
559
694
|
if not self._owner then
|
|
560
695
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
561
696
|
end
|
|
@@ -623,8 +758,8 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
623
758
|
end}
|
|
624
759
|
end
|
|
625
760
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
626
|
-
local
|
|
627
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
761
|
+
local ____combatClassification_1 = combatClassification
|
|
762
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_1 == ____combatClassification_1
|
|
628
763
|
end
|
|
629
764
|
function Unit.prototype.addClassification(self, classification)
|
|
630
765
|
return unitAddType(self.handle, classification)
|
|
@@ -642,13 +777,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
642
777
|
return isUnitInvisible(self.handle, player.handle)
|
|
643
778
|
end
|
|
644
779
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
645
|
-
local
|
|
780
|
+
local ____temp_2
|
|
646
781
|
if type(x) == "number" then
|
|
647
|
-
|
|
782
|
+
____temp_2 = isUnitInRangeXY(self.handle, x, y, range)
|
|
648
783
|
else
|
|
649
|
-
|
|
784
|
+
____temp_2 = isUnitInRange(self.handle, x.handle, y)
|
|
650
785
|
end
|
|
651
|
-
return
|
|
786
|
+
return ____temp_2
|
|
652
787
|
end
|
|
653
788
|
function Unit.prototype.isAllyOf(self, unit)
|
|
654
789
|
return isUnitAlly(
|
|
@@ -671,9 +806,16 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
671
806
|
setUnitAnimation(self.handle, animation)
|
|
672
807
|
end
|
|
673
808
|
end
|
|
809
|
+
function Unit.prototype.resetAnimation(self)
|
|
810
|
+
resetUnitAnimation(self.handle)
|
|
811
|
+
end
|
|
674
812
|
function Unit.prototype.queueAnimation(self, animation)
|
|
675
813
|
queueUnitAnimation(self.handle, animation)
|
|
676
814
|
end
|
|
815
|
+
function Unit.prototype.delayHealthChecks(self)
|
|
816
|
+
self[103] = (self[103] or 0) + 1
|
|
817
|
+
Timer:run(delayHealthChecksCallback, self)
|
|
818
|
+
end
|
|
677
819
|
function Unit.prototype.setPosition(self, x, y)
|
|
678
820
|
setUnitPosition(self.handle, x, y)
|
|
679
821
|
end
|
|
@@ -681,14 +823,21 @@ function Unit.prototype.isSelected(self, player)
|
|
|
681
823
|
return IsUnitSelected(self.handle, player.handle)
|
|
682
824
|
end
|
|
683
825
|
function Unit.prototype.explode(self)
|
|
684
|
-
|
|
826
|
+
SetUnitExploded(self.handle, true)
|
|
685
827
|
killUnit(self.handle)
|
|
686
828
|
end
|
|
687
829
|
function Unit.prototype.kill(self)
|
|
688
830
|
killUnit(self.handle)
|
|
689
831
|
end
|
|
690
|
-
function Unit.prototype.revive(self,
|
|
691
|
-
|
|
832
|
+
function Unit.prototype.revive(self, x, y, doEffect)
|
|
833
|
+
local ____ReviveHero_5 = ReviveHero
|
|
834
|
+
local ____array_4 = __TS__SparseArrayNew(self.handle, x, y)
|
|
835
|
+
local ____doEffect_3 = doEffect
|
|
836
|
+
if ____doEffect_3 == nil then
|
|
837
|
+
____doEffect_3 = false
|
|
838
|
+
end
|
|
839
|
+
__TS__SparseArrayPush(____array_4, ____doEffect_3)
|
|
840
|
+
____ReviveHero_5(__TS__SparseArraySpread(____array_4))
|
|
692
841
|
end
|
|
693
842
|
function Unit.prototype.healTarget(self, target, amount)
|
|
694
843
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -728,7 +877,7 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
728
877
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
729
878
|
end
|
|
730
879
|
function Unit.prototype.itemInSlot(self, slot)
|
|
731
|
-
return Item:of(
|
|
880
|
+
return Item:of(unitItemInSlot(self.handle, slot))
|
|
732
881
|
end
|
|
733
882
|
function Unit.prototype.addAbility(self, abilityId)
|
|
734
883
|
if unitAddAbility(self.handle, abilityId) then
|
|
@@ -784,6 +933,9 @@ end
|
|
|
784
933
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
785
934
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
786
935
|
end
|
|
936
|
+
function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
|
|
937
|
+
return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
|
|
938
|
+
end
|
|
787
939
|
function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
|
|
788
940
|
BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
|
|
789
941
|
end
|
|
@@ -794,8 +946,15 @@ function Unit.prototype.interruptAttack(self)
|
|
|
794
946
|
unitInterruptAttack(self.handle)
|
|
795
947
|
end
|
|
796
948
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
797
|
-
|
|
798
|
-
unitDisableAbility(
|
|
949
|
+
local handle = self.handle
|
|
950
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
951
|
+
Timer:run(
|
|
952
|
+
unitDisableAbility,
|
|
953
|
+
handle,
|
|
954
|
+
abilityId,
|
|
955
|
+
false,
|
|
956
|
+
false
|
|
957
|
+
)
|
|
799
958
|
end
|
|
800
959
|
function Unit.prototype.getDistanceTo(self, target)
|
|
801
960
|
local handle = self.handle
|
|
@@ -855,18 +1014,18 @@ function Unit.prototype.unpauseEx(self)
|
|
|
855
1014
|
self:decrementStunCounter()
|
|
856
1015
|
end
|
|
857
1016
|
function Unit.prototype.incrementStunCounter(self)
|
|
858
|
-
local stunCounter = self[
|
|
859
|
-
if not self[
|
|
1017
|
+
local stunCounter = self[102] or 0
|
|
1018
|
+
if not self[101] or stunCounter >= 0 then
|
|
860
1019
|
BlzPauseUnitEx(self.handle, true)
|
|
861
1020
|
end
|
|
862
|
-
self[
|
|
1021
|
+
self[102] = stunCounter + 1
|
|
863
1022
|
end
|
|
864
1023
|
function Unit.prototype.decrementStunCounter(self)
|
|
865
|
-
local stunCounter = self[
|
|
866
|
-
if not self[
|
|
1024
|
+
local stunCounter = self[102] or 0
|
|
1025
|
+
if not self[101] or stunCounter >= 1 then
|
|
867
1026
|
BlzPauseUnitEx(self.handle, false)
|
|
868
1027
|
end
|
|
869
|
-
self[
|
|
1028
|
+
self[102] = stunCounter - 1
|
|
870
1029
|
end
|
|
871
1030
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
872
1031
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
@@ -968,8 +1127,11 @@ function Unit.getInSector(self, pos, range, offsetAngle, centralAngle)
|
|
|
968
1127
|
)
|
|
969
1128
|
return targetCollection
|
|
970
1129
|
end
|
|
971
|
-
function Unit.getSelectionOf(self, player)
|
|
972
|
-
|
|
1130
|
+
function Unit.getSelectionOf(self, player, target)
|
|
1131
|
+
if target == nil then
|
|
1132
|
+
target = {}
|
|
1133
|
+
end
|
|
1134
|
+
targetCollection = target
|
|
973
1135
|
targetCollectionNextIndex = 1
|
|
974
1136
|
GroupEnumUnitsSelected(dummyGroup, player.handle, collectIntoTarget)
|
|
975
1137
|
return targetCollection
|
|
@@ -991,6 +1153,9 @@ end
|
|
|
991
1153
|
function Unit.prototype.__tostring(self)
|
|
992
1154
|
return (((self.constructor.name .. "$") .. util.id2s(self.typeId)) .. "@") .. tostring(getHandleId(self.handle))
|
|
993
1155
|
end
|
|
1156
|
+
function Unit.getBySyncId(self, syncId)
|
|
1157
|
+
return unitBySyncId[syncId]
|
|
1158
|
+
end
|
|
994
1159
|
__TS__SetDescriptor(
|
|
995
1160
|
Unit.prototype,
|
|
996
1161
|
"_deltas",
|
|
@@ -1054,6 +1219,14 @@ __TS__SetDescriptor(
|
|
|
1054
1219
|
end},
|
|
1055
1220
|
true
|
|
1056
1221
|
)
|
|
1222
|
+
__TS__SetDescriptor(
|
|
1223
|
+
Unit.prototype,
|
|
1224
|
+
"isStunned",
|
|
1225
|
+
{get = function(self)
|
|
1226
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1227
|
+
end},
|
|
1228
|
+
true
|
|
1229
|
+
)
|
|
1057
1230
|
__TS__SetDescriptor(
|
|
1058
1231
|
Unit.prototype,
|
|
1059
1232
|
"combatClassifications",
|
|
@@ -1071,12 +1244,27 @@ __TS__SetDescriptor(
|
|
|
1071
1244
|
Unit.prototype,
|
|
1072
1245
|
"weapons",
|
|
1073
1246
|
{get = function(self)
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1247
|
+
return {self.firstWeapon, self.secondWeapon}
|
|
1248
|
+
end},
|
|
1249
|
+
true
|
|
1250
|
+
)
|
|
1251
|
+
__TS__SetDescriptor(
|
|
1252
|
+
Unit.prototype,
|
|
1253
|
+
"firstWeapon",
|
|
1254
|
+
{get = function(self)
|
|
1255
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 0)
|
|
1256
|
+
rawset(self, "firstWeapon", weapon)
|
|
1257
|
+
return weapon
|
|
1258
|
+
end},
|
|
1259
|
+
true
|
|
1260
|
+
)
|
|
1261
|
+
__TS__SetDescriptor(
|
|
1262
|
+
Unit.prototype,
|
|
1263
|
+
"secondWeapon",
|
|
1264
|
+
{get = function(self)
|
|
1265
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 1)
|
|
1266
|
+
rawset(self, "secondWeapon", weapon)
|
|
1267
|
+
return weapon
|
|
1080
1268
|
end},
|
|
1081
1269
|
true
|
|
1082
1270
|
)
|
|
@@ -1112,6 +1300,19 @@ __TS__SetDescriptor(
|
|
|
1112
1300
|
},
|
|
1113
1301
|
true
|
|
1114
1302
|
)
|
|
1303
|
+
__TS__SetDescriptor(
|
|
1304
|
+
Unit.prototype,
|
|
1305
|
+
"primaryAttribute",
|
|
1306
|
+
{
|
|
1307
|
+
get = function(self)
|
|
1308
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1309
|
+
end,
|
|
1310
|
+
set = function(self, primaryAttribute)
|
|
1311
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1312
|
+
end
|
|
1313
|
+
},
|
|
1314
|
+
true
|
|
1315
|
+
)
|
|
1115
1316
|
__TS__SetDescriptor(
|
|
1116
1317
|
Unit.prototype,
|
|
1117
1318
|
"strengthBase",
|
|
@@ -1233,17 +1434,17 @@ __TS__SetDescriptor(
|
|
|
1233
1434
|
"isTeamGlowVisible",
|
|
1234
1435
|
{
|
|
1235
1436
|
get = function(self)
|
|
1236
|
-
return not self[
|
|
1437
|
+
return not self[106]
|
|
1237
1438
|
end,
|
|
1238
1439
|
set = function(self, isTeamGlowVisible)
|
|
1239
|
-
|
|
1240
|
-
local
|
|
1440
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1441
|
+
local ____temp_6
|
|
1241
1442
|
if not isTeamGlowVisible then
|
|
1242
|
-
|
|
1443
|
+
____temp_6 = true
|
|
1243
1444
|
else
|
|
1244
|
-
|
|
1445
|
+
____temp_6 = nil
|
|
1245
1446
|
end
|
|
1246
|
-
self[
|
|
1447
|
+
self[106] = ____temp_6
|
|
1247
1448
|
end
|
|
1248
1449
|
},
|
|
1249
1450
|
true
|
|
@@ -1252,9 +1453,9 @@ __TS__SetDescriptor(
|
|
|
1252
1453
|
Unit.prototype,
|
|
1253
1454
|
"color",
|
|
1254
1455
|
{set = function(self, color)
|
|
1255
|
-
|
|
1256
|
-
if self[
|
|
1257
|
-
|
|
1456
|
+
SetUnitColor(self.handle, color.handle)
|
|
1457
|
+
if self[106] then
|
|
1458
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1258
1459
|
end
|
|
1259
1460
|
end},
|
|
1260
1461
|
true
|
|
@@ -1277,10 +1478,14 @@ __TS__SetDescriptor(
|
|
|
1277
1478
|
"maxHealth",
|
|
1278
1479
|
{
|
|
1279
1480
|
get = function(self)
|
|
1280
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1481
|
+
return BlzGetUnitMaxHP(self.handle) - (self[104] or 0) - (self[105] or 0)
|
|
1281
1482
|
end,
|
|
1282
1483
|
set = function(self, maxHealth)
|
|
1283
|
-
|
|
1484
|
+
if maxHealth < 1 and self[103] ~= nil then
|
|
1485
|
+
self[104] = (self[104] or 0) + (1 - maxHealth)
|
|
1486
|
+
maxHealth = 1
|
|
1487
|
+
end
|
|
1488
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[105] or 0))
|
|
1284
1489
|
end
|
|
1285
1490
|
},
|
|
1286
1491
|
true
|
|
@@ -1322,10 +1527,10 @@ __TS__SetDescriptor(
|
|
|
1322
1527
|
"health",
|
|
1323
1528
|
{
|
|
1324
1529
|
get = function(self)
|
|
1325
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1530
|
+
return GetWidgetLife(self.handle) - (self[105] or 0)
|
|
1326
1531
|
end,
|
|
1327
1532
|
set = function(self, health)
|
|
1328
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1533
|
+
SetWidgetLife(self.handle, health + (self[105] or 0))
|
|
1329
1534
|
end
|
|
1330
1535
|
},
|
|
1331
1536
|
true
|
|
@@ -1419,7 +1624,7 @@ __TS__SetDescriptor(
|
|
|
1419
1624
|
"x",
|
|
1420
1625
|
{
|
|
1421
1626
|
get = function(self)
|
|
1422
|
-
return getUnitX(self.handle)
|
|
1627
|
+
return self[107] or getUnitX(self.handle)
|
|
1423
1628
|
end,
|
|
1424
1629
|
set = function(self, v)
|
|
1425
1630
|
SetUnitX(self.handle, v)
|
|
@@ -1432,7 +1637,7 @@ __TS__SetDescriptor(
|
|
|
1432
1637
|
"y",
|
|
1433
1638
|
{
|
|
1434
1639
|
get = function(self)
|
|
1435
|
-
return getUnitY(self.handle)
|
|
1640
|
+
return self[108] or getUnitY(self.handle)
|
|
1436
1641
|
end,
|
|
1437
1642
|
set = function(self, v)
|
|
1438
1643
|
SetUnitY(self.handle, v)
|
|
@@ -1518,10 +1723,10 @@ __TS__SetDescriptor(
|
|
|
1518
1723
|
"gold",
|
|
1519
1724
|
{
|
|
1520
1725
|
get = function(self)
|
|
1521
|
-
return
|
|
1726
|
+
return GetResourceAmount(self.handle)
|
|
1522
1727
|
end,
|
|
1523
1728
|
set = function(self, gold)
|
|
1524
|
-
|
|
1729
|
+
SetResourceAmount(self.handle, gold)
|
|
1525
1730
|
end
|
|
1526
1731
|
},
|
|
1527
1732
|
true
|
|
@@ -1536,17 +1741,17 @@ __TS__SetDescriptor(
|
|
|
1536
1741
|
set = function(self, isPaused)
|
|
1537
1742
|
local handle = self.handle
|
|
1538
1743
|
if isPaused and not IsUnitPaused(handle) then
|
|
1539
|
-
self[
|
|
1540
|
-
for _ = self[
|
|
1744
|
+
self[101] = true
|
|
1745
|
+
for _ = self[102] or 0, -1 do
|
|
1541
1746
|
BlzPauseUnitEx(handle, true)
|
|
1542
1747
|
end
|
|
1543
1748
|
PauseUnit(handle, true)
|
|
1544
1749
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1545
1750
|
PauseUnit(handle, false)
|
|
1546
|
-
for _ = self[
|
|
1751
|
+
for _ = self[102] or 0, -1 do
|
|
1547
1752
|
BlzPauseUnitEx(handle, false)
|
|
1548
1753
|
end
|
|
1549
|
-
self[
|
|
1754
|
+
self[101] = nil
|
|
1550
1755
|
end
|
|
1551
1756
|
end
|
|
1552
1757
|
},
|
|
@@ -1649,6 +1854,19 @@ __TS__SetDescriptor(
|
|
|
1649
1854
|
end},
|
|
1650
1855
|
true
|
|
1651
1856
|
)
|
|
1857
|
+
__TS__SetDescriptor(
|
|
1858
|
+
Unit.prototype,
|
|
1859
|
+
"movementType",
|
|
1860
|
+
{
|
|
1861
|
+
get = function(self)
|
|
1862
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1863
|
+
end,
|
|
1864
|
+
set = function(self, movementType)
|
|
1865
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1866
|
+
end
|
|
1867
|
+
},
|
|
1868
|
+
true
|
|
1869
|
+
)
|
|
1652
1870
|
__TS__SetDescriptor(
|
|
1653
1871
|
Unit.prototype,
|
|
1654
1872
|
"pathing",
|
|
@@ -1903,7 +2121,6 @@ Unit.onDecay = __TS__New(
|
|
|
1903
2121
|
Unit.onResurrect = __TS__New(
|
|
1904
2122
|
InitializingEvent,
|
|
1905
2123
|
function(event)
|
|
1906
|
-
local invoke = Event.invoke
|
|
1907
2124
|
local dead = setmetatable({}, {__mode = "k"})
|
|
1908
2125
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
1909
2126
|
dead[unit] = true
|
|
@@ -1919,10 +2136,15 @@ Unit.onResurrect = __TS__New(
|
|
|
1919
2136
|
Unit.morphEvent = __TS__New(
|
|
1920
2137
|
InitializingEvent,
|
|
1921
2138
|
function(event)
|
|
2139
|
+
local function ifNotLeft(unit)
|
|
2140
|
+
local handle = unit.handle
|
|
2141
|
+
if getUnitAbilityLevel(handle, leaveDetectAbilityId) ~= 0 and unitAddAbility(handle, morphDetectAbilityId) then
|
|
2142
|
+
invoke(event, unit)
|
|
2143
|
+
end
|
|
2144
|
+
end
|
|
1922
2145
|
____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
|
|
1923
2146
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
1924
|
-
|
|
1925
|
-
Timer:run(Event.invoke, event, unit)
|
|
2147
|
+
Timer:run(ifNotLeft, unit)
|
|
1926
2148
|
end
|
|
1927
2149
|
end)
|
|
1928
2150
|
end
|
|
@@ -1960,27 +2182,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
|
|
|
1960
2182
|
Unit.onTargetCast = dispatchId(__TS__New(
|
|
1961
2183
|
InitializingEvent,
|
|
1962
2184
|
function(event)
|
|
1963
|
-
local invoke = Event.invoke
|
|
1964
2185
|
local function listener(unit, id)
|
|
1965
|
-
local
|
|
2186
|
+
local ____GetSpellTargetUnit_result_9
|
|
1966
2187
|
if GetSpellTargetUnit() then
|
|
1967
|
-
|
|
2188
|
+
____GetSpellTargetUnit_result_9 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
1968
2189
|
else
|
|
1969
|
-
local
|
|
2190
|
+
local ____GetSpellTargetItem_result_8
|
|
1970
2191
|
if GetSpellTargetItem() then
|
|
1971
|
-
|
|
2192
|
+
____GetSpellTargetItem_result_8 = Item:of(GetSpellTargetItem())
|
|
1972
2193
|
else
|
|
1973
|
-
local
|
|
2194
|
+
local ____GetSpellTargetDestructable_result_7
|
|
1974
2195
|
if GetSpellTargetDestructable() then
|
|
1975
|
-
|
|
2196
|
+
____GetSpellTargetDestructable_result_7 = Destructable:of(GetSpellTargetDestructable())
|
|
1976
2197
|
else
|
|
1977
|
-
|
|
2198
|
+
____GetSpellTargetDestructable_result_7 = nil
|
|
1978
2199
|
end
|
|
1979
|
-
|
|
2200
|
+
____GetSpellTargetItem_result_8 = ____GetSpellTargetDestructable_result_7
|
|
1980
2201
|
end
|
|
1981
|
-
|
|
2202
|
+
____GetSpellTargetUnit_result_9 = ____GetSpellTargetItem_result_8
|
|
1982
2203
|
end
|
|
1983
|
-
local target =
|
|
2204
|
+
local target = ____GetSpellTargetUnit_result_9
|
|
1984
2205
|
if target then
|
|
1985
2206
|
invoke(event, unit, id, target)
|
|
1986
2207
|
end
|
|
@@ -2152,10 +2373,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2152
2373
|
____exports.UnitTriggerEvent,
|
|
2153
2374
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2154
2375
|
function()
|
|
2155
|
-
local
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2376
|
+
local handle = getOrderedUnit()
|
|
2377
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2378
|
+
local unit = ____exports.Unit:of(handle)
|
|
2379
|
+
if unit.state == 1 then
|
|
2380
|
+
return unit, getIssuedOrderId()
|
|
2381
|
+
end
|
|
2159
2382
|
end
|
|
2160
2383
|
return IgnoreEvent
|
|
2161
2384
|
end
|
|
@@ -2177,7 +2400,6 @@ Unit.autoAttackStartEvent = __TS__New(
|
|
|
2177
2400
|
)
|
|
2178
2401
|
Unit.onDamaging = (function()
|
|
2179
2402
|
local event = __TS__New(Event)
|
|
2180
|
-
local invoke = Event.invoke
|
|
2181
2403
|
local trigger = CreateTrigger()
|
|
2182
2404
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
|
|
2183
2405
|
TriggerAddCondition(
|
|
@@ -2187,13 +2409,18 @@ Unit.onDamaging = (function()
|
|
|
2187
2409
|
if source and source.typeId == dummyUnitId then
|
|
2188
2410
|
source = nil
|
|
2189
2411
|
end
|
|
2190
|
-
local target = BlzGetEventDamageTarget()
|
|
2412
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2413
|
+
local metadata = damageMetadataByTarget[target]
|
|
2414
|
+
damageMetadataByTarget[target] = nil
|
|
2191
2415
|
local data = {
|
|
2192
2416
|
amount = GetEventDamage(),
|
|
2193
|
-
attackType = BlzGetEventAttackType(),
|
|
2417
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2194
2418
|
damageType = BlzGetEventDamageType(),
|
|
2195
2419
|
weaponType = BlzGetEventWeaponType(),
|
|
2196
|
-
|
|
2420
|
+
metadata = metadata,
|
|
2421
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2422
|
+
originalAmount = GetEventDamage(),
|
|
2423
|
+
originalMetadata = metadata
|
|
2197
2424
|
}
|
|
2198
2425
|
if data.isAttack and source then
|
|
2199
2426
|
local weapon = BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 1) and (BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 0) and -1 or 1) or 0
|
|
@@ -2207,18 +2434,22 @@ Unit.onDamaging = (function()
|
|
|
2207
2434
|
invoke(
|
|
2208
2435
|
event,
|
|
2209
2436
|
source,
|
|
2210
|
-
|
|
2437
|
+
target,
|
|
2211
2438
|
setmetatable(
|
|
2212
2439
|
{},
|
|
2213
2440
|
{
|
|
2214
2441
|
__index = data,
|
|
2215
2442
|
__newindex = function(self, key, value)
|
|
2216
|
-
damageSetters[key]
|
|
2443
|
+
local damageSetter = damageSetters[key]
|
|
2444
|
+
if damageSetter ~= nil then
|
|
2445
|
+
damageSetter(value)
|
|
2446
|
+
end
|
|
2217
2447
|
data[key] = value
|
|
2218
2448
|
end
|
|
2219
2449
|
}
|
|
2220
2450
|
)
|
|
2221
2451
|
)
|
|
2452
|
+
damagingEventByTarget[target] = data
|
|
2222
2453
|
return
|
|
2223
2454
|
end
|
|
2224
2455
|
BlzSetEventDamage(0)
|
|
@@ -2226,7 +2457,7 @@ Unit.onDamaging = (function()
|
|
|
2226
2457
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2227
2458
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2228
2459
|
local sourceOwner = source.owner.handle
|
|
2229
|
-
local targetOwner =
|
|
2460
|
+
local targetOwner = target.owner.handle
|
|
2230
2461
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2231
2462
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2232
2463
|
Timer:run(function()
|
|
@@ -2242,23 +2473,19 @@ Unit.onDamaging = (function()
|
|
|
2242
2473
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2243
2474
|
local condition = ____value[1]
|
|
2244
2475
|
local action = ____value[2]
|
|
2245
|
-
if condition(
|
|
2246
|
-
source,
|
|
2247
|
-
____exports.Unit:of(target),
|
|
2248
|
-
data
|
|
2249
|
-
) then
|
|
2476
|
+
if condition(source, target, data) then
|
|
2250
2477
|
action(
|
|
2251
2478
|
source,
|
|
2252
|
-
|
|
2479
|
+
target,
|
|
2253
2480
|
setmetatable(
|
|
2254
2481
|
{fire = function()
|
|
2255
2482
|
UnitDamageTarget(
|
|
2256
2483
|
source.handle,
|
|
2257
|
-
target,
|
|
2484
|
+
target.handle,
|
|
2258
2485
|
data.amount,
|
|
2259
2486
|
true,
|
|
2260
2487
|
true,
|
|
2261
|
-
data.attackType,
|
|
2488
|
+
attackTypeToNative(data.attackType),
|
|
2262
2489
|
data.damageType,
|
|
2263
2490
|
data.weaponType
|
|
2264
2491
|
)
|
|
@@ -2276,7 +2503,6 @@ end)()
|
|
|
2276
2503
|
Unit.onDamage = __TS__New(
|
|
2277
2504
|
InitializingEvent,
|
|
2278
2505
|
function(event)
|
|
2279
|
-
local invoke = Event.invoke
|
|
2280
2506
|
local trigger = CreateTrigger()
|
|
2281
2507
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
|
|
2282
2508
|
TriggerAddCondition(
|
|
@@ -2286,12 +2512,18 @@ Unit.onDamage = __TS__New(
|
|
|
2286
2512
|
if source and source.typeId == dummyUnitId then
|
|
2287
2513
|
source = nil
|
|
2288
2514
|
end
|
|
2515
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2516
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2517
|
+
damagingEventByTarget[target] = nil
|
|
2289
2518
|
local data = {
|
|
2290
2519
|
amount = GetEventDamage(),
|
|
2291
|
-
attackType = BlzGetEventAttackType(),
|
|
2520
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2292
2521
|
damageType = BlzGetEventDamageType(),
|
|
2293
2522
|
weaponType = BlzGetEventWeaponType(),
|
|
2523
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2294
2524
|
isAttack = BlzGetEventIsAttack(),
|
|
2525
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2526
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2295
2527
|
preventDeath = damageEventPreventDeath
|
|
2296
2528
|
}
|
|
2297
2529
|
local evData = setmetatable(
|
|
@@ -2304,11 +2536,10 @@ Unit.onDamage = __TS__New(
|
|
|
2304
2536
|
end
|
|
2305
2537
|
}
|
|
2306
2538
|
)
|
|
2307
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2308
2539
|
invoke(event, source, target, evData)
|
|
2309
2540
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2310
2541
|
local bonusHealth = math.ceil(evData.amount)
|
|
2311
|
-
target[
|
|
2542
|
+
target[105] = (target[105] or 0) + bonusHealth
|
|
2312
2543
|
BlzSetUnitMaxHP(
|
|
2313
2544
|
target.handle,
|
|
2314
2545
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2322,7 +2553,7 @@ Unit.onDamage = __TS__New(
|
|
|
2322
2553
|
evData[0],
|
|
2323
2554
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2324
2555
|
)
|
|
2325
|
-
target[
|
|
2556
|
+
target[105] = (target[105] or 0) - bonusHealth
|
|
2326
2557
|
SetWidgetLife(
|
|
2327
2558
|
target.handle,
|
|
2328
2559
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2342,32 +2573,91 @@ Unit.onDamage = __TS__New(
|
|
|
2342
2573
|
DestroyTrigger(trigger)
|
|
2343
2574
|
end
|
|
2344
2575
|
)
|
|
2345
|
-
Unit.
|
|
2576
|
+
Unit.itemDroppedEvent = __TS__New(
|
|
2346
2577
|
____exports.UnitTriggerEvent,
|
|
2347
2578
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2348
2579
|
function()
|
|
2349
2580
|
local unit = getTriggerUnit()
|
|
2350
|
-
|
|
2351
|
-
|
|
2581
|
+
local item = getManipulatedItem()
|
|
2582
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2583
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2352
2584
|
end
|
|
2353
2585
|
return IgnoreEvent
|
|
2354
2586
|
end
|
|
2355
2587
|
)
|
|
2356
|
-
Unit.
|
|
2588
|
+
Unit.itemPickedUpEvent = __TS__New(
|
|
2357
2589
|
____exports.UnitTriggerEvent,
|
|
2358
2590
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2359
2591
|
function()
|
|
2360
2592
|
local unit = getTriggerUnit()
|
|
2361
|
-
|
|
2362
|
-
|
|
2593
|
+
local item = getManipulatedItem()
|
|
2594
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2595
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2363
2596
|
end
|
|
2364
2597
|
return IgnoreEvent
|
|
2365
2598
|
end
|
|
2366
2599
|
)
|
|
2367
|
-
Unit.
|
|
2600
|
+
Unit.itemUsedEvent = __TS__New(
|
|
2368
2601
|
____exports.UnitTriggerEvent,
|
|
2369
2602
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2370
|
-
function()
|
|
2603
|
+
function()
|
|
2604
|
+
local unit = getTriggerUnit()
|
|
2605
|
+
local item = getManipulatedItem()
|
|
2606
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2607
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2608
|
+
end
|
|
2609
|
+
return IgnoreEvent
|
|
2610
|
+
end
|
|
2611
|
+
)
|
|
2612
|
+
Unit.itemStackedEvent = __TS__New(
|
|
2613
|
+
____exports.UnitTriggerEvent,
|
|
2614
|
+
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2615
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2616
|
+
)
|
|
2617
|
+
__TS__ObjectDefineProperty(
|
|
2618
|
+
Unit,
|
|
2619
|
+
"itemUseOrderEvent",
|
|
2620
|
+
{get = function(self)
|
|
2621
|
+
local event = __TS__New(Event)
|
|
2622
|
+
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2623
|
+
local slot = order - orderId("useslot0")
|
|
2624
|
+
local function listener(unit)
|
|
2625
|
+
local item = unit.items[slot + 1]
|
|
2626
|
+
if item ~= nil then
|
|
2627
|
+
invoke(event, unit, item)
|
|
2628
|
+
end
|
|
2629
|
+
end
|
|
2630
|
+
self.onImmediateOrder[order]:addListener(listener)
|
|
2631
|
+
self.onTargetOrder[order]:addListener(listener)
|
|
2632
|
+
self.onPointOrder[order]:addListener(listener)
|
|
2633
|
+
end
|
|
2634
|
+
rawset(self, "itemUseOrderEvent", event)
|
|
2635
|
+
return event
|
|
2636
|
+
end}
|
|
2637
|
+
)
|
|
2638
|
+
__TS__ObjectDefineProperty(
|
|
2639
|
+
Unit,
|
|
2640
|
+
"itemMoveOrderEvent",
|
|
2641
|
+
{get = function(self)
|
|
2642
|
+
local event = __TS__New(Event)
|
|
2643
|
+
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2644
|
+
local slotTo = order - orderId("moveslot0")
|
|
2645
|
+
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2646
|
+
local slotFrom = unit.items:findSlot(item)
|
|
2647
|
+
if slotFrom ~= nil then
|
|
2648
|
+
invoke(
|
|
2649
|
+
event,
|
|
2650
|
+
unit,
|
|
2651
|
+
item,
|
|
2652
|
+
slotFrom,
|
|
2653
|
+
slotTo
|
|
2654
|
+
)
|
|
2655
|
+
end
|
|
2656
|
+
end)
|
|
2657
|
+
end
|
|
2658
|
+
rawset(self, "itemMoveOrderEvent", event)
|
|
2659
|
+
return event
|
|
2660
|
+
end}
|
|
2371
2661
|
)
|
|
2372
2662
|
__TS__ObjectDefineProperty(
|
|
2373
2663
|
Unit,
|