Add fstrings
Extend usage of fstrings for consistency and readability.
This commit is contained in:
parent
5423ee238c
commit
9113ad273e
6 changed files with 169 additions and 265 deletions
|
|
@ -169,7 +169,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
|
||||||
# check if this Character already exists. Note that we are only
|
# check if this Character already exists. Note that we are only
|
||||||
# searching the base character typeclass here, not any child
|
# searching the base character typeclass here, not any child
|
||||||
# classes.
|
# classes.
|
||||||
self.msg("|rA character named '|w%s|r' already exists.|n" % key)
|
self.msg(f"|rA character named '|w{key}|r' already exists.|n")
|
||||||
return
|
return
|
||||||
|
|
||||||
# create the character
|
# create the character
|
||||||
|
|
@ -190,12 +190,10 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
|
||||||
elif not new_character.db.desc:
|
elif not new_character.db.desc:
|
||||||
new_character.db.desc = "This is a character."
|
new_character.db.desc = "This is a character."
|
||||||
self.msg(
|
self.msg(
|
||||||
"Created new character %s. Use |wic %s|n to enter the game as this character."
|
f"Created new character {new_character.key}. Use |wic {new_character.key}|n to enter the game as this character."
|
||||||
% (new_character.key, new_character.key)
|
|
||||||
)
|
)
|
||||||
logger.log_sec(
|
logger.log_sec(
|
||||||
"Character Created: %s (Caller: %s, IP: %s)."
|
f"Character Created: {new_character} (Caller: {account}, IP: {self.session.address})."
|
||||||
% (new_character, account, self.session.address)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -248,10 +246,9 @@ class CmdCharDelete(COMMAND_DEFAULT_CLASS):
|
||||||
pc for pc in caller.db._playable_characters if pc != delobj
|
pc for pc in caller.db._playable_characters if pc != delobj
|
||||||
]
|
]
|
||||||
delobj.delete()
|
delobj.delete()
|
||||||
self.msg("Character '%s' was permanently deleted." % key)
|
self.msg(f"Character '{key}' was permanently deleted.")
|
||||||
logger.log_sec(
|
logger.log_sec(
|
||||||
"Character Deleted: %s (Caller: %s, IP: %s)."
|
f"Character Deleted: {key} (Caller: {account}, IP: {self.session.address})."
|
||||||
% (key, account, self.session.address)
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.msg("Deletion was aborted.")
|
self.msg("Deletion was aborted.")
|
||||||
|
|
@ -372,14 +369,12 @@ class CmdIC(COMMAND_DEFAULT_CLASS):
|
||||||
account.puppet_object(session, new_character)
|
account.puppet_object(session, new_character)
|
||||||
account.db._last_puppet = new_character
|
account.db._last_puppet = new_character
|
||||||
logger.log_sec(
|
logger.log_sec(
|
||||||
"Puppet Success: (Caller: %s, Target: %s, IP: %s)."
|
f"Puppet Success: (Caller: {account}, Target: {new_character}, IP: {self.session.address})."
|
||||||
% (account, new_character, self.session.address)
|
|
||||||
)
|
)
|
||||||
except RuntimeError as exc:
|
except RuntimeError as exc:
|
||||||
self.msg("|rYou cannot become |C%s|n: %s" % (new_character.name, exc))
|
self.msg(f"|rYou cannot become |C{new_character.name}|n: {exc}")
|
||||||
logger.log_sec(
|
logger.log_sec(
|
||||||
"Puppet Failed: %s (Caller: %s, Target: %s, IP: %s)."
|
f"Puppet Failed: %s (Caller: {account}, Target: {new_character}, IP: {self.session.address})."
|
||||||
% (exc, account, new_character, self.session.address)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -432,7 +427,7 @@ class CmdOOC(MuxAccountLookCommand):
|
||||||
self.msg(account.at_look(target=self.playable, session=session))
|
self.msg(account.at_look(target=self.playable, session=session))
|
||||||
|
|
||||||
except RuntimeError as exc:
|
except RuntimeError as exc:
|
||||||
self.msg("|rCould not unpuppet from |c%s|n: %s" % (old_char, exc))
|
self.msg(f"|rCould not unpuppet from |c{old_char}|n: {exc}")
|
||||||
|
|
||||||
|
|
||||||
class CmdSessions(COMMAND_DEFAULT_CLASS):
|
class CmdSessions(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
@ -469,7 +464,7 @@ class CmdSessions(COMMAND_DEFAULT_CLASS):
|
||||||
char and str(char) or "None",
|
char and str(char) or "None",
|
||||||
char and str(char.location) or "N/A",
|
char and str(char.location) or "N/A",
|
||||||
)
|
)
|
||||||
self.msg("|wYour current session(s):|n\n%s" % table)
|
self.msg(f"|wYour current session(s):|n\n{table}")
|
||||||
|
|
||||||
|
|
||||||
class CmdWho(COMMAND_DEFAULT_CLASS):
|
class CmdWho(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
@ -640,7 +635,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
row.append("%s%s" % (saved, changed))
|
row.append("%s%s" % (saved, changed))
|
||||||
table.add_row(*row)
|
table.add_row(*row)
|
||||||
self.msg("|wClient settings (%s):|n\n%s|n" % (self.session.protocol_key, table))
|
self.msg(f"|wClient settings ({self.session.protocal_key}):|n\n{table}|n")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -655,7 +650,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
||||||
try:
|
try:
|
||||||
codecs_lookup(new_encoding)
|
codecs_lookup(new_encoding)
|
||||||
except LookupError:
|
except LookupError:
|
||||||
raise RuntimeError("The encoding '|w%s|n' is invalid. " % new_encoding)
|
raise RuntimeError(f"The encoding '|w{new_encoding}|n' is invalid. ")
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def validate_size(new_size):
|
def validate_size(new_size):
|
||||||
|
|
@ -670,16 +665,13 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
||||||
old_val = flags.get(new_name, False)
|
old_val = flags.get(new_name, False)
|
||||||
new_val = validator(new_val)
|
new_val = validator(new_val)
|
||||||
if old_val == new_val:
|
if old_val == new_val:
|
||||||
self.msg("Option |w%s|n was kept as '|w%s|n'." % (new_name, old_val))
|
self.msg(f"Option |w{new_name}|n was kept as '|w{old_val}|n'.")
|
||||||
else:
|
else:
|
||||||
flags[new_name] = new_val
|
flags[new_name] = new_val
|
||||||
self.msg(
|
self.msg(f"Option |w{new_name}|n was changed from '|w{old_val}|n' to '|w{new_val}|n'.")
|
||||||
"Option |w%s|n was changed from '|w%s|n' to '|w%s|n'."
|
|
||||||
% (new_name, old_val, new_val)
|
|
||||||
)
|
|
||||||
return {new_name: new_val}
|
return {new_name: new_val}
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.msg("|rCould not set option |w%s|r:|n %s" % (new_name, err))
|
self.msg(f"|rCould not set option |w{new_name}|r:|n {err}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
validators = {
|
validators = {
|
||||||
|
|
@ -719,12 +711,12 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
|
||||||
saved_options.update(optiondict)
|
saved_options.update(optiondict)
|
||||||
self.account.attributes.add("_saved_protocol_flags", saved_options)
|
self.account.attributes.add("_saved_protocol_flags", saved_options)
|
||||||
for key in optiondict:
|
for key in optiondict:
|
||||||
self.msg("|gSaved option %s.|n" % key)
|
self.msg(f"|gSaved option {key}.|n")
|
||||||
if "clear" in self.switches:
|
if "clear" in self.switches:
|
||||||
# clear this save
|
# clear this save
|
||||||
for key in optiondict:
|
for key in optiondict:
|
||||||
self.account.attributes.get("_saved_protocol_flags", {}).pop(key, None)
|
self.account.attributes.get("_saved_protocol_flags", {}).pop(key, None)
|
||||||
self.msg("|gCleared saved %s." % key)
|
self.msg(f"|gCleared saved {key}.")
|
||||||
self.session.update_flags(**optiondict)
|
self.session.update_flags(**optiondict)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -767,10 +759,7 @@ class CmdPassword(COMMAND_DEFAULT_CLASS):
|
||||||
account.set_password(newpass)
|
account.set_password(newpass)
|
||||||
account.save()
|
account.save()
|
||||||
self.msg("Password changed.")
|
self.msg("Password changed.")
|
||||||
logger.log_sec(
|
logger.log_sec(f"Password Changed: {account} (Caller: {account}, IP: {self.session.address}).")
|
||||||
"Password Changed: %s (Caller: %s, IP: %s)."
|
|
||||||
% (account, account, self.session.address)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CmdQuit(COMMAND_DEFAULT_CLASS):
|
class CmdQuit(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
@ -997,27 +986,27 @@ class CmdQuell(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
if self.cmdstring in ("unquell", "unquell"):
|
if self.cmdstring in ("unquell", "unquell"):
|
||||||
if not account.attributes.get("_quell"):
|
if not account.attributes.get("_quell"):
|
||||||
self.msg("Already using normal Account permissions %s." % permstr)
|
self.msg(f"Already using normal Account permissions {permstr}.")
|
||||||
else:
|
else:
|
||||||
account.attributes.remove("_quell")
|
account.attributes.remove("_quell")
|
||||||
self.msg("Account permissions %s restored." % permstr)
|
self.msg(f"Account permissions {permstr} restored.")
|
||||||
else:
|
else:
|
||||||
if account.attributes.get("_quell"):
|
if account.attributes.get("_quell"):
|
||||||
self.msg("Already quelling Account %s permissions." % permstr)
|
self.msg(f"Already quelling Account {permstr} permissions.")
|
||||||
return
|
return
|
||||||
account.attributes.add("_quell", True)
|
account.attributes.add("_quell", True)
|
||||||
puppet = self.session.puppet if self.session else None
|
puppet = self.session.puppet if self.session else None
|
||||||
if puppet:
|
if puppet:
|
||||||
cpermstr = "(%s)" % ", ".join(puppet.permissions.all())
|
cpermstr = "(%s)" % ", ".join(puppet.permissions.all())
|
||||||
cpermstr = "Quelling to current puppet's permissions %s." % cpermstr
|
cpermstr = f"Quelling to current puppet's permissions {cpermstr}."
|
||||||
cpermstr += (
|
cpermstr += (
|
||||||
"\n(Note: If this is higher than Account permissions %s,"
|
f"\n(Note: If this is higher than Account permissions {permstr},"
|
||||||
" the lowest of the two will be used.)" % permstr
|
" the lowest of the two will be used.)"
|
||||||
)
|
)
|
||||||
cpermstr += "\nUse unquell to return to normal permission usage."
|
cpermstr += "\nUse unquell to return to normal permission usage."
|
||||||
self.msg(cpermstr)
|
self.msg(cpermstr)
|
||||||
else:
|
else:
|
||||||
self.msg("Quelling Account permissions%s. Use unquell to get them back." % permstr)
|
self.msg(f"Quelling Account permissions{permstr}. Use unquell to get them back.")
|
||||||
self._recache_locks(account)
|
self._recache_locks(account)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1058,4 +1047,4 @@ class CmdStyle(COMMAND_DEFAULT_CLASS):
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.msg(str(e))
|
self.msg(str(e))
|
||||||
return
|
return
|
||||||
self.msg("Style %s set to %s" % (self.lhs, result))
|
self.msg(f"Style {self.lhs} set to {result}")
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ class CmdSetObjAlias(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
caller.msg("No aliases exist for '%s'." % obj.get_display_name(caller))
|
caller.msg(f"No aliases exist for '{obj.get_display_name(caller)}'.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (obj.access(caller, "control") or obj.access(caller, "edit")):
|
if not (obj.access(caller, "control") or obj.access(caller, "edit")):
|
||||||
|
|
@ -350,13 +350,9 @@ class CmdCopy(ObjManipCommand):
|
||||||
new_aliases=to_obj_aliases,
|
new_aliases=to_obj_aliases,
|
||||||
)
|
)
|
||||||
if copiedobj:
|
if copiedobj:
|
||||||
string = "Copied %s to '%s' (aliases: %s)." % (
|
string = f"Copied {from_obj_name} to '{to_obj_name}' (aliases: {to_obj_aliases})."
|
||||||
from_obj_name,
|
|
||||||
to_obj_name,
|
|
||||||
to_obj_aliases,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
string = "There was an error copying %s to '%s'." % (from_obj_name, to_obj_name)
|
string = f"There was an error copying {from_obj_name} to '{to_obj_name}'."
|
||||||
# we are done, echo to user
|
# we are done, echo to user
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
||||||
|
|
@ -415,7 +411,7 @@ class CmdCpAttr(ObjManipCommand):
|
||||||
required and verify an object has an attribute.
|
required and verify an object has an attribute.
|
||||||
"""
|
"""
|
||||||
if not obj.attributes.has(attr):
|
if not obj.attributes.has(attr):
|
||||||
self.caller.msg("%s doesn't have an attribute %s." % (obj.name, attr))
|
self.caller.msg(f"{obj.name} doesn't have an attribute {attr}.")
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
@ -479,7 +475,7 @@ class CmdCpAttr(ObjManipCommand):
|
||||||
to_obj_attrs = to_obj["attrs"]
|
to_obj_attrs = to_obj["attrs"]
|
||||||
to_obj = caller.search(to_obj_name)
|
to_obj = caller.search(to_obj_name)
|
||||||
if not to_obj:
|
if not to_obj:
|
||||||
result.append("\nCould not find object '%s'" % to_obj_name)
|
result.append(f"\nCould not find object '{to_obj_name}'")
|
||||||
continue
|
continue
|
||||||
for inum, from_attr in enumerate(from_obj_attrs):
|
for inum, from_attr in enumerate(from_obj_attrs):
|
||||||
try:
|
try:
|
||||||
|
|
@ -495,13 +491,11 @@ class CmdCpAttr(ObjManipCommand):
|
||||||
if clear and not (from_obj == to_obj and from_attr == to_attr):
|
if clear and not (from_obj == to_obj and from_attr == to_attr):
|
||||||
from_obj.attributes.remove(from_attr)
|
from_obj.attributes.remove(from_attr)
|
||||||
result.append(
|
result.append(
|
||||||
"\nMoved %s.%s -> %s.%s. (value: %s)"
|
f"\nMoved {from_obj.name}.{from_attr} -> {to_obj_name}.{to_attr}. (value: {repr(value)})"
|
||||||
% (from_obj.name, from_attr, to_obj_name, to_attr, repr(value))
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
result.append(
|
result.append(
|
||||||
"\nCopied %s.%s -> %s.%s. (value: %s)"
|
f"\nCopied {from_obj.name}.{from_attr} -> {to_obj.name}.{to_attr}. (value: {repr(value)})"
|
||||||
% (from_obj.name, from_attr, to_obj_name, to_attr, repr(value))
|
|
||||||
)
|
)
|
||||||
caller.msg("".join(result))
|
caller.msg("".join(result))
|
||||||
|
|
||||||
|
|
@ -615,11 +609,9 @@ class CmdCreate(ObjManipCommand):
|
||||||
if not obj:
|
if not obj:
|
||||||
continue
|
continue
|
||||||
if aliases:
|
if aliases:
|
||||||
string = "You create a new %s: %s (aliases: %s)."
|
string = f"You create a new {obj.typename}: {obj.name} (aliases: {', '.join(aliases)})."
|
||||||
string = string % (obj.typename, obj.name, ", ".join(aliases))
|
|
||||||
else:
|
else:
|
||||||
string = "You create a new %s: %s."
|
string = f"You create a new {obj.typename}: {obj.name}."
|
||||||
string = string % (obj.typename, obj.name)
|
|
||||||
# set a default desc
|
# set a default desc
|
||||||
if not obj.db.desc:
|
if not obj.db.desc:
|
||||||
obj.db.desc = "You see nothing special."
|
obj.db.desc = "You see nothing special."
|
||||||
|
|
@ -681,7 +673,7 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
||||||
self.caller.msg("You don't have permission to edit the description of %s." % obj.key)
|
self.caller.msg(f"You don't have permission to edit the description of {obj.key}.")
|
||||||
return
|
return
|
||||||
|
|
||||||
self.caller.db.evmenu_target = obj
|
self.caller.db.evmenu_target = obj
|
||||||
|
|
@ -721,9 +713,9 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
|
||||||
desc = self.args
|
desc = self.args
|
||||||
if obj.access(self.caller, "control") or obj.access(self.caller, "edit"):
|
if obj.access(self.caller, "control") or obj.access(self.caller, "edit"):
|
||||||
obj.db.desc = desc
|
obj.db.desc = desc
|
||||||
caller.msg("The description was set on %s." % obj.get_display_name(caller))
|
caller.msg(f"The description was set on {obj.get_display_name(caller)}.")
|
||||||
else:
|
else:
|
||||||
caller.msg("You don't have permission to edit the description of %s." % obj.key)
|
caller.msg(f"You don't have permission to edit the description of {obj.key}.")
|
||||||
|
|
||||||
|
|
||||||
class CmdDestroy(COMMAND_DEFAULT_CLASS):
|
class CmdDestroy(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
@ -771,21 +763,20 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
|
||||||
# helper function for deleting a single object
|
# helper function for deleting a single object
|
||||||
string = ""
|
string = ""
|
||||||
if not obj.pk:
|
if not obj.pk:
|
||||||
string = "\nObject %s was already deleted." % obj.db_key
|
string = f"\nObject {obj.db_key} was already deleted."
|
||||||
else:
|
else:
|
||||||
objname = obj.name
|
objname = obj.name
|
||||||
if not (obj.access(caller, "control") or obj.access(caller, "delete")):
|
if not (obj.access(caller, "control") or obj.access(caller, "delete")):
|
||||||
return "\nYou don't have permission to delete %s." % objname
|
return f"\nYou don't have permission to delete {objname}."
|
||||||
if obj.account and "override" not in self.switches:
|
if obj.account and "override" not in self.switches:
|
||||||
return (
|
return (
|
||||||
"\nObject %s is controlled by an active account. Use /override to delete anyway."
|
f"\nObject {objname} is controlled by an active account. Use /override to delete anyway."
|
||||||
% objname
|
|
||||||
)
|
)
|
||||||
if obj.dbid == int(settings.DEFAULT_HOME.lstrip("#")):
|
if obj.dbid == int(settings.DEFAULT_HOME.lstrip("#")):
|
||||||
return (
|
return (
|
||||||
"\nYou are trying to delete |c%s|n, which is set as DEFAULT_HOME. "
|
f"\nYou are trying to delete |c{objname}|n, which is set as DEFAULT_HOME. "
|
||||||
"Re-point settings.DEFAULT_HOME to another "
|
"Re-point settings.DEFAULT_HOME to another "
|
||||||
"object before continuing." % objname
|
"object before continuing."
|
||||||
)
|
)
|
||||||
|
|
||||||
had_exits = hasattr(obj, "exits") and obj.exits
|
had_exits = hasattr(obj, "exits") and obj.exits
|
||||||
|
|
@ -798,15 +789,14 @@ class CmdDestroy(COMMAND_DEFAULT_CLASS):
|
||||||
okay = obj.delete()
|
okay = obj.delete()
|
||||||
if not okay:
|
if not okay:
|
||||||
string += (
|
string += (
|
||||||
"\nERROR: %s not deleted, probably because delete() returned False."
|
f"\nERROR: {objname} not deleted, probably because delete() returned False."
|
||||||
% objname
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
string += "\n%s was destroyed." % objname
|
string += f"\n{objname} was destroyed."
|
||||||
if had_exits:
|
if had_exits:
|
||||||
string += " Exits to and from %s were destroyed as well." % objname
|
string += f" Exits to and from {objname} were destroyed as well."
|
||||||
if had_objs:
|
if had_objs:
|
||||||
string += " Objects inside %s were moved to their homes." % objname
|
string += f" Objects inside {objname} were moved to their homes."
|
||||||
return string
|
return string
|
||||||
|
|
||||||
objs = []
|
objs = []
|
||||||
|
|
@ -936,12 +926,7 @@ class CmdDig(ObjManipCommand):
|
||||||
alias_string = ""
|
alias_string = ""
|
||||||
if new_room.aliases.all():
|
if new_room.aliases.all():
|
||||||
alias_string = " (%s)" % ", ".join(new_room.aliases.all())
|
alias_string = " (%s)" % ", ".join(new_room.aliases.all())
|
||||||
room_string = "Created room %s(%s)%s of type %s." % (
|
room_string = f"Created room {new_room}({new_room.dbref}){alias_string} of type {typeclass}."
|
||||||
new_room,
|
|
||||||
new_room.dbref,
|
|
||||||
alias_string,
|
|
||||||
typeclass,
|
|
||||||
)
|
|
||||||
|
|
||||||
# create exit to room
|
# create exit to room
|
||||||
|
|
||||||
|
|
@ -972,14 +957,7 @@ class CmdDig(ObjManipCommand):
|
||||||
alias_string = ""
|
alias_string = ""
|
||||||
if new_to_exit.aliases.all():
|
if new_to_exit.aliases.all():
|
||||||
alias_string = " (%s)" % ", ".join(new_to_exit.aliases.all())
|
alias_string = " (%s)" % ", ".join(new_to_exit.aliases.all())
|
||||||
exit_to_string = "\nCreated Exit from %s to %s: %s(%s)%s."
|
exit_to_string = "\nCreated Exit from {location.name} to {new_room.name}: {new_to_exit}({new_to_exit.dbref}){alias_string}."
|
||||||
exit_to_string = exit_to_string % (
|
|
||||||
location.name,
|
|
||||||
new_room.name,
|
|
||||||
new_to_exit,
|
|
||||||
new_to_exit.dbref,
|
|
||||||
alias_string,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create exit back from new room
|
# Create exit back from new room
|
||||||
|
|
||||||
|
|
@ -1006,15 +984,8 @@ class CmdDig(ObjManipCommand):
|
||||||
alias_string = ""
|
alias_string = ""
|
||||||
if new_back_exit.aliases.all():
|
if new_back_exit.aliases.all():
|
||||||
alias_string = " (%s)" % ", ".join(new_back_exit.aliases.all())
|
alias_string = " (%s)" % ", ".join(new_back_exit.aliases.all())
|
||||||
exit_back_string = "\nCreated Exit back from %s to %s: %s(%s)%s."
|
exit_back_string = f"\nCreated Exit back from {new_room.name} to {location.name}: {new_back_exit}({new_back_exit.dbref}){alias_string}."
|
||||||
exit_back_string = exit_back_string % (
|
caller.msg(f"{room_string}{exit_to_string}{exit_back_string}")
|
||||||
new_room.name,
|
|
||||||
location.name,
|
|
||||||
new_back_exit,
|
|
||||||
new_back_exit.dbref,
|
|
||||||
alias_string,
|
|
||||||
)
|
|
||||||
caller.msg("%s%s%s" % (room_string, exit_to_string, exit_back_string))
|
|
||||||
if new_room and "teleport" in self.switches:
|
if new_room and "teleport" in self.switches:
|
||||||
caller.move_to(new_room, move_type="teleport")
|
caller.move_to(new_room, move_type="teleport")
|
||||||
|
|
||||||
|
|
@ -1112,10 +1083,10 @@ class CmdTunnel(COMMAND_DEFAULT_CLASS):
|
||||||
telswitch = "/teleport"
|
telswitch = "/teleport"
|
||||||
backstring = ""
|
backstring = ""
|
||||||
if "oneway" not in self.switches:
|
if "oneway" not in self.switches:
|
||||||
backstring = ", %s;%s" % (backname, backshort)
|
backstring = f", {backname};{backshort}"
|
||||||
|
|
||||||
# build the string we will use to call dig
|
# build the string we will use to call dig
|
||||||
digstring = "dig%s %s = %s;%s%s" % (telswitch, roomname, exitname, exitshort, backstring)
|
digstring = f"dig{telswitch} {roomname} = {exitname};{exitshort}{backstring}"
|
||||||
self.execute_cmd(digstring)
|
self.execute_cmd(digstring)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1182,10 +1153,7 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
|
||||||
string = note % (obj.name, obj.dbref)
|
string = note % (obj.name, obj.dbref)
|
||||||
if "twoway" in self.switches:
|
if "twoway" in self.switches:
|
||||||
if not (target.location and obj.location):
|
if not (target.location and obj.location):
|
||||||
string = "To create a two-way link, %s and %s must both have a location" % (
|
string = f"To create a two-way link, {obj} and {target} must both have a location"
|
||||||
obj,
|
|
||||||
target,
|
|
||||||
)
|
|
||||||
string += " (i.e. they cannot be rooms, but should be exits)."
|
string += " (i.e. they cannot be rooms, but should be exits)."
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
return
|
return
|
||||||
|
|
@ -1193,15 +1161,10 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
|
||||||
string += note % (target.name, target.dbref)
|
string += note % (target.name, target.dbref)
|
||||||
obj.destination = target.location
|
obj.destination = target.location
|
||||||
target.destination = obj.location
|
target.destination = obj.location
|
||||||
string += "\nLink created %s (in %s) <-> %s (in %s) (two-way)." % (
|
string += f"\nLink created {obj.name} (in {obj.location}) <-> {target.name} (in {target.location}) (two-way)."
|
||||||
obj.name,
|
|
||||||
obj.location,
|
|
||||||
target.name,
|
|
||||||
target.location,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
obj.destination = target
|
obj.destination = target
|
||||||
string += "\nLink created %s -> %s (one way)." % (obj.name, target)
|
string += f"\nLink created {obj.name} -> {target} (one way)."
|
||||||
|
|
||||||
elif self.rhs is None:
|
elif self.rhs is None:
|
||||||
# this means that no = was given (otherwise rhs
|
# this means that no = was given (otherwise rhs
|
||||||
|
|
@ -1209,18 +1172,18 @@ class CmdLink(COMMAND_DEFAULT_CLASS):
|
||||||
# the home/destination on object
|
# the home/destination on object
|
||||||
dest = obj.destination
|
dest = obj.destination
|
||||||
if dest:
|
if dest:
|
||||||
string = "%s is an exit to %s." % (obj.name, dest.name)
|
string = f"{obj.name} is an exit to {dest.name}."
|
||||||
else:
|
else:
|
||||||
string = "%s is not an exit. Its home location is %s." % (obj.name, obj.home)
|
string = f"{obj.name} is not an exit. Its home location is {obj.home}."
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# We gave the command link 'obj = ' which means we want to
|
# We gave the command link 'obj = ' which means we want to
|
||||||
# clear destination.
|
# clear destination.
|
||||||
if obj.destination:
|
if obj.destination:
|
||||||
obj.destination = None
|
obj.destination = None
|
||||||
string = "Former exit %s no longer links anywhere." % obj.name
|
string = f"Former exit {obj.name} no longer links anywhere."
|
||||||
else:
|
else:
|
||||||
string = "%s had no destination to unlink." % obj.name
|
string = f"{obj.name} had no destination to unlink."
|
||||||
# give feedback
|
# give feedback
|
||||||
caller.msg(string.strip())
|
caller.msg(string.strip())
|
||||||
|
|
||||||
|
|
@ -1297,7 +1260,7 @@ class CmdSetHome(CmdLink):
|
||||||
if not home:
|
if not home:
|
||||||
string = "This object has no home location set!"
|
string = "This object has no home location set!"
|
||||||
else:
|
else:
|
||||||
string = "%s's current home is %s(%s)." % (obj, home, home.dbref)
|
string = f"{obj}'s current home is {home}({home.dbref})."
|
||||||
else:
|
else:
|
||||||
# set a home location
|
# set a home location
|
||||||
new_home = self.caller.search(self.rhs, global_search=True)
|
new_home = self.caller.search(self.rhs, global_search=True)
|
||||||
|
|
@ -1306,15 +1269,9 @@ class CmdSetHome(CmdLink):
|
||||||
old_home = obj.home
|
old_home = obj.home
|
||||||
obj.home = new_home
|
obj.home = new_home
|
||||||
if old_home:
|
if old_home:
|
||||||
string = "Home location of %s was changed from %s(%s) to %s(%s)." % (
|
string = f"Home location of {home} was changed from {old_home}({old_home.dbref} to {new_home}({new_home.dbref})."
|
||||||
obj,
|
|
||||||
old_home,
|
|
||||||
old_home.dbref,
|
|
||||||
new_home,
|
|
||||||
new_home.dbref,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
string = "Home location of %s was set to %s(%s)." % (obj, new_home, new_home.dbref)
|
string = f"Home location of {obj} was set to {new_home}({new_home.dbref})."
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1343,7 +1300,7 @@ class CmdListCmdSets(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
obj = caller
|
obj = caller
|
||||||
string = "%s" % obj.cmdset
|
string = f"{obj.cmdset}"
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1387,11 +1344,11 @@ class CmdName(ObjManipCommand):
|
||||||
caller.msg("No name defined!")
|
caller.msg("No name defined!")
|
||||||
return
|
return
|
||||||
if not (obj.access(caller, "control") or obj.access(caller, "edit")):
|
if not (obj.access(caller, "control") or obj.access(caller, "edit")):
|
||||||
caller.msg("You don't have right to edit this account %s." % obj)
|
caller.msg(f"You don't have right to edit this account {obj}.")
|
||||||
return
|
return
|
||||||
obj.username = newname
|
obj.username = newname
|
||||||
obj.save()
|
obj.save()
|
||||||
caller.msg("Account's name changed to '%s'." % newname)
|
caller.msg(f"Account's name changed to '{newname}'.")
|
||||||
return
|
return
|
||||||
# object search, also with *
|
# object search, also with *
|
||||||
obj = caller.search(objname)
|
obj = caller.search(objname)
|
||||||
|
|
@ -1407,7 +1364,7 @@ class CmdName(ObjManipCommand):
|
||||||
caller.msg("No names or aliases defined!")
|
caller.msg("No names or aliases defined!")
|
||||||
return
|
return
|
||||||
if not (obj.access(caller, "control") or obj.access(caller, "edit")):
|
if not (obj.access(caller, "control") or obj.access(caller, "edit")):
|
||||||
caller.msg("You don't have the right to edit %s." % obj)
|
caller.msg(f"You don't have the right to edit {obj}.")
|
||||||
return
|
return
|
||||||
# change the name and set aliases:
|
# change the name and set aliases:
|
||||||
if newname:
|
if newname:
|
||||||
|
|
@ -1419,7 +1376,7 @@ class CmdName(ObjManipCommand):
|
||||||
# fix for exits - we need their exit-command to change name too
|
# fix for exits - we need their exit-command to change name too
|
||||||
if obj.destination:
|
if obj.destination:
|
||||||
obj.flush_from_cache(force=True)
|
obj.flush_from_cache(force=True)
|
||||||
caller.msg("Object's name changed to '%s'%s." % (newname, astring))
|
caller.msg(f"Object's name changed to '{newname}'{astring}.")
|
||||||
|
|
||||||
|
|
||||||
class CmdOpen(ObjManipCommand):
|
class CmdOpen(ObjManipCommand):
|
||||||
|
|
@ -1463,25 +1420,20 @@ class CmdOpen(ObjManipCommand):
|
||||||
exit_obj = exit_obj[0]
|
exit_obj = exit_obj[0]
|
||||||
if not exit_obj.destination:
|
if not exit_obj.destination:
|
||||||
# we are trying to link a non-exit
|
# we are trying to link a non-exit
|
||||||
string = "'%s' already exists and is not an exit!\nIf you want to convert it "
|
caller.msg(f"'{exit_name}' already exists and is not an exit!\nIf you want to convert it "
|
||||||
string += (
|
|
||||||
"to an exit, you must assign an object to the 'destination' property first."
|
"to an exit, you must assign an object to the 'destination' property first."
|
||||||
)
|
)
|
||||||
caller.msg(string % exit_name)
|
|
||||||
return None
|
return None
|
||||||
# we are re-linking an old exit.
|
# we are re-linking an old exit.
|
||||||
old_destination = exit_obj.destination
|
old_destination = exit_obj.destination
|
||||||
if old_destination:
|
if old_destination:
|
||||||
string = "Exit %s already exists." % exit_name
|
string = f"Exit {exit_name} already exists."
|
||||||
if old_destination.id != destination.id:
|
if old_destination.id != destination.id:
|
||||||
# reroute the old exit.
|
# reroute the old exit.
|
||||||
exit_obj.destination = destination
|
exit_obj.destination = destination
|
||||||
if exit_aliases:
|
if exit_aliases:
|
||||||
[exit_obj.aliases.add(alias) for alias in exit_aliases]
|
[exit_obj.aliases.add(alias) for alias in exit_aliases]
|
||||||
string += " Rerouted its old destination '%s' to '%s' and changed aliases." % (
|
string += f" Rerouted its old destination '{old_destination.name}' to '{destination.name}' and changed aliases."
|
||||||
old_destination.name,
|
|
||||||
destination.name,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
string += " It already points to the correct place."
|
string += " It already points to the correct place."
|
||||||
|
|
||||||
|
|
@ -1506,14 +1458,9 @@ class CmdOpen(ObjManipCommand):
|
||||||
if not exit_aliases
|
if not exit_aliases
|
||||||
else " (aliases: %s)" % (", ".join([str(e) for e in exit_aliases]))
|
else " (aliases: %s)" % (", ".join([str(e) for e in exit_aliases]))
|
||||||
)
|
)
|
||||||
string = "Created new Exit '%s' from %s to %s%s." % (
|
string = f"Created new Exit '{exit_name}' from {location.name} to {destination.name}{string}."
|
||||||
exit_name,
|
|
||||||
location.name,
|
|
||||||
destination.name,
|
|
||||||
string,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
string = "Error: Exit '%s' not created." % exit_name
|
string = f"Error: Exit '{exit.name}' not created."
|
||||||
# emit results
|
# emit results
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
return exit_obj
|
return exit_obj
|
||||||
|
|
@ -1596,13 +1543,13 @@ def _convert_from_string(cmd, strobj):
|
||||||
# treat as string
|
# treat as string
|
||||||
strobj = utils.to_str(strobj)
|
strobj = utils.to_str(strobj)
|
||||||
string = (
|
string = (
|
||||||
'|RNote: name "|r%s|R" was converted to a string. '
|
f'|RNote: name "|r{strobj}|R" was converted to a string. '
|
||||||
"Make sure this is acceptable." % strobj
|
"Make sure this is acceptable."
|
||||||
)
|
)
|
||||||
cmd.caller.msg(string)
|
cmd.caller.msg(string)
|
||||||
return strobj
|
return strobj
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
string = "|RUnknown error in evaluating Attribute: {}".format(err)
|
string = f"|RUnknown error in evaluating Attribute: {err}"
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1853,7 +1800,7 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
def save(caller, buf):
|
def save(caller, buf):
|
||||||
"""Called when editor saves its buffer."""
|
"""Called when editor saves its buffer."""
|
||||||
obj.attributes.add(attr, buf)
|
obj.attributes.add(attr, buf)
|
||||||
caller.msg("Saved Attribute %s." % attr)
|
caller.msg(f"Saved Attribute {attr}.")
|
||||||
|
|
||||||
# check non-strings before activating editor
|
# check non-strings before activating editor
|
||||||
try:
|
try:
|
||||||
|
|
@ -1931,7 +1878,7 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
if "edit" in self.switches:
|
if "edit" in self.switches:
|
||||||
# edit in the line editor
|
# edit in the line editor
|
||||||
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
||||||
caller.msg("You don't have permission to edit %s." % obj.key)
|
caller.msg(f"You don't have permission to edit {obj.key}.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(attrs) > 1:
|
if len(attrs) > 1:
|
||||||
|
|
@ -1963,7 +1910,7 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
else:
|
else:
|
||||||
# deleting the attribute(s)
|
# deleting the attribute(s)
|
||||||
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
||||||
caller.msg("You don't have permission to edit %s." % obj.key)
|
caller.msg(f"You don't have permission to edit {obj.key}.")
|
||||||
return
|
return
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
if not self.check_attr(obj, attr, category):
|
if not self.check_attr(obj, attr, category):
|
||||||
|
|
@ -1982,7 +1929,7 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
||||||
caller.msg("You don't have permission to edit %s." % obj.key)
|
caller.msg(f"You don't have permission to edit {obj.key}.")
|
||||||
return
|
return
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
if not self.check_attr(obj, attr, category):
|
if not self.check_attr(obj, attr, category):
|
||||||
|
|
@ -1997,7 +1944,7 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
or parsed_value.access(self.caller, "edit")
|
or parsed_value.access(self.caller, "edit")
|
||||||
):
|
):
|
||||||
caller.msg(
|
caller.msg(
|
||||||
"You don't have permission to set " f"object with identifier '{value}'."
|
f"You don't have permission to set object with identifier '{value}'."
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
value = parsed_value
|
value = parsed_value
|
||||||
|
|
@ -2166,21 +2113,17 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif not matches:
|
elif not matches:
|
||||||
caller.msg("No object or typeclass path found to match '{}'".format(oquery))
|
caller.msg(f"No object or typeclass path found to match '{oquery}'")
|
||||||
else:
|
else:
|
||||||
# one match found
|
# one match found
|
||||||
caller.msg(
|
caller.msg(f"Docstring for typeclass '{oquery}': \n{matches[0][1].__doc__}")
|
||||||
"Docstring for typeclass '{}':\n{}".format(oquery, matches[0][1].__doc__)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# do the search again to get the error handling in case of multi-match
|
# do the search again to get the error handling in case of multi-match
|
||||||
obj = caller.search(oquery)
|
obj = caller.search(oquery)
|
||||||
if not obj:
|
if not obj:
|
||||||
return
|
return
|
||||||
caller.msg(
|
caller.msg(
|
||||||
"{}'s current typeclass is '{}.{}'".format(
|
f"{obj.name}'s current typeclass is '{obj.__class__.__module__}.{obj.__class__.__name__}'"
|
||||||
obj.name, obj.__class__.__module__, obj.__class__.__name__
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -2211,14 +2154,13 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
prototype = prototype[0]
|
prototype = prototype[0]
|
||||||
else:
|
else:
|
||||||
# no match
|
# no match
|
||||||
caller.msg("No prototype '{}' was found.".format(key))
|
caller.msg(f"No prototype '{key}' was found.")
|
||||||
return
|
return
|
||||||
new_typeclass = prototype["typeclass"]
|
new_typeclass = prototype["typeclass"]
|
||||||
self.switches.append("force")
|
self.switches.append("force")
|
||||||
|
|
||||||
if "show" in self.switches or "examine" in self.switches:
|
if "show" in self.switches or "examine" in self.switches:
|
||||||
string = "%s's current typeclass is %s." % (obj.name, obj.__class__)
|
caller.msg(f"{obj.name}'s current typeclass is '{obj.__class__}'")
|
||||||
caller.msg(string)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.cmdstring in ("swap", "@swap"):
|
if self.cmdstring in ("swap", "@swap"):
|
||||||
|
|
@ -2267,8 +2209,7 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
diff, _ = spawner.prototype_diff_from_object(prototype, obj)
|
diff, _ = spawner.prototype_diff_from_object(prototype, obj)
|
||||||
txt = spawner.format_diff(diff)
|
txt = spawner.format_diff(diff)
|
||||||
prompt = (
|
prompt = (
|
||||||
"Applying prototype '%s' over '%s' will cause the follow changes:\n%s\n"
|
f"Applying prototype '{prototype['key']}' over '{obj.name}' will cause the follow changes:\n{txt}\n"
|
||||||
% (prototype["key"], obj.name, txt)
|
|
||||||
)
|
)
|
||||||
if not reset:
|
if not reset:
|
||||||
prompt += "\n|yWARNING:|n Use the /reset switch to apply the prototype over a blank state."
|
prompt += "\n|yWARNING:|n Use the /reset switch to apply the prototype over a blank state."
|
||||||
|
|
@ -2289,16 +2230,12 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
prototype_success = modified > 0
|
prototype_success = modified > 0
|
||||||
if not prototype_success:
|
if not prototype_success:
|
||||||
caller.msg("Prototype %s failed to apply." % prototype["key"])
|
caller.msg(f"Prototype {prototype['key']} failed to apply.")
|
||||||
|
|
||||||
if is_same:
|
if is_same:
|
||||||
string = "%s updated its existing typeclass (%s).\n" % (obj.name, obj.path)
|
string = f"{obj.name} updated its existing typeclass ({obj.path}).\n"
|
||||||
else:
|
else:
|
||||||
string = "%s changed typeclass from %s to %s.\n" % (
|
string = f"{obj.name} changed typeclass from {old_typeclass_path} to {obj.typeclass_path}.\n"
|
||||||
obj.name,
|
|
||||||
old_typeclass_path,
|
|
||||||
obj.typeclass_path,
|
|
||||||
)
|
|
||||||
if update:
|
if update:
|
||||||
string += "Only the at_object_creation hook was run (update mode)."
|
string += "Only the at_object_creation hook was run (update mode)."
|
||||||
else:
|
else:
|
||||||
|
|
@ -2309,8 +2246,7 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
|
||||||
string += " Attributes set before swap were not removed\n(use `swap` or `type/reset` to clear all)."
|
string += " Attributes set before swap were not removed\n(use `swap` or `type/reset` to clear all)."
|
||||||
if "prototype" in self.switches and prototype_success:
|
if "prototype" in self.switches and prototype_success:
|
||||||
string += (
|
string += (
|
||||||
" Prototype '%s' was successfully applied over the object type."
|
f" Prototype '{prototype['key']}' was successfully applied over the object type."
|
||||||
% prototype["key"]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
@ -2359,12 +2295,11 @@ class CmdWipe(ObjManipCommand):
|
||||||
if not attrs:
|
if not attrs:
|
||||||
# wipe everything
|
# wipe everything
|
||||||
obj.attributes.clear()
|
obj.attributes.clear()
|
||||||
string = "Wiped all attributes on %s." % obj.name
|
string = f"Wiped all attributes on {obj.name}."
|
||||||
else:
|
else:
|
||||||
for attrname in attrs:
|
for attrname in attrs:
|
||||||
obj.attributes.remove(attrname)
|
obj.attributes.remove(attrname)
|
||||||
string = "Wiped attributes %s on %s."
|
string = f"Wiped attributes {','.join(attrs)} on {obj.name}."
|
||||||
string = string % (",".join(attrs), obj.name)
|
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2445,7 +2380,7 @@ class CmdLock(ObjManipCommand):
|
||||||
else:
|
else:
|
||||||
string = lockdef
|
string = lockdef
|
||||||
else:
|
else:
|
||||||
string = "%s has no lock of access type '%s'." % (obj, access_type)
|
string = f"{obj} has no lock of access type '{access_type}'."
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -2454,9 +2389,9 @@ class CmdLock(ObjManipCommand):
|
||||||
if self.switches:
|
if self.switches:
|
||||||
swi = ", ".join(self.switches)
|
swi = ", ".join(self.switches)
|
||||||
caller.msg(
|
caller.msg(
|
||||||
"Switch(es) |w%s|n can not be used with a "
|
f"Switch(es) |w{swi}|n can not be used with a "
|
||||||
"lock assignment. Use e.g. "
|
"lock assignment. Use e.g. "
|
||||||
"|wlock/del objname/locktype|n instead." % swi
|
"|wlock/del objname/locktype|n instead."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -2484,7 +2419,7 @@ class CmdLock(ObjManipCommand):
|
||||||
# update on them unless their cmdsets are rebuilt.
|
# update on them unless their cmdsets are rebuilt.
|
||||||
obj.at_init()
|
obj.at_init()
|
||||||
if ok:
|
if ok:
|
||||||
caller.msg("Added lock '%s' to %s." % (lockdef, obj))
|
caller.msg(f"Added lock '{lockdef}' to {obj}.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# if we get here, we are just viewing all locks on obj
|
# if we get here, we are just viewing all locks on obj
|
||||||
|
|
@ -3167,14 +3102,12 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
|
||||||
if not result:
|
if not result:
|
||||||
string += "\n |RNo match found.|n"
|
string += "\n |RNo match found.|n"
|
||||||
elif not low <= int(result[0].id) <= high:
|
elif not low <= int(result[0].id) <= high:
|
||||||
string += "\n |RNo match found for '%s' in #dbref interval.|n" % searchstring
|
string += f"\n |RNo match found for '{searchstring}' in #dbref interval.|n"
|
||||||
else:
|
else:
|
||||||
result = result[0]
|
result = result[0]
|
||||||
string += "\n|g %s - %s|n" % (result.get_display_name(caller), result.path)
|
string += f"\n|g {result.get_display_name(caller)} - {result.path}|n"
|
||||||
if "loc" in self.switches and not is_account and result.location:
|
if "loc" in self.switches and not is_account and result.location:
|
||||||
string += " (|wlocation|n: |g{}|n)".format(
|
string += f" (|wlocation|n: |g{result.location.get_display_name(caller)}|n)"
|
||||||
result.location.get_display_name(caller)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Not an account/dbref search but a wider search; build a queryset.
|
# Not an account/dbref search but a wider search; build a queryset.
|
||||||
# Searches for key and aliases
|
# Searches for key and aliases
|
||||||
|
|
@ -3675,14 +3608,13 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
|
||||||
if obj_to_teleport.has_account:
|
if obj_to_teleport.has_account:
|
||||||
caller.msg(
|
caller.msg(
|
||||||
"Cannot teleport a puppeted object "
|
"Cannot teleport a puppeted object "
|
||||||
"(%s, puppeted by %s) to a None-location."
|
f"({obj_to_teleport.key}, puppeted by {obj_to_teleport.account}) to a None-location."
|
||||||
% (obj_to_teleport.key, obj_to_teleport.account)
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
caller.msg("Teleported %s -> None-location." % obj_to_teleport)
|
caller.msg(f"Teleported {obj_to_teleport} -> None-location.")
|
||||||
if obj_to_teleport.location and "quiet" not in self.switches:
|
if obj_to_teleport.location and "quiet" not in self.switches:
|
||||||
obj_to_teleport.location.msg_contents(
|
obj_to_teleport.location.msg_contents(
|
||||||
"%s teleported %s into nothingness." % (caller, obj_to_teleport), exclude=caller
|
f"{caller} teleported {obj_to_teleport} into nothingness.", exclude=caller
|
||||||
)
|
)
|
||||||
obj_to_teleport.location = None
|
obj_to_teleport.location = None
|
||||||
return
|
return
|
||||||
|
|
@ -3710,7 +3642,7 @@ class CmdTeleport(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
|
|
||||||
if obj_to_teleport.location and obj_to_teleport.location == destination:
|
if obj_to_teleport.location and obj_to_teleport.location == destination:
|
||||||
caller.msg("%s is already at %s." % (obj_to_teleport, destination))
|
caller.msg(f"{obj_to_teleport} is already at {destination}.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# check any locks
|
# check any locks
|
||||||
|
|
@ -3886,7 +3818,7 @@ class CmdTag(COMMAND_DEFAULT_CLASS):
|
||||||
", ".join(sorted("'%s'%s" % (tags[i], categories[i]) for i in range(ntags))),
|
", ".join(sorted("'%s'%s" % (tags[i], categories[i]) for i in range(ntags))),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
string = "No tags attached to %s." % obj
|
string = f"No tags attached to {obj}."
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4049,7 +3981,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS):
|
||||||
"funcparser callables ($funcs) in the strings."
|
"funcparser callables ($funcs) in the strings."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
string = "Expected {}, got {}.".format(expect, type(prototype))
|
string = f"Expected {expect}, got {type(prototype)}."
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,9 +221,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
_, _, old_nickstring, old_replstring = oldnick.value
|
_, _, old_nickstring, old_replstring = oldnick.value
|
||||||
caller.nicks.remove(old_nickstring, category=nicktype)
|
caller.nicks.remove(old_nickstring, category=nicktype)
|
||||||
caller.msg(
|
caller.msg(
|
||||||
"%s removed: '|w%s|n' -> |w%s|n."
|
f"{nicktypestr} removed: '|w{old_nickstring}|n' -> |w{old_replstring}|n.")
|
||||||
% (nicktypestr, old_nickstring, old_replstring)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
caller.msg("No matching nicks to remove.")
|
caller.msg("No matching nicks to remove.")
|
||||||
return
|
return
|
||||||
|
|
@ -245,12 +243,12 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
_, _, nick, repl = nick.value
|
_, _, nick, repl = nick.value
|
||||||
if nick.startswith(self.lhs):
|
if nick.startswith(self.lhs):
|
||||||
strings.append(
|
strings.append(
|
||||||
"{}-nick: '{}' -> '{}'".format(nicktype.capitalize(), nick, repl)
|
f"{nicktype.capitalize()}-nick: '{nick}' -> '{repl}'"
|
||||||
)
|
)
|
||||||
if strings:
|
if strings:
|
||||||
caller.msg("\n".join(strings))
|
caller.msg("\n".join(strings))
|
||||||
else:
|
else:
|
||||||
caller.msg("No nicks found matching '{}'".format(self.lhs))
|
caller.msg(f"No nicks found matching '{self,lhs}'")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.rhs and self.lhs:
|
if not self.rhs and self.lhs:
|
||||||
|
|
@ -268,12 +266,12 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
_, _, nick, repl = nick.value
|
_, _, nick, repl = nick.value
|
||||||
if nick.startswith(self.lhs):
|
if nick.startswith(self.lhs):
|
||||||
strings.append(
|
strings.append(
|
||||||
"{}-nick: '{}' -> '{}'".format(nicktype.capitalize(), nick, repl)
|
f"{nicktype.capitalize()}-nick: '{nick}' -> '{repl}'"
|
||||||
)
|
)
|
||||||
if strings:
|
if strings:
|
||||||
caller.msg("\n".join(strings))
|
caller.msg("\n".join(strings))
|
||||||
else:
|
else:
|
||||||
caller.msg("No nicks found matching '{}'".format(self.lhs))
|
caller.msg(f"No nicks found matching '{self.lhs}'")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.rhs and self.lhs:
|
if not self.rhs and self.lhs:
|
||||||
|
|
@ -291,12 +289,12 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
_, _, nick, repl = nick.value
|
_, _, nick, repl = nick.value
|
||||||
if nick.startswith(self.lhs):
|
if nick.startswith(self.lhs):
|
||||||
strings.append(
|
strings.append(
|
||||||
"{}-nick: '{}' -> '{}'".format(nicktype.capitalize(), nick, repl)
|
f"{nicktype.capitalize()}-nick: '{nick}' -> '{repl}'"
|
||||||
)
|
)
|
||||||
if strings:
|
if strings:
|
||||||
caller.msg("\n".join(strings))
|
caller.msg("\n".join(strings))
|
||||||
else:
|
else:
|
||||||
caller.msg("No nicks found matching '{}'".format(self.lhs))
|
caller.msg(f"No nicks found matching '{self.lhs}'")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.args or not self.lhs:
|
if not self.args or not self.lhs:
|
||||||
|
|
@ -316,7 +314,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
errstring = ""
|
errstring = ""
|
||||||
string = ""
|
string = ""
|
||||||
for nicktype in nicktypes:
|
for nicktype in nicktypes:
|
||||||
nicktypestr = "%s-nick" % nicktype.capitalize()
|
nicktypestr = f"{nicktype.capitalize()}-nick"
|
||||||
old_nickstring = None
|
old_nickstring = None
|
||||||
old_replstring = None
|
old_replstring = None
|
||||||
|
|
||||||
|
|
@ -328,19 +326,11 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
errstring = ""
|
errstring = ""
|
||||||
if oldnick:
|
if oldnick:
|
||||||
if replstring == old_replstring:
|
if replstring == old_replstring:
|
||||||
string += "\nIdentical %s already set." % nicktypestr.lower()
|
string += f"\nIdentical {nicktypestr.lower()} already set."
|
||||||
else:
|
else:
|
||||||
string += "\n%s '|w%s|n' updated to map to '|w%s|n'." % (
|
string += f"\n{nicktypestr} '|w{old_nickstring}|n' updated to map to '|w{replstring}|n'."
|
||||||
nicktypestr,
|
|
||||||
old_nickstring,
|
|
||||||
replstring,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
string += "\n%s '|w%s|n' mapped to '|w%s|n'." % (
|
string += f"\n{nicktypestr} '|w{nickstring}|n' mapped to '|w{replstring}|n'."
|
||||||
nicktypestr,
|
|
||||||
nickstring,
|
|
||||||
replstring,
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
caller.nicks.add(nickstring, replstring, category=nicktype)
|
caller.nicks.add(nickstring, replstring, category=nicktype)
|
||||||
except NickTemplateInvalid:
|
except NickTemplateInvalid:
|
||||||
|
|
@ -350,11 +340,7 @@ class CmdNick(COMMAND_DEFAULT_CLASS):
|
||||||
return
|
return
|
||||||
elif old_nickstring and old_replstring:
|
elif old_nickstring and old_replstring:
|
||||||
# just looking at the nick
|
# just looking at the nick
|
||||||
string += "\n%s '|w%s|n' maps to '|w%s|n'." % (
|
string += f"\n{nicktypestr} '|w{old_nickstring}|n' maps to '|w{old_replstring}|n'."
|
||||||
nicktypestr,
|
|
||||||
old_nickstring,
|
|
||||||
old_replstring,
|
|
||||||
)
|
|
||||||
errstring = ""
|
errstring = ""
|
||||||
string = errstring if errstring else string
|
string = errstring if errstring else string
|
||||||
caller.msg(_cy(string))
|
caller.msg(_cy(string))
|
||||||
|
|
@ -439,10 +425,8 @@ class CmdGet(COMMAND_DEFAULT_CLASS):
|
||||||
if not success:
|
if not success:
|
||||||
caller.msg("This can't be picked up.")
|
caller.msg("This can't be picked up.")
|
||||||
else:
|
else:
|
||||||
caller.msg("You pick up %s." % obj.name)
|
caller.msg(f"You pick up {obj.name}.")
|
||||||
caller.location.msg_contents(
|
caller.location.msg_contents(f"{caller.name} picks up {obj,name}.", exclude=caller)
|
||||||
"%s picks up %s." % (caller.name, obj.name), exclude=caller
|
|
||||||
)
|
|
||||||
# calling at_get hook method
|
# calling at_get hook method
|
||||||
obj.at_get(caller)
|
obj.at_get(caller)
|
||||||
|
|
||||||
|
|
@ -475,8 +459,8 @@ class CmdDrop(COMMAND_DEFAULT_CLASS):
|
||||||
obj = caller.search(
|
obj = caller.search(
|
||||||
self.args,
|
self.args,
|
||||||
location=caller,
|
location=caller,
|
||||||
nofound_string="You aren't carrying %s." % self.args,
|
nofound_string=f"You aren't carrying {self.args}.",
|
||||||
multimatch_string="You carry more than one %s:" % self.args,
|
multimatch_string=f"You carry more than one {self.args}:",
|
||||||
)
|
)
|
||||||
if not obj:
|
if not obj:
|
||||||
return
|
return
|
||||||
|
|
@ -490,7 +474,7 @@ class CmdDrop(COMMAND_DEFAULT_CLASS):
|
||||||
caller.msg("This couldn't be dropped.")
|
caller.msg("This couldn't be dropped.")
|
||||||
else:
|
else:
|
||||||
caller.msg("You drop %s." % (obj.name,))
|
caller.msg("You drop %s." % (obj.name,))
|
||||||
caller.location.msg_contents("%s drops %s." % (caller.name, obj.name), exclude=caller)
|
caller.location.msg_contents(f"{caller.name} drops {obj.name}.", exclude=caller)
|
||||||
# Call the object script's at_drop() method.
|
# Call the object script's at_drop() method.
|
||||||
obj.at_drop(caller)
|
obj.at_drop(caller)
|
||||||
|
|
||||||
|
|
@ -521,17 +505,17 @@ class CmdGive(COMMAND_DEFAULT_CLASS):
|
||||||
to_give = caller.search(
|
to_give = caller.search(
|
||||||
self.lhs,
|
self.lhs,
|
||||||
location=caller,
|
location=caller,
|
||||||
nofound_string="You aren't carrying %s." % self.lhs,
|
nofound_string=f"You aren't carrying {self.lhs}.",
|
||||||
multimatch_string="You carry more than one %s:" % self.lhs,
|
multimatch_string=f"You carry more than one {self.lhs}:",
|
||||||
)
|
)
|
||||||
target = caller.search(self.rhs)
|
target = caller.search(self.rhs)
|
||||||
if not (to_give and target):
|
if not (to_give and target):
|
||||||
return
|
return
|
||||||
if target == caller:
|
if target == caller:
|
||||||
caller.msg("You keep %s to yourself." % to_give.key)
|
caller.msg(f"You keep {to_give.key} to yourself.")
|
||||||
return
|
return
|
||||||
if not to_give.location == caller:
|
if not to_give.location == caller:
|
||||||
caller.msg("You are not holding %s." % to_give.key)
|
caller.msg(f"You are not holding {to_give.key}.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# calling at_pre_give hook method
|
# calling at_pre_give hook method
|
||||||
|
|
@ -541,10 +525,10 @@ class CmdGive(COMMAND_DEFAULT_CLASS):
|
||||||
# give object
|
# give object
|
||||||
success = to_give.move_to(target, quiet=True, move_type="give")
|
success = to_give.move_to(target, quiet=True, move_type="give")
|
||||||
if not success:
|
if not success:
|
||||||
caller.msg("This could not be given.")
|
caller.msg(f"You could not give {to_give.key}.")
|
||||||
else:
|
else:
|
||||||
caller.msg("You give %s to %s." % (to_give.key, target.key))
|
caller.msg(f"You give {to_give.key} to {target.key}.")
|
||||||
target.msg("%s gives you %s." % (caller.key, to_give.key))
|
target.msg(f"{caller.key} gives you {to_give.key}.")
|
||||||
# Call the object script's at_give() method.
|
# Call the object script's at_give() method.
|
||||||
to_give.at_give(caller, target)
|
to_give.at_give(caller, target)
|
||||||
|
|
||||||
|
|
@ -702,7 +686,7 @@ class CmdPose(COMMAND_DEFAULT_CLASS):
|
||||||
msg = "What do you want to do?"
|
msg = "What do you want to do?"
|
||||||
self.caller.msg(msg)
|
self.caller.msg(msg)
|
||||||
else:
|
else:
|
||||||
msg = "%s%s" % (self.caller.name, self.args)
|
msg = f"{self.caller.name}{self.args}"
|
||||||
self.caller.location.msg_contents(text=(msg, {"type": "pose"}), from_obj=self.caller)
|
self.caller.location.msg_contents(text=(msg, {"type": "pose"}), from_obj=self.caller)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -737,7 +721,7 @@ class CmdAccess(COMMAND_DEFAULT_CLASS):
|
||||||
pperms = ", ".join(caller.account.permissions.all())
|
pperms = ", ".join(caller.account.permissions.all())
|
||||||
|
|
||||||
string += "\n|wYour access|n:"
|
string += "\n|wYour access|n:"
|
||||||
string += "\nCharacter |c%s|n: %s" % (caller.key, cperms)
|
string += f"\nCharacter |c{caller.key}|n: {cperms}"
|
||||||
if hasattr(caller, "account"):
|
if hasattr(caller, "account"):
|
||||||
string += "\nAccount |c%s|n: %s" % (caller.account.key, pperms)
|
string += f"\nAccount |c{caller.account.key}|n: {pperms}"
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
@ -962,7 +962,7 @@ class CmdSetHelp(CmdHelp):
|
||||||
if "append" in switches or "merge" in switches or "extend" in switches:
|
if "append" in switches or "merge" in switches or "extend" in switches:
|
||||||
# merge/append operations
|
# merge/append operations
|
||||||
if not old_entry:
|
if not old_entry:
|
||||||
self.msg("Could not find topic '%s'. You must give an exact name." % topicstr)
|
self.msg(f"Could not find topic '{topicstr}'. You must give an exact name.")
|
||||||
return
|
return
|
||||||
if not self.rhs:
|
if not self.rhs:
|
||||||
self.msg("You must supply text to append/merge.")
|
self.msg("You must supply text to append/merge.")
|
||||||
|
|
@ -972,16 +972,16 @@ class CmdSetHelp(CmdHelp):
|
||||||
else:
|
else:
|
||||||
old_entry.entrytext += "\n%s" % self.rhs
|
old_entry.entrytext += "\n%s" % self.rhs
|
||||||
old_entry.aliases.add(aliases)
|
old_entry.aliases.add(aliases)
|
||||||
self.msg("Entry updated:\n%s%s" % (old_entry.entrytext, aliastxt))
|
self.msg(f"Entry updated:\n{old_entry.entrytext}{aliastxt}")
|
||||||
return
|
return
|
||||||
|
|
||||||
if "delete" in switches or "del" in switches:
|
if "delete" in switches or "del" in switches:
|
||||||
# delete the help entry
|
# delete the help entry
|
||||||
if not old_entry:
|
if not old_entry:
|
||||||
self.msg("Could not find topic '%s'%s." % (topicstr, aliastxt))
|
self.msg(f"Could not find topic '{topicstr}'{aliastxt}.")
|
||||||
return
|
return
|
||||||
old_entry.delete()
|
old_entry.delete()
|
||||||
self.msg("Deleted help entry '%s'%s." % (topicstr, aliastxt))
|
self.msg(f"Deleted help entry '{topicstr}'{aliastxt}.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# at this point it means we want to add a new help entry.
|
# at this point it means we want to add a new help entry.
|
||||||
|
|
@ -998,7 +998,7 @@ class CmdSetHelp(CmdHelp):
|
||||||
old_entry.locks.add(lockstring)
|
old_entry.locks.add(lockstring)
|
||||||
old_entry.aliases.add(aliases)
|
old_entry.aliases.add(aliases)
|
||||||
old_entry.save()
|
old_entry.save()
|
||||||
self.msg("Overwrote the old topic '%s'%s." % (topicstr, aliastxt))
|
self.msg(f"Overwrote the old topic '{topicstr}'{aliastxt}.")
|
||||||
else:
|
else:
|
||||||
self.msg(
|
self.msg(
|
||||||
f"Topic '{topicstr}'{aliastxt} already exists. Use /edit to open in editor, or "
|
f"Topic '{topicstr}'{aliastxt} already exists. Use /edit to open in editor, or "
|
||||||
|
|
|
||||||
|
|
@ -216,30 +216,30 @@ Command {self} has no defined `func()` - showing on-command variables: No child
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
# a simple test command to show the available properties
|
# a simple test command to show the available properties
|
||||||
string = "-" * 50
|
string = "-" * 50
|
||||||
string += "\n|w%s|n - Command variables from evennia:\n" % self.key
|
string += f"\n|w{self.key}|n - Command variables from evennia:\n"
|
||||||
string += "-" * 50
|
string += "-" * 50
|
||||||
string += "\nname of cmd (self.key): |w%s|n\n" % self.key
|
string += f"\nname of cmd (self.key): |w{self.key}|n\n"
|
||||||
string += "cmd aliases (self.aliases): |w%s|n\n" % self.aliases
|
string += f"cmd aliases (self.aliases): |w{self.aliases}|n\n"
|
||||||
string += "cmd locks (self.locks): |w%s|n\n" % self.locks
|
string += f"cmd locks (self.locks): |w{self.locks}|n\n"
|
||||||
string += "help category (self.help_category): |w%s|n\n" % self.help_category
|
string += f"help category (self.help_category): |w{self.help_category}|n\n"
|
||||||
string += "object calling (self.caller): |w%s|n\n" % self.caller
|
string += f"object calling (self.caller): |w{self.caller}|n\n"
|
||||||
string += "object storing cmdset (self.obj): |w%s|n\n" % self.obj
|
string += f"object storing cmdset (self.obj): |w{self.obj}|n\n"
|
||||||
string += "command string given (self.cmdstring): |w%s|n\n" % self.cmdstring
|
string += f"command string given (self.cmdstring): |w{self.cmdstring}|n\n"
|
||||||
# show cmdset.key instead of cmdset to shorten output
|
# show cmdset.key instead of cmdset to shorten output
|
||||||
string += utils.fill("current cmdset (self.cmdset): |w%s|n\n" % self.cmdset)
|
string += utils.fill(f"current cmdset (self.cmdset): |w{self.cmdset}|n\n")
|
||||||
string += "\n" + "-" * 50
|
string += "\n" + "-" * 50
|
||||||
string += "\nVariables from MuxCommand baseclass\n"
|
string += "\nVariables from MuxCommand baseclass\n"
|
||||||
string += "-" * 50
|
string += "-" * 50
|
||||||
string += "\nraw argument (self.raw): |w%s|n \n" % self.raw
|
string += f"\nraw argument (self.raw): |w{self.raw}|n \n"
|
||||||
string += "cmd args (self.args): |w%s|n\n" % self.args
|
string += f"cmd args (self.args): |w{self.args}|n\n"
|
||||||
string += "cmd switches (self.switches): |w%s|n\n" % self.switches
|
string += f"cmd switches (self.switches): |w{self.switches}|n\n"
|
||||||
string += "cmd options (self.switch_options): |w%s|n\n" % self.switch_options
|
string += f"cmd options (self.switch_options): |w{self.switch_options}|n\n"
|
||||||
string += "cmd parse left/right using (self.rhs_split): |w%s|n\n" % self.rhs_split
|
string += f"cmd parse left/right using (self.rhs_split): |w{self.rhs_split}|n\n"
|
||||||
string += "space-separated arg list (self.arglist): |w%s|n\n" % self.arglist
|
string += f"space-separated arg list (self.arglist): |w{self.arglist}|n\n"
|
||||||
string += "lhs, left-hand side of '=' (self.lhs): |w%s|n\n" % self.lhs
|
string += f"lhs, left-hand side of '=' (self.lhs): |w{self.lhs}|n\n"
|
||||||
string += "lhs, comma separated (self.lhslist): |w%s|n\n" % self.lhslist
|
string += f"lhs, comma separated (self.lhslist): |w{self.lhslist}|n\n"
|
||||||
string += "rhs, right-hand side of '=' (self.rhs): |w%s|n\n" % self.rhs
|
string += f"rhs, right-hand side of '=' (self.rhs): |w{self.rhs}|n\n"
|
||||||
string += "rhs, comma separated (self.rhslist): |w%s|n\n" % self.rhslist
|
string += f"rhs, comma separated (self.rhslist): |w{self.rhslist}|n\n"
|
||||||
string += "-" * 50
|
string += "-" * 50
|
||||||
self.caller.msg(string)
|
self.caller.msg(string)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class CmdReload(COMMAND_DEFAULT_CLASS):
|
||||||
if self.args:
|
if self.args:
|
||||||
reason = "(Reason: %s) " % self.args.rstrip(".")
|
reason = "(Reason: %s) " % self.args.rstrip(".")
|
||||||
if _BROADCAST_SERVER_RESTART_MESSAGES:
|
if _BROADCAST_SERVER_RESTART_MESSAGES:
|
||||||
SESSIONS.announce_all(" Server restart initiated %s..." % reason)
|
SESSIONS.announce_all(f" Server restart initiated {reason}...")
|
||||||
SESSIONS.portal_restart_server()
|
SESSIONS.portal_restart_server()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ class CmdShutdown(COMMAND_DEFAULT_CLASS):
|
||||||
announcement = "\nServer is being SHUT DOWN!\n"
|
announcement = "\nServer is being SHUT DOWN!\n"
|
||||||
if self.args:
|
if self.args:
|
||||||
announcement += "%s\n" % self.args
|
announcement += "%s\n" % self.args
|
||||||
logger.log_info("Server shutdown by %s." % self.caller.name)
|
logger.log_info(f"Server shutdown by {self.caller.name}.")
|
||||||
SESSIONS.announce_all(announcement)
|
SESSIONS.announce_all(announcement)
|
||||||
SESSIONS.portal_shutdown()
|
SESSIONS.portal_shutdown()
|
||||||
|
|
||||||
|
|
@ -482,13 +482,12 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
||||||
# Boot the account then delete it.
|
# Boot the account then delete it.
|
||||||
self.msg("Informing and disconnecting account ...")
|
self.msg("Informing and disconnecting account ...")
|
||||||
string = "\nYour account '%s' is being *permanently* deleted.\n" % username
|
string = f"\nYour account '{username}' is being *permanently* deleted.\n"
|
||||||
if reason:
|
if reason:
|
||||||
string += " Reason given:\n '%s'" % reason
|
string += " Reason given:\n '%s'" % reason
|
||||||
account.msg(string)
|
account.msg(string)
|
||||||
logger.log_sec(
|
logger.log_sec(
|
||||||
"Account Deleted: %s (Reason: %s, Caller: %s, IP: %s)."
|
f"Account Deleted: {account} (Reason: {reason}, Caller: {caller}, IP: {self.session.address})."
|
||||||
% (account, reason, caller, self.session.address)
|
|
||||||
)
|
)
|
||||||
account.delete()
|
account.delete()
|
||||||
self.msg("Account %s was successfully deleted." % username)
|
self.msg("Account %s was successfully deleted." % username)
|
||||||
|
|
@ -519,8 +518,8 @@ class CmdAccounts(COMMAND_DEFAULT_CLASS):
|
||||||
utils.datetime_format(ply.date_created), ply.dbref, ply.key, ply.path
|
utils.datetime_format(ply.date_created), ply.dbref, ply.key, ply.path
|
||||||
)
|
)
|
||||||
|
|
||||||
string = "\n|wAccount typeclass distribution:|n\n%s" % typetable
|
string = f"\n|wAccount typeclass distribution:|n\n{typetable}"
|
||||||
string += "\n|wLast %s Accounts created:|n\n%s" % (min(naccounts, nlim), latesttable)
|
string += f"\n|wLast {min(naccounts, nlim)} Accounts created:|n\n{latesttable}"
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -610,7 +609,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
|
||||||
if delmode:
|
if delmode:
|
||||||
service.stopService()
|
service.stopService()
|
||||||
service_collection.removeService(service)
|
service_collection.removeService(service)
|
||||||
caller.msg("|gStopped and removed service '%s'.|n" % self.args)
|
caller.msg(f"|gStopped and removed service '{self.args}'.|n")
|
||||||
else:
|
else:
|
||||||
caller.msg(f"Stopping service '{self.args}'...")
|
caller.msg(f"Stopping service '{self.args}'...")
|
||||||
try:
|
try:
|
||||||
|
|
@ -621,7 +620,7 @@ class CmdService(COMMAND_DEFAULT_CLASS):
|
||||||
"If there are remaining problems, try reloading "
|
"If there are remaining problems, try reloading "
|
||||||
"or rebooting the server."
|
"or rebooting the server."
|
||||||
)
|
)
|
||||||
caller.msg("|g... Stopped service '%s'.|n" % self.args)
|
caller.msg(f"|g... Stopped service '{self.args}'.|n")
|
||||||
return
|
return
|
||||||
|
|
||||||
if switches[0] == "start":
|
if switches[0] == "start":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue