Anonymous

Module:Monsters: Difference between revisions

From Melvor Idle
Fix deprecation of GP function
m (Fix null error when area.type doesn't exist)
(Fix deprecation of GP function)
Line 1,010: Line 1,010:
if monster.gpDrops ~= nil then
if monster.gpDrops ~= nil then
avgGp = (monster.gpDrops.min + monster.gpDrops.max) / 2
avgGp = (monster.gpDrops.min + monster.gpDrops.max) / 2
local gpTxt = Icons.GP(monster.gpDrops.min, monster.gpDrops.max)
local gpTxt = Icons._Currency('GP', monster.gpDrops.min, monster.gpDrops.max)
result = result.."\r\nIn addition to loot, the monster will also drop "..gpTxt..'.'
result = result.."\r\nIn addition to loot, the monster will also drop "..gpTxt..'.'
end
end
Line 1,059: Line 1,059:
itemPrice = thisItem.sellsFor ~= nil and thisItem.sellsFor or 0
itemPrice = thisItem.sellsFor ~= nil and thisItem.sellsFor or 0
if itemPrice == 0 or row.maxQuantity == row.minQuantity then
if itemPrice == 0 or row.maxQuantity == row.minQuantity then
result = result..'||'..Icons.GP(itemPrice * row.minQuantity)
result = result..'||'.. Icons._Currency('GP', itemPrice * row.minQuantity)
else
else
result = result..'||'..Icons.GP(itemPrice * row.minQuantity, itemPrice * row.maxQuantity)
result = result..'||'.. Icons._Currency('GP', itemPrice * row.minQuantity, itemPrice * row.maxQuantity)
end
end
end
end
Line 1,092: Line 1,092:
end
end
result = result..'\r\n|}'
result = result..'\r\n|}'
result = result..'\r\nThe loot dropped by the average kill is worth '..Icons.GP(Shared.round(lootValue, 2, 0)).." if sold."
result = result..'\r\nThe loot dropped by the average kill is worth '.. Icons._Currency('GP', Shared.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,101: Line 1,101:
result = result..' and barrier dust'
result = result..' and barrier dust'
end
end
result = result..', the average kill is worth '..Icons.GP(Shared.round(avgGp + lootValue + boneVal + dustVal, 2, 0))..'.'
result = result..', the average kill is worth '.. Icons._Currency('GP', Shared.round(avgGp + lootValue + boneVal + dustVal, 2, 0))..'.'
end
end
end
end
Line 1,257: Line 1,257:
result = result..'||style="text-align:left" data-sort-value="'..thisItem.sellsFor..'"'
result = result..'||style="text-align:left" data-sort-value="'..thisItem.sellsFor..'"'
if thisItem.sellsFor == 0 or row.minQuantity == row.maxQuantity then
if thisItem.sellsFor == 0 or row.minQuantity == row.maxQuantity then
result = result..'|'..Icons.GP(thisItem.sellsFor * row.minQuantity)
result = result..'|'.. Icons._Currency('GP', thisItem.sellsFor * row.minQuantity)
else
else
result = result..'|'..Icons.GP(thisItem.sellsFor * row.minQuantity, thisItem.sellsFor * row.maxQuantity)
result = result..'|'.. Icons._Currency('GP', thisItem.sellsFor * row.minQuantity, thisItem.sellsFor * row.maxQuantity)
end
end
lootValue = lootValue + (dropChance * 0.01 * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2))
lootValue = lootValue + (dropChance * 0.01 * thisItem.sellsFor * ((row.minQuantity + row.maxQuantity)/ 2))
Line 1,275: Line 1,275:
end
end
result = result..'\r\n|}'
result = result..'\r\n|}'
result = result..'\r\nThe average value of the contents of one chest is '..Icons.GP(Shared.round(lootValue, 2, 0))..'.'
result = result..'\r\nThe average value of the contents of one chest is '.. Icons._Currency('GP', Shared.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}) .. ' ' .. Shared.round(foodValue, 2, 0) .. '.'
2,875

edits