warscript 0.0.1-dev.63f1d69 → 0.0.1-dev.64cec8d

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 (92) hide show
  1. package/binaryreader.d.ts +1 -0
  2. package/binaryreader.lua +3 -0
  3. package/core/types/effect.d.ts +13 -3
  4. package/core/types/effect.lua +116 -17
  5. package/core/types/frame.d.ts +8 -0
  6. package/core/types/frame.lua +93 -1
  7. package/core/util.d.ts +1 -1
  8. package/core/util.lua +12 -0
  9. package/engine/behavior.d.ts +2 -2
  10. package/engine/behavior.lua +6 -6
  11. package/engine/behaviour/ability/always-enabled.d.ts +7 -0
  12. package/engine/behaviour/ability/always-enabled.lua +31 -0
  13. package/engine/behaviour/ability/apply-buff.d.ts +3 -5
  14. package/engine/behaviour/ability/damage.d.ts +33 -11
  15. package/engine/behaviour/ability/damage.lua +89 -31
  16. package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
  17. package/engine/behaviour/ability/emulate-impact.lua +29 -0
  18. package/engine/behaviour/ability/heal.d.ts +33 -6
  19. package/engine/behaviour/ability/heal.lua +89 -10
  20. package/engine/behaviour/ability/instant-impact.d.ts +2 -2
  21. package/engine/behaviour/ability/instant-impact.lua +4 -19
  22. package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
  23. package/engine/behaviour/ability/on-command-impact.lua +25 -0
  24. package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
  25. package/engine/behaviour/ability/remove-buffs.lua +28 -0
  26. package/engine/behaviour/ability/restore-mana.d.ts +15 -0
  27. package/engine/behaviour/ability/restore-mana.lua +29 -0
  28. package/engine/behaviour/ability.d.ts +9 -2
  29. package/engine/behaviour/ability.lua +47 -33
  30. package/engine/behaviour/unit.d.ts +5 -0
  31. package/engine/behaviour/unit.lua +20 -0
  32. package/engine/buff.d.ts +66 -19
  33. package/engine/buff.lua +268 -80
  34. package/engine/game-map.d.ts +7 -0
  35. package/engine/game-map.lua +32 -0
  36. package/engine/internal/ability.d.ts +16 -13
  37. package/engine/internal/ability.lua +79 -76
  38. package/engine/internal/item/ability.lua +68 -0
  39. package/engine/internal/item+owner.lua +2 -2
  40. package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
  41. package/engine/internal/misc/ability-disable-counter.lua +13 -0
  42. package/engine/internal/unit/ability.d.ts +10 -1
  43. package/engine/internal/unit/ability.lua +36 -14
  44. package/engine/internal/unit/bonus.d.ts +4 -2
  45. package/engine/internal/unit/bonus.lua +6 -1
  46. package/engine/internal/unit/item.d.ts +24 -0
  47. package/engine/internal/unit/item.lua +79 -0
  48. package/engine/internal/unit/main-selected.d.ts +13 -0
  49. package/engine/internal/unit/main-selected.lua +51 -0
  50. package/engine/internal/unit+ability.lua +2 -2
  51. package/engine/internal/unit+transport.lua +4 -10
  52. package/engine/internal/unit-missile-launch.lua +24 -5
  53. package/engine/internal/unit.d.ts +25 -10
  54. package/engine/internal/unit.lua +139 -87
  55. package/engine/internal/utility.lua +12 -0
  56. package/engine/local-client.d.ts +7 -2
  57. package/engine/local-client.lua +82 -0
  58. package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
  59. package/engine/object-data/entry/ability-type-effects.d.ts +2 -0
  60. package/engine/object-data/entry/ability-type-effects.lua +89 -0
  61. package/engine/object-data/entry/ability-type.d.ts +0 -1
  62. package/engine/object-data/entry/ability-type.lua +15 -86
  63. package/engine/object-data/entry/item-type.d.ts +14 -0
  64. package/engine/object-data/entry/item-type.lua +91 -0
  65. package/engine/object-field/ability.d.ts +21 -1
  66. package/engine/object-field/ability.lua +51 -1
  67. package/engine/standard/fields/ability.d.ts +2 -0
  68. package/engine/standard/fields/ability.lua +2 -0
  69. package/engine/unit.d.ts +2 -0
  70. package/engine/unit.lua +2 -0
  71. package/index.d.ts +1 -0
  72. package/index.lua +1 -0
  73. package/lualib_bundle.lua +7 -2
  74. package/net/socket.d.ts +7 -1
  75. package/net/socket.lua +45 -4
  76. package/network.d.ts +1 -0
  77. package/network.lua +3 -2
  78. package/objutil/buff.lua +1 -1
  79. package/package.json +2 -2
  80. package/patch-lua.d.ts +0 -0
  81. package/patch-lua.lua +10 -0
  82. package/property.d.ts +55 -0
  83. package/property.lua +374 -0
  84. package/utility/arrays.d.ts +8 -1
  85. package/utility/arrays.lua +34 -3
  86. package/utility/lazy.d.ts +2 -0
  87. package/utility/lazy.lua +14 -0
  88. package/utility/linked-set.d.ts +11 -2
  89. package/utility/linked-set.lua +5 -2
  90. package/utility/types.d.ts +1 -0
  91. package/core/mapbounds.d.ts +0 -8
  92. package/core/mapbounds.lua +0 -12
@@ -0,0 +1,89 @@
1
+ local ____exports = {}
2
+ local ____unit = require("engine.internal.unit")
3
+ local Unit = ____unit.Unit
4
+ require("engine.internal.unit.ability")
5
+ local ____timer = require("core.types.timer")
6
+ local Timer = ____timer.Timer
7
+ local ____effect = require("core.types.effect")
8
+ local Effect = ____effect.Effect
9
+ local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
10
+ local casterCastingEffectAttachmentPointsByAbilityTypeId = ____ability_2Dtype.casterCastingEffectAttachmentPointsByAbilityTypeId
11
+ local casterCastingEffectModelPathsByAbilityTypeId = ____ability_2Dtype.casterCastingEffectModelPathsByAbilityTypeId
12
+ local casterChannelingEffectAttachmentPointsByAbilityTypeId = ____ability_2Dtype.casterChannelingEffectAttachmentPointsByAbilityTypeId
13
+ local casterChannelingEffectModelPathsByAbilityTypeId = ____ability_2Dtype.casterChannelingEffectModelPathsByAbilityTypeId
14
+ local castAnimationFQNByAbilityTypeId = {}
15
+ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnimationFQNByAbilityTypeId end)) do
16
+ Unit.abilityCastingStartEvent[abilityTypeId]:addListener(
17
+ 4,
18
+ function(caster, ability)
19
+ if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
20
+ Timer:run(function()
21
+ caster:playAnimation(animationFQN)
22
+ end)
23
+ end
24
+ end
25
+ )
26
+ end
27
+ local casterCastingEffectsByCaster = {}
28
+ local function handleAbilityCastingStartEvent(caster, ability)
29
+ local effectModelPaths = casterCastingEffectModelPathsByAbilityTypeId[ability.typeId]
30
+ local attachmentPoints = casterCastingEffectAttachmentPointsByAbilityTypeId[ability.typeId]
31
+ local effects = {}
32
+ if effectModelPaths ~= nil then
33
+ for i = 1, #effectModelPaths do
34
+ local effectModelPath = effectModelPaths[i]
35
+ local attachmentPoint = attachmentPoints and attachmentPoints[i]
36
+ if attachmentPoint == nil or attachmentPoint == "" then
37
+ attachmentPoint = "origin"
38
+ end
39
+ effects[i] = Effect:createTarget(effectModelPath, caster, attachmentPoint)
40
+ end
41
+ end
42
+ casterCastingEffectsByCaster[caster] = effects
43
+ end
44
+ local function handleAbilityStopCastingEvent(caster)
45
+ local effects = casterCastingEffectsByCaster[caster]
46
+ if effects ~= nil then
47
+ for i = 1, #effects do
48
+ effects[i]:destroy()
49
+ end
50
+ casterCastingEffectsByCaster[caster] = nil
51
+ end
52
+ end
53
+ for abilityTypeId in pairs(casterCastingEffectModelPathsByAbilityTypeId) do
54
+ Unit.abilityCastingStartEvent[abilityTypeId]:addListener(4, handleAbilityCastingStartEvent)
55
+ Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityStopCastingEvent)
56
+ Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopCastingEvent)
57
+ end
58
+ local casterChannelingEffectsByCaster = {}
59
+ local function handleAbilityChannelingStartEvent(caster, ability)
60
+ local effectModelPaths = casterChannelingEffectModelPathsByAbilityTypeId[ability.typeId]
61
+ local attachmentPoints = casterChannelingEffectAttachmentPointsByAbilityTypeId[ability.typeId]
62
+ local effects = {}
63
+ if effectModelPaths ~= nil then
64
+ for i = 1, #effectModelPaths do
65
+ local effectModelPath = effectModelPaths[i]
66
+ local attachmentPoint = attachmentPoints and attachmentPoints[i]
67
+ if attachmentPoint == nil or attachmentPoint == "" then
68
+ attachmentPoint = "origin"
69
+ end
70
+ effects[i] = Effect:createTarget(effectModelPath, caster, attachmentPoint)
71
+ end
72
+ end
73
+ casterChannelingEffectsByCaster[caster] = effects
74
+ end
75
+ local function handleAbilityStopChannelingEvent(caster)
76
+ local effects = casterChannelingEffectsByCaster[caster]
77
+ if effects ~= nil then
78
+ for i = 1, #effects do
79
+ effects[i]:destroy()
80
+ end
81
+ casterChannelingEffectsByCaster[caster] = nil
82
+ end
83
+ end
84
+ for abilityTypeId in pairs(casterChannelingEffectModelPathsByAbilityTypeId) do
85
+ Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityChannelingStartEvent)
86
+ Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
87
+ Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopChannelingEvent)
88
+ end
89
+ return ____exports
@@ -1,5 +1,4 @@
1
1
  /** @noSelfInFile */
2
- import "../../internal/unit/ability";
3
2
  import { TupleOf } from "../../../utility/types";
4
3
  import { AnimationName } from "../auxiliary/animation-name";
5
4
  import { AnimationQualifier } from "../auxiliary/animation-qualifier";
@@ -4,13 +4,6 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
6
6
  local ____exports = {}
7
- local ____unit = require("engine.internal.unit")
8
- local Unit = ____unit.Unit
9
- require("engine.internal.unit.ability")
10
- local ____timer = require("core.types.timer")
11
- local Timer = ____timer.Timer
12
- local ____effect = require("core.types.effect")
13
- local Effect = ____effect.Effect
14
7
  local ____lua_2Dmaps = require("utility.lua-maps")
15
8
  local mapValues = ____lua_2Dmaps.mapValues
16
9
  local ____arrays = require("utility.arrays")
@@ -34,7 +27,6 @@ local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.u
34
27
  local ObjectDataEntryIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.ObjectDataEntryIdGenerator
35
28
  local ____upgrade = require("engine.object-data.entry.upgrade")
36
29
  local Upgrade = ____upgrade.Upgrade
37
- local castAnimationFQNByAbilityTypeId = {}
38
30
  local isButtonVisibleFalseAbilityTypes = {}
39
31
  local casterCastingEffectPresetsByAbilityTypeId = {}
40
32
  local casterChannelingEffectPresetsByAbilityTypeId = {}
@@ -958,102 +950,39 @@ local _ = postcompile(function()
958
950
  abilityType.buttonPositionY = -11
959
951
  end
960
952
  end)
961
- for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnimationFQNByAbilityTypeId end)) do
962
- Unit.abilityCastingStartEvent[abilityTypeId]:addListener(
963
- 4,
964
- function(caster, ability)
965
- if ability:getField(ABILITY_RLF_CASTING_TIME) ~= 0 then
966
- Timer:run(function()
967
- caster:playAnimation(animationFQN)
968
- end)
969
- end
970
- end
971
- )
972
- end
973
- local casterCastingEffectModelPathsByAbilityTypeId = postcompile(function()
953
+ ---
954
+ -- @internal For use by internal systems only.
955
+ ____exports.casterCastingEffectModelPathsByAbilityTypeId = postcompile(function()
974
956
  return mapValues(
975
957
  casterCastingEffectPresetsByAbilityTypeId,
976
958
  function(casterCastingEffectPresets) return map(casterCastingEffectPresets, extractAttachmentPresetInputModelPath) end
977
959
  )
978
960
  end)
979
- local casterCastingEffectAttachmentPointsByAbilityTypeId = postcompile(function()
961
+ ---
962
+ -- @internal For use by internal systems only.
963
+ ____exports.casterCastingEffectAttachmentPointsByAbilityTypeId = postcompile(function()
980
964
  return mapValues(
981
965
  casterCastingEffectPresetsByAbilityTypeId,
982
966
  function(casterCastingEffectPresets) return map(casterCastingEffectPresets, extractAttachmentPresetInputNodeFQN) end
983
967
  )
984
968
  end)
985
- local casterCastingEffectsByCaster = {}
986
- local function handleAbilityCastingStartEvent(caster, ability)
987
- local effectModelPaths = casterCastingEffectModelPathsByAbilityTypeId[ability.typeId]
988
- local attachmentPoints = casterCastingEffectAttachmentPointsByAbilityTypeId[ability.typeId]
989
- local effects = {}
990
- if effectModelPaths ~= nil then
991
- for i = 1, #effectModelPaths do
992
- local effectModelPath = effectModelPaths[i]
993
- local attachmentPoint = attachmentPoints and attachmentPoints[i]
994
- if attachmentPoint == nil or attachmentPoint == "" then
995
- attachmentPoint = "origin"
996
- end
997
- effects[i] = Effect:createTarget(effectModelPath, caster, attachmentPoint)
998
- end
999
- end
1000
- casterCastingEffectsByCaster[caster] = effects
1001
- end
1002
- local function handleAbilityStopEvent(caster)
1003
- local effects = casterCastingEffectsByCaster[caster]
1004
- if effects ~= nil then
1005
- for i = 1, #effects do
1006
- effects[i]:destroy()
1007
- end
1008
- casterCastingEffectsByCaster[caster] = nil
1009
- end
1010
- end
1011
- for abilityTypeId in pairs(casterCastingEffectModelPathsByAbilityTypeId) do
1012
- Unit.abilityCastingStartEvent[abilityTypeId]:addListener(4, handleAbilityCastingStartEvent)
1013
- Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityStopEvent)
1014
- Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopEvent)
1015
- end
1016
- local casterChannelingEffectModelPathsByAbilityTypeId = postcompile(function()
969
+ ---
970
+ -- @internal For use by internal systems only.
971
+ ____exports.casterChannelingEffectModelPathsByAbilityTypeId = postcompile(function()
1017
972
  return mapValues(
1018
973
  casterChannelingEffectPresetsByAbilityTypeId,
1019
974
  function(casterChannelingEffectPresets) return map(casterChannelingEffectPresets, extractAttachmentPresetInputModelPath) end
1020
975
  )
1021
976
  end)
1022
- local casterChannelingEffectAttachmentPointsByAbilityTypeId = postcompile(function()
977
+ ---
978
+ -- @internal For use by internal systems only.
979
+ ____exports.casterChannelingEffectAttachmentPointsByAbilityTypeId = postcompile(function()
1023
980
  return mapValues(
1024
981
  casterChannelingEffectPresetsByAbilityTypeId,
1025
982
  function(casterChannelingEffectPresets) return map(casterChannelingEffectPresets, extractAttachmentPresetInputNodeFQN) end
1026
983
  )
1027
984
  end)
1028
- local casterChannelingEffectsByCaster = {}
1029
- local function handleAbilityChannelingStartEvent(caster, ability)
1030
- local effectModelPaths = casterChannelingEffectModelPathsByAbilityTypeId[ability.typeId]
1031
- local attachmentPoints = casterChannelingEffectAttachmentPointsByAbilityTypeId[ability.typeId]
1032
- local effects = {}
1033
- if effectModelPaths ~= nil then
1034
- for i = 1, #effectModelPaths do
1035
- local effectModelPath = effectModelPaths[i]
1036
- local attachmentPoint = attachmentPoints and attachmentPoints[i]
1037
- if attachmentPoint == nil or attachmentPoint == "" then
1038
- attachmentPoint = "origin"
1039
- end
1040
- effects[i] = Effect:createTarget(effectModelPath, caster, attachmentPoint)
1041
- end
1042
- end
1043
- casterChannelingEffectsByCaster[caster] = effects
1044
- end
1045
- local function handleAbilityStopEventV2(caster)
1046
- local effects = casterChannelingEffectsByCaster[caster]
1047
- if effects ~= nil then
1048
- for i = 1, #effects do
1049
- effects[i]:destroy()
1050
- end
1051
- casterChannelingEffectsByCaster[caster] = nil
1052
- end
1053
- end
1054
- for abilityTypeId in pairs(casterChannelingEffectModelPathsByAbilityTypeId) do
1055
- Unit.abilityChannelingStartEvent[abilityTypeId]:addListener(4, handleAbilityChannelingStartEvent)
1056
- Unit.abilityChannelingFinishEvent[abilityTypeId]:addListener(4, handleAbilityStopEventV2)
1057
- Unit.abilityStopEvent[abilityTypeId]:addListener(4, handleAbilityStopEventV2)
1058
- end
985
+ warpack.afterMapInit(function()
986
+ require("engine.object-data.entry.ability-type-effects")
987
+ end)
1059
988
  return ____exports
@@ -45,4 +45,18 @@ export declare class ItemType extends ObjectDataEntry<ItemTypeId> {
45
45
  set tooltipText(tooltipText: string);
46
46
  get tooltipExtendedText(): string;
47
47
  set tooltipExtendedText(tooltipText: string);
48
+ get cooldownGroupId(): number;
49
+ set cooldownGroupId(cooldownGroupId: number);
50
+ get goldCost(): number;
51
+ set goldCost(goldCost: number);
52
+ get lumberCost(): number;
53
+ set lumberCost(lumberCost: number);
54
+ get activelyUsed(): boolean;
55
+ set activelyUsed(activelyUsed: boolean);
56
+ get perishable(): boolean;
57
+ set perishable(perishable: boolean);
58
+ get initialStackSize(): number;
59
+ set initialStackSize(initialStackSize: number);
60
+ get maximumStackSize(): number;
61
+ set maximumStackSize(maximumStackSize: number);
48
62
  }
@@ -256,4 +256,95 @@ __TS__SetDescriptor(
256
256
  },
257
257
  true
258
258
  )
259
+ __TS__SetDescriptor(
260
+ ItemType.prototype,
261
+ "cooldownGroupId",
262
+ {
263
+ get = function(self)
264
+ return self:getObjectDataEntryIdField("icid")
265
+ end,
266
+ set = function(self, cooldownGroupId)
267
+ self:setObjectDataEntryIdField("icid", cooldownGroupId)
268
+ end
269
+ },
270
+ true
271
+ )
272
+ __TS__SetDescriptor(
273
+ ItemType.prototype,
274
+ "goldCost",
275
+ {
276
+ get = function(self)
277
+ return self:getNumberField("igol")
278
+ end,
279
+ set = function(self, goldCost)
280
+ self:setNumberField("igol", goldCost)
281
+ end
282
+ },
283
+ true
284
+ )
285
+ __TS__SetDescriptor(
286
+ ItemType.prototype,
287
+ "lumberCost",
288
+ {
289
+ get = function(self)
290
+ return self:getNumberField("ilum")
291
+ end,
292
+ set = function(self, lumberCost)
293
+ self:setNumberField("ilum", lumberCost)
294
+ end
295
+ },
296
+ true
297
+ )
298
+ __TS__SetDescriptor(
299
+ ItemType.prototype,
300
+ "activelyUsed",
301
+ {
302
+ get = function(self)
303
+ return self:getBooleanField("iusa")
304
+ end,
305
+ set = function(self, activelyUsed)
306
+ self:setBooleanField("iusa", activelyUsed)
307
+ end
308
+ },
309
+ true
310
+ )
311
+ __TS__SetDescriptor(
312
+ ItemType.prototype,
313
+ "perishable",
314
+ {
315
+ get = function(self)
316
+ return self:getBooleanField("iper")
317
+ end,
318
+ set = function(self, perishable)
319
+ self:setBooleanField("iper", perishable)
320
+ end
321
+ },
322
+ true
323
+ )
324
+ __TS__SetDescriptor(
325
+ ItemType.prototype,
326
+ "initialStackSize",
327
+ {
328
+ get = function(self)
329
+ return self:getNumberField("iuse")
330
+ end,
331
+ set = function(self, initialStackSize)
332
+ self:setNumberField("iuse", initialStackSize)
333
+ end
334
+ },
335
+ true
336
+ )
337
+ __TS__SetDescriptor(
338
+ ItemType.prototype,
339
+ "maximumStackSize",
340
+ {
341
+ get = function(self)
342
+ return self:getNumberField("ista")
343
+ end,
344
+ set = function(self, maximumStackSize)
345
+ self:setNumberField("ista", maximumStackSize)
346
+ end
347
+ },
348
+ true
349
+ )
259
350
  return ____exports
@@ -6,6 +6,9 @@ import { ObjectDataEntryId } from "../object-data/entry";
6
6
  import { LightningTypeId } from "../object-data/entry/lightning-type";
7
7
  import { CombatClassifications } from "../object-data/auxiliary/combat-classification";
8
8
  import { UnitTypeId } from "../object-data/entry/unit-type";
9
+ import { BuffResistanceType } from "../object-data/auxiliary/buff-resistance-type";
10
+ import { BuffPolarity } from "../object-data/auxiliary/buff-polarity";
11
+ import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
9
12
  export declare abstract class AbilityField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType extends jabilityfield = jabilityfield> extends ObjectField<AbilityType, Ability, ValueType, NativeFieldType> {
10
13
  protected get instanceClass(): typeof Ability;
11
14
  protected getObjectDataEntryId(instance: Ability): AbilityTypeId;
@@ -107,6 +110,20 @@ export declare class AbilityAbilityTypeIdLevelField extends AbilityObjectDataEnt
107
110
  }
108
111
  export declare class AbilityUnitTypeIdLevelField extends AbilityObjectDataEntryIdLevelField<UnitTypeId> {
109
112
  }
113
+ export declare abstract class AbilityEnumLevelField<T extends number> extends AbilityLevelField<T, T, jabilityintegerlevelfield> {
114
+ protected abstract values: ReadonlyNonEmptyLinkedSet<T>;
115
+ protected get defaultValue(): T;
116
+ protected getNativeFieldById(id: number): jabilityintegerlevelfield;
117
+ protected getNativeFieldValue(instance: Ability, level: number): T;
118
+ protected setNativeFieldValue(instance: Ability, level: number, value: T): boolean;
119
+ static get valueChangeEvent(): ObjectLevelFieldValueChangeEvent<AbilityBooleanLevelField>;
120
+ }
121
+ export declare class AbilityBuffPolarityLevelField extends AbilityEnumLevelField<BuffPolarity> {
122
+ protected values: ReadonlyNonEmptyLinkedSet<BuffPolarity>;
123
+ }
124
+ export declare class AbilityBuffResistanceTypeLevelField extends AbilityEnumLevelField<BuffResistanceType> {
125
+ protected values: ReadonlyNonEmptyLinkedSet<BuffResistanceType>;
126
+ }
110
127
  export declare class AbilityCombatClassificationsLevelField extends AbilityLevelField<CombatClassifications, CombatClassifications, jabilityintegerlevelfield> {
111
128
  protected get defaultValue(): CombatClassifications;
112
129
  protected getNativeFieldById(id: number): jabilityintegerlevelfield;
@@ -114,4 +131,7 @@ export declare class AbilityCombatClassificationsLevelField extends AbilityLevel
114
131
  protected setNativeFieldValue(instance: Ability, level: number, value: CombatClassifications): boolean;
115
132
  }
116
133
  export type AbilityDependentValue<ValueType extends boolean | number | string> = ValueType | AbilityField<ValueType> | AbilityLevelField<ValueType> | ((ability: Ability) => ValueType);
117
- export declare const resolveCurrentAbilityDependentValue: <ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>) => ValueType;
134
+ export declare const resolveCurrentAbilityDependentValue: {
135
+ <ValueType extends boolean | number | string>(ability: Ability, value: AbilityDependentValue<ValueType>): ValueType;
136
+ <ValueType extends boolean | number | string>(ability: Ability, value?: AbilityDependentValue<ValueType>): ValueType | undefined;
137
+ };
@@ -13,6 +13,8 @@ local ObjectField = ____object_2Dfield.ObjectField
13
13
  local ObjectLevelField = ____object_2Dfield.ObjectLevelField
14
14
  local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
15
15
  local AbilityType = ____ability_2Dtype.AbilityType
16
+ local ____linked_2Dset = require("utility.linked-set")
17
+ local nonEmptyLinkedSetOf = ____linked_2Dset.nonEmptyLinkedSetOf
16
18
  local convertAbilityBooleanField = _G.ConvertAbilityBooleanField
17
19
  local convertAbilityIntegerField = _G.ConvertAbilityIntegerField
18
20
  local convertAbilityRealField = _G.ConvertAbilityRealField
@@ -259,7 +261,7 @@ local AbilityLevelField = ____exports.AbilityLevelField
259
261
  AbilityLevelField.name = "AbilityLevelField"
260
262
  __TS__ClassExtends(AbilityLevelField, ObjectLevelField)
261
263
  function AbilityLevelField.prototype.getLevelCount(self, entry)
262
- return __TS__InstanceOf(entry, Ability) and #entry.levels or entry.levelCount
264
+ return entry.levelCount
263
265
  end
264
266
  function AbilityLevelField.prototype.getObjectDataEntryId(self, instance)
265
267
  return instance.typeId
@@ -431,6 +433,54 @@ ____exports.AbilityUnitTypeIdLevelField = __TS__Class()
431
433
  local AbilityUnitTypeIdLevelField = ____exports.AbilityUnitTypeIdLevelField
432
434
  AbilityUnitTypeIdLevelField.name = "AbilityUnitTypeIdLevelField"
433
435
  __TS__ClassExtends(AbilityUnitTypeIdLevelField, ____exports.AbilityObjectDataEntryIdLevelField)
436
+ ____exports.AbilityEnumLevelField = __TS__Class()
437
+ local AbilityEnumLevelField = ____exports.AbilityEnumLevelField
438
+ AbilityEnumLevelField.name = "AbilityEnumLevelField"
439
+ __TS__ClassExtends(AbilityEnumLevelField, ____exports.AbilityLevelField)
440
+ function AbilityEnumLevelField.prototype.getNativeFieldById(self, id)
441
+ return convertAbilityIntegerLevelField(id)
442
+ end
443
+ function AbilityEnumLevelField.prototype.getNativeFieldValue(self, instance, level)
444
+ local value = instance:getField(self.nativeField, level)
445
+ if self.values:contains(value) then
446
+ return value
447
+ end
448
+ return self.values:first()
449
+ end
450
+ function AbilityEnumLevelField.prototype.setNativeFieldValue(self, instance, level, value)
451
+ return instance:setField(self.nativeField, level, value)
452
+ end
453
+ __TS__SetDescriptor(
454
+ AbilityEnumLevelField.prototype,
455
+ "defaultValue",
456
+ {get = function(self)
457
+ return self.values:first()
458
+ end},
459
+ true
460
+ )
461
+ __TS__ObjectDefineProperty(
462
+ AbilityEnumLevelField,
463
+ "valueChangeEvent",
464
+ {get = function(self)
465
+ return self:getOrCreateValueChangeEvent()
466
+ end}
467
+ )
468
+ ____exports.AbilityBuffPolarityLevelField = __TS__Class()
469
+ local AbilityBuffPolarityLevelField = ____exports.AbilityBuffPolarityLevelField
470
+ AbilityBuffPolarityLevelField.name = "AbilityBuffPolarityLevelField"
471
+ __TS__ClassExtends(AbilityBuffPolarityLevelField, ____exports.AbilityEnumLevelField)
472
+ function AbilityBuffPolarityLevelField.prototype.____constructor(self, ...)
473
+ AbilityBuffPolarityLevelField.____super.prototype.____constructor(self, ...)
474
+ self.values = nonEmptyLinkedSetOf(0, 1, 2)
475
+ end
476
+ ____exports.AbilityBuffResistanceTypeLevelField = __TS__Class()
477
+ local AbilityBuffResistanceTypeLevelField = ____exports.AbilityBuffResistanceTypeLevelField
478
+ AbilityBuffResistanceTypeLevelField.name = "AbilityBuffResistanceTypeLevelField"
479
+ __TS__ClassExtends(AbilityBuffResistanceTypeLevelField, ____exports.AbilityEnumLevelField)
480
+ function AbilityBuffResistanceTypeLevelField.prototype.____constructor(self, ...)
481
+ AbilityBuffResistanceTypeLevelField.____super.prototype.____constructor(self, ...)
482
+ self.values = nonEmptyLinkedSetOf(1, 2, 3)
483
+ end
434
484
  local allowedTargetCombatClassificationsByLevelByAbilityTypeId = postcompile(function()
435
485
  local allowedTargetCombatClassificationsByLevelByAbilityTypeId = {}
436
486
  for ____, abilityType in ipairs(AbilityType:getAll()) do
@@ -687,6 +687,8 @@ export declare const DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD: Abilit
687
687
  export declare const ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD: AbilityBooleanLevelField & symbol;
688
688
  export declare const ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD: AbilityStringLevelField & symbol;
689
689
  export declare const CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
690
+ export declare const CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
691
+ export declare const CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
690
692
  export declare const TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD: AbilityStringArrayField & symbol;
691
693
  export declare const TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
692
694
  export declare const TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD: AbilityStringField & symbol;
@@ -698,6 +698,8 @@ ____exports.DISABLE_OTHER_ABILITIES_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBoolean
698
698
  ____exports.ALLOW_BOUNTY_ABILITY_BOOLEAN_LEVEL_FIELD = AbilityBooleanLevelField:create(fourCC("Ntm4"))
699
699
  ____exports.ICON_NORMAL_ABILITY_STRING_LEVEL_FIELD = AbilityStringLevelField:create(fourCC("aart"))
700
700
  ____exports.CASTER_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("acat"))
701
+ ____exports.CASTER_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("acap"))
702
+ ____exports.CASTER_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("aca1"))
701
703
  ____exports.TARGET_EFFECT_MODEL_PATHS_ABILITY_STRING_ARRAY_FIELD = AbilityStringArrayField:create(fourCC("atat"))
702
704
  ____exports.TARGET_EFFECT_FIRST_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata0"))
703
705
  ____exports.TARGET_EFFECT_SECOND_ATTACHMENT_POINT_STRING_FIELD = AbilityStringField:create(fourCC("ata1"))
package/engine/unit.d.ts CHANGED
@@ -4,6 +4,7 @@ import "./internal/unit/ability";
4
4
  import "./internal/unit/allowed-targets";
5
5
  import "./internal/unit/buff";
6
6
  import "./internal/unit/expiration-timer";
7
+ import "./internal/unit/item";
7
8
  import "./internal/unit+ability";
8
9
  import "./internal/unit+damage";
9
10
  import "./internal/unit+rally";
@@ -15,6 +16,7 @@ import "./internal/unit-missile-launch";
15
16
  import "./internal/unit/ghost-counter";
16
17
  import "./internal/unit/invulnerability-counter";
17
18
  import "./internal/unit/detach-missiles";
19
+ import "./internal/unit/main-selected";
18
20
  import "./internal/unit/band-aids/ancestral-spirit-cannibalize";
19
21
  export { Unit, DamagingEvent, DamageEvent } from "./internal/unit";
20
22
  export * from "./internal/unit+damage";
package/engine/unit.lua CHANGED
@@ -4,6 +4,7 @@ require("engine.internal.unit.ability")
4
4
  require("engine.internal.unit.allowed-targets")
5
5
  require("engine.internal.unit.buff")
6
6
  require("engine.internal.unit.expiration-timer")
7
+ require("engine.internal.unit.item")
7
8
  require("engine.internal.unit+ability")
8
9
  require("engine.internal.unit+damage")
9
10
  require("engine.internal.unit+rally")
@@ -15,6 +16,7 @@ require("engine.internal.unit-missile-launch")
15
16
  require("engine.internal.unit.ghost-counter")
16
17
  require("engine.internal.unit.invulnerability-counter")
17
18
  require("engine.internal.unit.detach-missiles")
19
+ require("engine.internal.unit.main-selected")
18
20
  require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
19
21
  do
20
22
  local ____unit = require("engine.internal.unit")
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** @noSelfInFile */
2
2
  import "./types";
3
+ import "./patch-lua";
3
4
  import "./patch-lualib";
4
5
  import "./patch-natives";
5
6
  import "./global/math";
package/index.lua CHANGED
@@ -1,5 +1,6 @@
1
1
  local ____exports = {}
2
2
  require("types")
3
+ require("patch-lua")
3
4
  require("patch-lualib")
4
5
  require("patch-natives")
5
6
  require("global.math")
package/lualib_bundle.lua CHANGED
@@ -1094,6 +1094,11 @@ do
1094
1094
  end
1095
1095
  if __TS__StringIncludes(_VERSION, "Lua 5.0") then
1096
1096
  return debug.traceback(("[Level " .. tostring(level)) .. "]")
1097
+ elseif _VERSION == "Lua 5.1" then
1098
+ return string.sub(
1099
+ debug.traceback("", level),
1100
+ 2
1101
+ )
1097
1102
  else
1098
1103
  return debug.traceback(nil, level)
1099
1104
  end
@@ -1102,7 +1107,7 @@ do
1102
1107
  return function(self)
1103
1108
  local description = getDescription(self)
1104
1109
  local caller = debug.getinfo(3, "f")
1105
- local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0") or _VERSION == "Lua 5.1"
1110
+ local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0")
1106
1111
  if isClassicLua or caller and caller.func ~= error then
1107
1112
  return description
1108
1113
  else
@@ -1126,7 +1131,7 @@ do
1126
1131
  end
1127
1132
  self.message = message
1128
1133
  self.name = "Error"
1129
- self.stack = getErrorStack(nil, self.constructor.new)
1134
+ self.stack = getErrorStack(nil, __TS__New)
1130
1135
  local metatable = getmetatable(self)
1131
1136
  if metatable and not metatable.__errorToStringPatched then
1132
1137
  metatable.__errorToStringPatched = true
package/net/socket.d.ts CHANGED
@@ -1,9 +1,15 @@
1
1
  /** @noSelfInFile */
2
2
  import { Event } from "../event";
3
3
  import { Player } from "../core/types/player";
4
+ declare const enum SocketPropertyKey {
5
+ ID = 0,
6
+ CHUNK_ID = 1
7
+ }
4
8
  export declare class Socket {
5
- private readonly id;
9
+ private readonly [SocketPropertyKey.ID];
10
+ private readonly [SocketPropertyKey.CHUNK_ID];
6
11
  readonly onMessage: Event<[Player, string]>;
7
12
  constructor();
8
13
  send(data: string): void;
9
14
  }
15
+ export {};
package/net/socket.lua CHANGED
@@ -7,6 +7,11 @@ local Event = ____event.Event
7
7
  local ____network = require("network")
8
8
  local send = ____network.send
9
9
  local onReceive = ____network.onReceive
10
+ local MAX_PAYLOAD_LENGTH = ____network.MAX_PAYLOAD_LENGTH
11
+ local ____math = require("math")
12
+ local ceil = ____math.ceil
13
+ local stringSub = string.sub
14
+ local tableConcat = table.concat
10
15
  local nextId = 0
11
16
  ____exports.Socket = __TS__Class()
12
17
  local Socket = ____exports.Socket
@@ -14,13 +19,49 @@ Socket.name = "Socket"
14
19
  function Socket.prototype.____constructor(self)
15
20
  local ____tostring_0 = tostring
16
21
  nextId = nextId + 1
17
- self.id = ____tostring_0(nextId)
22
+ self[0] = ____tostring_0(nextId)
23
+ local ____tostring_1 = tostring
24
+ nextId = nextId + 1
25
+ self[1] = ____tostring_1(nextId)
18
26
  self.onMessage = __TS__New(Event)
19
- onReceive[self.id]:addListener(function(sender, data)
20
- Event.invoke(self.onMessage, sender, data)
27
+ local chunksByPlayer = {}
28
+ onReceive[self[0]]:addListener(function(sender, data)
29
+ local chunks = chunksByPlayer[sender]
30
+ if chunks ~= nil then
31
+ chunks[#chunks + 1] = data
32
+ Event.invoke(
33
+ self.onMessage,
34
+ sender,
35
+ tableConcat(chunks)
36
+ )
37
+ chunksByPlayer[sender] = nil
38
+ else
39
+ Event.invoke(self.onMessage, sender, data)
40
+ end
41
+ end)
42
+ onReceive[self[1]]:addListener(function(sender, data)
43
+ local chunks = chunksByPlayer[sender]
44
+ if chunks == nil then
45
+ chunks = {}
46
+ chunksByPlayer[sender] = chunks
47
+ end
48
+ chunks[#chunks + 1] = data
21
49
  end)
22
50
  end
23
51
  function Socket.prototype.send(self, data)
24
- send(self.id, data)
52
+ local chunks = ceil(#data / MAX_PAYLOAD_LENGTH) - 1
53
+ local offset = 1
54
+ for _ = 0, chunks - 1 do
55
+ local nextOffset = offset + MAX_PAYLOAD_LENGTH
56
+ send(
57
+ self[1],
58
+ stringSub(data, offset, nextOffset - 1)
59
+ )
60
+ offset = nextOffset
61
+ end
62
+ send(
63
+ self[0],
64
+ stringSub(data, offset)
65
+ )
25
66
  end
26
67
  return ____exports
package/network.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Event } from "./event";
3
3
  import { Player } from "./core/types/player";
4
4
  import { Operation, OperationContinue, OperationMonitor } from "./operation";
5
+ export declare const MAX_PAYLOAD_LENGTH = 255;
5
6
  export declare const onReceive: {
6
7
  [prefix: string]: Event<[Player, string]>;
7
8
  } & {