diff --git a/evennia/commands/default/player.py b/evennia/commands/default/player.py index 8892e8d5a6..55919970bb 100644 --- a/evennia/commands/default/player.py +++ b/evennia/commands/default/player.py @@ -23,7 +23,7 @@ from builtins import range import time from django.conf import settings from evennia.server.sessionhandler import SESSIONS -from evennia.utils import utils, create, search, prettytable, evtable +from evennia.utils import utils, create, search, evtable COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS) @@ -356,20 +356,18 @@ class CmdSessions(COMMAND_DEFAULT_CLASS): """Implement function""" player = self.player sessions = player.sessions.all() - - table = prettytable.PrettyTable(["|wsessid", - "|wprotocol", - "|whost", - "|wpuppet/character", - "|wlocation"]) + table = evtable.EvTable("|wsessid", + "|wprotocol", + "|whost", + "|wpuppet/character", + "|wlocation") for sess in sorted(sessions, key=lambda x: x.sessid): char = player.get_puppet(sess) - table.add_row([str(sess.sessid), str(sess.protocol_key), - type(sess.address) == tuple and sess.address[0] or sess.address, - char and str(char) or "None", - char and str(char.location) or "N/A"]) - string = "|wYour current session(s):|n\n%s" % table - self.msg(string) + table.add_row(str(sess.sessid), str(sess.protocol_key), + type(sess.address) == tuple and sess.address[0] or sess.address, + char and str(char) or "None", + char and str(char.location) or "N/A") + self.msg("|wYour current session(s):|n\n%s" % table) class CmdWho(COMMAND_DEFAULT_CLASS): @@ -409,14 +407,14 @@ class CmdWho(COMMAND_DEFAULT_CLASS): nplayers = (SESSIONS.player_count()) if show_session_data: # privileged info - table = prettytable.PrettyTable(["|wPlayer Name", - "|wOn for", - "|wIdle", - "|wPuppeting", - "|wRoom", - "|wCmds", - "|wProtocol", - "|wHost"]) + table = evtable.EvTable("|wPlayer Name", + "|wOn for", + "|wIdle", + "|wPuppeting", + "|wRoom", + "|wCmds", + "|wProtocol", + "|wHost") for session in session_list: if not session.logged_in: continue @@ -425,31 +423,29 @@ class CmdWho(COMMAND_DEFAULT_CLASS): player = session.get_player() puppet = session.get_puppet() location = puppet.location.key if puppet and puppet.location else "None" - table.add_row([utils.crop(player.name, width=25), - utils.time_format(delta_conn, 0), - utils.time_format(delta_cmd, 1), - utils.crop(puppet.key if puppet else "None", width=25), - utils.crop(location, width=25), - session.cmd_total, - session.protocol_key, - isinstance(session.address, tuple) and session.address[0] or session.address]) + table.add_row(utils.crop(player.name, width=25), + utils.time_format(delta_conn, 0), + utils.time_format(delta_cmd, 1), + utils.crop(puppet.key if puppet else "None", width=25), + utils.crop(location, width=25), + session.cmd_total, + session.protocol_key, + isinstance(session.address, tuple) and session.address[0] or session.address) else: # unprivileged - table = prettytable.PrettyTable(["|wPlayer name", "|wOn for", "|wIdle"]) + table = evtable.EvTable("|wPlayer name", "|wOn for", "|wIdle") for session in session_list: if not session.logged_in: continue delta_cmd = time.time() - session.cmd_last_visible delta_conn = time.time() - session.conn_time player = session.get_player() - table.add_row([utils.crop(player.key, width=25), - utils.time_format(delta_conn, 0), - utils.time_format(delta_cmd, 1)]) - + table.add_row(utils.crop(player.key, width=25), + utils.time_format(delta_conn, 0), + utils.time_format(delta_cmd, 1)) is_one = nplayers == 1 - string = "|wPlayers:|n\n%s\n%s unique account%s logged in." \ - % (table, "One" if is_one else nplayers, "" if is_one else "s") - self.msg(string) + self.msg("|wPlayers:|n\n%s\n%s unique account%s logged in." + % (table, "One" if is_one else nplayers, "" if is_one else "s")) class CmdOption(COMMAND_DEFAULT_CLASS): @@ -524,7 +520,6 @@ class CmdOption(COMMAND_DEFAULT_CLASS): changed = "|y*|n" if key in saved_options and flags[key] != saved_options[key] else "" row.append("%s%s" % (saved, changed)) table.add_row(*row) - self.msg("|wClient settings (%s):|n\n%s|n" % (self.session.protocol_key, table)) return @@ -599,10 +594,9 @@ class CmdOption(COMMAND_DEFAULT_CLASS): for key in optiondict: self.player.attributes.get("_saved_protocol_flags", {}).pop(key, None) self.msg("|gCleared saved %s." % key) - - self.session.update_flags(**optiondict) + class CmdPassword(COMMAND_DEFAULT_CLASS): """ change your password