Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
Added ability to hide deungeons in list of monster areas and applied that to the Slayer table
m (getSlayerTierMonsterTable: Attempt to resolve input issues again)
(Added ability to hide deungeons in list of monster areas and applied that to the Slayer table)
Line 271: Line 271:
end
end


function p._getMonsterAreas(monster)
function p._getMonsterAreas(monster, excludeDungeons)
   local result = ''
   local result = ''
  local hideDungeons = excludeDungeons ~= nil and excludeDungeons or false
   local areaList = Areas.getMonsterAreas(monster.id)
   local areaList = Areas.getMonsterAreas(monster.id)
   for i, area in pairs(areaList) do
   for i, area in pairs(areaList) do
     if i > 1 then result = result..'<br/>' end
     if area.type ~= 'dungeon' or not hideDungeons then
    result = result..Icons.Icon({area.name, type = area.type})
      if i > 1 then result = result..'<br/>' end
      result = result..Icons.Icon({area.name, type = area.type})
    end
   end
   end
   return result
   return result
Line 283: Line 286:
function p.getMonsterAreas(frame)
function p.getMonsterAreas(frame)
   local MonsterName = frame.args ~= nil and frame.args[1] or frame
   local MonsterName = frame.args ~= nil and frame.args[1] or frame
  local hideDungeons = frame.args ~= nil and frame.args[2] or nil
   local monster = p.getMonster(MonsterName)
   local monster = p.getMonster(MonsterName)


Line 289: Line 293:
   end
   end


   return p._getMonsterAreas(monster)
   return p._getMonsterAreas(monster, hideDungeons)
end
end


Line 980: Line 984:
       tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. (gpRange[1] + gpRange[2]) / 2 .. '" |' .. gpTxt
       tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. (gpRange[1] + gpRange[2]) / 2 .. '" |' .. gpTxt
       tableTxt = tableTxt .. '\r\n|style="text-align:center" |' .. boneTxt
       tableTxt = tableTxt .. '\r\n|style="text-align:center" |' .. boneTxt
       tableTxt = tableTxt .. '\r\n|style="text-align:right;white-space:nowrap" |' .. p._getMonsterAreas(monster)
       tableTxt = tableTxt .. '\r\n|style="text-align:right;white-space:nowrap" |' .. p._getMonsterAreas(monster, true)
     end
     end