Atrinik Server  4.0
Functions | Variables
statistics.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <player.h>
#include <object.h>

Go to the source code of this file.

Functions

void statistics_init (void)
 
void statistic_update (const char *type, object *op, int64_t i, const char *buf)
 
void statistics_player_logout (player *pl)
 

Variables

static int fd = -1
 
static struct sockaddr_in insock
 

Detailed Description

Handles player statistics.

Many statistics are currently cached in the player's structure as uint64 for performance reasons, as it's not very efficient to send a statistic update each time the player plays for another second, or casts a spell, or regenerates some health/mana. Thus, such statistics are only updated in statistics_player_logout(), which is called when the player logs out.

Definition in file statistics.c.

Function Documentation

void statistic_update ( const char *  type,
object op,
int64_t  i,
const char *  buf 
)

Update a particular statistic of a player.

Parameters
typeThe statistic type - a string that will be recognized by the statistics server and stored appropriately.
opThe player.
iInteger value to store. If 0, will not do any updating.
bufOptional string buffer to send.

Definition at line 83 of file statistics.c.

void statistics_init ( void  )

Initialize statistics; sets up the datagram file descriptor, etc.

Definition at line 50 of file statistics.c.

void statistics_player_logout ( player pl)

Handle player logging out, in order to update cached statistics from the player's data structure.

Parameters
plThe player.

Definition at line 111 of file statistics.c.

Variable Documentation

int fd = -1
static

File descriptor used for sending datagrams.

Definition at line 43 of file statistics.c.

struct sockaddr_in insock
static

Destination address.

Definition at line 45 of file statistics.c.