Create a Bag of Holding class for Tweed Jackets

This commit is contained in:
Howard Abrams 2025-05-29 18:28:20 -07:00
parent c81ea8c55f
commit 5a1f8d8b56
3 changed files with 297 additions and 2 deletions

View file

@ -125,3 +125,43 @@ class CmdSetSmoke(CmdSet):
def at_cmdset_creation(self):
self.add(CmdLight)
self.add(CmdSmoke)
class CmdRummage(MuxCommand):
"""
Rummage around in an object that contains stuff.
Usage:
rummage
"""
key = "rummage"
locks = "cmd:holds()"
def func(self):
self.obj.do_rummage(self.caller)
class CmdKeep(MuxCommand):
"""
Move the item found into your inventory.
You can then |ggive|n that item to others.
Usage:
keep [ description ]
The optional |wdescription|n is shown if you |glook|n
at the object.
"""
key = "keep"
locks = "cmd:holds()"
def func(self):
self.obj.do_keep(self.caller, self.args.strip())
class CmdSetRummage(CmdSet):
def at_cmdset_creation(self):
self.add(CmdRummage)
self.add(CmdKeep)

View file

@ -271,7 +271,7 @@ COCKTAILS = [
"desc": "A rich glass a blood red color with notes of raspberries and toffee.",
"flavors": ["earthiness", "toffee", "raspberries"],
"effects": [
"Ah, what was the name of the land in the Mud World?",
"Ah, what was the name of the land in the Mud World where you first had this vintage?",
"You swirl your glass and watch the legs return to the bottom.",
]
},

View file

@ -4,9 +4,14 @@ from random import choice, random, randint
from enum import Enum
from evennia import create_script
from evennia.prototypes.spawner import spawn
from evennia.utils import logger, delay
from commands.misc import CmdSetPuddle, CmdSetStick, CmdSetKnock, CmdSetSmoke
from commands.misc import (CmdSetPuddle,
CmdSetStick,
CmdSetKnock,
CmdSetSmoke,
CmdSetRummage)
from commands.wizards import CmdSetWand
from utils.word_list import routput, choices
from .scripts import KnockScript
@ -600,3 +605,253 @@ class Knocker(Object):
Make a muffled comment.
"""
self.at_say(choice(self.muffled_responses))
class BagofJunk(Object):
"""
A bag of holding with just trivial junk. Perfect for a tweed jacket.
"""
human_stuff = [
"wallet",
"keys",
"smartphone",
"handkerchief",
"pen",
"notebook",
"sunglasses",
"business cards",
"lip balm",
"mints",
"gum",
"pocket watch",
"small flashlight",
"earbuds",
"uSB drive",
"travel-sized cologne",
"hair comb",
"safety pins",
"sewing kit",
"lint roller",
"tissues",
"granola bar",
"a small book",
"reading glasses",
"a small umbrella",
"phone charger",
"portable battery pack",
"cough drops",
"a small notepad",
"a map",
"a ticket stub",
"a receipt",
"a small first aid kit",
"a keychain",
"a small mirror",
"a hair tie",
"a small bottle of hand sanitizer",
"a travel guide",
"a bookmark",
"a small camera",
"a flash drive",
"a mini tool kit",
"a stress ball",
"a small plant seed packet",
"a whistle",
"a small notebook for sketches",
"a travel pillow",
"a portable fan",
"a small bottle of water",
"a snack bag",
"a pair of gloves",
"a scarf",
"a small blanket",
"a portable game console",
"a deck of cards",
"a small puzzle",
"a travel-sized board game",
"a notepad for ideas",
"a small calendar",
"a set of colored pencils",
"a small sketchbook",
"a travel-sized hairbrush",
"a small bottle of lotion",
"a portable speaker",
"a small sewing kit",
"a pair of earplugs",
"a small flashlight",
"a mini umbrella",
"a small bottle of vinegar",
"a small bottle of olive oil",
"a reusable shopping bag",
"a small notebook for journaling",
"a small calendar",
"a small bottle of hot sauce",
"a small bottle of soy sauce",
"a small bottle of ketchup",
"a small bottle of mustard",
"a small bottle of salad dressing",
"a small bottle of honey",
"a small bottle of syrup",
"a small bottle of jam",
"a small bottle of peanut butter",
"a small bottle of jelly",
"a small bottle of salsa",
"a small bottle of barbecue sauce",
"a small bottle of relish",
"a small bottle of mayonnaise",
"a small bottle of Worcestershire sauce",
"a small bottle of teriyaki sauce",
"a small bottle of chili sauce",
"a small bottle of curry paste",
"a small bottle of coconut milk",
"a small bottle of broth",
"a small bottle of stock",
"a small bottle of wine",
"a small bottle of beer",
"a small bottle of cider",
"a small bottle of soda",
"a small bottle of juice",
"a small bottle of water",
]
fey_stuff = [
"pan flute",
"an acorn cap",
"dried leaves",
"a small bottle of wine",
"a sprig of thyme",
"a tiny bell",
"a piece of string",
"a small mirror",
"a handful of wildflower seeds",
"a feather",
"a small pouch of herbs",
"a miniature goat figurine",
"a piece of bark",
"a lucky charm",
"a small stone with a hole",
"a twig shaped like a heart",
"a tiny lantern",
"a scrap of parchment",
"a small compass",
"a piece of cheese",
"a bottle of honey",
"a small jar of jam",
"a dried mushroom",
"a tiny scroll",
"a thimble",
"a small wooden carving",
"a piece of rope",
"a small pouch of glitter",
"a tiny drum",
"a handful of nuts",
"a small mirror",
"a piece of flint",
"a small bellflower",
"a tiny painting",
"a small vial of potion",
"a piece of candy",
"a small twig flute",
"a dried flower",
"a small notebook",
"a pencil",
"a tiny map of the forest",
"a small bottle of ink",
"a feather quill",
"a small pouch of coins",
"a tiny key",
"a small wooden spoon",
"a piece of fabric",
"a small bell",
"a tiny lantern",
"a small mirror",
"a piece of candy",
"a small bottle of perfume",
"a tiny flower crown",
"a small pouch of glitter",
"a tiny compass",
"a small wooden flute",
"a piece of dried fruit",
"a small jar of fireflies",
"a tiny drumstick",
"a small pouch of spices",
"a piece of string",
"a small bottle of potion",
"a tiny scroll",
"a small wooden toy",
"a piece of bark",
"a small feather",
"a tiny bell",
"a small pouch of seeds",
"a piece of candy",
"a small mirror",
"a tiny lantern",
"a small bottle of honey",
"a piece of flint",
"a small wooden carving",
"a tiny drum",
"a small pouch of herbs",
"a piece of fabric",
"a small bottle of ink",
"a feather quill",
"a tiny map of the forest",
"a small pouch of coins",
"a tiny key",
"a small wooden spoon",
"a piece of dried fruit",
"a small jar of fireflies",
"a tiny flower crown",
"a small pouch of glitter",
"a tiny compass",
"a small wooden flute",
"a piece of bark",
"a small mirror",
"a piece of candy",
"a small bottle of perfume",
"a tiny scroll",
"a small wooden toy",
"a piece of string",
"a small bottle of potion",
"a tiny drumstick",
"a small pouch of spices",
"a tiny bellflower",
]
def at_object_creation(self):
self.cmdset.add_default(CmdSetRummage)
def do_rummage(self, owner):
"""
Rummage around this bag and describe finding an item.
"""
if self.db.stuff == 'human':
item = choice(self.human_stuff)
else:
item = choice(self.fey_stuff)
self.db.latest_item = item
where = self.db._sdesc or self.name
msg = routput(f"$You() << $conj(scrounge) ^ $conj(rummage) ^ $conj(fish) ^ $conj(rifle) ^ $conj(put) $pron(your) hand >> << around ^ >> in $pron(your) {where}, and << $conj(pull) out ^ $conj(find) ^ $conj(stare) at >> |w{item}|n.")
owner.announce_action(msg)
def do_keep(self, keeper, description=None):
"""
Create an object out of the last thing rummaged.
"""
if self.db.latest_item:
where = self.db._sdesc or self.name
if not description or description == "":
description = f"An interesting item found in a {where}."
item = spawn({
"typeclass": "typeclasses.objects.Object",
"key": self.db.latest_item,
"desc": description
})[0]
item.location = keeper
keeper.msg(f"You got {item.key}.")
self.db.latest_item = None
else:
self.location.msg("You must |grummage|n first.")