fixed a bug that allowed purchasing 0-stock items (you would only lose gold without getting an item)

This commit is contained in:
Ceikry
2022-05-14 06:24:47 +00:00
committed by Ryan
parent 2f09f2b940
commit 7478f68d40
2 changed files with 34 additions and 0 deletions
@@ -259,6 +259,11 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
if(inStock.amount < amount)
item.amount = inStock.amount
if(inStock.amount == 0) {
sendMessage(player, "This item is out of stock.")
return TransactionStatus.Failure("Shop item out of stock.")
}
if(isMainStock && inStock.amount > stock[slot].amount && !getServerConfig().getBoolean(Shops.personalizedShops, false) && player.ironmanManager.isIronman)
{
sendDialogue(player, "As an ironman, you cannot buy overstocked items from shops.")