WoW:API GetTradeSkillReagentInfo: Difference between revisions

(Fixed category sort order)
 
m (Move page script moved page API GetTradeSkillReagentInfo to API GetTradeSkillReagentInfo without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<center>'''GetTradeSkillReagentInfo''' ''-Documentation by [[User:Goldark|Goldark]]-''</center>
{{wowapi}} __NOTOC__
 
Returns information on reagents for the specified trade skill.
Returns information on reagents for the specified trade skill.
reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(tradeSkillRecipeId, reagentId);


local reagentName, reagentTexture, reagentCount, playerReagentCount =  
==Parameters==
    GetTradeSkillReagentInfo(tradeSkillRecipeId, reagentId);
===Arguments===
 
----
;''Arguments''
 
:(Number tradeSkillRecipeId, Number reagentId)
 
:;tradeSkillRecipeId : The Id of the tradeskill recipe
:;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]])
:;reagentId : The Id of the reagent (from 1 to x, where x is the result of calling [[API GetTradeSkillNumReagents|GetTradeSkillNumReagents]])
 
===Returns===
----
:; reagentName : String - The name of the reagent.
;''Returns''
:; reagentTexture : String - The texture for the reagent's icon.
 
:; reagentCount : Integer - The quantity of this reagent required to make one of these items.
: String reagentName, String reagentTexture, Integer reagentCount, Integer playerReagentCount
:; playerReagentCount : Integer - The quantity of this reagent in the player's inventory.


:; reagentName : The name of the reagent.
==Example==
:; 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);
  local numReagents = GetTradeSkillNumReagents(id);
local totalReagents = 0;
  for i=1, numReagents, 1 do
  for i=1, numReagents, 1 do
   local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i);
   local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i);
   SetItemButtonTexture(reagent, reagentTexture);
   totalReagents = totalReagents + reagentCount;
  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;
  end;
 
===Result===
 
Calculates the total number of items required by the recipe.
----
{{Template:WoW API}}
 
[[Category:API TradeSkill Functions|GetTradeSkillReagentInfo]]

Latest revision as of 04:46, 15 August 2023

WoW API < GetTradeSkillReagentInfo

Returns information on reagents for the specified trade skill.

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

ParametersEdit

ArgumentsEdit

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

ReturnsEdit

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

ExampleEdit

local numReagents = GetTradeSkillNumReagents(id);
local totalReagents = 0;
for i=1, numReagents, 1 do
  local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i);
  totalReagents = totalReagents + reagentCount;
end;

ResultEdit

Calculates the total number of items required by the recipe.