-- 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