warscript 0.0.1-dev.c963f13 → 0.0.1-dev.cc49a34
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 -1
- package/attributes.lua +17 -1
- 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 +117 -22
- package/core/types/group.d.ts +0 -1
- 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/player.d.ts +16 -0
- package/core/types/player.lua +60 -15
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +99 -24
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- 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 +846 -790
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +24 -11
- package/engine/behavior.lua +233 -73
- 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 +36 -4
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +39 -11
- package/engine/behaviour/ability/damage.lua +83 -37
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +43 -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 +25 -0
- package/engine/behaviour/ability/remove-buffs.lua +49 -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 +29 -5
- package/engine/behaviour/ability.lua +154 -27
- package/engine/behaviour/unit/stun-immunity.d.ts +12 -7
- package/engine/behaviour/unit/stun-immunity.lua +57 -31
- package/engine/behaviour/unit.d.ts +48 -4
- package/engine/behaviour/unit.lua +292 -2
- package/engine/buff.d.ts +121 -46
- package/engine/buff.lua +567 -248
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +23 -14
- package/engine/internal/ability.lua +129 -85
- package/engine/internal/item/ability.lua +162 -4
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +20 -19
- package/engine/internal/item.lua +191 -74
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- 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/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/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/ability.d.ts +45 -1
- package/engine/internal/unit/ability.lua +128 -17
- 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/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +13 -8
- package/engine/internal/unit/bonus.lua +33 -1
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -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/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -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 +36 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +12 -3
- 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+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +70 -13
- package/engine/internal/unit.d.ts +90 -37
- package/engine/internal/unit.lua +623 -294
- 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 +9 -2
- package/engine/local-client.lua +112 -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/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 -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/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -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/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/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/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- 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/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/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 +19 -18
- package/engine/object-data/entry/ability-type.lua +93 -36
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.lua +18 -37
- 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 +28 -3
- package/engine/object-data/entry/destructible-type.lua +155 -0
- 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 +25 -6
- package/engine/object-data/entry/unit-type.lua +258 -93
- 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 +28 -5
- package/engine/object-field/ability.lua +59 -5
- package/engine/object-field/unit.d.ts +72 -3
- package/engine/object-field/unit.lua +268 -7
- package/engine/object-field.d.ts +25 -7
- package/engine/object-field.lua +359 -116
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +22 -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 +18 -0
- package/engine/standard/entries/unit-type.lua +18 -0
- package/engine/standard/fields/ability.d.ts +5 -3
- package/engine/standard/fields/ability.lua +5 -3
- package/engine/standard/fields/unit.d.ts +12 -0
- package/engine/standard/fields/unit.lua +20 -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 +250 -10
- package/engine/unit.d.ts +8 -0
- package/engine/unit.lua +17 -2
- package/event.d.ts +2 -3
- package/event.lua +9 -5
- 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 +12 -11
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/objutil/unit.lua +8 -0
- package/package.json +13 -13
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/patch-lualib.lua +1 -1
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/string.d.ts +16 -0
- package/string.lua +5 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +13 -5
- package/utility/arrays.lua +45 -3
- package/utility/bit-set.d.ts +0 -2
- 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/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-map.d.ts +26 -0
- package/utility/linked-map.lua +66 -0
- package/utility/linked-set.d.ts +13 -3
- package/utility/linked-set.lua +27 -3
- package/utility/lua-maps.d.ts +16 -4
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +3 -2
- package/utility/lua-sets.lua +7 -0
- package/utility/records.lua +20 -1
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +4 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
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,33 +51,42 @@ 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 ____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
|
|
65
|
+
local ____synchronization = require("engine.synchronization")
|
|
66
|
+
local synchronizer = ____synchronization.synchronizer
|
|
67
|
+
local ____linked_2Dmap = require("utility.linked-map")
|
|
68
|
+
local LinkedMap = ____linked_2Dmap.LinkedMap
|
|
51
69
|
local match = string.match
|
|
52
70
|
local ____tostring = _G.tostring
|
|
53
71
|
local setUnitAnimation = SetUnitAnimation
|
|
54
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
55
72
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
56
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
57
73
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
58
74
|
local getUnitRealField = BlzGetUnitRealField
|
|
59
75
|
local getHeroStr = GetHeroStr
|
|
60
76
|
local getHeroAgi = GetHeroAgi
|
|
61
77
|
local getHeroInt = GetHeroInt
|
|
62
|
-
local setHeroStr = SetHeroStr
|
|
63
|
-
local setHeroAgi = SetHeroAgi
|
|
64
|
-
local setHeroInt = SetHeroInt
|
|
65
78
|
local getUnitBooleanField = BlzGetUnitBooleanField
|
|
66
79
|
local getUnitStringField = BlzGetUnitStringField
|
|
67
80
|
local setUnitIntegerField = BlzSetUnitIntegerField
|
|
68
81
|
local setUnitRealField = BlzSetUnitRealField
|
|
69
82
|
local setUnitBooleanField = BlzSetUnitBooleanField
|
|
70
83
|
local setUnitStringField = BlzSetUnitStringField
|
|
71
|
-
local setUnitScale = SetUnitScale
|
|
72
84
|
local setUnitPosition = SetUnitPosition
|
|
73
85
|
local setUnitTimeScale = SetUnitTimeScale
|
|
74
86
|
local getHandleId = GetHandleId
|
|
87
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
75
88
|
local createUnit = CreateUnit
|
|
76
89
|
local killUnit = KillUnit
|
|
77
|
-
local setUnitExploded = SetUnitExploded
|
|
78
90
|
local removeUnit = RemoveUnit
|
|
79
91
|
local getUnitTypeId = GetUnitTypeId
|
|
80
92
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -90,11 +102,12 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
90
102
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
91
103
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
92
104
|
local isUnitInRange = IsUnitInRange
|
|
93
|
-
local
|
|
94
|
-
local
|
|
105
|
+
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
106
|
+
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
107
|
+
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
108
|
+
local setUnitWeaponStringField = BlzSetUnitWeaponStringField
|
|
95
109
|
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
96
110
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
97
|
-
local unitInterruptAttack = BlzUnitInterruptAttack
|
|
98
111
|
local isUnitInvisible = IsUnitInvisible
|
|
99
112
|
local isUnitVisible = IsUnitVisible
|
|
100
113
|
local getUnitX = GetUnitX
|
|
@@ -111,15 +124,9 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
111
124
|
local getIssuedOrderId = GetIssuedOrderId
|
|
112
125
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
113
126
|
local unitAlive = UnitAlive
|
|
114
|
-
local unitAddType = UnitAddType
|
|
115
|
-
local unitRemoveType = UnitRemoveType
|
|
116
|
-
local isUnitIllusion = IsUnitIllusion
|
|
117
|
-
local isUnitType = IsUnitType
|
|
118
127
|
local isUnitAlly = IsUnitAlly
|
|
119
128
|
local isUnitEnemy = IsUnitEnemy
|
|
120
129
|
local getOwningPlayer = GetOwningPlayer
|
|
121
|
-
local setUnitColor = SetUnitColor
|
|
122
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
123
130
|
____exports.UnitClassification = {}
|
|
124
131
|
local UnitClassification = ____exports.UnitClassification
|
|
125
132
|
do
|
|
@@ -129,6 +136,7 @@ do
|
|
|
129
136
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
130
137
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
131
138
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
139
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
132
140
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
133
141
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
134
142
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -275,16 +283,14 @@ function UnitTriggerEvent.prototype.____constructor(self, eventType, c)
|
|
|
275
283
|
end
|
|
276
284
|
local function dispatch(event, idGetter, argsGetter)
|
|
277
285
|
local initialized = false
|
|
278
|
-
local x = {}
|
|
279
286
|
return setmetatable(
|
|
280
|
-
|
|
287
|
+
{},
|
|
281
288
|
{
|
|
282
289
|
__index = function(self, id)
|
|
283
290
|
if type(id) ~= "number" then
|
|
284
291
|
return event[id]
|
|
285
292
|
end
|
|
286
293
|
if not initialized then
|
|
287
|
-
local invoke = Event.invoke
|
|
288
294
|
event:addListener(function(...)
|
|
289
295
|
local id = idGetter(...)
|
|
290
296
|
local dispatched = rawget(self, id)
|
|
@@ -322,7 +328,6 @@ local function dispatchAbility(event)
|
|
|
322
328
|
return event[id]
|
|
323
329
|
end
|
|
324
330
|
if not initialized then
|
|
325
|
-
local invoke = Event.invoke
|
|
326
331
|
event:addListener(function(unit, ability, ...)
|
|
327
332
|
local dispatched = rawget(self, ability.typeId)
|
|
328
333
|
if dispatched ~= nil then
|
|
@@ -339,6 +344,9 @@ local function dispatchAbility(event)
|
|
|
339
344
|
}
|
|
340
345
|
)
|
|
341
346
|
end
|
|
347
|
+
local function damagingEventPreventRetaliation(self)
|
|
348
|
+
self[0] = true
|
|
349
|
+
end
|
|
342
350
|
local function damageEventPreventDeath(self, callback, ...)
|
|
343
351
|
if self[0] ~= nil then
|
|
344
352
|
return
|
|
@@ -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,184 @@ 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
|
+
"isEnabled",
|
|
415
|
+
{
|
|
416
|
+
get = function(self)
|
|
417
|
+
return BlzGetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index)
|
|
418
|
+
end,
|
|
419
|
+
set = function(self, isEnabled)
|
|
420
|
+
BlzSetUnitWeaponBooleanField(self.unit.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, self.index, isEnabled)
|
|
421
|
+
end
|
|
422
|
+
},
|
|
423
|
+
true
|
|
424
|
+
)
|
|
425
|
+
__TS__SetDescriptor(
|
|
426
|
+
UnitWeapon.prototype,
|
|
427
|
+
"cooldown",
|
|
428
|
+
{
|
|
429
|
+
get = function(self)
|
|
430
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index)
|
|
431
|
+
end,
|
|
432
|
+
set = function(self, cooldown)
|
|
433
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, self.index, cooldown)
|
|
434
|
+
end
|
|
435
|
+
},
|
|
436
|
+
true
|
|
437
|
+
)
|
|
438
|
+
__TS__SetDescriptor(
|
|
439
|
+
UnitWeapon.prototype,
|
|
440
|
+
"damage",
|
|
441
|
+
{
|
|
442
|
+
get = function(self)
|
|
443
|
+
local minimumDamage = self.damageBase + self.damageDiceCount
|
|
444
|
+
local maximumDamage = self.damageBase + self.damageDiceCount * self.damageDiceSideCount
|
|
445
|
+
return {minimumDamage, maximumDamage}
|
|
446
|
+
end,
|
|
447
|
+
set = function(self, ____bindingPattern0)
|
|
448
|
+
local maximumDamage
|
|
449
|
+
local minimumDamage
|
|
450
|
+
minimumDamage = ____bindingPattern0[1]
|
|
451
|
+
maximumDamage = ____bindingPattern0[2]
|
|
452
|
+
self.damageBase = minimumDamage - 1
|
|
453
|
+
self.damageDiceCount = 1
|
|
454
|
+
self.damageDiceSideCount = maximumDamage - minimumDamage + 1
|
|
455
|
+
end
|
|
456
|
+
},
|
|
457
|
+
true
|
|
458
|
+
)
|
|
459
|
+
__TS__SetDescriptor(
|
|
460
|
+
UnitWeapon.prototype,
|
|
461
|
+
"allowedTargetCombatClassifications",
|
|
462
|
+
{
|
|
463
|
+
get = function(self)
|
|
464
|
+
return BlzGetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index)
|
|
465
|
+
end,
|
|
466
|
+
set = function(self, allowedTargetCombatClassifications)
|
|
467
|
+
BlzSetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index, allowedTargetCombatClassifications)
|
|
468
|
+
end
|
|
469
|
+
},
|
|
470
|
+
true
|
|
471
|
+
)
|
|
472
|
+
__TS__SetDescriptor(
|
|
473
|
+
UnitWeapon.prototype,
|
|
474
|
+
"damageBase",
|
|
475
|
+
{
|
|
476
|
+
get = function(self)
|
|
477
|
+
return BlzGetUnitBaseDamage(self.unit.handle, self.index)
|
|
478
|
+
end,
|
|
479
|
+
set = function(self, damageBase)
|
|
480
|
+
BlzSetUnitBaseDamage(self.unit.handle, self.index, damageBase)
|
|
481
|
+
end
|
|
482
|
+
},
|
|
483
|
+
true
|
|
484
|
+
)
|
|
485
|
+
__TS__SetDescriptor(
|
|
486
|
+
UnitWeapon.prototype,
|
|
487
|
+
"damageDiceCount",
|
|
488
|
+
{
|
|
489
|
+
get = function(self)
|
|
490
|
+
return BlzGetUnitDiceNumber(self.unit.handle, self.index)
|
|
491
|
+
end,
|
|
492
|
+
set = function(self, damageDiceCount)
|
|
493
|
+
BlzSetUnitDiceNumber(self.unit.handle, self.index, damageDiceCount)
|
|
494
|
+
end
|
|
495
|
+
},
|
|
496
|
+
true
|
|
497
|
+
)
|
|
498
|
+
__TS__SetDescriptor(
|
|
499
|
+
UnitWeapon.prototype,
|
|
500
|
+
"damageDiceSideCount",
|
|
501
|
+
{
|
|
502
|
+
get = function(self)
|
|
503
|
+
return BlzGetUnitDiceSides(self.unit.handle, self.index)
|
|
504
|
+
end,
|
|
505
|
+
set = function(self, damageDiceSideCount)
|
|
506
|
+
BlzSetUnitDiceSides(self.unit.handle, self.index, damageDiceSideCount)
|
|
507
|
+
end
|
|
508
|
+
},
|
|
509
|
+
true
|
|
510
|
+
)
|
|
511
|
+
__TS__SetDescriptor(
|
|
512
|
+
UnitWeapon.prototype,
|
|
513
|
+
"range",
|
|
514
|
+
{
|
|
515
|
+
get = function(self)
|
|
516
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_RANGE, self.index)
|
|
517
|
+
end,
|
|
518
|
+
set = function(self, range)
|
|
519
|
+
local handle = self.unit.handle
|
|
520
|
+
local index = self.index
|
|
521
|
+
setUnitWeaponRealField(
|
|
522
|
+
handle,
|
|
523
|
+
UNIT_WEAPON_RF_ATTACK_RANGE,
|
|
524
|
+
index + 1,
|
|
525
|
+
getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1) + (range - getUnitWeaponRealField(handle, UNIT_WEAPON_RF_ATTACK_RANGE, index))
|
|
526
|
+
)
|
|
527
|
+
end
|
|
528
|
+
},
|
|
529
|
+
true
|
|
530
|
+
)
|
|
531
|
+
__TS__SetDescriptor(
|
|
532
|
+
UnitWeapon.prototype,
|
|
533
|
+
"impactDelay",
|
|
534
|
+
{
|
|
535
|
+
get = function(self)
|
|
536
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index)
|
|
537
|
+
end,
|
|
538
|
+
set = function(self, impactDelay)
|
|
539
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT, self.index, impactDelay)
|
|
540
|
+
end
|
|
541
|
+
},
|
|
542
|
+
true
|
|
543
|
+
)
|
|
544
|
+
__TS__SetDescriptor(
|
|
545
|
+
UnitWeapon.prototype,
|
|
546
|
+
"missileArc",
|
|
547
|
+
{
|
|
548
|
+
get = function(self)
|
|
549
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index)
|
|
550
|
+
end,
|
|
551
|
+
set = function(self, missileArc)
|
|
552
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC, self.index, missileArc)
|
|
553
|
+
end
|
|
554
|
+
},
|
|
555
|
+
true
|
|
556
|
+
)
|
|
557
|
+
__TS__SetDescriptor(
|
|
558
|
+
UnitWeapon.prototype,
|
|
559
|
+
"missileModelPath",
|
|
560
|
+
{
|
|
561
|
+
get = function(self)
|
|
562
|
+
return getUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index)
|
|
563
|
+
end,
|
|
564
|
+
set = function(self, missileModelPath)
|
|
565
|
+
setUnitWeaponStringField(self.unit.handle, UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, self.index, missileModelPath)
|
|
566
|
+
end
|
|
567
|
+
},
|
|
568
|
+
true
|
|
569
|
+
)
|
|
570
|
+
__TS__SetDescriptor(
|
|
571
|
+
UnitWeapon.prototype,
|
|
572
|
+
"missileSpeed",
|
|
573
|
+
{
|
|
574
|
+
get = function(self)
|
|
575
|
+
return getUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index)
|
|
576
|
+
end,
|
|
577
|
+
set = function(self, missileSpeed)
|
|
578
|
+
setUnitWeaponRealField(self.unit.handle, UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED, self.index, missileSpeed)
|
|
579
|
+
end
|
|
580
|
+
},
|
|
581
|
+
true
|
|
582
|
+
)
|
|
435
583
|
local unitInventorySize = UnitInventorySize
|
|
436
584
|
local unitItemInSlot = UnitItemInSlot
|
|
437
585
|
local getItemAbility = BlzGetItemAbility
|
|
@@ -442,8 +590,6 @@ local getAbilityName = GetAbilityName
|
|
|
442
590
|
local unitAddAbility = UnitAddAbility
|
|
443
591
|
local getUnitGoldCost = GetUnitGoldCost
|
|
444
592
|
local getUnitLumberCost = GetUnitWoodCost
|
|
445
|
-
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
446
|
-
local unitAddItem = UnitAddItem
|
|
447
593
|
local unitRemoveAbility = UnitRemoveAbility
|
|
448
594
|
local function retrieveAbility(unit, ability, abilityId)
|
|
449
595
|
if ability == nil then
|
|
@@ -453,17 +599,6 @@ local function retrieveAbility(unit, ability, abilityId)
|
|
|
453
599
|
____exports.Unit:of(unit)
|
|
454
600
|
)
|
|
455
601
|
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
602
|
for i = 0, unitInventorySize(unit) - 1 do
|
|
468
603
|
local item = unitItemInSlot(unit, i)
|
|
469
604
|
if getItemAbility(item, abilityId) == ability then
|
|
@@ -521,15 +656,15 @@ for ____, player in ipairs(Player.all) do
|
|
|
521
656
|
dummies[player] = dummy
|
|
522
657
|
end
|
|
523
658
|
local function delayHealthChecksCallback(unit)
|
|
524
|
-
local counter = (unit[
|
|
659
|
+
local counter = (unit[104] or 0) - 1
|
|
525
660
|
if counter ~= 0 then
|
|
526
|
-
unit[
|
|
661
|
+
unit[104] = counter
|
|
527
662
|
return
|
|
528
663
|
end
|
|
529
|
-
unit[
|
|
530
|
-
local healthBonus = unit[
|
|
664
|
+
unit[104] = nil
|
|
665
|
+
local healthBonus = unit[105]
|
|
531
666
|
if healthBonus ~= nil then
|
|
532
|
-
unit[
|
|
667
|
+
unit[105] = nil
|
|
533
668
|
local handle = unit.handle
|
|
534
669
|
BlzSetUnitMaxHP(
|
|
535
670
|
handle,
|
|
@@ -537,12 +672,27 @@ local function delayHealthChecksCallback(unit)
|
|
|
537
672
|
)
|
|
538
673
|
end
|
|
539
674
|
end
|
|
675
|
+
local nextSyncId = 1
|
|
676
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
677
|
+
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
678
|
+
local function addAbility(unit, abilityTypeId)
|
|
679
|
+
local ____unitAddAbility_result_0
|
|
680
|
+
if unitAddAbility(unit, abilityTypeId) then
|
|
681
|
+
____unitAddAbility_result_0 = getUnitAbility(unit, abilityTypeId)
|
|
682
|
+
else
|
|
683
|
+
____unitAddAbility_result_0 = nil
|
|
684
|
+
end
|
|
685
|
+
return ____unitAddAbility_result_0
|
|
686
|
+
end
|
|
540
687
|
____exports.Unit = __TS__Class()
|
|
541
688
|
local Unit = ____exports.Unit
|
|
542
689
|
Unit.name = "Unit"
|
|
543
690
|
__TS__ClassExtends(Unit, Handle)
|
|
544
691
|
function Unit.prototype.____constructor(self, handle)
|
|
545
692
|
Handle.prototype.____constructor(self, handle)
|
|
693
|
+
local ____nextSyncId_1 = nextSyncId
|
|
694
|
+
nextSyncId = ____nextSyncId_1 + 1
|
|
695
|
+
self.syncId = ____nextSyncId_1
|
|
546
696
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
547
697
|
assert(unitAddAbility(handle, leaveDetectAbilityId) and UnitMakeAbilityPermanent(handle, true, leaveDetectAbilityId))
|
|
548
698
|
assert(unitAddAbility(handle, morphDetectAbilityId))
|
|
@@ -555,24 +705,29 @@ function Unit.prototype.____constructor(self, handle)
|
|
|
555
705
|
fourCC("Amrf")
|
|
556
706
|
))
|
|
557
707
|
end
|
|
708
|
+
unitBySyncId[self.syncId] = self
|
|
558
709
|
local ____ = self.abilities
|
|
559
710
|
end
|
|
560
|
-
function Unit.prototype.getEvent(self,
|
|
561
|
-
self.events = self.events or (
|
|
562
|
-
local eventId = GetHandleId(
|
|
563
|
-
|
|
564
|
-
|
|
711
|
+
function Unit.prototype.getEvent(self, jevent, collector)
|
|
712
|
+
self.events = self.events or __TS__New(LinkedMap)
|
|
713
|
+
local eventId = GetHandleId(jevent)
|
|
714
|
+
local event = self.events:get(eventId)
|
|
715
|
+
if event == nil then
|
|
716
|
+
event = __TS__New(
|
|
565
717
|
TriggerEvent,
|
|
566
718
|
function(trigger)
|
|
567
|
-
TriggerRegisterUnitEvent(trigger, self.handle,
|
|
719
|
+
TriggerRegisterUnitEvent(trigger, self.handle, jevent)
|
|
568
720
|
end,
|
|
569
721
|
collector or (function() return {} end)
|
|
570
722
|
)
|
|
723
|
+
self.events:put(eventId, event)
|
|
571
724
|
end
|
|
572
|
-
return
|
|
725
|
+
return event
|
|
573
726
|
end
|
|
574
727
|
function Unit.prototype.onDestroy(self)
|
|
575
728
|
local handle = self.handle
|
|
729
|
+
self[108] = getUnitX(handle)
|
|
730
|
+
self[109] = getUnitY(handle)
|
|
576
731
|
if not self._owner then
|
|
577
732
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
578
733
|
end
|
|
@@ -640,17 +795,17 @@ function Unit.prototype.addModifier(self, property, modifier)
|
|
|
640
795
|
end}
|
|
641
796
|
end
|
|
642
797
|
function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
643
|
-
local
|
|
644
|
-
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) &
|
|
798
|
+
local ____combatClassification_2 = combatClassification
|
|
799
|
+
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_2 == ____combatClassification_2
|
|
645
800
|
end
|
|
646
801
|
function Unit.prototype.addClassification(self, classification)
|
|
647
|
-
return
|
|
802
|
+
return UnitAddType(self.handle, classification)
|
|
648
803
|
end
|
|
649
804
|
function Unit.prototype.removeClassification(self, classification)
|
|
650
|
-
return
|
|
805
|
+
return UnitRemoveType(self.handle, classification)
|
|
651
806
|
end
|
|
652
807
|
function Unit.prototype.hasClassification(self, classification)
|
|
653
|
-
return
|
|
808
|
+
return IsUnitType(self.handle, classification)
|
|
654
809
|
end
|
|
655
810
|
function Unit.prototype.isVisibleTo(self, player)
|
|
656
811
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -659,13 +814,13 @@ function Unit.prototype.isInvisibleTo(self, player)
|
|
|
659
814
|
return isUnitInvisible(self.handle, player.handle)
|
|
660
815
|
end
|
|
661
816
|
function Unit.prototype.isInRangeOf(self, x, y, range)
|
|
662
|
-
local
|
|
817
|
+
local ____temp_3
|
|
663
818
|
if type(x) == "number" then
|
|
664
|
-
|
|
819
|
+
____temp_3 = isUnitInRangeXY(self.handle, x, y, range)
|
|
665
820
|
else
|
|
666
|
-
|
|
821
|
+
____temp_3 = isUnitInRange(self.handle, x.handle, y)
|
|
667
822
|
end
|
|
668
|
-
return
|
|
823
|
+
return ____temp_3
|
|
669
824
|
end
|
|
670
825
|
function Unit.prototype.isAllyOf(self, unit)
|
|
671
826
|
return isUnitAlly(
|
|
@@ -683,16 +838,30 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
683
838
|
if type(animation) == "number" then
|
|
684
839
|
setUnitAnimationByIndex(self.handle, animation)
|
|
685
840
|
elseif rarity then
|
|
686
|
-
|
|
841
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
687
842
|
else
|
|
688
843
|
setUnitAnimation(self.handle, animation)
|
|
689
844
|
end
|
|
690
845
|
end
|
|
846
|
+
function Unit.prototype.resetAnimation(self)
|
|
847
|
+
ResetUnitAnimation(self.handle)
|
|
848
|
+
end
|
|
691
849
|
function Unit.prototype.queueAnimation(self, animation)
|
|
692
|
-
|
|
850
|
+
QueueUnitAnimation(self.handle, animation)
|
|
851
|
+
end
|
|
852
|
+
function Unit.prototype.chooseWeapon(self, target)
|
|
853
|
+
local firstWeapon = self.firstWeapon
|
|
854
|
+
if firstWeapon.isEnabled and target:isAllowedTarget(self, firstWeapon.allowedTargetCombatClassifications) then
|
|
855
|
+
return firstWeapon
|
|
856
|
+
end
|
|
857
|
+
local secondWeapon = self.secondWeapon
|
|
858
|
+
if secondWeapon.isEnabled and target:isAllowedTarget(target, secondWeapon.allowedTargetCombatClassifications) then
|
|
859
|
+
return secondWeapon
|
|
860
|
+
end
|
|
861
|
+
return nil
|
|
693
862
|
end
|
|
694
863
|
function Unit.prototype.delayHealthChecks(self)
|
|
695
|
-
self[
|
|
864
|
+
self[104] = (self[104] or 0) + 1
|
|
696
865
|
Timer:run(delayHealthChecksCallback, self)
|
|
697
866
|
end
|
|
698
867
|
function Unit.prototype.setPosition(self, x, y)
|
|
@@ -702,14 +871,21 @@ function Unit.prototype.isSelected(self, player)
|
|
|
702
871
|
return IsUnitSelected(self.handle, player.handle)
|
|
703
872
|
end
|
|
704
873
|
function Unit.prototype.explode(self)
|
|
705
|
-
|
|
874
|
+
SetUnitExploded(self.handle, true)
|
|
706
875
|
killUnit(self.handle)
|
|
707
876
|
end
|
|
708
877
|
function Unit.prototype.kill(self)
|
|
709
878
|
killUnit(self.handle)
|
|
710
879
|
end
|
|
711
|
-
function Unit.prototype.revive(self,
|
|
712
|
-
|
|
880
|
+
function Unit.prototype.revive(self, x, y, doEffect)
|
|
881
|
+
local ____ReviveHero_6 = ReviveHero
|
|
882
|
+
local ____array_5 = __TS__SparseArrayNew(self.handle, x, y)
|
|
883
|
+
local ____doEffect_4 = doEffect
|
|
884
|
+
if ____doEffect_4 == nil then
|
|
885
|
+
____doEffect_4 = false
|
|
886
|
+
end
|
|
887
|
+
__TS__SparseArrayPush(____array_5, ____doEffect_4)
|
|
888
|
+
____ReviveHero_6(__TS__SparseArraySpread(____array_5))
|
|
713
889
|
end
|
|
714
890
|
function Unit.prototype.healTarget(self, target, amount)
|
|
715
891
|
if __TS__InstanceOf(target, ____exports.Unit) and target:hasAbility(fourCC("BIhm")) then
|
|
@@ -749,20 +925,19 @@ function Unit.prototype.dropItemSlot(self, item, slot)
|
|
|
749
925
|
return UnitDropItemSlot(self.handle, item.handle, slot)
|
|
750
926
|
end
|
|
751
927
|
function Unit.prototype.itemInSlot(self, slot)
|
|
752
|
-
return Item:of(
|
|
928
|
+
return Item:of(unitItemInSlot(self.handle, slot))
|
|
753
929
|
end
|
|
754
930
|
function Unit.prototype.addAbility(self, abilityId)
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
931
|
+
local ability = UnitAbility:of(
|
|
932
|
+
doUnitAbilityAction(self.handle, abilityId, addAbility, abilityId),
|
|
933
|
+
abilityId,
|
|
934
|
+
self
|
|
935
|
+
)
|
|
936
|
+
if ability ~= nil then
|
|
761
937
|
local abilities = self.abilities
|
|
762
938
|
abilities[#abilities + 1] = ability
|
|
763
|
-
return ability
|
|
764
939
|
end
|
|
765
|
-
return
|
|
940
|
+
return ability
|
|
766
941
|
end
|
|
767
942
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
768
943
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -776,47 +951,44 @@ end
|
|
|
776
951
|
function Unit.prototype.hasAbility(self, abilityId)
|
|
777
952
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
778
953
|
end
|
|
779
|
-
function Unit.prototype.
|
|
780
|
-
local
|
|
781
|
-
|
|
782
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
783
|
-
return nil
|
|
784
|
-
end
|
|
785
|
-
return UnitAbility:of(
|
|
786
|
-
getUnitAbility(self.handle, abilityId),
|
|
787
|
-
abilityId,
|
|
788
|
-
self
|
|
789
|
-
)
|
|
954
|
+
function Unit.prototype.getAbility(self, abilityId)
|
|
955
|
+
local ability = doUnitAbilityAction(self.handle, abilityId, getUnitAbility, abilityId)
|
|
956
|
+
return UnitAbility:of(ability, abilityId, self)
|
|
790
957
|
end
|
|
791
|
-
function Unit.prototype.removeAbility(self,
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
end
|
|
958
|
+
function Unit.prototype.removeAbility(self, abilityTypeId)
|
|
959
|
+
local abilities = self.abilities
|
|
960
|
+
for i = 1, #abilities do
|
|
961
|
+
if abilities[i].typeId == abilityTypeId then
|
|
962
|
+
local ability = abilities[i]
|
|
963
|
+
tremove(abilities, i)
|
|
964
|
+
ability:destroy()
|
|
965
|
+
return true
|
|
800
966
|
end
|
|
801
|
-
return true
|
|
802
967
|
end
|
|
803
|
-
return
|
|
968
|
+
return doUnitAbilityAction(self.handle, abilityTypeId, unitRemoveAbility, abilityTypeId)
|
|
804
969
|
end
|
|
805
970
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
806
971
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
807
972
|
end
|
|
973
|
+
function Unit.prototype.getAbilityRemainingCooldown(self, abilityId)
|
|
974
|
+
return BlzGetUnitAbilityCooldownRemaining(self.handle, abilityId)
|
|
975
|
+
end
|
|
808
976
|
function Unit.prototype.startAbilityCooldown(self, abilityId, cooldown)
|
|
809
977
|
BlzStartUnitAbilityCooldown(self.handle, abilityId, cooldown)
|
|
810
978
|
end
|
|
811
979
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
812
980
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
813
981
|
end
|
|
814
|
-
function Unit.prototype.interruptAttack(self)
|
|
815
|
-
unitInterruptAttack(self.handle)
|
|
816
|
-
end
|
|
817
982
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
818
|
-
|
|
819
|
-
unitDisableAbility(
|
|
983
|
+
local handle = self.handle
|
|
984
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
985
|
+
Timer:run(
|
|
986
|
+
unitDisableAbility,
|
|
987
|
+
handle,
|
|
988
|
+
abilityId,
|
|
989
|
+
false,
|
|
990
|
+
false
|
|
991
|
+
)
|
|
820
992
|
end
|
|
821
993
|
function Unit.prototype.getDistanceTo(self, target)
|
|
822
994
|
local handle = self.handle
|
|
@@ -876,18 +1048,44 @@ function Unit.prototype.unpauseEx(self)
|
|
|
876
1048
|
self:decrementStunCounter()
|
|
877
1049
|
end
|
|
878
1050
|
function Unit.prototype.incrementStunCounter(self)
|
|
879
|
-
local stunCounter = self[
|
|
880
|
-
if not self[
|
|
1051
|
+
local stunCounter = self[102] or 0
|
|
1052
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 0 then
|
|
881
1053
|
BlzPauseUnitEx(self.handle, true)
|
|
882
1054
|
end
|
|
883
|
-
self[
|
|
1055
|
+
self[102] = stunCounter + 1
|
|
884
1056
|
end
|
|
885
1057
|
function Unit.prototype.decrementStunCounter(self)
|
|
886
|
-
local stunCounter = self[
|
|
887
|
-
if not self[
|
|
1058
|
+
local stunCounter = self[102] or 0
|
|
1059
|
+
if not self[101] and (self[103] or 0) <= 0 or stunCounter >= 1 then
|
|
888
1060
|
BlzPauseUnitEx(self.handle, false)
|
|
889
1061
|
end
|
|
890
|
-
self[
|
|
1062
|
+
self[102] = stunCounter - 1
|
|
1063
|
+
end
|
|
1064
|
+
function Unit.prototype.incrementForceStunCounter(self)
|
|
1065
|
+
local forceStunCounter = self[103] or 0
|
|
1066
|
+
if forceStunCounter == 0 then
|
|
1067
|
+
local handle = self.handle
|
|
1068
|
+
if not self[101] then
|
|
1069
|
+
for _ = self[102] or 0, -1 do
|
|
1070
|
+
BlzPauseUnitEx(handle, true)
|
|
1071
|
+
end
|
|
1072
|
+
end
|
|
1073
|
+
BlzPauseUnitEx(handle, true)
|
|
1074
|
+
end
|
|
1075
|
+
self[103] = forceStunCounter + 1
|
|
1076
|
+
end
|
|
1077
|
+
function Unit.prototype.decrementForceStunCounter(self)
|
|
1078
|
+
local forceStunCounter = self[103] or 0
|
|
1079
|
+
if forceStunCounter == 1 then
|
|
1080
|
+
local handle = self.handle
|
|
1081
|
+
if not self[101] then
|
|
1082
|
+
for _ = self[102] or 0, -1 do
|
|
1083
|
+
BlzPauseUnitEx(handle, false)
|
|
1084
|
+
end
|
|
1085
|
+
end
|
|
1086
|
+
BlzPauseUnitEx(handle, false)
|
|
1087
|
+
end
|
|
1088
|
+
self[103] = forceStunCounter - 1
|
|
891
1089
|
end
|
|
892
1090
|
function Unit.create(self, owner, id, x, y, facing, skinId)
|
|
893
1091
|
local handle = skinId and BlzCreateUnitWithSkin(
|
|
@@ -989,8 +1187,11 @@ function Unit.getInSector(self, pos, range, offsetAngle, centralAngle)
|
|
|
989
1187
|
)
|
|
990
1188
|
return targetCollection
|
|
991
1189
|
end
|
|
992
|
-
function Unit.getSelectionOf(self, player)
|
|
993
|
-
|
|
1190
|
+
function Unit.getSelectionOf(self, player, target)
|
|
1191
|
+
if target == nil then
|
|
1192
|
+
target = {}
|
|
1193
|
+
end
|
|
1194
|
+
targetCollection = target
|
|
994
1195
|
targetCollectionNextIndex = 1
|
|
995
1196
|
GroupEnumUnitsSelected(dummyGroup, player.handle, collectIntoTarget)
|
|
996
1197
|
return targetCollection
|
|
@@ -1012,6 +1213,9 @@ end
|
|
|
1012
1213
|
function Unit.prototype.__tostring(self)
|
|
1013
1214
|
return (((self.constructor.name .. "$") .. util.id2s(self.typeId)) .. "@") .. tostring(getHandleId(self.handle))
|
|
1014
1215
|
end
|
|
1216
|
+
function Unit.getBySyncId(self, syncId)
|
|
1217
|
+
return unitBySyncId[syncId]
|
|
1218
|
+
end
|
|
1015
1219
|
__TS__SetDescriptor(
|
|
1016
1220
|
Unit.prototype,
|
|
1017
1221
|
"_deltas",
|
|
@@ -1071,7 +1275,15 @@ __TS__SetDescriptor(
|
|
|
1071
1275
|
Unit.prototype,
|
|
1072
1276
|
"isIllusion",
|
|
1073
1277
|
{get = function(self)
|
|
1074
|
-
return
|
|
1278
|
+
return IsUnitIllusion(self.handle)
|
|
1279
|
+
end},
|
|
1280
|
+
true
|
|
1281
|
+
)
|
|
1282
|
+
__TS__SetDescriptor(
|
|
1283
|
+
Unit.prototype,
|
|
1284
|
+
"isStunned",
|
|
1285
|
+
{get = function(self)
|
|
1286
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1075
1287
|
end},
|
|
1076
1288
|
true
|
|
1077
1289
|
)
|
|
@@ -1092,12 +1304,27 @@ __TS__SetDescriptor(
|
|
|
1092
1304
|
Unit.prototype,
|
|
1093
1305
|
"weapons",
|
|
1094
1306
|
{get = function(self)
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1307
|
+
return {self.firstWeapon, self.secondWeapon}
|
|
1308
|
+
end},
|
|
1309
|
+
true
|
|
1310
|
+
)
|
|
1311
|
+
__TS__SetDescriptor(
|
|
1312
|
+
Unit.prototype,
|
|
1313
|
+
"firstWeapon",
|
|
1314
|
+
{get = function(self)
|
|
1315
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 0)
|
|
1316
|
+
rawset(self, "firstWeapon", weapon)
|
|
1317
|
+
return weapon
|
|
1318
|
+
end},
|
|
1319
|
+
true
|
|
1320
|
+
)
|
|
1321
|
+
__TS__SetDescriptor(
|
|
1322
|
+
Unit.prototype,
|
|
1323
|
+
"secondWeapon",
|
|
1324
|
+
{get = function(self)
|
|
1325
|
+
local weapon = __TS__New(____exports.UnitWeapon, self, 1)
|
|
1326
|
+
rawset(self, "secondWeapon", weapon)
|
|
1327
|
+
return weapon
|
|
1101
1328
|
end},
|
|
1102
1329
|
true
|
|
1103
1330
|
)
|
|
@@ -1135,13 +1362,13 @@ __TS__SetDescriptor(
|
|
|
1135
1362
|
)
|
|
1136
1363
|
__TS__SetDescriptor(
|
|
1137
1364
|
Unit.prototype,
|
|
1138
|
-
"
|
|
1365
|
+
"primaryAttribute",
|
|
1139
1366
|
{
|
|
1140
1367
|
get = function(self)
|
|
1141
|
-
return
|
|
1368
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1142
1369
|
end,
|
|
1143
|
-
set = function(self,
|
|
1144
|
-
|
|
1370
|
+
set = function(self, primaryAttribute)
|
|
1371
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1145
1372
|
end
|
|
1146
1373
|
},
|
|
1147
1374
|
true
|
|
@@ -1163,19 +1390,6 @@ __TS__SetDescriptor(
|
|
|
1163
1390
|
end},
|
|
1164
1391
|
true
|
|
1165
1392
|
)
|
|
1166
|
-
__TS__SetDescriptor(
|
|
1167
|
-
Unit.prototype,
|
|
1168
|
-
"agilityBase",
|
|
1169
|
-
{
|
|
1170
|
-
get = function(self)
|
|
1171
|
-
return getHeroAgi(self.handle, false)
|
|
1172
|
-
end,
|
|
1173
|
-
set = function(self, agilityBase)
|
|
1174
|
-
setHeroAgi(self.handle, agilityBase, true)
|
|
1175
|
-
end
|
|
1176
|
-
},
|
|
1177
|
-
true
|
|
1178
|
-
)
|
|
1179
1393
|
__TS__SetDescriptor(
|
|
1180
1394
|
Unit.prototype,
|
|
1181
1395
|
"agilityBonus",
|
|
@@ -1193,19 +1407,6 @@ __TS__SetDescriptor(
|
|
|
1193
1407
|
end},
|
|
1194
1408
|
true
|
|
1195
1409
|
)
|
|
1196
|
-
__TS__SetDescriptor(
|
|
1197
|
-
Unit.prototype,
|
|
1198
|
-
"intelligenceBase",
|
|
1199
|
-
{
|
|
1200
|
-
get = function(self)
|
|
1201
|
-
return getHeroInt(self.handle, false)
|
|
1202
|
-
end,
|
|
1203
|
-
set = function(self, intelligenceBase)
|
|
1204
|
-
setHeroInt(self.handle, intelligenceBase, true)
|
|
1205
|
-
end
|
|
1206
|
-
},
|
|
1207
|
-
true
|
|
1208
|
-
)
|
|
1209
1410
|
__TS__SetDescriptor(
|
|
1210
1411
|
Unit.prototype,
|
|
1211
1412
|
"intelligenceBonus",
|
|
@@ -1254,17 +1455,17 @@ __TS__SetDescriptor(
|
|
|
1254
1455
|
"isTeamGlowVisible",
|
|
1255
1456
|
{
|
|
1256
1457
|
get = function(self)
|
|
1257
|
-
return not self[
|
|
1458
|
+
return not self[107]
|
|
1258
1459
|
end,
|
|
1259
1460
|
set = function(self, isTeamGlowVisible)
|
|
1260
|
-
|
|
1261
|
-
local
|
|
1461
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1462
|
+
local ____temp_7
|
|
1262
1463
|
if not isTeamGlowVisible then
|
|
1263
|
-
|
|
1464
|
+
____temp_7 = true
|
|
1264
1465
|
else
|
|
1265
|
-
|
|
1466
|
+
____temp_7 = nil
|
|
1266
1467
|
end
|
|
1267
|
-
self[
|
|
1468
|
+
self[107] = ____temp_7
|
|
1268
1469
|
end
|
|
1269
1470
|
},
|
|
1270
1471
|
true
|
|
@@ -1273,9 +1474,9 @@ __TS__SetDescriptor(
|
|
|
1273
1474
|
Unit.prototype,
|
|
1274
1475
|
"color",
|
|
1275
1476
|
{set = function(self, color)
|
|
1276
|
-
|
|
1277
|
-
if self[
|
|
1278
|
-
|
|
1477
|
+
SetUnitColor(self.handle, color.handle)
|
|
1478
|
+
if self[107] then
|
|
1479
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1279
1480
|
end
|
|
1280
1481
|
end},
|
|
1281
1482
|
true
|
|
@@ -1298,14 +1499,14 @@ __TS__SetDescriptor(
|
|
|
1298
1499
|
"maxHealth",
|
|
1299
1500
|
{
|
|
1300
1501
|
get = function(self)
|
|
1301
|
-
return BlzGetUnitMaxHP(self.handle) - (self[
|
|
1502
|
+
return BlzGetUnitMaxHP(self.handle) - (self[105] or 0) - (self[106] or 0)
|
|
1302
1503
|
end,
|
|
1303
1504
|
set = function(self, maxHealth)
|
|
1304
|
-
if maxHealth < 1 and self[
|
|
1305
|
-
self[
|
|
1505
|
+
if maxHealth < 1 and self[104] ~= nil then
|
|
1506
|
+
self[105] = (self[105] or 0) + (1 - maxHealth)
|
|
1306
1507
|
maxHealth = 1
|
|
1307
1508
|
end
|
|
1308
|
-
BlzSetUnitMaxHP(self.handle, maxHealth + (self[
|
|
1509
|
+
BlzSetUnitMaxHP(self.handle, maxHealth + (self[106] or 0))
|
|
1309
1510
|
end
|
|
1310
1511
|
},
|
|
1311
1512
|
true
|
|
@@ -1347,10 +1548,10 @@ __TS__SetDescriptor(
|
|
|
1347
1548
|
"health",
|
|
1348
1549
|
{
|
|
1349
1550
|
get = function(self)
|
|
1350
|
-
return GetWidgetLife(self.handle) - (self[
|
|
1551
|
+
return GetWidgetLife(self.handle) - (self[106] or 0)
|
|
1351
1552
|
end,
|
|
1352
1553
|
set = function(self, health)
|
|
1353
|
-
SetWidgetLife(self.handle, health + (self[
|
|
1554
|
+
SetWidgetLife(self.handle, health + (self[106] or 0))
|
|
1354
1555
|
end
|
|
1355
1556
|
},
|
|
1356
1557
|
true
|
|
@@ -1426,25 +1627,12 @@ __TS__SetDescriptor(
|
|
|
1426
1627
|
},
|
|
1427
1628
|
true
|
|
1428
1629
|
)
|
|
1429
|
-
__TS__SetDescriptor(
|
|
1430
|
-
Unit.prototype,
|
|
1431
|
-
"flyHeight",
|
|
1432
|
-
{
|
|
1433
|
-
get = function(self)
|
|
1434
|
-
return getUnitFlyHeight(self.handle)
|
|
1435
|
-
end,
|
|
1436
|
-
set = function(self, v)
|
|
1437
|
-
SetUnitFlyHeight(self.handle, v, 100000)
|
|
1438
|
-
end
|
|
1439
|
-
},
|
|
1440
|
-
true
|
|
1441
|
-
)
|
|
1442
1630
|
__TS__SetDescriptor(
|
|
1443
1631
|
Unit.prototype,
|
|
1444
1632
|
"x",
|
|
1445
1633
|
{
|
|
1446
1634
|
get = function(self)
|
|
1447
|
-
return getUnitX(self.handle)
|
|
1635
|
+
return self[108] or getUnitX(self.handle)
|
|
1448
1636
|
end,
|
|
1449
1637
|
set = function(self, v)
|
|
1450
1638
|
SetUnitX(self.handle, v)
|
|
@@ -1457,7 +1645,7 @@ __TS__SetDescriptor(
|
|
|
1457
1645
|
"y",
|
|
1458
1646
|
{
|
|
1459
1647
|
get = function(self)
|
|
1460
|
-
return getUnitY(self.handle)
|
|
1648
|
+
return self[109] or getUnitY(self.handle)
|
|
1461
1649
|
end,
|
|
1462
1650
|
set = function(self, v)
|
|
1463
1651
|
SetUnitY(self.handle, v)
|
|
@@ -1543,10 +1731,10 @@ __TS__SetDescriptor(
|
|
|
1543
1731
|
"gold",
|
|
1544
1732
|
{
|
|
1545
1733
|
get = function(self)
|
|
1546
|
-
return
|
|
1734
|
+
return GetResourceAmount(self.handle)
|
|
1547
1735
|
end,
|
|
1548
1736
|
set = function(self, gold)
|
|
1549
|
-
|
|
1737
|
+
SetResourceAmount(self.handle, gold)
|
|
1550
1738
|
end
|
|
1551
1739
|
},
|
|
1552
1740
|
true
|
|
@@ -1561,17 +1749,21 @@ __TS__SetDescriptor(
|
|
|
1561
1749
|
set = function(self, isPaused)
|
|
1562
1750
|
local handle = self.handle
|
|
1563
1751
|
if isPaused and not IsUnitPaused(handle) then
|
|
1564
|
-
self[
|
|
1565
|
-
|
|
1566
|
-
|
|
1752
|
+
self[101] = true
|
|
1753
|
+
if (self[103] or 0) <= 0 then
|
|
1754
|
+
for _ = self[102] or 0, -1 do
|
|
1755
|
+
BlzPauseUnitEx(handle, true)
|
|
1756
|
+
end
|
|
1567
1757
|
end
|
|
1568
1758
|
PauseUnit(handle, true)
|
|
1569
1759
|
elseif not isPaused and IsUnitPaused(handle) then
|
|
1570
1760
|
PauseUnit(handle, false)
|
|
1571
|
-
|
|
1572
|
-
|
|
1761
|
+
if (self[103] or 0) <= 0 then
|
|
1762
|
+
for _ = self[102] or 0, -1 do
|
|
1763
|
+
BlzPauseUnitEx(handle, false)
|
|
1764
|
+
end
|
|
1573
1765
|
end
|
|
1574
|
-
self[
|
|
1766
|
+
self[101] = nil
|
|
1575
1767
|
end
|
|
1576
1768
|
end
|
|
1577
1769
|
},
|
|
@@ -1627,20 +1819,6 @@ __TS__SetDescriptor(
|
|
|
1627
1819
|
},
|
|
1628
1820
|
true
|
|
1629
1821
|
)
|
|
1630
|
-
__TS__SetDescriptor(
|
|
1631
|
-
Unit.prototype,
|
|
1632
|
-
"scale",
|
|
1633
|
-
{
|
|
1634
|
-
get = function(self)
|
|
1635
|
-
return getUnitRealField(self.handle, UNIT_RF_SCALING_VALUE)
|
|
1636
|
-
end,
|
|
1637
|
-
set = function(self, v)
|
|
1638
|
-
setUnitScale(self.handle, v, v, v)
|
|
1639
|
-
setUnitRealField(self.handle, UNIT_RF_SCALING_VALUE, v)
|
|
1640
|
-
end
|
|
1641
|
-
},
|
|
1642
|
-
true
|
|
1643
|
-
)
|
|
1644
1822
|
__TS__SetDescriptor(
|
|
1645
1823
|
Unit.prototype,
|
|
1646
1824
|
"timeScale",
|
|
@@ -1674,6 +1852,19 @@ __TS__SetDescriptor(
|
|
|
1674
1852
|
end},
|
|
1675
1853
|
true
|
|
1676
1854
|
)
|
|
1855
|
+
__TS__SetDescriptor(
|
|
1856
|
+
Unit.prototype,
|
|
1857
|
+
"movementType",
|
|
1858
|
+
{
|
|
1859
|
+
get = function(self)
|
|
1860
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1861
|
+
end,
|
|
1862
|
+
set = function(self, movementType)
|
|
1863
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1864
|
+
end
|
|
1865
|
+
},
|
|
1866
|
+
true
|
|
1867
|
+
)
|
|
1677
1868
|
__TS__SetDescriptor(
|
|
1678
1869
|
Unit.prototype,
|
|
1679
1870
|
"pathing",
|
|
@@ -1855,6 +2046,14 @@ __TS__SetDescriptor(
|
|
|
1855
2046
|
end},
|
|
1856
2047
|
true
|
|
1857
2048
|
)
|
|
2049
|
+
__TS__SetDescriptor(
|
|
2050
|
+
Unit.prototype,
|
|
2051
|
+
"targetAcquiredEvent",
|
|
2052
|
+
{get = function(self)
|
|
2053
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2054
|
+
end},
|
|
2055
|
+
true
|
|
2056
|
+
)
|
|
1858
2057
|
__TS__SetDescriptor(
|
|
1859
2058
|
Unit.prototype,
|
|
1860
2059
|
"onSelect",
|
|
@@ -1915,6 +2114,11 @@ __TS__SetDescriptor(
|
|
|
1915
2114
|
end},
|
|
1916
2115
|
true
|
|
1917
2116
|
)
|
|
2117
|
+
Unit.levelChangedEvent = __TS__New(
|
|
2118
|
+
____exports.UnitTriggerEvent,
|
|
2119
|
+
EVENT_PLAYER_HERO_LEVEL,
|
|
2120
|
+
function() return ____exports.Unit:of(getTriggerUnit()) end
|
|
2121
|
+
)
|
|
1918
2122
|
Unit.deathEvent = __TS__New(
|
|
1919
2123
|
____exports.UnitTriggerEvent,
|
|
1920
2124
|
EVENT_PLAYER_UNIT_DEATH,
|
|
@@ -1928,7 +2132,6 @@ Unit.onDecay = __TS__New(
|
|
|
1928
2132
|
Unit.onResurrect = __TS__New(
|
|
1929
2133
|
InitializingEvent,
|
|
1930
2134
|
function(event)
|
|
1931
|
-
local invoke = Event.invoke
|
|
1932
2135
|
local dead = setmetatable({}, {__mode = "k"})
|
|
1933
2136
|
____exports.Unit.deathEvent:addListener(function(unit)
|
|
1934
2137
|
dead[unit] = true
|
|
@@ -1944,10 +2147,15 @@ Unit.onResurrect = __TS__New(
|
|
|
1944
2147
|
Unit.morphEvent = __TS__New(
|
|
1945
2148
|
InitializingEvent,
|
|
1946
2149
|
function(event)
|
|
2150
|
+
local function ifNotLeft(unit)
|
|
2151
|
+
local handle = unit.handle
|
|
2152
|
+
if getUnitAbilityLevel(handle, leaveDetectAbilityId) ~= 0 and unitAddAbility(handle, morphDetectAbilityId) then
|
|
2153
|
+
invoke(event, unit)
|
|
2154
|
+
end
|
|
2155
|
+
end
|
|
1947
2156
|
____exports.Unit.onImmediateOrder[orderId("undefend")]:addListener(function(unit)
|
|
1948
2157
|
if getUnitAbilityLevel(unit.handle, morphDetectAbilityId) == 0 then
|
|
1949
|
-
|
|
1950
|
-
Timer:run(Event.invoke, event, unit)
|
|
2158
|
+
Timer:run(ifNotLeft, unit)
|
|
1951
2159
|
end
|
|
1952
2160
|
end)
|
|
1953
2161
|
end
|
|
@@ -1985,27 +2193,26 @@ Unit.onSpellEffect = dispatchId(__TS__New(
|
|
|
1985
2193
|
Unit.onTargetCast = dispatchId(__TS__New(
|
|
1986
2194
|
InitializingEvent,
|
|
1987
2195
|
function(event)
|
|
1988
|
-
local invoke = Event.invoke
|
|
1989
2196
|
local function listener(unit, id)
|
|
1990
|
-
local
|
|
2197
|
+
local ____GetSpellTargetUnit_result_10
|
|
1991
2198
|
if GetSpellTargetUnit() then
|
|
1992
|
-
|
|
2199
|
+
____GetSpellTargetUnit_result_10 = ____exports.Unit:of(GetSpellTargetUnit())
|
|
1993
2200
|
else
|
|
1994
|
-
local
|
|
2201
|
+
local ____GetSpellTargetItem_result_9
|
|
1995
2202
|
if GetSpellTargetItem() then
|
|
1996
|
-
|
|
2203
|
+
____GetSpellTargetItem_result_9 = Item:of(GetSpellTargetItem())
|
|
1997
2204
|
else
|
|
1998
|
-
local
|
|
2205
|
+
local ____GetSpellTargetDestructable_result_8
|
|
1999
2206
|
if GetSpellTargetDestructable() then
|
|
2000
|
-
|
|
2207
|
+
____GetSpellTargetDestructable_result_8 = Destructable:of(GetSpellTargetDestructable())
|
|
2001
2208
|
else
|
|
2002
|
-
|
|
2209
|
+
____GetSpellTargetDestructable_result_8 = nil
|
|
2003
2210
|
end
|
|
2004
|
-
|
|
2211
|
+
____GetSpellTargetItem_result_9 = ____GetSpellTargetDestructable_result_8
|
|
2005
2212
|
end
|
|
2006
|
-
|
|
2213
|
+
____GetSpellTargetUnit_result_10 = ____GetSpellTargetItem_result_9
|
|
2007
2214
|
end
|
|
2008
|
-
local target =
|
|
2215
|
+
local target = ____GetSpellTargetUnit_result_10
|
|
2009
2216
|
if target then
|
|
2010
2217
|
invoke(event, unit, id, target)
|
|
2011
2218
|
end
|
|
@@ -2177,10 +2384,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2177
2384
|
____exports.UnitTriggerEvent,
|
|
2178
2385
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2179
2386
|
function()
|
|
2180
|
-
local
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2387
|
+
local handle = getOrderedUnit()
|
|
2388
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2389
|
+
local unit = ____exports.Unit:of(handle)
|
|
2390
|
+
if unit.state == 1 then
|
|
2391
|
+
return unit, getIssuedOrderId()
|
|
2392
|
+
end
|
|
2184
2393
|
end
|
|
2185
2394
|
return IgnoreEvent
|
|
2186
2395
|
end
|
|
@@ -2202,7 +2411,6 @@ Unit.autoAttackStartEvent = __TS__New(
|
|
|
2202
2411
|
)
|
|
2203
2412
|
Unit.onDamaging = (function()
|
|
2204
2413
|
local event = __TS__New(Event)
|
|
2205
|
-
local invoke = Event.invoke
|
|
2206
2414
|
local trigger = CreateTrigger()
|
|
2207
2415
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGING)
|
|
2208
2416
|
TriggerAddCondition(
|
|
@@ -2212,38 +2420,57 @@ Unit.onDamaging = (function()
|
|
|
2212
2420
|
if source and source.typeId == dummyUnitId then
|
|
2213
2421
|
source = nil
|
|
2214
2422
|
end
|
|
2215
|
-
local target = BlzGetEventDamageTarget()
|
|
2423
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2424
|
+
local metadata = damageMetadataByTarget[target]
|
|
2425
|
+
damageMetadataByTarget[target] = nil
|
|
2216
2426
|
local data = {
|
|
2217
2427
|
amount = GetEventDamage(),
|
|
2218
|
-
attackType = BlzGetEventAttackType(),
|
|
2428
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2219
2429
|
damageType = BlzGetEventDamageType(),
|
|
2220
2430
|
weaponType = BlzGetEventWeaponType(),
|
|
2221
|
-
|
|
2431
|
+
metadata = metadata,
|
|
2432
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2433
|
+
originalAmount = GetEventDamage(),
|
|
2434
|
+
originalMetadata = metadata,
|
|
2435
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2222
2436
|
}
|
|
2223
2437
|
if data.isAttack and source then
|
|
2224
|
-
|
|
2225
|
-
if weapon == -1 then
|
|
2226
|
-
local targetsAllowed = BlzGetUnitWeaponIntegerField(source.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
|
|
2227
|
-
weapon = 0
|
|
2228
|
-
end
|
|
2229
|
-
data.weapon = assert(source.weapons[weapon + 1])
|
|
2438
|
+
data.weapon = source:chooseWeapon(target)
|
|
2230
2439
|
end
|
|
2231
2440
|
if not data.isAttack or not source or not source._attackHandlers then
|
|
2232
2441
|
invoke(
|
|
2233
2442
|
event,
|
|
2234
2443
|
source,
|
|
2235
|
-
|
|
2444
|
+
target,
|
|
2236
2445
|
setmetatable(
|
|
2237
2446
|
{},
|
|
2238
2447
|
{
|
|
2239
2448
|
__index = data,
|
|
2240
2449
|
__newindex = function(self, key, value)
|
|
2241
|
-
damageSetters[key]
|
|
2450
|
+
local damageSetter = damageSetters[key]
|
|
2451
|
+
if damageSetter ~= nil then
|
|
2452
|
+
damageSetter(value)
|
|
2453
|
+
end
|
|
2242
2454
|
data[key] = value
|
|
2243
2455
|
end
|
|
2244
2456
|
}
|
|
2245
2457
|
)
|
|
2246
2458
|
)
|
|
2459
|
+
if data[0] and source then
|
|
2460
|
+
local sourceOwner = source.owner.handle
|
|
2461
|
+
data[1] = sourceOwner
|
|
2462
|
+
local targetOwner = target.owner.handle
|
|
2463
|
+
data[2] = targetOwner
|
|
2464
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2465
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2466
|
+
data[3] = true
|
|
2467
|
+
end
|
|
2468
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2469
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2470
|
+
data[4] = true
|
|
2471
|
+
end
|
|
2472
|
+
end
|
|
2473
|
+
damagingEventByTarget[target] = data
|
|
2247
2474
|
return
|
|
2248
2475
|
end
|
|
2249
2476
|
BlzSetEventDamage(0)
|
|
@@ -2251,7 +2478,7 @@ Unit.onDamaging = (function()
|
|
|
2251
2478
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2252
2479
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2253
2480
|
local sourceOwner = source.owner.handle
|
|
2254
|
-
local targetOwner =
|
|
2481
|
+
local targetOwner = target.owner.handle
|
|
2255
2482
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2256
2483
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2257
2484
|
Timer:run(function()
|
|
@@ -2267,23 +2494,19 @@ Unit.onDamaging = (function()
|
|
|
2267
2494
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2268
2495
|
local condition = ____value[1]
|
|
2269
2496
|
local action = ____value[2]
|
|
2270
|
-
if condition(
|
|
2271
|
-
source,
|
|
2272
|
-
____exports.Unit:of(target),
|
|
2273
|
-
data
|
|
2274
|
-
) then
|
|
2497
|
+
if condition(source, target, data) then
|
|
2275
2498
|
action(
|
|
2276
2499
|
source,
|
|
2277
|
-
|
|
2500
|
+
target,
|
|
2278
2501
|
setmetatable(
|
|
2279
2502
|
{fire = function()
|
|
2280
2503
|
UnitDamageTarget(
|
|
2281
2504
|
source.handle,
|
|
2282
|
-
target,
|
|
2505
|
+
target.handle,
|
|
2283
2506
|
data.amount,
|
|
2284
2507
|
true,
|
|
2285
2508
|
true,
|
|
2286
|
-
data.attackType,
|
|
2509
|
+
attackTypeToNative(data.attackType),
|
|
2287
2510
|
data.damageType,
|
|
2288
2511
|
data.weaponType
|
|
2289
2512
|
)
|
|
@@ -2301,7 +2524,6 @@ end)()
|
|
|
2301
2524
|
Unit.onDamage = __TS__New(
|
|
2302
2525
|
InitializingEvent,
|
|
2303
2526
|
function(event)
|
|
2304
|
-
local invoke = Event.invoke
|
|
2305
2527
|
local trigger = CreateTrigger()
|
|
2306
2528
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_DAMAGED)
|
|
2307
2529
|
TriggerAddCondition(
|
|
@@ -2311,29 +2533,54 @@ Unit.onDamage = __TS__New(
|
|
|
2311
2533
|
if source and source.typeId == dummyUnitId then
|
|
2312
2534
|
source = nil
|
|
2313
2535
|
end
|
|
2536
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2537
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2538
|
+
damagingEventByTarget[target] = nil
|
|
2314
2539
|
local data = {
|
|
2315
2540
|
amount = GetEventDamage(),
|
|
2316
|
-
attackType = BlzGetEventAttackType(),
|
|
2541
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2317
2542
|
damageType = BlzGetEventDamageType(),
|
|
2318
2543
|
weaponType = BlzGetEventWeaponType(),
|
|
2544
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2319
2545
|
isAttack = BlzGetEventIsAttack(),
|
|
2546
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2547
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2320
2548
|
preventDeath = damageEventPreventDeath
|
|
2321
2549
|
}
|
|
2550
|
+
if damagingEvent then
|
|
2551
|
+
for key, value in pairs(damagingEvent) do
|
|
2552
|
+
if isAttribute(key) then
|
|
2553
|
+
data[key] = value
|
|
2554
|
+
end
|
|
2555
|
+
end
|
|
2556
|
+
local sourceOwner = damagingEvent[1]
|
|
2557
|
+
if sourceOwner then
|
|
2558
|
+
local targetOwner = damagingEvent[2]
|
|
2559
|
+
if damagingEvent[3] then
|
|
2560
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2561
|
+
end
|
|
2562
|
+
if damagingEvent[4] then
|
|
2563
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2564
|
+
end
|
|
2565
|
+
end
|
|
2566
|
+
end
|
|
2322
2567
|
local evData = setmetatable(
|
|
2323
2568
|
{},
|
|
2324
2569
|
{
|
|
2325
2570
|
__index = data,
|
|
2326
2571
|
__newindex = function(self, key, value)
|
|
2327
|
-
damageSetters[key]
|
|
2572
|
+
local damageSetter = damageSetters[key]
|
|
2573
|
+
if damageSetter ~= nil then
|
|
2574
|
+
damageSetter(value)
|
|
2575
|
+
end
|
|
2328
2576
|
data[key] = value
|
|
2329
2577
|
end
|
|
2330
2578
|
}
|
|
2331
2579
|
)
|
|
2332
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2333
2580
|
invoke(event, source, target, evData)
|
|
2334
2581
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2335
2582
|
local bonusHealth = math.ceil(evData.amount)
|
|
2336
|
-
target[
|
|
2583
|
+
target[106] = (target[106] or 0) + bonusHealth
|
|
2337
2584
|
BlzSetUnitMaxHP(
|
|
2338
2585
|
target.handle,
|
|
2339
2586
|
BlzGetUnitMaxHP(target.handle) + bonusHealth
|
|
@@ -2347,7 +2594,7 @@ Unit.onDamage = __TS__New(
|
|
|
2347
2594
|
evData[0],
|
|
2348
2595
|
table.unpack(evData, 1 + 1, 1 + (evData[1] or 0))
|
|
2349
2596
|
)
|
|
2350
|
-
target[
|
|
2597
|
+
target[106] = (target[106] or 0) - bonusHealth
|
|
2351
2598
|
SetWidgetLife(
|
|
2352
2599
|
target.handle,
|
|
2353
2600
|
GetWidgetLife(target.handle) - bonusHealth
|
|
@@ -2367,32 +2614,110 @@ Unit.onDamage = __TS__New(
|
|
|
2367
2614
|
DestroyTrigger(trigger)
|
|
2368
2615
|
end
|
|
2369
2616
|
)
|
|
2370
|
-
Unit.
|
|
2617
|
+
Unit.itemDroppedEvent = __TS__New(
|
|
2371
2618
|
____exports.UnitTriggerEvent,
|
|
2372
2619
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2373
2620
|
function()
|
|
2374
2621
|
local unit = getTriggerUnit()
|
|
2375
|
-
|
|
2376
|
-
|
|
2622
|
+
local item = getManipulatedItem()
|
|
2623
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2624
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2377
2625
|
end
|
|
2378
2626
|
return IgnoreEvent
|
|
2379
2627
|
end
|
|
2380
2628
|
)
|
|
2381
|
-
Unit.
|
|
2629
|
+
Unit.itemPickedUpEvent = __TS__New(
|
|
2382
2630
|
____exports.UnitTriggerEvent,
|
|
2383
2631
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2384
2632
|
function()
|
|
2385
|
-
local
|
|
2386
|
-
|
|
2387
|
-
|
|
2633
|
+
local unitHandle = getTriggerUnit()
|
|
2634
|
+
local itemHandle = getManipulatedItem()
|
|
2635
|
+
if getUnitTypeId(unitHandle) ~= dummyUnitId and not (ignoreEventsItems[itemHandle] ~= nil) then
|
|
2636
|
+
local unit = ____exports.Unit:of(unitHandle)
|
|
2637
|
+
local item = Item:of(itemHandle)
|
|
2638
|
+
if item.owner ~= unit then
|
|
2639
|
+
return unit, item
|
|
2640
|
+
end
|
|
2388
2641
|
end
|
|
2389
2642
|
return IgnoreEvent
|
|
2390
2643
|
end
|
|
2391
2644
|
)
|
|
2392
|
-
Unit.
|
|
2645
|
+
Unit.itemUsedEvent = __TS__New(
|
|
2393
2646
|
____exports.UnitTriggerEvent,
|
|
2394
2647
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2395
|
-
function()
|
|
2648
|
+
function()
|
|
2649
|
+
local unit = getTriggerUnit()
|
|
2650
|
+
local item = getManipulatedItem()
|
|
2651
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2652
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2653
|
+
end
|
|
2654
|
+
return IgnoreEvent
|
|
2655
|
+
end
|
|
2656
|
+
)
|
|
2657
|
+
Unit.itemStackedEvent = __TS__New(
|
|
2658
|
+
____exports.UnitTriggerEvent,
|
|
2659
|
+
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2660
|
+
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(BlzGetStackingItemTarget()), Item:of(BlzGetStackingItemSource()) end
|
|
2661
|
+
)
|
|
2662
|
+
__TS__ObjectDefineProperty(
|
|
2663
|
+
Unit,
|
|
2664
|
+
"itemChargesChangedEvent",
|
|
2665
|
+
{get = function(self)
|
|
2666
|
+
local event = __TS__New(Event)
|
|
2667
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2668
|
+
local unit = item.owner
|
|
2669
|
+
if unit ~= nil then
|
|
2670
|
+
invoke(event, unit, item)
|
|
2671
|
+
end
|
|
2672
|
+
end)
|
|
2673
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2674
|
+
return event
|
|
2675
|
+
end}
|
|
2676
|
+
)
|
|
2677
|
+
__TS__ObjectDefineProperty(
|
|
2678
|
+
Unit,
|
|
2679
|
+
"itemUseOrderEvent",
|
|
2680
|
+
{get = function(self)
|
|
2681
|
+
local event = __TS__New(Event)
|
|
2682
|
+
for order = orderId("useslot0"), orderId("useslot5") do
|
|
2683
|
+
local slot = order - orderId("useslot0")
|
|
2684
|
+
local function listener(unit)
|
|
2685
|
+
local item = unit.items[slot + 1]
|
|
2686
|
+
if item ~= nil then
|
|
2687
|
+
invoke(event, unit, item)
|
|
2688
|
+
end
|
|
2689
|
+
end
|
|
2690
|
+
self.onImmediateOrder[order]:addListener(listener)
|
|
2691
|
+
self.onTargetOrder[order]:addListener(listener)
|
|
2692
|
+
self.onPointOrder[order]:addListener(listener)
|
|
2693
|
+
end
|
|
2694
|
+
rawset(self, "itemUseOrderEvent", event)
|
|
2695
|
+
return event
|
|
2696
|
+
end}
|
|
2697
|
+
)
|
|
2698
|
+
__TS__ObjectDefineProperty(
|
|
2699
|
+
Unit,
|
|
2700
|
+
"itemMoveOrderEvent",
|
|
2701
|
+
{get = function(self)
|
|
2702
|
+
local event = __TS__New(Event)
|
|
2703
|
+
for order = orderId("moveslot0"), orderId("moveslot5") do
|
|
2704
|
+
local slotTo = order - orderId("moveslot0")
|
|
2705
|
+
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2706
|
+
local slotFrom = unit.items:findSlot(item)
|
|
2707
|
+
if slotFrom ~= nil then
|
|
2708
|
+
invoke(
|
|
2709
|
+
event,
|
|
2710
|
+
unit,
|
|
2711
|
+
item,
|
|
2712
|
+
slotFrom,
|
|
2713
|
+
slotTo
|
|
2714
|
+
)
|
|
2715
|
+
end
|
|
2716
|
+
end)
|
|
2717
|
+
end
|
|
2718
|
+
rawset(self, "itemMoveOrderEvent", event)
|
|
2719
|
+
return event
|
|
2720
|
+
end}
|
|
2396
2721
|
)
|
|
2397
2722
|
__TS__ObjectDefineProperty(
|
|
2398
2723
|
Unit,
|
|
@@ -2419,6 +2744,10 @@ __TS__ObjectDefineProperty(
|
|
|
2419
2744
|
rawset(self, "destroyEvent", destroyEvent)
|
|
2420
2745
|
return destroyEvent
|
|
2421
2746
|
end}
|
|
2747
|
+
)
|
|
2748
|
+
Unit.synchronize = synchronizer(
|
|
2749
|
+
function(unit) return unit.syncId end,
|
|
2750
|
+
function(syncId) return unitBySyncId[syncId] end
|
|
2422
2751
|
);
|
|
2423
2752
|
(function(self)
|
|
2424
2753
|
local leaveAbilityIds = postcompile(function()
|