Atrinik Server  4.0
Data Structures | Typedefs | Functions | Variables
exp.h File Reference
#include <global.h>

Go to the source code of this file.

Data Structures

struct  level_color


typedef struct level_color level_color_t


uint64_t level_exp (int level, double expmul)
int64_t add_exp (object *op, int64_t exp_gain, int skill_nr, int exact)
int exp_lvl_adj (object *who, object *op)
float calc_level_difference (int who_lvl, int op_lvl)


uint64_t new_levels [MAXLEVEL+2]
level_color_t level_color [201]

Detailed Description

Experience related header file.

Alex Tokar

Definition in file exp.h.

Typedef Documentation

typedef struct level_color level_color_t

Level color structure.

Function Documentation

int64_t add_exp ( object op,
int64_t  exp_gain,
int  skill_nr,
int  exact 

Add experience to player.

opThe player.
exp_gainHow much experience to add (or, in case the value being negative, subtract).
skill_nrSkill ID.
exactIf 1, experience gained will not be capped.
0 on failure, experience gained on success.

Definition at line 304 of file exp.c.

float calc_level_difference ( int  who_lvl,
int  op_lvl 

Calculate level difference.

We will get a bonus or malus value here, unless both levels match.

Yellow does not always mean same level, but in equal range.

Experience multiplication based on target color range:

  • yellow: Between 0.8 and 1.1 (80% - 110%).
  • blue: Between 0.4 and 0.6 (40% - 60%).
  • green: Between 0.25 and 0.3 (25% - 30%).
  • orange: Between 1.2 and 1.4 (120% - 140%).
  • red, purple: 1.4 + 0.1% per level.

If the target is in yellow range, the experience multiplication is between 0.8 and 1.1 (80% - 110%).

If the target is in blue range, the experience

Level difference.

Definition at line 490 of file exp.c.

int exp_lvl_adj ( object who,
object op 

Attempt to increase player's or skill object's level, if enough experience has been reached.

Will tell the player about changed levels.

whoPlayer. Cannot be NULL.
opWhat we are checking to gain the level (eg, skill). If NULL, will use 'who'.
Amount of levels affected. 0 if no change.

Definition at line 422 of file exp.c.

uint64_t level_exp ( int  level,
double  expmul 

Calculates how much experience is needed for a player to become the given level.

levelLevel to become.
expmulExperience multiplicator.
The experience needed.
Remove, since the param expmul seems to always be passed as '1.0'?

Definition at line 284 of file exp.c.