Hello, I was trying to list all talents and was wondering how to do that with the new talent system. I cam across New Talent Tree Iterator however the answers there seem to have a error/bug? It appears to skip/not include talents that are not selected/node has more than one option. I know the code there has a if node currentrank > 0 but if you take that out it still does not include talents where the node has more than one option.
function PrintTalents()
local specID = PlayerUtil.GetCurrentSpecID()
-- last selected configID or fall back to default spec config
local configID = C_ClassTalents.GetLastSelectedSavedConfigID(specID) or C_ClassTalents.GetActiveConfigID()
local configInfo = C_Traits.GetConfigInfo(configID)
local treeID = configInfo.treeIDs[1]
local nodes = C_Traits.GetTreeNodes(treeID)
for _, nodeID in ipairs(nodes) do
local nodeInfo = C_Traits.GetNodeInfo(configID, nodeID)
local entryID = nodeInfo.activeEntry and nodeInfo.activeEntry.entryID and nodeInfo.activeEntry.entryID
local entryInfo = entryID and C_Traits.GetEntryInfo(configID, entryID)
local definitionInfo = entryInfo and entryInfo.definitionID and C_Traits.GetDefinitionInfo(entryInfo.definitionID)
if definitionInfo ~= nil then
local talentName = TalentUtil.GetTalentName(definitionInfo.overrideName, definitionInfo.spellID)
if talentName == "Berserker's Torment" then
print("true")
end
--print(string.format("%s %d/%d", talentName, nodeInfo.currentRank, nodeInfo.maxRanks))
end
end
end
Is what I have currently. It uses warrior as test and if you change
if talentName == "Berserker's Torment" then
print("true")
end
to
if talentName == "Titans's Torment" then
print("true")
end
you can see Titan’s Torment is not included in the loop. If it is not chosen.