Anonymous

Module:Items/ComparisonTables: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 21: Line 21:
}
}


-- Special ID to identify two-handed weapons
local slotOverrides = {
local twoHandedWeaponID = '2hWeapons'
['2hWeapons'] = 'melvorD:2hWeapons',
['Enhancement'] = 'melvorD:Enhancement'
}


local function getSlotID(slot)
local function getSlotID(slot)
Line 29: Line 31:


if slotData == nil then
if slotData == nil then
-- Special case for 2h weapons. Assume 1h weapons otherwise.
if slotOverrides[slot] ~= nil then
if slot == twoHandedWeaponID then
return slotOverrides[slot]
return 'melvorD:' .. twoHandedWeaponID
end
end
 
-- slotID invalid, check if user provided a slot name
-- slotID invalid, check if user provided a slot name
slotData = GameData.getEntityByProperty('equipmentSlots', 'emptyName', slot)
slotData = GameData.getEntityByProperty('equipmentSlots', 'emptyName', slot)
Line 73: Line 74:
return false
return false
end
end
 
if item.name == 'Gods Enhancement (Superior)' then
mw.logObject(item)
end
if not Shared.contains(item.validSlots, slotLocalID) then  
if not Shared.contains(item.validSlots, slotLocalID) then  
-- Special case for when the slot is Weapon but the data slot is Quiver (throwables)
-- Special case for when the slot is Weapon but the data slot is Quiver (throwables)
Line 81: Line 85:
-- Special case when the slot ID is for two handed weapons (this ID doesn't actually exist in game)
-- Special case when the slot ID is for two handed weapons (this ID doesn't actually exist in game)
if slotLocalID == twoHandedWeaponID then
if slotLocalID == '2hWeapons' then
return Items._getItemStat(item, 'isTwoHanded')
return Items._getItemStat(item, 'isTwoHanded')
else
end
return false
if slotLocalID == 'Enhancement' then
return Shared.contains(item.validSlots, 'Enhancement1') or
  Shared.contains(item.validSlots, 'Enhancement2') or
  Shared.contains(item.validSlots, 'Enhancement3')
end
end
end
end
2,875

edits