WoW:API GetTradeSkillNumReagents: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
Line 3: Line 3:
Returns the number of different reagents required by the specified recipe. Thus, if a recipe calls for 2 copper tubes, 1 malachite and 2 blasting powders, GetTradeSkillNumReagents would return 3. If it required 5 linen cloths, the result would be 1.
Returns the number of different reagents required by the specified recipe. Thus, if a recipe calls for 2 copper tubes, 1 malachite and 2 blasting powders, GetTradeSkillNumReagents would return 3. If it required 5 linen cloths, the result would be 1.


Once you know how many different reagents you need, you can use [[API GetTradeSkillReagentInfo]] to find out how many of each one are required.
Once you know how many different reagents you need, you can use [[API GetTradeSkillReagentInfo|GetTradeSkillReagentInfo]] to find out how many of each one are required.


  local numReagents = GetTradeSkillNumReagents(tradeSkillRecipeId);
  local numReagents = GetTradeSkillNumReagents(tradeSkillRecipeId);

Revision as of 15:28, 23 March 2005

GetTradeSkillNumReagents -Documentation by Goldark-

Returns the number of different reagents required by the specified recipe. Thus, if a recipe calls for 2 copper tubes, 1 malachite and 2 blasting powders, GetTradeSkillNumReagents would return 3. If it required 5 linen cloths, the result would be 1.

Once you know how many different reagents you need, you can use GetTradeSkillReagentInfo to find out how many of each one are required.

local numReagents = GetTradeSkillNumReagents(tradeSkillRecipeId);

Arguments
(Number tradeSkillRecipeId)
tradeSkillRecipeId
The Id of the trade skill recipe

Returns
Integer reagentCount
reagentCount
The number of different reagents required to create the item.



Example
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;



Template:WoW API