Fixup buying too many items

This commit is contained in:
RedSparr0w
2019-11-23 14:58:44 +13:00
parent 2b93d72a15
commit e519d1b00b
2 changed files with 2 additions and 2 deletions
@@ -540,10 +540,10 @@ public class ShopAssistant {
int totalValue = value * amount;
if (currencyAmount < totalValue) {
amount = (int) Math.floor(player.playerItemsN[currencySlot] / amount);
amount = (int) Math.floor(player.playerItemsN[currencySlot] / value);
// buy as many as we can afford
totalValue = value * amount;
if (currencyAmount < totalValue) {
if (currencyAmount < totalValue || amount <= 0) {
player.getActionSender().sendMessage("You don't have enough " + ItemAssistant.getItemName(currency).toLowerCase() + " to buy that.");
return false;
}