1
0
mirror of https://github.com/MinetestForFun/minercantile.git synced 2024-11-16 15:20:26 +01:00

update on the new calculation formula

to make it more understandable
This commit is contained in:
Cyberpangolin 2016-06-14 10:49:21 +02:00 committed by GitHub
parent 1036d5e539
commit 8a1b0ec41d

View File

@ -211,7 +211,7 @@ function minercantile.shop.get_buy_price(itname)
if minercantile.stock.items[itname].price ~= nil then -- if defined price if minercantile.stock.items[itname].price ~= nil then -- if defined price
price = math.ceil(minercantile.stock.items[itname].price) price = math.ceil(minercantile.stock.items[itname].price)
else else
price = math.ceil((money/1000)/((0.001*(2340+nb)-0.1)^3.9)/10) -- was price = math.ceil((money/1000)/(math.log(nb+2000-99)*10)*1000000/(math.pow((nb+2000-99),(2.01)))) price = math.ceil((money/1000)/((0.001*(2340+nb-99))^3.9)/10) -- was price = math.ceil((money/1000)/(math.log(nb+2000-99)*10)*1000000/(math.pow((nb+2000-99),(2.01))))
end end
if price and price < 1 then price = 1 end if price and price < 1 then price = 1 end
return price return price
@ -231,7 +231,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/1000)/((0.001*(2340+nb)+0.1)^3.9)/10) --was price = math.floor(((money/1000)/(math.log(nb+2000+99)*10)*1000000/(math.pow((nb+2000+99),(2.01))))+0.5) price = math.floor((money/1000)/((0.001*(2340+nb+99))^3.9)/10) --was price = math.floor(((money/1000)/(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)