nightmare3_fluffos_v2/
nightmare3_fluffos_v2/bin/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/ChangeLog.old/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/Win32/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/simuls/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/clone/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/command/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/data/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/etc/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/master/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/log/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/compiler/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/efuns/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/operators/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/u/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/tmp/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/windows/
nightmare3_fluffos_v2/lib/cmds/ambassador/
nightmare3_fluffos_v2/lib/cmds/database/
nightmare3_fluffos_v2/lib/cmds/hm/
nightmare3_fluffos_v2/lib/cmds/soul/
nightmare3_fluffos_v2/lib/daemon/cfg/
nightmare3_fluffos_v2/lib/daemon/cfg/mon_races/
nightmare3_fluffos_v2/lib/daemon/cfg/races/
nightmare3_fluffos_v2/lib/daemon/include/
nightmare3_fluffos_v2/lib/daemon/save/
nightmare3_fluffos_v2/lib/daemon/services/
nightmare3_fluffos_v2/lib/daemon/soul/
nightmare3_fluffos_v2/lib/doc/
nightmare3_fluffos_v2/lib/doc/TestPlans/
nightmare3_fluffos_v2/lib/doc/approval/
nightmare3_fluffos_v2/lib/doc/approval/QC/
nightmare3_fluffos_v2/lib/doc/approval/balance/
nightmare3_fluffos_v2/lib/doc/build/
nightmare3_fluffos_v2/lib/doc/build/armours/
nightmare3_fluffos_v2/lib/doc/build/economy/
nightmare3_fluffos_v2/lib/doc/build/etc/
nightmare3_fluffos_v2/lib/doc/build/monster/
nightmare3_fluffos_v2/lib/doc/build/room/
nightmare3_fluffos_v2/lib/doc/build/virtual/
nightmare3_fluffos_v2/lib/doc/build/weapon/
nightmare3_fluffos_v2/lib/doc/classes/
nightmare3_fluffos_v2/lib/doc/efun/
nightmare3_fluffos_v2/lib/doc/etc/
nightmare3_fluffos_v2/lib/doc/help/creator/
nightmare3_fluffos_v2/lib/doc/help/hm/
nightmare3_fluffos_v2/lib/doc/law/
nightmare3_fluffos_v2/lib/doc/lpc/basic/
nightmare3_fluffos_v2/lib/doc/lpc/data_types/
nightmare3_fluffos_v2/lib/doc/lpc/etc/
nightmare3_fluffos_v2/lib/doc/lpc/intermediate/
nightmare3_fluffos_v2/lib/doc/lpc/types/
nightmare3_fluffos_v2/lib/doc/mudlib/
nightmare3_fluffos_v2/lib/doc/mudlib/features/
nightmare3_fluffos_v2/lib/domains/Examples/etc/
nightmare3_fluffos_v2/lib/domains/Examples/room/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaA/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaB/
nightmare3_fluffos_v2/lib/domains/Examples/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/
nightmare3_fluffos_v2/lib/domains/Praxis/adm/
nightmare3_fluffos_v2/lib/domains/Praxis/attic/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/mon/
nightmare3_fluffos_v2/lib/domains/Praxis/data/
nightmare3_fluffos_v2/lib/domains/Praxis/death/
nightmare3_fluffos_v2/lib/domains/Praxis/mountains/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/armour/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/magic/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/orc_valley/
nightmare3_fluffos_v2/lib/domains/Praxis/quests/
nightmare3_fluffos_v2/lib/domains/Praxis/standardOld/
nightmare3_fluffos_v2/lib/include/
nightmare3_fluffos_v2/lib/log/
nightmare3_fluffos_v2/lib/log/errors/
nightmare3_fluffos_v2/lib/log/reports/
nightmare3_fluffos_v2/lib/log/watch/
nightmare3_fluffos_v2/lib/news/
nightmare3_fluffos_v2/lib/secure/cfg/
nightmare3_fluffos_v2/lib/secure/cmds/ambassador/
nightmare3_fluffos_v2/lib/secure/cmds/mortal/
nightmare3_fluffos_v2/lib/secure/save/users/d/
nightmare3_fluffos_v2/lib/secure/std/
nightmare3_fluffos_v2/lib/std/hm/
nightmare3_fluffos_v2/lib/std/living/
nightmare3_fluffos_v2/lib/std/room/
nightmare3_fluffos_v2/lib/std/user/
nightmare3_fluffos_v2/lib/std/virtual/
nightmare3_fluffos_v2/lib/www/
nightmare3_fluffos_v2/lib/www/errors/
nightmare3_fluffos_v2/lib/www/gateways/
nightmare3_fluffos_v2/win32/
//	/adm/daemon/finger_d.c
//	from the Nightmare Mudlib
//	by Kalinash 18 Feb 94
//      Based on the old finger daemon by Descartes.

#include <objects.h>
#include <dirs.h>
#include <daemons.h>
#include <config.h>

inherit OB_USER;

string query_hah(object ob, int verbose);
string query_ttl(string name);

void create() {
    ::create();
}

string user_finger_display(string who) {
    object ob;
    mapping mail_stat;
    mixed birth;
    string drow, name, level, tmp, where;
    string race, Class, guild, gender;

    if(!who) return "You must specify whom you wish to finger.";
    name = lower_case(who);
    if(!user_exists(name)) return "No such member of the Nightmare Reality.";
    who = sprintf("%s/%s/%s", DIR_USERS, name[0..0], name);
    unguarded((: restore_object, who :));
    mail_stat = (mapping)FOLDERS_D->mail_status(name);
    drow = sprintf("%s\n", query_ttl(name));
    if(!race=query_race()) 
        race = "unborn";
    if(!Class=query_class())
        Class = "child";
    guild = query_guild();
    if(!gender=query_gender())
        gender = "neuter";
    if(query_description()) {
        tmp = sprintf("%s%s %s%%^RESET%%^\n", drow, capitalize(name), query_description());
        drow = tmp;
    }
    if(query_guild())
    tmp = sprintf("%s %s %s %s",capitalize(gender),
      capitalize(race), capitalize(Class), guild
      == "assassin" ? "" : "of the " + capitalize(pluralize(guild)));
    else
        tmp = sprintf("%s %s %s",capitalize(gender),
          capitalize(race), capitalize(Class));
    tmp = arrange_string(tmp, 40);
        level = capitalize(query_position());
    tmp = sprintf("%s%sLevel: %s (%d)\n", drow, tmp, level, query_level());
    drow = tmp;
    tmp = sprintf("In real life: %s", query_rname());
    tmp = arrange_string(tmp, 40);
    tmp = sprintf("%sMarried to : %s\n", tmp, !query_married() ? "No one" :
          capitalize(query_married()));
    drow = sprintf("%s%s", drow, tmp);
    birth = query_birthday();
    tmp = sprintf("%sBirthday: %s %d, %d BN\n", drow, capitalize(month(birth)),
      date(birth), (-(year(birth)-18)));
    drow = tmp;
    if(this_player() && archp(this_player()))
        if(query_email())
            tmp = sprintf("%sEmail : %s\n", drow, query_email());
        else
            tmp = sprintf("%sNo email address.\n", drow);
    drow = tmp;
    if(!(ob = find_player(name)) || (int)ob->query_invis() ||
      hiddenp(ob)) {
        tmp = sprintf("%sLast on: ", drow);
        drow = tmp;
    }
    else {
        tmp = query_hah(find_player(name), 1);
        if(tmp != "") {
            tmp = sprintf("%s%s\n", drow, tmp);
            drow = tmp;
        }
        tmp = sprintf("%sOn since : ", drow);
        drow = tmp;
    }
    if(query_where_block() && !archp(this_player()))
        where = "Anonymous";
    else
        where = query_ip();
    tmp = sprintf("%s%s from %s.\n", drow, last_on, where);
    drow = tmp;
    if(!mail_stat["unread"])
        tmp = sprintf("%sNo unread mail.\n", drow);
    else if(mail_stat["unread"] == 1)
        tmp = sprintf("%s1 unread piece of mail.\n", drow);
    else 
        tmp = sprintf("%s%d unread pieces of mail.\n", drow, mail_stat["unread"]);
    drow = tmp;
    who = user_path(name);
    if(unguarded((: file_exists, who+".project" :)))
      tmp = sprintf("%sProject: %s", drow,
        unguarded((: read_file, who+".project" :)));
    drow = tmp;
    if(unguarded((: file_exists, who+".plan" :)))
      tmp = drow +"Plan:\n"+unguarded((: read_file, who+".plan" :));
    else
        tmp = sprintf("%sNo Plan.\n", drow);
    drow = tmp;
    return drow;
}

string query_hah(object ob, int verbose) {
    int time, tmp;
    string line;
 
    if(!interactive(ob)) {
	if(verbose) return "Disconnected.";
	else return "disconnected";
    }
    line = "";
    time = query_idle(ob);
    if(time < 60) return line;
    tmp = time / 86400;
    if(tmp) {   
	if(!verbose) return tmp + " d";
	else line += tmp + " day" + (tmp>1 ? "s " : " ");
    }
    tmp = (time%86400)/3600;
    if(tmp) {   
      if(!verbose) {
	if(tmp>9) return tmp+" h";
	else line += tmp+":";
      }
	else line += tmp + " hour"+(tmp>1 ? "s " : " ");
   }
     tmp = (time%3600)/60;
   if(tmp) {   
 	if(!verbose) {  
	    if(strlen(line)>0 && tmp < 10) line += "0";
	    line += tmp;
	}
	else line += tmp+ " minute"+(tmp>1 ? "s " : " ");
    }
    if(verbose) line += "idle time";
    else line += "idle";
    return line;
}
 
string query_last_on() { return last_on; }
 
string query_ttl(string name) {
    string pre, post;
    if(!getenv("TITLE")) return capitalize(name);
    return replace_string(getenv("TITLE"), "$N", capitalize(name));
}
    
int remove() {
    destruct(this_object());
    return !(this_object());
}

int clean_up() {
    this_object()->remove();
    return 0;
}