4,951
edits
ByteFoolish (talk | contribs) m (Remove link if SlayerTier is N/A) |
Falterfire (talk | contribs) (Added handling for items that haven't been added yet) |
||
Line 647: | Line 647: | ||
for i, row in Shared.skpairs(monster.lootTable) do | for i, row in Shared.skpairs(monster.lootTable) do | ||
local thisItem = Items.getItemByID(row[1]) | local thisItem = Items.getItemByID(row[1]) | ||
local maxQty = row[3] | local maxQty = row[3] | ||
result = result..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'}) | if thisItem ~= nil then | ||
result = result..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'}) | |||
else | |||
result = result..'\r\n|-\r\n|Unknown Item[[Category:Pages with script errors]]' | |||
end | |||
result = result..'||style="text-align:right" data-sort-value="'..maxQty..'"|' | result = result..'||style="text-align:right" data-sort-value="'..maxQty..'"|' | ||
Line 657: | Line 662: | ||
--Adding price columns | --Adding price columns | ||
local itemPrice = 0 | |||
if | if thisItem == nil then | ||
result = result..'||data-sort-value="0"|???' | |||
else | else | ||
itemPrice = thisItem.sellsFor ~= nil and thisItem.sellsFor or 0 | |||
if itemPrice == 0 or maxQty == 1 then | |||
result = result..'||'..Icons.GP(itemPrice) | |||
else | |||
result = result..'||'..Icons.GP(itemPrice, itemPrice * maxQty) | |||
end | |||
end | end | ||