Module:Monsters: Difference between revisions

Added Chest EV
mNo edit summary
(Added Chest EV)
Line 464: Line 464:
   else
   else
     local lootChance = 100
     local lootChance = 100
    local lootValue = 0


     local multiDrop = Shared.tableCount(chest.dropTable) > 1
     local multiDrop = Shared.tableCount(chest.dropTable) > 1
Line 494: Line 495:
       result = result..'||style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%'
       result = result..'||style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%'


       result = result..'||style="text-align:right" data-sort-value="'..thisItem.sellsFor..'"'
       result = result..'||style="text-align:left" data-sort-value="'..thisItem.sellsFor..'"'
       if qty > 1 then
       if qty > 1 then
         result = result..'|'..Icons.GP(thisItem.sellsFor, thisItem.sellsFor * qty)
         result = result..'|'..Icons.GP(thisItem.sellsFor, thisItem.sellsFor * qty)
Line 500: Line 501:
         result = result..'|'..Icons.GP(thisItem.sellsFor)
         result = result..'|'..Icons.GP(thisItem.sellsFor)
       end
       end
      lootValue = lootValue + (dropChance * 0.01 * thisItem.sellsFor * ((1 + qty)/ 2))
     end
     end
     result = result..'\r\n|}'
     result = result..'\r\n|}'
    result = result..'\r\nThe average value of the contents of one chest is '..Icons.GP(Shared.round(lootValue, 2, 0))
   end
   end