4,951
edits
ByteFoolish (talk | contribs) (getAreaFilterType) |
Falterfire (talk | contribs) (Added p.getDungeonRequirements) |
||
Line 68: | Line 68: | ||
end | end | ||
function p. | function p._getAreaStat(area, statName) | ||
if statName == 'slayerLevel' then | if statName == 'slayerLevel' then | ||
return Icons._SkillReq('Slayer', area.slayerLevel) | return Icons._SkillReq('Slayer', area.slayerLevel) | ||
elseif statName == 'slayerItem' then | |||
if area.slayerItem ~= nil and area.slayerItem > 0 then | if area.slayerItem ~= nil and area.slayerItem > 0 then | ||
local slayItem = Items.getItemByID(area.slayerItem) | local slayItem = Items.getItemByID(area.slayerItem) | ||
Line 84: | Line 77: | ||
else | else | ||
return 'None' | return 'None' | ||
end | |||
elseif statName == 'dungeonReq' then | |||
if area.requiresCompletion ~= nil and area.requiresCompletion >= 0 then | |||
local dung = p.getAreaByID('dungeon', area.requiresCompletion) | |||
return 'Completing '..Icons.Icon({dung.name, type='dungeon'}) | |||
else | |||
return '' | |||
end | end | ||
end | end | ||
return area[statName] | return area[statName] | ||
end | |||
function p.getAreaStat(frame) | |||
local areaName = frame.args ~= nil and frame.args[1] or frame[1] | |||
local statName = frame.args ~= nil and frame.args[2] or frame[2] | |||
local area = p.getArea(areaName) | |||
if area == nil then | |||
return "ERROR: Could not find an area named "..areaName | |||
end | |||
return p._getAreaStat(area, statName) | |||
end | end | ||
Line 111: | Line 122: | ||
end | end | ||
return areaArray | return areaArray | ||
end | |||
function p.getDungeonRequirements(frame) | |||
local areaName = frame.args ~= nil and frame.args[1] or frame | |||
local area = p.getArea(areaName) | |||
if area == nil then | |||
return "ERROR: Could not find an area named "..areaName | |||
end | |||
local result = p._getAreaStat(area, 'dungeonReq') | |||
if result ~= '' then | |||
result = '\r\n|-\r\n|Requirements:<br/>'..result | |||
end | |||
return result | |||
end | end | ||
return p | return p |