ds2.10/bin/
ds2.10/extra/
ds2.10/extra/crat/
ds2.10/extra/creremote/
ds2.10/extra/mingw/
ds2.10/extra/wolfpaw/
ds2.10/fluffos-2.16-ds05/
ds2.10/fluffos-2.16-ds05/Win32/
ds2.10/fluffos-2.16-ds05/compat/
ds2.10/fluffos-2.16-ds05/compat/simuls/
ds2.10/fluffos-2.16-ds05/include/
ds2.10/fluffos-2.16-ds05/testsuite/
ds2.10/fluffos-2.16-ds05/testsuite/clone/
ds2.10/fluffos-2.16-ds05/testsuite/command/
ds2.10/fluffos-2.16-ds05/testsuite/data/
ds2.10/fluffos-2.16-ds05/testsuite/etc/
ds2.10/fluffos-2.16-ds05/testsuite/include/
ds2.10/fluffos-2.16-ds05/testsuite/inherit/
ds2.10/fluffos-2.16-ds05/testsuite/inherit/master/
ds2.10/fluffos-2.16-ds05/testsuite/log/
ds2.10/fluffos-2.16-ds05/testsuite/single/
ds2.10/fluffos-2.16-ds05/testsuite/single/tests/compiler/
ds2.10/fluffos-2.16-ds05/testsuite/single/tests/efuns/
ds2.10/fluffos-2.16-ds05/testsuite/single/tests/operators/
ds2.10/fluffos-2.16-ds05/testsuite/u/
ds2.10/lib/cmds/admins/
ds2.10/lib/cmds/common/
ds2.10/lib/cmds/creators/include/
ds2.10/lib/daemon/services/
ds2.10/lib/daemon/tmp/
ds2.10/lib/doc/
ds2.10/lib/doc/bguide/
ds2.10/lib/doc/efun/all/
ds2.10/lib/doc/efun/arrays/
ds2.10/lib/doc/efun/buffers/
ds2.10/lib/doc/efun/compile/
ds2.10/lib/doc/efun/floats/
ds2.10/lib/doc/efun/functions/
ds2.10/lib/doc/efun/general/
ds2.10/lib/doc/efun/mixed/
ds2.10/lib/doc/efun/numbers/
ds2.10/lib/doc/efun/parsing/
ds2.10/lib/doc/help/classes/
ds2.10/lib/doc/help/races/
ds2.10/lib/doc/lfun/
ds2.10/lib/doc/lfun/all/
ds2.10/lib/doc/lfun/lib/abilities/
ds2.10/lib/doc/lfun/lib/armor/
ds2.10/lib/doc/lfun/lib/bank/
ds2.10/lib/doc/lfun/lib/bot/
ds2.10/lib/doc/lfun/lib/clay/
ds2.10/lib/doc/lfun/lib/clean/
ds2.10/lib/doc/lfun/lib/clerk/
ds2.10/lib/doc/lfun/lib/client/
ds2.10/lib/doc/lfun/lib/combat/
ds2.10/lib/doc/lfun/lib/connect/
ds2.10/lib/doc/lfun/lib/container/
ds2.10/lib/doc/lfun/lib/corpse/
ds2.10/lib/doc/lfun/lib/creator/
ds2.10/lib/doc/lfun/lib/daemon/
ds2.10/lib/doc/lfun/lib/damage/
ds2.10/lib/doc/lfun/lib/deterioration/
ds2.10/lib/doc/lfun/lib/donate/
ds2.10/lib/doc/lfun/lib/door/
ds2.10/lib/doc/lfun/lib/equip/
ds2.10/lib/doc/lfun/lib/file/
ds2.10/lib/doc/lfun/lib/fish/
ds2.10/lib/doc/lfun/lib/fishing/
ds2.10/lib/doc/lfun/lib/flashlight/
ds2.10/lib/doc/lfun/lib/follow/
ds2.10/lib/doc/lfun/lib/ftp_client/
ds2.10/lib/doc/lfun/lib/ftp_data_connection/
ds2.10/lib/doc/lfun/lib/fuel/
ds2.10/lib/doc/lfun/lib/furnace/
ds2.10/lib/doc/lfun/lib/genetics/
ds2.10/lib/doc/lfun/lib/holder/
ds2.10/lib/doc/lfun/lib/id/
ds2.10/lib/doc/lfun/lib/interactive/
ds2.10/lib/doc/lfun/lib/lamp/
ds2.10/lib/doc/lfun/lib/leader/
ds2.10/lib/doc/lfun/lib/light/
ds2.10/lib/doc/lfun/lib/limb/
ds2.10/lib/doc/lfun/lib/living/
ds2.10/lib/doc/lfun/lib/load/
ds2.10/lib/doc/lfun/lib/look/
ds2.10/lib/doc/lfun/lib/manipulate/
ds2.10/lib/doc/lfun/lib/meal/
ds2.10/lib/doc/lfun/lib/messages/
ds2.10/lib/doc/lfun/lib/player/
ds2.10/lib/doc/lfun/lib/poison/
ds2.10/lib/doc/lfun/lib/position/
ds2.10/lib/doc/lfun/lib/post_office/
ds2.10/lib/doc/lfun/lib/potion/
ds2.10/lib/doc/lfun/lib/room/
ds2.10/lib/doc/lfun/lib/server/
ds2.10/lib/doc/lfun/lib/spell/
ds2.10/lib/doc/lfun/lib/torch/
ds2.10/lib/doc/lfun/lib/vendor/
ds2.10/lib/doc/lfun/lib/virt_sky/
ds2.10/lib/doc/lfun/lib/weapon/
ds2.10/lib/doc/lfun/lib/worn_storage/
ds2.10/lib/doc/lpc/constructs/
ds2.10/lib/doc/lpc/etc/
ds2.10/lib/doc/lpc/intermediate/
ds2.10/lib/doc/lpc/types/
ds2.10/lib/doc/misc/
ds2.10/lib/doc/old/
ds2.10/lib/doc/phints/
ds2.10/lib/domains/
ds2.10/lib/domains/Praxis/adm/
ds2.10/lib/domains/Praxis/attic/
ds2.10/lib/domains/Praxis/cemetery/mon/
ds2.10/lib/domains/Praxis/data/
ds2.10/lib/domains/Praxis/death/
ds2.10/lib/domains/Praxis/mountains/
ds2.10/lib/domains/Praxis/obj/armour/
ds2.10/lib/domains/Praxis/obj/magic/
ds2.10/lib/domains/Praxis/obj/weapon/
ds2.10/lib/domains/Praxis/orc_valley/
ds2.10/lib/domains/Ylsrim/
ds2.10/lib/domains/Ylsrim/adm/
ds2.10/lib/domains/Ylsrim/armor/
ds2.10/lib/domains/Ylsrim/broken/
ds2.10/lib/domains/Ylsrim/fish/
ds2.10/lib/domains/Ylsrim/meal/
ds2.10/lib/domains/Ylsrim/npc/
ds2.10/lib/domains/Ylsrim/obj/
ds2.10/lib/domains/Ylsrim/virtual/
ds2.10/lib/domains/Ylsrim/weapon/
ds2.10/lib/domains/alpha/room/
ds2.10/lib/domains/alpha/virtual/
ds2.10/lib/domains/campus/adm/
ds2.10/lib/domains/campus/etc/
ds2.10/lib/domains/campus/meals/
ds2.10/lib/domains/campus/txt/ai/charles/
ds2.10/lib/domains/campus/txt/ai/charles/bak2/
ds2.10/lib/domains/campus/txt/ai/charles/bak2/bak1/
ds2.10/lib/domains/campus/txt/ai/charly/
ds2.10/lib/domains/campus/txt/ai/charly/bak/
ds2.10/lib/domains/campus/txt/jenny/
ds2.10/lib/domains/cave/doors/
ds2.10/lib/domains/cave/etc/
ds2.10/lib/domains/cave/meals/
ds2.10/lib/domains/cave/weap/
ds2.10/lib/domains/default/chamber/
ds2.10/lib/domains/default/creator/
ds2.10/lib/domains/default/doors/
ds2.10/lib/domains/default/etc/
ds2.10/lib/domains/default/vehicle/
ds2.10/lib/domains/default/virtual/
ds2.10/lib/domains/town/save/
ds2.10/lib/domains/town/txt/shame/
ds2.10/lib/domains/town/virtual/
ds2.10/lib/domains/town/virtual/bottom/
ds2.10/lib/domains/town/virtual/space/
ds2.10/lib/estates/
ds2.10/lib/ftp/
ds2.10/lib/lib/comp/
ds2.10/lib/lib/daemons/
ds2.10/lib/lib/daemons/include/
ds2.10/lib/lib/lvs/
ds2.10/lib/lib/user/
ds2.10/lib/lib/virtual/
ds2.10/lib/log/
ds2.10/lib/log/adm/
ds2.10/lib/log/archive/
ds2.10/lib/log/chan/
ds2.10/lib/log/errors/
ds2.10/lib/log/law/adm/
ds2.10/lib/log/law/email/
ds2.10/lib/log/law/names/
ds2.10/lib/log/law/sites-misc/
ds2.10/lib/log/law/sites-register/
ds2.10/lib/log/law/sites-tempban/
ds2.10/lib/log/law/sites-watch/
ds2.10/lib/log/open/
ds2.10/lib/log/reports/
ds2.10/lib/log/router/
ds2.10/lib/log/secure/
ds2.10/lib/log/watch/
ds2.10/lib/obj/book_source/
ds2.10/lib/obj/include/
ds2.10/lib/powers/prayers/
ds2.10/lib/powers/spells/
ds2.10/lib/realms/template/
ds2.10/lib/realms/template/adm/
ds2.10/lib/realms/template/area/
ds2.10/lib/realms/template/area/armor/
ds2.10/lib/realms/template/area/npc/
ds2.10/lib/realms/template/area/obj/
ds2.10/lib/realms/template/area/room/
ds2.10/lib/realms/template/area/weap/
ds2.10/lib/realms/template/bak/
ds2.10/lib/realms/template/cmds/
ds2.10/lib/save/kills/o/
ds2.10/lib/secure/cfg/classes/
ds2.10/lib/secure/cmds/builders/
ds2.10/lib/secure/cmds/creators/include/
ds2.10/lib/secure/cmds/players/include/
ds2.10/lib/secure/daemon/imc2server/
ds2.10/lib/secure/daemon/include/
ds2.10/lib/secure/lib/
ds2.10/lib/secure/lib/include/
ds2.10/lib/secure/lib/net/include/
ds2.10/lib/secure/lib/std/
ds2.10/lib/secure/log/adm/
ds2.10/lib/secure/log/bak/
ds2.10/lib/secure/log/intermud/
ds2.10/lib/secure/log/network/
ds2.10/lib/secure/modules/
ds2.10/lib/secure/npc/
ds2.10/lib/secure/obj/include/
ds2.10/lib/secure/room/
ds2.10/lib/secure/save/
ds2.10/lib/secure/save/backup/
ds2.10/lib/secure/save/boards/
ds2.10/lib/secure/save/players/g/
ds2.10/lib/secure/tmp/
ds2.10/lib/secure/upgrades/files/
ds2.10/lib/secure/verbs/creators/
ds2.10/lib/std/board/
ds2.10/lib/std/lib/
ds2.10/lib/verbs/admins/include/
ds2.10/lib/verbs/builders/
ds2.10/lib/verbs/common/
ds2.10/lib/verbs/common/include/
ds2.10/lib/verbs/creators/
ds2.10/lib/verbs/creators/include/
ds2.10/lib/verbs/rooms/
ds2.10/lib/verbs/rooms/include/
ds2.10/lib/www/client/
ds2.10/lib/www/errors/
ds2.10/lib/www/images/
ds2.10/win32/
/*    /cmds/players/biography.c
 *    from the NIghtmare V Object Library
 *    biography
 *    created by Descartes of Borg 951217
 */

#include <lib.h>
#include <clock.h>
#include <daemons.h>
#include <marriage.h>
#include <message_class.h>

inherit LIB_DAEMON;

mixed cmd(string args) {
    class marriage *m;
    mapping *deaths;
    mapping kills;
    string *npcs, *tmp, *col1, *col2, *col3;
    string yrstr;
    int x, cols, birth, i;

    cols = ((int *)this_player()->GetScreen())[0];
    tmp = ({ center("Biography for " + (string)this_player()->GetShort() +
                " on " + mud_name(), cols), "" });
    birth = (int)this_player()->GetBirth();
    x = query_year(birth);
    if( x < 0 ) yrstr = (-x) + " BN";
    else yrstr = x + "";
    tmp += ({ sprintf("%:-"+(cols/2)+"s%"+(cols/2)+"s", "Level: " +
                (int)this_player()->GetLevel(), "Age: " +
                ((time() - birth)/YEAR) + " years") });
    tmp = ({ "You are " + (string)this_player()->GetMoralityDescription()
            + "." });
    tmp += ({ sprintf("You were born on the %d%s day of %s, year %s.",
                query_date(birth), ordinal(query_date(birth)),
                query_month(birth), yrstr) });
    m = (class marriage *)this_player()->GetMarriages();
    if( !sizeof(m) ) tmp += ({ "You have never been married." });
    else {
        class marriage marr;
        string town;

        marr = m[0];
        if( !marr->DivorceDate ) {
            x = query_year(marr->WeddingDate);
            if( x < 0 ) yrstr = (-x) + " BN";
            else yrstr = x + "";
            town = (string)(marr->Location)->GetTown();
            if( !town || town == "wilderness" ) town = ".";
            else town = " in " + town + ".";
            tmp += ({ "You married " + marr->Spouse + " the " +
                    ordinal(query_date(marr->WeddingDate)) + " of " +
                    query_month(marr->WeddingDate) + " " + yrstr + town });
            if( sizeof(m) > 1 ) m = m[1..];
            else m = ({});
        }
        if( i = sizeof(m) ) {
            tmp += ({ "Past marriages:" });
            while(i--) {
                string yrstr2;

                marr = m[i];
                x = query_year(marr->WeddingDate);
                if( x < 0 ) yrstr = (-x) + " BN";
                else yrstr = x + "";
                x = query_year(marr->DivorceDate);
                if( x < 0 ) yrstr2 = (-x) + " BN";
                else yrstr2 = x + "";
                town = (string)(marr->Location)->GetTown();
                if( !town || town == "wilderness" ) town = "";
                else town = " in " + town;		
                tmp += ({ "You married " + marr->Spouse + " " +
                        query_month(marr->WeddingDate) + " " +
                        query_date(marr->WeddingDate) + ", " + yrstr +
                        town + ", divorced " +
                        query_month(marr->DivorceDate) + " " +
                        query_date(marr->DivorceDate) + ", " + yrstr2 + "."
                        });
            }
        }
    }
    deaths = (mapping *)this_player()->GetDeaths();
    if( !(x = sizeof(deaths)) )
        tmp += ({ "You have never suffered the pain of death." });
    else {
        mapping *d1, *d2;

        tmp += ({ "", "Death has cast its shadow over you on the following " +
                consolidate(x, "occasion") + ":" });
        if( x == 1 ) {
            d1 = deaths[0..0];
            d2 = ({});
        }
        else {
            d1 = deaths[0..(x-1)];
            d2 = deaths[x..];
        }
        for(i=0; i<x; i++)
            tmp += ({ sprintf("%:-" + (cols/2) + "s%s",
                        (i >= sizeof(d1)) ? "" :
                        d1[i]["enemy"],
                        (i >= sizeof(d2)) ? "" :			
                        d2[i]["enemy"]) });
    }	    
    kills = (mapping)STATISTICS_D->GetKills((string)this_player()->GetKeyName());
    npcs = sort_array(keys(kills), 1);
    if( !(x = sizeof(npcs)) )
        tmp += ({ "You have never brought harm to another." });
    else {
        tmp += ({ "","You are responsible for the deaths of the following:" });
        if( x < 3 ) {
            col1 = npcs[0..0];
            if( x == 2 ) col2 = npcs[1..1];
            else col2 = ({});
            col3 = ({});
        }
        else {
            x = x/3;
            col1 = npcs[0..(x-1)];
            col2 = npcs[x..(x+x-1)];
            col3 = npcs[(2*x)..];
        }
        for(i=0; i<x; i++)
            tmp += ({ sprintf("%:-" + (cols/2) + "s%:-" + (cols/2) + "s%s",
                        (i >= sizeof(col1)) ? "" :			
                        col1[i] + " (" + kills[col1[i]] + ")",
                        (i >= sizeof(col2)) ? "" :			
                        col2[i] + " (" + kills[col2[i]] + ")",
                        (i >= sizeof(col3)) ? "" :
                        col3[i] + " (" + kills[col3[i]] + ")") });
    }
    this_player()->eventPage(tmp, MSG_SYSTEM);
    return 1;
}

string GetHelp(string str) {
    return ("Syntax: <biography>\n\n"
            "Biography gives you a full account of the sort of life you "
            "have lived on " + mud_name() + ".  This information details "
            "such things as your birth, deaths, marriages, and other life "
            "information.\n\n"
            "See also: score");
}