17,101
edits
(Substitute links with Icons.Icon() where possible to benefit from ambiguous link handling) |
(_getDungeonRewards: Safely handle cases where boss monsters have no loot table) |
||
Line 115: | Line 115: | ||
local gpMin = bossMonster.dropCoins[1] | local gpMin = bossMonster.dropCoins[1] | ||
local gpMax = bossMonster.dropCoins[2] - 1 | local gpMax = bossMonster.dropCoins[2] - 1 | ||
local chestID = bossMonster.lootTable[1][1] | local chestID, chestQty, theChest = nil, nil, nil | ||
if bossMonster.lootTable ~= nil and Shared.tableCount(bossMonster.lootTable) > 0 then | |||
chestID = bossMonster.lootTable[1][1] | |||
chestQty = bossMonster.lootTable[1][3] | |||
theChest = Items.getItemByID(chestID) | |||
end | |||
local chr = asList and '* ' or '' | local chr = asList and '* ' or '' | ||
local rewardList = {} | local rewardList = {} | ||
Line 124: | Line 127: | ||
table.insert(rewardList, chr..Icons.GP(gpMin, gpMax)) | table.insert(rewardList, chr..Icons.GP(gpMin, gpMax)) | ||
end | end | ||
table.insert(rewardList, chr..Icons.Icon({theChest.name, type='item', qty=chestQty})) | if theChest ~= nil then | ||
table.insert(rewardList, chr..Icons.Icon({theChest.name, type='item', qty=chestQty})) | |||
end | |||
if area.name == 'Volcanic Cave' then | if area.name == 'Volcanic Cave' then | ||
table.insert(rewardList, chr..Icons.Icon({'Fire Cape', type='item', qty=1})) | table.insert(rewardList, chr..Icons.Icon({'Fire Cape', type='item', qty=1})) |