Anonymous

Module:Items: Difference between revisions

From Melvor Idle
Added p._getItemEquipSlot (for use with the DR table I'm adding to Items/ComparisonTables
(Added p._canItemUseSlot)
(Added p._getItemEquipSlot (for use with the DR table I'm adding to Items/ComparisonTables)
Line 45: Line 45:
end
end
return item.validSlots ~= nil and Shared.contains(item.validSlots, equipSlot)
return item.validSlots ~= nil and Shared.contains(item.validSlots, equipSlot)
end
function p._getItemEquipSlot(item)
--Function to return the (non-Passive) equipment slot that an item occupies
if type(item) == 'string' then
item = p.getItem(item)
end
if item == nil or item.validSlots == nil then
return 'Invalid'
end
for i, slot in pairs(item.validSlots) do
if slot ~= 'Passive' then
return slot
end
end
end
end