warcraft-3-w3ts-utils 0.1.7 → 0.1.9
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/dist/index.lua +13 -0
- package/dist/lua_modules/w3ts/globals/index.lua +23 -0
- package/dist/lua_modules/w3ts/globals/order.lua +2 -0
- package/dist/lua_modules/w3ts/handles/camera.lua +348 -0
- package/dist/lua_modules/w3ts/handles/destructable.lua +237 -0
- package/dist/lua_modules/w3ts/handles/dialog.lua +161 -0
- package/dist/lua_modules/w3ts/handles/effect.lua +198 -0
- package/dist/lua_modules/w3ts/handles/fogmodifier.lua +76 -0
- package/dist/lua_modules/w3ts/handles/force.lua +105 -0
- package/dist/lua_modules/w3ts/handles/frame.lua +417 -0
- package/dist/lua_modules/w3ts/handles/gamecache.lua +132 -0
- package/dist/lua_modules/w3ts/handles/group.lua +215 -0
- package/dist/lua_modules/w3ts/handles/handle.lua +38 -0
- package/dist/lua_modules/w3ts/handles/image.lua +105 -0
- package/dist/lua_modules/w3ts/handles/index.lua +226 -0
- package/dist/lua_modules/w3ts/handles/item.lua +375 -0
- package/dist/lua_modules/w3ts/handles/leaderboard.lua +211 -0
- package/dist/lua_modules/w3ts/handles/multiboard.lua +193 -0
- package/dist/lua_modules/w3ts/handles/player.lua +311 -0
- package/dist/lua_modules/w3ts/handles/point.lua +80 -0
- package/dist/lua_modules/w3ts/handles/quest.lua +176 -0
- package/dist/lua_modules/w3ts/handles/rect.lua +129 -0
- package/dist/lua_modules/w3ts/handles/region.lua +72 -0
- package/dist/lua_modules/w3ts/handles/sound.lua +174 -0
- package/dist/lua_modules/w3ts/handles/texttag.lua +97 -0
- package/dist/lua_modules/w3ts/handles/timer.lua +83 -0
- package/dist/lua_modules/w3ts/handles/timerdialog.lua +86 -0
- package/dist/lua_modules/w3ts/handles/trigger.lua +265 -0
- package/dist/lua_modules/w3ts/handles/ubersplat.lua +84 -0
- package/dist/lua_modules/w3ts/handles/unit.lua +1330 -0
- package/dist/lua_modules/w3ts/handles/weathereffect.lua +42 -0
- package/dist/lua_modules/w3ts/handles/widget.lua +53 -0
- package/dist/lua_modules/w3ts/hooks/index.lua +52 -0
- package/dist/lua_modules/w3ts/index.lua +36 -0
- package/dist/lua_modules/w3ts/system/base64.lua +108 -0
- package/dist/lua_modules/w3ts/system/binaryreader.lua +74 -0
- package/dist/lua_modules/w3ts/system/binarywriter.lua +88 -0
- package/dist/lua_modules/w3ts/system/file.lua +88 -0
- package/dist/lua_modules/w3ts/system/gametime.lua +27 -0
- package/dist/lua_modules/w3ts/system/host.lua +104 -0
- package/dist/lua_modules/w3ts/system/index.lua +58 -0
- package/dist/lua_modules/w3ts/system/sync.lua +239 -0
- package/dist/lua_modules/w3ts/utils/color.lua +189 -0
- package/dist/lua_modules/w3ts/utils/index.lua +38 -0
- package/dist/lualib_bundle.lua +2733 -0
- package/dist/package.json +41 -0
- package/dist/utils/abilities.lua +107 -0
- package/dist/utils/camera.lua +46 -0
- package/dist/utils/chat-command.lua +30 -0
- package/dist/utils/color.lua +41 -0
- package/dist/utils/index.lua +125 -0
- package/dist/utils/item.d.ts +14 -1
- package/dist/utils/item.lua +179 -0
- package/dist/utils/math.lua +17 -0
- package/dist/utils/minimapIcons.lua +28 -0
- package/dist/utils/misc.lua +143 -0
- package/dist/utils/physics.lua +161 -0
- package/dist/utils/players.d.ts +0 -1
- package/dist/utils/players.lua +233 -0
- package/dist/utils/point.lua +60 -0
- package/dist/utils/quests.lua +47 -0
- package/dist/utils/textTag.lua +110 -0
- package/dist/utils/timer.lua +21 -0
- package/dist/utils/units.lua +102 -0
- package/package.json +4 -6
- package/dist/index.js +0 -18
- package/dist/utils/abilities.js +0 -125
- package/dist/utils/camera.js +0 -37
- package/dist/utils/chat-command.js +0 -22
- package/dist/utils/color.js +0 -141
- package/dist/utils/index.js +0 -32
- package/dist/utils/item.js +0 -124
- package/dist/utils/math.js +0 -17
- package/dist/utils/minimapIcons.js +0 -27
- package/dist/utils/misc.js +0 -175
- package/dist/utils/physics.js +0 -194
- package/dist/utils/players.js +0 -189
- package/dist/utils/point.js +0 -74
- package/dist/utils/quests.js +0 -30
- package/dist/utils/textTag.js +0 -72
- package/dist/utils/timer.js +0 -16
- package/dist/utils/units.js +0 -81
- package/tsconfig.json +0 -40
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____handle = require("lua_modules.w3ts.handles.handle")
|
|
7
|
+
local Handle = ____handle.Handle
|
|
8
|
+
____exports.DialogButton = __TS__Class()
|
|
9
|
+
local DialogButton = ____exports.DialogButton
|
|
10
|
+
DialogButton.name = "DialogButton"
|
|
11
|
+
__TS__ClassExtends(DialogButton, Handle)
|
|
12
|
+
function DialogButton.prototype.____constructor(self, whichDialog, text, hotkey, quit, score)
|
|
13
|
+
if hotkey == nil then
|
|
14
|
+
hotkey = 0
|
|
15
|
+
end
|
|
16
|
+
if quit == nil then
|
|
17
|
+
quit = false
|
|
18
|
+
end
|
|
19
|
+
if score == nil then
|
|
20
|
+
score = false
|
|
21
|
+
end
|
|
22
|
+
if Handle:initFromHandle() then
|
|
23
|
+
Handle.prototype.____constructor(self)
|
|
24
|
+
return
|
|
25
|
+
end
|
|
26
|
+
local handle
|
|
27
|
+
if quit == false then
|
|
28
|
+
handle = DialogAddButton(whichDialog.handle, text, hotkey)
|
|
29
|
+
else
|
|
30
|
+
handle = DialogAddQuitButton(whichDialog.handle, score, text, hotkey)
|
|
31
|
+
end
|
|
32
|
+
if handle == nil then
|
|
33
|
+
error("w3ts failed to create button handle.", 3)
|
|
34
|
+
end
|
|
35
|
+
Handle.prototype.____constructor(self, handle)
|
|
36
|
+
end
|
|
37
|
+
function DialogButton.create(self, whichDialog, text, hotkey, quit, score)
|
|
38
|
+
if hotkey == nil then
|
|
39
|
+
hotkey = 0
|
|
40
|
+
end
|
|
41
|
+
if quit == nil then
|
|
42
|
+
quit = false
|
|
43
|
+
end
|
|
44
|
+
if score == nil then
|
|
45
|
+
score = false
|
|
46
|
+
end
|
|
47
|
+
local handle
|
|
48
|
+
if quit == false then
|
|
49
|
+
handle = DialogAddButton(whichDialog.handle, text, hotkey)
|
|
50
|
+
else
|
|
51
|
+
handle = DialogAddQuitButton(whichDialog.handle, score, text, hotkey)
|
|
52
|
+
end
|
|
53
|
+
if handle then
|
|
54
|
+
local obj = self:getObject(handle)
|
|
55
|
+
local values = {}
|
|
56
|
+
values.handle = handle
|
|
57
|
+
return __TS__ObjectAssign(obj, values)
|
|
58
|
+
end
|
|
59
|
+
return nil
|
|
60
|
+
end
|
|
61
|
+
function DialogButton.fromEvent(self)
|
|
62
|
+
return self:fromHandle(GetClickedButton())
|
|
63
|
+
end
|
|
64
|
+
function DialogButton.fromHandle(self, handle)
|
|
65
|
+
local ____handle_0
|
|
66
|
+
if handle then
|
|
67
|
+
____handle_0 = self:getObject(handle)
|
|
68
|
+
else
|
|
69
|
+
____handle_0 = nil
|
|
70
|
+
end
|
|
71
|
+
return ____handle_0
|
|
72
|
+
end
|
|
73
|
+
---
|
|
74
|
+
-- @example Create a simple dialog.
|
|
75
|
+
-- ```ts
|
|
76
|
+
-- const dialog = Dialog.create();
|
|
77
|
+
-- if (dialog) {
|
|
78
|
+
-- const trigger = Trigger.create();
|
|
79
|
+
--
|
|
80
|
+
-- trigger.registerDialogEvent(dialog);
|
|
81
|
+
-- trigger.addAction(() => {
|
|
82
|
+
-- const clicked = DialogButton.fromEvent();
|
|
83
|
+
-- });
|
|
84
|
+
--
|
|
85
|
+
-- Timer.create().start(1.00, false, () => {
|
|
86
|
+
-- DialogButton.create(dialog, "Stay", 0);
|
|
87
|
+
-- DialogButton.create(dialog, "Leave", 0, true);
|
|
88
|
+
--
|
|
89
|
+
-- dialog.setMessage("Welcome to TypeScript!");
|
|
90
|
+
-- dialog.display(Players[0], true);
|
|
91
|
+
-- });
|
|
92
|
+
-- }
|
|
93
|
+
-- ```
|
|
94
|
+
____exports.Dialog = __TS__Class()
|
|
95
|
+
local Dialog = ____exports.Dialog
|
|
96
|
+
Dialog.name = "Dialog"
|
|
97
|
+
__TS__ClassExtends(Dialog, Handle)
|
|
98
|
+
function Dialog.prototype.____constructor(self)
|
|
99
|
+
if Handle:initFromHandle() then
|
|
100
|
+
Handle.prototype.____constructor(self)
|
|
101
|
+
return
|
|
102
|
+
end
|
|
103
|
+
local handle = DialogCreate()
|
|
104
|
+
if handle == nil then
|
|
105
|
+
error("w3ts failed to create dialog handle.", 3)
|
|
106
|
+
end
|
|
107
|
+
Handle.prototype.____constructor(self, handle)
|
|
108
|
+
end
|
|
109
|
+
function Dialog.create(self)
|
|
110
|
+
local handle = DialogCreate()
|
|
111
|
+
if handle then
|
|
112
|
+
local obj = self:getObject(handle)
|
|
113
|
+
local values = {}
|
|
114
|
+
values.handle = handle
|
|
115
|
+
return __TS__ObjectAssign(obj, values)
|
|
116
|
+
end
|
|
117
|
+
return nil
|
|
118
|
+
end
|
|
119
|
+
function Dialog.prototype.addButton(self, text, hotkey, quit, score)
|
|
120
|
+
if hotkey == nil then
|
|
121
|
+
hotkey = 0
|
|
122
|
+
end
|
|
123
|
+
if quit == nil then
|
|
124
|
+
quit = false
|
|
125
|
+
end
|
|
126
|
+
if score == nil then
|
|
127
|
+
score = false
|
|
128
|
+
end
|
|
129
|
+
return ____exports.DialogButton:create(
|
|
130
|
+
self,
|
|
131
|
+
text,
|
|
132
|
+
hotkey,
|
|
133
|
+
quit,
|
|
134
|
+
score
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
function Dialog.prototype.clear(self)
|
|
138
|
+
DialogClear(self.handle)
|
|
139
|
+
end
|
|
140
|
+
function Dialog.prototype.destroy(self)
|
|
141
|
+
DialogDestroy(self.handle)
|
|
142
|
+
end
|
|
143
|
+
function Dialog.prototype.display(self, whichPlayer, flag)
|
|
144
|
+
DialogDisplay(whichPlayer.handle, self.handle, flag)
|
|
145
|
+
end
|
|
146
|
+
function Dialog.prototype.setMessage(self, whichMessage)
|
|
147
|
+
DialogSetMessage(self.handle, whichMessage)
|
|
148
|
+
end
|
|
149
|
+
function Dialog.fromEvent(self)
|
|
150
|
+
return self:fromHandle(GetClickedDialog())
|
|
151
|
+
end
|
|
152
|
+
function Dialog.fromHandle(self, handle)
|
|
153
|
+
local ____handle_1
|
|
154
|
+
if handle then
|
|
155
|
+
____handle_1 = self:getObject(handle)
|
|
156
|
+
else
|
|
157
|
+
____handle_1 = nil
|
|
158
|
+
end
|
|
159
|
+
return ____handle_1
|
|
160
|
+
end
|
|
161
|
+
return ____exports
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local ____handle = require("lua_modules.w3ts.handles.handle")
|
|
8
|
+
local Handle = ____handle.Handle
|
|
9
|
+
____exports.Effect = __TS__Class()
|
|
10
|
+
local Effect = ____exports.Effect
|
|
11
|
+
Effect.name = "Effect"
|
|
12
|
+
__TS__ClassExtends(Effect, Handle)
|
|
13
|
+
function Effect.prototype.____constructor(self, modelName, a, b)
|
|
14
|
+
if Handle:initFromHandle() then
|
|
15
|
+
Handle.prototype.____constructor(self)
|
|
16
|
+
return
|
|
17
|
+
end
|
|
18
|
+
local handle
|
|
19
|
+
if type(a) == "number" and type(b) == "number" then
|
|
20
|
+
handle = AddSpecialEffect(modelName, a, b)
|
|
21
|
+
elseif type(a) ~= "number" and type(b) == "string" then
|
|
22
|
+
handle = AddSpecialEffectTarget(modelName, a.handle, b)
|
|
23
|
+
end
|
|
24
|
+
if handle == nil then
|
|
25
|
+
error("w3ts failed to create effect handle.", 3)
|
|
26
|
+
end
|
|
27
|
+
Handle.prototype.____constructor(self, handle)
|
|
28
|
+
if type(a) ~= "number" and type(b) == "string" then
|
|
29
|
+
self.attachWidget = a
|
|
30
|
+
self.attachPointName = b
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
__TS__SetDescriptor(
|
|
34
|
+
Effect.prototype,
|
|
35
|
+
"scale",
|
|
36
|
+
{
|
|
37
|
+
get = function(self)
|
|
38
|
+
return BlzGetSpecialEffectScale(self.handle)
|
|
39
|
+
end,
|
|
40
|
+
set = function(self, scale)
|
|
41
|
+
BlzSetSpecialEffectScale(self.handle, scale)
|
|
42
|
+
end
|
|
43
|
+
},
|
|
44
|
+
true
|
|
45
|
+
)
|
|
46
|
+
__TS__SetDescriptor(
|
|
47
|
+
Effect.prototype,
|
|
48
|
+
"x",
|
|
49
|
+
{
|
|
50
|
+
get = function(self)
|
|
51
|
+
return BlzGetLocalSpecialEffectX(self.handle)
|
|
52
|
+
end,
|
|
53
|
+
set = function(self, x)
|
|
54
|
+
BlzSetSpecialEffectX(self.handle, x)
|
|
55
|
+
end
|
|
56
|
+
},
|
|
57
|
+
true
|
|
58
|
+
)
|
|
59
|
+
__TS__SetDescriptor(
|
|
60
|
+
Effect.prototype,
|
|
61
|
+
"y",
|
|
62
|
+
{
|
|
63
|
+
get = function(self)
|
|
64
|
+
return BlzGetLocalSpecialEffectY(self.handle)
|
|
65
|
+
end,
|
|
66
|
+
set = function(self, y)
|
|
67
|
+
BlzSetSpecialEffectY(self.handle, y)
|
|
68
|
+
end
|
|
69
|
+
},
|
|
70
|
+
true
|
|
71
|
+
)
|
|
72
|
+
__TS__SetDescriptor(
|
|
73
|
+
Effect.prototype,
|
|
74
|
+
"z",
|
|
75
|
+
{
|
|
76
|
+
get = function(self)
|
|
77
|
+
return BlzGetLocalSpecialEffectZ(self.handle)
|
|
78
|
+
end,
|
|
79
|
+
set = function(self, z)
|
|
80
|
+
BlzSetSpecialEffectZ(self.handle, z)
|
|
81
|
+
end
|
|
82
|
+
},
|
|
83
|
+
true
|
|
84
|
+
)
|
|
85
|
+
function Effect.create(self, modelName, x, y)
|
|
86
|
+
local handle = AddSpecialEffect(modelName, x, y)
|
|
87
|
+
if handle then
|
|
88
|
+
local obj = self:getObject(handle)
|
|
89
|
+
local values = {}
|
|
90
|
+
values.handle = handle
|
|
91
|
+
return __TS__ObjectAssign(obj, values)
|
|
92
|
+
end
|
|
93
|
+
return nil
|
|
94
|
+
end
|
|
95
|
+
function Effect.createAttachment(self, modelName, targetWidget, attachPointName)
|
|
96
|
+
local handle = AddSpecialEffectTarget(modelName, targetWidget.handle, attachPointName)
|
|
97
|
+
if handle then
|
|
98
|
+
local obj = self:getObject(handle)
|
|
99
|
+
local values = {}
|
|
100
|
+
values.handle = handle
|
|
101
|
+
values.attachWidget = targetWidget
|
|
102
|
+
values.attachPointName = attachPointName
|
|
103
|
+
return __TS__ObjectAssign(obj, values)
|
|
104
|
+
end
|
|
105
|
+
return nil
|
|
106
|
+
end
|
|
107
|
+
function Effect.createSpell(self, abilityId, effectType, x, y)
|
|
108
|
+
local handle = AddSpellEffectById(abilityId, effectType, x, y)
|
|
109
|
+
if handle then
|
|
110
|
+
local obj = self:getObject(handle)
|
|
111
|
+
local values = {}
|
|
112
|
+
values.handle = handle
|
|
113
|
+
return __TS__ObjectAssign(obj, values)
|
|
114
|
+
end
|
|
115
|
+
return nil
|
|
116
|
+
end
|
|
117
|
+
function Effect.createSpellAttachment(self, abilityId, effectType, targetWidget, attachPointName)
|
|
118
|
+
local handle = AddSpellEffectTargetById(abilityId, effectType, targetWidget.handle, attachPointName)
|
|
119
|
+
if handle then
|
|
120
|
+
local obj = self:getObject(handle)
|
|
121
|
+
local values = {}
|
|
122
|
+
values.handle = handle
|
|
123
|
+
values.attachWidget = targetWidget
|
|
124
|
+
values.attachPointName = attachPointName
|
|
125
|
+
return __TS__ObjectAssign(obj, values)
|
|
126
|
+
end
|
|
127
|
+
return nil
|
|
128
|
+
end
|
|
129
|
+
function Effect.prototype.addSubAnimation(self, subAnim)
|
|
130
|
+
BlzSpecialEffectAddSubAnimation(self.handle, subAnim)
|
|
131
|
+
end
|
|
132
|
+
function Effect.prototype.clearSubAnimations(self)
|
|
133
|
+
BlzSpecialEffectClearSubAnimations(self.handle)
|
|
134
|
+
end
|
|
135
|
+
function Effect.prototype.destroy(self)
|
|
136
|
+
DestroyEffect(self.handle)
|
|
137
|
+
end
|
|
138
|
+
function Effect.prototype.playAnimation(self, animType)
|
|
139
|
+
BlzPlaySpecialEffect(self.handle, animType)
|
|
140
|
+
end
|
|
141
|
+
function Effect.prototype.playWithTimeScale(self, animType, timeScale)
|
|
142
|
+
BlzPlaySpecialEffectWithTimeScale(self.handle, animType, timeScale)
|
|
143
|
+
end
|
|
144
|
+
function Effect.prototype.removeSubAnimation(self, subAnim)
|
|
145
|
+
BlzSpecialEffectRemoveSubAnimation(self.handle, subAnim)
|
|
146
|
+
end
|
|
147
|
+
function Effect.prototype.resetScaleMatrix(self)
|
|
148
|
+
BlzResetSpecialEffectMatrix(self.handle)
|
|
149
|
+
end
|
|
150
|
+
function Effect.prototype.setAlpha(self, alpha)
|
|
151
|
+
BlzSetSpecialEffectAlpha(self.handle, alpha)
|
|
152
|
+
end
|
|
153
|
+
function Effect.prototype.setColor(self, red, green, blue)
|
|
154
|
+
BlzSetSpecialEffectColor(self.handle, red, green, blue)
|
|
155
|
+
end
|
|
156
|
+
function Effect.prototype.setColorByPlayer(self, whichPlayer)
|
|
157
|
+
BlzSetSpecialEffectColorByPlayer(self.handle, whichPlayer.handle)
|
|
158
|
+
end
|
|
159
|
+
function Effect.prototype.setHeight(self, height)
|
|
160
|
+
BlzSetSpecialEffectHeight(self.handle, height)
|
|
161
|
+
end
|
|
162
|
+
function Effect.prototype.setOrientation(self, yaw, pitch, roll)
|
|
163
|
+
BlzSetSpecialEffectOrientation(self.handle, yaw, pitch, roll)
|
|
164
|
+
end
|
|
165
|
+
function Effect.prototype.setPitch(self, pitch)
|
|
166
|
+
BlzSetSpecialEffectPitch(self.handle, pitch)
|
|
167
|
+
end
|
|
168
|
+
function Effect.prototype.setPoint(self, p)
|
|
169
|
+
BlzSetSpecialEffectPositionLoc(self.handle, p.handle)
|
|
170
|
+
end
|
|
171
|
+
function Effect.prototype.setPosition(self, x, y, z)
|
|
172
|
+
BlzSetSpecialEffectPosition(self.handle, x, y, z)
|
|
173
|
+
end
|
|
174
|
+
function Effect.prototype.setRoll(self, roll)
|
|
175
|
+
BlzSetSpecialEffectRoll(self.handle, roll)
|
|
176
|
+
end
|
|
177
|
+
function Effect.prototype.setScaleMatrix(self, x, y, z)
|
|
178
|
+
BlzSetSpecialEffectMatrixScale(self.handle, x, y, z)
|
|
179
|
+
end
|
|
180
|
+
function Effect.prototype.setTime(self, value)
|
|
181
|
+
BlzSetSpecialEffectTime(self.handle, value)
|
|
182
|
+
end
|
|
183
|
+
function Effect.prototype.setTimeScale(self, timeScale)
|
|
184
|
+
BlzSetSpecialEffectTimeScale(self.handle, timeScale)
|
|
185
|
+
end
|
|
186
|
+
function Effect.prototype.setYaw(self, y)
|
|
187
|
+
BlzSetSpecialEffectYaw(self.handle, y)
|
|
188
|
+
end
|
|
189
|
+
function Effect.fromHandle(self, handle)
|
|
190
|
+
local ____handle_0
|
|
191
|
+
if handle then
|
|
192
|
+
____handle_0 = self:getObject(handle)
|
|
193
|
+
else
|
|
194
|
+
____handle_0 = nil
|
|
195
|
+
end
|
|
196
|
+
return ____handle_0
|
|
197
|
+
end
|
|
198
|
+
return ____exports
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____handle = require("lua_modules.w3ts.handles.handle")
|
|
7
|
+
local Handle = ____handle.Handle
|
|
8
|
+
____exports.FogModifier = __TS__Class()
|
|
9
|
+
local FogModifier = ____exports.FogModifier
|
|
10
|
+
FogModifier.name = "FogModifier"
|
|
11
|
+
__TS__ClassExtends(FogModifier, Handle)
|
|
12
|
+
function FogModifier.prototype.____constructor(self, forWhichPlayer, whichState, centerX, centerY, radius, useSharedVision, afterUnits)
|
|
13
|
+
if Handle:initFromHandle() then
|
|
14
|
+
Handle.prototype.____constructor(self)
|
|
15
|
+
return
|
|
16
|
+
end
|
|
17
|
+
local handle = CreateFogModifierRadius(
|
|
18
|
+
forWhichPlayer.handle,
|
|
19
|
+
whichState,
|
|
20
|
+
centerX,
|
|
21
|
+
centerY,
|
|
22
|
+
radius,
|
|
23
|
+
useSharedVision,
|
|
24
|
+
afterUnits
|
|
25
|
+
)
|
|
26
|
+
if handle == nil then
|
|
27
|
+
error("w3ts failed to create fogmodifier handle.", 3)
|
|
28
|
+
end
|
|
29
|
+
Handle.prototype.____constructor(self, handle)
|
|
30
|
+
end
|
|
31
|
+
function FogModifier.create(self, forWhichPlayer, whichState, centerX, centerY, radius, useSharedVision, afterUnits)
|
|
32
|
+
local handle = CreateFogModifierRadius(
|
|
33
|
+
forWhichPlayer.handle,
|
|
34
|
+
whichState,
|
|
35
|
+
centerX,
|
|
36
|
+
centerY,
|
|
37
|
+
radius,
|
|
38
|
+
useSharedVision,
|
|
39
|
+
afterUnits
|
|
40
|
+
)
|
|
41
|
+
if handle then
|
|
42
|
+
local obj = self:getObject(handle)
|
|
43
|
+
local values = {}
|
|
44
|
+
values.handle = handle
|
|
45
|
+
return __TS__ObjectAssign(obj, values)
|
|
46
|
+
end
|
|
47
|
+
return nil
|
|
48
|
+
end
|
|
49
|
+
function FogModifier.prototype.destroy(self)
|
|
50
|
+
DestroyFogModifier(self.handle)
|
|
51
|
+
end
|
|
52
|
+
function FogModifier.prototype.start(self)
|
|
53
|
+
FogModifierStart(self.handle)
|
|
54
|
+
end
|
|
55
|
+
function FogModifier.prototype.stop(self)
|
|
56
|
+
FogModifierStop(self.handle)
|
|
57
|
+
end
|
|
58
|
+
function FogModifier.fromHandle(self, handle)
|
|
59
|
+
local ____handle_0
|
|
60
|
+
if handle then
|
|
61
|
+
____handle_0 = self:getObject(handle)
|
|
62
|
+
else
|
|
63
|
+
____handle_0 = nil
|
|
64
|
+
end
|
|
65
|
+
return ____handle_0
|
|
66
|
+
end
|
|
67
|
+
function FogModifier.fromRect(self, forWhichPlayer, whichState, where, useSharedVision, afterUnits)
|
|
68
|
+
return self:fromHandle(CreateFogModifierRect(
|
|
69
|
+
forWhichPlayer.handle,
|
|
70
|
+
whichState,
|
|
71
|
+
where.handle,
|
|
72
|
+
useSharedVision,
|
|
73
|
+
afterUnits
|
|
74
|
+
))
|
|
75
|
+
end
|
|
76
|
+
return ____exports
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
+
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
5
|
+
local ____exports = {}
|
|
6
|
+
local ____handle = require("lua_modules.w3ts.handles.handle")
|
|
7
|
+
local Handle = ____handle.Handle
|
|
8
|
+
local ____player = require("lua_modules.w3ts.handles.player")
|
|
9
|
+
local MapPlayer = ____player.MapPlayer
|
|
10
|
+
____exports.Force = __TS__Class()
|
|
11
|
+
local Force = ____exports.Force
|
|
12
|
+
Force.name = "Force"
|
|
13
|
+
__TS__ClassExtends(Force, Handle)
|
|
14
|
+
function Force.prototype.____constructor(self)
|
|
15
|
+
if Handle:initFromHandle() then
|
|
16
|
+
Handle.prototype.____constructor(self)
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
local handle = CreateForce()
|
|
20
|
+
if handle == nil then
|
|
21
|
+
error("w3ts failed to create force handle.", 3)
|
|
22
|
+
end
|
|
23
|
+
Handle.prototype.____constructor(self, handle)
|
|
24
|
+
end
|
|
25
|
+
function Force.create(self)
|
|
26
|
+
local handle = CreateForce()
|
|
27
|
+
if handle then
|
|
28
|
+
local obj = self:getObject(handle)
|
|
29
|
+
local values = {}
|
|
30
|
+
values.handle = handle
|
|
31
|
+
return __TS__ObjectAssign(obj, values)
|
|
32
|
+
end
|
|
33
|
+
return nil
|
|
34
|
+
end
|
|
35
|
+
function Force.prototype.addPlayer(self, whichPlayer)
|
|
36
|
+
ForceAddPlayer(self.handle, whichPlayer.handle)
|
|
37
|
+
end
|
|
38
|
+
function Force.prototype.clear(self)
|
|
39
|
+
ForceClear(self.handle)
|
|
40
|
+
end
|
|
41
|
+
function Force.prototype.destroy(self)
|
|
42
|
+
DestroyForce(self.handle)
|
|
43
|
+
end
|
|
44
|
+
function Force.prototype.enumAllies(self, whichPlayer, filter)
|
|
45
|
+
ForceEnumAllies(
|
|
46
|
+
self.handle,
|
|
47
|
+
whichPlayer.handle,
|
|
48
|
+
type(filter) == "function" and Filter(filter) or filter
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
function Force.prototype.enumEnemies(self, whichPlayer, filter)
|
|
52
|
+
ForceEnumEnemies(
|
|
53
|
+
self.handle,
|
|
54
|
+
whichPlayer.handle,
|
|
55
|
+
type(filter) == "function" and Filter(filter) or filter
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
function Force.prototype.enumPlayers(self, filter)
|
|
59
|
+
ForceEnumPlayers(
|
|
60
|
+
self.handle,
|
|
61
|
+
type(filter) == "function" and Filter(filter) or filter
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
function Force.prototype.enumPlayersCounted(self, filter, countLimit)
|
|
65
|
+
ForceEnumPlayersCounted(
|
|
66
|
+
self.handle,
|
|
67
|
+
type(filter) == "function" and Filter(filter) or filter,
|
|
68
|
+
countLimit
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
Force.prototype["for"] = function(self, callback)
|
|
72
|
+
ForForce(self.handle, callback)
|
|
73
|
+
end
|
|
74
|
+
function Force.prototype.getPlayers(self)
|
|
75
|
+
local players = {}
|
|
76
|
+
ForForce(
|
|
77
|
+
self.handle,
|
|
78
|
+
function()
|
|
79
|
+
local pl = MapPlayer:fromEnum()
|
|
80
|
+
if pl then
|
|
81
|
+
players[#players + 1] = pl
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
)
|
|
85
|
+
return players
|
|
86
|
+
end
|
|
87
|
+
function Force.prototype.hasPlayer(self, whichPlayer)
|
|
88
|
+
return IsPlayerInForce(whichPlayer.handle, self.handle)
|
|
89
|
+
end
|
|
90
|
+
function Force.prototype.removePlayer(self, whichPlayer)
|
|
91
|
+
ForceRemovePlayer(self.handle, whichPlayer.handle)
|
|
92
|
+
end
|
|
93
|
+
function Force.fromPlayer(self, whichPlayer)
|
|
94
|
+
return self:fromHandle(GetForceOfPlayer(whichPlayer.handle))
|
|
95
|
+
end
|
|
96
|
+
function Force.fromHandle(self, handle)
|
|
97
|
+
local ____handle_0
|
|
98
|
+
if handle then
|
|
99
|
+
____handle_0 = self:getObject(handle)
|
|
100
|
+
else
|
|
101
|
+
____handle_0 = nil
|
|
102
|
+
end
|
|
103
|
+
return ____handle_0
|
|
104
|
+
end
|
|
105
|
+
return ____exports
|