warscript 0.0.1-dev.8bfb72f → 0.0.1-dev.8d8d605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attributes.d.ts +6 -0
- package/attributes.lua +17 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- package/core/types/frame.d.ts +1 -0
- package/core/types/frame.lua +136 -58
- 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 +76 -26
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/playerColor.lua +4 -3
- package/core/types/sound.d.ts +18 -25
- package/core/types/sound.lua +113 -33
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/core/util.lua +6 -1
- package/decl/native.d.ts +1718 -964
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/apply-buff.lua +5 -5
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +12 -3
- package/engine/behaviour/ability/damage.lua +40 -49
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +23 -7
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +16 -6
- package/engine/behaviour/ability.lua +67 -21
- package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
- package/engine/behaviour/unit/stun-immunity.lua +57 -31
- package/engine/behaviour/unit.d.ts +41 -2
- package/engine/behaviour/unit.lua +270 -6
- package/engine/buff.d.ts +117 -60
- package/engine/buff.lua +587 -303
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +11 -1
- package/engine/internal/ability.lua +100 -41
- package/engine/internal/item/ability.lua +63 -11
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item+owner.d.ts +1 -0
- package/engine/internal/item+owner.lua +19 -6
- package/engine/internal/item.d.ts +28 -16
- package/engine/internal/item.lua +265 -83
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/object-data/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/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 +35 -0
- package/engine/internal/unit/ability.lua +113 -12
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- 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/bag.d.ts +18 -0
- package/engine/internal/unit/bag.lua +63 -0
- package/engine/internal/unit/bonus.d.ts +6 -0
- package/engine/internal/unit/bonus.lua +33 -3
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment.d.ts +36 -0
- package/engine/internal/unit/equipment.lua +169 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +3 -3
- package/engine/internal/unit/{item.lua → inventory.lua} +25 -26
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit/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.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit+damage.d.ts +11 -11
- package/engine/internal/unit+damage.lua +43 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +42 -25
- package/engine/internal/unit.lua +384 -265
- package/engine/lightning.d.ts +4 -3
- package/engine/lightning.lua +21 -12
- package/engine/local-client.d.ts +27 -0
- package/engine/local-client.lua +343 -54
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/equipment-slot.d.ts +12 -0
- package/engine/object-data/auxiliary/equipment-slot.lua +2 -0
- package/engine/object-data/auxiliary/equipment-type.d.ts +13 -0
- package/engine/object-data/auxiliary/equipment-type.lua +2 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/auxiliary/item-tag.d.ts +12 -0
- package/engine/object-data/auxiliary/item-tag.lua +2 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/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/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/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +42 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/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/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/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/feral-spirit.lua +2 -2
- 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/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/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/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/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/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/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/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/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/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -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 +30 -19
- package/engine/object-data/entry/ability-type.lua +222 -28
- package/engine/object-data/entry/buff-type/applicable.lua +122 -137
- package/engine/object-data/entry/buff-type.d.ts +10 -12
- package/engine/object-data/entry/buff-type.lua +39 -29
- 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 +12 -3
- package/engine/object-data/entry/item-type.lua +56 -4
- package/engine/object-data/entry/lightning-type.d.ts +2 -2
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +71 -6
- package/engine/object-data/entry/unit-type.lua +592 -93
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +19 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-field/ability.d.ts +4 -4
- 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 +72 -3
- package/engine/object-field/unit.lua +268 -7
- package/engine/object-field.d.ts +26 -7
- package/engine/object-field.lua +360 -119
- 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 +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/entries/unit-type.d.ts +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 +12 -0
- package/engine/standard/fields/unit.lua +20 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +250 -10
- package/engine/unit.d.ts +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 -10
- package/objutil/object.lua +1 -1
- package/objutil/unit.lua +8 -0
- 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 +2 -0
- package/utility/arrays.lua +11 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +5 -1
- package/utility/linked-set.lua +49 -1
- package/utility/lua-maps.d.ts +15 -2
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/records.lua +20 -1
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +3 -0
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
- /package/engine/internal/{object-data/armor-increase.d.ts → misc/damage-metadata-by-target.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/lightning.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { LightningTypeId } from "./object-data/entry/lightning-type";
|
|
3
|
-
import { Handle, HandleDestructor } from "../core/types/handle";
|
|
4
3
|
import { Unit } from "../core/types/unit";
|
|
4
|
+
import { AbstractDestroyable, Destructor } from "../destroyable";
|
|
5
5
|
declare const enum LightningPropertyKey {
|
|
6
6
|
CHECK_VISIBILITY = 100,
|
|
7
7
|
SOURCE_UNIT = 101,
|
|
@@ -16,7 +16,8 @@ declare const enum LightningPropertyKey {
|
|
|
16
16
|
FADING = 110
|
|
17
17
|
}
|
|
18
18
|
export type LightningConstructor<T extends Lightning> = typeof Lightning & (new (handle: jlightning, typeId: LightningTypeId) => T);
|
|
19
|
-
export declare class Lightning extends
|
|
19
|
+
export declare class Lightning extends AbstractDestroyable {
|
|
20
|
+
readonly handle: jlightning;
|
|
20
21
|
readonly typeId: LightningTypeId;
|
|
21
22
|
private [LightningPropertyKey.CHECK_VISIBILITY]?;
|
|
22
23
|
private [LightningPropertyKey.SOURCE_UNIT]?;
|
|
@@ -30,7 +31,7 @@ export declare class Lightning extends Handle<jlightning> {
|
|
|
30
31
|
private [LightningPropertyKey.DURATION]?;
|
|
31
32
|
private [LightningPropertyKey.FADING]?;
|
|
32
33
|
constructor(handle: jlightning, typeId: LightningTypeId);
|
|
33
|
-
protected onDestroy():
|
|
34
|
+
protected onDestroy(): Destructor;
|
|
34
35
|
static create<T extends Lightning>(this: LightningConstructor<T>, typeId: LightningTypeId, ...parameters: [
|
|
35
36
|
...checkVisibility: [boolean] | [],
|
|
36
37
|
...sourceAndTarget: [sourceX: number, sourceY: number, targetX: number, targetY: number] | [
|
package/engine/lightning.lua
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
5
|
local ____exports = {}
|
|
5
|
-
local ____handle = require("core.types.handle")
|
|
6
|
-
local Handle = ____handle.Handle
|
|
7
6
|
local ____timer = require("core.types.timer")
|
|
8
7
|
local Timer = ____timer.Timer
|
|
9
8
|
local ____functions = require("utility.functions")
|
|
10
9
|
local forwardByN = ____functions.forwardByN
|
|
11
10
|
local ____unit_2Dmissile_2Ddata = require("engine.internal.unit-missile-data")
|
|
12
11
|
local MISSILE_DATA_BY_UNIT_TYPE_ID = ____unit_2Dmissile_2Ddata.MISSILE_DATA_BY_UNIT_TYPE_ID
|
|
12
|
+
local ____destroyable = require("destroyable")
|
|
13
|
+
local AbstractDestroyable = ____destroyable.AbstractDestroyable
|
|
13
14
|
local ____type = _G.type
|
|
14
15
|
local select = _G.select
|
|
15
16
|
local cos = math.cos
|
|
@@ -41,9 +42,10 @@ local temporaryLightningsCount = 0
|
|
|
41
42
|
____exports.Lightning = __TS__Class()
|
|
42
43
|
local Lightning = ____exports.Lightning
|
|
43
44
|
Lightning.name = "Lightning"
|
|
44
|
-
__TS__ClassExtends(Lightning,
|
|
45
|
+
__TS__ClassExtends(Lightning, AbstractDestroyable)
|
|
45
46
|
function Lightning.prototype.____constructor(self, handle, typeId)
|
|
46
|
-
|
|
47
|
+
AbstractDestroyable.prototype.____constructor(self)
|
|
48
|
+
self.handle = handle
|
|
47
49
|
self.typeId = typeId
|
|
48
50
|
end
|
|
49
51
|
function Lightning.prototype.onDestroy(self)
|
|
@@ -51,7 +53,7 @@ function Lightning.prototype.onDestroy(self)
|
|
|
51
53
|
unitToPointLightnings[self] = nil
|
|
52
54
|
pointToUnitLightnings[self] = nil
|
|
53
55
|
destroyLightning(self.handle)
|
|
54
|
-
return
|
|
56
|
+
return AbstractDestroyable.prototype.onDestroy(self)
|
|
55
57
|
end
|
|
56
58
|
function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY, targetXOrTargetUnitOrTargetYOrTargetZ, targetY, targetZ)
|
|
57
59
|
if type(checkVisibility) ~= "boolean" then
|
|
@@ -67,7 +69,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
67
69
|
)
|
|
68
70
|
end
|
|
69
71
|
if targetZ ~= nil then
|
|
70
|
-
return
|
|
72
|
+
return __TS__New(
|
|
73
|
+
self,
|
|
71
74
|
addLightningEx(
|
|
72
75
|
util.id2s(typeId),
|
|
73
76
|
checkVisibility,
|
|
@@ -84,7 +87,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
84
87
|
if targetXOrTargetUnitOrTargetYOrTargetZ ~= nil then
|
|
85
88
|
if ____type(targetXOrTargetUnitOrTargetYOrTargetZ) == "number" then
|
|
86
89
|
if ____type(sourceXOrSourceUnit) == "number" then
|
|
87
|
-
return
|
|
90
|
+
return __TS__New(
|
|
91
|
+
self,
|
|
88
92
|
addLightning(
|
|
89
93
|
util.id2s(typeId),
|
|
90
94
|
checkVisibility,
|
|
@@ -97,7 +101,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
97
101
|
)
|
|
98
102
|
end
|
|
99
103
|
local unit = sourceXOrSourceUnit.handle
|
|
100
|
-
local lightning =
|
|
104
|
+
local lightning = __TS__New(
|
|
105
|
+
self,
|
|
101
106
|
addLightningEx(
|
|
102
107
|
util.id2s(typeId),
|
|
103
108
|
checkVisibility,
|
|
@@ -122,7 +127,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
122
127
|
return lightning
|
|
123
128
|
end
|
|
124
129
|
local unit = targetXOrTargetUnitOrTargetYOrTargetZ.handle
|
|
125
|
-
local lightning =
|
|
130
|
+
local lightning = __TS__New(
|
|
131
|
+
self,
|
|
126
132
|
addLightningEx(
|
|
127
133
|
util.id2s(typeId),
|
|
128
134
|
checkVisibility,
|
|
@@ -151,7 +157,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
151
157
|
local unit = sourceXOrSourceUnit.handle
|
|
152
158
|
moveLocation(location, sourceYOrTargetXOrTargetUnit, sourceZOrTargetXOrTargetUnitOrTargetY)
|
|
153
159
|
local z = getLocationZ(location)
|
|
154
|
-
local lightning =
|
|
160
|
+
local lightning = __TS__New(
|
|
161
|
+
self,
|
|
155
162
|
addLightningEx(
|
|
156
163
|
util.id2s(typeId),
|
|
157
164
|
checkVisibility,
|
|
@@ -178,7 +185,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
178
185
|
local unit = sourceZOrTargetXOrTargetUnitOrTargetY.handle
|
|
179
186
|
moveLocation(location, sourceXOrSourceUnit, sourceYOrTargetXOrTargetUnit)
|
|
180
187
|
local z = getLocationZ(location)
|
|
181
|
-
local lightning =
|
|
188
|
+
local lightning = __TS__New(
|
|
189
|
+
self,
|
|
182
190
|
addLightningEx(
|
|
183
191
|
util.id2s(typeId),
|
|
184
192
|
checkVisibility,
|
|
@@ -204,7 +212,8 @@ function Lightning.create(self, typeId, checkVisibility, sourceXOrSourceUnit, so
|
|
|
204
212
|
end
|
|
205
213
|
local sourceUnit = sourceXOrSourceUnit.handle
|
|
206
214
|
local targetUnit = sourceYOrTargetXOrTargetUnit.handle
|
|
207
|
-
local lightning =
|
|
215
|
+
local lightning = __TS__New(
|
|
216
|
+
self,
|
|
208
217
|
addLightningEx(
|
|
209
218
|
util.id2s(typeId),
|
|
210
219
|
checkVisibility,
|
package/engine/local-client.d.ts
CHANGED
|
@@ -3,19 +3,46 @@ import { Unit } from "../core/types/unit";
|
|
|
3
3
|
import { Async } from "../core/types/async";
|
|
4
4
|
import { Event, TriggerEvent } from "../event";
|
|
5
5
|
import { GraphicsMode } from "./index";
|
|
6
|
+
import { Color } from "../core/types/color";
|
|
6
7
|
export declare class LocalClient {
|
|
7
8
|
private constructor();
|
|
8
9
|
static readonly locale: string;
|
|
9
10
|
static get width(): number;
|
|
10
11
|
static get height(): number;
|
|
12
|
+
static get isSD(): boolean;
|
|
11
13
|
static get isHD(): boolean;
|
|
14
|
+
static get isDE(): boolean;
|
|
12
15
|
static get graphicsMode(): GraphicsMode;
|
|
13
16
|
static get isActive(): boolean;
|
|
17
|
+
static get isMinimized(): boolean;
|
|
18
|
+
static pingMinimap(x: number, y: number, duration: number, ...parameters: [] | [red: number, green: number, blue: number, flashy?: boolean] | [color: Color, flashy?: boolean]): void;
|
|
19
|
+
/** Local input state; do not use to branch synchronized game logic. */
|
|
20
|
+
static isKeyPressed(key: joskeytype): boolean;
|
|
21
|
+
/** Local input state. Uses the same modifier mask as Player key events. */
|
|
22
|
+
static isMetaKeyPressed(key: oskeymeta): boolean;
|
|
23
|
+
/** Local input state. */
|
|
24
|
+
static isMouseButtonPressed(button: jmousebuttontype): boolean;
|
|
25
|
+
static get mouseScreenX(): number;
|
|
26
|
+
static get mouseScreenY(): number;
|
|
27
|
+
static screenToFrameX(x: number): number;
|
|
28
|
+
static screenToFrameY(y: number): number;
|
|
29
|
+
static frameToScreenX(x: number): number;
|
|
30
|
+
static frameToScreenY(y: number): number;
|
|
31
|
+
static get mouseFrameX(): number;
|
|
32
|
+
static get mouseFrameY(): number;
|
|
14
33
|
static get mouseFocusUnit(): Async<Unit> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Local selection sampled every 1/64 second. Undefined before the first tick and while
|
|
36
|
+
* a group selection's buttons are not registered yet (see `selectionLayoutSocket`).
|
|
37
|
+
*/
|
|
15
38
|
static get mainSelectedUnit(): Async<Unit> | undefined;
|
|
16
39
|
static get mainSelectedUnitChangeEvent(): Event<[
|
|
17
40
|
previousMainSelectedUnit: Unit | undefined,
|
|
18
41
|
newMainSelectedUnit: Unit | undefined
|
|
19
42
|
]>;
|
|
43
|
+
static get isInTargetingMode(): boolean;
|
|
44
|
+
static readonly targetingModeEnterEvent: Event<[]>;
|
|
45
|
+
static readonly targetingModeLeaveEvent: Event<[]>;
|
|
46
|
+
static readonly targetingModeStateChangeEvent: Event<[]>;
|
|
20
47
|
static readonly onDisconnect: TriggerEvent<[]>;
|
|
21
48
|
}
|
package/engine/local-client.lua
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local
|
|
2
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
4
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
4
5
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
5
|
-
local __TS__New = ____lualib.__TS__New
|
|
6
6
|
local ____exports = {}
|
|
7
|
+
local actualizeTargetingModeState
|
|
7
8
|
local ____unit = require("core.types.unit")
|
|
8
9
|
local Unit = ____unit.Unit
|
|
9
10
|
local ____event = require("event")
|
|
@@ -15,31 +16,154 @@ local ____player = require("core.types.player")
|
|
|
15
16
|
local Player = ____player.Player
|
|
16
17
|
local ____timer = require("core.types.timer")
|
|
17
18
|
local Timer = ____timer.Timer
|
|
18
|
-
local
|
|
19
|
-
local
|
|
20
|
-
local
|
|
21
|
-
local
|
|
22
|
-
local
|
|
19
|
+
local ____color = require("core.types.color")
|
|
20
|
+
local Color = ____color.Color
|
|
21
|
+
local ____arrays = require("utility.arrays")
|
|
22
|
+
local array = ____arrays.array
|
|
23
|
+
local ____socket = require("net.socket")
|
|
24
|
+
local Socket = ____socket.Socket
|
|
25
|
+
local frameGetChild = BlzFrameGetChild
|
|
26
|
+
local frameGetChildrenCount = BlzFrameGetChildrenCount
|
|
27
|
+
local frameGetParent = BlzFrameGetParent
|
|
28
|
+
local frameToPixelX = BlzFrameToPixelX
|
|
29
|
+
local frameToPixelY = BlzFrameToPixelY
|
|
30
|
+
local getFrameByName = BlzGetFrameByName
|
|
23
31
|
local getHandleId = GetHandleId
|
|
32
|
+
local getLocalClientHeight = BlzGetLocalClientHeight
|
|
33
|
+
local getLocalClientWidth = BlzGetLocalClientWidth
|
|
34
|
+
local getLocale = BlzGetLocale
|
|
24
35
|
local getMouseFocusUnit = BlzGetMouseFocusUnit
|
|
36
|
+
local getMouseScreenPosX = BlzGetMouseScreenPosX
|
|
37
|
+
local getMouseScreenPosY = BlzGetMouseScreenPosY
|
|
25
38
|
local getUnitRealField = BlzGetUnitRealField
|
|
26
39
|
local getUnitTypeId = GetUnitTypeId
|
|
27
|
-
local
|
|
40
|
+
local isHeroUnitId = IsHeroUnitId
|
|
41
|
+
local isKeyPressed = BlzIsKeyPressed
|
|
42
|
+
local isLocalClientActive = BlzIsLocalClientActive
|
|
43
|
+
local isMetaKeyPressed = BlzIsMetaKeyPressed
|
|
44
|
+
local isMouseButtonPressed = BlzIsMouseButtonPressed
|
|
45
|
+
local loadTOCFile = BlzLoadTOCFile
|
|
46
|
+
local location = Location
|
|
47
|
+
local pingMinimap = PingMinimap
|
|
48
|
+
local pingMinimapEx = PingMinimapEx
|
|
49
|
+
local pixelToFrameX = BlzPixelToFrameX
|
|
50
|
+
local pixelToFrameY = BlzPixelToFrameY
|
|
28
51
|
local tableSort = table.sort
|
|
29
|
-
local
|
|
52
|
+
local hdTocPath = "_warscript\\IsHD.toc"
|
|
53
|
+
local deTocPath = "_warscript\\IsDE.toc"
|
|
30
54
|
compiletime(function()
|
|
31
55
|
if currentMap then
|
|
32
|
-
local
|
|
33
|
-
currentMap:addFileString("_HD.w3mod\\" ..
|
|
34
|
-
currentMap:addFileString("_HD.w3mod\\" ..
|
|
56
|
+
local hdFdfPath = "_warscript\\IsHD.fdf"
|
|
57
|
+
currentMap:addFileString("_HD.w3mod\\" .. hdFdfPath, "\r\n")
|
|
58
|
+
currentMap:addFileString("_HD.w3mod\\" .. hdTocPath, hdFdfPath .. "\r\n")
|
|
59
|
+
local deFdfPath = "_warscript\\IsDE.fdf"
|
|
60
|
+
currentMap:addFileString("_DE.w3mod\\" .. deFdfPath, "\r\n")
|
|
61
|
+
currentMap:addFileString("_DE.w3mod\\" .. deTocPath, deFdfPath .. "\r\n")
|
|
35
62
|
end
|
|
36
63
|
end)
|
|
37
|
-
local
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
local SELECTION_DETAIL_FRAME_NAME = "SimpleInfoPanelUnitDetail"
|
|
65
|
+
local SELECTION_GROUP_PANEL_INDEX = 5
|
|
66
|
+
local SELECTION_BUTTON_ICON_INDEX = 1
|
|
67
|
+
--- The detail panel, its parent, the group panel and the button grid.
|
|
68
|
+
local SELECTION_LAYOUT_ROOT_HANDLE_COUNT = 4
|
|
69
|
+
local SELECTION_LAYOUT_MAX_BUTTON_COUNT = 24
|
|
70
|
+
--- The root frames plus a button and its icon per slot of the largest layout.
|
|
71
|
+
local SELECTION_LAYOUT_MAX_HANDLE_COUNT = SELECTION_LAYOUT_ROOT_HANDLE_COUNT + 2 * SELECTION_LAYOUT_MAX_BUTTON_COUNT
|
|
72
|
+
--- Registration attempts for one local selection before giving up on its layout.
|
|
73
|
+
local SELECTION_LAYOUT_MAX_REQUEST_COUNT = 4
|
|
74
|
+
local function getSelectionButtons()
|
|
75
|
+
return Frame:byName(SELECTION_DETAIL_FRAME_NAME).parent:getChild(SELECTION_GROUP_PANEL_INDEX):getChild(0)
|
|
76
|
+
end
|
|
77
|
+
local function getMainSelectedUnitIndex(selectionButtons, buttonCount)
|
|
78
|
+
local mainSelectedUnitIndex
|
|
79
|
+
local maxButtonWidth = 0
|
|
80
|
+
for i = 0, buttonCount - 1 do
|
|
81
|
+
local width = selectionButtons:getChild(i):getChild(SELECTION_BUTTON_ICON_INDEX).width
|
|
82
|
+
if width > maxButtonWidth then
|
|
83
|
+
maxButtonWidth = width
|
|
84
|
+
mainSelectedUnitIndex = i
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
return mainSelectedUnitIndex
|
|
88
|
+
end
|
|
89
|
+
local function getChildIfPresent(parent, index)
|
|
90
|
+
if parent == nil or index >= frameGetChildrenCount(parent) then
|
|
91
|
+
return nil
|
|
92
|
+
end
|
|
93
|
+
return frameGetChild(parent, index)
|
|
94
|
+
end
|
|
95
|
+
local function padSelectionLayoutFrames(registeredCount)
|
|
96
|
+
do
|
|
97
|
+
local i = registeredCount
|
|
98
|
+
while i < SELECTION_LAYOUT_MAX_HANDLE_COUNT do
|
|
99
|
+
location(0, 0)
|
|
100
|
+
i = i + 1
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
--- Wraps every frame of the group selection layout currently shown on this client, in the
|
|
105
|
+
-- order `actualizeMainSelectedUnit` later walks them. Game-owned frames receive a JASS handle
|
|
106
|
+
-- id the first time a script retrieves them, and the game builds the layout's buttons anew
|
|
107
|
+
-- whenever the selection changes, so this must run in a tick every client shares and register
|
|
108
|
+
-- the same number of handles everywhere: every frame reached for the first time counts, and
|
|
109
|
+
-- the remainder up to SELECTION_LAYOUT_MAX_HANDLE_COUNT is padded with locations, the way
|
|
110
|
+
-- `Frame.byOrigin` balances origin frames that appear asynchronously.
|
|
111
|
+
--
|
|
112
|
+
-- Returns the number of buttons found, or undefined when the layout was not fully reachable.
|
|
113
|
+
local function registerShownSelectionLayoutFrames()
|
|
114
|
+
local registeredCount = 0
|
|
115
|
+
local function register(handle)
|
|
116
|
+
if handle == nil or getHandleId(handle) == 0 then
|
|
117
|
+
return nil
|
|
118
|
+
end
|
|
119
|
+
if not Frame:isWrapped(handle) then
|
|
120
|
+
registeredCount = registeredCount + 1
|
|
121
|
+
end
|
|
122
|
+
Frame:of(handle)
|
|
123
|
+
return handle
|
|
124
|
+
end
|
|
125
|
+
local detail = register(getFrameByName(SELECTION_DETAIL_FRAME_NAME, 0))
|
|
126
|
+
local container = register(detail ~= nil and frameGetParent(detail) or nil)
|
|
127
|
+
local groupPanel = register(getChildIfPresent(container, SELECTION_GROUP_PANEL_INDEX))
|
|
128
|
+
local grid = register(getChildIfPresent(groupPanel, 0))
|
|
129
|
+
local buttonCount
|
|
130
|
+
if grid ~= nil then
|
|
131
|
+
local count = frameGetChildrenCount(grid)
|
|
132
|
+
if count <= SELECTION_LAYOUT_MAX_BUTTON_COUNT then
|
|
133
|
+
buttonCount = count
|
|
134
|
+
for i = 0, count - 1 do
|
|
135
|
+
local button = register(getChildIfPresent(grid, i))
|
|
136
|
+
if register(getChildIfPresent(button, SELECTION_BUTTON_ICON_INDEX)) == nil then
|
|
137
|
+
buttonCount = nil
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
padSelectionLayoutFrames(registeredCount)
|
|
143
|
+
return buttonCount
|
|
144
|
+
end
|
|
145
|
+
local function getExpectedSelectionLayoutButtonCount(selectionCount)
|
|
146
|
+
return selectionCount <= 12 and 12 or SELECTION_LAYOUT_MAX_BUTTON_COUNT
|
|
147
|
+
end
|
|
148
|
+
local selectionLayoutSocket = __TS__New(Socket)
|
|
149
|
+
local localSelectionSignature = 0
|
|
150
|
+
local localSelectionEpoch = 0
|
|
151
|
+
local localSelectionCount = 0
|
|
152
|
+
local registeredSelectionEpoch = 0
|
|
153
|
+
local registeredSelectionButtonCount = 0
|
|
154
|
+
local selectionLayoutRequestCount = 0
|
|
155
|
+
local selectionLayoutRequestPending = false
|
|
156
|
+
selectionLayoutSocket.onMessage:addListener(function(player)
|
|
157
|
+
if player ~= Player["local"] then
|
|
158
|
+
padSelectionLayoutFrames(0)
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
selectionLayoutRequestPending = false
|
|
162
|
+
local buttonCount = registerShownSelectionLayoutFrames()
|
|
163
|
+
if buttonCount ~= nil and localSelectionCount > 1 and buttonCount == getExpectedSelectionLayoutButtonCount(localSelectionCount) then
|
|
164
|
+
registeredSelectionEpoch = localSelectionEpoch
|
|
165
|
+
registeredSelectionButtonCount = buttonCount
|
|
166
|
+
end
|
|
43
167
|
end)
|
|
44
168
|
local localSelectedUnits = {}
|
|
45
169
|
local indexByLocalSelectedUnit = {}
|
|
@@ -57,11 +181,62 @@ local function compareUnitsSelectionPriority(a, b)
|
|
|
57
181
|
end
|
|
58
182
|
local mainSelectedUnitChangeEvent
|
|
59
183
|
local previousMainSelectedUnit
|
|
184
|
+
local currentMainSelectedUnit
|
|
185
|
+
local lastTargetingModeState = false
|
|
186
|
+
local targetingModeEnterEvent = __TS__New(Event)
|
|
187
|
+
local targetingModeLeaveEvent = __TS__New(Event)
|
|
188
|
+
local targetingModeStateChangeEvent = __TS__New(Event)
|
|
60
189
|
____exports.LocalClient = __TS__Class()
|
|
61
190
|
local LocalClient = ____exports.LocalClient
|
|
62
191
|
LocalClient.name = "LocalClient"
|
|
63
192
|
function LocalClient.prototype.____constructor(self)
|
|
64
193
|
end
|
|
194
|
+
function LocalClient.pingMinimap(self, x, y, duration, redOrColor, greenOrFlashy, blue, flashy)
|
|
195
|
+
if redOrColor == nil then
|
|
196
|
+
pingMinimap(x, y, duration)
|
|
197
|
+
elseif __TS__InstanceOf(redOrColor, Color) then
|
|
198
|
+
pingMinimapEx(
|
|
199
|
+
x,
|
|
200
|
+
y,
|
|
201
|
+
duration,
|
|
202
|
+
redOrColor.r,
|
|
203
|
+
redOrColor.g,
|
|
204
|
+
redOrColor.b,
|
|
205
|
+
greenOrFlashy or false
|
|
206
|
+
)
|
|
207
|
+
else
|
|
208
|
+
pingMinimapEx(
|
|
209
|
+
x,
|
|
210
|
+
y,
|
|
211
|
+
duration,
|
|
212
|
+
redOrColor,
|
|
213
|
+
greenOrFlashy,
|
|
214
|
+
blue,
|
|
215
|
+
flashy or false
|
|
216
|
+
)
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
function LocalClient.isKeyPressed(self, key)
|
|
220
|
+
return isKeyPressed(key)
|
|
221
|
+
end
|
|
222
|
+
function LocalClient.isMetaKeyPressed(self, key)
|
|
223
|
+
return isMetaKeyPressed(key)
|
|
224
|
+
end
|
|
225
|
+
function LocalClient.isMouseButtonPressed(self, button)
|
|
226
|
+
return isMouseButtonPressed(button)
|
|
227
|
+
end
|
|
228
|
+
function LocalClient.screenToFrameX(self, x)
|
|
229
|
+
return pixelToFrameX(x)
|
|
230
|
+
end
|
|
231
|
+
function LocalClient.screenToFrameY(self, y)
|
|
232
|
+
return pixelToFrameY(y)
|
|
233
|
+
end
|
|
234
|
+
function LocalClient.frameToScreenX(self, x)
|
|
235
|
+
return frameToPixelX(x)
|
|
236
|
+
end
|
|
237
|
+
function LocalClient.frameToScreenY(self, y)
|
|
238
|
+
return frameToPixelY(y)
|
|
239
|
+
end
|
|
65
240
|
LocalClient.locale = getLocale()
|
|
66
241
|
__TS__ObjectDefineProperty(
|
|
67
242
|
LocalClient,
|
|
@@ -77,6 +252,13 @@ __TS__ObjectDefineProperty(
|
|
|
77
252
|
return getLocalClientHeight()
|
|
78
253
|
end}
|
|
79
254
|
)
|
|
255
|
+
__TS__ObjectDefineProperty(
|
|
256
|
+
LocalClient,
|
|
257
|
+
"isSD",
|
|
258
|
+
{get = function(self)
|
|
259
|
+
return true
|
|
260
|
+
end}
|
|
261
|
+
)
|
|
80
262
|
__TS__ObjectDefineProperty(
|
|
81
263
|
LocalClient,
|
|
82
264
|
"isHD",
|
|
@@ -84,11 +266,18 @@ __TS__ObjectDefineProperty(
|
|
|
84
266
|
return false
|
|
85
267
|
end}
|
|
86
268
|
)
|
|
269
|
+
__TS__ObjectDefineProperty(
|
|
270
|
+
LocalClient,
|
|
271
|
+
"isDE",
|
|
272
|
+
{get = function(self)
|
|
273
|
+
return false
|
|
274
|
+
end}
|
|
275
|
+
)
|
|
87
276
|
__TS__ObjectDefineProperty(
|
|
88
277
|
LocalClient,
|
|
89
278
|
"graphicsMode",
|
|
90
279
|
{get = function(self)
|
|
91
|
-
return
|
|
280
|
+
return 0
|
|
92
281
|
end}
|
|
93
282
|
)
|
|
94
283
|
__TS__ObjectDefineProperty(
|
|
@@ -98,6 +287,41 @@ __TS__ObjectDefineProperty(
|
|
|
98
287
|
return isLocalClientActive()
|
|
99
288
|
end}
|
|
100
289
|
)
|
|
290
|
+
__TS__ObjectDefineProperty(
|
|
291
|
+
LocalClient,
|
|
292
|
+
"isMinimized",
|
|
293
|
+
{get = function(self)
|
|
294
|
+
return getLocalClientHeight() == 0
|
|
295
|
+
end}
|
|
296
|
+
)
|
|
297
|
+
__TS__ObjectDefineProperty(
|
|
298
|
+
LocalClient,
|
|
299
|
+
"mouseScreenX",
|
|
300
|
+
{get = function(self)
|
|
301
|
+
return getMouseScreenPosX()
|
|
302
|
+
end}
|
|
303
|
+
)
|
|
304
|
+
__TS__ObjectDefineProperty(
|
|
305
|
+
LocalClient,
|
|
306
|
+
"mouseScreenY",
|
|
307
|
+
{get = function(self)
|
|
308
|
+
return getMouseScreenPosY()
|
|
309
|
+
end}
|
|
310
|
+
)
|
|
311
|
+
__TS__ObjectDefineProperty(
|
|
312
|
+
LocalClient,
|
|
313
|
+
"mouseFrameX",
|
|
314
|
+
{get = function(self)
|
|
315
|
+
return pixelToFrameX(getMouseScreenPosX())
|
|
316
|
+
end}
|
|
317
|
+
)
|
|
318
|
+
__TS__ObjectDefineProperty(
|
|
319
|
+
LocalClient,
|
|
320
|
+
"mouseFrameY",
|
|
321
|
+
{get = function(self)
|
|
322
|
+
return pixelToFrameY(getMouseScreenPosY())
|
|
323
|
+
end}
|
|
324
|
+
)
|
|
101
325
|
__TS__ObjectDefineProperty(
|
|
102
326
|
LocalClient,
|
|
103
327
|
"mouseFocusUnit",
|
|
@@ -109,33 +333,7 @@ __TS__ObjectDefineProperty(
|
|
|
109
333
|
LocalClient,
|
|
110
334
|
"mainSelectedUnit",
|
|
111
335
|
{get = function(self)
|
|
112
|
-
|
|
113
|
-
for i = 1, #localSelectedUnits do
|
|
114
|
-
indexByLocalSelectedUnit[localSelectedUnits[i]] = i
|
|
115
|
-
end
|
|
116
|
-
tableSort(localSelectedUnits, compareUnitsSelectionPriority)
|
|
117
|
-
local mainSelectedUnitIndex
|
|
118
|
-
if selectionButtons and #localSelectedUnits > 1 then
|
|
119
|
-
local maxButtonWidth = 0
|
|
120
|
-
for i = 0, #selectionButtons - 1 do
|
|
121
|
-
local width = selectionButtons[i + 1].width
|
|
122
|
-
if width > maxButtonWidth then
|
|
123
|
-
maxButtonWidth = width
|
|
124
|
-
mainSelectedUnitIndex = i
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
local mainSelectedUnit = localSelectedUnits[(mainSelectedUnitIndex or 0) + 1]
|
|
129
|
-
for i = 1, #localSelectedUnits do
|
|
130
|
-
indexByLocalSelectedUnit[localSelectedUnits[i]] = nil
|
|
131
|
-
localSelectedUnits[i] = nil
|
|
132
|
-
end
|
|
133
|
-
if mainSelectedUnitChangeEvent ~= nil and mainSelectedUnit ~= previousMainSelectedUnit then
|
|
134
|
-
local previousPreviousMainSelectedUnit = previousMainSelectedUnit
|
|
135
|
-
previousMainSelectedUnit = mainSelectedUnit
|
|
136
|
-
Event.invoke(mainSelectedUnitChangeEvent, previousPreviousMainSelectedUnit, previousMainSelectedUnit)
|
|
137
|
-
end
|
|
138
|
-
return mainSelectedUnit
|
|
336
|
+
return currentMainSelectedUnit
|
|
139
337
|
end}
|
|
140
338
|
)
|
|
141
339
|
__TS__ObjectDefineProperty(
|
|
@@ -144,13 +342,20 @@ __TS__ObjectDefineProperty(
|
|
|
144
342
|
{get = function(self)
|
|
145
343
|
if mainSelectedUnitChangeEvent == nil then
|
|
146
344
|
mainSelectedUnitChangeEvent = __TS__New(Event)
|
|
147
|
-
Timer.onPeriod[1 / 64]:addListener(function()
|
|
148
|
-
local _ = ____exports.LocalClient.mainSelectedUnit
|
|
149
|
-
end)
|
|
150
345
|
end
|
|
151
346
|
return mainSelectedUnitChangeEvent
|
|
152
347
|
end}
|
|
153
348
|
)
|
|
349
|
+
__TS__ObjectDefineProperty(
|
|
350
|
+
LocalClient,
|
|
351
|
+
"isInTargetingMode",
|
|
352
|
+
{get = function(self)
|
|
353
|
+
return actualizeTargetingModeState()
|
|
354
|
+
end}
|
|
355
|
+
)
|
|
356
|
+
LocalClient.targetingModeEnterEvent = targetingModeEnterEvent
|
|
357
|
+
LocalClient.targetingModeLeaveEvent = targetingModeLeaveEvent
|
|
358
|
+
LocalClient.targetingModeStateChangeEvent = targetingModeStateChangeEvent
|
|
154
359
|
LocalClient.onDisconnect = __TS__New(
|
|
155
360
|
TriggerEvent,
|
|
156
361
|
function(trigger)
|
|
@@ -158,11 +363,95 @@ LocalClient.onDisconnect = __TS__New(
|
|
|
158
363
|
end,
|
|
159
364
|
function() return end
|
|
160
365
|
)
|
|
366
|
+
local function actualizeMainSelectedUnit()
|
|
367
|
+
Unit:getSelectionOf(Player["local"], localSelectedUnits)
|
|
368
|
+
local selectionCount = #localSelectedUnits
|
|
369
|
+
local signature = selectionCount
|
|
370
|
+
for i = 1, selectionCount do
|
|
371
|
+
indexByLocalSelectedUnit[localSelectedUnits[i]] = i
|
|
372
|
+
signature = signature + getHandleId(localSelectedUnits[i].handle)
|
|
373
|
+
end
|
|
374
|
+
if signature ~= localSelectionSignature then
|
|
375
|
+
localSelectionSignature = signature
|
|
376
|
+
localSelectionEpoch = localSelectionEpoch + 1
|
|
377
|
+
selectionLayoutRequestCount = 0
|
|
378
|
+
end
|
|
379
|
+
localSelectionCount = selectionCount
|
|
380
|
+
tableSort(localSelectedUnits, compareUnitsSelectionPriority)
|
|
381
|
+
local mainSelectedUnitIndex
|
|
382
|
+
if selectionCount > 1 then
|
|
383
|
+
local registered = registeredSelectionEpoch == localSelectionEpoch
|
|
384
|
+
if registered then
|
|
385
|
+
local selectionButtons = getSelectionButtons()
|
|
386
|
+
if selectionButtons:getChildrenCount() == registeredSelectionButtonCount then
|
|
387
|
+
mainSelectedUnitIndex = getMainSelectedUnitIndex(selectionButtons, registeredSelectionButtonCount)
|
|
388
|
+
else
|
|
389
|
+
registered = false
|
|
390
|
+
registeredSelectionEpoch = 0
|
|
391
|
+
selectionLayoutRequestCount = 0
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
if not registered and not selectionLayoutRequestPending and selectionLayoutRequestCount < SELECTION_LAYOUT_MAX_REQUEST_COUNT then
|
|
395
|
+
selectionLayoutRequestPending = true
|
|
396
|
+
selectionLayoutRequestCount = selectionLayoutRequestCount + 1
|
|
397
|
+
selectionLayoutSocket:send("")
|
|
398
|
+
end
|
|
399
|
+
end
|
|
400
|
+
local mainSelectedUnit
|
|
401
|
+
if selectionCount <= 1 then
|
|
402
|
+
mainSelectedUnit = localSelectedUnits[1]
|
|
403
|
+
elseif registeredSelectionEpoch == localSelectionEpoch then
|
|
404
|
+
mainSelectedUnit = localSelectedUnits[(mainSelectedUnitIndex or 0) + 1]
|
|
405
|
+
end
|
|
406
|
+
for i = 1, selectionCount do
|
|
407
|
+
indexByLocalSelectedUnit[localSelectedUnits[i]] = nil
|
|
408
|
+
localSelectedUnits[i] = nil
|
|
409
|
+
end
|
|
410
|
+
currentMainSelectedUnit = mainSelectedUnit
|
|
411
|
+
if mainSelectedUnitChangeEvent ~= nil and mainSelectedUnit ~= previousMainSelectedUnit then
|
|
412
|
+
local previousPreviousMainSelectedUnit = previousMainSelectedUnit
|
|
413
|
+
previousMainSelectedUnit = mainSelectedUnit
|
|
414
|
+
Event.invoke(mainSelectedUnitChangeEvent, previousPreviousMainSelectedUnit, previousMainSelectedUnit)
|
|
415
|
+
end
|
|
416
|
+
end
|
|
417
|
+
local commandButtons = array(
|
|
418
|
+
12,
|
|
419
|
+
function(i) return Frame:byOrigin(ORIGIN_FRAME_COMMAND_BUTTON, i) end
|
|
420
|
+
)
|
|
421
|
+
local function getTargetingModeState()
|
|
422
|
+
for i = 0, 10 do
|
|
423
|
+
if commandButtons[i + 1].visible then
|
|
424
|
+
return false
|
|
425
|
+
end
|
|
426
|
+
end
|
|
427
|
+
return commandButtons[12].visible
|
|
428
|
+
end
|
|
429
|
+
actualizeTargetingModeState = function()
|
|
430
|
+
if getTargetingModeState() then
|
|
431
|
+
if not lastTargetingModeState then
|
|
432
|
+
lastTargetingModeState = true
|
|
433
|
+
Event.invoke(targetingModeEnterEvent)
|
|
434
|
+
Event.invoke(targetingModeStateChangeEvent)
|
|
435
|
+
end
|
|
436
|
+
return true
|
|
437
|
+
end
|
|
438
|
+
if lastTargetingModeState then
|
|
439
|
+
lastTargetingModeState = false
|
|
440
|
+
Event.invoke(targetingModeLeaveEvent)
|
|
441
|
+
Event.invoke(targetingModeStateChangeEvent)
|
|
442
|
+
end
|
|
443
|
+
return false
|
|
444
|
+
end
|
|
445
|
+
Timer.onPeriod[1 / 64]:addListener(function()
|
|
446
|
+
actualizeMainSelectedUnit()
|
|
447
|
+
actualizeTargetingModeState()
|
|
448
|
+
end)
|
|
161
449
|
warpack.afterMapInit(function()
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
)
|
|
450
|
+
local isDE = loadTOCFile(deTocPath)
|
|
451
|
+
local isHD = not isDE and loadTOCFile(hdTocPath)
|
|
452
|
+
rawset(____exports.LocalClient, "isDE", isDE)
|
|
453
|
+
rawset(____exports.LocalClient, "isHD", isHD)
|
|
454
|
+
rawset(____exports.LocalClient, "isSD", not isDE and not isHD)
|
|
455
|
+
rawset(____exports.LocalClient, "graphicsMode", isDE and 2 or (isHD and 1 or 0))
|
|
167
456
|
end)
|
|
168
457
|
return ____exports
|
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
local animationNames = {
|
|
3
|
+
attack = true,
|
|
4
|
+
birth = true,
|
|
5
|
+
death = true,
|
|
6
|
+
decay = true,
|
|
7
|
+
dissipate = true,
|
|
8
|
+
morph = true,
|
|
9
|
+
portrait = true,
|
|
10
|
+
sleep = true,
|
|
11
|
+
spell = true,
|
|
12
|
+
stand = true,
|
|
13
|
+
walk = true
|
|
14
|
+
}
|
|
15
|
+
____exports.isAnimationName = function(value)
|
|
16
|
+
return animationNames[value] ~= nil
|
|
17
|
+
end
|
|
2
18
|
return ____exports
|