Atrinik Server  4.0
Data Structures | Macros | Typedefs | Functions
process_treasure.h File Reference
#include <toolkit/toolkit.h>

Go to the source code of this file.

Data Structures

struct  process_treasure_table
 

Macros

#define PROCESS_TREASURE_TABLE_TOTAL_CHANCE(table)   process_treasure_table_total_chance(table, arraysize(table))
 

Typedefs

typedef struct
process_treasure_table 
process_treasure_table_t
 

Functions

bool process_treasure_is_special (object *op)
 
uint32_t process_treasure_table_total_chance (const process_treasure_table_t *table, size_t table_size)
 
bool process_treasure_table (const process_treasure_table_t *table, size_t table_size, uint32_t total_chance, object *op, int difficulty, treasure_affinity_t *affinity, double *item_power)
 
bool process_treasure_table_jewelry (object *op, int difficulty, treasure_affinity_t *affinity, double *item_power)
 
void process_treasure_set_item_power (object *op, double item_power)
 

Detailed Description

Common treasure processing file.

Definition in file process_treasure.h.

Macro Definition Documentation

#define PROCESS_TREASURE_TABLE_TOTAL_CHANCE (   table)    process_treasure_table_total_chance(table, arraysize(table))

Compute the total chance of the specified treasure table.

Parameters
tableTreasure table.
Returns
Total chance of the treasure table.

Definition at line 73 of file process_treasure.h.

Typedef Documentation

Holds data about a single bonus type.

Function Documentation

bool process_treasure_is_special ( object op)

Checks if the specified treasure is already a special item.

Parameters
opObject to check.
Returns
True if the object is a special item, false otherwise.

Definition at line 258 of file process_treasure.c.

void process_treasure_set_item_power ( object op,
double  item_power 
)

Set calculated item power on the specified object.

Parameters
opObject.
item_powerItem power to set.

Definition at line 522 of file process_treasure.c.

bool process_treasure_table ( const process_treasure_table_t table,
size_t  table_size,
uint32_t  total_chance,
object op,
int  difficulty,
treasure_affinity_t *  affinity,
double *  item_power 
)

Process a specific treasure table and apply a single bonus from it to the specified item.

Parameters
tableTable to process.
table_sizeSize of the table.
total_chanceTotal chance of the specified table.
opObject to apply the bonus to.
difficultyDifficulty level.
affinityTreasure affinity.
[out]item_powerItem power adjustment. Make sure this value is initialized to something sane.
Returns
True if a bonus was applied, false otherwise.

Definition at line 408 of file process_treasure.c.

bool process_treasure_table_jewelry ( object op,
int  difficulty,
treasure_affinity_t *  affinity,
double *  item_power 
)

Process the jewelry treasure table and apply a single bonus from it to the specified item.

Parameters
opObject to apply the bonus to.
difficultyDifficulty level.
affinityTreasure affinity.
[out]item_powerItem power adjustment. Make sure this value is initialized to something sane.
Returns
True if a bonus was applied, false otherwise.

Definition at line 493 of file process_treasure.c.

uint32_t process_treasure_table_total_chance ( const process_treasure_table_t table,
size_t  table_size 
)

Calculate the total chance of the specified treasure table.

Parameters
tableTable.
table_sizeNumber of elements in the table.
Returns
Total table chance.

Definition at line 281 of file process_treasure.c.