diff --git a/evennia/trunk/TODO b/evennia/trunk/TODO index ddbc5ef245..7f86b610f6 100644 --- a/evennia/trunk/TODO +++ b/evennia/trunk/TODO @@ -24,8 +24,6 @@ Medium Priority Tasks --------------------- * We're going to need a delayed event queue in addition to the scheduler. For example: I want player X to perform this action in Y seconds. -* Implement some of the @list command from MUX2. Most importantly, - '@list commands'. Low Priority Tasks ------------------ diff --git a/evennia/trunk/commands_general.py b/evennia/trunk/commands_general.py index 6d869260b8..c3eb20beb8 100644 --- a/evennia/trunk/commands_general.py +++ b/evennia/trunk/commands_general.py @@ -6,6 +6,7 @@ import functions_help import global_defines import session_mgr import ansi +import os """ Generic command module. Pretty much every command should go here for now. @@ -269,3 +270,4 @@ def cmd_uptime(cdat): session.msg('Current server time : %s' % (time.strftime('%a %b %d %H:%M %Y (%Z)', time.localtime(),))) session.msg('Server start time : %s' % (time.strftime('%a %b %d %H:%M %Y', time.localtime(server.start_time),))) session.msg('Server uptime : %s' % functions_general.time_format(start_delta, style=2)) + session.msg('Server load (1 min) : %s' % os.getloadavg()) diff --git a/evennia/trunk/commands_staff.py b/evennia/trunk/commands_staff.py index 1ccddaa29e..55c7ec660a 100644 --- a/evennia/trunk/commands_staff.py +++ b/evennia/trunk/commands_staff.py @@ -1,6 +1,10 @@ +import os +import resource + import functions_db import functions_general import commands_general +import commands_unloggedin import cmdhandler import session_mgr import ansi @@ -63,6 +67,25 @@ def cmd_destroy(cdat): session.msg("You destroy %s." % (target_obj,)) target_obj.destroy() +def cmd_list(cdat): + """ + Shows some game related information. + """ + session = cdat['session'] + pobject = session.get_pobject() + args = cdat['uinput']['splitted'][1:] + argstr = ''.join(args) + + if len(argstr) == 0: + session.msg("Unknown option. Use one of: commands, process") + elif argstr == "commands": + session.msg('Commands: '+' '.join(functions_general.command_list())) + elif argstr == "process": + loadvg = os.getloadavg() + rusage = resource.getrusage(resource.RUSAGE_SELF) + session.msg("Process ID: %d" % (os.getpid(),)) + session.msg("Time used: %d user %d sys" % (rusage[0],rusage[1])) + def cmd_description(cdat): """ Set an object's description. diff --git a/evennia/trunk/evennia.sql b/evennia/trunk/evennia.sql new file mode 100755 index 0000000000..a3dbae1c3c Binary files /dev/null and b/evennia/trunk/evennia.sql differ diff --git a/evennia/trunk/functions_db.py b/evennia/trunk/functions_db.py index f9b64ee0e3..6d86d0fb6a 100644 --- a/evennia/trunk/functions_db.py +++ b/evennia/trunk/functions_db.py @@ -5,6 +5,7 @@ from apps.objects.models import Object from apps.config.models import ConfigValue import global_defines import gameconf + """ Common database functions. """ diff --git a/evennia/trunk/functions_general.py b/evennia/trunk/functions_general.py index 4945077cce..a8bcffced3 100644 --- a/evennia/trunk/functions_general.py +++ b/evennia/trunk/functions_general.py @@ -1,8 +1,25 @@ import session_mgr +import commands_staff +import commands_general +import commands_unloggedin """ General commonly used functions. """ - +def command_list(): + """ + Return a list of all commands. + """ + commands = dir(commands_unloggedin) + dir(commands_general) + stf_commands = dir(commands_staff) + filtered = [prospect for prospect in commands if "cmd_" in prospect] + stf_filtered = [prospect for prospect in stf_commands if "cmd_" in prospect] + processed = [] + for cmd in filtered: + processed.append(cmd[4:]) + for cmd in stf_filtered: + processed.append('@%s' %(cmd[4:],)) + return processed + def time_format(seconds, style=0): """ Function to return a 'prettified' version of a value in seconds. diff --git a/evennia/trunk/settings.py b/evennia/trunk/settings.py index b54f489d29..38c96e83e8 100755 --- a/evennia/trunk/settings.py +++ b/evennia/trunk/settings.py @@ -10,7 +10,7 @@ ADMINS = ( MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. -DATABASE_NAME = 'evennia.sql' # Or path to database file if using sqlite3. +DATABASE_NAME = '/home/gtaylor/dev/evennia/evennia.sql' # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.