lycheedev 1.0.0 → 1.0.1
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/bin/lycheedev.js +21 -6
- package/package.json +1 -1
- package/vendor/addon/Core/Bootstrap.lua +131 -131
- package/vendor/addon/Core/Clients/Mainline.lua +9 -9
- package/vendor/addon/Core/Clients/Mists.lua +9 -9
- package/vendor/addon/Core/Clients/Titan.lua +9 -9
- package/vendor/addon/Core/Compatibility.lua +43 -43
- package/vendor/addon/Core/Database.lua +859 -859
- package/vendor/addon/Core/Inspector.lua +647 -647
- package/vendor/addon/Core/Locale.lua +307 -307
- package/vendor/addon/Core/Locale_enUS.lua +318 -318
- package/vendor/addon/Core/Safety.lua +42 -42
- package/vendor/addon/Core/Serializer.lua +324 -324
- package/vendor/addon/Libs/AutomationQR.lua +1176 -1176
- package/vendor/addon/Lychee Dev_Mainline.toc +43 -43
- package/vendor/addon/Lychee Dev_Mists.toc +43 -43
- package/vendor/addon/Lychee Dev_Wrath.toc +43 -43
- package/vendor/addon/Modules/Automation/Controller.lua +757 -757
- package/vendor/addon/Modules/Automation/Report.lua +409 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +12 -12
- package/vendor/addon/Modules/Diagnostics.lua +238 -238
- package/vendor/addon/Modules/Events/Catalog.lua +184 -184
- package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -1788
- package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -1489
- package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -1492
- package/vendor/addon/Modules/Events/Monitor.lua +181 -181
- package/vendor/addon/Modules/FunctionTrace.lua +85 -85
- package/vendor/addon/Modules/ObjectInspector.lua +329 -329
- package/vendor/addon/UI/AutomationOverlay.lua +183 -183
- package/vendor/addon/UI/Export.lua +140 -140
- package/vendor/addon/UI/Features.lua +890 -890
- package/vendor/addon/UI/MainWindow.lua +1145 -1145
- package/vendor/addon/UI/Pages/About.lua +223 -223
- package/vendor/addon/UI/Pages/Automation.lua +417 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +289 -289
- package/vendor/addon/UI/Pages/ExportRecords.lua +387 -387
- package/vendor/addon/UI/Pages/Object.lua +573 -573
- package/vendor/addon/UI/Pages/Trace.lua +165 -165
- package/vendor/skill/SKILL.md +94 -94
- package/vendor/skill/agents/openai.yaml +4 -4
- package/vendor/skill/references/automation.md +327 -327
- package/vendor/skill/references/runtime-investigations.md +97 -97
- package/vendor/skill/scripts/automation/__init__.py +1 -1
- package/vendor/skill/scripts/automation/registry.py +516 -516
- package/vendor/skill/scripts/automation/saved_variables.py +438 -438
- package/vendor/skill/scripts/automation/session.py +207 -207
- package/vendor/skill/scripts/automation/windows.py +573 -573
- package/vendor/skill/scripts/automation.py +865 -865
- package/vendor/skill/scripts/requirements.txt +13 -13
- package/vendor/skill/scripts/selftest_offline.py +981 -981
package/bin/lycheedev.js
CHANGED
|
@@ -174,7 +174,9 @@ function main(argv) {
|
|
|
174
174
|
|
|
175
175
|
const forwarded = [];
|
|
176
176
|
const client = target.client || {};
|
|
177
|
-
|
|
177
|
+
// The python helper wants the installed addon directory itself, not the
|
|
178
|
+
// AddOns folder that contains it.
|
|
179
|
+
if (client.addonsDir) forwarded.push('--install-dir', path.join(client.addonsDir, addonFolderName));
|
|
178
180
|
|
|
179
181
|
switch (command) {
|
|
180
182
|
case 'send': {
|
|
@@ -237,11 +239,12 @@ function main(argv) {
|
|
|
237
239
|
|
|
238
240
|
function passthrough(all) {
|
|
239
241
|
const out = [];
|
|
242
|
+
// These are either handled by the wrapper itself or are global python
|
|
243
|
+
// options that `forward()` places before the subcommand.
|
|
244
|
+
const handled = ['wow-root', 'client', 'python', 'force', 'reset-registry', 'task', 'count',
|
|
245
|
+
'ticket', 'status', 'json', 'help', 'version', 'data-dir', 'installation'];
|
|
240
246
|
for (const [name, value] of Object.entries(all)) {
|
|
241
|
-
if (
|
|
242
|
-
'ticket', 'status', 'json', 'help', 'version'].includes(name)) {
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
247
|
+
if (handled.includes(name)) continue;
|
|
245
248
|
if (value === true) out.push(`--${name}`);
|
|
246
249
|
else out.push(`--${name}`, String(value));
|
|
247
250
|
}
|
|
@@ -249,7 +252,19 @@ function main(argv) {
|
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
function forward(args) {
|
|
252
|
-
|
|
255
|
+
// `--data-dir` and `--installation` are global options of the python helper,
|
|
256
|
+
// so they must precede the subcommand or argparse rejects them. Everything
|
|
257
|
+
// else stays where the caller put it.
|
|
258
|
+
const globals = [];
|
|
259
|
+
if (flags['data-dir']) globals.push('--data-dir', String(flags['data-dir']));
|
|
260
|
+
if (flags.installation) globals.push('--installation', String(flags.installation));
|
|
261
|
+
const finalArgs = [...globals, ...args];
|
|
262
|
+
if (process.env.LYCHEEDEV_DEBUG) {
|
|
263
|
+
console.error(`[debug] python automation.py ${finalArgs.join(' ')}`);
|
|
264
|
+
}
|
|
265
|
+
const result = runAutomation(finalArgs, {
|
|
266
|
+
pythonBin: flags.python || (target.config || {}).pythonBin,
|
|
267
|
+
});
|
|
253
268
|
return typeof result.status === 'number' ? result.status : 1;
|
|
254
269
|
}
|
|
255
270
|
}
|
package/package.json
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
local MAX_CAPTURE_BYTES = 44000
|
|
5
|
-
|
|
6
|
-
local function AddOutput(output, text)
|
|
7
|
-
if output.truncated then
|
|
8
|
-
return
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
text = tostring(text or "")
|
|
12
|
-
local prefix = #output.parts > 0 and "\n" or ""
|
|
13
|
-
local remaining = MAX_CAPTURE_BYTES - output.length - #prefix
|
|
14
|
-
if #text > remaining then
|
|
15
|
-
output.parts[#output.parts + 1] = prefix
|
|
16
|
-
.. text:sub(1, math.max(0, remaining))
|
|
17
|
-
.. "\n... <output truncated>"
|
|
18
|
-
output.truncated = true
|
|
19
|
-
output.length = output.length + #output.parts[#output.parts]
|
|
20
|
-
return
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
output.parts[#output.parts + 1] = prefix .. text
|
|
24
|
-
output.length = output.length + #prefix + #text
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
local function NormalizeCode(code)
|
|
28
|
-
code = type(code) == "string" and code or ""
|
|
29
|
-
code = code:gsub("^%s+", ""):gsub("%s+$", "")
|
|
30
|
-
|
|
31
|
-
local prefixEnd = code:match("^/[Rr][Uu][Nn]%s+()")
|
|
32
|
-
or code:match("^/[Ss][Cc][Rr][Ii][Pp][Tt]%s+()")
|
|
33
|
-
if prefixEnd then
|
|
34
|
-
code = code:sub(prefixEnd)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
return code
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
local function BuildEnvironment(output)
|
|
41
|
-
local environment = {}
|
|
42
|
-
|
|
43
|
-
environment.print = function(...)
|
|
44
|
-
local values = { n = select("#", ...), ... }
|
|
45
|
-
local parts = {}
|
|
46
|
-
for index = 1, values.n do
|
|
47
|
-
if issecretvalue and issecretvalue(values[index]) then
|
|
48
|
-
parts[index] = "<secret>"
|
|
49
|
-
else
|
|
50
|
-
parts[index] = tostring(values[index])
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
AddOutput(output, table.concat(parts, " "))
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
environment.dump = function(value)
|
|
57
|
-
AddOutput(output, ns.Serialize(value))
|
|
58
|
-
return value
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
setmetatable(environment, { __index = _G, __newindex = _G })
|
|
62
|
-
return environment
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
local function Pack(...)
|
|
66
|
-
return { n = select("#", ...), ... }
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
function ns.Execute(code)
|
|
70
|
-
if ns.IsCombatBlocked() then
|
|
71
|
-
return false, ns.L.COMBAT_BLOCKED, ""
|
|
72
|
-
end
|
|
73
|
-
code = NormalizeCode(code)
|
|
74
|
-
if code == "" then
|
|
75
|
-
return false, L.ENTER_LUA, code
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
local output = {
|
|
79
|
-
parts = {},
|
|
80
|
-
length = 0,
|
|
81
|
-
truncated = false,
|
|
82
|
-
}
|
|
83
|
-
local chunk, compileError = loadstring(code, "LycheeDevInput")
|
|
84
|
-
if not chunk then
|
|
85
|
-
return false, L.COMPILE_ERROR .. tostring(compileError), code
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
setfenv(chunk, BuildEnvironment(output))
|
|
89
|
-
|
|
90
|
-
local packed = Pack(pcall(chunk))
|
|
91
|
-
local succeeded = packed[1]
|
|
92
|
-
|
|
93
|
-
if not succeeded then
|
|
94
|
-
AddOutput(output, L.RUNTIME_ERROR .. tostring(packed[2]))
|
|
95
|
-
return false, table.concat(output.parts), code
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
local values = { n = packed.n - 1 }
|
|
99
|
-
for index = 2, packed.n do
|
|
100
|
-
values[index - 1] = packed[index]
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
if values.n > 0 then
|
|
104
|
-
AddOutput(output, ns.SerializeValues(values))
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
if #output.parts == 0 then
|
|
108
|
-
AddOutput(output, L.COMPLETED_NO_OUTPUT)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
return true, table.concat(output.parts), code, ns.CreateValueTree(values), ns.CreateStoredValueTree(values)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
SLASH_LYCHEEDEV1 = "/dev"
|
|
115
|
-
SlashCmdList.LYCHEEDEV = function(message)
|
|
116
|
-
local text = tostring(message or "")
|
|
117
|
-
local action = text:match("^(%S+)")
|
|
118
|
-
if action and action:lower() == "auto" then
|
|
119
|
-
if ns.Automation and ns.Automation.HandleCommand then
|
|
120
|
-
ns.Automation.HandleCommand(text:match("^%S+%s*(.-)%s*$") or "")
|
|
121
|
-
end
|
|
122
|
-
return
|
|
123
|
-
end
|
|
124
|
-
if ns.IsCombatBlocked() then
|
|
125
|
-
ns.PrintCombatBlocked()
|
|
126
|
-
return
|
|
127
|
-
end
|
|
128
|
-
ns.EnsureSafety()
|
|
129
|
-
ns.InitializeDatabase()
|
|
130
|
-
ns.ToggleWindow()
|
|
131
|
-
end
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
local MAX_CAPTURE_BYTES = 44000
|
|
5
|
+
|
|
6
|
+
local function AddOutput(output, text)
|
|
7
|
+
if output.truncated then
|
|
8
|
+
return
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
text = tostring(text or "")
|
|
12
|
+
local prefix = #output.parts > 0 and "\n" or ""
|
|
13
|
+
local remaining = MAX_CAPTURE_BYTES - output.length - #prefix
|
|
14
|
+
if #text > remaining then
|
|
15
|
+
output.parts[#output.parts + 1] = prefix
|
|
16
|
+
.. text:sub(1, math.max(0, remaining))
|
|
17
|
+
.. "\n... <output truncated>"
|
|
18
|
+
output.truncated = true
|
|
19
|
+
output.length = output.length + #output.parts[#output.parts]
|
|
20
|
+
return
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
output.parts[#output.parts + 1] = prefix .. text
|
|
24
|
+
output.length = output.length + #prefix + #text
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
local function NormalizeCode(code)
|
|
28
|
+
code = type(code) == "string" and code or ""
|
|
29
|
+
code = code:gsub("^%s+", ""):gsub("%s+$", "")
|
|
30
|
+
|
|
31
|
+
local prefixEnd = code:match("^/[Rr][Uu][Nn]%s+()")
|
|
32
|
+
or code:match("^/[Ss][Cc][Rr][Ii][Pp][Tt]%s+()")
|
|
33
|
+
if prefixEnd then
|
|
34
|
+
code = code:sub(prefixEnd)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
return code
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
local function BuildEnvironment(output)
|
|
41
|
+
local environment = {}
|
|
42
|
+
|
|
43
|
+
environment.print = function(...)
|
|
44
|
+
local values = { n = select("#", ...), ... }
|
|
45
|
+
local parts = {}
|
|
46
|
+
for index = 1, values.n do
|
|
47
|
+
if issecretvalue and issecretvalue(values[index]) then
|
|
48
|
+
parts[index] = "<secret>"
|
|
49
|
+
else
|
|
50
|
+
parts[index] = tostring(values[index])
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
AddOutput(output, table.concat(parts, " "))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
environment.dump = function(value)
|
|
57
|
+
AddOutput(output, ns.Serialize(value))
|
|
58
|
+
return value
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
setmetatable(environment, { __index = _G, __newindex = _G })
|
|
62
|
+
return environment
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
local function Pack(...)
|
|
66
|
+
return { n = select("#", ...), ... }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
function ns.Execute(code)
|
|
70
|
+
if ns.IsCombatBlocked() then
|
|
71
|
+
return false, ns.L.COMBAT_BLOCKED, ""
|
|
72
|
+
end
|
|
73
|
+
code = NormalizeCode(code)
|
|
74
|
+
if code == "" then
|
|
75
|
+
return false, L.ENTER_LUA, code
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
local output = {
|
|
79
|
+
parts = {},
|
|
80
|
+
length = 0,
|
|
81
|
+
truncated = false,
|
|
82
|
+
}
|
|
83
|
+
local chunk, compileError = loadstring(code, "LycheeDevInput")
|
|
84
|
+
if not chunk then
|
|
85
|
+
return false, L.COMPILE_ERROR .. tostring(compileError), code
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
setfenv(chunk, BuildEnvironment(output))
|
|
89
|
+
|
|
90
|
+
local packed = Pack(pcall(chunk))
|
|
91
|
+
local succeeded = packed[1]
|
|
92
|
+
|
|
93
|
+
if not succeeded then
|
|
94
|
+
AddOutput(output, L.RUNTIME_ERROR .. tostring(packed[2]))
|
|
95
|
+
return false, table.concat(output.parts), code
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
local values = { n = packed.n - 1 }
|
|
99
|
+
for index = 2, packed.n do
|
|
100
|
+
values[index - 1] = packed[index]
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if values.n > 0 then
|
|
104
|
+
AddOutput(output, ns.SerializeValues(values))
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if #output.parts == 0 then
|
|
108
|
+
AddOutput(output, L.COMPLETED_NO_OUTPUT)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
return true, table.concat(output.parts), code, ns.CreateValueTree(values), ns.CreateStoredValueTree(values)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
SLASH_LYCHEEDEV1 = "/dev"
|
|
115
|
+
SlashCmdList.LYCHEEDEV = function(message)
|
|
116
|
+
local text = tostring(message or "")
|
|
117
|
+
local action = text:match("^(%S+)")
|
|
118
|
+
if action and action:lower() == "auto" then
|
|
119
|
+
if ns.Automation and ns.Automation.HandleCommand then
|
|
120
|
+
ns.Automation.HandleCommand(text:match("^%S+%s*(.-)%s*$") or "")
|
|
121
|
+
end
|
|
122
|
+
return
|
|
123
|
+
end
|
|
124
|
+
if ns.IsCombatBlocked() then
|
|
125
|
+
ns.PrintCombatBlocked()
|
|
126
|
+
return
|
|
127
|
+
end
|
|
128
|
+
ns.EnsureSafety()
|
|
129
|
+
ns.InitializeDatabase()
|
|
130
|
+
ns.ToggleWindow()
|
|
131
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
|
|
3
|
-
ns.Client = {
|
|
4
|
-
id = "retail",
|
|
5
|
-
name = "Retail",
|
|
6
|
-
flavor = "Mainline",
|
|
7
|
-
interface = 120100,
|
|
8
|
-
baseline = "12.1.0",
|
|
9
|
-
}
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
|
|
3
|
+
ns.Client = {
|
|
4
|
+
id = "retail",
|
|
5
|
+
name = "Retail",
|
|
6
|
+
flavor = "Mainline",
|
|
7
|
+
interface = 120100,
|
|
8
|
+
baseline = "12.1.0",
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
|
|
3
|
-
ns.Client = {
|
|
4
|
-
id = "classic",
|
|
5
|
-
name = "Classic",
|
|
6
|
-
flavor = "Mists",
|
|
7
|
-
interface = 50504,
|
|
8
|
-
baseline = "5.5.4",
|
|
9
|
-
}
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
|
|
3
|
+
ns.Client = {
|
|
4
|
+
id = "classic",
|
|
5
|
+
name = "Classic",
|
|
6
|
+
flavor = "Mists",
|
|
7
|
+
interface = 50504,
|
|
8
|
+
baseline = "5.5.4",
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
|
|
3
|
-
ns.Client = {
|
|
4
|
-
id = "titan",
|
|
5
|
-
name = "Classic Titan",
|
|
6
|
-
flavor = "Titan",
|
|
7
|
-
interface = 38002,
|
|
8
|
-
baseline = "3.80.2",
|
|
9
|
-
}
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
|
|
3
|
+
ns.Client = {
|
|
4
|
+
id = "titan",
|
|
5
|
+
name = "Classic Titan",
|
|
6
|
+
flavor = "Titan",
|
|
7
|
+
interface = 38002,
|
|
8
|
+
baseline = "3.80.2",
|
|
9
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
|
|
3
|
-
local client = assert(ns.Client, "Lychee Dev client profile must load first")
|
|
4
|
-
|
|
5
|
-
function client.GetAddOnMetadata(addon, field)
|
|
6
|
-
return C_AddOns.GetAddOnMetadata(addon, field)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
function client.GetMouseFocus()
|
|
10
|
-
local foci = GetMouseFoci()
|
|
11
|
-
if issecretvalue(foci) or type(foci) ~= "table" or not foci[1]
|
|
12
|
-
or issecretvalue(foci[1]) then
|
|
13
|
-
return nil
|
|
14
|
-
end
|
|
15
|
-
return foci[1]
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
-- UI units per physical screen pixel, for screen-space overlays such as the
|
|
19
|
-
-- automation status blocks and QR notice. GetPhysicalScreenSize was verified on
|
|
20
|
-
-- the Retail 12.1.0 baseline only; other clients use the legacy 768-height
|
|
21
|
-
-- approximation until verified.
|
|
22
|
-
function client.GetPhysicalPixelSize()
|
|
23
|
-
if GetPhysicalScreenSize then
|
|
24
|
-
local succeeded, width, height = pcall(GetPhysicalScreenSize)
|
|
25
|
-
if succeeded and not (issecretvalue and (issecretvalue(width) or issecretvalue(height)))
|
|
26
|
-
and width and width > 0 and GetScreenWidth then
|
|
27
|
-
local uiWidth = GetScreenWidth()
|
|
28
|
-
if uiWidth and uiWidth > 0 and not (issecretvalue and issecretvalue(uiWidth)) then
|
|
29
|
-
return uiWidth / width
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
-- Fallback for clients without a verified GetPhysicalScreenSize: the legacy
|
|
34
|
-
-- 768-height approximation treats the screen as 768 physical pixels tall,
|
|
35
|
-
-- so one physical pixel spans (uiHeight / 768) UI units. The inverse,
|
|
36
|
-
-- 768 / uiHeight, would shrink the 4x4 physical-pixel status blocks below
|
|
37
|
-
-- their specified minimum on tall UIs.
|
|
38
|
-
local uiHeight = GetScreenHeight and GetScreenHeight() or nil
|
|
39
|
-
if uiHeight and uiHeight > 0 and not (issecretvalue and issecretvalue(uiHeight)) then
|
|
40
|
-
return uiHeight / 768
|
|
41
|
-
end
|
|
42
|
-
return 1
|
|
43
|
-
end
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
|
|
3
|
+
local client = assert(ns.Client, "Lychee Dev client profile must load first")
|
|
4
|
+
|
|
5
|
+
function client.GetAddOnMetadata(addon, field)
|
|
6
|
+
return C_AddOns.GetAddOnMetadata(addon, field)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
function client.GetMouseFocus()
|
|
10
|
+
local foci = GetMouseFoci()
|
|
11
|
+
if issecretvalue(foci) or type(foci) ~= "table" or not foci[1]
|
|
12
|
+
or issecretvalue(foci[1]) then
|
|
13
|
+
return nil
|
|
14
|
+
end
|
|
15
|
+
return foci[1]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
-- UI units per physical screen pixel, for screen-space overlays such as the
|
|
19
|
+
-- automation status blocks and QR notice. GetPhysicalScreenSize was verified on
|
|
20
|
+
-- the Retail 12.1.0 baseline only; other clients use the legacy 768-height
|
|
21
|
+
-- approximation until verified.
|
|
22
|
+
function client.GetPhysicalPixelSize()
|
|
23
|
+
if GetPhysicalScreenSize then
|
|
24
|
+
local succeeded, width, height = pcall(GetPhysicalScreenSize)
|
|
25
|
+
if succeeded and not (issecretvalue and (issecretvalue(width) or issecretvalue(height)))
|
|
26
|
+
and width and width > 0 and GetScreenWidth then
|
|
27
|
+
local uiWidth = GetScreenWidth()
|
|
28
|
+
if uiWidth and uiWidth > 0 and not (issecretvalue and issecretvalue(uiWidth)) then
|
|
29
|
+
return uiWidth / width
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
-- Fallback for clients without a verified GetPhysicalScreenSize: the legacy
|
|
34
|
+
-- 768-height approximation treats the screen as 768 physical pixels tall,
|
|
35
|
+
-- so one physical pixel spans (uiHeight / 768) UI units. The inverse,
|
|
36
|
+
-- 768 / uiHeight, would shrink the 4x4 physical-pixel status blocks below
|
|
37
|
+
-- their specified minimum on tall UIs.
|
|
38
|
+
local uiHeight = GetScreenHeight and GetScreenHeight() or nil
|
|
39
|
+
if uiHeight and uiHeight > 0 and not (issecretvalue and issecretvalue(uiHeight)) then
|
|
40
|
+
return uiHeight / 768
|
|
41
|
+
end
|
|
42
|
+
return 1
|
|
43
|
+
end
|