From 53f48691b31f165dd766faed104f602aed29dd57 Mon Sep 17 00:00:00 2001 From: Cyberpangolin Date: Tue, 14 Jun 2016 10:23:12 +0200 Subject: [PATCH] Replacing the way to calculate the prices. The new formula is simpler, so easier to calculate, and gives better results at extremely high or low stocks values. I keep as commentary the old formula just in case, it was a pain to write it ;) 1000000 is now a good money value at the very beggining of the shop. --- shop.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shop.lua b/shop.lua index 0560e3e..f046b22 100644 --- a/shop.lua +++ b/shop.lua @@ -211,7 +211,7 @@ function minercantile.shop.get_buy_price(itname) if minercantile.stock.items[itname].price ~= nil then -- if defined price price = math.ceil(minercantile.stock.items[itname].price) else - 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)-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)))) end if price and price < 1 then price = 1 end 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 price = math.floor(minercantile.stock.items[itname].price) else - 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)+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) end if wear and wear > 0 then --calcul price with % wear, (0-65535)