WoW:API GetTalentPrereqs: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Move page script moved page API GetTalentPrereqs to API GetTalentPrereqs without leaving a redirect) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{wowapi}} | {{wowapi}} | ||
Returns the tier and column of a talent's prerequisite, and if the talent is learnable. | Returns the tier and column of a talent's prerequisite, and if the talent is learnable. | ||
tier, column, isLearnable = GetTalentPrereqs( tabIndex , talentIndex[, inspect] ); | |||
tier, column, isLearnable = GetTalentPrereqs( tabIndex , talentIndex ); | |||
== Parameters == | == Parameters == | ||
Line 19: | Line 13: | ||
:;talentIndex : Integer - Specifies which talent to check | :;talentIndex : Integer - Specifies which talent to check | ||
Note: The talentIndex is counted as if it where a tree, meaning that the left most talent in the top most row is number 1 followed by the one immediate to the right is number 2, if there are no more talents to the right then it continues from the left most talent on the next row. | ::: Note: The talentIndex is counted as if it where a tree, meaning that the left most talent in the top most row is number 1 followed by the one immediate to the right is number 2, if there are no more talents to the right then it continues from the left most talent on the next row. | ||
:;inspect : [[Boolean]] - If true returns the information for the inspected unit instead of the player. New with 2.3. | |||
<big>'''Returns'''</big> | <big>'''Returns'''</big> | ||
Line 43: | Line 39: | ||
== Details == | == Details == | ||
If you select a talent with no prerequisites, the whole function returns nil | If you select a talent with no prerequisites, the whole function returns nil | ||
The original code by Blizzard shows that possibly several prerequisites could exists, in which case other triplets of row, column, learnable values would be returned. Code to handle this would look like this : | |||
local handle_prereqs = function (...) | |||
for i = 1, select("#", ...), 3 do | |||
local row, column, learnable = select(i, ...) | |||
<do something here> | |||
end | |||
end | |||
handle_prereqs(GetTalentPrereqs(tab, index)) |
Latest revision as of 04:46, 15 August 2023
Returns the tier and column of a talent's prerequisite, and if the talent is learnable.
tier, column, isLearnable = GetTalentPrereqs( tabIndex , talentIndex[, inspect] );
Parameters[edit]
Arguments
- (tabIndex, talentIndex)
- tabIndex
- Integer - Specifies which tab the talent is in.
- talentIndex
- Integer - Specifies which talent to check
- Note: The talentIndex is counted as if it where a tree, meaning that the left most talent in the top most row is number 1 followed by the one immediate to the right is number 2, if there are no more talents to the right then it continues from the left most talent on the next row.
- inspect
- Boolean - If true returns the information for the inspected unit instead of the player. New with 2.3.
Returns
- tier, column, isLearnable
- tier
- Integer - The tier that the prerequisite talent sits on
- column
- Integer - The Column that the prerequisite talent sits on
- isLearnable
- Integer - Returns 1 if you have the necessary prereqisites already, nil otherwise.
Example[edit]
For a Warrior, checks the prerequisites for the talent "Flurry":
local tier, column, learnable = GetTalentPrereqs(2,16)
Result
tier = 4 column = 3 learnable = 1 if you have 5/5 in Enrage, nil otherwise
Details[edit]
If you select a talent with no prerequisites, the whole function returns nil
The original code by Blizzard shows that possibly several prerequisites could exists, in which case other triplets of row, column, learnable values would be returned. Code to handle this would look like this :
local handle_prereqs = function (...) for i = 1, select("#", ...), 3 do local row, column, learnable = select(i, ...) <do something here> end end handle_prereqs(GetTalentPrereqs(tab, index))