Adding the SQLite database to this commit. Oh, and @list commands is in, as well as some pieces of @list process.

This commit is contained in:
Greg Taylor 2006-12-26 04:20:47 +00:00
parent 959be95e42
commit d3634f3236
7 changed files with 45 additions and 4 deletions

View file

@ -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
------------------

View file

@ -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())

View file

@ -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.

BIN
evennia/trunk/evennia.sql Executable file

Binary file not shown.

View file

@ -5,6 +5,7 @@ from apps.objects.models import Object
from apps.config.models import ConfigValue
import global_defines
import gameconf
"""
Common database functions.
"""

View file

@ -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.

View file

@ -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.