Remove @ from default commands. Update docstrings

This commit is contained in:
Griatch 2019-06-17 22:04:59 +02:00
parent c95a3ec2d2
commit aa6b403cd1
14 changed files with 534 additions and 448 deletions

View file

@ -12,6 +12,7 @@
### Commands ### Commands
- Remove `@`-prefix from all default commands (prefixes still works)
- Removed default `@delaccount` command, incorporating as `@account/delete` instead. Added confirmation - Removed default `@delaccount` command, incorporating as `@account/delete` instead. Added confirmation
question. question.
- Add new `@force` command to have another object perform a command. - Add new `@force` command to have another object perform a command.
@ -23,6 +24,12 @@
- `@py` command now defaults to escaping html tags in its output when viewing in the webclient. - `@py` command now defaults to escaping html tags in its output when viewing in the webclient.
Use new `/clientraw` switch to get old behavior (issue #1369). Use new `/clientraw` switch to get old behavior (issue #1369).
- Shorter and more informative, dynamic, listing of on-command vars if not setting func() in child command class. - Shorter and more informative, dynamic, listing of on-command vars if not setting func() in child command class.
- New Command helper methods
- `.client_width()` returns client width of the session running the command.
- `.styled_table(*args, **kwargs)` returns a formatted evtable styled by user's options
- `.style_header(*args, **kwargs)` creates styled header entry
- `.style_separator(*args, **kwargs)` " separator
- `.style_footer(*args, **kwargs)` " footer
### Web ### Web
@ -121,6 +128,16 @@
- Django signals fire for important events: Puppet/Unpuppet, Object create/rename, Login, - Django signals fire for important events: Puppet/Unpuppet, Object create/rename, Login,
Logout, Login fail Disconnect, Account create/rename Logout, Login fail Disconnect, Account create/rename
### Settings
- `GLOBAL_SCRIPTS` - dict defining typeclasses of global scripts to store on the new
`evennia.GLOBAL_SCRIPTS` container. These will auto-start when Evennia start and will always
exist.
- `OPTIONS_ACCOUNTS_DEFAULT` - option dict with option defaults and Option classes
- `OPTION_CLASS_MODULES` - classes representing an on-Account Option, on special form
- `VALIDATOR_FUNC_MODULES` - (general) text validator functions, for verifying an input
is on a specific form.
### Utils ### Utils
- `evennia` launcher now fully handles all django-admin commands, like running tests in parallel. - `evennia` launcher now fully handles all django-admin commands, like running tests in parallel.

View file

@ -481,9 +481,32 @@ Command {self} has no defined `func()` - showing on-command variables:
return self.__doc__ return self.__doc__
def client_width(self): def client_width(self):
return self.session.protocol_flags['SCREENWIDTH'][0] """
Get the client screenwidth for the session using this command.
def style_table(self, *args, **kwargs): Returns:
client width (int or None): The width (in characters) of the client window. None
if this command is run without a Session (such as by an NPC).
"""
if self.session:
return self.session.protocol_flags['SCREENWIDTH'][0]
def styled_table(self, *args, **kwargs):
"""
Create an EvTable styled by on user preferences.
Args:
*args (str): Column headers. If not colored explicitly, these will get colors
from user options.
Kwargs:
any (str, int or dict): EvTable options, including, optionally a `table` dict
detailing the contents of the table.
Returns:
table (EvTable): An initialized evtable entity, either complete (if using `table` kwarg)
or incomplete and ready for use with `.add_row` or `.add_collumn`.
"""
border_color = self.account.options.get('border_color') border_color = self.account.options.get('border_color')
column_color = self.account.options.get('column_names_color') column_color = self.account.options.get('column_names_color')
@ -511,14 +534,31 @@ Command {self} has no defined `func()` - showing on-command variables:
border_top_char=border_top_char, **kwargs) border_top_char=border_top_char, **kwargs)
return table return table
def render_header(self, header_text=None, fill_character=None, edge_character=None, def _render_decoration(self, header_text=None, fill_character=None, edge_character=None,
mode='header', color_header=True): mode='header', color_header=True, width=None):
"""
Helper for formatting a string into a prety display, for a header, separator or footer.
Kwargs:
header_text (str): Text to include in header.
fill_character (str): This single character will be used to fill the width of the
display.
edge_character (str): This character caps the edges of the display.
mode(str): One of 'header', 'separator' or 'footer'.
color_header (bool): If the header should be colorized based on user options.
width (int): If not given, the client's width will be used if available.
Returns:
string (str): The decorated and formatted text.
"""
colors = dict() colors = dict()
colors['border'] = self.account.options.get('border_color') colors['border'] = self.account.options.get('border_color')
colors['headertext'] = self.account.options.get('%s_text_color' % mode) colors['headertext'] = self.account.options.get('%s_text_color' % mode)
colors['headerstar'] = self.account.options.get('%s_star_color' % mode) colors['headerstar'] = self.account.options.get('%s_star_color' % mode)
width = self.width() width = width or self.width()
if edge_character: if edge_character:
width -= 2 width -= 2
@ -557,19 +597,31 @@ Command {self} has no defined `func()` - showing on-command variables:
return final_send return final_send
def style_header(self, *args, **kwargs): def style_header(self, *args, **kwargs):
"""
Create a pretty header.
"""
if 'mode' not in kwargs: if 'mode' not in kwargs:
kwargs['mode'] = 'header' kwargs['mode'] = 'header'
return self.render_header(*args, **kwargs) return self._render_decoration(*args, **kwargs)
def style_separator(self, *args, **kwargs): def style_separator(self, *args, **kwargs):
"""
Create a separator.
"""
if 'mode' not in kwargs: if 'mode' not in kwargs:
kwargs['mode'] = 'separator' kwargs['mode'] = 'separator'
return self.render_header(*args, **kwargs) return self._render_decoration(*args, **kwargs)
def style_footer(self, *args, **kwargs): def style_footer(self, *args, **kwargs):
"""
Create a pretty footer.
"""
if 'mode' not in kwargs: if 'mode' not in kwargs:
kwargs['mode'] = 'footer' kwargs['mode'] = 'footer'
return self.render_header(*args, **kwargs) return self._render_decoration(*args, **kwargs)
class InterruptCommand(Exception): class InterruptCommand(Exception):

View file

@ -11,7 +11,7 @@ self.account to make sure to always use the account object rather than
self.caller (which change depending on the level you are calling from) self.caller (which change depending on the level you are calling from)
The property self.character can be used to access the character when The property self.character can be used to access the character when
these commands are triggered with a connected character (such as the these commands are triggered with a connected character (such as the
case of the @ooc command), it is None if we are OOC. case of the `ooc` command), it is None if we are OOC.
Note that under MULTISESSION_MODE > 2, Account commands should use Note that under MULTISESSION_MODE > 2, Account commands should use
self.msg() and similar methods to reroute returns to the correct self.msg() and similar methods to reroute returns to the correct
@ -24,7 +24,7 @@ import time
from codecs import lookup as codecs_lookup from codecs import lookup as codecs_lookup
from django.conf import settings from django.conf import settings
from evennia.server.sessionhandler import SESSIONS from evennia.server.sessionhandler import SESSIONS
from evennia.utils import utils, create, logger, search, evtable from evennia.utils import utils, create, logger, search
COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS) COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)
@ -102,7 +102,7 @@ class CmdOOCLook(MuxAccountLookCommand):
if _MULTISESSION_MODE < 2: if _MULTISESSION_MODE < 2:
# only one character allowed # only one character allowed
self.msg("You are out-of-character (OOC).\nUse |w@ic|n to get back into the game.") self.msg("You are out-of-character (OOC).\nUse |wic|n to get back into the game.")
return return
# call on-account look helper method # call on-account look helper method
@ -114,14 +114,14 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
create a new character create a new character
Usage: Usage:
@charcreate <charname> [= desc] charcreate <charname> [= desc]
Create a new character, optionally giving it a description. You Create a new character, optionally giving it a description. You
may use upper-case letters in the name - you will nevertheless may use upper-case letters in the name - you will nevertheless
always be able to access your character using lower-case letters always be able to access your character using lower-case letters
if you want. if you want.
""" """
key = "@charcreate" key = "charcreate"
locks = "cmd:pperm(Player)" locks = "cmd:pperm(Player)"
help_category = "General" help_category = "General"
@ -132,7 +132,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
"""create the new character""" """create the new character"""
account = self.account account = self.account
if not self.args: if not self.args:
self.msg("Usage: @charcreate <charname> [= description]") self.msg("Usage: charcreate <charname> [= description]")
return return
key = self.lhs key = self.lhs
desc = self.rhs desc = self.rhs
@ -170,7 +170,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
new_character.db.desc = desc new_character.db.desc = desc
elif not new_character.db.desc: elif not new_character.db.desc:
new_character.db.desc = "This is a character." new_character.db.desc = "This is a character."
self.msg("Created new character %s. Use |w@ic %s|n to enter the game as this character." self.msg("Created new character %s. Use |wic %s|n to enter the game as this character."
% (new_character.key, new_character.key)) % (new_character.key, new_character.key))
logger.log_sec('Character Created: %s (Caller: %s, IP: %s).' % (new_character, account, self.session.address)) logger.log_sec('Character Created: %s (Caller: %s, IP: %s).' % (new_character, account, self.session.address))
@ -180,11 +180,11 @@ class CmdCharDelete(COMMAND_DEFAULT_CLASS):
delete a character - this cannot be undone! delete a character - this cannot be undone!
Usage: Usage:
@chardelete <charname> chardelete <charname>
Permanently deletes one of your characters. Permanently deletes one of your characters.
""" """
key = "@chardelete" key = "chardelete"
locks = "cmd:pperm(Player)" locks = "cmd:pperm(Player)"
help_category = "General" help_category = "General"
@ -193,7 +193,7 @@ class CmdCharDelete(COMMAND_DEFAULT_CLASS):
account = self.account account = self.account
if not self.args: if not self.args:
self.msg("Usage: @chardelete <charactername>") self.msg("Usage: chardelete <charactername>")
return return
# use the playable_characters list to search # use the playable_characters list to search
@ -238,7 +238,7 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
control an object you have permission to puppet control an object you have permission to puppet
Usage: Usage:
@ic <character> ic <character>
Go in-character (IC) as a given Character. Go in-character (IC) as a given Character.
@ -251,10 +251,10 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
as you the account have access right to puppet it. as you the account have access right to puppet it.
""" """
key = "@ic" key = "ic"
# lock must be all() for different puppeted objects to access it. # lock must be all() for different puppeted objects to access it.
locks = "cmd:all()" locks = "cmd:all()"
aliases = "@puppet" aliases = "puppet"
help_category = "General" help_category = "General"
# this is used by the parent # this is used by the parent
@ -271,7 +271,7 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
if not self.args: if not self.args:
new_character = account.db._last_puppet new_character = account.db._last_puppet
if not new_character: if not new_character:
self.msg("Usage: @ic <character>") self.msg("Usage: ic <character>")
return return
if not new_character: if not new_character:
# search for a matching character # search for a matching character
@ -301,16 +301,16 @@ class CmdOOC(MuxAccountLookCommand):
stop puppeting and go ooc stop puppeting and go ooc
Usage: Usage:
@ooc ooc
Go out-of-character (OOC). Go out-of-character (OOC).
This will leave your current character and put you in a incorporeal OOC state. This will leave your current character and put you in a incorporeal OOC state.
""" """
key = "@ooc" key = "ooc"
locks = "cmd:pperm(Player)" locks = "cmd:pperm(Player)"
aliases = "@unpuppet" aliases = "unpuppet"
help_category = "General" help_category = "General"
# this is used by the parent # this is used by the parent
@ -337,7 +337,7 @@ class CmdOOC(MuxAccountLookCommand):
if _MULTISESSION_MODE < 2: if _MULTISESSION_MODE < 2:
# only one character allowed # only one character allowed
self.msg("You are out-of-character (OOC).\nUse |w@ic|n to get back into the game.") self.msg("You are out-of-character (OOC).\nUse |wic|n to get back into the game.")
return return
self.msg(account.at_look(target=self.playable, session=session)) self.msg(account.at_look(target=self.playable, session=session))
@ -351,12 +351,12 @@ class CmdSessions(COMMAND_DEFAULT_CLASS):
check your connected session(s) check your connected session(s)
Usage: Usage:
@sessions sessions
Lists the sessions currently connected to your account. Lists the sessions currently connected to your account.
""" """
key = "@sessions" key = "sessions"
locks = "cmd:all()" locks = "cmd:all()"
help_category = "General" help_category = "General"
@ -367,11 +367,11 @@ class CmdSessions(COMMAND_DEFAULT_CLASS):
"""Implement function""" """Implement function"""
account = self.account account = self.account
sessions = account.sessions.all() sessions = account.sessions.all()
table = self.style_table("|wsessid", table = self.styled_table("|wsessid",
"|wprotocol", "|wprotocol",
"|whost", "|whost",
"|wpuppet/character", "|wpuppet/character",
"|wlocation") "|wlocation")
for sess in sorted(sessions, key=lambda x: x.sessid): for sess in sorted(sessions, key=lambda x: x.sessid):
char = account.get_puppet(sess) char = account.get_puppet(sess)
table.add_row(str(sess.sessid), str(sess.protocol_key), table.add_row(str(sess.sessid), str(sess.protocol_key),
@ -418,7 +418,7 @@ class CmdWho(COMMAND_DEFAULT_CLASS):
naccounts = SESSIONS.account_count() naccounts = SESSIONS.account_count()
if show_session_data: if show_session_data:
# privileged info # privileged info
table = self.style_table("|wAccount Name", table = self.styled_table("|wAccount Name",
"|wOn for", "|wOn for",
"|wIdle", "|wIdle",
"|wPuppeting", "|wPuppeting",
@ -444,7 +444,7 @@ class CmdWho(COMMAND_DEFAULT_CLASS):
isinstance(session.address, tuple) and session.address[0] or session.address) isinstance(session.address, tuple) and session.address[0] or session.address)
else: else:
# unprivileged # unprivileged
table = self.style_table("|wAccount name", "|wOn for", "|wIdle") table = self.styled_table("|wAccount name", "|wOn for", "|wIdle")
for session in session_list: for session in session_list:
if not session.logged_in: if not session.logged_in:
continue continue
@ -464,7 +464,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
Set an account option Set an account option
Usage: Usage:
@option[/save] [name = value] option[/save] [name = value]
Switches: Switches:
save - Save the current option settings for future logins. save - Save the current option settings for future logins.
@ -476,8 +476,8 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
""" """
key = "@option" key = "option"
aliases = "@options" aliases = "options"
switch_options = ("save", "clear") switch_options = ("save", "clear")
locks = "cmd:all()" locks = "cmd:all()"
@ -500,7 +500,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
if "save" in self.switches: if "save" in self.switches:
# save all options # save all options
self.caller.db._saved_protocol_flags = flags self.caller.db._saved_protocol_flags = flags
self.msg("|gSaved all options. Use @option/clear to remove.|n") self.msg("|gSaved all options. Use option/clear to remove.|n")
if "clear" in self.switches: if "clear" in self.switches:
# clear all saves # clear all saves
self.caller.db._saved_protocol_flags = {} self.caller.db._saved_protocol_flags = {}
@ -524,7 +524,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
options.pop("TTYPE", None) options.pop("TTYPE", None)
header = ("Name", "Value", "Saved") if saved_options else ("Name", "Value") header = ("Name", "Value", "Saved") if saved_options else ("Name", "Value")
table = self.style_table(*header) table = self.styled_table(*header)
for key in sorted(options): for key in sorted(options):
row = [key, options[key]] row = [key, options[key]]
if saved_options: if saved_options:
@ -537,7 +537,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
return return
if not self.rhs: if not self.rhs:
self.msg("Usage: @option [name = [value]]") self.msg("Usage: option [name = [value]]")
return return
# Try to assign new values # Try to assign new values
@ -619,11 +619,11 @@ class CmdPassword(COMMAND_DEFAULT_CLASS):
change your password change your password
Usage: Usage:
@password <old password> = <new password> password <old password> = <new password>
Changes your password. Make sure to pick a safe one. Changes your password. Make sure to pick a safe one.
""" """
key = "@password" key = "password"
locks = "cmd:pperm(Player)" locks = "cmd:pperm(Player)"
# this is used by the parent # this is used by the parent
@ -634,7 +634,7 @@ class CmdPassword(COMMAND_DEFAULT_CLASS):
account = self.account account = self.account
if not self.rhs: if not self.rhs:
self.msg("Usage: @password <oldpass> = <newpass>") self.msg("Usage: password <oldpass> = <newpass>")
return return
oldpass = self.lhslist[0] # Both of these are oldpass = self.lhslist[0] # Both of these are
newpass = self.rhslist[0] # already stripped by parse() newpass = self.rhslist[0] # already stripped by parse()
@ -660,7 +660,7 @@ class CmdQuit(COMMAND_DEFAULT_CLASS):
quit the game quit the game
Usage: Usage:
@quit quit
Switch: Switch:
all - disconnect all connected sessions all - disconnect all connected sessions
@ -668,7 +668,7 @@ class CmdQuit(COMMAND_DEFAULT_CLASS):
Gracefully disconnect your current session from the Gracefully disconnect your current session from the
game. Use the /all switch to disconnect from all sessions. game. Use the /all switch to disconnect from all sessions.
""" """
key = "@quit" key = "quit"
switch_options = ("all",) switch_options = ("all",)
locks = "cmd:all()" locks = "cmd:all()"
@ -702,7 +702,7 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
testing which colors your client support testing which colors your client support
Usage: Usage:
@color ansi||xterm256 color ansi||xterm256
Prints a color map along with in-mud color codes to use to produce Prints a color map along with in-mud color codes to use to produce
them. It also tests what is supported in your client. Choices are them. It also tests what is supported in your client. Choices are
@ -710,7 +710,7 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
standard. No checking is done to determine your client supports standard. No checking is done to determine your client supports
color - if not you will see rubbish appear. color - if not you will see rubbish appear.
""" """
key = "@color" key = "color"
locks = "cmd:all()" locks = "cmd:all()"
help_category = "General" help_category = "General"
@ -805,7 +805,7 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
self.msg(string) self.msg(string)
else: else:
# malformed input # malformed input
self.msg("Usage: @color ansi||xterm256") self.msg("Usage: color ansi||xterm256")
class CmdQuell(COMMAND_DEFAULT_CLASS): class CmdQuell(COMMAND_DEFAULT_CLASS):
@ -825,8 +825,8 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
Use the unquell command to revert back to normal operation. Use the unquell command to revert back to normal operation.
""" """
key = "@quell" key = "quell"
aliases = ["@unquell"] aliases = ["unquell"]
locks = "cmd:pperm(Player)" locks = "cmd:pperm(Player)"
help_category = "General" help_category = "General"
@ -848,7 +848,7 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
"""Perform the command""" """Perform the command"""
account = self.account account = self.account
permstr = account.is_superuser and " (superuser)" or "(%s)" % (", ".join(account.permissions.all())) permstr = account.is_superuser and " (superuser)" or "(%s)" % (", ".join(account.permissions.all()))
if self.cmdstring in ('unquell', '@unquell'): if self.cmdstring in ('unquell', 'unquell'):
if not account.attributes.get('_quell'): if not account.attributes.get('_quell'):
self.msg("Already using normal Account permissions %s." % permstr) self.msg("Already using normal Account permissions %s." % permstr)
else: else:
@ -865,15 +865,27 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
cpermstr = "Quelling to current puppet's permissions %s." % cpermstr cpermstr = "Quelling to current puppet's permissions %s." % cpermstr
cpermstr += "\n(Note: If this is higher than Account permissions %s," \ cpermstr += "\n(Note: If this is higher than Account permissions %s," \
" the lowest of the two will be used.)" % permstr " the lowest of the two will be used.)" % permstr
cpermstr += "\nUse @unquell to return to normal permission usage." cpermstr += "\nUse unquell to return to normal permission usage."
self.msg(cpermstr) self.msg(cpermstr)
else: else:
self.msg("Quelling Account permissions%s. Use @unquell to get them back." % permstr) self.msg("Quelling Account permissions%s. Use unquell to get them back." % permstr)
self._recache_locks(account) self._recache_locks(account)
class CmdStyle(COMMAND_DEFAULT_CLASS): class CmdStyle(COMMAND_DEFAULT_CLASS):
key = "@style" """
In-game style options
Usage:
style
style <option> = <value>
Configure stylings for in-game display elements like table borders, help
entriest etc. Use without arguments to see all available options.
"""
key = "style"
switch_options = ['clear'] switch_options = ['clear']
def func(self): def func(self):
@ -883,11 +895,12 @@ class CmdStyle(COMMAND_DEFAULT_CLASS):
self.set() self.set()
def list_styles(self): def list_styles(self):
styles_table = self.style_table('Option', 'Description', 'Type', 'Value', width=78) table = self.styled_table('Option', 'Description', 'Type', 'Value', width=78)
for op_key in self.account.options.options_dict.keys(): for op_key in self.account.options.options_dict.keys():
op_found = self.account.options.get(op_key, return_obj=True) op_found = self.account.options.get(op_key, return_obj=True)
styles_table.add_row(op_key, op_found.description, op_found.__class__.__name__, op_found.display()) table.add_row(op_key, op_found.description,
self.msg(str(styles_table)) op_found.__class__.__name__, op_found.display())
self.msg(str(table))
def set(self): def set(self):
try: try:
@ -895,5 +908,4 @@ class CmdStyle(COMMAND_DEFAULT_CLASS):
except ValueError as e: except ValueError as e:
self.msg(str(e)) self.msg(str(e))
return return
self.msg('Success! The new value is: %s' % result) self.msg('Style %s set to %s' % (self.lhs, result))

View file

@ -25,7 +25,7 @@ class CmdBoot(COMMAND_DEFAULT_CLASS):
kick an account from the server. kick an account from the server.
Usage Usage
@boot[/switches] <account obj> [: reason] boot[/switches] <account obj> [: reason]
Switches: Switches:
quiet - Silently boot without informing account quiet - Silently boot without informing account
@ -35,7 +35,7 @@ class CmdBoot(COMMAND_DEFAULT_CLASS):
supplied it will be echoed to the user unless /quiet is set. supplied it will be echoed to the user unless /quiet is set.
""" """
key = "@boot" key = "boot"
switch_options = ("quiet", "sid") switch_options = ("quiet", "sid")
locks = "cmd:perm(boot) or perm(Admin)" locks = "cmd:perm(boot) or perm(Admin)"
help_category = "Admin" help_category = "Admin"
@ -46,7 +46,7 @@ class CmdBoot(COMMAND_DEFAULT_CLASS):
args = self.args args = self.args
if not args: if not args:
caller.msg("Usage: @boot[/switches] <account> [:reason]") caller.msg("Usage: boot[/switches] <account> [:reason]")
return return
if ':' in args: if ':' in args:
@ -104,15 +104,19 @@ class CmdBoot(COMMAND_DEFAULT_CLASS):
IPREGEX = re.compile(r"[0-9*]{1,3}\.[0-9*]{1,3}\.[0-9*]{1,3}\.[0-9*]{1,3}") IPREGEX = re.compile(r"[0-9*]{1,3}\.[0-9*]{1,3}\.[0-9*]{1,3}\.[0-9*]{1,3}")
def list_bans(banlist): def list_bans(cmd, banlist):
""" """
Helper function to display a list of active bans. Input argument Helper function to display a list of active bans. Input argument
is the banlist read into the two commands @ban and @unban below. is the banlist read into the two commands ban and unban below.
Args:
cmd (Command): Instance of the Ban command.
banlist (list): List of bans to list.
""" """
if not banlist: if not banlist:
return "No active bans were found." return "No active bans were found."
table = self.style_table("|wid", "|wname/ip", "|wdate", "|wreason") table = cmd.styled_table("|wid", "|wname/ip", "|wdate", "|wreason")
for inum, ban in enumerate(banlist): for inum, ban in enumerate(banlist):
table.add_row(str(inum + 1), table.add_row(str(inum + 1),
ban[0] and ban[0] or ban[1], ban[0] and ban[0] or ban[1],
@ -125,7 +129,7 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
ban an account from the server ban an account from the server
Usage: Usage:
@ban [<name or ip> [: reason]] ban [<name or ip> [: reason]]
Without any arguments, shows numbered list of active bans. Without any arguments, shows numbered list of active bans.
@ -133,7 +137,7 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
reason to be able to later remember why the ban was put in place. reason to be able to later remember why the ban was put in place.
It is often preferable to ban an account from the server than to It is often preferable to ban an account from the server than to
delete an account with @accounts/delete. If banned by name, that account delete an account with accounts/delete. If banned by name, that account
account can no longer be logged into. account can no longer be logged into.
IP (Internet Protocol) address banning allows blocking all access IP (Internet Protocol) address banning allows blocking all access
@ -141,10 +145,10 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
wildcard. wildcard.
Examples: Examples:
@ban thomas - ban account 'thomas' ban thomas - ban account 'thomas'
@ban/ip 134.233.2.111 - ban specific ip address ban/ip 134.233.2.111 - ban specific ip address
@ban/ip 134.233.2.* - ban all in a subnet ban/ip 134.233.2.* - ban all in a subnet
@ban/ip 134.233.*.* - even wider ban ban/ip 134.233.*.* - even wider ban
A single IP filter can be easy to circumvent by changing computers A single IP filter can be easy to circumvent by changing computers
or requesting a new IP address. Setting a wide IP block filter with or requesting a new IP address. Setting a wide IP block filter with
@ -153,8 +157,8 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
or region. or region.
""" """
key = "@ban" key = "ban"
aliases = ["@bans"] aliases = ["bans"]
locks = "cmd:perm(ban) or perm(Developer)" locks = "cmd:perm(ban) or perm(Developer)"
help_category = "Admin" help_category = "Admin"
@ -178,7 +182,7 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
if not self.args or (self.switches and if not self.args or (self.switches and
not any(switch in ('ip', 'name') not any(switch in ('ip', 'name')
for switch in self.switches)): for switch in self.switches)):
self.caller.msg(list_bans(banlist)) self.caller.msg(list_bans(self, banlist))
return return
now = time.ctime() now = time.ctime()
@ -214,15 +218,15 @@ class CmdUnban(COMMAND_DEFAULT_CLASS):
remove a ban from an account remove a ban from an account
Usage: Usage:
@unban <banid> unban <banid>
This will clear an account name/ip ban previously set with the @ban This will clear an account name/ip ban previously set with the ban
command. Use this command without an argument to view a numbered command. Use this command without an argument to view a numbered
list of bans. Use the numbers in this list to select which one to list of bans. Use the numbers in this list to select which one to
unban. unban.
""" """
key = "@unban" key = "unban"
locks = "cmd:perm(unban) or perm(Developer)" locks = "cmd:perm(unban) or perm(Developer)"
help_category = "Admin" help_category = "Admin"
@ -232,7 +236,7 @@ class CmdUnban(COMMAND_DEFAULT_CLASS):
banlist = ServerConfig.objects.conf('server_bans') banlist = ServerConfig.objects.conf('server_bans')
if not self.args: if not self.args:
self.caller.msg(list_bans(banlist)) self.caller.msg(list_bans(self, banlist))
return return
try: try:
@ -261,9 +265,9 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
admin command for emitting message to multiple objects admin command for emitting message to multiple objects
Usage: Usage:
@emit[/switches] [<obj>, <obj>, ... =] <message> emit[/switches] [<obj>, <obj>, ... =] <message>
@remit [<obj>, <obj>, ... =] <message> remit [<obj>, <obj>, ... =] <message>
@pemit [<obj>, <obj>, ... =] <message> pemit [<obj>, <obj>, ... =] <message>
Switches: Switches:
room - limit emits to rooms only (default) room - limit emits to rooms only (default)
@ -272,12 +276,12 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
Emits a message to the selected objects or to Emits a message to the selected objects or to
your immediate surroundings. If the object is a room, your immediate surroundings. If the object is a room,
send to its contents. @remit and @pemit are just send to its contents. remit and pemit are just
limited forms of @emit, for sending to rooms and limited forms of emit, for sending to rooms and
to accounts respectively. to accounts respectively.
""" """
key = "@emit" key = "emit"
aliases = ["@pemit", "@remit"] aliases = ["pemit", "remit"]
switch_options = ("room", "accounts", "contents") switch_options = ("room", "accounts", "contents")
locks = "cmd:perm(emit) or perm(Builder)" locks = "cmd:perm(emit) or perm(Builder)"
help_category = "Admin" help_category = "Admin"
@ -290,9 +294,9 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
if not args: if not args:
string = "Usage: " string = "Usage: "
string += "\n@emit[/switches] [<obj>, <obj>, ... =] <message>" string += "\nemit[/switches] [<obj>, <obj>, ... =] <message>"
string += "\n@remit [<obj>, <obj>, ... =] <message>" string += "\nremit [<obj>, <obj>, ... =] <message>"
string += "\n@pemit [<obj>, <obj>, ... =] <message>" string += "\npemit [<obj>, <obj>, ... =] <message>"
caller.msg(string) caller.msg(string)
return return
@ -301,10 +305,10 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
send_to_contents = 'contents' in self.switches send_to_contents = 'contents' in self.switches
# we check which command was used to force the switches # we check which command was used to force the switches
if self.cmdstring == '@remit': if self.cmdstring == 'remit':
rooms_only = True rooms_only = True
send_to_contents = True send_to_contents = True
elif self.cmdstring == '@pemit': elif self.cmdstring == 'pemit':
accounts_only = True accounts_only = True
if not self.rhs: if not self.rhs:
@ -341,12 +345,12 @@ class CmdNewPassword(COMMAND_DEFAULT_CLASS):
change the password of an account change the password of an account
Usage: Usage:
@userpassword <user obj> = <new password> userpassword <user obj> = <new password>
Set an account's password. Set an account's password.
""" """
key = "@userpassword" key = "userpassword"
locks = "cmd:perm(newpassword) or perm(Admin)" locks = "cmd:perm(newpassword) or perm(Admin)"
help_category = "Admin" help_category = "Admin"
@ -356,7 +360,7 @@ class CmdNewPassword(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.rhs: if not self.rhs:
self.msg("Usage: @userpassword <user obj> = <new password>") self.msg("Usage: userpassword <user obj> = <new password>")
return return
# the account search also matches 'me' etc. # the account search also matches 'me' etc.
@ -388,8 +392,8 @@ class CmdPerm(COMMAND_DEFAULT_CLASS):
set the permissions of an account/object set the permissions of an account/object
Usage: Usage:
@perm[/switch] <object> [= <permission>[,<permission>,...]] perm[/switch] <object> [= <permission>[,<permission>,...]]
@perm[/switch] *<account> [= <permission>[,<permission>,...]] perm[/switch] *<account> [= <permission>[,<permission>,...]]
Switches: Switches:
del - delete the given permission from <object> or <account>. del - delete the given permission from <object> or <account>.
@ -398,8 +402,8 @@ class CmdPerm(COMMAND_DEFAULT_CLASS):
This command sets/clears individual permission strings on an object This command sets/clears individual permission strings on an object
or account. If no permission is given, list all permissions on <object>. or account. If no permission is given, list all permissions on <object>.
""" """
key = "@perm" key = "perm"
aliases = "@setperm" aliases = "setperm"
switch_options = ("del", "account") switch_options = ("del", "account")
locks = "cmd:perm(perm) or perm(Developer)" locks = "cmd:perm(perm) or perm(Developer)"
help_category = "Admin" help_category = "Admin"
@ -412,7 +416,7 @@ class CmdPerm(COMMAND_DEFAULT_CLASS):
lhs, rhs = self.lhs, self.rhs lhs, rhs = self.lhs, self.rhs
if not self.args: if not self.args:
string = "Usage: @perm[/switch] object [ = permission, permission, ...]" string = "Usage: perm[/switch] object [ = permission, permission, ...]"
caller.msg(string) caller.msg(string)
return return
@ -496,19 +500,19 @@ class CmdWall(COMMAND_DEFAULT_CLASS):
make an announcement to all make an announcement to all
Usage: Usage:
@wall <message> wall <message>
Announces a message to all connected sessions Announces a message to all connected sessions
including all currently unlogged in. including all currently unlogged in.
""" """
key = "@wall" key = "wall"
locks = "cmd:perm(wall) or perm(Admin)" locks = "cmd:perm(wall) or perm(Admin)"
help_category = "Admin" help_category = "Admin"
def func(self): def func(self):
"""Implements command""" """Implements command"""
if not self.args: if not self.args:
self.caller.msg("Usage: @wall <message>") self.caller.msg("Usage: wall <message>")
return return
message = "%s shouts \"%s\"" % (self.caller.name, self.args) message = "%s shouts \"%s\"" % (self.caller.name, self.args)
self.msg("Announcing to all connected sessions ...") self.msg("Announcing to all connected sessions ...")
@ -520,12 +524,12 @@ class CmdForce(COMMAND_DEFAULT_CLASS):
forces an object to execute a command forces an object to execute a command
Usage: Usage:
@force <object>=<command string> force <object>=<command string>
Example: Example:
@force bob=get stick force bob=get stick
""" """
key = "@force" key = "force"
locks = "cmd:perm(spawn) or perm(Builder)" locks = "cmd:perm(spawn) or perm(Builder)"
help_category = "Building" help_category = "Building"
perm_used = "edit" perm_used = "edit"

View file

@ -225,7 +225,7 @@ class CmdBatchCommands(_COMMAND_DEFAULT_CLASS):
build from batch-command file build from batch-command file
Usage: Usage:
@batchcommands[/interactive] <python.path.to.file> batchcommands[/interactive] <python.path.to.file>
Switch: Switch:
interactive - this mode will offer more control when interactive - this mode will offer more control when
@ -235,8 +235,8 @@ class CmdBatchCommands(_COMMAND_DEFAULT_CLASS):
Runs batches of commands from a batch-cmd text file (*.ev). Runs batches of commands from a batch-cmd text file (*.ev).
""" """
key = "@batchcommands" key = "batchcommands"
aliases = ["@batchcommand", "@batchcmd"] aliases = ["batchcommand", "batchcmd"]
switch_options = ("interactive",) switch_options = ("interactive",)
locks = "cmd:perm(batchcommands) or perm(Developer)" locks = "cmd:perm(batchcommands) or perm(Developer)"
help_category = "Building" help_category = "Building"
@ -248,7 +248,7 @@ class CmdBatchCommands(_COMMAND_DEFAULT_CLASS):
args = self.args args = self.args
if not args: if not args:
caller.msg("Usage: @batchcommands[/interactive] <path.to.file>") caller.msg("Usage: batchcommands[/interactive] <path.to.file>")
return return
python_path = self.args python_path = self.args
@ -337,7 +337,7 @@ class CmdBatchCode(_COMMAND_DEFAULT_CLASS):
build from batch-code file build from batch-code file
Usage: Usage:
@batchcode[/interactive] <python path to file> batchcode[/interactive] <python path to file>
Switch: Switch:
interactive - this mode will offer more control when interactive - this mode will offer more control when
@ -351,8 +351,8 @@ class CmdBatchCode(_COMMAND_DEFAULT_CLASS):
Runs batches of commands from a batch-code text file (*.py). Runs batches of commands from a batch-code text file (*.py).
""" """
key = "@batchcode" key = "batchcode"
aliases = ["@batchcodes"] aliases = ["batchcodes"]
switch_options = ("interactive", "debug") switch_options = ("interactive", "debug")
locks = "cmd:superuser()" locks = "cmd:superuser()"
help_category = "Building" help_category = "Building"
@ -364,7 +364,7 @@ class CmdBatchCode(_COMMAND_DEFAULT_CLASS):
args = self.args args = self.args
if not args: if not args:
caller.msg("Usage: @batchcode[/interactive/debug] <path.to.file>") caller.msg("Usage: batchcode[/interactive/debug] <path.to.file>")
return return
python_path = self.args python_path = self.args
debug = 'debug' in self.switches debug = 'debug' in self.switches
@ -452,13 +452,13 @@ class CmdBatchCode(_COMMAND_DEFAULT_CLASS):
class CmdStateAbort(_COMMAND_DEFAULT_CLASS): class CmdStateAbort(_COMMAND_DEFAULT_CLASS):
""" """
@abort abort
This is a safety feature. It force-ejects us out of the processor and to This is a safety feature. It force-ejects us out of the processor and to
the default cmdset, regardless of what current cmdset the processor might the default cmdset, regardless of what current cmdset the processor might
have put us in (e.g. when testing buggy scripts etc). have put us in (e.g. when testing buggy scripts etc).
""" """
key = "@abort" key = "abort"
help_category = "BatchProcess" help_category = "BatchProcess"
locks = "cmd:perm(batchcommands)" locks = "cmd:perm(batchcommands)"
@ -813,7 +813,7 @@ class CmdStateHH(_COMMAND_DEFAULT_CLASS):
cc - continue processing to end, then quit. cc - continue processing to end, then quit.
qq - quit (abort all remaining commands) qq - quit (abort all remaining commands)
@abort - this is a safety command that always is available abort - this is a safety command that always is available
regardless of what cmdsets gets added to us during regardless of what cmdsets gets added to us during
batch-command processing. It immediately shuts down batch-command processing. It immediately shuts down
the processor and returns us to the default cmdset. the processor and returns us to the default cmdset.
@ -831,7 +831,7 @@ class CmdStateHH(_COMMAND_DEFAULT_CLASS):
class BatchSafeCmdSet(CmdSet): class BatchSafeCmdSet(CmdSet):
""" """
The base cmdset for the batch processor. The base cmdset for the batch processor.
This sets a 'safe' @abort command that will This sets a 'safe' abort command that will
always be available to get out of everything. always be available to get out of everything.
""" """
key = "Batch_default" key = "Batch_default"

View file

@ -27,10 +27,10 @@ __all__ = ("ObjManipCommand", "CmdSetObjAlias", "CmdCopy",
"CmdLock", "CmdExamine", "CmdFind", "CmdTeleport", "CmdLock", "CmdExamine", "CmdFind", "CmdTeleport",
"CmdScript", "CmdTag", "CmdSpawn") "CmdScript", "CmdTag", "CmdSpawn")
# used by @set # used by set
from ast import literal_eval as _LITERAL_EVAL from ast import literal_eval as _LITERAL_EVAL
# used by @find # used by find
CHAR_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS CHAR_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS
ROOM_TYPECLASS = settings.BASE_ROOM_TYPECLASS ROOM_TYPECLASS = settings.BASE_ROOM_TYPECLASS
EXIT_TYPECLASS = settings.BASE_EXIT_TYPECLASS EXIT_TYPECLASS = settings.BASE_EXIT_TYPECLASS
@ -101,9 +101,9 @@ class CmdSetObjAlias(COMMAND_DEFAULT_CLASS):
adding permanent aliases for object adding permanent aliases for object
Usage: Usage:
@alias <obj> [= [alias[,alias,alias,...]]] alias <obj> [= [alias[,alias,alias,...]]]
@alias <obj> = alias <obj> =
@alias/category <obj> = [alias[,alias,...]:<category> alias/category <obj> = [alias[,alias,...]:<category>
Switches: Switches:
category - requires ending input with :category, to store the category - requires ending input with :category, to store the
@ -114,13 +114,13 @@ class CmdSetObjAlias(COMMAND_DEFAULT_CLASS):
assigning a category, all aliases given will be using this category. assigning a category, all aliases given will be using this category.
Observe that this is not the same thing as personal aliases Observe that this is not the same thing as personal aliases
created with the 'nick' command! Aliases set with @alias are created with the 'nick' command! Aliases set with alias are
changing the object in question, making those aliases usable changing the object in question, making those aliases usable
by everyone. by everyone.
""" """
key = "@alias" key = "alias"
aliases = "@setobjalias" aliases = "setobjalias"
switch_options = ("category",) switch_options = ("category",)
locks = "cmd:perm(setobjalias) or perm(Builder)" locks = "cmd:perm(setobjalias) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -131,7 +131,7 @@ class CmdSetObjAlias(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.lhs: if not self.lhs:
string = "Usage: @alias <obj> [= [alias[,alias ...]]]" string = "Usage: alias <obj> [= [alias[,alias ...]]]"
self.caller.msg(string) self.caller.msg(string)
return return
objname = self.lhs objname = self.lhs
@ -203,7 +203,7 @@ class CmdCopy(ObjManipCommand):
copy an object and its properties copy an object and its properties
Usage: Usage:
@copy[/reset] <original obj> [= <new_name>][;alias;alias..] copy[/reset] <original obj> [= <new_name>][;alias;alias..]
[:<new_location>] [,<new_name2> ...] [:<new_location>] [,<new_name2> ...]
switch: switch:
@ -215,7 +215,7 @@ class CmdCopy(ObjManipCommand):
one exact copy of the original object will be created with the name *_copy. one exact copy of the original object will be created with the name *_copy.
""" """
key = "@copy" key = "copy"
switch_options = ("reset",) switch_options = ("reset",)
locks = "cmd:perm(copy) or perm(Builder)" locks = "cmd:perm(copy) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -226,7 +226,7 @@ class CmdCopy(ObjManipCommand):
caller = self.caller caller = self.caller
args = self.args args = self.args
if not args: if not args:
caller.msg("Usage: @copy <obj> [=<new_name>[;alias;alias..]]" caller.msg("Usage: copy <obj> [=<new_name>[;alias;alias..]]"
"[:<new_location>] [, <new_name2>...]") "[:<new_location>] [, <new_name2>...]")
return return
@ -280,16 +280,16 @@ class CmdCpAttr(ObjManipCommand):
copy attributes between objects copy attributes between objects
Usage: Usage:
@cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...] cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...] cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]
Switches: Switches:
move - delete the attribute from the source object after copying. move - delete the attribute from the source object after copying.
Example: Example:
@cpattr coolness = Anna/chillout, Anna/nicety, Tom/nicety cpattr coolness = Anna/chillout, Anna/nicety, Tom/nicety
-> ->
copies the coolness attribute (defined on yourself), to attributes copies the coolness attribute (defined on yourself), to attributes
on Anna and Tom. on Anna and Tom.
@ -297,7 +297,7 @@ class CmdCpAttr(ObjManipCommand):
Copy the attribute one object to one or more attributes on another object. Copy the attribute one object to one or more attributes on another object.
If you don't supply a source object, yourself is used. If you don't supply a source object, yourself is used.
""" """
key = "@cpattr" key = "cpattr"
switch_options = ("move",) switch_options = ("move",)
locks = "cmd:perm(cpattr) or perm(Builder)" locks = "cmd:perm(cpattr) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -348,10 +348,10 @@ class CmdCpAttr(ObjManipCommand):
if not self.rhs: if not self.rhs:
string = """Usage: string = """Usage:
@cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...] cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]""" cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]"""
caller.msg(string) caller.msg(string)
return return
@ -428,10 +428,10 @@ class CmdMvAttr(ObjManipCommand):
move attributes between objects move attributes between objects
Usage: Usage:
@mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...] mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...] mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]
Switches: Switches:
copy - Don't delete the original after moving. copy - Don't delete the original after moving.
@ -439,7 +439,7 @@ class CmdMvAttr(ObjManipCommand):
Move an attribute from one object to one or more attributes on another Move an attribute from one object to one or more attributes on another
object. If you don't supply a source object, yourself is used. object. If you don't supply a source object, yourself is used.
""" """
key = "@mvattr" key = "mvattr"
switch_options = ("copy",) switch_options = ("copy",)
locks = "cmd:perm(mvattr) or perm(Builder)" locks = "cmd:perm(mvattr) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -450,18 +450,18 @@ class CmdMvAttr(ObjManipCommand):
""" """
if not self.rhs: if not self.rhs:
string = """Usage: string = """Usage:
@mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...] mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...] mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]""" mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]"""
self.caller.msg(string) self.caller.msg(string)
return return
# simply use @cpattr for all the functionality # simply use cpattr for all the functionality
if "copy" in self.switches: if "copy" in self.switches:
self.execute_cmd("@cpattr %s" % self.args) self.execute_cmd("cpattr %s" % self.args)
else: else:
self.execute_cmd("@cpattr/move %s" % self.args) self.execute_cmd("cpattr/move %s" % self.args)
class CmdCreate(ObjManipCommand): class CmdCreate(ObjManipCommand):
@ -469,7 +469,7 @@ class CmdCreate(ObjManipCommand):
create new objects create new objects
Usage: Usage:
@create[/drop] <objname>[;alias;alias...][:typeclass], <objname>... create[/drop] <objname>[;alias;alias...][:typeclass], <objname>...
switch: switch:
drop - automatically drop the new object into your current drop - automatically drop the new object into your current
@ -484,11 +484,11 @@ class CmdCreate(ObjManipCommand):
types/examples/red_button.py, you could create a new types/examples/red_button.py, you could create a new
object of this type like this: object of this type like this:
@create/drop button;red : examples.red_button.RedButton create/drop button;red : examples.red_button.RedButton
""" """
key = "@create" key = "create"
switch_options = ("drop",) switch_options = ("drop",)
locks = "cmd:perm(create) or perm(Builder)" locks = "cmd:perm(create) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -505,7 +505,7 @@ class CmdCreate(ObjManipCommand):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
string = "Usage: @create[/drop] <newname>[;alias;alias...] [:typeclass.path]" string = "Usage: create[/drop] <newname>[;alias;alias...] [:typeclass.path]"
caller.msg(string) caller.msg(string)
return return
@ -565,7 +565,7 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
describe an object or the current room. describe an object or the current room.
Usage: Usage:
@desc [<obj> =] <description> desc [<obj> =] <description>
Switches: Switches:
edit - Open up a line editor for more advanced editing. edit - Open up a line editor for more advanced editing.
@ -573,8 +573,8 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
Sets the "desc" attribute on an object. If an object is not given, Sets the "desc" attribute on an object. If an object is not given,
describe the current room. describe the current room.
""" """
key = "@desc" key = "desc"
aliases = "@describe" aliases = "describe"
switch_options = ("edit",) switch_options = ("edit",)
locks = "cmd:perm(desc) or perm(Builder)" locks = "cmd:perm(desc) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -605,7 +605,7 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.args and 'edit' not in self.switches: if not self.args and 'edit' not in self.switches:
caller.msg("Usage: @desc [<obj> =] <description>") caller.msg("Usage: desc [<obj> =] <description>")
return return
if 'edit' in self.switches: if 'edit' in self.switches:
@ -635,16 +635,16 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
permanently delete objects permanently delete objects
Usage: Usage:
@destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...] destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...]
Switches: Switches:
override - The @destroy command will usually avoid accidentally override - The destroy command will usually avoid accidentally
destroying account objects. This switch overrides this safety. destroying account objects. This switch overrides this safety.
force - destroy without confirmation. force - destroy without confirmation.
Examples: Examples:
@destroy house, roof, door, 44-78 destroy house, roof, door, 44-78
@destroy 5-10, flower, 45 destroy 5-10, flower, 45
@destroy/force north destroy/force north
Destroys one or many objects. If dbrefs are used, a range to delete can be Destroys one or many objects. If dbrefs are used, a range to delete can be
given, e.g. 4-10. Also the end points will be deleted. This command given, e.g. 4-10. Also the end points will be deleted. This command
@ -652,8 +652,8 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
You can specify the /force switch to bypass this confirmation. You can specify the /force switch to bypass this confirmation.
""" """
key = "@destroy" key = "destroy"
aliases = ["@delete", "@del"] aliases = ["delete", "del"]
switch_options = ("override", "force") switch_options = ("override", "force")
locks = "cmd:perm(destroy) or perm(Builder)" locks = "cmd:perm(destroy) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -668,7 +668,7 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
delete = True delete = True
if not self.args or not self.lhslist: if not self.args or not self.lhslist:
caller.msg("Usage: @destroy[/switches] [obj, obj2, obj3, [dbref-dbref],...]") caller.msg("Usage: destroy[/switches] [obj, obj2, obj3, [dbref-dbref],...]")
delete = False delete = False
def delobj(obj): def delobj(obj):
@ -758,7 +758,7 @@ class CmdDig(ObjManipCommand):
build new rooms and connect them to the current location build new rooms and connect them to the current location
Usage: Usage:
@dig[/switches] <roomname>[;alias;alias...][:typeclass] dig[/switches] <roomname>[;alias;alias...][:typeclass]
[= <exit_to_there>[;alias][:typeclass]] [= <exit_to_there>[;alias][:typeclass]]
[, <exit_to_here>[;alias][:typeclass]] [, <exit_to_here>[;alias][:typeclass]]
@ -766,9 +766,9 @@ class CmdDig(ObjManipCommand):
tel or teleport - move yourself to the new room tel or teleport - move yourself to the new room
Examples: Examples:
@dig kitchen = north;n, south;s dig kitchen = north;n, south;s
@dig house:myrooms.MyHouseTypeclass dig house:myrooms.MyHouseTypeclass
@dig sheer cliff;cliff;sheer = climb up, climb down dig sheer cliff;cliff;sheer = climb up, climb down
This command is a convenient way to build rooms quickly; it creates the This command is a convenient way to build rooms quickly; it creates the
new room and you can optionally set up exits back and forth between your new room and you can optionally set up exits back and forth between your
@ -776,7 +776,7 @@ class CmdDig(ObjManipCommand):
like to the name of the room and the exits in question; an example like to the name of the room and the exits in question; an example
would be 'north;no;n'. would be 'north;no;n'.
""" """
key = "@dig" key = "dig"
switch_options = ("teleport",) switch_options = ("teleport",)
locks = "cmd:perm(dig) or perm(Builder)" locks = "cmd:perm(dig) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -793,7 +793,7 @@ class CmdDig(ObjManipCommand):
caller = self.caller caller = self.caller
if not self.lhs: if not self.lhs:
string = "Usage: @dig[/teleport] <roomname>[;alias;alias...]" \ string = "Usage: dig[/teleport] <roomname>[;alias;alias...]" \
"[:parent] [= <exit_there>" "[:parent] [= <exit_there>"
string += "[;alias;alias..][:parent]] " string += "[;alias;alias..][:parent]] "
string += "[, <exit_back_here>[;alias;alias..][:parent]]" string += "[, <exit_back_here>[;alias;alias..][:parent]]"
@ -896,15 +896,15 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
create new rooms in cardinal directions only create new rooms in cardinal directions only
Usage: Usage:
@tunnel[/switch] <direction>[:typeclass] [= <roomname>[;alias;alias;...][:typeclass]] tunnel[/switch] <direction>[:typeclass] [= <roomname>[;alias;alias;...][:typeclass]]
Switches: Switches:
oneway - do not create an exit back to the current location oneway - do not create an exit back to the current location
tel - teleport to the newly created room tel - teleport to the newly created room
Example: Example:
@tunnel n tunnel n
@tunnel n = house;mike's place;green building tunnel n = house;mike's place;green building
This is a simple way to build using pre-defined directions: This is a simple way to build using pre-defined directions:
|wn,ne,e,se,s,sw,w,nw|n (north, northeast etc) |wn,ne,e,se,s,sw,w,nw|n (north, northeast etc)
@ -915,11 +915,11 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
exit will always be able to be used with both "north" as well as exit will always be able to be used with both "north" as well as
"n" for example). Opposite directions will automatically be "n" for example). Opposite directions will automatically be
created back from the new room unless the /oneway switch is given. created back from the new room unless the /oneway switch is given.
For more flexibility and power in creating rooms, use @dig. For more flexibility and power in creating rooms, use dig.
""" """
key = "@tunnel" key = "tunnel"
aliases = ["@tun"] aliases = ["tun"]
switch_options = ("oneway", "tel") switch_options = ("oneway", "tel")
locks = "cmd: perm(tunnel) or perm(Builder)" locks = "cmd: perm(tunnel) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -942,7 +942,7 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
"""Implements the tunnel command""" """Implements the tunnel command"""
if not self.args or not self.lhs: if not self.args or not self.lhs:
string = "Usage: @tunnel[/switch] <direction>[:typeclass] [= <roomname>" \ string = "Usage: tunnel[/switch] <direction>[:typeclass] [= <roomname>" \
"[;alias;alias;...][:typeclass]]" "[;alias;alias;...][:typeclass]]"
self.caller.msg(string) self.caller.msg(string)
return return
@ -951,9 +951,9 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
exitshort = self.lhs.split(":")[0] exitshort = self.lhs.split(":")[0]
if exitshort not in self.directions: if exitshort not in self.directions:
string = "@tunnel can only understand the following directions: %s." % ",".join( string = "tunnel can only understand the following directions: %s." % ",".join(
sorted(self.directions.keys())) sorted(self.directions.keys()))
string += "\n(use @dig for more freedom)" string += "\n(use dig for more freedom)"
self.caller.msg(string) self.caller.msg(string)
return return
@ -981,8 +981,8 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
if "oneway" not in self.switches: if "oneway" not in self.switches:
backstring = ", %s;%s" % (backname, backshort) backstring = ", %s;%s" % (backname, backshort)
# build the string we will use to call @dig # build the string we will use to call dig
digstring = "@dig%s %s = %s;%s%s" % (telswitch, roomname, digstring = "dig%s %s = %s;%s%s" % (telswitch, roomname,
exitname, exitshort, backstring) exitname, exitshort, backstring)
self.execute_cmd(digstring) self.execute_cmd(digstring)
@ -992,9 +992,9 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
link existing rooms together with exits link existing rooms together with exits
Usage: Usage:
@link[/switches] <object> = <target> link[/switches] <object> = <target>
@link[/switches] <object> = link[/switches] <object> =
@link[/switches] <object> link[/switches] <object>
Switch: Switch:
twoway - connect two exits. For this to work, BOTH <object> twoway - connect two exits. For this to work, BOTH <object>
@ -1004,11 +1004,11 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
instead sets the destination to the *locations* of the respective given instead sets the destination to the *locations* of the respective given
arguments. arguments.
The second form (a lone =) sets the destination to None (same as The second form (a lone =) sets the destination to None (same as
the @unlink command) and the third form (without =) just shows the the unlink command) and the third form (without =) just shows the
currently set destination. currently set destination.
""" """
key = "@link" key = "link"
locks = "cmd:perm(link) or perm(Builder)" locks = "cmd:perm(link) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1017,7 +1017,7 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
caller.msg("Usage: @link[/twoway] <object> = <target>") caller.msg("Usage: link[/twoway] <object> = <target>")
return return
object_name = self.lhs object_name = self.lhs
@ -1076,7 +1076,7 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
string = "%s is not an exit. Its home location is %s." % (obj.name, obj.home) string = "%s is not an exit. Its home location is %s." % (obj.name, obj.home)
else: else:
# We gave the command @link 'obj = ' which means we want to # We gave the command link 'obj = ' which means we want to
# clear destination. # clear destination.
if obj.destination: if obj.destination:
obj.destination = None obj.destination = None
@ -1092,14 +1092,14 @@ class CmdUnLink(CmdLink):
remove exit-connections between rooms remove exit-connections between rooms
Usage: Usage:
@unlink <Object> unlink <Object>
Unlinks an object, for example an exit, disconnecting Unlinks an object, for example an exit, disconnecting
it from whatever it was connected to. it from whatever it was connected to.
""" """
# this is just a child of CmdLink # this is just a child of CmdLink
key = "@unlink" key = "unlink"
locks = "cmd:perm(unlink) or perm(Builder)" locks = "cmd:perm(unlink) or perm(Builder)"
help_key = "Building" help_key = "Building"
@ -1112,13 +1112,13 @@ class CmdUnLink(CmdLink):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
caller.msg("Usage: @unlink <object>") caller.msg("Usage: unlink <object>")
return return
# This mimics '@link <obj> = ' which is the same as @unlink # This mimics 'link <obj> = ' which is the same as unlink
self.rhs = "" self.rhs = ""
# call the @link functionality # call the link functionality
super().func() super().func()
@ -1127,8 +1127,8 @@ class CmdSetHome(CmdLink):
set an object's home location set an object's home location
Usage: Usage:
@sethome <obj> [= <home_location>] sethome <obj> [= <home_location>]
@sethom <obj> sethom <obj>
The "home" location is a "safety" location for objects; they The "home" location is a "safety" location for objects; they
will be moved there if their current location ceases to exist. All will be moved there if their current location ceases to exist. All
@ -1138,14 +1138,14 @@ class CmdSetHome(CmdLink):
If no location is given, just view the object's home location. If no location is given, just view the object's home location.
""" """
key = "@sethome" key = "sethome"
locks = "cmd:perm(@sethome) or perm(Builder)" locks = "cmd:perm(sethome) or perm(Builder)"
help_category = "Building" help_category = "Building"
def func(self): def func(self):
"""implement the command""" """implement the command"""
if not self.args: if not self.args:
string = "Usage: @sethome <obj> [= <home_location>]" string = "Usage: sethome <obj> [= <home_location>]"
self.caller.msg(string) self.caller.msg(string)
return return
@ -1180,13 +1180,13 @@ class CmdListCmdSets(COMMAND_DEFAULT_CLASS):
list command sets defined on an object list command sets defined on an object
Usage: Usage:
@cmdsets <obj> cmdsets <obj>
This displays all cmdsets assigned This displays all cmdsets assigned
to a user. Defaults to yourself. to a user. Defaults to yourself.
""" """
key = "@cmdsets" key = "cmdsets"
aliases = "@listcmsets" aliases = "listcmsets"
locks = "cmd:perm(listcmdsets) or perm(Builder)" locks = "cmd:perm(listcmdsets) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1209,15 +1209,15 @@ class CmdName(ObjManipCommand):
change the name and/or aliases of an object change the name and/or aliases of an object
Usage: Usage:
@name <obj> = <newname>;alias1;alias2 name <obj> = <newname>;alias1;alias2
Rename an object to something new. Use *obj to Rename an object to something new. Use *obj to
rename an account. rename an account.
""" """
key = "@name" key = "name"
aliases = ["@rename"] aliases = ["rename"]
locks = "cmd:perm(rename) or perm(Builder)" locks = "cmd:perm(rename) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1226,7 +1226,7 @@ class CmdName(ObjManipCommand):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
caller.msg("Usage: @name <obj> = <newname>[;alias;alias;...]") caller.msg("Usage: name <obj> = <newname>[;alias;alias;...]")
return return
obj = None obj = None
@ -1284,7 +1284,7 @@ class CmdOpen(ObjManipCommand):
open a new exit from the current room open a new exit from the current room
Usage: Usage:
@open <new exit>[;alias;alias..][:typeclass] [,<return exit>[;alias;..][:typeclass]]] = <destination> open <new exit>[;alias;alias..][:typeclass] [,<return exit>[;alias;..][:typeclass]]] = <destination>
Handles the creation of exits. If a destination is given, the exit Handles the creation of exits. If a destination is given, the exit
will point there. The <return exit> argument sets up an exit at the will point there. The <return exit> argument sets up an exit at the
@ -1293,7 +1293,7 @@ class CmdOpen(ObjManipCommand):
unique. unique.
""" """
key = "@open" key = "open"
locks = "cmd:perm(open) or perm(Builder)" locks = "cmd:perm(open) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1368,7 +1368,7 @@ class CmdOpen(ObjManipCommand):
caller = self.caller caller = self.caller
if not self.args or not self.rhs: if not self.args or not self.rhs:
string = "Usage: @open <new exit>[;alias...][:typeclass][,<return exit>[;alias..][:typeclass]]] " string = "Usage: open <new exit>[;alias...][:typeclass][,<return exit>[;alias..][:typeclass]]] "
string += "= <destination>" string += "= <destination>"
caller.msg(string) caller.msg(string)
return return
@ -1421,7 +1421,7 @@ def _convert_from_string(cmd, strobj):
Handles floats, ints, and limited nested lists and dicts Handles floats, ints, and limited nested lists and dicts
(can't handle lists in a dict, for example, this is mainly due to (can't handle lists in a dict, for example, this is mainly due to
the complexity of parsing this rather than any technical difficulty - the complexity of parsing this rather than any technical difficulty -
if there is a need for @set-ing such complex structures on the if there is a need for set-ing such complex structures on the
command line we might consider adding it). command line we might consider adding it).
Python 2.6 and later: Python 2.6 and later:
Supports all Python structures through literal_eval as long as they Supports all Python structures through literal_eval as long as they
@ -1456,10 +1456,10 @@ class CmdSetAttribute(ObjManipCommand):
set attribute on an object or account set attribute on an object or account
Usage: Usage:
@set <obj>/<attr> = <value> set <obj>/<attr> = <value>
@set <obj>/<attr> = set <obj>/<attr> =
@set <obj>/<attr> set <obj>/<attr>
@set *<account>/attr = <value> set *<account>/attr = <value>
Switch: Switch:
edit: Open the line editor (string values only) edit: Open the line editor (string values only)
@ -1490,7 +1490,7 @@ class CmdSetAttribute(ObjManipCommand):
""" """
key = "@set" key = "set"
locks = "cmd:perm(set) or perm(Builder)" locks = "cmd:perm(set) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1603,11 +1603,11 @@ class CmdSetAttribute(ObjManipCommand):
return found_obj return found_obj
def func(self): def func(self):
"""Implement the set attribute - a limited form of @py.""" """Implement the set attribute - a limited form of py."""
caller = self.caller caller = self.caller
if not self.args: if not self.args:
caller.msg("Usage: @set obj/attr = value. Use empty value to clear.") caller.msg("Usage: set obj/attr = value. Use empty value to clear.")
return return
# get values prepared by the parser # get values prepared by the parser
@ -1675,12 +1675,12 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
set or change an object's typeclass set or change an object's typeclass
Usage: Usage:
@typeclass[/switch] <object> [= typeclass.path] typeclass[/switch] <object> [= typeclass.path]
@type '' type ''
@parent '' parent ''
@typeclass/list/show [typeclass.path] typeclass/list/show [typeclass.path]
@swap - this is a shorthand for using /force/reset flags. swap - this is a shorthand for using /force/reset flags.
@update - this is a shorthand for using the /force/reload flag. update - this is a shorthand for using the /force/reload flag.
Switch: Switch:
show, examine - display the current typeclass of object (default) or, if show, examine - display the current typeclass of object (default) or, if
@ -1695,7 +1695,7 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
Example: Example:
@type button = examples.red_button.RedButton type button = examples.red_button.RedButton
If the typeclass_path is not given, the current object's If the typeclass_path is not given, the current object's
typeclass is assumed. typeclass is assumed.
@ -1715,8 +1715,8 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
""" """
key = "@typeclass" key = "typeclass"
aliases = ["@type", "@parent", "@swap", "@update"] aliases = ["type", "parent", "swap", "update"]
switch_options = ("show", "examine", "update", "reset", "force", "list") switch_options = ("show", "examine", "update", "reset", "force", "list")
locks = "cmd:perm(typeclass) or perm(Builder)" locks = "cmd:perm(typeclass) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1793,10 +1793,10 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
caller.msg(string) caller.msg(string)
return return
if self.cmdstring == "@swap": if self.cmdstring == "swap":
self.switches.append("force") self.switches.append("force")
self.switches.append("reset") self.switches.append("reset")
elif self.cmdstring == "@update": elif self.cmdstring == "update":
self.switches.append("force") self.switches.append("force")
self.switches.append("update") self.switches.append("update")
@ -1844,16 +1844,16 @@ class CmdWipe(ObjManipCommand):
clear all attributes from an object clear all attributes from an object
Usage: Usage:
@wipe <object>[/<attr>[/<attr>...]] wipe <object>[/<attr>[/<attr>...]]
Example: Example:
@wipe box wipe box
@wipe box/colour wipe box/colour
Wipes all of an object's attributes, or optionally only those Wipes all of an object's attributes, or optionally only those
matching the given attribute-wildcard search string. matching the given attribute-wildcard search string.
""" """
key = "@wipe" key = "wipe"
locks = "cmd:perm(wipe) or perm(Builder)" locks = "cmd:perm(wipe) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1865,7 +1865,7 @@ class CmdWipe(ObjManipCommand):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
caller.msg("Usage: @wipe <object>[/<attr>/<attr>...]") caller.msg("Usage: wipe <object>[/<attr>/<attr>...]")
return return
# get the attributes set by our custom parser # get the attributes set by our custom parser
@ -1895,9 +1895,9 @@ class CmdLock(ObjManipCommand):
assign a lock definition to an object assign a lock definition to an object
Usage: Usage:
@lock <object or *account>[ = <lockstring>] lock <object or *account>[ = <lockstring>]
or or
@lock[/switch] <object or *account>/<access_type> lock[/switch] <object or *account>/<access_type>
Switch: Switch:
del - delete given access type del - delete given access type
@ -1921,8 +1921,8 @@ class CmdLock(ObjManipCommand):
them by ';', i.e: them by ';', i.e:
'get:id(25); delete:perm(Builder)' 'get:id(25); delete:perm(Builder)'
""" """
key = "@lock" key = "lock"
aliases = ["@locks"] aliases = ["locks"]
locks = "cmd: perm(locks) or perm(Builder)" locks = "cmd: perm(locks) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -1931,13 +1931,13 @@ class CmdLock(ObjManipCommand):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
string = "Usage: @lock <object>[ = <lockstring>] or @lock[/switch] " \ string = "Usage: lock <object>[ = <lockstring>] or lock[/switch] " \
"<object>/<access_type>" "<object>/<access_type>"
caller.msg(string) caller.msg(string)
return return
if '/' in self.lhs: if '/' in self.lhs:
# call of the form @lock obj/access_type # call of the form lock obj/access_type
objname, access_type = [p.strip() for p in self.lhs.split('/', 1)] objname, access_type = [p.strip() for p in self.lhs.split('/', 1)]
obj = None obj = None
if objname.startswith("*"): if objname.startswith("*"):
@ -1975,7 +1975,7 @@ class CmdLock(ObjManipCommand):
swi = ", ".join(self.switches) swi = ", ".join(self.switches)
caller.msg("Switch(es) |w%s|n can not be used with a " caller.msg("Switch(es) |w%s|n can not be used with a "
"lock assignment. Use e.g. " "lock assignment. Use e.g. "
"|w@lock/del objname/locktype|n instead." % swi) "|wlock/del objname/locktype|n instead." % swi)
return return
objname, lockdef = self.lhs, self.rhs objname, lockdef = self.lhs, self.rhs
@ -2037,8 +2037,8 @@ class CmdExamine(ObjManipCommand):
Append a * before the search string to examine an account. Append a * before the search string to examine an account.
""" """
key = "@examine" key = "examine"
aliases = ["@ex", "exam"] aliases = ["ex", "exam"]
locks = "cmd:perm(examine) or perm(Builder)" locks = "cmd:perm(examine) or perm(Builder)"
help_category = "Building" help_category = "Building"
arg_regex = r"(/\w+?(\s|$))|\s|$" arg_regex = r"(/\w+?(\s|$))|\s|$"
@ -2298,8 +2298,8 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
search the database for objects search the database for objects
Usage: Usage:
@find[/switches] <name or dbref or *account> [= dbrefmin[-dbrefmax]] find[/switches] <name or dbref or *account> [= dbrefmin[-dbrefmax]]
@locate - this is a shorthand for using the /loc switch. locate - this is a shorthand for using the /loc switch.
Switches: Switches:
room - only look for rooms (location=None) room - only look for rooms (location=None)
@ -2316,8 +2316,8 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
one is given. one is given.
""" """
key = "@find" key = "find"
aliases = "@search, @locate" aliases = "search, locate"
switch_options = ("room", "exit", "char", "exact", "loc", "startswith") switch_options = ("room", "exit", "char", "exact", "loc", "startswith")
locks = "cmd:perm(find) or perm(Builder)" locks = "cmd:perm(find) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -2328,10 +2328,10 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
switches = self.switches switches = self.switches
if not self.args: if not self.args:
caller.msg("Usage: @find <string> [= low [-high]]") caller.msg("Usage: find <string> [= low [-high]]")
return return
if "locate" in self.cmdstring: # Use option /loc as a default for @locate command alias if "locate" in self.cmdstring: # Use option /loc as a default for locate command alias
switches.append('loc') switches.append('loc')
searchstring = self.lhs searchstring = self.lhs
@ -2439,12 +2439,12 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
teleport object to another location teleport object to another location
Usage: Usage:
@tel/switch [<object> to||=] <target location> tel/switch [<object> to||=] <target location>
Examples: Examples:
@tel Limbo tel Limbo
@tel/quiet box = Limbo tel/quiet box = Limbo
@tel/tonone box tel/tonone box
Switches: Switches:
quiet - don't echo leave/arrive messages to the source/target quiet - don't echo leave/arrive messages to the source/target
@ -2461,8 +2461,8 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
Teleports an object somewhere. If no object is given, you yourself Teleports an object somewhere. If no object is given, you yourself
is teleported to the target location. is teleported to the target location.
""" """
key = "@tel" key = "tel"
aliases = "@teleport" aliases = "teleport"
switch_options = ("quiet", "intoexit", "tonone", "loc") switch_options = ("quiet", "intoexit", "tonone", "loc")
rhs_split = ("=", " to ") # Prefer = delimiter, but allow " to " usage. rhs_split = ("=", " to ") # Prefer = delimiter, but allow " to " usage.
locks = "cmd:perm(teleport) or perm(Builder)" locks = "cmd:perm(teleport) or perm(Builder)"
@ -2555,7 +2555,7 @@ class CmdScript(COMMAND_DEFAULT_CLASS):
attach a script to an object attach a script to an object
Usage: Usage:
@script[/switch] <obj> [= script_path or <scriptkey>] script[/switch] <obj> [= script_path or <scriptkey>]
Switches: Switches:
start - start all non-running scripts on object, or a given script only start - start all non-running scripts on object, or a given script only
@ -2570,8 +2570,8 @@ class CmdScript(COMMAND_DEFAULT_CLASS):
the object. the object.
""" """
key = "@script" key = "script"
aliases = "@addscript" aliases = "addscript"
switch_options = ("start", "stop") switch_options = ("start", "stop")
locks = "cmd:perm(script) or perm(Builder)" locks = "cmd:perm(script) or perm(Builder)"
help_category = "Building" help_category = "Building"
@ -2582,12 +2582,12 @@ class CmdScript(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
string = "Usage: @script[/switch] <obj> [= script_path or <script key>]" string = "Usage: script[/switch] <obj> [= script_path or <script key>]"
caller.msg(string) caller.msg(string)
return return
if not self.lhs: if not self.lhs:
caller.msg("To create a global script you need |w@scripts/add <typeclass>|n.") caller.msg("To create a global script you need |wscripts/add <typeclass>|n.")
return return
obj = caller.search(self.lhs) obj = caller.search(self.lhs)
@ -2653,8 +2653,8 @@ class CmdTag(COMMAND_DEFAULT_CLASS):
handles the tags of an object handles the tags of an object
Usage: Usage:
@tag[/del] <obj> [= <tag>[:<category>]] tag[/del] <obj> [= <tag>[:<category>]]
@tag/search <tag>[:<category] tag/search <tag>[:<category]
Switches: Switches:
search - return all objects with a given Tag search - return all objects with a given Tag
@ -2670,18 +2670,18 @@ class CmdTag(COMMAND_DEFAULT_CLASS):
enough to for most grouping schemes. enough to for most grouping schemes.
""" """
key = "@tag" key = "tag"
aliases = ["@tags"] aliases = ["tags"]
options = ("search", "del") options = ("search", "del")
locks = "cmd:perm(tag) or perm(Builder)" locks = "cmd:perm(tag) or perm(Builder)"
help_category = "Building" help_category = "Building"
arg_regex = r"(/\w+?(\s|$))|\s|$" arg_regex = r"(/\w+?(\s|$))|\s|$"
def func(self): def func(self):
"""Implement the @tag functionality""" """Implement the tag functionality"""
if not self.args: if not self.args:
self.caller.msg("Usage: @tag[/switches] <obj> [= <tag>[:<category>]]") self.caller.msg("Usage: tag[/switches] <obj> [= <tag>[:<category>]]")
return return
if "search" in self.switches: if "search" in self.switches:
# search by tag # search by tag
@ -2777,17 +2777,17 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
spawn objects from prototype spawn objects from prototype
Usage: Usage:
@spawn[/noloc] <prototype_key> spawn[/noloc] <prototype_key>
@spawn[/noloc] <prototype_dict> spawn[/noloc] <prototype_dict>
@spawn/search [prototype_keykey][;tag[,tag]] spawn/search [prototype_keykey][;tag[,tag]]
@spawn/list [tag, tag, ...] spawn/list [tag, tag, ...]
@spawn/show [<prototype_key>] spawn/show [<prototype_key>]
@spawn/update <prototype_key> spawn/update <prototype_key>
@spawn/save <prototype_dict> spawn/save <prototype_dict>
@spawn/edit [<prototype_key>] spawn/edit [<prototype_key>]
@olc - equivalent to @spawn/edit olc - equivalent to spawn/edit
Switches: Switches:
noloc - allow location to be None if not specified explicitly. Otherwise, noloc - allow location to be None if not specified explicitly. Otherwise,
@ -2804,9 +2804,9 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
edit, olc - create/manipulate prototype in a menu interface. edit, olc - create/manipulate prototype in a menu interface.
Example: Example:
@spawn GOBLIN spawn GOBLIN
@spawn {"key":"goblin", "typeclass":"monster.Monster", "location":"#2"} spawn {"key":"goblin", "typeclass":"monster.Monster", "location":"#2"}
@spawn/save {"key": "grunt", prototype: "goblin"};;mobs;edit:all() spawn/save {"key": "grunt", prototype: "goblin"};;mobs;edit:all()
\f \f
Dictionary keys: Dictionary keys:
|wprototype_parent |n - name of parent prototype to use. Required if typeclass is |wprototype_parent |n - name of parent prototype to use. Required if typeclass is
@ -2831,12 +2831,12 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
any other keywords are interpreted as Attributes and their values. any other keywords are interpreted as Attributes and their values.
The available prototypes are defined globally in modules set in The available prototypes are defined globally in modules set in
settings.PROTOTYPE_MODULES. If @spawn is used without arguments it settings.PROTOTYPE_MODULES. If spawn is used without arguments it
displays a list of available prototypes. displays a list of available prototypes.
""" """
key = "@spawn" key = "spawn"
aliases = ["olc"] aliases = ["olc"]
switch_options = ("noloc", "search", "list", "show", "examine", "save", "delete", "menu", "olc", "update", "edit") switch_options = ("noloc", "search", "list", "show", "examine", "save", "delete", "menu", "olc", "update", "edit")
locks = "cmd:perm(spawn) or perm(Builder)" locks = "cmd:perm(spawn) or perm(Builder)"
@ -2947,7 +2947,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
# store a prototype to the database store # store a prototype to the database store
if not self.args: if not self.args:
caller.msg( caller.msg(
"Usage: @spawn/save <key>[;desc[;tag,tag[,...][;lockstring]]] = <prototype_dict>") "Usage: spawn/save <key>[;desc[;tag,tag[,...][;lockstring]]] = <prototype_dict>")
return return
# handle rhs: # handle rhs:
@ -3000,7 +3000,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
answer = yield(string) answer = yield(string)
if answer.lower() in ["n", "no"]: if answer.lower() in ["n", "no"]:
caller.msg("|rNo update was done of existing objects. " caller.msg("|rNo update was done of existing objects. "
"Use @spawn/update <key> to apply later as needed.|n") "Use spawn/update <key> to apply later as needed.|n")
return return
n_updated = spawner.batch_update_objects_with_prototype(existing_objects, key) n_updated = spawner.batch_update_objects_with_prototype(existing_objects, key)
caller.msg("{} objects were updated.".format(n_updated)) caller.msg("{} objects were updated.".format(n_updated))
@ -3008,7 +3008,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
if not self.args: if not self.args:
ncount = len(protlib.search_prototype()) ncount = len(protlib.search_prototype())
caller.msg("Usage: @spawn <prototype-key> or {{key: value, ...}}" caller.msg("Usage: spawn <prototype-key> or {{key: value, ...}}"
"\n ({} existing prototypes. Use /list to inspect)".format(ncount)) "\n ({} existing prototypes. Use /list to inspect)".format(ncount))
return return

View file

@ -218,7 +218,7 @@ class CmdAllCom(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
args = self.args args = self.args
if not args: if not args:
self.execute_cmd("@channels") self.execute_cmd("channels")
self.msg("(Usage: allcom on | off | who | destroy)") self.msg("(Usage: allcom on | off | who | destroy)")
return return
@ -239,7 +239,7 @@ class CmdAllCom(COMMAND_DEFAULT_CLASS):
channels = [chan for chan in ChannelDB.objects.get_all_channels() channels = [chan for chan in ChannelDB.objects.get_all_channels()
if chan.access(caller, 'control')] if chan.access(caller, 'control')]
for channel in channels: for channel in channels:
self.execute_cmd("@cdestroy %s" % channel.key) self.execute_cmd("cdestroy %s" % channel.key)
elif args == "who": elif args == "who":
# run a who, listing the subscribers on visible channels. # run a who, listing the subscribers on visible channels.
string = "\n|CChannel subscriptions|n" string = "\n|CChannel subscriptions|n"
@ -260,16 +260,16 @@ class CmdChannels(COMMAND_DEFAULT_CLASS):
list all channels available to you list all channels available to you
Usage: Usage:
@channels channels
@clist clist
comlist comlist
Lists all channels available to you, whether you listen to them or not. Lists all channels available to you, whether you listen to them or not.
Use 'comlist' to only view your current channel subscriptions. Use 'comlist' to only view your current channel subscriptions.
Use addcom/delcom to join and leave channels Use addcom/delcom to join and leave channels
""" """
key = "@channels" key = "channels"
aliases = ["@clist", "comlist", "chanlist", "channellist", "all channels"] aliases = ["clist", "comlist", "chanlist", "channellist", "all channels"]
help_category = "Comms" help_category = "Comms"
locks = "cmd: not pperm(channel_banned)" locks = "cmd: not pperm(channel_banned)"
@ -292,8 +292,8 @@ class CmdChannels(COMMAND_DEFAULT_CLASS):
if self.cmdstring == "comlist": if self.cmdstring == "comlist":
# just display the subscribed channels with no extra info # just display the subscribed channels with no extra info
comtable = self.style_table("|wchannel|n", "|wmy aliases|n", comtable = self.styled_table("|wchannel|n", "|wmy aliases|n",
"|wdescription|n", align="l", maxwidth=_DEFAULT_WIDTH) "|wdescription|n", align="l", maxwidth=_DEFAULT_WIDTH)
for chan in subs: for chan in subs:
clower = chan.key.lower() clower = chan.key.lower()
nicks = caller.nicks.get(category="channel", return_obj=True) nicks = caller.nicks.get(category="channel", return_obj=True)
@ -302,12 +302,12 @@ class CmdChannels(COMMAND_DEFAULT_CLASS):
"%s" % ",".join(nick.db_key for nick in make_iter(nicks) "%s" % ",".join(nick.db_key for nick in make_iter(nicks)
if nick and nick.value[3].lower() == clower), if nick and nick.value[3].lower() == clower),
chan.db.desc]) chan.db.desc])
self.msg("\n|wChannel subscriptions|n (use |w@channels|n to list all," self.msg("\n|wChannel subscriptions|n (use |wchannels|n to list all,"
" |waddcom|n/|wdelcom|n to sub/unsub):|n\n%s" % comtable) " |waddcom|n/|wdelcom|n to sub/unsub):|n\n%s" % comtable)
else: else:
# full listing (of channels caller is able to listen to) # full listing (of channels caller is able to listen to)
comtable = self.style_table("|wsub|n", "|wchannel|n", "|wmy aliases|n", comtable = self.styled_table("|wsub|n", "|wchannel|n", "|wmy aliases|n",
"|wlocks|n", "|wdescription|n", maxwidth=_DEFAULT_WIDTH) "|wlocks|n", "|wdescription|n", maxwidth=_DEFAULT_WIDTH)
for chan in channels: for chan in channels:
clower = chan.key.lower() clower = chan.key.lower()
nicks = caller.nicks.get(category="channel", return_obj=True) nicks = caller.nicks.get(category="channel", return_obj=True)
@ -336,12 +336,12 @@ class CmdCdestroy(COMMAND_DEFAULT_CLASS):
destroy a channel you created destroy a channel you created
Usage: Usage:
@cdestroy <channel> cdestroy <channel>
Destroys a channel that you control. Destroys a channel that you control.
""" """
key = "@cdestroy" key = "cdestroy"
help_category = "Comms" help_category = "Comms"
locks = "cmd: not pperm(channel_banned)" locks = "cmd: not pperm(channel_banned)"
@ -353,7 +353,7 @@ class CmdCdestroy(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
self.msg("Usage: @cdestroy <channelname>") self.msg("Usage: cdestroy <channelname>")
return return
channel = find_channel(caller, self.args) channel = find_channel(caller, self.args)
if not channel: if not channel:
@ -377,7 +377,7 @@ class CmdCBoot(COMMAND_DEFAULT_CLASS):
kick an account from a channel you control kick an account from a channel you control
Usage: Usage:
@cboot[/quiet] <channel> = <account> [:reason] cboot[/quiet] <channel> = <account> [:reason]
Switch: Switch:
quiet - don't notify the channel quiet - don't notify the channel
@ -386,7 +386,7 @@ class CmdCBoot(COMMAND_DEFAULT_CLASS):
""" """
key = "@cboot" key = "cboot"
switch_options = ("quiet",) switch_options = ("quiet",)
locks = "cmd: not pperm(channel_banned)" locks = "cmd: not pperm(channel_banned)"
help_category = "Comms" help_category = "Comms"
@ -398,7 +398,7 @@ class CmdCBoot(COMMAND_DEFAULT_CLASS):
"""implement the function""" """implement the function"""
if not self.args or not self.rhs: if not self.args or not self.rhs:
string = "Usage: @cboot[/quiet] <channel> = <account> [:reason]" string = "Usage: cboot[/quiet] <channel> = <account> [:reason]"
self.msg(string) self.msg(string)
return return
@ -444,7 +444,7 @@ class CmdCemit(COMMAND_DEFAULT_CLASS):
send an admin message to a channel you control send an admin message to a channel you control
Usage: Usage:
@cemit[/switches] <channel> = <message> cemit[/switches] <channel> = <message>
Switches: Switches:
sendername - attach the sender's name before the message sendername - attach the sender's name before the message
@ -456,8 +456,8 @@ class CmdCemit(COMMAND_DEFAULT_CLASS):
""" """
key = "@cemit" key = "cemit"
aliases = ["@cmsg"] aliases = ["cmsg"]
switch_options = ("sendername", "quiet") switch_options = ("sendername", "quiet")
locks = "cmd: not pperm(channel_banned) and pperm(Player)" locks = "cmd: not pperm(channel_banned) and pperm(Player)"
help_category = "Comms" help_category = "Comms"
@ -469,7 +469,7 @@ class CmdCemit(COMMAND_DEFAULT_CLASS):
"""Implement function""" """Implement function"""
if not self.args or not self.rhs: if not self.args or not self.rhs:
string = "Usage: @cemit[/switches] <channel> = <message>" string = "Usage: cemit[/switches] <channel> = <message>"
self.msg(string) self.msg(string)
return return
channel = find_channel(self.caller, self.lhs) channel = find_channel(self.caller, self.lhs)
@ -493,11 +493,11 @@ class CmdCWho(COMMAND_DEFAULT_CLASS):
show who is listening to a channel show who is listening to a channel
Usage: Usage:
@cwho <channel> cwho <channel>
List who is connected to a given channel you have access to. List who is connected to a given channel you have access to.
""" """
key = "@cwho" key = "cwho"
locks = "cmd: not pperm(channel_banned)" locks = "cmd: not pperm(channel_banned)"
help_category = "Comms" help_category = "Comms"
@ -508,7 +508,7 @@ class CmdCWho(COMMAND_DEFAULT_CLASS):
"""implement function""" """implement function"""
if not self.args: if not self.args:
string = "Usage: @cwho <channel>" string = "Usage: cwho <channel>"
self.msg(string) self.msg(string)
return return
@ -529,12 +529,12 @@ class CmdChannelCreate(COMMAND_DEFAULT_CLASS):
create a new channel create a new channel
Usage: Usage:
@ccreate <new channel>[;alias;alias...] = description ccreate <new channel>[;alias;alias...] = description
Creates a new channel owned by you. Creates a new channel owned by you.
""" """
key = "@ccreate" key = "ccreate"
aliases = "channelcreate" aliases = "channelcreate"
locks = "cmd:not pperm(channel_banned) and pperm(Player)" locks = "cmd:not pperm(channel_banned) and pperm(Player)"
help_category = "Comms" help_category = "Comms"
@ -548,7 +548,7 @@ class CmdChannelCreate(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.args: if not self.args:
self.msg("Usage @ccreate <channelname>[;alias;alias..] = description") self.msg("Usage ccreate <channelname>[;alias;alias..] = description")
return return
description = "" description = ""
@ -581,15 +581,15 @@ class CmdClock(COMMAND_DEFAULT_CLASS):
change channel locks of a channel you control change channel locks of a channel you control
Usage: Usage:
@clock <channel> [= <lockstring>] clock <channel> [= <lockstring>]
Changes the lock access restrictions of a channel. If no Changes the lock access restrictions of a channel. If no
lockstring was given, view the current lock definitions. lockstring was given, view the current lock definitions.
""" """
key = "@clock" key = "clock"
locks = "cmd:not pperm(channel_banned)" locks = "cmd:not pperm(channel_banned)"
aliases = ["@clock"] aliases = ["clock"]
help_category = "Comms" help_category = "Comms"
# this is used by the COMMAND_DEFAULT_CLASS parent # this is used by the COMMAND_DEFAULT_CLASS parent
@ -599,7 +599,7 @@ class CmdClock(COMMAND_DEFAULT_CLASS):
"""run the function""" """run the function"""
if not self.args: if not self.args:
string = "Usage: @clock channel [= lockstring]" string = "Usage: clock channel [= lockstring]"
self.msg(string) self.msg(string)
return return
@ -634,13 +634,13 @@ class CmdCdesc(COMMAND_DEFAULT_CLASS):
describe a channel you control describe a channel you control
Usage: Usage:
@cdesc <channel> = <description> cdesc <channel> = <description>
Changes the description of the channel as shown in Changes the description of the channel as shown in
channel lists. channel lists.
""" """
key = "@cdesc" key = "cdesc"
locks = "cmd:not pperm(channel_banned)" locks = "cmd:not pperm(channel_banned)"
help_category = "Comms" help_category = "Comms"
@ -653,7 +653,7 @@ class CmdCdesc(COMMAND_DEFAULT_CLASS):
caller = self.caller caller = self.caller
if not self.rhs: if not self.rhs:
self.msg("Usage: @cdesc <channel> = <description>") self.msg("Usage: cdesc <channel> = <description>")
return return
channel = find_channel(caller, self.lhs) channel = find_channel(caller, self.lhs)
if not channel: if not channel:
@ -804,10 +804,12 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
self.msg("You paged %s with: '%s'." % (", ".join(received), message)) self.msg("You paged %s with: '%s'." % (", ".join(received), message))
def _list_bots(): def _list_bots(cmd):
""" """
Helper function to produce a list of all IRC bots. Helper function to produce a list of all IRC bots.
Args:
cmd (Command): Instance of the Bot command.
Returns: Returns:
bots (str): A table of bots or an error message. bots (str): A table of bots or an error message.
@ -815,8 +817,8 @@ def _list_bots():
ircbots = [bot for bot in AccountDB.objects.filter(db_is_bot=True, username__startswith="ircbot-")] ircbots = [bot for bot in AccountDB.objects.filter(db_is_bot=True, username__startswith="ircbot-")]
if ircbots: if ircbots:
from evennia.utils.evtable import EvTable from evennia.utils.evtable import EvTable
table = self.style_table("|w#dbref|n", "|wbotname|n", "|wev-channel|n", table = cmd.styled_table("|w#dbref|n", "|wbotname|n", "|wev-channel|n",
"|wirc-channel|n", "|wSSL|n", maxwidth=_DEFAULT_WIDTH) "|wirc-channel|n", "|wSSL|n", maxwidth=_DEFAULT_WIDTH)
for ircbot in ircbots: for ircbot in ircbots:
ircinfo = "%s (%s:%s)" % (ircbot.db.irc_channel, ircbot.db.irc_network, ircbot.db.irc_port) ircinfo = "%s (%s:%s)" % (ircbot.db.irc_channel, ircbot.db.irc_network, ircbot.db.irc_port)
table.add_row("#%i" % ircbot.id, ircbot.db.irc_botname, ircbot.db.ev_channel, ircinfo, ircbot.db.irc_ssl) table.add_row("#%i" % ircbot.id, ircbot.db.irc_botname, ircbot.db.ev_channel, ircinfo, ircbot.db.irc_ssl)
@ -830,8 +832,8 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
link an evennia channel to an external IRC channel link an evennia channel to an external IRC channel
Usage: Usage:
@irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>[:typeclass] irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>[:typeclass]
@irc2chan/delete botname|#dbid irc2chan/delete botname|#dbid
Switches: Switches:
/delete - this will delete the bot and remove the irc connection /delete - this will delete the bot and remove the irc connection
@ -842,8 +844,8 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
/ssl - use an SSL-encrypted connection /ssl - use an SSL-encrypted connection
Example: Example:
@irc2chan myircchan = irc.dalnet.net 6667 #mychannel evennia-bot irc2chan myircchan = irc.dalnet.net 6667 #mychannel evennia-bot
@irc2chan public = irc.freenode.net 6667 #evgaming #evbot:accounts.mybot.MyBot irc2chan public = irc.freenode.net 6667 #evgaming #evbot:accounts.mybot.MyBot
This creates an IRC bot that connects to a given IRC network and This creates an IRC bot that connects to a given IRC network and
channel. If a custom typeclass path is given, this will be used channel. If a custom typeclass path is given, this will be used
@ -852,11 +854,11 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
IRC channel and vice versa. The bot will automatically connect at IRC channel and vice versa. The bot will automatically connect at
server start, so this command need only be given once. The server start, so this command need only be given once. The
/disconnect switch will permanently delete the bot. To only /disconnect switch will permanently delete the bot. To only
temporarily deactivate it, use the |w@services|n command instead. temporarily deactivate it, use the |wservices|n command instead.
Provide an optional bot class path to use a custom bot. Provide an optional bot class path to use a custom bot.
""" """
key = "@irc2chan" key = "irc2chan"
switch_options = ("delete", "remove", "disconnect", "list", "ssl") switch_options = ("delete", "remove", "disconnect", "list", "ssl")
locks = "cmd:serversetting(IRC_ENABLED) and pperm(Developer)" locks = "cmd:serversetting(IRC_ENABLED) and pperm(Developer)"
help_category = "Comms" help_category = "Comms"
@ -871,7 +873,7 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
if 'list' in self.switches: if 'list' in self.switches:
# show all connections # show all connections
self.msg(_list_bots()) self.msg(_list_bots(self))
return return
if 'disconnect' in self.switches or 'remove' in self.switches or 'delete' in self.switches: if 'disconnect' in self.switches or 'remove' in self.switches or 'delete' in self.switches:
@ -889,7 +891,7 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
return return
if not self.args or not self.rhs: if not self.args or not self.rhs:
string = "Usage: @irc2chan[/switches] <evennia_channel> =" \ string = "Usage: irc2chan[/switches] <evennia_channel> =" \
" <ircnetwork> <port> <#irchannel> <botname>[:typeclass]" " <ircnetwork> <port> <#irchannel> <botname>[:typeclass]"
self.msg(string) self.msg(string)
return return
@ -941,7 +943,7 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
ircstatus [#dbref ping||nicklist||reconnect] ircstatus [#dbref ping||nicklist||reconnect]
If not given arguments, will return a list of all bots (like If not given arguments, will return a list of all bots (like
@irc2chan/list). The 'ping' argument will ping the IRC network to irc2chan/list). The 'ping' argument will ping the IRC network to
see if the connection is still responsive. The 'nicklist' argument see if the connection is still responsive. The 'nicklist' argument
(aliases are 'who' and 'users') will return a list of users on the (aliases are 'who' and 'users') will return a list of users on the
remote IRC channel. Finally, 'reconnect' will force the client to remote IRC channel. Finally, 'reconnect' will force the client to
@ -951,7 +953,7 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
messages sent to either channel will be lost. messages sent to either channel will be lost.
""" """
key = "@ircstatus" key = "ircstatus"
locks = "cmd:serversetting(IRC_ENABLED) and perm(ircstatus) or perm(Builder))" locks = "cmd:serversetting(IRC_ENABLED) and perm(ircstatus) or perm(Builder))"
help_category = "Comms" help_category = "Comms"
@ -959,12 +961,12 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
"""Handles the functioning of the command.""" """Handles the functioning of the command."""
if not self.args: if not self.args:
self.msg(_list_bots()) self.msg(_list_bots(self))
return return
# should always be on the form botname option # should always be on the form botname option
args = self.args.split() args = self.args.split()
if len(args) != 2: if len(args) != 2:
self.msg("Usage: @ircstatus [#dbref ping||nicklist||reconnect]") self.msg("Usage: ircstatus [#dbref ping||nicklist||reconnect]")
return return
botname, option = args botname, option = args
if option not in ("ping", "users", "reconnect", "nicklist", "who"): if option not in ("ping", "users", "reconnect", "nicklist", "who"):
@ -974,7 +976,7 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
if utils.dbref(botname): if utils.dbref(botname):
matches = AccountDB.objects.filter(db_is_bot=True, id=utils.dbref(botname)) matches = AccountDB.objects.filter(db_is_bot=True, id=utils.dbref(botname))
if not matches: if not matches:
self.msg("No matching IRC-bot found. Use @ircstatus without arguments to list active bots.") self.msg("No matching IRC-bot found. Use ircstatus without arguments to list active bots.")
return return
ircbot = matches[0] ircbot = matches[0]
channel = ircbot.db.irc_channel channel = ircbot.db.irc_channel
@ -1004,7 +1006,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
link an evennia channel to an external RSS feed link an evennia channel to an external RSS feed
Usage: Usage:
@rss2chan[/switches] <evennia_channel> = <rss_url> rss2chan[/switches] <evennia_channel> = <rss_url>
Switches: Switches:
/disconnect - this will stop the feed and remove the connection to the /disconnect - this will stop the feed and remove the connection to the
@ -1013,7 +1015,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
/list - show all rss->evennia mappings /list - show all rss->evennia mappings
Example: Example:
@rss2chan rsschan = http://code.google.com/feeds/p/evennia/updates/basic rss2chan rsschan = http://code.google.com/feeds/p/evennia/updates/basic
This creates an RSS reader that connects to a given RSS feed url. Updates This creates an RSS reader that connects to a given RSS feed url. Updates
will be echoed as a title and news link to the given channel. The rate of will be echoed as a title and news link to the given channel. The rate of
@ -1024,7 +1026,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
to identify the connection uniquely. to identify the connection uniquely.
""" """
key = "@rss2chan" key = "rss2chan"
switch_options = ("disconnect", "remove", "list") switch_options = ("disconnect", "remove", "list")
locks = "cmd:serversetting(RSS_ENABLED) and pperm(Developer)" locks = "cmd:serversetting(RSS_ENABLED) and pperm(Developer)"
help_category = "Comms" help_category = "Comms"
@ -1051,8 +1053,8 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
rssbots = [bot for bot in AccountDB.objects.filter(db_is_bot=True, username__startswith="rssbot-")] rssbots = [bot for bot in AccountDB.objects.filter(db_is_bot=True, username__startswith="rssbot-")]
if rssbots: if rssbots:
from evennia.utils.evtable import EvTable from evennia.utils.evtable import EvTable
table = self.style_table("|wdbid|n", "|wupdate rate|n", "|wev-channel", table = self.styled_table("|wdbid|n", "|wupdate rate|n", "|wev-channel",
"|wRSS feed URL|n", border="cells", maxwidth=_DEFAULT_WIDTH) "|wRSS feed URL|n", border="cells", maxwidth=_DEFAULT_WIDTH)
for rssbot in rssbots: for rssbot in rssbots:
table.add_row(rssbot.id, rssbot.db.rss_rate, rssbot.db.ev_channel, rssbot.db.rss_url) table.add_row(rssbot.id, rssbot.db.rss_rate, rssbot.db.ev_channel, rssbot.db.rss_url)
self.msg(table) self.msg(table)
@ -1074,7 +1076,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
return return
if not self.args or not self.rhs: if not self.args or not self.rhs:
string = "Usage: @rss2chan[/switches] <evennia_channel> = <rss url>" string = "Usage: rss2chan[/switches] <evennia_channel> = <rss url>"
self.msg(string) self.msg(string)
return return
channel = self.lhs channel = self.lhs

View file

@ -96,10 +96,10 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
Examples: Examples:
nick hi = say Hello, I'm Sarah! nick hi = say Hello, I'm Sarah!
nick/object tom = the tall man nick/object tom = the tall man
nick build $1 $2 = @create/drop $1;$2 nick build $1 $2 = create/drop $1;$2
nick tell $1 $2=@page $1=$2 nick tell $1 $2=page $1=$2
nick tm?$1=@page tallman=$1 nick tm?$1=page tallman=$1
nick tm\=$1=@page tallman=$1 nick tm\=$1=page tallman=$1
A 'nick' is a personal string replacement. Use $1, $2, ... to catch arguments. A 'nick' is a personal string replacement. Use $1, $2, ... to catch arguments.
Put the last $-marker without an ending space to catch all remaining text. You Put the last $-marker without an ending space to catch all remaining text. You
@ -113,7 +113,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
Note that no objects are actually renamed or changed by this command - your nicks Note that no objects are actually renamed or changed by this command - your nicks
are only available to you. If you want to permanently add keywords to an object are only available to you. If you want to permanently add keywords to an object
for everyone to use, you need build privileges and the @alias command. for everyone to use, you need build privileges and the alias command.
""" """
key = "nick" key = "nick"
@ -152,12 +152,12 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
utils.make_iter(caller.nicks.get(category="object", return_obj=True) or []) + utils.make_iter(caller.nicks.get(category="object", return_obj=True) or []) +
utils.make_iter(caller.nicks.get(category="account", return_obj=True) or [])) utils.make_iter(caller.nicks.get(category="account", return_obj=True) or []))
if 'list' in switches or self.cmdstring in ("nicks", "@nicks"): if 'list' in switches or self.cmdstring in ("nicks",):
if not nicklist: if not nicklist:
string = "|wNo nicks defined.|n" string = "|wNo nicks defined.|n"
else: else:
table = self.style_table("#", "Type", "Nick match", "Replacement") table = self.styled_table("#", "Type", "Nick match", "Replacement")
for inum, nickobj in enumerate(nicklist): for inum, nickobj in enumerate(nicklist):
_, _, nickvalue, replacement = nickobj.value _, _, nickvalue, replacement = nickobj.value
table.add_row(str(inum + 1), nickobj.db_category, _cy(nickvalue), _cy(replacement)) table.add_row(str(inum + 1), nickobj.db_category, _cy(nickvalue), _cy(replacement))
@ -338,7 +338,7 @@ class CmdInventory(COMMAND_DEFAULT_CLASS):
if not items: if not items:
string = "You are not carrying anything." string = "You are not carrying anything."
else: else:
table = self.style_table(border="header") table = self.styled_table(border="header")
for item in items: for item in items:
table.add_row("|C%s|n" % item.name, item.db.desc or "") table.add_row("|C%s|n" % item.name, item.db.desc or "")
string = "|wYou are carrying:\n%s" % table string = "|wYou are carrying:\n%s" % table

View file

@ -295,7 +295,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
Edit the help database. Edit the help database.
Usage: Usage:
@help[/switches] <topic>[[;alias;alias][,category[,locks]] [= <text>] help[/switches] <topic>[[;alias;alias][,category[,locks]] [= <text>]
Switches: Switches:
edit - open a line editor to edit the topic's help text. edit - open a line editor to edit the topic's help text.
@ -305,10 +305,10 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
delete - remove help topic. delete - remove help topic.
Examples: Examples:
@sethelp throw = This throws something at ... sethelp throw = This throws something at ...
@sethelp/append pickpocketing,Thievery = This steals ... sethelp/append pickpocketing,Thievery = This steals ...
@sethelp/replace pickpocketing, ,attr(is_thief) = This steals ... sethelp/replace pickpocketing, ,attr(is_thief) = This steals ...
@sethelp/edit thievery sethelp/edit thievery
This command manipulates the help database. A help entry can be created, This command manipulates the help database. A help entry can be created,
appended/merged to and deleted. If you don't assign a category, the appended/merged to and deleted. If you don't assign a category, the
@ -316,7 +316,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
is to let everyone read the help file. is to let everyone read the help file.
""" """
key = "@sethelp" key = "sethelp"
switch_options = ("edit", "replace", "append", "extend", "delete") switch_options = ("edit", "replace", "append", "extend", "delete")
locks = "cmd:perm(Helper)" locks = "cmd:perm(Helper)"
help_category = "Building" help_category = "Building"
@ -328,7 +328,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
lhslist = self.lhslist lhslist = self.lhslist
if not self.args: if not self.args:
self.msg("Usage: @sethelp[/switches] <topic>[;alias;alias][,category[,locks,..] = <text>") self.msg("Usage: sethelp[/switches] <topic>[;alias;alias][,category[,locks,..] = <text>")
return return
nlist = len(lhslist) nlist = len(lhslist)

View file

@ -41,14 +41,14 @@ class CmdReload(COMMAND_DEFAULT_CLASS):
reload the server reload the server
Usage: Usage:
@reload [reason] reload [reason]
This restarts the server. The Portal is not This restarts the server. The Portal is not
affected. Non-persistent scripts will survive a @reload (use affected. Non-persistent scripts will survive a reload (use
@reset to purge) and at_reload() hooks will be called. reset to purge) and at_reload() hooks will be called.
""" """
key = "@reload" key = "reload"
aliases = ['@restart'] aliases = ['restart']
locks = "cmd:perm(reload) or perm(Developer)" locks = "cmd:perm(reload) or perm(Developer)"
help_category = "System" help_category = "System"
@ -68,23 +68,23 @@ class CmdReset(COMMAND_DEFAULT_CLASS):
reset and reboot the server reset and reboot the server
Usage: Usage:
@reset reset
Notes: Notes:
For normal updating you are recommended to use @reload rather For normal updating you are recommended to use reload rather
than this command. Use @shutdown for a complete stop of than this command. Use shutdown for a complete stop of
everything. everything.
This emulates a cold reboot of the Server component of Evennia. This emulates a cold reboot of the Server component of Evennia.
The difference to @shutdown is that the Server will auto-reboot The difference to shutdown is that the Server will auto-reboot
and that it does not affect the Portal, so no users will be and that it does not affect the Portal, so no users will be
disconnected. Contrary to @reload however, all shutdown hooks will disconnected. Contrary to reload however, all shutdown hooks will
be called and any non-database saved scripts, ndb-attributes, be called and any non-database saved scripts, ndb-attributes,
cmdsets etc will be wiped. cmdsets etc will be wiped.
""" """
key = "@reset" key = "reset"
aliases = ['@reboot'] aliases = ['reboot']
locks = "cmd:perm(reload) or perm(Developer)" locks = "cmd:perm(reload) or perm(Developer)"
help_category = "System" help_category = "System"
@ -102,11 +102,11 @@ class CmdShutdown(COMMAND_DEFAULT_CLASS):
stop the server completely stop the server completely
Usage: Usage:
@shutdown [announcement] shutdown [announcement]
Gracefully shut down both Server and Portal. Gracefully shut down both Server and Portal.
""" """
key = "@shutdown" key = "shutdown"
locks = "cmd:perm(shutdown) or perm(Developer)" locks = "cmd:perm(shutdown) or perm(Developer)"
help_category = "System" help_category = "System"
@ -226,8 +226,8 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
execute a snippet of python code execute a snippet of python code
Usage: Usage:
@py <cmd> py <cmd>
@py/edit py/edit
Switches: Switches:
time - output an approximate execution time for <cmd> time - output an approximate execution time for <cmd>
@ -241,7 +241,7 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
in order to offer access to the system (you can import more at in order to offer access to the system (you can import more at
execution time). execution time).
Available variables in @py environment: Available variables in py environment:
self, me : caller self, me : caller
here : caller.location here : caller.location
ev : the evennia API ev : the evennia API
@ -249,14 +249,14 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
You can explore The evennia API from inside the game by calling You can explore The evennia API from inside the game by calling
the `__doc__` property on entities: the `__doc__` property on entities:
@py evennia.__doc__ py evennia.__doc__
@py evennia.managers.__doc__ py evennia.managers.__doc__
|rNote: In the wrong hands this command is a severe security risk. |rNote: In the wrong hands this command is a severe security risk.
It should only be accessible by trusted server admins/superusers.|n It should only be accessible by trusted server admins/superusers.|n
""" """
key = "@py" key = "py"
aliases = ["!"] aliases = ["!"]
switch_options = ("time", "edit", "clientraw") switch_options = ("time", "edit", "clientraw")
locks = "cmd:perm(py) or perm(Developer)" locks = "cmd:perm(py) or perm(Developer)"
@ -277,7 +277,7 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
return return
if not pycode: if not pycode:
string = "Usage: @py <code>" string = "Usage: py <code>"
self.msg(string) self.msg(string)
return return
@ -326,7 +326,7 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
list and manage all running scripts list and manage all running scripts
Usage: Usage:
@scripts[/switches] [#dbref, key, script.path or <obj>] scripts[/switches] [#dbref, key, script.path or <obj>]
Switches: Switches:
start - start a script (must supply a script path) start - start a script (must supply a script path)
@ -340,10 +340,10 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
or #dbref. For using the /stop switch, a unique script #dbref is or #dbref. For using the /stop switch, a unique script #dbref is
required since whole classes of scripts often have the same name. required since whole classes of scripts often have the same name.
Use @script for managing commands on objects. Use script for managing commands on objects.
""" """
key = "@scripts" key = "scripts"
aliases = ["@globalscript", "@listscripts"] aliases = ["globalscript", "listscripts"]
switch_options = ("start", "stop", "kill", "validate") switch_options = ("start", "stop", "kill", "validate")
locks = "cmd:perm(listscripts) or perm(Admin)" locks = "cmd:perm(listscripts) or perm(Admin)"
help_category = "System" help_category = "System"
@ -419,14 +419,14 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
statistics on objects in the database statistics on objects in the database
Usage: Usage:
@objects [<nr>] objects [<nr>]
Gives statictics on objects in database as well as Gives statictics on objects in database as well as
a list of <nr> latest objects in database. If not a list of <nr> latest objects in database. If not
given, <nr> defaults to 10. given, <nr> defaults to 10.
""" """
key = "@objects" key = "objects"
aliases = ["@listobjects", "@listobjs", '@stats', '@db'] aliases = ["listobjects", "listobjs", 'stats', 'db']
locks = "cmd:perm(listobjects) or perm(Builder)" locks = "cmd:perm(listobjects) or perm(Builder)"
help_category = "System" help_category = "System"
@ -446,7 +446,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
nobjs = nobjs or 1 # fix zero-div error with empty database nobjs = nobjs or 1 # fix zero-div error with empty database
# total object sum table # total object sum table
totaltable = self.style_table("|wtype|n", "|wcomment|n", "|wcount|n", "|w%|n", totaltable = self.styled_table("|wtype|n", "|wcomment|n", "|wcount|n", "|w%|n",
border="table", align="l") border="table", align="l")
totaltable.align = 'l' totaltable.align = 'l'
totaltable.add_row("Characters", "(BASE_CHARACTER_TYPECLASS + children)", totaltable.add_row("Characters", "(BASE_CHARACTER_TYPECLASS + children)",
@ -458,7 +458,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
totaltable.add_row("Other", "", nother, "%.2f" % ((float(nother) / nobjs) * 100)) totaltable.add_row("Other", "", nother, "%.2f" % ((float(nother) / nobjs) * 100))
# typeclass table # typeclass table
typetable = self.style_table("|wtypeclass|n", "|wcount|n", "|w%|n", typetable = self.styled_table("|wtypeclass|n", "|wcount|n", "|w%|n",
border="table", align="l") border="table", align="l")
typetable.align = 'l' typetable.align = 'l'
dbtotals = ObjectDB.objects.object_totals() dbtotals = ObjectDB.objects.object_totals()
@ -467,7 +467,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
# last N table # last N table
objs = ObjectDB.objects.all().order_by("db_date_created")[max(0, nobjs - nlim):] objs = ObjectDB.objects.all().order_by("db_date_created")[max(0, nobjs - nlim):]
latesttable = self.style_table("|wcreated|n", "|wdbref|n", "|wname|n", latesttable = self.styled_table("|wcreated|n", "|wdbref|n", "|wname|n",
"|wtypeclass|n", align="l", border="table") "|wtypeclass|n", align="l", border="table")
latesttable.align = 'l' latesttable.align = 'l'
for obj in objs: for obj in objs:
@ -485,8 +485,8 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
Manage registered accounts Manage registered accounts
Usage: Usage:
@accounts [nr] accounts [nr]
@accounts/delete <name or #id> [: reason] accounts/delete <name or #id> [: reason]
Switches: Switches:
delete - delete an account from the server delete - delete an account from the server
@ -495,8 +495,8 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
It will list the <nr> amount of latest registered accounts It will list the <nr> amount of latest registered accounts
If not given, <nr> defaults to 10. If not given, <nr> defaults to 10.
""" """
key = "@accounts" key = "accounts"
aliases = ["@account", "@listaccounts"] aliases = ["account", "listaccounts"]
switch_options = ("delete", ) switch_options = ("delete", )
locks = "cmd:perm(listaccounts) or perm(Admin)" locks = "cmd:perm(listaccounts) or perm(Admin)"
help_category = "System" help_category = "System"
@ -513,7 +513,7 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
caller.msg("You are not allowed to delete accounts.") caller.msg("You are not allowed to delete accounts.")
return return
if not args: if not args:
caller.msg("Usage: @accounts/delete <name or #id> [: reason]") caller.msg("Usage: accounts/delete <name or #id> [: reason]")
return return
reason = "" reason = ""
if ":" in args: if ":" in args:
@ -564,12 +564,12 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
# typeclass table # typeclass table
dbtotals = AccountDB.objects.object_totals() dbtotals = AccountDB.objects.object_totals()
typetable = self.style_table("|wtypeclass|n", "|wcount|n", "|w%%|n", border="cells", align="l") typetable = self.styled_table("|wtypeclass|n", "|wcount|n", "|w%%|n", border="cells", align="l")
for path, count in dbtotals.items(): for path, count in dbtotals.items():
typetable.add_row(path, count, "%.2f" % ((float(count) / naccounts) * 100)) typetable.add_row(path, count, "%.2f" % ((float(count) / naccounts) * 100))
# last N table # last N table
plyrs = AccountDB.objects.all().order_by("db_date_created")[max(0, naccounts - nlim):] plyrs = AccountDB.objects.all().order_by("db_date_created")[max(0, naccounts - nlim):]
latesttable = self.style_table("|wcreated|n", "|wdbref|n", "|wname|n", "|wtypeclass|n", border="cells", align="l") latesttable = self.styled_table("|wcreated|n", "|wdbref|n", "|wname|n", "|wtypeclass|n", border="cells", align="l")
for ply in plyrs: for ply in plyrs:
latesttable.add_row(utils.datetime_format(ply.date_created), ply.dbref, ply.key, ply.path) latesttable.add_row(utils.datetime_format(ply.date_created), ply.dbref, ply.key, ply.path)
@ -583,7 +583,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
manage system services manage system services
Usage: Usage:
@service[/switch] <service> service[/switch] <service>
Switches: Switches:
list - shows all available services (default) list - shows all available services (default)
@ -598,8 +598,8 @@ class CmdService(COMMAND_DEFAULT_CLASS):
in the list. in the list.
""" """
key = "@service" key = "service"
aliases = ["@services"] aliases = ["services"]
switch_options = ("list", "start", "stop", "delete") switch_options = ("list", "start", "stop", "delete")
locks = "cmd:perm(service) or perm(Developer)" locks = "cmd:perm(service) or perm(Developer)"
help_category = "System" help_category = "System"
@ -611,7 +611,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
switches = self.switches switches = self.switches
if switches and switches[0] not in ("list", "start", "stop", "delete"): if switches and switches[0] not in ("list", "start", "stop", "delete"):
caller.msg("Usage: @service/<list|start|stop|delete> [servicename]") caller.msg("Usage: service/<list|start|stop|delete> [servicename]")
return return
# get all services # get all services
@ -620,7 +620,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
if not switches or switches[0] == "list": if not switches or switches[0] == "list":
# Just display the list of installed services and their # Just display the list of installed services and their
# status, then exit. # status, then exit.
table = self.style_table("|wService|n (use @services/start|stop|delete)", "|wstatus", align="l") table = self.styled_table("|wService|n (use services/start|stop|delete)", "|wstatus", align="l")
for service in service_collection.services: for service in service_collection.services:
table.add_row(service.name, service.running and "|gRunning" or "|rNot Running") table.add_row(service.name, service.running and "|gRunning" or "|rNot Running")
caller.msg(str(table)) caller.msg(str(table))
@ -632,7 +632,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
service = service_collection.getServiceNamed(self.args) service = service_collection.getServiceNamed(self.args)
except Exception: except Exception:
string = 'Invalid service name. This command is case-sensitive. ' string = 'Invalid service name. This command is case-sensitive. '
string += 'See @service/list for valid service name (enter the full name exactly).' string += 'See service/list for valid service name (enter the full name exactly).'
caller.msg(string) caller.msg(string)
return return
@ -677,13 +677,13 @@ class CmdAbout(COMMAND_DEFAULT_CLASS):
show Evennia info show Evennia info
Usage: Usage:
@about about
Display info about the game engine. Display info about the game engine.
""" """
key = "@about" key = "about"
aliases = "@version" aliases = "version"
locks = "cmd:all()" locks = "cmd:all()"
help_category = "System" help_category = "System"
@ -718,26 +718,26 @@ class CmdTime(COMMAND_DEFAULT_CLASS):
show server time statistics show server time statistics
Usage: Usage:
@time time
List Server time statistics such as uptime List Server time statistics such as uptime
and the current time stamp. and the current time stamp.
""" """
key = "@time" key = "time"
aliases = "@uptime" aliases = "uptime"
locks = "cmd:perm(time) or perm(Player)" locks = "cmd:perm(time) or perm(Player)"
help_category = "System" help_category = "System"
def func(self): def func(self):
"""Show server time data in a table.""" """Show server time data in a table."""
table1 = self.style_table("|wServer time", "", align="l", width=78) table1 = self.styled_table("|wServer time", "", align="l", width=78)
table1.add_row("Current uptime", utils.time_format(gametime.uptime(), 3)) table1.add_row("Current uptime", utils.time_format(gametime.uptime(), 3))
table1.add_row("Portal uptime", utils.time_format(gametime.portal_uptime(), 3)) table1.add_row("Portal uptime", utils.time_format(gametime.portal_uptime(), 3))
table1.add_row("Total runtime", utils.time_format(gametime.runtime(), 2)) table1.add_row("Total runtime", utils.time_format(gametime.runtime(), 2))
table1.add_row("First start", datetime.datetime.fromtimestamp(gametime.server_epoch())) table1.add_row("First start", datetime.datetime.fromtimestamp(gametime.server_epoch()))
table1.add_row("Current time", datetime.datetime.now()) table1.add_row("Current time", datetime.datetime.now())
table1.reformat_column(0, width=30) table1.reformat_column(0, width=30)
table2 = self.style_table("|wIn-Game time", "|wReal time x %g" % gametime.TIMEFACTOR, align="l", width=77, border_top=0) table2 = self.styled_table("|wIn-Game time", "|wReal time x %g" % gametime.TIMEFACTOR, align="l", width=77, border_top=0)
epochtxt = "Epoch (%s)" % ("from settings" if settings.TIME_GAME_EPOCH else "server start") epochtxt = "Epoch (%s)" % ("from settings" if settings.TIME_GAME_EPOCH else "server start")
table2.add_row(epochtxt, datetime.datetime.fromtimestamp(gametime.game_epoch())) table2.add_row(epochtxt, datetime.datetime.fromtimestamp(gametime.game_epoch()))
table2.add_row("Total time passed:", utils.time_format(gametime.gametime(), 2)) table2.add_row("Total time passed:", utils.time_format(gametime.gametime(), 2))
@ -751,7 +751,7 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
show server load and memory statistics show server load and memory statistics
Usage: Usage:
@server[/mem] server[/mem]
Switches: Switches:
mem - return only a string of the current memory usage mem - return only a string of the current memory usage
@ -782,8 +782,8 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
the released memory will instead be re-used by the program. the released memory will instead be re-used by the program.
""" """
key = "@server" key = "server"
aliases = ["@serverload", "@serverprocess"] aliases = ["serverload", "serverprocess"]
switch_options = ("mem", "flushmem") switch_options = ("mem", "flushmem")
locks = "cmd:perm(list) or perm(Developer)" locks = "cmd:perm(list) or perm(Developer)"
help_category = "System" help_category = "System"
@ -831,7 +831,7 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
self.caller.msg(string % (rmem, pmem)) self.caller.msg(string % (rmem, pmem))
return return
# Display table # Display table
loadtable = self.style_table("property", "statistic", align="l") loadtable = self.styled_table("property", "statistic", align="l")
loadtable.add_row("Total CPU load", "%g %%" % loadavg) loadtable.add_row("Total CPU load", "%g %%" % loadavg)
loadtable.add_row("Total computer memory usage", "%g MB (%g%%)" % (rmem, pmem)) loadtable.add_row("Total computer memory usage", "%g MB (%g%%)" % (rmem, pmem))
loadtable.add_row("Process ID", "%g" % pid), loadtable.add_row("Process ID", "%g" % pid),
@ -857,7 +857,7 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
self.caller.msg(string % (rmem, pmem, vmem)) self.caller.msg(string % (rmem, pmem, vmem))
return return
loadtable = self.style_table("property", "statistic", align="l") loadtable = self.styled_table("property", "statistic", align="l")
loadtable.add_row("Server load (1 min)", "%g" % loadavg) loadtable.add_row("Server load (1 min)", "%g" % loadavg)
loadtable.add_row("Process ID", "%g" % pid), loadtable.add_row("Process ID", "%g" % pid),
loadtable.add_row("Memory usage", "%g MB (%g%%)" % (rmem, pmem)) loadtable.add_row("Memory usage", "%g MB (%g%%)" % (rmem, pmem))
@ -882,7 +882,7 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
total_num, cachedict = _IDMAPPER.cache_size() total_num, cachedict = _IDMAPPER.cache_size()
sorted_cache = sorted([(key, num) for key, num in cachedict.items() if num > 0], sorted_cache = sorted([(key, num) for key, num in cachedict.items() if num > 0],
key=lambda tup: tup[1], reverse=True) key=lambda tup: tup[1], reverse=True)
memtable = self.style_table("entity name", "number", "idmapper %", align="l") memtable = self.styled_table("entity name", "number", "idmapper %", align="l")
for tup in sorted_cache: for tup in sorted_cache:
memtable.add_row(tup[0], "%i" % tup[1], "%.2f" % (float(tup[1]) / total_num * 100)) memtable.add_row(tup[0], "%i" % tup[1], "%.2f" % (float(tup[1]) / total_num * 100))
@ -897,14 +897,14 @@ class CmdTickers(COMMAND_DEFAULT_CLASS):
View running tickers View running tickers
Usage: Usage:
@tickers tickers
Note: Tickers are created, stopped and manipulated in Python code Note: Tickers are created, stopped and manipulated in Python code
using the TickerHandler. This is merely a convenience function for using the TickerHandler. This is merely a convenience function for
inspecting the current status. inspecting the current status.
""" """
key = "@tickers" key = "tickers"
help_category = "System" help_category = "System"
locks = "cmd:perm(tickers) or perm(Builder)" locks = "cmd:perm(tickers) or perm(Builder)"
@ -914,7 +914,7 @@ class CmdTickers(COMMAND_DEFAULT_CLASS):
if not all_subs: if not all_subs:
self.caller.msg("No tickers are currently active.") self.caller.msg("No tickers are currently active.")
return return
table = self.style_table("interval (s)", "object", "path/methodname", "idstring", "db") table = self.styled_table("interval (s)", "object", "path/methodname", "idstring", "db")
for sub in all_subs: for sub in all_subs:
table.add_row(sub[3], table.add_row(sub[3],
"%s%s" % (sub[0] or "[None]", "%s%s" % (sub[0] or "[None]",

View file

@ -290,7 +290,7 @@ class TestAccount(CommandTest):
def test_char_create(self): def test_char_create(self):
self.call(account.CmdCharCreate(), "Test1=Test char", self.call(account.CmdCharCreate(), "Test1=Test char",
"Created new character Test1. Use @ic Test1 to enter the game", caller=self.account) "Created new character Test1. Use ic Test1 to enter the game", caller=self.account)
def test_char_delete(self): def test_char_delete(self):
# Chardelete requires user input; this test is mainly to confirm # Chardelete requires user input; this test is mainly to confirm
@ -382,7 +382,7 @@ class TestBuilding(CommandTest):
self.call(building.CmdSetAttribute(), "Obj2/test3 = ", "Deleted attribute 'test3' (= True) from Obj2.") self.call(building.CmdSetAttribute(), "Obj2/test3 = ", "Deleted attribute 'test3' (= True) from Obj2.")
self.call(building.CmdCpAttr(), "/copy Obj2/test2 = Obj2/test3", self.call(building.CmdCpAttr(), "/copy Obj2/test2 = Obj2/test3",
"@cpattr: Extra switch \"/copy\" ignored.|\nCopied Obj2.test2 -> Obj2.test3. " "cpattr: Extra switch \"/copy\" ignored.|\nCopied Obj2.test2 -> Obj2.test3. "
"(value: 'value2')") "(value: 'value2')")
self.call(building.CmdMvAttr(), "", "Usage: ") self.call(building.CmdMvAttr(), "", "Usage: ")
self.call(building.CmdMvAttr(), "Obj2/test2 = Obj/test3", "Moved Obj2.test2 -> Obj.test3") self.call(building.CmdMvAttr(), "Obj2/test2 = Obj/test3", "Moved Obj2.test2 -> Obj.test3")
@ -473,7 +473,7 @@ class TestBuilding(CommandTest):
def test_tunnel(self): def test_tunnel(self):
self.call(building.CmdTunnel(), "n = TestRoom2;test2", "Created room TestRoom2") self.call(building.CmdTunnel(), "n = TestRoom2;test2", "Created room TestRoom2")
self.call(building.CmdTunnel(), "", "Usage: ") self.call(building.CmdTunnel(), "", "Usage: ")
self.call(building.CmdTunnel(), "foo = TestRoom2;test2", "@tunnel can only understand the") self.call(building.CmdTunnel(), "foo = TestRoom2;test2", "tunnel can only understand the")
self.call(building.CmdTunnel(), "/tel e = TestRoom3;test3", "Created room TestRoom3") self.call(building.CmdTunnel(), "/tel e = TestRoom3;test3", "Created room TestRoom3")
DefaultRoom.objects.get_family(db_key="TestRoom3") DefaultRoom.objects.get_family(db_key="TestRoom3")
exits = DefaultExit.objects.filter_family(db_key__in=("east", "west")) exits = DefaultExit.objects.filter_family(db_key__in=("east", "west"))
@ -529,7 +529,7 @@ class TestBuilding(CommandTest):
"to evennia.objects.objects.DefaultExit.") "to evennia.objects.objects.DefaultExit.")
self.call(building.CmdTypeclass(), "Obj2 = evennia.objects.objects.DefaultExit", self.call(building.CmdTypeclass(), "Obj2 = evennia.objects.objects.DefaultExit",
"Obj2 changed typeclass from evennia.objects.objects.DefaultObject " "Obj2 changed typeclass from evennia.objects.objects.DefaultObject "
"to evennia.objects.objects.DefaultExit.", cmdstring="@swap") "to evennia.objects.objects.DefaultExit.", cmdstring="swap")
self.call(building.CmdTypeclass(), "/list Obj", "Core typeclasses") self.call(building.CmdTypeclass(), "/list Obj", "Core typeclasses")
self.call(building.CmdTypeclass(), "/show Obj", "Obj's current typeclass is 'evennia.objects.objects.DefaultExit'") self.call(building.CmdTypeclass(), "/show Obj", "Obj's current typeclass is 'evennia.objects.objects.DefaultExit'")
self.call(building.CmdTypeclass(), "Obj = evennia.objects.objects.DefaultExit", self.call(building.CmdTypeclass(), "Obj = evennia.objects.objects.DefaultExit",
@ -541,7 +541,7 @@ class TestBuilding(CommandTest):
self.call(building.CmdTypeclass(), "Obj", self.call(building.CmdTypeclass(), "Obj",
"Obj updated its existing typeclass (evennia.objects.objects.DefaultObject).\n" "Obj updated its existing typeclass (evennia.objects.objects.DefaultObject).\n"
"Only the at_object_creation hook was run (update mode). Attributes set before swap were not removed.", "Only the at_object_creation hook was run (update mode). Attributes set before swap were not removed.",
cmdstring="@update") cmdstring="update")
self.call(building.CmdTypeclass(), "/reset/force Obj=evennia.objects.objects.DefaultObject", self.call(building.CmdTypeclass(), "/reset/force Obj=evennia.objects.objects.DefaultObject",
"Obj updated its existing typeclass (evennia.objects.objects.DefaultObject).\n" "Obj updated its existing typeclass (evennia.objects.objects.DefaultObject).\n"
"All object creation hooks were run. All old attributes where deleted before the swap.") "All object creation hooks were run. All old attributes where deleted before the swap.")
@ -554,7 +554,7 @@ class TestBuilding(CommandTest):
self.call(building.CmdLock(), "Obj/test", "test:all()") self.call(building.CmdLock(), "Obj/test", "test:all()")
self.call(building.CmdLock(), "/view Obj = edit:false()", self.call(building.CmdLock(), "/view Obj = edit:false()",
"Switch(es) view can not be used with a lock assignment. " "Switch(es) view can not be used with a lock assignment. "
"Use e.g. @lock/del objname/locktype instead.") "Use e.g. lock/del objname/locktype instead.")
self.call(building.CmdLock(), "Obj = control:false()") self.call(building.CmdLock(), "Obj = control:false()")
self.call(building.CmdLock(), "Obj = edit:false()") self.call(building.CmdLock(), "Obj = edit:false()")
self.call(building.CmdLock(), "Obj/test", "You are not allowed to do that.") self.call(building.CmdLock(), "Obj/test", "You are not allowed to do that.")
@ -573,9 +573,9 @@ class TestBuilding(CommandTest):
self.call(building.CmdFind(), "/ex Char2", # /ex is an ambiguous switch self.call(building.CmdFind(), "/ex Char2", # /ex is an ambiguous switch
"locate: Ambiguous switch supplied: Did you mean /exit or /exact?|", "locate: Ambiguous switch supplied: Did you mean /exit or /exact?|",
cmdstring="locate") cmdstring="locate")
self.call(building.CmdFind(), "Char2", "One Match", cmdstring="@locate") self.call(building.CmdFind(), "Char2", "One Match", cmdstring="locate")
self.call(building.CmdFind(), "/l Char2", "One Match", cmdstring="find") # /l switch is abbreviated form of /loc self.call(building.CmdFind(), "/l Char2", "One Match", cmdstring="find") # /l switch is abbreviated form of /loc
self.call(building.CmdFind(), "Char2", "One Match", cmdstring="@find") self.call(building.CmdFind(), "Char2", "One Match", cmdstring="find")
self.call(building.CmdFind(), "/startswith Room2", "One Match") self.call(building.CmdFind(), "/startswith Room2", "One Match")
self.call(building.CmdFind(), self.char1.dbref, "Exact dbref match") self.call(building.CmdFind(), self.char1.dbref, "Exact dbref match")
@ -590,7 +590,7 @@ class TestBuilding(CommandTest):
self.call(building.CmdScript(), "Obj = ", "No scripts defined on Obj") self.call(building.CmdScript(), "Obj = ", "No scripts defined on Obj")
self.call(building.CmdScript(), "Obj = scripts.Script", "Script scripts.Script successfully added") self.call(building.CmdScript(), "Obj = scripts.Script", "Script scripts.Script successfully added")
self.call(building.CmdScript(), "", "Usage: ") self.call(building.CmdScript(), "", "Usage: ")
self.call(building.CmdScript(), "= Obj", "To create a global script you need @scripts/add <typeclass>.") self.call(building.CmdScript(), "= Obj", "To create a global script you need scripts/add <typeclass>.")
self.call(building.CmdScript(), "Obj = ", "dbref obj") self.call(building.CmdScript(), "Obj = ", "dbref obj")
self.call(building.CmdScript(), "/start Obj", "0 scripts started on Obj") # because it's already started self.call(building.CmdScript(), "/start Obj", "0 scripts started on Obj") # because it's already started
@ -655,10 +655,10 @@ class TestBuilding(CommandTest):
commandTest.assertIsNotNone(obj) commandTest.assertIsNotNone(obj)
return obj return obj
# Tests "@spawn" without any arguments. # Tests "spawn" without any arguments.
self.call(building.CmdSpawn(), " ", "Usage: @spawn") self.call(building.CmdSpawn(), " ", "Usage: spawn")
# Tests "@spawn <prototype_dictionary>" without specifying location. # Tests "spawn <prototype_dictionary>" without specifying location.
self.call(building.CmdSpawn(), self.call(building.CmdSpawn(),
"/save {'prototype_key': 'testprot', 'key':'Test Char', " "/save {'prototype_key': 'testprot', 'key':'Test Char', "
@ -682,7 +682,7 @@ class TestBuilding(CommandTest):
self.assertEqual(testchar.location, self.char1.location) self.assertEqual(testchar.location, self.char1.location)
testchar.delete() testchar.delete()
# Test "@spawn <prototype_dictionary>" with a location other than the character's. # Test "spawn <prototype_dictionary>" with a location other than the character's.
spawnLoc = self.room2 spawnLoc = self.room2
if spawnLoc == self.char1.location: if spawnLoc == self.char1.location:
# Just to make sure we use a different location, in case someone changes # Just to make sure we use a different location, in case someone changes
@ -704,7 +704,7 @@ class TestBuilding(CommandTest):
'typeclass': 'evennia.objects.objects.DefaultCharacter', 'typeclass': 'evennia.objects.objects.DefaultCharacter',
'prototype_key': 'testball'}) 'prototype_key': 'testball'})
# Tests "@spawn <prototype_name>" # Tests "spawn <prototype_name>"
self.call(building.CmdSpawn(), "testball", "Spawned Ball") self.call(building.CmdSpawn(), "testball", "Spawned Ball")
ball = getObject(self, "Ball") ball = getObject(self, "Ball")
@ -712,7 +712,7 @@ class TestBuilding(CommandTest):
self.assertIsInstance(ball, DefaultObject) self.assertIsInstance(ball, DefaultObject)
ball.delete() ball.delete()
# Tests "@spawn/n ..." without specifying a location. # Tests "spawn/n ..." without specifying a location.
# Location should be "None". # Location should be "None".
self.call(building.CmdSpawn(), "/n 'BALL'", "Spawned Ball") # /n switch is abbreviated form of /noloc self.call(building.CmdSpawn(), "/n 'BALL'", "Spawned Ball") # /n switch is abbreviated form of /noloc
ball = getObject(self, "Ball") ball = getObject(self, "Ball")
@ -723,7 +723,7 @@ class TestBuilding(CommandTest):
"/noloc {'prototype_parent':'TESTBALL', 'prototype_key': 'testball', 'location':'%s'}" "/noloc {'prototype_parent':'TESTBALL', 'prototype_key': 'testball', 'location':'%s'}"
% spawnLoc.dbref, "Error: Prototype testball tries to parent itself.") % spawnLoc.dbref, "Error: Prototype testball tries to parent itself.")
# Tests "@spawn/noloc ...", but DO specify a location. # Tests "spawn/noloc ...", but DO specify a location.
# Location should be the specified location. # Location should be the specified location.
self.call(building.CmdSpawn(), self.call(building.CmdSpawn(),
"/noloc {'prototype_parent':'TESTBALL', 'key': 'Ball', 'prototype_key': 'foo', 'location':'%s'}" "/noloc {'prototype_parent':'TESTBALL', 'key': 'Ball', 'prototype_key': 'foo', 'location':'%s'}"
@ -738,14 +738,14 @@ class TestBuilding(CommandTest):
# Test listing commands # Test listing commands
self.call(building.CmdSpawn(), "/list", "Key ") self.call(building.CmdSpawn(), "/list", "Key ")
# @spawn/edit (missing prototype) # spawn/edit (missing prototype)
# brings up olc menu # brings up olc menu
msg = self.call( msg = self.call(
building.CmdSpawn(), building.CmdSpawn(),
'/edit') '/edit')
assert 'Prototype wizard' in msg assert 'Prototype wizard' in msg
# @spawn/edit with valid prototype # spawn/edit with valid prototype
# brings up olc menu loaded with prototype # brings up olc menu loaded with prototype
msg = self.call( msg = self.call(
building.CmdSpawn(), building.CmdSpawn(),
@ -759,34 +759,34 @@ class TestBuilding(CommandTest):
and 'Ball' == self.char1.ndb._menutree.olc_prototype['key'] and 'Ball' == self.char1.ndb._menutree.olc_prototype['key']
assert 'Ball' in msg and 'testball' in msg assert 'Ball' in msg and 'testball' in msg
# @spawn/edit with valid prototype (synomym) # spawn/edit with valid prototype (synomym)
msg = self.call( msg = self.call(
building.CmdSpawn(), building.CmdSpawn(),
'/edit BALL') '/edit BALL')
assert 'Prototype wizard' in msg assert 'Prototype wizard' in msg
assert 'Ball' in msg and 'testball' in msg assert 'Ball' in msg and 'testball' in msg
# @spawn/edit with invalid prototype # spawn/edit with invalid prototype
msg = self.call( msg = self.call(
building.CmdSpawn(), building.CmdSpawn(),
'/edit NO_EXISTS', '/edit NO_EXISTS',
"No prototype 'NO_EXISTS' was found.") "No prototype 'NO_EXISTS' was found.")
# @spawn/examine (missing prototype) # spawn/examine (missing prototype)
# lists all prototypes that exist # lists all prototypes that exist
msg = self.call( msg = self.call(
building.CmdSpawn(), building.CmdSpawn(),
'/examine') '/examine')
assert 'testball' in msg and 'testprot' in msg assert 'testball' in msg and 'testprot' in msg
# @spawn/examine with valid prototype # spawn/examine with valid prototype
# prints the prototype # prints the prototype
msg = self.call( msg = self.call(
building.CmdSpawn(), building.CmdSpawn(),
'/examine BALL') '/examine BALL')
assert 'Ball' in msg and 'testball' in msg assert 'Ball' in msg and 'testball' in msg
# @spawn/examine with invalid prototype # spawn/examine with invalid prototype
# shows error # shows error
self.call( self.call(
building.CmdSpawn(), building.CmdSpawn(),
@ -836,7 +836,7 @@ class TestComms(CommandTest):
def test_cboot(self): def test_cboot(self):
# No one else connected to boot # No one else connected to boot
self.call(comms.CmdCBoot(), "", "Usage: @cboot[/quiet] <channel> = <account> [:reason]", receiver=self.account) self.call(comms.CmdCBoot(), "", "Usage: cboot[/quiet] <channel> = <account> [:reason]", receiver=self.account)
def test_cdestroy(self): def test_cdestroy(self):
self.call(comms.CmdCdestroy(), "testchan", self.call(comms.CmdCdestroy(), "testchan",

View file

@ -311,7 +311,7 @@ class CmdUnconnectedEncoding(COMMAND_DEFAULT_CLASS):
""" """
key = "encoding" key = "encoding"
aliases = ("@encoding", "@encode") aliases = ("encode")
locks = "cmd:all()" locks = "cmd:all()"
def func(self): def func(self):
@ -337,7 +337,7 @@ class CmdUnconnectedEncoding(COMMAND_DEFAULT_CLASS):
pencoding = self.session.protocol_flags.get("ENCODING", None) pencoding = self.session.protocol_flags.get("ENCODING", None)
string = "" string = ""
if pencoding: if pencoding:
string += "Default encoding: |g%s|n (change with |w@encoding <encoding>|n)" % pencoding string += "Default encoding: |g%s|n (change with |wencoding <encoding>|n)" % pencoding
encodings = settings.ENCODINGS encodings = settings.ENCODINGS
if encodings: if encodings:
string += "\nServer's alternative encodings (tested in this order):\n |g%s|n" % ", ".join(encodings) string += "\nServer's alternative encodings (tested in this order):\n |g%s|n" % ", ".join(encodings)
@ -369,10 +369,9 @@ class CmdUnconnectedScreenreader(COMMAND_DEFAULT_CLASS):
screenreader screenreader
Used to flip screenreader mode on and off before logging in (when Used to flip screenreader mode on and off before logging in (when
logged in, use @option screenreader on). logged in, use option screenreader on).
""" """
key = "screenreader" key = "screenreader"
aliases = "@screenreader"
def func(self): def func(self):
"""Flips screenreader setting.""" """Flips screenreader setting."""
@ -443,7 +442,7 @@ def _create_character(session, new_account, typeclass, home, permissions):
# If no description is set, set a default description # If no description is set, set a default description
if not new_character.db.desc: if not new_character.db.desc:
new_character.db.desc = "This is a character." new_character.db.desc = "This is a character."
# We need to set this to have @ic auto-connect to this character # We need to set this to have ic auto-connect to this character
new_account.db._last_puppet = new_character new_account.db._last_puppet = new_character
except Exception as e: except Exception as e:
session.msg("There was an error creating the Character:\n%s\n If this problem persists, contact an admin." % e) session.msg("There was an error creating the Character:\n%s\n If this problem persists, contact an admin." % e)

View file

@ -499,7 +499,7 @@ TYPECLASS_AGGRESSIVE_CACHE = True
# the user changes an option. The options are accessed through the # the user changes an option. The options are accessed through the
# `Account.options` handler. # `Account.options` handler.
# ("Description", 'Option Class name in evennia.OPTIONS_CLASSES', 'Default Value') # ("Description", 'Option Class name in evennia.OPTION_CLASS_MODULES', 'Default Value')
OPTIONS_ACCOUNT_DEFAULT = { OPTIONS_ACCOUNT_DEFAULT = {
'border_color': ('Headers, footers, table borders, etc.', 'Color', 'n'), 'border_color': ('Headers, footers, table borders, etc.', 'Color', 'n'),
@ -519,7 +519,7 @@ OPTIONS_ACCOUNT_DEFAULT = {
# later in this list will override those added earlier. # later in this list will override those added earlier.
OPTION_CLASS_MODULES = ['evennia.utils.optionclasses', ] OPTION_CLASS_MODULES = ['evennia.utils.optionclasses', ]
# Module holding validator functions. These are used as a resource for # Module holding validator functions. These are used as a resource for
# validating options, but can also be used as input validators in general.# # validating options, but can also be used as input validators in general.
# Same-named functions in modules added later in this list will override those # Same-named functions in modules added later in this list will override those
# added earlier. # added earlier.
VALIDATOR_FUNC_MODULES = ['evennia.utils.validatorfuncs', ] VALIDATOR_FUNC_MODULES = ['evennia.utils.validatorfuncs', ]

View file

@ -1229,7 +1229,7 @@ def mod_import(module):
# check just where the ImportError happened (it could have been # check just where the ImportError happened (it could have been
# an erroneous import inside the module as well). This is the # an erroneous import inside the module as well). This is the
# trivial way to do it ... # trivial way to do it ...
if str(ex) != "Import by filename is not supported.": if not str(ex).startswith("No module named "):
raise raise
# error in this module. Try absolute path import instead # error in this module. Try absolute path import instead