warscript 0.0.1-dev.6912057 → 0.0.1-dev.69b6655
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/types/frame.d.ts +1 -0
- package/core/types/frame.lua +136 -58
- package/core/types/handle.lua +6 -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 +1 -1
- package/core/types/sound.lua +14 -9
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -2
- package/core/types/timer.lua +22 -2
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/decl/native.d.ts +711 -11
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -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/damage.d.ts +3 -0
- package/engine/behaviour/ability/damage.lua +18 -15
- package/engine/behaviour/ability/emulate-impact.lua +5 -4
- 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 +12 -6
- package/engine/behaviour/ability.lua +42 -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 +7 -1
- package/engine/internal/ability.lua +78 -42
- 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 +23 -14
- package/engine/internal/item.lua +169 -82
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- 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 +14 -14
- package/engine/internal/unit/ability.lua +86 -47
- 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/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 +9 -0
- package/engine/internal/unit+damage.lua +33 -0
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +17 -22
- package/engine/internal/unit.lua +180 -206
- package/engine/local-client.d.ts +27 -0
- package/engine/local-client.lua +394 -54
- 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/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/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/banshee.d.ts +8 -0
- package/engine/object-data/entry/ability-type/banshee.lua +13 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.lua +27 -0
- package/engine/object-data/entry/ability-type/banshees-wail.d.ts +31 -0
- package/engine/object-data/entry/ability-type/banshees-wail.lua +117 -0
- package/engine/object-data/entry/ability-type/battering-ram.d.ts +33 -0
- package/engine/object-data/entry/ability-type/battering-ram.lua +130 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +30 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.d.ts +27 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
- package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
- package/engine/object-data/entry/ability-type/consecration.lua +52 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
- package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment.lua +27 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
- package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
- package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
- package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
- package/engine/object-data/entry/ability-type/grit.lua +65 -0
- package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
- package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
- package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
- package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → healing-modifier.d.ts} +4 -3
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/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/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.d.ts +9 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.lua +26 -0
- package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
- package/engine/object-data/entry/ability-type/resolve.d.ts +12 -0
- package/engine/object-data/entry/ability-type/resolve.lua +39 -0
- package/engine/object-data/entry/ability-type/righteous-fury.d.ts +33 -0
- package/engine/object-data/entry/ability-type/righteous-fury.lua +130 -0
- package/engine/object-data/entry/ability-type/sacred-aura.d.ts +27 -0
- package/engine/object-data/entry/ability-type/sacred-aura.lua +104 -0
- package/engine/object-data/entry/ability-type/soul-lantern.d.ts +30 -0
- package/engine/object-data/entry/ability-type/soul-lantern.lua +117 -0
- package/engine/object-data/entry/ability-type/spell-amp.d.ts +15 -0
- package/engine/object-data/entry/ability-type/spell-amp.lua +52 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.lua +39 -0
- package/engine/object-data/entry/ability-type/spell-vamp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-vamp.lua +39 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.d.ts +21 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.lua +78 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.lua +26 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.lua +13 -0
- package/engine/object-data/entry/ability-type/stat-details.d.ts +12 -0
- package/engine/object-data/entry/ability-type/stat-details.lua +27 -0
- package/engine/object-data/entry/ability-type/surge-of-light.d.ts +33 -0
- package/engine/object-data/entry/ability-type/surge-of-light.lua +130 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.d.ts +57 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.lua +234 -0
- package/engine/object-data/entry/ability-type/talents.d.ts +12 -0
- package/engine/object-data/entry/ability-type/talents.lua +27 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.d.ts +30 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.lua +117 -0
- package/engine/object-data/entry/ability-type/valiant-charge.d.ts +27 -0
- package/engine/object-data/entry/ability-type/valiant-charge.lua +104 -0
- package/engine/object-data/entry/ability-type/warcry.d.ts +9 -0
- package/engine/object-data/entry/ability-type/warcry.lua +26 -0
- package/engine/object-data/entry/ability-type/withering-fire.d.ts +21 -0
- package/engine/object-data/entry/ability-type/withering-fire.lua +78 -0
- package/engine/object-data/entry/ability-type.d.ts +12 -3
- package/engine/object-data/entry/ability-type.lua +141 -5
- package/engine/object-data/entry/buff-type/applicable.lua +113 -109
- package/engine/object-data/entry/buff-type.d.ts +6 -2
- package/engine/object-data/entry/buff-type.lua +26 -0
- package/engine/object-data/entry/destructible-type.d.ts +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 +52 -0
- package/engine/object-data/entry/lightning-type.d.ts +2 -2
- package/engine/object-data/entry/sound-preset.d.ts +2 -2
- package/engine/object-data/entry/unit-type.d.ts +62 -4
- package/engine/object-data/entry/unit-type.lua +474 -38
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry.d.ts +4 -1
- 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/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/unit-type.d.ts +5 -0
- package/engine/standard/entries/unit-type.lua +5 -0
- package/engine/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.d.ts +1 -1
- package/engine/text-tag.lua +92 -17
- package/engine/unit.d.ts +9 -1
- package/engine/unit.lua +9 -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 +10 -8
- package/objutil/object.lua +1 -1
- package/operation.d.ts +8 -1
- package/operation.lua +38 -18
- package/package.json +3 -23
- package/patch-lua.lua +15 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +2 -0
- package/utility/functions.lua +7 -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/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -0
- 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/{object-data/armor-increase.d.ts → misc/frame-coordinates.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/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
|
|
36
|
+
* or until startup selection-frame initialization has finished.
|
|
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,11 @@
|
|
|
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
|
|
6
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
7
|
local ____exports = {}
|
|
8
|
+
local actualizeTargetingModeState
|
|
7
9
|
local ____unit = require("core.types.unit")
|
|
8
10
|
local Unit = ____unit.Unit
|
|
9
11
|
local ____event = require("event")
|
|
@@ -15,32 +17,80 @@ local ____player = require("core.types.player")
|
|
|
15
17
|
local Player = ____player.Player
|
|
16
18
|
local ____timer = require("core.types.timer")
|
|
17
19
|
local Timer = ____timer.Timer
|
|
18
|
-
local
|
|
19
|
-
local
|
|
20
|
-
local
|
|
21
|
-
local
|
|
22
|
-
local
|
|
20
|
+
local ____color = require("core.types.color")
|
|
21
|
+
local Color = ____color.Color
|
|
22
|
+
local ____arrays = require("utility.arrays")
|
|
23
|
+
local array = ____arrays.array
|
|
24
|
+
local ____unit = require("objutil.unit")
|
|
25
|
+
local UnitDefinition = ____unit.UnitDefinition
|
|
26
|
+
local ____socket = require("net.socket")
|
|
27
|
+
local Socket = ____socket.Socket
|
|
28
|
+
local frameToPixelX = BlzFrameToPixelX
|
|
29
|
+
local frameToPixelY = BlzFrameToPixelY
|
|
23
30
|
local getHandleId = GetHandleId
|
|
31
|
+
local getLocalClientHeight = BlzGetLocalClientHeight
|
|
32
|
+
local getLocalClientWidth = BlzGetLocalClientWidth
|
|
33
|
+
local getLocale = BlzGetLocale
|
|
24
34
|
local getMouseFocusUnit = BlzGetMouseFocusUnit
|
|
35
|
+
local getMouseScreenPosX = BlzGetMouseScreenPosX
|
|
36
|
+
local getMouseScreenPosY = BlzGetMouseScreenPosY
|
|
25
37
|
local getUnitRealField = BlzGetUnitRealField
|
|
26
38
|
local getUnitTypeId = GetUnitTypeId
|
|
27
|
-
local
|
|
39
|
+
local isHeroUnitId = IsHeroUnitId
|
|
40
|
+
local isKeyPressed = BlzIsKeyPressed
|
|
41
|
+
local isLocalClientActive = BlzIsLocalClientActive
|
|
42
|
+
local isMetaKeyPressed = BlzIsMetaKeyPressed
|
|
43
|
+
local isMouseButtonPressed = BlzIsMouseButtonPressed
|
|
44
|
+
local loadTOCFile = BlzLoadTOCFile
|
|
45
|
+
local pingMinimap = PingMinimap
|
|
46
|
+
local pingMinimapEx = PingMinimapEx
|
|
47
|
+
local pixelToFrameX = BlzPixelToFrameX
|
|
48
|
+
local pixelToFrameY = BlzPixelToFrameY
|
|
28
49
|
local tableSort = table.sort
|
|
29
|
-
local
|
|
50
|
+
local hdTocPath = "_warscript\\IsHD.toc"
|
|
51
|
+
local deTocPath = "_warscript\\IsDE.toc"
|
|
30
52
|
compiletime(function()
|
|
31
53
|
if currentMap then
|
|
32
|
-
local
|
|
33
|
-
currentMap:addFileString("_HD.w3mod\\" ..
|
|
34
|
-
currentMap:addFileString("_HD.w3mod\\" ..
|
|
54
|
+
local hdFdfPath = "_warscript\\IsHD.fdf"
|
|
55
|
+
currentMap:addFileString("_HD.w3mod\\" .. hdFdfPath, "\r\n")
|
|
56
|
+
currentMap:addFileString("_HD.w3mod\\" .. hdTocPath, hdFdfPath .. "\r\n")
|
|
57
|
+
local deFdfPath = "_warscript\\IsDE.fdf"
|
|
58
|
+
currentMap:addFileString("_DE.w3mod\\" .. deFdfPath, "\r\n")
|
|
59
|
+
currentMap:addFileString("_DE.w3mod\\" .. deTocPath, deFdfPath .. "\r\n")
|
|
35
60
|
end
|
|
36
61
|
end)
|
|
37
|
-
local
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
local selectionWarmupUnitTypeId = compiletime(function()
|
|
63
|
+
local dummy = __TS__New(UnitDefinition, "hfoo", nil, {
|
|
64
|
+
name = "[Warscript/Selection Warmup] Unit",
|
|
65
|
+
model = "",
|
|
66
|
+
modelHD = "",
|
|
67
|
+
foodCost = 0,
|
|
68
|
+
movementType = "none",
|
|
69
|
+
collisionSize = 0,
|
|
70
|
+
selectionScale = 0,
|
|
71
|
+
sightRadiusDay = 0,
|
|
72
|
+
sightRadiusNight = 0,
|
|
73
|
+
abilitiesNormal = {"Avul"}
|
|
74
|
+
})
|
|
75
|
+
dummy.weapons[1].enabled = false
|
|
76
|
+
dummy.weapons[2].enabled = false
|
|
77
|
+
return fourCC(dummy.id)
|
|
43
78
|
end)
|
|
79
|
+
local function getSelectionButtons()
|
|
80
|
+
return Frame:byName("SimpleInfoPanelUnitDetail").parent:getChild(5):getChild(0)
|
|
81
|
+
end
|
|
82
|
+
local function getMainSelectedUnitIndex(selectionButtons, buttonCount)
|
|
83
|
+
local mainSelectedUnitIndex
|
|
84
|
+
local maxButtonWidth = 0
|
|
85
|
+
for i = 0, buttonCount - 1 do
|
|
86
|
+
local width = selectionButtons:getChild(i):getChild(1).width
|
|
87
|
+
if width > maxButtonWidth then
|
|
88
|
+
maxButtonWidth = width
|
|
89
|
+
mainSelectedUnitIndex = i
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
return mainSelectedUnitIndex
|
|
93
|
+
end
|
|
44
94
|
local localSelectedUnits = {}
|
|
45
95
|
local indexByLocalSelectedUnit = {}
|
|
46
96
|
local function compareUnitsSelectionPriority(a, b)
|
|
@@ -57,11 +107,62 @@ local function compareUnitsSelectionPriority(a, b)
|
|
|
57
107
|
end
|
|
58
108
|
local mainSelectedUnitChangeEvent
|
|
59
109
|
local previousMainSelectedUnit
|
|
110
|
+
local currentMainSelectedUnit
|
|
111
|
+
local lastTargetingModeState = false
|
|
112
|
+
local targetingModeEnterEvent = __TS__New(Event)
|
|
113
|
+
local targetingModeLeaveEvent = __TS__New(Event)
|
|
114
|
+
local targetingModeStateChangeEvent = __TS__New(Event)
|
|
60
115
|
____exports.LocalClient = __TS__Class()
|
|
61
116
|
local LocalClient = ____exports.LocalClient
|
|
62
117
|
LocalClient.name = "LocalClient"
|
|
63
118
|
function LocalClient.prototype.____constructor(self)
|
|
64
119
|
end
|
|
120
|
+
function LocalClient.pingMinimap(self, x, y, duration, redOrColor, greenOrFlashy, blue, flashy)
|
|
121
|
+
if redOrColor == nil then
|
|
122
|
+
pingMinimap(x, y, duration)
|
|
123
|
+
elseif __TS__InstanceOf(redOrColor, Color) then
|
|
124
|
+
pingMinimapEx(
|
|
125
|
+
x,
|
|
126
|
+
y,
|
|
127
|
+
duration,
|
|
128
|
+
redOrColor.r,
|
|
129
|
+
redOrColor.g,
|
|
130
|
+
redOrColor.b,
|
|
131
|
+
greenOrFlashy or false
|
|
132
|
+
)
|
|
133
|
+
else
|
|
134
|
+
pingMinimapEx(
|
|
135
|
+
x,
|
|
136
|
+
y,
|
|
137
|
+
duration,
|
|
138
|
+
redOrColor,
|
|
139
|
+
greenOrFlashy,
|
|
140
|
+
blue,
|
|
141
|
+
flashy or false
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
function LocalClient.isKeyPressed(self, key)
|
|
146
|
+
return isKeyPressed(key)
|
|
147
|
+
end
|
|
148
|
+
function LocalClient.isMetaKeyPressed(self, key)
|
|
149
|
+
return isMetaKeyPressed(key)
|
|
150
|
+
end
|
|
151
|
+
function LocalClient.isMouseButtonPressed(self, button)
|
|
152
|
+
return isMouseButtonPressed(button)
|
|
153
|
+
end
|
|
154
|
+
function LocalClient.screenToFrameX(self, x)
|
|
155
|
+
return pixelToFrameX(x)
|
|
156
|
+
end
|
|
157
|
+
function LocalClient.screenToFrameY(self, y)
|
|
158
|
+
return pixelToFrameY(y)
|
|
159
|
+
end
|
|
160
|
+
function LocalClient.frameToScreenX(self, x)
|
|
161
|
+
return frameToPixelX(x)
|
|
162
|
+
end
|
|
163
|
+
function LocalClient.frameToScreenY(self, y)
|
|
164
|
+
return frameToPixelY(y)
|
|
165
|
+
end
|
|
65
166
|
LocalClient.locale = getLocale()
|
|
66
167
|
__TS__ObjectDefineProperty(
|
|
67
168
|
LocalClient,
|
|
@@ -77,6 +178,13 @@ __TS__ObjectDefineProperty(
|
|
|
77
178
|
return getLocalClientHeight()
|
|
78
179
|
end}
|
|
79
180
|
)
|
|
181
|
+
__TS__ObjectDefineProperty(
|
|
182
|
+
LocalClient,
|
|
183
|
+
"isSD",
|
|
184
|
+
{get = function(self)
|
|
185
|
+
return true
|
|
186
|
+
end}
|
|
187
|
+
)
|
|
80
188
|
__TS__ObjectDefineProperty(
|
|
81
189
|
LocalClient,
|
|
82
190
|
"isHD",
|
|
@@ -84,11 +192,18 @@ __TS__ObjectDefineProperty(
|
|
|
84
192
|
return false
|
|
85
193
|
end}
|
|
86
194
|
)
|
|
195
|
+
__TS__ObjectDefineProperty(
|
|
196
|
+
LocalClient,
|
|
197
|
+
"isDE",
|
|
198
|
+
{get = function(self)
|
|
199
|
+
return false
|
|
200
|
+
end}
|
|
201
|
+
)
|
|
87
202
|
__TS__ObjectDefineProperty(
|
|
88
203
|
LocalClient,
|
|
89
204
|
"graphicsMode",
|
|
90
205
|
{get = function(self)
|
|
91
|
-
return
|
|
206
|
+
return 0
|
|
92
207
|
end}
|
|
93
208
|
)
|
|
94
209
|
__TS__ObjectDefineProperty(
|
|
@@ -98,6 +213,41 @@ __TS__ObjectDefineProperty(
|
|
|
98
213
|
return isLocalClientActive()
|
|
99
214
|
end}
|
|
100
215
|
)
|
|
216
|
+
__TS__ObjectDefineProperty(
|
|
217
|
+
LocalClient,
|
|
218
|
+
"isMinimized",
|
|
219
|
+
{get = function(self)
|
|
220
|
+
return getLocalClientHeight() == 0
|
|
221
|
+
end}
|
|
222
|
+
)
|
|
223
|
+
__TS__ObjectDefineProperty(
|
|
224
|
+
LocalClient,
|
|
225
|
+
"mouseScreenX",
|
|
226
|
+
{get = function(self)
|
|
227
|
+
return getMouseScreenPosX()
|
|
228
|
+
end}
|
|
229
|
+
)
|
|
230
|
+
__TS__ObjectDefineProperty(
|
|
231
|
+
LocalClient,
|
|
232
|
+
"mouseScreenY",
|
|
233
|
+
{get = function(self)
|
|
234
|
+
return getMouseScreenPosY()
|
|
235
|
+
end}
|
|
236
|
+
)
|
|
237
|
+
__TS__ObjectDefineProperty(
|
|
238
|
+
LocalClient,
|
|
239
|
+
"mouseFrameX",
|
|
240
|
+
{get = function(self)
|
|
241
|
+
return pixelToFrameX(getMouseScreenPosX())
|
|
242
|
+
end}
|
|
243
|
+
)
|
|
244
|
+
__TS__ObjectDefineProperty(
|
|
245
|
+
LocalClient,
|
|
246
|
+
"mouseFrameY",
|
|
247
|
+
{get = function(self)
|
|
248
|
+
return pixelToFrameY(getMouseScreenPosY())
|
|
249
|
+
end}
|
|
250
|
+
)
|
|
101
251
|
__TS__ObjectDefineProperty(
|
|
102
252
|
LocalClient,
|
|
103
253
|
"mouseFocusUnit",
|
|
@@ -109,33 +259,7 @@ __TS__ObjectDefineProperty(
|
|
|
109
259
|
LocalClient,
|
|
110
260
|
"mainSelectedUnit",
|
|
111
261
|
{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
|
|
262
|
+
return currentMainSelectedUnit
|
|
139
263
|
end}
|
|
140
264
|
)
|
|
141
265
|
__TS__ObjectDefineProperty(
|
|
@@ -144,13 +268,20 @@ __TS__ObjectDefineProperty(
|
|
|
144
268
|
{get = function(self)
|
|
145
269
|
if mainSelectedUnitChangeEvent == nil then
|
|
146
270
|
mainSelectedUnitChangeEvent = __TS__New(Event)
|
|
147
|
-
Timer.onPeriod[1 / 64]:addListener(function()
|
|
148
|
-
local _ = ____exports.LocalClient.mainSelectedUnit
|
|
149
|
-
end)
|
|
150
271
|
end
|
|
151
272
|
return mainSelectedUnitChangeEvent
|
|
152
273
|
end}
|
|
153
274
|
)
|
|
275
|
+
__TS__ObjectDefineProperty(
|
|
276
|
+
LocalClient,
|
|
277
|
+
"isInTargetingMode",
|
|
278
|
+
{get = function(self)
|
|
279
|
+
return actualizeTargetingModeState()
|
|
280
|
+
end}
|
|
281
|
+
)
|
|
282
|
+
LocalClient.targetingModeEnterEvent = targetingModeEnterEvent
|
|
283
|
+
LocalClient.targetingModeLeaveEvent = targetingModeLeaveEvent
|
|
284
|
+
LocalClient.targetingModeStateChangeEvent = targetingModeStateChangeEvent
|
|
154
285
|
LocalClient.onDisconnect = __TS__New(
|
|
155
286
|
TriggerEvent,
|
|
156
287
|
function(trigger)
|
|
@@ -158,11 +289,220 @@ LocalClient.onDisconnect = __TS__New(
|
|
|
158
289
|
end,
|
|
159
290
|
function() return end
|
|
160
291
|
)
|
|
292
|
+
local function actualizeMainSelectedUnit()
|
|
293
|
+
Unit:getSelectionOf(Player["local"], localSelectedUnits)
|
|
294
|
+
for i = 1, #localSelectedUnits do
|
|
295
|
+
indexByLocalSelectedUnit[localSelectedUnits[i]] = i
|
|
296
|
+
end
|
|
297
|
+
tableSort(localSelectedUnits, compareUnitsSelectionPriority)
|
|
298
|
+
local mainSelectedUnitIndex
|
|
299
|
+
if #localSelectedUnits > 1 then
|
|
300
|
+
local selectionButtons = getSelectionButtons()
|
|
301
|
+
mainSelectedUnitIndex = getMainSelectedUnitIndex(
|
|
302
|
+
selectionButtons,
|
|
303
|
+
selectionButtons:getChildrenCount()
|
|
304
|
+
)
|
|
305
|
+
end
|
|
306
|
+
local mainSelectedUnit = localSelectedUnits[(#localSelectedUnits > 1 and (mainSelectedUnitIndex or 0) or 0) + 1]
|
|
307
|
+
for i = 1, #localSelectedUnits do
|
|
308
|
+
indexByLocalSelectedUnit[localSelectedUnits[i]] = nil
|
|
309
|
+
localSelectedUnits[i] = nil
|
|
310
|
+
end
|
|
311
|
+
currentMainSelectedUnit = mainSelectedUnit
|
|
312
|
+
if mainSelectedUnitChangeEvent ~= nil and mainSelectedUnit ~= previousMainSelectedUnit then
|
|
313
|
+
local previousPreviousMainSelectedUnit = previousMainSelectedUnit
|
|
314
|
+
previousMainSelectedUnit = mainSelectedUnit
|
|
315
|
+
Event.invoke(mainSelectedUnitChangeEvent, previousPreviousMainSelectedUnit, previousMainSelectedUnit)
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
local commandButtons = array(
|
|
319
|
+
12,
|
|
320
|
+
function(i) return Frame:byOrigin(ORIGIN_FRAME_COMMAND_BUTTON, i) end
|
|
321
|
+
)
|
|
322
|
+
local function getTargetingModeState()
|
|
323
|
+
for i = 0, 10 do
|
|
324
|
+
if commandButtons[i + 1].visible then
|
|
325
|
+
return false
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
return commandButtons[12].visible
|
|
329
|
+
end
|
|
330
|
+
actualizeTargetingModeState = function()
|
|
331
|
+
if getTargetingModeState() then
|
|
332
|
+
if not lastTargetingModeState then
|
|
333
|
+
lastTargetingModeState = true
|
|
334
|
+
Event.invoke(targetingModeEnterEvent)
|
|
335
|
+
Event.invoke(targetingModeStateChangeEvent)
|
|
336
|
+
end
|
|
337
|
+
return true
|
|
338
|
+
end
|
|
339
|
+
if lastTargetingModeState then
|
|
340
|
+
lastTargetingModeState = false
|
|
341
|
+
Event.invoke(targetingModeLeaveEvent)
|
|
342
|
+
Event.invoke(targetingModeStateChangeEvent)
|
|
343
|
+
end
|
|
344
|
+
return false
|
|
345
|
+
end
|
|
346
|
+
Timer.onPeriod[1 / 64]:addListener(function()
|
|
347
|
+
actualizeTargetingModeState()
|
|
348
|
+
end)
|
|
349
|
+
local function initializeSelectionFrames()
|
|
350
|
+
local checkProgress, onMessage, observeSelection, retryTimer
|
|
351
|
+
local warmups = {}
|
|
352
|
+
local warmupByPlayer = {}
|
|
353
|
+
local dummyUnits = {}
|
|
354
|
+
local socket = __TS__New(Socket)
|
|
355
|
+
local finished = false
|
|
356
|
+
local transitionPending = false
|
|
357
|
+
local sent12 = false
|
|
358
|
+
local sent24 = false
|
|
359
|
+
local function retrySelection()
|
|
360
|
+
for ____, warmup in ipairs(warmups) do
|
|
361
|
+
do
|
|
362
|
+
if not warmup.player.isPlaying or warmup.hasSeen12 and warmup.hasSeen24 then
|
|
363
|
+
goto __continue58
|
|
364
|
+
end
|
|
365
|
+
local count = warmup.hasSeen24 and 12 or 24
|
|
366
|
+
if warmup.player == Player["local"] then
|
|
367
|
+
local selection = Unit:getSelectionOf(Player["local"])
|
|
368
|
+
local normalSelection = __TS__ArrayFilter(
|
|
369
|
+
selection,
|
|
370
|
+
function(____, unit) return not (dummyUnits[unit] ~= nil) end
|
|
371
|
+
)
|
|
372
|
+
if #normalSelection > 0 or #selection == 0 then
|
|
373
|
+
warmup.previousSelection = normalSelection
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
warmup.player:clearSelection()
|
|
377
|
+
for i = 0, count - 1 do
|
|
378
|
+
warmup.player:select(warmup.units[i + 1])
|
|
379
|
+
end
|
|
380
|
+
if count == 12 and #warmup.units == 24 then
|
|
381
|
+
for i = 23, 12, -1 do
|
|
382
|
+
warmup.units[i + 1]:destroy()
|
|
383
|
+
warmup.units[i + 1] = nil
|
|
384
|
+
end
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
::__continue58::
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
local function finish()
|
|
391
|
+
finished = true
|
|
392
|
+
retryTimer:destroy()
|
|
393
|
+
Timer.onPeriod[1 / 64]:removeListener(observeSelection)
|
|
394
|
+
socket.onMessage:removeListener(onMessage)
|
|
395
|
+
Player.onLeave:removeListener(checkProgress)
|
|
396
|
+
local restoreSelection
|
|
397
|
+
local selection = Unit:getSelectionOf(Player["local"])
|
|
398
|
+
for ____, unit in ipairs(selection) do
|
|
399
|
+
if dummyUnits[unit] ~= nil then
|
|
400
|
+
restoreSelection = __TS__ArrayFilter(
|
|
401
|
+
selection,
|
|
402
|
+
function(____, selected) return not (dummyUnits[selected] ~= nil) end
|
|
403
|
+
)
|
|
404
|
+
if #restoreSelection == 0 then
|
|
405
|
+
local ____opt_0 = warmupByPlayer[Player["local"]]
|
|
406
|
+
restoreSelection = ____opt_0 and ____opt_0.previousSelection
|
|
407
|
+
end
|
|
408
|
+
Player["local"]:clearSelection()
|
|
409
|
+
break
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
for ____, warmup in ipairs(warmups) do
|
|
413
|
+
for ____, unit in ipairs(warmup.units) do
|
|
414
|
+
unit:destroy()
|
|
415
|
+
end
|
|
416
|
+
warmup.units = {}
|
|
417
|
+
end
|
|
418
|
+
if restoreSelection ~= nil then
|
|
419
|
+
for ____, unit in ipairs(restoreSelection) do
|
|
420
|
+
if getUnitTypeId(unit.handle) ~= 0 then
|
|
421
|
+
Player["local"]:select(unit)
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
Timer.onPeriod[1 / 64]:addListener(actualizeMainSelectedUnit)
|
|
426
|
+
end
|
|
427
|
+
checkProgress = function()
|
|
428
|
+
if finished or transitionPending then
|
|
429
|
+
return
|
|
430
|
+
end
|
|
431
|
+
for ____, warmup in ipairs(warmups) do
|
|
432
|
+
if warmup.player.isPlaying and (not warmup.hasSeen12 or not warmup.hasSeen24) then
|
|
433
|
+
return
|
|
434
|
+
end
|
|
435
|
+
end
|
|
436
|
+
transitionPending = true
|
|
437
|
+
Timer:simple(1 / 64, finish)
|
|
438
|
+
end
|
|
439
|
+
onMessage = function(player, layout)
|
|
440
|
+
local warmup = warmupByPlayer[player]
|
|
441
|
+
if warmup == nil or not player.isPlaying then
|
|
442
|
+
return
|
|
443
|
+
end
|
|
444
|
+
if layout == "12" then
|
|
445
|
+
warmup.hasSeen12 = true
|
|
446
|
+
elseif layout == "24" then
|
|
447
|
+
warmup.hasSeen24 = true
|
|
448
|
+
else
|
|
449
|
+
return
|
|
450
|
+
end
|
|
451
|
+
checkProgress()
|
|
452
|
+
end
|
|
453
|
+
observeSelection = function()
|
|
454
|
+
if not (warmupByPlayer[Player["local"]] ~= nil) or not Player["local"].isPlaying then
|
|
455
|
+
return
|
|
456
|
+
end
|
|
457
|
+
local localSelectionCount = #Unit:getSelectionOf(Player["local"])
|
|
458
|
+
if not sent12 and localSelectionCount >= 2 and localSelectionCount <= 12 then
|
|
459
|
+
socket:send("12")
|
|
460
|
+
sent12 = true
|
|
461
|
+
elseif not sent24 and localSelectionCount >= 13 and localSelectionCount <= 24 then
|
|
462
|
+
socket:send("24")
|
|
463
|
+
sent24 = true
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
for ____, player in ipairs(Player.all) do
|
|
467
|
+
if player.isUser and player.isPlaying then
|
|
468
|
+
local warmup = {
|
|
469
|
+
player = player,
|
|
470
|
+
units = {},
|
|
471
|
+
previousSelection = player == Player["local"] and Unit:getSelectionOf(player) or ({}),
|
|
472
|
+
hasSeen12 = false,
|
|
473
|
+
hasSeen24 = false
|
|
474
|
+
}
|
|
475
|
+
warmups[#warmups + 1] = warmup
|
|
476
|
+
warmupByPlayer[player] = warmup
|
|
477
|
+
for i = 0, 23 do
|
|
478
|
+
local unit = assert(Unit:create(
|
|
479
|
+
player,
|
|
480
|
+
selectionWarmupUnitTypeId,
|
|
481
|
+
0,
|
|
482
|
+
0,
|
|
483
|
+
0
|
|
484
|
+
))
|
|
485
|
+
unit.isPaused = true
|
|
486
|
+
warmup.units[i + 1] = unit
|
|
487
|
+
dummyUnits[unit] = true
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
socket.onMessage:addListener(onMessage)
|
|
492
|
+
Player.onLeave:addListener(checkProgress)
|
|
493
|
+
Timer.onPeriod[1 / 64]:addListener(observeSelection)
|
|
494
|
+
retryTimer = Timer:periodic(1, retrySelection)
|
|
495
|
+
observeSelection()
|
|
496
|
+
retrySelection()
|
|
497
|
+
checkProgress()
|
|
498
|
+
end
|
|
161
499
|
warpack.afterMapInit(function()
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
)
|
|
500
|
+
local isDE = loadTOCFile(deTocPath)
|
|
501
|
+
local isHD = not isDE and loadTOCFile(hdTocPath)
|
|
502
|
+
rawset(____exports.LocalClient, "isDE", isDE)
|
|
503
|
+
rawset(____exports.LocalClient, "isHD", isHD)
|
|
504
|
+
rawset(____exports.LocalClient, "isSD", not isDE and not isHD)
|
|
505
|
+
rawset(____exports.LocalClient, "graphicsMode", isDE and 2 or (isHD and 1 or 0))
|
|
167
506
|
end)
|
|
507
|
+
Timer:run(initializeSelectionFrames)
|
|
168
508
|
return ____exports
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____records = require("utility.records")
|
|
3
|
+
local invertRecord = ____records.invertRecord
|
|
4
|
+
local stringByArmorType = {
|
|
5
|
+
[0] = "small",
|
|
6
|
+
[1] = "medium",
|
|
7
|
+
[2] = "large",
|
|
8
|
+
[3] = "fort",
|
|
9
|
+
[4] = "normal",
|
|
10
|
+
[5] = "hero",
|
|
11
|
+
[6] = "divine",
|
|
12
|
+
[7] = "none"
|
|
13
|
+
}
|
|
14
|
+
local armorTypeByString = invertRecord(stringByArmorType)
|
|
15
|
+
local nativeByArmorType = {
|
|
16
|
+
[0] = DEFENSE_TYPE_LIGHT,
|
|
17
|
+
[1] = DEFENSE_TYPE_MEDIUM,
|
|
18
|
+
[2] = DEFENSE_TYPE_LARGE,
|
|
19
|
+
[3] = DEFENSE_TYPE_FORT,
|
|
20
|
+
[4] = DEFENSE_TYPE_NORMAL,
|
|
21
|
+
[5] = DEFENSE_TYPE_HERO,
|
|
22
|
+
[6] = DEFENSE_TYPE_DIVINE,
|
|
23
|
+
[7] = DEFENSE_TYPE_NONE
|
|
24
|
+
}
|
|
25
|
+
local armorTypeByNative = invertRecord(nativeByArmorType)
|
|
26
|
+
---
|
|
27
|
+
-- @internal For use by internal systems only.
|
|
28
|
+
____exports.armorTypeToString = function(armorType)
|
|
29
|
+
return stringByArmorType[armorType]
|
|
30
|
+
end
|
|
31
|
+
---
|
|
32
|
+
-- @internal For use by internal systems only.
|
|
33
|
+
____exports.stringToArmorType = function(____string)
|
|
34
|
+
return armorTypeByString[____string] or 7
|
|
35
|
+
end
|
|
36
|
+
---
|
|
37
|
+
-- @internal For use by internal systems only.
|
|
38
|
+
____exports.armorTypeToNative = function(armorType)
|
|
39
|
+
return nativeByArmorType[armorType]
|
|
40
|
+
end
|
|
41
|
+
---
|
|
42
|
+
-- @internal For use by internal systems only.
|
|
43
|
+
____exports.nativeToArmorType = function(armorType)
|
|
44
|
+
return armorTypeByNative[armorType]
|
|
45
|
+
end
|
|
46
|
+
return ____exports
|