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.
Files changed (52) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +15 -12
  3. package/docs/source-converters.md +5 -5
  4. package/docs/spells.md +1 -1
  5. package/lib/datasources/NativeApi.d.ts +319 -0
  6. package/lib/datasources/NativeApi.lua +1114 -0
  7. package/lib/datasources/UseSource.d.ts +41 -43
  8. package/lib/datasources/index.d.ts +3 -25
  9. package/lib/datasources/index.lua +45 -74
  10. package/lib/helpers/Auras.d.ts +5 -0
  11. package/lib/helpers/Auras.lua +47 -0
  12. package/lib/helpers/Range.d.ts +2 -0
  13. package/lib/helpers/Range.lua +30 -0
  14. package/lib/helpers/index.d.ts +2 -0
  15. package/lib/helpers/index.lua +12 -0
  16. package/lib/index.d.ts +1 -0
  17. package/lib/index.lua +6 -0
  18. package/lib/platform/forever.d.ts +3 -0
  19. package/lib/rendering/progress.lua +5 -150
  20. package/lib/ui/UnitPortrait.d.ts +1 -2
  21. package/lib/ui/UnitPortrait.lua +11 -18
  22. package/package.json +8 -1
  23. package/lib/datasources/AuraTimer.d.ts +0 -21
  24. package/lib/datasources/AuraTimer.lua +0 -334
  25. package/lib/datasources/Auras.d.ts +0 -32
  26. package/lib/datasources/Auras.lua +0 -300
  27. package/lib/datasources/CastTimer.d.ts +0 -9
  28. package/lib/datasources/CastTimer.lua +0 -255
  29. package/lib/datasources/EditModeLayouts.d.ts +0 -33
  30. package/lib/datasources/EditModeLayouts.lua +0 -698
  31. package/lib/datasources/GroupMembers.d.ts +0 -24
  32. package/lib/datasources/GroupMembers.lua +0 -477
  33. package/lib/datasources/GroupRoster.d.ts +0 -28
  34. package/lib/datasources/GroupRoster.lua +0 -622
  35. package/lib/datasources/KnownSpells.d.ts +0 -33
  36. package/lib/datasources/KnownSpells.lua +0 -1077
  37. package/lib/datasources/ManaRegenTimer.d.ts +0 -29
  38. package/lib/datasources/ManaRegenTimer.lua +0 -683
  39. package/lib/datasources/Resources.d.ts +0 -81
  40. package/lib/datasources/Resources.lua +0 -907
  41. package/lib/datasources/SpellCooldown.d.ts +0 -12
  42. package/lib/datasources/SpellCooldown.lua +0 -240
  43. package/lib/datasources/SpellSource.d.ts +0 -14
  44. package/lib/datasources/SpellSource.lua +0 -236
  45. package/lib/datasources/SwingTimer.d.ts +0 -31
  46. package/lib/datasources/SwingTimer.lua +0 -650
  47. package/lib/datasources/TotemTimer.d.ts +0 -10
  48. package/lib/datasources/TotemTimer.lua +0 -275
  49. package/lib/datasources/UnitInfo.d.ts +0 -51
  50. package/lib/datasources/UnitInfo.lua +0 -801
  51. package/lib/datasources/UnitSource.d.ts +0 -38
  52. package/lib/datasources/UnitSource.lua +0 -613
@@ -1,275 +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__ClassExtends(target, base)
11
- target.____super = base
12
- local staticMetatable = setmetatable({__index = base}, base)
13
- setmetatable(target, staticMetatable)
14
- local baseMetatable = getmetatable(base)
15
- if baseMetatable then
16
- if type(baseMetatable.__index) == "function" then
17
- staticMetatable.__index = baseMetatable.__index
18
- end
19
- if type(baseMetatable.__newindex) == "function" then
20
- staticMetatable.__newindex = baseMetatable.__newindex
21
- end
22
- end
23
- setmetatable(target.prototype, base.prototype)
24
- if type(base.prototype.__index) == "function" then
25
- target.prototype.__index = base.prototype.__index
26
- end
27
- if type(base.prototype.__newindex) == "function" then
28
- target.prototype.__newindex = base.prototype.__newindex
29
- end
30
- if type(base.prototype.__tostring) == "function" then
31
- target.prototype.__tostring = base.prototype.__tostring
32
- end
33
- end
34
-
35
- local function __TS__New(target, ...)
36
- local instance = setmetatable({}, target.prototype)
37
- instance:____constructor(...)
38
- return instance
39
- end
40
-
41
- local function __TS__CloneDescriptor(____bindingPattern0)
42
- local value
43
- local writable
44
- local set
45
- local get
46
- local configurable
47
- local enumerable
48
- enumerable = ____bindingPattern0.enumerable
49
- configurable = ____bindingPattern0.configurable
50
- get = ____bindingPattern0.get
51
- set = ____bindingPattern0.set
52
- writable = ____bindingPattern0.writable
53
- value = ____bindingPattern0.value
54
- local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
55
- local hasGetterOrSetter = get ~= nil or set ~= nil
56
- local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
57
- if hasGetterOrSetter and hasValueOrWritableAttribute then
58
- error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
59
- end
60
- if get or set then
61
- descriptor.get = get
62
- descriptor.set = set
63
- else
64
- descriptor.value = value
65
- descriptor.writable = writable == true
66
- end
67
- return descriptor
68
- end
69
-
70
- local __TS__DescriptorGet
71
- do
72
- local getmetatable = _G.getmetatable
73
- local ____rawget = _G.rawget
74
- function __TS__DescriptorGet(self, metatable, key)
75
- while metatable do
76
- local rawResult = ____rawget(metatable, key)
77
- if rawResult ~= nil then
78
- return rawResult
79
- end
80
- local descriptors = ____rawget(metatable, "_descriptors")
81
- if descriptors then
82
- local descriptor = descriptors[key]
83
- if descriptor ~= nil then
84
- if descriptor.get then
85
- return descriptor.get(self)
86
- end
87
- return descriptor.value
88
- end
89
- end
90
- metatable = getmetatable(metatable)
91
- end
92
- end
93
- end
94
-
95
- local __TS__DescriptorSet
96
- do
97
- local getmetatable = _G.getmetatable
98
- local ____rawget = _G.rawget
99
- local rawset = _G.rawset
100
- function __TS__DescriptorSet(self, metatable, key, value)
101
- while metatable do
102
- local descriptors = ____rawget(metatable, "_descriptors")
103
- if descriptors then
104
- local descriptor = descriptors[key]
105
- if descriptor ~= nil then
106
- if descriptor.set then
107
- descriptor.set(self, value)
108
- else
109
- if descriptor.writable == false then
110
- error(
111
- ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
112
- 0
113
- )
114
- end
115
- descriptor.value = value
116
- end
117
- return
118
- end
119
- end
120
- metatable = getmetatable(metatable)
121
- end
122
- rawset(self, key, value)
123
- end
124
- end
125
-
126
- local __TS__SetDescriptor
127
- do
128
- local getmetatable = _G.getmetatable
129
- local function descriptorIndex(self, key)
130
- return __TS__DescriptorGet(
131
- self,
132
- getmetatable(self),
133
- key
134
- )
135
- end
136
- local function descriptorNewIndex(self, key, value)
137
- return __TS__DescriptorSet(
138
- self,
139
- getmetatable(self),
140
- key,
141
- value
142
- )
143
- end
144
- function __TS__SetDescriptor(target, key, desc, isPrototype)
145
- if isPrototype == nil then
146
- isPrototype = false
147
- end
148
- local ____isPrototype_0
149
- if isPrototype then
150
- ____isPrototype_0 = target
151
- else
152
- ____isPrototype_0 = getmetatable(target)
153
- end
154
- local metatable = ____isPrototype_0
155
- if not metatable then
156
- metatable = {}
157
- setmetatable(target, metatable)
158
- end
159
- if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
160
- local instanceMetatable = {}
161
- instanceMetatable._isOwnDescriptorMetatable = true
162
- setmetatable(instanceMetatable, metatable)
163
- setmetatable(target, instanceMetatable)
164
- metatable = instanceMetatable
165
- end
166
- local value = rawget(target, key)
167
- if value ~= nil then
168
- rawset(target, key, nil)
169
- end
170
- if not rawget(metatable, "_descriptors") then
171
- metatable._descriptors = {}
172
- end
173
- metatable._descriptors[key] = __TS__CloneDescriptor(desc)
174
- metatable.__index = descriptorIndex
175
- metatable.__newindex = descriptorNewIndex
176
- end
177
- end
178
- -- End of Lua Library inline imports
179
- local ____exports = {}
180
- local ____TimerSource = require("datasources.TimerSource")
181
- local TimerSource = ____TimerSource.TimerSource
182
- local ____Source = require("datasources.Source")
183
- local registerSource = ____Source.registerSource
184
- --- Player-owned ground effects exposed by the game's totem API, across spell ranks.
185
- ____exports.TotemTimer = __TS__Class()
186
- local TotemTimer = ____exports.TotemTimer
187
- TotemTimer.name = "TotemTimer"
188
- __TS__ClassExtends(TotemTimer, TimerSource)
189
- function TotemTimer.prototype.____constructor(self, spell)
190
- TimerSource.prototype.____constructor(
191
- self,
192
- function() return self:ReadDuration() end,
193
- {"PLAYER_TOTEM_UPDATE", "PLAYER_ENTERING_WORLD", "PLAYER_REGEN_ENABLED", "SPELLS_CHANGED"}
194
- )
195
- self.spell = spell
196
- self.status = "inactive"
197
- end
198
- function TotemTimer.prototype.ReadDuration(self)
199
- if GetTotemInfo == nil or GetTotemDuration == nil or GetNumTotemSlots == nil then
200
- self.status = "unavailable"
201
- return nil
202
- end
203
- local ____temp_4
204
- if type(self.spell) == "string" then
205
- ____temp_4 = self.spell
206
- else
207
- local ____opt_0 = C_Spell and C_Spell.GetSpellName
208
- ____temp_4 = ____opt_0 and ____opt_0(self.spell)
209
- end
210
- local name = ____temp_4
211
- if issecretvalue(name) then
212
- self.status = "restricted"
213
- return nil
214
- end
215
- local slots = GetNumTotemSlots()
216
- if issecretvalue(slots) then
217
- self.status = "restricted"
218
- return nil
219
- end
220
- local restricted = false
221
- do
222
- local slot = 1
223
- while slot <= slots do
224
- do
225
- local __continue9
226
- repeat
227
- local active, effectName, ____, ____, ____, ____, spellId = GetTotemInfo(slot)
228
- if issecretvalue(active) then
229
- restricted = true
230
- __continue9 = true
231
- break
232
- end
233
- if not active then
234
- __continue9 = true
235
- break
236
- end
237
- local sameId = not issecretvalue(spellId) and spellId == self.spell
238
- local sameName = not issecretvalue(effectName) and name ~= nil and effectName == name
239
- if not sameId and not sameName then
240
- if issecretvalue(spellId) or issecretvalue(effectName) then
241
- restricted = true
242
- end
243
- __continue9 = true
244
- break
245
- end
246
- self.status = "active"
247
- return GetTotemDuration(slot)
248
- until true
249
- if not __continue9 then
250
- break
251
- end
252
- end
253
- slot = slot + 1
254
- end
255
- end
256
- self.status = restricted and "restricted" or "inactive"
257
- return nil
258
- end;
259
- (function(self)
260
- registerSource(
261
- nil,
262
- ____exports.TotemTimer,
263
- function(____, props) return __TS__New(____exports.TotemTimer, props[1]) end
264
- )
265
- end)(TotemTimer)
266
- __TS__SetDescriptor(
267
- TotemTimer.prototype,
268
- "Status",
269
- {get = function(self)
270
- self:ReadDuration()
271
- return self.status
272
- end},
273
- true
274
- )
275
- return ____exports
@@ -1,51 +0,0 @@
1
- import { DataSource } from "./DataSource";
2
- import { UnitSource } from "./UnitSource";
3
- import type { UnitInput } from "./UnitSource";
4
- export interface ClassInfo {
5
- readonly id: number;
6
- readonly token: string;
7
- readonly name: string;
8
- }
9
- export declare class ClassSource extends DataSource<ClassInfo | undefined> {
10
- private restricted;
11
- private readonly listeners;
12
- private events?;
13
- private stopUnit?;
14
- readonly target: UnitSource;
15
- protected constructor(unit: UnitInput);
16
- get unit(): string;
17
- protected HasSecretFields(): boolean;
18
- protected GetValue(): ClassInfo | undefined;
19
- onChange(listener: (value: ClassInfo | undefined) => void): () => void;
20
- private StopListening;
21
- Dispose(): void;
22
- }
23
- export interface SpecializationInfo {
24
- readonly id: number;
25
- readonly name?: string;
26
- readonly icon?: number;
27
- readonly role?: string;
28
- /** Native value when provided by the client; never estimated. */
29
- readonly pointsSpent?: number;
30
- }
31
- export type InspectStatus = "idle" | "pending" | "ready" | "unsupported";
32
- /** Own data is read live; other units require an explicit inspect request. */
33
- export declare class SpecSource extends DataSource<readonly SpecializationInfo[] | undefined> {
34
- private restricted;
35
- private snapshot?;
36
- private snapshotGUID?;
37
- private listener?;
38
- private status;
39
- readonly target: UnitSource;
40
- protected constructor(unit: UnitInput);
41
- get unit(): string;
42
- get Status(): InspectStatus;
43
- protected HasSecretFields(): boolean;
44
- protected GetValue(): readonly SpecializationInfo[] | undefined;
45
- private Read;
46
- /** Returns false if an inspect cannot start. No request is made from a getter. */
47
- RequestInspect(): boolean;
48
- private StopListening;
49
- Dispose(): void;
50
- }
51
- export { SpecSource as Specializations };