Module:Monsters: Difference between revisions

Included bones in the 'total monster loot value' calculation
(Fixed getMonsterLootValue not taking into account bones)
(Included bones in the 'total monster loot value' calculation)
Line 676: Line 676:


local bones = p._getMonsterBones(monster)
local bones = p._getMonsterBones(monster)
local boneVal = 0
--Show the bones only if either the monster shows up outside of dungeons _or_ the monster drops shards
--Show the bones only if either the monster shows up outside of dungeons _or_ the monster drops shards
if bones ~= nil then
if bones ~= nil then
local boneQty = (monster.boneQty ~= nil and monster.boneQty or 1)
result = result.."'''Always Drops:'''"
result = result.."'''Always Drops:'''"
result = result..'\r\n{|class="wikitable" id="bonedrops"'
result = result..'\r\n{|class="wikitable" id="bonedrops"'
result = result..'\r\n!Item !! Qty'
result = result..'\r\n!Item !! Qty'
result = result..'\r\n|-\r\n|'..Icons.Icon({bones.name, type='item'})
result = result..'\r\n|-\r\n|'..Icons.Icon({bones.name, type='item'})
result = result..'||'..(monster.boneQty ~= nil and monster.boneQty or 1)..'\r\n'..'|}'
result = result..'||'..boneQty..'\r\n'..'|}'
boneVal = boneQty * bones.sellsFor
end
end


Line 768: Line 771:
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.GP(Shared.round(lootValue, 2, 0)).." if sold."
if avgGp > 0 then
if avgGp > 0 then
result = result..'<br/>Including GP, the average kill is worth '..Icons.GP(Shared.round(avgGp + lootValue, 2, 0))..'.'
result = result.."<br/>Including GP"
if boneVal > 0 then
result = result..' and bones'
end
result = result..', the average kill is worth '..Icons.GP(Shared.round(avgGp + lootValue + boneVal, 2, 0))..'.'
end
end
end
end