67 lines
1.8 KiB
Python
Executable file
67 lines
1.8 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
from evennia import CmdSet
|
|
from evennia.utils import logger
|
|
from evennia.commands.default.muxcommand import MuxCommand
|
|
|
|
from .command import Command
|
|
|
|
|
|
class CmdFly(Command):
|
|
"""Cast the 'fly' spell.
|
|
|
|
Make sure you set the following properties, for instance:
|
|
|
|
@set self/disappear_msg = "The wizard disappears in a puff of smoke."
|
|
@set self/reappear_msg = "A plume of <<white ^ light blue ^ gray ^ >> smoke appears... ;; When the smoke clears, a wizard <<emerges ^ materializes>>."
|
|
@set self/appear_delay = 3
|
|
|
|
The last setting is the number of seconds between message segments
|
|
(those are separated by double semicolons).
|
|
|
|
"""
|
|
key = "^fly"
|
|
locks = "call:all()"
|
|
|
|
def func(self):
|
|
self.caller.do_fly(self.args.strip())
|
|
|
|
|
|
class CmdSetWand(CmdSet):
|
|
"""
|
|
All wizard spells are tied to a 'wand' that might be flavored.
|
|
"""
|
|
key = "Wand"
|
|
|
|
def at_cmdset_creation(self):
|
|
super().at_cmdset_creation()
|
|
self.add(CmdFly)
|
|
|
|
|
|
class CmdGM(MuxCommand):
|
|
"""
|
|
The gm command allows anything to be emoted into a room.
|
|
|
|
"""
|
|
key = "gm"
|
|
aliases = ["#"]
|
|
locks = "cmd:perm(gm) or perm(Admin)"
|
|
|
|
def func(self):
|
|
send_to = []
|
|
for switch in self.switches:
|
|
o = self.caller.search(switch, global_search=True)
|
|
if o:
|
|
send_to = send_to + [o]
|
|
|
|
if not send_to:
|
|
send_to = [self.caller.location]
|
|
|
|
for o in send_to:
|
|
if o.is_typeclass('typeclasses.rooms.Room'):
|
|
o.msg_contents(self.args)
|
|
elif o.is_typeclass('typeclasses.characters.Character'):
|
|
o.msg(self.args)
|
|
|
|
logger.info(f"switches = {self.switches} lhs={self.lhs} rhs={self.rhs} / args={self.args}")
|