Shake entertaining cocktails

This commit is contained in:
Howard Abrams 2025-05-16 21:55:21 -07:00
parent c4777ef1c2
commit 82425dc3cd
4 changed files with 313 additions and 37 deletions

View file

@ -21,7 +21,7 @@ from evennia.contrib.rpg.rpsystem import RPSystemCmdSet
from evennia.contrib.rpg.character_creator.character_creator import ContribChargenCmdSet
from commands.sittables import CmdNoSitStand
from commands.everyone import CmdTake, CmdThink, CmdSay, CmdWhisper
from commands.wizards import CmdGM, CmdSpell, CmdGMTrigger
from commands.wizards import CmdGM, CmdSpell, CmdGMTrigger, CmdMakeCocktail
class CharacterCmdSet(default_cmds.CharacterCmdSet):
"""
@ -48,6 +48,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
self.add(CmdGM)
self.add(CmdSpell)
self.add(CmdGMTrigger)
self.add(CmdMakeCocktail)
class AccountCmdSet(default_cmds.AccountCmdSet):

View file

@ -9,8 +9,10 @@ from evennia.contrib.rpg.rpsystem import send_emote
from .command import Command
from typeclasses.scripts import DonkeyHeadSpell
from typeclasses.drinkables import Cocktail
from utils.word_list import routput
class CmdFly(Command):
"""Cast the 'fly' spell.
@ -42,10 +44,38 @@ class CmdSetWand(CmdSet):
self.add(CmdFly)
class CmdMakeCocktail(MuxCommand):
"""
For the 'Bartender' especially.
Usage:
shake |wcocktail|n = |wpatron|n
If patron is not given or not found, the drink will be in your
inventory, and you can call |ggive|n to pass it along.
If cocktail name isn't given (or matches anything), a random
one will be created.
"""
key = 'shake'
locks = "cmd:perm(gm) or perm(Admin)"
def func(self):
dest = self.caller
if self.rhs:
dest = self.caller.search(self.rhs)
Cocktail.make(dest, self.lhs)
class CmdGM(MuxCommand):
"""
The gm command allows anything to be emoted into a room.
Usage:
gm A bat flies into the room!
gm/gnome You hear a distant ringing
"""
key = "gm"
aliases = ["#"]

View file

@ -1,9 +1,13 @@
#!/usr/bin/env python
from evennia.prototypes.spawner import spawn
from evennia.utils import logger
from typeclasses.objects import Object
from commands.consumables import CmdSetTeapot, CmdSetCup
from utils.word_list import routput, choices
import re
import random
TEA_TYPES = {
@ -114,3 +118,188 @@ class Teapot(Object):
teacup.do_fill(drinker, teatype, TEA_TYPES[teatype])
else:
drinker.msg("You need to |gget teacup|n first.")
COCKTAILS = [
{
"title": "Moonlit Mirage",
"desc": "A shimmering, colorful drink, garnished with glitter and a twist of tart, almost sour fruit.",
"flavors": ["lemon", "tartness", "sweetness"],
"effects": [
"You notice the swirling glitter make a pattern.",
"Your cocktail just changed color to << red ^ pink ^ orange ^ yellow ^ blue ^ purple >>."
]
},
{
"title": "Puck's Revenge",
"desc": "A vibrant concoction of fruit juices and sparkling fairy dust, served in a glass shaped like a flower.",
"flavors": ["fruity", "... fairy dust?"],
"effects": [
"Wow, this drink really packs a punch.",
"You feel a little light-headed.",
]
},
{
"title": "Glimmering Gossamer",
"desc": "A delicate blend of elderflower liqueur and sparkling wine, adorned with a butterfly-shaped ice cube.",
"flavors": ["elderflower"],
"effects": ["The butterfly shaped ice cube just started fluttering, and flew away."]
},
{
"title": "Whimsical Willow",
"desc": "A herbal infusion of gin, rosemary, and elderberry, served with a sprig of fresh mint and a splash of tonic.",
"flavors": ["fresh mint", "rosemary", "elderberry"],
"effects": [
"Hrm ... did the bartender always have flowers in his hair?",
"Hrm ... why are vines sprouting from everyone's hair?",
]
},
{
"title": "Charmed Chalice",
"desc": "A mysterious potion that glows softly, made with enchanted spirits and a hint of honey, served in a chalice that changes shape.",
"flavors": ["honey"],
"effects": [
"Your cocktail glass just changed into a flute for sparkling wine.",
"Your glass has changed shape into a small vase. Good thing the drink is still in it.",
"Your glass has changes shape into a glass bowl, still holding the contents of your drink.",
]
},
{
"title": "Enchanted Elixir",
"desc": "A deep blue drink with hints of blueberry and a touch of magic, served with a glowing ice sphere.",
"flavors": ["blueberry", "blue"],
"effects": [
"The ice sphere in the glass pulses with light and energy.",
"You see stars everywhere in the room.",
"The room became brighter...maybe that it just because you can see stars.",
]
# - Glowing orbs of light spin about the drinkers head
# - Drinker sees stars … SPELL?
},
{
"title": "Sylvan Serenade",
"desc": "A melodic blend of apple cider and spiced rum, garnished with a cinnamon stick and a slice of star fruit.",
"flavors": ["apple", "cider", "spices", "cinnamon"],
"effects": [
"You hear the song of a distant choir.",
"You hear the distant sounds of flutes and tambourines.",
],
},
{
"title": "Brambleberry Bliss",
"desc": "A sweet and tart mix of brambleberries and gin, served over crushed ice with a sprinkle of edible flowers.",
"flavors": ["brambleberries", "berry", "floral"],
"effects": [
"The flowers floating in the glass whispers to you, \"I'm always getting into trouble. I guess that's because I'm a wild flower.\"",
"A flower floating in the drink whispers to you, \"I got a promotion. I guess I was just outstanding in my field.\"",
"The flowers in the cocktail whispers to you, \"I like to drive fast. I guess I'm always putting the petal to the metal.\"",
],
# - The flowers talk .. maybe tell jokes.
},
{
"title": "Twilight Tonic",
"desc": "A dark, mysterious drink made with blackcurrant and tonic water, served with a slice of lime and a hint of mint.",
"flavors": ["lime", "blackcurrant", "mint"],
"effects": [
"A shadow falls on your face making you look seductively mysterious.",
"The room briefly grows dim.",
]
},
{
"title": "A 'water'",
"desc": "A clean cocktail with absolutely no taste.",
"flavors": ["water", "blandness"],
"effects": [
"Wow, this drink really packs a punch...NOT",
"Refreshing.",
"Unintoxicating.",
"Your liver is thanking you."
]
},
{
"title": "Bee Knees",
"desc": "Slightly fizzy, slightly sweet, served with a wedge of honeycomb.",
"flavors": ["honey", "vanilla"],
"effects": [
"You feel like a dwarf in a tunnel digging a hole. Diggy, diggy hole!",
"Just like being in the Mud World."
]
},
]
DRINK_COCKTAIL_MSGS = [
'You take a <<sip ^ sample ^ drink>> of your << |w{0}|n ^ cocktail >>.', # 0 == title
'You << notice ^ savor ^ relish ^ enjoy >> the {1}.', # 1 == flavors
]
EMPTY_COCKTAIL_MSGS = [
'That drink went down fast.',
'Hrm ... did you enjoy that?',
'You drain your glass.',
"You've finished that concoction.",
]
# py Cocktail.make(self, "mirage")
class Cocktail(Object):
fill_amount = 4
sip_amount = 1
def make(owner, name=None):
"""
Create for 'owner', a drink that matches 'name'.
If name doesn't match, get a random one.
"""
details = random.choice(COCKTAILS)
if name:
rx = r".*" + name + r".*"
details = [c for c in COCKTAILS
if re.match(rx, c.get("title"), re.IGNORECASE)]
if len(details) > 0:
details = details[0]
drink = spawn({
"typeclass": "typeclasses.drinkables.Cocktail",
"key": details.get("title") + " cocktail",
"aliases": ["drink", "glass"],
"desc": details.get("desc")
})[0]
drink.db.flavors = details.get("flavors")
drink.db.effects = details.get("effects")
drink.db.amount = Cocktail.fill_amount
drink.location = owner
drink.location.msg(f"You now have a {drink.name}.")
def at_object_creation(self):
"""
Add the 'drink' command.
"""
self.cmdset.add_default(CmdSetCup)
def do_drink(self, drinker):
"""
Called when owner calls the 'drink' command.
"""
amount = self.db.amount or 0
cocktail_type = self.db.cocktail_type or "cocktail"
cocktail_flavors = self.db.flavors
if amount > 2:
flavor = random.choice(cocktail_flavors)
drinker.msg(choices(DRINK_COCKTAIL_MSGS, cocktail_type, flavor))
elif amount > 0:
drinker.msg(random.choice(self.db.effects))
else:
drinker.msg(choices(EMPTY_COCKTAIL_MSGS, cocktail_type))
self.key = "cocktail glass"
self.db.desc = "An empty cocktail glass"
self.db.amount = self.db.amount - self.sip_amount
def at_pre_drop(self, dropper):
if dropper.location.key == 'Wyldwood Bar':
dropper.msg(routput(f"<< A ^ The >> mushroom << man ^ person >> << bounces ^ shimmies over ^ appears >> and takes the {self.name} << from you ^ >>.")
)
self.delete()
else:
dropper.msg(f"You put the {self.name} down.")

View file

@ -1,4 +1,4 @@
# Bar Lobby
# This room should display /tables/, as exits, differently, but this will be part of standard room with the setting in the Exit, not a special room.
@ -12,27 +12,11 @@
# [[file:../../../projects/mud-rpg.org::*Bar Lobby][Bar Lobby:2]]
@desc here = An amazing room formed from a ring of living trees. The canopy of boughs above twinkle with the lights of small, glowing orbs. Working the bar, a hauty-looking elf; waiting on tables, a smiling mushroom man, er...person.
@desc here = An amazing room formed from a ring of living trees. The canopy of boughs above twinkle with the lights of small, glowing orbs. Working the bar, a haughty-looking elf; waiting on tables, a smiling mushroom man, er...person.
# Bar Lobby:2 ends here
# Dynamically add:
# #+begin_example
# While wisps of pipe smoke obscure details, the clientel hail from every nation, race and...creature...sitting at similarly elaborate and
# #+end_example
# [[file:../../../projects/mud-rpg.org::*Bar Lobby][Bar Lobby:3]]
@detail clientel;people;creatures;patrons;creature = Dancing wisps of pipe smoke obscure the details of many of the bar's clientel. Perhaps |glook|n at character directly.
# Bar Lobby:3 ends here
# [[file:../../../projects/mud-rpg.org::*Bar Lobby][Bar Lobby:4]]
@detail mist;pipe smoke;smoke = Pipe smoke appears to be a pasttime here.
# Bar Lobby:4 ends here
# [[file:../../../projects/mud-rpg.org::*Bar Lobby][Bar Lobby:5]]
@detail trees;tree;trunk;trunks = You've never see black elder tree trunks so large or that grow so close together. The course, dark gray trunks absorb soft light from the orbs making the room appear much larger.
@detail trees;tree;trunk;trunks = You've never see black elder tree trunks so large or that grow so close together. The course, dark gray trunks the absorb soft light from the orbs making the room appear much larger.
# Bar Lobby:5 ends here
# [[file:../../../projects/mud-rpg.org::*Bar Lobby][Bar Lobby:6]]
@ -64,7 +48,7 @@
@detail chairs;chair = Didn't know that trees could grow in the shape of a chair, and yet, you're looking at examples.
# Bar Lobby:11 ends here
# Portal
# An exit, is always a /way out/, not a way in, obviously.
# [[file:../../../projects/mud-rpg.org::*Portal][Portal:1]]
@ -87,7 +71,7 @@
# And a nice journey message to go east out of the forest:
# [[file:../../../projects/mud-rpg.org::*Portal][Portal:3]]
@set orbs/traverse_msg = "You follow the orbs deeper into the forest, until you seem to drift to sleep...\n\nYou awake to the sound of a party!"
@set orbs/traverse_msg = "You follow the orbs deeper into the forest, until you seem to drift away and doze off, but then..."
# Portal:3 ends here
@ -99,7 +83,7 @@
@desc/portal_open here = You notice a glowing orb... and then another, and another. The field, filled with the soft light, illuminates another path...
# Portal:4 ends here
# Closing the Portal
# First, close the portal by moving it to the =None= location:
@ -111,34 +95,53 @@
@tag/del Frog Meadow = portal_open:roomstate
# Closing the Portal:2 ends here
# Bartender
# Return to the Bar …
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:1]]
@teleport Wyldwood Bar
# Bartender:1 ends here
# A haughty elf named Elendil
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:1]]
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:2]]
@create/drop Bartender;barkeep;Elendil: typeclasses.puppets.Puppet
# Bartender:1 ends here
# Bartender:2 ends here
# And all the RP system stuff:
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:2]]
py bt = self.search('Bartender'); bt.db.gender = 'male'; bt.db._sdesc = 'blonde elf'; bt.db.pose_default = 'working behind the bar'; bt.db.pose = 'working behind the bar'
# Bartender:2 ends here
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:3]]
@desc Bartender = A haughty-looking elf with green eyes and long blond hair with two intricate braids accentuating incredibly pointed ears. His nose, pointed, often points straight up.
py bt = self.search('Bartender'); bt.db.gender = 'male'; bt.db._sdesc = 'blonde elf'; bt.db.pose_default = 'working behind the bar'; bt.db.pose = 'working behind the bar'
# Bartender:3 ends here
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:4]]
@desc Bartender = A haughty-looking elf with green eyes and long blond hair with two intricate braids accentuating incredibly pointed ears. His nose, pointed, often points straight up.
# Bartender:4 ends here
# And give him the powers he deserves:
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:4]]
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:5]]
@perm Bartender = Admin
# Bartender:4 ends here
# Bartender:5 ends here
# And lets make him initially invisible:
# [[file:../../../projects/mud-rpg.org::*Bartender][Bartender:6]]
@set Bartender/hidden_tag = "hidden_bartender"
#
@lock Bartender = view:tag(hidden_bartender)
# Bartender:6 ends here
@ -149,7 +152,7 @@ py bt = self.search('Bartender'); bt.db.gender = 'male'; bt.db._sdesc = 'blonde
@detail mushroom;mushroom man = A stubby mushroom with an enormous red cap and a friendly looking face. Amazing how he can balance cocktails on its head.
# Or a Mushroom Bartender:4 ends here
# Awakened Shrub
# Next great NPC will a cameo from the Awakened Shrub.
@ -163,7 +166,7 @@ py bt = self.search('Bartender'); bt.db.gender = 'male'; bt.db._sdesc = 'blonde
# [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:2]]
@desc shrub = If a bush had the facial muscles to smile and show how much it enjoys itself, this lil' guy would be it. The short leaves indicates it once was a boxwood, but the way it nurses that glass of water shows those days are way behind. When you look its way, it waves a branch at you.
@desc shrub = If a small shrub had the facial muscles to smile and show how much it enjoys itself, this lil' guy would be it. The short leaves indicates it once was a boxwood, but the way it nurses that glass of water shows those days are way behind. When you look its way, it waves a branch at you.
# Awakened Shrub:2 ends here
@ -184,11 +187,42 @@ py bt = self.search('shrub'); bt.db.gender = 'neutral'; bt.db._sdesc = 'shrub';
# Awakened Shrub:4 ends here
# Be cool if it could write something:
# [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:7]]
@create chalkboard : typeclasses.readables.Readable
# Awakened Shrub:7 ends here
# And write something on it.
# [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:8]]
@set chalkboard/inside = "Hello, My name is Shrub McShrubberson"
# Awakened Shrub:8 ends here
# [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:9]]
@desc chalkboard = A small chalkboard with a wood frame.
# Awakened Shrub:9 ends here
# And give it to the bush baby:
# [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:10]]
give chalkboard to shrub
# Awakened Shrub:10 ends here
# Cocktails
# Lets create a sign for the list of cocktails:
# [[file:../../../projects/mud-rpg.org::*Cocktails][Cocktails:1]]
@create/drop Cocktail List;sign;list:typeclasses.readables.Readable
@create/drop sign;list:typeclasses.readables.Readable
# Cocktails:1 ends here
@ -205,7 +239,7 @@ py bt = self.search('shrub'); bt.db.gender = 'neutral'; bt.db._sdesc = 'shrub';
# Might as well allow the user to read it:
# [[file:../../../projects/mud-rpg.org::*Cocktails][Cocktails:3]]
@set sign/inside = "|wCocktails|n
@set sign/inside = |wCocktails|n
- Moonlit Mirage
- Puck's Revenge
- Glimmering Gossamer
@ -214,7 +248,7 @@ py bt = self.search('shrub'); bt.db.gender = 'neutral'; bt.db._sdesc = 'shrub';
- Enchanted Elixir
- Sylvan Serenade
- Brambleberry Bliss
- Twilight Tonic"
- Twilight Tonic
# Cocktails:3 ends here
@ -226,3 +260,25 @@ py bt = self.search('shrub'); bt.db.gender = 'neutral'; bt.db._sdesc = 'shrub';
#
@set sign/get_err_msg = "The tree trunk that holds the sign has grown around it making it impossible to remove."
# Cocktails:4 ends here
# Needs the ability to create a drink.
# [[file:../../../projects/mud-rpg.org::*Cocktails][Cocktails:5]]
@set bartender/currentgame = "session1"
# Cocktails:5 ends here
# The preps come in three forms with how detailed we want to spam the room.
# [[file:../../../projects/mud-rpg.org::*Cocktails][Cocktails:6]]
@set bartender/triggers:session1 =
{"prep1": {"desc": "Single preparation step for making a cocktail", "timer": 1, "events": [ "The bartender grabs a << few ^ couple of >> << bottles ^ jars ^ bottles ^ odd containers >> from << the shelf ^ a locked chest ^ a wooden box >>."]},
{"prep2": {"desc": "Preparation steps for making a cocktail", "timer": 1, "events": [ "The bartender grabs a << few ^ couple of >> << bottles ^ jars ^ bottles ^ odd containers >> from << the shelf ^ a locked chest ^ a wooden box >>.", "<< He ^ The bartender >> then shakes and strains the << drink ^ concoction ^ elixir >> into a cocktail glass.", ]},
{"prep3": {"desc": "Preparation steps for making a cocktail", "timer": 1, "events": [ "The bartender grabs a << few ^ couple of >> << bottles ^ jars ^ bottles ^ odd containers >> from << the shelf ^ a locked chest ^ a wooden box >>.", "<< He ^ The bartender >> then shakes and strains the << drink ^ concoction ^ elixir >> into a cocktail glass.", "He carefully, garnishes the << drink ^ cocktail >>."]},
}
# Cocktails:6 ends here