Module:Monsters: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 778: Line 778:
   end
   end
    
    
  local dropChance = nil
   if not p._isDungeonOnlyMonster(monster) then
   if not p._isDungeonOnlyMonster(monster) then
     local lootChance = monster.lootChance ~= nil and monster.lootChance or 100
     local lootChance = monster.lootChance ~= nil and monster.lootChance or 100
Line 789: Line 788:
for i, row in Shared.skpairs(monster.lootTable) do
for i, row in Shared.skpairs(monster.lootTable) do
local thisItem = Items.getItemByID(row[1])
local thisItem = Items.getItemByID(row[1])
mw.log(thisItem['id'])
if item['id'] == thisItem['id'] then
if item['id'] == thisItem['id'] then
    local dropChance = (row[2] / totalWt * lootChance)
    local dropChance = (row[2] / totalWt * lootChance)
    mw.log(dropChance)
    end
    end
end
end
return Shared.round(dropChance, 2, 2)
   end
   end
  mw.log(dropChance)
  return Shared.round(dropChance, 2, 2)
end
end


318

edits