WoW:API GetTradeSkillReagentInfo

From AddOn Studio
Revision as of 22:20, 6 January 2005 by WoWWiki>Goldark (Fixed category sort order)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
GetTradeSkillReagentInfo -Documentation by Goldark-

Returns information on reagents for the specified trade skill.

local reagentName, reagentTexture, reagentCount, playerReagentCount = 
   GetTradeSkillReagentInfo(tradeSkillRecipeId, reagentId);

Arguments
(Number tradeSkillRecipeId, Number reagentId)
tradeSkillRecipeId
The Id of the tradeskill recipe
reagentId
The Id of the reagent (from 1 to x, where x is the result of calling API GetTradeSkillNumReagents)

Returns
String reagentName, String reagentTexture, Integer reagentCount, Integer playerReagentCount
reagentName
The name of the reagent.
reagentTexture
The texture for the reagent's icon.
reagentCount
The quantity of this reagent required to make one of these items.
playerReagentCount
The quantity of this reagent in the player's inventory.

Example
local numReagents = GetTradeSkillNumReagents(id);
for i=1, numReagents, 1 do
  local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i);
  SetItemButtonTexture(reagent, reagentTexture);
  name:SetText(reagentName);
  -- Grayout items
  if ( playerReagentCount < reagentCount ) then
    SetItemButtonTextureVertexColor(reagent, 0.5, 0.5, 0.5);
    name:SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
    creatable = nil;
  end;
end;



Template:WoW API