Module:Monsters: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1,087: Line 1,087:
result = result..'\r\n|-class="sortbottom" \r\n!colspan="3"|Total:'
result = result..'\r\n|-class="sortbottom" \r\n!colspan="3"|Total:'
if lootChance < 100 then
if lootChance < 100 then
result = result..'\r\n|style="text-align:right"|'..Shared.fraction(lootChance, 100)..'||'
result = result..'\r\n|style="text-align:right"|'..Num.fraction(lootChance, 100)..'||'
else
else
result = result..'\r\n|colspan="2" '
result = result..'\r\n|colspan="2" '
end
end
result = result..'style="text-align:right"|'..Shared.round(lootChance, 2, 2)..'%'
result = result..'style="text-align:right"|'..Num.round(lootChance, 2, 2)..'%'
end
end
result = result..'\r\n|}'
result = result..'\r\n|}'
result = result..'\r\nThe loot dropped by the average kill is worth '.. Icons._Currency('GP', Shared.round(lootValue, 2, 0)).." if sold."
result = result..'\r\nThe loot dropped by the average kill is worth '.. Icons._Currency('GP', Num.round(lootValue, 2, 0)).." if sold."
if avgGp > 0 then
if avgGp > 0 then
result = result.."<br/>Including GP"
result = result.."<br/>Including GP"
Line 1,103: Line 1,103:
result = result..' and barrier dust'
result = result..' and barrier dust'
end
end
result = result..', the average kill is worth '.. Icons._Currency('GP', Shared.round(avgGp + lootValue + boneVal + dustVal, 2, 0))..'.'
result = result..', the average kill is worth '.. Icons._Currency('GP', Num.round(avgGp + lootValue + boneVal + dustVal, 2, 0))..'.'
end
end
end
end
Line 1,200: Line 1,200:
end
end
dropChance = (dropWt / totalWt * lootChance)
dropChance = (dropWt / totalWt * lootChance)
return Shared.round(dropChance, 2, 2)
return Num.round(dropChance, 2, 2)
end
end
end
end
Line 1,253: Line 1,253:
local dropChance = (row.weight / totalWt) * 100
local dropChance = (row.weight / totalWt) * 100
result = result..'||style="text-align:right" data-sort-value="'..row.weight..'"'
result = result..'||style="text-align:right" data-sort-value="'..row.weight..'"'
result = result..'|'..Shared.fraction(row.weight, totalWt)
result = result..'|'..Num.fraction(row.weight, totalWt)


result = result..'||style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%'
result = result..'||style="text-align:right"|'..Num.round(dropChance, 2, 2)..'%'


result = result..'||style="text-align:left" data-sort-value="'..thisItem.sellsFor..'"'
result = result..'||style="text-align:left" data-sort-value="'..thisItem.sellsFor..'"'
Line 1,273: Line 1,273:
result = result .. '|' .. Icons.Icon({'Hitpoints', type='skill', notext=true, nolink=true}) .. ' ' .. formatNumRange(minHeal, maxHeal)
result = result .. '|' .. Icons.Icon({'Hitpoints', type='skill', notext=true, nolink=true}) .. ' ' .. formatNumRange(minHeal, maxHeal)
result = result .. '||data-sort-value="' .. avgHpPerLoot .. '"'
result = result .. '||data-sort-value="' .. avgHpPerLoot .. '"'
result = result .. '|' .. Icons.Icon({'Hitpoints', type='skill', notext=true, nolink=true}) .. ' ' .. Shared.round(avgHpPerLoot, 2, 0)
result = result .. '|' .. Icons.Icon({'Hitpoints', type='skill', notext=true, nolink=true}) .. ' ' .. Num.round(avgHpPerLoot, 2, 0)
end
end
end
end
result = result..'\r\n|}'
result = result..'\r\n|}'
result = result..'\r\nThe average value of the contents of one chest is '.. Icons._Currency('GP', Shared.round(lootValue, 2, 0))..'.'
result = result..'\r\nThe average value of the contents of one chest is '.. Icons._Currency('GP', Num.round(lootValue, 2, 0))..'.'
if isAllFood then
if isAllFood then
result = result..'\r\n\r\nThe average healing of the contents of one chest is ' .. Icons.Icon({'Hitpoints', type='skill', notext=true, nolink=true}) .. ' ' .. Shared.round(foodValue, 2, 0) .. '.'
result = result..'\r\n\r\nThe average healing of the contents of one chest is ' .. Icons.Icon({'Hitpoints', type='skill', notext=true, nolink=true}) .. ' ' .. Num.round(foodValue, 2, 0) .. '.'
end
end
end
end
Line 1,621: Line 1,621:
end
end


return Shared.round(totalGP, 2, 2)
return Num.round(totalGP, 2, 2)
end
end


Line 1,826: Line 1,826:
local lootTxt = '0'
local lootTxt = '0'
if lootVal ~= 0 then
if lootVal ~= 0 then
lootTxt = Num.formatnum(Shared.round(lootVal, 2, 2))
lootTxt = Num.formatnum(Num.round(lootVal, 2, 2))
end
end
Line 1,900: Line 1,900:
end
end
table.insert(resultPart, '\r\n|data-sort-value="' .. spAtt.name .. '"| ' .. table.concat(iconList, '<br/>'))
table.insert(resultPart, '\r\n|data-sort-value="' .. spAtt.name .. '"| ' .. table.concat(iconList, '<br/>'))
table.insert(resultPart, '\r\n|data-sort-value="' .. chance .. '"| ' .. Shared.round(chance, 2, 0) .. '%')
table.insert(resultPart, '\r\n|data-sort-value="' .. chance .. '"| ' .. Num.round(chance, 2, 0) .. '%')
if firstRow then
if firstRow then
table.insert(resultPart, '\r\n' .. rowSuffix .. '| ' .. spAtt.description)
table.insert(resultPart, '\r\n' .. rowSuffix .. '| ' .. spAtt.description)
2,874

edits