621
edits
(triple whoops) |
(attempting to add plusOneMinimumRefinementValue and doubleConsumableRefinementValue as separate notes) |
||
Line 47: | Line 47: | ||
local lootTable = Shared.shallowClone(digSite.artefacts[string.lower(size)]) | local lootTable = Shared.shallowClone(digSite.artefacts[string.lower(size)]) | ||
local lootValue = 0 | local lootValue = 0 | ||
local plusOneMinimumRefinementValue = 0 | |||
local doubleConsumableRefinementValue = 0 | |||
local totalWt = 0 | local totalWt = 0 | ||
for i, row in ipairs(lootTable) do | for i, row in ipairs(lootTable) do | ||
Line 65: | Line 67: | ||
for i, row in ipairs(lootTable) do | for i, row in ipairs(lootTable) do | ||
local thisItem = Items.getItemByID(row.itemID) | local thisItem = Items.getItemByID(row.itemID) | ||
if thisItem ~= nil then | if thisItem ~= nil then | ||
Line 106: | Line 109: | ||
local fmt = (dropChance < 0.10 and '%.2g') or '%.2f' | local fmt = (dropChance < 0.10 and '%.2g') or '%.2f' | ||
table.insert(result, 'style="text-align:right"|'..string.format(fmt, dropChance * 100)..'%') | table.insert(result, 'style="text-align:right"|'..string.format(fmt, dropChance * 100)..'%') | ||
lootValue = lootValue + (dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2)) | lootValue = lootValue + (dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2)) | ||
plusOneMinimumRefinementValue = plusOneMinimumRefinementValue + (dropChance * thisItem.sellsFor * (((row.minQuantity+1) + (row.maxQuantity+1))/ 2)) | |||
--Checking if item is a consumable, then adding its value a second time | |||
if thisItem._canItemUseSlot(thisItem, 'Consumable') then | |||
doubleConsumableRefinementValue = lootValue + (dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2)) | |||
end | |||
end | end | ||
table.insert(result, '\r\n|}') | table.insert(result, '\r\n|}') | ||
table.insert(result, '\r\nThe average value of one action is '..Icons.GP(Shared.round(lootValue, 2, 0))..'.') | table.insert(result, '\r\nThe average value of one action is '..Icons.GP(Shared.round(lootValue, 2, 0))..'.') | ||
table.insert(result, '\r\nThe average value of one action with the +1 Minimum Items refinement is '..Icons.GP(Shared.round(plusOneMinimumRefinementValue, 2, 0))..'.') | |||
if doubleConsumableRefinementValue>lootValue then | |||
table.insert(result, '\r\nThe average value of one action with the x2 Consumables refinement is '..Icons.GP(Shared.round(doubleConsumableRefinementValue, 2, 0))..'.') | |||
end | |||
return table.concat(result, '') | return table.concat(result, '') |