WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Enumerating DF talents (https://www.wowinterface.com/forums/showthread.php?t=59524)

doofus 03-04-23 02:04 PM

Enumerating DF talents
 
I have some code to determine picked talents. The code fails with some talents like Berserk, which has 2-3 extra talents/nodes that enhance the base Berserk. My code shows I have 0 points on Berserk which is not correct. In addition the talent tree has nodes like "Berserk: Persistence" or "Berserk: Ravage" - but I cannot see them in the enumeration.

On a side note when I shift-click on say "Berserk: Ravage" or "Berserk: Persistence" with chat open, it simply copies "Berserk" without the ": Ravage" or ": Persistence".

How can I enumerate those talents properly?

Here is my code

Code:

local function GetActiveTalentsTraits()
  -- this is the old style talents ( patch < 10 )
  --BA_Data["function LogTextLine"](string.format("----->>>>> talents - specs <<<<<-----"));
  --local __specID, __specName, __description, __icon, __background, __role = GetSpecializationInfo(GetSpecialization());
  --BA_Data["function LogTextLine"](string.format("GetSpecializationInfo -- old style spec - id:%d - name:%s - descr:%s",__specID,__specName,__description));
  local lTalents = {};
  local lConfigID = C_ClassTalents.GetActiveConfigID();
  --BA_Data["function LogTextLine"](string.format("GetActiveConfigID - active:%d",lConfigID));
  local lConfigInfo = C_Traits.GetConfigInfo(lConfigID);
  local lTreeIDs = lConfigInfo["treeIDs"];
  --BA_Data["function LogTextLine"](string.format("GetConfigInfo -- configID:%d - name:%s - type:%d - num trees:%d",lConfigID,lConfigInfo["name"],lConfigInfo["type"],#lTreeIDs));
  for i = 1, #lTreeIDs do
    for _, lNodeID in pairs(C_Traits.GetTreeNodes(lTreeIDs[i])) do
      local lNodeInfo = C_Traits.GetNodeInfo(lConfigID, lNodeID);
      local activeEntry = lNodeInfo.activeEntry;
      local activeRank = lNodeInfo.activeRank;
      if ( activeEntry --[====[ and activeRank > 0 ]====] ) then
        --BA_Data["function LogTextLine"](string.format("node id:%d - entry:%s - rank:%d",lNodeID,tostring(activeEntry),activeRank));
        local activeEntryID = activeEntry.entryID;
        local lEntryInfo = C_Traits.GetEntryInfo(lConfigID,activeEntryID);
        if ( lEntryInfo ) then
          local lDefinitionID = lEntryInfo["definitionID"];
          --BA_Data["function LogTextLine"](string.format("def ID:%s",tostring(lDefinitionID)));
          local lDefinitionInfo = C_Traits.GetDefinitionInfo(lDefinitionID);
          --BA_Data["function LogTextLine"](string.format("def info:%s",tostring(lDefinitionInfo)));
          local spellID = lDefinitionInfo["spellID"];
          -- bugbug this should not be! but we work around it
          if ( not spellID ) then spellID = 0; end
          --BA_Data["function LogTextLine"](string.format("spell ID:%s",tostring(spellID)));
          local spellName = spellID ~= 0 and GetSpellInfo(spellID) or "Unknown spell";
          lTalents[spellName] = activeRank;
          --BA_Data["function LogTextLine"](string.format("id:%d - %s - %d",spellID,spellName,lTalents[spellName]));
        end
      end
    end
  end
  --BA_Data["General variables"]["function DumpTalentsTraits"](lTalents);
  return lTalents;
end



All times are GMT -6. The time now is 02:30 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI