Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
Fixed drop tables sometimes not auto-sorting properly
(Moved getAreaMonsterTable and getDungeonMonsterTable over from Module:CombatAreas to prevent dependency loop)
(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 pairs(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]
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 pairs(chest.dropTable) do
     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]