17,105
edits
(Correct Slayer function issues) |
m (getSlayerTierByLevel: Further fixes) |
||
Line 443: | Line 443: | ||
function p.getSlayerTierByLevel(level) -- returns a full table | function p.getSlayerTierByLevel(level) -- returns a full table | ||
if type(level) ~= 'number' or level < | if type(level) ~= 'number' or level < 1 then | ||
return "ERROR: Invalid Slayer level [[Category:Pages with script errors]]" | return "ERROR: Invalid Slayer level [[Category:Pages with script errors]]" | ||
end | end | ||
for i, tier in ipairs(ConstantData.Slayer.Tiers) do | for i, tier in ipairs(ConstantData.Slayer.Tiers) do | ||
if tier.minLevel <= level and (tier.maxLevel == nil | if tier.minLevel <= level and (tier.maxLevel == nil or tier.maxLevel >= level) then | ||
return p.getSlayerTierByID(i - 1) | return p.getSlayerTierByID(i - 1) | ||
end | end |