Module:Monsters: Difference between revisions

Fix for areas using random pools of monsters
(Revise monster area table format for compactness)
(Fix for areas using random pools of monsters)
Line 1,428: Line 1,428:
-- Declare function for building table rows to avoid repeating code
-- Declare function for building table rows to avoid repeating code
local buildRow = function(entityID, monsterCount, specialType)
local buildRow = function(entityID, monsterCount, specialType)
local monIcon, monLevel, monHP, monMaxHit, monStyle, monCount, monDrReduce, monBarrier
local monIcon, monLevel, monHP, monMaxHit, monStyle, monCount, monDrReduce, monBarrier, monDmgTypeIcon
local monData = {}
local monData = {}
if specialType ~= nil and Shared.contains({'Afflicted', 'Spider', 'SlayerArea'}, specialType) then
if specialType ~= nil and Shared.contains({'Afflicted', 'Spider', 'SlayerArea'}, specialType) then
Line 1,435: Line 1,435:
local iconQ = Icons.Icon({'Into the Mist', notext=true, nolink=true, img='Question'})
local iconQ = Icons.Icon({'Into the Mist', notext=true, nolink=true, img='Question'})
monIcon = Icons.Icon({'Into the Mist', 'Afflicted Monster', nolink=true, img='Question'})
monIcon = Icons.Icon({'Into the Mist', 'Afflicted Monster', nolink=true, img='Question'})
monLevel, monBarrier, monHP, monMaxHit, monDrReduce, monStyle, monCount = iconQ, iconQ, iconQ, iconQ, iconQ, iconQ, monsterCount
monLevel, monBarrier, monHP, monMaxHit, monDrReduce, monStyle, monDmgTypeIcon, monCount = iconQ, iconQ, iconQ, iconQ, iconQ, iconQ, iconQ, monsterCount
elseif specialType == 'Spider' then
elseif specialType == 'Spider' then
local iconQ = Icons.Icon({'', notext=true, nolink=true, img='Question'})
local iconQ = Icons.Icon({'', notext=true, nolink=true, img='Question'})
Line 1,446: Line 1,446:
end
end
monIcon = table.concat(monIconPart, '<br/>')
monIcon = table.concat(monIconPart, '<br/>')
monLevel, monBarrier, monHP, monMaxHit, monDrReduce, monStyle, monCount = iconQ, iconQ, iconQ, iconQ, iconQ, iconQ, monsterCount
monLevel, monBarrier, monHP, monMaxHit, monDrReduce, monStyle, monDmgTypeIcon, monCount = iconQ, iconQ, iconQ, iconQ, iconQ, iconQ, iconQ, monsterCount
elseif specialType == 'SlayerArea' then
elseif specialType == 'SlayerArea' then
-- entityID corresponds to a slayer area
-- entityID corresponds to a slayer area
local area = Areas.getAreaByID('slayer', entityID)
local area = Areas.getAreaByID('slayer', entityID)
local iconQ = Icons.Icon({area.name, area.name, notext=true, nolink=true, img='Question'})
monIcon = Icons.Icon({area.name, type='combatArea'}) .. ' Monsters'
monIcon = Icons.Icon({area.name, type='combatArea'}) .. ' Monsters'
monLevel = {p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterCombatLevel(monster) end)}
monLevel = {p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterCombatLevel(monster) end)}
Line 1,460: Line 1,461:
monMaxHit = highMaxHit
monMaxHit = highMaxHit
monDrReduce = highDrReduce
monDrReduce = highDrReduce
monStyle = Icons.Icon({area.name, area.name, notext=true, nolink=true, img='Question'})
monDmgTypeIcon = iconQ
monStyle = iconQ
monCount = monsterCount
monCount = monsterCount
end
end