Module:ProfessionList: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
m (incorporate quantity of product item in the returned sellPrice variable)
m (fix edge cases with sell price arithmetic)
Line 154: Line 154:
-- include the price of selling the product
-- include the price of selling the product
item.sellPrice = search.getShopSellPrice(item.product) * (item.output[1].quantity or 0)
local sell = search.getShopSellPrice(item.product)
local qty = item.output[1].quantity
item.sellPrice = sell and qty and sell * qty
item.profit = item.buyPrice and item.sellPrice and item.sellPrice - item.buyPrice
item.profit = item.buyPrice and item.sellPrice and item.sellPrice - item.buyPrice
item.profitPerXP = item.profit and item.xp and item.profit / item.xp
item.profitPerXP = item.profit and item.xp and item.profit / item.xp