version.c

foundation2_fluffos_v1/lib/cmds/player/version.c · 1.2 KB

From the archive foundation2_fluffos_v1.zip

Download the archive   « Back to the archive contents

/*    /cmds/player/version.c
 *    from the Nightmare IV LPC Library
 *    gives information about the MUD
 *    created by Descartes of Borg 950507
 */

#include <lib.h>
#include <daemons.h>
#include <localtime.h>

inherit LIB_DAEMON;

int cmd(string str) {
    string tz, tmp;
    int x, scr;

    tz = (string)this_player()->GetTimeZone() || localtime(time())[LT_ZONE];
    x = (int)TIME_D->GetOffset(tz) * 3600;
    scr = ((int *)this_player()->GetScreen())[0];
    tmp = center(mud_name(), scr) + "\n";
    tmp += sprintf("%:-"+(scr/2)+"s%"+(scr/2)+"s\n", "Driver: " + version(),
		   "Library: " + mudlib() + " " + mudlib_version());
    tmp += sprintf("%:-" + (scr/2) + "s%" + (scr/2) + "s\n",
		  "Up since: " + ctime((time() - uptime()) +x),
                 "Next reboot: " + ctime(time() - uptime() + x +
                   (int)EVENTS_D->GetRebootInterval() * 3600));
    tmp += center("Current time: " + ctime(time() + x) + " " + tz, scr);
    message("system", tmp, this_player());
    return 1;
}

void help() {
    message("help", "Syntax: <version>\n\n"
      "Gives you version information about the LPMud as well as how "
      "long the mud has been up in your local time if you have it "
      "specified.", this_player()
    );
}

Site Stats

Snippets: 1791
Codebases: 571