Atrinik Server  4.0
Macros | Functions | Variables
book.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <player.h>
#include <object.h>
#include <exp.h>
#include <object_methods.h>
#include <artifact.h>
#include "common/process_treasure.h"

Go to the source code of this file.


#define BOOK_LEVEL_DIFF   12
#define BOOK_CHANCE_EMPTY   15


static int apply_func (object *op, object *applier, int aflags)
static int process_treasure_func (object *op, object **ret, int difficulty, treasure_affinity_t *affinity, int flags)


static int book_level_mod [MAX_STAT+1]
static double book_exp_mod [MAX_STAT+1]

Detailed Description

Handles code related to books.

Definition in file book.c.

Macro Definition Documentation

#define BOOK_CHANCE_EMPTY   15

Chance for generated random books to be empty - 1/x.

Definition at line 49 of file book.c.

#define BOOK_LEVEL_DIFF   12

Maximum amount of difference in levels between the book's level and the player's literacy skill.

Definition at line 44 of file book.c.

Function Documentation

static int apply_func ( object op,
object applier,
int  aflags 

Applies an object.

opThe object to apply.
applierThe object that executes the apply action.
aflagsSpecial (always apply/unapply) flags.

Definition at line 85 of file book.c.


Initialize the book type object methods.

Definition at line 238 of file book.c.

static int process_treasure_func ( object op,
object **  ret,
int  difficulty,
treasure_affinity_t *  affinity,
int  flags 

Process generated treasure.

opObject to process.
[out]retIf the function returns OBJECT_METHOD_OK, this variable will contain the processed treasure object, which may be different from 'op' (which may be destroyed). Indeterminate on any other return value.
difficultyDifficulty level.
affinityTreasure affinity.
flagsA combination of GT_xxx flags.
One of Object method return values.
If OBJECT_METHOD_ERROR is returned from this function, it is possible that the original object has been destroyed and thus any further processing should stop.

Definition at line 189 of file book.c.

Variable Documentation

double book_exp_mod[MAX_STAT+1]
Initial value:
= {
-2.00f, -1.90f, -1.80f, -1.70f, -1.60f,
-1.50f, -1.40f, -1.30f, -1.20f, -1.10f,
1.00f, 1.00f, 1.00f, 1.00f, 1.00f,
1.05f, 1.10f, 1.15f, 1.20f, 1.30f,
1.35f, 1.40f, 1.50f, 1.55f, 1.60f,
1.70f, 1.75f, 1.85f, 1.90f, 2.00f

The higher your intelligence, the more you are able to make use of the knowledge you read from books. Thus, you get more experience by reading books the more intelligence you have, and less experience if you have unnaturally low intelligence.

Definition at line 73 of file book.c.

int book_level_mod[MAX_STAT+1]
Initial value:
= {
-8, -7, -6, -5, -4,
-4, -3, -2, -2, -1,
0, 0, 0, 0, 0,
1, 1, 2, 2, 3,
3, 3, 4, 4, 5,
6, 7, 8, 9, 10

Affects BOOK_LEVEL_DIFF, depending on the player's intelligence stat. If the player is intelligent enough, they may be able to read higher level books; if their intelligence is too low, the maximum level books they can read will decrease.

Definition at line 57 of file book.c.