Largely rewrote and refactored the help system.

The help entry database structure has changed! You have to resync or purge
your database or your will get problems!

New features:
* Help entry access now fully controlled by evennia permissions
* Categories for each help entry
* All entries are created dynamically, with a See also: footer calculated
  after the current state of the database.
* Indexes and topic list calculated on the fly (alphabetically/after category)
* Added auto-help help entries for all default commands.
* Only shows commands _actually implemented_ - MUX help db moved into 'MUX' category
  which is not shown by default.
* More powerful auto-help markup - supports categories and permissions (and inheritance).
* Global on/off switch for auto-help, when entering production
* Auto_help_override switch for selectively activating auto-help when developing
  new commands (like the old system).
* Refactored State help system; no more risk of overwriting global help entries.
* State help now defers to main help db when no match found; makes system more transparent.
* State help entries also support categories/permissions (state categories are not
  used much though).

Other updates:
* Added more commands to the batch processor
* Many bug-fixes.

/Griatch
This commit is contained in:
Griatch 2009-10-14 18:15:15 +00:00
parent 46e2cd3ecb
commit 8074617285
27 changed files with 1995 additions and 1072 deletions

View file

@ -17,25 +17,41 @@ from src.cmdtable import GLOBAL_CMD_TABLE
def cmd_version(command):
"""
Version info command.
@version - game version
Usage:
@version
Display the game version info
"""
retval = "-"*50 +"\n\r"
retval += " Evennia %s\n\r" % (defines_global.EVENNIA_VERSION,)
retval += " Django %s\n\r" % (django.get_version())
retval += "-"*50
command.source_object.emit_to(retval)
GLOBAL_CMD_TABLE.add_command("version", cmd_version),
GLOBAL_CMD_TABLE.add_command("@version", cmd_version, help_category="Admin"),
def cmd_time(command):
"""
@time
Usage:
@time
Server local time.
"""
command.source_object.emit_to('Current server time : %s' %
(time.strftime('%a %b %d %H:%M:%S %Y (%Z)', time.localtime(),)))
GLOBAL_CMD_TABLE.add_command("time", cmd_time),
GLOBAL_CMD_TABLE.add_command("@time", cmd_time, priv_tuple=("genperms.game_info",),
help_category="Admin")
def cmd_uptime(command):
"""
@uptime
Usage:
@uptime
Server uptime and stats.
"""
source_object = command.source_object
@ -54,11 +70,18 @@ def cmd_uptime(command):
loadavg = os.getloadavg()
source_object.emit_to('Server load (1 min) : %.2f' %
loadavg[0])
GLOBAL_CMD_TABLE.add_command("uptime", cmd_uptime),
GLOBAL_CMD_TABLE.add_command("@uptime", cmd_uptime, priv_tuple=("genperms.game_info",),
help_category="Admin")
def cmd_list(command):
"""
Shows some game related information.
"""
@list - list info
Usage:
@list commands | flags | process
Shows game related information depending
on which argument is given.
"""
server = command.session.server
source_object = command.source_object
@ -99,10 +122,15 @@ def cmd_list(command):
source_object.emit_to("Flags: "+" ".join(flags.SERVER_FLAGS))
else:
source_object.emit_to(msg_invalid)
GLOBAL_CMD_TABLE.add_command("@list", cmd_list,priv_tuple=("genperms.game_info",)),
GLOBAL_CMD_TABLE.add_command("@list", cmd_list,priv_tuple=("genperms.game_info",), help_category="Admin")
def cmd_ps(command):
"""
@ps - list processes
Usage
@ps
Shows the process/event table.
"""
source_object = command.source_object
@ -115,13 +143,23 @@ def cmd_ps(command):
event.description))
source_object.emit_to("Totals: %d interval events" % (len(scheduler.schedule),))
GLOBAL_CMD_TABLE.add_command("@ps", cmd_ps,
priv_tuple=("genperms.process_control")),
priv_tuple=("genperms.process_control",), help_category="Admin")
def cmd_stats(command):
"""
@stats - show object stats
Usage:
@stats
Example:
@stats
->
4012 objects = 144 rooms, 212 exits, 613 things, 1878 players. (1165 garbage)
Shows stats about the database.
4012 objects = 144 rooms, 212 exits, 613 things, 1878 players. (1165 garbage)
"""
stats_dict = Object.objects.object_totals()
command.source_object.emit_to(
"%d objects = %d rooms, %d exits, %d things, %d players. (%d garbage)" %
@ -131,4 +169,4 @@ def cmd_stats(command):
stats_dict["things"],
stats_dict["players"],
stats_dict["garbage"]))
GLOBAL_CMD_TABLE.add_command("@stats", cmd_stats, priv_tuple=("genperms.game_info",)),
GLOBAL_CMD_TABLE.add_command("@stats", cmd_stats, priv_tuple=("genperms.game_info",), help_category="Admin"),