Files
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

118 lines
4.0 KiB
Lua

-- CoaExporter / Catalogs / Talents.lua
--
-- Dumps the full talent-tree definitions per class (every node, with
-- prerequisites, children, max ranks, costs, etc.). Plugs into
-- Catalogs/Common.lua so it shares the entry-walk with Skills.
--
-- Output (in CoaExporterCatalog):
-- talents = { [class][tab] = { talents = { ... } } }
CoaExporter = _G.CoaExporter or {}
_G.CoaExporter = CoaExporter
local AE = CoaExporter
local C = AE.Catalog
local function GetReqString(entry)
local raw = entry.RequiredIDs
if raw == nil then raw = entry.RequiredID end
if raw == nil then raw = entry.RequiredId end
if raw == nil then raw = entry.PrerequisiteIDs end
if raw == nil then raw = entry.PrereqIDs end
if raw == nil then raw = entry.Requires end
if type(raw) == "table" then
local out = {}
for _, v in pairs(raw) do
local n = tonumber(v)
if n and n > 0 then table.insert(out, n) end
end
table.sort(out)
return table.concat(out, ",")
end
local n = tonumber(raw)
if n and n > 0 then return tostring(n) end
return "0"
end
local function GetChildrenString(entry)
local raw = entry.ConnectedNodes
if type(raw) ~= "table" then return "0" end
local out = {}
for _, v in pairs(raw) do
local n = tonumber(v)
if n and n > 0 then table.insert(out, n) end
end
if #out == 0 then return "0" end
table.sort(out)
return table.concat(out, ",")
end
local hierarchy
C.Register({
name = "talents",
onStart = function(_)
hierarchy = {}
end,
onEntry = function(_, entry, info)
local cls = info.cls
local tab = info.tab
hierarchy[cls] = hierarchy[cls] or {}
hierarchy[cls][tab] = hierarchy[cls][tab] or { talents = {} }
-- Class tree can be named: "Class", the class name itself, "General", or "{ClassName} Class"
local isClassTalent = (tab == cls or tab == "Class" or tab == "General" or tab == (cls .. " Class"))
local talent = {
name = info.name,
spellId = info.spellId,
advId = entry.ID or 0,
icon = info.icon,
tier = info.tier,
col = info.col,
rank = tonumber(entry.MaxPoints or entry.MaxRank or 1),
reqs = GetReqString(entry),
children = GetChildrenString(entry),
cost = tonumber(entry.AECost or entry.TECost or 0),
type = info.entryType,
isClass = isClassTalent,
tt = info.tooltip,
}
if #(info.allSpells or {}) > 1 then
talent.allSpells = info.allSpells
end
if entry.MinLevel then talent.minLevel = tonumber(entry.MinLevel) end
if entry.ExclusiveWith then
talent.exclusiveWith = (type(entry.ExclusiveWith) == "table") and entry.ExclusiveWith or { entry.ExclusiveWith }
end
if entry.ChoiceIndex then talent.choiceIndex = tonumber(entry.ChoiceIndex) end
if entry.GroupID then talent.groupID = tonumber(entry.GroupID) end
if entry.Description then talent.description = tostring(entry.Description) end
if entry.FlavorText then talent.flavorText = tostring(entry.FlavorText) end
if entry.Category then talent.category = tostring(entry.Category) end
if entry.UnlockCondition then talent.unlockCondition = tostring(entry.UnlockCondition) end
table.insert(hierarchy[cls][tab].talents, talent)
end,
onFinish = function(ctx)
CoaExporterCatalog.talents = hierarchy
CoaExporterCatalog.talentsMeta = { scanAt = ctx.startedAt }
local classCount, totalNodes = 0, 0
for _, tabs in pairs(hierarchy) do
classCount = classCount + 1
for _, t in pairs(tabs) do
totalNodes = totalNodes + #(t.talents or {})
end
end
C._log(string.format("talents: %d classes, %d nodes", classCount, totalNodes))
end,
})
AE._loadedCatalogTalents = true