""" Commands that are generally staff-oriented that show information regarding the server instance. """ import os, datetime import django, twisted from django.contrib.auth.models import User from src.objects.models import ObjectDB from src.scripts.models import ScriptDB from src.utils import utils from src.utils import gametime from game.gamesrc.commands.default.muxcommand import MuxCommand from src.commands import cmdsethandler class CmdVersion(MuxCommand): """ @version - game version Usage: @version Display the game version info. """ key = "@version" help_category = "System" def func(self): "Show the version" version = utils.get_evennia_version() string = "-"*50 +"\n\r" string += " {cEvennia{n %s\n\r" % version string += " (Django %s, " % (django.get_version()) string += " Twisted %s)\n\r" % (twisted.version.short()) string += "-"*50 self.caller.msg(string) class CmdTime(MuxCommand): """ @time Usage: @time Server local time. """ key = "@time" aliases = "@uptime" permissions = "cmd:time" help_category = "System" def func(self): "Show times." string1 = "\nCurrent server uptime: \t" string1 += "{w%s{n" % (utils.time_format(gametime.uptime(format=False), 2)) string2 = "\nTotal server running time: \t" string2 += "{w%s{n" % (utils.time_format(gametime.runtime(format=False), 2)) string3 = "\nTotal in-game time (realtime x %g):\t" % (gametime.TIMEFACTOR) string3 += "{w%s{n" % (utils.time_format(gametime.gametime(format=False), 2)) string4 = "\nServer time stamp: \t" string4 += "{w%s{n" % (str(datetime.datetime.now())) string5 = "" if not utils.host_os_is('nt'): # os.getloadavg() is not available on Windows. loadavg = os.getloadavg() string5 += "\nServer load (per minute): \t" string5 += "{w%g%%{n" % (100 * loadavg[0]) string = "%s%s%s%s%s" % (string1, string2, string3, string4, string5) self.caller.msg(string) class CmdList(MuxCommand): """ @list - list info Usage: @list