warscript 0.0.1-dev.f566ce7 → 0.0.1-dev.f594e71
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/core/types/frame.d.ts +1 -0
- package/core/types/frame.lua +65 -36
- package/core/types/handle.lua +9 -9
- package/core/types/player.d.ts +2 -1
- package/core/types/player.lua +18 -13
- package/core/types/playerColor.lua +4 -3
- package/core/types/sound.d.ts +1 -1
- package/core/types/sound.lua +13 -8
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/decl/native.d.ts +705 -7
- package/engine/behaviour/ability/damage.lua +11 -14
- package/engine/behaviour/ability.d.ts +1 -0
- package/engine/behaviour/ability.lua +11 -0
- package/engine/behaviour/unit.d.ts +1 -0
- package/engine/behaviour/unit.lua +1 -0
- package/engine/buff.d.ts +12 -10
- package/engine/buff.lua +64 -16
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +37 -18
- package/engine/internal/item+owner.d.ts +1 -0
- package/engine/internal/item+owner.lua +7 -0
- package/engine/internal/item.d.ts +16 -1
- package/engine/internal/item.lua +130 -20
- package/engine/internal/unit/ability.lua +15 -3
- package/engine/internal/unit/appearance.d.ts +15 -0
- package/engine/internal/unit/appearance.lua +85 -0
- package/engine/internal/unit/bag.d.ts +18 -0
- package/engine/internal/unit/bag.lua +63 -0
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment.d.ts +36 -0
- package/engine/internal/unit/equipment.lua +169 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +3 -3
- package/engine/internal/unit/{item.lua → inventory.lua} +25 -26
- package/engine/internal/unit/pseudo-passive-abilities.d.ts +2 -0
- package/engine/internal/unit/pseudo-passive-abilities.lua +11 -0
- package/engine/internal/unit+damage.d.ts +9 -0
- package/engine/internal/unit+damage.lua +33 -0
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit.d.ts +0 -1
- package/engine/internal/unit.lua +2 -7
- package/engine/local-client.d.ts +20 -0
- package/engine/local-client.lua +284 -53
- package/engine/object-data/auxiliary/equipment-slot.d.ts +12 -0
- package/engine/object-data/auxiliary/equipment-slot.lua +2 -0
- package/engine/object-data/auxiliary/equipment-type.d.ts +13 -0
- package/engine/object-data/auxiliary/equipment-type.lua +2 -0
- package/engine/object-data/auxiliary/item-tag.d.ts +12 -0
- package/engine/object-data/auxiliary/item-tag.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
- package/engine/object-data/entry/ability-type/apprehend.d.ts +22 -0
- package/engine/object-data/entry/ability-type/apprehend.lua +66 -0
- package/engine/object-data/entry/ability-type/banshee.d.ts +8 -0
- package/engine/object-data/entry/ability-type/banshee.lua +13 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.lua +27 -0
- package/engine/object-data/entry/ability-type/banshees-wail.d.ts +31 -0
- package/engine/object-data/entry/ability-type/banshees-wail.lua +117 -0
- package/engine/object-data/entry/ability-type/battering-ram.d.ts +33 -0
- package/engine/object-data/entry/ability-type/battering-ram.lua +130 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +30 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.d.ts +27 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
- package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
- package/engine/object-data/entry/ability-type/consecration.lua +52 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
- package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment.lua +27 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
- package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
- package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
- package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
- package/engine/object-data/entry/ability-type/grit.lua +65 -0
- package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
- package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
- package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
- package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
- package/engine/object-data/entry/ability-type/healing-modifier.d.ts +9 -0
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/heroic-slash.d.ts +18 -0
- package/engine/object-data/entry/ability-type/heroic-slash.lua +65 -0
- package/engine/object-data/entry/ability-type/holy-wrath.d.ts +30 -0
- package/engine/object-data/entry/ability-type/holy-wrath.lua +117 -0
- package/engine/object-data/entry/ability-type/inspire-courage.d.ts +18 -0
- package/engine/object-data/entry/ability-type/inspire-courage.lua +65 -0
- package/engine/object-data/entry/ability-type/lights-mercy.d.ts +27 -0
- package/engine/object-data/entry/ability-type/lights-mercy.lua +104 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.d.ts +12 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.lua +39 -0
- package/engine/object-data/entry/ability-type/mind-control.d.ts +21 -0
- package/engine/object-data/entry/ability-type/mind-control.lua +78 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.d.ts +21 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.lua +52 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.d.ts +19 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.lua +65 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.d.ts +15 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.lua +26 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.d.ts +6 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.lua +12 -0
- package/engine/object-data/entry/ability-type/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.d.ts +9 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.lua +26 -0
- package/engine/object-data/entry/ability-type/resolve.d.ts +12 -0
- package/engine/object-data/entry/ability-type/resolve.lua +39 -0
- package/engine/object-data/entry/ability-type/righteous-fury.d.ts +33 -0
- package/engine/object-data/entry/ability-type/righteous-fury.lua +130 -0
- package/engine/object-data/entry/ability-type/sacred-aura.d.ts +27 -0
- package/engine/object-data/entry/ability-type/sacred-aura.lua +104 -0
- package/engine/object-data/entry/ability-type/soul-lantern.d.ts +30 -0
- package/engine/object-data/entry/ability-type/soul-lantern.lua +117 -0
- package/engine/object-data/entry/ability-type/spell-amp.d.ts +15 -0
- package/engine/object-data/entry/ability-type/spell-amp.lua +52 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.lua +39 -0
- package/engine/object-data/entry/ability-type/spell-vamp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-vamp.lua +39 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.d.ts +21 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.lua +78 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.lua +26 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.lua +13 -0
- package/engine/object-data/entry/ability-type/stat-details.d.ts +12 -0
- package/engine/object-data/entry/ability-type/stat-details.lua +27 -0
- package/engine/object-data/entry/ability-type/surge-of-light.d.ts +33 -0
- package/engine/object-data/entry/ability-type/surge-of-light.lua +130 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.d.ts +57 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.lua +234 -0
- package/engine/object-data/entry/ability-type/talents.d.ts +12 -0
- package/engine/object-data/entry/ability-type/talents.lua +27 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.d.ts +30 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.lua +117 -0
- package/engine/object-data/entry/ability-type/valiant-charge.d.ts +27 -0
- package/engine/object-data/entry/ability-type/valiant-charge.lua +104 -0
- package/engine/object-data/entry/ability-type/warcry.d.ts +9 -0
- package/engine/object-data/entry/ability-type/warcry.lua +26 -0
- package/engine/object-data/entry/ability-type/withering-fire.d.ts +21 -0
- package/engine/object-data/entry/ability-type/withering-fire.lua +78 -0
- package/engine/object-data/entry/ability-type.d.ts +10 -3
- package/engine/object-data/entry/ability-type.lua +53 -0
- package/engine/object-data/entry/buff-type.d.ts +6 -2
- package/engine/object-data/entry/buff-type.lua +26 -0
- package/engine/object-data/entry/destructible-type.d.ts +6 -2
- package/engine/object-data/entry/destructible-type.lua +26 -0
- package/engine/object-data/entry/item-type.d.ts +12 -3
- package/engine/object-data/entry/item-type.lua +52 -0
- package/engine/object-data/entry/lightning-type.d.ts +2 -2
- package/engine/object-data/entry/sound-preset.d.ts +2 -2
- package/engine/object-data/entry/unit-type.d.ts +47 -2
- package/engine/object-data/entry/unit-type.lua +383 -49
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry.d.ts +4 -1
- package/engine/standard/entries/ability-type.d.ts +3102 -7
- package/engine/standard/entries/ability-type.lua +0 -6
- package/engine/standard/entries/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/unit-type.d.ts +5 -0
- package/engine/standard/entries/unit-type.lua +5 -0
- package/engine/unit.d.ts +4 -1
- package/engine/unit.lua +4 -1
- package/event.d.ts +1 -1
- package/network.lua +25 -1
- package/operation.d.ts +8 -1
- package/operation.lua +37 -14
- package/package.json +2 -22
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
package/engine/internal/item.lua
CHANGED
|
@@ -13,6 +13,8 @@ local ____color = require("core.types.color")
|
|
|
13
13
|
local Color = ____color.Color
|
|
14
14
|
local ____event = require("event")
|
|
15
15
|
local Event = ____event.Event
|
|
16
|
+
local ____playerColor = require("core.types.playerColor")
|
|
17
|
+
local PlayerColor = ____playerColor.PlayerColor
|
|
16
18
|
local ____rect = require("core.types.rect")
|
|
17
19
|
local Rect = ____rect.Rect
|
|
18
20
|
local ____ability = require("engine.internal.ability")
|
|
@@ -27,37 +29,57 @@ local ____add_2Ditem_2Dto_2Dslot = require("engine.internal.unit.add-item-to-slo
|
|
|
27
29
|
local SLOT_FILLER_ITEM_TYPE_ID = ____add_2Ditem_2Dto_2Dslot.SLOT_FILLER_ITEM_TYPE_ID
|
|
28
30
|
local ____vec2 = require("math.vec2")
|
|
29
31
|
local distance = ____vec2.distance
|
|
30
|
-
local
|
|
31
|
-
local
|
|
32
|
-
local
|
|
33
|
-
local
|
|
34
|
-
local
|
|
35
|
-
local
|
|
36
|
-
local
|
|
37
|
-
local
|
|
38
|
-
local removeItem = RemoveItem
|
|
39
|
-
local getHandleId = GetHandleId
|
|
40
|
-
local setRect = SetRect
|
|
32
|
+
local ____timer = require("core.types.timer")
|
|
33
|
+
local Timer = ____timer.Timer
|
|
34
|
+
local chooseRandomItemExWithFilter = ChooseRandomItemExWithFilter
|
|
35
|
+
local condition = Condition
|
|
36
|
+
local convertEquipmentType = ConvertEquipmentType
|
|
37
|
+
local convertItemTag = ConvertItemTag
|
|
38
|
+
local createTrigger = CreateTrigger
|
|
39
|
+
local destroyTrigger = DestroyTrigger
|
|
41
40
|
local enumItemsInRect = EnumItemsInRect
|
|
41
|
+
local getAbilityId = BlzGetAbilityId
|
|
42
42
|
local getEnumItem = GetEnumItem
|
|
43
|
+
local getHandleId = GetHandleId
|
|
44
|
+
local getItemAbility = BlzGetItemAbility
|
|
45
|
+
local getItemAbilityByIndex = BlzGetItemAbilityByIndex
|
|
46
|
+
local getItemBooleanField = BlzGetItemBooleanField
|
|
47
|
+
local getItemCharges = GetItemCharges
|
|
48
|
+
local getItemEquipmentType = GetItemEquipmentType
|
|
49
|
+
local getItemIntegerField = BlzGetItemIntegerField
|
|
50
|
+
local getItemTag = GetItemTag
|
|
43
51
|
local getItemTypeId = GetItemTypeId
|
|
44
52
|
local getItemX = GetItemX
|
|
45
53
|
local getItemY = GetItemY
|
|
46
|
-
local
|
|
54
|
+
local getManipulatedItem = GetManipulatedItem
|
|
55
|
+
local getTriggerWidget = GetTriggerWidget
|
|
56
|
+
local getWidgetLife = GetWidgetLife
|
|
57
|
+
local isItemEquipped = IsItemEquipped
|
|
58
|
+
local isItemInBag = IsItemInBag
|
|
59
|
+
local isItemPawnable = IsItemPawnable
|
|
60
|
+
local isItemPowerup = IsItemPowerup
|
|
61
|
+
local itemAddAbility = BlzItemAddAbility
|
|
62
|
+
local itemRemoveAbility = BlzItemRemoveAbility
|
|
63
|
+
local loadItemHandle = LoadItemHandle
|
|
64
|
+
local removeItem = RemoveItem
|
|
65
|
+
local saveWidgetHandle = SaveWidgetHandle
|
|
66
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
47
67
|
local setItemCharges = SetItemCharges
|
|
68
|
+
local setItemColor = SetItemColor
|
|
69
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
70
|
+
local setItemDroppable = SetItemDroppable
|
|
71
|
+
local setItemPawnable = SetItemPawnable
|
|
72
|
+
local setRect = SetRect
|
|
73
|
+
local triggerAddCondition = TriggerAddCondition
|
|
74
|
+
local triggerRegisterDeathEvent = TriggerRegisterDeathEvent
|
|
48
75
|
local unitRemoveAbility = UnitRemoveAbility
|
|
49
76
|
local unitRemoveItem = UnitRemoveItem
|
|
50
77
|
local unitUseItem = UnitUseItem
|
|
51
78
|
local unitUseItemPoint = UnitUseItemPoint
|
|
52
79
|
local unitUseItemTarget = UnitUseItemTarget
|
|
53
|
-
local setItemDropOnDeath = SetItemDropOnDeath
|
|
54
|
-
local setItemDroppable = SetItemDroppable
|
|
55
|
-
local setItemPawnable = SetItemPawnable
|
|
56
|
-
local isItemPawnable = IsItemPawnable
|
|
57
|
-
local getItemIntegerField = BlzGetItemIntegerField
|
|
58
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
59
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
60
80
|
local tableRemove = table.remove
|
|
81
|
+
local itemChargesChangeEvent = __TS__New(Event)
|
|
82
|
+
local itemDeathEvent = __TS__New(Event)
|
|
61
83
|
_G.SetItemCharges = function(whichItem, charges)
|
|
62
84
|
setItemCharges(whichItem, charges)
|
|
63
85
|
invoke(
|
|
@@ -137,6 +159,25 @@ local function collectIntoTargetRange()
|
|
|
137
159
|
targetCollectionNextIndex = targetCollectionNextIndex + 1
|
|
138
160
|
end
|
|
139
161
|
end
|
|
162
|
+
local hashtable = InitHashtable()
|
|
163
|
+
local deathTriggerCondition = condition(function()
|
|
164
|
+
saveWidgetHandle(
|
|
165
|
+
hashtable,
|
|
166
|
+
1,
|
|
167
|
+
1,
|
|
168
|
+
getTriggerWidget()
|
|
169
|
+
)
|
|
170
|
+
local item = ____exports.Item:of(loadItemHandle(hashtable, 1, 1))
|
|
171
|
+
if item ~= nil then
|
|
172
|
+
invoke(itemDeathEvent, item)
|
|
173
|
+
end
|
|
174
|
+
end)
|
|
175
|
+
itemDeathEvent:addListener(
|
|
176
|
+
999999,
|
|
177
|
+
function(item)
|
|
178
|
+
Timer:run(item, "destroy")
|
|
179
|
+
end
|
|
180
|
+
)
|
|
140
181
|
____exports.Item = __TS__Class()
|
|
141
182
|
local Item = ____exports.Item
|
|
142
183
|
Item.name = "Item"
|
|
@@ -144,6 +185,10 @@ __TS__ClassExtends(Item, Handle)
|
|
|
144
185
|
function Item.prototype.____constructor(self, handle)
|
|
145
186
|
Handle.prototype.____constructor(self, handle)
|
|
146
187
|
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
188
|
+
local deathTrigger = createTrigger()
|
|
189
|
+
triggerRegisterDeathEvent(deathTrigger, handle)
|
|
190
|
+
triggerAddCondition(deathTrigger, deathTriggerCondition)
|
|
191
|
+
self[101] = deathTrigger
|
|
147
192
|
end
|
|
148
193
|
function Item.prototype.onDestroy(self)
|
|
149
194
|
local owner = self.owner
|
|
@@ -155,11 +200,30 @@ function Item.prototype.onDestroy(self)
|
|
|
155
200
|
abilities[i]:destroy()
|
|
156
201
|
end
|
|
157
202
|
removeItem(self.handle)
|
|
203
|
+
destroyTrigger(self[101])
|
|
158
204
|
return Handle.prototype.onDestroy(self)
|
|
159
205
|
end
|
|
160
206
|
function Item.create(self, id, x, y, skinId)
|
|
161
207
|
return self:of(BlzCreateItemWithSkin(id, x, y, skinId or id))
|
|
162
208
|
end
|
|
209
|
+
function Item.getRandomTypeId(self, level, equipmentType, tag, itemType)
|
|
210
|
+
if equipmentType == nil then
|
|
211
|
+
equipmentType = 9
|
|
212
|
+
end
|
|
213
|
+
if tag == nil then
|
|
214
|
+
tag = 8
|
|
215
|
+
end
|
|
216
|
+
if itemType == nil then
|
|
217
|
+
itemType = ITEM_TYPE_ANY
|
|
218
|
+
end
|
|
219
|
+
local id = chooseRandomItemExWithFilter(
|
|
220
|
+
itemType,
|
|
221
|
+
level,
|
|
222
|
+
convertEquipmentType(equipmentType),
|
|
223
|
+
convertItemTag(tag)
|
|
224
|
+
)
|
|
225
|
+
return id ~= 0 and id or nil
|
|
226
|
+
end
|
|
163
227
|
function Item.prototype.consumeCharge(self)
|
|
164
228
|
return self:consumeCharges(1)
|
|
165
229
|
end
|
|
@@ -244,6 +308,52 @@ function Item.getInRect(self, rect)
|
|
|
244
308
|
enumItemsInRect(rect.handle, nil, collectIntoTarget)
|
|
245
309
|
return targetCollection
|
|
246
310
|
end
|
|
311
|
+
__TS__SetDescriptor(
|
|
312
|
+
Item.prototype,
|
|
313
|
+
"isEquipped",
|
|
314
|
+
{get = function(self)
|
|
315
|
+
return isItemEquipped(self.handle)
|
|
316
|
+
end},
|
|
317
|
+
true
|
|
318
|
+
)
|
|
319
|
+
__TS__SetDescriptor(
|
|
320
|
+
Item.prototype,
|
|
321
|
+
"isInBag",
|
|
322
|
+
{get = function(self)
|
|
323
|
+
return isItemInBag(self.handle)
|
|
324
|
+
end},
|
|
325
|
+
true
|
|
326
|
+
)
|
|
327
|
+
__TS__SetDescriptor(
|
|
328
|
+
Item.prototype,
|
|
329
|
+
"equipmentType",
|
|
330
|
+
{get = function(self)
|
|
331
|
+
return getHandleId(getItemEquipmentType(self.handle))
|
|
332
|
+
end},
|
|
333
|
+
true
|
|
334
|
+
)
|
|
335
|
+
__TS__SetDescriptor(
|
|
336
|
+
Item.prototype,
|
|
337
|
+
"tag",
|
|
338
|
+
{get = function(self)
|
|
339
|
+
return getHandleId(getItemTag(self.handle))
|
|
340
|
+
end},
|
|
341
|
+
true
|
|
342
|
+
)
|
|
343
|
+
__TS__SetDescriptor(
|
|
344
|
+
Item.prototype,
|
|
345
|
+
"color",
|
|
346
|
+
{
|
|
347
|
+
get = function(self)
|
|
348
|
+
return self[102] or PlayerColor.red
|
|
349
|
+
end,
|
|
350
|
+
set = function(self, color)
|
|
351
|
+
setItemColor(self.handle, color.handle)
|
|
352
|
+
self[102] = color
|
|
353
|
+
end
|
|
354
|
+
},
|
|
355
|
+
true
|
|
356
|
+
)
|
|
247
357
|
__TS__SetDescriptor(
|
|
248
358
|
Item.prototype,
|
|
249
359
|
"typeId",
|
|
@@ -635,8 +745,8 @@ __TS__ObjectDefineProperty(
|
|
|
635
745
|
return self.onDestroyEvent
|
|
636
746
|
end}
|
|
637
747
|
)
|
|
748
|
+
Item.deathEvent = itemDeathEvent
|
|
638
749
|
Item.chargesChangedEvent = itemChargesChangeEvent
|
|
639
|
-
local getManipulatedItem = GetManipulatedItem
|
|
640
750
|
local trigger = CreateTrigger()
|
|
641
751
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_PICKUP_ITEM)
|
|
642
752
|
TriggerAddAction(
|
|
@@ -28,6 +28,9 @@ local ____lua_2Dsets = require("utility.lua-sets")
|
|
|
28
28
|
local luaSetOf = ____lua_2Dsets.luaSetOf
|
|
29
29
|
local ____attributes = require("attributes")
|
|
30
30
|
local attribute = ____attributes.attribute
|
|
31
|
+
local ____pseudo_2Dpassive_2Dabilities = require("engine.internal.unit.pseudo-passive-abilities")
|
|
32
|
+
local pseudoPassiveAbilityOrderTypeStringId = ____pseudo_2Dpassive_2Dabilities.pseudoPassiveAbilityOrderTypeStringId
|
|
33
|
+
local pseudoPassiveAbilityTypeIds = ____pseudo_2Dpassive_2Dabilities.pseudoPassiveAbilityTypeIds
|
|
31
34
|
local eventInvoke = Event.invoke
|
|
32
35
|
local condition = Condition
|
|
33
36
|
local createTrigger = CreateTrigger
|
|
@@ -90,7 +93,7 @@ local function createCommonEvent(underlyingEvent)
|
|
|
90
93
|
underlyingEvent,
|
|
91
94
|
3,
|
|
92
95
|
function(caster, ability)
|
|
93
|
-
return
|
|
96
|
+
return not (pseudoPassiveAbilityTypeIds[ability.typeId] ~= nil), caster, ability
|
|
94
97
|
end
|
|
95
98
|
)
|
|
96
99
|
end
|
|
@@ -170,7 +173,7 @@ local function createNoTargetEvent(underlyingEvent)
|
|
|
170
173
|
underlyingEvent,
|
|
171
174
|
1,
|
|
172
175
|
function(caster, ability, targetUnit, targetItem, targetDestructible, x, y)
|
|
173
|
-
if x == 0 and y == 0 and targetUnit == nil and targetItem == nil and targetDestructible == nil then
|
|
176
|
+
if x == 0 and y == 0 and targetUnit == nil and targetItem == nil and targetDestructible == nil and not (pseudoPassiveAbilityTypeIds[ability.typeId] ~= nil) then
|
|
174
177
|
return true, caster, ability
|
|
175
178
|
else
|
|
176
179
|
return false
|
|
@@ -381,7 +384,11 @@ rawset(
|
|
|
381
384
|
if unit ~= nil then
|
|
382
385
|
local ability = unit:getAbility(abilityTypeId)
|
|
383
386
|
if ability ~= nil then
|
|
384
|
-
|
|
387
|
+
if pseudoPassiveAbilityTypeIds[ability.typeId] ~= nil then
|
|
388
|
+
ability:interruptCast()
|
|
389
|
+
else
|
|
390
|
+
eventInvoke(event, unit, ability, orderTypeStringId)
|
|
391
|
+
end
|
|
385
392
|
end
|
|
386
393
|
end
|
|
387
394
|
end)
|
|
@@ -477,4 +484,9 @@ internalAbilityChannelingStartEvent:addListener(
|
|
|
477
484
|
end
|
|
478
485
|
end
|
|
479
486
|
)
|
|
487
|
+
local function doNothing()
|
|
488
|
+
end
|
|
489
|
+
for pseudoPassiveAbilityTypeId in pairs(pseudoPassiveAbilityTypeIds) do
|
|
490
|
+
Unit.abilityCommandEvent[pseudoPassiveAbilityTypeId][pseudoPassiveAbilityOrderTypeStringId]:addListener(999999, doNothing)
|
|
491
|
+
end
|
|
480
492
|
return ____exports
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
declare module "../unit" {
|
|
3
|
+
interface Unit {
|
|
4
|
+
getAnimationDuration(this: Unit, animation: string | number): number;
|
|
5
|
+
setAurasEnabled(this: Unit, enabled: boolean, affectsUI?: boolean): void;
|
|
6
|
+
isHeroGlowAllowed: boolean;
|
|
7
|
+
maximumFlyHeight: number;
|
|
8
|
+
showsAirToGroundIndicator: boolean;
|
|
9
|
+
alwaysDisplaysHealth: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface UnitWeapon {
|
|
12
|
+
resetAttack(this: UnitWeapon): void;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____unit = require("engine.internal.unit")
|
|
5
|
+
local Unit = ____unit.Unit
|
|
6
|
+
local UnitWeapon = ____unit.UnitWeapon
|
|
7
|
+
local allowHeroGlowOnUnit = AllowHeroGlowOnUnit
|
|
8
|
+
local disallowHeroGlowOnUnit = DisallowHeroGlowOnUnit
|
|
9
|
+
local getUnitAnimationDuration = BlzGetUnitAnimationDuration
|
|
10
|
+
local getUnitAnimationDurationByIndex = BlzGetUnitAnimationDurationByIndex
|
|
11
|
+
local getUnitBooleanField = BlzGetUnitBooleanField
|
|
12
|
+
local getUnitRealField = BlzGetUnitRealField
|
|
13
|
+
local heroGlowIsAllowedOnUnit = HeroGlowIsAllowedOnUnit
|
|
14
|
+
local resetUnitAttack = BlzResetUnitAttack
|
|
15
|
+
local setUnitBooleanField = BlzSetUnitBooleanField
|
|
16
|
+
local setUnitRealField = BlzSetUnitRealField
|
|
17
|
+
local unitEnableAuras = BlzUnitEnableAuras
|
|
18
|
+
Unit.prototype.getAnimationDuration = function(self, animation)
|
|
19
|
+
if type(animation) == "number" then
|
|
20
|
+
return getUnitAnimationDurationByIndex(self.handle, animation)
|
|
21
|
+
end
|
|
22
|
+
return getUnitAnimationDuration(self.handle, animation)
|
|
23
|
+
end
|
|
24
|
+
Unit.prototype.setAurasEnabled = function(self, enabled, affectsUI)
|
|
25
|
+
if affectsUI == nil then
|
|
26
|
+
affectsUI = true
|
|
27
|
+
end
|
|
28
|
+
unitEnableAuras(self.handle, enabled, affectsUI)
|
|
29
|
+
end
|
|
30
|
+
__TS__ObjectDefineProperty(
|
|
31
|
+
Unit.prototype,
|
|
32
|
+
"isHeroGlowAllowed",
|
|
33
|
+
{
|
|
34
|
+
get = function(self)
|
|
35
|
+
return heroGlowIsAllowedOnUnit(self.handle)
|
|
36
|
+
end,
|
|
37
|
+
set = function(self, allowed)
|
|
38
|
+
if allowed then
|
|
39
|
+
allowHeroGlowOnUnit(self.handle)
|
|
40
|
+
else
|
|
41
|
+
disallowHeroGlowOnUnit(self.handle)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
__TS__ObjectDefineProperty(
|
|
47
|
+
Unit.prototype,
|
|
48
|
+
"maximumFlyHeight",
|
|
49
|
+
{
|
|
50
|
+
get = function(self)
|
|
51
|
+
return getUnitRealField(self.handle, UNIT_RF_FLY_MAX_HEIGHT)
|
|
52
|
+
end,
|
|
53
|
+
set = function(self, height)
|
|
54
|
+
setUnitRealField(self.handle, UNIT_RF_FLY_MAX_HEIGHT, height)
|
|
55
|
+
end
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
__TS__ObjectDefineProperty(
|
|
59
|
+
Unit.prototype,
|
|
60
|
+
"showsAirToGroundIndicator",
|
|
61
|
+
{
|
|
62
|
+
get = function(self)
|
|
63
|
+
return getUnitBooleanField(self.handle, UNIT_BF_SHOW_AIR_TO_GROUND)
|
|
64
|
+
end,
|
|
65
|
+
set = function(self, show)
|
|
66
|
+
setUnitBooleanField(self.handle, UNIT_BF_SHOW_AIR_TO_GROUND, show)
|
|
67
|
+
end
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
__TS__ObjectDefineProperty(
|
|
71
|
+
Unit.prototype,
|
|
72
|
+
"alwaysDisplaysHealth",
|
|
73
|
+
{
|
|
74
|
+
get = function(self)
|
|
75
|
+
return getUnitBooleanField(self.handle, UNIT_BF_FORCE_DISPLAY_HP)
|
|
76
|
+
end,
|
|
77
|
+
set = function(self, show)
|
|
78
|
+
setUnitBooleanField(self.handle, UNIT_BF_FORCE_DISPLAY_HP, show)
|
|
79
|
+
end
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
UnitWeapon.prototype.resetAttack = function(self)
|
|
83
|
+
resetUnitAttack(self.unit.handle, self.index)
|
|
84
|
+
end
|
|
85
|
+
return ____exports
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Item } from "../item";
|
|
3
|
+
export interface UnitBag extends ReadonlyArray<Item | undefined> {
|
|
4
|
+
}
|
|
5
|
+
/** A live, zero-based view of a unit's bag. The engine does not expose bag-slot assignment. */
|
|
6
|
+
export declare class UnitBag {
|
|
7
|
+
constructor(handle: junit);
|
|
8
|
+
has(item: Item): boolean;
|
|
9
|
+
findSlot(item: Item): number | undefined;
|
|
10
|
+
protected __index(key: string | number): unknown;
|
|
11
|
+
protected __len(): number;
|
|
12
|
+
protected __ipairs(): LuaIterator<LuaMultiReturn<[number, Item | undefined]>, junit>;
|
|
13
|
+
}
|
|
14
|
+
declare module "../unit" {
|
|
15
|
+
interface Unit {
|
|
16
|
+
readonly bag: UnitBag;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____item = require("engine.internal.item")
|
|
7
|
+
local Item = ____item.Item
|
|
8
|
+
local ____unit = require("engine.internal.unit")
|
|
9
|
+
local Unit = ____unit.Unit
|
|
10
|
+
local unitExtendedInventorySize = UnitExtendedInventorySize
|
|
11
|
+
local unitHasItemBagged = UnitHasItemBagged
|
|
12
|
+
local unitItemInBagSlot = UnitItemInBagSlot
|
|
13
|
+
local ____rawget = _G.rawget
|
|
14
|
+
local rawset = _G.rawset
|
|
15
|
+
local ____type = _G.type
|
|
16
|
+
local handleByUnitBag = setmetatable({}, {__mode = "k"})
|
|
17
|
+
local function unitBagNext(handle, slot)
|
|
18
|
+
if slot >= unitExtendedInventorySize(handle) then
|
|
19
|
+
return nil, nil
|
|
20
|
+
end
|
|
21
|
+
return slot + 1, Item:of(unitItemInBagSlot(handle, slot))
|
|
22
|
+
end
|
|
23
|
+
--- A live, zero-based view of a unit's bag. The engine does not expose bag-slot assignment.
|
|
24
|
+
____exports.UnitBag = __TS__Class()
|
|
25
|
+
local UnitBag = ____exports.UnitBag
|
|
26
|
+
UnitBag.name = "UnitBag"
|
|
27
|
+
function UnitBag.prototype.____constructor(self, handle)
|
|
28
|
+
handleByUnitBag[self] = handle
|
|
29
|
+
end
|
|
30
|
+
function UnitBag.prototype.has(self, item)
|
|
31
|
+
return unitHasItemBagged(handleByUnitBag[self], item.handle)
|
|
32
|
+
end
|
|
33
|
+
function UnitBag.prototype.findSlot(self, item)
|
|
34
|
+
local handle = handleByUnitBag[self]
|
|
35
|
+
for slot = 0, unitExtendedInventorySize(handle) - 1 do
|
|
36
|
+
if unitItemInBagSlot(handle, slot) == item.handle then
|
|
37
|
+
return slot
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
return nil
|
|
41
|
+
end
|
|
42
|
+
function UnitBag.prototype.__index(self, key)
|
|
43
|
+
if ____type(key) == "number" then
|
|
44
|
+
return Item:of(unitItemInBagSlot(handleByUnitBag[self], key - 1))
|
|
45
|
+
end
|
|
46
|
+
return ____rawget(____exports.UnitBag.prototype, key)
|
|
47
|
+
end
|
|
48
|
+
function UnitBag.prototype.__len(self)
|
|
49
|
+
return unitExtendedInventorySize(handleByUnitBag[self])
|
|
50
|
+
end
|
|
51
|
+
function UnitBag.prototype.__ipairs(self)
|
|
52
|
+
return unitBagNext, handleByUnitBag[self], 0
|
|
53
|
+
end
|
|
54
|
+
__TS__ObjectDefineProperty(
|
|
55
|
+
Unit.prototype,
|
|
56
|
+
"bag",
|
|
57
|
+
{get = function(self)
|
|
58
|
+
local bag = __TS__New(____exports.UnitBag, self.handle)
|
|
59
|
+
rawset(self, "bag", bag)
|
|
60
|
+
return bag
|
|
61
|
+
end}
|
|
62
|
+
)
|
|
63
|
+
return ____exports
|
|
@@ -32,7 +32,7 @@ declare module "../unit" {
|
|
|
32
32
|
* @param includeAuras Whether to remove aura buffs. Default `true`.
|
|
33
33
|
* @param autoDispel Unknown. Default `false`.
|
|
34
34
|
*/
|
|
35
|
-
removeBuffs(polarity?: BuffPolarity, resistanceType?: BuffResistanceType, includeExpirationTimers?: boolean, includeAuras?: boolean, autoDispel?: boolean):
|
|
36
|
-
removeBuffs(buffTypeIds: number[]):
|
|
35
|
+
removeBuffs(polarity?: BuffPolarity, resistanceType?: BuffResistanceType, includeExpirationTimers?: boolean, includeAuras?: boolean, autoDispel?: boolean): number;
|
|
36
|
+
removeBuffs(buffTypeIds: number[]): number;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
3
|
-
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
4
|
-
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
5
1
|
local ____exports = {}
|
|
6
2
|
local ____buff = require("engine.buff")
|
|
7
3
|
local checkBuff = ____buff.checkBuff
|
|
@@ -19,7 +15,7 @@ Unit.prototype.hasBuff = function(self, buffTypeId)
|
|
|
19
15
|
end
|
|
20
16
|
Unit.prototype.removeBuff = function(self, buffTypeId)
|
|
21
17
|
if removeBuff(self.handle, buffTypeId) then
|
|
22
|
-
checkBuff(self, buffTypeId)
|
|
18
|
+
checkBuff(self, buffTypeId, false)
|
|
23
19
|
return true
|
|
24
20
|
end
|
|
25
21
|
return false
|
|
@@ -46,36 +42,55 @@ Unit.prototype.countBuffs = function(self, polarity, resistanceType, includeExpi
|
|
|
46
42
|
)
|
|
47
43
|
end
|
|
48
44
|
Unit.prototype.removeBuffs = function(self, polarityOrBuffTypeIds, resistanceType, includeExpirationTimers, includeAuras, autoDispel)
|
|
45
|
+
local handle = self.handle
|
|
46
|
+
local cnt
|
|
49
47
|
if type(polarityOrBuffTypeIds) == "table" then
|
|
50
|
-
|
|
48
|
+
cnt = 0
|
|
51
49
|
for i = 1, #polarityOrBuffTypeIds do
|
|
52
|
-
unitRemoveAbility(handle, polarityOrBuffTypeIds[i])
|
|
50
|
+
cnt = cnt + (unitRemoveAbility(handle, polarityOrBuffTypeIds[i]) and 1 or 0)
|
|
53
51
|
end
|
|
54
52
|
else
|
|
55
|
-
local
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(resistanceType or 0) & 1 ~= 0,
|
|
60
|
-
(resistanceType or 0) & 2 ~= 0
|
|
61
|
-
)
|
|
53
|
+
local positive = (polarityOrBuffTypeIds or 3) & 1 ~= 0
|
|
54
|
+
local negative = (polarityOrBuffTypeIds or 3) & 2 ~= 0
|
|
55
|
+
local magic = (resistanceType or 0) & 1 ~= 0
|
|
56
|
+
local physical = (resistanceType or 0) & 2 ~= 0
|
|
62
57
|
local ____includeExpirationTimers_0 = includeExpirationTimers
|
|
63
58
|
if ____includeExpirationTimers_0 == nil then
|
|
64
59
|
____includeExpirationTimers_0 = true
|
|
65
60
|
end
|
|
66
|
-
|
|
61
|
+
includeExpirationTimers = ____includeExpirationTimers_0
|
|
67
62
|
local ____includeAuras_1 = includeAuras
|
|
68
63
|
if ____includeAuras_1 == nil then
|
|
69
64
|
____includeAuras_1 = true
|
|
70
65
|
end
|
|
71
|
-
|
|
66
|
+
includeAuras = ____includeAuras_1
|
|
72
67
|
local ____autoDispel_2 = autoDispel
|
|
73
68
|
if ____autoDispel_2 == nil then
|
|
74
69
|
____autoDispel_2 = false
|
|
75
70
|
end
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
autoDispel = ____autoDispel_2
|
|
72
|
+
cnt = unitCountBuffsEx(
|
|
73
|
+
handle,
|
|
74
|
+
positive,
|
|
75
|
+
negative,
|
|
76
|
+
magic,
|
|
77
|
+
physical,
|
|
78
|
+
includeExpirationTimers,
|
|
79
|
+
includeAuras,
|
|
80
|
+
autoDispel
|
|
81
|
+
)
|
|
82
|
+
unitRemoveBuffsEx(
|
|
83
|
+
handle,
|
|
84
|
+
positive,
|
|
85
|
+
negative,
|
|
86
|
+
magic,
|
|
87
|
+
physical,
|
|
88
|
+
includeExpirationTimers,
|
|
89
|
+
includeAuras,
|
|
90
|
+
autoDispel
|
|
91
|
+
)
|
|
78
92
|
end
|
|
79
|
-
checkBuffs(self)
|
|
93
|
+
checkBuffs(self, false)
|
|
94
|
+
return cnt
|
|
80
95
|
end
|
|
81
96
|
return ____exports
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Item } from "../item";
|
|
3
|
+
import { EquipmentSlot } from "../../object-data/auxiliary/equipment-slot";
|
|
4
|
+
import { EquipmentType } from "../../object-data/auxiliary/equipment-type";
|
|
5
|
+
export interface UnitEquipment extends ReadonlyArray<Item | undefined> {
|
|
6
|
+
}
|
|
7
|
+
/** A live view indexed by EquipmentSlot. Equip operations let the engine choose the slot. */
|
|
8
|
+
export declare class UnitEquipment {
|
|
9
|
+
constructor(handle: junit);
|
|
10
|
+
equip(item: Item): boolean;
|
|
11
|
+
unequip(item: Item): void;
|
|
12
|
+
unequipSlot(slot: EquipmentSlot): Item | undefined;
|
|
13
|
+
has(item: Item): boolean;
|
|
14
|
+
hasAny(): boolean;
|
|
15
|
+
isSlotEmpty(slot: EquipmentSlot): boolean;
|
|
16
|
+
hasType(type: EquipmentType): boolean;
|
|
17
|
+
canEquipType(type: EquipmentType): boolean;
|
|
18
|
+
findSlot(item: Item): EquipmentSlot | undefined;
|
|
19
|
+
protected __index(key: string | number): unknown;
|
|
20
|
+
protected __len(): number;
|
|
21
|
+
protected __ipairs(): LuaIterator<LuaMultiReturn<[number, Item | undefined]>, junit>;
|
|
22
|
+
}
|
|
23
|
+
declare module "../unit" {
|
|
24
|
+
interface Unit {
|
|
25
|
+
readonly equipment: UnitEquipment;
|
|
26
|
+
}
|
|
27
|
+
namespace Unit {
|
|
28
|
+
const itemEquippedEvent: UnitTriggerEvent<[item: Item]>;
|
|
29
|
+
const itemUnequippedEvent: UnitTriggerEvent<[item: Item]>;
|
|
30
|
+
let itemStackedEvent: UnitTriggerEvent<[
|
|
31
|
+
target: Item,
|
|
32
|
+
source: Item,
|
|
33
|
+
previousTargetCharges: number
|
|
34
|
+
]>;
|
|
35
|
+
}
|
|
36
|
+
}
|