warscript 0.0.1-dev.dbb3984 → 0.0.1-dev.dc37dce
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 +6 -0
- package/attributes.lua +17 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +2 -3
- package/core/types/effect.lua +97 -50
- package/core/types/frame.lua +24 -21
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +60 -15
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +100 -25
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- package/core/util.d.ts +1 -1
- package/core/util.lua +12 -1
- package/decl/native.d.ts +846 -790
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +5 -0
- package/engine/behaviour/ability/apply-buff.lua +36 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +9 -3
- package/engine/behaviour/ability/damage.lua +26 -38
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +43 -0
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -19
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +25 -0
- package/engine/behaviour/ability/remove-buffs.lua +49 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +28 -7
- package/engine/behaviour/ability.lua +137 -43
- package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
- package/engine/behaviour/unit/stun-immunity.lua +57 -31
- package/engine/behaviour/unit.d.ts +40 -2
- package/engine/behaviour/unit.lua +269 -6
- package/engine/buff.d.ts +112 -53
- package/engine/buff.lua +544 -289
- package/engine/internal/ability.d.ts +20 -3
- package/engine/internal/ability.lua +126 -13
- package/engine/internal/item/ability.lua +162 -4
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +20 -19
- package/engine/internal/item.lua +191 -74
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/object-data/armor-bonus.d.ts +2 -0
- package/engine/internal/object-data/attribute-bonus.lua +2 -2
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/object-data/health-bonus.d.ts +2 -0
- package/engine/internal/object-data/health-bonus.lua +16 -0
- package/engine/internal/object-data/mana-bonus.d.ts +2 -0
- package/engine/internal/object-data/mana-bonus.lua +16 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/ability.d.ts +45 -1
- package/engine/internal/unit/ability.lua +128 -3
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bonus.d.ts +8 -0
- package/engine/internal/unit/bonus.lua +50 -3
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/item.lua +7 -13
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +46 -26
- package/engine/internal/unit.lua +444 -270
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
- package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +21 -17
- package/engine/object-data/entry/ability-type.lua +177 -40
- package/engine/object-data/entry/buff-type/applicable.lua +122 -137
- package/engine/object-data/entry/buff-type.d.ts +6 -12
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +28 -2
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/item-type.d.ts +3 -1
- package/engine/object-data/entry/item-type.lua +15 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +25 -5
- package/engine/object-data/entry/unit-type.lua +258 -93
- package/engine/object-data/entry/upgrade.d.ts +1 -1
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +16 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +12 -6
- package/engine/object-field/ability.lua +8 -4
- package/engine/object-field/unit.d.ts +72 -3
- package/engine/object-field/unit.lua +268 -7
- package/engine/object-field.d.ts +25 -6
- package/engine/object-field.lua +359 -116
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +21 -0
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/fields/ability.d.ts +4 -2
- package/engine/standard/fields/ability.lua +4 -2
- package/engine/standard/fields/unit.d.ts +12 -0
- package/engine/standard/fields/unit.lua +20 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +250 -10
- package/engine/unit.d.ts +7 -0
- package/engine/unit.lua +7 -0
- package/lualib_bundle.lua +118 -47
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +11 -10
- package/objutil/object.lua +1 -1
- package/objutil/unit.lua +8 -0
- package/operation.lua +23 -17
- package/package.json +5 -5
- package/patch-lua.lua +15 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +2 -0
- package/utility/arrays.lua +11 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-map.d.ts +34 -0
- package/utility/linked-map.lua +101 -0
- package/utility/linked-set.d.ts +4 -1
- package/utility/linked-set.lua +43 -1
- package/utility/lua-maps.d.ts +15 -2
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/records.lua +20 -1
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +3 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
- /package/engine/internal/{object-data/armor-increase.d.ts → misc/ability-disable-counter.d.ts} +0 -0
- /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
package/lualib_bundle.lua
CHANGED
|
@@ -653,7 +653,6 @@ do
|
|
|
653
653
|
self.state = 0
|
|
654
654
|
self.fulfilledCallbacks = {}
|
|
655
655
|
self.rejectedCallbacks = {}
|
|
656
|
-
self.finallyCallbacks = {}
|
|
657
656
|
local success, ____error = ____pcall(
|
|
658
657
|
executor,
|
|
659
658
|
nil,
|
|
@@ -703,14 +702,40 @@ do
|
|
|
703
702
|
return self["then"](self, nil, onRejected)
|
|
704
703
|
end
|
|
705
704
|
function __TS__Promise.prototype.finally(self, onFinally)
|
|
706
|
-
if onFinally then
|
|
707
|
-
|
|
708
|
-
____self_finallyCallbacks_2[#____self_finallyCallbacks_2 + 1] = onFinally
|
|
709
|
-
if self.state ~= 0 then
|
|
710
|
-
onFinally(nil)
|
|
711
|
-
end
|
|
705
|
+
if type(onFinally) ~= "function" then
|
|
706
|
+
return self["then"](self, onFinally, onFinally)
|
|
712
707
|
end
|
|
713
|
-
return self
|
|
708
|
+
return self["then"](
|
|
709
|
+
self,
|
|
710
|
+
function(____, x)
|
|
711
|
+
local ____self_2 = __TS__New(
|
|
712
|
+
__TS__Promise,
|
|
713
|
+
function(____, resolve) return resolve(
|
|
714
|
+
nil,
|
|
715
|
+
onFinally(nil)
|
|
716
|
+
) end
|
|
717
|
+
)
|
|
718
|
+
return ____self_2["then"](
|
|
719
|
+
____self_2,
|
|
720
|
+
function() return x end
|
|
721
|
+
)
|
|
722
|
+
end,
|
|
723
|
+
function(____, e)
|
|
724
|
+
local ____self_3 = __TS__New(
|
|
725
|
+
__TS__Promise,
|
|
726
|
+
function(____, resolve) return resolve(
|
|
727
|
+
nil,
|
|
728
|
+
onFinally(nil)
|
|
729
|
+
) end
|
|
730
|
+
)
|
|
731
|
+
return ____self_3["then"](
|
|
732
|
+
____self_3,
|
|
733
|
+
function()
|
|
734
|
+
error(e, 0)
|
|
735
|
+
end
|
|
736
|
+
)
|
|
737
|
+
end
|
|
738
|
+
)
|
|
714
739
|
end
|
|
715
740
|
function __TS__Promise.prototype.resolve(self, value)
|
|
716
741
|
if isPromiseLike(value) then
|
|
@@ -734,22 +759,11 @@ do
|
|
|
734
759
|
end
|
|
735
760
|
function __TS__Promise.prototype.invokeCallbacks(self, callbacks, value)
|
|
736
761
|
local callbacksLength = #callbacks
|
|
737
|
-
local finallyCallbacks = self.finallyCallbacks
|
|
738
|
-
local finallyCallbacksLength = #finallyCallbacks
|
|
739
762
|
if callbacksLength ~= 0 then
|
|
740
763
|
for i = 1, callbacksLength - 1 do
|
|
741
764
|
callbacks[i](callbacks, value)
|
|
742
765
|
end
|
|
743
|
-
|
|
744
|
-
return callbacks[callbacksLength](callbacks, value)
|
|
745
|
-
end
|
|
746
|
-
callbacks[callbacksLength](callbacks, value)
|
|
747
|
-
end
|
|
748
|
-
if finallyCallbacksLength ~= 0 then
|
|
749
|
-
for i = 1, finallyCallbacksLength - 1 do
|
|
750
|
-
finallyCallbacks[i](finallyCallbacks)
|
|
751
|
-
end
|
|
752
|
-
return finallyCallbacks[finallyCallbacksLength](finallyCallbacks)
|
|
766
|
+
return callbacks[callbacksLength](callbacks, value)
|
|
753
767
|
end
|
|
754
768
|
end
|
|
755
769
|
function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve, reject)
|
|
@@ -904,8 +918,10 @@ local function __TS__ObjectAssign(target, ...)
|
|
|
904
918
|
local sources = {...}
|
|
905
919
|
for i = 1, #sources do
|
|
906
920
|
local source = sources[i]
|
|
907
|
-
|
|
908
|
-
|
|
921
|
+
if type(source) == "table" then
|
|
922
|
+
for key in pairs(source) do
|
|
923
|
+
target[key] = source[key]
|
|
924
|
+
end
|
|
909
925
|
end
|
|
910
926
|
end
|
|
911
927
|
return target
|
|
@@ -1011,6 +1027,13 @@ do
|
|
|
1011
1027
|
metatable = {}
|
|
1012
1028
|
setmetatable(target, metatable)
|
|
1013
1029
|
end
|
|
1030
|
+
if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
|
|
1031
|
+
local instanceMetatable = {}
|
|
1032
|
+
instanceMetatable._isOwnDescriptorMetatable = true
|
|
1033
|
+
setmetatable(instanceMetatable, metatable)
|
|
1034
|
+
setmetatable(target, instanceMetatable)
|
|
1035
|
+
metatable = instanceMetatable
|
|
1036
|
+
end
|
|
1014
1037
|
local value = rawget(target, key)
|
|
1015
1038
|
if value ~= nil then
|
|
1016
1039
|
rawset(target, key, nil)
|
|
@@ -1383,46 +1406,70 @@ do
|
|
|
1383
1406
|
return self:entries()
|
|
1384
1407
|
end
|
|
1385
1408
|
function Map.prototype.entries(self)
|
|
1409
|
+
local function getFirstKey()
|
|
1410
|
+
return self.firstKey
|
|
1411
|
+
end
|
|
1386
1412
|
local items = self.items
|
|
1387
1413
|
local nextKey = self.nextKey
|
|
1388
|
-
local key
|
|
1414
|
+
local key
|
|
1415
|
+
local started = false
|
|
1389
1416
|
return {
|
|
1390
1417
|
[Symbol.iterator] = function(self)
|
|
1391
1418
|
return self
|
|
1392
1419
|
end,
|
|
1393
1420
|
next = function(self)
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1421
|
+
if not started then
|
|
1422
|
+
started = true
|
|
1423
|
+
key = getFirstKey(nil)
|
|
1424
|
+
else
|
|
1425
|
+
key = nextKey[key]
|
|
1426
|
+
end
|
|
1427
|
+
return {done = not key, value = {key, items[key]}}
|
|
1397
1428
|
end
|
|
1398
1429
|
}
|
|
1399
1430
|
end
|
|
1400
1431
|
function Map.prototype.keys(self)
|
|
1432
|
+
local function getFirstKey()
|
|
1433
|
+
return self.firstKey
|
|
1434
|
+
end
|
|
1401
1435
|
local nextKey = self.nextKey
|
|
1402
|
-
local key
|
|
1436
|
+
local key
|
|
1437
|
+
local started = false
|
|
1403
1438
|
return {
|
|
1404
1439
|
[Symbol.iterator] = function(self)
|
|
1405
1440
|
return self
|
|
1406
1441
|
end,
|
|
1407
1442
|
next = function(self)
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1443
|
+
if not started then
|
|
1444
|
+
started = true
|
|
1445
|
+
key = getFirstKey(nil)
|
|
1446
|
+
else
|
|
1447
|
+
key = nextKey[key]
|
|
1448
|
+
end
|
|
1449
|
+
return {done = not key, value = key}
|
|
1411
1450
|
end
|
|
1412
1451
|
}
|
|
1413
1452
|
end
|
|
1414
1453
|
function Map.prototype.values(self)
|
|
1454
|
+
local function getFirstKey()
|
|
1455
|
+
return self.firstKey
|
|
1456
|
+
end
|
|
1415
1457
|
local items = self.items
|
|
1416
1458
|
local nextKey = self.nextKey
|
|
1417
|
-
local key
|
|
1459
|
+
local key
|
|
1460
|
+
local started = false
|
|
1418
1461
|
return {
|
|
1419
1462
|
[Symbol.iterator] = function(self)
|
|
1420
1463
|
return self
|
|
1421
1464
|
end,
|
|
1422
1465
|
next = function(self)
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1466
|
+
if not started then
|
|
1467
|
+
started = true
|
|
1468
|
+
key = getFirstKey(nil)
|
|
1469
|
+
else
|
|
1470
|
+
key = nextKey[key]
|
|
1471
|
+
end
|
|
1472
|
+
return {done = not key, value = items[key]}
|
|
1426
1473
|
end
|
|
1427
1474
|
}
|
|
1428
1475
|
end
|
|
@@ -1999,44 +2046,68 @@ do
|
|
|
1999
2046
|
return self:values()
|
|
2000
2047
|
end
|
|
2001
2048
|
function Set.prototype.entries(self)
|
|
2049
|
+
local function getFirstKey()
|
|
2050
|
+
return self.firstKey
|
|
2051
|
+
end
|
|
2002
2052
|
local nextKey = self.nextKey
|
|
2003
|
-
local key
|
|
2053
|
+
local key
|
|
2054
|
+
local started = false
|
|
2004
2055
|
return {
|
|
2005
2056
|
[Symbol.iterator] = function(self)
|
|
2006
2057
|
return self
|
|
2007
2058
|
end,
|
|
2008
2059
|
next = function(self)
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2060
|
+
if not started then
|
|
2061
|
+
started = true
|
|
2062
|
+
key = getFirstKey(nil)
|
|
2063
|
+
else
|
|
2064
|
+
key = nextKey[key]
|
|
2065
|
+
end
|
|
2066
|
+
return {done = not key, value = {key, key}}
|
|
2012
2067
|
end
|
|
2013
2068
|
}
|
|
2014
2069
|
end
|
|
2015
2070
|
function Set.prototype.keys(self)
|
|
2071
|
+
local function getFirstKey()
|
|
2072
|
+
return self.firstKey
|
|
2073
|
+
end
|
|
2016
2074
|
local nextKey = self.nextKey
|
|
2017
|
-
local key
|
|
2075
|
+
local key
|
|
2076
|
+
local started = false
|
|
2018
2077
|
return {
|
|
2019
2078
|
[Symbol.iterator] = function(self)
|
|
2020
2079
|
return self
|
|
2021
2080
|
end,
|
|
2022
2081
|
next = function(self)
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2082
|
+
if not started then
|
|
2083
|
+
started = true
|
|
2084
|
+
key = getFirstKey(nil)
|
|
2085
|
+
else
|
|
2086
|
+
key = nextKey[key]
|
|
2087
|
+
end
|
|
2088
|
+
return {done = not key, value = key}
|
|
2026
2089
|
end
|
|
2027
2090
|
}
|
|
2028
2091
|
end
|
|
2029
2092
|
function Set.prototype.values(self)
|
|
2093
|
+
local function getFirstKey()
|
|
2094
|
+
return self.firstKey
|
|
2095
|
+
end
|
|
2030
2096
|
local nextKey = self.nextKey
|
|
2031
|
-
local key
|
|
2097
|
+
local key
|
|
2098
|
+
local started = false
|
|
2032
2099
|
return {
|
|
2033
2100
|
[Symbol.iterator] = function(self)
|
|
2034
2101
|
return self
|
|
2035
2102
|
end,
|
|
2036
2103
|
next = function(self)
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2104
|
+
if not started then
|
|
2105
|
+
started = true
|
|
2106
|
+
key = getFirstKey(nil)
|
|
2107
|
+
else
|
|
2108
|
+
key = nextKey[key]
|
|
2109
|
+
end
|
|
2110
|
+
return {done = not key, value = key}
|
|
2040
2111
|
end
|
|
2041
2112
|
}
|
|
2042
2113
|
end
|
|
@@ -2241,7 +2312,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2241
2312
|
end
|
|
2242
2313
|
local result = string.gsub(
|
|
2243
2314
|
trace,
|
|
2244
|
-
"(
|
|
2315
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
2245
2316
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
2246
2317
|
)
|
|
2247
2318
|
local function stringReplacer(____, file, line)
|
package/net/socket.lua
CHANGED
|
@@ -28,13 +28,13 @@ function Socket.prototype.____constructor(self)
|
|
|
28
28
|
onReceive[self[0]]:addListener(function(sender, data)
|
|
29
29
|
local chunks = chunksByPlayer[sender]
|
|
30
30
|
if chunks ~= nil then
|
|
31
|
+
chunksByPlayer[sender] = nil
|
|
31
32
|
chunks[#chunks + 1] = data
|
|
32
33
|
Event.invoke(
|
|
33
34
|
self.onMessage,
|
|
34
35
|
sender,
|
|
35
36
|
tableConcat(chunks)
|
|
36
37
|
)
|
|
37
|
-
chunksByPlayer[sender] = nil
|
|
38
38
|
else
|
|
39
39
|
Event.invoke(self.onMessage, sender, data)
|
|
40
40
|
end
|
package/objutil/buff.lua
CHANGED
|
@@ -20,7 +20,6 @@ local AbilityDefinitionInnerFire = ____ability.AbilityDefinitionInnerFire
|
|
|
20
20
|
local AbilityDefinitionSearingArrows = ____ability.AbilityDefinitionSearingArrows
|
|
21
21
|
local AbilityDefinitionSlowPoison = ____ability.AbilityDefinitionSlowPoison
|
|
22
22
|
local ____unit = require("core.types.unit")
|
|
23
|
-
local AttackType = ____unit.AttackType
|
|
24
23
|
local DamageType = ____unit.DamageType
|
|
25
24
|
local Unit = ____unit.Unit
|
|
26
25
|
local ____dummy = require("core.dummy")
|
|
@@ -30,6 +29,8 @@ local ____timer = require("core.types.timer")
|
|
|
30
29
|
local Timer = ____timer.Timer
|
|
31
30
|
local ____exception = require("exception")
|
|
32
31
|
local IllegalStateException = ____exception.IllegalStateException
|
|
32
|
+
local ____linked_2Dmap = require("utility.linked-map")
|
|
33
|
+
local LinkedMap = ____linked_2Dmap.LinkedMap
|
|
33
34
|
local ____assert = _G.assert
|
|
34
35
|
local ____pairs = _G.pairs
|
|
35
36
|
____exports.BuffDefinition = __TS__Class()
|
|
@@ -462,7 +463,7 @@ local buffs = setmetatable(
|
|
|
462
463
|
{
|
|
463
464
|
__mode = "k",
|
|
464
465
|
__index = function(self, unit)
|
|
465
|
-
local ____table =
|
|
466
|
+
local ____table = __TS__New(LinkedMap)
|
|
466
467
|
self[unit] = ____table
|
|
467
468
|
return ____table
|
|
468
469
|
end
|
|
@@ -495,7 +496,7 @@ function Buff.prototype.____constructor(self, unit, source, duration, level, pre
|
|
|
495
496
|
end
|
|
496
497
|
local constructor = self.constructor
|
|
497
498
|
local instances = buffs[unit]
|
|
498
|
-
local instance = instances
|
|
499
|
+
local instance = instances:get(constructor)
|
|
499
500
|
if instance then
|
|
500
501
|
instance:destroy()
|
|
501
502
|
if not instance.destroyed then
|
|
@@ -508,7 +509,7 @@ function Buff.prototype.____constructor(self, unit, source, duration, level, pre
|
|
|
508
509
|
)
|
|
509
510
|
end
|
|
510
511
|
end
|
|
511
|
-
instances
|
|
512
|
+
instances:put(constructor, self)
|
|
512
513
|
if preset then
|
|
513
514
|
local unitHandle = unit.handle
|
|
514
515
|
local slowPoisonMethod = not preset.positive and not preset.magic
|
|
@@ -587,13 +588,13 @@ function Buff.apply(self, ...)
|
|
|
587
588
|
end
|
|
588
589
|
end
|
|
589
590
|
function Buff.getInstance(self, unit)
|
|
590
|
-
return buffs[unit]
|
|
591
|
+
return buffs[unit]:get(self)
|
|
591
592
|
end
|
|
592
593
|
function Buff.isApplied(self, unit)
|
|
593
|
-
return buffs[unit]
|
|
594
|
+
return buffs[unit]:get(self) ~= nil
|
|
594
595
|
end
|
|
595
596
|
function Buff.ifApplied(self, unit, action)
|
|
596
|
-
local instance = buffs[unit]
|
|
597
|
+
local instance = buffs[unit]:get(self)
|
|
597
598
|
if instance then
|
|
598
599
|
____assert(__TS__InstanceOf(instance, self))
|
|
599
600
|
action(instance)
|
|
@@ -616,7 +617,7 @@ function Buff.prototype.destroy(self)
|
|
|
616
617
|
if self.preset then
|
|
617
618
|
self.unit:removeAbility(self.preset.buffId)
|
|
618
619
|
end
|
|
619
|
-
buffs[self.unit]
|
|
620
|
+
buffs[self.unit]:remove(self.constructor)
|
|
620
621
|
self.destroyed = true
|
|
621
622
|
end
|
|
622
623
|
function Buff.prototype.onDispel(self, source)
|
|
@@ -756,14 +757,14 @@ for ____, pointDispelAbilityId in ipairs(pointDispelAbilityIds) do
|
|
|
756
757
|
end)
|
|
757
758
|
end
|
|
758
759
|
Unit.onDamaging:addListener(function(source, target, event)
|
|
759
|
-
if event.amount == 0 and event.attackType ==
|
|
760
|
+
if event.amount == 0 and event.attackType == 0 and event.damageType == DamageType.NORMAL and not event.isAttack then
|
|
760
761
|
Timer:run(function()
|
|
761
762
|
checkBuffs(target, true, source)
|
|
762
763
|
end)
|
|
763
764
|
end
|
|
764
765
|
end)
|
|
765
766
|
Unit.itemPickedUpEvent:addListener(function(unit, item)
|
|
766
|
-
if item.
|
|
767
|
+
if item.isPowerUp and item:hasAbility(fourCC("APdi")) then
|
|
767
768
|
end
|
|
768
769
|
end)
|
|
769
770
|
return ____exports
|
package/objutil/object.lua
CHANGED
|
@@ -153,7 +153,7 @@ end
|
|
|
153
153
|
function ObjectDefinition.getLevelArrayFieldValue(self, level, value, values)
|
|
154
154
|
return type(values) == "function" and values(level, value) or (__TS__ArrayIsArray(values[1]) and values[1] or values)
|
|
155
155
|
end
|
|
156
|
-
____exports.ObjectType = ObjectType or ({})
|
|
156
|
+
____exports.ObjectType = ____exports.ObjectType or ({})
|
|
157
157
|
____exports.ObjectType.ABILITY = 0
|
|
158
158
|
____exports.ObjectType[____exports.ObjectType.ABILITY] = "ABILITY"
|
|
159
159
|
____exports.ObjectType.ITEM = 1
|
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/operation.lua
CHANGED
|
@@ -22,10 +22,7 @@ OperationMonitor.name = "OperationMonitor"
|
|
|
22
22
|
__TS__ClassExtends(OperationMonitor, __TS__Promise)
|
|
23
23
|
function OperationMonitor.prototype.____constructor(self, operation, ...)
|
|
24
24
|
local args = {...}
|
|
25
|
-
__TS__Promise.prototype.____constructor(
|
|
26
|
-
self,
|
|
27
|
-
table.unpack(args)
|
|
28
|
-
)
|
|
25
|
+
__TS__Promise.prototype.____constructor(self, ...)
|
|
29
26
|
self.o = operation
|
|
30
27
|
end
|
|
31
28
|
function OperationMonitor.prototype.cancel(self)
|
|
@@ -57,6 +54,7 @@ function Operation.prototype.execute(self)
|
|
|
57
54
|
return __TS__AsyncAwaiter(function(____awaiter_resolve)
|
|
58
55
|
local result
|
|
59
56
|
local progress = self.progress
|
|
57
|
+
local ____hasReturned, ____returnValue
|
|
60
58
|
local ____try = __TS__AsyncAwaiter(function()
|
|
61
59
|
local maximum = __TS__Await(self:estimate())
|
|
62
60
|
self.maximum = maximum
|
|
@@ -79,7 +77,8 @@ function Operation.prototype.execute(self)
|
|
|
79
77
|
if onComplete ~= nil then
|
|
80
78
|
Event.invoke(onComplete, self, false, reason)
|
|
81
79
|
end
|
|
82
|
-
|
|
80
|
+
____hasReturned = true
|
|
81
|
+
return
|
|
83
82
|
end
|
|
84
83
|
result = __TS__Await(self:work())
|
|
85
84
|
if self.progress ~= progress or self.maximum ~= maximum then
|
|
@@ -93,21 +92,28 @@ function Operation.prototype.execute(self)
|
|
|
93
92
|
end
|
|
94
93
|
until not (result == OperationContinue)
|
|
95
94
|
end)
|
|
96
|
-
|
|
95
|
+
____try = ____try.catch(
|
|
97
96
|
____try,
|
|
98
97
|
function(____, reason)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
return __TS__AsyncAwaiter(function()
|
|
99
|
+
reject(nil, reason)
|
|
100
|
+
local onFailure = ____rawget(self, "onFailure")
|
|
101
|
+
if onFailure ~= nil then
|
|
102
|
+
Event.invoke(onFailure, self, reason)
|
|
103
|
+
end
|
|
104
|
+
local onComplete = ____rawget(self, "onComplete")
|
|
105
|
+
if onComplete ~= nil then
|
|
106
|
+
Event.invoke(onComplete, self, false, reason)
|
|
107
|
+
end
|
|
108
|
+
____hasReturned = true
|
|
109
|
+
return
|
|
110
|
+
end)
|
|
109
111
|
end
|
|
110
|
-
)
|
|
112
|
+
)
|
|
113
|
+
__TS__Await(____try)
|
|
114
|
+
if ____hasReturned then
|
|
115
|
+
return ____awaiter_resolve(nil, ____returnValue)
|
|
116
|
+
end
|
|
111
117
|
resolve(nil, result)
|
|
112
118
|
local onSuccess = ____rawget(self, "onSuccess")
|
|
113
119
|
if onSuccess ~= nil then
|
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.dc37dce",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
|
-
"@warscript/tstl-plugin": "^0.0.
|
|
25
|
+
"@warscript/tstl-plugin": "^0.0.5",
|
|
26
26
|
"lua-types": "^2.13.1",
|
|
27
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.e490aaf"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
31
|
-
"@typescript-eslint/parser": "^8.
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
|
31
|
+
"@typescript-eslint/parser": "^8.61.1",
|
|
32
32
|
"async": "^3.2.6",
|
|
33
33
|
"copyfiles": "^2.4.1",
|
|
34
34
|
"eslint": "^9.14.0",
|
package/patch-lua.lua
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
local error = _G.error
|
|
1
2
|
local getmetatable = _G.getmetatable
|
|
2
3
|
local ipairs = _G.ipairs
|
|
4
|
+
local select = _G.select
|
|
5
|
+
local tostring = _G.tostring
|
|
6
|
+
local tableconcat = table.concat
|
|
3
7
|
|
|
4
8
|
_G.ipairs = function(t)
|
|
5
9
|
local metatable = getmetatable(t)
|
|
@@ -8,3 +12,14 @@ _G.ipairs = function(t)
|
|
|
8
12
|
end
|
|
9
13
|
return ipairs(t)
|
|
10
14
|
end
|
|
15
|
+
|
|
16
|
+
_G.assert = function(v, ...)
|
|
17
|
+
if not v then
|
|
18
|
+
local args = {}
|
|
19
|
+
for i = 1, select("#", ...) do
|
|
20
|
+
args[i] = tostring(select(i, ...))
|
|
21
|
+
end
|
|
22
|
+
error(tableconcat(args, " "))
|
|
23
|
+
end
|
|
24
|
+
return v, ...
|
|
25
|
+
end
|
package/patch-lualib.lua
CHANGED
|
@@ -3,7 +3,7 @@ local lualib = _G.require("lualib_bundle")
|
|
|
3
3
|
local next = _G.next
|
|
4
4
|
local ____type = _G.type
|
|
5
5
|
lualib.__TS__ArrayIsArray = function(value)
|
|
6
|
-
return ____type(value) == "table" and (value[1] ~= nil or (
|
|
6
|
+
return ____type(value) == "table" and (value[1] ~= nil or (next(value)) == nil) and value.constructor == nil
|
|
7
7
|
end
|
|
8
8
|
local __TS__SetDescriptor = lualib.__TS__SetDescriptor
|
|
9
9
|
lualib.__TS__ObjectDefineProperty = function(target, key, desc)
|
package/utility/arrays.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const joinToString: <T>(array: readonly T[], separator: string, t
|
|
|
5
5
|
export declare const arrayOfNotNull: <T>(...elements: readonly (T | undefined | null)[]) => T[];
|
|
6
6
|
export declare const array: <T, N extends number>(length: N, initialize: (index: number) => T) => TupleOf<T, N>;
|
|
7
7
|
export declare const toLuaSet: <T extends AnyNotNil>(array: readonly T[]) => LuaSet<T>;
|
|
8
|
+
export declare const contains: <T>(array: readonly T[], element: T) => boolean;
|
|
8
9
|
export declare const forEach: <T, Args extends any[]>(array: readonly T[], consumerOrKey: ((value: T, ...args: Args) => void) | KeysOfType<T, (this: T, ...args: Args) => void>, ...args: Args) => void;
|
|
9
10
|
export declare const all: {
|
|
10
11
|
<T>(array: readonly T[], transform: (value: T) => boolean): boolean;
|
|
@@ -22,6 +23,7 @@ export declare const mapToLuaSet: {
|
|
|
22
23
|
<T, R extends AnyNotNil>(array: readonly T[], transform: (value: T) => R): LuaSet<R>;
|
|
23
24
|
<T, K extends KeysOfType<T, AnyNotNil>>(array: readonly T[], key: K): LuaSet<T[K] extends AnyNotNil ? T[K] : never>;
|
|
24
25
|
};
|
|
26
|
+
export declare const flatten: <T>(array: readonly (readonly T[])[]) => T[];
|
|
25
27
|
export declare const flatMap: {
|
|
26
28
|
<T, R>(array: readonly T[], transform: (value: T) => readonly R[]): R[];
|
|
27
29
|
<T, K extends KeysOfType<T, readonly any[]>>(array: readonly T[], key: K): (T[K] extends readonly (infer R)[] ? R : never)[];
|
package/utility/arrays.lua
CHANGED
|
@@ -3,6 +3,8 @@ local __TS__New = ____lualib.__TS__New
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____exception = require("exception")
|
|
5
5
|
local IllegalArgumentException = ____exception.IllegalArgumentException
|
|
6
|
+
local ____functions = require("utility.functions")
|
|
7
|
+
local identity = ____functions.identity
|
|
6
8
|
local mathMax = math.max
|
|
7
9
|
local mathMin = math.min
|
|
8
10
|
local select = _G.select
|
|
@@ -47,6 +49,14 @@ ____exports.toLuaSet = function(array)
|
|
|
47
49
|
end
|
|
48
50
|
return result
|
|
49
51
|
end
|
|
52
|
+
____exports.contains = function(array, element)
|
|
53
|
+
for i = 1, #array do
|
|
54
|
+
if array[i] == element then
|
|
55
|
+
return true
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
return false
|
|
59
|
+
end
|
|
50
60
|
____exports.forEach = function(array, consumerOrKey, ...)
|
|
51
61
|
if type(consumerOrKey) == "function" then
|
|
52
62
|
for i = 1, #array do
|
|
@@ -120,6 +130,7 @@ ____exports.mapToLuaSet = function(array, transform)
|
|
|
120
130
|
end
|
|
121
131
|
return result
|
|
122
132
|
end
|
|
133
|
+
____exports.flatten = function(array) return ____exports.flatMap(array, identity) end
|
|
123
134
|
____exports.flatMap = function(array, transform)
|
|
124
135
|
local result = {}
|
|
125
136
|
local k = 1
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
type Callback = {
|
|
3
|
+
readonly __callback: unique symbol;
|
|
4
|
+
};
|
|
5
|
+
export type CallbackId = number & {
|
|
6
|
+
readonly __callbackId: unique symbol;
|
|
7
|
+
};
|
|
8
|
+
export type CallbackArray = {
|
|
9
|
+
readonly __callbackArray: unique symbol;
|
|
10
|
+
} & Callback[];
|
|
11
|
+
export declare const callbackArray: () => CallbackArray;
|
|
12
|
+
export declare function addCallback<Args extends any[]>(this: void, array: CallbackArray, callback: (...args: Args) => unknown, ...args: Args): CallbackId;
|
|
13
|
+
export declare function clearCallbacks(this: void, array: CallbackArray): void;
|
|
14
|
+
export declare function consumeCallback(this: void, array: CallbackArray, id: CallbackId): void;
|
|
15
|
+
export declare function consumeCallbacks(this: void, array: CallbackArray): void;
|
|
16
|
+
export declare function invokeCallbacks(this: void, array: CallbackArray): void;
|
|
17
|
+
export {};
|