Module:Items/SourceTables: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 820: Line 820:
table.insert(rowPart, '\r\n|colspan="2" ')
table.insert(rowPart, '\r\n|colspan="2" ')
else
else
local fraction = Shared.fraction(weight, totalWeight)
local fraction = Num.fraction(weight, totalWeight)
if Shared.contains(fraction, '%.') then
if Shared.contains(fraction, '%.') then
--If fraction contains decimals, something screwy happened so just show only percentage
--If fraction contains decimals, something screwy happened so just show only percentage
Line 826: Line 826:
table.insert(rowPart, '\r\n|colspan="2" ')
table.insert(rowPart, '\r\n|colspan="2" ')
else
else
table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="' .. chanceStr .. '"| ' .. Shared.fraction(weight, totalWeight) .. '\r\n|')
table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="' .. chanceStr .. '"| ' .. Num.fraction(weight, totalWeight) .. '\r\n|')
end
end
end
end
Line 1,303: Line 1,303:
chance = chance * lootChance
chance = chance * lootChance
weight = weight * 100
weight = weight * 100
chance, weight = Shared.fractionpair(chance, weight)
chance, weight = Num.fractionpair(chance, weight)
end
end
if chance > 0 then
if chance > 0 then
2,875

edits