View Single Post
04/28/15, 07:47 PM   #21
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by stAjora View Post
As you can see, I'm collecting all information regarding a players researched traits. I tried to do this dynamically but I couldn't figure it out. Shouldn't be able to build the complete tree craft->weapon_type->trait with a couple loops?
I did not test it, but you could do something like this:
Lua Code:
  1. local function GetInfoForSmithingCraftType(craftingSkillType)
  2.     local numResearchLines = GetNumSmithingResearchLines(craftingSkillType)
  3.  
  4.     for researchLineIndex=1, numResearcLines do
  5.         local name, icon, numTraits = GetSmithingResearchLineInfo(craftingSkillType, researchLineIndex)
  6.        
  7.         for traitIndex=1, numTraits do
  8.             local traitType, traitDescription, known = GetSmithingResearchLineTraitInfo(craftingSkillType, researchLineIndex, traitIndex)
  9.             if known then
  10.                 -- do whatever
  11.             end
  12.         end
  13.     end
  14. end
  Reply With Quote