WoW:API GetTradeSkillNumReagents: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Move page script moved page API GetTradeSkillNumReagents to WoW:API GetTradeSkillNumReagents without leaving a redirect) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 15: | Line 15: | ||
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); | ||
totalReagents = totalReagents | totalReagents = totalReagents + reagentCount; | ||
end; | end; | ||
===Result=== | ===Result=== | ||
Latest revision as of 04:46, 15 August 2023
← WoW API < GetTradeSkillNumReagents
Returns the number of distinct reagents required by the specified recipe.
numReagents = GetTradeSkillNumReagents(tradeSkillRecipeId);
Parameters
Arguments
- tradeSkillRecipeId
- Integer - The id of the trade skill recipe.
Returns
- reagentCount
- Integer - The number of distinct 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;
Result
Calculates the total number of items required by the recipe.
Notes
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 distinct reagents you need, you can use GetTradeSkillReagentInfo to find out how many of each one are required.