WoW:API GetTrainerServiceSkillReq: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API GetTrainerServiceSkillReq to API GetTrainerServiceSkillReq without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Returns the name of the skill required, and the amount needed in that skill.
{{wowapi}}
Returns the name of the skill required, and the amount needed in that skill.  Index is the selection index obtained by [[API GetTrainerSelectionIndex|GetTrainerSelectionIndex()]].


   skillName, skillAmt = GetTrainerServiceSkillReq(index);
   skillName, skillLevel, hasReq = GetTrainerServiceSkillReq(index)


== Arguments ==
== Arguments ==
:index
:index
::the number of the selection in the trainer window
::the number of the [[API GetTrainerSelectionIndex|selection]] in the trainer window
 
== Returns ==
:;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.


== Example ==
== Example ==
   local selection = [[API GetTrainerSelectionIndex|GetTrainerSelectionIndex()]];
   local selection = [[API GetTrainerSelectionIndex|GetTrainerSelectionIndex()]]
    
    
   local skillName, skillAmt = GetTrainerServiceSkillReq(selection);
   local skillName, skillAmt = [[API GetTrainerServiceSkillReq|GetTrainerServiceSkillReq(selection)]]
   DEFAULT_CHAT_FRAME:AddMessage('Skill Line Required: ' .. skillName);
   DEFAULT_CHAT_FRAME:AddMessage('Skill Name: ' .. skillName)
   DEFAULT_CHAT_FRAME:AddMessage('Skill Amount Required: ' .. skillAmt);
   DEFAULT_CHAT_FRAME:AddMessage('Skill Amount Required: ' .. skillLevel)
 
If you had the Alchemist trainer window open and Weak Troll's Blood Potion selected, the return on the chat window would be Alchemy and 15.


--[[User:Dragonflyy|Dragonflyy]]
If you had an engineering trainer open, with a skill you knew already the output would be:


---
  Skill Name: Engineering
{{Template:WoW API}}
  Skill Amount Required: 375

Latest revision as of 04:46, 15 August 2023

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)

Arguments[edit]

index
the number of the selection in the trainer window

Returns[edit]

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.

Example[edit]

 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