warscript 0.0.1-dev.f48f7bb → 0.0.1-dev.f9321c0

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.
Files changed (100) hide show
  1. package/config.d.ts +5 -0
  2. package/config.lua +10 -0
  3. package/core/types/effect.d.ts +1 -3
  4. package/core/types/effect.lua +26 -29
  5. package/core/types/sound.d.ts +17 -24
  6. package/core/types/sound.lua +99 -24
  7. package/core/types/timer.d.ts +6 -7
  8. package/core/types/timer.lua +18 -21
  9. package/core/util.lua +6 -1
  10. package/engine/behaviour/ability/apply-buff.d.ts +5 -0
  11. package/engine/behaviour/ability/apply-buff.lua +32 -0
  12. package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
  13. package/engine/behaviour/ability/damage.d.ts +3 -0
  14. package/engine/behaviour/ability/damage.lua +2 -2
  15. package/engine/behaviour/ability/emulate-impact.lua +7 -0
  16. package/engine/behaviour/ability.d.ts +7 -2
  17. package/engine/behaviour/ability.lua +34 -7
  18. package/engine/behaviour/unit.d.ts +2 -0
  19. package/engine/buff.d.ts +56 -41
  20. package/engine/buff.lua +295 -228
  21. package/engine/internal/ability.lua +0 -2
  22. package/engine/internal/item/ability.lua +3 -3
  23. package/engine/internal/item.d.ts +2 -2
  24. package/engine/internal/item.lua +56 -25
  25. package/engine/internal/mechanics/ability-duration.lua +1 -1
  26. package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
  27. package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
  28. package/engine/internal/object-data/evasion-probability.d.ts +2 -0
  29. package/engine/internal/object-data/evasion-probability.lua +16 -0
  30. package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
  31. package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
  32. package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
  33. package/engine/internal/unit/add-item-to-slot.lua +52 -0
  34. package/engine/internal/unit/bonus.d.ts +2 -0
  35. package/engine/internal/unit/bonus.lua +17 -0
  36. package/engine/internal/unit/item.lua +3 -48
  37. package/engine/internal/unit.d.ts +13 -1
  38. package/engine/internal/unit.lua +43 -2
  39. package/engine/lightning.d.ts +12 -5
  40. package/engine/lightning.lua +48 -14
  41. package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
  42. package/engine/object-data/auxiliary/animation-name.lua +16 -0
  43. package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
  44. package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
  45. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  46. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  47. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  48. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  49. package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
  50. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  51. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  52. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  53. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  54. package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
  55. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  56. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  57. package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
  58. package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
  59. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  60. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  61. package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
  62. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  63. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  64. package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
  65. package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
  66. package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
  67. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  68. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  69. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  70. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  71. package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
  72. package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
  73. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  74. package/engine/object-data/entry/ability-type/web.lua +52 -0
  75. package/engine/object-data/entry/ability-type.d.ts +19 -17
  76. package/engine/object-data/entry/ability-type.lua +81 -21
  77. package/engine/object-data/entry/buff-type/applicable.lua +18 -37
  78. package/engine/object-data/entry/buff-type.d.ts +6 -12
  79. package/engine/object-data/entry/buff-type.lua +13 -29
  80. package/engine/object-data/entry/destructible-type.d.ts +1 -1
  81. package/engine/object-data/entry/item-type.d.ts +1 -1
  82. package/engine/object-data/entry/item-type.lua +4 -4
  83. package/engine/object-data/entry/lightning-type.d.ts +1 -1
  84. package/engine/object-data/entry/sound-preset.d.ts +33 -0
  85. package/engine/object-data/entry/sound-preset.lua +140 -0
  86. package/engine/object-data/entry/unit-type.d.ts +8 -1
  87. package/engine/object-data/entry/unit-type.lua +69 -10
  88. package/engine/object-data/entry/upgrade.d.ts +1 -1
  89. package/engine/object-data/entry/upgrade.lua +4 -4
  90. package/engine/object-data/entry.d.ts +16 -14
  91. package/engine/object-data/entry.lua +60 -32
  92. package/engine/standard/entries/buff-type.d.ts +3 -0
  93. package/engine/standard/entries/buff-type.lua +3 -0
  94. package/engine/standard/entries/sound-preset.d.ts +10 -0
  95. package/engine/standard/entries/sound-preset.lua +10 -0
  96. package/engine/unit.d.ts +1 -0
  97. package/engine/unit.lua +1 -0
  98. package/objutil/unit.lua +8 -0
  99. package/package.json +2 -2
  100. package/utility/reflection.lua +11 -7
@@ -32,7 +32,7 @@ function Upgrade.prototype.getEffect(self, i)
32
32
  type = effectType,
33
33
  bonusBase = self:getNumberField("gba" .. tostring(i)),
34
34
  bonusIncrement = self:getNumberField("gmo" .. tostring(i)),
35
- abilityTypeId = self:getObjectDataEntryIdField("gco" .. tostring(i))
35
+ abilityTypeId = self:getObjectDataEntryNumericIdField("gco" .. tostring(i))
36
36
  }
37
37
  end
38
38
  return nil
@@ -51,7 +51,7 @@ function Upgrade.prototype.setEffect(self, i, effect)
51
51
  effect and effect.bonusIncrement or 0
52
52
  )
53
53
  if (effect and effect.abilityTypeId) ~= nil then
54
- self:setObjectDataEntryIdField(
54
+ self:setObjectDataEntryNumericIdField(
55
55
  "gco" .. tostring(i),
56
56
  effect and effect.abilityTypeId
57
57
  )
@@ -145,7 +145,7 @@ __TS__SetDescriptor(
145
145
  "techTreeDependencies",
146
146
  {
147
147
  get = function(self)
148
- local techTreeDependencyIds = self:getObjectDataEntryIdsLevelField("greq")
148
+ local techTreeDependencyIds = self:getObjectDataEntryNumericIdsLevelField("greq")
149
149
  local techTreeDependencyInternalLevels = self:getNumbersLevelField("grqc")
150
150
  return mapIndexed(
151
151
  techTreeDependencyIds,
@@ -177,7 +177,7 @@ __TS__SetDescriptor(
177
177
  function(level) return level + 1 end
178
178
  )
179
179
  end
180
- self:setObjectDataEntryIdsLevelField("greq", techTreeDependencyIds)
180
+ self:setObjectDataEntryNumericIdsLevelField("greq", techTreeDependencyIds)
181
181
  self:setNumbersLevelField("grqc", techTreeDependencyInternalLevels)
182
182
  end
183
183
  },
@@ -1,7 +1,7 @@
1
1
  /** @noSelfInFile */
2
2
  import { AttachmentPreset, AttachmentPresetInput } from "./auxiliary/attachment-preset";
3
3
  import { MutableKeys } from "../../utility/types";
4
- export type ObjectDataEntryId = number & {
4
+ export type ObjectDataEntryId = (number | string) & {
5
5
  readonly __objectDataEntryId: unique symbol;
6
6
  };
7
7
  export type ObjectDataEntryIdType<T extends ObjectDataEntry> = T extends ObjectDataEntry<infer Id> ? Id : never;
@@ -18,14 +18,16 @@ export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = Obj
18
18
  private readonly levelFieldParametersByField;
19
19
  private readonly maxAffectedLevelByField;
20
20
  private _isInternal;
21
+ private get type();
21
22
  get isInternal(): boolean;
22
- protected static generateId(): number;
23
+ static get idType(): "number" | "string";
24
+ protected static generateId(): number | string;
23
25
  protected static getObjectData(map: WarMap): WarObjects;
24
- static getAllIdsByBaseIds<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>, baseIds: number | number[]): ObjectDataEntryIdType<T>[];
25
- static create<T extends ObjectDataEntry>(this: ObjectDataEntryConstructor<T>, ...args: [id?: number, properties?: ObjectDataEntryProperties<T>] | [properties: ObjectDataEntryProperties<T>]): T;
26
- static getAllByBaseIds<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>, baseIds: number | number[]): T[];
26
+ static getAllIdsByBaseIds<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>, baseIds: number | number[] | string | string[]): ObjectDataEntryIdType<T>[];
27
+ static create<T extends ObjectDataEntry>(this: ObjectDataEntryConstructor<T>, ...args: [id?: number | string, properties?: ObjectDataEntryProperties<T>] | [properties: ObjectDataEntryProperties<T>]): T;
28
+ static getAllByBaseIds<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>, baseIds: number | number[] | string | string[]): T[];
27
29
  static getAll<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>): T[];
28
- static of<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>, id: number): T | undefined;
30
+ static of<T extends ObjectDataEntry>(this: ObjectDataEntryAbstractConstructor<T>, id: number | string): T | undefined;
29
31
  constructor(object: WarObject);
30
32
  get id(): Id;
31
33
  get baseId(): Id;
@@ -42,8 +44,8 @@ export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = Obj
42
44
  protected setNumberField(field: string, value: number): void;
43
45
  protected getStringField(field: string): string;
44
46
  protected setStringField(field: string, value: string): void;
45
- protected getObjectDataEntryIdField<Id extends ObjectDataEntryId>(field: string): Id;
46
- protected setObjectDataEntryIdField<Id extends ObjectDataEntryId>(field: string, value: Id): void;
47
+ protected getObjectDataEntryNumericIdField<Id extends ObjectDataEntryId & number>(field: string): Id;
48
+ protected setObjectDataEntryNumericIdField<Id extends ObjectDataEntryId & number>(field: string, value: Id): void;
47
49
  protected getAttachmentPresetField(modelPathField: string, nodeFQNField: string): AttachmentPreset | undefined;
48
50
  protected setAttachmentPresetField(modelPathField: string, nodeFQNField: string, attachmentPreset: AttachmentPresetInput | undefined): void;
49
51
  protected getBooleansField(field: string): boolean[];
@@ -52,8 +54,8 @@ export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = Obj
52
54
  protected setNumbersField(field: string, values: number[]): void;
53
55
  protected getStringsField(field: string): string[];
54
56
  protected setStringsField(field: string, values: string[]): void;
55
- protected getObjectDataEntryIdsField<Id extends ObjectDataEntryId>(field: string): Id[];
56
- protected setObjectDataEntryIdsField<Id extends ObjectDataEntryId>(field: string, values: Id[]): void;
57
+ protected getObjectDataEntryNumericIdsField<Id extends ObjectDataEntryId & number>(field: string): Id[];
58
+ protected setObjectDataEntryNumericIdsField<Id extends ObjectDataEntryId & number>(field: string, values: Id[]): void;
57
59
  protected getAttachmentPresetListField(modelPathListField: string, nodeFQNFields: string[]): AttachmentPreset[];
58
60
  protected setAttachmentPresetListField(modelPathListField: string, nodeFQNFields: string[], lengthField: string, attachmentPresets: AttachmentPresetInput[]): void;
59
61
  protected setFlagLevelFieldValue(fieldId: string, flag: 1 | 2 | 4 | 8 | 16, supplier: ObjectDataEntryLevelFieldValueSupplier<boolean>): void;
@@ -64,16 +66,16 @@ export declare abstract class ObjectDataEntry<Id extends ObjectDataEntryId = Obj
64
66
  protected setNumberLevelField(field: string, values: ObjectDataEntryLevelFieldValueSupplier<number>): void;
65
67
  protected getStringLevelField(field: string): string[];
66
68
  protected setStringLevelField(field: string, values: ObjectDataEntryLevelFieldValueSupplier<string>): void;
67
- protected getObjectDataEntryIdLevelField<Id extends ObjectDataEntryId>(field: string): Id[];
68
- protected setObjectDataEntryIdLevelField<Id extends ObjectDataEntryId>(field: string, values: ObjectDataEntryLevelFieldValueSupplier<Id>): void;
69
+ protected getObjectDataEntryNumericIdLevelField<Id extends ObjectDataEntryId & number>(field: string): Id[];
70
+ protected setObjectDataEntryNumericIdLevelField<Id extends ObjectDataEntryId & number>(field: string, values: ObjectDataEntryLevelFieldValueSupplier<Id>): void;
69
71
  protected getBooleansLevelField(field: string): boolean[][];
70
72
  protected setBooleansLevelField(field: string, values: ObjectDataEntryLevelFieldValueSupplier<boolean[]>): void;
71
73
  protected getNumbersLevelField(field: string): number[][];
72
74
  protected setNumbersLevelField(field: string, values: ObjectDataEntryLevelFieldValueSupplier<number[]>): void;
73
75
  protected getStringsLevelField(field: string): string[][];
74
76
  protected setStringsLevelField(field: string, values: ObjectDataEntryLevelFieldValueSupplier<string[]>): void;
75
- protected getObjectDataEntryIdsLevelField<T extends ObjectDataEntryId>(field: string): T[][];
76
- protected setObjectDataEntryIdsLevelField<T extends ObjectDataEntryId>(field: string, values: ObjectDataEntryLevelFieldValueSupplier<T[]>): void;
77
+ protected getObjectDataEntryNumericIdsLevelField<T extends ObjectDataEntryId & number>(field: string): T[][];
78
+ protected setObjectDataEntryNumericIdsLevelField<T extends ObjectDataEntryId & number>(field: string, values: ObjectDataEntryLevelFieldValueSupplier<T[]>): void;
77
79
  private getLevelField;
78
80
  private setLevelField;
79
81
  }
@@ -7,10 +7,11 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
7
7
  local __TS__InstanceOf = ____lualib.__TS__InstanceOf
8
8
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
9
9
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
10
+ local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
10
11
  local __TS__StringSplit = ____lualib.__TS__StringSplit
11
12
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
12
13
  local ____exports = {}
13
- local booleanToData, dataToBoolean, numberToData, dataToNumber, stringToData, dataToString, objectDataEntryIdToData, dataToObjectDataEntryId, booleansToData, dataToBooleans, numbersToData, dataToNumbers, stringsToData, dataToStrings, objectDataEntryIdsToData, dataToObjectDataEntryIds, isDataNotBlank
14
+ local booleanToData, dataToBoolean, numberToData, dataToNumber, stringToData, dataToString, objectDataEntryNumericIdToData, dataToObjectDataEntryNumericId, objectDataEntryIdToData, dataToObjectDataEntryId, booleansToData, dataToBooleans, numbersToData, dataToNumbers, stringsToData, dataToStrings, objectDataEntryNumericIdsToData, dataToObjectDataEntryNumericIds, isDataNotBlank
14
15
  local ____attachment_2Dpreset = require("engine.object-data.auxiliary.attachment-preset")
15
16
  local extractAttachmentPresetInputModelPath = ____attachment_2Dpreset.extractAttachmentPresetInputModelPath
16
17
  local extractAttachmentPresetInputNodeFQN = ____attachment_2Dpreset.extractAttachmentPresetInputNodeFQN
@@ -124,7 +125,7 @@ function ObjectDataEntry.getAllByBaseIds(self, baseIds)
124
125
  local constructor = self
125
126
  for id, object in pairs(constructor:getObjectData(currentMap).all) do
126
127
  if dataBaseIds[object.parentId or id] ~= nil then
127
- local objectDataEntry = self:of(dataToObjectDataEntryId(id))
128
+ local objectDataEntry = self:of(dataToObjectDataEntryId(id, self.idType))
128
129
  if objectDataEntry ~= nil and not objectDataEntry.isInternal then
129
130
  result[#result + 1] = objectDataEntry
130
131
  end
@@ -139,7 +140,7 @@ function ObjectDataEntry.getAll(self)
139
140
  local constructor = self
140
141
  local result = {}
141
142
  for id in pairs(constructor:getObjectData(currentMap).all) do
142
- local objectDataEntry = self:of(dataToObjectDataEntryId(id))
143
+ local objectDataEntry = self:of(dataToObjectDataEntryId(id, self.idType))
143
144
  if objectDataEntry ~= nil and not objectDataEntry.isInternal then
144
145
  result[#result + 1] = objectDataEntry
145
146
  end
@@ -156,9 +157,9 @@ function ObjectDataEntry.of(self, id)
156
157
  if object == nil then
157
158
  return nil
158
159
  end
159
- local objectDataEntry = objectDataEntryByObjectDataEntryId[dataToObjectDataEntryId(object.id)]
160
+ local objectDataEntry = objectDataEntryByObjectDataEntryId[dataToObjectDataEntryId(object.id, self.idType)]
160
161
  if objectDataEntry == nil then
161
- if not constructor.IS_SYNTHETIC and (self.BASE_ID == 0 or dataToObjectDataEntryId(object.parentId) == self.BASE_ID) then
162
+ if not constructor.IS_SYNTHETIC and (self.BASE_ID == 0 or dataToObjectDataEntryId(object.parentId, self.idType) == self.BASE_ID) then
162
163
  local AbstractObjectDataEntryView = __TS__Class()
163
164
  AbstractObjectDataEntryView.name = "AbstractObjectDataEntryView"
164
165
  __TS__ClassExtends(AbstractObjectDataEntryView, constructor)
@@ -231,13 +232,13 @@ function ObjectDataEntry.prototype.setStringField(self, field, value)
231
232
  stringToData(value)
232
233
  )
233
234
  end
234
- function ObjectDataEntry.prototype.getObjectDataEntryIdField(self, field)
235
- return dataToObjectDataEntryId(self.object:getField(field))
235
+ function ObjectDataEntry.prototype.getObjectDataEntryNumericIdField(self, field)
236
+ return dataToObjectDataEntryNumericId(self.object:getField(field))
236
237
  end
237
- function ObjectDataEntry.prototype.setObjectDataEntryIdField(self, field, value)
238
+ function ObjectDataEntry.prototype.setObjectDataEntryNumericIdField(self, field, value)
238
239
  self.object:setField(
239
240
  field,
240
- objectDataEntryIdToData(value)
241
+ objectDataEntryNumericIdToData(value)
241
242
  )
242
243
  end
243
244
  function ObjectDataEntry.prototype.getAttachmentPresetField(self, modelPathField, nodeFQNField)
@@ -285,13 +286,13 @@ function ObjectDataEntry.prototype.setStringsField(self, field, values)
285
286
  stringsToData(values)
286
287
  )
287
288
  end
288
- function ObjectDataEntry.prototype.getObjectDataEntryIdsField(self, field)
289
- return dataToObjectDataEntryIds(self.object:getField(field))
289
+ function ObjectDataEntry.prototype.getObjectDataEntryNumericIdsField(self, field)
290
+ return dataToObjectDataEntryNumericIds(self.object:getField(field))
290
291
  end
291
- function ObjectDataEntry.prototype.setObjectDataEntryIdsField(self, field, values)
292
+ function ObjectDataEntry.prototype.setObjectDataEntryNumericIdsField(self, field, values)
292
293
  self.object:setField(
293
294
  field,
294
- objectDataEntryIdsToData(values)
295
+ objectDataEntryNumericIdsToData(values)
295
296
  )
296
297
  end
297
298
  function ObjectDataEntry.prototype.getAttachmentPresetListField(self, modelPathListField, nodeFQNFields)
@@ -369,16 +370,16 @@ function ObjectDataEntry.prototype.setStringLevelField(self, field, values)
369
370
  stringToData
370
371
  )
371
372
  end
372
- function ObjectDataEntry.prototype.getObjectDataEntryIdLevelField(self, field)
373
- return self:getLevelField(field, dataToObjectDataEntryId)
373
+ function ObjectDataEntry.prototype.getObjectDataEntryNumericIdLevelField(self, field)
374
+ return self:getLevelField(field, dataToObjectDataEntryNumericId)
374
375
  end
375
- function ObjectDataEntry.prototype.setObjectDataEntryIdLevelField(self, field, values)
376
+ function ObjectDataEntry.prototype.setObjectDataEntryNumericIdLevelField(self, field, values)
376
377
  self:setLevelField(
377
378
  field,
378
379
  values,
379
380
  ____exports.extractObjectDataEntryLevelFieldValue,
380
- dataToObjectDataEntryId,
381
- objectDataEntryIdToData
381
+ dataToObjectDataEntryNumericId,
382
+ objectDataEntryNumericIdToData
382
383
  )
383
384
  end
384
385
  function ObjectDataEntry.prototype.getBooleansLevelField(self, field)
@@ -417,23 +418,26 @@ function ObjectDataEntry.prototype.setStringsLevelField(self, field, values)
417
418
  stringsToData
418
419
  )
419
420
  end
420
- function ObjectDataEntry.prototype.getObjectDataEntryIdsLevelField(self, field)
421
- return self:getLevelField(field, dataToObjectDataEntryIds)
421
+ function ObjectDataEntry.prototype.getObjectDataEntryNumericIdsLevelField(self, field)
422
+ return self:getLevelField(field, dataToObjectDataEntryNumericIds)
422
423
  end
423
- function ObjectDataEntry.prototype.setObjectDataEntryIdsLevelField(self, field, values)
424
+ function ObjectDataEntry.prototype.setObjectDataEntryNumericIdsLevelField(self, field, values)
424
425
  self:setLevelField(
425
426
  field,
426
427
  values,
427
428
  ____exports.extractObjectDataEntryLevelArrayFieldValue,
428
- dataToObjectDataEntryIds,
429
- objectDataEntryIdsToData
429
+ dataToObjectDataEntryNumericIds,
430
+ objectDataEntryNumericIdsToData
430
431
  )
431
432
  end
432
433
  function ObjectDataEntry.prototype.getLevelField(self, field, dataToValue)
433
434
  local values = {}
434
435
  local object = self.object
435
436
  for level = 1, tonumber(object:getField("levels")) or 1 do
436
- values[level] = dataToValue(object:getField((field .. "+") .. tostring(level)))
437
+ values[level] = dataToValue(
438
+ object:getField((field .. "+") .. tostring(level)),
439
+ "number"
440
+ )
437
441
  end
438
442
  return values
439
443
  end
@@ -473,6 +477,14 @@ function ObjectDataEntry.prototype.setLevelField(self, field, supplier, extracto
473
477
  end
474
478
  ObjectDataEntry.BASE_ID = 0
475
479
  ObjectDataEntry.IS_SYNTHETIC = false
480
+ __TS__SetDescriptor(
481
+ ObjectDataEntry.prototype,
482
+ "type",
483
+ {get = function(self)
484
+ return self.constructor
485
+ end},
486
+ true
487
+ )
476
488
  __TS__SetDescriptor(
477
489
  ObjectDataEntry.prototype,
478
490
  "isInternal",
@@ -491,11 +503,18 @@ __TS__SetDescriptor(
491
503
  },
492
504
  true
493
505
  )
506
+ __TS__ObjectDefineProperty(
507
+ ObjectDataEntry,
508
+ "idType",
509
+ {get = function(self)
510
+ return type(self.BASE_ID) == "number" and "number" or "string"
511
+ end}
512
+ )
494
513
  __TS__SetDescriptor(
495
514
  ObjectDataEntry.prototype,
496
515
  "id",
497
516
  {get = function(self)
498
- return dataToObjectDataEntryId(self.object.id)
517
+ return dataToObjectDataEntryId(self.object.id, self.type.idType)
499
518
  end},
500
519
  true
501
520
  )
@@ -503,7 +522,7 @@ __TS__SetDescriptor(
503
522
  ObjectDataEntry.prototype,
504
523
  "baseId",
505
524
  {get = function(self)
506
- return dataToObjectDataEntryId(self.object.parentId or self.object.id)
525
+ return dataToObjectDataEntryId(self.object.parentId or self.object.id, self.type.idType)
507
526
  end},
508
527
  true
509
528
  )
@@ -533,10 +552,10 @@ end
533
552
  dataToString = function(data)
534
553
  return tostring(data or "")
535
554
  end
536
- objectDataEntryIdToData = function(value)
555
+ objectDataEntryNumericIdToData = function(value)
537
556
  return value == 0 and "" or string.pack(">I4", value)
538
557
  end
539
- dataToObjectDataEntryId = function(data)
558
+ dataToObjectDataEntryNumericId = function(data)
540
559
  local dataString = dataToString(data)
541
560
  if isDataNotBlank(nil, dataString) then
542
561
  return (string.unpack(">I4", dataString))
@@ -544,6 +563,15 @@ dataToObjectDataEntryId = function(data)
544
563
  return 0
545
564
  end
546
565
  end
566
+ objectDataEntryIdToData = function(value)
567
+ return type(value) == "number" and objectDataEntryNumericIdToData(value) or value
568
+ end
569
+ dataToObjectDataEntryId = function(data, ____type)
570
+ if ____type == "number" then
571
+ return dataToObjectDataEntryNumericId(data)
572
+ end
573
+ return dataToString(data)
574
+ end
547
575
  booleansToData = function(value)
548
576
  return table.concat(
549
577
  __TS__ArrayMap(
@@ -607,16 +635,16 @@ dataToStrings = function(data)
607
635
  function(____, data) return dataToString(data) end
608
636
  )
609
637
  end
610
- objectDataEntryIdsToData = function(value)
638
+ objectDataEntryNumericIdsToData = function(value)
611
639
  return table.concat(
612
640
  __TS__ArrayMap(
613
641
  value,
614
- function(____, objectDataEntryId) return objectDataEntryIdToData(objectDataEntryId) end
642
+ function(____, objectDataEntryId) return objectDataEntryNumericIdToData(objectDataEntryId) end
615
643
  ),
616
644
  ","
617
645
  )
618
646
  end
619
- dataToObjectDataEntryIds = function(data)
647
+ dataToObjectDataEntryNumericIds = function(data)
620
648
  return __TS__ArrayMap(
621
649
  __TS__ArrayFilter(
622
650
  __TS__StringSplit(
@@ -625,7 +653,7 @@ dataToObjectDataEntryIds = function(data)
625
653
  ),
626
654
  isDataNotBlank
627
655
  ),
628
- function(____, data) return dataToObjectDataEntryId(data) end
656
+ function(____, data) return dataToObjectDataEntryNumericId(data) end
629
657
  )
630
658
  end
631
659
  isDataNotBlank = function(self, data)
@@ -0,0 +1,3 @@
1
+ /** @noSelfInFile */
2
+ import { StandardBuffTypeId } from "../../object-data/entry/buff-type";
3
+ export declare const CHEMICAL_RAGE_BUFF_TYPE_ID: StandardBuffTypeId;
@@ -0,0 +1,3 @@
1
+ local ____exports = {}
2
+ ____exports.CHEMICAL_RAGE_BUFF_TYPE_ID = fourCC("BNcr")
3
+ return ____exports
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ import { StandardSoundPresetId } from "../../object-data/entry/sound-preset";
3
+ export declare const ABOMINATION_PISSED_SOUND_PRESET_ID: StandardSoundPresetId;
4
+ export declare const ABOMINATION_READY_SOUND_PRESET_ID: StandardSoundPresetId;
5
+ export declare const ABOMINATION_WAR_CRY_SOUND_PRESET_ID: StandardSoundPresetId;
6
+ export declare const AXE_MEDIUM_CHOP_WOOD_SOUND_PRESET_ID: StandardSoundPresetId;
7
+ export declare const IMPALE_SOUND_PRESET_ID: StandardSoundPresetId;
8
+ export declare const IMPALE_HIT_SOUND_PRESET_ID: StandardSoundPresetId;
9
+ export declare const IMPALE_LAND_SOUND_PRESET_ID: StandardSoundPresetId;
10
+ export declare const IMPALE_CAST_SOUND_PRESET_ID: StandardSoundPresetId;
@@ -0,0 +1,10 @@
1
+ local ____exports = {}
2
+ ____exports.ABOMINATION_PISSED_SOUND_PRESET_ID = "AbominationPissed"
3
+ ____exports.ABOMINATION_READY_SOUND_PRESET_ID = "AbominationReady"
4
+ ____exports.ABOMINATION_WAR_CRY_SOUND_PRESET_ID = "AbominationWarcry"
5
+ ____exports.AXE_MEDIUM_CHOP_WOOD_SOUND_PRESET_ID = "AxeMediumChopWood"
6
+ ____exports.IMPALE_SOUND_PRESET_ID = "Impale"
7
+ ____exports.IMPALE_HIT_SOUND_PRESET_ID = "ImpaleHit"
8
+ ____exports.IMPALE_LAND_SOUND_PRESET_ID = "ImpaleLand"
9
+ ____exports.IMPALE_CAST_SOUND_PRESET_ID = "ImpaleCast"
10
+ return ____exports
package/engine/unit.d.ts CHANGED
@@ -17,6 +17,7 @@ import "./internal/unit/ghost-counter";
17
17
  import "./internal/unit/invulnerability-counter";
18
18
  import "./internal/unit/detach-missiles";
19
19
  import "./internal/unit/main-selected";
20
+ import "./internal/unit/add-item-to-slot-init";
20
21
  import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
21
22
  export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
22
23
  export * from "./internal/unit+damage";
package/engine/unit.lua CHANGED
@@ -17,6 +17,7 @@ require("engine.internal.unit.ghost-counter")
17
17
  require("engine.internal.unit.invulnerability-counter")
18
18
  require("engine.internal.unit.detach-missiles")
19
19
  require("engine.internal.unit.main-selected")
20
+ require("engine.internal.unit.add-item-to-slot-init")
20
21
  require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
21
22
  do
22
23
  local ____unit = require("engine.internal.unit")
package/objutil/unit.lua CHANGED
@@ -11,6 +11,8 @@ local ____exports = {}
11
11
  local ____object = require("objutil.object")
12
12
  local ObjectDefinition = ____object.ObjectDefinition
13
13
  local idgen = require("objutil.idgen")
14
+ local ____config = require("config")
15
+ local WarscriptConfig = ____config.WarscriptConfig
14
16
  local attackTypes = setmetatable(
15
17
  {
16
18
  normal = "normal",
@@ -593,6 +595,9 @@ __TS__SetDescriptor(
593
595
  end,
594
596
  set = function(self, v)
595
597
  self:setStringField("umdl", v)
598
+ if WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
599
+ self:setStringField("upor", "")
600
+ end
596
601
  end
597
602
  },
598
603
  true
@@ -606,6 +611,9 @@ __TS__SetDescriptor(
606
611
  end,
607
612
  set = function(self, v)
608
613
  self.object:setField("umdl:hd", v)
614
+ if WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
615
+ self.object:setField("upor:hd", "")
616
+ end
609
617
  end
610
618
  },
611
619
  true
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.f48f7bb",
4
+ "version": "0.0.1-dev.f9321c0",
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.880fc91"
27
+ "warpack": "0.0.1-dev.8e8a660"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@typescript-eslint/eslint-plugin": "^8.13.0",
@@ -5,21 +5,25 @@ local checkNotNull = ____preconditions.checkNotNull
5
5
  -- @internal For use by internal systems only.
6
6
  ____exports.implementReadonlyNumberIndexSupplier = function(clazz, supplier)
7
7
  local metatable = checkNotNull(getmetatable(clazz))
8
- local originalIndex = checkNotNull(metatable.__index)
8
+ local originalIndex = checkNotNull(rawget(metatable, "__index"))
9
9
  local memoizedValueByKey = {}
10
- metatable.__index = setmetatable(
11
- memoizedValueByKey,
12
- {__index = function(self, key)
10
+ rawset(
11
+ metatable,
12
+ "__index",
13
+ function(self, key)
13
14
  if type(key) == "number" then
14
- local value = supplier(key)
15
- memoizedValueByKey[key] = value
15
+ local value = memoizedValueByKey[key]
16
+ if value == nil then
17
+ value = supplier(key)
18
+ memoizedValueByKey[key] = value
19
+ end
16
20
  return value
17
21
  end
18
22
  if type(originalIndex) == "function" then
19
23
  return originalIndex(self, key)
20
24
  end
21
25
  return originalIndex[key]
22
- end}
26
+ end
23
27
  )
24
28
  end
25
29
  ____exports.getClass = function(object)