warscript 0.0.1-dev.f40f923 → 0.0.1-dev.f4350ae
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 +5 -0
- package/attributes.lua +8 -1
- package/core/types/effect.d.ts +1 -3
- package/core/types/effect.lua +26 -29
- package/core/types/sound.lua +5 -0
- package/core/types/timer.d.ts +6 -7
- package/core/types/timer.lua +18 -21
- package/decl/native.d.ts +840 -786
- package/engine/behaviour/ability/damage.d.ts +6 -3
- package/engine/behaviour/ability/damage.lua +24 -36
- package/engine/behaviour/ability/emulate-impact.lua +7 -0
- package/engine/behaviour/ability.d.ts +4 -1
- package/engine/behaviour/ability.lua +6 -4
- package/engine/internal/ability.d.ts +2 -0
- package/engine/internal/ability.lua +7 -0
- package/engine/internal/item.d.ts +2 -1
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit.d.ts +16 -3
- package/engine/internal/unit.lua +126 -37
- 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/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- 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/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -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/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/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +11 -11
- package/engine/object-data/entry/ability-type.lua +27 -6
- package/engine/object-data/entry/buff-type/applicable.lua +5 -0
- package/engine/object-data/entry/buff-type.d.ts +5 -11
- package/engine/object-data/entry/buff-type.lua +11 -27
- package/engine/object-data/entry/unit-type.d.ts +2 -2
- package/engine/object-data/entry/unit-type.lua +94 -84
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field/unit.d.ts +46 -3
- package/engine/object-field/unit.lua +173 -7
- package/engine/object-field.d.ts +9 -1
- package/engine/object-field.lua +158 -76
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/objutil/buff.lua +1 -2
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +3 -0
- package/utility/lua-maps.lua +16 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
package/attributes.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
declare const marker: {};
|
|
2
3
|
export type Attribute<T> = {
|
|
3
4
|
readonly __attribute: unique symbol;
|
|
4
5
|
readonly __type: T;
|
|
6
|
+
readonly __marker: typeof marker;
|
|
5
7
|
} & symbol;
|
|
8
|
+
export declare const attribute: <T>() => Attribute<T>;
|
|
9
|
+
export declare const isAttribute: (value: unknown) => value is Attribute<unknown>;
|
|
6
10
|
export declare namespace Attribute {
|
|
7
11
|
const create: <T>() => Attribute<T>;
|
|
8
12
|
}
|
|
@@ -10,3 +14,4 @@ export declare class AttributesHolder {
|
|
|
10
14
|
readonly get: (<T>(attribute: Attribute<T>) => T | undefined) & LuaExtension<"TableGetMethod">;
|
|
11
15
|
readonly set: (<T>(attribute: Attribute<T>, value: T | undefined) => void) & LuaExtension<"TableSetMethod">;
|
|
12
16
|
}
|
|
17
|
+
export {};
|
package/attributes.lua
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local marker = {}
|
|
5
|
+
____exports.attribute = function()
|
|
6
|
+
return {__marker = marker}
|
|
7
|
+
end
|
|
8
|
+
____exports.isAttribute = function(value)
|
|
9
|
+
return type(value) == "table" and rawget(value, "__marker") == marker
|
|
10
|
+
end
|
|
4
11
|
____exports.Attribute = {}
|
|
5
12
|
local Attribute = ____exports.Attribute
|
|
6
13
|
do
|
|
7
14
|
Attribute.create = function()
|
|
8
|
-
return {}
|
|
15
|
+
return {__marker = marker}
|
|
9
16
|
end
|
|
10
17
|
end
|
|
11
18
|
____exports.AttributesHolder = __TS__Class()
|
package/core/types/effect.d.ts
CHANGED
|
@@ -30,12 +30,10 @@ export declare class Effect extends Handle<jeffect> {
|
|
|
30
30
|
set pitch(pitch: number);
|
|
31
31
|
get roll(): number;
|
|
32
32
|
set roll(roll: number);
|
|
33
|
-
static create<T extends Effect>(this: typeof Effect & (new (handle: jeffect) => T),
|
|
34
|
-
static createTarget<T extends Effect>(this: typeof Effect & (new (handle: jeffect) => T), model: string, target: Widget, attachPoint: string): T;
|
|
33
|
+
static create<T extends Effect>(this: typeof Effect & (new (handle: jeffect) => T), modelPath: string, xOrWidget: number | Widget, yOrAttachmentPoint?: number | string, parameters?: EffectParameters): T;
|
|
35
34
|
static flash(modelPath: string, ...args: [
|
|
36
35
|
...pointOrWidget: [x: number, y: number] | [widget: Widget, attachmentPoint?: string],
|
|
37
36
|
...parametersOrDuration: [parametersOrDuration?: EffectParameters | number] | [duration?: number, parameters?: EffectParameters]
|
|
38
37
|
]): void;
|
|
39
|
-
static flashTarget(model: string, target: Widget, attachPoint: string, duration?: number): void;
|
|
40
38
|
}
|
|
41
39
|
export {};
|
package/core/types/effect.lua
CHANGED
|
@@ -4,7 +4,7 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
|
4
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
5
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local dummyPlayer, flash
|
|
7
|
+
local dummyPlayer, addSpecialEffectInternal, flash
|
|
8
8
|
local ____handle = require("core.types.handle")
|
|
9
9
|
local Handle = ____handle.Handle
|
|
10
10
|
local ____playerColor = require("core.types.playerColor")
|
|
@@ -119,6 +119,7 @@ local function setSpecialEffectColor(effect, color)
|
|
|
119
119
|
dummyPlayer.color = dummyColor
|
|
120
120
|
end
|
|
121
121
|
local setters = {scale = setSpecialEffectScale, color = setSpecialEffectColor, pitch = setSpecialEffectPitchDegrees, roll = setSpecialEffectRollDegrees}
|
|
122
|
+
local setterProperties = {"scale", "color", "pitch", "roll"}
|
|
122
123
|
dummyPlayer = Player.neutralExtra
|
|
123
124
|
local temporaryEffects = {}
|
|
124
125
|
local temporaryEffectsDurations = {}
|
|
@@ -177,11 +178,14 @@ function Effect.prototype.onDestroy(self)
|
|
|
177
178
|
destroyEffect(self.handle)
|
|
178
179
|
return Handle.prototype.onDestroy(self)
|
|
179
180
|
end
|
|
180
|
-
function Effect.create(self,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
function Effect.create(self, modelPath, xOrWidget, yOrAttachmentPoint, parameters)
|
|
182
|
+
local effect = self:of(addSpecialEffectInternal(modelPath, xOrWidget, yOrAttachmentPoint, parameters))
|
|
183
|
+
if parameters ~= nil then
|
|
184
|
+
effect[100] = parameters.color
|
|
185
|
+
effect[101] = parameters.pitch
|
|
186
|
+
effect[102] = parameters.roll
|
|
187
|
+
end
|
|
188
|
+
return effect
|
|
185
189
|
end
|
|
186
190
|
function Effect.flash(self, modelPath, xOrWidget, yOrOrAttachmentPoint, parametersOrDuration, parameters)
|
|
187
191
|
if type(parametersOrDuration) ~= "number" then
|
|
@@ -206,24 +210,12 @@ function Effect.flash(self, modelPath, xOrWidget, yOrOrAttachmentPoint, paramete
|
|
|
206
210
|
parameters
|
|
207
211
|
)
|
|
208
212
|
end
|
|
209
|
-
function Effect.flashTarget(self, model, target, attachPoint, duration)
|
|
210
|
-
local effect = addSpecialEffectTarget(model, target.handle, attachPoint)
|
|
211
|
-
if effect ~= nil then
|
|
212
|
-
if duration and duration > 0 then
|
|
213
|
-
temporaryEffectsCount = temporaryEffectsCount + 1
|
|
214
|
-
temporaryEffects[temporaryEffectsCount] = effect
|
|
215
|
-
temporaryEffectsDurations[temporaryEffectsCount] = duration
|
|
216
|
-
else
|
|
217
|
-
destroyEffect(effect)
|
|
218
|
-
end
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
213
|
__TS__SetDescriptor(
|
|
222
214
|
Effect.prototype,
|
|
223
215
|
"color",
|
|
224
216
|
{
|
|
225
217
|
get = function(self)
|
|
226
|
-
return self[100] or PlayerColor.
|
|
218
|
+
return self[100] or PlayerColor.red
|
|
227
219
|
end,
|
|
228
220
|
set = function(self, color)
|
|
229
221
|
setSpecialEffectColor(self.handle, color)
|
|
@@ -273,30 +265,35 @@ __TS__SetDescriptor(
|
|
|
273
265
|
},
|
|
274
266
|
true
|
|
275
267
|
)
|
|
276
|
-
|
|
268
|
+
addSpecialEffectInternal = function(modelPath, xOrWidget, yOrAttachmentPoint, parameters)
|
|
277
269
|
local coordinatesProvided = type(xOrWidget) == "number"
|
|
278
270
|
local isPositional = coordinatesProvided or (parameters and parameters.detached) == true
|
|
279
271
|
local x = not isPositional and 0 or (coordinatesProvided and xOrWidget or xOrWidget.x)
|
|
280
|
-
local y = not isPositional and 0 or (coordinatesProvided and
|
|
281
|
-
local effect = isPositional and addSpecialEffect(modelPath, x, y) or addSpecialEffectTarget(modelPath, xOrWidget.handle,
|
|
282
|
-
if isPositional and not coordinatesProvided and (parameters and parameters.scale) == nil and __TS__InstanceOf(xOrWidget, Unit) then
|
|
283
|
-
setSpecialEffectScale(effect, xOrWidget.scale)
|
|
284
|
-
end
|
|
272
|
+
local y = not isPositional and 0 or (coordinatesProvided and yOrAttachmentPoint or xOrWidget.y)
|
|
273
|
+
local effect = isPositional and addSpecialEffect(modelPath, x, y) or addSpecialEffectTarget(modelPath, xOrWidget.handle, yOrAttachmentPoint or "origin")
|
|
285
274
|
if parameters ~= nil then
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
275
|
+
if isPositional and parameters.scale == nil and __TS__InstanceOf(xOrWidget, Unit) then
|
|
276
|
+
setSpecialEffectScale(effect, xOrWidget.scale)
|
|
277
|
+
end
|
|
278
|
+
for ____, property in ipairs(setterProperties) do
|
|
279
|
+
local value = parameters[property]
|
|
280
|
+
if value ~= nil then
|
|
281
|
+
setters[property](effect, value)
|
|
289
282
|
end
|
|
290
283
|
end
|
|
291
284
|
if isPositional and parameters.zOffset ~= nil then
|
|
292
285
|
moveLocation(location, x, y)
|
|
293
286
|
local z = __TS__InstanceOf(xOrWidget, Unit) and getLocationZ(location) + xOrWidget.flyHeight or getLocationZ(location)
|
|
294
|
-
|
|
287
|
+
setSpecialEffectZ(
|
|
295
288
|
effect,
|
|
296
289
|
z + parameters.zOffset * (parameters.scaleZOffset and getSpecialEffectScale(effect) or 1)
|
|
297
290
|
)
|
|
298
291
|
end
|
|
299
292
|
end
|
|
293
|
+
return effect
|
|
294
|
+
end
|
|
295
|
+
flash = function(modelPath, xOrWidget, yOrAttachmentPoint, duration, parameters)
|
|
296
|
+
local effect = addSpecialEffectInternal(modelPath, xOrWidget, yOrAttachmentPoint, parameters)
|
|
300
297
|
if duration ~= nil and duration > 0 then
|
|
301
298
|
temporaryEffectsCount = temporaryEffectsCount + 1
|
|
302
299
|
temporaryEffects[temporaryEffectsCount] = effect
|
package/core/types/sound.lua
CHANGED
|
@@ -121,6 +121,11 @@ local customSoundPresetDataByLabel = postcompile(function()
|
|
|
121
121
|
end
|
|
122
122
|
return customSoundPresetDataByLabel
|
|
123
123
|
end)
|
|
124
|
+
---
|
|
125
|
+
-- @internal For use by internal systems only.
|
|
126
|
+
____exports.isSoundLabelCustom = function(label)
|
|
127
|
+
return customSoundPresetDataByLabel[label] ~= nil
|
|
128
|
+
end
|
|
124
129
|
local function createPresetSound(fileName, preset)
|
|
125
130
|
local ____fileName_1 = fileName
|
|
126
131
|
local ____preset_looping_0 = preset.looping
|
package/core/types/timer.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Event } from "../../event";
|
|
3
|
+
import { AbstractDestroyable, Destructor } from "../../destroyable";
|
|
3
4
|
declare const enum TimerPropertyKey {
|
|
4
5
|
HANDLE = 0,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ARGS_LENGTH = 4
|
|
6
|
+
DESTROY_ON_EXPIRATION = 1,
|
|
7
|
+
CALLBACK = 2,
|
|
8
|
+
ARGS_LENGTH = 3
|
|
9
9
|
}
|
|
10
|
-
export declare class Timer
|
|
10
|
+
export declare class Timer extends AbstractDestroyable {
|
|
11
11
|
private readonly [TimerPropertyKey.HANDLE];
|
|
12
|
-
private [TimerPropertyKey.DESTROYED]?;
|
|
13
12
|
private [TimerPropertyKey.DESTROY_ON_EXPIRATION]?;
|
|
14
13
|
private [TimerPropertyKey.CALLBACK]?;
|
|
15
14
|
private [TimerPropertyKey.ARGS_LENGTH]?;
|
|
16
15
|
private constructor();
|
|
17
16
|
get handle(): jtimer;
|
|
18
17
|
start<Args extends any[]>(timeout: number, periodic: boolean, callback: (...args: Args) => void, ...args: Args): void;
|
|
18
|
+
onDestroy(): Destructor;
|
|
19
19
|
get elapsed(): number;
|
|
20
20
|
get remaining(): number;
|
|
21
21
|
get timeout(): number;
|
|
22
22
|
pause(): void;
|
|
23
23
|
resume(): void;
|
|
24
|
-
destroy(): void;
|
|
25
24
|
static create(): Timer;
|
|
26
25
|
static run<Args extends any[]>(callback: (...args: Args) => void, ...args: Args): void;
|
|
27
26
|
static simple<Args extends any[]>(timeout: number, callback: (...args: Args) => void, ...args: Args): Timer;
|
package/core/types/timer.lua
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__New = ____lualib.__TS__New
|
|
3
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
4
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
6
|
local __TS__Promise = ____lualib.__TS__Promise
|
|
6
7
|
local ____exports = {}
|
|
@@ -9,8 +10,8 @@ local Event = ____event.Event
|
|
|
9
10
|
local InitializingEvent = ____event.InitializingEvent
|
|
10
11
|
local ____objectPool = require("util.objectPool")
|
|
11
12
|
local ObjectPool = ____objectPool.ObjectPool
|
|
12
|
-
local
|
|
13
|
-
local
|
|
13
|
+
local ____destroyable = require("destroyable")
|
|
14
|
+
local AbstractDestroyable = ____destroyable.AbstractDestroyable
|
|
14
15
|
local createTimer = CreateTimer
|
|
15
16
|
local timerStart = TimerStart
|
|
16
17
|
local pauseTimer = PauseTimer
|
|
@@ -35,14 +36,14 @@ local timerByHandleId = {}
|
|
|
35
36
|
local function timerSafeCall()
|
|
36
37
|
local timer = timerByHandleId[getHandleId(getExpiredTimer())]
|
|
37
38
|
if timer ~= nil then
|
|
38
|
-
if timer[
|
|
39
|
+
if timer[1] then
|
|
39
40
|
timer:destroy()
|
|
40
41
|
end
|
|
41
|
-
local callback = timer[
|
|
42
|
+
local callback = timer[2]
|
|
42
43
|
if callback ~= nil then
|
|
43
44
|
safeCall(
|
|
44
45
|
callback,
|
|
45
|
-
____unpack(timer,
|
|
46
|
+
____unpack(timer, 3 + 1, 3 + (timer[3] or 0))
|
|
46
47
|
)
|
|
47
48
|
end
|
|
48
49
|
end
|
|
@@ -50,37 +51,33 @@ end
|
|
|
50
51
|
____exports.Timer = __TS__Class()
|
|
51
52
|
local Timer = ____exports.Timer
|
|
52
53
|
Timer.name = "Timer"
|
|
54
|
+
__TS__ClassExtends(Timer, AbstractDestroyable)
|
|
53
55
|
function Timer.prototype.____constructor(self)
|
|
56
|
+
AbstractDestroyable.prototype.____constructor(self)
|
|
54
57
|
self[0] = get()
|
|
55
58
|
timerByHandleId[getHandleId(self[0])] = self
|
|
56
59
|
end
|
|
57
60
|
function Timer.prototype.start(self, timeout, periodic, callback, ...)
|
|
58
|
-
self[
|
|
61
|
+
self[2] = callback
|
|
59
62
|
local argsLength = select("#", ...)
|
|
60
|
-
self[
|
|
63
|
+
self[3] = argsLength
|
|
61
64
|
for i = 1, argsLength do
|
|
62
|
-
self[
|
|
65
|
+
self[3 + i] = (select(i, ...))
|
|
63
66
|
end
|
|
64
67
|
timerStart(self.handle, timeout, periodic, timerSafeCall)
|
|
65
68
|
end
|
|
69
|
+
function Timer.prototype.onDestroy(self)
|
|
70
|
+
local handle = self[0]
|
|
71
|
+
timerByHandleId[getHandleId(handle)] = nil
|
|
72
|
+
release(handle)
|
|
73
|
+
return AbstractDestroyable.prototype.onDestroy(self)
|
|
74
|
+
end
|
|
66
75
|
function Timer.prototype.pause(self)
|
|
67
76
|
pauseTimer(self[0])
|
|
68
77
|
end
|
|
69
78
|
function Timer.prototype.resume(self)
|
|
70
79
|
resumeTimer(self[0])
|
|
71
80
|
end
|
|
72
|
-
function Timer.prototype.destroy(self)
|
|
73
|
-
if self[1] then
|
|
74
|
-
error(
|
|
75
|
-
__TS__New(IllegalStateException, "Double-destroy run for timer"),
|
|
76
|
-
0
|
|
77
|
-
)
|
|
78
|
-
end
|
|
79
|
-
local handle = self[0]
|
|
80
|
-
timerByHandleId[getHandleId(handle)] = nil
|
|
81
|
-
release(handle)
|
|
82
|
-
self[1] = true
|
|
83
|
-
end
|
|
84
81
|
function Timer.create(self)
|
|
85
82
|
return __TS__New(____exports.Timer)
|
|
86
83
|
end
|
|
@@ -89,7 +86,7 @@ function Timer.run(self, callback, ...)
|
|
|
89
86
|
end
|
|
90
87
|
function Timer.simple(self, timeout, callback, ...)
|
|
91
88
|
local timer = __TS__New(____exports.Timer)
|
|
92
|
-
timer[
|
|
89
|
+
timer[1] = true
|
|
93
90
|
timer:start(timeout, false, callback, ...)
|
|
94
91
|
return timer
|
|
95
92
|
end
|