Module:CombatAreas: Difference between revisions

getAreaFilterType
(Tweaked processArea code to make sure a type is always added properly)
(getAreaFilterType)
Line 47: Line 47:
   elseif type == 'slayer' then type = 'slayerAreas' end
   elseif type == 'slayer' then type = 'slayerAreas' end
   return processArea(AreaData[type][id + 1], id + 1)
   return processArea(AreaData[type][id + 1], id + 1)
end
function p.getAreaFilterType(type, name)
  local areaName = nil
  if type == 'dungeon' then areas = AreaData.dungeons
  elseif type == 'combat' then areas = AreaData.combatAreas
  elseif type == 'slayer' then areas = AreaData.slayerAreas
  else return nil end
  for i, area in pairs(areas) do
    if type == 'dungeon' then areaName = area.name
    else areaName = area.areaName end
    if areaName == name then
      return processArea(area, i, type)
    end
  end
  return nil
end
end


285

edits