warscript 0.0.1-dev.ee2345e → 0.0.1-dev.fa6dee5
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 +0 -1
- package/core/types/frame.d.ts +0 -1
- package/core/types/group.d.ts +0 -1
- package/core/types/image.d.ts +0 -1
- package/core/types/missile.d.ts +2 -2
- package/core/types/missile.lua +8 -2
- package/core/types/unit.lua +8 -0
- package/core/util.lua +1 -1
- package/engine/ability.d.ts +1 -1
- package/engine/behavior.d.ts +6 -6
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +6 -1
- package/engine/behaviour/ability/instant-impact.lua +4 -0
- package/engine/behaviour/ability.d.ts +8 -1
- package/engine/behaviour/ability.lua +62 -0
- package/engine/behaviour/unit/stun-immunity.d.ts +0 -1
- package/engine/buff.d.ts +2 -2
- package/engine/internal/unit/bonus.d.ts +5 -6
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +36 -9
- package/engine/internal/unit.lua +215 -63
- package/engine/object-data/auxiliary/attachment-preset.d.ts +0 -1
- package/engine/object-data/auxiliary/combat-classification.d.ts +0 -2
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +0 -1
- package/engine/object-data/entry/ability-type/blank-passive.d.ts +0 -1
- package/engine/object-data/entry/ability-type/channel.d.ts +0 -1
- package/engine/object-data/entry/ability-type/mine.d.ts +10 -0
- package/engine/object-data/entry/ability-type/mine.lua +39 -0
- package/engine/object-data/entry/ability-type/spirit-touch.d.ts +2 -2
- package/engine/object-data/entry/ability-type/spirit-touch.lua +6 -6
- package/engine/object-data/entry/ability-type.d.ts +0 -1
- package/engine/object-data/entry/buff-type/applicable.d.ts +0 -1
- package/engine/object-data/entry/buff-type/blank.d.ts +0 -1
- package/engine/object-data/entry/buff-type.d.ts +0 -1
- package/engine/object-data/entry/destructible-type.d.ts +0 -1
- package/engine/object-data/entry/item-type/blank.d.ts +0 -1
- package/engine/object-data/entry/item-type.d.ts +0 -1
- package/engine/object-data/entry/lightning-type.d.ts +0 -1
- package/engine/object-data/entry/unit-type.d.ts +37 -2
- package/engine/object-data/entry/unit-type.lua +333 -49
- package/engine/object-data/entry/upgrade/blank.d.ts +0 -1
- package/engine/object-data/entry/upgrade.d.ts +0 -1
- package/engine/object-data/entry.d.ts +2 -3
- package/engine/object-field/ability.d.ts +1 -1
- package/engine/object-field.d.ts +0 -1
- package/engine/random.d.ts +1 -0
- package/engine/random.lua +9 -0
- package/engine/standard/entries/unit-type.d.ts +39 -1
- package/engine/standard/entries/unit-type.lua +39 -1
- package/engine/standard/fields/ability.d.ts +1 -1
- package/engine/standard/fields/ability.lua +1 -1
- package/engine/unit.lua +9 -2
- package/event.d.ts +0 -1
- package/lualib_bundle.lua +139 -40
- package/math/vec2.d.ts +2 -9
- package/math.d.ts +0 -2
- package/objutil/ability.d.ts +0 -1
- package/objutil/buff.d.ts +0 -1
- package/objutil/object.d.ts +0 -1
- package/objutil/unit.d.ts +0 -1
- package/package.json +13 -14
- package/string.d.ts +30 -0
- package/string.lua +14 -0
- package/util/stream.d.ts +0 -1
- package/utility/arrays.d.ts +3 -4
- package/utility/bit-set.d.ts +0 -2
- package/utility/linked-set.d.ts +1 -2
- package/utility/lua-maps.d.ts +1 -2
- package/utility/lua-sets.d.ts +1 -2
|
@@ -8,11 +8,33 @@ ____exports.RIFLEMAN_UNIT_TYPE_ID = fourCC("hrif")
|
|
|
8
8
|
____exports.SIEGE_ENGINE_UNIT_TYPE_ID = fourCC("hmtt")
|
|
9
9
|
____exports.SORCERESS_UNIT_TYPE_ID = fourCC("hsor")
|
|
10
10
|
____exports.SPELLBREAKER_UNIT_TYPE_ID = fourCC("hspt")
|
|
11
|
-
____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
|
|
12
11
|
____exports.ARCHMAGE_HERO_UNIT_TYPE_ID = fourCC("Hamg")
|
|
12
|
+
____exports.BLOOD_MAGE_HERO_UNIT_TYPE_ID = fourCC("Hblm")
|
|
13
|
+
____exports.MOUNTAIN_KING_HERO_UNIT_TYPE_ID = fourCC("Hmkg")
|
|
14
|
+
____exports.PALADIN_HERO_UNIT_TYPE_ID = fourCC("Hpal")
|
|
15
|
+
____exports.ARCHER_HIGH_ELF_UNIT_TYPE_ID = fourCC("nhea")
|
|
13
16
|
____exports.CAPTAIN_UNIT_TYPE_ID = fourCC("hcth")
|
|
17
|
+
____exports.SWORDSMAN_UNIT_TYPE_ID = fourCC("hhes")
|
|
18
|
+
____exports.ADMIRAL_PROUDMOORE_HERO_UNIT_TYPE_ID = fourCC("Hapm")
|
|
19
|
+
____exports.ANASTERIAN_SUNSTRIDER_HERO_UNIT_TYPE_ID = fourCC("Hssa")
|
|
20
|
+
____exports.ANTONIDAS_HERO_UNIT_TYPE_ID = fourCC("Hant")
|
|
21
|
+
____exports.ANTONIDAS_GHOST_HERO_UNIT_TYPE_ID = fourCC("Hgam")
|
|
14
22
|
____exports.ARTHAS_HERO_UNIT_TYPE_ID = fourCC("Hart")
|
|
15
23
|
____exports.ARTHAS_WITH_FROSTMOURNE_HERO_UNIT_TYPE_ID = fourCC("Harf")
|
|
24
|
+
____exports.DAGREN_THE_ORCSLAYER_HERO_UNIT_TYPE_ID = fourCC("Hdgo")
|
|
25
|
+
____exports.HALAHK_THE_LIFEBRINGER_HERO_UNIT_TYPE_ID = fourCC("Hhkl")
|
|
26
|
+
____exports.JAINA_HERO_UNIT_TYPE_ID = fourCC("Hjai")
|
|
27
|
+
____exports.JENNALLA_DEEMSPRING_HERO_UNIT_TYPE_ID = fourCC("Hjnd")
|
|
28
|
+
____exports.KAEL_HERO_UNIT_TYPE_ID = fourCC("Hkal")
|
|
29
|
+
____exports.KELEN_THE_SEEKER_HERO_UNIT_TYPE_ID = fourCC("Haah")
|
|
30
|
+
____exports.LORD_GARITHOS_HERO_UNIT_TYPE_ID = fourCC("Hlgr")
|
|
31
|
+
____exports.LORD_NICHOLAS_BUZAN_HERO_UNIT_TYPE_ID = fourCC("Hpb1")
|
|
32
|
+
____exports.MAGROTH_THE_DEFENDER_HERO_UNIT_TYPE_ID = fourCC("Hmgd")
|
|
33
|
+
____exports.MURADIN_BRONZEBEARD_HERO_UNIT_TYPE_ID = fourCC("Hmbr")
|
|
34
|
+
____exports.SIR_GREGORY_EDMUNSON_HERO_UNIT_TYPE_ID = fourCC("Hpb2")
|
|
35
|
+
____exports.SYLVANAS_WINDRUNNER_HERO_UNIT_TYPE_ID = fourCC("Hvwd")
|
|
36
|
+
____exports.THALORIEN_DAWNSEEKER_HERO_UNIT_TYPE_ID = fourCC("Hddt")
|
|
37
|
+
____exports.UTHER_HERO_UNIT_TYPE_ID = fourCC("Huth")
|
|
16
38
|
____exports.BATRIDER_UNIT_TYPE_ID = fourCC("otbr")
|
|
17
39
|
____exports.DEMOLISHER_UNIT_TYPE_ID = fourCC("ocat")
|
|
18
40
|
____exports.GRUNT_UNIT_TYPE_ID = fourCC("ogru")
|
|
@@ -24,7 +46,22 @@ ____exports.SPIRIT_WALKER_UNIT_TYPE_ID = fourCC("ospw")
|
|
|
24
46
|
____exports.TAUREN_UNIT_TYPE_ID = fourCC("otau")
|
|
25
47
|
____exports.WIND_RIDER_UNIT_TYPE_ID = fourCC("owyv")
|
|
26
48
|
____exports.WITCH_DOCTOR_UNIT_TYPE_ID = fourCC("odoc")
|
|
49
|
+
____exports.ARCHER_UNIT_TYPE_ID = fourCC("earc")
|
|
50
|
+
____exports.CHIMAERA_UNIT_TYPE_ID = fourCC("echm")
|
|
51
|
+
____exports.DRUID_OF_THE_CLAW_UNIT_TYPE_ID = fourCC("edoc")
|
|
52
|
+
____exports.DRUID_OF_THE_TALON_UNIT_TYPE_ID = fourCC("edot")
|
|
53
|
+
____exports.DRYAD_UNIT_TYPE_ID = fourCC("edry")
|
|
54
|
+
____exports.FAERIE_DRAGON_UNIT_TYPE_ID = fourCC("efdr")
|
|
55
|
+
____exports.GLAIVE_THROWER_UNIT_TYPE_ID = fourCC("ebal")
|
|
56
|
+
____exports.HIPPOGRYPH_UNIT_TYPE_ID = fourCC("ehip")
|
|
57
|
+
____exports.HIPPOGRYPH_RIDER_UNIT_TYPE_ID = fourCC("ehpr")
|
|
58
|
+
____exports.HUNTRESS_UNIT_TYPE_ID = fourCC("esen")
|
|
59
|
+
____exports.MOUNTAIN_GIANT_THROWER_UNIT_TYPE_ID = fourCC("emtg")
|
|
60
|
+
____exports.WISP_UNIT_TYPE_ID = fourCC("ewsp")
|
|
27
61
|
____exports.DEMON_HUNTER_HERO_UNIT_TYPE_ID = fourCC("Edem")
|
|
62
|
+
____exports.KEEPER_OF_THE_GROVE_HERO_UNIT_TYPE_ID = fourCC("Ekee")
|
|
63
|
+
____exports.MOON_PRIESTESS_HERO_UNIT_TYPE_ID = fourCC("Emoo")
|
|
64
|
+
____exports.WARDEN_HERO_UNIT_TYPE_ID = fourCC("Ewar")
|
|
28
65
|
____exports.DEMON_HUNTER_DEMON_FORM_HERO_UNIT_TYPE_ID = fourCC("Edmm")
|
|
29
66
|
____exports.ABOMINATION_UNIT_TYPE_ID = fourCC("uabo")
|
|
30
67
|
____exports.GHOUL_UNIT_TYPE_ID = fourCC("ugho")
|
|
@@ -60,6 +97,7 @@ ____exports.WENDIGO_UNIT_TYPE_ID = fourCC("nwen")
|
|
|
60
97
|
____exports.WENDIGO_SHAMAN_UNIT_TYPE_ID = fourCC("nwns")
|
|
61
98
|
____exports.WILDKIN_UNIT_TYPE_ID = fourCC("nowb")
|
|
62
99
|
____exports.WRAITH_UNIT_TYPE_ID = fourCC("ngh2")
|
|
100
|
+
____exports.GOBLIN_LAND_MINE_UNIT_TYPE_ID = fourCC("nglm")
|
|
63
101
|
____exports.CIRCLE_OF_POWER_UNIT_TYPE_ID = fourCC("ncop")
|
|
64
102
|
____exports.CIRCLE_OF_POWER_MEDIUM_UNIT_TYPE_ID = fourCC("ncp2")
|
|
65
103
|
____exports.CIRCLE_OF_POWER_LARGE_UNIT_TYPE_ID = fourCC("ncp3")
|
|
@@ -16,7 +16,7 @@ export declare const LEVEL_SKIP_REQUIREMENT_ABILITY_INTEGER_FIELD: AbilityIntege
|
|
|
16
16
|
export declare const HERO_ABILITY_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
|
|
17
17
|
export declare const ITEM_ABILITY_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
|
|
18
18
|
export declare const CHECK_DEPENDENCIES_ABILITY_BOOLEAN_FIELD: AbilityBooleanField & symbol;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const MISSILE_ARC_ABILITY_FLOAT_FIELD: AbilityFloatField & symbol;
|
|
20
20
|
export declare const NAME_ABILITY_STRING_FIELD: AbilityStringField & symbol;
|
|
21
21
|
export declare const ICON_ACTIVATED_ABILITY_STRING_FIELD: AbilityStringField & symbol;
|
|
22
22
|
export declare const ICON_RESEARCH_ABILITY_STRING_FIELD: AbilityStringField & symbol;
|
|
@@ -27,7 +27,7 @@ ____exports.LEVEL_SKIP_REQUIREMENT_ABILITY_INTEGER_FIELD = AbilityIntegerField:c
|
|
|
27
27
|
____exports.HERO_ABILITY_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("aher"))
|
|
28
28
|
____exports.ITEM_ABILITY_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("aite"))
|
|
29
29
|
____exports.CHECK_DEPENDENCIES_ABILITY_BOOLEAN_FIELD = AbilityBooleanField:create(fourCC("achd"))
|
|
30
|
-
____exports.
|
|
30
|
+
____exports.MISSILE_ARC_ABILITY_FLOAT_FIELD = AbilityFloatField:create(fourCC("amac"))
|
|
31
31
|
____exports.NAME_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("anam"))
|
|
32
32
|
____exports.ICON_ACTIVATED_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("auar"))
|
|
33
33
|
____exports.ICON_RESEARCH_ABILITY_STRING_FIELD = AbilityStringField:create(fourCC("arar"))
|
package/engine/unit.lua
CHANGED
|
@@ -18,8 +18,7 @@ require("engine.internal.unit.detach-missiles")
|
|
|
18
18
|
require("engine.internal.unit.band-aids.ancestral-spirit-cannibalize")
|
|
19
19
|
do
|
|
20
20
|
local ____unit = require("engine.internal.unit")
|
|
21
|
-
|
|
22
|
-
____exports.Unit = Unit
|
|
21
|
+
____exports.Unit = ____unit.Unit
|
|
23
22
|
end
|
|
24
23
|
do
|
|
25
24
|
local ____export = require("engine.internal.unit+damage")
|
|
@@ -29,4 +28,12 @@ do
|
|
|
29
28
|
end
|
|
30
29
|
end
|
|
31
30
|
end
|
|
31
|
+
do
|
|
32
|
+
local ____export = require("engine.internal.unit+rally")
|
|
33
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
34
|
+
if ____exportKey ~= "default" then
|
|
35
|
+
____exports[____exportKey] = ____exportValue
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
32
39
|
return ____exports
|
package/event.d.ts
CHANGED
package/lualib_bundle.lua
CHANGED
|
@@ -193,8 +193,14 @@ do
|
|
|
193
193
|
result[#result + 1] = v
|
|
194
194
|
end
|
|
195
195
|
else
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
local i = 0
|
|
197
|
+
for ____, v in arrayLikeIterator(arrayLike) do
|
|
198
|
+
local ____mapFn_3 = mapFn
|
|
199
|
+
local ____thisArg_1 = thisArg
|
|
200
|
+
local ____v_2 = v
|
|
201
|
+
local ____i_0 = i
|
|
202
|
+
i = ____i_0 + 1
|
|
203
|
+
result[#result + 1] = ____mapFn_3(____thisArg_1, ____v_2, ____i_0)
|
|
198
204
|
end
|
|
199
205
|
end
|
|
200
206
|
return result
|
|
@@ -773,10 +779,11 @@ end
|
|
|
773
779
|
|
|
774
780
|
local __TS__AsyncAwaiter, __TS__Await
|
|
775
781
|
do
|
|
776
|
-
local
|
|
777
|
-
local
|
|
778
|
-
local
|
|
779
|
-
local
|
|
782
|
+
local ____coroutine = _G.coroutine or ({})
|
|
783
|
+
local cocreate = ____coroutine.create
|
|
784
|
+
local coresume = ____coroutine.resume
|
|
785
|
+
local costatus = ____coroutine.status
|
|
786
|
+
local coyield = ____coroutine.yield
|
|
780
787
|
function __TS__AsyncAwaiter(generator)
|
|
781
788
|
return __TS__New(
|
|
782
789
|
__TS__Promise,
|
|
@@ -1417,19 +1424,51 @@ do
|
|
|
1417
1424
|
Map[Symbol.species] = Map
|
|
1418
1425
|
end
|
|
1419
1426
|
|
|
1427
|
+
local function __TS__MapGroupBy(items, keySelector)
|
|
1428
|
+
local result = __TS__New(Map)
|
|
1429
|
+
local i = 0
|
|
1430
|
+
for ____, item in __TS__Iterator(items) do
|
|
1431
|
+
local key = keySelector(nil, item, i)
|
|
1432
|
+
if result:has(key) then
|
|
1433
|
+
local ____temp_0 = result:get(key)
|
|
1434
|
+
____temp_0[#____temp_0 + 1] = item
|
|
1435
|
+
else
|
|
1436
|
+
result:set(key, {item})
|
|
1437
|
+
end
|
|
1438
|
+
i = i + 1
|
|
1439
|
+
end
|
|
1440
|
+
return result
|
|
1441
|
+
end
|
|
1442
|
+
|
|
1420
1443
|
local __TS__Match = string.match
|
|
1421
1444
|
|
|
1422
1445
|
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
1423
1446
|
|
|
1424
1447
|
local __TS__MathModf = math.modf
|
|
1425
1448
|
|
|
1449
|
+
local function __TS__NumberIsNaN(value)
|
|
1450
|
+
return value ~= value
|
|
1451
|
+
end
|
|
1452
|
+
|
|
1426
1453
|
local function __TS__MathSign(val)
|
|
1427
|
-
if val
|
|
1428
|
-
return
|
|
1429
|
-
|
|
1454
|
+
if __TS__NumberIsNaN(val) or val == 0 then
|
|
1455
|
+
return val
|
|
1456
|
+
end
|
|
1457
|
+
if val < 0 then
|
|
1430
1458
|
return -1
|
|
1431
1459
|
end
|
|
1432
|
-
return
|
|
1460
|
+
return 1
|
|
1461
|
+
end
|
|
1462
|
+
|
|
1463
|
+
local function __TS__NumberIsFinite(value)
|
|
1464
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1465
|
+
end
|
|
1466
|
+
|
|
1467
|
+
local function __TS__MathTrunc(val)
|
|
1468
|
+
if not __TS__NumberIsFinite(val) or val == 0 then
|
|
1469
|
+
return val
|
|
1470
|
+
end
|
|
1471
|
+
return val > 0 and math.floor(val) or math.ceil(val)
|
|
1433
1472
|
end
|
|
1434
1473
|
|
|
1435
1474
|
local function __TS__Number(value)
|
|
@@ -1459,18 +1498,10 @@ local function __TS__Number(value)
|
|
|
1459
1498
|
end
|
|
1460
1499
|
end
|
|
1461
1500
|
|
|
1462
|
-
local function __TS__NumberIsFinite(value)
|
|
1463
|
-
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1464
|
-
end
|
|
1465
|
-
|
|
1466
1501
|
local function __TS__NumberIsInteger(value)
|
|
1467
1502
|
return __TS__NumberIsFinite(value) and math.floor(value) == value
|
|
1468
1503
|
end
|
|
1469
1504
|
|
|
1470
|
-
local function __TS__NumberIsNaN(value)
|
|
1471
|
-
return value ~= value
|
|
1472
|
-
end
|
|
1473
|
-
|
|
1474
1505
|
local function __TS__StringSubstring(self, start, ____end)
|
|
1475
1506
|
if ____end ~= ____end then
|
|
1476
1507
|
____end = 0
|
|
@@ -1603,23 +1634,17 @@ local function __TS__ObjectDefineProperty(target, key, desc)
|
|
|
1603
1634
|
local valueExists = value ~= nil
|
|
1604
1635
|
local ____desc_set_4 = desc.set
|
|
1605
1636
|
local ____desc_get_5 = desc.get
|
|
1606
|
-
local
|
|
1607
|
-
if
|
|
1608
|
-
|
|
1609
|
-
else
|
|
1610
|
-
____temp_0 = valueExists
|
|
1637
|
+
local ____desc_configurable_0 = desc.configurable
|
|
1638
|
+
if ____desc_configurable_0 == nil then
|
|
1639
|
+
____desc_configurable_0 = valueExists
|
|
1611
1640
|
end
|
|
1612
|
-
local
|
|
1613
|
-
if
|
|
1614
|
-
|
|
1615
|
-
else
|
|
1616
|
-
____temp_1 = valueExists
|
|
1641
|
+
local ____desc_enumerable_1 = desc.enumerable
|
|
1642
|
+
if ____desc_enumerable_1 == nil then
|
|
1643
|
+
____desc_enumerable_1 = valueExists
|
|
1617
1644
|
end
|
|
1618
|
-
local
|
|
1619
|
-
if
|
|
1620
|
-
|
|
1621
|
-
else
|
|
1622
|
-
____temp_2 = valueExists
|
|
1645
|
+
local ____desc_writable_2 = desc.writable
|
|
1646
|
+
if ____desc_writable_2 == nil then
|
|
1647
|
+
____desc_writable_2 = valueExists
|
|
1623
1648
|
end
|
|
1624
1649
|
local ____temp_3
|
|
1625
1650
|
if desc.value ~= nil then
|
|
@@ -1630,9 +1655,9 @@ local function __TS__ObjectDefineProperty(target, key, desc)
|
|
|
1630
1655
|
descriptor = {
|
|
1631
1656
|
set = ____desc_set_4,
|
|
1632
1657
|
get = ____desc_get_5,
|
|
1633
|
-
configurable =
|
|
1634
|
-
enumerable =
|
|
1635
|
-
writable =
|
|
1658
|
+
configurable = ____desc_configurable_0,
|
|
1659
|
+
enumerable = ____desc_enumerable_1,
|
|
1660
|
+
writable = ____desc_writable_2,
|
|
1636
1661
|
value = ____temp_3
|
|
1637
1662
|
}
|
|
1638
1663
|
end
|
|
@@ -1671,6 +1696,22 @@ local function __TS__ObjectFromEntries(entries)
|
|
|
1671
1696
|
return obj
|
|
1672
1697
|
end
|
|
1673
1698
|
|
|
1699
|
+
local function __TS__ObjectGroupBy(items, keySelector)
|
|
1700
|
+
local result = {}
|
|
1701
|
+
local i = 0
|
|
1702
|
+
for ____, item in __TS__Iterator(items) do
|
|
1703
|
+
local key = keySelector(nil, item, i)
|
|
1704
|
+
if result[key] ~= nil then
|
|
1705
|
+
local ____result_key_0 = result[key]
|
|
1706
|
+
____result_key_0[#____result_key_0 + 1] = item
|
|
1707
|
+
else
|
|
1708
|
+
result[key] = {item}
|
|
1709
|
+
end
|
|
1710
|
+
i = i + 1
|
|
1711
|
+
end
|
|
1712
|
+
return result
|
|
1713
|
+
end
|
|
1714
|
+
|
|
1674
1715
|
local function __TS__ObjectKeys(obj)
|
|
1675
1716
|
local result = {}
|
|
1676
1717
|
local len = 0
|
|
@@ -1994,6 +2035,64 @@ do
|
|
|
1994
2035
|
end
|
|
1995
2036
|
}
|
|
1996
2037
|
end
|
|
2038
|
+
function Set.prototype.union(self, other)
|
|
2039
|
+
local result = __TS__New(Set, self)
|
|
2040
|
+
for ____, item in __TS__Iterator(other) do
|
|
2041
|
+
result:add(item)
|
|
2042
|
+
end
|
|
2043
|
+
return result
|
|
2044
|
+
end
|
|
2045
|
+
function Set.prototype.intersection(self, other)
|
|
2046
|
+
local result = __TS__New(Set)
|
|
2047
|
+
for ____, item in __TS__Iterator(self) do
|
|
2048
|
+
if other:has(item) then
|
|
2049
|
+
result:add(item)
|
|
2050
|
+
end
|
|
2051
|
+
end
|
|
2052
|
+
return result
|
|
2053
|
+
end
|
|
2054
|
+
function Set.prototype.difference(self, other)
|
|
2055
|
+
local result = __TS__New(Set, self)
|
|
2056
|
+
for ____, item in __TS__Iterator(other) do
|
|
2057
|
+
result:delete(item)
|
|
2058
|
+
end
|
|
2059
|
+
return result
|
|
2060
|
+
end
|
|
2061
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
2062
|
+
local result = __TS__New(Set, self)
|
|
2063
|
+
for ____, item in __TS__Iterator(other) do
|
|
2064
|
+
if self:has(item) then
|
|
2065
|
+
result:delete(item)
|
|
2066
|
+
else
|
|
2067
|
+
result:add(item)
|
|
2068
|
+
end
|
|
2069
|
+
end
|
|
2070
|
+
return result
|
|
2071
|
+
end
|
|
2072
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
2073
|
+
for ____, item in __TS__Iterator(self) do
|
|
2074
|
+
if not other:has(item) then
|
|
2075
|
+
return false
|
|
2076
|
+
end
|
|
2077
|
+
end
|
|
2078
|
+
return true
|
|
2079
|
+
end
|
|
2080
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
2081
|
+
for ____, item in __TS__Iterator(other) do
|
|
2082
|
+
if not self:has(item) then
|
|
2083
|
+
return false
|
|
2084
|
+
end
|
|
2085
|
+
end
|
|
2086
|
+
return true
|
|
2087
|
+
end
|
|
2088
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
2089
|
+
for ____, item in __TS__Iterator(self) do
|
|
2090
|
+
if other:has(item) then
|
|
2091
|
+
return false
|
|
2092
|
+
end
|
|
2093
|
+
end
|
|
2094
|
+
return true
|
|
2095
|
+
end
|
|
1997
2096
|
Set[Symbol.species] = Set
|
|
1998
2097
|
end
|
|
1999
2098
|
|
|
@@ -2443,10 +2542,7 @@ local function __TS__Using(self, cb, ...)
|
|
|
2443
2542
|
local args = {...}
|
|
2444
2543
|
local thrownError
|
|
2445
2544
|
local ok, result = xpcall(
|
|
2446
|
-
function() return cb(
|
|
2447
|
-
nil,
|
|
2448
|
-
__TS__Unpack(args)
|
|
2449
|
-
) end,
|
|
2545
|
+
function() return cb(__TS__Unpack(args)) end,
|
|
2450
2546
|
function(err)
|
|
2451
2547
|
thrownError = err
|
|
2452
2548
|
return thrownError
|
|
@@ -2563,10 +2659,12 @@ return {
|
|
|
2563
2659
|
__TS__Iterator = __TS__Iterator,
|
|
2564
2660
|
__TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
|
|
2565
2661
|
Map = Map,
|
|
2662
|
+
__TS__MapGroupBy = __TS__MapGroupBy,
|
|
2566
2663
|
__TS__Match = __TS__Match,
|
|
2567
2664
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2568
2665
|
__TS__MathModf = __TS__MathModf,
|
|
2569
2666
|
__TS__MathSign = __TS__MathSign,
|
|
2667
|
+
__TS__MathTrunc = __TS__MathTrunc,
|
|
2570
2668
|
__TS__New = __TS__New,
|
|
2571
2669
|
__TS__Number = __TS__Number,
|
|
2572
2670
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -2582,6 +2680,7 @@ return {
|
|
|
2582
2680
|
__TS__ObjectFromEntries = __TS__ObjectFromEntries,
|
|
2583
2681
|
__TS__ObjectGetOwnPropertyDescriptor = __TS__ObjectGetOwnPropertyDescriptor,
|
|
2584
2682
|
__TS__ObjectGetOwnPropertyDescriptors = __TS__ObjectGetOwnPropertyDescriptors,
|
|
2683
|
+
__TS__ObjectGroupBy = __TS__ObjectGroupBy,
|
|
2585
2684
|
__TS__ObjectKeys = __TS__ObjectKeys,
|
|
2586
2685
|
__TS__ObjectRest = __TS__ObjectRest,
|
|
2587
2686
|
__TS__ObjectValues = __TS__ObjectValues,
|
package/math/vec2.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
/** Gets the height of the terrain at the position specified by the vector. */
|
|
4
3
|
export declare const getTerrainZ: (x: number, y: number) => number;
|
|
@@ -7,12 +6,6 @@ export declare const angleBetweenPoints: (x1: number, y1: number, x2: number, y2
|
|
|
7
6
|
/** Returns the distance between a and b. */
|
|
8
7
|
export declare const distance: (x1: number, y1: number, x2: number, y2: number) => number;
|
|
9
8
|
/** Moves a point current towards target. */
|
|
10
|
-
export declare const moveTowards: (x1: number, y1: number, x2: number, y2: number, distance: number) => LuaMultiReturn<[
|
|
11
|
-
number,
|
|
12
|
-
number
|
|
13
|
-
]>;
|
|
9
|
+
export declare const moveTowards: (x1: number, y1: number, x2: number, y2: number, distance: number) => LuaMultiReturn<[number, number]>;
|
|
14
10
|
/** Gets a polar offset from this vector. Angle should be specified in degrees. */
|
|
15
|
-
export declare const polarOffset: (x: number, y: number, angle: number, distance: number) => LuaMultiReturn<[
|
|
16
|
-
number,
|
|
17
|
-
number
|
|
18
|
-
]>;
|
|
11
|
+
export declare const polarOffset: (x: number, y: number, angle: number, distance: number) => LuaMultiReturn<[number, number]>;
|
package/math.d.ts
CHANGED
package/objutil/ability.d.ts
CHANGED
package/objutil/buff.d.ts
CHANGED
package/objutil/object.d.ts
CHANGED
package/objutil/unit.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "warscript",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.fa6dee5",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -22,23 +22,22 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
|
-
"@warscript/tstl-plugin": "^0.0.
|
|
26
|
-
"typescript-to-lua": "^1.24.1",
|
|
25
|
+
"@warscript/tstl-plugin": "^0.0.4",
|
|
27
26
|
"lua-types": "^2.13.1",
|
|
28
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.07dd222"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
32
|
-
"@typescript-eslint/parser": "^
|
|
33
|
-
"async": "^3.2.
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
|
31
|
+
"@typescript-eslint/parser": "^8.13.0",
|
|
32
|
+
"async": "^3.2.6",
|
|
34
33
|
"copyfiles": "^2.4.1",
|
|
35
|
-
"eslint": "^
|
|
36
|
-
"eslint-config-prettier": "^
|
|
37
|
-
"eslint-plugin-prettier": "^
|
|
38
|
-
"prettier": "^
|
|
39
|
-
"rimraf": "^
|
|
40
|
-
"ts-node": "^10.9.
|
|
41
|
-
"tsc-watch": "^
|
|
34
|
+
"eslint": "^9.14.0",
|
|
35
|
+
"eslint-config-prettier": "^9.1.0",
|
|
36
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
37
|
+
"prettier": "^3.3.3",
|
|
38
|
+
"rimraf": "^6.0.1",
|
|
39
|
+
"ts-node": "^10.9.2",
|
|
40
|
+
"tsc-watch": "^6.2.0"
|
|
42
41
|
},
|
|
43
42
|
"publishConfig": {
|
|
44
43
|
"access": "public",
|
package/string.d.ts
CHANGED
|
@@ -59,6 +59,22 @@ declare global {
|
|
|
59
59
|
function toNumber(string: string): number;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
declare global {
|
|
63
|
+
namespace string {
|
|
64
|
+
/**
|
|
65
|
+
* Returns the index within the string of the first occurrence of the specified substring, starting from the specified `startIndex`,
|
|
66
|
+
* or -1 if the string does not contain such substring.
|
|
67
|
+
*/
|
|
68
|
+
function indexOf(string: string, substring: string, startIndex?: number): number;
|
|
69
|
+
}
|
|
70
|
+
interface String {
|
|
71
|
+
/**
|
|
72
|
+
* Returns the index within this string of the first occurrence of the specified substring, starting from the specified `startIndex`,
|
|
73
|
+
* or -1 if the string does not contain such substring.
|
|
74
|
+
*/
|
|
75
|
+
indexOf(substring: string, startIndex?: number): number;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
62
78
|
declare global {
|
|
63
79
|
interface String {
|
|
64
80
|
/**
|
|
@@ -103,4 +119,18 @@ declare global {
|
|
|
103
119
|
function isNotBlank(string: string): boolean;
|
|
104
120
|
}
|
|
105
121
|
}
|
|
122
|
+
declare global {
|
|
123
|
+
namespace string {
|
|
124
|
+
/**
|
|
125
|
+
* Returns the number of characters matching the given predicate.
|
|
126
|
+
*/
|
|
127
|
+
function count(string: string, predicate: (char: string) => boolean): number;
|
|
128
|
+
}
|
|
129
|
+
interface String {
|
|
130
|
+
/**
|
|
131
|
+
* Returns the number of characters matching the given predicate.
|
|
132
|
+
*/
|
|
133
|
+
count(predicate: (char: string) => boolean): number;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
106
136
|
export {};
|
package/string.lua
CHANGED
|
@@ -2,6 +2,7 @@ local ____exports = {}
|
|
|
2
2
|
local ____error = _G.error
|
|
3
3
|
local tonumber = _G.tonumber
|
|
4
4
|
local match = string.match
|
|
5
|
+
local find = string.find
|
|
5
6
|
local sub = string.sub
|
|
6
7
|
_G.string.removePrefix = function(____string, prefix)
|
|
7
8
|
local prefixLength = #prefix
|
|
@@ -17,6 +18,10 @@ end
|
|
|
17
18
|
_G.string.toNumber = function(____string)
|
|
18
19
|
return tonumber(____string) or ____error(("'" .. ____string) .. "' is not a valid representation of a number.")
|
|
19
20
|
end
|
|
21
|
+
_G.string.indexOf = function(____string, substring, startIndex)
|
|
22
|
+
local index = find(____string, substring, (startIndex or 0) + 1, true)
|
|
23
|
+
return (index or 0) - 1
|
|
24
|
+
end
|
|
20
25
|
_G.string.indexOfLast = function(____string, predicate)
|
|
21
26
|
for i = #____string, 1, -1 do
|
|
22
27
|
if predicate(sub(____string, i, i)) then
|
|
@@ -31,4 +36,13 @@ end
|
|
|
31
36
|
_G.string.isNotBlank = function(____string)
|
|
32
37
|
return (match(____string, "^%s*$")) == nil
|
|
33
38
|
end
|
|
39
|
+
_G.string.count = function(____string, predicate)
|
|
40
|
+
local result = 0
|
|
41
|
+
for i = 1, #____string do
|
|
42
|
+
if predicate(sub(____string, i, i)) then
|
|
43
|
+
result = result + 1
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
return result
|
|
47
|
+
end
|
|
34
48
|
return ____exports
|
package/util/stream.d.ts
CHANGED
package/utility/arrays.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { TupleOf } from "./types";
|
|
4
3
|
export declare const emptyArray: <T>() => readonly T[];
|
|
5
4
|
export declare const joinToString: <T>(array: readonly T[], separator: string, transform?: (element: T) => string) => string;
|
|
6
|
-
export declare const arrayOfNotNull: <T>(...elements: readonly (T |
|
|
5
|
+
export declare const arrayOfNotNull: <T>(...elements: readonly (T | undefined | null)[]) => T[];
|
|
7
6
|
export declare const array: <T, N extends number>(length: N, initialize: (index: number) => T) => TupleOf<T, N>;
|
|
8
7
|
export declare const toLuaSet: <T extends AnyNotNil>(array: readonly T[]) => LuaSet<T>;
|
|
9
|
-
export declare const forEach: <T, Args extends any[]>(array: readonly T[], consumerOrKey:
|
|
8
|
+
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;
|
|
10
9
|
export declare const all: {
|
|
11
10
|
<T>(array: readonly T[], transform: (value: T) => boolean): boolean;
|
|
12
11
|
<T>(array: readonly T[], key: KeysOfType<T, boolean>): boolean;
|
|
@@ -45,7 +44,7 @@ export declare const max: (array: readonly number[]) => number;
|
|
|
45
44
|
export declare const intersperse: <T>(array: readonly T[], delimiter: T) => T[];
|
|
46
45
|
export declare const zip: <T, R, V>(array: readonly T[], otherArray: readonly R[], transform: (value: T, otherValue: R) => V) => V[];
|
|
47
46
|
export declare const chunked: <T>(array: readonly T[], size: number) => T[][];
|
|
48
|
-
export declare const sortBy: <T, R>(array: T[], selector:
|
|
47
|
+
export declare const sortBy: <T, R>(array: T[], selector: ((value: T) => R) | KeysOfType<T, R>) => void;
|
|
49
48
|
export declare const sortedBy: {
|
|
50
49
|
<T, R>(array: readonly T[], selector: (value: T) => R): T[];
|
|
51
50
|
<T, K extends keyof T>(array: readonly T[], key: K): T[];
|
package/utility/bit-set.d.ts
CHANGED
package/utility/linked-set.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
type IteratorState<T extends AnyNotNil> = {
|
|
4
3
|
t: LuaMap<T, T>;
|
|
@@ -46,5 +45,5 @@ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet
|
|
|
46
45
|
}
|
|
47
46
|
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
48
47
|
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LinkedSet<T>;
|
|
49
|
-
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T |
|
|
48
|
+
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LinkedSet<T>;
|
|
50
49
|
export {};
|
package/utility/lua-maps.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
import { Flatten, TupleOf } from "./types";
|
|
4
|
-
export declare const luaMapOf: <K extends AnyNotNil, V>(...pairs: Flatten<TupleOf<[K, V], 0 |
|
|
3
|
+
export declare const luaMapOf: <K extends AnyNotNil, V>(...pairs: Flatten<TupleOf<[K, V], 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40>>) => LuaMap<K, V>;
|
|
5
4
|
export declare const luaMapInvert: <K extends AnyNotNil, V extends AnyNotNil>(luaMap: LuaMap<K, V>) => LuaMap<V, K>;
|
|
6
5
|
export declare const mapValues: <K extends AnyNotNil, V1, V2>(luaMap: LuaMap<K, V1>, transform: (value: V1) => V2) => LuaMap<K, V2>;
|
package/utility/lua-sets.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
1
|
/** @noSelfInFile */
|
|
3
2
|
export declare const luaSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LuaSet<T>;
|
|
4
|
-
export declare const luaSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T |
|
|
3
|
+
export declare const luaSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LuaSet<T>;
|
|
5
4
|
export declare const luaSetIntersection: <T extends AnyNotNil>(firstLuaSet: ReadonlyLuaSet<T>, secondLuaSet: ReadonlyLuaSet<T>) => LuaSet<T>;
|
|
6
5
|
export declare const luaSetContainsAnyOf: <T extends AnyNotNil>(luaSet: ReadonlyLuaSet<T>, ...elements: readonly T[]) => boolean;
|