4,951
edits
Falterfire (talk | contribs) (Added what is hopefully a function version of p.getMonsterDrops) |
Falterfire (talk | contribs) (Added sorting to monsterDrop table) |
||
Line 384: | Line 384: | ||
result = result.."'''Loot:'''" | result = result.."'''Loot:'''" | ||
result = result..'\r\n{|class="wikitable"' | result = result..'\r\n{|class="wikitable sortable"' | ||
result = result..'\r\n!Item!!Qty' | result = result..'\r\n!Item!!Qty' | ||
if multiDrop then result = result..'!!Weight' end | if multiDrop then result = result..'!!Weight' end | ||
result = result..'!!Chance' | result = result..'!!Chance' | ||
--Sort the loot table by weight in descending order | |||
table.sort(monster.lootTable, function(a, b) return a[2] > b[2] end) | |||
for i, row in pairs(monster.lootTable) do | for i, row in pairs(monster.lootTable) do | ||
local thisItem = Items.getItemByID(row[1]) | local thisItem = Items.getItemByID(row[1]) |