Module:Monsters: Difference between revisions

Now uses Module:CombatAreas instead of directly pulling from Module:CombatAreas/data
(Change to fit new format for getting spells by id)
(Now uses Module:CombatAreas instead of directly pulling from Module:CombatAreas/data)
Line 3: Line 3:
local Constants = mw.loadData('Module:Constants/data')
local Constants = mw.loadData('Module:Constants/data')
local MonsterData = mw.loadData('Module:Monsters/data')
local MonsterData = mw.loadData('Module:Monsters/data')
local AreaData = mw.loadData('Module:CombatAreas/data')


local Areas = require('Module:CombatAreas')
local Magic = require('Module:Magic')
local Magic = require('Module:Magic')
local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
Line 200: Line 200:


   local result = ''
   local result = ''
   for i, area in pairs(AreaData.combatAreas) do
   local areaList = Areas.getMonsterAreas(monster.id)
    if Shared.contains(area.monsters, monster.id) then
   for i, area in pairs(areaList) do
      if string.len(result) > 0 then result = result..'<br/>' end
     if i > 1 then result = result..'<br/>' end
      result = result..Icons.Icon({area.areaName, type = 'combatArea'})
    result = result..Icons.Icon({area.name, type = area.type})
    end
  end
   for i, area in pairs(AreaData.slayerAreas) do
     if Shared.contains(area.monsters, monster.id) then
      if string.len(result) > 0 then result = result..'<br/>' end
      result = result..Icons.Icon({area.areaName, type = 'combatArea'})..'[[Category:Slayer Monsters]]'
    end
  end
  for i, area in pairs(AreaData.dungeons) do
    if Shared.contains(area.monsters, monster.id) then
      if string.len(result) > 0 then result = result..'<br/>' end
      result = result..Icons.Icon({area.name, type = 'dungeon'})..'[[Category:Dungeon Monsters]]'
    end
   end
   end
   return result
   return result