4,951
edits
Falterfire (talk | contribs) (Added a Bosses category) |
Falterfire (talk | contribs) (Fixed chest drop table quantity sorting issue.) |
||
Line 490: | Line 490: | ||
--Sort the loot table by weight in descending order | --Sort the loot table by weight in descending order | ||
for i, row in pairs(chest.dropTable) do | |||
if chest.dropQty ~= nil then | |||
table.insert(row, chest.dropQty[i]) | |||
else | |||
table.insert(row, 1) | |||
end | |||
end | |||
table.sort(chest.dropTable, function(a, b) return a[2] > b[2] end) | table.sort(chest.dropTable, function(a, b) return a[2] > b[2] end) | ||
for i, row in pairs(chest.dropTable) do | for i, row in pairs(chest.dropTable) do | ||
local thisItem = Items.getItemByID(row[1]) | local thisItem = Items.getItemByID(row[1]) | ||
local qty = | local qty = row[3] | ||
result = result..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'}) | result = result..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'}) | ||
result = result..'||style="text-align:right" data-sort-value="'..qty..'"|' | result = result..'||style="text-align:right" data-sort-value="'..qty..'"|' |