mirror of
https://github.com/MinetestForFun/minercantile.git
synced 2025-07-05 01:30:23 +02:00
Update price calculation to avoid big differences on very low prices.
add 0.5 to the calculated buying price before rounding it to make it more balanced at very low prices.
This commit is contained in:
2
shop.lua
2
shop.lua
@ -203,7 +203,7 @@ function minercantile.shop.get_sell_price(itname, wear)
|
|||||||
if minercantile.stock.items[itname].price ~= nil then -- if defined price
|
if minercantile.stock.items[itname].price ~= nil then -- if defined price
|
||||||
price = math.floor(minercantile.stock.items[itname].price)
|
price = math.floor(minercantile.stock.items[itname].price)
|
||||||
else
|
else
|
||||||
price = math.floor((money/10)/(math.log(nb+2000+99)*10)*1000000/(math.pow((nb+2000+99),(2.01))))
|
price = math.floor(((money/10)/(math.log(nb+2000+99)*10)*1000000/(math.pow((nb+2000+99),(2.01))))+0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
if wear and wear > 0 then --calcul price with % wear, (0-65535)
|
if wear and wear > 0 then --calcul price with % wear, (0-65535)
|
||||||
|
Reference in New Issue
Block a user