126 lines (108 with data), 2.4 kB
/*
A finger program by Dredd (aka geoff@molly.cs.monash.edu.au)
Shattered World 1992
Modified to work with the new player stuff - G.
*/
inherit "std/object";
#include "vars.h"
#include <Config.h>
#include "/RO/stats.h"
#include "mail.h"
/*#define write(x) tell_object(this_player(), x) */
reset(arg)
{
::reset(arg);
if (!arg) {
add_id("finger");
set_short("A finger finder");
}
}
init()
{
::init();
add_action("finger", "finger");
}
finger(str)
{
array info, tmp;
int i;
notify_fail("Who do you wish to finger?\n");
if (!str) return;
object o = find_them(str);
if (!o) return;
/* info = [ "Finger information for: "+capitalize(str) ]; */
info = [ ];
tmp = STAT_SERV->show_stats(o);
info += tmp;
#if 0
info += [ mail_info(str) ] + ({ tmp[sizeof(tmp)-1] });
/* this doesn't work if you're less than elder status. */
#endif
/* Limit what info normal player has access to */
if (!this_player()->query_wiz()) info = info[..6] + info[index(info, "Login Status -")..];
MORE->more(implode(info, "\n"));
return 1;
}
mail_info(string name)
{
array mail;
string ret = "Mail info - \n";
if (!name)
return;
mail=MDAEMON->readmail(name);
if (!mail)
return;
if (sizeof(mail))
{
ret += " Mail last received : "+
explode(mail[sizeof(mail)-1], "\n")[1][6..]+"\n";
}
mail=MDAEMON->readmail(name, "new");
if (sizeof(mail))
{
ret += " "+capitalize(ENGLISH->int_to_english(sizeof(mail), 20))
+ " new mail messages, unread since : "+
explode(mail[0], "\n")[1][6..]+"\n";
}
else
ret += " No unread mail.\n";
ret = ret[..sizeof(ret)-2]; /* Strip last return char */
return ret;
}
/*
* hope we didn't need this for anything significant :)
*/
called_from(whom)
{
object o = find_them(whom);
if (o)
return o->query_last_ip();
}
last_logged_in (whom)
{
object o = find_them(whom);
if (o)
return o->query_last_login();
}
find_them(str) {
return load_object(PLAYER_SERV->GetPlayerObjName(str));
}
player_exists(who)
/* returns 1 is the player mentioned has a save file
* Hunter, August 1992
*/
{
object o = find_them(who);
if (!o) return 0;
return o->query_wiz() + 1;
}
query_wiz(who)
{
return player_exists(who) -1;
}
query_quest_points (who)
{
object o = find_them(who);
if (!o) return;
return o-> query_quest_points();
}