From the NannyMUD documentation
2000-12-16
kill_logger - Logging the kills players do in your area.
INTRODUCTION
This logger allows you to log kills, and nothing else. It shares
many treats with the other loggers, such as optimisation and disc
sanity.
FORMAT
The log written is kept in a special format, the entries are
indexed by the name of the player who has made the kill. For
each player an array of kills is kept, each kill containing
one of the following fields (as setup bu YOU):
FIELD_KILL_TIME
The time when the kill was done, as returned by time().
FIELD_PLAYER_LEVEL
The level of the player that made the kill.
FIELD_PLAYER_GUILD
The guild of the player that made the kill.
FIELD_PLAYER_ALIGN
The alignment of the player that made the kill.
FIELD_GAINED_XP
The ammount of XP gained by player from the kill.
FIELD_MONSTER_NAME
The name of the monster, as returned by query_name().
FIELD_MONSTER_WORTH
The ammount of GC the monster was carrying (not counted for
monsters with no corpse).
FIELD_MONSTER_ALIGN
The alignment of the monster that died.
FIELD_MONSTER_FILENAME
The full filename of the monster that died.
HOW TO USE
1/ Copy the file
/std/special/logger/kill_logger/kill_logger_inherit.c
to a good place in your directory structure.
2/ Copy the file
/std/special/logger/kill_logger/log_room.c
to a good place in your directory structure.
3/ Modify YOUR kill_logger_inherit.c as following:
3'1/ Change the return value of remote_get_log_filename
to return the file where you want your logged info to
be kept (ie. "log/kill_log" -> the datafile will reside
into /players/YOURNAME/log/kill_log.o).
3'2/ Comment any of the | (or) branches from
remote_get_log_fields to remove that specific information
from the logged data (it will be replaced with 0 in the
logfile).
4/ Modify #define LOGD in YOUR log_room.c to point at the file
where you placed your kill_logger_inherit (and, eventually, add
more code to suit your taste).
5/ For each monster you want logged, add a die_hook to your
kill_logger_inherit (ie. in reset(), near the place you set
the short/log etc. add:
add_hook("die_hook", PATH_TO_LOGGER_INHERIT);
Where PATH_TO_LOGGER_INHERIT is the path to YOUR copy of
kill_logger_inherit.c
1/ Entries older than 90 days will be removed.
2/ At most 999 entries will be kept in the file.
3/ At most 100 entries will be kept for a single player.
NAME
die_hook -SYNTAX
void die_hook(mixed arg, object player);DESCRIPTION
This is called whenever a monster dies.
FUNCTION
NAME
get_parsed_data -SYNTAX
mixed get_parsed_data()DESCRIPTION
Returns the data logged as specified above: a mapping indexed by the player name containing an array of array of fields. Each field can be reffered by FIELD_..info by the names described above. The fields you do not log (ie. are commented in kill_logger_inherit) are replaced with 0 instead of valid value.
FUNCTION
NAME
void clear_all_data -SYNTAX
void clear_all_data()DESCRIPTION
Calling this function clears the logged data.