Fixed bug finding a character's coin pouch.

This commit is contained in:
Howard Abrams 2025-06-24 22:26:11 -07:00
parent 34820da276
commit 294ae2fa35
2 changed files with 5 additions and 3 deletions

View file

@ -16,6 +16,7 @@ from evennia.contrib.game_systems.gendersub import GenderCharacter
from evennia.contrib.rpg.rpsystem import ContribRPCharacter, send_emote from evennia.contrib.rpg.rpsystem import ContribRPCharacter, send_emote
from evennia.prototypes.spawner import spawn from evennia.prototypes.spawner import spawn
from evennia.utils import delay, logger, int2str from evennia.utils import delay, logger, int2str
from evennia.utils.search import search_object
from utils.word_list import routput, choices from utils.word_list import routput, choices
from .objects import Object from .objects import Object
@ -152,8 +153,9 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
Throws InterruptCommand exception if the character has Throws InterruptCommand exception if the character has
no pouch, and therefore, no money. no pouch, and therefore, no money.
""" """
pouches = self.search("", location=self, quiet=True, pouches = [item
typeclass="typeclasses.things.CoinPurse") for item in self.contents
if item.is_typeclass("typeclasses.things.CoinPurse")]
if pouches: if pouches:
return pouches[0] return pouches[0]
raise InterruptCommand("No coin purse") raise InterruptCommand("No coin purse")

View file

@ -17,7 +17,7 @@
# [[file:../../../projects/mud-games.org::*George and the Troll][George and the Troll:1]] # [[file:../../../projects/mud-games.org::*George and the Troll][George and the Troll:1]]
@create rules: typeclasses.things.Readable @create rules: typeclasses.readables.Readable
# #
@desc rules = A small, worn card with the rules of the game, |yHobbits and Trolls|n printed on it. @desc rules = A small, worn card with the rules of the game, |yHobbits and Trolls|n printed on it.
# George and the Troll:1 ends here # George and the Troll:1 ends here