warscript 0.0.1-dev.ba37a78 → 0.0.1-dev.ccd5725

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.
@@ -0,0 +1,13 @@
1
+ /// <reference types="@typescript-to-lua/language-extensions" />
2
+ /** @noSelfInFile */
3
+ export type Attribute<T> = {
4
+ readonly __attribute: unique symbol;
5
+ readonly __type: T;
6
+ } & symbol;
7
+ export declare namespace Attribute {
8
+ const create: <T>() => Attribute<T>;
9
+ }
10
+ export declare class AttributesHolder {
11
+ readonly get: (<T>(attribute: Attribute<T>) => T | undefined) & LuaExtension<"TableGetMethod">;
12
+ readonly set: (<T>(attribute: Attribute<T>, value: T | undefined) => void) & LuaExtension<"TableSetMethod">;
13
+ }
package/attributes.lua ADDED
@@ -0,0 +1,16 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__Class = ____lualib.__TS__Class
3
+ local ____exports = {}
4
+ ____exports.Attribute = {}
5
+ local Attribute = ____exports.Attribute
6
+ do
7
+ Attribute.create = function()
8
+ return {}
9
+ end
10
+ end
11
+ ____exports.AttributesHolder = __TS__Class()
12
+ local AttributesHolder = ____exports.AttributesHolder
13
+ AttributesHolder.name = "AttributesHolder"
14
+ function AttributesHolder.prototype.____constructor(self)
15
+ end
16
+ return ____exports
@@ -1,5 +1,6 @@
1
1
  /** @noSelfInFile */
2
2
  import { Event } from "../../event";
3
+ import { AttributesHolder } from "../../attributes";
3
4
  export type HandleConstructor<H extends jhandle, T extends Handle<H>, Args extends any[]> = new (handle: H, ...args: Args) => T;
4
5
  export type HandleDestructor = {
5
6
  readonly __handleDestructor: unique symbol;
@@ -11,7 +12,7 @@ type NoOverride = {
11
12
  declare const enum HandlePropertyKey {
12
13
  STATE = 0
13
14
  }
14
- export declare class Handle<H extends jhandle, DestroyParameters extends any[] = []> implements Destroyable {
15
+ export declare class Handle<H extends jhandle, DestroyParameters extends any[] = []> extends AttributesHolder implements Destroyable {
15
16
  readonly handle: H;
16
17
  private [HandlePropertyKey.STATE]?;
17
18
  private onDestroyEvent?;
@@ -1,5 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
3
4
  local __TS__New = ____lualib.__TS__New
4
5
  local __TS__Delete = ____lualib.__TS__Delete
5
6
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
@@ -12,13 +13,17 @@ local getClass = ____reflection.getClass
12
13
  local getSuperclass = ____reflection.getSuperclass
13
14
  local ____exception = require("exception")
14
15
  local IllegalStateException = ____exception.IllegalStateException
16
+ local ____attributes = require("attributes")
17
+ local AttributesHolder = ____attributes.AttributesHolder
15
18
  local getHandleId = GetHandleId
16
19
  local onCreateEventByHandleConstructor = {}
17
20
  local onDestroyEventByHandleConstructor = {}
18
21
  ____exports.Handle = __TS__Class()
19
22
  local Handle = ____exports.Handle
20
23
  Handle.name = "Handle"
24
+ __TS__ClassExtends(Handle, AttributesHolder)
21
25
  function Handle.prototype.____constructor(self, handle)
26
+ AttributesHolder.prototype.____constructor(self)
22
27
  self[0] = 0
23
28
  local id = getHandleId(handle)
24
29
  local clazz = self.constructor
@@ -3,14 +3,13 @@ import { AbilityBehavior } from "../ability";
3
3
  import { Ability } from "../../internal/ability";
4
4
  import { UnitBehavior } from "../unit";
5
5
  import { Unit } from "../../internal/unit";
6
- import { MutableKeys } from "../../../utility/types";
7
6
  import { AbilityDependentValue } from "../../object-field/ability";
8
7
  export declare class ApplyUnitBehaviorAbilityBehavior<T extends UnitBehavior> extends AbilityBehavior {
9
8
  private readonly unitBehaviorConstructor;
10
9
  private readonly parameters?;
11
10
  private readonly keys?;
12
11
  private unitBehavior?;
13
- constructor(ability: Ability, unitBehaviorConstructor: new (unit: Unit) => T, parameters?: Partial<{ [K in MutableKeys<T> & KeysOfType<T, string | number | boolean>]: T[K] extends string | number | boolean ? AbilityDependentValue<T[K]> : never; }> | undefined);
12
+ constructor(ability: Ability, unitBehaviorConstructor: new (unit: Unit) => T, parameters?: Partial<{ [K in keyof T & { [P in keyof T]-?: (<T_1>() => T_1 extends { [Q in P]: T[P]; } ? 1 : 2) extends <T_2>() => T_2 extends { -readonly [Q_1 in P]: T[P]; } ? 1 : 2 ? P : never; }[keyof T] & KeysOfType<T, string | number | boolean>]: T[K] extends string | number | boolean ? AbilityDependentValue<T[K]> : never; }> | undefined);
14
13
  update(): void;
15
14
  onUnitGainAbility(unit: Unit): void;
16
15
  onUnitLoseAbility(): void;
@@ -13,6 +13,7 @@ import { ObjectDataEntryIdGenerator } from "../utility/object-data-entry-id-gene
13
13
  import type { AbilityTypeId } from "./ability-type";
14
14
  import type { UpgradeId } from "./upgrade";
15
15
  import { AnimationQualifier } from "../auxiliary/animation-qualifier";
16
+ import { AttackType } from "../auxiliary/attack-type";
16
17
  export type UnitTypeId = ObjectDataEntryId & {
17
18
  readonly __unitTypeId: unique symbol;
18
19
  };
@@ -23,12 +24,16 @@ export declare class UnitTypeWeapon {
23
24
  private readonly unitType;
24
25
  private readonly index;
25
26
  private constructor();
27
+ get attackType(): AttackType;
28
+ set attackType(attackType: AttackType);
26
29
  get backSwingDuration(): number;
27
30
  set backSwingDuration(backSwingDuration: number);
28
31
  get impactDelay(): number;
29
32
  set impactDelay(impactDelay: number);
30
33
  get missileModelPath(): string;
31
34
  set missileModelPath(missileModelPath: string);
35
+ get range(): number;
36
+ set range(range: number);
32
37
  get soundType(): WeaponSoundType;
33
38
  set soundType(soundType: WeaponSoundType);
34
39
  get soundTypeSD(): WeaponSoundType;
@@ -117,6 +122,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
117
122
  set modelPathSD(modelPathSD: string);
118
123
  get modelPathHD(): string;
119
124
  set modelPathHD(modelPathHD: string);
125
+ get runSpeed(): number;
126
+ set runSpeed(runSpeed: number);
127
+ get runSpeedSD(): number;
128
+ set runSpeedSD(runSpeedSD: number);
129
+ get runSpeedHD(): number;
130
+ set runSpeedHD(runSpeedHD: number);
120
131
  get selectionCircleScale(): number;
121
132
  set selectionCircleScale(selectionCircleScale: number);
122
133
  get selectionCircleScaleSD(): number;
@@ -149,6 +160,12 @@ export declare abstract class UnitType<Id extends UnitTypeId = UnitTypeId> exten
149
160
  set shadowImageXOffset(shadowImageXOffset: number);
150
161
  get shadowImageYOffset(): number;
151
162
  set shadowImageYOffset(shadowImageYOffset: number);
163
+ get walkSpeed(): number;
164
+ set walkSpeed(walkSpeed: number);
165
+ get walkSpeedSD(): number;
166
+ set walkSpeedSD(walkSpeedSD: number);
167
+ get walkSpeedHD(): number;
168
+ set walkSpeedHD(walkSpeedHD: number);
152
169
  get armorSoundType(): ArmorSoundType;
153
170
  set armorSoundType(armorSoundType: ArmorSoundType);
154
171
  get armorSoundTypeSD(): ArmorSoundType;
@@ -28,21 +28,21 @@ function UnitTypeWeapon.prototype.____constructor(self, unitType, index)
28
28
  end
29
29
  __TS__SetDescriptor(
30
30
  UnitTypeWeapon.prototype,
31
- "backSwingDuration",
31
+ "attackType",
32
32
  {
33
33
  get = function(self)
34
34
  local ____self_0 = self.unitType
35
- return ____self_0.getNumberField(
35
+ return ____self_0.getStringField(
36
36
  ____self_0,
37
- "ubs" .. tostring(self.index)
37
+ ("ua" .. tostring(self.index)) .. "t"
38
38
  )
39
39
  end,
40
- set = function(self, backSwingDuration)
40
+ set = function(self, attackType)
41
41
  local ____self_1 = self.unitType
42
- ____self_1.setNumberField(
42
+ ____self_1.setStringField(
43
43
  ____self_1,
44
- "ubs" .. tostring(self.index),
45
- backSwingDuration
44
+ ("ua" .. tostring(self.index)) .. "t",
45
+ attackType
46
46
  )
47
47
  end
48
48
  },
@@ -50,21 +50,21 @@ __TS__SetDescriptor(
50
50
  )
51
51
  __TS__SetDescriptor(
52
52
  UnitTypeWeapon.prototype,
53
- "impactDelay",
53
+ "backSwingDuration",
54
54
  {
55
55
  get = function(self)
56
56
  local ____self_2 = self.unitType
57
57
  return ____self_2.getNumberField(
58
58
  ____self_2,
59
- "udp" .. tostring(self.index)
59
+ "ubs" .. tostring(self.index)
60
60
  )
61
61
  end,
62
- set = function(self, impactDelay)
62
+ set = function(self, backSwingDuration)
63
63
  local ____self_3 = self.unitType
64
64
  ____self_3.setNumberField(
65
65
  ____self_3,
66
- "udp" .. tostring(self.index),
67
- impactDelay
66
+ "ubs" .. tostring(self.index),
67
+ backSwingDuration
68
68
  )
69
69
  end
70
70
  },
@@ -72,21 +72,21 @@ __TS__SetDescriptor(
72
72
  )
73
73
  __TS__SetDescriptor(
74
74
  UnitTypeWeapon.prototype,
75
- "missileModelPath",
75
+ "impactDelay",
76
76
  {
77
77
  get = function(self)
78
78
  local ____self_4 = self.unitType
79
- return ____self_4.getStringField(
79
+ return ____self_4.getNumberField(
80
80
  ____self_4,
81
- ("ua" .. tostring(self.index)) .. "m"
81
+ "udp" .. tostring(self.index)
82
82
  )
83
83
  end,
84
- set = function(self, missileModelPath)
84
+ set = function(self, impactDelay)
85
85
  local ____self_5 = self.unitType
86
- ____self_5.setStringField(
86
+ ____self_5.setNumberField(
87
87
  ____self_5,
88
- ("ua" .. tostring(self.index)) .. "m",
89
- missileModelPath
88
+ "udp" .. tostring(self.index),
89
+ impactDelay
90
90
  )
91
91
  end
92
92
  },
@@ -94,21 +94,21 @@ __TS__SetDescriptor(
94
94
  )
95
95
  __TS__SetDescriptor(
96
96
  UnitTypeWeapon.prototype,
97
- "soundType",
97
+ "missileModelPath",
98
98
  {
99
99
  get = function(self)
100
100
  local ____self_6 = self.unitType
101
101
  return ____self_6.getStringField(
102
102
  ____self_6,
103
- "ucs" .. tostring(self.index)
103
+ ("ua" .. tostring(self.index)) .. "m"
104
104
  )
105
105
  end,
106
- set = function(self, soundType)
106
+ set = function(self, missileModelPath)
107
107
  local ____self_7 = self.unitType
108
108
  ____self_7.setStringField(
109
109
  ____self_7,
110
- "ucs" .. tostring(self.index),
111
- soundType
110
+ ("ua" .. tostring(self.index)) .. "m",
111
+ missileModelPath
112
112
  )
113
113
  end
114
114
  },
@@ -116,21 +116,21 @@ __TS__SetDescriptor(
116
116
  )
117
117
  __TS__SetDescriptor(
118
118
  UnitTypeWeapon.prototype,
119
- "soundTypeSD",
119
+ "range",
120
120
  {
121
121
  get = function(self)
122
122
  local ____self_8 = self.unitType
123
- return ____self_8.getStringField(
123
+ return ____self_8.getNumberField(
124
124
  ____self_8,
125
- ("ucs" .. tostring(self.index)) .. ":sd"
125
+ ("ua" .. tostring(self.index)) .. "r"
126
126
  )
127
127
  end,
128
- set = function(self, soundTypeSD)
128
+ set = function(self, range)
129
129
  local ____self_9 = self.unitType
130
- ____self_9.setStringField(
130
+ ____self_9.setNumberField(
131
131
  ____self_9,
132
- ("ucs" .. tostring(self.index)) .. ":sd",
133
- soundTypeSD
132
+ ("ua" .. tostring(self.index)) .. "r",
133
+ range
134
134
  )
135
135
  end
136
136
  },
@@ -138,19 +138,63 @@ __TS__SetDescriptor(
138
138
  )
139
139
  __TS__SetDescriptor(
140
140
  UnitTypeWeapon.prototype,
141
- "soundTypeHD",
141
+ "soundType",
142
142
  {
143
143
  get = function(self)
144
144
  local ____self_10 = self.unitType
145
145
  return ____self_10.getStringField(
146
146
  ____self_10,
147
- ("ucs" .. tostring(self.index)) .. ":hd"
147
+ "ucs" .. tostring(self.index)
148
148
  )
149
149
  end,
150
- set = function(self, soundTypeHD)
150
+ set = function(self, soundType)
151
151
  local ____self_11 = self.unitType
152
152
  ____self_11.setStringField(
153
153
  ____self_11,
154
+ "ucs" .. tostring(self.index),
155
+ soundType
156
+ )
157
+ end
158
+ },
159
+ true
160
+ )
161
+ __TS__SetDescriptor(
162
+ UnitTypeWeapon.prototype,
163
+ "soundTypeSD",
164
+ {
165
+ get = function(self)
166
+ local ____self_12 = self.unitType
167
+ return ____self_12.getStringField(
168
+ ____self_12,
169
+ ("ucs" .. tostring(self.index)) .. ":sd"
170
+ )
171
+ end,
172
+ set = function(self, soundTypeSD)
173
+ local ____self_13 = self.unitType
174
+ ____self_13.setStringField(
175
+ ____self_13,
176
+ ("ucs" .. tostring(self.index)) .. ":sd",
177
+ soundTypeSD
178
+ )
179
+ end
180
+ },
181
+ true
182
+ )
183
+ __TS__SetDescriptor(
184
+ UnitTypeWeapon.prototype,
185
+ "soundTypeHD",
186
+ {
187
+ get = function(self)
188
+ local ____self_14 = self.unitType
189
+ return ____self_14.getStringField(
190
+ ____self_14,
191
+ ("ucs" .. tostring(self.index)) .. ":hd"
192
+ )
193
+ end,
194
+ set = function(self, soundTypeHD)
195
+ local ____self_15 = self.unitType
196
+ ____self_15.setStringField(
197
+ ____self_15,
154
198
  ("ucs" .. tostring(self.index)) .. ":hd",
155
199
  soundTypeHD
156
200
  )
@@ -683,6 +727,45 @@ __TS__SetDescriptor(
683
727
  },
684
728
  true
685
729
  )
730
+ __TS__SetDescriptor(
731
+ UnitType.prototype,
732
+ "runSpeed",
733
+ {
734
+ get = function(self)
735
+ return self:getNumberField("urun")
736
+ end,
737
+ set = function(self, runSpeed)
738
+ self:setNumberField("urun", runSpeed)
739
+ end
740
+ },
741
+ true
742
+ )
743
+ __TS__SetDescriptor(
744
+ UnitType.prototype,
745
+ "runSpeedSD",
746
+ {
747
+ get = function(self)
748
+ return self:getNumberField("urun:sd")
749
+ end,
750
+ set = function(self, runSpeedSD)
751
+ self:setNumberField("urun:sd", runSpeedSD)
752
+ end
753
+ },
754
+ true
755
+ )
756
+ __TS__SetDescriptor(
757
+ UnitType.prototype,
758
+ "runSpeedHD",
759
+ {
760
+ get = function(self)
761
+ return self:getNumberField("urun:hd")
762
+ end,
763
+ set = function(self, runSpeedHD)
764
+ self:setNumberField("urun:hd", runSpeedHD)
765
+ end
766
+ },
767
+ true
768
+ )
686
769
  __TS__SetDescriptor(
687
770
  UnitType.prototype,
688
771
  "selectionCircleScale",
@@ -891,6 +974,45 @@ __TS__SetDescriptor(
891
974
  },
892
975
  true
893
976
  )
977
+ __TS__SetDescriptor(
978
+ UnitType.prototype,
979
+ "walkSpeed",
980
+ {
981
+ get = function(self)
982
+ return self:getNumberField("uwal")
983
+ end,
984
+ set = function(self, walkSpeed)
985
+ self:setNumberField("uwal", walkSpeed)
986
+ end
987
+ },
988
+ true
989
+ )
990
+ __TS__SetDescriptor(
991
+ UnitType.prototype,
992
+ "walkSpeedSD",
993
+ {
994
+ get = function(self)
995
+ return self:getNumberField("uwal:sd")
996
+ end,
997
+ set = function(self, walkSpeedSD)
998
+ self:setNumberField("uwal:sd", walkSpeedSD)
999
+ end
1000
+ },
1001
+ true
1002
+ )
1003
+ __TS__SetDescriptor(
1004
+ UnitType.prototype,
1005
+ "walkSpeedHD",
1006
+ {
1007
+ get = function(self)
1008
+ return self:getNumberField("uwal:hd")
1009
+ end,
1010
+ set = function(self, walkSpeedHD)
1011
+ self:setNumberField("uwal:hd", walkSpeedHD)
1012
+ end
1013
+ },
1014
+ true
1015
+ )
894
1016
  __TS__SetDescriptor(
895
1017
  UnitType.prototype,
896
1018
  "armorSoundType",
@@ -1262,11 +1384,11 @@ __TS__SetDescriptor(
1262
1384
  implementReadonlyNumberIndexSupplier(
1263
1385
  ____exports.UnitType,
1264
1386
  function(id)
1265
- local ____class_12 = __TS__Class()
1266
- ____class_12.name = ____class_12.name
1267
- __TS__ClassExtends(____class_12, ____exports.UnitType)
1268
- ____class_12.BASE_ID = id
1269
- return ____class_12
1387
+ local ____class_16 = __TS__Class()
1388
+ ____class_16.name = ____class_16.name
1389
+ __TS__ClassExtends(____class_16, ____exports.UnitType)
1390
+ ____class_16.BASE_ID = id
1391
+ return ____class_16
1270
1392
  end
1271
1393
  )
1272
1394
  ____exports.HeroUnitType = __TS__Class()
@@ -1296,11 +1418,11 @@ __TS__SetDescriptor(
1296
1418
  implementReadonlyNumberIndexSupplier(
1297
1419
  ____exports.HeroUnitType,
1298
1420
  function(id)
1299
- local ____class_13 = __TS__Class()
1300
- ____class_13.name = ____class_13.name
1301
- __TS__ClassExtends(____class_13, ____exports.HeroUnitType)
1302
- ____class_13.BASE_ID = id
1303
- return ____class_13
1421
+ local ____class_17 = __TS__Class()
1422
+ ____class_17.name = ____class_17.name
1423
+ __TS__ClassExtends(____class_17, ____exports.HeroUnitType)
1424
+ ____class_17.BASE_ID = id
1425
+ return ____class_17
1304
1426
  end
1305
1427
  )
1306
1428
  return ____exports
@@ -30,6 +30,9 @@ export declare const DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID: StandardHeroUnit
30
30
  export declare const ABOMINATION_UNIT_TYPE_ID: StandardUnitTypeId;
31
31
  export declare const GHOUL_UNIT_TYPE_ID: StandardUnitTypeId;
32
32
  export declare const DEATH_KNIGHT_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
33
+ export declare const ZOMBIE_UNIT_TYPE_ID: StandardUnitTypeId;
34
+ export declare const ZOMBIE_FEMALE_UNIT_TYPE_ID: StandardUnitTypeId;
35
+ export declare const ARTHAS_EVIL_HERO_UNIT_TYPE_ID: StandardHeroUnitTypeId;
33
36
  export declare const DIRE_MAMMOTH_UNIT_TYPE_ID: StandardUnitTypeId;
34
37
  export declare const ELDER_JUNGLE_STALKER_UNIT_TYPE_ID: StandardUnitTypeId;
35
38
  export declare const ENRAGED_ELEMENTAL_UNIT_TYPE_ID: StandardUnitTypeId;
@@ -29,6 +29,9 @@ ____exports.DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID = fourCC("Edmm")
29
29
  ____exports.ABOMINATION_UNIT_TYPE_ID = fourCC("uabo")
30
30
  ____exports.GHOUL_UNIT_TYPE_ID = fourCC("ugho")
31
31
  ____exports.DEATH_KNIGHT_HERO_UNIT_TYPE_ID = fourCC("Udea")
32
+ ____exports.ZOMBIE_UNIT_TYPE_ID = fourCC("nzom")
33
+ ____exports.ZOMBIE_FEMALE_UNIT_TYPE_ID = fourCC("nzof")
34
+ ____exports.ARTHAS_EVIL_HERO_UNIT_TYPE_ID = fourCC("Uear")
32
35
  ____exports.DIRE_MAMMOTH_UNIT_TYPE_ID = fourCC("nmdr")
33
36
  ____exports.ELDER_JUNGLE_STALKER_UNIT_TYPE_ID = fourCC("njga")
34
37
  ____exports.ENRAGED_ELEMENTAL_UNIT_TYPE_ID = fourCC("nele")
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.ba37a78",
4
+ "version": "0.0.1-dev.ccd5725",
5
5
  "description": "A typescript library for Warcraft III using Warpack.",
6
6
  "keywords": [
7
7
  "warcraft",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@warscript/language-extensions": "^0.0.1",
25
- "@warscript/tstl-plugin": "^0.0.1",
25
+ "@warscript/tstl-plugin": "^0.0.2",
26
26
  "typescript-to-lua": "^1.24.1",
27
27
  "lua-types": "^2.13.1",
28
28
  "warpack": "0.0.1-dev.5bdabe5"
@@ -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
  }, {