Fandom

WoWWiki

API GetTrainerServiceInfo

104,634pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

WoW API < GetTrainerServiceInfo

Returns information about a trainer service.

name, rank, category, expanded = GetTrainerServiceInfo(id);

Arguments
id 
Index of the trainer service to retrieve information about. Note that indices are affected by the trainer filter. (See GetTrainerServiceTypeFilter and SetTrainerServiceTypeFilter.)

Returns
name 
(String) Name of the spell or the header (i.e. "Arcane Explosion" or "Fire").
rank 
(String) Rank of the spell, if applicable. Headers return empty strings.
category 
(String) "used" (already have the spell), "unavailable" (can not train this skill), "available" (can train this skill) and "header".
expanded 
(Number) nil if this is a collapsed header (category == "header"), 1 otherwise. (See CollapseTrainerSkillLine and ExpandTrainerSkillLine.)

Example

Prints the list of trainable spells when interacting with a trainer.

local i, name, rank, category;
for i=1,GetNumTrainerServices() do
 name, rank, category = GetTrainerServiceInfo(i);
 if (name == nil) then
  break; -- GetNumTrainerServices() does not check if you're talking to a trainer or not.
 end
 if (category == "available") then
  DEFAULT_CHAT_FRAME:AddMessage(name .. " (" .. rank .. ")");
 end
end

Patch changes Edit

0300Wrath-Logo-Small/0400Cataclysm-Logo-Small Patch 4.0.1 (12-Oct-2010): New return values: name (String), subType (String), category (String), texture (String), requiredLevel (Number), topServiceLine (Number).

Also on Fandom

Random Wiki