-- AscensionExporter - Talents collector (active spec only) local AE = AscensionExporter local function get_active_group() if GetActiveTalentGroup then local g = GetActiveTalentGroup() if g == 0 then g = 1 end return g or 1 end return 1 end local function collect_selected_for_tab(tabIndex, talentGroup) local arr = {} local numTalents = GetNumTalents(tabIndex) for talentIndex = 1, numTalents do local name, _, _, _, rank, maxRank = GetTalentInfo(tabIndex, talentIndex, false, false, talentGroup) if rank and rank > 0 then local link = GetTalentLink(tabIndex, talentIndex) local spellId = 0 if link then spellId = tonumber(string.match(link, "talent:(%d+)")) or 0 end table.insert(arr, { tabIndex = tabIndex, talentIndex = talentIndex, name = name or "", rank = rank or 0, maxRank = maxRank or 0, spellId = spellId, }) end end return arr end function AE.CollectTalents() local active = get_active_group() local out = { activeTalentGroup = active, selected = {}, } local numTabs = GetNumTalentTabs() for tabIndex = 1, numTabs do local tabName, _, pointsSpent = GetTalentTabInfo(tabIndex, false, false, active) -- Only export selected ranks for the active group local selected = collect_selected_for_tab(tabIndex, active) for _, v in ipairs(selected) do table.insert(out.selected, v) end end return out end