warscript 0.0.1-dev.effa673 → 0.0.1-dev.f1df135
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/timer.d.ts +6 -7
- package/core/types/timer.lua +18 -21
- package/engine/object-data/auxiliary/attachment-preset.d.ts +1 -1
- package/engine/object-data/auxiliary/attachment-preset.lua +3 -2
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/package.json +2 -2
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
|
|
@@ -11,7 +11,7 @@ export type AttachmentPreset = {
|
|
|
11
11
|
export type EffectPresetWithParameters = AttachmentPreset & {
|
|
12
12
|
parameters?: EffectParameters;
|
|
13
13
|
};
|
|
14
|
-
export type AttachmentPresetInput<T extends AttachmentPreset = AttachmentPreset> = Optional<T, "nodeQualifiers"> | string;
|
|
14
|
+
export type AttachmentPresetInput<T extends AttachmentPreset = AttachmentPreset> = Optional<T, "nodeName" | "nodeQualifiers"> | string;
|
|
15
15
|
export type EffectPresetWithParametersInput = AttachmentPresetInput<EffectPresetWithParameters>;
|
|
16
16
|
export declare const toEffectPreset: (effectPresetInput: EffectPresetWithParametersInput) => EffectPresetWithParameters;
|
|
17
17
|
export declare const extractAttachmentPresetInputModelPath: (attachmentPresetInput: AttachmentPresetInput | undefined) => string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayJoin = ____lualib.__TS__ArrayJoin
|
|
2
3
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
3
4
|
local __TS__ArraySlice = ____lualib.__TS__ArraySlice
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
____exports.toEffectPreset = function(effectPresetInput)
|
|
6
|
-
return type(effectPresetInput) == "string" and ({modelPath = effectPresetInput, nodeName = "origin", nodeQualifiers = {}}) or ({modelPath = effectPresetInput.modelPath, nodeName = effectPresetInput.nodeName, nodeQualifiers = effectPresetInput.nodeQualifiers or ({}), parameters = effectPresetInput.parameters})
|
|
7
|
+
return type(effectPresetInput) == "string" and ({modelPath = effectPresetInput, nodeName = "origin", nodeQualifiers = {}}) or ({modelPath = effectPresetInput.modelPath, nodeName = effectPresetInput.nodeName or "origin", nodeQualifiers = effectPresetInput.nodeQualifiers or ({}), parameters = effectPresetInput.parameters})
|
|
7
8
|
end
|
|
8
9
|
____exports.extractAttachmentPresetInputModelPath = function(attachmentPresetInput)
|
|
9
10
|
return type(attachmentPresetInput) == "string" and attachmentPresetInput or (attachmentPresetInput and attachmentPresetInput.modelPath or "")
|
|
@@ -12,7 +13,7 @@ ____exports.extractAttachmentPresetInputNodeFQN = function(attachmentPresetInput
|
|
|
12
13
|
if type(attachmentPresetInput) == "string" or attachmentPresetInput == nil then
|
|
13
14
|
return ""
|
|
14
15
|
end
|
|
15
|
-
return
|
|
16
|
+
return __TS__ArrayJoin(
|
|
16
17
|
{
|
|
17
18
|
attachmentPresetInput.nodeName,
|
|
18
19
|
table.unpack(attachmentPresetInput.nodeQualifiers or ({}))
|
|
@@ -7,4 +7,6 @@ export declare class BerserkAbilityType extends AbilityType {
|
|
|
7
7
|
set movementSpeedIncreaseFactor(movementSpeedIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
8
8
|
get attackSpeedIncreaseFactor(): number[];
|
|
9
9
|
set attackSpeedIncreaseFactor(attackSpeedIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
10
|
+
get receivedDamageIncreaseFactor(): number[];
|
|
11
|
+
set receivedDamageIncreaseFactor(receivedDamageIncreaseFactor: ObjectDataEntryLevelFieldValueSupplier<number>);
|
|
10
12
|
}
|
|
@@ -36,4 +36,17 @@ __TS__SetDescriptor(
|
|
|
36
36
|
},
|
|
37
37
|
true
|
|
38
38
|
)
|
|
39
|
+
__TS__SetDescriptor(
|
|
40
|
+
BerserkAbilityType.prototype,
|
|
41
|
+
"receivedDamageIncreaseFactor",
|
|
42
|
+
{
|
|
43
|
+
get = function(self)
|
|
44
|
+
return self:getNumberLevelField("bsk3")
|
|
45
|
+
end,
|
|
46
|
+
set = function(self, receivedDamageIncreaseFactor)
|
|
47
|
+
self:setNumberLevelField("bsk3", receivedDamageIncreaseFactor)
|
|
48
|
+
end
|
|
49
|
+
},
|
|
50
|
+
true
|
|
51
|
+
)
|
|
39
52
|
return ____exports
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "warscript",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.f1df135",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
25
|
"@warscript/tstl-plugin": "^0.0.4",
|
|
26
26
|
"lua-types": "^2.13.1",
|
|
27
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.8e8a660"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|