Module:Skills/Archaeology: Difference between revisions

_getDigSiteArtefactValue: Amend calculation of +1 and double consumable bonus GP values
mNo edit summary
(_getDigSiteArtefactValue: Amend calculation of +1 and double consumable bonus GP values)
Line 107: Line 107:
table.insert(result, 'style="text-align:right"|'..string.format(fmt, dropChance * 100)..'%')
table.insert(result, 'style="text-align:right"|'..string.format(fmt, dropChance * 100)..'%')
-- Setting average gp values with various parameters
-- Setting average gp values with various parameters
lootValue = lootValue + (dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2))
local artefactAvgValue = dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity) / 2)
plusOneMinimumRefinementValue = plusOneMinimumRefinementValue + (dropChance * thisItem.sellsFor * (((row.minQuantity+1) + (row.maxQuantity+1))/ 2))
lootValue = lootValue + artefactAvgValue
plusOneMinimumRefinementValue = plusOneMinimumRefinementValue + (dropChance * thisItem.sellsFor)  
-- Checking if item is a consumable, then adding its value a second time
-- Checking if item is a consumable, then adding its value a second time
         if Items._canItemUseSlot(thisItem, 'Consumable') ~= nil then
         if Items._canItemUseSlot(thisItem, 'Consumable') then
             doubleConsumableRefinementValue = lootValue + (dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2))
             doubleConsumableRefinementValue = doubleConsumableRefinementValue + artefactAvgValue
         end
         end
end
end
Line 117: Line 118:
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\n\nThe average value of one action with the +1 Minimum Items refinement is '..Icons.GP(Shared.round(plusOneMinimumRefinementValue, 2, 0))..'.')
table.insert(result, '\r\n\r\nThe average value of one action with the +1 Minimum Items refinement is '..Icons.GP(Shared.round(lootValue + plusOneMinimumRefinementValue, 2, 0))..'.')
if doubleConsumableRefinementValue > lootValue then
if doubleConsumableRefinementValue > 0 then
table.insert(result, '\r\n\nThe average value of one action with the x2 Consumables refinement is '..Icons.GP(Shared.round(doubleConsumableRefinementValue, 2, 0))..'.')
table.insert(result, '\r\n\r\nThe average value of one action with the x2 Consumables refinement is '..Icons.GP(Shared.round(lootValue + doubleConsumableRefinementValue, 2, 0))..'.')
end
end