Better handling of full inventories

Made it possible to alch when inventory is full with non-coin items, if the alch would free up the necessary space
Made it possible to receive a kitten from Gertrude when inventory is full,  if the transaction would free the space for the kitten
Made it possible to receive a kitten from Gertrude when inventory is full even with more than 100 gp, if the pet can be summoned immediately
Gertrude's Quest completion - fixed bug causing loss of kitten with full inventory
Fixed a bug where Gertrude's kitten-giving dialogue will hang if spoken to while having a non-pet familiar out
Fixed typos
This commit is contained in:
Player Name
2024-03-31 14:17:25 +00:00
committed by Ryan
parent 2948d58934
commit 5c977c0522
3 changed files with 31 additions and 23 deletions
@@ -239,7 +239,7 @@ class ModernListeners : SpellListener("modern"){
}
val coins = Item(995, item.definition.getAlchemyValue(high))
if (coins.amount > 0 && !player.inventory.hasSpaceFor(coins)) {
if (item.amount > 1 && coins.amount > 0 && !player.inventory.hasSpaceFor(coins)) {
player.sendMessage("Not enough space in your inventory!")
return false
}
@@ -258,11 +258,10 @@ class ModernListeners : SpellListener("modern"){
}
playAudio(player, if (high) Sounds.HIGH_ALCHEMY_97 else Sounds.LOW_ALCHEMY_98)
if (coins.amount > 0)
player.inventory.add(coins)
player.dispatch(ItemAlchemizationEvent(item.id, high))
player.inventory.remove(Item(item.id, 1))
if (player.inventory.remove(Item(item.id, 1)) && coins.amount > 0) {
player.inventory.add(coins)
}
removeRunes(player)
addXP(player, if (high) 65.0 else 31.0)
showMagicTab(player)