Module:Items/UseTables: Difference between revisions

Apply fixes
(Update for v1.1)
(Apply fixes)
Line 183: Line 183:
for i, recipeSkillID in ipairs(recipeSkillIDs) do
for i, recipeSkillID in ipairs(recipeSkillIDs) do
if not hasUse(recipeSkillID) then
if not hasUse(recipeSkillID) then
local localSkillID = GameData.getLocalID(recipeSkillID)
local _, localSkillID = GameData.getLocalID(recipeSkillID)
-- Iterate over all recipes for the current skill
-- Iterate over all recipes for the current skill
for j, recipe in ipairs(SkillData[localSkillID].recipes) do
for j, recipe in ipairs(SkillData[localSkillID].recipes) do
Line 403: Line 403:
for i, recipeSkillID in ipairs(recipeSkillIDs) do
for i, recipeSkillID in ipairs(recipeSkillIDs) do
local skillName = Constants.getSkillName(recipeSkillID)
local skillName = Constants.getSkillName(recipeSkillID)
local localSkillID = GameData.getLocalID(recipeSkillID)
local _, localSkillID = GameData.getLocalID(recipeSkillID)
-- Iterate over all recipes for the current skill
-- Iterate over all recipes for the current skill
for j, recipe in ipairs(SkillData[localSkillID].recipes) do
for j, recipe in ipairs(SkillData[localSkillID].recipes) do
Line 505: Line 506:
--Handle shop purchases using Module:Shop
--Handle shop purchases using Module:Shop
local shopUses = Shop.getItemCostArray(item.id)
local shopUses = Shop.getItemCostArray(item.id)
for i, purchase in ipairs(shopUses) do
for i, shopUse in ipairs(shopUses) do
local purchase = shopUse.purchase
local rowReq = Shop.getRequirementString(purchase.unlockRequirements)
local rowReq = Shop.getRequirementString(purchase.unlockRequirements)
local iconType = (purchase.contains.items ~= nil and not Shared.tableIsEmpty(purchase.contains.items) and 'item') or 'upgrade'
local iconType = (purchase.contains.items ~= nil and not Shared.tableIsEmpty(purchase.contains.items) and 'item') or 'upgrade'
Line 511: Line 513:
local scCost = Shop.getCurrencyCostString(purchase.cost, 'slayerCoins')
local scCost = Shop.getCurrencyCostString(purchase.cost, 'slayerCoins')
local rcCost = Shop.getCurrencyCostString(purchase.cost, 'raidCoins')
local rcCost = Shop.getCurrencyCostString(purchase.cost, 'raidCoins')
table.insert(useArray, {item = {name = Shop._getPurchaseName(purchase)}, qty = 1, mats = purchase.cost.items, skill = 'Shop', req = rowReq, xp = 'N/A', gp = gpCost, sc = scCost, rc = rcCost, type = iconType})
table.insert(useArray, {item = {name = Shop._getPurchaseName(purchase)}, qty = shopUse.qty, mats = purchase.cost.items, skill = 'Shop', req = rowReq, xp = 'N/A', gp = gpCost, sc = scCost, rc = rcCost, type = iconType})
end
end