wuira 0.1.1 → 0.1.3
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 +93 -0
- package/README.md +91 -0
- package/config/tsconfig.json +3 -1
- package/lib/datasources/Auras.d.ts +32 -0
- package/lib/datasources/Auras.lua +284 -0
- package/lib/datasources/GroupMembers.d.ts +18 -0
- package/lib/datasources/GroupMembers.lua +122 -0
- package/lib/datasources/Resources.d.ts +9 -8
- package/lib/datasources/Resources.lua +172 -11
- package/lib/datasources/UnitInfo.d.ts +45 -0
- package/lib/datasources/UnitInfo.lua +451 -0
- package/lib/datasources/UnitSource.d.ts +28 -0
- package/lib/datasources/UnitSource.lua +245 -0
- package/lib/datasources/index.d.ts +8 -0
- package/lib/datasources/index.lua +23 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.lua +1 -0
- package/lib/ui/Cell.d.ts +4 -1
- package/lib/ui/Cell.lua +1 -0
- package/lib/wuira.d.ts +2 -2
- package/lib/wuira.lua +8 -2
- package/package.json +2 -1
- package/templates/addon/src/index.tsx +1 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable changes to wuira are recorded here, newest first. Add changes to
|
|
4
|
+
`Unreleased` during development, grouped under Added, Changed, Fixed, or Removed
|
|
5
|
+
as appropriate. When releasing, move those entries into a versioned section
|
|
6
|
+
with the release date and highlight breaking changes explicitly.
|
|
7
|
+
|
|
8
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
No changes yet.
|
|
11
|
+
|
|
12
|
+
## 0.1.3 — 2026-10-14
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- A maintained changelog included in the npm package.
|
|
17
|
+
- Buff and debuff sources with caster unit information, explicit source availability,
|
|
18
|
+
and `Aura.isSourceSelf()` returning `undefined` when ownership is unknown.
|
|
19
|
+
- Target and focus unit constants.
|
|
20
|
+
- Group, party, and raid member sources exposing fresh roster unit tokens,
|
|
21
|
+
with explicit solo behavior and no duplicate player entry in raids.
|
|
22
|
+
- Player-only class and specialization sources, including native talent-point
|
|
23
|
+
values when available and explicit GUID-checked inspect requests for other players.
|
|
24
|
+
- Shared `UnitSource` references with live identity and `Is.PC` / `Is.Self`
|
|
25
|
+
predicates, accepted by class, spec, aura, and resource sources.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Resource and aura constructors accept shared `UnitSource` references while
|
|
30
|
+
retaining support for string unit arguments.
|
|
31
|
+
|
|
32
|
+
### Validation and limitations
|
|
33
|
+
|
|
34
|
+
- Mocked Lua tests cover aura ownership and restrictions, solo/party/raid
|
|
35
|
+
membership, shared unit identity, and inspect responses after target changes.
|
|
36
|
+
- Forever aura and inspect capabilities still require in-game validation.
|
|
37
|
+
Inspect is explicit, combat-restricted, and not automatically queued or retried.
|
|
38
|
+
|
|
39
|
+
## 0.1.2 — 2026-10-14
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- A public `Cell` type shared with the mounting API.
|
|
44
|
+
- Support for `wuira.Mount` callbacks returning `void`, allowing addons without
|
|
45
|
+
a visual tree to initialize without an empty JSX fragment.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- Importing `wuira` automatically installs the global WoW console polyfill.
|
|
50
|
+
- The addon template logs its startup message without creating a visual tree.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Shared TypeScript configuration explicitly uses Node16 module resolution,
|
|
55
|
+
allowing package imports and their generated declarations to resolve.
|
|
56
|
+
- Global console declarations load through the shared configuration without
|
|
57
|
+
requiring DOM typings or an explicit polyfill import in application code.
|
|
58
|
+
|
|
59
|
+
## 0.1.1 — 2026-10-14
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- Public package imports: `wuira`, `wuira/ui`, and `wuira/datasources`.
|
|
64
|
+
- Generated Lua modules and TypeScript declarations distributed in `lib/`.
|
|
65
|
+
- Shared compiler configuration through `wuira/config/tsconfig.json`.
|
|
66
|
+
- Project templates maintained under `templates/addon/`.
|
|
67
|
+
- `wuira.config.mjs` for addon names and relative or absolute output paths.
|
|
68
|
+
- Standalone addon output containing its TOC and required Lua modules.
|
|
69
|
+
- GitHub Actions CI for Linux and Windows and tag-triggered npm publishing.
|
|
70
|
+
- English documentation with component and CLI examples.
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
|
|
74
|
+
- Standardized framework, CLI, configuration, and API names to `wuira`.
|
|
75
|
+
- Converted CLI and build tooling to ESM `.mjs` files.
|
|
76
|
+
- Framework sources and build scripts are no longer copied into generated
|
|
77
|
+
projects; they consume the installed npm package.
|
|
78
|
+
|
|
79
|
+
### Removed
|
|
80
|
+
|
|
81
|
+
- The framework repository's playable addon entry, TOC, and PlayerFrame
|
|
82
|
+
playground. Addon entries are generated in consumer projects instead.
|
|
83
|
+
|
|
84
|
+
## 0.1.0 — 2026-10-14
|
|
85
|
+
|
|
86
|
+
### Added
|
|
87
|
+
|
|
88
|
+
- Initial public npm release with `wuira create` and `wuira build` commands.
|
|
89
|
+
- TypeScriptToLua compilation with separate Lua modules and a WoW module loader.
|
|
90
|
+
- JSX Cells, flow and grid layouts, and native StatusBar progress bars.
|
|
91
|
+
- Background, border, texture, and glow decorations.
|
|
92
|
+
- Health and mana data sources and a local WoW console polyfill.
|
|
93
|
+
- MIT license and addon project scaffolding.
|
package/README.md
CHANGED
|
@@ -94,6 +94,92 @@ function App() {
|
|
|
94
94
|
wuira.Mount(App);
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
### Group members
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { GroupMembers, PartyMembers, RaidMembers, Buffs } from "wuira/datasources";
|
|
101
|
+
|
|
102
|
+
const group = new GroupMembers();
|
|
103
|
+
for (const unit of group.Value) {
|
|
104
|
+
const buffs = new Buffs(unit);
|
|
105
|
+
// Apply your own buff-tracking rules to buffs.Value when readable.
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const party = new PartyMembers();
|
|
109
|
+
const raid = new RaidMembers();
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`GroupMembers` returns `["player"]` while solo, `player` plus `partyN` tokens
|
|
113
|
+
in a party, and `raidN` tokens in a raid. `PartyMembers` is empty outside a
|
|
114
|
+
party; `RaidMembers` is empty outside a raid. The player is included once.
|
|
115
|
+
Offline members are retained. Each `.Value` access reads the current roster;
|
|
116
|
+
there is no automatic subscription, polling, or UI rerender. Read again when
|
|
117
|
+
handling `GROUP_ROSTER_UPDATE`. Tokens may refer to different members after
|
|
118
|
+
roster changes and should not be used as persistent identities.
|
|
119
|
+
|
|
120
|
+
### Player class and specialization
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import { UnitSource, ClassSource, SpecSource, Unit } from "wuira/datasources";
|
|
124
|
+
|
|
125
|
+
const target = new UnitSource(Unit.Target);
|
|
126
|
+
const playerClass = new ClassSource(target);
|
|
127
|
+
const specs = new SpecSource(target);
|
|
128
|
+
|
|
129
|
+
console.log(target.Is.PC); // boolean | undefined when restricted
|
|
130
|
+
console.log(playerClass.Value?.token);
|
|
131
|
+
specs.RequestInspect();
|
|
132
|
+
// Later, after INSPECT_READY: specs.Value contains native specialization data.
|
|
133
|
+
// Each entry exposes id, name, icon, role, and pointsSpent when provided.
|
|
134
|
+
// Call specs.Dispose() when the owning feature is removed or cancels the request.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
These sources accept real players only; NPCs produce no data or inspect request.
|
|
138
|
+
The same `UnitSource` can be passed to `Buffs`, `Debuffs`, `HP`, and `Mana`.
|
|
139
|
+
Its `Value` contains the current token and GUID, rather than a cached identity.
|
|
140
|
+
`Is.PC` and `Is.Self` return `undefined` when their native result is secret.
|
|
141
|
+
String unit tokens are still supported as a convenience shorthand.
|
|
142
|
+
Own specialization data is read directly. Other players require an explicit,
|
|
143
|
+
out-of-combat inspect request and a matching response GUID. An unknown result
|
|
144
|
+
remains `undefined`, and a changed unit token cannot expose another player's
|
|
145
|
+
cached result. Secret values are guarded by the datasource API. Requests are
|
|
146
|
+
not globally queued or automatically retried; callers own cancellation and
|
|
147
|
+
request timing. Inspect permission, range, hostile-player support, and the
|
|
148
|
+
meaning of talent-point fields must be verified on Forever. Being a player
|
|
149
|
+
does not by itself guarantee inspect access.
|
|
150
|
+
|
|
151
|
+
### Aura ownership
|
|
152
|
+
|
|
153
|
+
Buff and debuff sources expose fresh snapshots with caster information. Application
|
|
154
|
+
code decides which blessings or other effects should be displayed.
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { Buffs, Debuffs, Unit } from "wuira/datasources";
|
|
158
|
+
|
|
159
|
+
const buffs = new Buffs(Unit.Target);
|
|
160
|
+
const debuffs = new Debuffs(Unit.Target);
|
|
161
|
+
|
|
162
|
+
buffs.Compute(auras => {
|
|
163
|
+
for (const aura of auras) {
|
|
164
|
+
if (aura.isSourceSelf() === true) {
|
|
165
|
+
console.log(aura.name, "applied by me");
|
|
166
|
+
} else if (aura.isSourceSelf() === false) {
|
|
167
|
+
console.log(aura.name, "applied by", aura.sourceUnit);
|
|
168
|
+
}
|
|
169
|
+
// undefined means ownership is unknown, not that another player cast it.
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`sourceStatus` is `known`, `unknown`, or `restricted`. Restricted caster values
|
|
175
|
+
are not exposed. Secret spell/name/icon data blocks `.Value` and `.Compute` through
|
|
176
|
+
the normal datasource guard; `.IsSecret()` reports it. Missing native API support
|
|
177
|
+
raises an explicit error instead of returning an apparently empty list. Reads do
|
|
178
|
+
not install event listeners or poll automatically. The current adapter requires
|
|
179
|
+
`C_UnitAuras.GetAuraDataByIndex`; Forever availability and restrictions still need
|
|
180
|
+
in-game verification. Unit tokens refer to snapshot time and are not persistent
|
|
181
|
+
caster identities. No Paladin-specific spell catalog or filtering is built in.
|
|
182
|
+
|
|
97
183
|
### Visual styling
|
|
98
184
|
|
|
99
185
|
<!-- Screenshot: a dark Cell with a thin colored border. -->
|
|
@@ -195,6 +281,8 @@ An empty fragment creates no native frame. Only empty fragments are currently su
|
|
|
195
281
|
|
|
196
282
|
`console.log/info/warn/error` use a global WoW console polyfill. Output goes to the local chat window, never to other players. The addon uses no Node.js runtime or stdin/stdout. `console.error` does not throw. Arguments are formatted with Lua `tostring`; objects are not deeply inspected. The CLI uses its own Node.js terminal console.
|
|
197
283
|
|
|
284
|
+
Importing `wuira` installs the global console polyfill automatically. The shared TypeScript config loads its global declarations and uses Node16 module resolution for package exports; DOM typings are not required. `wuira.Mount` accepts a `Cell`, no value, or a function returning `Cell | void`, so addons without a visual tree can simply log and return.
|
|
285
|
+
|
|
198
286
|
## Build and distribution
|
|
199
287
|
|
|
200
288
|
`wuira build` transpiles through `tsconfig.json`. It writes a standalone addon directory containing individual Lua modules, a loader, a startup file, and `<addonName>.toc`. The default output directory is `dist/`. The addon name lives in `wuira.config.mjs`; Interface version and other metadata live in `addon.toc.in`. The default Interface version, 16001, targets the Forever playground.
|
|
@@ -238,6 +326,9 @@ Licensed under MIT; see [LICENSE](LICENSE).
|
|
|
238
326
|
|
|
239
327
|
## Releases
|
|
240
328
|
|
|
329
|
+
See [CHANGELOG.md](CHANGELOG.md) for release history. Record new changes under
|
|
330
|
+
`Unreleased`, then move them into a dated version section before publishing.
|
|
331
|
+
|
|
241
332
|
The first version is published. To publish the next version locally, validate the project, increment the patch version, and publish:
|
|
242
333
|
|
|
243
334
|
```sh
|
package/config/tsconfig.json
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/TypeScriptToLua/TypeScriptToLua/master/tsconfig-schema.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "ESNext",
|
|
5
|
+
"module": "Node16",
|
|
6
|
+
"moduleResolution": "Node16",
|
|
5
7
|
"lib": [
|
|
6
8
|
"ESNext"
|
|
7
9
|
],
|
|
8
|
-
"types": [],
|
|
10
|
+
"types": ["wuira/console-polyfill"],
|
|
9
11
|
"jsx": "react",
|
|
10
12
|
"jsxFactory": "UI.createElement",
|
|
11
13
|
"jsxFragmentFactory": "UI.Fragment",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DataSource } from "./DataSource";
|
|
2
|
+
import { UnitSource } from "./UnitSource";
|
|
3
|
+
import type { UnitInput } from "./UnitSource";
|
|
4
|
+
export type AuraSourceStatus = "known" | "unknown" | "restricted";
|
|
5
|
+
/** Readable aura snapshot. Unit tokens describe the source at snapshot time. */
|
|
6
|
+
export declare class Aura {
|
|
7
|
+
readonly spellId: number;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly icon: number;
|
|
10
|
+
readonly sourceUnit: string | undefined;
|
|
11
|
+
readonly sourceStatus: AuraSourceStatus;
|
|
12
|
+
private readonly sourceSelf;
|
|
13
|
+
constructor(spellId: number, name: string, icon: number, sourceUnit: string | undefined, sourceStatus: AuraSourceStatus, sourceSelf: boolean | undefined);
|
|
14
|
+
/** Undefined means ownership could not be established; it does not mean another caster. */
|
|
15
|
+
isSourceSelf(): boolean | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** Reads a fresh snapshot on access; it does not install listeners or poll. */
|
|
18
|
+
export declare abstract class AuraSource extends DataSource<readonly Aura[]> {
|
|
19
|
+
private readonly filter;
|
|
20
|
+
private restricted;
|
|
21
|
+
readonly target: UnitSource;
|
|
22
|
+
protected constructor(unit: UnitInput, filter: "HELPFUL" | "HARMFUL");
|
|
23
|
+
get unit(): string;
|
|
24
|
+
protected HasSecretFields(): boolean;
|
|
25
|
+
protected GetValue(): readonly Aura[];
|
|
26
|
+
}
|
|
27
|
+
export declare class Buffs extends AuraSource {
|
|
28
|
+
constructor(unit: UnitInput);
|
|
29
|
+
}
|
|
30
|
+
export declare class Debuffs extends AuraSource {
|
|
31
|
+
constructor(unit: UnitInput);
|
|
32
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
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 ____DataSource = require("datasources.DataSource")
|
|
181
|
+
local DataSource = ____DataSource.DataSource
|
|
182
|
+
local ____UnitSource = require("datasources.UnitSource")
|
|
183
|
+
local resolveUnit = ____UnitSource.resolveUnit
|
|
184
|
+
--- Readable aura snapshot. Unit tokens describe the source at snapshot time.
|
|
185
|
+
____exports.Aura = __TS__Class()
|
|
186
|
+
local Aura = ____exports.Aura
|
|
187
|
+
Aura.name = "Aura"
|
|
188
|
+
function Aura.prototype.____constructor(self, spellId, name, icon, sourceUnit, sourceStatus, sourceSelf)
|
|
189
|
+
self.spellId = spellId
|
|
190
|
+
self.name = name
|
|
191
|
+
self.icon = icon
|
|
192
|
+
self.sourceUnit = sourceUnit
|
|
193
|
+
self.sourceStatus = sourceStatus
|
|
194
|
+
self.sourceSelf = sourceSelf
|
|
195
|
+
end
|
|
196
|
+
function Aura.prototype.isSourceSelf(self)
|
|
197
|
+
return self.sourceSelf
|
|
198
|
+
end
|
|
199
|
+
--- Reads a fresh snapshot on access; it does not install listeners or poll.
|
|
200
|
+
____exports.AuraSource = __TS__Class()
|
|
201
|
+
local AuraSource = ____exports.AuraSource
|
|
202
|
+
AuraSource.name = "AuraSource"
|
|
203
|
+
__TS__ClassExtends(AuraSource, DataSource)
|
|
204
|
+
function AuraSource.prototype.____constructor(self, unit, filter)
|
|
205
|
+
DataSource.prototype.____constructor(self, {})
|
|
206
|
+
self.filter = filter
|
|
207
|
+
self.restricted = false
|
|
208
|
+
self.target = resolveUnit(nil, unit)
|
|
209
|
+
end
|
|
210
|
+
function AuraSource.prototype.HasSecretFields(self)
|
|
211
|
+
return self.restricted
|
|
212
|
+
end
|
|
213
|
+
function AuraSource.prototype.GetValue(self)
|
|
214
|
+
self.restricted = false
|
|
215
|
+
local read = C_UnitAuras and C_UnitAuras.GetAuraDataByIndex
|
|
216
|
+
if read == nil then
|
|
217
|
+
error("AuraSource: this client does not expose C_UnitAuras.GetAuraDataByIndex")
|
|
218
|
+
end
|
|
219
|
+
local result = {}
|
|
220
|
+
do
|
|
221
|
+
local index = 1
|
|
222
|
+
while index <= 1024 do
|
|
223
|
+
local raw = read(self.unit, index, self.filter)
|
|
224
|
+
if issecretvalue(raw) then
|
|
225
|
+
self.restricted = true
|
|
226
|
+
return {}
|
|
227
|
+
end
|
|
228
|
+
if raw == nil then
|
|
229
|
+
return result
|
|
230
|
+
end
|
|
231
|
+
if issecretvalue(raw.spellId) or issecretvalue(raw.name) or issecretvalue(raw.icon) then
|
|
232
|
+
self.restricted = true
|
|
233
|
+
return {}
|
|
234
|
+
end
|
|
235
|
+
local sourceUnit
|
|
236
|
+
local sourceSelf
|
|
237
|
+
local status = "unknown"
|
|
238
|
+
if issecretvalue(raw.sourceUnit) then
|
|
239
|
+
status = "restricted"
|
|
240
|
+
elseif raw.sourceUnit ~= nil then
|
|
241
|
+
sourceUnit = raw.sourceUnit
|
|
242
|
+
status = "known"
|
|
243
|
+
local ____self = UnitIsUnit(sourceUnit, "player")
|
|
244
|
+
if not issecretvalue(____self) then
|
|
245
|
+
sourceSelf = ____self
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
result[#result + 1] = __TS__New(
|
|
249
|
+
____exports.Aura,
|
|
250
|
+
raw.spellId,
|
|
251
|
+
raw.name,
|
|
252
|
+
raw.icon,
|
|
253
|
+
sourceUnit,
|
|
254
|
+
status,
|
|
255
|
+
sourceSelf
|
|
256
|
+
)
|
|
257
|
+
index = index + 1
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
error("AuraSource: aura enumeration exceeded its safety limit")
|
|
261
|
+
end
|
|
262
|
+
__TS__SetDescriptor(
|
|
263
|
+
AuraSource.prototype,
|
|
264
|
+
"unit",
|
|
265
|
+
{get = function(self)
|
|
266
|
+
return self.target.Token
|
|
267
|
+
end},
|
|
268
|
+
true
|
|
269
|
+
)
|
|
270
|
+
____exports.Buffs = __TS__Class()
|
|
271
|
+
local Buffs = ____exports.Buffs
|
|
272
|
+
Buffs.name = "Buffs"
|
|
273
|
+
__TS__ClassExtends(Buffs, ____exports.AuraSource)
|
|
274
|
+
function Buffs.prototype.____constructor(self, unit)
|
|
275
|
+
Buffs.____super.prototype.____constructor(self, unit, "HELPFUL")
|
|
276
|
+
end
|
|
277
|
+
____exports.Debuffs = __TS__Class()
|
|
278
|
+
local Debuffs = ____exports.Debuffs
|
|
279
|
+
Debuffs.name = "Debuffs"
|
|
280
|
+
__TS__ClassExtends(Debuffs, ____exports.AuraSource)
|
|
281
|
+
function Debuffs.prototype.____constructor(self, unit)
|
|
282
|
+
Debuffs.____super.prototype.____constructor(self, unit, "HARMFUL")
|
|
283
|
+
end
|
|
284
|
+
return ____exports
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataSource } from "./DataSource";
|
|
2
|
+
export type GroupScope = "auto" | "party" | "raid";
|
|
3
|
+
/** Fresh roster tokens, including offline members. Tokens are not persistent identities. */
|
|
4
|
+
export declare class GroupMembers extends DataSource<readonly string[]> {
|
|
5
|
+
readonly scope: GroupScope;
|
|
6
|
+
private restricted;
|
|
7
|
+
constructor(scope?: GroupScope);
|
|
8
|
+
protected HasSecretFields(): boolean;
|
|
9
|
+
protected GetValue(): readonly string[];
|
|
10
|
+
}
|
|
11
|
+
/** Includes the player in a party; empty when solo or in a raid. */
|
|
12
|
+
export declare class PartyMembers extends GroupMembers {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
/** Includes the player through their raidN token; empty outside a raid. */
|
|
16
|
+
export declare class RaidMembers extends GroupMembers {
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
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__NumberIsFinite(value)
|
|
36
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local function __TS__NumberIsInteger(value)
|
|
40
|
+
return __TS__NumberIsFinite(value) and math.floor(value) == value
|
|
41
|
+
end
|
|
42
|
+
-- End of Lua Library inline imports
|
|
43
|
+
local ____exports = {}
|
|
44
|
+
local ____DataSource = require("datasources.DataSource")
|
|
45
|
+
local DataSource = ____DataSource.DataSource
|
|
46
|
+
--- Fresh roster tokens, including offline members. Tokens are not persistent identities.
|
|
47
|
+
____exports.GroupMembers = __TS__Class()
|
|
48
|
+
local GroupMembers = ____exports.GroupMembers
|
|
49
|
+
GroupMembers.name = "GroupMembers"
|
|
50
|
+
__TS__ClassExtends(GroupMembers, DataSource)
|
|
51
|
+
function GroupMembers.prototype.____constructor(self, scope)
|
|
52
|
+
if scope == nil then
|
|
53
|
+
scope = "auto"
|
|
54
|
+
end
|
|
55
|
+
DataSource.prototype.____constructor(self, {})
|
|
56
|
+
self.scope = scope
|
|
57
|
+
self.restricted = false
|
|
58
|
+
end
|
|
59
|
+
function GroupMembers.prototype.HasSecretFields(self)
|
|
60
|
+
return self.restricted
|
|
61
|
+
end
|
|
62
|
+
function GroupMembers.prototype.GetValue(self)
|
|
63
|
+
self.restricted = false
|
|
64
|
+
if IsInRaid == nil or GetNumGroupMembers == nil then
|
|
65
|
+
error("GroupMembers: this client does not expose the required group APIs")
|
|
66
|
+
end
|
|
67
|
+
local raid = IsInRaid()
|
|
68
|
+
local count = GetNumGroupMembers()
|
|
69
|
+
if issecretvalue(raid) or issecretvalue(count) then
|
|
70
|
+
self.restricted = true
|
|
71
|
+
return {}
|
|
72
|
+
end
|
|
73
|
+
if not __TS__NumberIsInteger(count) or count < 0 or count > 1024 then
|
|
74
|
+
error("GroupMembers: invalid group member count")
|
|
75
|
+
end
|
|
76
|
+
if raid then
|
|
77
|
+
if self.scope == "party" then
|
|
78
|
+
return {}
|
|
79
|
+
end
|
|
80
|
+
local units = {}
|
|
81
|
+
do
|
|
82
|
+
local index = 1
|
|
83
|
+
while index <= count do
|
|
84
|
+
units[#units + 1] = "raid" .. tostring(index)
|
|
85
|
+
index = index + 1
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
return units
|
|
89
|
+
end
|
|
90
|
+
if self.scope == "raid" then
|
|
91
|
+
return {}
|
|
92
|
+
end
|
|
93
|
+
if count == 0 then
|
|
94
|
+
return self.scope == "auto" and ({"player"}) or ({})
|
|
95
|
+
end
|
|
96
|
+
local units = {"player"}
|
|
97
|
+
do
|
|
98
|
+
local index = 1
|
|
99
|
+
while index < count do
|
|
100
|
+
units[#units + 1] = "party" .. tostring(index)
|
|
101
|
+
index = index + 1
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
return units
|
|
105
|
+
end
|
|
106
|
+
--- Includes the player in a party; empty when solo or in a raid.
|
|
107
|
+
____exports.PartyMembers = __TS__Class()
|
|
108
|
+
local PartyMembers = ____exports.PartyMembers
|
|
109
|
+
PartyMembers.name = "PartyMembers"
|
|
110
|
+
__TS__ClassExtends(PartyMembers, ____exports.GroupMembers)
|
|
111
|
+
function PartyMembers.prototype.____constructor(self)
|
|
112
|
+
PartyMembers.____super.prototype.____constructor(self, "party")
|
|
113
|
+
end
|
|
114
|
+
--- Includes the player through their raidN token; empty outside a raid.
|
|
115
|
+
____exports.RaidMembers = __TS__Class()
|
|
116
|
+
local RaidMembers = ____exports.RaidMembers
|
|
117
|
+
RaidMembers.name = "RaidMembers"
|
|
118
|
+
__TS__ClassExtends(RaidMembers, ____exports.GroupMembers)
|
|
119
|
+
function RaidMembers.prototype.____constructor(self)
|
|
120
|
+
RaidMembers.____super.prototype.____constructor(self, "raid")
|
|
121
|
+
end
|
|
122
|
+
return ____exports
|