/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
#define SAVE "/w/newstyle/stats.o"
#define PERIOD 60*60*24*7

string *births, *deaths, *marriages;
string *criminals;
int log_time;
mapping murders;

string strlist(string *list)
{
   if(!list || !sizeof(list)) return "Nobody";
   if(sizeof(list) == 1) return list[0];
   return implode(list[0..sizeof(list)-2], ", ") + " and " +
   list[sizeof(list)-1];
}

string pairlist(string *list)
{
   int i;
   string ret;
   
   ret = "";
   if(!list || !sizeof(list) )return "Not a soul";
   for(i=0;i<sizeof(list); i += 2)
   ret += list[i]+" and "+list[i+1];
   
   return ret;
}

void reset_stats()
{
   births = deaths = marriages = ({ });
   murders = ([ ]);
}

void log_data()
{
   log_file("BDM", "Period "+ctime(time()-PERIOD)+" to "+ctime(time())+".\n");
   log_file("BDM", "Sadly passed away:\n"+strlist(deaths)+".\n");
   log_file("BDM", "Bouncing babies:\n"+strlist(births)+".\n");
   log_file("BDM", "Happily wed:\n"+pairlist(marriages)+".\n");
   reset_stats();
}

void create()
{
   reset_stats();
 seteuid(geteuid(this_object()));
   restore_object(SAVE, 1);
}

void dest_me()
{
   save_object(SAVE, 1);
   destruct(this_object());
}

void log_death(string name) { deaths += ({ name }); }
void log_birth(string name) { births += ({ name }); }
void log_marriage(string bride, string groom)
{
   marriages += ({ bride, groom });
}
void log_murder(object what)
{
   string index, junk;
   
   index = file_name(what);
   sscanf(index, "%s#%s", index, junk);
   
   if(!murders[index])
      murders[index] = 1;
   else
      murders[index]++;
}

string murder_table()
{
   /* return a nice table often killed things in the cache */
   string ret, *indexes;
   string *most;
   int i;
   
   return "";
}