Anonymous

Module:Items/UseTables: Difference between revisions

From Melvor Idle
_getItemUses: Amend upgrade logic such that items aren't flagged as used in upgrades if they only are the result of an upgrade
(changed wording on items column to 'item cost')
(_getItemUses: Amend upgrade logic such that items aren't flagged as used in upgrades if they only are the result of an upgrade)
Line 141: Line 141:
end
end


-- Can the item be upgraded, or is it part of an upgrade recipe?
-- Is the item a cost in an upgrade?
for i, upgrade in ipairs(GameData.rawData.itemUpgrades) do
for i, upgrade in ipairs(GameData.rawData.itemUpgrades) do
if upgrade.upgradedItemID == item.id then
for j, itemCost in ipairs(upgrade.itemCosts) do
addUse('Upgrade')
if itemCost.id == item.id then
else
addUse('Upgrade')
for j, itemCost in ipairs(upgrade.itemCosts) do
table.insert(categoryArray, '[[Category:Upgradeable Items]]')
if itemCost.id == item.id then
break
addUse('Upgrade')
break
end
end
end
end
end
Line 156: Line 153:
break
break
end
end
end
if hasUse('Upgrade') then
table.insert(categoryArray, '[[Category:Upgradeable Items]]')
end
end