From 5aded2b34929088b117ecbf5aa5efd8f2909657c Mon Sep 17 00:00:00 2001 From: xmomoz Date: Sun, 23 Apr 2023 08:51:44 +0000 Subject: [PATCH] Can no longer sell to full general store --- Server/src/main/core/game/shops/Shop.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Server/src/main/core/game/shops/Shop.kt b/Server/src/main/core/game/shops/Shop.kt index ef755b058..eff96dfc6 100644 --- a/Server/src/main/core/game/shops/Shop.kt +++ b/Server/src/main/core/game/shops/Shop.kt @@ -359,9 +359,15 @@ class Shop(val title: String, val stock: Array, val general: Boolean = if(amount > player.inventory.getAmount(item.id)) item.amount = player.inventory.getAmount(item.id) + val id = if(!item.definition.isUnnoted) item.noteChange else item.id + val (isPlayerStock, shopSlot) = getStockSlot(id) + + if(isPlayerStock && shopSlot == -1 && generalPlayerStock.freeSlots() == 0) { + sendMessage(player, "The shop is too full to buy any more items") + return TransactionStatus.Failure("Attempt to sell to full shop.") + } + if(currency == Items.COINS_995 && item.amount > 1){ - val id = if(!item.definition.isUnnoted) item.noteChange else item.id - val (isPlayerStock, shopSlot) = getStockSlot(id) var amt = item.amount var inStockAmt = container!![shopSlot]?.amount ?: playerStock.getAmount(id) while(amt-- > 1)