Anonymous

Module:Items/ComparisonTables: Difference between revisions

From Melvor Idle
Update for change in structure of equipmentSlots data
(_getEquipmentTable: Implement Strength level requirement column)
(Update for change in structure of equipmentSlots data)
Line 278: Line 278:


function p._getCategoryTable(style, slot, other, includeModifiers, includeDescription, sortByName)
function p._getCategoryTable(style, slot, other, includeModifiers, includeDescription, sortByName)
if type(slot) == 'number' then
-- If slot is a slot name, convert it to the slot ID instead
slot = Constants.getEquipmentSlotName(slot)
slot = Constants.getEquipmentSlotID(slot) or (Constants.getEquipmentSlotName(slot) ~= nil and slot)
end


local itemList = Items.getItems(function(item)
local itemList = Items.getItems(function(item)
Line 482: Line 481:
)
)
else
else
if Constants.getEquipmentSlotID(category) == nil then
-- If category is a slot name, convert it to the slot ID instead
category = Constants.getEquipmentSlotID(category) or (Constants.getEquipmentSlotName(category) ~= nil and category)
if category == nil then
return Shared.printError('Invalid option. Choose either an equipment slot, Potion, or Other')
return Shared.printError('Invalid option. Choose either an equipment slot, Potion, or Other')
end
end