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
- Remove `@`-prefix from all default commands (prefixes still works)
- Removed default `@delaccount` command, incorporating as `@account/delete` instead. Added confirmation
question.
- 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.
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.
- 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
@ -121,6 +128,16 @@
- Django signals fire for important events: Puppet/Unpuppet, Object create/rename, Login,
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
- `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__
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')
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)
return table
def render_header(self, header_text=None, fill_character=None, edge_character=None,
mode='header', color_header=True):
def _render_decoration(self, header_text=None, fill_character=None, edge_character=None,
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['border'] = self.account.options.get('border_color')
colors['headertext'] = self.account.options.get('%s_text_color' % mode)
colors['headerstar'] = self.account.options.get('%s_star_color' % mode)
width = self.width()
width = width or self.width()
if edge_character:
width -= 2
@ -557,19 +597,31 @@ Command {self} has no defined `func()` - showing on-command variables:
return final_send
def style_header(self, *args, **kwargs):
"""
Create a pretty header.
"""
if 'mode' not in kwargs:
kwargs['mode'] = 'header'
return self.render_header(*args, **kwargs)
return self._render_decoration(*args, **kwargs)
def style_separator(self, *args, **kwargs):
"""
Create a separator.
"""
if 'mode' not in kwargs:
kwargs['mode'] = 'separator'
return self.render_header(*args, **kwargs)
return self._render_decoration(*args, **kwargs)
def style_footer(self, *args, **kwargs):
"""
Create a pretty footer.
"""
if 'mode' not in kwargs:
kwargs['mode'] = 'footer'
return self.render_header(*args, **kwargs)
return self._render_decoration(*args, **kwargs)
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)
The property self.character can be used to access the character when
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
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 django.conf import settings
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)
@ -102,7 +102,7 @@ class CmdOOCLook(MuxAccountLookCommand):
if _MULTISESSION_MODE < 2:
# 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
# call on-account look helper method
@ -114,14 +114,14 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
create a new character
Usage:
@charcreate <charname> [= desc]
charcreate <charname> [= desc]
Create a new character, optionally giving it a description. You
may use upper-case letters in the name - you will nevertheless
always be able to access your character using lower-case letters
if you want.
"""
key = "@charcreate"
key = "charcreate"
locks = "cmd:pperm(Player)"
help_category = "General"
@ -132,7 +132,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
"""create the new character"""
account = self.account
if not self.args:
self.msg("Usage: @charcreate <charname> [= description]")
self.msg("Usage: charcreate <charname> [= description]")
return
key = self.lhs
desc = self.rhs
@ -170,7 +170,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
new_character.db.desc = desc
elif not new_character.db.desc:
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))
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!
Usage:
@chardelete <charname>
chardelete <charname>
Permanently deletes one of your characters.
"""
key = "@chardelete"
key = "chardelete"
locks = "cmd:pperm(Player)"
help_category = "General"
@ -193,7 +193,7 @@ class CmdCharDelete(COMMAND_DEFAULT_CLASS):
account = self.account
if not self.args:
self.msg("Usage: @chardelete <charactername>")
self.msg("Usage: chardelete <charactername>")
return
# use the playable_characters list to search
@ -238,7 +238,7 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
control an object you have permission to puppet
Usage:
@ic <character>
ic <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.
"""
key = "@ic"
key = "ic"
# lock must be all() for different puppeted objects to access it.
locks = "cmd:all()"
aliases = "@puppet"
aliases = "puppet"
help_category = "General"
# this is used by the parent
@ -271,7 +271,7 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
if not self.args:
new_character = account.db._last_puppet
if not new_character:
self.msg("Usage: @ic <character>")
self.msg("Usage: ic <character>")
return
if not new_character:
# search for a matching character
@ -301,16 +301,16 @@ class CmdOOC(MuxAccountLookCommand):
stop puppeting and go ooc
Usage:
@ooc
ooc
Go out-of-character (OOC).
This will leave your current character and put you in a incorporeal OOC state.
"""
key = "@ooc"
key = "ooc"
locks = "cmd:pperm(Player)"
aliases = "@unpuppet"
aliases = "unpuppet"
help_category = "General"
# this is used by the parent
@ -337,7 +337,7 @@ class CmdOOC(MuxAccountLookCommand):
if _MULTISESSION_MODE < 2:
# 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
self.msg(account.at_look(target=self.playable, session=session))
@ -351,12 +351,12 @@ class CmdSessions(COMMAND_DEFAULT_CLASS):
check your connected session(s)
Usage:
@sessions
sessions
Lists the sessions currently connected to your account.
"""
key = "@sessions"
key = "sessions"
locks = "cmd:all()"
help_category = "General"
@ -367,11 +367,11 @@ class CmdSessions(COMMAND_DEFAULT_CLASS):
"""Implement function"""
account = self.account
sessions = account.sessions.all()
table = self.style_table("|wsessid",
"|wprotocol",
"|whost",
"|wpuppet/character",
"|wlocation")
table = self.styled_table("|wsessid",
"|wprotocol",
"|whost",
"|wpuppet/character",
"|wlocation")
for sess in sorted(sessions, key=lambda x: x.sessid):
char = account.get_puppet(sess)
table.add_row(str(sess.sessid), str(sess.protocol_key),
@ -418,7 +418,7 @@ class CmdWho(COMMAND_DEFAULT_CLASS):
naccounts = SESSIONS.account_count()
if show_session_data:
# privileged info
table = self.style_table("|wAccount Name",
table = self.styled_table("|wAccount Name",
"|wOn for",
"|wIdle",
"|wPuppeting",
@ -444,7 +444,7 @@ class CmdWho(COMMAND_DEFAULT_CLASS):
isinstance(session.address, tuple) and session.address[0] or session.address)
else:
# unprivileged
table = self.style_table("|wAccount name", "|wOn for", "|wIdle")
table = self.styled_table("|wAccount name", "|wOn for", "|wIdle")
for session in session_list:
if not session.logged_in:
continue
@ -464,7 +464,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
Set an account option
Usage:
@option[/save] [name = value]
option[/save] [name = value]
Switches:
save - Save the current option settings for future logins.
@ -476,8 +476,8 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
"""
key = "@option"
aliases = "@options"
key = "option"
aliases = "options"
switch_options = ("save", "clear")
locks = "cmd:all()"
@ -500,7 +500,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
if "save" in self.switches:
# save all options
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:
# clear all saves
self.caller.db._saved_protocol_flags = {}
@ -524,7 +524,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
options.pop("TTYPE", None)
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):
row = [key, options[key]]
if saved_options:
@ -537,7 +537,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
return
if not self.rhs:
self.msg("Usage: @option [name = [value]]")
self.msg("Usage: option [name = [value]]")
return
# Try to assign new values
@ -619,11 +619,11 @@ class CmdPassword(COMMAND_DEFAULT_CLASS):
change your password
Usage:
@password <old password> = <new password>
password <old password> = <new password>
Changes your password. Make sure to pick a safe one.
"""
key = "@password"
key = "password"
locks = "cmd:pperm(Player)"
# this is used by the parent
@ -634,7 +634,7 @@ class CmdPassword(COMMAND_DEFAULT_CLASS):
account = self.account
if not self.rhs:
self.msg("Usage: @password <oldpass> = <newpass>")
self.msg("Usage: password <oldpass> = <newpass>")
return
oldpass = self.lhslist[0] # Both of these are
newpass = self.rhslist[0] # already stripped by parse()
@ -660,7 +660,7 @@ class CmdQuit(COMMAND_DEFAULT_CLASS):
quit the game
Usage:
@quit
quit
Switch:
all - disconnect all connected sessions
@ -668,7 +668,7 @@ class CmdQuit(COMMAND_DEFAULT_CLASS):
Gracefully disconnect your current session from the
game. Use the /all switch to disconnect from all sessions.
"""
key = "@quit"
key = "quit"
switch_options = ("all",)
locks = "cmd:all()"
@ -702,7 +702,7 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
testing which colors your client support
Usage:
@color ansi||xterm256
color ansi||xterm256
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
@ -710,7 +710,7 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
standard. No checking is done to determine your client supports
color - if not you will see rubbish appear.
"""
key = "@color"
key = "color"
locks = "cmd:all()"
help_category = "General"
@ -805,7 +805,7 @@ class CmdColorTest(COMMAND_DEFAULT_CLASS):
self.msg(string)
else:
# malformed input
self.msg("Usage: @color ansi||xterm256")
self.msg("Usage: color ansi||xterm256")
class CmdQuell(COMMAND_DEFAULT_CLASS):
@ -825,8 +825,8 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
Use the unquell command to revert back to normal operation.
"""
key = "@quell"
aliases = ["@unquell"]
key = "quell"
aliases = ["unquell"]
locks = "cmd:pperm(Player)"
help_category = "General"
@ -848,7 +848,7 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
"""Perform the command"""
account = self.account
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'):
self.msg("Already using normal Account permissions %s." % permstr)
else:
@ -865,15 +865,27 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
cpermstr = "Quelling to current puppet's permissions %s." % cpermstr
cpermstr += "\n(Note: If this is higher than Account permissions %s," \
" 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)
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)
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']
def func(self):
@ -883,11 +895,12 @@ class CmdStyle(COMMAND_DEFAULT_CLASS):
self.set()
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():
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())
self.msg(str(styles_table))
table.add_row(op_key, op_found.description,
op_found.__class__.__name__, op_found.display())
self.msg(str(table))
def set(self):
try:
@ -895,5 +908,4 @@ class CmdStyle(COMMAND_DEFAULT_CLASS):
except ValueError as e:
self.msg(str(e))
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.
Usage
@boot[/switches] <account obj> [: reason]
boot[/switches] <account obj> [: reason]
Switches:
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.
"""
key = "@boot"
key = "boot"
switch_options = ("quiet", "sid")
locks = "cmd:perm(boot) or perm(Admin)"
help_category = "Admin"
@ -46,7 +46,7 @@ class CmdBoot(COMMAND_DEFAULT_CLASS):
args = self.args
if not args:
caller.msg("Usage: @boot[/switches] <account> [:reason]")
caller.msg("Usage: boot[/switches] <account> [:reason]")
return
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}")
def list_bans(banlist):
def list_bans(cmd, banlist):
"""
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:
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):
table.add_row(str(inum + 1),
ban[0] and ban[0] or ban[1],
@ -125,7 +129,7 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
ban an account from the server
Usage:
@ban [<name or ip> [: reason]]
ban [<name or ip> [: reason]]
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.
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.
IP (Internet Protocol) address banning allows blocking all access
@ -141,10 +145,10 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
wildcard.
Examples:
@ban thomas - ban account 'thomas'
@ban/ip 134.233.2.111 - ban specific ip address
@ban/ip 134.233.2.* - ban all in a subnet
@ban/ip 134.233.*.* - even wider ban
ban thomas - ban account 'thomas'
ban/ip 134.233.2.111 - ban specific ip address
ban/ip 134.233.2.* - ban all in a subnet
ban/ip 134.233.*.* - even wider ban
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
@ -153,8 +157,8 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
or region.
"""
key = "@ban"
aliases = ["@bans"]
key = "ban"
aliases = ["bans"]
locks = "cmd:perm(ban) or perm(Developer)"
help_category = "Admin"
@ -178,7 +182,7 @@ class CmdBan(COMMAND_DEFAULT_CLASS):
if not self.args or (self.switches and
not any(switch in ('ip', 'name')
for switch in self.switches)):
self.caller.msg(list_bans(banlist))
self.caller.msg(list_bans(self, banlist))
return
now = time.ctime()
@ -214,15 +218,15 @@ class CmdUnban(COMMAND_DEFAULT_CLASS):
remove a ban from an account
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
list of bans. Use the numbers in this list to select which one to
unban.
"""
key = "@unban"
key = "unban"
locks = "cmd:perm(unban) or perm(Developer)"
help_category = "Admin"
@ -232,7 +236,7 @@ class CmdUnban(COMMAND_DEFAULT_CLASS):
banlist = ServerConfig.objects.conf('server_bans')
if not self.args:
self.caller.msg(list_bans(banlist))
self.caller.msg(list_bans(self, banlist))
return
try:
@ -261,9 +265,9 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
admin command for emitting message to multiple objects
Usage:
@emit[/switches] [<obj>, <obj>, ... =] <message>
@remit [<obj>, <obj>, ... =] <message>
@pemit [<obj>, <obj>, ... =] <message>
emit[/switches] [<obj>, <obj>, ... =] <message>
remit [<obj>, <obj>, ... =] <message>
pemit [<obj>, <obj>, ... =] <message>
Switches:
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
your immediate surroundings. If the object is a room,
send to its contents. @remit and @pemit are just
limited forms of @emit, for sending to rooms and
send to its contents. remit and pemit are just
limited forms of emit, for sending to rooms and
to accounts respectively.
"""
key = "@emit"
aliases = ["@pemit", "@remit"]
key = "emit"
aliases = ["pemit", "remit"]
switch_options = ("room", "accounts", "contents")
locks = "cmd:perm(emit) or perm(Builder)"
help_category = "Admin"
@ -290,9 +294,9 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
if not args:
string = "Usage: "
string += "\n@emit[/switches] [<obj>, <obj>, ... =] <message>"
string += "\n@remit [<obj>, <obj>, ... =] <message>"
string += "\n@pemit [<obj>, <obj>, ... =] <message>"
string += "\nemit[/switches] [<obj>, <obj>, ... =] <message>"
string += "\nremit [<obj>, <obj>, ... =] <message>"
string += "\npemit [<obj>, <obj>, ... =] <message>"
caller.msg(string)
return
@ -301,10 +305,10 @@ class CmdEmit(COMMAND_DEFAULT_CLASS):
send_to_contents = 'contents' in self.switches
# we check which command was used to force the switches
if self.cmdstring == '@remit':
if self.cmdstring == 'remit':
rooms_only = True
send_to_contents = True
elif self.cmdstring == '@pemit':
elif self.cmdstring == 'pemit':
accounts_only = True
if not self.rhs:
@ -341,12 +345,12 @@ class CmdNewPassword(COMMAND_DEFAULT_CLASS):
change the password of an account
Usage:
@userpassword <user obj> = <new password>
userpassword <user obj> = <new password>
Set an account's password.
"""
key = "@userpassword"
key = "userpassword"
locks = "cmd:perm(newpassword) or perm(Admin)"
help_category = "Admin"
@ -356,7 +360,7 @@ class CmdNewPassword(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.rhs:
self.msg("Usage: @userpassword <user obj> = <new password>")
self.msg("Usage: userpassword <user obj> = <new password>")
return
# the account search also matches 'me' etc.
@ -388,8 +392,8 @@ class CmdPerm(COMMAND_DEFAULT_CLASS):
set the permissions of an account/object
Usage:
@perm[/switch] <object> [= <permission>[,<permission>,...]]
@perm[/switch] *<account> [= <permission>[,<permission>,...]]
perm[/switch] <object> [= <permission>[,<permission>,...]]
perm[/switch] *<account> [= <permission>[,<permission>,...]]
Switches:
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
or account. If no permission is given, list all permissions on <object>.
"""
key = "@perm"
aliases = "@setperm"
key = "perm"
aliases = "setperm"
switch_options = ("del", "account")
locks = "cmd:perm(perm) or perm(Developer)"
help_category = "Admin"
@ -412,7 +416,7 @@ class CmdPerm(COMMAND_DEFAULT_CLASS):
lhs, rhs = self.lhs, self.rhs
if not self.args:
string = "Usage: @perm[/switch] object [ = permission, permission, ...]"
string = "Usage: perm[/switch] object [ = permission, permission, ...]"
caller.msg(string)
return
@ -496,19 +500,19 @@ class CmdWall(COMMAND_DEFAULT_CLASS):
make an announcement to all
Usage:
@wall <message>
wall <message>
Announces a message to all connected sessions
including all currently unlogged in.
"""
key = "@wall"
key = "wall"
locks = "cmd:perm(wall) or perm(Admin)"
help_category = "Admin"
def func(self):
"""Implements command"""
if not self.args:
self.caller.msg("Usage: @wall <message>")
self.caller.msg("Usage: wall <message>")
return
message = "%s shouts \"%s\"" % (self.caller.name, self.args)
self.msg("Announcing to all connected sessions ...")
@ -520,12 +524,12 @@ class CmdForce(COMMAND_DEFAULT_CLASS):
forces an object to execute a command
Usage:
@force <object>=<command string>
force <object>=<command string>
Example:
@force bob=get stick
force bob=get stick
"""
key = "@force"
key = "force"
locks = "cmd:perm(spawn) or perm(Builder)"
help_category = "Building"
perm_used = "edit"

View file

@ -225,7 +225,7 @@ class CmdBatchCommands(_COMMAND_DEFAULT_CLASS):
build from batch-command file
Usage:
@batchcommands[/interactive] <python.path.to.file>
batchcommands[/interactive] <python.path.to.file>
Switch:
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).
"""
key = "@batchcommands"
aliases = ["@batchcommand", "@batchcmd"]
key = "batchcommands"
aliases = ["batchcommand", "batchcmd"]
switch_options = ("interactive",)
locks = "cmd:perm(batchcommands) or perm(Developer)"
help_category = "Building"
@ -248,7 +248,7 @@ class CmdBatchCommands(_COMMAND_DEFAULT_CLASS):
args = self.args
if not args:
caller.msg("Usage: @batchcommands[/interactive] <path.to.file>")
caller.msg("Usage: batchcommands[/interactive] <path.to.file>")
return
python_path = self.args
@ -337,7 +337,7 @@ class CmdBatchCode(_COMMAND_DEFAULT_CLASS):
build from batch-code file
Usage:
@batchcode[/interactive] <python path to file>
batchcode[/interactive] <python path to file>
Switch:
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).
"""
key = "@batchcode"
aliases = ["@batchcodes"]
key = "batchcode"
aliases = ["batchcodes"]
switch_options = ("interactive", "debug")
locks = "cmd:superuser()"
help_category = "Building"
@ -364,7 +364,7 @@ class CmdBatchCode(_COMMAND_DEFAULT_CLASS):
args = self.args
if not args:
caller.msg("Usage: @batchcode[/interactive/debug] <path.to.file>")
caller.msg("Usage: batchcode[/interactive/debug] <path.to.file>")
return
python_path = self.args
debug = 'debug' in self.switches
@ -452,13 +452,13 @@ class CmdBatchCode(_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
the default cmdset, regardless of what current cmdset the processor might
have put us in (e.g. when testing buggy scripts etc).
"""
key = "@abort"
key = "abort"
help_category = "BatchProcess"
locks = "cmd:perm(batchcommands)"
@ -813,7 +813,7 @@ class CmdStateHH(_COMMAND_DEFAULT_CLASS):
cc - continue processing to end, then quit.
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
batch-command processing. It immediately shuts down
the processor and returns us to the default cmdset.
@ -831,7 +831,7 @@ class CmdStateHH(_COMMAND_DEFAULT_CLASS):
class BatchSafeCmdSet(CmdSet):
"""
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.
"""
key = "Batch_default"

View file

@ -27,10 +27,10 @@ __all__ = ("ObjManipCommand", "CmdSetObjAlias", "CmdCopy",
"CmdLock", "CmdExamine", "CmdFind", "CmdTeleport",
"CmdScript", "CmdTag", "CmdSpawn")
# used by @set
# used by set
from ast import literal_eval as _LITERAL_EVAL
# used by @find
# used by find
CHAR_TYPECLASS = settings.BASE_CHARACTER_TYPECLASS
ROOM_TYPECLASS = settings.BASE_ROOM_TYPECLASS
EXIT_TYPECLASS = settings.BASE_EXIT_TYPECLASS
@ -101,9 +101,9 @@ class CmdSetObjAlias(COMMAND_DEFAULT_CLASS):
adding permanent aliases for object
Usage:
@alias <obj> [= [alias[,alias,alias,...]]]
@alias <obj> =
@alias/category <obj> = [alias[,alias,...]:<category>
alias <obj> [= [alias[,alias,alias,...]]]
alias <obj> =
alias/category <obj> = [alias[,alias,...]:<category>
Switches:
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.
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
by everyone.
"""
key = "@alias"
aliases = "@setobjalias"
key = "alias"
aliases = "setobjalias"
switch_options = ("category",)
locks = "cmd:perm(setobjalias) or perm(Builder)"
help_category = "Building"
@ -131,7 +131,7 @@ class CmdSetObjAlias(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.lhs:
string = "Usage: @alias <obj> [= [alias[,alias ...]]]"
string = "Usage: alias <obj> [= [alias[,alias ...]]]"
self.caller.msg(string)
return
objname = self.lhs
@ -203,7 +203,7 @@ class CmdCopy(ObjManipCommand):
copy an object and its properties
Usage:
@copy[/reset] <original obj> [= <new_name>][;alias;alias..]
copy[/reset] <original obj> [= <new_name>][;alias;alias..]
[:<new_location>] [,<new_name2> ...]
switch:
@ -215,7 +215,7 @@ class CmdCopy(ObjManipCommand):
one exact copy of the original object will be created with the name *_copy.
"""
key = "@copy"
key = "copy"
switch_options = ("reset",)
locks = "cmd:perm(copy) or perm(Builder)"
help_category = "Building"
@ -226,7 +226,7 @@ class CmdCopy(ObjManipCommand):
caller = self.caller
args = self.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>...]")
return
@ -280,16 +280,16 @@ class CmdCpAttr(ObjManipCommand):
copy attributes between objects
Usage:
@cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]
cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]
Switches:
move - delete the attribute from the source object after copying.
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
on Anna and Tom.
@ -297,7 +297,7 @@ class CmdCpAttr(ObjManipCommand):
Copy the attribute one object to one or more attributes on another object.
If you don't supply a source object, yourself is used.
"""
key = "@cpattr"
key = "cpattr"
switch_options = ("move",)
locks = "cmd:perm(cpattr) or perm(Builder)"
help_category = "Building"
@ -348,10 +348,10 @@ class CmdCpAttr(ObjManipCommand):
if not self.rhs:
string = """Usage:
@cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]"""
cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]"""
caller.msg(string)
return
@ -428,10 +428,10 @@ class CmdMvAttr(ObjManipCommand):
move attributes between objects
Usage:
@mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]
mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]
Switches:
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
object. If you don't supply a source object, yourself is used.
"""
key = "@mvattr"
key = "mvattr"
switch_options = ("copy",)
locks = "cmd:perm(mvattr) or perm(Builder)"
help_category = "Building"
@ -450,18 +450,18 @@ class CmdMvAttr(ObjManipCommand):
"""
if not self.rhs:
string = """Usage:
@mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
@mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]"""
mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]
mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]
mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]"""
self.caller.msg(string)
return
# simply use @cpattr for all the functionality
# simply use cpattr for all the functionality
if "copy" in self.switches:
self.execute_cmd("@cpattr %s" % self.args)
self.execute_cmd("cpattr %s" % self.args)
else:
self.execute_cmd("@cpattr/move %s" % self.args)
self.execute_cmd("cpattr/move %s" % self.args)
class CmdCreate(ObjManipCommand):
@ -469,7 +469,7 @@ class CmdCreate(ObjManipCommand):
create new objects
Usage:
@create[/drop] <objname>[;alias;alias...][:typeclass], <objname>...
create[/drop] <objname>[;alias;alias...][:typeclass], <objname>...
switch:
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
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",)
locks = "cmd:perm(create) or perm(Builder)"
help_category = "Building"
@ -505,7 +505,7 @@ class CmdCreate(ObjManipCommand):
caller = self.caller
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)
return
@ -565,7 +565,7 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
describe an object or the current room.
Usage:
@desc [<obj> =] <description>
desc [<obj> =] <description>
Switches:
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,
describe the current room.
"""
key = "@desc"
aliases = "@describe"
key = "desc"
aliases = "describe"
switch_options = ("edit",)
locks = "cmd:perm(desc) or perm(Builder)"
help_category = "Building"
@ -605,7 +605,7 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.args and 'edit' not in self.switches:
caller.msg("Usage: @desc [<obj> =] <description>")
caller.msg("Usage: desc [<obj> =] <description>")
return
if 'edit' in self.switches:
@ -635,16 +635,16 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
permanently delete objects
Usage:
@destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...]
destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...]
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.
force - destroy without confirmation.
Examples:
@destroy house, roof, door, 44-78
@destroy 5-10, flower, 45
@destroy/force north
destroy house, roof, door, 44-78
destroy 5-10, flower, 45
destroy/force north
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
@ -652,8 +652,8 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
You can specify the /force switch to bypass this confirmation.
"""
key = "@destroy"
aliases = ["@delete", "@del"]
key = "destroy"
aliases = ["delete", "del"]
switch_options = ("override", "force")
locks = "cmd:perm(destroy) or perm(Builder)"
help_category = "Building"
@ -668,7 +668,7 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
delete = True
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
def delobj(obj):
@ -758,7 +758,7 @@ class CmdDig(ObjManipCommand):
build new rooms and connect them to the current location
Usage:
@dig[/switches] <roomname>[;alias;alias...][:typeclass]
dig[/switches] <roomname>[;alias;alias...][:typeclass]
[= <exit_to_there>[;alias][:typeclass]]
[, <exit_to_here>[;alias][:typeclass]]
@ -766,9 +766,9 @@ class CmdDig(ObjManipCommand):
tel or teleport - move yourself to the new room
Examples:
@dig kitchen = north;n, south;s
@dig house:myrooms.MyHouseTypeclass
@dig sheer cliff;cliff;sheer = climb up, climb down
dig kitchen = north;n, south;s
dig house:myrooms.MyHouseTypeclass
dig sheer cliff;cliff;sheer = climb up, climb down
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
@ -776,7 +776,7 @@ class CmdDig(ObjManipCommand):
like to the name of the room and the exits in question; an example
would be 'north;no;n'.
"""
key = "@dig"
key = "dig"
switch_options = ("teleport",)
locks = "cmd:perm(dig) or perm(Builder)"
help_category = "Building"
@ -793,7 +793,7 @@ class CmdDig(ObjManipCommand):
caller = self.caller
if not self.lhs:
string = "Usage: @dig[/teleport] <roomname>[;alias;alias...]" \
string = "Usage: dig[/teleport] <roomname>[;alias;alias...]" \
"[:parent] [= <exit_there>"
string += "[;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
Usage:
@tunnel[/switch] <direction>[:typeclass] [= <roomname>[;alias;alias;...][:typeclass]]
tunnel[/switch] <direction>[:typeclass] [= <roomname>[;alias;alias;...][:typeclass]]
Switches:
oneway - do not create an exit back to the current location
tel - teleport to the newly created room
Example:
@tunnel n
@tunnel n = house;mike's place;green building
tunnel n
tunnel n = house;mike's place;green building
This is a simple way to build using pre-defined directions:
|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
"n" for example). Opposite directions will automatically be
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"
aliases = ["@tun"]
key = "tunnel"
aliases = ["tun"]
switch_options = ("oneway", "tel")
locks = "cmd: perm(tunnel) or perm(Builder)"
help_category = "Building"
@ -942,7 +942,7 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
"""Implements the tunnel command"""
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]]"
self.caller.msg(string)
return
@ -951,9 +951,9 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
exitshort = self.lhs.split(":")[0]
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()))
string += "\n(use @dig for more freedom)"
string += "\n(use dig for more freedom)"
self.caller.msg(string)
return
@ -981,8 +981,8 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
if "oneway" not in self.switches:
backstring = ", %s;%s" % (backname, backshort)
# build the string we will use to call @dig
digstring = "@dig%s %s = %s;%s%s" % (telswitch, roomname,
# build the string we will use to call dig
digstring = "dig%s %s = %s;%s%s" % (telswitch, roomname,
exitname, exitshort, backstring)
self.execute_cmd(digstring)
@ -992,9 +992,9 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
link existing rooms together with exits
Usage:
@link[/switches] <object> = <target>
@link[/switches] <object> =
@link[/switches] <object>
link[/switches] <object> = <target>
link[/switches] <object> =
link[/switches] <object>
Switch:
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
arguments.
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.
"""
key = "@link"
key = "link"
locks = "cmd:perm(link) or perm(Builder)"
help_category = "Building"
@ -1017,7 +1017,7 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.args:
caller.msg("Usage: @link[/twoway] <object> = <target>")
caller.msg("Usage: link[/twoway] <object> = <target>")
return
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)
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.
if obj.destination:
obj.destination = None
@ -1092,14 +1092,14 @@ class CmdUnLink(CmdLink):
remove exit-connections between rooms
Usage:
@unlink <Object>
unlink <Object>
Unlinks an object, for example an exit, disconnecting
it from whatever it was connected to.
"""
# this is just a child of CmdLink
key = "@unlink"
key = "unlink"
locks = "cmd:perm(unlink) or perm(Builder)"
help_key = "Building"
@ -1112,13 +1112,13 @@ class CmdUnLink(CmdLink):
caller = self.caller
if not self.args:
caller.msg("Usage: @unlink <object>")
caller.msg("Usage: unlink <object>")
return
# This mimics '@link <obj> = ' which is the same as @unlink
# This mimics 'link <obj> = ' which is the same as unlink
self.rhs = ""
# call the @link functionality
# call the link functionality
super().func()
@ -1127,8 +1127,8 @@ class CmdSetHome(CmdLink):
set an object's home location
Usage:
@sethome <obj> [= <home_location>]
@sethom <obj>
sethome <obj> [= <home_location>]
sethom <obj>
The "home" location is a "safety" location for objects; they
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.
"""
key = "@sethome"
locks = "cmd:perm(@sethome) or perm(Builder)"
key = "sethome"
locks = "cmd:perm(sethome) or perm(Builder)"
help_category = "Building"
def func(self):
"""implement the command"""
if not self.args:
string = "Usage: @sethome <obj> [= <home_location>]"
string = "Usage: sethome <obj> [= <home_location>]"
self.caller.msg(string)
return
@ -1180,13 +1180,13 @@ class CmdListCmdSets(COMMAND_DEFAULT_CLASS):
list command sets defined on an object
Usage:
@cmdsets <obj>
cmdsets <obj>
This displays all cmdsets assigned
to a user. Defaults to yourself.
"""
key = "@cmdsets"
aliases = "@listcmsets"
key = "cmdsets"
aliases = "listcmsets"
locks = "cmd:perm(listcmdsets) or perm(Builder)"
help_category = "Building"
@ -1209,15 +1209,15 @@ class CmdName(ObjManipCommand):
change the name and/or aliases of an object
Usage:
@name <obj> = <newname>;alias1;alias2
name <obj> = <newname>;alias1;alias2
Rename an object to something new. Use *obj to
rename an account.
"""
key = "@name"
aliases = ["@rename"]
key = "name"
aliases = ["rename"]
locks = "cmd:perm(rename) or perm(Builder)"
help_category = "Building"
@ -1226,7 +1226,7 @@ class CmdName(ObjManipCommand):
caller = self.caller
if not self.args:
caller.msg("Usage: @name <obj> = <newname>[;alias;alias;...]")
caller.msg("Usage: name <obj> = <newname>[;alias;alias;...]")
return
obj = None
@ -1284,7 +1284,7 @@ class CmdOpen(ObjManipCommand):
open a new exit from the current room
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
will point there. The <return exit> argument sets up an exit at the
@ -1293,7 +1293,7 @@ class CmdOpen(ObjManipCommand):
unique.
"""
key = "@open"
key = "open"
locks = "cmd:perm(open) or perm(Builder)"
help_category = "Building"
@ -1368,7 +1368,7 @@ class CmdOpen(ObjManipCommand):
caller = self.caller
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>"
caller.msg(string)
return
@ -1421,7 +1421,7 @@ def _convert_from_string(cmd, strobj):
Handles floats, ints, and limited nested lists and dicts
(can't handle lists in a dict, for example, this is mainly due to
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).
Python 2.6 and later:
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
Usage:
@set <obj>/<attr> = <value>
@set <obj>/<attr> =
@set <obj>/<attr>
@set *<account>/attr = <value>
set <obj>/<attr> = <value>
set <obj>/<attr> =
set <obj>/<attr>
set *<account>/attr = <value>
Switch:
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)"
help_category = "Building"
@ -1603,11 +1603,11 @@ class CmdSetAttribute(ObjManipCommand):
return found_obj
def func(self):
"""Implement the set attribute - a limited form of @py."""
"""Implement the set attribute - a limited form of py."""
caller = self.caller
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
# get values prepared by the parser
@ -1675,12 +1675,12 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
set or change an object's typeclass
Usage:
@typeclass[/switch] <object> [= typeclass.path]
@type ''
@parent ''
@typeclass/list/show [typeclass.path]
@swap - this is a shorthand for using /force/reset flags.
@update - this is a shorthand for using the /force/reload flag.
typeclass[/switch] <object> [= typeclass.path]
type ''
parent ''
typeclass/list/show [typeclass.path]
swap - this is a shorthand for using /force/reset flags.
update - this is a shorthand for using the /force/reload flag.
Switch:
show, examine - display the current typeclass of object (default) or, if
@ -1695,7 +1695,7 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
Example:
@type button = examples.red_button.RedButton
type button = examples.red_button.RedButton
If the typeclass_path is not given, the current object's
typeclass is assumed.
@ -1715,8 +1715,8 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
"""
key = "@typeclass"
aliases = ["@type", "@parent", "@swap", "@update"]
key = "typeclass"
aliases = ["type", "parent", "swap", "update"]
switch_options = ("show", "examine", "update", "reset", "force", "list")
locks = "cmd:perm(typeclass) or perm(Builder)"
help_category = "Building"
@ -1793,10 +1793,10 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
caller.msg(string)
return
if self.cmdstring == "@swap":
if self.cmdstring == "swap":
self.switches.append("force")
self.switches.append("reset")
elif self.cmdstring == "@update":
elif self.cmdstring == "update":
self.switches.append("force")
self.switches.append("update")
@ -1844,16 +1844,16 @@ class CmdWipe(ObjManipCommand):
clear all attributes from an object
Usage:
@wipe <object>[/<attr>[/<attr>...]]
wipe <object>[/<attr>[/<attr>...]]
Example:
@wipe box
@wipe box/colour
wipe box
wipe box/colour
Wipes all of an object's attributes, or optionally only those
matching the given attribute-wildcard search string.
"""
key = "@wipe"
key = "wipe"
locks = "cmd:perm(wipe) or perm(Builder)"
help_category = "Building"
@ -1865,7 +1865,7 @@ class CmdWipe(ObjManipCommand):
caller = self.caller
if not self.args:
caller.msg("Usage: @wipe <object>[/<attr>/<attr>...]")
caller.msg("Usage: wipe <object>[/<attr>/<attr>...]")
return
# get the attributes set by our custom parser
@ -1895,9 +1895,9 @@ class CmdLock(ObjManipCommand):
assign a lock definition to an object
Usage:
@lock <object or *account>[ = <lockstring>]
lock <object or *account>[ = <lockstring>]
or
@lock[/switch] <object or *account>/<access_type>
lock[/switch] <object or *account>/<access_type>
Switch:
del - delete given access type
@ -1921,8 +1921,8 @@ class CmdLock(ObjManipCommand):
them by ';', i.e:
'get:id(25); delete:perm(Builder)'
"""
key = "@lock"
aliases = ["@locks"]
key = "lock"
aliases = ["locks"]
locks = "cmd: perm(locks) or perm(Builder)"
help_category = "Building"
@ -1931,13 +1931,13 @@ class CmdLock(ObjManipCommand):
caller = self.caller
if not self.args:
string = "Usage: @lock <object>[ = <lockstring>] or @lock[/switch] " \
string = "Usage: lock <object>[ = <lockstring>] or lock[/switch] " \
"<object>/<access_type>"
caller.msg(string)
return
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)]
obj = None
if objname.startswith("*"):
@ -1975,7 +1975,7 @@ class CmdLock(ObjManipCommand):
swi = ", ".join(self.switches)
caller.msg("Switch(es) |w%s|n can not be used with a "
"lock assignment. Use e.g. "
"|w@lock/del objname/locktype|n instead." % swi)
"|wlock/del objname/locktype|n instead." % swi)
return
objname, lockdef = self.lhs, self.rhs
@ -2037,8 +2037,8 @@ class CmdExamine(ObjManipCommand):
Append a * before the search string to examine an account.
"""
key = "@examine"
aliases = ["@ex", "exam"]
key = "examine"
aliases = ["ex", "exam"]
locks = "cmd:perm(examine) or perm(Builder)"
help_category = "Building"
arg_regex = r"(/\w+?(\s|$))|\s|$"
@ -2298,8 +2298,8 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
search the database for objects
Usage:
@find[/switches] <name or dbref or *account> [= dbrefmin[-dbrefmax]]
@locate - this is a shorthand for using the /loc switch.
find[/switches] <name or dbref or *account> [= dbrefmin[-dbrefmax]]
locate - this is a shorthand for using the /loc switch.
Switches:
room - only look for rooms (location=None)
@ -2316,8 +2316,8 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
one is given.
"""
key = "@find"
aliases = "@search, @locate"
key = "find"
aliases = "search, locate"
switch_options = ("room", "exit", "char", "exact", "loc", "startswith")
locks = "cmd:perm(find) or perm(Builder)"
help_category = "Building"
@ -2328,10 +2328,10 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
switches = self.switches
if not self.args:
caller.msg("Usage: @find <string> [= low [-high]]")
caller.msg("Usage: find <string> [= low [-high]]")
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')
searchstring = self.lhs
@ -2439,12 +2439,12 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
teleport object to another location
Usage:
@tel/switch [<object> to||=] <target location>
tel/switch [<object> to||=] <target location>
Examples:
@tel Limbo
@tel/quiet box = Limbo
@tel/tonone box
tel Limbo
tel/quiet box = Limbo
tel/tonone box
Switches:
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
is teleported to the target location.
"""
key = "@tel"
aliases = "@teleport"
key = "tel"
aliases = "teleport"
switch_options = ("quiet", "intoexit", "tonone", "loc")
rhs_split = ("=", " to ") # Prefer = delimiter, but allow " to " usage.
locks = "cmd:perm(teleport) or perm(Builder)"
@ -2555,7 +2555,7 @@ class CmdScript(COMMAND_DEFAULT_CLASS):
attach a script to an object
Usage:
@script[/switch] <obj> [= script_path or <scriptkey>]
script[/switch] <obj> [= script_path or <scriptkey>]
Switches:
start - start all non-running scripts on object, or a given script only
@ -2570,8 +2570,8 @@ class CmdScript(COMMAND_DEFAULT_CLASS):
the object.
"""
key = "@script"
aliases = "@addscript"
key = "script"
aliases = "addscript"
switch_options = ("start", "stop")
locks = "cmd:perm(script) or perm(Builder)"
help_category = "Building"
@ -2582,12 +2582,12 @@ class CmdScript(COMMAND_DEFAULT_CLASS):
caller = self.caller
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)
return
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
obj = caller.search(self.lhs)
@ -2653,8 +2653,8 @@ class CmdTag(COMMAND_DEFAULT_CLASS):
handles the tags of an object
Usage:
@tag[/del] <obj> [= <tag>[:<category>]]
@tag/search <tag>[:<category]
tag[/del] <obj> [= <tag>[:<category>]]
tag/search <tag>[:<category]
Switches:
search - return all objects with a given Tag
@ -2670,18 +2670,18 @@ class CmdTag(COMMAND_DEFAULT_CLASS):
enough to for most grouping schemes.
"""
key = "@tag"
aliases = ["@tags"]
key = "tag"
aliases = ["tags"]
options = ("search", "del")
locks = "cmd:perm(tag) or perm(Builder)"
help_category = "Building"
arg_regex = r"(/\w+?(\s|$))|\s|$"
def func(self):
"""Implement the @tag functionality"""
"""Implement the tag functionality"""
if not self.args:
self.caller.msg("Usage: @tag[/switches] <obj> [= <tag>[:<category>]]")
self.caller.msg("Usage: tag[/switches] <obj> [= <tag>[:<category>]]")
return
if "search" in self.switches:
# search by tag
@ -2777,17 +2777,17 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
spawn objects from prototype
Usage:
@spawn[/noloc] <prototype_key>
@spawn[/noloc] <prototype_dict>
spawn[/noloc] <prototype_key>
spawn[/noloc] <prototype_dict>
@spawn/search [prototype_keykey][;tag[,tag]]
@spawn/list [tag, tag, ...]
@spawn/show [<prototype_key>]
@spawn/update <prototype_key>
spawn/search [prototype_keykey][;tag[,tag]]
spawn/list [tag, tag, ...]
spawn/show [<prototype_key>]
spawn/update <prototype_key>
@spawn/save <prototype_dict>
@spawn/edit [<prototype_key>]
@olc - equivalent to @spawn/edit
spawn/save <prototype_dict>
spawn/edit [<prototype_key>]
olc - equivalent to spawn/edit
Switches:
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.
Example:
@spawn GOBLIN
@spawn {"key":"goblin", "typeclass":"monster.Monster", "location":"#2"}
@spawn/save {"key": "grunt", prototype: "goblin"};;mobs;edit:all()
spawn GOBLIN
spawn {"key":"goblin", "typeclass":"monster.Monster", "location":"#2"}
spawn/save {"key": "grunt", prototype: "goblin"};;mobs;edit:all()
\f
Dictionary keys:
|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.
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.
"""
key = "@spawn"
key = "spawn"
aliases = ["olc"]
switch_options = ("noloc", "search", "list", "show", "examine", "save", "delete", "menu", "olc", "update", "edit")
locks = "cmd:perm(spawn) or perm(Builder)"
@ -2947,7 +2947,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
# store a prototype to the database store
if not self.args:
caller.msg(
"Usage: @spawn/save <key>[;desc[;tag,tag[,...][;lockstring]]] = <prototype_dict>")
"Usage: spawn/save <key>[;desc[;tag,tag[,...][;lockstring]]] = <prototype_dict>")
return
# handle rhs:
@ -3000,7 +3000,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
answer = yield(string)
if answer.lower() in ["n", "no"]:
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
n_updated = spawner.batch_update_objects_with_prototype(existing_objects, key)
caller.msg("{} objects were updated.".format(n_updated))
@ -3008,7 +3008,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
if not self.args:
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))
return

View file

@ -218,7 +218,7 @@ class CmdAllCom(COMMAND_DEFAULT_CLASS):
caller = self.caller
args = self.args
if not args:
self.execute_cmd("@channels")
self.execute_cmd("channels")
self.msg("(Usage: allcom on | off | who | destroy)")
return
@ -239,7 +239,7 @@ class CmdAllCom(COMMAND_DEFAULT_CLASS):
channels = [chan for chan in ChannelDB.objects.get_all_channels()
if chan.access(caller, 'control')]
for channel in channels:
self.execute_cmd("@cdestroy %s" % channel.key)
self.execute_cmd("cdestroy %s" % channel.key)
elif args == "who":
# run a who, listing the subscribers on visible channels.
string = "\n|CChannel subscriptions|n"
@ -260,16 +260,16 @@ class CmdChannels(COMMAND_DEFAULT_CLASS):
list all channels available to you
Usage:
@channels
@clist
channels
clist
comlist
Lists all channels available to you, whether you listen to them or not.
Use 'comlist' to only view your current channel subscriptions.
Use addcom/delcom to join and leave channels
"""
key = "@channels"
aliases = ["@clist", "comlist", "chanlist", "channellist", "all channels"]
key = "channels"
aliases = ["clist", "comlist", "chanlist", "channellist", "all channels"]
help_category = "Comms"
locks = "cmd: not pperm(channel_banned)"
@ -292,8 +292,8 @@ class CmdChannels(COMMAND_DEFAULT_CLASS):
if self.cmdstring == "comlist":
# just display the subscribed channels with no extra info
comtable = self.style_table("|wchannel|n", "|wmy aliases|n",
"|wdescription|n", align="l", maxwidth=_DEFAULT_WIDTH)
comtable = self.styled_table("|wchannel|n", "|wmy aliases|n",
"|wdescription|n", align="l", maxwidth=_DEFAULT_WIDTH)
for chan in subs:
clower = chan.key.lower()
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)
if nick and nick.value[3].lower() == clower),
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)
else:
# full listing (of channels caller is able to listen to)
comtable = self.style_table("|wsub|n", "|wchannel|n", "|wmy aliases|n",
"|wlocks|n", "|wdescription|n", maxwidth=_DEFAULT_WIDTH)
comtable = self.styled_table("|wsub|n", "|wchannel|n", "|wmy aliases|n",
"|wlocks|n", "|wdescription|n", maxwidth=_DEFAULT_WIDTH)
for chan in channels:
clower = chan.key.lower()
nicks = caller.nicks.get(category="channel", return_obj=True)
@ -336,12 +336,12 @@ class CmdCdestroy(COMMAND_DEFAULT_CLASS):
destroy a channel you created
Usage:
@cdestroy <channel>
cdestroy <channel>
Destroys a channel that you control.
"""
key = "@cdestroy"
key = "cdestroy"
help_category = "Comms"
locks = "cmd: not pperm(channel_banned)"
@ -353,7 +353,7 @@ class CmdCdestroy(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.args:
self.msg("Usage: @cdestroy <channelname>")
self.msg("Usage: cdestroy <channelname>")
return
channel = find_channel(caller, self.args)
if not channel:
@ -377,7 +377,7 @@ class CmdCBoot(COMMAND_DEFAULT_CLASS):
kick an account from a channel you control
Usage:
@cboot[/quiet] <channel> = <account> [:reason]
cboot[/quiet] <channel> = <account> [:reason]
Switch:
quiet - don't notify the channel
@ -386,7 +386,7 @@ class CmdCBoot(COMMAND_DEFAULT_CLASS):
"""
key = "@cboot"
key = "cboot"
switch_options = ("quiet",)
locks = "cmd: not pperm(channel_banned)"
help_category = "Comms"
@ -398,7 +398,7 @@ class CmdCBoot(COMMAND_DEFAULT_CLASS):
"""implement the function"""
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)
return
@ -444,7 +444,7 @@ class CmdCemit(COMMAND_DEFAULT_CLASS):
send an admin message to a channel you control
Usage:
@cemit[/switches] <channel> = <message>
cemit[/switches] <channel> = <message>
Switches:
sendername - attach the sender's name before the message
@ -456,8 +456,8 @@ class CmdCemit(COMMAND_DEFAULT_CLASS):
"""
key = "@cemit"
aliases = ["@cmsg"]
key = "cemit"
aliases = ["cmsg"]
switch_options = ("sendername", "quiet")
locks = "cmd: not pperm(channel_banned) and pperm(Player)"
help_category = "Comms"
@ -469,7 +469,7 @@ class CmdCemit(COMMAND_DEFAULT_CLASS):
"""Implement function"""
if not self.args or not self.rhs:
string = "Usage: @cemit[/switches] <channel> = <message>"
string = "Usage: cemit[/switches] <channel> = <message>"
self.msg(string)
return
channel = find_channel(self.caller, self.lhs)
@ -493,11 +493,11 @@ class CmdCWho(COMMAND_DEFAULT_CLASS):
show who is listening to a channel
Usage:
@cwho <channel>
cwho <channel>
List who is connected to a given channel you have access to.
"""
key = "@cwho"
key = "cwho"
locks = "cmd: not pperm(channel_banned)"
help_category = "Comms"
@ -508,7 +508,7 @@ class CmdCWho(COMMAND_DEFAULT_CLASS):
"""implement function"""
if not self.args:
string = "Usage: @cwho <channel>"
string = "Usage: cwho <channel>"
self.msg(string)
return
@ -529,12 +529,12 @@ class CmdChannelCreate(COMMAND_DEFAULT_CLASS):
create a new channel
Usage:
@ccreate <new channel>[;alias;alias...] = description
ccreate <new channel>[;alias;alias...] = description
Creates a new channel owned by you.
"""
key = "@ccreate"
key = "ccreate"
aliases = "channelcreate"
locks = "cmd:not pperm(channel_banned) and pperm(Player)"
help_category = "Comms"
@ -548,7 +548,7 @@ class CmdChannelCreate(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.args:
self.msg("Usage @ccreate <channelname>[;alias;alias..] = description")
self.msg("Usage ccreate <channelname>[;alias;alias..] = description")
return
description = ""
@ -581,15 +581,15 @@ class CmdClock(COMMAND_DEFAULT_CLASS):
change channel locks of a channel you control
Usage:
@clock <channel> [= <lockstring>]
clock <channel> [= <lockstring>]
Changes the lock access restrictions of a channel. If no
lockstring was given, view the current lock definitions.
"""
key = "@clock"
key = "clock"
locks = "cmd:not pperm(channel_banned)"
aliases = ["@clock"]
aliases = ["clock"]
help_category = "Comms"
# this is used by the COMMAND_DEFAULT_CLASS parent
@ -599,7 +599,7 @@ class CmdClock(COMMAND_DEFAULT_CLASS):
"""run the function"""
if not self.args:
string = "Usage: @clock channel [= lockstring]"
string = "Usage: clock channel [= lockstring]"
self.msg(string)
return
@ -634,13 +634,13 @@ class CmdCdesc(COMMAND_DEFAULT_CLASS):
describe a channel you control
Usage:
@cdesc <channel> = <description>
cdesc <channel> = <description>
Changes the description of the channel as shown in
channel lists.
"""
key = "@cdesc"
key = "cdesc"
locks = "cmd:not pperm(channel_banned)"
help_category = "Comms"
@ -653,7 +653,7 @@ class CmdCdesc(COMMAND_DEFAULT_CLASS):
caller = self.caller
if not self.rhs:
self.msg("Usage: @cdesc <channel> = <description>")
self.msg("Usage: cdesc <channel> = <description>")
return
channel = find_channel(caller, self.lhs)
if not channel:
@ -804,10 +804,12 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
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.
Args:
cmd (Command): Instance of the Bot command.
Returns:
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-")]
if ircbots:
from evennia.utils.evtable import EvTable
table = self.style_table("|w#dbref|n", "|wbotname|n", "|wev-channel|n",
"|wirc-channel|n", "|wSSL|n", maxwidth=_DEFAULT_WIDTH)
table = cmd.styled_table("|w#dbref|n", "|wbotname|n", "|wev-channel|n",
"|wirc-channel|n", "|wSSL|n", maxwidth=_DEFAULT_WIDTH)
for ircbot in ircbots:
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)
@ -830,8 +832,8 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
link an evennia channel to an external IRC channel
Usage:
@irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>[:typeclass]
@irc2chan/delete botname|#dbid
irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>[:typeclass]
irc2chan/delete botname|#dbid
Switches:
/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
Example:
@irc2chan myircchan = irc.dalnet.net 6667 #mychannel evennia-bot
@irc2chan public = irc.freenode.net 6667 #evgaming #evbot:accounts.mybot.MyBot
irc2chan myircchan = irc.dalnet.net 6667 #mychannel evennia-bot
irc2chan public = irc.freenode.net 6667 #evgaming #evbot:accounts.mybot.MyBot
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
@ -852,11 +854,11 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
IRC channel and vice versa. The bot will automatically connect at
server start, so this command need only be given once. The
/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.
"""
key = "@irc2chan"
key = "irc2chan"
switch_options = ("delete", "remove", "disconnect", "list", "ssl")
locks = "cmd:serversetting(IRC_ENABLED) and pperm(Developer)"
help_category = "Comms"
@ -871,7 +873,7 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
if 'list' in self.switches:
# show all connections
self.msg(_list_bots())
self.msg(_list_bots(self))
return
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
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]"
self.msg(string)
return
@ -941,7 +943,7 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
ircstatus [#dbref ping||nicklist||reconnect]
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
(aliases are 'who' and 'users') will return a list of users on the
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.
"""
key = "@ircstatus"
key = "ircstatus"
locks = "cmd:serversetting(IRC_ENABLED) and perm(ircstatus) or perm(Builder))"
help_category = "Comms"
@ -959,12 +961,12 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
"""Handles the functioning of the command."""
if not self.args:
self.msg(_list_bots())
self.msg(_list_bots(self))
return
# should always be on the form botname option
args = self.args.split()
if len(args) != 2:
self.msg("Usage: @ircstatus [#dbref ping||nicklist||reconnect]")
self.msg("Usage: ircstatus [#dbref ping||nicklist||reconnect]")
return
botname, option = args
if option not in ("ping", "users", "reconnect", "nicklist", "who"):
@ -974,7 +976,7 @@ class CmdIRCStatus(COMMAND_DEFAULT_CLASS):
if utils.dbref(botname):
matches = AccountDB.objects.filter(db_is_bot=True, id=utils.dbref(botname))
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
ircbot = matches[0]
channel = ircbot.db.irc_channel
@ -1004,7 +1006,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
link an evennia channel to an external RSS feed
Usage:
@rss2chan[/switches] <evennia_channel> = <rss_url>
rss2chan[/switches] <evennia_channel> = <rss_url>
Switches:
/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
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
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.
"""
key = "@rss2chan"
key = "rss2chan"
switch_options = ("disconnect", "remove", "list")
locks = "cmd:serversetting(RSS_ENABLED) and pperm(Developer)"
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-")]
if rssbots:
from evennia.utils.evtable import EvTable
table = self.style_table("|wdbid|n", "|wupdate rate|n", "|wev-channel",
"|wRSS feed URL|n", border="cells", maxwidth=_DEFAULT_WIDTH)
table = self.styled_table("|wdbid|n", "|wupdate rate|n", "|wev-channel",
"|wRSS feed URL|n", border="cells", maxwidth=_DEFAULT_WIDTH)
for rssbot in rssbots:
table.add_row(rssbot.id, rssbot.db.rss_rate, rssbot.db.ev_channel, rssbot.db.rss_url)
self.msg(table)
@ -1074,7 +1076,7 @@ class CmdRSS2Chan(COMMAND_DEFAULT_CLASS):
return
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)
return
channel = self.lhs

View file

@ -96,10 +96,10 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
Examples:
nick hi = say Hello, I'm Sarah!
nick/object tom = the tall man
nick build $1 $2 = @create/drop $1;$2
nick tell $1 $2=@page $1=$2
nick tm?$1=@page tallman=$1
nick tm\=$1=@page tallman=$1
nick build $1 $2 = create/drop $1;$2
nick tell $1 $2=page $1=$2
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.
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
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"
@ -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="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:
string = "|wNo nicks defined.|n"
else:
table = self.style_table("#", "Type", "Nick match", "Replacement")
table = self.styled_table("#", "Type", "Nick match", "Replacement")
for inum, nickobj in enumerate(nicklist):
_, _, nickvalue, replacement = nickobj.value
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:
string = "You are not carrying anything."
else:
table = self.style_table(border="header")
table = self.styled_table(border="header")
for item in items:
table.add_row("|C%s|n" % item.name, item.db.desc or "")
string = "|wYou are carrying:\n%s" % table

View file

@ -295,7 +295,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
Edit the help database.
Usage:
@help[/switches] <topic>[[;alias;alias][,category[,locks]] [= <text>]
help[/switches] <topic>[[;alias;alias][,category[,locks]] [= <text>]
Switches:
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.
Examples:
@sethelp throw = This throws something at ...
@sethelp/append pickpocketing,Thievery = This steals ...
@sethelp/replace pickpocketing, ,attr(is_thief) = This steals ...
@sethelp/edit thievery
sethelp throw = This throws something at ...
sethelp/append pickpocketing,Thievery = This steals ...
sethelp/replace pickpocketing, ,attr(is_thief) = This steals ...
sethelp/edit thievery
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
@ -316,7 +316,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
is to let everyone read the help file.
"""
key = "@sethelp"
key = "sethelp"
switch_options = ("edit", "replace", "append", "extend", "delete")
locks = "cmd:perm(Helper)"
help_category = "Building"
@ -328,7 +328,7 @@ class CmdSetHelp(COMMAND_DEFAULT_CLASS):
lhslist = self.lhslist
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
nlist = len(lhslist)

View file

@ -41,14 +41,14 @@ class CmdReload(COMMAND_DEFAULT_CLASS):
reload the server
Usage:
@reload [reason]
reload [reason]
This restarts the server. The Portal is not
affected. Non-persistent scripts will survive a @reload (use
@reset to purge) and at_reload() hooks will be called.
affected. Non-persistent scripts will survive a reload (use
reset to purge) and at_reload() hooks will be called.
"""
key = "@reload"
aliases = ['@restart']
key = "reload"
aliases = ['restart']
locks = "cmd:perm(reload) or perm(Developer)"
help_category = "System"
@ -68,23 +68,23 @@ class CmdReset(COMMAND_DEFAULT_CLASS):
reset and reboot the server
Usage:
@reset
reset
Notes:
For normal updating you are recommended to use @reload rather
than this command. Use @shutdown for a complete stop of
For normal updating you are recommended to use reload rather
than this command. Use shutdown for a complete stop of
everything.
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
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,
cmdsets etc will be wiped.
"""
key = "@reset"
aliases = ['@reboot']
key = "reset"
aliases = ['reboot']
locks = "cmd:perm(reload) or perm(Developer)"
help_category = "System"
@ -102,11 +102,11 @@ class CmdShutdown(COMMAND_DEFAULT_CLASS):
stop the server completely
Usage:
@shutdown [announcement]
shutdown [announcement]
Gracefully shut down both Server and Portal.
"""
key = "@shutdown"
key = "shutdown"
locks = "cmd:perm(shutdown) or perm(Developer)"
help_category = "System"
@ -226,8 +226,8 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
execute a snippet of python code
Usage:
@py <cmd>
@py/edit
py <cmd>
py/edit
Switches:
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
execution time).
Available variables in @py environment:
Available variables in py environment:
self, me : caller
here : caller.location
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
the `__doc__` property on entities:
@py evennia.__doc__
@py evennia.managers.__doc__
py evennia.__doc__
py evennia.managers.__doc__
|rNote: In the wrong hands this command is a severe security risk.
It should only be accessible by trusted server admins/superusers.|n
"""
key = "@py"
key = "py"
aliases = ["!"]
switch_options = ("time", "edit", "clientraw")
locks = "cmd:perm(py) or perm(Developer)"
@ -277,7 +277,7 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
return
if not pycode:
string = "Usage: @py <code>"
string = "Usage: py <code>"
self.msg(string)
return
@ -326,7 +326,7 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
list and manage all running scripts
Usage:
@scripts[/switches] [#dbref, key, script.path or <obj>]
scripts[/switches] [#dbref, key, script.path or <obj>]
Switches:
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
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"
aliases = ["@globalscript", "@listscripts"]
key = "scripts"
aliases = ["globalscript", "listscripts"]
switch_options = ("start", "stop", "kill", "validate")
locks = "cmd:perm(listscripts) or perm(Admin)"
help_category = "System"
@ -419,14 +419,14 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
statistics on objects in the database
Usage:
@objects [<nr>]
objects [<nr>]
Gives statictics on objects in database as well as
a list of <nr> latest objects in database. If not
given, <nr> defaults to 10.
"""
key = "@objects"
aliases = ["@listobjects", "@listobjs", '@stats', '@db']
key = "objects"
aliases = ["listobjects", "listobjs", 'stats', 'db']
locks = "cmd:perm(listobjects) or perm(Builder)"
help_category = "System"
@ -446,7 +446,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
nobjs = nobjs or 1 # fix zero-div error with empty database
# 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")
totaltable.align = 'l'
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))
# 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")
typetable.align = 'l'
dbtotals = ObjectDB.objects.object_totals()
@ -467,7 +467,7 @@ class CmdObjects(COMMAND_DEFAULT_CLASS):
# last N table
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")
latesttable.align = 'l'
for obj in objs:
@ -485,8 +485,8 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
Manage registered accounts
Usage:
@accounts [nr]
@accounts/delete <name or #id> [: reason]
accounts [nr]
accounts/delete <name or #id> [: reason]
Switches:
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
If not given, <nr> defaults to 10.
"""
key = "@accounts"
aliases = ["@account", "@listaccounts"]
key = "accounts"
aliases = ["account", "listaccounts"]
switch_options = ("delete", )
locks = "cmd:perm(listaccounts) or perm(Admin)"
help_category = "System"
@ -513,7 +513,7 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
caller.msg("You are not allowed to delete accounts.")
return
if not args:
caller.msg("Usage: @accounts/delete <name or #id> [: reason]")
caller.msg("Usage: accounts/delete <name or #id> [: reason]")
return
reason = ""
if ":" in args:
@ -564,12 +564,12 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
# typeclass table
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():
typetable.add_row(path, count, "%.2f" % ((float(count) / naccounts) * 100))
# last N table
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:
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
Usage:
@service[/switch] <service>
service[/switch] <service>
Switches:
list - shows all available services (default)
@ -598,8 +598,8 @@ class CmdService(COMMAND_DEFAULT_CLASS):
in the list.
"""
key = "@service"
aliases = ["@services"]
key = "service"
aliases = ["services"]
switch_options = ("list", "start", "stop", "delete")
locks = "cmd:perm(service) or perm(Developer)"
help_category = "System"
@ -611,7 +611,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
switches = self.switches
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
# get all services
@ -620,7 +620,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
if not switches or switches[0] == "list":
# Just display the list of installed services and their
# 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:
table.add_row(service.name, service.running and "|gRunning" or "|rNot Running")
caller.msg(str(table))
@ -632,7 +632,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
service = service_collection.getServiceNamed(self.args)
except Exception:
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)
return
@ -677,13 +677,13 @@ class CmdAbout(COMMAND_DEFAULT_CLASS):
show Evennia info
Usage:
@about
about
Display info about the game engine.
"""
key = "@about"
aliases = "@version"
key = "about"
aliases = "version"
locks = "cmd:all()"
help_category = "System"
@ -718,26 +718,26 @@ class CmdTime(COMMAND_DEFAULT_CLASS):
show server time statistics
Usage:
@time
time
List Server time statistics such as uptime
and the current time stamp.
"""
key = "@time"
aliases = "@uptime"
key = "time"
aliases = "uptime"
locks = "cmd:perm(time) or perm(Player)"
help_category = "System"
def func(self):
"""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("Portal uptime", utils.time_format(gametime.portal_uptime(), 3))
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("Current time", datetime.datetime.now())
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")
table2.add_row(epochtxt, datetime.datetime.fromtimestamp(gametime.game_epoch()))
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
Usage:
@server[/mem]
server[/mem]
Switches:
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.
"""
key = "@server"
aliases = ["@serverload", "@serverprocess"]
key = "server"
aliases = ["serverload", "serverprocess"]
switch_options = ("mem", "flushmem")
locks = "cmd:perm(list) or perm(Developer)"
help_category = "System"
@ -831,7 +831,7 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
self.caller.msg(string % (rmem, pmem))
return
# 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 computer memory usage", "%g MB (%g%%)" % (rmem, pmem))
loadtable.add_row("Process ID", "%g" % pid),
@ -857,7 +857,7 @@ class CmdServerLoad(COMMAND_DEFAULT_CLASS):
self.caller.msg(string % (rmem, pmem, vmem))
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("Process ID", "%g" % pid),
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()
sorted_cache = sorted([(key, num) for key, num in cachedict.items() if num > 0],
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:
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
Usage:
@tickers
tickers
Note: Tickers are created, stopped and manipulated in Python code
using the TickerHandler. This is merely a convenience function for
inspecting the current status.
"""
key = "@tickers"
key = "tickers"
help_category = "System"
locks = "cmd:perm(tickers) or perm(Builder)"
@ -914,7 +914,7 @@ class CmdTickers(COMMAND_DEFAULT_CLASS):
if not all_subs:
self.caller.msg("No tickers are currently active.")
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:
table.add_row(sub[3],
"%s%s" % (sub[0] or "[None]",

View file

@ -290,7 +290,7 @@ class TestAccount(CommandTest):
def test_char_create(self):
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):
# 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.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')")
self.call(building.CmdMvAttr(), "", "Usage: ")
self.call(building.CmdMvAttr(), "Obj2/test2 = Obj/test3", "Moved Obj2.test2 -> Obj.test3")
@ -473,7 +473,7 @@ class TestBuilding(CommandTest):
def test_tunnel(self):
self.call(building.CmdTunnel(), "n = TestRoom2;test2", "Created room TestRoom2")
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")
DefaultRoom.objects.get_family(db_key="TestRoom3")
exits = DefaultExit.objects.filter_family(db_key__in=("east", "west"))
@ -529,7 +529,7 @@ class TestBuilding(CommandTest):
"to evennia.objects.objects.DefaultExit.")
self.call(building.CmdTypeclass(), "Obj2 = evennia.objects.objects.DefaultExit",
"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(), "/show Obj", "Obj's current typeclass is '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",
"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.",
cmdstring="@update")
cmdstring="update")
self.call(building.CmdTypeclass(), "/reset/force Obj=evennia.objects.objects.DefaultObject",
"Obj updated its existing typeclass (evennia.objects.objects.DefaultObject).\n"
"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(), "/view Obj = edit:false()",
"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 = edit:false()")
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
"locate: Ambiguous switch supplied: Did you mean /exit or /exact?|",
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(), "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(), 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 = scripts.Script", "Script scripts.Script successfully added")
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(), "/start Obj", "0 scripts started on Obj") # because it's already started
@ -655,10 +655,10 @@ class TestBuilding(CommandTest):
commandTest.assertIsNotNone(obj)
return obj
# Tests "@spawn" without any arguments.
self.call(building.CmdSpawn(), " ", "Usage: @spawn")
# Tests "spawn" without any arguments.
self.call(building.CmdSpawn(), " ", "Usage: spawn")
# Tests "@spawn <prototype_dictionary>" without specifying location.
# Tests "spawn <prototype_dictionary>" without specifying location.
self.call(building.CmdSpawn(),
"/save {'prototype_key': 'testprot', 'key':'Test Char', "
@ -682,7 +682,7 @@ class TestBuilding(CommandTest):
self.assertEqual(testchar.location, self.char1.location)
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
if spawnLoc == self.char1.location:
# 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',
'prototype_key': 'testball'})
# Tests "@spawn <prototype_name>"
# Tests "spawn <prototype_name>"
self.call(building.CmdSpawn(), "testball", "Spawned Ball")
ball = getObject(self, "Ball")
@ -712,7 +712,7 @@ class TestBuilding(CommandTest):
self.assertIsInstance(ball, DefaultObject)
ball.delete()
# Tests "@spawn/n ..." without specifying a location.
# Tests "spawn/n ..." without specifying a location.
# Location should be "None".
self.call(building.CmdSpawn(), "/n 'BALL'", "Spawned Ball") # /n switch is abbreviated form of /noloc
ball = getObject(self, "Ball")
@ -723,7 +723,7 @@ class TestBuilding(CommandTest):
"/noloc {'prototype_parent':'TESTBALL', 'prototype_key': 'testball', 'location':'%s'}"
% 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.
self.call(building.CmdSpawn(),
"/noloc {'prototype_parent':'TESTBALL', 'key': 'Ball', 'prototype_key': 'foo', 'location':'%s'}"
@ -738,14 +738,14 @@ class TestBuilding(CommandTest):
# Test listing commands
self.call(building.CmdSpawn(), "/list", "Key ")
# @spawn/edit (missing prototype)
# spawn/edit (missing prototype)
# brings up olc menu
msg = self.call(
building.CmdSpawn(),
'/edit')
assert 'Prototype wizard' in msg
# @spawn/edit with valid prototype
# spawn/edit with valid prototype
# brings up olc menu loaded with prototype
msg = self.call(
building.CmdSpawn(),
@ -759,34 +759,34 @@ class TestBuilding(CommandTest):
and 'Ball' == self.char1.ndb._menutree.olc_prototype['key']
assert 'Ball' in msg and 'testball' in msg
# @spawn/edit with valid prototype (synomym)
# spawn/edit with valid prototype (synomym)
msg = self.call(
building.CmdSpawn(),
'/edit BALL')
assert 'Prototype wizard' in msg
assert 'Ball' in msg and 'testball' in msg
# @spawn/edit with invalid prototype
# spawn/edit with invalid prototype
msg = self.call(
building.CmdSpawn(),
'/edit NO_EXISTS',
"No prototype 'NO_EXISTS' was found.")
# @spawn/examine (missing prototype)
# spawn/examine (missing prototype)
# lists all prototypes that exist
msg = self.call(
building.CmdSpawn(),
'/examine')
assert 'testball' in msg and 'testprot' in msg
# @spawn/examine with valid prototype
# spawn/examine with valid prototype
# prints the prototype
msg = self.call(
building.CmdSpawn(),
'/examine BALL')
assert 'Ball' in msg and 'testball' in msg
# @spawn/examine with invalid prototype
# spawn/examine with invalid prototype
# shows error
self.call(
building.CmdSpawn(),
@ -836,7 +836,7 @@ class TestComms(CommandTest):
def test_cboot(self):
# 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):
self.call(comms.CmdCdestroy(), "testchan",

View file

@ -311,7 +311,7 @@ class CmdUnconnectedEncoding(COMMAND_DEFAULT_CLASS):
"""
key = "encoding"
aliases = ("@encoding", "@encode")
aliases = ("encode")
locks = "cmd:all()"
def func(self):
@ -337,7 +337,7 @@ class CmdUnconnectedEncoding(COMMAND_DEFAULT_CLASS):
pencoding = self.session.protocol_flags.get("ENCODING", None)
string = ""
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
if 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
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"
aliases = "@screenreader"
def func(self):
"""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 not new_character.db.desc:
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
except Exception as 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
# `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 = {
'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.
OPTION_CLASS_MODULES = ['evennia.utils.optionclasses', ]
# 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
# added earlier.
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
# an erroneous import inside the module as well). This is the
# trivial way to do it ...
if str(ex) != "Import by filename is not supported.":
if not str(ex).startswith("No module named "):
raise
# error in this module. Try absolute path import instead