wuira 0.3.3 → 0.4.0
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 +11 -0
- package/README.md +15 -12
- package/docs/source-converters.md +5 -5
- package/docs/spells.md +1 -1
- package/lib/datasources/NativeApi.d.ts +319 -0
- package/lib/datasources/NativeApi.lua +1114 -0
- package/lib/datasources/UseSource.d.ts +41 -43
- package/lib/datasources/index.d.ts +3 -25
- package/lib/datasources/index.lua +45 -74
- package/lib/helpers/Auras.d.ts +5 -0
- package/lib/helpers/Auras.lua +47 -0
- package/lib/helpers/Range.d.ts +2 -0
- package/lib/helpers/Range.lua +30 -0
- package/lib/helpers/index.d.ts +2 -0
- package/lib/helpers/index.lua +12 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.lua +6 -0
- package/lib/platform/forever.d.ts +3 -0
- package/lib/rendering/progress.lua +5 -150
- package/lib/ui/UnitPortrait.d.ts +1 -2
- package/lib/ui/UnitPortrait.lua +11 -18
- package/package.json +8 -1
- package/lib/datasources/AuraTimer.d.ts +0 -21
- package/lib/datasources/AuraTimer.lua +0 -334
- package/lib/datasources/Auras.d.ts +0 -32
- package/lib/datasources/Auras.lua +0 -300
- package/lib/datasources/CastTimer.d.ts +0 -9
- package/lib/datasources/CastTimer.lua +0 -255
- package/lib/datasources/EditModeLayouts.d.ts +0 -33
- package/lib/datasources/EditModeLayouts.lua +0 -698
- package/lib/datasources/GroupMembers.d.ts +0 -24
- package/lib/datasources/GroupMembers.lua +0 -477
- package/lib/datasources/GroupRoster.d.ts +0 -28
- package/lib/datasources/GroupRoster.lua +0 -622
- package/lib/datasources/KnownSpells.d.ts +0 -33
- package/lib/datasources/KnownSpells.lua +0 -1077
- package/lib/datasources/ManaRegenTimer.d.ts +0 -29
- package/lib/datasources/ManaRegenTimer.lua +0 -683
- package/lib/datasources/Resources.d.ts +0 -81
- package/lib/datasources/Resources.lua +0 -907
- package/lib/datasources/SpellCooldown.d.ts +0 -12
- package/lib/datasources/SpellCooldown.lua +0 -240
- package/lib/datasources/SpellSource.d.ts +0 -14
- package/lib/datasources/SpellSource.lua +0 -236
- package/lib/datasources/SwingTimer.d.ts +0 -31
- package/lib/datasources/SwingTimer.lua +0 -650
- package/lib/datasources/TotemTimer.d.ts +0 -10
- package/lib/datasources/TotemTimer.lua +0 -275
- package/lib/datasources/UnitInfo.d.ts +0 -51
- package/lib/datasources/UnitInfo.lua +0 -801
- package/lib/datasources/UnitSource.d.ts +0 -38
- package/lib/datasources/UnitSource.lua +0 -613
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { DataSource } from "./DataSource";
|
|
2
|
-
export declare const Unit: {
|
|
3
|
-
readonly Player: "player";
|
|
4
|
-
readonly Target: "target";
|
|
5
|
-
readonly Focus: "focus";
|
|
6
|
-
};
|
|
7
|
-
export interface UnitIdentity {
|
|
8
|
-
readonly token: string;
|
|
9
|
-
readonly guid: string;
|
|
10
|
-
}
|
|
11
|
-
export declare class UnitPredicates {
|
|
12
|
-
private readonly token;
|
|
13
|
-
constructor(token: () => string);
|
|
14
|
-
get PC(): boolean | undefined;
|
|
15
|
-
get Self(): boolean | undefined;
|
|
16
|
-
}
|
|
17
|
-
/** Shared live unit reference; identity is read again rather than cached by token. */
|
|
18
|
-
export declare class UnitSource extends DataSource<UnitIdentity | undefined> {
|
|
19
|
-
private token;
|
|
20
|
-
readonly Is: UnitPredicates;
|
|
21
|
-
private restricted;
|
|
22
|
-
private readonly listeners;
|
|
23
|
-
private readonly tokenListeners;
|
|
24
|
-
private events?;
|
|
25
|
-
protected constructor(token: string);
|
|
26
|
-
get Token(): string;
|
|
27
|
-
/** Keep source objects/subscriptions while a stable identity moves to another unit slot. */
|
|
28
|
-
Retarget(token: string): void;
|
|
29
|
-
/** Secure consumers only need notification when the actual unit address changes. */
|
|
30
|
-
onTokenChange(listener: () => void): () => void;
|
|
31
|
-
onChange(listener: () => void): () => void;
|
|
32
|
-
private UpdateEvents;
|
|
33
|
-
protected HasSecretFields(): boolean;
|
|
34
|
-
protected GetValue(): UnitIdentity | undefined;
|
|
35
|
-
}
|
|
36
|
-
export type UnitInput = string | UnitSource;
|
|
37
|
-
/** Reuse explicit unit references; string inputs remain a convenience shorthand. */
|
|
38
|
-
export declare function resolveUnit(unit: UnitInput): UnitSource;
|
|
@@ -1,613 +0,0 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
-- Lua Library inline imports
|
|
3
|
-
local function __TS__Class(self)
|
|
4
|
-
local c = {prototype = {}}
|
|
5
|
-
c.prototype.__index = c.prototype
|
|
6
|
-
c.prototype.constructor = c
|
|
7
|
-
return c
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
local function __TS__CloneDescriptor(____bindingPattern0)
|
|
11
|
-
local value
|
|
12
|
-
local writable
|
|
13
|
-
local set
|
|
14
|
-
local get
|
|
15
|
-
local configurable
|
|
16
|
-
local enumerable
|
|
17
|
-
enumerable = ____bindingPattern0.enumerable
|
|
18
|
-
configurable = ____bindingPattern0.configurable
|
|
19
|
-
get = ____bindingPattern0.get
|
|
20
|
-
set = ____bindingPattern0.set
|
|
21
|
-
writable = ____bindingPattern0.writable
|
|
22
|
-
value = ____bindingPattern0.value
|
|
23
|
-
local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
|
|
24
|
-
local hasGetterOrSetter = get ~= nil or set ~= nil
|
|
25
|
-
local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
|
|
26
|
-
if hasGetterOrSetter and hasValueOrWritableAttribute then
|
|
27
|
-
error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
|
|
28
|
-
end
|
|
29
|
-
if get or set then
|
|
30
|
-
descriptor.get = get
|
|
31
|
-
descriptor.set = set
|
|
32
|
-
else
|
|
33
|
-
descriptor.value = value
|
|
34
|
-
descriptor.writable = writable == true
|
|
35
|
-
end
|
|
36
|
-
return descriptor
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
local __TS__DescriptorGet
|
|
40
|
-
do
|
|
41
|
-
local getmetatable = _G.getmetatable
|
|
42
|
-
local ____rawget = _G.rawget
|
|
43
|
-
function __TS__DescriptorGet(self, metatable, key)
|
|
44
|
-
while metatable do
|
|
45
|
-
local rawResult = ____rawget(metatable, key)
|
|
46
|
-
if rawResult ~= nil then
|
|
47
|
-
return rawResult
|
|
48
|
-
end
|
|
49
|
-
local descriptors = ____rawget(metatable, "_descriptors")
|
|
50
|
-
if descriptors then
|
|
51
|
-
local descriptor = descriptors[key]
|
|
52
|
-
if descriptor ~= nil then
|
|
53
|
-
if descriptor.get then
|
|
54
|
-
return descriptor.get(self)
|
|
55
|
-
end
|
|
56
|
-
return descriptor.value
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
metatable = getmetatable(metatable)
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
local __TS__DescriptorSet
|
|
65
|
-
do
|
|
66
|
-
local getmetatable = _G.getmetatable
|
|
67
|
-
local ____rawget = _G.rawget
|
|
68
|
-
local rawset = _G.rawset
|
|
69
|
-
function __TS__DescriptorSet(self, metatable, key, value)
|
|
70
|
-
while metatable do
|
|
71
|
-
local descriptors = ____rawget(metatable, "_descriptors")
|
|
72
|
-
if descriptors then
|
|
73
|
-
local descriptor = descriptors[key]
|
|
74
|
-
if descriptor ~= nil then
|
|
75
|
-
if descriptor.set then
|
|
76
|
-
descriptor.set(self, value)
|
|
77
|
-
else
|
|
78
|
-
if descriptor.writable == false then
|
|
79
|
-
error(
|
|
80
|
-
((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
|
|
81
|
-
0
|
|
82
|
-
)
|
|
83
|
-
end
|
|
84
|
-
descriptor.value = value
|
|
85
|
-
end
|
|
86
|
-
return
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
metatable = getmetatable(metatable)
|
|
90
|
-
end
|
|
91
|
-
rawset(self, key, value)
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
local __TS__SetDescriptor
|
|
96
|
-
do
|
|
97
|
-
local getmetatable = _G.getmetatable
|
|
98
|
-
local function descriptorIndex(self, key)
|
|
99
|
-
return __TS__DescriptorGet(
|
|
100
|
-
self,
|
|
101
|
-
getmetatable(self),
|
|
102
|
-
key
|
|
103
|
-
)
|
|
104
|
-
end
|
|
105
|
-
local function descriptorNewIndex(self, key, value)
|
|
106
|
-
return __TS__DescriptorSet(
|
|
107
|
-
self,
|
|
108
|
-
getmetatable(self),
|
|
109
|
-
key,
|
|
110
|
-
value
|
|
111
|
-
)
|
|
112
|
-
end
|
|
113
|
-
function __TS__SetDescriptor(target, key, desc, isPrototype)
|
|
114
|
-
if isPrototype == nil then
|
|
115
|
-
isPrototype = false
|
|
116
|
-
end
|
|
117
|
-
local ____isPrototype_0
|
|
118
|
-
if isPrototype then
|
|
119
|
-
____isPrototype_0 = target
|
|
120
|
-
else
|
|
121
|
-
____isPrototype_0 = getmetatable(target)
|
|
122
|
-
end
|
|
123
|
-
local metatable = ____isPrototype_0
|
|
124
|
-
if not metatable then
|
|
125
|
-
metatable = {}
|
|
126
|
-
setmetatable(target, metatable)
|
|
127
|
-
end
|
|
128
|
-
if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
|
|
129
|
-
local instanceMetatable = {}
|
|
130
|
-
instanceMetatable._isOwnDescriptorMetatable = true
|
|
131
|
-
setmetatable(instanceMetatable, metatable)
|
|
132
|
-
setmetatable(target, instanceMetatable)
|
|
133
|
-
metatable = instanceMetatable
|
|
134
|
-
end
|
|
135
|
-
local value = rawget(target, key)
|
|
136
|
-
if value ~= nil then
|
|
137
|
-
rawset(target, key, nil)
|
|
138
|
-
end
|
|
139
|
-
if not rawget(metatable, "_descriptors") then
|
|
140
|
-
metatable._descriptors = {}
|
|
141
|
-
end
|
|
142
|
-
metatable._descriptors[key] = __TS__CloneDescriptor(desc)
|
|
143
|
-
metatable.__index = descriptorIndex
|
|
144
|
-
metatable.__newindex = descriptorNewIndex
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
local function __TS__ClassExtends(target, base)
|
|
149
|
-
target.____super = base
|
|
150
|
-
local staticMetatable = setmetatable({__index = base}, base)
|
|
151
|
-
setmetatable(target, staticMetatable)
|
|
152
|
-
local baseMetatable = getmetatable(base)
|
|
153
|
-
if baseMetatable then
|
|
154
|
-
if type(baseMetatable.__index) == "function" then
|
|
155
|
-
staticMetatable.__index = baseMetatable.__index
|
|
156
|
-
end
|
|
157
|
-
if type(baseMetatable.__newindex) == "function" then
|
|
158
|
-
staticMetatable.__newindex = baseMetatable.__newindex
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
setmetatable(target.prototype, base.prototype)
|
|
162
|
-
if type(base.prototype.__index) == "function" then
|
|
163
|
-
target.prototype.__index = base.prototype.__index
|
|
164
|
-
end
|
|
165
|
-
if type(base.prototype.__newindex) == "function" then
|
|
166
|
-
target.prototype.__newindex = base.prototype.__newindex
|
|
167
|
-
end
|
|
168
|
-
if type(base.prototype.__tostring) == "function" then
|
|
169
|
-
target.prototype.__tostring = base.prototype.__tostring
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
local function __TS__New(target, ...)
|
|
174
|
-
local instance = setmetatable({}, target.prototype)
|
|
175
|
-
instance:____constructor(...)
|
|
176
|
-
return instance
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
local __TS__Symbol, Symbol
|
|
180
|
-
do
|
|
181
|
-
local symbolMetatable = {__tostring = function(self)
|
|
182
|
-
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
183
|
-
end}
|
|
184
|
-
function __TS__Symbol(description)
|
|
185
|
-
return setmetatable({description = description}, symbolMetatable)
|
|
186
|
-
end
|
|
187
|
-
Symbol = {
|
|
188
|
-
asyncDispose = __TS__Symbol("Symbol.asyncDispose"),
|
|
189
|
-
dispose = __TS__Symbol("Symbol.dispose"),
|
|
190
|
-
iterator = __TS__Symbol("Symbol.iterator"),
|
|
191
|
-
hasInstance = __TS__Symbol("Symbol.hasInstance"),
|
|
192
|
-
species = __TS__Symbol("Symbol.species"),
|
|
193
|
-
toStringTag = __TS__Symbol("Symbol.toStringTag")
|
|
194
|
-
}
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
local __TS__Iterator
|
|
198
|
-
do
|
|
199
|
-
local function iteratorGeneratorStep(self)
|
|
200
|
-
local co = self.____coroutine
|
|
201
|
-
local status, value = coroutine.resume(co)
|
|
202
|
-
if not status then
|
|
203
|
-
error(value, 0)
|
|
204
|
-
end
|
|
205
|
-
if coroutine.status(co) == "dead" then
|
|
206
|
-
return
|
|
207
|
-
end
|
|
208
|
-
return true, value
|
|
209
|
-
end
|
|
210
|
-
local function iteratorIteratorStep(self)
|
|
211
|
-
local result = self:next()
|
|
212
|
-
if result.done then
|
|
213
|
-
return
|
|
214
|
-
end
|
|
215
|
-
return true, result.value
|
|
216
|
-
end
|
|
217
|
-
local function iteratorStringStep(self, index)
|
|
218
|
-
index = index + 1
|
|
219
|
-
if index > #self then
|
|
220
|
-
return
|
|
221
|
-
end
|
|
222
|
-
return index, string.sub(self, index, index)
|
|
223
|
-
end
|
|
224
|
-
function __TS__Iterator(iterable)
|
|
225
|
-
if type(iterable) == "string" then
|
|
226
|
-
return iteratorStringStep, iterable, 0
|
|
227
|
-
elseif iterable.____coroutine ~= nil then
|
|
228
|
-
return iteratorGeneratorStep, iterable
|
|
229
|
-
elseif iterable[Symbol.iterator] then
|
|
230
|
-
local iterator = iterable[Symbol.iterator](iterable)
|
|
231
|
-
return iteratorIteratorStep, iterator
|
|
232
|
-
else
|
|
233
|
-
return ipairs(iterable)
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
local Set
|
|
239
|
-
do
|
|
240
|
-
Set = __TS__Class()
|
|
241
|
-
Set.name = "Set"
|
|
242
|
-
function Set.prototype.____constructor(self, values)
|
|
243
|
-
self[Symbol.toStringTag] = "Set"
|
|
244
|
-
self.size = 0
|
|
245
|
-
self.nextKey = {}
|
|
246
|
-
self.previousKey = {}
|
|
247
|
-
if values == nil then
|
|
248
|
-
return
|
|
249
|
-
end
|
|
250
|
-
local iterable = values
|
|
251
|
-
if iterable[Symbol.iterator] then
|
|
252
|
-
local iterator = iterable[Symbol.iterator](iterable)
|
|
253
|
-
while true do
|
|
254
|
-
local result = iterator:next()
|
|
255
|
-
if result.done then
|
|
256
|
-
break
|
|
257
|
-
end
|
|
258
|
-
self:add(result.value)
|
|
259
|
-
end
|
|
260
|
-
else
|
|
261
|
-
local array = values
|
|
262
|
-
for ____, value in ipairs(array) do
|
|
263
|
-
self:add(value)
|
|
264
|
-
end
|
|
265
|
-
end
|
|
266
|
-
end
|
|
267
|
-
function Set.prototype.add(self, value)
|
|
268
|
-
local isNewValue = not self:has(value)
|
|
269
|
-
if isNewValue then
|
|
270
|
-
self.size = self.size + 1
|
|
271
|
-
end
|
|
272
|
-
if self.firstKey == nil then
|
|
273
|
-
self.firstKey = value
|
|
274
|
-
self.lastKey = value
|
|
275
|
-
elseif isNewValue then
|
|
276
|
-
self.nextKey[self.lastKey] = value
|
|
277
|
-
self.previousKey[value] = self.lastKey
|
|
278
|
-
self.lastKey = value
|
|
279
|
-
end
|
|
280
|
-
return self
|
|
281
|
-
end
|
|
282
|
-
function Set.prototype.clear(self)
|
|
283
|
-
self.nextKey = {}
|
|
284
|
-
self.previousKey = {}
|
|
285
|
-
self.firstKey = nil
|
|
286
|
-
self.lastKey = nil
|
|
287
|
-
self.size = 0
|
|
288
|
-
end
|
|
289
|
-
function Set.prototype.delete(self, value)
|
|
290
|
-
local contains = self:has(value)
|
|
291
|
-
if contains then
|
|
292
|
-
self.size = self.size - 1
|
|
293
|
-
local next = self.nextKey[value]
|
|
294
|
-
local previous = self.previousKey[value]
|
|
295
|
-
if next ~= nil and previous ~= nil then
|
|
296
|
-
self.nextKey[previous] = next
|
|
297
|
-
self.previousKey[next] = previous
|
|
298
|
-
elseif next ~= nil then
|
|
299
|
-
self.firstKey = next
|
|
300
|
-
self.previousKey[next] = nil
|
|
301
|
-
elseif previous ~= nil then
|
|
302
|
-
self.lastKey = previous
|
|
303
|
-
self.nextKey[previous] = nil
|
|
304
|
-
else
|
|
305
|
-
self.firstKey = nil
|
|
306
|
-
self.lastKey = nil
|
|
307
|
-
end
|
|
308
|
-
self.nextKey[value] = nil
|
|
309
|
-
self.previousKey[value] = nil
|
|
310
|
-
end
|
|
311
|
-
return contains
|
|
312
|
-
end
|
|
313
|
-
function Set.prototype.forEach(self, callback)
|
|
314
|
-
for ____, key in __TS__Iterator(self:keys()) do
|
|
315
|
-
callback(nil, key, key, self)
|
|
316
|
-
end
|
|
317
|
-
end
|
|
318
|
-
function Set.prototype.has(self, value)
|
|
319
|
-
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
320
|
-
end
|
|
321
|
-
Set.prototype[Symbol.iterator] = function(self)
|
|
322
|
-
return self:values()
|
|
323
|
-
end
|
|
324
|
-
function Set.prototype.entries(self)
|
|
325
|
-
local function getFirstKey()
|
|
326
|
-
return self.firstKey
|
|
327
|
-
end
|
|
328
|
-
local nextKey = self.nextKey
|
|
329
|
-
local key
|
|
330
|
-
local started = false
|
|
331
|
-
return {
|
|
332
|
-
[Symbol.iterator] = function(self)
|
|
333
|
-
return self
|
|
334
|
-
end,
|
|
335
|
-
next = function(self)
|
|
336
|
-
if not started then
|
|
337
|
-
started = true
|
|
338
|
-
key = getFirstKey(nil)
|
|
339
|
-
else
|
|
340
|
-
key = nextKey[key]
|
|
341
|
-
end
|
|
342
|
-
return {done = not key, value = {key, key}}
|
|
343
|
-
end
|
|
344
|
-
}
|
|
345
|
-
end
|
|
346
|
-
function Set.prototype.keys(self)
|
|
347
|
-
local function getFirstKey()
|
|
348
|
-
return self.firstKey
|
|
349
|
-
end
|
|
350
|
-
local nextKey = self.nextKey
|
|
351
|
-
local key
|
|
352
|
-
local started = false
|
|
353
|
-
return {
|
|
354
|
-
[Symbol.iterator] = function(self)
|
|
355
|
-
return self
|
|
356
|
-
end,
|
|
357
|
-
next = function(self)
|
|
358
|
-
if not started then
|
|
359
|
-
started = true
|
|
360
|
-
key = getFirstKey(nil)
|
|
361
|
-
else
|
|
362
|
-
key = nextKey[key]
|
|
363
|
-
end
|
|
364
|
-
return {done = not key, value = key}
|
|
365
|
-
end
|
|
366
|
-
}
|
|
367
|
-
end
|
|
368
|
-
function Set.prototype.values(self)
|
|
369
|
-
local function getFirstKey()
|
|
370
|
-
return self.firstKey
|
|
371
|
-
end
|
|
372
|
-
local nextKey = self.nextKey
|
|
373
|
-
local key
|
|
374
|
-
local started = false
|
|
375
|
-
return {
|
|
376
|
-
[Symbol.iterator] = function(self)
|
|
377
|
-
return self
|
|
378
|
-
end,
|
|
379
|
-
next = function(self)
|
|
380
|
-
if not started then
|
|
381
|
-
started = true
|
|
382
|
-
key = getFirstKey(nil)
|
|
383
|
-
else
|
|
384
|
-
key = nextKey[key]
|
|
385
|
-
end
|
|
386
|
-
return {done = not key, value = key}
|
|
387
|
-
end
|
|
388
|
-
}
|
|
389
|
-
end
|
|
390
|
-
function Set.prototype.union(self, other)
|
|
391
|
-
local result = __TS__New(Set, self)
|
|
392
|
-
for ____, item in __TS__Iterator(other) do
|
|
393
|
-
result:add(item)
|
|
394
|
-
end
|
|
395
|
-
return result
|
|
396
|
-
end
|
|
397
|
-
function Set.prototype.intersection(self, other)
|
|
398
|
-
local result = __TS__New(Set)
|
|
399
|
-
for ____, item in __TS__Iterator(self) do
|
|
400
|
-
if other:has(item) then
|
|
401
|
-
result:add(item)
|
|
402
|
-
end
|
|
403
|
-
end
|
|
404
|
-
return result
|
|
405
|
-
end
|
|
406
|
-
function Set.prototype.difference(self, other)
|
|
407
|
-
local result = __TS__New(Set, self)
|
|
408
|
-
for ____, item in __TS__Iterator(other) do
|
|
409
|
-
result:delete(item)
|
|
410
|
-
end
|
|
411
|
-
return result
|
|
412
|
-
end
|
|
413
|
-
function Set.prototype.symmetricDifference(self, other)
|
|
414
|
-
local result = __TS__New(Set, self)
|
|
415
|
-
for ____, item in __TS__Iterator(other) do
|
|
416
|
-
if self:has(item) then
|
|
417
|
-
result:delete(item)
|
|
418
|
-
else
|
|
419
|
-
result:add(item)
|
|
420
|
-
end
|
|
421
|
-
end
|
|
422
|
-
return result
|
|
423
|
-
end
|
|
424
|
-
function Set.prototype.isSubsetOf(self, other)
|
|
425
|
-
for ____, item in __TS__Iterator(self) do
|
|
426
|
-
if not other:has(item) then
|
|
427
|
-
return false
|
|
428
|
-
end
|
|
429
|
-
end
|
|
430
|
-
return true
|
|
431
|
-
end
|
|
432
|
-
function Set.prototype.isSupersetOf(self, other)
|
|
433
|
-
for ____, item in __TS__Iterator(other) do
|
|
434
|
-
if not self:has(item) then
|
|
435
|
-
return false
|
|
436
|
-
end
|
|
437
|
-
end
|
|
438
|
-
return true
|
|
439
|
-
end
|
|
440
|
-
function Set.prototype.isDisjointFrom(self, other)
|
|
441
|
-
for ____, item in __TS__Iterator(self) do
|
|
442
|
-
if other:has(item) then
|
|
443
|
-
return false
|
|
444
|
-
end
|
|
445
|
-
end
|
|
446
|
-
return true
|
|
447
|
-
end
|
|
448
|
-
Set[Symbol.species] = Set
|
|
449
|
-
end
|
|
450
|
-
|
|
451
|
-
local function __TS__StringTrim(self)
|
|
452
|
-
local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
|
|
453
|
-
return result
|
|
454
|
-
end
|
|
455
|
-
-- End of Lua Library inline imports
|
|
456
|
-
local ____exports = {}
|
|
457
|
-
local ____DataSource = require("datasources.DataSource")
|
|
458
|
-
local DataSource = ____DataSource.DataSource
|
|
459
|
-
local ____Source = require("datasources.Source")
|
|
460
|
-
local registerSource = ____Source.registerSource
|
|
461
|
-
local ____UseSource = require("datasources.UseSource")
|
|
462
|
-
local UseSource = ____UseSource.UseSource
|
|
463
|
-
____exports.Unit = {Player = "player", Target = "target", Focus = "focus"}
|
|
464
|
-
____exports.UnitPredicates = __TS__Class()
|
|
465
|
-
local UnitPredicates = ____exports.UnitPredicates
|
|
466
|
-
UnitPredicates.name = "UnitPredicates"
|
|
467
|
-
function UnitPredicates.prototype.____constructor(self, token)
|
|
468
|
-
self.token = token
|
|
469
|
-
end
|
|
470
|
-
__TS__SetDescriptor(
|
|
471
|
-
UnitPredicates.prototype,
|
|
472
|
-
"PC",
|
|
473
|
-
{get = function(self)
|
|
474
|
-
local value = UnitIsPlayer(self:token())
|
|
475
|
-
local ____issecretvalue_result_0
|
|
476
|
-
if issecretvalue(value) then
|
|
477
|
-
____issecretvalue_result_0 = nil
|
|
478
|
-
else
|
|
479
|
-
____issecretvalue_result_0 = value
|
|
480
|
-
end
|
|
481
|
-
return ____issecretvalue_result_0
|
|
482
|
-
end},
|
|
483
|
-
true
|
|
484
|
-
)
|
|
485
|
-
__TS__SetDescriptor(
|
|
486
|
-
UnitPredicates.prototype,
|
|
487
|
-
"Self",
|
|
488
|
-
{get = function(self)
|
|
489
|
-
local value = UnitIsUnit(
|
|
490
|
-
self:token(),
|
|
491
|
-
"player"
|
|
492
|
-
)
|
|
493
|
-
local ____issecretvalue_result_1
|
|
494
|
-
if issecretvalue(value) then
|
|
495
|
-
____issecretvalue_result_1 = nil
|
|
496
|
-
else
|
|
497
|
-
____issecretvalue_result_1 = value
|
|
498
|
-
end
|
|
499
|
-
return ____issecretvalue_result_1
|
|
500
|
-
end},
|
|
501
|
-
true
|
|
502
|
-
)
|
|
503
|
-
--- Shared live unit reference; identity is read again rather than cached by token.
|
|
504
|
-
____exports.UnitSource = __TS__Class()
|
|
505
|
-
local UnitSource = ____exports.UnitSource
|
|
506
|
-
UnitSource.name = "UnitSource"
|
|
507
|
-
__TS__ClassExtends(UnitSource, DataSource)
|
|
508
|
-
function UnitSource.prototype.____constructor(self, token)
|
|
509
|
-
DataSource.prototype.____constructor(self, nil)
|
|
510
|
-
self.token = token
|
|
511
|
-
self.restricted = false
|
|
512
|
-
self.listeners = __TS__New(Set)
|
|
513
|
-
self.tokenListeners = __TS__New(Set)
|
|
514
|
-
self.Is = __TS__New(
|
|
515
|
-
____exports.UnitPredicates,
|
|
516
|
-
function() return self.Token end
|
|
517
|
-
)
|
|
518
|
-
end
|
|
519
|
-
function UnitSource.prototype.Retarget(self, token)
|
|
520
|
-
if issecretvalue(token) or type(token) ~= "string" or __TS__StringTrim(token) == "" then
|
|
521
|
-
error("UnitSource: expected a public unit token")
|
|
522
|
-
end
|
|
523
|
-
if token == self.token then
|
|
524
|
-
return
|
|
525
|
-
end
|
|
526
|
-
if InCombatLockdown() then
|
|
527
|
-
error("UnitSource: retarget after combat so secure actions and displayed data stay aligned")
|
|
528
|
-
end
|
|
529
|
-
self.token = token
|
|
530
|
-
self:UpdateEvents()
|
|
531
|
-
for ____, listener in __TS__Iterator(self.tokenListeners) do
|
|
532
|
-
listener(nil)
|
|
533
|
-
end
|
|
534
|
-
for ____, listener in __TS__Iterator(self.listeners) do
|
|
535
|
-
listener(nil)
|
|
536
|
-
end
|
|
537
|
-
end
|
|
538
|
-
function UnitSource.prototype.onTokenChange(self, listener)
|
|
539
|
-
self.tokenListeners:add(listener)
|
|
540
|
-
return function()
|
|
541
|
-
self.tokenListeners:delete(listener)
|
|
542
|
-
end
|
|
543
|
-
end
|
|
544
|
-
function UnitSource.prototype.onChange(self, listener)
|
|
545
|
-
self.listeners:add(listener)
|
|
546
|
-
self:UpdateEvents()
|
|
547
|
-
return function()
|
|
548
|
-
self.listeners:delete(listener)
|
|
549
|
-
self:UpdateEvents()
|
|
550
|
-
end
|
|
551
|
-
end
|
|
552
|
-
function UnitSource.prototype.UpdateEvents(self)
|
|
553
|
-
local ____opt_2 = self.events
|
|
554
|
-
if ____opt_2 ~= nil then
|
|
555
|
-
____opt_2:UnregisterAllEvents()
|
|
556
|
-
end
|
|
557
|
-
if self.listeners.size == 0 or self.token ~= "target" then
|
|
558
|
-
local ____opt_4 = self.events
|
|
559
|
-
if ____opt_4 ~= nil then
|
|
560
|
-
____opt_4:SetScript("OnEvent", nil)
|
|
561
|
-
end
|
|
562
|
-
local ____opt_6 = self.events
|
|
563
|
-
if ____opt_6 ~= nil then
|
|
564
|
-
____opt_6:Hide()
|
|
565
|
-
end
|
|
566
|
-
self.events = nil
|
|
567
|
-
return
|
|
568
|
-
end
|
|
569
|
-
if self.events == nil then
|
|
570
|
-
self.events = CreateFrame("Frame", nil, UIParent)
|
|
571
|
-
end
|
|
572
|
-
local frame = self.events
|
|
573
|
-
frame:RegisterEvent("PLAYER_TARGET_CHANGED")
|
|
574
|
-
frame:SetScript(
|
|
575
|
-
"OnEvent",
|
|
576
|
-
function()
|
|
577
|
-
for ____, listener in __TS__Iterator(self.listeners) do
|
|
578
|
-
listener(nil)
|
|
579
|
-
end
|
|
580
|
-
end
|
|
581
|
-
)
|
|
582
|
-
end
|
|
583
|
-
function UnitSource.prototype.HasSecretFields(self)
|
|
584
|
-
return self.restricted
|
|
585
|
-
end
|
|
586
|
-
function UnitSource.prototype.GetValue(self)
|
|
587
|
-
local guid = UnitGUID(self.Token)
|
|
588
|
-
self.restricted = issecretvalue(guid)
|
|
589
|
-
if self.restricted or guid == nil then
|
|
590
|
-
return nil
|
|
591
|
-
end
|
|
592
|
-
return {token = self.Token, guid = guid}
|
|
593
|
-
end
|
|
594
|
-
__TS__SetDescriptor(
|
|
595
|
-
UnitSource.prototype,
|
|
596
|
-
"Token",
|
|
597
|
-
{get = function(self)
|
|
598
|
-
return self.token
|
|
599
|
-
end},
|
|
600
|
-
true
|
|
601
|
-
);
|
|
602
|
-
(function(self)
|
|
603
|
-
registerSource(
|
|
604
|
-
nil,
|
|
605
|
-
____exports.UnitSource,
|
|
606
|
-
function(____, props) return __TS__New(____exports.UnitSource, props[1]) end
|
|
607
|
-
)
|
|
608
|
-
end)(UnitSource)
|
|
609
|
-
--- Reuse explicit unit references; string inputs remain a convenience shorthand.
|
|
610
|
-
function ____exports.resolveUnit(self, unit)
|
|
611
|
-
return type(unit) == "string" and UseSource(nil, ____exports.UnitSource, unit) or unit
|
|
612
|
-
end
|
|
613
|
-
return ____exports
|