17,030
edits
mNo edit summary |
m (Adapt to revised data format) |
||
Line 92: | Line 92: | ||
end | end | ||
return result | return result | ||
end | end | ||
Line 133: | Line 99: | ||
-- Equipment stats first | -- Equipment stats first | ||
if Shared.contains(ItemData.EquipmentStatKeys, StatName) and item.equipmentStats ~= nil then | if Shared.contains(ItemData.EquipmentStatKeys, StatName) and item.equipmentStats ~= nil then | ||
result = item.equipmentStats[StatName] | |||
elseif StatName == 'isTwoHanded' then | elseif StatName == 'isTwoHanded' then | ||
if item.validSlots ~= nil and item.occupiesSlots ~= nil then | if item.validSlots ~= nil and item.occupiesSlots ~= nil then | ||
result = Shared.contains(item.validSlots, 'Weapon') and Shared.contains(item.occupiesSlots, 'Shield') | |||
else | else | ||
result = false | |||
end | end | ||
elseif string.find(StatName, '^(.+)LevelRequired$') ~= nil then | elseif string.find(StatName, '^(.+)LevelRequired$') ~= nil and item.equipRequirements ~= nil and item.equipRequirements.Level ~= nil then | ||
local skillName = Shared.titleCase(string.match(StatName, '^(.+)LevelRequired$')) | local skillName = Shared.titleCase(string.match(StatName, '^(.+)LevelRequired$')) | ||
if skillName ~= nil then | if skillName ~= nil then | ||
local | local skillID = Constants.getSkillID(skillName) | ||
result = | if skillID ~= nil then | ||
result = item.equipRequirements.Level[skillID] | |||
end | |||
end | end | ||
elseif StatName == 'attackType' then | elseif StatName == 'attackType' then | ||
Line 154: | Line 121: | ||
elseif StatName == 'completionReq' then | elseif StatName == 'completionReq' then | ||
if item.ignoreCompletion == nil or not item.ignoreCompletion then | if item.ignoreCompletion == nil or not item.ignoreCompletion then | ||
result = 'Yes' | |||
else | else | ||
result = 'No' | |||
end | end | ||
elseif StatName == 'slayerBonusXP' then | elseif StatName == 'slayerBonusXP' then | ||
Line 219: | Line 186: | ||
if not item.isEquipment or item.validSlots == nil and item.equipmentStats ~= nil then | if not item.isEquipment or item.validSlots == nil and item.equipmentStats ~= nil then | ||
-- Ensure at least one stat has a non-zero value | -- Ensure at least one stat has a non-zero value | ||
for statName, statVal in pairs(item.equipmentStats) do | |||
for statName, statVal in pairs( | |||
if statVal ~= 0 then return true end | if statVal ~= 0 then return true end | ||
end | end |