4,951
edits
Falterfire (talk | contribs) (Moved getAreaMonsterTable and getDungeonMonsterTable over from Module:CombatAreas to prevent dependency loop) |
Falterfire (talk | contribs) (Fixed drop tables sometimes not auto-sorting properly) |
||
Line 398: | Line 398: | ||
--Sort the loot table by weight in descending order | --Sort the loot table by weight in descending order | ||
table.sort(monster.lootTable, function(a, b) return a[2] > b[2] end) | table.sort(monster.lootTable, function(a, b) return a[2] > b[2] end) | ||
for i, row in | 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] | ||
Line 485: | Line 485: | ||
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 | for i, row in Shared.skpairs(chest.dropTable) do | ||
local thisItem = Items.getItemByID(row[1]) | local thisItem = Items.getItemByID(row[1]) | ||
local qty = row[3] | local qty = row[3] |