Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
_getItemSources: Exclude loot tables of dungeon exclusive non-boss monsters
(_getItemLootSourceTable: Add fraction alongside percentage for chance stat (Attempt 2))
(_getItemSources: Exclude loot tables of dungeon exclusive non-boss monsters)
Line 280: Line 280:
         if loot[1] == item.id then
         if loot[1] == item.id then
           isDrop = true
           isDrop = true
          break
         end
         end
      end
      if isDrop then
        -- 2021-05-24 Additional checks for dungeon exclusive monsters: Loot is not rolled on
        -- dungeon exclusive monsters unless they are the boss/last enemy of that dungeon
        local rollForLoot = false
        for k, area in pairs(Areas.getMonsterAreas(i - 1)) do
          if not (area.type == 'dungeon') or (area.type == 'dungeon' and area.monsters[Shared.tableCount(area.monsters)] == i - 1) then
            -- Either monster isn't dungeon exclusive, or is the boss/last enemy of a dungeon
            rollForLoot = true
            break
          end
        end
        isDrop = rollForLoot
       end
       end
     end
     end