lycheedev 1.0.0 → 1.0.2
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 +58 -8
- 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
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
-- Screen-level automation status overlay. Everything is created lazily on the
|
|
5
|
-
-- first Show call: while disabled this file creates no frames, registers no
|
|
6
|
-
-- events and runs no scripts.
|
|
7
|
-
--
|
|
8
|
-
-- Status blocks: three 4-physical-pixel squares in RGB order at the top-left
|
|
9
|
-
-- corner while an automation request runs. Error state lights only red.
|
|
10
|
-
-- Completion notice: one static QR code at the top-right, encoded once per
|
|
11
|
-
-- result and kept visible until the output-side reload, an explicit hide or a
|
|
12
|
-
-- safe cleanup. Dark modules come from a bounded reuse pool.
|
|
13
|
-
|
|
14
|
-
local POOL_LIMIT = 3000
|
|
15
|
-
local MAX_NOTICE_UI_SIZE = 480
|
|
16
|
-
|
|
17
|
-
local statusFrame
|
|
18
|
-
local noticeFrame
|
|
19
|
-
local statusBlocks
|
|
20
|
-
local noticeTextures = {}
|
|
21
|
-
local noticeTextureCount = 0
|
|
22
|
-
local lastNoticeJson
|
|
23
|
-
|
|
24
|
-
local function PhysicalUnit()
|
|
25
|
-
if ns.Client and ns.Client.GetPhysicalPixelSize then
|
|
26
|
-
return ns.Client.GetPhysicalPixelSize()
|
|
27
|
-
end
|
|
28
|
-
return 1
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
local function EnsureOverlay()
|
|
32
|
-
if statusFrame then
|
|
33
|
-
return
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
statusFrame = CreateFrame("Frame", "LycheeDevAutomationStatus", UIParent)
|
|
37
|
-
statusFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
38
|
-
statusFrame:SetFrameLevel(10000)
|
|
39
|
-
statusFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
|
|
40
|
-
statusFrame:Hide()
|
|
41
|
-
|
|
42
|
-
statusBlocks = {
|
|
43
|
-
statusFrame:CreateTexture(nil, "OVERLAY"),
|
|
44
|
-
statusFrame:CreateTexture(nil, "OVERLAY"),
|
|
45
|
-
statusFrame:CreateTexture(nil, "OVERLAY"),
|
|
46
|
-
}
|
|
47
|
-
statusBlocks[1]:SetColorTexture(0.85, 0.13, 0.15, 1)
|
|
48
|
-
statusBlocks[2]:SetColorTexture(0.20, 0.78, 0.33, 1)
|
|
49
|
-
statusBlocks[3]:SetColorTexture(0.24, 0.47, 0.95, 1)
|
|
50
|
-
|
|
51
|
-
noticeFrame = CreateFrame("Frame", "LycheeDevAutomationNotice", UIParent)
|
|
52
|
-
noticeFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
53
|
-
noticeFrame:SetFrameLevel(10000)
|
|
54
|
-
-- Top-left corner, matching the status blocks. The notice replaces them when
|
|
55
|
-
-- it appears, so the two never share the corner at the same time.
|
|
56
|
-
noticeFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
|
|
57
|
-
local background = noticeFrame:CreateTexture(nil, "BACKGROUND")
|
|
58
|
-
background:SetAllPoints()
|
|
59
|
-
background:SetColorTexture(1, 1, 1, 1)
|
|
60
|
-
noticeFrame:Hide()
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
local function LayoutStatusBlocks(mode)
|
|
64
|
-
local unit = PhysicalUnit()
|
|
65
|
-
local size = math.max(1, math.floor(4 * unit + 0.5))
|
|
66
|
-
local gap = math.max(1, math.floor(unit + 0.5))
|
|
67
|
-
for index = 1, 3 do
|
|
68
|
-
local block = statusBlocks[index]
|
|
69
|
-
block:ClearAllPoints()
|
|
70
|
-
block:SetSize(size, size)
|
|
71
|
-
block:SetPoint("TOPLEFT", statusFrame, "TOPLEFT", (index - 1) * (size + gap), 0)
|
|
72
|
-
block:SetShown(mode == "running" or (mode == "error" and index == 1))
|
|
73
|
-
end
|
|
74
|
-
statusFrame:SetSize(size * 3 + gap * 2, size)
|
|
75
|
-
statusFrame:Show()
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
local function CountDarkModules(matrix)
|
|
79
|
-
local size = #matrix
|
|
80
|
-
local dark = 0
|
|
81
|
-
for y = 1, size do
|
|
82
|
-
local column = matrix[y]
|
|
83
|
-
for x = 1, size do
|
|
84
|
-
if column[x] and column[x] > 0 then
|
|
85
|
-
dark = dark + 1
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
return dark, size
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
local function RenderMatrix(matrix)
|
|
93
|
-
local dark, size = CountDarkModules(matrix)
|
|
94
|
-
if dark > POOL_LIMIT then
|
|
95
|
-
return false
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
local unit = PhysicalUnit()
|
|
99
|
-
local moduleSize = math.max(2, math.ceil(3 * unit))
|
|
100
|
-
local quiet = moduleSize * 4
|
|
101
|
-
if size * moduleSize + quiet * 2 > MAX_NOTICE_UI_SIZE then
|
|
102
|
-
moduleSize = math.max(1, math.floor((MAX_NOTICE_UI_SIZE / (size + 8)) + 0.5))
|
|
103
|
-
quiet = moduleSize * 4
|
|
104
|
-
end
|
|
105
|
-
local total = size * moduleSize + quiet * 2
|
|
106
|
-
noticeFrame:SetSize(total, total)
|
|
107
|
-
|
|
108
|
-
local used = 0
|
|
109
|
-
for y = 1, size do
|
|
110
|
-
local column = matrix[y]
|
|
111
|
-
for x = 1, size do
|
|
112
|
-
if column[x] and column[x] > 0 then
|
|
113
|
-
used = used + 1
|
|
114
|
-
local texture = noticeTextures[used]
|
|
115
|
-
if not texture then
|
|
116
|
-
texture = noticeFrame:CreateTexture(nil, "OVERLAY")
|
|
117
|
-
texture:SetColorTexture(0, 0, 0, 1)
|
|
118
|
-
noticeTextures[used] = texture
|
|
119
|
-
noticeTextureCount = used
|
|
120
|
-
end
|
|
121
|
-
texture:SetSize(moduleSize, moduleSize)
|
|
122
|
-
texture:ClearAllPoints()
|
|
123
|
-
texture:SetPoint("TOPLEFT", noticeFrame, "TOPLEFT",
|
|
124
|
-
quiet + (x - 1) * moduleSize, -(quiet + (y - 1) * moduleSize))
|
|
125
|
-
texture:Show()
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
for index = used + 1, noticeTextureCount do
|
|
130
|
-
noticeTextures[index]:Hide()
|
|
131
|
-
end
|
|
132
|
-
return true
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
local Overlay = {}
|
|
136
|
-
|
|
137
|
-
function Overlay.ShowRunning()
|
|
138
|
-
EnsureOverlay()
|
|
139
|
-
LayoutStatusBlocks("running")
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
function Overlay.ShowError()
|
|
143
|
-
EnsureOverlay()
|
|
144
|
-
LayoutStatusBlocks("error")
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
function Overlay.HideStatus()
|
|
148
|
-
if statusFrame then
|
|
149
|
-
statusFrame:Hide()
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
function Overlay.ShowNotice(json)
|
|
154
|
-
EnsureOverlay()
|
|
155
|
-
if json == lastNoticeJson and noticeFrame:IsShown() then
|
|
156
|
-
-- Same static notice: keep the rendered matrix, never re-encode.
|
|
157
|
-
return true
|
|
158
|
-
end
|
|
159
|
-
local matrix, encodeError = ns.AutomationQR.Encode(json, 2)
|
|
160
|
-
if not matrix or not RenderMatrix(matrix) then
|
|
161
|
-
noticeFrame:Hide()
|
|
162
|
-
lastNoticeJson = nil
|
|
163
|
-
Overlay.ShowError()
|
|
164
|
-
return false, encodeError or "render_failed"
|
|
165
|
-
end
|
|
166
|
-
lastNoticeJson = json
|
|
167
|
-
-- The notice now shares the top-left corner with the status blocks, so the
|
|
168
|
-
-- blocks step aside; the caller has already stopped the run they described.
|
|
169
|
-
if statusFrame then
|
|
170
|
-
statusFrame:Hide()
|
|
171
|
-
end
|
|
172
|
-
noticeFrame:Show()
|
|
173
|
-
return true
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
function Overlay.HideNotice()
|
|
177
|
-
if noticeFrame then
|
|
178
|
-
noticeFrame:Hide()
|
|
179
|
-
end
|
|
180
|
-
lastNoticeJson = nil
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
ns.AutomationOverlay = Overlay
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
-- Screen-level automation status overlay. Everything is created lazily on the
|
|
5
|
+
-- first Show call: while disabled this file creates no frames, registers no
|
|
6
|
+
-- events and runs no scripts.
|
|
7
|
+
--
|
|
8
|
+
-- Status blocks: three 4-physical-pixel squares in RGB order at the top-left
|
|
9
|
+
-- corner while an automation request runs. Error state lights only red.
|
|
10
|
+
-- Completion notice: one static QR code at the top-right, encoded once per
|
|
11
|
+
-- result and kept visible until the output-side reload, an explicit hide or a
|
|
12
|
+
-- safe cleanup. Dark modules come from a bounded reuse pool.
|
|
13
|
+
|
|
14
|
+
local POOL_LIMIT = 3000
|
|
15
|
+
local MAX_NOTICE_UI_SIZE = 480
|
|
16
|
+
|
|
17
|
+
local statusFrame
|
|
18
|
+
local noticeFrame
|
|
19
|
+
local statusBlocks
|
|
20
|
+
local noticeTextures = {}
|
|
21
|
+
local noticeTextureCount = 0
|
|
22
|
+
local lastNoticeJson
|
|
23
|
+
|
|
24
|
+
local function PhysicalUnit()
|
|
25
|
+
if ns.Client and ns.Client.GetPhysicalPixelSize then
|
|
26
|
+
return ns.Client.GetPhysicalPixelSize()
|
|
27
|
+
end
|
|
28
|
+
return 1
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
local function EnsureOverlay()
|
|
32
|
+
if statusFrame then
|
|
33
|
+
return
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
statusFrame = CreateFrame("Frame", "LycheeDevAutomationStatus", UIParent)
|
|
37
|
+
statusFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
38
|
+
statusFrame:SetFrameLevel(10000)
|
|
39
|
+
statusFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
|
|
40
|
+
statusFrame:Hide()
|
|
41
|
+
|
|
42
|
+
statusBlocks = {
|
|
43
|
+
statusFrame:CreateTexture(nil, "OVERLAY"),
|
|
44
|
+
statusFrame:CreateTexture(nil, "OVERLAY"),
|
|
45
|
+
statusFrame:CreateTexture(nil, "OVERLAY"),
|
|
46
|
+
}
|
|
47
|
+
statusBlocks[1]:SetColorTexture(0.85, 0.13, 0.15, 1)
|
|
48
|
+
statusBlocks[2]:SetColorTexture(0.20, 0.78, 0.33, 1)
|
|
49
|
+
statusBlocks[3]:SetColorTexture(0.24, 0.47, 0.95, 1)
|
|
50
|
+
|
|
51
|
+
noticeFrame = CreateFrame("Frame", "LycheeDevAutomationNotice", UIParent)
|
|
52
|
+
noticeFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
53
|
+
noticeFrame:SetFrameLevel(10000)
|
|
54
|
+
-- Top-left corner, matching the status blocks. The notice replaces them when
|
|
55
|
+
-- it appears, so the two never share the corner at the same time.
|
|
56
|
+
noticeFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
|
|
57
|
+
local background = noticeFrame:CreateTexture(nil, "BACKGROUND")
|
|
58
|
+
background:SetAllPoints()
|
|
59
|
+
background:SetColorTexture(1, 1, 1, 1)
|
|
60
|
+
noticeFrame:Hide()
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
local function LayoutStatusBlocks(mode)
|
|
64
|
+
local unit = PhysicalUnit()
|
|
65
|
+
local size = math.max(1, math.floor(4 * unit + 0.5))
|
|
66
|
+
local gap = math.max(1, math.floor(unit + 0.5))
|
|
67
|
+
for index = 1, 3 do
|
|
68
|
+
local block = statusBlocks[index]
|
|
69
|
+
block:ClearAllPoints()
|
|
70
|
+
block:SetSize(size, size)
|
|
71
|
+
block:SetPoint("TOPLEFT", statusFrame, "TOPLEFT", (index - 1) * (size + gap), 0)
|
|
72
|
+
block:SetShown(mode == "running" or (mode == "error" and index == 1))
|
|
73
|
+
end
|
|
74
|
+
statusFrame:SetSize(size * 3 + gap * 2, size)
|
|
75
|
+
statusFrame:Show()
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
local function CountDarkModules(matrix)
|
|
79
|
+
local size = #matrix
|
|
80
|
+
local dark = 0
|
|
81
|
+
for y = 1, size do
|
|
82
|
+
local column = matrix[y]
|
|
83
|
+
for x = 1, size do
|
|
84
|
+
if column[x] and column[x] > 0 then
|
|
85
|
+
dark = dark + 1
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
return dark, size
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
local function RenderMatrix(matrix)
|
|
93
|
+
local dark, size = CountDarkModules(matrix)
|
|
94
|
+
if dark > POOL_LIMIT then
|
|
95
|
+
return false
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
local unit = PhysicalUnit()
|
|
99
|
+
local moduleSize = math.max(2, math.ceil(3 * unit))
|
|
100
|
+
local quiet = moduleSize * 4
|
|
101
|
+
if size * moduleSize + quiet * 2 > MAX_NOTICE_UI_SIZE then
|
|
102
|
+
moduleSize = math.max(1, math.floor((MAX_NOTICE_UI_SIZE / (size + 8)) + 0.5))
|
|
103
|
+
quiet = moduleSize * 4
|
|
104
|
+
end
|
|
105
|
+
local total = size * moduleSize + quiet * 2
|
|
106
|
+
noticeFrame:SetSize(total, total)
|
|
107
|
+
|
|
108
|
+
local used = 0
|
|
109
|
+
for y = 1, size do
|
|
110
|
+
local column = matrix[y]
|
|
111
|
+
for x = 1, size do
|
|
112
|
+
if column[x] and column[x] > 0 then
|
|
113
|
+
used = used + 1
|
|
114
|
+
local texture = noticeTextures[used]
|
|
115
|
+
if not texture then
|
|
116
|
+
texture = noticeFrame:CreateTexture(nil, "OVERLAY")
|
|
117
|
+
texture:SetColorTexture(0, 0, 0, 1)
|
|
118
|
+
noticeTextures[used] = texture
|
|
119
|
+
noticeTextureCount = used
|
|
120
|
+
end
|
|
121
|
+
texture:SetSize(moduleSize, moduleSize)
|
|
122
|
+
texture:ClearAllPoints()
|
|
123
|
+
texture:SetPoint("TOPLEFT", noticeFrame, "TOPLEFT",
|
|
124
|
+
quiet + (x - 1) * moduleSize, -(quiet + (y - 1) * moduleSize))
|
|
125
|
+
texture:Show()
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
for index = used + 1, noticeTextureCount do
|
|
130
|
+
noticeTextures[index]:Hide()
|
|
131
|
+
end
|
|
132
|
+
return true
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
local Overlay = {}
|
|
136
|
+
|
|
137
|
+
function Overlay.ShowRunning()
|
|
138
|
+
EnsureOverlay()
|
|
139
|
+
LayoutStatusBlocks("running")
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
function Overlay.ShowError()
|
|
143
|
+
EnsureOverlay()
|
|
144
|
+
LayoutStatusBlocks("error")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
function Overlay.HideStatus()
|
|
148
|
+
if statusFrame then
|
|
149
|
+
statusFrame:Hide()
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
function Overlay.ShowNotice(json)
|
|
154
|
+
EnsureOverlay()
|
|
155
|
+
if json == lastNoticeJson and noticeFrame:IsShown() then
|
|
156
|
+
-- Same static notice: keep the rendered matrix, never re-encode.
|
|
157
|
+
return true
|
|
158
|
+
end
|
|
159
|
+
local matrix, encodeError = ns.AutomationQR.Encode(json, 2)
|
|
160
|
+
if not matrix or not RenderMatrix(matrix) then
|
|
161
|
+
noticeFrame:Hide()
|
|
162
|
+
lastNoticeJson = nil
|
|
163
|
+
Overlay.ShowError()
|
|
164
|
+
return false, encodeError or "render_failed"
|
|
165
|
+
end
|
|
166
|
+
lastNoticeJson = json
|
|
167
|
+
-- The notice now shares the top-left corner with the status blocks, so the
|
|
168
|
+
-- blocks step aside; the caller has already stopped the run they described.
|
|
169
|
+
if statusFrame then
|
|
170
|
+
statusFrame:Hide()
|
|
171
|
+
end
|
|
172
|
+
noticeFrame:Show()
|
|
173
|
+
return true
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
function Overlay.HideNotice()
|
|
177
|
+
if noticeFrame then
|
|
178
|
+
noticeFrame:Hide()
|
|
179
|
+
end
|
|
180
|
+
lastNoticeJson = nil
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
ns.AutomationOverlay = Overlay
|
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
function ns.CreateExportController(parent, ui)
|
|
5
|
-
local controller = {}
|
|
6
|
-
local popup
|
|
7
|
-
|
|
8
|
-
local function EnsurePopup()
|
|
9
|
-
if popup then
|
|
10
|
-
return popup
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
local overlay = ui.CreatePanel(parent, 0, 0, 0, 0.78)
|
|
14
|
-
overlay:SetAllPoints(parent)
|
|
15
|
-
overlay:SetFrameLevel(parent:GetFrameLevel() + 80)
|
|
16
|
-
overlay:EnableMouse(true)
|
|
17
|
-
|
|
18
|
-
local panel = ui.CreatePanel(overlay, ui.surfaceR, ui.surfaceG, ui.surfaceB, 1)
|
|
19
|
-
panel:SetSize(520, 224)
|
|
20
|
-
panel:SetPoint("CENTER")
|
|
21
|
-
panel:SetFrameLevel(overlay:GetFrameLevel() + 1)
|
|
22
|
-
|
|
23
|
-
local logo = panel:CreateTexture(nil, "ARTWORK")
|
|
24
|
-
logo:SetTexture("Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png")
|
|
25
|
-
logo:SetTexCoord(0.18, 0.79, 0.17, 0.80)
|
|
26
|
-
logo:SetSize(34, 34)
|
|
27
|
-
logo:SetPoint("TOPLEFT", 20, -17)
|
|
28
|
-
|
|
29
|
-
local title = panel:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
|
|
30
|
-
title:SetPoint("LEFT", logo, "RIGHT", 12, 1)
|
|
31
|
-
title:SetText(L.EXPORT_SAVED_TITLE)
|
|
32
|
-
|
|
33
|
-
local status = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
34
|
-
status:SetPoint("TOPRIGHT", -20, -27)
|
|
35
|
-
status:SetText(L.EXPORT_STATUS_PENDING)
|
|
36
|
-
status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
|
|
37
|
-
|
|
38
|
-
local divider = panel:CreateTexture(nil, "ARTWORK")
|
|
39
|
-
divider:SetColorTexture(1, 1, 1, 0.07)
|
|
40
|
-
divider:SetPoint("TOPLEFT", 20, -66)
|
|
41
|
-
divider:SetPoint("TOPRIGHT", -20, -66)
|
|
42
|
-
divider:SetHeight(1)
|
|
43
|
-
|
|
44
|
-
local ticketLabel = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
45
|
-
ticketLabel:SetPoint("TOPLEFT", 20, -86)
|
|
46
|
-
ticketLabel:SetText(L.EXPORT_TICKET)
|
|
47
|
-
ticketLabel:SetTextColor(1, 1, 1, 0.38)
|
|
48
|
-
|
|
49
|
-
local ticketPanel = ui.CreatePanel(panel, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
50
|
-
ticketPanel:SetPoint("TOPLEFT", ticketLabel, "BOTTOMLEFT", 0, -7)
|
|
51
|
-
ticketPanel:SetPoint("TOPRIGHT", panel, "TOPRIGHT", -20, -108)
|
|
52
|
-
ticketPanel:SetHeight(42)
|
|
53
|
-
|
|
54
|
-
local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
|
|
55
|
-
ticketBox:SetPoint("TOPLEFT", 12, -1)
|
|
56
|
-
ticketBox:SetPoint("BOTTOMRIGHT", -12, 1)
|
|
57
|
-
ticketBox:SetAutoFocus(false)
|
|
58
|
-
ticketBox:SetFontObject(ChatFontNormal)
|
|
59
|
-
ticketBox:SetTextColor(0.94, 0.95, 0.96)
|
|
60
|
-
ticketBox:SetScript("OnEscapePressed", function() overlay:Hide() end)
|
|
61
|
-
ticketBox:SetScript("OnTextChanged", function(self)
|
|
62
|
-
if not self.updatingText and self:GetText() ~= self.savedText then
|
|
63
|
-
self.updatingText = true
|
|
64
|
-
self:SetText(self.savedText or "")
|
|
65
|
-
self.updatingText = nil
|
|
66
|
-
self:HighlightText()
|
|
67
|
-
end
|
|
68
|
-
end)
|
|
69
|
-
|
|
70
|
-
local hint = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
71
|
-
hint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -9)
|
|
72
|
-
hint:SetPoint("RIGHT", -20, 0)
|
|
73
|
-
hint:SetJustifyH("LEFT")
|
|
74
|
-
hint:SetText(L.EXPORT_TICKET_HELP)
|
|
75
|
-
hint:SetTextColor(1, 1, 1, 0.48)
|
|
76
|
-
|
|
77
|
-
local reloadButton = ui.CreateButton(panel, 110, L.RELOAD_NOW, true)
|
|
78
|
-
reloadButton:SetPoint("BOTTOMRIGHT", -20, 16)
|
|
79
|
-
reloadButton:SetScript("OnClick", function()
|
|
80
|
-
if ns.IsCombatBlocked() then
|
|
81
|
-
ns.PrintCombatBlocked()
|
|
82
|
-
return
|
|
83
|
-
end
|
|
84
|
-
ReloadUI()
|
|
85
|
-
end)
|
|
86
|
-
|
|
87
|
-
local laterButton = ui.CreateButton(panel, 96, L.RELOAD_LATER, false)
|
|
88
|
-
laterButton:SetPoint("RIGHT", reloadButton, "LEFT", -8, 0)
|
|
89
|
-
laterButton:SetScript("OnClick", function() overlay:Hide() end)
|
|
90
|
-
|
|
91
|
-
ticketBox:SetScript("OnMouseUp", function()
|
|
92
|
-
ui.SelectAllText(ticketBox)
|
|
93
|
-
end)
|
|
94
|
-
|
|
95
|
-
popup = {
|
|
96
|
-
overlay = overlay,
|
|
97
|
-
ticketBox = ticketBox,
|
|
98
|
-
hint = hint,
|
|
99
|
-
laterButton = laterButton,
|
|
100
|
-
reloadButton = reloadButton,
|
|
101
|
-
}
|
|
102
|
-
overlay:Hide()
|
|
103
|
-
controller.popup = popup
|
|
104
|
-
return popup
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
function controller:Save(kind, title, content, metadata)
|
|
108
|
-
if type(content) == "function" then
|
|
109
|
-
local succeeded, generated = pcall(content)
|
|
110
|
-
if not succeeded then
|
|
111
|
-
print("|cffd83b4eLychee Dev:|r " .. L.EXPORT_BUILD_FAILED .. tostring(generated))
|
|
112
|
-
return nil
|
|
113
|
-
end
|
|
114
|
-
content = generated
|
|
115
|
-
end
|
|
116
|
-
local ticket, errorMessage = ns.AddExport(kind, title, content, metadata)
|
|
117
|
-
if not ticket then
|
|
118
|
-
print("|cffd83b4eLychee Dev:|r " .. (errorMessage or L.EXPORT_FAILED))
|
|
119
|
-
return nil
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
local activePopup = EnsurePopup()
|
|
123
|
-
activePopup.ticketBox.savedText = ticket
|
|
124
|
-
activePopup.ticketBox.updatingText = true
|
|
125
|
-
activePopup.ticketBox:SetText(ticket)
|
|
126
|
-
activePopup.ticketBox.updatingText = nil
|
|
127
|
-
activePopup.hint:SetText(L.EXPORT_TICKET_HELP)
|
|
128
|
-
activePopup.overlay:Show()
|
|
129
|
-
ui.SelectAllText(activePopup.ticketBox)
|
|
130
|
-
return ticket
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
function controller:Hide()
|
|
134
|
-
if popup then
|
|
135
|
-
popup.overlay:Hide()
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
return controller
|
|
140
|
-
end
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
function ns.CreateExportController(parent, ui)
|
|
5
|
+
local controller = {}
|
|
6
|
+
local popup
|
|
7
|
+
|
|
8
|
+
local function EnsurePopup()
|
|
9
|
+
if popup then
|
|
10
|
+
return popup
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
local overlay = ui.CreatePanel(parent, 0, 0, 0, 0.78)
|
|
14
|
+
overlay:SetAllPoints(parent)
|
|
15
|
+
overlay:SetFrameLevel(parent:GetFrameLevel() + 80)
|
|
16
|
+
overlay:EnableMouse(true)
|
|
17
|
+
|
|
18
|
+
local panel = ui.CreatePanel(overlay, ui.surfaceR, ui.surfaceG, ui.surfaceB, 1)
|
|
19
|
+
panel:SetSize(520, 224)
|
|
20
|
+
panel:SetPoint("CENTER")
|
|
21
|
+
panel:SetFrameLevel(overlay:GetFrameLevel() + 1)
|
|
22
|
+
|
|
23
|
+
local logo = panel:CreateTexture(nil, "ARTWORK")
|
|
24
|
+
logo:SetTexture("Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png")
|
|
25
|
+
logo:SetTexCoord(0.18, 0.79, 0.17, 0.80)
|
|
26
|
+
logo:SetSize(34, 34)
|
|
27
|
+
logo:SetPoint("TOPLEFT", 20, -17)
|
|
28
|
+
|
|
29
|
+
local title = panel:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
|
|
30
|
+
title:SetPoint("LEFT", logo, "RIGHT", 12, 1)
|
|
31
|
+
title:SetText(L.EXPORT_SAVED_TITLE)
|
|
32
|
+
|
|
33
|
+
local status = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
34
|
+
status:SetPoint("TOPRIGHT", -20, -27)
|
|
35
|
+
status:SetText(L.EXPORT_STATUS_PENDING)
|
|
36
|
+
status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
|
|
37
|
+
|
|
38
|
+
local divider = panel:CreateTexture(nil, "ARTWORK")
|
|
39
|
+
divider:SetColorTexture(1, 1, 1, 0.07)
|
|
40
|
+
divider:SetPoint("TOPLEFT", 20, -66)
|
|
41
|
+
divider:SetPoint("TOPRIGHT", -20, -66)
|
|
42
|
+
divider:SetHeight(1)
|
|
43
|
+
|
|
44
|
+
local ticketLabel = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
45
|
+
ticketLabel:SetPoint("TOPLEFT", 20, -86)
|
|
46
|
+
ticketLabel:SetText(L.EXPORT_TICKET)
|
|
47
|
+
ticketLabel:SetTextColor(1, 1, 1, 0.38)
|
|
48
|
+
|
|
49
|
+
local ticketPanel = ui.CreatePanel(panel, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
50
|
+
ticketPanel:SetPoint("TOPLEFT", ticketLabel, "BOTTOMLEFT", 0, -7)
|
|
51
|
+
ticketPanel:SetPoint("TOPRIGHT", panel, "TOPRIGHT", -20, -108)
|
|
52
|
+
ticketPanel:SetHeight(42)
|
|
53
|
+
|
|
54
|
+
local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
|
|
55
|
+
ticketBox:SetPoint("TOPLEFT", 12, -1)
|
|
56
|
+
ticketBox:SetPoint("BOTTOMRIGHT", -12, 1)
|
|
57
|
+
ticketBox:SetAutoFocus(false)
|
|
58
|
+
ticketBox:SetFontObject(ChatFontNormal)
|
|
59
|
+
ticketBox:SetTextColor(0.94, 0.95, 0.96)
|
|
60
|
+
ticketBox:SetScript("OnEscapePressed", function() overlay:Hide() end)
|
|
61
|
+
ticketBox:SetScript("OnTextChanged", function(self)
|
|
62
|
+
if not self.updatingText and self:GetText() ~= self.savedText then
|
|
63
|
+
self.updatingText = true
|
|
64
|
+
self:SetText(self.savedText or "")
|
|
65
|
+
self.updatingText = nil
|
|
66
|
+
self:HighlightText()
|
|
67
|
+
end
|
|
68
|
+
end)
|
|
69
|
+
|
|
70
|
+
local hint = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
71
|
+
hint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -9)
|
|
72
|
+
hint:SetPoint("RIGHT", -20, 0)
|
|
73
|
+
hint:SetJustifyH("LEFT")
|
|
74
|
+
hint:SetText(L.EXPORT_TICKET_HELP)
|
|
75
|
+
hint:SetTextColor(1, 1, 1, 0.48)
|
|
76
|
+
|
|
77
|
+
local reloadButton = ui.CreateButton(panel, 110, L.RELOAD_NOW, true)
|
|
78
|
+
reloadButton:SetPoint("BOTTOMRIGHT", -20, 16)
|
|
79
|
+
reloadButton:SetScript("OnClick", function()
|
|
80
|
+
if ns.IsCombatBlocked() then
|
|
81
|
+
ns.PrintCombatBlocked()
|
|
82
|
+
return
|
|
83
|
+
end
|
|
84
|
+
ReloadUI()
|
|
85
|
+
end)
|
|
86
|
+
|
|
87
|
+
local laterButton = ui.CreateButton(panel, 96, L.RELOAD_LATER, false)
|
|
88
|
+
laterButton:SetPoint("RIGHT", reloadButton, "LEFT", -8, 0)
|
|
89
|
+
laterButton:SetScript("OnClick", function() overlay:Hide() end)
|
|
90
|
+
|
|
91
|
+
ticketBox:SetScript("OnMouseUp", function()
|
|
92
|
+
ui.SelectAllText(ticketBox)
|
|
93
|
+
end)
|
|
94
|
+
|
|
95
|
+
popup = {
|
|
96
|
+
overlay = overlay,
|
|
97
|
+
ticketBox = ticketBox,
|
|
98
|
+
hint = hint,
|
|
99
|
+
laterButton = laterButton,
|
|
100
|
+
reloadButton = reloadButton,
|
|
101
|
+
}
|
|
102
|
+
overlay:Hide()
|
|
103
|
+
controller.popup = popup
|
|
104
|
+
return popup
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
function controller:Save(kind, title, content, metadata)
|
|
108
|
+
if type(content) == "function" then
|
|
109
|
+
local succeeded, generated = pcall(content)
|
|
110
|
+
if not succeeded then
|
|
111
|
+
print("|cffd83b4eLychee Dev:|r " .. L.EXPORT_BUILD_FAILED .. tostring(generated))
|
|
112
|
+
return nil
|
|
113
|
+
end
|
|
114
|
+
content = generated
|
|
115
|
+
end
|
|
116
|
+
local ticket, errorMessage = ns.AddExport(kind, title, content, metadata)
|
|
117
|
+
if not ticket then
|
|
118
|
+
print("|cffd83b4eLychee Dev:|r " .. (errorMessage or L.EXPORT_FAILED))
|
|
119
|
+
return nil
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
local activePopup = EnsurePopup()
|
|
123
|
+
activePopup.ticketBox.savedText = ticket
|
|
124
|
+
activePopup.ticketBox.updatingText = true
|
|
125
|
+
activePopup.ticketBox:SetText(ticket)
|
|
126
|
+
activePopup.ticketBox.updatingText = nil
|
|
127
|
+
activePopup.hint:SetText(L.EXPORT_TICKET_HELP)
|
|
128
|
+
activePopup.overlay:Show()
|
|
129
|
+
ui.SelectAllText(activePopup.ticketBox)
|
|
130
|
+
return ticket
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
function controller:Hide()
|
|
134
|
+
if popup then
|
|
135
|
+
popup.overlay:Hide()
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
return controller
|
|
140
|
+
end
|