From 09d48dc614892f6386717a22a0cfe7a3caa12cb9 Mon Sep 17 00:00:00 2001 From: Cyberpangolin Date: Tue, 7 Jun 2016 21:32:26 +0200 Subject: [PATCH] Update shop.lua --- shop.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shop.lua b/shop.lua index 21782a3..e97c64b 100644 --- a/shop.lua +++ b/shop.lua @@ -240,9 +240,11 @@ function minercantile.buy(name, item, nb, price) end local item_can_sell = nb - if items_nb/4 < nb then - item_can_sell = math.floor(items_nb/4) - end + if items_nb < 4 then + item_can_sell = 1 + elseif items_nb/4 < nb then + item_can_sell = math.floor(items_nb/4) + end local price_total = math.floor(item_can_sell * price) local player_can_buy = item_can_sell