warscript 0.0.1-dev.d6e2c10 → 0.0.1-dev.d77b529
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/dummy.lua +4 -2
- package/core/types/effect.d.ts +11 -1
- package/core/types/effect.lua +43 -77
- package/core/types/frame.d.ts +1 -0
- package/core/types/frame.lua +112 -37
- package/core/types/handle.lua +9 -9
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- 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 +14 -9
- package/core/types/unit.d.ts +5 -0
- package/core/types/unit.lua +5 -0
- package/core/util.d.ts +3 -1
- package/core/util.lua +109 -3
- package/decl/native.d.ts +705 -7
- package/engine/behavior.d.ts +4 -2
- package/engine/behavior.lua +69 -11
- package/engine/behaviour/ability/apply-unit-behavior.lua +5 -0
- package/engine/behaviour/ability/damage.d.ts +4 -0
- package/engine/behaviour/ability/damage.lua +19 -15
- package/engine/behaviour/ability/emulate-impact.lua +5 -4
- package/engine/behaviour/ability/on-command-impact.d.ts +1 -0
- package/engine/behaviour/ability/on-command-impact.lua +1 -0
- package/engine/behaviour/ability.d.ts +11 -5
- package/engine/behaviour/ability.lua +54 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +1 -1
- package/engine/behaviour/unit/stun-immunity.lua +5 -4
- package/engine/behaviour/unit.d.ts +1 -0
- package/engine/behaviour/unit.lua +14 -3
- package/engine/buff.d.ts +64 -25
- package/engine/buff.lua +345 -156
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +56 -36
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item/owner-cache.d.ts +5 -0
- package/engine/internal/item/owner-cache.lua +4 -0
- package/engine/internal/item+owner.d.ts +2 -0
- package/engine/internal/item+owner.lua +27 -4
- package/engine/internal/item.d.ts +20 -5
- package/engine/internal/item.lua +146 -57
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/misc/unit-ability-level-natives.lua +12 -0
- package/engine/internal/object-data/armor-bonus.d.ts +2 -0
- package/engine/internal/object-data/attribute-bonus.lua +2 -2
- package/engine/internal/object-data/health-bonus.d.ts +2 -0
- package/engine/internal/object-data/health-bonus.lua +16 -0
- package/engine/internal/object-data/health-regeneration-rate-increase.d.ts +2 -0
- package/engine/internal/object-data/health-regeneration-rate-increase.lua +48 -0
- package/engine/internal/object-data/mana-bonus.d.ts +2 -0
- package/engine/internal/object-data/mana-bonus.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.lua +15 -3
- package/engine/internal/unit/add-item-to-slot-init.lua +3 -14
- package/engine/internal/unit/add-item-to-slot.lua +53 -12
- package/engine/internal/unit/appearance.d.ts +15 -0
- package/engine/internal/unit/appearance.lua +85 -0
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +14 -0
- package/engine/internal/unit/bonus.lua +102 -8
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment-inventory.d.ts +44 -0
- package/engine/internal/unit/equipment-inventory.lua +233 -0
- package/engine/internal/unit/expiration-timer.lua +1 -1
- package/engine/internal/unit/extended-inventory.d.ts +25 -0
- package/engine/internal/unit/extended-inventory.lua +99 -0
- package/engine/internal/unit/fly-height.lua +3 -3
- package/engine/internal/unit/ignore-events-items.lua +10 -1
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +7 -3
- package/engine/internal/unit/inventory.lua +87 -0
- package/engine/internal/unit/item-container.d.ts +25 -0
- package/engine/internal/unit/item-container.lua +11 -0
- package/engine/internal/unit/item-order-events.d.ts +17 -0
- package/engine/internal/unit/item-order-events.lua +67 -0
- package/engine/internal/unit/item-slot.d.ts +27 -0
- package/engine/internal/unit/item-slot.lua +92 -0
- package/engine/internal/unit/order.d.ts +3 -3
- package/engine/internal/unit/order.lua +10 -10
- 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/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.lua +3 -3
- package/engine/internal/unit+ability.d.ts +2 -1
- package/engine/internal/unit+ability.lua +63 -2
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit+damage.d.ts +9 -0
- package/engine/internal/unit+damage.lua +33 -0
- package/engine/internal/unit+rally.lua +9 -31
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit-missile-launch.lua +25 -18
- package/engine/internal/unit.d.ts +3 -18
- package/engine/internal/unit.lua +97 -195
- package/engine/local-client.d.ts +27 -1
- package/engine/local-client.lua +298 -58
- 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 +12 -0
- package/engine/object-data/auxiliary/equipment-type.lua +26 -0
- 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/item-class.d.ts +11 -0
- package/engine/object-data/auxiliary/item-class.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/order-type.d.ts +939 -0
- package/engine/object-data/auxiliary/order-type.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
- package/engine/object-data/auxiliary/unit-attribute.lua +1 -1
- 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/armor-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
- package/engine/object-data/entry/ability-type/aura-of-blight.d.ts +13 -0
- package/engine/object-data/entry/ability-type/aura-of-blight.lua +39 -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/{armor-increase.d.ts → healing-modifier.d.ts} +4 -3
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/healing-ward-aura.d.ts +13 -0
- package/engine/object-data/entry/ability-type/healing-ward-aura.lua +39 -0
- package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/health-bonus.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/item-life-regeneration.d.ts +10 -0
- package/engine/object-data/entry/ability-type/item-life-regeneration.lua +26 -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-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -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/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/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/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.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 +18 -3
- package/engine/object-data/entry/ability-type.lua +222 -5
- package/engine/object-data/entry/buff-type/applicable.lua +113 -109
- 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 +16 -2
- package/engine/object-data/entry/destructible-type.lua +91 -0
- package/engine/object-data/entry/item-type.d.ts +18 -3
- package/engine/object-data/entry/item-type.lua +84 -0
- package/engine/object-data/entry/lightning-type.d.ts +6 -8
- package/engine/object-data/entry/lightning-type.lua +1 -1
- 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 +6 -1
- package/engine/object-data/entry.lua +8 -0
- package/engine/object-field/ability.lua +2 -2
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/object-field/unit.d.ts +7 -4
- package/engine/object-field/unit.lua +4 -0
- package/engine/object-field.d.ts +3 -1
- package/engine/object-field.lua +177 -119
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +8 -0
- 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/lightning-type.d.ts +42 -15
- package/engine/standard/entries/lightning-type.lua +0 -14
- package/engine/standard/entries/unit-type.d.ts +5 -0
- package/engine/standard/entries/unit-type.lua +5 -0
- package/engine/standard/fields/item.d.ts +4 -0
- package/engine/standard/fields/item.lua +6 -0
- package/engine/standard/fields/unit.d.ts +11 -5
- package/engine/standard/fields/unit.lua +13 -4
- package/engine/unit.d.ts +8 -1
- package/engine/unit.lua +8 -1
- package/event.d.ts +1 -1
- package/lualib_bundle.lua +1 -1
- package/math.d.ts +2 -0
- package/math.lua +14 -0
- package/network.lua +25 -1
- package/objutil/buff.lua +10 -8
- package/objutil/object.lua +1 -1
- package/operation.d.ts +8 -1
- package/operation.lua +38 -18
- package/package.json +3 -23
- package/patch-lua.lua +15 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +3 -1
- package/utility/linked-set.lua +27 -0
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/records.lua +20 -1
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
- package/engine/internal/unit/item.lua +0 -78
- /package/engine/internal/{object-data/armor-increase.d.ts → misc/unit-ability-level-natives.d.ts} +0 -0
- /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
package/engine/index.d.ts
CHANGED
|
@@ -64,8 +64,12 @@ export declare class UnitAbility extends Ability {
|
|
|
64
64
|
get isDisabled(): boolean;
|
|
65
65
|
get level(): number;
|
|
66
66
|
set level(v: number);
|
|
67
|
+
/** Uses the native percentage scale. */
|
|
68
|
+
get cooldownRemainingPercent(): number;
|
|
69
|
+
set cooldownRemainingPercent(percent: number);
|
|
67
70
|
get cooldownRemaining(): number;
|
|
68
71
|
set cooldownRemaining(cooldownRemaining: number);
|
|
72
|
+
startCooldown(cooldown: number): void;
|
|
69
73
|
interruptCast(): void;
|
|
70
74
|
protected onDestroy(): HandleDestructor;
|
|
71
75
|
static get onCreate(): Event<[UnitAbility]>;
|
|
@@ -14,31 +14,34 @@ local abilityActionDummy = ____ability.abilityActionDummy
|
|
|
14
14
|
local doAbilityAction = ____ability.doAbilityAction
|
|
15
15
|
local doAbilityActionForceDummy = ____ability.doAbilityActionForceDummy
|
|
16
16
|
local startItemCooldown = ____ability.startItemCooldown
|
|
17
|
-
local
|
|
18
|
-
local
|
|
19
|
-
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
20
|
-
local setAbilityRealField = BlzSetAbilityRealField
|
|
21
|
-
local setAbilityBooleanField = BlzSetAbilityBooleanField
|
|
22
|
-
local setAbilityStringField = BlzSetAbilityStringField
|
|
23
|
-
local setAbilityIntegerLevelField = BlzSetAbilityIntegerLevelField
|
|
24
|
-
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
25
|
-
local setAbilityBooleanLevelField = BlzSetAbilityBooleanLevelField
|
|
26
|
-
local setAbilityStringLevelField = BlzSetAbilityStringLevelField
|
|
27
|
-
local getAbilityIntegerField = BlzGetAbilityIntegerField
|
|
28
|
-
local getAbilityRealField = BlzGetAbilityRealField
|
|
17
|
+
local ____unit_2Dability_2Dlevel_2Dnatives = require("engine.internal.misc.unit-ability-level-natives")
|
|
18
|
+
local rawSetUnitAbilityLevel = ____unit_2Dability_2Dlevel_2Dnatives.rawSetUnitAbilityLevel
|
|
29
19
|
local getAbilityBooleanField = BlzGetAbilityBooleanField
|
|
30
|
-
local
|
|
20
|
+
local getAbilityBooleanLevelField = BlzGetAbilityBooleanLevelField
|
|
21
|
+
local getAbilityIntegerField = BlzGetAbilityIntegerField
|
|
31
22
|
local getAbilityIntegerLevelField = BlzGetAbilityIntegerLevelField
|
|
23
|
+
local getAbilityRealField = BlzGetAbilityRealField
|
|
32
24
|
local getAbilityRealLevelField = BlzGetAbilityRealLevelField
|
|
33
|
-
local
|
|
25
|
+
local getAbilityStringField = BlzGetAbilityStringField
|
|
34
26
|
local getAbilityStringLevelField = BlzGetAbilityStringLevelField
|
|
27
|
+
local getHandleId = GetHandleId
|
|
28
|
+
local getUnitAbilityCooldownPercent = BlzGetUnitAbilityCooldownPercent
|
|
35
29
|
local getUnitAbilityCooldownRemaining = BlzGetUnitAbilityCooldownRemaining
|
|
30
|
+
local getUnitAbilityLevel = GetUnitAbilityLevel
|
|
31
|
+
local order2orderId = _G.OrderId
|
|
32
|
+
local setAbilityBooleanField = BlzSetAbilityBooleanField
|
|
33
|
+
local setAbilityBooleanLevelField = BlzSetAbilityBooleanLevelField
|
|
34
|
+
local setAbilityIntegerField = BlzSetAbilityIntegerField
|
|
35
|
+
local setAbilityIntegerLevelField = BlzSetAbilityIntegerLevelField
|
|
36
|
+
local setAbilityRealField = BlzSetAbilityRealField
|
|
37
|
+
local setAbilityRealLevelField = BlzSetAbilityRealLevelField
|
|
38
|
+
local setAbilityStringField = BlzSetAbilityStringField
|
|
39
|
+
local setAbilityStringLevelField = BlzSetAbilityStringLevelField
|
|
40
|
+
local setUnitAbilityCooldownPercent = BlzSetUnitAbilityCooldownPercent
|
|
41
|
+
local setUnitAbilityCooldownRemaining = BlzSetUnitAbilityCooldownRemaining
|
|
36
42
|
local startUnitAbilityCooldown = BlzStartUnitAbilityCooldown
|
|
37
|
-
local getHandleId = GetHandleId
|
|
38
|
-
local getItemBooleanField = BlzGetItemBooleanField
|
|
39
|
-
local setItemBooleanField = BlzSetItemBooleanField
|
|
40
|
-
local unitHideAbility = BlzUnitHideAbility
|
|
41
43
|
local unitDisableAbility = BlzUnitDisableAbility
|
|
44
|
+
local unitHideAbility = BlzUnitHideAbility
|
|
42
45
|
local match = string.match
|
|
43
46
|
local ____type = _G.type
|
|
44
47
|
local ____tostring = _G.tostring
|
|
@@ -215,7 +218,6 @@ local levelRefreshFields = {
|
|
|
215
218
|
[fourCC("Neg1")] = true
|
|
216
219
|
}
|
|
217
220
|
local levelsField = ABILITY_IF_LEVELS
|
|
218
|
-
local order2orderId = _G.OrderId
|
|
219
221
|
local orderIdFieldByParentTypeId = {
|
|
220
222
|
[fourCC("ANcl")] = ABILITY_SLF_BASE_ORDER_ID_NCL6,
|
|
221
223
|
[fourCC("Aspb")] = ABILITY_SLF_BASE_ORDER_ID_SPB5,
|
|
@@ -288,8 +290,8 @@ function Ability.prototype.setField(self, field, levelOrValue, value)
|
|
|
288
290
|
local levels = getAbilityIntegerField(ability, levelsField)
|
|
289
291
|
setAbilityIntegerField(ability, levelsField, levels + 1)
|
|
290
292
|
local level = getUnitAbilityLevel(unit, typeId)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
+
rawSetUnitAbilityLevel(unit, typeId, levels + 1)
|
|
294
|
+
rawSetUnitAbilityLevel(unit, typeId, level)
|
|
293
295
|
setAbilityIntegerField(ability, levelsField, levels)
|
|
294
296
|
end
|
|
295
297
|
return success
|
|
@@ -422,6 +424,9 @@ function UnitAbility.prototype.decrementDisableCounter(self)
|
|
|
422
424
|
unitHideAbility(unit, typeId, true)
|
|
423
425
|
self.d = (self.d or 0) - 1
|
|
424
426
|
end
|
|
427
|
+
function UnitAbility.prototype.startCooldown(self, cooldown)
|
|
428
|
+
startUnitAbilityCooldown(self.u, self.typeId, cooldown)
|
|
429
|
+
end
|
|
425
430
|
function UnitAbility.prototype.interruptCast(self)
|
|
426
431
|
self.owner:interruptCast(self.typeId)
|
|
427
432
|
end
|
|
@@ -447,7 +452,20 @@ __TS__SetDescriptor(
|
|
|
447
452
|
return getUnitAbilityLevel(self.u, self.typeId) - 1
|
|
448
453
|
end,
|
|
449
454
|
set = function(self, v)
|
|
450
|
-
|
|
455
|
+
SetUnitAbilityLevel(self.u, self.typeId, v + 1)
|
|
456
|
+
end
|
|
457
|
+
},
|
|
458
|
+
true
|
|
459
|
+
)
|
|
460
|
+
__TS__SetDescriptor(
|
|
461
|
+
UnitAbility.prototype,
|
|
462
|
+
"cooldownRemainingPercent",
|
|
463
|
+
{
|
|
464
|
+
get = function(self)
|
|
465
|
+
return getUnitAbilityCooldownPercent(self.u, self.typeId)
|
|
466
|
+
end,
|
|
467
|
+
set = function(self, percent)
|
|
468
|
+
setUnitAbilityCooldownPercent(self.u, self.typeId, percent)
|
|
451
469
|
end
|
|
452
470
|
},
|
|
453
471
|
true
|
|
@@ -460,7 +478,7 @@ __TS__SetDescriptor(
|
|
|
460
478
|
return getUnitAbilityCooldownRemaining(self.u, self.typeId)
|
|
461
479
|
end,
|
|
462
480
|
set = function(self, cooldownRemaining)
|
|
463
|
-
|
|
481
|
+
setUnitAbilityCooldownRemaining(self.u, self.typeId, cooldownRemaining)
|
|
464
482
|
end
|
|
465
483
|
},
|
|
466
484
|
true
|
|
@@ -516,11 +534,13 @@ function ItemAbility.prototype.setField(self, field, levelOrValue, value)
|
|
|
516
534
|
)
|
|
517
535
|
end
|
|
518
536
|
function ItemAbility.prototype.interruptCast(self)
|
|
519
|
-
local
|
|
520
|
-
local
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
537
|
+
local item = self.owner
|
|
538
|
+
local itemHandle = item.handle
|
|
539
|
+
local ____opt_1 = item.owner
|
|
540
|
+
local itemOwnerHandle = ____opt_1 and ____opt_1.handle
|
|
541
|
+
local cooldownRemaining = doAbilityActionForceDummy(itemHandle, itemOwnerHandle, getAbilityCooldown, self.typeId)
|
|
542
|
+
if cooldownRemaining == 0 then
|
|
543
|
+
startItemCooldown(itemHandle, itemOwnerHandle, 0.015625)
|
|
524
544
|
end
|
|
525
545
|
end
|
|
526
546
|
function ItemAbility.prototype.onDestroy(self)
|
|
@@ -543,17 +563,17 @@ __TS__SetDescriptor(
|
|
|
543
563
|
{
|
|
544
564
|
get = function(self)
|
|
545
565
|
local item = self.owner
|
|
546
|
-
local
|
|
547
|
-
local
|
|
548
|
-
local
|
|
549
|
-
return
|
|
566
|
+
local ____doAbilityActionForceDummy_6 = doAbilityActionForceDummy
|
|
567
|
+
local ____item_handle_5 = item.handle
|
|
568
|
+
local ____opt_3 = item.owner
|
|
569
|
+
return ____doAbilityActionForceDummy_6(____item_handle_5, ____opt_3 and ____opt_3.handle, getAbilityCooldown, self.typeId)
|
|
550
570
|
end,
|
|
551
571
|
set = function(self, cooldownRemaining)
|
|
552
572
|
local item = self.owner
|
|
553
|
-
local
|
|
554
|
-
local
|
|
555
|
-
local
|
|
556
|
-
|
|
573
|
+
local ____startItemCooldown_10 = startItemCooldown
|
|
574
|
+
local ____item_handle_9 = item.handle
|
|
575
|
+
local ____opt_7 = item.owner
|
|
576
|
+
____startItemCooldown_10(____item_handle_9, ____opt_7 and ____opt_7.handle, cooldownRemaining)
|
|
557
577
|
end
|
|
558
578
|
},
|
|
559
579
|
true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____item = require("engine.internal.item")
|
|
5
|
+
local Item = ____item.Item
|
|
6
|
+
local ____item = require("engine.standard.fields.item")
|
|
7
|
+
local CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD = ____item.CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD
|
|
8
|
+
local IS_ACTIVELY_USED_ITEM_FIELD = ____item.IS_ACTIVELY_USED_ITEM_FIELD
|
|
9
|
+
__TS__ObjectDefineProperty(
|
|
10
|
+
Item.prototype,
|
|
11
|
+
"canBeSold",
|
|
12
|
+
{
|
|
13
|
+
get = function(self)
|
|
14
|
+
return CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD:getValue(self)
|
|
15
|
+
end,
|
|
16
|
+
set = function(self, value)
|
|
17
|
+
CAN_BE_SOLD_TO_MERCHANTS_ITEM_FIELD:setValue(self, value)
|
|
18
|
+
end
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
__TS__ObjectDefineProperty(
|
|
22
|
+
Item.prototype,
|
|
23
|
+
"isActivelyUsed",
|
|
24
|
+
{
|
|
25
|
+
get = function(self)
|
|
26
|
+
return IS_ACTIVELY_USED_ITEM_FIELD:getValue(self)
|
|
27
|
+
end,
|
|
28
|
+
set = function(self, value)
|
|
29
|
+
IS_ACTIVELY_USED_ITEM_FIELD:setValue(self, value)
|
|
30
|
+
end
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
return ____exports
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Unit } from "./unit";
|
|
3
|
+
import "./unit/equipment-inventory";
|
|
3
4
|
declare module "./item" {
|
|
4
5
|
interface Item {
|
|
6
|
+
/** The unit carrying the item in any of its inventories (regular, extended or equipment), if any. */
|
|
5
7
|
readonly owner?: Unit;
|
|
6
8
|
}
|
|
7
9
|
}
|
|
@@ -5,15 +5,33 @@ local ____item = require("engine.internal.item")
|
|
|
5
5
|
local Item = ____item.Item
|
|
6
6
|
local ____unit = require("engine.internal.unit")
|
|
7
7
|
local Unit = ____unit.Unit
|
|
8
|
-
|
|
8
|
+
require("engine.internal.unit.equipment-inventory")
|
|
9
|
+
local ____owner_2Dcache = require("engine.internal.item.owner-cache")
|
|
10
|
+
local ownerByItem = ____owner_2Dcache.ownerByItem
|
|
11
|
+
local ____item_2Dcontainer = require("engine.internal.unit.item-container")
|
|
12
|
+
local unitOwnsItem = ____item_2Dcontainer.unitOwnsItem
|
|
9
13
|
Unit.itemPickedUpEvent:addListener(
|
|
10
|
-
|
|
14
|
+
999999,
|
|
11
15
|
function(unit, item)
|
|
12
16
|
ownerByItem[item] = unit
|
|
13
17
|
end
|
|
14
18
|
)
|
|
19
|
+
Unit.itemEquippedEvent:addListener(
|
|
20
|
+
999999,
|
|
21
|
+
function(unit, item)
|
|
22
|
+
ownerByItem[item] = unit
|
|
23
|
+
end
|
|
24
|
+
)
|
|
25
|
+
Unit.itemUnequippedEvent:addListener(
|
|
26
|
+
999999,
|
|
27
|
+
function(unit, item)
|
|
28
|
+
if not unitOwnsItem(unit.handle, item.handle) then
|
|
29
|
+
ownerByItem[item] = nil
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
)
|
|
15
33
|
Unit.itemDroppedEvent:addListener(
|
|
16
|
-
|
|
34
|
+
999999,
|
|
17
35
|
function(unit, item)
|
|
18
36
|
ownerByItem[item] = nil
|
|
19
37
|
end
|
|
@@ -22,7 +40,12 @@ __TS__ObjectDefineProperty(
|
|
|
22
40
|
Item.prototype,
|
|
23
41
|
"owner",
|
|
24
42
|
{get = function(self)
|
|
25
|
-
|
|
43
|
+
local owner = ownerByItem[self]
|
|
44
|
+
if owner ~= nil and not unitOwnsItem(owner.handle, self.handle) then
|
|
45
|
+
ownerByItem[self] = nil
|
|
46
|
+
return nil
|
|
47
|
+
end
|
|
48
|
+
return owner
|
|
26
49
|
end}
|
|
27
50
|
)
|
|
28
51
|
return ____exports
|
|
@@ -2,19 +2,37 @@
|
|
|
2
2
|
import { Handle, HandleDestructor } from "../../core/types/handle";
|
|
3
3
|
import { Color } from "../../core/types/color";
|
|
4
4
|
import { Event } from "../../event";
|
|
5
|
+
import { PlayerColor } from "../../core/types/playerColor";
|
|
6
|
+
import { EquipmentType } from "../object-data/auxiliary/equipment-type";
|
|
7
|
+
import { ItemTag } from "../object-data/auxiliary/item-tag";
|
|
5
8
|
import { ReadonlyRect } from "../../core/types/rect";
|
|
6
9
|
import { ItemAbility } from "./ability";
|
|
7
10
|
import { AbilityTypeId } from "../object-data/entry/ability-type";
|
|
8
11
|
import type { ItemTypeId } from "../object-data/entry/item-type";
|
|
9
12
|
type DefenseType = 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
13
|
declare const enum ItemPropertyKey {
|
|
11
|
-
ABILITIES = 100
|
|
14
|
+
ABILITIES = 100,
|
|
15
|
+
DEATH_TRIGGER = 101,
|
|
16
|
+
COLOR = 102
|
|
12
17
|
}
|
|
13
18
|
export declare class Item extends Handle<jitem> {
|
|
14
19
|
private readonly [ItemPropertyKey.ABILITIES];
|
|
20
|
+
private readonly [ItemPropertyKey.DEATH_TRIGGER];
|
|
21
|
+
private [ItemPropertyKey.COLOR]?;
|
|
15
22
|
constructor(handle: jitem);
|
|
16
23
|
protected onDestroy(): HandleDestructor;
|
|
17
24
|
static create<T extends Item>(this: typeof Item & (new (handle: jitem) => T), id: number, x: number, y: number, skinId?: number): T;
|
|
25
|
+
/** Whether the item is owned by a unit, i.e. carried in any of its inventories (regular, extended or equipment). */
|
|
26
|
+
get isOwned(): boolean;
|
|
27
|
+
/** Whether the item is carried in a unit's (regular) inventory, as opposed to its extended or equipment inventory. */
|
|
28
|
+
get isInInventory(): boolean;
|
|
29
|
+
get isInExtendedInventory(): boolean;
|
|
30
|
+
get isInEquipmentInventory(): boolean;
|
|
31
|
+
get equipmentType(): EquipmentType;
|
|
32
|
+
get tag(): ItemTag;
|
|
33
|
+
get color(): PlayerColor;
|
|
34
|
+
set color(color: PlayerColor);
|
|
35
|
+
static getRandomTypeId(level: number, equipmentType?: EquipmentType | undefined, tag?: ItemTag, itemType?: jitemtype): ItemTypeId | undefined;
|
|
18
36
|
get typeId(): ItemTypeId;
|
|
19
37
|
set skinId(v: number);
|
|
20
38
|
get skinId(): number;
|
|
@@ -32,8 +50,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
32
50
|
get dropsOnDeath(): boolean;
|
|
33
51
|
set canBeDropped(canBeDropped: boolean);
|
|
34
52
|
get canBeDropped(): boolean;
|
|
35
|
-
set canBeSold(canBeSold: boolean);
|
|
36
|
-
get canBeSold(): boolean;
|
|
37
53
|
set perishes(perishes: boolean);
|
|
38
54
|
get perishes(): boolean;
|
|
39
55
|
set isPowerUp(isPowerUp: boolean);
|
|
@@ -42,8 +58,6 @@ export declare class Item extends Handle<jitem> {
|
|
|
42
58
|
get isDead(): boolean;
|
|
43
59
|
set isInvulnerable(isInvulnerable: boolean);
|
|
44
60
|
get isInvulnerable(): boolean;
|
|
45
|
-
set isActivelyUsed(isActivelyUsed: boolean);
|
|
46
|
-
get isActivelyUsed(): boolean;
|
|
47
61
|
set visible(v: boolean);
|
|
48
62
|
get visible(): boolean;
|
|
49
63
|
set level(v: number);
|
|
@@ -82,6 +96,7 @@ export declare class Item extends Handle<jitem> {
|
|
|
82
96
|
static getInRect(rect: ReadonlyRect): Item[];
|
|
83
97
|
static get onCreate(): Event<[Item]>;
|
|
84
98
|
static get destroyEvent(): Event<[Item]>;
|
|
99
|
+
static readonly deathEvent: Event<[Item]>;
|
|
85
100
|
static readonly chargesChangedEvent: Event<[Item]>;
|
|
86
101
|
}
|
|
87
102
|
export {};
|
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,58 @@ 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 isItemOwned = IsItemOwned
|
|
60
|
+
local isItemPawnable = IsItemPawnable
|
|
61
|
+
local isItemPowerup = IsItemPowerup
|
|
62
|
+
local itemAddAbility = BlzItemAddAbility
|
|
63
|
+
local itemRemoveAbility = BlzItemRemoveAbility
|
|
64
|
+
local loadItemHandle = LoadItemHandle
|
|
65
|
+
local removeItem = RemoveItem
|
|
66
|
+
local saveWidgetHandle = SaveWidgetHandle
|
|
67
|
+
local setItemBooleanField = BlzSetItemBooleanField
|
|
47
68
|
local setItemCharges = SetItemCharges
|
|
69
|
+
local setItemColor = SetItemColor
|
|
70
|
+
local setItemDropOnDeath = SetItemDropOnDeath
|
|
71
|
+
local setItemDroppable = SetItemDroppable
|
|
72
|
+
local setItemPawnable = SetItemPawnable
|
|
73
|
+
local setRect = SetRect
|
|
74
|
+
local triggerAddCondition = TriggerAddCondition
|
|
75
|
+
local triggerRegisterDeathEvent = TriggerRegisterDeathEvent
|
|
48
76
|
local unitRemoveAbility = UnitRemoveAbility
|
|
49
77
|
local unitRemoveItem = UnitRemoveItem
|
|
50
78
|
local unitUseItem = UnitUseItem
|
|
51
79
|
local unitUseItemPoint = UnitUseItemPoint
|
|
52
80
|
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
81
|
local tableRemove = table.remove
|
|
82
|
+
local itemChargesChangeEvent = __TS__New(Event)
|
|
83
|
+
local itemDeathEvent = __TS__New(Event)
|
|
61
84
|
_G.SetItemCharges = function(whichItem, charges)
|
|
62
85
|
setItemCharges(whichItem, charges)
|
|
63
86
|
invoke(
|
|
@@ -137,6 +160,25 @@ local function collectIntoTargetRange()
|
|
|
137
160
|
targetCollectionNextIndex = targetCollectionNextIndex + 1
|
|
138
161
|
end
|
|
139
162
|
end
|
|
163
|
+
local hashtable = InitHashtable()
|
|
164
|
+
local deathTriggerCondition = condition(function()
|
|
165
|
+
saveWidgetHandle(
|
|
166
|
+
hashtable,
|
|
167
|
+
1,
|
|
168
|
+
1,
|
|
169
|
+
getTriggerWidget()
|
|
170
|
+
)
|
|
171
|
+
local item = ____exports.Item:of(loadItemHandle(hashtable, 1, 1))
|
|
172
|
+
if item ~= nil then
|
|
173
|
+
invoke(itemDeathEvent, item)
|
|
174
|
+
end
|
|
175
|
+
end)
|
|
176
|
+
itemDeathEvent:addListener(
|
|
177
|
+
999999,
|
|
178
|
+
function(item)
|
|
179
|
+
Timer:run(item, "destroy")
|
|
180
|
+
end
|
|
181
|
+
)
|
|
140
182
|
____exports.Item = __TS__Class()
|
|
141
183
|
local Item = ____exports.Item
|
|
142
184
|
Item.name = "Item"
|
|
@@ -144,6 +186,10 @@ __TS__ClassExtends(Item, Handle)
|
|
|
144
186
|
function Item.prototype.____constructor(self, handle)
|
|
145
187
|
Handle.prototype.____constructor(self, handle)
|
|
146
188
|
self[100] = doAbilityAction(handle, getItemAbilities, self)
|
|
189
|
+
local deathTrigger = createTrigger()
|
|
190
|
+
triggerRegisterDeathEvent(deathTrigger, handle)
|
|
191
|
+
triggerAddCondition(deathTrigger, deathTriggerCondition)
|
|
192
|
+
self[101] = deathTrigger
|
|
147
193
|
end
|
|
148
194
|
function Item.prototype.onDestroy(self)
|
|
149
195
|
local owner = self.owner
|
|
@@ -155,11 +201,27 @@ function Item.prototype.onDestroy(self)
|
|
|
155
201
|
abilities[i]:destroy()
|
|
156
202
|
end
|
|
157
203
|
removeItem(self.handle)
|
|
204
|
+
destroyTrigger(self[101])
|
|
158
205
|
return Handle.prototype.onDestroy(self)
|
|
159
206
|
end
|
|
160
207
|
function Item.create(self, id, x, y, skinId)
|
|
161
208
|
return self:of(BlzCreateItemWithSkin(id, x, y, skinId or id))
|
|
162
209
|
end
|
|
210
|
+
function Item.getRandomTypeId(self, level, equipmentType, tag, itemType)
|
|
211
|
+
if tag == nil then
|
|
212
|
+
tag = 8
|
|
213
|
+
end
|
|
214
|
+
if itemType == nil then
|
|
215
|
+
itemType = ITEM_TYPE_ANY
|
|
216
|
+
end
|
|
217
|
+
local id = chooseRandomItemExWithFilter(
|
|
218
|
+
itemType,
|
|
219
|
+
level,
|
|
220
|
+
convertEquipmentType(equipmentType or 9),
|
|
221
|
+
convertItemTag(tag)
|
|
222
|
+
)
|
|
223
|
+
return id ~= 0 and id or nil
|
|
224
|
+
end
|
|
163
225
|
function Item.prototype.consumeCharge(self)
|
|
164
226
|
return self:consumeCharges(1)
|
|
165
227
|
end
|
|
@@ -244,6 +306,70 @@ function Item.getInRect(self, rect)
|
|
|
244
306
|
enumItemsInRect(rect.handle, nil, collectIntoTarget)
|
|
245
307
|
return targetCollection
|
|
246
308
|
end
|
|
309
|
+
__TS__SetDescriptor(
|
|
310
|
+
Item.prototype,
|
|
311
|
+
"isOwned",
|
|
312
|
+
{get = function(self)
|
|
313
|
+
local handle = self.handle
|
|
314
|
+
return isItemOwned(handle) or isItemInBag(handle) or isItemEquipped(handle)
|
|
315
|
+
end},
|
|
316
|
+
true
|
|
317
|
+
)
|
|
318
|
+
__TS__SetDescriptor(
|
|
319
|
+
Item.prototype,
|
|
320
|
+
"isInInventory",
|
|
321
|
+
{get = function(self)
|
|
322
|
+
local handle = self.handle
|
|
323
|
+
return isItemOwned(handle) and not isItemInBag(handle) and not isItemEquipped(handle)
|
|
324
|
+
end},
|
|
325
|
+
true
|
|
326
|
+
)
|
|
327
|
+
__TS__SetDescriptor(
|
|
328
|
+
Item.prototype,
|
|
329
|
+
"isInExtendedInventory",
|
|
330
|
+
{get = function(self)
|
|
331
|
+
return isItemInBag(self.handle)
|
|
332
|
+
end},
|
|
333
|
+
true
|
|
334
|
+
)
|
|
335
|
+
__TS__SetDescriptor(
|
|
336
|
+
Item.prototype,
|
|
337
|
+
"isInEquipmentInventory",
|
|
338
|
+
{get = function(self)
|
|
339
|
+
return isItemEquipped(self.handle)
|
|
340
|
+
end},
|
|
341
|
+
true
|
|
342
|
+
)
|
|
343
|
+
__TS__SetDescriptor(
|
|
344
|
+
Item.prototype,
|
|
345
|
+
"equipmentType",
|
|
346
|
+
{get = function(self)
|
|
347
|
+
return getHandleId(getItemEquipmentType(self.handle))
|
|
348
|
+
end},
|
|
349
|
+
true
|
|
350
|
+
)
|
|
351
|
+
__TS__SetDescriptor(
|
|
352
|
+
Item.prototype,
|
|
353
|
+
"tag",
|
|
354
|
+
{get = function(self)
|
|
355
|
+
return getHandleId(getItemTag(self.handle))
|
|
356
|
+
end},
|
|
357
|
+
true
|
|
358
|
+
)
|
|
359
|
+
__TS__SetDescriptor(
|
|
360
|
+
Item.prototype,
|
|
361
|
+
"color",
|
|
362
|
+
{
|
|
363
|
+
get = function(self)
|
|
364
|
+
return self[102] or PlayerColor.red
|
|
365
|
+
end,
|
|
366
|
+
set = function(self, color)
|
|
367
|
+
setItemColor(self.handle, color.handle)
|
|
368
|
+
self[102] = color
|
|
369
|
+
end
|
|
370
|
+
},
|
|
371
|
+
true
|
|
372
|
+
)
|
|
247
373
|
__TS__SetDescriptor(
|
|
248
374
|
Item.prototype,
|
|
249
375
|
"typeId",
|
|
@@ -356,19 +482,6 @@ __TS__SetDescriptor(
|
|
|
356
482
|
},
|
|
357
483
|
true
|
|
358
484
|
)
|
|
359
|
-
__TS__SetDescriptor(
|
|
360
|
-
Item.prototype,
|
|
361
|
-
"canBeSold",
|
|
362
|
-
{
|
|
363
|
-
get = function(self)
|
|
364
|
-
return isItemPawnable(self.handle)
|
|
365
|
-
end,
|
|
366
|
-
set = function(self, canBeSold)
|
|
367
|
-
setItemPawnable(self.handle, canBeSold)
|
|
368
|
-
end
|
|
369
|
-
},
|
|
370
|
-
true
|
|
371
|
-
)
|
|
372
485
|
__TS__SetDescriptor(
|
|
373
486
|
Item.prototype,
|
|
374
487
|
"perishes",
|
|
@@ -427,30 +540,6 @@ __TS__SetDescriptor(
|
|
|
427
540
|
},
|
|
428
541
|
true
|
|
429
542
|
)
|
|
430
|
-
__TS__SetDescriptor(
|
|
431
|
-
Item.prototype,
|
|
432
|
-
"isActivelyUsed",
|
|
433
|
-
{
|
|
434
|
-
get = function(self)
|
|
435
|
-
return getItemBooleanField(self.handle, ITEM_BF_ACTIVELY_USED)
|
|
436
|
-
end,
|
|
437
|
-
set = function(self, isActivelyUsed)
|
|
438
|
-
local handle = self.handle
|
|
439
|
-
local powerUp = isItemPowerup(handle)
|
|
440
|
-
local perishes = getItemBooleanField(handle, ITEM_BF_PERISHABLE)
|
|
441
|
-
local dropsOnDeath = getItemBooleanField(handle, ITEM_BF_DROPPED_WHEN_CARRIER_DIES)
|
|
442
|
-
local canBeDropped = getItemBooleanField(handle, ITEM_BF_CAN_BE_DROPPED)
|
|
443
|
-
local canBeSold = isItemPawnable(handle)
|
|
444
|
-
setItemBooleanField(handle, ITEM_BF_ACTIVELY_USED, isActivelyUsed)
|
|
445
|
-
setItemPawnable(handle, canBeSold)
|
|
446
|
-
setItemDroppable(handle, canBeDropped)
|
|
447
|
-
setItemDropOnDeath(handle, dropsOnDeath)
|
|
448
|
-
setItemBooleanField(handle, ITEM_BF_PERISHABLE, perishes)
|
|
449
|
-
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, powerUp)
|
|
450
|
-
end
|
|
451
|
-
},
|
|
452
|
-
true
|
|
453
|
-
)
|
|
454
543
|
__TS__SetDescriptor(
|
|
455
544
|
Item.prototype,
|
|
456
545
|
"visible",
|
|
@@ -672,8 +761,8 @@ __TS__ObjectDefineProperty(
|
|
|
672
761
|
return self.onDestroyEvent
|
|
673
762
|
end}
|
|
674
763
|
)
|
|
764
|
+
Item.deathEvent = itemDeathEvent
|
|
675
765
|
Item.chargesChangedEvent = itemChargesChangeEvent
|
|
676
|
-
local getManipulatedItem = GetManipulatedItem
|
|
677
766
|
local trigger = CreateTrigger()
|
|
678
767
|
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_PICKUP_ITEM)
|
|
679
768
|
TriggerAddAction(
|
|
@@ -74,9 +74,12 @@ ____exports.castAbility = function(nativeUnit, abilityTypeId, prepareAbility, ..
|
|
|
74
74
|
unitRemoveAbility(nativeUnit, INVENTORY_ABILITY_TYPE_ID)
|
|
75
75
|
if latestInventoryAbilityTypeId ~= 0 then
|
|
76
76
|
unitAddAbility(nativeUnit, latestInventoryAbilityTypeId)
|
|
77
|
-
for slot,
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
for slot = 0, inventorySize - 1 do
|
|
78
|
+
local nativeItem = nativeItemBySlot[slot]
|
|
79
|
+
if nativeItem ~= nil then
|
|
80
|
+
unitAddItem(nativeUnit, nativeItem)
|
|
81
|
+
unitDropItemSlot(nativeUnit, nativeItem, slot)
|
|
82
|
+
end
|
|
80
83
|
end
|
|
81
84
|
end
|
|
82
85
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
---
|
|
3
|
+
-- @internal The original natives, captured before `unit+ability` wraps them to report
|
|
4
|
+
-- ability level changes. For internal level juggling that must not be reported.
|
|
5
|
+
____exports.rawSetUnitAbilityLevel = SetUnitAbilityLevel
|
|
6
|
+
---
|
|
7
|
+
-- @internal
|
|
8
|
+
____exports.rawIncUnitAbilityLevel = IncUnitAbilityLevel
|
|
9
|
+
---
|
|
10
|
+
-- @internal
|
|
11
|
+
____exports.rawDecUnitAbilityLevel = DecUnitAbilityLevel
|
|
12
|
+
return ____exports
|