Module:Items: Difference between revisions

Added a check for level requirements to the 'hasCombatStats' check for autoarmourstats just to be safe
(added ability to get whether an item hasCombatStats with p.getItemStat)
(Added a check for level requirements to the 'hasCombatStats' check for autoarmourstats just to be safe)
Line 137: Line 137:
return p._getItemModifier(item, 'increasedSkillXP', 'Slayer', false)
return p._getItemModifier(item, 'increasedSkillXP', 'Slayer', false)
elseif StatName == 'hasCombatStats' then
elseif StatName == 'hasCombatStats' then
return tostring(p.hasCombatStats(item))
return tostring(p.hasCombatStats(item) or p._hasLevelRequirements(item))
end
end
if result == nil and ZeroIfNil then result = 0 end
if result == nil and ZeroIfNil then result = 0 end
Line 202: Line 202:
end
end
return false
return false
end
function p._hasLevelRequirements(item)
--Function true if an item has at least one level requirement to equip
if item.equipRequirements ~= nil and item.equipRequirements.Level ~= nil then
for skillID, lvl in pairs(item.equipRequirements.Level) do
if lvl ~= nil and lvl > 1 then
return true
end
end
return false
else
return false
end
end
end