Module:Monsters: Difference between revisions

Moving getDungeonRewards to CombatAreas/Tables because it just makes more sense
(_getMonsterMaxHit: Modify for v0.20 stun/sleep logic)
(Moving getDungeonRewards to CombatAreas/Tables because it just makes more sense)
Line 813: Line 813:
   else
   else
     return p._getAreaMonsterList(area)
     return p._getAreaMonsterList(area)
  end
end
function p._getDungeonRewards(area)
  local bossMonster = p.getMonsterByID(area.monsters[Shared.tableCount(area.monsters)])
  local gpMin = bossMonster.dropCoins[1]
  local gpMax = bossMonster.dropCoins[2] - 1
  local chestID = bossMonster.lootTable[1][1]
  local chestQty = bossMonster.lootTable[1][3]
  local theChest = Items.getItemByID(chestID)
  local result = ''
  if gpMin > 0 and gpMax > 0 then
    result = result..'* '..Icons.GP(gpMin, gpMax)..'\r\n'
  end
  result = result..'* '..Icons.Icon({theChest.name, type='item', qty=chestQty})
  if area.name == 'Volcanic Cave' then
    result = result..'\r\n* '..Icons.Icon({'Fire Cape', type='item', qty=1})
  elseif area.name == 'Infernal Stronghold' then
    result = result..'\r\n* '..Icons.Icon({'Infernal Cape', type='item', qty=1})
  end
  return result
end
function p.getDungeonRewards(frame)
  local areaName = frame.args ~= nil and frame.args[1] or frame
  local area = Areas.getArea(areaName)
  if area == nil then
    return "ERROR: Could not find an area named "..areaName..'[[Category:Pages with script errors]]'
  end
  if area.type == 'dungeon' then
    return p._getDungeonRewards(area)
  else
    return "ERROR: "..areaName.." is not a dungeon[[Category:Pages with script errors]]"
   end
   end
end
end