17,101
edits
(Amend/correct handling for random ITM and random spider lair monsters) |
(_getDungeonMonsterList: Fix) |
||
Line 1,073: | Line 1,073: | ||
function p._getDungeonMonsterList(area) | function p._getDungeonMonsterList(area) | ||
local monsterList = {} | local monsterList = {} | ||
local lastID = '' | |||
local lastID = | |||
local count = 0 | local count = 0 | ||
-- Special handing for Impending Darkness event | -- Special handing for Impending Darkness event | ||
Line 1,085: | Line 1,084: | ||
-- table.insert(monsterList, '4 ' .. Icons.Icon({'Bane', type='monster'})) | -- table.insert(monsterList, '4 ' .. Icons.Icon({'Bane', type='monster'})) | ||
--end | --end | ||
for i, monsterID in | |||
if | local monsterCounts = {} | ||
for i, monsterID in ipairs(area.monsterIDs) do | |||
if lastID == '' then | |||
lastID = monsterID | lastID = monsterID | ||
count = 1 | count = 1 | ||
elseif lastID == monsterID then | |||
count = count + 1 | |||
else | else | ||
count = count | table.insert(monsterCounts, { id = lastID, count = count }) | ||
lastID = monsterID | |||
count = 1 | |||
end | end | ||
-- | end | ||
table.insert(monsterCounts, { id = lastID, count = count }) | |||
local | |||
table.insert(monsterList, Icons.Icon({ | for i, monster in ipairs(monsterCounts) do | ||
if monster.id == 'melvorF:RandomITM' then | |||
--Special handling for Afflicted Monsters | |||
table.insert(monsterList, Icons.Icon({'Affliction', 'Afflicted Monster', img='Question', qty=monster.count})) | |||
elseif monster.id == 'melvorTotH:RandomSpiderLair' then | |||
table.insert(monsterList, Icons.Icon({'Spider', img='Question', nolink=true, qty=monster.count})) | |||
else | |||
local monsterObj = p.getMonsterByID(monster.id) | |||
table.insert(monsterList, Icons.Icon({monsterObj.name, type='monster', qty=monster.count})) | |||
end | end | ||
end | end | ||
return table.concat(monsterList, '<br/>') | return table.concat(monsterList, '<br/>') | ||
end | end |