/adm/daemons/topuserd.c
The top user daemon collates player statistics and
produces a list of the mud's top players, based on their
total skills. You can include or exclude wizards, and/or
players up to a certain skill total.
WARNING: This program can take a long time to run,
especially if you have a lot of players, so it is best to
run it at a time when you are unlikely to have many people
logged on.
#defines:
RANK_NUM: Number of players in the list (maximum)
INCLUDE_WIZS: If defined, include wizards in list
MIN_SCORE: Minimum total skills for inclusion in list
OUTPUT_FILE: The name of the file to be listed to
Externally called functions:
int produce_list():
This is the main function that does the compiling of the
list. It performs the following: checks that the calling
object has ROOT_UID or is an admin, makes sure there is no
existing call in progress, and initializes variables etc.,
checks each player directory, calling scan_dir() for each,
sorts the list of players, and writes it to OUTPUT_FILE.
mixed *query_list():
Returns an array containing the names of all the players
and their skill totals, sorted in descending order.
Internal functions:
static int create_shell():
Creates a user object for the skills to be restored into,
so they can be queried easily and totalled.
static int scan_dir(string dir):
Scans dir for player files, calling process_user() for each.
static int process_user(string who):
Checks that file 'who' exists, restores it into body object,
queries and adds skills, and adds player to list if
appropriate.
static int create_list():
Writes the list to the file in an appropriate format.
Author: Blue@Atmos, 26th August 1993.