Some more @list work and help system cleanup.

This commit is contained in:
Greg Taylor 2007-01-02 04:19:53 +00:00
parent 18cf29b0cf
commit 4641aa8a4e
6 changed files with 24 additions and 9 deletions

View file

@ -11,7 +11,7 @@ class HelpEntry(models.Model):
staff_only = models.BooleanField(default=0)
class Admin:
list_display = ('topicname', 'staff_only')
list_display = ('id', 'topicname', 'staff_only')
list_filter = ('staff_only',)
search_fields = ['entrytext']
@ -20,8 +20,8 @@ class HelpEntry(models.Model):
ordering = ['topicname']
def __str__(self):
return "%3d. %s" % (self.id, self.topicname)
return self.topicname
def get_topicname(self):
"""
Returns the topic's name.

View file

@ -245,7 +245,7 @@ def cmd_help(cdat):
elif len(topics) > 1:
session.msg("More than one match found:")
for result in topics:
session.msg(" %s" % (result,))
session.msg("%3d. %s" % (result.id, result.get_topicname()))
session.msg("You may type 'help <#>' to see any of these topics.")
else:
topic = topics[0]

View file

@ -8,6 +8,7 @@ import commands_unloggedin
import cmdhandler
import session_mgr
import ansi
import defines_global
from django.contrib.auth.models import User
from apps.objects.models import Object
"""
@ -76,15 +77,28 @@ def cmd_list(cdat):
args = cdat['uinput']['splitted'][1:]
argstr = ''.join(args)
msg_invalid = "Unknown option. Use one of: commands, process"
if len(argstr) == 0:
session.msg("Unknown option. Use one of: commands, process")
session.msg(msg_invalid)
elif argstr == "commands":
session.msg('Commands: '+' '.join(functions_general.command_list()))
elif argstr == "process":
loadvg = os.getloadavg()
psize = resource.getpagesize()
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]))
session.msg("Process ID: %10d %10d bytes per page" % (os.getpid(), psize))
session.msg("Time used: %10d user %10d sys" % (rusage[0],rusage[1]))
session.msg("Integral mem:%10d shared %10d private%10d stack" % (rusage[3], rusage[4], rusage[5]))
session.msg("Max res mem: %10d pages %10d bytes" % (rusage[2],rusage[2] * psize))
session.msg("Page faults: %10d hard %10d soft %10d swapouts" % (rusage[7], rusage[6], rusage[8]))
session.msg("Disk I/O: %10d reads %10d writes" % (rusage[9], rusage[10]))
session.msg("Network I/O: %10d in %10d out" % (rusage[12], rusage[11]))
session.msg("Context swi: %10d vol %10d forced %10d sigs" % (rusage[14], rusage[15], rusage[13]))
elif argstr == "flags":
session.msg("Flags: "+" ".join(defines_global.SERVER_FLAGS))
else:
session.msg(msg_invalid)
def cmd_description(cdat):
"""

View file

@ -11,7 +11,7 @@ OBJECT_TYPES = (
# This is a list of flags that the server actually uses. Anything not in this
# list is a custom flag.
SERVER_FLAGS = ["CONNECTED"]
SERVER_FLAGS = ["CONNECTED", "DARK", "FLOATING", "GAGGED", "HAVEN", "OPAQUE", "SAFE", "SLAVE", "SUSPECT", "TRANSPARENT"]
# These flags are not saved.
NOSAVE_FLAGS = ["CONNECTED"]
@ -20,7 +20,7 @@ NOSAVE_FLAGS = ["CONNECTED"]
NOSET_FLAGS = ["CONNECTED"]
# These attribute names can't be modified by players.
NOSET_ATTRIBS = ["MONEY"]
NOSET_ATTRIBS = ["MONEY", "ALIAS"]
# Server version number.
EVENNIA_VERSION = 'Pre-Alpha'

Binary file not shown.

View file

@ -83,6 +83,7 @@ class Server(dispatcher):
def shutdown(self, message='The server has been shutdown. Please check back soon.'):
functions_general.announce_all(message)
self.game_running = False
"""
END Server CLASS
"""