17,105
edits
(_getItemStat: Add backwards compatibility for isTwoHanded & LevelRequirement stats) |
(_getItemStat: Don't waste time iterating over equipRequirements if the specified skill was not found) |
||
Line 139: | Line 139: | ||
local skillName = Shared.titleCase(string.match(StatName, '^(.+)LevelRequired$')) | local skillName = Shared.titleCase(string.match(StatName, '^(.+)LevelRequired$')) | ||
local skillID = Constants.getSkillID(skillName) | local skillID = Constants.getSkillID(skillName) | ||
for i, req in pairs(item.equipRequirements) do | if skillID ~= nil then | ||
for i, req in pairs(item.equipRequirements) do | |||
if req.type == 'Level' then | |||
for j, levelReq in pairs(req.levels) do | |||
if levelReq.skill == skillID then | |||
result = levelReq.level | |||
break | |||
end | |||
end | end | ||
if result ~= nil then break end | |||
end | end | ||
end | end | ||
end | end |