warscript 0.0.1-dev.90e4632 → 0.0.1-dev.91a4dce
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 +6 -0
- package/attributes.lua +17 -1
- package/core/types/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- package/core/types/frame.lua +24 -21
- package/core/types/player.d.ts +15 -0
- package/core/types/player.lua +40 -7
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/sound.d.ts +17 -25
- package/core/types/sound.lua +85 -44
- package/core/types/tileCell.d.ts +9 -0
- package/core/types/tileCell.lua +92 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- package/core/util.lua +6 -1
- package/decl/native.d.ts +846 -790
- package/engine/behavior.d.ts +5 -0
- package/engine/behavior.lua +106 -27
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +9 -3
- package/engine/behaviour/ability/damage.lua +26 -38
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +18 -3
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +5 -1
- package/engine/behaviour/ability.lua +26 -21
- package/engine/behaviour/unit/stun-immunity.d.ts +7 -3
- package/engine/behaviour/unit/stun-immunity.lua +52 -27
- package/engine/behaviour/unit.d.ts +34 -0
- package/engine/behaviour/unit.lua +190 -4
- package/engine/buff.d.ts +15 -12
- package/engine/buff.lua +133 -117
- package/engine/internal/ability.d.ts +7 -1
- package/engine/internal/ability.lua +49 -9
- package/engine/internal/item/ability.lua +63 -11
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +18 -17
- package/engine/internal/item.lua +135 -49
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +98 -9
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +42 -14
- package/engine/internal/unit.d.ts +34 -10
- package/engine/internal/unit.lua +273 -116
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- 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/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/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/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/curse.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/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -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/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/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 +11 -11
- package/engine/object-data/entry/ability-type.lua +35 -13
- package/engine/object-data/entry/buff-type/applicable.lua +5 -0
- package/engine/object-data/entry/buff-type.d.ts +5 -11
- package/engine/object-data/entry/buff-type.lua +11 -27
- package/engine/object-data/entry/sound-preset.d.ts +17 -0
- package/engine/object-data/entry/sound-preset.lua +104 -0
- package/engine/object-data/entry/unit-type.d.ts +13 -4
- package/engine/object-data/entry/unit-type.lua +153 -85
- package/engine/object-field/ability.d.ts +4 -4
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +57 -3
- package/engine/object-field/unit.lua +207 -7
- package/engine/object-field.d.ts +17 -6
- package/engine/object-field.lua +188 -92
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +249 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +2 -3
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +2 -0
- package/utility/arrays.lua +11 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/linked-set.d.ts +2 -0
- package/utility/linked-set.lua +22 -1
- package/utility/lua-maps.d.ts +15 -2
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/types.d.ts +3 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/internal/unit.lua
CHANGED
|
@@ -53,12 +53,19 @@ local ____math = require("math")
|
|
|
53
53
|
local min = ____math.min
|
|
54
54
|
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
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 ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
60
|
+
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
|
+
local ____attributes = require("attributes")
|
|
62
|
+
local isAttribute = ____attributes.isAttribute
|
|
63
|
+
local ____ability = require("engine.internal.item.ability")
|
|
64
|
+
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
56
65
|
local match = string.match
|
|
57
66
|
local ____tostring = _G.tostring
|
|
58
67
|
local setUnitAnimation = SetUnitAnimation
|
|
59
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
60
68
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
61
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
62
69
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
63
70
|
local getUnitRealField = BlzGetUnitRealField
|
|
64
71
|
local getHeroStr = GetHeroStr
|
|
@@ -80,7 +87,6 @@ local getHandleId = GetHandleId
|
|
|
80
87
|
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
81
88
|
local createUnit = CreateUnit
|
|
82
89
|
local killUnit = KillUnit
|
|
83
|
-
local setUnitExploded = SetUnitExploded
|
|
84
90
|
local removeUnit = RemoveUnit
|
|
85
91
|
local getUnitTypeId = GetUnitTypeId
|
|
86
92
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -96,8 +102,6 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
96
102
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
97
103
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
98
104
|
local isUnitInRange = IsUnitInRange
|
|
99
|
-
local setResourceAmount = SetResourceAmount
|
|
100
|
-
local getResourceAmount = GetResourceAmount
|
|
101
105
|
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
102
106
|
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
103
107
|
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
@@ -121,15 +125,9 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
121
125
|
local getIssuedOrderId = GetIssuedOrderId
|
|
122
126
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
123
127
|
local unitAlive = UnitAlive
|
|
124
|
-
local unitAddType = UnitAddType
|
|
125
|
-
local unitRemoveType = UnitRemoveType
|
|
126
|
-
local isUnitIllusion = IsUnitIllusion
|
|
127
|
-
local isUnitType = IsUnitType
|
|
128
128
|
local isUnitAlly = IsUnitAlly
|
|
129
129
|
local isUnitEnemy = IsUnitEnemy
|
|
130
130
|
local getOwningPlayer = GetOwningPlayer
|
|
131
|
-
local setUnitColor = SetUnitColor
|
|
132
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
133
131
|
____exports.UnitClassification = {}
|
|
134
132
|
local UnitClassification = ____exports.UnitClassification
|
|
135
133
|
do
|
|
@@ -139,6 +137,7 @@ do
|
|
|
139
137
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
140
138
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
141
139
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
140
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
142
141
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
143
142
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
144
143
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -346,6 +345,9 @@ local function dispatchAbility(event)
|
|
|
346
345
|
}
|
|
347
346
|
)
|
|
348
347
|
end
|
|
348
|
+
local function damagingEventPreventRetaliation(self)
|
|
349
|
+
self[0] = true
|
|
350
|
+
end
|
|
349
351
|
local function damageEventPreventDeath(self, callback, ...)
|
|
350
352
|
if self[0] ~= nil then
|
|
351
353
|
return
|
|
@@ -357,7 +359,14 @@ local function damageEventPreventDeath(self, callback, ...)
|
|
|
357
359
|
rawset(self, 1 + i, (select(i, ...)))
|
|
358
360
|
end
|
|
359
361
|
end
|
|
360
|
-
local damageSetters = {
|
|
362
|
+
local damageSetters = {
|
|
363
|
+
amount = BlzSetEventDamage,
|
|
364
|
+
attackType = function(attackType)
|
|
365
|
+
return BlzSetEventAttackType(attackTypeToNative(attackType))
|
|
366
|
+
end,
|
|
367
|
+
damageType = BlzSetEventDamageType,
|
|
368
|
+
weaponType = BlzSetEventWeaponType
|
|
369
|
+
}
|
|
361
370
|
local jlimitopByOperator = {
|
|
362
371
|
[0] = LESS_THAN_OR_EQUAL,
|
|
363
372
|
[1] = LESS_THAN_OR_EQUAL,
|
|
@@ -401,6 +410,19 @@ function UnitWeapon.prototype.____constructor(self, unit, index)
|
|
|
401
410
|
self.unit = unit
|
|
402
411
|
self.index = index
|
|
403
412
|
end
|
|
413
|
+
__TS__SetDescriptor(
|
|
414
|
+
UnitWeapon.prototype,
|
|
415
|
+
"isEnabled",
|
|
416
|
+
{
|
|
417
|
+
get = function(self)
|
|
418
|
+
return BlzGetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index)
|
|
419
|
+
end,
|
|
420
|
+
set = function(self, isEnabled)
|
|
421
|
+
BlzSetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index, isEnabled)
|
|
422
|
+
end
|
|
423
|
+
},
|
|
424
|
+
true
|
|
425
|
+
)
|
|
404
426
|
__TS__SetDescriptor(
|
|
405
427
|
UnitWeapon.prototype,
|
|
406
428
|
"cooldown",
|
|
@@ -435,6 +457,19 @@ __TS__SetDescriptor(
|
|
|
435
457
|
},
|
|
436
458
|
true
|
|
437
459
|
)
|
|
460
|
+
__TS__SetDescriptor(
|
|
461
|
+
UnitWeapon.prototype,
|
|
462
|
+
"allowedTargetCombatClassifications",
|
|
463
|
+
{
|
|
464
|
+
get = function(self)
|
|
465
|
+
return BlzGetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index)
|
|
466
|
+
end,
|
|
467
|
+
set = function(self, allowedTargetCombatClassifications)
|
|
468
|
+
BlzSetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index, allowedTargetCombatClassifications)
|
|
469
|
+
end
|
|
470
|
+
},
|
|
471
|
+
true
|
|
472
|
+
)
|
|
438
473
|
__TS__SetDescriptor(
|
|
439
474
|
UnitWeapon.prototype,
|
|
440
475
|
"damageBase",
|
|
@@ -639,16 +674,26 @@ local function delayHealthChecksCallback(unit)
|
|
|
639
674
|
end
|
|
640
675
|
end
|
|
641
676
|
local nextSyncId = 1
|
|
642
|
-
local unitBySyncId = setmetatable({}, {__mode = "
|
|
677
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
678
|
+
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
679
|
+
local function addAbility(unit, abilityTypeId)
|
|
680
|
+
local ____unitAddAbility_result_0
|
|
681
|
+
if unitAddAbility(unit, abilityTypeId) then
|
|
682
|
+
____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
|
|
683
|
+
else
|
|
684
|
+
____unitAddAbility_result_0 = nil
|
|
685
|
+
end
|
|
686
|
+
return ____unitAddAbility_result_0
|
|
687
|
+
end
|
|
643
688
|
____exports.Unit = __TS__Class()
|
|
644
689
|
local Unit = ____exports.Unit
|
|
645
690
|
Unit.name = "Unit"
|
|
646
691
|
__TS__ClassExtends(Unit, Handle)
|
|
647
692
|
function Unit.prototype.____constructor(self, handle)
|
|
648
693
|
Handle.prototype.____constructor(self, handle)
|
|
649
|
-
local
|
|
650
|
-
nextSyncId =
|
|
651
|
-
self.syncId =
|
|
694
|
+
local ____nextSyncId_1 = nextSyncId
|
|
695
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
696
|
+
self.syncId = ____nextSyncId_1
|
|
652
697
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
653
698
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
654
699
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -680,6 +725,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
680
725
|
end
|
|
681
726
|
function Unit.prototype.onDestroy(self)
|
|
682
727
|
local handle = self.handle
|
|
728
|
+
self[107] = getUnitX(handle)
|
|
729
|
+
self[108] = getUnitY(handle)
|
|
683
730
|
if not self._owner then
|
|
684
731
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
685
732
|
end
|
|
@@ -747,17 +794,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
747
794
|
end}
|
|
748
795
|
end
|
|
749
796
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
750
|
-
local
|
|
751
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
797
|
+
local ____combatClassification_2 = combatClassification
|
|
798
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
|
|
752
799
|
end
|
|
753
800
|
function Unit.prototype.addClassification(self, classification)
|
|
754
|
-
return
|
|
801
|
+
return UnitAddType(self.handle, classification)
|
|
755
802
|
end
|
|
756
803
|
function Unit.prototype.removeClassification(self, classification)
|
|
757
|
-
return
|
|
804
|
+
return UnitRemoveType(self.handle, classification)
|
|
758
805
|
end
|
|
759
806
|
function Unit.prototype.hasClassification(self, classification)
|
|
760
|
-
return
|
|
807
|
+
return IsUnitType(self.handle, classification)
|
|
761
808
|
end
|
|
762
809
|
function Unit.prototype.isVisibleTo(self, player)
|
|
763
810
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -766,13 +813,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
766
813
|
return isUnitInvisible(self.handle, player.handle)
|
|
767
814
|
end
|
|
768
815
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
769
|
-
local
|
|
816
|
+
local ____temp_3
|
|
770
817
|
if type(x) == "number" then
|
|
771
|
-
|
|
818
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
772
819
|
else
|
|
773
|
-
|
|
820
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
774
821
|
end
|
|
775
|
-
return
|
|
822
|
+
return ____temp_3
|
|
776
823
|
end
|
|
777
824
|
function Unit.prototype.isAllyOf(self, unit)
|
|
778
825
|
return isUnitAlly(
|
|
@@ -790,13 +837,27 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
790
837
|
if type(animation) == "number" then
|
|
791
838
|
setUnitAnimationByIndex(self.handle, animation)
|
|
792
839
|
elseif rarity then
|
|
793
|
-
|
|
840
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
794
841
|
else
|
|
795
842
|
setUnitAnimation(self.handle, animation)
|
|
796
843
|
end
|
|
797
844
|
end
|
|
845
|
+
function Unit.prototype.resetAnimation(self)
|
|
846
|
+
ResetUnitAnimation(self.handle)
|
|
847
|
+
end
|
|
798
848
|
function Unit.prototype.queueAnimation(self, animation)
|
|
799
|
-
|
|
849
|
+
QueueUnitAnimation(self.handle, animation)
|
|
850
|
+
end
|
|
851
|
+
function Unit.prototype.chooseWeapon(self, target)
|
|
852
|
+
local firstWeapon = self.firstWeapon
|
|
853
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
854
|
+
return firstWeapon
|
|
855
|
+
end
|
|
856
|
+
local secondWeapon = self.secondWeapon
|
|
857
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
858
|
+
return secondWeapon
|
|
859
|
+
end
|
|
860
|
+
return nil
|
|
800
861
|
end
|
|
801
862
|
function Unit.prototype.delayHealthChecks(self)
|
|
802
863
|
self[103] = (self[103] or 0) + 1
|
|
@@ -809,21 +870,21 @@ function Unit.prototype.isSelected(self, player)
|
|
|
809
870
|
return IsUnitSelected(self.handle, player.handle)
|
|
810
871
|
end
|
|
811
872
|
function Unit.prototype.explode(self)
|
|
812
|
-
|
|
873
|
+
SetUnitExploded(self.handle, true)
|
|
813
874
|
killUnit(self.handle)
|
|
814
875
|
end
|
|
815
876
|
function Unit.prototype.kill(self)
|
|
816
877
|
killUnit(self.handle)
|
|
817
878
|
end
|
|
818
879
|
function Unit.prototype.revive(self, x, y, doEffect)
|
|
819
|
-
local
|
|
820
|
-
local
|
|
821
|
-
local
|
|
822
|
-
if
|
|
823
|
-
|
|
880
|
+
local ____ReviveHero_6 = ReviveHero
|
|
881
|
+
local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
|
|
882
|
+
local ____doEffect_4 = doEffect
|
|
883
|
+
if ____doEffect_4 == nil then
|
|
884
|
+
____doEffect_4 = false
|
|
824
885
|
end
|
|
825
|
-
__TS__SparseArrayPush(
|
|
826
|
-
|
|
886
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
887
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
827
888
|
end
|
|
828
889
|
function Unit.prototype.healTarget(self, target, amount)
|
|
829
890
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -866,17 +927,16 @@ function Unit.prototype.itemInSlot(self, slot)
|
|
|
866
927
|
return Item:of(unitItemInSlot(self.handle, slot))
|
|
867
928
|
end
|
|
868
929
|
function Unit.prototype.addAbility(self, abilityId)
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
930
|
+
local ability = UnitAbility:of(
|
|
931
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
932
|
+
abilityId,
|
|
933
|
+
self
|
|
934
|
+
)
|
|
935
|
+
if ability ~= nil then
|
|
875
936
|
local abilities = self.abilities
|
|
876
937
|
abilities[#abilities + 1] = ability
|
|
877
|
-
return ability
|
|
878
938
|
end
|
|
879
|
-
return
|
|
939
|
+
return ability
|
|
880
940
|
end
|
|
881
941
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
882
942
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -890,31 +950,21 @@ end
|
|
|
890
950
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
891
951
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
892
952
|
end
|
|
893
|
-
function Unit.prototype.
|
|
894
|
-
local
|
|
895
|
-
|
|
896
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
897
|
-
return nil
|
|
898
|
-
end
|
|
899
|
-
return UnitAbility:of(
|
|
900
|
-
getUnitAbility(self.handle, abilityId),
|
|
901
|
-
abilityId,
|
|
902
|
-
self
|
|
903
|
-
)
|
|
953
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
954
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
955
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
904
956
|
end
|
|
905
|
-
function Unit.prototype.removeAbility(self,
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
end
|
|
957
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
958
|
+
local abilities = self.abilities
|
|
959
|
+
for i = 1, #abilities do
|
|
960
|
+
if abilities[i].typeId == abilityTypeId then
|
|
961
|
+
local ability = abilities[i]
|
|
962
|
+
tremove(abilities, i)
|
|
963
|
+
ability:destroy()
|
|
964
|
+
return true
|
|
914
965
|
end
|
|
915
|
-
return true
|
|
916
966
|
end
|
|
917
|
-
return
|
|
967
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
918
968
|
end
|
|
919
969
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
920
970
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -928,6 +978,21 @@ end
|
|
|
928
978
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
929
979
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
930
980
|
end
|
|
981
|
+
function Unit.prototype.interruptMovement(self)
|
|
982
|
+
local handle = self.handle
|
|
983
|
+
unitDisableAbility(
|
|
984
|
+
handle,
|
|
985
|
+
fourCC("Amov"),
|
|
986
|
+
true,
|
|
987
|
+
false
|
|
988
|
+
)
|
|
989
|
+
unitDisableAbility(
|
|
990
|
+
handle,
|
|
991
|
+
fourCC("Amov"),
|
|
992
|
+
false,
|
|
993
|
+
false
|
|
994
|
+
)
|
|
995
|
+
end
|
|
931
996
|
function Unit.prototype.interruptAttack(self)
|
|
932
997
|
unitInterruptAttack(self.handle)
|
|
933
998
|
end
|
|
@@ -1201,7 +1266,7 @@ __TS__SetDescriptor(
|
|
|
1201
1266
|
Unit.prototype,
|
|
1202
1267
|
"isIllusion",
|
|
1203
1268
|
{get = function(self)
|
|
1204
|
-
return
|
|
1269
|
+
return IsUnitIllusion(self.handle)
|
|
1205
1270
|
end},
|
|
1206
1271
|
true
|
|
1207
1272
|
)
|
|
@@ -1286,6 +1351,19 @@ __TS__SetDescriptor(
|
|
|
1286
1351
|
},
|
|
1287
1352
|
true
|
|
1288
1353
|
)
|
|
1354
|
+
__TS__SetDescriptor(
|
|
1355
|
+
Unit.prototype,
|
|
1356
|
+
"primaryAttribute",
|
|
1357
|
+
{
|
|
1358
|
+
get = function(self)
|
|
1359
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1360
|
+
end,
|
|
1361
|
+
set = function(self, primaryAttribute)
|
|
1362
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1363
|
+
end
|
|
1364
|
+
},
|
|
1365
|
+
true
|
|
1366
|
+
)
|
|
1289
1367
|
__TS__SetDescriptor(
|
|
1290
1368
|
Unit.prototype,
|
|
1291
1369
|
"strengthBase",
|
|
@@ -1410,14 +1488,14 @@ __TS__SetDescriptor(
|
|
|
1410
1488
|
return not self[106]
|
|
1411
1489
|
end,
|
|
1412
1490
|
set = function(self, isTeamGlowVisible)
|
|
1413
|
-
|
|
1414
|
-
local
|
|
1491
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1492
|
+
local ____temp_7
|
|
1415
1493
|
if not isTeamGlowVisible then
|
|
1416
|
-
|
|
1494
|
+
____temp_7 = true
|
|
1417
1495
|
else
|
|
1418
|
-
|
|
1496
|
+
____temp_7 = nil
|
|
1419
1497
|
end
|
|
1420
|
-
self[106] =
|
|
1498
|
+
self[106] = ____temp_7
|
|
1421
1499
|
end
|
|
1422
1500
|
},
|
|
1423
1501
|
true
|
|
@@ -1426,9 +1504,9 @@ __TS__SetDescriptor(
|
|
|
1426
1504
|
Unit.prototype,
|
|
1427
1505
|
"color",
|
|
1428
1506
|
{set = function(self, color)
|
|
1429
|
-
|
|
1507
|
+
SetUnitColor(self.handle, color.handle)
|
|
1430
1508
|
if self[106] then
|
|
1431
|
-
|
|
1509
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1432
1510
|
end
|
|
1433
1511
|
end},
|
|
1434
1512
|
true
|
|
@@ -1597,7 +1675,7 @@ __TS__SetDescriptor(
|
|
|
1597
1675
|
"x",
|
|
1598
1676
|
{
|
|
1599
1677
|
get = function(self)
|
|
1600
|
-
return getUnitX(self.handle)
|
|
1678
|
+
return self[107] or getUnitX(self.handle)
|
|
1601
1679
|
end,
|
|
1602
1680
|
set = function(self, v)
|
|
1603
1681
|
SetUnitX(self.handle, v)
|
|
@@ -1610,7 +1688,7 @@ __TS__SetDescriptor(
|
|
|
1610
1688
|
"y",
|
|
1611
1689
|
{
|
|
1612
1690
|
get = function(self)
|
|
1613
|
-
return getUnitY(self.handle)
|
|
1691
|
+
return self[108] or getUnitY(self.handle)
|
|
1614
1692
|
end,
|
|
1615
1693
|
set = function(self, v)
|
|
1616
1694
|
SetUnitY(self.handle, v)
|
|
@@ -1696,10 +1774,10 @@ __TS__SetDescriptor(
|
|
|
1696
1774
|
"gold",
|
|
1697
1775
|
{
|
|
1698
1776
|
get = function(self)
|
|
1699
|
-
return
|
|
1777
|
+
return GetResourceAmount(self.handle)
|
|
1700
1778
|
end,
|
|
1701
1779
|
set = function(self, gold)
|
|
1702
|
-
|
|
1780
|
+
SetResourceAmount(self.handle, gold)
|
|
1703
1781
|
end
|
|
1704
1782
|
},
|
|
1705
1783
|
true
|
|
@@ -1827,6 +1905,19 @@ __TS__SetDescriptor(
|
|
|
1827
1905
|
end},
|
|
1828
1906
|
true
|
|
1829
1907
|
)
|
|
1908
|
+
__TS__SetDescriptor(
|
|
1909
|
+
Unit.prototype,
|
|
1910
|
+
"movementType",
|
|
1911
|
+
{
|
|
1912
|
+
get = function(self)
|
|
1913
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1914
|
+
end,
|
|
1915
|
+
set = function(self, movementType)
|
|
1916
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1917
|
+
end
|
|
1918
|
+
},
|
|
1919
|
+
true
|
|
1920
|
+
)
|
|
1830
1921
|
__TS__SetDescriptor(
|
|
1831
1922
|
Unit.prototype,
|
|
1832
1923
|
"pathing",
|
|
@@ -2008,6 +2099,14 @@ __TS__SetDescriptor(
|
|
|
2008
2099
|
end},
|
|
2009
2100
|
true
|
|
2010
2101
|
)
|
|
2102
|
+
__TS__SetDescriptor(
|
|
2103
|
+
Unit.prototype,
|
|
2104
|
+
"targetAcquiredEvent",
|
|
2105
|
+
{get = function(self)
|
|
2106
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2107
|
+
end},
|
|
2108
|
+
true
|
|
2109
|
+
)
|
|
2011
2110
|
__TS__SetDescriptor(
|
|
2012
2111
|
Unit.prototype,
|
|
2013
2112
|
"onSelect",
|
|
@@ -2143,25 +2242,25 @@ Unit.onTargetCast = dispatchId(__TS__New(
|
|
|
2143
2242
|
InitializingEvent,
|
|
2144
2243
|
function(event)
|
|
2145
2244
|
local function listener(unit, id)
|
|
2146
|
-
local
|
|
2245
|
+
local ____GetSpellTargetUnit_result_10
|
|
2147
2246
|
if GetSpellTargetUnit() then
|
|
2148
|
-
|
|
2247
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
2149
2248
|
else
|
|
2150
|
-
local
|
|
2249
|
+
local ____GetSpellTargetItem_result_9
|
|
2151
2250
|
if GetSpellTargetItem() then
|
|
2152
|
-
|
|
2251
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
2153
2252
|
else
|
|
2154
|
-
local
|
|
2253
|
+
local ____GetSpellTargetDestructable_result_8
|
|
2155
2254
|
if GetSpellTargetDestructable() then
|
|
2156
|
-
|
|
2255
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2157
2256
|
else
|
|
2158
|
-
|
|
2257
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2159
2258
|
end
|
|
2160
|
-
|
|
2259
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2161
2260
|
end
|
|
2162
|
-
|
|
2261
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2163
2262
|
end
|
|
2164
|
-
local target =
|
|
2263
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2165
2264
|
if target then
|
|
2166
2265
|
invoke(event, unit, id, target)
|
|
2167
2266
|
end
|
|
@@ -2369,38 +2468,57 @@ Unit.onDamaging = (function()
|
|
|
2369
2468
|
if source and source.typeId == dummyUnitId then
|
|
2370
2469
|
source = nil
|
|
2371
2470
|
end
|
|
2372
|
-
local target = BlzGetEventDamageTarget()
|
|
2471
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2472
|
+
local metadata = damageMetadataByTarget[target]
|
|
2473
|
+
damageMetadataByTarget[target] = nil
|
|
2373
2474
|
local data = {
|
|
2374
2475
|
amount = GetEventDamage(),
|
|
2375
|
-
attackType = BlzGetEventAttackType(),
|
|
2476
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2376
2477
|
damageType = BlzGetEventDamageType(),
|
|
2377
2478
|
weaponType = BlzGetEventWeaponType(),
|
|
2378
|
-
|
|
2479
|
+
metadata = metadata,
|
|
2480
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2481
|
+
originalAmount = GetEventDamage(),
|
|
2482
|
+
originalMetadata = metadata,
|
|
2483
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2379
2484
|
}
|
|
2380
2485
|
if data.isAttack and source then
|
|
2381
|
-
|
|
2382
|
-
if weapon == -1 then
|
|
2383
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2384
|
-
weapon = 0
|
|
2385
|
-
end
|
|
2386
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2486
|
+
data.weapon = source:chooseWeapon(target)
|
|
2387
2487
|
end
|
|
2388
2488
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2389
2489
|
invoke(
|
|
2390
2490
|
event,
|
|
2391
2491
|
source,
|
|
2392
|
-
|
|
2492
|
+
target,
|
|
2393
2493
|
setmetatable(
|
|
2394
2494
|
{},
|
|
2395
2495
|
{
|
|
2396
2496
|
__index = data,
|
|
2397
2497
|
__newindex = function(self, key, value)
|
|
2398
|
-
damageSetters[key]
|
|
2498
|
+
local damageSetter = damageSetters[key]
|
|
2499
|
+
if damageSetter ~= nil then
|
|
2500
|
+
damageSetter(value)
|
|
2501
|
+
end
|
|
2399
2502
|
data[key] = value
|
|
2400
2503
|
end
|
|
2401
2504
|
}
|
|
2402
2505
|
)
|
|
2403
2506
|
)
|
|
2507
|
+
if data[0] and source then
|
|
2508
|
+
local sourceOwner = source.owner.handle
|
|
2509
|
+
data[1] = sourceOwner
|
|
2510
|
+
local targetOwner = target.owner.handle
|
|
2511
|
+
data[2] = targetOwner
|
|
2512
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2513
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2514
|
+
data[3] = true
|
|
2515
|
+
end
|
|
2516
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2517
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2518
|
+
data[4] = true
|
|
2519
|
+
end
|
|
2520
|
+
end
|
|
2521
|
+
damagingEventByTarget[target] = data
|
|
2404
2522
|
return
|
|
2405
2523
|
end
|
|
2406
2524
|
BlzSetEventDamage(0)
|
|
@@ -2408,7 +2526,7 @@ Unit.onDamaging = (function()
|
|
|
2408
2526
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2409
2527
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2410
2528
|
local sourceOwner = source.owner.handle
|
|
2411
|
-
local targetOwner =
|
|
2529
|
+
local targetOwner = target.owner.handle
|
|
2412
2530
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2413
2531
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2414
2532
|
Timer:run(function()
|
|
@@ -2424,23 +2542,19 @@ Unit.onDamaging = (function()
|
|
|
2424
2542
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2425
2543
|
local condition = ____value[1]
|
|
2426
2544
|
local action = ____value[2]
|
|
2427
|
-
if condition(
|
|
2428
|
-
source,
|
|
2429
|
-
____exports.Unit:of(target),
|
|
2430
|
-
data
|
|
2431
|
-
) then
|
|
2545
|
+
if condition(source, target, data) then
|
|
2432
2546
|
action(
|
|
2433
2547
|
source,
|
|
2434
|
-
|
|
2548
|
+
target,
|
|
2435
2549
|
setmetatable(
|
|
2436
2550
|
{fire = function()
|
|
2437
2551
|
UnitDamageTarget(
|
|
2438
2552
|
source.handle,
|
|
2439
|
-
target,
|
|
2553
|
+
target.handle,
|
|
2440
2554
|
data.amount,
|
|
2441
2555
|
true,
|
|
2442
2556
|
true,
|
|
2443
|
-
data.attackType,
|
|
2557
|
+
attackTypeToNative(data.attackType),
|
|
2444
2558
|
data.damageType,
|
|
2445
2559
|
data.weaponType
|
|
2446
2560
|
)
|
|
@@ -2467,26 +2581,50 @@ Unit.onDamage = __TS__New(
|
|
|
2467
2581
|
if source and source.typeId == dummyUnitId then
|
|
2468
2582
|
source = nil
|
|
2469
2583
|
end
|
|
2584
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2585
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2586
|
+
damagingEventByTarget[target] = nil
|
|
2470
2587
|
local data = {
|
|
2471
2588
|
amount = GetEventDamage(),
|
|
2472
|
-
attackType = BlzGetEventAttackType(),
|
|
2589
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2473
2590
|
damageType = BlzGetEventDamageType(),
|
|
2474
2591
|
weaponType = BlzGetEventWeaponType(),
|
|
2592
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2475
2593
|
isAttack = BlzGetEventIsAttack(),
|
|
2476
|
-
originalAmount = GetEventDamage(),
|
|
2594
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2595
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2477
2596
|
preventDeath = damageEventPreventDeath
|
|
2478
2597
|
}
|
|
2598
|
+
if damagingEvent then
|
|
2599
|
+
for key, value in pairs(damagingEvent) do
|
|
2600
|
+
if isAttribute(key) then
|
|
2601
|
+
data[key] = value
|
|
2602
|
+
end
|
|
2603
|
+
end
|
|
2604
|
+
local sourceOwner = damagingEvent[1]
|
|
2605
|
+
if sourceOwner then
|
|
2606
|
+
local targetOwner = damagingEvent[2]
|
|
2607
|
+
if damagingEvent[3] then
|
|
2608
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2609
|
+
end
|
|
2610
|
+
if damagingEvent[4] then
|
|
2611
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2612
|
+
end
|
|
2613
|
+
end
|
|
2614
|
+
end
|
|
2479
2615
|
local evData = setmetatable(
|
|
2480
2616
|
{},
|
|
2481
2617
|
{
|
|
2482
2618
|
__index = data,
|
|
2483
2619
|
__newindex = function(self, key, value)
|
|
2484
|
-
damageSetters[key]
|
|
2620
|
+
local damageSetter = damageSetters[key]
|
|
2621
|
+
if damageSetter ~= nil then
|
|
2622
|
+
damageSetter(value)
|
|
2623
|
+
end
|
|
2485
2624
|
data[key] = value
|
|
2486
2625
|
end
|
|
2487
2626
|
}
|
|
2488
2627
|
)
|
|
2489
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2490
2628
|
invoke(event, source, target, evData)
|
|
2491
2629
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2492
2630
|
local bonusHealth = math.ceil(evData.amount)
|
|
@@ -2540,10 +2678,14 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2540
2678
|
____exports.UnitTriggerEvent,
|
|
2541
2679
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2542
2680
|
function()
|
|
2543
|
-
local
|
|
2544
|
-
local
|
|
2545
|
-
if getUnitTypeId(
|
|
2546
|
-
|
|
2681
|
+
local unitHandle = getTriggerUnit()
|
|
2682
|
+
local itemHandle = getManipulatedItem()
|
|
2683
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not (ignoreEventsItems[itemHandle] ~= nil) then
|
|
2684
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2685
|
+
local item = Item:of(itemHandle)
|
|
2686
|
+
if item.owner ~= unit then
|
|
2687
|
+
return unit, item
|
|
2688
|
+
end
|
|
2547
2689
|
end
|
|
2548
2690
|
return IgnoreEvent
|
|
2549
2691
|
end
|
|
@@ -2563,7 +2705,22 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2563
2705
|
Unit.itemStackedEvent = __TS__New(
|
|
2564
2706
|
____exports.UnitTriggerEvent,
|
|
2565
2707
|
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2566
|
-
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(
|
|
2708
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
|
|
2709
|
+
)
|
|
2710
|
+
__TS__ObjectDefineProperty(
|
|
2711
|
+
Unit,
|
|
2712
|
+
"itemChargesChangedEvent",
|
|
2713
|
+
{get = function(self)
|
|
2714
|
+
local event = __TS__New(Event)
|
|
2715
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2716
|
+
local unit = item.owner
|
|
2717
|
+
if unit ~= nil then
|
|
2718
|
+
invoke(event, unit, item)
|
|
2719
|
+
end
|
|
2720
|
+
end)
|
|
2721
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2722
|
+
return event
|
|
2723
|
+
end}
|
|
2567
2724
|
)
|
|
2568
2725
|
__TS__ObjectDefineProperty(
|
|
2569
2726
|
Unit,
|