#!/usr/bin/env python from evennia.commands.default.muxcommand import MuxCommand from evennia import CmdSet from evennia.utils import logger from .command import Command class CmdKnock(Command): """ The ability to knock on something, like a door. Usage: knock Uh, yeah, you'll need to make sure the ring is in the mouth of the door knocker. """ key = "knock" def func(self): logger.log_info(f"Seems like {self.caller.key} wants to knock on me.") self.obj.do_knock(self.caller) class CmdSetKnock(CmdSet): def at_cmdset_creation(self): self.add(CmdKnock) class CmdJump(Command): """ Jump or play in or around puddles. Usage: jump You know you want to do this! """ key = "jump" aliases = ["play"] def func(self): self.obj.do_jump(self.caller) class CmdSetPuddle(CmdSet): def at_cmdset_creation(self): self.add(CmdJump) class CmdThrow(Command): """ Throw a stick or a fish back into the water. Usage: throw [ object ] """ key = "throw" locks = "holds(stick)" # locks = "cmd:holds()" def func(self): self.obj.do_throw(self.caller) class CmdSetStick(CmdSet): def at_cmdset_creation(self): self.add(CmdThrow) class CmdLight(Command): """ Light something on fire, preferably a pipe. Usage: light [ object ] """ key = "light" locks = "cmd:holds()" def func(self): self.obj.do_light(self.caller) class CmdSmoke(MuxCommand): """ Smoke and blow a shape with your magical pipe. Usage: smoke [ options [= description]] Where 'options' can be: - ring : a traditional or multicolored smoke ring - dragon : a dragon shape If an 'option' is not given, then resorts to the attribute, 'smoke_msg'. """ key = "smoke" aliases = ['puff', 'blow'] locks = "cmd:holds()" def func(self): if self.lhs: if self.lhs == 'ring': self.obj.do_ring(self.caller, self.rhs) elif self.lhs == 'dragon': self.obj.do_dragon(self.caller, self.rhs) else: self.caller.msg(f"The option, '{self.lhs}' isn't available.") else: self.obj.do_smoke(self.caller) 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) class CmdCat(Command): """Have you cat do some antic. Usage: cat Or: cat's Will announce your cat's antics to the room. You can target another character by preceding the character's description with a |w/|n, as in |w/elf|n or |w/blonde elf|n. """ key = "cat" def func(self): self.obj.at_do(self.caller, self.args.strip()) class CmdSetCat(CmdSet): def at_cmdset_creation(self): self.add(CmdCat) class CmdOctopus(Command): """ Have your octopus do some antics. Usage: octopus Or: octopus's Will announce your octopus's antics to the room. You can target another character in the antics by preceding the character's description with a |w/|n, as in |w/elf|n or |w/blonde elf|n. """ key = "octopus" aliases = ["pus"] def func(self): self.obj.at_do(self.caller, self.args.strip()) class CmdSetOctopus(CmdSet): def at_cmdset_creation(self): self.add(CmdOctopus) class CmdRoll(MuxCommand): """ Roll the dice in your inventory. Usage: roll Or: roll/switches Will announce your roll to the room. If you have more than one dice, the following switches are available: sum : Report the sum of the dice high : Report only the highest (advantage) low : Report only the lowest (disadvantage) """ key = "roll" locks = "cmd:holds()" switch_options = ("sum", "high", "low") def func(self): self.obj.roll(self.caller, self.switches) class CmdSetDice(CmdSet): def at_cmdset_creation(self): self.add(CmdRoll)