Module:Skills/Archaeology: Difference between revisions

re-enabled doubleConsumableRefinementValue variable, it should only display if a digsite also drops consumables
No edit summary
(re-enabled doubleConsumableRefinementValue variable, it should only display if a digsite also drops consumables)
Line 77: Line 77:
table.insert(result, '||'..thisItem.type..'')
table.insert(result, '||'..thisItem.type..'')
table.insert(result, '||style="text-align:right" data-sort-value="'..row.maxQuantity..'"|')
table.insert(result, '||style="text-align:right" data-sort-value="'..row.maxQuantity..'"|')
if row.maxQuantity > row.minQuantity then
if row.maxQuantity > row.minQuantity then
table.insert(result, Shared.formatnum(row.minQuantity) .. ' - ')
table.insert(result, Shared.formatnum(row.minQuantity) .. ' - ')
end
end
table.insert(result, Shared.formatnum(row.maxQuantity))
table.insert(result, Shared.formatnum(row.maxQuantity))
 
-- Adding price columns
--Adding price columns
local itemPrice = 0
local itemPrice = 0
if thisItem == nil then
if thisItem == nil then
Line 95: Line 93:
end
end
end
end
 
-- Getting the drop chance
--Getting the drop chance
local dropChance = (row.weight / totalWt)
local dropChance = (row.weight / totalWt)
if dropChance < 100 then
if dropChance < 100 then
Line 109: Line 106:
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)..'%')
-- Setting average gp values with various parameters
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))
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 Items._canItemUseSlot(thisItem, 'Consumable') ~= nil then
            doubleConsumableRefinementValue = lootValue + (dropChance * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2))
        end
end
end
587

edits