wuira 0.3.2 → 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 (64) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +27 -9
  3. package/docs/source-converters.md +6 -6
  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/NativeNumberSource.d.ts +1 -1
  8. package/lib/datasources/NativeNumberSource.lua +16 -1
  9. package/lib/datasources/ProgressSource.lua +5 -9
  10. package/lib/datasources/Source.d.ts +18 -0
  11. package/lib/datasources/Source.lua +300 -0
  12. package/lib/datasources/SourceConverter.d.ts +1 -1
  13. package/lib/datasources/SourceConverter.lua +10 -1
  14. package/lib/datasources/TextureSource.d.ts +1 -1
  15. package/lib/datasources/TextureSource.lua +16 -1
  16. package/lib/datasources/TimerSource.d.ts +1 -1
  17. package/lib/datasources/TimerSource.lua +16 -1
  18. package/lib/datasources/UseSource.d.ts +49 -0
  19. package/lib/datasources/UseSource.lua +9 -0
  20. package/lib/datasources/index.d.ts +5 -25
  21. package/lib/datasources/index.lua +49 -69
  22. package/lib/helpers/Auras.d.ts +5 -0
  23. package/lib/helpers/Auras.lua +47 -0
  24. package/lib/helpers/Range.d.ts +2 -0
  25. package/lib/helpers/Range.lua +30 -0
  26. package/lib/helpers/index.d.ts +2 -0
  27. package/lib/helpers/index.lua +12 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.lua +6 -0
  30. package/lib/platform/forever.d.ts +3 -0
  31. package/lib/rendering/progress.lua +5 -150
  32. package/lib/ui/UnitPortrait.d.ts +1 -2
  33. package/lib/ui/UnitPortrait.lua +11 -18
  34. package/package.json +8 -1
  35. package/lib/datasources/AuraTimer.d.ts +0 -21
  36. package/lib/datasources/AuraTimer.lua +0 -322
  37. package/lib/datasources/Auras.d.ts +0 -32
  38. package/lib/datasources/Auras.lua +0 -284
  39. package/lib/datasources/CastTimer.d.ts +0 -9
  40. package/lib/datasources/CastTimer.lua +0 -240
  41. package/lib/datasources/EditModeLayouts.d.ts +0 -33
  42. package/lib/datasources/EditModeLayouts.lua +0 -689
  43. package/lib/datasources/GroupMembers.d.ts +0 -24
  44. package/lib/datasources/GroupMembers.lua +0 -454
  45. package/lib/datasources/GroupRoster.d.ts +0 -28
  46. package/lib/datasources/GroupRoster.lua +0 -611
  47. package/lib/datasources/KnownSpells.d.ts +0 -33
  48. package/lib/datasources/KnownSpells.lua +0 -1068
  49. package/lib/datasources/ManaRegenTimer.d.ts +0 -29
  50. package/lib/datasources/ManaRegenTimer.lua +0 -674
  51. package/lib/datasources/Resources.d.ts +0 -60
  52. package/lib/datasources/Resources.lua +0 -824
  53. package/lib/datasources/SpellCooldown.d.ts +0 -12
  54. package/lib/datasources/SpellCooldown.lua +0 -218
  55. package/lib/datasources/SpellSource.d.ts +0 -14
  56. package/lib/datasources/SpellSource.lua +0 -224
  57. package/lib/datasources/SwingTimer.d.ts +0 -31
  58. package/lib/datasources/SwingTimer.lua +0 -641
  59. package/lib/datasources/TotemTimer.d.ts +0 -10
  60. package/lib/datasources/TotemTimer.lua +0 -260
  61. package/lib/datasources/UnitInfo.d.ts +0 -51
  62. package/lib/datasources/UnitInfo.lua +0 -783
  63. package/lib/datasources/UnitSource.d.ts +0 -38
  64. package/lib/datasources/UnitSource.lua +0 -602
@@ -1,260 +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__CloneDescriptor(____bindingPattern0)
36
- local value
37
- local writable
38
- local set
39
- local get
40
- local configurable
41
- local enumerable
42
- enumerable = ____bindingPattern0.enumerable
43
- configurable = ____bindingPattern0.configurable
44
- get = ____bindingPattern0.get
45
- set = ____bindingPattern0.set
46
- writable = ____bindingPattern0.writable
47
- value = ____bindingPattern0.value
48
- local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
49
- local hasGetterOrSetter = get ~= nil or set ~= nil
50
- local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
51
- if hasGetterOrSetter and hasValueOrWritableAttribute then
52
- error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
53
- end
54
- if get or set then
55
- descriptor.get = get
56
- descriptor.set = set
57
- else
58
- descriptor.value = value
59
- descriptor.writable = writable == true
60
- end
61
- return descriptor
62
- end
63
-
64
- local __TS__DescriptorGet
65
- do
66
- local getmetatable = _G.getmetatable
67
- local ____rawget = _G.rawget
68
- function __TS__DescriptorGet(self, metatable, key)
69
- while metatable do
70
- local rawResult = ____rawget(metatable, key)
71
- if rawResult ~= nil then
72
- return rawResult
73
- end
74
- local descriptors = ____rawget(metatable, "_descriptors")
75
- if descriptors then
76
- local descriptor = descriptors[key]
77
- if descriptor ~= nil then
78
- if descriptor.get then
79
- return descriptor.get(self)
80
- end
81
- return descriptor.value
82
- end
83
- end
84
- metatable = getmetatable(metatable)
85
- end
86
- end
87
- end
88
-
89
- local __TS__DescriptorSet
90
- do
91
- local getmetatable = _G.getmetatable
92
- local ____rawget = _G.rawget
93
- local rawset = _G.rawset
94
- function __TS__DescriptorSet(self, metatable, key, value)
95
- while metatable do
96
- local descriptors = ____rawget(metatable, "_descriptors")
97
- if descriptors then
98
- local descriptor = descriptors[key]
99
- if descriptor ~= nil then
100
- if descriptor.set then
101
- descriptor.set(self, value)
102
- else
103
- if descriptor.writable == false then
104
- error(
105
- ((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
106
- 0
107
- )
108
- end
109
- descriptor.value = value
110
- end
111
- return
112
- end
113
- end
114
- metatable = getmetatable(metatable)
115
- end
116
- rawset(self, key, value)
117
- end
118
- end
119
-
120
- local __TS__SetDescriptor
121
- do
122
- local getmetatable = _G.getmetatable
123
- local function descriptorIndex(self, key)
124
- return __TS__DescriptorGet(
125
- self,
126
- getmetatable(self),
127
- key
128
- )
129
- end
130
- local function descriptorNewIndex(self, key, value)
131
- return __TS__DescriptorSet(
132
- self,
133
- getmetatable(self),
134
- key,
135
- value
136
- )
137
- end
138
- function __TS__SetDescriptor(target, key, desc, isPrototype)
139
- if isPrototype == nil then
140
- isPrototype = false
141
- end
142
- local ____isPrototype_0
143
- if isPrototype then
144
- ____isPrototype_0 = target
145
- else
146
- ____isPrototype_0 = getmetatable(target)
147
- end
148
- local metatable = ____isPrototype_0
149
- if not metatable then
150
- metatable = {}
151
- setmetatable(target, metatable)
152
- end
153
- if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
154
- local instanceMetatable = {}
155
- instanceMetatable._isOwnDescriptorMetatable = true
156
- setmetatable(instanceMetatable, metatable)
157
- setmetatable(target, instanceMetatable)
158
- metatable = instanceMetatable
159
- end
160
- local value = rawget(target, key)
161
- if value ~= nil then
162
- rawset(target, key, nil)
163
- end
164
- if not rawget(metatable, "_descriptors") then
165
- metatable._descriptors = {}
166
- end
167
- metatable._descriptors[key] = __TS__CloneDescriptor(desc)
168
- metatable.__index = descriptorIndex
169
- metatable.__newindex = descriptorNewIndex
170
- end
171
- end
172
- -- End of Lua Library inline imports
173
- local ____exports = {}
174
- local ____TimerSource = require("datasources.TimerSource")
175
- local TimerSource = ____TimerSource.TimerSource
176
- --- Player-owned ground effects exposed by the game's totem API, across spell ranks.
177
- ____exports.TotemTimer = __TS__Class()
178
- local TotemTimer = ____exports.TotemTimer
179
- TotemTimer.name = "TotemTimer"
180
- __TS__ClassExtends(TotemTimer, TimerSource)
181
- function TotemTimer.prototype.____constructor(self, spell)
182
- TimerSource.prototype.____constructor(
183
- self,
184
- function() return self:ReadDuration() end,
185
- {"PLAYER_TOTEM_UPDATE", "PLAYER_ENTERING_WORLD", "PLAYER_REGEN_ENABLED", "SPELLS_CHANGED"}
186
- )
187
- self.spell = spell
188
- self.status = "inactive"
189
- end
190
- function TotemTimer.prototype.ReadDuration(self)
191
- if GetTotemInfo == nil or GetTotemDuration == nil or GetNumTotemSlots == nil then
192
- self.status = "unavailable"
193
- return nil
194
- end
195
- local ____temp_4
196
- if type(self.spell) == "string" then
197
- ____temp_4 = self.spell
198
- else
199
- local ____opt_0 = C_Spell and C_Spell.GetSpellName
200
- ____temp_4 = ____opt_0 and ____opt_0(self.spell)
201
- end
202
- local name = ____temp_4
203
- if issecretvalue(name) then
204
- self.status = "restricted"
205
- return nil
206
- end
207
- local slots = GetNumTotemSlots()
208
- if issecretvalue(slots) then
209
- self.status = "restricted"
210
- return nil
211
- end
212
- local restricted = false
213
- do
214
- local slot = 1
215
- while slot <= slots do
216
- do
217
- local __continue9
218
- repeat
219
- local active, effectName, ____, ____, ____, ____, spellId = GetTotemInfo(slot)
220
- if issecretvalue(active) then
221
- restricted = true
222
- __continue9 = true
223
- break
224
- end
225
- if not active then
226
- __continue9 = true
227
- break
228
- end
229
- local sameId = not issecretvalue(spellId) and spellId == self.spell
230
- local sameName = not issecretvalue(effectName) and name ~= nil and effectName == name
231
- if not sameId and not sameName then
232
- if issecretvalue(spellId) or issecretvalue(effectName) then
233
- restricted = true
234
- end
235
- __continue9 = true
236
- break
237
- end
238
- self.status = "active"
239
- return GetTotemDuration(slot)
240
- until true
241
- if not __continue9 then
242
- break
243
- end
244
- end
245
- slot = slot + 1
246
- end
247
- end
248
- self.status = restricted and "restricted" or "inactive"
249
- return nil
250
- end
251
- __TS__SetDescriptor(
252
- TotemTimer.prototype,
253
- "Status",
254
- {get = function(self)
255
- self:ReadDuration()
256
- return self.status
257
- end},
258
- true
259
- )
260
- 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
- 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
- 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 };