warscript 0.0.1-dev.f566ce7 → 0.0.1-dev.f594e71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/types/frame.d.ts +1 -0
- package/core/types/frame.lua +65 -36
- package/core/types/handle.lua +9 -9
- package/core/types/player.d.ts +2 -1
- package/core/types/player.lua +18 -13
- package/core/types/playerColor.lua +4 -3
- package/core/types/sound.d.ts +1 -1
- package/core/types/sound.lua +13 -8
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/decl/native.d.ts +705 -7
- package/engine/behaviour/ability/damage.lua +11 -14
- package/engine/behaviour/ability.d.ts +1 -0
- package/engine/behaviour/ability.lua +11 -0
- package/engine/behaviour/unit.d.ts +1 -0
- package/engine/behaviour/unit.lua +1 -0
- package/engine/buff.d.ts +12 -10
- package/engine/buff.lua +64 -16
- package/engine/index.d.ts +2 -1
- package/engine/internal/ability.d.ts +4 -0
- package/engine/internal/ability.lua +37 -18
- package/engine/internal/item+owner.d.ts +1 -0
- package/engine/internal/item+owner.lua +7 -0
- package/engine/internal/item.d.ts +16 -1
- package/engine/internal/item.lua +130 -20
- package/engine/internal/unit/ability.lua +15 -3
- package/engine/internal/unit/appearance.d.ts +15 -0
- package/engine/internal/unit/appearance.lua +85 -0
- package/engine/internal/unit/bag.d.ts +18 -0
- package/engine/internal/unit/bag.lua +63 -0
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +34 -19
- package/engine/internal/unit/equipment.d.ts +36 -0
- package/engine/internal/unit/equipment.lua +169 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +3 -3
- package/engine/internal/unit/{item.lua → inventory.lua} +25 -26
- package/engine/internal/unit/pseudo-passive-abilities.d.ts +2 -0
- package/engine/internal/unit/pseudo-passive-abilities.lua +11 -0
- package/engine/internal/unit+damage.d.ts +9 -0
- package/engine/internal/unit+damage.lua +33 -0
- package/engine/internal/unit-missile-data.lua +58 -32
- package/engine/internal/unit.d.ts +0 -1
- package/engine/internal/unit.lua +2 -7
- package/engine/local-client.d.ts +20 -0
- package/engine/local-client.lua +284 -53
- package/engine/object-data/auxiliary/equipment-slot.d.ts +12 -0
- package/engine/object-data/auxiliary/equipment-slot.lua +2 -0
- package/engine/object-data/auxiliary/equipment-type.d.ts +13 -0
- package/engine/object-data/auxiliary/equipment-type.lua +2 -0
- package/engine/object-data/auxiliary/item-tag.d.ts +12 -0
- package/engine/object-data/auxiliary/item-tag.lua +2 -0
- package/engine/object-data/auxiliary/sound-set-name.d.ts +14 -3
- package/engine/object-data/entry/ability-type/apprehend.d.ts +22 -0
- package/engine/object-data/entry/ability-type/apprehend.lua +66 -0
- package/engine/object-data/entry/ability-type/banshee.d.ts +8 -0
- package/engine/object-data/entry/ability-type/banshee.lua +13 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/banshees-wail-damage-amp.lua +27 -0
- package/engine/object-data/entry/ability-type/banshees-wail.d.ts +31 -0
- package/engine/object-data/entry/ability-type/banshees-wail.lua +117 -0
- package/engine/object-data/entry/ability-type/battering-ram.d.ts +33 -0
- package/engine/object-data/entry/ability-type/battering-ram.lua +130 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +30 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.d.ts +27 -0
- package/engine/object-data/entry/ability-type/cleansing-fire.lua +104 -0
- package/engine/object-data/entry/ability-type/consecration.d.ts +15 -0
- package/engine/object-data/entry/ability-type/consecration.lua +52 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.d.ts +12 -0
- package/engine/object-data/entry/ability-type/cooldown-reduction.lua +39 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.d.ts +18 -0
- package/engine/object-data/entry/ability-type/critical-strike-system.lua +65 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.d.ts +21 -0
- package/engine/object-data/entry/ability-type/deathseeker-arrows.lua +78 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.d.ts +8 -0
- package/engine/object-data/entry/ability-type/equipment-inventory-interface.lua +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment-inventory.lua +27 -0
- package/engine/object-data/entry/ability-type/equipment.d.ts +13 -0
- package/engine/object-data/entry/ability-type/equipment.lua +27 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.d.ts +8 -0
- package/engine/object-data/entry/ability-type/grant-talent-point.lua +13 -0
- package/engine/object-data/entry/ability-type/grim-conviction.d.ts +36 -0
- package/engine/object-data/entry/ability-type/grim-conviction.lua +131 -0
- package/engine/object-data/entry/ability-type/grit.d.ts +18 -0
- package/engine/object-data/entry/ability-type/grit.lua +65 -0
- package/engine/object-data/entry/ability-type/guiding-hand.d.ts +27 -0
- package/engine/object-data/entry/ability-type/guiding-hand.lua +104 -0
- package/engine/object-data/entry/ability-type/headsplitter.d.ts +27 -0
- package/engine/object-data/entry/ability-type/headsplitter.lua +104 -0
- package/engine/object-data/entry/ability-type/healing-modifier.d.ts +9 -0
- package/engine/object-data/entry/ability-type/healing-modifier.lua +26 -0
- package/engine/object-data/entry/ability-type/heroic-slash.d.ts +18 -0
- package/engine/object-data/entry/ability-type/heroic-slash.lua +65 -0
- package/engine/object-data/entry/ability-type/holy-wrath.d.ts +30 -0
- package/engine/object-data/entry/ability-type/holy-wrath.lua +117 -0
- package/engine/object-data/entry/ability-type/inspire-courage.d.ts +18 -0
- package/engine/object-data/entry/ability-type/inspire-courage.lua +65 -0
- package/engine/object-data/entry/ability-type/lights-mercy.d.ts +27 -0
- package/engine/object-data/entry/ability-type/lights-mercy.lua +104 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.d.ts +12 -0
- package/engine/object-data/entry/ability-type/mana-efficiency.lua +39 -0
- package/engine/object-data/entry/ability-type/mind-control.d.ts +21 -0
- package/engine/object-data/entry/ability-type/mind-control.lua +78 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.d.ts +21 -0
- package/engine/object-data/entry/ability-type/on-attack-cast-spell.lua +52 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.d.ts +19 -0
- package/engine/object-data/entry/ability-type/on-basic-attack-cast-spell.lua +65 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.d.ts +15 -0
- package/engine/object-data/entry/ability-type/on-hit-cast-spell.lua +26 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.d.ts +6 -0
- package/engine/object-data/entry/ability-type/on-magic-attack-cast-spell.lua +12 -0
- package/engine/object-data/entry/ability-type/provoke.d.ts +21 -0
- package/engine/object-data/entry/ability-type/provoke.lua +66 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.d.ts +9 -0
- package/engine/object-data/entry/ability-type/raise-the-banner.lua +26 -0
- package/engine/object-data/entry/ability-type/resolve.d.ts +12 -0
- package/engine/object-data/entry/ability-type/resolve.lua +39 -0
- package/engine/object-data/entry/ability-type/righteous-fury.d.ts +33 -0
- package/engine/object-data/entry/ability-type/righteous-fury.lua +130 -0
- package/engine/object-data/entry/ability-type/sacred-aura.d.ts +27 -0
- package/engine/object-data/entry/ability-type/sacred-aura.lua +104 -0
- package/engine/object-data/entry/ability-type/soul-lantern.d.ts +30 -0
- package/engine/object-data/entry/ability-type/soul-lantern.lua +117 -0
- package/engine/object-data/entry/ability-type/spell-amp.d.ts +15 -0
- package/engine/object-data/entry/ability-type/spell-amp.lua +52 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-critical-strike.lua +39 -0
- package/engine/object-data/entry/ability-type/spell-vamp.d.ts +12 -0
- package/engine/object-data/entry/ability-type/spell-vamp.lua +39 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-evasion.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.d.ts +21 -0
- package/engine/object-data/entry/ability-type/stackable-hardened-skin.lua +78 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-life-steal.lua +26 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-spell-damage-reduction.lua +13 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.d.ts +9 -0
- package/engine/object-data/entry/ability-type/stackable-thorn-shield.lua +13 -0
- package/engine/object-data/entry/ability-type/stat-details.d.ts +12 -0
- package/engine/object-data/entry/ability-type/stat-details.lua +27 -0
- package/engine/object-data/entry/ability-type/surge-of-light.d.ts +33 -0
- package/engine/object-data/entry/ability-type/surge-of-light.lua +130 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.d.ts +57 -0
- package/engine/object-data/entry/ability-type/sweeping-strike.lua +234 -0
- package/engine/object-data/entry/ability-type/talents.d.ts +12 -0
- package/engine/object-data/entry/ability-type/talents.lua +27 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.d.ts +30 -0
- package/engine/object-data/entry/ability-type/unyielding-guard.lua +117 -0
- package/engine/object-data/entry/ability-type/valiant-charge.d.ts +27 -0
- package/engine/object-data/entry/ability-type/valiant-charge.lua +104 -0
- package/engine/object-data/entry/ability-type/warcry.d.ts +9 -0
- package/engine/object-data/entry/ability-type/warcry.lua +26 -0
- package/engine/object-data/entry/ability-type/withering-fire.d.ts +21 -0
- package/engine/object-data/entry/ability-type/withering-fire.lua +78 -0
- package/engine/object-data/entry/ability-type.d.ts +10 -3
- package/engine/object-data/entry/ability-type.lua +53 -0
- package/engine/object-data/entry/buff-type.d.ts +6 -2
- package/engine/object-data/entry/buff-type.lua +26 -0
- package/engine/object-data/entry/destructible-type.d.ts +6 -2
- package/engine/object-data/entry/destructible-type.lua +26 -0
- package/engine/object-data/entry/item-type.d.ts +12 -3
- package/engine/object-data/entry/item-type.lua +52 -0
- package/engine/object-data/entry/lightning-type.d.ts +2 -2
- package/engine/object-data/entry/sound-preset.d.ts +2 -2
- package/engine/object-data/entry/unit-type.d.ts +47 -2
- package/engine/object-data/entry/unit-type.lua +383 -49
- package/engine/object-data/entry/upgrade.d.ts +2 -2
- package/engine/object-data/entry.d.ts +4 -1
- package/engine/standard/entries/ability-type.d.ts +3102 -7
- package/engine/standard/entries/ability-type.lua +0 -6
- package/engine/standard/entries/item-type.d.ts +1299 -0
- package/engine/standard/entries/item-type.lua +2 -0
- package/engine/standard/entries/unit-type.d.ts +5 -0
- package/engine/standard/entries/unit-type.lua +5 -0
- package/engine/unit.d.ts +4 -1
- package/engine/unit.lua +4 -1
- package/event.d.ts +1 -1
- package/network.lua +25 -1
- package/operation.d.ts +8 -1
- package/operation.lua +37 -14
- package/package.json +2 -22
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
package/core/types/frame.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export declare class Frame extends Handle<jframehandle> {
|
|
|
80
80
|
get onMouseLeave(): FrameEvent;
|
|
81
81
|
get onMouseUp(): FrameEvent;
|
|
82
82
|
get onMouseWheel(): FrameEvent<[number]>;
|
|
83
|
+
private trackMouseLocally;
|
|
83
84
|
get mouseEnterLocalEvent(): Event;
|
|
84
85
|
get mouseLeaveLocalEvent(): Event;
|
|
85
86
|
get popupMenuItemChangeEvent(): FrameEvent<[
|
package/core/types/frame.lua
CHANGED
|
@@ -142,6 +142,55 @@ do
|
|
|
142
142
|
FramePoint.BOTTOM_RIGHT = FRAMEPOINT_BOTTOMRIGHT
|
|
143
143
|
end
|
|
144
144
|
local tooltipByFrame = setmetatable({}, {__mode = "k"})
|
|
145
|
+
local isMouseInsideLocallyByFrame = mutableLuaMap()
|
|
146
|
+
local mouseEnterLocalEventByFrame = mutableLuaMap()
|
|
147
|
+
local mouseLeaveLocalEventByFrame = mutableLuaMap()
|
|
148
|
+
local isLocalMouseTrackingStarted = false
|
|
149
|
+
--- Reused across ticks to avoid per-tick allocations: only the first `leftFrameCount` /
|
|
150
|
+
-- `enteredFrameCount` entries are meaningful, stale entries beyond them are never read and are
|
|
151
|
+
-- kept collectable by the weak values mode.
|
|
152
|
+
local leftFrames = setmetatable({}, {__mode = "v"})
|
|
153
|
+
local enteredFrames = setmetatable({}, {__mode = "v"})
|
|
154
|
+
--- All frames share a single poll which invokes every mouse leave event before any mouse enter
|
|
155
|
+
-- event within the same tick. With a poll per event, the invocation order would depend on the
|
|
156
|
+
-- event creation order instead, breaking listeners relying on the natural "leave the old frame,
|
|
157
|
+
-- then enter the new frame" order.
|
|
158
|
+
local function startLocalMouseTracking()
|
|
159
|
+
if isLocalMouseTrackingStarted then
|
|
160
|
+
return
|
|
161
|
+
end
|
|
162
|
+
isLocalMouseTrackingStarted = true
|
|
163
|
+
Timer.onPeriod[1 / 64]:addListener(function()
|
|
164
|
+
local leftFrameCount = 0
|
|
165
|
+
local enteredFrameCount = 0
|
|
166
|
+
for frame, wasMouseInside in pairs(isMouseInsideLocallyByFrame) do
|
|
167
|
+
local tooltip = tooltipByFrame[frame]
|
|
168
|
+
local isMouseInside = tooltip ~= nil and tooltip.visible
|
|
169
|
+
if isMouseInside ~= wasMouseInside then
|
|
170
|
+
isMouseInsideLocallyByFrame[frame] = isMouseInside
|
|
171
|
+
if isMouseInside then
|
|
172
|
+
enteredFrames[enteredFrameCount + 1] = frame
|
|
173
|
+
enteredFrameCount = enteredFrameCount + 1
|
|
174
|
+
else
|
|
175
|
+
leftFrames[leftFrameCount + 1] = frame
|
|
176
|
+
leftFrameCount = leftFrameCount + 1
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
for i = 1, leftFrameCount do
|
|
181
|
+
local event = mouseLeaveLocalEventByFrame[leftFrames[i]]
|
|
182
|
+
if event ~= nil then
|
|
183
|
+
Event.invoke(event)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
for i = 1, enteredFrameCount do
|
|
187
|
+
local event = mouseEnterLocalEventByFrame[enteredFrames[i]]
|
|
188
|
+
if event ~= nil then
|
|
189
|
+
Event.invoke(event)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end)
|
|
193
|
+
end
|
|
145
194
|
local keyByAsyncInitOriginFrameType = luaMapOf(ORIGIN_FRAME_PORTRAIT_HP_TEXT, "hp", ORIGIN_FRAME_PORTRAIT_MANA_TEXT, "mana")
|
|
146
195
|
local asyncInitOriginFrameTypeByKey = luaMapInvert(keyByAsyncInitOriginFrameType)
|
|
147
196
|
local seenAsyncInitOriginFrameTypes = mutableLuaSet()
|
|
@@ -198,6 +247,18 @@ function Frame.prototype.getEvent(self, eventType, c)
|
|
|
198
247
|
end
|
|
199
248
|
return self.events[eventId]
|
|
200
249
|
end
|
|
250
|
+
function Frame.prototype.trackMouseLocally(self)
|
|
251
|
+
if not (tooltipByFrame[self] ~= nil) then
|
|
252
|
+
____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent = self
|
|
253
|
+
local tooltip = ____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent == self and ____exports.Frame:createByType("SIMPLEFRAME", "", ____exports.Frame.CONSOLE_UI) or ____exports.Frame:createByType("FRAME", "", ____exports.Frame.GAME_UI)
|
|
254
|
+
____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent = ____exports.Frame.CONSOLE_UI
|
|
255
|
+
self:setTooltip(tooltip)
|
|
256
|
+
end
|
|
257
|
+
if not (isMouseInsideLocallyByFrame[self] ~= nil) then
|
|
258
|
+
isMouseInsideLocallyByFrame[self] = false
|
|
259
|
+
startLocalMouseTracking()
|
|
260
|
+
end
|
|
261
|
+
end
|
|
201
262
|
function Frame.prototype.hide(self)
|
|
202
263
|
self.hideCounter = self.hideCounter + 1
|
|
203
264
|
if self.hideCounter > 0 then
|
|
@@ -673,24 +734,8 @@ __TS__SetDescriptor(
|
|
|
673
734
|
"mouseEnterLocalEvent",
|
|
674
735
|
{get = function(self)
|
|
675
736
|
local event = __TS__New(Event)
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
local tooltip = ____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent == self and ____exports.Frame:createByType("SIMPLEFRAME", "", ____exports.Frame.CONSOLE_UI) or ____exports.Frame:createByType("FRAME", "", ____exports.Frame.GAME_UI)
|
|
679
|
-
____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent = ____exports.Frame.CONSOLE_UI
|
|
680
|
-
self:setTooltip(tooltip)
|
|
681
|
-
end
|
|
682
|
-
local isMouseInside = false
|
|
683
|
-
Timer.onPeriod[1 / 64]:addListener(function()
|
|
684
|
-
local tooltip = tooltipByFrame[self]
|
|
685
|
-
if tooltip and tooltip.visible then
|
|
686
|
-
if not isMouseInside then
|
|
687
|
-
isMouseInside = true
|
|
688
|
-
Event.invoke(event)
|
|
689
|
-
end
|
|
690
|
-
else
|
|
691
|
-
isMouseInside = false
|
|
692
|
-
end
|
|
693
|
-
end)
|
|
737
|
+
self:trackMouseLocally()
|
|
738
|
+
mouseEnterLocalEventByFrame[self] = event
|
|
694
739
|
rawset(self, "mouseEnterLocalEvent", event)
|
|
695
740
|
return event
|
|
696
741
|
end},
|
|
@@ -701,24 +746,8 @@ __TS__SetDescriptor(
|
|
|
701
746
|
"mouseLeaveLocalEvent",
|
|
702
747
|
{get = function(self)
|
|
703
748
|
local event = __TS__New(Event)
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
local tooltip = ____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent == self and ____exports.Frame:createByType("SIMPLEFRAME", "", ____exports.Frame.CONSOLE_UI) or ____exports.Frame:createByType("FRAME", "", ____exports.Frame.GAME_UI)
|
|
707
|
-
____exports.Frame.SIMPLE_FRAME_TEST_CHILD.parent = ____exports.Frame.CONSOLE_UI
|
|
708
|
-
self:setTooltip(tooltip)
|
|
709
|
-
end
|
|
710
|
-
local isMouseInside = false
|
|
711
|
-
Timer.onPeriod[1 / 64]:addListener(function()
|
|
712
|
-
local tooltip = tooltipByFrame[self]
|
|
713
|
-
if tooltip and tooltip.visible then
|
|
714
|
-
isMouseInside = true
|
|
715
|
-
else
|
|
716
|
-
if isMouseInside then
|
|
717
|
-
isMouseInside = false
|
|
718
|
-
Event.invoke(event)
|
|
719
|
-
end
|
|
720
|
-
end
|
|
721
|
-
end)
|
|
749
|
+
self:trackMouseLocally()
|
|
750
|
+
mouseLeaveLocalEventByFrame[self] = event
|
|
722
751
|
rawset(self, "mouseLeaveLocalEvent", event)
|
|
723
752
|
return event
|
|
724
753
|
end},
|
package/core/types/handle.lua
CHANGED
|
@@ -15,6 +15,8 @@ local ____exception = require("exception")
|
|
|
15
15
|
local IllegalStateException = ____exception.IllegalStateException
|
|
16
16
|
local ____attributes = require("attributes")
|
|
17
17
|
local AttributesHolder = ____attributes.AttributesHolder
|
|
18
|
+
local ____preconditions = require("utility.preconditions")
|
|
19
|
+
local checkNotNull = ____preconditions.checkNotNull
|
|
18
20
|
local getHandleId = GetHandleId
|
|
19
21
|
local onCreateEventByHandleConstructor = {}
|
|
20
22
|
local onDestroyEventByHandleConstructor = {}
|
|
@@ -58,6 +60,9 @@ function Handle.invokeOnCreateEvent(self, clazz, handle)
|
|
|
58
60
|
Event.invoke(onCreateEvent, handle)
|
|
59
61
|
end
|
|
60
62
|
end
|
|
63
|
+
function Handle.isWrapped(self, handle)
|
|
64
|
+
return self.memoized[getHandleId(handle)] ~= nil
|
|
65
|
+
end
|
|
61
66
|
function Handle.prototype.__tostring(self)
|
|
62
67
|
return (self.constructor.name .. "@") .. tostring(getHandleId(self.handle))
|
|
63
68
|
end
|
|
@@ -66,17 +71,12 @@ function Handle.prototype.onDestroy(self, ...)
|
|
|
66
71
|
return nil
|
|
67
72
|
end
|
|
68
73
|
function Handle.prototype.destroy(self, ...)
|
|
74
|
+
if self[0] == 2 or self[0] == 3 then
|
|
75
|
+
return nil
|
|
76
|
+
end
|
|
69
77
|
local clazz = self.constructor
|
|
70
78
|
local id = getHandleId(self.handle)
|
|
71
|
-
|
|
72
|
-
error(
|
|
73
|
-
__TS__New(
|
|
74
|
-
IllegalStateException,
|
|
75
|
-
"Double-destroy run for handle " .. tostring(id)
|
|
76
|
-
),
|
|
77
|
-
0
|
|
78
|
-
)
|
|
79
|
-
end
|
|
79
|
+
checkNotNull(clazz.memoized[id])
|
|
80
80
|
self[0] = 2
|
|
81
81
|
if self.onDestroyEvent then
|
|
82
82
|
Event.invoke(self.onDestroyEvent)
|
package/core/types/player.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare class Player extends Handle<jplayer> {
|
|
|
28
28
|
static readonly neutralExtra: Player;
|
|
29
29
|
private static events;
|
|
30
30
|
readonly id: number;
|
|
31
|
+
readonly slotState: jplayerslotstate;
|
|
31
32
|
constructor(handle: jplayer);
|
|
32
33
|
onDestroy(): HandleDestructor;
|
|
33
34
|
toString(): string;
|
|
@@ -45,11 +46,11 @@ export declare class Player extends Handle<jplayer> {
|
|
|
45
46
|
get isUser(): boolean;
|
|
46
47
|
get isPlaying(): boolean;
|
|
47
48
|
get controller(): jmapcontrol;
|
|
48
|
-
get slotState(): jplayerslotstate;
|
|
49
49
|
clearSelection(): void;
|
|
50
50
|
selectSingle(unit: Unit): void;
|
|
51
51
|
select(unit: Unit): void;
|
|
52
52
|
deselect(unit: Unit): void;
|
|
53
|
+
setRaceSkin(racePreference: jracepreference): void;
|
|
53
54
|
forceUIKey(key: string): void;
|
|
54
55
|
forceUICancel(): void;
|
|
55
56
|
isAllyOf(other: Player): boolean;
|
package/core/types/player.lua
CHANGED
|
@@ -31,12 +31,13 @@ local getPlayerName = GetPlayerName
|
|
|
31
31
|
local getPlayerTechCount = GetPlayerTechCount
|
|
32
32
|
local getPlayerTechMaxAllowed = GetPlayerTechMaxAllowed
|
|
33
33
|
local getTriggerPlayer = GetTriggerPlayer
|
|
34
|
+
local playerNative = _G.Player
|
|
35
|
+
local setPlayerAbilityAvailable = SetPlayerAbilityAvailable
|
|
34
36
|
local setPlayerAlliance = SetPlayerAlliance
|
|
37
|
+
local setPlayerRaceSkin = SetPlayerRaceSkin
|
|
35
38
|
local setPlayerTechMaxAllowed = SetPlayerTechMaxAllowed
|
|
36
39
|
local setPlayerTechResearched = SetPlayerTechResearched
|
|
37
|
-
local setPlayerAbilityAvailable = SetPlayerAbilityAvailable
|
|
38
40
|
local triggerRegisterPlayerAllianceChange = TriggerRegisterPlayerAllianceChange
|
|
39
|
-
local playerNative = _G.Player
|
|
40
41
|
local nativeByPlayerAllianceType = {
|
|
41
42
|
[0] = ALLIANCE_PASSIVE,
|
|
42
43
|
[1] = ALLIANCE_RESCUABLE,
|
|
@@ -56,6 +57,7 @@ Player.name = "Player"
|
|
|
56
57
|
__TS__ClassExtends(Player, Handle)
|
|
57
58
|
function Player.prototype.____constructor(self, handle)
|
|
58
59
|
Handle.prototype.____constructor(self, handle)
|
|
60
|
+
self.slotState = GetPlayerSlotState(self.handle)
|
|
59
61
|
self.id = GetPlayerId(handle)
|
|
60
62
|
end
|
|
61
63
|
function Player.prototype.onDestroy(self)
|
|
@@ -88,6 +90,9 @@ function Player.prototype.deselect(self, unit)
|
|
|
88
90
|
SelectUnit(unit.handle, false)
|
|
89
91
|
end
|
|
90
92
|
end
|
|
93
|
+
function Player.prototype.setRaceSkin(self, racePreference)
|
|
94
|
+
setPlayerRaceSkin(self.handle, racePreference)
|
|
95
|
+
end
|
|
91
96
|
function Player.prototype.forceUIKey(self, key)
|
|
92
97
|
if self.isLocal then
|
|
93
98
|
ForceUIKey(key)
|
|
@@ -364,7 +369,7 @@ __TS__SetDescriptor(
|
|
|
364
369
|
Player.prototype,
|
|
365
370
|
"isUser",
|
|
366
371
|
{get = function(self)
|
|
367
|
-
return
|
|
372
|
+
return self.controller == MAP_CONTROL_USER
|
|
368
373
|
end},
|
|
369
374
|
true
|
|
370
375
|
)
|
|
@@ -372,7 +377,7 @@ __TS__SetDescriptor(
|
|
|
372
377
|
Player.prototype,
|
|
373
378
|
"isPlaying",
|
|
374
379
|
{get = function(self)
|
|
375
|
-
return
|
|
380
|
+
return self.slotState == PLAYER_SLOT_STATE_PLAYING
|
|
376
381
|
end},
|
|
377
382
|
true
|
|
378
383
|
)
|
|
@@ -380,15 +385,9 @@ __TS__SetDescriptor(
|
|
|
380
385
|
Player.prototype,
|
|
381
386
|
"controller",
|
|
382
387
|
{get = function(self)
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
)
|
|
387
|
-
__TS__SetDescriptor(
|
|
388
|
-
Player.prototype,
|
|
389
|
-
"slotState",
|
|
390
|
-
{get = function(self)
|
|
391
|
-
return GetPlayerSlotState(self.handle)
|
|
388
|
+
local controller = GetPlayerController(self.handle)
|
|
389
|
+
rawset(self, "controller", controller)
|
|
390
|
+
return controller
|
|
392
391
|
end},
|
|
393
392
|
true
|
|
394
393
|
)
|
|
@@ -490,4 +489,10 @@ __TS__ObjectDefineProperty(
|
|
|
490
489
|
end}
|
|
491
490
|
)
|
|
492
491
|
Player.colorChangedEvent = playerColorChangedEvent
|
|
492
|
+
____exports.Player.onLeave:addListener(
|
|
493
|
+
999999,
|
|
494
|
+
function(player)
|
|
495
|
+
rawset(player, "slotState", PLAYER_SLOT_STATE_LEFT)
|
|
496
|
+
end
|
|
497
|
+
)
|
|
493
498
|
return ____exports
|
|
@@ -10,6 +10,7 @@ local ____color = require("core.types.color")
|
|
|
10
10
|
local Color = ____color.Color
|
|
11
11
|
local ____exception = require("exception")
|
|
12
12
|
local IllegalStateException = ____exception.IllegalStateException
|
|
13
|
+
local getHandleId = GetHandleId
|
|
13
14
|
local byId = {}
|
|
14
15
|
local byName = {}
|
|
15
16
|
____exports.PlayerColor = __TS__Class()
|
|
@@ -81,7 +82,7 @@ PlayerColor.data = util.contextFn(
|
|
|
81
82
|
PLAYER_COLOR_SNOW,
|
|
82
83
|
PLAYER_COLOR_EMERALD,
|
|
83
84
|
PLAYER_COLOR_PEANUT,
|
|
84
|
-
|
|
85
|
+
PLAYER_COLOR_BLACK
|
|
85
86
|
}
|
|
86
87
|
local rgbaColors = {
|
|
87
88
|
Color:of(255, 2, 2),
|
|
@@ -141,7 +142,7 @@ PlayerColor.data = util.contextFn(
|
|
|
141
142
|
do
|
|
142
143
|
local i = 0
|
|
143
144
|
while i < #handles do
|
|
144
|
-
data[
|
|
145
|
+
data[getHandleId(handles[i + 1])] = {rgba = rgbaColors[i + 1], name = names[i + 1]}
|
|
145
146
|
i = i + 1
|
|
146
147
|
end
|
|
147
148
|
end
|
|
@@ -172,7 +173,7 @@ PlayerColor.coal = ____exports.PlayerColor:of(PLAYER_COLOR_COAL)
|
|
|
172
173
|
PlayerColor.snow = ____exports.PlayerColor:of(PLAYER_COLOR_SNOW)
|
|
173
174
|
PlayerColor.emerald = ____exports.PlayerColor:of(PLAYER_COLOR_EMERALD)
|
|
174
175
|
PlayerColor.peanut = ____exports.PlayerColor:of(PLAYER_COLOR_PEANUT)
|
|
175
|
-
PlayerColor.black = ____exports.PlayerColor:of(
|
|
176
|
+
PlayerColor.black = ____exports.PlayerColor:of(PLAYER_COLOR_BLACK)
|
|
176
177
|
PlayerColor.all = {
|
|
177
178
|
____exports.PlayerColor.red,
|
|
178
179
|
____exports.PlayerColor.blue,
|
package/core/types/sound.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
|
|
|
47
47
|
protected onDestroy(fadeOut?: boolean): HandleDestructor;
|
|
48
48
|
get volume(): number;
|
|
49
49
|
set volume(v: number);
|
|
50
|
-
start(milliseconds?: number): void;
|
|
50
|
+
start(milliseconds?: number, fadeIn?: boolean): void;
|
|
51
51
|
stop(fadeOut?: boolean): void;
|
|
52
52
|
restart(milliseconds?: number): void;
|
|
53
53
|
static play(fileName: string, preset: SoundSettings): void;
|
package/core/types/sound.lua
CHANGED
|
@@ -9,19 +9,20 @@ local ____sound_2Dpreset = require("engine.object-data.entry.sound-preset")
|
|
|
9
9
|
local SoundPreset = ____sound_2Dpreset.SoundPreset
|
|
10
10
|
local ____random = require("engine.random")
|
|
11
11
|
local randomInteger = ____random.randomInteger
|
|
12
|
+
local attachSoundToUnit = AttachSoundToUnit
|
|
12
13
|
local createSound = CreateSound
|
|
13
14
|
local createSoundFromLabel = CreateSoundFromLabel
|
|
14
|
-
local
|
|
15
|
+
local killSoundWhenDone = KillSoundWhenDone
|
|
15
16
|
local setSoundChannel = SetSoundChannel
|
|
17
|
+
local setSoundDistanceCutoff = SetSoundDistanceCutoff
|
|
18
|
+
local setSoundDistances = SetSoundDistances
|
|
19
|
+
local setSoundPitch = SetSoundPitch
|
|
20
|
+
local setSoundPlayPosition = SetSoundPlayPosition
|
|
16
21
|
local setSoundPosition = SetSoundPosition
|
|
17
22
|
local setSoundVolume = SetSoundVolume
|
|
18
|
-
local setSoundDistances = SetSoundDistances
|
|
19
|
-
local setSoundDistanceCutoff = SetSoundDistanceCutoff
|
|
20
23
|
local startSound = StartSound
|
|
21
|
-
local
|
|
24
|
+
local startSoundEx = StartSoundEx
|
|
22
25
|
local stopSound = StopSound
|
|
23
|
-
local attachSoundToUnit = AttachSoundToUnit
|
|
24
|
-
local killSoundWhenDone = KillSoundWhenDone
|
|
25
26
|
____exports.SoundChannel = ____exports.SoundChannel or ({})
|
|
26
27
|
____exports.SoundChannel.General = 0
|
|
27
28
|
____exports.SoundChannel[____exports.SoundChannel.General] = "General"
|
|
@@ -226,8 +227,12 @@ function Sound.prototype.onDestroy(self, fadeOut)
|
|
|
226
227
|
stopSound(self.handle, true, fadeOut or false)
|
|
227
228
|
return Handle.prototype.onDestroy(self)
|
|
228
229
|
end
|
|
229
|
-
function Sound.prototype.start(self, milliseconds)
|
|
230
|
-
|
|
230
|
+
function Sound.prototype.start(self, milliseconds, fadeIn)
|
|
231
|
+
if fadeIn == nil then
|
|
232
|
+
startSound(self.handle)
|
|
233
|
+
else
|
|
234
|
+
startSoundEx(self.handle, fadeIn)
|
|
235
|
+
end
|
|
231
236
|
if milliseconds then
|
|
232
237
|
setSoundPlayPosition(self.handle, milliseconds)
|
|
233
238
|
end
|
package/core/types/unit.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import "../../engine/internal/unit";
|
|
3
3
|
import "../../engine/internal/unit/ability";
|
|
4
|
+
import "../../engine/internal/unit/appearance";
|
|
5
|
+
import "../../engine/internal/unit/bag";
|
|
6
|
+
import "../../engine/internal/unit/equipment";
|
|
7
|
+
import "../../engine/internal/unit/inventory";
|
|
4
8
|
import "../../engine/internal/unit+damage";
|
|
5
9
|
import "../../engine/internal/unit+rally";
|
|
6
10
|
import "../../engine/internal/unit+spellSteal";
|
package/core/types/unit.lua
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
require("engine.internal.unit")
|
|
3
3
|
require("engine.internal.unit.ability")
|
|
4
|
+
require("engine.internal.unit.appearance")
|
|
5
|
+
require("engine.internal.unit.bag")
|
|
6
|
+
require("engine.internal.unit.equipment")
|
|
7
|
+
require("engine.internal.unit.inventory")
|
|
4
8
|
require("engine.internal.unit+damage")
|
|
5
9
|
require("engine.internal.unit+rally")
|
|
6
10
|
require("engine.internal.unit+spellSteal")
|