Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
_getItemSourceTables: Exclude loot tables of dungeon exclusive non-boss monsters
(_getItemSources: Exclude loot tables of dungeon exclusive non-boss monsters)
(_getItemSourceTables: Exclude loot tables of dungeon exclusive non-boss monsters)
Line 298: Line 298:
     end
     end
     if isDrop then
     if isDrop then
       if monster.isBoss then
       if monster.isBoss and not Shared.contains(item.name, "Shard") then
         local areaList = Areas.getMonsterAreas(i - 1)
         local areaList = Areas.getMonsterAreas(i - 1)
         --If this is a boss then we actually are completing dungeons for this and need to figure out which one
         --If this is a boss then we actually are completing dungeons for this and need to figure out which one
Line 586: Line 586:
     local minqty = 1
     local minqty = 1
     local qty = 1
     local qty = 1
    local chance = 0
     local wt = 0
     local wt = 0
     local totalWt = 0
     local totalWt = 0
Line 594: Line 593:
       qty = monster.boneQty ~= nil and monster.boneQty or 1
       qty = monster.boneQty ~= nil and monster.boneQty or 1
       minqty = qty
       minqty = qty
       chance = 100
       wt = 1
      totalWt = 1
     elseif monster.lootTable ~= nil then
     elseif monster.lootTable ~= nil then
       for j, loot in pairs(monster.lootTable) do
       for j, loot in pairs(monster.lootTable) do
Line 605: Line 605:
     end
     end
     local lootChance = monster.lootChance ~= nil and monster.lootChance or 100
     local lootChance = monster.lootChance ~= nil and monster.lootChance or 100
    if wt > 0 and lootChance > 0 and not Shared.contains(item.name, 'Shard') 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
      if not rollForLoot then
        wt = 0
      end
    end
     if wt > 0 and lootChance > 0 then
     if wt > 0 and lootChance > 0 then
       local sourceTxt = nil
       local sourceTxt = nil
Line 631: Line 647:
     if item2.dropTable ~= nil then
     if item2.dropTable ~= nil then
       local qty = 1
       local qty = 1
      local chance = 0
       local wt = 0
       local wt = 0
       local totalWt = 0
       local totalWt = 0
Line 653: Line 668:
   for i, npc in pairs(SkillData.Thieving) do
   for i, npc in pairs(SkillData.Thieving) do
     local qty = 1
     local qty = 1
    local chance = 0
     local wt = 0
     local wt = 0
     local totalWt = 0
     local totalWt = 0