def handle_verb(self, parsed: ParseResult, actor: Living) -> bool: if parsed.verb == "list": pets = self.get_pets() actor.tell("Available pets at the moment are:", end=True) txt = ["<ul> pet <dim>|</><ul> price </>"] for i, (pet, price) in enumerate(pets.items(), start=1): txt.append(" %-15s %s" % (pet.name, mud_context.driver.moneyfmt.display(price))) actor.tell("\n".join(txt), format=False) return True elif parsed.verb == "buy": if not parsed.args: raise ActionRefused("Buy which pet? Don't forget to name it as well (optional).") pets = self.get_pets() for pet, price in pets.items(): if pet.name == parsed.args[0].lower(): pet = make_mob(pet.circle_vnum, type(pet)) if price > actor.money: raise ActionRefused("You can't afford that pet.") if len(parsed.args) == 2: name = parsed.args[1].lower() pet.title = "%s %s" % (pet.name, lang.capital(name)) pet.description += " A small sign on a chain around the neck says 'My name is %s'." % lang.capital(name) pet.aliases.add(pet.name) pet.name = name pet.following = actor # @todo make pet charmed as well (see circle doc/src) pet.is_pet = True actor.money -= price actor.tell_others("{Actor} buys %s as a pet." % pet.title) actor.tell("You paid %s and received %s as your new pet. Happy times!" % (mud_context.driver.moneyfmt.display(price), pet.title)) pet.move(actor.location, pet) return True raise ActionRefused("There is no such pet!") else: return super().handle_verb(parsed, actor)