warscript 0.0.1-dev.fd21394 → 0.0.1-dev.ff2a62d
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/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/core/types/frame.d.ts +2 -0
- package/core/types/frame.lua +2 -0
- package/engine/behaviour/ability/damage.d.ts +33 -11
- package/engine/behaviour/ability/damage.lua +89 -31
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/buff.d.ts +34 -13
- package/engine/buff.lua +154 -58
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/unit+transport.lua +4 -10
- package/lualib_bundle.lua +7 -2
- package/package.json +2 -2
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/engine/buff.lua
CHANGED
|
@@ -107,7 +107,11 @@ local buffParametersKeys = {
|
|
|
107
107
|
disablesAutoAttack = true,
|
|
108
108
|
destroysOnDamage = true,
|
|
109
109
|
maximumAutoAttackCount = true,
|
|
110
|
-
uniqueGroup = true
|
|
110
|
+
uniqueGroup = true,
|
|
111
|
+
damageOnExpiration = true,
|
|
112
|
+
healingOnExpiration = true,
|
|
113
|
+
killsOnExpiration = true,
|
|
114
|
+
explodesOnExpiration = true
|
|
111
115
|
}
|
|
112
116
|
local function resolveNumberValue(ability, level, value)
|
|
113
117
|
if value == nil or type(value) == "number" then
|
|
@@ -145,7 +149,14 @@ local function resolveAndSetNumberValue(buff, property, ability, level, value, d
|
|
|
145
149
|
buff[property] = resolvedValue
|
|
146
150
|
end
|
|
147
151
|
end
|
|
148
|
-
local buffBooleanParameters = {
|
|
152
|
+
local buffBooleanParameters = {
|
|
153
|
+
"stuns",
|
|
154
|
+
"ignoresStunImmunity",
|
|
155
|
+
"disablesAutoAttack",
|
|
156
|
+
"providesInvulnerability",
|
|
157
|
+
"killsOnExpiration",
|
|
158
|
+
"explodesOnExpiration"
|
|
159
|
+
}
|
|
149
160
|
local buffNumberParameters = {
|
|
150
161
|
"durationIncreaseOnAutoAttack",
|
|
151
162
|
"attackSpeedIncreaseFactor",
|
|
@@ -158,7 +169,9 @@ local buffNumberParameters = {
|
|
|
158
169
|
"damageOverDuration",
|
|
159
170
|
"healingInterval",
|
|
160
171
|
"healingPerInterval",
|
|
161
|
-
"healingOverDuration"
|
|
172
|
+
"healingOverDuration",
|
|
173
|
+
"damageOnExpiration",
|
|
174
|
+
"healingOnExpiration"
|
|
162
175
|
}
|
|
163
176
|
local unsuccessfulApplicationMarker = {}
|
|
164
177
|
local function selectBuffTypeIdWithLeastDuration(buffTypeIds, unit)
|
|
@@ -207,6 +220,7 @@ local function expireBuff(buff)
|
|
|
207
220
|
end
|
|
208
221
|
end
|
|
209
222
|
Timer:run(destroyBuff, buff)
|
|
223
|
+
buff:onExpiration()
|
|
210
224
|
end
|
|
211
225
|
local function buffDamageIntervalInitialTimerCallback(buff)
|
|
212
226
|
buffDamageIntervalTimerCallback(buff)
|
|
@@ -530,11 +544,11 @@ function Buff.prototype.onDestroy(self)
|
|
|
530
544
|
behavior:destroy()
|
|
531
545
|
end
|
|
532
546
|
end
|
|
533
|
-
if self[
|
|
547
|
+
if self[132] then
|
|
534
548
|
unit:decrementDisableAutoAttackCounter()
|
|
535
549
|
end
|
|
536
|
-
if self[
|
|
537
|
-
if self[
|
|
550
|
+
if self[130] then
|
|
551
|
+
if self[131] then
|
|
538
552
|
unit:decrementStunCounter()
|
|
539
553
|
end
|
|
540
554
|
unit:decrementStunCounter()
|
|
@@ -583,20 +597,34 @@ function Buff.getByTypeId(self, unit, typeId)
|
|
|
583
597
|
end
|
|
584
598
|
return nil
|
|
585
599
|
end
|
|
586
|
-
function Buff.prototype.
|
|
600
|
+
function Buff.prototype.onExpiration(self)
|
|
587
601
|
local unit = self.unit
|
|
588
602
|
if self[119] ~= nil then
|
|
603
|
+
(self[101] or unit):damageTarget(unit, self[119] or 0)
|
|
604
|
+
end
|
|
605
|
+
if self[120] ~= nil then
|
|
606
|
+
(self[101] or unit):healTarget(unit, self[119] or 0)
|
|
607
|
+
end
|
|
608
|
+
if self[135] then
|
|
609
|
+
unit:explode()
|
|
610
|
+
elseif self[134] then
|
|
611
|
+
unit:kill()
|
|
612
|
+
end
|
|
613
|
+
end
|
|
614
|
+
function Buff.prototype.onDeath(self, source)
|
|
615
|
+
local unit = self.unit
|
|
616
|
+
if self[121] ~= nil then
|
|
589
617
|
damageArea(
|
|
590
618
|
self[101] or unit,
|
|
591
|
-
self[
|
|
619
|
+
self[121],
|
|
592
620
|
unit.x,
|
|
593
621
|
unit.y,
|
|
594
|
-
self[121] or 0,
|
|
595
|
-
self[120] or 0,
|
|
596
622
|
self[123] or 0,
|
|
597
623
|
self[122] or 0,
|
|
598
624
|
self[125] or 0,
|
|
599
|
-
self[124] or 0
|
|
625
|
+
self[124] or 0,
|
|
626
|
+
self[127] or 0,
|
|
627
|
+
self[126] or 0
|
|
600
628
|
)
|
|
601
629
|
end
|
|
602
630
|
end
|
|
@@ -618,9 +646,9 @@ function Buff.prototype.onDamageDealt(self, target, event)
|
|
|
618
646
|
end
|
|
619
647
|
self.remainingDuration = remainingDuration
|
|
620
648
|
end
|
|
621
|
-
local autoAttackCount = (self[
|
|
622
|
-
self[
|
|
623
|
-
if autoAttackCount == self[
|
|
649
|
+
local autoAttackCount = (self[128] or 0) + 1
|
|
650
|
+
self[128] = autoAttackCount
|
|
651
|
+
if autoAttackCount == self[129] then
|
|
624
652
|
self:destroy()
|
|
625
653
|
end
|
|
626
654
|
end
|
|
@@ -802,6 +830,32 @@ __TS__SetDescriptor(
|
|
|
802
830
|
},
|
|
803
831
|
true
|
|
804
832
|
)
|
|
833
|
+
__TS__SetDescriptor(
|
|
834
|
+
Buff.prototype,
|
|
835
|
+
"damageOnExpiration",
|
|
836
|
+
{
|
|
837
|
+
get = function(self)
|
|
838
|
+
return self[119] or 0
|
|
839
|
+
end,
|
|
840
|
+
set = function(self, damageOnExpiration)
|
|
841
|
+
self[119] = damageOnExpiration ~= 0 and damageOnExpiration or nil
|
|
842
|
+
end
|
|
843
|
+
},
|
|
844
|
+
true
|
|
845
|
+
)
|
|
846
|
+
__TS__SetDescriptor(
|
|
847
|
+
Buff.prototype,
|
|
848
|
+
"healingOnExpiration",
|
|
849
|
+
{
|
|
850
|
+
get = function(self)
|
|
851
|
+
return self[120] or 0
|
|
852
|
+
end,
|
|
853
|
+
set = function(self, healingOnExpiration)
|
|
854
|
+
self[120] = healingOnExpiration ~= 0 and healingOnExpiration or nil
|
|
855
|
+
end
|
|
856
|
+
},
|
|
857
|
+
true
|
|
858
|
+
)
|
|
805
859
|
__TS__SetDescriptor(
|
|
806
860
|
Buff.prototype,
|
|
807
861
|
"receivedDamageFactor",
|
|
@@ -833,25 +887,25 @@ __TS__SetDescriptor(
|
|
|
833
887
|
"stuns",
|
|
834
888
|
{
|
|
835
889
|
get = function(self)
|
|
836
|
-
local
|
|
837
|
-
if
|
|
838
|
-
|
|
890
|
+
local ____self__130_52 = self[130]
|
|
891
|
+
if ____self__130_52 == nil then
|
|
892
|
+
____self__130_52 = false
|
|
839
893
|
end
|
|
840
|
-
return
|
|
894
|
+
return ____self__130_52
|
|
841
895
|
end,
|
|
842
896
|
set = function(self, stuns)
|
|
843
|
-
if not stuns and self[
|
|
844
|
-
if self[
|
|
897
|
+
if not stuns and self[130] then
|
|
898
|
+
if self[131] then
|
|
845
899
|
self.object:decrementStunCounter()
|
|
846
900
|
end
|
|
847
901
|
self.object:decrementStunCounter()
|
|
848
|
-
self[
|
|
849
|
-
elseif stuns and not self[
|
|
850
|
-
if self[
|
|
902
|
+
self[130] = nil
|
|
903
|
+
elseif stuns and not self[130] then
|
|
904
|
+
if self[131] then
|
|
851
905
|
self.object:incrementStunCounter()
|
|
852
906
|
end
|
|
853
907
|
self.object:incrementStunCounter()
|
|
854
|
-
self[
|
|
908
|
+
self[130] = true
|
|
855
909
|
end
|
|
856
910
|
end
|
|
857
911
|
},
|
|
@@ -862,23 +916,23 @@ __TS__SetDescriptor(
|
|
|
862
916
|
"ignoresStunImmunity",
|
|
863
917
|
{
|
|
864
918
|
get = function(self)
|
|
865
|
-
local
|
|
866
|
-
if
|
|
867
|
-
|
|
919
|
+
local ____self__131_53 = self[131]
|
|
920
|
+
if ____self__131_53 == nil then
|
|
921
|
+
____self__131_53 = false
|
|
868
922
|
end
|
|
869
|
-
return
|
|
923
|
+
return ____self__131_53
|
|
870
924
|
end,
|
|
871
925
|
set = function(self, ignoresStunImmunity)
|
|
872
|
-
if not ignoresStunImmunity and self[
|
|
873
|
-
if self[
|
|
926
|
+
if not ignoresStunImmunity and self[131] then
|
|
927
|
+
if self[130] then
|
|
874
928
|
self.object:decrementStunCounter()
|
|
875
929
|
end
|
|
876
|
-
self[
|
|
877
|
-
elseif ignoresStunImmunity and not self[
|
|
878
|
-
if self[
|
|
930
|
+
self[131] = nil
|
|
931
|
+
elseif ignoresStunImmunity and not self[131] then
|
|
932
|
+
if self[130] then
|
|
879
933
|
self.object:incrementStunCounter()
|
|
880
934
|
end
|
|
881
|
-
self[
|
|
935
|
+
self[131] = true
|
|
882
936
|
end
|
|
883
937
|
end
|
|
884
938
|
},
|
|
@@ -889,19 +943,19 @@ __TS__SetDescriptor(
|
|
|
889
943
|
"disablesAutoAttack",
|
|
890
944
|
{
|
|
891
945
|
get = function(self)
|
|
892
|
-
local
|
|
893
|
-
if
|
|
894
|
-
|
|
946
|
+
local ____self__132_54 = self[132]
|
|
947
|
+
if ____self__132_54 == nil then
|
|
948
|
+
____self__132_54 = false
|
|
895
949
|
end
|
|
896
|
-
return
|
|
950
|
+
return ____self__132_54
|
|
897
951
|
end,
|
|
898
952
|
set = function(self, disablesAutoAttack)
|
|
899
|
-
if not disablesAutoAttack and self[
|
|
953
|
+
if not disablesAutoAttack and self[132] then
|
|
900
954
|
self.object:decrementDisableAutoAttackCounter()
|
|
901
|
-
self[
|
|
902
|
-
elseif disablesAutoAttack and not self[
|
|
955
|
+
self[132] = nil
|
|
956
|
+
elseif disablesAutoAttack and not self[132] then
|
|
903
957
|
self.object:incrementDisableAutoAttackCounter()
|
|
904
|
-
self[
|
|
958
|
+
self[132] = true
|
|
905
959
|
end
|
|
906
960
|
end
|
|
907
961
|
},
|
|
@@ -912,19 +966,61 @@ __TS__SetDescriptor(
|
|
|
912
966
|
"providesInvulnerability",
|
|
913
967
|
{
|
|
914
968
|
get = function(self)
|
|
915
|
-
local
|
|
916
|
-
if
|
|
917
|
-
|
|
969
|
+
local ____self__133_55 = self[133]
|
|
970
|
+
if ____self__133_55 == nil then
|
|
971
|
+
____self__133_55 = false
|
|
918
972
|
end
|
|
919
|
-
return
|
|
973
|
+
return ____self__133_55
|
|
920
974
|
end,
|
|
921
975
|
set = function(self, providesInvulnerability)
|
|
922
|
-
if not providesInvulnerability and self[
|
|
976
|
+
if not providesInvulnerability and self[133] then
|
|
923
977
|
self.object:decrementInvulnerabilityCounter()
|
|
924
|
-
self[
|
|
925
|
-
elseif providesInvulnerability and not self[
|
|
978
|
+
self[133] = nil
|
|
979
|
+
elseif providesInvulnerability and not self[133] then
|
|
926
980
|
self.object:incrementInvulnerabilityCounter()
|
|
927
|
-
self[
|
|
981
|
+
self[133] = true
|
|
982
|
+
end
|
|
983
|
+
end
|
|
984
|
+
},
|
|
985
|
+
true
|
|
986
|
+
)
|
|
987
|
+
__TS__SetDescriptor(
|
|
988
|
+
Buff.prototype,
|
|
989
|
+
"killsOnExpiration",
|
|
990
|
+
{
|
|
991
|
+
get = function(self)
|
|
992
|
+
local ____self__134_56 = self[134]
|
|
993
|
+
if ____self__134_56 == nil then
|
|
994
|
+
____self__134_56 = false
|
|
995
|
+
end
|
|
996
|
+
return ____self__134_56
|
|
997
|
+
end,
|
|
998
|
+
set = function(self, killsOnExpiration)
|
|
999
|
+
if not killsOnExpiration and self[134] then
|
|
1000
|
+
self[134] = nil
|
|
1001
|
+
elseif killsOnExpiration and not self[134] then
|
|
1002
|
+
self[134] = true
|
|
1003
|
+
end
|
|
1004
|
+
end
|
|
1005
|
+
},
|
|
1006
|
+
true
|
|
1007
|
+
)
|
|
1008
|
+
__TS__SetDescriptor(
|
|
1009
|
+
Buff.prototype,
|
|
1010
|
+
"explodesOnExpiration",
|
|
1011
|
+
{
|
|
1012
|
+
get = function(self)
|
|
1013
|
+
local ____self__135_57 = self[135]
|
|
1014
|
+
if ____self__135_57 == nil then
|
|
1015
|
+
____self__135_57 = false
|
|
1016
|
+
end
|
|
1017
|
+
return ____self__135_57
|
|
1018
|
+
end,
|
|
1019
|
+
set = function(self, killsOnExpiration)
|
|
1020
|
+
if not killsOnExpiration and self[135] then
|
|
1021
|
+
self[135] = nil
|
|
1022
|
+
elseif killsOnExpiration and not self[135] then
|
|
1023
|
+
self[135] = true
|
|
928
1024
|
end
|
|
929
1025
|
end
|
|
930
1026
|
},
|
|
@@ -935,13 +1031,13 @@ __TS__SetDescriptor(
|
|
|
935
1031
|
"maximumAutoAttackCount",
|
|
936
1032
|
{
|
|
937
1033
|
get = function(self)
|
|
938
|
-
return self[
|
|
1034
|
+
return self[129] or 0
|
|
939
1035
|
end,
|
|
940
1036
|
set = function(self, maximumAutoAttackCount)
|
|
941
1037
|
if maximumAutoAttackCount == 0 then
|
|
942
|
-
self[
|
|
1038
|
+
self[129] = nil
|
|
943
1039
|
else
|
|
944
|
-
self[
|
|
1040
|
+
self[129] = maximumAutoAttackCount
|
|
945
1041
|
end
|
|
946
1042
|
end
|
|
947
1043
|
},
|
|
@@ -999,13 +1095,13 @@ __TS__SetDescriptor(
|
|
|
999
1095
|
"remainingDuration",
|
|
1000
1096
|
{
|
|
1001
1097
|
get = function(self)
|
|
1002
|
-
local
|
|
1003
|
-
return
|
|
1098
|
+
local ____opt_58 = self._timer
|
|
1099
|
+
return ____opt_58 and ____opt_58.remaining or 0
|
|
1004
1100
|
end,
|
|
1005
1101
|
set = function(self, remainingDuration)
|
|
1006
|
-
local
|
|
1007
|
-
local
|
|
1008
|
-
local remainingDurationDelta =
|
|
1102
|
+
local ____remainingDuration_62 = remainingDuration
|
|
1103
|
+
local ____opt_60 = self._timer
|
|
1104
|
+
local remainingDurationDelta = ____remainingDuration_62 - (____opt_60 and ____opt_60.remaining or 0)
|
|
1009
1105
|
if remainingDurationDelta ~= 0 then
|
|
1010
1106
|
self[102] = self[102] + remainingDurationDelta
|
|
1011
1107
|
if remainingDuration <= 0 then
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____rect = require("core.types.rect")
|
|
6
|
+
local Rect = ____rect.Rect
|
|
7
|
+
local ____region = require("core.types.region")
|
|
8
|
+
local Region = ____region.Region
|
|
9
|
+
____exports.GameMap = __TS__Class()
|
|
10
|
+
local GameMap = ____exports.GameMap
|
|
11
|
+
GameMap.name = "GameMap"
|
|
12
|
+
function GameMap.prototype.____constructor(self)
|
|
13
|
+
end
|
|
14
|
+
__TS__ObjectDefineProperty(
|
|
15
|
+
GameMap,
|
|
16
|
+
"worldBoundsRect",
|
|
17
|
+
{get = function(self)
|
|
18
|
+
local rect = Rect:of(GetWorldBounds())
|
|
19
|
+
rawset(self, "worldBoundsRect", rect)
|
|
20
|
+
return rect
|
|
21
|
+
end}
|
|
22
|
+
)
|
|
23
|
+
__TS__ObjectDefineProperty(
|
|
24
|
+
GameMap,
|
|
25
|
+
"worldBoundsRegion",
|
|
26
|
+
{get = function(self)
|
|
27
|
+
local region = Region:create(self.worldBoundsRect)
|
|
28
|
+
rawset(self, "worldBoundsRegion", region)
|
|
29
|
+
return region
|
|
30
|
+
end}
|
|
31
|
+
)
|
|
32
|
+
return ____exports
|
|
@@ -6,9 +6,8 @@ local ____unit = require("engine.internal.unit")
|
|
|
6
6
|
local Unit = ____unit.Unit
|
|
7
7
|
local ____event = require("event")
|
|
8
8
|
local Event = ____event.Event
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local boundRegion = ____mapbounds.boundRegion
|
|
9
|
+
local ____game_2Dmap = require("engine.game-map")
|
|
10
|
+
local GameMap = ____game_2Dmap.GameMap
|
|
12
11
|
local eventInvoke = Event.invoke
|
|
13
12
|
local tableRemove = table.remove
|
|
14
13
|
local ____assert = _G.assert
|
|
@@ -58,8 +57,8 @@ triggerAddCondition(
|
|
|
58
57
|
deboard(unit)
|
|
59
58
|
end
|
|
60
59
|
if not unitAlive(handle) then
|
|
61
|
-
unit.x =
|
|
62
|
-
unit.y =
|
|
60
|
+
unit.x = GameMap.worldBoundsRect.maxX
|
|
61
|
+
unit.y = GameMap.worldBoundsRect.maxY
|
|
63
62
|
end
|
|
64
63
|
local transport = Unit:of(getTransportUnit())
|
|
65
64
|
transportByUnit[unit] = transport
|
|
@@ -68,11 +67,6 @@ triggerAddCondition(
|
|
|
68
67
|
eventInvoke(onBoardEvent, unit, transport)
|
|
69
68
|
end)
|
|
70
69
|
)
|
|
71
|
-
boundRegion.onUnitEnter:addListener(function(unit)
|
|
72
|
-
if transportByUnit[unit] ~= nil and not isUnitLoaded(unit.handle) then
|
|
73
|
-
deboard(unit)
|
|
74
|
-
end
|
|
75
|
-
end)
|
|
76
70
|
Unit.deathEvent:addListener(function(unit)
|
|
77
71
|
if transportByUnit[unit] ~= nil then
|
|
78
72
|
deboard(unit)
|
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")
|
|
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,
|
|
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/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.ff2a62d",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
25
|
"@warscript/tstl-plugin": "^0.0.4",
|
|
26
26
|
"lua-types": "^2.13.1",
|
|
27
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.2c4e71e"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
package/property.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { Player } from "./core/types/player";
|
|
3
|
+
import { Event } from "./event";
|
|
4
|
+
export declare class PersistentPropertiesConfig {
|
|
5
|
+
static defaultFileName: string;
|
|
6
|
+
}
|
|
7
|
+
declare const enum PropertyPropertyKey {
|
|
8
|
+
DEFAULT_VALUE = 0,
|
|
9
|
+
VALUE = 1,
|
|
10
|
+
IS_CHANGED = 2
|
|
11
|
+
}
|
|
12
|
+
export declare class Property<T> {
|
|
13
|
+
readonly valueChangeEvent: Event<[newValue: T, oldValue: T]>;
|
|
14
|
+
private [PropertyPropertyKey.DEFAULT_VALUE];
|
|
15
|
+
private [PropertyPropertyKey.VALUE];
|
|
16
|
+
private [PropertyPropertyKey.IS_CHANGED]?;
|
|
17
|
+
constructor(defaultValue: T);
|
|
18
|
+
get defaultValue(): T;
|
|
19
|
+
set defaultValue(defaultValue: T);
|
|
20
|
+
get value(): T;
|
|
21
|
+
set value(value: T);
|
|
22
|
+
get isChanged(): boolean;
|
|
23
|
+
reset(): boolean;
|
|
24
|
+
set(value: T): boolean;
|
|
25
|
+
get(): T;
|
|
26
|
+
}
|
|
27
|
+
declare const enum PlayerPropertyPropertyKey {
|
|
28
|
+
DEFAULT_VALUE = 0,
|
|
29
|
+
VALUE_BY_PLAYER = 1,
|
|
30
|
+
IS_CHANGED_BY_PLAYER = 2
|
|
31
|
+
}
|
|
32
|
+
export declare class PlayerProperty<T> {
|
|
33
|
+
readonly valueChangeEvent: Event<[player: Player, newValue: T, oldValue: T]>;
|
|
34
|
+
private readonly [PlayerPropertyPropertyKey.DEFAULT_VALUE];
|
|
35
|
+
private readonly [PlayerPropertyPropertyKey.VALUE_BY_PLAYER];
|
|
36
|
+
private readonly [PlayerPropertyPropertyKey.IS_CHANGED_BY_PLAYER];
|
|
37
|
+
constructor(defaultValue: T);
|
|
38
|
+
isChanged(player: Player): boolean;
|
|
39
|
+
reset(player: Player): boolean;
|
|
40
|
+
set(player: Player, value: T): boolean;
|
|
41
|
+
get(player: Player): T;
|
|
42
|
+
}
|
|
43
|
+
export declare class PersistentProperty<T extends undefined | boolean | number | string> extends Property<T> {
|
|
44
|
+
readonly id: number;
|
|
45
|
+
constructor(id: number, defaultValue: T, valueChangeEventListener?: (newValue: T, oldValue: T) => void);
|
|
46
|
+
reset(): boolean;
|
|
47
|
+
set(value: T): boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare class PersistentPlayerProperty<T extends string | number | boolean> extends PlayerProperty<T> {
|
|
50
|
+
readonly id: number;
|
|
51
|
+
constructor(id: number, initialValue: T, valueChangeEventListener?: (player: Player, newValue: T, oldValue: T) => void);
|
|
52
|
+
reset(player: Player): boolean;
|
|
53
|
+
set(player: Player, value: T): boolean;
|
|
54
|
+
}
|
|
55
|
+
export {};
|