warscript 0.0.1-dev.76448ae → 0.0.1-dev.7769f27
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 +1 -0
- package/attributes.lua +9 -0
- 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 +16 -2
- package/core/types/frame.lua +131 -65
- 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 +18 -1
- package/core/types/player.lua +73 -25
- package/core/types/playerCamera.lua +44 -0
- 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/tileCell.d.ts +18 -3
- package/core/types/tileCell.lua +108 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +22 -2
- 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 +707 -9
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/ability-type-extended-tooltip.d.ts +8 -0
- package/engine/ability-type-extended-tooltip.lua +44 -0
- package/engine/behavior.d.ts +12 -1
- package/engine/behavior.lua +199 -65
- package/engine/behaviour/ability/apply-buff.lua +4 -4
- 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/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability.d.ts +13 -6
- package/engine/behaviour/ability.lua +56 -1
- package/engine/behaviour/unit/stun-immunity.d.ts +9 -5
- package/engine/behaviour/unit/stun-immunity.lua +17 -7
- package/engine/behaviour/unit.d.ts +16 -5
- package/engine/behaviour/unit.lua +127 -22
- package/engine/buff.d.ts +73 -27
- package/engine/buff.lua +424 -193
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +10 -1
- package/engine/internal/ability.lua +91 -45
- 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 +37 -8
- package/engine/internal/item.d.ts +27 -14
- package/engine/internal/item.lua +185 -82
- 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.d.ts +14 -14
- package/engine/internal/unit/ability.lua +72 -45
- 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.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- 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/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +3 -3
- package/engine/internal/unit/order.lua +10 -10
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.d.ts +2 -1
- package/engine/internal/unit+ability.lua +73 -3
- 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 +64 -33
- package/engine/internal/unit.d.ts +19 -31
- package/engine/internal/unit.lua +225 -296
- package/engine/local-client.d.ts +28 -0
- package/engine/local-client.lua +324 -54
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -0
- package/engine/object-data/auxiliary/attachment-preset.lua +7 -0
- 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-passive-with-cooldown.d.ts +23 -0
- package/engine/object-data/entry/ability-type/blank-passive-with-cooldown.lua +112 -0
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +4 -0
- package/engine/object-data/entry/ability-type/blank-passive.lua +27 -7
- package/engine/object-data/entry/ability-type/breath-of-fire.d.ts +11 -0
- package/engine/object-data/entry/ability-type/breath-of-fire.lua +27 -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/exhume-corpses.d.ts +14 -0
- package/engine/object-data/entry/ability-type/exhume-corpses.lua +40 -0
- package/engine/object-data/entry/ability-type/firebolt.d.ts +7 -0
- package/engine/object-data/entry/ability-type/firebolt.lua +13 -0
- package/engine/object-data/entry/ability-type/flame-strike.d.ts +25 -0
- package/engine/object-data/entry/ability-type/flame-strike.lua +92 -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/life-drain.d.ts +37 -0
- package/engine/object-data/entry/ability-type/life-drain.lua +144 -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/rain-of-fire.d.ts +7 -0
- package/engine/object-data/entry/ability-type/rain-of-fire.lua +13 -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-burn.d.ts +22 -0
- package/engine/object-data/entry/ability-type/soul-burn.lua +79 -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 +31 -6
- package/engine/object-data/entry/ability-type.lua +287 -9
- 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 +32 -2
- package/engine/object-data/entry/destructible-type.lua +181 -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 +51 -2
- package/engine/object-data/entry/unit-type.lua +415 -37
- 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.d.ts +3 -3
- package/engine/object-field/ability.lua +9 -8
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/object-field/unit.d.ts +20 -5
- package/engine/object-field/unit.lua +61 -0
- package/engine/object-field.d.ts +12 -4
- package/engine/object-field.lua +273 -126
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +21 -0
- package/engine/standard/entries/ability-type.d.ts +3102 -7
- package/engine/standard/entries/ability-type.lua +0 -6
- package/engine/standard/entries/buff-type.d.ts +45 -0
- package/engine/standard/entries/buff-type.lua +43 -0
- 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/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- 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 -3
- package/engine/standard/fields/unit.lua +15 -2
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.lua +4 -2
- package/engine/unit.d.ts +10 -1
- package/engine/unit.lua +10 -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/net/socket.lua +1 -1
- package/network.lua +25 -1
- package/objutil/buff.lua +11 -9
- 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/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +8 -1
- package/utility/arrays.lua +25 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +4 -1
- package/utility/linked-set.lua +46 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/records.lua +20 -1
- package/utility/types.d.ts +3 -0
- 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/core/types/player.lua
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__New = ____lualib.__TS__New
|
|
2
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
4
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
6
6
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
7
7
|
local ____exports = {}
|
|
@@ -23,20 +23,41 @@ local ____math = require("math")
|
|
|
23
23
|
local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
24
24
|
local ____player_2Dlocal_2Dhandle = require("engine.internal.misc.player-local-handle")
|
|
25
25
|
local PLAYER_LOCAL_HANDLE = ____player_2Dlocal_2Dhandle.PLAYER_LOCAL_HANDLE
|
|
26
|
+
local ____lazy = require("utility.lazy")
|
|
27
|
+
local lazyRecord = ____lazy.lazyRecord
|
|
28
|
+
local getPlayerAlliance = GetPlayerAlliance
|
|
26
29
|
local getPlayerColor = GetPlayerColor
|
|
27
30
|
local getPlayerName = GetPlayerName
|
|
28
31
|
local getPlayerTechCount = GetPlayerTechCount
|
|
29
32
|
local getPlayerTechMaxAllowed = GetPlayerTechMaxAllowed
|
|
33
|
+
local getTriggerPlayer = GetTriggerPlayer
|
|
34
|
+
local playerNative = _G.Player
|
|
35
|
+
local setPlayerAbilityAvailable = SetPlayerAbilityAvailable
|
|
36
|
+
local setPlayerAlliance = SetPlayerAlliance
|
|
37
|
+
local setPlayerRaceSkin = SetPlayerRaceSkin
|
|
30
38
|
local setPlayerTechMaxAllowed = SetPlayerTechMaxAllowed
|
|
31
39
|
local setPlayerTechResearched = SetPlayerTechResearched
|
|
32
|
-
local
|
|
33
|
-
local
|
|
40
|
+
local triggerRegisterPlayerAllianceChange = TriggerRegisterPlayerAllianceChange
|
|
41
|
+
local nativeByPlayerAllianceType = {
|
|
42
|
+
[0] = ALLIANCE_PASSIVE,
|
|
43
|
+
[1] = ALLIANCE_RESCUABLE,
|
|
44
|
+
[2] = ALLIANCE_HELP_REQUEST,
|
|
45
|
+
[3] = ALLIANCE_HELP_RESPONSE,
|
|
46
|
+
[4] = ALLIANCE_SHARED_XP,
|
|
47
|
+
[5] = ALLIANCE_SHARED_SPELLS,
|
|
48
|
+
[6] = ALLIANCE_SHARED_VISION,
|
|
49
|
+
[7] = ALLIANCE_SHARED_VISION_FORCED,
|
|
50
|
+
[8] = ALLIANCE_SHARED_CONTROL,
|
|
51
|
+
[9] = ALLIANCE_SHARED_ADVANCED_CONTROL
|
|
52
|
+
}
|
|
53
|
+
local playerColorChangedEvent = __TS__New(Event)
|
|
34
54
|
____exports.Player = __TS__Class()
|
|
35
55
|
local Player = ____exports.Player
|
|
36
56
|
Player.name = "Player"
|
|
37
57
|
__TS__ClassExtends(Player, Handle)
|
|
38
58
|
function Player.prototype.____constructor(self, handle)
|
|
39
59
|
Handle.prototype.____constructor(self, handle)
|
|
60
|
+
self.slotState = GetPlayerSlotState(self.handle)
|
|
40
61
|
self.id = GetPlayerId(handle)
|
|
41
62
|
end
|
|
42
63
|
function Player.prototype.onDestroy(self)
|
|
@@ -69,6 +90,9 @@ function Player.prototype.deselect(self, unit)
|
|
|
69
90
|
SelectUnit(unit.handle, false)
|
|
70
91
|
end
|
|
71
92
|
end
|
|
93
|
+
function Player.prototype.setRaceSkin(self, racePreference)
|
|
94
|
+
setPlayerRaceSkin(self.handle, racePreference)
|
|
95
|
+
end
|
|
72
96
|
function Player.prototype.forceUIKey(self, key)
|
|
73
97
|
if self.isLocal then
|
|
74
98
|
ForceUIKey(key)
|
|
@@ -85,6 +109,12 @@ end
|
|
|
85
109
|
function Player.prototype.isEnemyOf(self, other)
|
|
86
110
|
return IsPlayerEnemy(self.handle, other.handle)
|
|
87
111
|
end
|
|
112
|
+
function Player.prototype.setAlliance(self, other, ____type, value)
|
|
113
|
+
setPlayerAlliance(self.handle, other.handle, nativeByPlayerAllianceType[____type], value)
|
|
114
|
+
end
|
|
115
|
+
function Player.prototype.getAlliance(self, other, ____type)
|
|
116
|
+
return getPlayerAlliance(self.handle, other.handle, nativeByPlayerAllianceType[____type])
|
|
117
|
+
end
|
|
88
118
|
function Player.prototype.setAbilityAvailable(self, abilityId, available)
|
|
89
119
|
setPlayerAbilityAvailable(self.handle, abilityId, available)
|
|
90
120
|
end
|
|
@@ -124,14 +154,11 @@ function Player.getMouseEvent(self, event, collector)
|
|
|
124
154
|
self.events[eventId] = __TS__New(
|
|
125
155
|
TriggerEvent,
|
|
126
156
|
function(trigger)
|
|
127
|
-
Timer:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
for ____, player in ipairs(____exports.Player.all) do
|
|
131
|
-
TriggerRegisterPlayerEvent(trigger, player.handle, event)
|
|
132
|
-
end
|
|
157
|
+
Timer:run(function()
|
|
158
|
+
for ____, player in ipairs(____exports.Player.all) do
|
|
159
|
+
TriggerRegisterPlayerEvent(trigger, player.handle, event)
|
|
133
160
|
end
|
|
134
|
-
)
|
|
161
|
+
end)
|
|
135
162
|
end,
|
|
136
163
|
collector or (function() return {} end)
|
|
137
164
|
)
|
|
@@ -180,7 +207,7 @@ function Player.getKeyEvent(self, isDown)
|
|
|
180
207
|
TriggerAddCondition(
|
|
181
208
|
trigger,
|
|
182
209
|
Condition(function()
|
|
183
|
-
local player = ____exports.Player:of(
|
|
210
|
+
local player = ____exports.Player:of(getTriggerPlayer())
|
|
184
211
|
local key = BlzGetTriggerPlayerKey()
|
|
185
212
|
local metaKey = BlzGetTriggerPlayerMetaKey()
|
|
186
213
|
Event.invoke(event, player, key, metaKey)
|
|
@@ -279,6 +306,7 @@ __TS__SetDescriptor(
|
|
|
279
306
|
end,
|
|
280
307
|
set = function(self, color)
|
|
281
308
|
SetPlayerColor(self.handle, color.handle)
|
|
309
|
+
Event.invoke(playerColorChangedEvent, self)
|
|
282
310
|
end
|
|
283
311
|
},
|
|
284
312
|
true
|
|
@@ -341,7 +369,7 @@ __TS__SetDescriptor(
|
|
|
341
369
|
Player.prototype,
|
|
342
370
|
"isUser",
|
|
343
371
|
{get = function(self)
|
|
344
|
-
return
|
|
372
|
+
return self.controller == MAP_CONTROL_USER
|
|
345
373
|
end},
|
|
346
374
|
true
|
|
347
375
|
)
|
|
@@ -349,7 +377,7 @@ __TS__SetDescriptor(
|
|
|
349
377
|
Player.prototype,
|
|
350
378
|
"isPlaying",
|
|
351
379
|
{get = function(self)
|
|
352
|
-
return
|
|
380
|
+
return self.slotState == PLAYER_SLOT_STATE_PLAYING
|
|
353
381
|
end},
|
|
354
382
|
true
|
|
355
383
|
)
|
|
@@ -357,17 +385,30 @@ __TS__SetDescriptor(
|
|
|
357
385
|
Player.prototype,
|
|
358
386
|
"controller",
|
|
359
387
|
{get = function(self)
|
|
360
|
-
|
|
388
|
+
local controller = GetPlayerController(self.handle)
|
|
389
|
+
rawset(self, "controller", controller)
|
|
390
|
+
return controller
|
|
361
391
|
end},
|
|
362
392
|
true
|
|
363
393
|
)
|
|
364
|
-
|
|
365
|
-
Player
|
|
366
|
-
"
|
|
394
|
+
__TS__ObjectDefineProperty(
|
|
395
|
+
Player,
|
|
396
|
+
"allianceChangedEvent",
|
|
367
397
|
{get = function(self)
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
398
|
+
local event = lazyRecord(function(____type)
|
|
399
|
+
return __TS__New(
|
|
400
|
+
TriggerEvent,
|
|
401
|
+
function(trigger)
|
|
402
|
+
for ____, player in ipairs(____exports.Player.all) do
|
|
403
|
+
triggerRegisterPlayerAllianceChange(trigger, player.handle, nativeByPlayerAllianceType[____type])
|
|
404
|
+
end
|
|
405
|
+
end,
|
|
406
|
+
function() return ____exports.Player:of(getTriggerPlayer()) end
|
|
407
|
+
)
|
|
408
|
+
end)
|
|
409
|
+
rawset(self, "allianceChangedEvent", event)
|
|
410
|
+
return event
|
|
411
|
+
end}
|
|
371
412
|
)
|
|
372
413
|
__TS__ObjectDefineProperty(
|
|
373
414
|
Player,
|
|
@@ -375,7 +416,7 @@ __TS__ObjectDefineProperty(
|
|
|
375
416
|
{get = function(self)
|
|
376
417
|
return ____exports.Player:getEvent(
|
|
377
418
|
EVENT_PLAYER_LEAVE,
|
|
378
|
-
function() return ____exports.Player:of(
|
|
419
|
+
function() return ____exports.Player:of(getTriggerPlayer()) end
|
|
379
420
|
)
|
|
380
421
|
end}
|
|
381
422
|
)
|
|
@@ -385,7 +426,7 @@ __TS__ObjectDefineProperty(
|
|
|
385
426
|
{get = function(self)
|
|
386
427
|
return ____exports.Player:getMouseEvent(
|
|
387
428
|
EVENT_PLAYER_MOUSE_DOWN,
|
|
388
|
-
function() return ____exports.Player:of(
|
|
429
|
+
function() return ____exports.Player:of(getTriggerPlayer()), BlzGetTriggerPlayerMouseButton() end
|
|
389
430
|
)
|
|
390
431
|
end}
|
|
391
432
|
)
|
|
@@ -395,7 +436,7 @@ __TS__ObjectDefineProperty(
|
|
|
395
436
|
{get = function(self)
|
|
396
437
|
return ____exports.Player:getMouseEvent(
|
|
397
438
|
EVENT_PLAYER_MOUSE_UP,
|
|
398
|
-
function() return ____exports.Player:of(
|
|
439
|
+
function() return ____exports.Player:of(getTriggerPlayer()), BlzGetTriggerPlayerMouseButton() end
|
|
399
440
|
)
|
|
400
441
|
end}
|
|
401
442
|
)
|
|
@@ -405,7 +446,7 @@ __TS__ObjectDefineProperty(
|
|
|
405
446
|
{get = function(self)
|
|
406
447
|
return ____exports.Player:getMouseEvent(
|
|
407
448
|
EVENT_PLAYER_MOUSE_MOVE,
|
|
408
|
-
function() return ____exports.Player:of(
|
|
449
|
+
function() return ____exports.Player:of(getTriggerPlayer()), vec2(
|
|
409
450
|
BlzGetTriggerPlayerMouseX(),
|
|
410
451
|
BlzGetTriggerPlayerMouseY()
|
|
411
452
|
) end
|
|
@@ -441,10 +482,17 @@ __TS__ObjectDefineProperty(
|
|
|
441
482
|
TriggerRegisterPlayerChatEvent(trigger, player.handle, "", false)
|
|
442
483
|
end
|
|
443
484
|
end,
|
|
444
|
-
function() return ____exports.Player:of(
|
|
485
|
+
function() return ____exports.Player:of(getTriggerPlayer()), GetEventPlayerChatString() end
|
|
445
486
|
)
|
|
446
487
|
rawset(self, "onChat", event)
|
|
447
488
|
return event
|
|
448
489
|
end}
|
|
449
490
|
)
|
|
491
|
+
Player.colorChangedEvent = playerColorChangedEvent
|
|
492
|
+
____exports.Player.onLeave:addListener(
|
|
493
|
+
999999,
|
|
494
|
+
function(player)
|
|
495
|
+
rawset(player, "slotState", PLAYER_SLOT_STATE_LEFT)
|
|
496
|
+
end
|
|
497
|
+
)
|
|
450
498
|
return ____exports
|
|
@@ -13,6 +13,8 @@ local ____frame_2Dcoordinates = require("engine.internal.misc.frame-coordinates"
|
|
|
13
13
|
local FRAME_MAX_Y = ____frame_2Dcoordinates.FRAME_MAX_Y
|
|
14
14
|
local FRAME_MIN_Y = ____frame_2Dcoordinates.FRAME_MIN_Y
|
|
15
15
|
local getFrameMinXMaxX = ____frame_2Dcoordinates.getFrameMinXMaxX
|
|
16
|
+
local ____get_2Dterrain_2Dz = require("engine.internal.misc.get-terrain-z")
|
|
17
|
+
local getTerrainZ = ____get_2Dterrain_2Dz.getTerrainZ
|
|
16
18
|
local getHandleId = GetHandleId
|
|
17
19
|
local setCameraField = SetCameraField
|
|
18
20
|
local getCameraField = GetCameraField
|
|
@@ -26,6 +28,7 @@ local resetToGameCamera = ResetToGameCamera
|
|
|
26
28
|
local cos = math.cos
|
|
27
29
|
local deg = math.deg
|
|
28
30
|
local sin = math.sin
|
|
31
|
+
local sqrt = math.sqrt
|
|
29
32
|
local memoized = {}
|
|
30
33
|
____exports.PlayerCamera = __TS__Class()
|
|
31
34
|
local PlayerCamera = ____exports.PlayerCamera
|
|
@@ -233,4 +236,45 @@ ____exports.worldCoordinatesToFrame = function(x, y, z)
|
|
|
233
236
|
local frameY = 0.42625 - yCenterScreenShift + (cameraAngleOfAttackSinRotationCos * dx + cameraAngleOfAttackSinRotationSin * dy - cameraAngleOfAttackCos * dz) / xPrime
|
|
234
237
|
return frameX, frameY, xPrime < 0 and frameX >= frameMinX and frameX <= frameMaxX and frameY >= FRAME_MIN_Y and frameY <= FRAME_MAX_Y
|
|
235
238
|
end
|
|
239
|
+
---
|
|
240
|
+
-- @internal For use by internal systems only.
|
|
241
|
+
____exports.frameCoordinatesToWorld = function(x, y)
|
|
242
|
+
if not isCameraViewPrecalculated then
|
|
243
|
+
precalculateCameraView()
|
|
244
|
+
end
|
|
245
|
+
local a = (x - 0.4) * scaleFactor
|
|
246
|
+
local b = (0.42625 - yCenterScreenShift - y) * scaleFactor
|
|
247
|
+
local nx = 1 / sqrt(1 + a * a + b * b)
|
|
248
|
+
local ny = sqrt(1 - (1 + b * b) * nx * nx)
|
|
249
|
+
local nz = sqrt(1 - nx * nx - ny * ny)
|
|
250
|
+
if a > 0 then
|
|
251
|
+
ny = -ny
|
|
252
|
+
end
|
|
253
|
+
if b < 0 then
|
|
254
|
+
nz = -nz
|
|
255
|
+
end
|
|
256
|
+
local nxPrime = cameraAngleOfAttackCosRotationCos * nx - cameraRotationSin * ny + cameraAngleOfAttackSinRotationCos * nz
|
|
257
|
+
local nyPrime = cameraAngleOfAttackCosRotationSin * nx + cameraRotationCos * ny + cameraAngleOfAttackSinRotationSin * nz
|
|
258
|
+
local nzPrime = -cameraAngleOfAttackSin * nx + cameraAngleOfAttackCos * nz
|
|
259
|
+
local zGuess = getTerrainZ(cameraEyeX, cameraEyeY)
|
|
260
|
+
local xGuess = cameraEyeX + nxPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
261
|
+
local yGuess = cameraEyeY + nyPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
262
|
+
local zWorld = getTerrainZ(xGuess, yGuess)
|
|
263
|
+
local deltaZ = zWorld - zGuess
|
|
264
|
+
zGuess = zWorld
|
|
265
|
+
local zWorldOld = zWorld
|
|
266
|
+
local deltaZOld = deltaZ
|
|
267
|
+
local i = 0
|
|
268
|
+
while (deltaZ > 1 or deltaZ < -1) and i < 50 do
|
|
269
|
+
xGuess = cameraEyeX + nxPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
270
|
+
yGuess = cameraEyeY + nyPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
271
|
+
zWorld = getTerrainZ(xGuess, yGuess)
|
|
272
|
+
deltaZ = zWorld - zGuess
|
|
273
|
+
zGuess = (deltaZOld * zWorld - deltaZ * zWorldOld) / (deltaZOld - deltaZ)
|
|
274
|
+
zWorldOld = zWorld
|
|
275
|
+
deltaZOld = deltaZ
|
|
276
|
+
i = i + 1
|
|
277
|
+
end
|
|
278
|
+
return xGuess, yGuess, zWorld, i < 50
|
|
279
|
+
end
|
|
236
280
|
return ____exports
|
|
@@ -10,6 +10,7 @@ local ____color = require("core.types.color")
|
|
|
10
10
|
local Color = ____color.Color
|
|
11
11
|
local ____exception = require("exception")
|
|
12
12
|
local IllegalStateException = ____exception.IllegalStateException
|
|
13
|
+
local getHandleId = GetHandleId
|
|
13
14
|
local byId = {}
|
|
14
15
|
local byName = {}
|
|
15
16
|
____exports.PlayerColor = __TS__Class()
|
|
@@ -81,7 +82,7 @@ PlayerColor.data = util.contextFn(
|
|
|
81
82
|
PLAYER_COLOR_SNOW,
|
|
82
83
|
PLAYER_COLOR_EMERALD,
|
|
83
84
|
PLAYER_COLOR_PEANUT,
|
|
84
|
-
|
|
85
|
+
PLAYER_COLOR_BLACK
|
|
85
86
|
}
|
|
86
87
|
local rgbaColors = {
|
|
87
88
|
Color:of(255, 2, 2),
|
|
@@ -141,7 +142,7 @@ PlayerColor.data = util.contextFn(
|
|
|
141
142
|
do
|
|
142
143
|
local i = 0
|
|
143
144
|
while i < #handles do
|
|
144
|
-
data[
|
|
145
|
+
data[getHandleId(handles[i + 1])] = {rgba = rgbaColors[i + 1], name = names[i + 1]}
|
|
145
146
|
i = i + 1
|
|
146
147
|
end
|
|
147
148
|
end
|
|
@@ -172,7 +173,7 @@ PlayerColor.coal = ____exports.PlayerColor:of(PLAYER_COLOR_COAL)
|
|
|
172
173
|
PlayerColor.snow = ____exports.PlayerColor:of(PLAYER_COLOR_SNOW)
|
|
173
174
|
PlayerColor.emerald = ____exports.PlayerColor:of(PLAYER_COLOR_EMERALD)
|
|
174
175
|
PlayerColor.peanut = ____exports.PlayerColor:of(PLAYER_COLOR_PEANUT)
|
|
175
|
-
PlayerColor.black = ____exports.PlayerColor:of(
|
|
176
|
+
PlayerColor.black = ____exports.PlayerColor:of(PLAYER_COLOR_BLACK)
|
|
176
177
|
PlayerColor.all = {
|
|
177
178
|
____exports.PlayerColor.red,
|
|
178
179
|
____exports.PlayerColor.blue,
|
package/core/types/sound.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
|
|
|
47
47
|
protected onDestroy(fadeOut?: boolean): HandleDestructor;
|
|
48
48
|
get volume(): number;
|
|
49
49
|
set volume(v: number);
|
|
50
|
-
start(milliseconds?: number): void;
|
|
50
|
+
start(milliseconds?: number, fadeIn?: boolean): void;
|
|
51
51
|
stop(fadeOut?: boolean): void;
|
|
52
52
|
restart(milliseconds?: number): void;
|
|
53
53
|
static play(fileName: string, preset: SoundSettings): void;
|
package/core/types/sound.lua
CHANGED
|
@@ -9,20 +9,21 @@ local ____sound_2Dpreset = require("engine.object-data.entry.sound-preset")
|
|
|
9
9
|
local SoundPreset = ____sound_2Dpreset.SoundPreset
|
|
10
10
|
local ____random = require("engine.random")
|
|
11
11
|
local randomInteger = ____random.randomInteger
|
|
12
|
+
local attachSoundToUnit = AttachSoundToUnit
|
|
12
13
|
local createSound = CreateSound
|
|
13
14
|
local createSoundFromLabel = CreateSoundFromLabel
|
|
14
|
-
local
|
|
15
|
+
local killSoundWhenDone = KillSoundWhenDone
|
|
15
16
|
local setSoundChannel = SetSoundChannel
|
|
17
|
+
local setSoundDistanceCutoff = SetSoundDistanceCutoff
|
|
18
|
+
local setSoundDistances = SetSoundDistances
|
|
19
|
+
local setSoundPitch = SetSoundPitch
|
|
20
|
+
local setSoundPlayPosition = SetSoundPlayPosition
|
|
16
21
|
local setSoundPosition = SetSoundPosition
|
|
17
22
|
local setSoundVolume = SetSoundVolume
|
|
18
|
-
local setSoundDistances = SetSoundDistances
|
|
19
|
-
local setSoundDistanceCutoff = SetSoundDistanceCutoff
|
|
20
23
|
local startSound = StartSound
|
|
21
|
-
local
|
|
24
|
+
local startSoundEx = StartSoundEx
|
|
22
25
|
local stopSound = StopSound
|
|
23
|
-
|
|
24
|
-
local killSoundWhenDone = KillSoundWhenDone
|
|
25
|
-
____exports.SoundChannel = SoundChannel or ({})
|
|
26
|
+
____exports.SoundChannel = ____exports.SoundChannel or ({})
|
|
26
27
|
____exports.SoundChannel.General = 0
|
|
27
28
|
____exports.SoundChannel[____exports.SoundChannel.General] = "General"
|
|
28
29
|
____exports.SoundChannel.UnitSelection = 1
|
|
@@ -226,8 +227,12 @@ function Sound.prototype.onDestroy(self, fadeOut)
|
|
|
226
227
|
stopSound(self.handle, true, fadeOut or false)
|
|
227
228
|
return Handle.prototype.onDestroy(self)
|
|
228
229
|
end
|
|
229
|
-
function Sound.prototype.start(self, milliseconds)
|
|
230
|
-
|
|
230
|
+
function Sound.prototype.start(self, milliseconds, fadeIn)
|
|
231
|
+
if fadeIn == nil then
|
|
232
|
+
startSound(self.handle)
|
|
233
|
+
else
|
|
234
|
+
startSoundEx(self.handle, fadeIn)
|
|
235
|
+
end
|
|
231
236
|
if milliseconds then
|
|
232
237
|
setSoundPlayPosition(self.handle, milliseconds)
|
|
233
238
|
end
|
package/core/types/tileCell.d.ts
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { AttributesHolder } from "../../attributes";
|
|
3
|
+
export declare class TileCell extends AttributesHolder implements Readonly<Vec2> {
|
|
4
|
+
/** Identifies the cell the same way on every client; see {@link TileCell.getById}. */
|
|
5
|
+
readonly id: number;
|
|
4
6
|
readonly x: number;
|
|
5
7
|
readonly y: number;
|
|
6
8
|
readonly z: undefined;
|
|
7
|
-
protected constructor(
|
|
9
|
+
protected constructor(
|
|
10
|
+
/** Identifies the cell the same way on every client; see {@link TileCell.getById}. */
|
|
11
|
+
id: number, x: number, y: number, z: undefined);
|
|
12
|
+
get up(): TileCell;
|
|
13
|
+
get down(): TileCell;
|
|
14
|
+
get left(): TileCell;
|
|
15
|
+
get right(): TileCell;
|
|
16
|
+
get terrainTypeId(): number;
|
|
17
|
+
set terrainTypeId(terrainTypeId: number);
|
|
18
|
+
get terrainVariance(): number;
|
|
19
|
+
set terrainVariance(terrainVariance: number);
|
|
20
|
+
randomizeTerrainVariance(): void;
|
|
8
21
|
isInRangeOf(x: number, y: number, range: number): boolean;
|
|
9
22
|
isInRangeOf(tileCell: TileCell, range: number): boolean;
|
|
10
23
|
static getInRect(minX: number, minY: number, maxX: number, maxY: number): TileCell[];
|
|
11
24
|
static getInRange(x: number, y: number, range: number): TileCell[];
|
|
12
25
|
static of(this: void, x: number, y: number): TileCell;
|
|
26
|
+
/** The cell with the given {@link id}, e.g. one received over the network. */
|
|
27
|
+
static getById(this: void, id: number): TileCell;
|
|
13
28
|
}
|
package/core/types/tileCell.lua
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
3
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
4
6
|
local ____exports = {}
|
|
7
|
+
local ____attributes = require("attributes")
|
|
8
|
+
local AttributesHolder = ____attributes.AttributesHolder
|
|
9
|
+
local getTerrainType = GetTerrainType
|
|
10
|
+
local setTerrainType = SetTerrainType
|
|
11
|
+
local getTerrainVariance = GetTerrainVariance
|
|
5
12
|
local abs = math.abs
|
|
6
13
|
local ____type = math.type
|
|
7
14
|
local ult = math.ult
|
|
@@ -9,13 +16,27 @@ local tileCellById = {}
|
|
|
9
16
|
____exports.TileCell = __TS__Class()
|
|
10
17
|
local TileCell = ____exports.TileCell
|
|
11
18
|
TileCell.name = "TileCell"
|
|
19
|
+
__TS__ClassExtends(TileCell, AttributesHolder)
|
|
12
20
|
function TileCell.prototype.____constructor(self, id, x, y, z)
|
|
21
|
+
AttributesHolder.prototype.____constructor(self)
|
|
13
22
|
self.id = id
|
|
14
23
|
self.x = x
|
|
15
24
|
self.y = y
|
|
16
25
|
self.z = z
|
|
17
26
|
tileCellById[id] = self
|
|
18
27
|
end
|
|
28
|
+
function TileCell.prototype.randomizeTerrainVariance(self)
|
|
29
|
+
local x = self.x
|
|
30
|
+
local y = self.y
|
|
31
|
+
setTerrainType(
|
|
32
|
+
x,
|
|
33
|
+
y,
|
|
34
|
+
getTerrainType(x, y),
|
|
35
|
+
-1,
|
|
36
|
+
1,
|
|
37
|
+
1
|
|
38
|
+
)
|
|
39
|
+
end
|
|
19
40
|
function TileCell.prototype.isInRangeOf(self, x, y, range)
|
|
20
41
|
if range == nil then
|
|
21
42
|
range = y
|
|
@@ -97,4 +118,91 @@ function TileCell.of(x, y)
|
|
|
97
118
|
nil
|
|
98
119
|
)
|
|
99
120
|
end
|
|
121
|
+
function TileCell.getById(id)
|
|
122
|
+
local yId = (id + 16384) // 32768
|
|
123
|
+
local xId = id - yId * 32768
|
|
124
|
+
return tileCellById[id] or __TS__New(
|
|
125
|
+
____exports.TileCell,
|
|
126
|
+
id,
|
|
127
|
+
xId * 128,
|
|
128
|
+
yId * 128,
|
|
129
|
+
nil
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
__TS__SetDescriptor(
|
|
133
|
+
TileCell.prototype,
|
|
134
|
+
"up",
|
|
135
|
+
{get = function(self)
|
|
136
|
+
return ____exports.TileCell.of(self.x, self.y + 128)
|
|
137
|
+
end},
|
|
138
|
+
true
|
|
139
|
+
)
|
|
140
|
+
__TS__SetDescriptor(
|
|
141
|
+
TileCell.prototype,
|
|
142
|
+
"down",
|
|
143
|
+
{get = function(self)
|
|
144
|
+
return ____exports.TileCell.of(self.x, self.y - 128)
|
|
145
|
+
end},
|
|
146
|
+
true
|
|
147
|
+
)
|
|
148
|
+
__TS__SetDescriptor(
|
|
149
|
+
TileCell.prototype,
|
|
150
|
+
"left",
|
|
151
|
+
{get = function(self)
|
|
152
|
+
return ____exports.TileCell.of(self.x - 128, self.y)
|
|
153
|
+
end},
|
|
154
|
+
true
|
|
155
|
+
)
|
|
156
|
+
__TS__SetDescriptor(
|
|
157
|
+
TileCell.prototype,
|
|
158
|
+
"right",
|
|
159
|
+
{get = function(self)
|
|
160
|
+
return ____exports.TileCell.of(self.x + 128, self.y)
|
|
161
|
+
end},
|
|
162
|
+
true
|
|
163
|
+
)
|
|
164
|
+
__TS__SetDescriptor(
|
|
165
|
+
TileCell.prototype,
|
|
166
|
+
"terrainTypeId",
|
|
167
|
+
{
|
|
168
|
+
get = function(self)
|
|
169
|
+
return getTerrainType(self.x, self.y)
|
|
170
|
+
end,
|
|
171
|
+
set = function(self, terrainTypeId)
|
|
172
|
+
local x = self.x
|
|
173
|
+
local y = self.y
|
|
174
|
+
setTerrainType(
|
|
175
|
+
x,
|
|
176
|
+
y,
|
|
177
|
+
terrainTypeId,
|
|
178
|
+
getTerrainVariance(x, y),
|
|
179
|
+
1,
|
|
180
|
+
1
|
|
181
|
+
)
|
|
182
|
+
end
|
|
183
|
+
},
|
|
184
|
+
true
|
|
185
|
+
)
|
|
186
|
+
__TS__SetDescriptor(
|
|
187
|
+
TileCell.prototype,
|
|
188
|
+
"terrainVariance",
|
|
189
|
+
{
|
|
190
|
+
get = function(self)
|
|
191
|
+
return getTerrainVariance(self.x, self.y)
|
|
192
|
+
end,
|
|
193
|
+
set = function(self, terrainVariance)
|
|
194
|
+
local x = self.x
|
|
195
|
+
local y = self.y
|
|
196
|
+
setTerrainType(
|
|
197
|
+
x,
|
|
198
|
+
y,
|
|
199
|
+
getTerrainType(x, y),
|
|
200
|
+
terrainVariance,
|
|
201
|
+
1,
|
|
202
|
+
1
|
|
203
|
+
)
|
|
204
|
+
end
|
|
205
|
+
},
|
|
206
|
+
true
|
|
207
|
+
)
|
|
100
208
|
return ____exports
|
package/core/types/timer.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Event } from "../../event";
|
|
3
3
|
import { AbstractDestroyable, Destructor } from "../../destroyable";
|
|
4
|
+
import { CallbackId } from "../../utility/callback-array";
|
|
4
5
|
declare const enum TimerPropertyKey {
|
|
5
6
|
HANDLE = 0,
|
|
6
7
|
DESTROY_ON_EXPIRATION = 1,
|
|
@@ -22,8 +23,8 @@ export declare class Timer extends AbstractDestroyable {
|
|
|
22
23
|
pause(): void;
|
|
23
24
|
resume(): void;
|
|
24
25
|
static create(): Timer;
|
|
25
|
-
static run<T, K extends KeysOfType<T, (this: T, ...args: any) => any>>(object: T, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never):
|
|
26
|
-
static run<Args extends any[]>(callback: (this: void, ...args: Args) => void, ...args: Args):
|
|
26
|
+
static run<T, K extends KeysOfType<T, (this: T, ...args: any) => any>>(object: T, key: K, ...parameters: T[K] extends (this: T, ...args: any) => any ? Parameters<T[K]> : never): CallbackId;
|
|
27
|
+
static run<Args extends any[]>(callback: (this: void, ...args: Args) => void, ...args: Args): CallbackId;
|
|
27
28
|
static simple<Args extends any[]>(timeout: number, callback: (...args: Args) => void, ...args: Args): Timer;
|
|
28
29
|
static periodic<Args extends any[]>(period: number, callback: (this: void, timer: Timer, ...args: Args) => void, ...args: Args): Timer;
|
|
29
30
|
static counted(period: number, count: number, callback: (this: void, timer: Timer) => void): Timer;
|
package/core/types/timer.lua
CHANGED
|
@@ -12,6 +12,11 @@ local ____objectPool = require("util.objectPool")
|
|
|
12
12
|
local ObjectPool = ____objectPool.ObjectPool
|
|
13
13
|
local ____destroyable = require("destroyable")
|
|
14
14
|
local AbstractDestroyable = ____destroyable.AbstractDestroyable
|
|
15
|
+
local ____callback_2Darray = require("utility.callback-array")
|
|
16
|
+
local addCallback = ____callback_2Darray.addCallback
|
|
17
|
+
local callbackArray = ____callback_2Darray.callbackArray
|
|
18
|
+
local consumeCallback = ____callback_2Darray.consumeCallback
|
|
19
|
+
local consumeCallbacks = ____callback_2Darray.consumeCallbacks
|
|
15
20
|
local createTimer = CreateTimer
|
|
16
21
|
local timerStart = TimerStart
|
|
17
22
|
local pauseTimer = PauseTimer
|
|
@@ -49,6 +54,17 @@ local function timerSafeCall()
|
|
|
49
54
|
end
|
|
50
55
|
end
|
|
51
56
|
end
|
|
57
|
+
local zeroTimerScheduled = false
|
|
58
|
+
local zeroTimerCallbacks = callbackArray()
|
|
59
|
+
---
|
|
60
|
+
-- @internal For use by internal systems only.
|
|
61
|
+
____exports.consumeZeroTimerCallback = function(id)
|
|
62
|
+
consumeCallback(zeroTimerCallbacks, id)
|
|
63
|
+
end
|
|
64
|
+
local function invokeZeroTimerCallbacks()
|
|
65
|
+
zeroTimerScheduled = false
|
|
66
|
+
consumeCallbacks(zeroTimerCallbacks)
|
|
67
|
+
end
|
|
52
68
|
____exports.Timer = __TS__Class()
|
|
53
69
|
local Timer = ____exports.Timer
|
|
54
70
|
Timer.name = "Timer"
|
|
@@ -83,10 +99,14 @@ function Timer.create(self)
|
|
|
83
99
|
return __TS__New(____exports.Timer)
|
|
84
100
|
end
|
|
85
101
|
function Timer.run(self, objectOrCallback, keyOrFirstArg, ...)
|
|
102
|
+
if not zeroTimerScheduled then
|
|
103
|
+
zeroTimerScheduled = true
|
|
104
|
+
____exports.Timer:simple(0, invokeZeroTimerCallbacks)
|
|
105
|
+
end
|
|
86
106
|
if ____type(objectOrCallback) == "function" then
|
|
87
|
-
|
|
107
|
+
return addCallback(zeroTimerCallbacks, objectOrCallback, keyOrFirstArg, ...)
|
|
88
108
|
else
|
|
89
|
-
|
|
109
|
+
return addCallback(zeroTimerCallbacks, objectOrCallback[keyOrFirstArg], objectOrCallback, ...)
|
|
90
110
|
end
|
|
91
111
|
end
|
|
92
112
|
function Timer.simple(self, timeout, callback, ...)
|
package/core/types/unit.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import "../../engine/internal/unit";
|
|
3
3
|
import "../../engine/internal/unit/ability";
|
|
4
|
+
import "../../engine/internal/unit/appearance";
|
|
5
|
+
import "../../engine/internal/unit/extended-inventory";
|
|
6
|
+
import "../../engine/internal/unit/equipment-inventory";
|
|
7
|
+
import "../../engine/internal/unit/inventory";
|
|
8
|
+
import "../../engine/internal/unit/item-order-events";
|
|
4
9
|
import "../../engine/internal/unit+damage";
|
|
5
10
|
import "../../engine/internal/unit+rally";
|
|
6
11
|
import "../../engine/internal/unit+spellSteal";
|
package/core/types/unit.lua
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
require("engine.internal.unit")
|
|
3
3
|
require("engine.internal.unit.ability")
|
|
4
|
+
require("engine.internal.unit.appearance")
|
|
5
|
+
require("engine.internal.unit.extended-inventory")
|
|
6
|
+
require("engine.internal.unit.equipment-inventory")
|
|
7
|
+
require("engine.internal.unit.inventory")
|
|
8
|
+
require("engine.internal.unit.item-order-events")
|
|
4
9
|
require("engine.internal.unit+damage")
|
|
5
10
|
require("engine.internal.unit+rally")
|
|
6
11
|
require("engine.internal.unit+spellSteal")
|