warscript 0.0.1-dev.404878c → 0.0.1-dev.58c74da
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 +13 -0
- package/attributes.lua +16 -0
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +8 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- package/engine/internal/ability.d.ts +1 -1
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +2 -0
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/internal/unit.d.ts +10 -2
- package/engine/internal/unit.lua +34 -9
- package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type.d.ts +1 -0
- package/engine/object-data/entry/ability-type.lua +1 -0
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- package/engine/object-data/entry/unit-type.d.ts +21 -0
- package/engine/object-data/entry/unit-type.lua +198 -44
- package/engine/object-field/ability.d.ts +7 -5
- package/engine/object-field/ability.lua +6 -0
- package/engine/object-field/unit.d.ts +1 -0
- package/engine/object-field/unit.lua +3 -0
- package/engine/object-field.d.ts +6 -3
- package/engine/object-field.lua +38 -12
- package/engine/standard/entries/unit-type.d.ts +24 -1
- package/engine/standard/entries/unit-type.lua +24 -1
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/exception.d.ts +2 -0
- package/exception.lua +4 -0
- package/global/vec2.lua +1 -0
- package/package.json +3 -4
- package/string.d.ts +14 -0
- package/string.lua +9 -0
- package/utility/arrays.d.ts +1 -1
- package/utility/arrays.lua +4 -1
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +16 -0
- package/utility/types.d.ts +2 -2
package/engine/object-field.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type ObjectFieldId = number & {
|
|
|
9
9
|
export type ObjectFieldConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (new (id: number) => T);
|
|
10
10
|
export type ObjectFieldAbstractConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (abstract new (id: number) => T);
|
|
11
11
|
declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEntry, InstanceType extends AnyNotNil, ValueType, NativeFieldType> {
|
|
12
|
-
protected readonly valueByInstance: LuaMap<InstanceType, ValueType>;
|
|
13
12
|
protected abstract readonly instanceClass: AbstractConstructor<InstanceType> | Function;
|
|
14
13
|
supports(instance: AnyNotNil): instance is InstanceType & {
|
|
15
14
|
readonly __oneSidedTypeGuard: unique symbol;
|
|
@@ -33,21 +32,23 @@ export type ObjectFieldValueChangeEvent<T extends ObjectField<any, any, any, any
|
|
|
33
32
|
previousValue: ValueType,
|
|
34
33
|
newValue: ValueType
|
|
35
34
|
]> : never;
|
|
36
|
-
export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> = Omit<T, "setValue" | "removeValue">;
|
|
35
|
+
export type ReadonlyObjectFieldType<T extends ObjectField<any, any, any, any>> = Omit<T, "setValue" | "removeValue" | "trySetValue">;
|
|
37
36
|
type ReadonlyObjectFieldConstructor<T extends ObjectField> = OmitConstructor<typeof ObjectField> & (abstract new (...args: any[]) => ReadonlyObjectFieldType<T>);
|
|
38
37
|
export declare abstract class ObjectField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType, NativeFieldType> {
|
|
39
38
|
protected abstract readonly defaultValue: ValueType;
|
|
39
|
+
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
40
40
|
protected abstract getNativeFieldValue(instance: InstanceType): ValueType;
|
|
41
41
|
protected abstract setNativeFieldValue(instance: InstanceType, value: ValueType): boolean;
|
|
42
42
|
getValue(entry: ObjectDataEntryType | InstanceType): ValueType;
|
|
43
43
|
setValue(entry: ObjectDataEntryType | InstanceType, value: ValueType): boolean;
|
|
44
44
|
removeValue(entry: ObjectDataEntryType): boolean;
|
|
45
|
+
trySetValue(entry: ObjectDataEntryType | InstanceType, value: unknown): boolean;
|
|
45
46
|
private invokeValueChangeEvent;
|
|
46
47
|
private invokeValueChangeEventRecursive;
|
|
47
48
|
protected static getOrCreateValueChangeEvent<T extends ObjectField, R extends ReadonlyObjectFieldType<T>>(this: ReadonlyObjectFieldConstructor<T>): ObjectFieldValueChangeEvent<R>;
|
|
48
49
|
static get valueChangeEvent(): ObjectFieldValueChangeEvent<ReadonlyObjectFieldType<ObjectField>>;
|
|
49
50
|
}
|
|
50
|
-
export type ReadonlyObjectLevelFieldType<T extends ObjectLevelField<any, any, any, any>> = Omit<T, "setValue">;
|
|
51
|
+
export type ReadonlyObjectLevelFieldType<T extends ObjectLevelField<any, any, any, any>> = Omit<T, "setValue" | "trySetValue">;
|
|
51
52
|
export type ObjectLevelFieldValueChangeEvent<T extends ObjectLevelField<any, any, any, any> | ReadonlyObjectLevelFieldType<ObjectLevelField<any, any, any, any>>> = T extends ObjectLevelField<any, infer InstanceType, infer ValueType, any, any> ? DispatchingEvent<[
|
|
52
53
|
instance: InstanceType,
|
|
53
54
|
field: T,
|
|
@@ -71,11 +72,13 @@ export declare abstract class ObjectArrayField<ObjectDataEntryType extends Objec
|
|
|
71
72
|
}
|
|
72
73
|
export declare abstract class ObjectLevelField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType[], NativeFieldType> {
|
|
73
74
|
protected abstract readonly defaultValue: ValueType;
|
|
75
|
+
protected abstract hasNativeFieldValue(instance: InstanceType): boolean;
|
|
74
76
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
75
77
|
protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
|
|
76
78
|
protected abstract getLevelCount(entry: ObjectDataEntryType | InstanceType): number;
|
|
77
79
|
getValue<LevelType extends [number] | []>(entry: ObjectDataEntryType | InstanceType, ...[level]: LevelType): LevelType extends [number] ? ValueType : ValueType[];
|
|
78
80
|
setValue(entry: ObjectDataEntryType | InstanceType, ...[levelOrValue, value]: [value: ObjectDataEntryLevelFieldValueSupplier<InputValueType, ValueType>] | [level: number, value: InputValueType]): boolean;
|
|
81
|
+
trySetValue(entry: ObjectDataEntryType | InstanceType, levelOrValue: number | unknown, value?: unknown): boolean;
|
|
79
82
|
private invokeValueChangeEvent;
|
|
80
83
|
private invokeValueChangeEventRecursive;
|
|
81
84
|
protected static getOrCreateValueChangeEvent<T extends ObjectLevelField, R extends ReadonlyObjectLevelFieldType<T>>(this: ReadonlyObjectLevelFieldConstructor<T>): ObjectLevelFieldValueChangeEvent<R>;
|
package/engine/object-field.lua
CHANGED
|
@@ -4,6 +4,7 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
4
4
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
6
6
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
7
|
+
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
7
8
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
8
9
|
local ____exports = {}
|
|
9
10
|
local ____event = require("event")
|
|
@@ -131,13 +132,15 @@ function ObjectField.prototype.setValue(self, entry, value)
|
|
|
131
132
|
return true
|
|
132
133
|
end
|
|
133
134
|
end
|
|
135
|
+
if not self:hasNativeFieldValue(entry) then
|
|
136
|
+
return false
|
|
137
|
+
end
|
|
134
138
|
local previousValue = self:getNativeFieldValue(entry)
|
|
135
139
|
if value ~= previousValue then
|
|
136
|
-
if self:setNativeFieldValue(entry, value) then
|
|
137
|
-
self:invokeValueChangeEvent(entry, self, previousValue, value)
|
|
138
|
-
else
|
|
140
|
+
if not self:setNativeFieldValue(entry, value) then
|
|
139
141
|
return false
|
|
140
142
|
end
|
|
143
|
+
self:invokeValueChangeEvent(entry, self, previousValue, value)
|
|
141
144
|
end
|
|
142
145
|
return true
|
|
143
146
|
end
|
|
@@ -155,6 +158,12 @@ function ObjectField.prototype.removeValue(self, entry)
|
|
|
155
158
|
end
|
|
156
159
|
return false
|
|
157
160
|
end
|
|
161
|
+
function ObjectField.prototype.trySetValue(self, entry, value)
|
|
162
|
+
if __TS__TypeOf(value) ~= __TS__TypeOf(self.defaultValue) then
|
|
163
|
+
return false
|
|
164
|
+
end
|
|
165
|
+
return self:setValue(entry, value)
|
|
166
|
+
end
|
|
158
167
|
function ObjectField.prototype.invokeValueChangeEvent(self, ...)
|
|
159
168
|
self:invokeValueChangeEventRecursive(
|
|
160
169
|
getClass(self),
|
|
@@ -383,22 +392,39 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
383
392
|
return true
|
|
384
393
|
end
|
|
385
394
|
end
|
|
395
|
+
if not self:hasNativeFieldValue(entry) then
|
|
396
|
+
return false
|
|
397
|
+
end
|
|
386
398
|
local previousValue = self:getNativeFieldValue(entry, level)
|
|
387
399
|
if value ~= previousValue then
|
|
388
|
-
if self:setNativeFieldValue(entry, level, value) then
|
|
389
|
-
self:invokeValueChangeEvent(
|
|
390
|
-
entry,
|
|
391
|
-
self,
|
|
392
|
-
level,
|
|
393
|
-
previousValue,
|
|
394
|
-
value
|
|
395
|
-
)
|
|
396
|
-
else
|
|
400
|
+
if not self:setNativeFieldValue(entry, level, value) then
|
|
397
401
|
return false
|
|
398
402
|
end
|
|
403
|
+
self:invokeValueChangeEvent(
|
|
404
|
+
entry,
|
|
405
|
+
self,
|
|
406
|
+
level,
|
|
407
|
+
previousValue,
|
|
408
|
+
value
|
|
409
|
+
)
|
|
399
410
|
end
|
|
400
411
|
return true
|
|
401
412
|
end
|
|
413
|
+
function ObjectLevelField.prototype.trySetValue(self, entry, levelOrValue, value)
|
|
414
|
+
if value ~= nil then
|
|
415
|
+
if __TS__TypeOf(value) ~= __TS__TypeOf(self.defaultValue) then
|
|
416
|
+
return false
|
|
417
|
+
end
|
|
418
|
+
if type(levelOrValue) ~= "number" then
|
|
419
|
+
return false
|
|
420
|
+
end
|
|
421
|
+
return self:setValue(entry, levelOrValue, value)
|
|
422
|
+
end
|
|
423
|
+
if __TS__TypeOf(levelOrValue) ~= __TS__TypeOf(self.defaultValue) then
|
|
424
|
+
return false
|
|
425
|
+
end
|
|
426
|
+
return self:setValue(entry, levelOrValue)
|
|
427
|
+
end
|
|
402
428
|
function ObjectLevelField.prototype.invokeValueChangeEvent(self, ...)
|
|
403
429
|
self:invokeValueChangeEventRecursive(
|
|
404
430
|
getClass(self),
|
|
@@ -9,11 +9,31 @@ export declare const RIFLEMAN_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
|
9
9
|
export declare const SIEGE_ENGINE_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
10
10
|
export declare const SORCERESS_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
11
11
|
export declare const SPELLBREAKER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
12
|
-
export declare const PALADIN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
13
12
|
export declare const ARCHMAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
13
|
+
export declare const BLOOD_MAGE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
14
|
+
export declare const MOUNTAIN_KING_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
15
|
+
export declare const PALADIN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
14
16
|
export declare const CAPTAIN_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
17
|
+
export declare const ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
18
|
+
export declare const ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
19
|
+
export declare const ANTONIDAS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
20
|
+
export declare const ANTONIDAS_GHOST_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
15
21
|
export declare const ARTHAS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
16
22
|
export declare const ARTHAS_WITH_FROSTMOURNE_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
23
|
+
export declare const DAGREN_THE_ORCSLAYER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
24
|
+
export declare const HALAHK_THE_LIFEBRINGER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
25
|
+
export declare const JAINA_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
26
|
+
export declare const JENNALLA_DEEMSPRING_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
27
|
+
export declare const KAEL_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
28
|
+
export declare const KELEN_THE_SEEKER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
29
|
+
export declare const LORD_GARITHOS_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
30
|
+
export declare const LORD_NICHOLAS_BUZAN_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
31
|
+
export declare const MAGROTH_THE_DEFENDER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
32
|
+
export declare const MURADIN_BRONZEBEARD_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
33
|
+
export declare const SIR_GREGORY_EDMUNSON_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
34
|
+
export declare const SYLVANAS_WINDRUNNER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
35
|
+
export declare const THALORIEN_DAWNSEEKER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
36
|
+
export declare const UTHER_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
17
37
|
export declare const BATRIDER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
18
38
|
export declare const DEMOLISHER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
19
39
|
export declare const GRUNT_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
@@ -30,6 +50,9 @@ export declare const DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID: StandardHeroUnit
|
|
|
30
50
|
export declare const ABOMINATION_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
31
51
|
export declare const GHOUL_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
32
52
|
export declare const DEATH_KNIGHT_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
53
|
+
export declare const ZOMBIE_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
54
|
+
export declare const ZOMBIE_FEMALE_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
55
|
+
export declare const ARTHAS_EVIL_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
|
|
33
56
|
export declare const DIRE_MAMMOTH_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
34
57
|
export declare const ELDER_JUNGLE_STALKER_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
35
58
|
export declare const ENRAGED_ELEMENTAL_UNIT_TYPE_ID: StandardUnitTypeId;
|
|
@@ -8,11 +8,31 @@ ____exports.RIFLEMAN_UNIT_TYPE_ID = fourCC("hrif")
|
|
|
8
8
|
____exports.SIEGE_ENGINE_UNIT_TYPE_ID = fourCC("hmtt")
|
|
9
9
|
____exports.SORCERESS_UNIT_TYPE_ID = fourCC("hsor")
|
|
10
10
|
____exports.SPELLBREAKER_UNIT_TYPE_ID = fourCC("hspt")
|
|
11
|
-
____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
|
|
12
11
|
____exports.ARCHMAGE_HERO_UNIT_TYPE_ID = fourCC("Hamg")
|
|
12
|
+
____exports.BLOOD_MAGE_HERO_UNIT_TYPE_ID = fourCC("Hblm")
|
|
13
|
+
____exports.MOUNTAIN_KING_HERO_UNIT_TYPE_ID = fourCC("Hmkg")
|
|
14
|
+
____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
|
|
13
15
|
____exports.CAPTAIN_UNIT_TYPE_ID = fourCC("hcth")
|
|
16
|
+
____exports.ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID = fourCC("Hapm")
|
|
17
|
+
____exports.ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID = fourCC("Hssa")
|
|
18
|
+
____exports.ANTONIDAS_HERO_UNIT_TYPE_ID = fourCC("Hant")
|
|
19
|
+
____exports.ANTONIDAS_GHOST_HERO_UNIT_TYPE_ID = fourCC("Hgam")
|
|
14
20
|
____exports.ARTHAS_HERO_UNIT_TYPE_ID = fourCC("Hart")
|
|
15
21
|
____exports.ARTHAS_WITH_FROSTMOURNE_HERO_UNIT_TYPE_ID = fourCC("Harf")
|
|
22
|
+
____exports.DAGREN_THE_ORCSLAYER_HERO_UNIT_TYPE_ID = fourCC("Hdgo")
|
|
23
|
+
____exports.HALAHK_THE_LIFEBRINGER_HERO_UNIT_TYPE_ID = fourCC("Hhkl")
|
|
24
|
+
____exports.JAINA_HERO_UNIT_TYPE_ID = fourCC("Hjai")
|
|
25
|
+
____exports.JENNALLA_DEEMSPRING_HERO_UNIT_TYPE_ID = fourCC("Hjnd")
|
|
26
|
+
____exports.KAEL_HERO_UNIT_TYPE_ID = fourCC("Hkal")
|
|
27
|
+
____exports.KELEN_THE_SEEKER_HERO_UNIT_TYPE_ID = fourCC("Haah")
|
|
28
|
+
____exports.LORD_GARITHOS_HERO_UNIT_TYPE_ID = fourCC("Hlgr")
|
|
29
|
+
____exports.LORD_NICHOLAS_BUZAN_HERO_UNIT_TYPE_ID = fourCC("Hpb1")
|
|
30
|
+
____exports.MAGROTH_THE_DEFENDER_HERO_UNIT_TYPE_ID = fourCC("Hmgd")
|
|
31
|
+
____exports.MURADIN_BRONZEBEARD_HERO_UNIT_TYPE_ID = fourCC("Hmbr")
|
|
32
|
+
____exports.SIR_GREGORY_EDMUNSON_HERO_UNIT_TYPE_ID = fourCC("Hpb2")
|
|
33
|
+
____exports.SYLVANAS_WINDRUNNER_HERO_UNIT_TYPE_ID = fourCC("Hvwd")
|
|
34
|
+
____exports.THALORIEN_DAWNSEEKER_HERO_UNIT_TYPE_ID = fourCC("Hddt")
|
|
35
|
+
____exports.UTHER_HERO_UNIT_TYPE_ID = fourCC("Huth")
|
|
16
36
|
____exports.BATRIDER_UNIT_TYPE_ID = fourCC("otbr")
|
|
17
37
|
____exports.DEMOLISHER_UNIT_TYPE_ID = fourCC("ocat")
|
|
18
38
|
____exports.GRUNT_UNIT_TYPE_ID = fourCC("ogru")
|
|
@@ -29,6 +49,9 @@ ____exports.DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID = fourCC("Edmm")
|
|
|
29
49
|
____exports.ABOMINATION_UNIT_TYPE_ID = fourCC("uabo")
|
|
30
50
|
____exports.GHOUL_UNIT_TYPE_ID = fourCC("ugho")
|
|
31
51
|
____exports.DEATH_KNIGHT_HERO_UNIT_TYPE_ID = fourCC("Udea")
|
|
52
|
+
____exports.ZOMBIE_UNIT_TYPE_ID = fourCC("nzom")
|
|
53
|
+
____exports.ZOMBIE_FEMALE_UNIT_TYPE_ID = fourCC("nzof")
|
|
54
|
+
____exports.ARTHAS_EVIL_HERO_UNIT_TYPE_ID = fourCC("Uear")
|
|
32
55
|
____exports.DIRE_MAMMOTH_UNIT_TYPE_ID = fourCC("nmdr")
|
|
33
56
|
____exports.ELDER_JUNGLE_STALKER_UNIT_TYPE_ID = fourCC("njga")
|
|
34
57
|
____exports.ENRAGED_ELEMENTAL_UNIT_TYPE_ID = fourCC("nele")
|
package/engine/unit.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import "./internal/unit/missile";
|
|
|
14
14
|
import "./internal/unit-missile-launch";
|
|
15
15
|
import "./internal/unit/ghost-counter";
|
|
16
16
|
import "./internal/unit/invulnerability-counter";
|
|
17
|
+
import "./internal/unit/detach-missiles";
|
|
17
18
|
import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
|
|
18
19
|
export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
|
|
19
20
|
export * from "./internal/unit+damage";
|
package/engine/unit.lua
CHANGED
|
@@ -14,6 +14,7 @@ require("engine.internal.unit.missile")
|
|
|
14
14
|
require("engine.internal.unit-missile-launch")
|
|
15
15
|
require("engine.internal.unit.ghost-counter")
|
|
16
16
|
require("engine.internal.unit.invulnerability-counter")
|
|
17
|
+
require("engine.internal.unit.detach-missiles")
|
|
17
18
|
require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
|
|
18
19
|
do
|
|
19
20
|
local ____unit = require("engine.internal.unit")
|
package/exception.d.ts
CHANGED
package/exception.lua
CHANGED
|
@@ -50,4 +50,8 @@ ____exports.CancellationException = __TS__Class()
|
|
|
50
50
|
local CancellationException = ____exports.CancellationException
|
|
51
51
|
CancellationException.name = "CancellationException"
|
|
52
52
|
__TS__ClassExtends(CancellationException, ____exports.Exception)
|
|
53
|
+
____exports.UnsupportedOperationException = __TS__Class()
|
|
54
|
+
local UnsupportedOperationException = ____exports.UnsupportedOperationException
|
|
55
|
+
UnsupportedOperationException.name = "UnsupportedOperationException"
|
|
56
|
+
__TS__ClassExtends(UnsupportedOperationException, ____exports.Exception)
|
|
53
57
|
return ____exports
|
package/global/vec2.lua
CHANGED
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.58c74da",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -22,10 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
|
-
"@warscript/tstl-plugin": "^0.0.
|
|
26
|
-
"typescript-to-lua": "^1.24.1",
|
|
25
|
+
"@warscript/tstl-plugin": "^0.0.3",
|
|
27
26
|
"lua-types": "^2.13.1",
|
|
28
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.ec41c86"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
package/string.d.ts
CHANGED
|
@@ -103,4 +103,18 @@ declare global {
|
|
|
103
103
|
function isNotBlank(string: string): boolean;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
declare global {
|
|
107
|
+
namespace string {
|
|
108
|
+
/**
|
|
109
|
+
* Returns the number of characters matching the given predicate.
|
|
110
|
+
*/
|
|
111
|
+
function count(string: string, predicate: (char: string) => boolean): number;
|
|
112
|
+
}
|
|
113
|
+
interface String {
|
|
114
|
+
/**
|
|
115
|
+
* Returns the number of characters matching the given predicate.
|
|
116
|
+
*/
|
|
117
|
+
count(predicate: (char: string) => boolean): number;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
106
120
|
export {};
|
package/string.lua
CHANGED
|
@@ -31,4 +31,13 @@ end
|
|
|
31
31
|
_G.string.isNotBlank = function(____string)
|
|
32
32
|
return (match(____string, "^%s*$")) == nil
|
|
33
33
|
end
|
|
34
|
+
_G.string.count = function(____string, predicate)
|
|
35
|
+
local result = 0
|
|
36
|
+
for i = 1, #____string do
|
|
37
|
+
if predicate(sub(____string, i, i)) then
|
|
38
|
+
result = result + 1
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
return result
|
|
42
|
+
end
|
|
34
43
|
return ____exports
|
package/utility/arrays.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/** @noSelfInFile */
|
|
3
3
|
import { TupleOf } from "./types";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const emptyArray: <T>() => readonly T[];
|
|
5
5
|
export declare const joinToString: <T>(array: readonly T[], separator: string, transform?: (element: T) => string) => string;
|
|
6
6
|
export declare const arrayOfNotNull: <T>(...elements: readonly (T | null | undefined)[]) => T[];
|
|
7
7
|
export declare const array: <T, N extends number>(length: N, initialize: (index: number) => T) => TupleOf<T, N>;
|
package/utility/arrays.lua
CHANGED
|
@@ -8,7 +8,10 @@ local mathMin = math.min
|
|
|
8
8
|
local select = _G.select
|
|
9
9
|
local tableConcat = table.concat
|
|
10
10
|
local tableSort = table.sort
|
|
11
|
-
|
|
11
|
+
local EMPTY_ARRAY = {}
|
|
12
|
+
____exports.emptyArray = function()
|
|
13
|
+
return EMPTY_ARRAY
|
|
14
|
+
end
|
|
12
15
|
____exports.joinToString = function(array, separator, transform)
|
|
13
16
|
if transform == nil then
|
|
14
17
|
transform = tostring
|
package/utility/linked-set.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet
|
|
|
44
44
|
sortBy<R>(selector: ((value: T) => R) | KeysOfType<T, R>): void;
|
|
45
45
|
protected __pairs(this: LinkedSet<T>): LuaIterator<T | undefined, IteratorState<T>>;
|
|
46
46
|
}
|
|
47
|
+
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
47
48
|
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LinkedSet<T>;
|
|
48
49
|
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | null | undefined)[]) => LinkedSet<T>;
|
|
49
50
|
export {};
|
package/utility/linked-set.lua
CHANGED
|
@@ -2,9 +2,12 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local ____arrays = require("utility.arrays")
|
|
7
8
|
local sortBy = ____arrays.sortBy
|
|
9
|
+
local ____exception = require("exception")
|
|
10
|
+
local UnsupportedOperationException = ____exception.UnsupportedOperationException
|
|
8
11
|
local function linkedSetNext(state)
|
|
9
12
|
local n = state.n
|
|
10
13
|
state.n = state.t[n]
|
|
@@ -161,6 +164,19 @@ __TS__SetDescriptor(
|
|
|
161
164
|
end},
|
|
162
165
|
true
|
|
163
166
|
)
|
|
167
|
+
local EmptyLinkedSet = __TS__Class()
|
|
168
|
+
EmptyLinkedSet.name = "EmptyLinkedSet"
|
|
169
|
+
__TS__ClassExtends(EmptyLinkedSet, ____exports.LinkedSet)
|
|
170
|
+
function EmptyLinkedSet.prototype.add(self)
|
|
171
|
+
error(
|
|
172
|
+
__TS__New(UnsupportedOperationException),
|
|
173
|
+
0
|
|
174
|
+
)
|
|
175
|
+
end
|
|
176
|
+
local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
|
|
177
|
+
____exports.emptyLinkedSet = function()
|
|
178
|
+
return EMPTY_LINKED_SET
|
|
179
|
+
end
|
|
164
180
|
____exports.linkedSetOf = function(...)
|
|
165
181
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
166
182
|
for i = 1, select("#", ...) do
|
package/utility/types.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ export type ValueOf<T> = T[keyof T];
|
|
|
12
12
|
export type EntryOf<T> = ValueOf<{
|
|
13
13
|
[K in keyof T]: [K, T[K]];
|
|
14
14
|
}>;
|
|
15
|
-
export type MutableKeys<T extends object> = {
|
|
15
|
+
export type MutableKeys<T extends object> = keyof T & {
|
|
16
16
|
[P in keyof T]-?: IfEquals<{
|
|
17
17
|
[Q in P]: T[P];
|
|
18
18
|
}, {
|
|
19
19
|
-readonly [Q in P]: T[P];
|
|
20
20
|
}, P>;
|
|
21
21
|
}[keyof T];
|
|
22
|
-
export type ReadonlyKeys<T extends object> = {
|
|
22
|
+
export type ReadonlyKeys<T extends object> = keyof T & {
|
|
23
23
|
[P in keyof T]-?: IfEquals<{
|
|
24
24
|
[Q in P]: T[P];
|
|
25
25
|
}, {
|