Atrinik Server 2.5
Functions | Variables
server/item.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static char * describe_attack (object *op, int newline)
static char * get_number (int i)
char * describe_protections (object *op, int newline)
char * query_weight (object *op)
char * get_levelnumber (int i)
char * query_short_name (object *op, object *caller)
char * query_name (object *op, object *caller)
char * query_material_name (object *op)
char * query_base_name (object *op, object *caller)
static void describe_terrain (object *op, char *retbuf)
char * describe_item (object *op)
int need_identify (object *op)
void identify (object *op)
void set_trapped_flag (object *op)

Variables

static float weapon_speed_table [19]
static char numbers [21][20]
static char numbers_10 [10][20]
static char levelnumbers [21][20]
static char levelnumbers_10 [11][20]

Detailed Description

Item related functions

Definition in file item.c.


Function Documentation

static char * describe_attack ( object op,
int  newline 
) [static]

Generates the visible naming for attack forms. Returns a static array of the description. This can return a big buffer.

Parameters:
opObject to get the attack forms for.
newlineIf true, don't put parens around the description but do put a newline at the end. Useful when dumping to files.
Returns:
Static buffer with the attack forms.

Definition at line 132 of file item.c.

char* describe_item ( object op)

Returns a pointer to a static buffer which contains a description of the given object.

If it is a monster, lots of information about its abilities will be returned.

If it is an item, lots of information about which abilities will be gained about its user will be returned.

If it is a player, it writes out the current abilities of the player, which is usually gained by the items applied.

Used to describe every object in the game, including description of every flag, etc.

Parameters:
opObject that should be described.
Returns:
The described information.

Definition at line 1039 of file item.c.

char* describe_protections ( object op,
int  newline 
)

Generates the visible naming for protections. Returns a static array of the description. This can return a big buffer.

Parameters:
opObject to get the protections for.
newlineIf true, don't put parens around the description but do put a newline at the end. Useful when dumping to files.
Returns:
Static buffer with the protections.

Definition at line 184 of file item.c.

static void describe_terrain ( object op,
char *  retbuf 
) [static]

Describe terrain flags of a given object.

Parameters:
opThe object.
retbufCharacter buffer to store the described terrains.

Definition at line 989 of file item.c.

char* get_levelnumber ( int  i)

Formats a level.

Parameters:
iLevel to format.
Returns:
Word representation of the level.

Definition at line 258 of file item.c.

static char * get_number ( int  i) [static]

Returns the text representation of the given number in a static buffer. The buffer might be overwritten at the next call.

It is currently only used by the query_name() function.

Parameters:
iThe number.
Returns:
Text representation of the given number.

Definition at line 292 of file item.c.

void identify ( object op)

Identify an object. Basically sets FLAG_IDENTIFIED on the object along with other things.

Parameters:
opObject to identify.

Definition at line 1588 of file item.c.

int need_identify ( object op)

Checks if given object should need identification.

Parameters:
opObject to check.
Returns:
1 if this object needs identification, 0 otherwise.

Definition at line 1538 of file item.c.

char* query_base_name ( object op,
object caller 
)

Returns a character pointer pointing to a static buffer which contains a verbose textual representation of the name of the given object.

The buffer will be overwritten at the next call.

This is a lot like query_name(), but we don't include the item count or item status. Used for inventory sorting and sending to client.

Parameters:
opObject to get the base name from.
callerObject calling this.
Returns:
The base name of the object.

Definition at line 762 of file item.c.

char* query_material_name ( object op)

Queries an object's name, but only includes the name, title (if any) and material information (if any).

Parameters:
opObject.
Returns:
The object's name.

Definition at line 712 of file item.c.

char* query_name ( object op,
object caller 
)

Returns a character pointer pointing to a static buffer which contains a verbose textual representation of the name of the given object.

Uses 5 buffers that it will cycle through. In this way, you can make several calls to query_name before the bufs start getting overwritten. This may be a bad thing (it may be easier to assume the value returned is good forever). However, it makes printing statements that use several names much easier (don't need to store them to temp variables).

Parameters:
opObject to get the name from.
callerObject calling this.
Returns:
Full name of the object, with things like worn/cursed/etc.

Definition at line 592 of file item.c.

char* query_short_name ( object op,
object caller 
)

This function is similar to query_name(), but doesn't contain any information about the object status (worn/cursed/etc).

Parameters:
opObject to get the name from.
callerObject calling this.
Returns:
The short name of the object.

Definition at line 312 of file item.c.

char* query_weight ( object op)

Formats the item's weight.

Parameters:
opObject to get the weight of.
Returns:
The text representation of the object's weight in a static buffer.

Definition at line 232 of file item.c.

void set_trapped_flag ( object op)

Check if an object marked with FLAG_IS_TRAPPED still has a known trap in it.

Parameters:
opThe object to check.

Definition at line 1642 of file item.c.


Variable Documentation

char levelnumbers[21][20] [static]
Initial value:
{
    "zeroth",
    "first",
    "second",
    "third",
    "fourth",
    "fifth",
    "sixth",
    "seventh",
    "eighth",
    "ninth",
    "tenth",
    "eleventh",
    "twelfth",
    "thirteenth",
    "fourteenth",
    "fifteenth",
    "sixteenth",
    "seventeenth",
    "eighteen",
    "nineteen",
    "twentieth"
}

Levels as a full name and not a number.

Definition at line 81 of file item.c.

char levelnumbers_10[11][20] [static]
Initial value:
{
    "zeroth",
    "tenth",
    "twentieth",
    "thirtieth",
    "fortieth",
    "fiftieth",
    "sixtieth",
    "seventieth",
    "eightieth",
    "ninetieth"
}

Tens for levels

Definition at line 107 of file item.c.

char numbers[21][20] [static]
Initial value:
{
    "no",
    "",
    "two",
    "three",
    "four",
    "five",
    "six",
    "seven",
    "eight",
    "nine",
    "ten",
    "eleven",
    "twelve",
    "thirteen",
    "fourteen",
    "fifteen",
    "sixteen",
    "seventeen",
    "eighteen",
    "nineteen",
    "twenty"
}

Word representations of numbers used by get_number()

Definition at line 40 of file item.c.

char numbers_10[10][20] [static]
Initial value:
{
    "zero",
    "ten",
    "twenty",
    "thirty",
    "forty",
    "fifty",
    "sixty",
    "seventy",
    "eighty",
    "ninety"
}

Tens

Definition at line 66 of file item.c.

float weapon_speed_table[19] [static]
Initial value:
{
    20.0f,  18.0f,  10.0f,  8.0f,   5.5f,   4.25f,  3.50f,  3.05f,  2.70f,  2.35f,
    2.15f,  1.95f,  1.80f,  1.60f,  1.52f,  1.44f,  1.32f,  1.25f,  1.20f
}

Weapon speed table, to figure out a text representation of weapon's speed

Definition at line 33 of file item.c.