Module:Items/ComparisonTables: Difference between revisions

getItemUpgradeTable: Avoid determining the stat change for upgraded items unless necessary
(Fix Bob's Rake style override)
(getItemUpgradeTable: Avoid determining the stat change for upgraded items unless necessary)
Line 468: Line 468:


local matArray = {}
local matArray = {}
local statChangeString = ''
for i, itemCost in ipairs(upgrade.itemCosts) do
for i, itemCost in ipairs(upgrade.itemCosts) do
local mat = Items.getItemByID(itemCost.id)
local mat = Items.getItemByID(itemCost.id)
if mat ~= nil then
if mat ~= nil then
table.insert(matArray, Icons.Icon({mat.name, type='item', qty=itemCost.quantity}))
table.insert(matArray, Icons.Icon({mat.name, type='item', qty=itemCost.quantity}))
if (isEquipment and item.validSlots ~= nil and mat.validSlots ~= nil) or (not isEquipment and useStatChange) and statChangeString == '' then
statChangeString = Items.getStatChangeString(item, mat)
end
end
end
end
end
Line 487: Line 483:


if useStatChange then
if useStatChange then
table.insert(resultPart, '||'..statChangeString)
-- Generate stat change column
local statChangeString = ''
if not Shared.tableIsEmpty(upgrade.rootItemIDs) then
-- Some items (e.g. FEZ) may have multiple root items. Simply use the first one
local rootItem = Items.getItemByID(upgrade.rootItemIDs[1])
if rootItem ~= nil then
statChangeString = Items.getStatChangeString(item, rootItem)
end
end
table.insert(resultPart, '|| '..statChangeString)
end
end
end
end