Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
Removed fraction columns when it will be 1/1, added average value including GP
(Added Chest EV)
(Removed fraction columns when it will be 1/1, added average value including GP)
Line 383: Line 383:


     result = result.."'''Loot:'''"
     result = result.."'''Loot:'''"
    local avgGp = 0


     if monster.dropCoins ~= nil then
     if monster.dropCoins ~= nil then
      avgGp = (monster.dropCoins[1] + monster.dropCoins[2]) / 2
       local gpTxt = Icons.GP(monster.dropCoins[1], monster.dropCoins[2])
       local gpTxt = Icons.GP(monster.dropCoins[1], monster.dropCoins[2])
       if lootChance == 100 then
       if lootChance == 100 then
Line 417: Line 419:
       --Getting the drop chance
       --Getting the drop chance
       local dropChance = (row[2] / totalWt * lootChance)
       local dropChance = (row[2] / totalWt * lootChance)
       result = result..'||style="text-align:right" data-sort-value="'..row[2]..'"'
       if dropChance ~= 100 then
      result = result..'|'..Shared.fraction(row[2] * lootChance, totalWt * 100)
        --Show fraction as long as it isn't going to be 1/1
       result = result..'||style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%'
        result = result..'||style="text-align:right" data-sort-value="'..row[2]..'"'
        result = result..'|'..Shared.fraction(row[2] * lootChance, totalWt * 100)
        result = result..'||'
       else
        result = result..'||colspan="2" data-sort-value="'..row[2]..'"'
      end
      result = result..'style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%'


       --Adding price columns
       --Adding price columns
Line 442: Line 450:
     end
     end
     result = result..'\r\n|}'
     result = result..'\r\n|}'
     result = result..'\r\nThe loot from the average kill is worth '..Icons.GP(Shared.round(lootValue, 2, 0)).." (Not including GP)"
     result = result..'\r\nThe loot dropped by the average kill is worth '..Icons.GP(Shared.round(lootValue, 2, 0)).." if sold"
    result = result..'<br/>Including the GP, the average kill is worth '..Icons.GP(Shared.round(avgGp + lootValue, 2, 0))
   end
   end