WoW API: GetTrainerServiceSkillReq

Revision as of 04:46, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API GetTrainerServiceSkillReq to API GetTrainerServiceSkillReq without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WoW API < GetTrainerServiceSkillReq

Returns the name of the skill required, and the amount needed in that skill. Index is the selection index obtained by GetTrainerSelectionIndex().

 skillName, skillLevel, hasReq = GetTrainerServiceSkillReq(index)

ArgumentsEdit

index
the number of the selection in the trainer window

ReturnsEdit

skillName
The name of the skill.
skillLevel
The required level needed for the skill.
hasReq
1 or nil. Seems to be 1 for skills that you cannot learn, nil for skills you have learned already.

ExampleEdit

 local selection = GetTrainerSelectionIndex()
 
 local skillName, skillAmt = GetTrainerServiceSkillReq(selection)
 DEFAULT_CHAT_FRAME:AddMessage('Skill Name: ' .. skillName)
 DEFAULT_CHAT_FRAME:AddMessage('Skill Amount Required: ' .. skillLevel)

If you had an engineering trainer open, with a skill you knew already the output would be:

 Skill Name: Engineering
 Skill Amount Required: 375