warcraft-3-w3ts-utils 0.1.6 → 0.1.8
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.lua +173 -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.lua +234 -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 -37
|
@@ -0,0 +1,417 @@
|
|
|
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
|
+
--- Warcraft III's UI uses a proprietary format known as FDF (Frame Definition Files).
|
|
10
|
+
-- This class provides the ability to manipulate and create them dynamically through code.
|
|
11
|
+
--
|
|
12
|
+
-- @example Create a simple button.
|
|
13
|
+
-- ```ts
|
|
14
|
+
-- const gameui = Frame.fromOrigin(ORIGIN_FRAME_GAME_UI, 0);
|
|
15
|
+
-- if (gameui) {
|
|
16
|
+
-- // Create a "GLUEBUTTON" named "Facebutton", the clickable Button, for game UI
|
|
17
|
+
-- const buttonFrame = Frame.createType("FaceButton", gameui, 0, "GLUEBUTTON", "");
|
|
18
|
+
-- if (buttonFrame) {
|
|
19
|
+
-- // Create a BACKDROP named "FaceButtonIcon", the visible image, for buttonFrame.
|
|
20
|
+
-- const buttonIconFrame = Frame.createType("FaceButton", buttonFrame, 0, "BACKDROP", "");
|
|
21
|
+
-- // buttonIconFrame will mimic buttonFrame in size and position
|
|
22
|
+
-- buttonIconFrame?.setAllPoints(buttonFrame);
|
|
23
|
+
-- // Set a Texture
|
|
24
|
+
-- buttonIconFrame?.setTexture("ReplaceableTextures\\CommandButtons\\BTNSelectHeroOn", 0, true);
|
|
25
|
+
-- // Place the buttonFrame to the center of the screen
|
|
26
|
+
-- buttonFrame.setAbsPoint(FRAMEPOINT_CENTER, 0.4, 0.3);
|
|
27
|
+
-- // Give that buttonFrame a size
|
|
28
|
+
-- buttonFrame.setSize(0.05, 0.05);
|
|
29
|
+
-- }
|
|
30
|
+
-- }
|
|
31
|
+
-- ```
|
|
32
|
+
--
|
|
33
|
+
-- There are many aspects to modifying the UI and it can become complicated, so here are some
|
|
34
|
+
-- guides:
|
|
35
|
+
--
|
|
36
|
+
-- https://www.hiveworkshop.com/threads/ui-frames-starting-guide.318603/
|
|
37
|
+
-- https://www.hiveworkshop.com/pastebin/913bd439799b3d917e5b522dd9ef458f20598/
|
|
38
|
+
-- https://www.hiveworkshop.com/tags/ui-fdf/
|
|
39
|
+
____exports.Frame = __TS__Class()
|
|
40
|
+
local Frame = ____exports.Frame
|
|
41
|
+
Frame.name = "Frame"
|
|
42
|
+
__TS__ClassExtends(Frame, Handle)
|
|
43
|
+
function Frame.prototype.____constructor(self, name, owner, priority, createContext, typeName, inherits)
|
|
44
|
+
if Handle:initFromHandle() then
|
|
45
|
+
Handle.prototype.____constructor(self)
|
|
46
|
+
return
|
|
47
|
+
end
|
|
48
|
+
local handle
|
|
49
|
+
if createContext == nil then
|
|
50
|
+
handle = BlzCreateSimpleFrame(name, owner.handle, priority)
|
|
51
|
+
elseif typeName ~= nil and inherits ~= nil then
|
|
52
|
+
handle = BlzCreateFrameByType(
|
|
53
|
+
typeName,
|
|
54
|
+
name,
|
|
55
|
+
owner.handle,
|
|
56
|
+
inherits,
|
|
57
|
+
createContext
|
|
58
|
+
)
|
|
59
|
+
else
|
|
60
|
+
handle = BlzCreateFrame(name, owner.handle, priority, createContext)
|
|
61
|
+
end
|
|
62
|
+
if handle == nil then
|
|
63
|
+
error("w3ts failed to create framehandle handle.", 3)
|
|
64
|
+
end
|
|
65
|
+
Handle.prototype.____constructor(self, handle)
|
|
66
|
+
end
|
|
67
|
+
__TS__SetDescriptor(
|
|
68
|
+
Frame.prototype,
|
|
69
|
+
"alpha",
|
|
70
|
+
{
|
|
71
|
+
get = function(self)
|
|
72
|
+
return BlzFrameGetAlpha(self.handle)
|
|
73
|
+
end,
|
|
74
|
+
set = function(self, alpha)
|
|
75
|
+
BlzFrameSetAlpha(self.handle, alpha)
|
|
76
|
+
end
|
|
77
|
+
},
|
|
78
|
+
true
|
|
79
|
+
)
|
|
80
|
+
__TS__SetDescriptor(
|
|
81
|
+
Frame.prototype,
|
|
82
|
+
"children",
|
|
83
|
+
{get = function(self)
|
|
84
|
+
local count = self.childrenCount
|
|
85
|
+
local output = {}
|
|
86
|
+
do
|
|
87
|
+
local i = 0
|
|
88
|
+
while i < count do
|
|
89
|
+
local child = self:getChild(i)
|
|
90
|
+
if child then
|
|
91
|
+
output[#output + 1] = child
|
|
92
|
+
end
|
|
93
|
+
i = i + 1
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
return output
|
|
97
|
+
end},
|
|
98
|
+
true
|
|
99
|
+
)
|
|
100
|
+
__TS__SetDescriptor(
|
|
101
|
+
Frame.prototype,
|
|
102
|
+
"childrenCount",
|
|
103
|
+
{get = function(self)
|
|
104
|
+
return BlzFrameGetChildrenCount(self.handle)
|
|
105
|
+
end},
|
|
106
|
+
true
|
|
107
|
+
)
|
|
108
|
+
__TS__SetDescriptor(
|
|
109
|
+
Frame.prototype,
|
|
110
|
+
"enabled",
|
|
111
|
+
{
|
|
112
|
+
get = function(self)
|
|
113
|
+
return BlzFrameGetEnable(self.handle)
|
|
114
|
+
end,
|
|
115
|
+
set = function(self, flag)
|
|
116
|
+
BlzFrameSetEnable(self.handle, flag)
|
|
117
|
+
end
|
|
118
|
+
},
|
|
119
|
+
true
|
|
120
|
+
)
|
|
121
|
+
__TS__SetDescriptor(
|
|
122
|
+
Frame.prototype,
|
|
123
|
+
"height",
|
|
124
|
+
{
|
|
125
|
+
get = function(self)
|
|
126
|
+
return BlzFrameGetHeight(self.handle)
|
|
127
|
+
end,
|
|
128
|
+
set = function(self, height)
|
|
129
|
+
BlzFrameSetSize(self.handle, self.width, height)
|
|
130
|
+
end
|
|
131
|
+
},
|
|
132
|
+
true
|
|
133
|
+
)
|
|
134
|
+
__TS__SetDescriptor(
|
|
135
|
+
Frame.prototype,
|
|
136
|
+
"parent",
|
|
137
|
+
{
|
|
138
|
+
get = function(self)
|
|
139
|
+
return ____exports.Frame:fromHandle(BlzFrameGetParent(self.handle))
|
|
140
|
+
end,
|
|
141
|
+
set = function(self, parent)
|
|
142
|
+
BlzFrameSetParent(self.handle, parent.handle)
|
|
143
|
+
end
|
|
144
|
+
},
|
|
145
|
+
true
|
|
146
|
+
)
|
|
147
|
+
__TS__SetDescriptor(
|
|
148
|
+
Frame.prototype,
|
|
149
|
+
"text",
|
|
150
|
+
{
|
|
151
|
+
get = function(self)
|
|
152
|
+
return BlzFrameGetText(self.handle) or ""
|
|
153
|
+
end,
|
|
154
|
+
set = function(self, text)
|
|
155
|
+
BlzFrameSetText(self.handle, text)
|
|
156
|
+
end
|
|
157
|
+
},
|
|
158
|
+
true
|
|
159
|
+
)
|
|
160
|
+
__TS__SetDescriptor(
|
|
161
|
+
Frame.prototype,
|
|
162
|
+
"textSizeLimit",
|
|
163
|
+
{
|
|
164
|
+
get = function(self)
|
|
165
|
+
return BlzFrameGetTextSizeLimit(self.handle)
|
|
166
|
+
end,
|
|
167
|
+
set = function(self, size)
|
|
168
|
+
BlzFrameSetTextSizeLimit(self.handle, size)
|
|
169
|
+
end
|
|
170
|
+
},
|
|
171
|
+
true
|
|
172
|
+
)
|
|
173
|
+
__TS__SetDescriptor(
|
|
174
|
+
Frame.prototype,
|
|
175
|
+
"value",
|
|
176
|
+
{
|
|
177
|
+
get = function(self)
|
|
178
|
+
return BlzFrameGetValue(self.handle)
|
|
179
|
+
end,
|
|
180
|
+
set = function(self, value)
|
|
181
|
+
BlzFrameSetValue(self.handle, value)
|
|
182
|
+
end
|
|
183
|
+
},
|
|
184
|
+
true
|
|
185
|
+
)
|
|
186
|
+
__TS__SetDescriptor(
|
|
187
|
+
Frame.prototype,
|
|
188
|
+
"visible",
|
|
189
|
+
{
|
|
190
|
+
get = function(self)
|
|
191
|
+
return BlzFrameIsVisible(self.handle)
|
|
192
|
+
end,
|
|
193
|
+
set = function(self, flag)
|
|
194
|
+
BlzFrameSetVisible(self.handle, flag)
|
|
195
|
+
end
|
|
196
|
+
},
|
|
197
|
+
true
|
|
198
|
+
)
|
|
199
|
+
__TS__SetDescriptor(
|
|
200
|
+
Frame.prototype,
|
|
201
|
+
"width",
|
|
202
|
+
{
|
|
203
|
+
get = function(self)
|
|
204
|
+
return BlzFrameGetWidth(self.handle)
|
|
205
|
+
end,
|
|
206
|
+
set = function(self, width)
|
|
207
|
+
BlzFrameSetSize(self.handle, width, self.height)
|
|
208
|
+
end
|
|
209
|
+
},
|
|
210
|
+
true
|
|
211
|
+
)
|
|
212
|
+
function Frame.create(self, name, owner, priority, createContext)
|
|
213
|
+
local handle = BlzCreateFrame(name, owner.handle, priority, createContext)
|
|
214
|
+
if handle then
|
|
215
|
+
local obj = self:getObject(handle)
|
|
216
|
+
local values = {}
|
|
217
|
+
values.handle = handle
|
|
218
|
+
return __TS__ObjectAssign(obj, values)
|
|
219
|
+
end
|
|
220
|
+
return nil
|
|
221
|
+
end
|
|
222
|
+
function Frame.createSimple(self, name, owner, createContext)
|
|
223
|
+
local handle = BlzCreateSimpleFrame(name, owner.handle, createContext)
|
|
224
|
+
if handle then
|
|
225
|
+
local obj = self:getObject(handle)
|
|
226
|
+
local values = {}
|
|
227
|
+
values.handle = handle
|
|
228
|
+
return __TS__ObjectAssign(obj, values)
|
|
229
|
+
end
|
|
230
|
+
return nil
|
|
231
|
+
end
|
|
232
|
+
function Frame.createType(self, name, owner, createContext, typeName, inherits)
|
|
233
|
+
local handle = BlzCreateFrameByType(
|
|
234
|
+
typeName,
|
|
235
|
+
name,
|
|
236
|
+
owner.handle,
|
|
237
|
+
inherits,
|
|
238
|
+
createContext
|
|
239
|
+
)
|
|
240
|
+
if handle then
|
|
241
|
+
local obj = self:getObject(handle)
|
|
242
|
+
local values = {}
|
|
243
|
+
values.handle = handle
|
|
244
|
+
return __TS__ObjectAssign(obj, values)
|
|
245
|
+
end
|
|
246
|
+
return nil
|
|
247
|
+
end
|
|
248
|
+
function Frame.prototype.addText(self, text)
|
|
249
|
+
BlzFrameAddText(self.handle, text)
|
|
250
|
+
return self
|
|
251
|
+
end
|
|
252
|
+
function Frame.prototype.cageMouse(self, enable)
|
|
253
|
+
BlzFrameCageMouse(self.handle, enable)
|
|
254
|
+
return self
|
|
255
|
+
end
|
|
256
|
+
function Frame.prototype.clearPoints(self)
|
|
257
|
+
BlzFrameClearAllPoints(self.handle)
|
|
258
|
+
return self
|
|
259
|
+
end
|
|
260
|
+
function Frame.prototype.click(self)
|
|
261
|
+
BlzFrameClick(self.handle)
|
|
262
|
+
return self
|
|
263
|
+
end
|
|
264
|
+
function Frame.prototype.destroy(self)
|
|
265
|
+
BlzDestroyFrame(self.handle)
|
|
266
|
+
return self
|
|
267
|
+
end
|
|
268
|
+
function Frame.prototype.getChild(self, index)
|
|
269
|
+
return ____exports.Frame:fromHandle(BlzFrameGetChild(self.handle, index))
|
|
270
|
+
end
|
|
271
|
+
function Frame.prototype.setAbsPoint(self, point, x, y)
|
|
272
|
+
BlzFrameSetAbsPoint(self.handle, point, x, y)
|
|
273
|
+
return self
|
|
274
|
+
end
|
|
275
|
+
function Frame.prototype.setAllPoints(self, relative)
|
|
276
|
+
BlzFrameSetAllPoints(self.handle, relative.handle)
|
|
277
|
+
return self
|
|
278
|
+
end
|
|
279
|
+
function Frame.prototype.setAlpha(self, alpha)
|
|
280
|
+
BlzFrameSetAlpha(self.handle, alpha)
|
|
281
|
+
return self
|
|
282
|
+
end
|
|
283
|
+
function Frame.prototype.setEnabled(self, flag)
|
|
284
|
+
BlzFrameSetEnable(self.handle, flag)
|
|
285
|
+
return self
|
|
286
|
+
end
|
|
287
|
+
function Frame.prototype.setFocus(self, flag)
|
|
288
|
+
BlzFrameSetFocus(self.handle, flag)
|
|
289
|
+
return self
|
|
290
|
+
end
|
|
291
|
+
function Frame.prototype.setFont(self, filename, height, flags)
|
|
292
|
+
BlzFrameSetFont(self.handle, filename, height, flags)
|
|
293
|
+
return self
|
|
294
|
+
end
|
|
295
|
+
function Frame.prototype.setHeight(self, height)
|
|
296
|
+
BlzFrameSetSize(self.handle, self.width, height)
|
|
297
|
+
return self
|
|
298
|
+
end
|
|
299
|
+
function Frame.prototype.setLevel(self, level)
|
|
300
|
+
BlzFrameSetLevel(self.handle, level)
|
|
301
|
+
return self
|
|
302
|
+
end
|
|
303
|
+
function Frame.prototype.setMinMaxValue(self, minValue, maxValue)
|
|
304
|
+
BlzFrameSetMinMaxValue(self.handle, minValue, maxValue)
|
|
305
|
+
return self
|
|
306
|
+
end
|
|
307
|
+
function Frame.prototype.setModel(self, modelFile, cameraIndex)
|
|
308
|
+
BlzFrameSetModel(self.handle, modelFile, cameraIndex)
|
|
309
|
+
return self
|
|
310
|
+
end
|
|
311
|
+
function Frame.prototype.getParent(self)
|
|
312
|
+
return ____exports.Frame:fromHandle(BlzFrameGetParent(self.handle))
|
|
313
|
+
end
|
|
314
|
+
function Frame.prototype.setParent(self, parent)
|
|
315
|
+
BlzFrameSetParent(self.handle, parent.handle)
|
|
316
|
+
return self
|
|
317
|
+
end
|
|
318
|
+
function Frame.prototype.setPoint(self, point, relative, relativePoint, x, y)
|
|
319
|
+
BlzFrameSetPoint(
|
|
320
|
+
self.handle,
|
|
321
|
+
point,
|
|
322
|
+
relative.handle,
|
|
323
|
+
relativePoint,
|
|
324
|
+
x,
|
|
325
|
+
y
|
|
326
|
+
)
|
|
327
|
+
return self
|
|
328
|
+
end
|
|
329
|
+
function Frame.prototype.setScale(self, scale)
|
|
330
|
+
BlzFrameSetScale(self.handle, scale)
|
|
331
|
+
return self
|
|
332
|
+
end
|
|
333
|
+
function Frame.prototype.setSize(self, width, height)
|
|
334
|
+
BlzFrameSetSize(self.handle, width, height)
|
|
335
|
+
return self
|
|
336
|
+
end
|
|
337
|
+
function Frame.prototype.setSpriteAnimate(self, primaryProp, flags)
|
|
338
|
+
BlzFrameSetSpriteAnimate(self.handle, primaryProp, flags)
|
|
339
|
+
return self
|
|
340
|
+
end
|
|
341
|
+
function Frame.prototype.setStepSize(self, stepSize)
|
|
342
|
+
BlzFrameSetStepSize(self.handle, stepSize)
|
|
343
|
+
return self
|
|
344
|
+
end
|
|
345
|
+
function Frame.prototype.setText(self, text)
|
|
346
|
+
BlzFrameSetText(self.handle, text)
|
|
347
|
+
return self
|
|
348
|
+
end
|
|
349
|
+
function Frame.prototype.setTextColor(self, color)
|
|
350
|
+
BlzFrameSetTextColor(self.handle, color)
|
|
351
|
+
return self
|
|
352
|
+
end
|
|
353
|
+
function Frame.prototype.setTextSizeLimit(self, size)
|
|
354
|
+
BlzFrameSetTextSizeLimit(self.handle, size)
|
|
355
|
+
return self
|
|
356
|
+
end
|
|
357
|
+
function Frame.prototype.setTexture(self, texFile, flag, blend)
|
|
358
|
+
BlzFrameSetTexture(self.handle, texFile, flag, blend)
|
|
359
|
+
return self
|
|
360
|
+
end
|
|
361
|
+
function Frame.prototype.setTooltip(self, tooltip)
|
|
362
|
+
BlzFrameSetTooltip(self.handle, tooltip.handle)
|
|
363
|
+
return self
|
|
364
|
+
end
|
|
365
|
+
function Frame.prototype.setValue(self, value)
|
|
366
|
+
BlzFrameSetValue(self.handle, value)
|
|
367
|
+
return self
|
|
368
|
+
end
|
|
369
|
+
function Frame.prototype.setVertexColor(self, color)
|
|
370
|
+
BlzFrameSetVertexColor(self.handle, color)
|
|
371
|
+
return self
|
|
372
|
+
end
|
|
373
|
+
function Frame.prototype.setVisible(self, flag)
|
|
374
|
+
BlzFrameSetVisible(self.handle, flag)
|
|
375
|
+
return self
|
|
376
|
+
end
|
|
377
|
+
function Frame.prototype.setWidth(self, width)
|
|
378
|
+
BlzFrameSetSize(self.handle, width, self.height)
|
|
379
|
+
return self
|
|
380
|
+
end
|
|
381
|
+
function Frame.autoPosition(self, enable)
|
|
382
|
+
BlzEnableUIAutoPosition(enable)
|
|
383
|
+
end
|
|
384
|
+
function Frame.fromEvent(self)
|
|
385
|
+
return self:fromHandle(BlzGetTriggerFrame())
|
|
386
|
+
end
|
|
387
|
+
function Frame.fromHandle(self, handle)
|
|
388
|
+
local ____handle_0
|
|
389
|
+
if handle then
|
|
390
|
+
____handle_0 = self:getObject(handle)
|
|
391
|
+
else
|
|
392
|
+
____handle_0 = nil
|
|
393
|
+
end
|
|
394
|
+
return ____handle_0
|
|
395
|
+
end
|
|
396
|
+
function Frame.fromName(self, name, createContext)
|
|
397
|
+
return self:fromHandle(BlzGetFrameByName(name, createContext))
|
|
398
|
+
end
|
|
399
|
+
function Frame.fromOrigin(self, frameType, index)
|
|
400
|
+
return self:fromHandle(BlzGetOriginFrame(frameType, index))
|
|
401
|
+
end
|
|
402
|
+
function Frame.getEventHandle(self)
|
|
403
|
+
return BlzGetTriggerFrameEvent()
|
|
404
|
+
end
|
|
405
|
+
function Frame.getEventText(self)
|
|
406
|
+
return BlzGetTriggerFrameValue()
|
|
407
|
+
end
|
|
408
|
+
function Frame.getEventValue(self)
|
|
409
|
+
return BlzGetTriggerFrameValue()
|
|
410
|
+
end
|
|
411
|
+
function Frame.hideOrigin(self, enable)
|
|
412
|
+
BlzHideOriginFrames(enable)
|
|
413
|
+
end
|
|
414
|
+
function Frame.loadTOC(self, filename)
|
|
415
|
+
return BlzLoadTOCFile(filename)
|
|
416
|
+
end
|
|
417
|
+
return ____exports
|
|
@@ -0,0 +1,132 @@
|
|
|
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.GameCache = __TS__Class()
|
|
9
|
+
local GameCache = ____exports.GameCache
|
|
10
|
+
GameCache.name = "GameCache"
|
|
11
|
+
__TS__ClassExtends(GameCache, Handle)
|
|
12
|
+
function GameCache.prototype.____constructor(self, campaignFile)
|
|
13
|
+
if Handle:initFromHandle() then
|
|
14
|
+
Handle.prototype.____constructor(self)
|
|
15
|
+
return
|
|
16
|
+
end
|
|
17
|
+
local handle = InitGameCache(campaignFile)
|
|
18
|
+
if handle == nil then
|
|
19
|
+
error("w3ts failed to create gamecache handle.", 3)
|
|
20
|
+
end
|
|
21
|
+
Handle.prototype.____constructor(self, handle)
|
|
22
|
+
self.filename = campaignFile
|
|
23
|
+
end
|
|
24
|
+
function GameCache.create(self, campaignFile)
|
|
25
|
+
local handle = InitGameCache(campaignFile)
|
|
26
|
+
if handle then
|
|
27
|
+
local obj = self:getObject(handle)
|
|
28
|
+
local values = {}
|
|
29
|
+
values.handle = handle
|
|
30
|
+
values.filename = campaignFile
|
|
31
|
+
return __TS__ObjectAssign(obj, values)
|
|
32
|
+
end
|
|
33
|
+
return nil
|
|
34
|
+
end
|
|
35
|
+
function GameCache.prototype.flush(self)
|
|
36
|
+
FlushGameCache(self.handle)
|
|
37
|
+
end
|
|
38
|
+
function GameCache.prototype.flushBoolean(self, missionKey, key)
|
|
39
|
+
FlushStoredBoolean(self.handle, missionKey, key)
|
|
40
|
+
end
|
|
41
|
+
function GameCache.prototype.flushInteger(self, missionKey, key)
|
|
42
|
+
FlushStoredInteger(self.handle, missionKey, key)
|
|
43
|
+
end
|
|
44
|
+
function GameCache.prototype.flushMission(self, missionKey)
|
|
45
|
+
FlushStoredMission(self.handle, missionKey)
|
|
46
|
+
end
|
|
47
|
+
function GameCache.prototype.flushNumber(self, missionKey, key)
|
|
48
|
+
FlushStoredInteger(self.handle, missionKey, key)
|
|
49
|
+
end
|
|
50
|
+
function GameCache.prototype.flushString(self, missionKey, key)
|
|
51
|
+
FlushStoredString(self.handle, missionKey, key)
|
|
52
|
+
end
|
|
53
|
+
function GameCache.prototype.flushUnit(self, missionKey, key)
|
|
54
|
+
FlushStoredUnit(self.handle, missionKey, key)
|
|
55
|
+
end
|
|
56
|
+
function GameCache.prototype.getBoolean(self, missionKey, key)
|
|
57
|
+
return GetStoredBoolean(self.handle, missionKey, key)
|
|
58
|
+
end
|
|
59
|
+
function GameCache.prototype.getInteger(self, missionKey, key)
|
|
60
|
+
return GetStoredInteger(self.handle, missionKey, key)
|
|
61
|
+
end
|
|
62
|
+
function GameCache.prototype.getNumber(self, missionKey, key)
|
|
63
|
+
return GetStoredReal(self.handle, missionKey, key)
|
|
64
|
+
end
|
|
65
|
+
function GameCache.prototype.getString(self, missionKey, key)
|
|
66
|
+
return GetStoredString(self.handle, missionKey, key)
|
|
67
|
+
end
|
|
68
|
+
function GameCache.prototype.hasBoolean(self, missionKey, key)
|
|
69
|
+
return HaveStoredBoolean(self.handle, missionKey, key)
|
|
70
|
+
end
|
|
71
|
+
function GameCache.prototype.hasInteger(self, missionKey, key)
|
|
72
|
+
return HaveStoredInteger(self.handle, missionKey, key)
|
|
73
|
+
end
|
|
74
|
+
function GameCache.prototype.hasNumber(self, missionKey, key)
|
|
75
|
+
return HaveStoredReal(self.handle, missionKey, key)
|
|
76
|
+
end
|
|
77
|
+
function GameCache.prototype.hasString(self, missionKey, key)
|
|
78
|
+
return HaveStoredString(self.handle, missionKey, key)
|
|
79
|
+
end
|
|
80
|
+
function GameCache.prototype.restoreUnit(self, missionKey, key, forWhichPlayer, x, y, face)
|
|
81
|
+
return RestoreUnit(
|
|
82
|
+
self.handle,
|
|
83
|
+
missionKey,
|
|
84
|
+
key,
|
|
85
|
+
forWhichPlayer.handle,
|
|
86
|
+
x,
|
|
87
|
+
y,
|
|
88
|
+
face
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
function GameCache.prototype.save(self)
|
|
92
|
+
return SaveGameCache(self.handle)
|
|
93
|
+
end
|
|
94
|
+
function GameCache.prototype.store(self, missionKey, key, value)
|
|
95
|
+
if type(value) == "string" then
|
|
96
|
+
StoreString(self.handle, missionKey, key, value)
|
|
97
|
+
elseif type(value) == "boolean" then
|
|
98
|
+
StoreBoolean(self.handle, missionKey, key, value)
|
|
99
|
+
elseif type(value) == "number" then
|
|
100
|
+
StoreReal(self.handle, missionKey, key, value)
|
|
101
|
+
else
|
|
102
|
+
StoreUnit(self.handle, missionKey, key, value)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
function GameCache.prototype.syncBoolean(self, missionKey, key)
|
|
106
|
+
return SyncStoredBoolean(self.handle, missionKey, key)
|
|
107
|
+
end
|
|
108
|
+
function GameCache.prototype.syncInteger(self, missionKey, key)
|
|
109
|
+
return SyncStoredInteger(self.handle, missionKey, key)
|
|
110
|
+
end
|
|
111
|
+
function GameCache.prototype.syncNumber(self, missionKey, key)
|
|
112
|
+
return SyncStoredReal(self.handle, missionKey, key)
|
|
113
|
+
end
|
|
114
|
+
function GameCache.prototype.syncString(self, missionKey, key)
|
|
115
|
+
return SyncStoredString(self.handle, missionKey, key)
|
|
116
|
+
end
|
|
117
|
+
function GameCache.prototype.syncUnit(self, missionKey, key)
|
|
118
|
+
return SyncStoredUnit(self.handle, missionKey, key)
|
|
119
|
+
end
|
|
120
|
+
function GameCache.fromHandle(self, handle)
|
|
121
|
+
local ____handle_0
|
|
122
|
+
if handle then
|
|
123
|
+
____handle_0 = self:getObject(handle)
|
|
124
|
+
else
|
|
125
|
+
____handle_0 = nil
|
|
126
|
+
end
|
|
127
|
+
return ____handle_0
|
|
128
|
+
end
|
|
129
|
+
function GameCache.reloadFromDisk(self)
|
|
130
|
+
return ReloadGameCachesFromDisk()
|
|
131
|
+
end
|
|
132
|
+
return ____exports
|