108 lines
4.1 KiB
Python
Executable file
108 lines
4.1 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
from typeclasses.objects import Object
|
|
from commands.consumables import CmdSetTeapot, CmdSetTeacup
|
|
from utils.word_list import routput, Token
|
|
|
|
import random
|
|
|
|
TEA_TYPES = {
|
|
"black": "a rich, bold and [malty|fragrant|almost spicy] black tea",
|
|
"green": "a green tea with [grassy|floral|vanilla|vegetal] notes",
|
|
"oolong": "a complex and [earthy|floral] oolong",
|
|
"matcha": "a frothy and aromatic matcha of the most vibrant green",
|
|
"white": "a subtle tea with notes of [rose|berries|chamomile flowers]",
|
|
"pu-erh": "an earthy, almost mushroom flavored, pu-erh tea",
|
|
"puerh": "an earthy, almost mushroom flavored, pu-erh tea",
|
|
"barley": "a nutty herbal infusion of barley with just a hint of smokiness",
|
|
"chaga": "an earthy, mushroomy chaga infusion",
|
|
"hibiscus": "a dark red, tart herbal infusion of roselle flowers",
|
|
"chai": "a spicy chai tea, tempered with milk and sweetness",
|
|
"herbal": "an herbal infusion of [chamomile|mint|chicory root|lavender]",
|
|
"earl": "a flowery Earl Grey tea",
|
|
"chamomile": "a relaxing, yet subtle infusion of chamomile flowers that makes you want to go to sleep",
|
|
"mint": "a blend of peppermint and spearmint to create the ultimate minty herbal infusion",
|
|
"chrysanthemum": "a lovely, floral infusion of chrysanthemum flowers",
|
|
"dandelion": "a roasted herbal infusion of dandelions that tastes a bit like coffee",
|
|
"rooibos": "an almost [sweet and|] [woody|nutty|vanilla-y] rooibos herbal infusion",
|
|
# Why limit to teas ... sure, this tea pot could make coffee ...
|
|
}
|
|
|
|
FILL_MSGS = [
|
|
"You fill your [teacup|cup] with {1}.",
|
|
"You pour [some|] {0} tea into your [teacup|cup].",
|
|
]
|
|
|
|
DRINK_MSGS = [
|
|
"You take a sip of {0} tea.",
|
|
"You take a sip of {0} tea [in|from] your [teacup|cup].",
|
|
"You [sip|sample|drink] from your [teacup|cup].",
|
|
"You savor {1} in your [teacup|cup].",
|
|
]
|
|
|
|
EMPTY_MSGS = [
|
|
"Your [teacup|cup] is empty. Perhaps you can |bmake|n some |btea|n?",
|
|
"Your cup certainly doesn't runneth over, as it be quite empty.",
|
|
"Alas, you find your cup devoid of any sort of watery infusion.",
|
|
"You notice your cup is empty.",
|
|
"It appears that you need to refill your tea cup."
|
|
]
|
|
|
|
|
|
class TeaCup(Object):
|
|
fill_amount = 4
|
|
sip_amount = 1
|
|
|
|
def at_object_creation(self):
|
|
self.cmdset.add_default(CmdSetTeacup)
|
|
|
|
def do_drink(self, drinker):
|
|
amount = self.db.amount or 0
|
|
tea_type = self.db.tea_type or "tea"
|
|
tea_details = self.db.tea_details
|
|
|
|
if amount > 0:
|
|
self.db.amount = self.db.amount - self.sip_amount
|
|
drinker.msg(routput(random.choice(DRINK_MSGS).format(tea_type, tea_details)))
|
|
else:
|
|
drinker.msg(routput(random.choice(EMPTY_MSGS).format(tea_type, tea_details)))
|
|
|
|
def do_fill(self, drinker, tea_type, tea_details):
|
|
self.db.tea_type = tea_type
|
|
self.db.tea_details = tea_details
|
|
self.db.amount = self.fill_amount
|
|
|
|
drinker.msg(routput(random.choice(FILL_MSGS).format(tea_type, tea_details)))
|
|
# Spam the room? Maybe not.
|
|
# self.location.msg_contents(f"{drinker.name} refills a {self.key}.",
|
|
# exclude=drinker)
|
|
|
|
|
|
class Teapot(Object):
|
|
def at_object_creation(self):
|
|
"""
|
|
called at creation
|
|
"""
|
|
self.cmdset.add_default(CmdSetTeapot, persistent=True)
|
|
|
|
def do_make_tea(self, drinker, args):
|
|
words = Token(args)
|
|
tea_choice = []
|
|
if not words.empty():
|
|
tea_choice = [tea for tea in TEA_TYPES.keys() if words.contains(tea)]
|
|
|
|
if len(tea_choice) > 0:
|
|
self.db.tea_type = tea_choice[0]
|
|
else:
|
|
self.db.tea_type = random.choice(list(TEA_TYPES.keys()))
|
|
desc = routput(TEA_TYPES[self.db.tea_type])
|
|
|
|
self.db.desc = f"A large, brown teapot full of {desc}."
|
|
drinker.msg(f"You make a teapot of {desc}.")
|
|
self.location.msg_contents(f"{drinker.name} makes a pot of tea.", exclude=drinker)
|
|
|
|
def do_fill(self, drinker):
|
|
teacup = drinker.has("teacup")
|
|
if teacup:
|
|
teacup.do_fill(drinker, self.db.tea_type, TEA_TYPES[self.db.tea_type])
|