Files
coa-exporter/CoaExporter/UI/ExportFrame.lua
T
florian.berthold 2b97a68317 Initial CoaExporter: merge AscensionExporter + CoA skill/talent dumpers
Folds three previously-separate Lua addons into one for guild-member use:

  - ascension-char-exporter (per-character JSON/Wiki.js Markdown via /ascx)
  - CoA_SkillExporter      (skills/dispels/passives catalog via /skilldump)
  - CoA_TalentExporter     (talent-tree catalog via /talentdumpall)

The two CoA catalog dumpers were ~90% identical entry-walkers. Pulled the
shared C_CharacterAdvancement.GetAllEntries() loop into Catalogs/Common.lua
and have Skills.lua / Talents.lua register collectors that share a single
scan pass (so /coae catalog all walks the entry list once, not twice).

Per-character collectors (Talents, Gear, Enchants, MysticScrolls,
MysticScrollProbe) and the AtlasLootAscension-derived ScrollCatalog data
are kept verbatim, just rebranded.

Slash interface:

  /coae export {all|talents|gear|enchants|mdgear|mdenchants|md}
  /coae catalog {all|skills|talents|dispels [class]|passives [class]|status}
  /coae scrolls {scan|export|reset|status}
  /coae sv on|off | debug | help

Aliases: /coaexp, /ascx, /asxc, plus legacy /skilldump /talentdumpall
/dispels /passives that map to the catalog subcommands.

SavedVariables: CoaExporterSaved, CoaExporterConfig, CoaExporterScrollCache,
CoaExporterCatalog (skills/dispels/levelPassives/talents/_meta).
2026-05-07 10:43:16 +02:00

126 lines
4.3 KiB
Lua

-- CoaExporter - Export UI
local function CreateOrGetFrame()
if CoaExporterFrame then return CoaExporterFrame end
local frame = CreateFrame("Frame", "CoaExporterFrame", UIParent, "DialogBoxFrame")
frame:SetSize(700, 520)
frame:SetPoint("CENTER")
frame:SetMovable(true)
frame:EnableMouse(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
title:SetPoint("TOP", 0, -8)
frame.title = title
-- Two rows of buttons: per-character on top, catalog on bottom.
local function makeBtn(label, x, y, width, click)
local btn = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
btn:SetSize(width or 90, 22)
btn:SetPoint("TOPLEFT", 16 + x, y)
btn:SetText(label)
btn:SetScript("OnClick", click)
return btn
end
local function ce()
return _G.CoaExporter
end
-- Row 1: character export
local x = 0
makeBtn("All", x, -32, 60, function() if ce() then ce():Export("all") end end)
x = x + 65
makeBtn("Talents", x, -32, 70, function() if ce() then ce():Export("talents") end end)
x = x + 75
makeBtn("Gear", x, -32, 60, function() if ce() then ce():Export("gear") end end)
x = x + 65
makeBtn("Enchants", x, -32, 80, function() if ce() then ce():Export("enchants") end end)
x = x + 85
makeBtn("MD Gear", x, -32, 75, function()
local ae = ce()
if ae and ae.GenerateMarkdownGear then
ae:ShowExport(ae:GenerateMarkdownGear() or "", "CoaExporter - Markdown Gear (Ctrl+C)")
end
end)
x = x + 80
makeBtn("MD Enchants", x, -32, 90, function()
local ae = ce()
if ae and ae.GenerateMarkdownEnchants then
ae:ShowExport(ae:GenerateMarkdownEnchants() or "", "CoaExporter - Markdown Enchants (Ctrl+C)")
end
end)
x = x + 95
makeBtn("MD Full", x, -32, 75, function()
local ae = ce()
if ae and ae.GenerateMarkdownFull then
ae:ShowExport(ae:GenerateMarkdownFull() or "", "CoaExporter - Wiki Markdown (Ctrl+C)")
end
end)
-- Row 2: catalog (game data) export
x = 0
makeBtn("Catalog: Skills", x, -58, 110, function()
if CoaExporter and CoaExporter.Catalog then
CoaExporter.Catalog.Run("skills")
end
end)
x = x + 115
makeBtn("Catalog: Talents", x, -58, 120, function()
if CoaExporter and CoaExporter.Catalog then
CoaExporter.Catalog.Run("talents")
end
end)
x = x + 125
makeBtn("Catalog: All", x, -58, 100, function()
if CoaExporter and CoaExporter.Catalog then
CoaExporter.Catalog.Run("all")
end
end)
x = x + 105
makeBtn("Scrolls: Scan", x, -58, 100, function()
if CoaExporter and CoaExporter.ScrollsStartScan then
CoaExporter.ScrollsStartScan(function(stats)
DEFAULT_CHAT_FRAME:AddMessage(string.format(
"CoaExporter scrolls: scan complete - %d resolved, %d unresolved",
stats.total - stats.unresolved, stats.unresolved))
end)
end
end)
-- ScrollFrame + EditBox
local scrollFrame = CreateFrame("ScrollFrame", "CoaExporterScrollFrame", frame, "UIPanelScrollFrameTemplate")
scrollFrame:SetPoint("TOPLEFT", 16, -88)
scrollFrame:SetPoint("BOTTOMRIGHT", -32, 16)
local editBox = CreateFrame("EditBox", "CoaExporterEditBox", scrollFrame)
editBox:SetMultiLine(true)
editBox:SetAutoFocus(true)
editBox:SetFontObject(ChatFontNormal)
editBox:SetWidth(640)
editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
editBox:SetScript("OnEditFocusGained", function(self) self:HighlightText() end)
scrollFrame:SetScrollChild(editBox)
frame.scrollFrame = scrollFrame
frame.editBox = editBox
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", -4, -4)
CoaExporterFrame = frame
return frame
end
function CoaExporter_ShowExportFrame(text, titleText)
local f = CreateOrGetFrame()
f:Show()
f.editBox:SetText(text or "")
f.title:SetText(titleText or "CoaExporter (Ctrl+C)")
f.editBox:HighlightText()
f.editBox:SetFocus()
end