WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How do I get the spec info from the talent tree (https://www.wowinterface.com/forums/showthread.php?t=51965)

gmarco 02-24-15 03:22 AM

How do I get the spec info from the talent tree
 
Hi all,

I use this thread because I have a problem "talents related" :-) and so I try to ask here for some help.

I am trying to figure how to have the spec informations from the talent tree...
I like to find something like this: 2,1,3,1,1,3,2

I have read on my book and googling a lot but it seems to me that a lot of functions are not yet documented and not related to find something like it.

I can find everything of the talent selected but what I am not able to get is its position in the tier row.

code like:

Lua Code:
  1. isFree, talent = GetTalentRowSelectionInfo(1)
  2. print (GetTalentInfoByID(talent))

give me back a lot but not what I am looking for :-)

Thanks for any suggestions/tips/hints :-)

Mazzop 02-24-15 04:02 AM

for gmarco

Code:

local specid = GetActiveSpecGroup()
local maxtalenttier = GetMaxTalentTier()
local talenttree = {}
for i=1, maxtalenttier do
for j=1, 3 do
if select(4, GetTalentInfo(i,j,specid)) == true then
talenttree[i] = j
end
end
end

print(table.concat(talenttree))


gmarco 02-26-15 12:43 PM

Hi Mazzop,
this is exactly what I need ... :-)

Thanks !!!

gmarco 02-26-15 12:51 PM

I have adapted the code in this way:

Lua Code:
  1. local PRISPEC = {}
  2. local SECSPEC = {}
  3.  
  4. --- blabla ...
  5.  
  6.  
  7.     for i=1, GetMaxTalentTier()  do
  8.        for j=1, 3 do
  9.             if select(4, GetTalentInfo(i,j,1)) == true then
  10.                 ptalenttree[i] = j
  11.             end
  12.          
  13.             if select(4, GetTalentInfo(i,j,2)) == true then
  14.                 stalenttree[i] = j
  15.             end
  16.        end
  17.     end
  18.  
  19.     PRISPEC["tree"] = table.concat(ptalenttree,"-")
  20.     SECSPEC["tree"] = table.concat(stalenttree,"-")


Now I'd like ask another thing ...

Is possible to rewrite these 2 lines in a more lua style to have the array populated by the GetSpecializationInfo(primarySpec) directly ?


Lua Code:
  1. local id, name, description, icon, background, role = GetSpecializationInfo(primarySpec)
  2. PRISPEC = { id = id, name = name, description = description, icon = icon , background = background, role = role }

Thanks.

Lombra 02-26-15 12:56 PM

Not by name, as they have no reference to anything like that, but you can do this:
Code:

PRISPEC = {GetSpecializationInfo(primarySpec)}


All times are GMT -6. The time now is 05:37 PM.

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