4,951
edits
Falterfire (talk | contribs) (p.getAreaStat now handles Slayer areas) |
Falterfire (talk | contribs) (Tweaked processArea code to make sure a type is always added properly) |
||
Line 8: | Line 8: | ||
local Items = require('Module:Items') | local Items = require('Module:Items') | ||
function processArea(area, index) | function processArea(area, index, type) | ||
local result = Shared.clone(area) | local result = Shared.clone(area) | ||
result.id = index - 1 | result.id = index - 1 | ||
Line 14: | Line 14: | ||
result.name = result.areaName | result.name = result.areaName | ||
end | end | ||
result.type = type | |||
return result | return result | ||
end | end | ||
Line 25: | Line 23: | ||
for i, area in pairs(AreaData.combatAreas) do | for i, area in pairs(AreaData.combatAreas) do | ||
if area.areaName == name then | if area.areaName == name then | ||
return processArea(area, i) | return processArea(area, i, 'combat') | ||
end | end | ||
end | end | ||
Line 31: | Line 29: | ||
for i, area in pairs(AreaData.slayerAreas) do | for i, area in pairs(AreaData.slayerAreas) do | ||
if area.areaName == name then | if area.areaName == name then | ||
return processArea(area, i) | return processArea(area, i, 'slayer') | ||
end | end | ||
end | end | ||
Line 37: | Line 35: | ||
for i, area in pairs(AreaData.dungeons) do | for i, area in pairs(AreaData.dungeons) do | ||
if area.name == name then | if area.name == name then | ||
return processArea(area, i) | return processArea(area, i, 'dungeon') | ||
end | end | ||
end | end | ||
Line 78: | Line 76: | ||
for i, area in pairs(AreaData.combatAreas) do | for i, area in pairs(AreaData.combatAreas) do | ||
if Shared.contains(area.monsters, monsterID) then | if Shared.contains(area.monsters, monsterID) then | ||
table.insert(areaArray, processArea(area, i)) | table.insert(areaArray, processArea(area, i, 'combat')) | ||
end | end | ||
end | end | ||
Line 84: | Line 82: | ||
for i, area in pairs(AreaData.slayerAreas) do | for i, area in pairs(AreaData.slayerAreas) do | ||
if Shared.contains(area.monsters, monsterID) then | if Shared.contains(area.monsters, monsterID) then | ||
table.insert(areaArray, processArea(area, i)) | table.insert(areaArray, processArea(area, i, 'slayer')) | ||
end | end | ||
end | end | ||
Line 90: | Line 88: | ||
for i, area in pairs(AreaData.dungeons) do | for i, area in pairs(AreaData.dungeons) do | ||
if Shared.contains(area.monsters, monsterID) then | if Shared.contains(area.monsters, monsterID) then | ||
table.insert(areaArray, processArea(area, i)) | table.insert(areaArray, processArea(area, i, 'dungeon')) | ||
end | end | ||
end | end |