wuira 0.1.4 → 0.1.6
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/CHANGELOG.md +102 -1
- package/README.md +347 -0
- package/lib/Spells.d.ts +21 -0
- package/lib/Spells.lua +41 -0
- package/lib/datasources/AuraTimer.d.ts +21 -0
- package/lib/datasources/AuraTimer.lua +322 -0
- package/lib/datasources/CastTimer.d.ts +9 -0
- package/lib/datasources/CastTimer.lua +240 -0
- package/lib/datasources/DataSource.d.ts +4 -0
- package/lib/datasources/DataSource.lua +24 -0
- package/lib/datasources/KnownSpells.d.ts +21 -0
- package/lib/datasources/KnownSpells.lua +794 -0
- package/lib/datasources/ManaRegenTimer.d.ts +29 -0
- package/lib/datasources/ManaRegenTimer.lua +674 -0
- package/lib/datasources/ProgressSource.d.ts +6 -2
- package/lib/datasources/ProgressSource.lua +34 -3
- package/lib/datasources/Resources.d.ts +33 -2
- package/lib/datasources/Resources.lua +562 -10
- package/lib/datasources/SpellCooldown.d.ts +12 -0
- package/lib/datasources/SpellCooldown.lua +218 -0
- package/lib/datasources/SpellSource.d.ts +14 -0
- package/lib/datasources/SpellSource.lua +224 -0
- package/lib/datasources/SwingTimer.d.ts +31 -0
- package/lib/datasources/SwingTimer.lua +641 -0
- package/lib/datasources/TextureSource.d.ts +10 -0
- package/lib/datasources/TextureSource.lua +83 -0
- package/lib/datasources/TimerSource.d.ts +20 -0
- package/lib/datasources/TimerSource.lua +338 -0
- package/lib/datasources/TotemTimer.d.ts +10 -0
- package/lib/datasources/TotemTimer.lua +260 -0
- package/lib/datasources/index.d.ts +16 -1
- package/lib/datasources/index.lua +43 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.lua +24 -0
- package/lib/platform/ActionBars.d.ts +27 -0
- package/lib/platform/ActionBars.lua +726 -0
- package/lib/platform/AddonSettings.d.ts +9 -0
- package/lib/platform/AddonSettings.lua +36 -0
- package/lib/platform/BlizzardUI.d.ts +17 -0
- package/lib/platform/BlizzardUI.lua +689 -0
- package/lib/platform/MicroMenu.d.ts +15 -0
- package/lib/platform/MicroMenu.lua +219 -0
- package/lib/platform/SecureButton.d.ts +5 -0
- package/lib/platform/SecureButton.lua +196 -0
- package/lib/platform/SlashCommands.d.ts +3 -0
- package/lib/platform/SlashCommands.lua +309 -0
- package/lib/platform/forever.d.ts +115 -2
- package/lib/skins/MicroBar.d.ts +8 -0
- package/lib/skins/MicroBar.lua +65 -0
- package/lib/skins/NativeSkin.d.ts +26 -0
- package/lib/skins/NativeSkin.lua +601 -0
- package/lib/skins/index.d.ts +3 -0
- package/lib/skins/index.lua +11 -0
- package/lib/store/index.lua +13 -0
- package/lib/ui/Button.d.ts +10 -0
- package/lib/ui/Button.lua +9 -0
- package/lib/ui/Cell.d.ts +7 -1
- package/lib/ui/FrameMover.d.ts +21 -0
- package/lib/ui/FrameMover.lua +123 -0
- package/lib/ui/HoverTracker.d.ts +20 -0
- package/lib/ui/HoverTracker.lua +88 -0
- package/lib/ui/Icon.d.ts +8 -0
- package/lib/ui/Icon.lua +8 -0
- package/lib/ui/KeybindCapture.d.ts +20 -0
- package/lib/ui/KeybindCapture.lua +488 -0
- package/lib/ui/Label.d.ts +10 -0
- package/lib/ui/Label.lua +8 -0
- package/lib/ui/ProgressBar.d.ts +5 -1
- package/lib/ui/SecureButton.d.ts +44 -0
- package/lib/ui/SecureButton.lua +9 -0
- package/lib/ui/index.d.ts +13 -0
- package/lib/ui/index.lua +28 -0
- package/lib/ui/layout/measureLayout.lua +11 -2
- package/lib/ui/mount.lua +679 -74
- package/lib/ui/primitives/jsx.d.ts +15 -2
- package/lib/wuira.d.ts +3 -0
- package/lib/wuira.lua +5 -0
- package/package.json +8 -1
- package/tools/build-library.mjs +1 -1
|
@@ -32,6 +32,304 @@ local function __TS__ClassExtends(target, base)
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
local __TS__Symbol, Symbol
|
|
36
|
+
do
|
|
37
|
+
local symbolMetatable = {__tostring = function(self)
|
|
38
|
+
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
39
|
+
end}
|
|
40
|
+
function __TS__Symbol(description)
|
|
41
|
+
return setmetatable({description = description}, symbolMetatable)
|
|
42
|
+
end
|
|
43
|
+
Symbol = {
|
|
44
|
+
asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
|
|
45
|
+
dispose = __TS__Symbol("Symbol.dispose"),
|
|
46
|
+
iterator = __TS__Symbol("Symbol.iterator"),
|
|
47
|
+
hasInstance = __TS__Symbol("Symbol.hasInstance"),
|
|
48
|
+
species = __TS__Symbol("Symbol.species"),
|
|
49
|
+
toStringTag = __TS__Symbol("Symbol.toStringTag")
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
local __TS__Iterator
|
|
54
|
+
do
|
|
55
|
+
local function iteratorGeneratorStep(self)
|
|
56
|
+
local co = self.____coroutine
|
|
57
|
+
local status, value = coroutine.resume(co)
|
|
58
|
+
if not status then
|
|
59
|
+
error(value, 0)
|
|
60
|
+
end
|
|
61
|
+
if coroutine.status(co) == "dead" then
|
|
62
|
+
return
|
|
63
|
+
end
|
|
64
|
+
return true, value
|
|
65
|
+
end
|
|
66
|
+
local function iteratorIteratorStep(self)
|
|
67
|
+
local result = self:next()
|
|
68
|
+
if result.done then
|
|
69
|
+
return
|
|
70
|
+
end
|
|
71
|
+
return true, result.value
|
|
72
|
+
end
|
|
73
|
+
local function iteratorStringStep(self, index)
|
|
74
|
+
index = index + 1
|
|
75
|
+
if index > #self then
|
|
76
|
+
return
|
|
77
|
+
end
|
|
78
|
+
return index, string.sub(self, index, index)
|
|
79
|
+
end
|
|
80
|
+
function __TS__Iterator(iterable)
|
|
81
|
+
if type(iterable) == "string" then
|
|
82
|
+
return iteratorStringStep, iterable, 0
|
|
83
|
+
elseif iterable.____coroutine ~= nil then
|
|
84
|
+
return iteratorGeneratorStep, iterable
|
|
85
|
+
elseif iterable[Symbol.iterator] then
|
|
86
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
87
|
+
return iteratorIteratorStep, iterator
|
|
88
|
+
else
|
|
89
|
+
return ipairs(iterable)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
local function __TS__New(target, ...)
|
|
95
|
+
local instance = setmetatable({}, target.prototype)
|
|
96
|
+
instance:____constructor(...)
|
|
97
|
+
return instance
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
local Set
|
|
101
|
+
do
|
|
102
|
+
Set = __TS__Class()
|
|
103
|
+
Set.name = "Set"
|
|
104
|
+
function Set.prototype.____constructor(self, values)
|
|
105
|
+
self[Symbol.toStringTag] = "Set"
|
|
106
|
+
self.size = 0
|
|
107
|
+
self.nextKey = {}
|
|
108
|
+
self.previousKey = {}
|
|
109
|
+
if values == nil then
|
|
110
|
+
return
|
|
111
|
+
end
|
|
112
|
+
local iterable = values
|
|
113
|
+
if iterable[Symbol.iterator] then
|
|
114
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
115
|
+
while true do
|
|
116
|
+
local result = iterator:next()
|
|
117
|
+
if result.done then
|
|
118
|
+
break
|
|
119
|
+
end
|
|
120
|
+
self:add(result.value)
|
|
121
|
+
end
|
|
122
|
+
else
|
|
123
|
+
local array = values
|
|
124
|
+
for ____, value in ipairs(array) do
|
|
125
|
+
self:add(value)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
function Set.prototype.add(self, value)
|
|
130
|
+
local isNewValue = not self:has(value)
|
|
131
|
+
if isNewValue then
|
|
132
|
+
self.size = self.size + 1
|
|
133
|
+
end
|
|
134
|
+
if self.firstKey == nil then
|
|
135
|
+
self.firstKey = value
|
|
136
|
+
self.lastKey = value
|
|
137
|
+
elseif isNewValue then
|
|
138
|
+
self.nextKey[self.lastKey] = value
|
|
139
|
+
self.previousKey[value] = self.lastKey
|
|
140
|
+
self.lastKey = value
|
|
141
|
+
end
|
|
142
|
+
return self
|
|
143
|
+
end
|
|
144
|
+
function Set.prototype.clear(self)
|
|
145
|
+
self.nextKey = {}
|
|
146
|
+
self.previousKey = {}
|
|
147
|
+
self.firstKey = nil
|
|
148
|
+
self.lastKey = nil
|
|
149
|
+
self.size = 0
|
|
150
|
+
end
|
|
151
|
+
function Set.prototype.delete(self, value)
|
|
152
|
+
local contains = self:has(value)
|
|
153
|
+
if contains then
|
|
154
|
+
self.size = self.size - 1
|
|
155
|
+
local next = self.nextKey[value]
|
|
156
|
+
local previous = self.previousKey[value]
|
|
157
|
+
if next ~= nil and previous ~= nil then
|
|
158
|
+
self.nextKey[previous] = next
|
|
159
|
+
self.previousKey[next] = previous
|
|
160
|
+
elseif next ~= nil then
|
|
161
|
+
self.firstKey = next
|
|
162
|
+
self.previousKey[next] = nil
|
|
163
|
+
elseif previous ~= nil then
|
|
164
|
+
self.lastKey = previous
|
|
165
|
+
self.nextKey[previous] = nil
|
|
166
|
+
else
|
|
167
|
+
self.firstKey = nil
|
|
168
|
+
self.lastKey = nil
|
|
169
|
+
end
|
|
170
|
+
self.nextKey[value] = nil
|
|
171
|
+
self.previousKey[value] = nil
|
|
172
|
+
end
|
|
173
|
+
return contains
|
|
174
|
+
end
|
|
175
|
+
function Set.prototype.forEach(self, callback)
|
|
176
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
177
|
+
callback(nil, key, key, self)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
function Set.prototype.has(self, value)
|
|
181
|
+
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
182
|
+
end
|
|
183
|
+
Set.prototype[Symbol.iterator] = function(self)
|
|
184
|
+
return self:values()
|
|
185
|
+
end
|
|
186
|
+
function Set.prototype.entries(self)
|
|
187
|
+
local function getFirstKey()
|
|
188
|
+
return self.firstKey
|
|
189
|
+
end
|
|
190
|
+
local nextKey = self.nextKey
|
|
191
|
+
local key
|
|
192
|
+
local started = false
|
|
193
|
+
return {
|
|
194
|
+
[Symbol.iterator] = function(self)
|
|
195
|
+
return self
|
|
196
|
+
end,
|
|
197
|
+
next = function(self)
|
|
198
|
+
if not started then
|
|
199
|
+
started = true
|
|
200
|
+
key = getFirstKey(nil)
|
|
201
|
+
else
|
|
202
|
+
key = nextKey[key]
|
|
203
|
+
end
|
|
204
|
+
return {done = not key, value = {key, key}}
|
|
205
|
+
end
|
|
206
|
+
}
|
|
207
|
+
end
|
|
208
|
+
function Set.prototype.keys(self)
|
|
209
|
+
local function getFirstKey()
|
|
210
|
+
return self.firstKey
|
|
211
|
+
end
|
|
212
|
+
local nextKey = self.nextKey
|
|
213
|
+
local key
|
|
214
|
+
local started = false
|
|
215
|
+
return {
|
|
216
|
+
[Symbol.iterator] = function(self)
|
|
217
|
+
return self
|
|
218
|
+
end,
|
|
219
|
+
next = function(self)
|
|
220
|
+
if not started then
|
|
221
|
+
started = true
|
|
222
|
+
key = getFirstKey(nil)
|
|
223
|
+
else
|
|
224
|
+
key = nextKey[key]
|
|
225
|
+
end
|
|
226
|
+
return {done = not key, value = key}
|
|
227
|
+
end
|
|
228
|
+
}
|
|
229
|
+
end
|
|
230
|
+
function Set.prototype.values(self)
|
|
231
|
+
local function getFirstKey()
|
|
232
|
+
return self.firstKey
|
|
233
|
+
end
|
|
234
|
+
local nextKey = self.nextKey
|
|
235
|
+
local key
|
|
236
|
+
local started = false
|
|
237
|
+
return {
|
|
238
|
+
[Symbol.iterator] = function(self)
|
|
239
|
+
return self
|
|
240
|
+
end,
|
|
241
|
+
next = function(self)
|
|
242
|
+
if not started then
|
|
243
|
+
started = true
|
|
244
|
+
key = getFirstKey(nil)
|
|
245
|
+
else
|
|
246
|
+
key = nextKey[key]
|
|
247
|
+
end
|
|
248
|
+
return {done = not key, value = key}
|
|
249
|
+
end
|
|
250
|
+
}
|
|
251
|
+
end
|
|
252
|
+
function Set.prototype.union(self, other)
|
|
253
|
+
local result = __TS__New(Set, self)
|
|
254
|
+
for ____, item in __TS__Iterator(other) do
|
|
255
|
+
result:add(item)
|
|
256
|
+
end
|
|
257
|
+
return result
|
|
258
|
+
end
|
|
259
|
+
function Set.prototype.intersection(self, other)
|
|
260
|
+
local result = __TS__New(Set)
|
|
261
|
+
for ____, item in __TS__Iterator(self) do
|
|
262
|
+
if other:has(item) then
|
|
263
|
+
result:add(item)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
return result
|
|
267
|
+
end
|
|
268
|
+
function Set.prototype.difference(self, other)
|
|
269
|
+
local result = __TS__New(Set, self)
|
|
270
|
+
for ____, item in __TS__Iterator(other) do
|
|
271
|
+
result:delete(item)
|
|
272
|
+
end
|
|
273
|
+
return result
|
|
274
|
+
end
|
|
275
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
276
|
+
local result = __TS__New(Set, self)
|
|
277
|
+
for ____, item in __TS__Iterator(other) do
|
|
278
|
+
if self:has(item) then
|
|
279
|
+
result:delete(item)
|
|
280
|
+
else
|
|
281
|
+
result:add(item)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
return result
|
|
285
|
+
end
|
|
286
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
287
|
+
for ____, item in __TS__Iterator(self) do
|
|
288
|
+
if not other:has(item) then
|
|
289
|
+
return false
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
return true
|
|
293
|
+
end
|
|
294
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
295
|
+
for ____, item in __TS__Iterator(other) do
|
|
296
|
+
if not self:has(item) then
|
|
297
|
+
return false
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
return true
|
|
301
|
+
end
|
|
302
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
303
|
+
for ____, item in __TS__Iterator(self) do
|
|
304
|
+
if other:has(item) then
|
|
305
|
+
return false
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
return true
|
|
309
|
+
end
|
|
310
|
+
Set[Symbol.species] = Set
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
local function __TS__ArrayIncludes(self, searchElement, fromIndex)
|
|
314
|
+
if fromIndex == nil then
|
|
315
|
+
fromIndex = 0
|
|
316
|
+
end
|
|
317
|
+
local len = #self
|
|
318
|
+
local k = fromIndex
|
|
319
|
+
if fromIndex < 0 then
|
|
320
|
+
k = len + fromIndex
|
|
321
|
+
end
|
|
322
|
+
if k < 0 then
|
|
323
|
+
k = 0
|
|
324
|
+
end
|
|
325
|
+
for i = k + 1, len do
|
|
326
|
+
if self[i] == searchElement then
|
|
327
|
+
return true
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
return false
|
|
331
|
+
end
|
|
332
|
+
|
|
35
333
|
local function __TS__CloneDescriptor(____bindingPattern0)
|
|
36
334
|
local value
|
|
37
335
|
local writable
|
|
@@ -169,12 +467,30 @@ do
|
|
|
169
467
|
metatable.__newindex = descriptorNewIndex
|
|
170
468
|
end
|
|
171
469
|
end
|
|
470
|
+
|
|
471
|
+
local function __TS__ObjectAssign(target, ...)
|
|
472
|
+
local sources = {...}
|
|
473
|
+
for i = 1, #sources do
|
|
474
|
+
local source = sources[i]
|
|
475
|
+
if type(source) == "table" then
|
|
476
|
+
for key in pairs(source) do
|
|
477
|
+
target[key] = source[key]
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
return target
|
|
482
|
+
end
|
|
172
483
|
-- End of Lua Library inline imports
|
|
173
484
|
local ____exports = {}
|
|
174
485
|
local ____ProgressSource = require("datasources.ProgressSource")
|
|
175
486
|
local ProgressSource = ____ProgressSource.ProgressSource
|
|
176
487
|
local ____UnitSource = require("datasources.UnitSource")
|
|
488
|
+
local Unit = ____UnitSource.Unit
|
|
177
489
|
local resolveUnit = ____UnitSource.resolveUnit
|
|
490
|
+
local ____DataSource = require("datasources.DataSource")
|
|
491
|
+
local DataSource = ____DataSource.DataSource
|
|
492
|
+
local ____ManaRegenTimer = require("datasources.ManaRegenTimer")
|
|
493
|
+
local ManaRegenTimer = ____ManaRegenTimer.ManaRegenTimer
|
|
178
494
|
do
|
|
179
495
|
local ____UnitSource = require("datasources.UnitSource")
|
|
180
496
|
____exports.Unit = ____UnitSource.Unit
|
|
@@ -195,26 +511,154 @@ function Resource.prototype.____constructor(self, current, maximum, percent, uni
|
|
|
195
511
|
)
|
|
196
512
|
self.unitToken = unitToken
|
|
197
513
|
self.events = events
|
|
514
|
+
self.listeners = __TS__New(Set)
|
|
515
|
+
self.dispatching = false
|
|
516
|
+
self.eventValue = 0
|
|
198
517
|
end
|
|
199
|
-
function Resource.prototype.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
518
|
+
function Resource.prototype.AddEvents(self, ...)
|
|
519
|
+
local events = {...}
|
|
520
|
+
for ____, event in ipairs(events) do
|
|
521
|
+
do
|
|
522
|
+
local __continue5
|
|
523
|
+
repeat
|
|
524
|
+
if __TS__ArrayIncludes(self.events, event) then
|
|
525
|
+
__continue5 = true
|
|
526
|
+
break
|
|
527
|
+
end
|
|
528
|
+
local ____self_events_0 = self.events
|
|
529
|
+
____self_events_0[#____self_events_0 + 1] = event
|
|
530
|
+
if self.listeners.size > 0 then
|
|
531
|
+
local ____opt_1 = self.eventFrame
|
|
532
|
+
if ____opt_1 ~= nil then
|
|
533
|
+
____opt_1:RegisterEvent(event)
|
|
534
|
+
end
|
|
535
|
+
end
|
|
536
|
+
__continue5 = true
|
|
537
|
+
until true
|
|
538
|
+
if not __continue5 then
|
|
539
|
+
break
|
|
540
|
+
end
|
|
541
|
+
end
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
function Resource.prototype.GetValue(self)
|
|
545
|
+
return self.dispatching and self.eventValue or ProgressSource.prototype.GetValue(self)
|
|
546
|
+
end
|
|
547
|
+
function Resource.prototype.onChange(self, listener)
|
|
548
|
+
local previous = self:GetValue()
|
|
549
|
+
local readable = not issecretvalue(previous)
|
|
550
|
+
return self:Observe(function(____, _, _payload, value)
|
|
551
|
+
if issecretvalue(value) or not self:CanEmit(value) then
|
|
552
|
+
return
|
|
553
|
+
end
|
|
554
|
+
if readable and value == previous then
|
|
555
|
+
return
|
|
556
|
+
end
|
|
557
|
+
previous = value
|
|
558
|
+
readable = true
|
|
559
|
+
listener(nil, value)
|
|
560
|
+
end)
|
|
561
|
+
end
|
|
562
|
+
function Resource.prototype.Observe(self, listener)
|
|
563
|
+
self.listeners:add(listener)
|
|
564
|
+
if self.listeners.size == 1 then
|
|
565
|
+
if self.eventFrame == nil then
|
|
566
|
+
self.eventFrame = CreateFrame("Frame", nil, UIParent)
|
|
567
|
+
end
|
|
568
|
+
local frame = self.eventFrame
|
|
569
|
+
frame:SetScript(
|
|
570
|
+
"OnEvent",
|
|
571
|
+
function(_frame, event, ...)
|
|
572
|
+
local payload = {...}
|
|
573
|
+
if event ~= "PLAYER_ENTERING_WORLD" and (issecretvalue(payload[1]) or payload[1] ~= self.unitToken) then
|
|
574
|
+
return
|
|
575
|
+
end
|
|
576
|
+
self.eventValue = ProgressSource.prototype.GetValue(self)
|
|
577
|
+
self.dispatching = true
|
|
578
|
+
do
|
|
579
|
+
local ____try, ____error = pcall(function()
|
|
580
|
+
for ____, callback in __TS__Iterator(self.listeners) do
|
|
581
|
+
callback(nil, event, payload, self.eventValue)
|
|
582
|
+
end
|
|
583
|
+
end)
|
|
584
|
+
do
|
|
585
|
+
self.dispatching = false
|
|
586
|
+
end
|
|
587
|
+
if not ____try then
|
|
588
|
+
error(____error, 0)
|
|
589
|
+
end
|
|
590
|
+
end
|
|
591
|
+
end
|
|
592
|
+
)
|
|
593
|
+
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
594
|
+
for ____, event in ipairs(self.events) do
|
|
595
|
+
frame:RegisterEvent(event)
|
|
596
|
+
end
|
|
597
|
+
end
|
|
598
|
+
return function()
|
|
599
|
+
self.listeners:delete(listener)
|
|
600
|
+
if self.listeners.size == 0 then
|
|
601
|
+
local ____opt_3 = self.eventFrame
|
|
602
|
+
if ____opt_3 ~= nil then
|
|
603
|
+
____opt_3:UnregisterAllEvents()
|
|
604
|
+
end
|
|
605
|
+
local ____opt_5 = self.eventFrame
|
|
606
|
+
if ____opt_5 ~= nil then
|
|
607
|
+
____opt_5:SetScript("OnEvent", nil)
|
|
205
608
|
end
|
|
206
609
|
end
|
|
207
|
-
)
|
|
208
|
-
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
209
|
-
for ____, event in ipairs(self.events) do
|
|
210
|
-
frame:RegisterEvent(event)
|
|
211
610
|
end
|
|
212
611
|
end
|
|
612
|
+
function Resource.prototype.Listen(self, _frame, refresh)
|
|
613
|
+
return self:Observe(function() return refresh(nil) end)
|
|
614
|
+
end
|
|
615
|
+
--- Live optional prediction channel. Secret amounts only travel to native sinks.
|
|
616
|
+
____exports.HealthPrediction = __TS__Class()
|
|
617
|
+
local HealthPrediction = ____exports.HealthPrediction
|
|
618
|
+
HealthPrediction.name = "HealthPrediction"
|
|
619
|
+
__TS__ClassExtends(HealthPrediction, DataSource)
|
|
620
|
+
function HealthPrediction.prototype.____constructor(self, read)
|
|
621
|
+
DataSource.prototype.____constructor(self, 0)
|
|
622
|
+
self.read = read
|
|
623
|
+
end
|
|
624
|
+
function HealthPrediction.prototype.GetValue(self)
|
|
625
|
+
local ____opt_7 = self.read
|
|
626
|
+
local value = ____opt_7 and ____opt_7(self)
|
|
627
|
+
if issecretvalue(value) then
|
|
628
|
+
return value
|
|
629
|
+
end
|
|
630
|
+
return value or 0
|
|
631
|
+
end
|
|
632
|
+
function HealthPrediction.prototype.ApplyTo(self, frame, maximum)
|
|
633
|
+
if not self.IsAvailable then
|
|
634
|
+
frame:Hide()
|
|
635
|
+
return
|
|
636
|
+
end
|
|
637
|
+
local value = self:GetValue()
|
|
638
|
+
if not self:CanEmit(value) then
|
|
639
|
+
frame:Hide()
|
|
640
|
+
return
|
|
641
|
+
end
|
|
642
|
+
frame:SetMinMaxValues(0, maximum)
|
|
643
|
+
frame:SetValue(value)
|
|
644
|
+
frame:Show()
|
|
645
|
+
end
|
|
646
|
+
__TS__SetDescriptor(
|
|
647
|
+
HealthPrediction.prototype,
|
|
648
|
+
"IsAvailable",
|
|
649
|
+
{get = function(self)
|
|
650
|
+
return self.read ~= nil
|
|
651
|
+
end},
|
|
652
|
+
true
|
|
653
|
+
)
|
|
213
654
|
____exports.HP = __TS__Class()
|
|
214
655
|
local HP = ____exports.HP
|
|
215
656
|
HP.name = "HP"
|
|
216
657
|
__TS__ClassExtends(HP, Resource)
|
|
217
658
|
function HP.prototype.____constructor(self, unit)
|
|
659
|
+
if unit == nil then
|
|
660
|
+
unit = Unit.Player
|
|
661
|
+
end
|
|
218
662
|
local target = resolveUnit(nil, unit)
|
|
219
663
|
Resource.prototype.____constructor(
|
|
220
664
|
self,
|
|
@@ -226,6 +670,93 @@ function HP.prototype.____constructor(self, unit)
|
|
|
226
670
|
)
|
|
227
671
|
self.target = target
|
|
228
672
|
end
|
|
673
|
+
function HP.prototype.UseHealPrediction(self)
|
|
674
|
+
if self.healPrediction == nil then
|
|
675
|
+
local ____exports_HealthPrediction_10 = ____exports.HealthPrediction
|
|
676
|
+
local ____temp_9
|
|
677
|
+
if UnitGetIncomingHeals == nil then
|
|
678
|
+
____temp_9 = nil
|
|
679
|
+
else
|
|
680
|
+
____temp_9 = function() return UnitGetIncomingHeals(self.unit) end
|
|
681
|
+
end
|
|
682
|
+
self.healPrediction = __TS__New(____exports_HealthPrediction_10, ____temp_9)
|
|
683
|
+
if self.healPrediction.IsAvailable then
|
|
684
|
+
self:AddEvents("UNIT_HEAL_PREDICTION")
|
|
685
|
+
end
|
|
686
|
+
end
|
|
687
|
+
return self
|
|
688
|
+
end
|
|
689
|
+
function HP.prototype.UseAbsorbPrediction(self)
|
|
690
|
+
if self.absorbPrediction == nil then
|
|
691
|
+
local ____exports_HealthPrediction_12 = ____exports.HealthPrediction
|
|
692
|
+
local ____temp_11
|
|
693
|
+
if UnitGetTotalAbsorbs == nil then
|
|
694
|
+
____temp_11 = nil
|
|
695
|
+
else
|
|
696
|
+
____temp_11 = function() return UnitGetTotalAbsorbs(self.unit) end
|
|
697
|
+
end
|
|
698
|
+
self.absorbPrediction = __TS__New(____exports_HealthPrediction_12, ____temp_11)
|
|
699
|
+
if self.absorbPrediction.IsAvailable then
|
|
700
|
+
self:AddEvents("UNIT_ABSORB_AMOUNT_CHANGED")
|
|
701
|
+
end
|
|
702
|
+
end
|
|
703
|
+
return self
|
|
704
|
+
end
|
|
705
|
+
function HP.prototype.BindTo(self, frame, options)
|
|
706
|
+
if options == nil then
|
|
707
|
+
options = {}
|
|
708
|
+
end
|
|
709
|
+
if (options.healPredictionBar ~= nil or options.absorbPredictionBar ~= nil) and (options.min ~= nil or options.max ~= nil or options.current ~= nil) then
|
|
710
|
+
error("HP: prediction overlays require the native health scale without min/max/current overrides")
|
|
711
|
+
end
|
|
712
|
+
return Resource.prototype.BindTo(
|
|
713
|
+
self,
|
|
714
|
+
frame,
|
|
715
|
+
__TS__ObjectAssign(
|
|
716
|
+
{},
|
|
717
|
+
options,
|
|
718
|
+
{onRefresh = function()
|
|
719
|
+
if options.healPredictionBar ~= nil or options.absorbPredictionBar ~= nil then
|
|
720
|
+
local maximum = UnitHealthMax(self.unit)
|
|
721
|
+
if options.healPredictionBar ~= nil then
|
|
722
|
+
local ____opt_13 = self.healPrediction
|
|
723
|
+
if ____opt_13 ~= nil then
|
|
724
|
+
____opt_13:ApplyTo(options.healPredictionBar, maximum)
|
|
725
|
+
end
|
|
726
|
+
end
|
|
727
|
+
if options.absorbPredictionBar ~= nil then
|
|
728
|
+
local ____opt_15 = self.absorbPrediction
|
|
729
|
+
if ____opt_15 ~= nil then
|
|
730
|
+
____opt_15:ApplyTo(options.absorbPredictionBar, maximum)
|
|
731
|
+
end
|
|
732
|
+
end
|
|
733
|
+
end
|
|
734
|
+
local ____this_18
|
|
735
|
+
____this_18 = options
|
|
736
|
+
local ____opt_17 = ____this_18.onRefresh
|
|
737
|
+
if ____opt_17 ~= nil then
|
|
738
|
+
____opt_17(____this_18)
|
|
739
|
+
end
|
|
740
|
+
end}
|
|
741
|
+
)
|
|
742
|
+
)
|
|
743
|
+
end
|
|
744
|
+
__TS__SetDescriptor(
|
|
745
|
+
HP.prototype,
|
|
746
|
+
"HealPrediction",
|
|
747
|
+
{get = function(self)
|
|
748
|
+
return self.healPrediction
|
|
749
|
+
end},
|
|
750
|
+
true
|
|
751
|
+
)
|
|
752
|
+
__TS__SetDescriptor(
|
|
753
|
+
HP.prototype,
|
|
754
|
+
"AbsorbPrediction",
|
|
755
|
+
{get = function(self)
|
|
756
|
+
return self.absorbPrediction
|
|
757
|
+
end},
|
|
758
|
+
true
|
|
759
|
+
)
|
|
229
760
|
__TS__SetDescriptor(
|
|
230
761
|
HP.prototype,
|
|
231
762
|
"unit",
|
|
@@ -251,6 +782,27 @@ function Mana.prototype.____constructor(self, unit)
|
|
|
251
782
|
)
|
|
252
783
|
self.target = target
|
|
253
784
|
end
|
|
785
|
+
function Mana.prototype.UseRegenTimer(self)
|
|
786
|
+
if self.unit ~= "player" then
|
|
787
|
+
error("Mana.UseRegenTimer: only the player is supported")
|
|
788
|
+
end
|
|
789
|
+
if self.regenTimer == nil then
|
|
790
|
+
self:AddEvents("UNIT_SPELLCAST_SUCCEEDED")
|
|
791
|
+
self.regenTimer = __TS__New(
|
|
792
|
+
ManaRegenTimer,
|
|
793
|
+
function(____, listener) return self:Observe(listener) end
|
|
794
|
+
)
|
|
795
|
+
end
|
|
796
|
+
return self
|
|
797
|
+
end
|
|
798
|
+
__TS__SetDescriptor(
|
|
799
|
+
Mana.prototype,
|
|
800
|
+
"RegenTimer",
|
|
801
|
+
{get = function(self)
|
|
802
|
+
return self.regenTimer
|
|
803
|
+
end},
|
|
804
|
+
true
|
|
805
|
+
)
|
|
254
806
|
__TS__SetDescriptor(
|
|
255
807
|
Mana.prototype,
|
|
256
808
|
"unit",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TimerSource } from "./TimerSource";
|
|
2
|
+
/** Native cooldown duration, including opaque timings during combat. */
|
|
3
|
+
export declare class SpellCooldown extends TimerSource {
|
|
4
|
+
readonly spellId: number | string;
|
|
5
|
+
constructor(spellId: number | string, options?: {
|
|
6
|
+
ignoreGCD?: boolean;
|
|
7
|
+
});
|
|
8
|
+
get IsAvailable(): boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class GlobalCooldown extends SpellCooldown {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|