 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
49 extern int check_altar_sacrifice(
const object *altar,
const object *sacrifice,
int remove_others,
int *toremove);
56 extern void check_inv(
object *op,
object *trig);
61 extern int64_t
new_exp(
const object *ob);
127 extern object *
identify(
object *op);
135 extern uint64_t
price_base(
const object *obj);
137 extern const char *
i18n(
const object *who,
const char *
code);
163 extern void set_dragon_name(
object *pl,
const object *abil,
const object *skin);
171 extern void change_exp(
object *op, int64_t exp,
const char *skill_name,
int flag);
174 extern void share_exp(
object *op, int64_t exp,
const char *
skill,
int flag);
228 extern
int on_same_map(const
object *op1, const
object *op2);
235 extern
char *
ob_describe(const
object *op, const
object *observer,
int use_media_tags,
char *
buf,
size_t size);
265 extern
void object_copy(const
object *src_ob,
object *dest_ob);
285 extern
object *
object_split(
object *orig_ob, uint32_t nr,
char *err,
size_t size);
306 extern
int dirdiff(
int dir1,
int dir2);
329 extern
int object_set_value(
object *op, const
char *key, const
char *value,
int add_key);
336 extern
int save_object(FILE *fp,
object *op,
int flag);
341 extern
char *
path_combine(const
char *src, const
char *dst,
char *path,
size_t size);
345 extern FILE *
tempnam_secure(const
char *dir, const
char *pfx,
char **filename);
347 extern
int ihypot(
int a,
int b);
348 extern
int isqrt(
int n);
365 extern const
char *
re_cmp(const
char *str, const
char *regexp);
367 extern
int nstrtok(const
char *buf1, const
char *buf2);
368 extern
char *
strtoktolin(const
char *buf1, const
char *buf2,
char *retbuf,
size_t size);
380 extern
void init_msgfile(FILE *file, const
char *filename);
423 extern
long usec_elapsed(struct timespec first, struct timespec second);
432 extern
long timespec_diff(struct timespec *end, struct timespec *start);
449 extern
int random_roll(
int min,
int max, const
object *op,
int goodbad);
450 extern int64_t
random_roll64(int64_t min, int64_t max, const
object *op,
int goodbad);
451 extern
int die_roll(
int num,
int size, const
object *op,
int goodbad);
452 extern
int rndm(
int min,
int max);
458 extern
void replace(const
char *src, const
char *key, const
char *replacement,
char *result,
size_t resultsize);
464 extern
size_t split_string(
char *str,
char *array[],
size_t array_size,
char sep);
481 extern
void yyfree(
void *ptr);
482 extern
int load_object(FILE *fp,
object *op,
int bufstate,
int map_flags,
bool artifact_init);
int object_find_multi_free_spot_within_radius(const object *ob, const object *gen, int *hx, int *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, within radius of generator,...
New face structure - this enforces the notion that data is face by face only - you can not change the...
void clear_friendly_list(void)
Totally clear the friendly list.
void path_normalize(char *path)
Cleans specified path.
bool check_recipes()
Ensure that all recipes have a valid artifact, and that archetypes are correct.
void share_exp(object *op, int64_t exp, const char *skill, int flag)
Gives experience to a player/monster, sharing it with party if applicable.
void object_remove_from_active_list(object *op)
This function removes object 'op' from the list of active objects.
void yyset_out(FILE *out_str)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
recipelist * get_formulalist(int i)
Gets a formula list by ingredients count.
int get_dex_bonus(int stat)
void object_unset_flag_inv(object *op, int flag)
Desactivate recursively a flag on an object inventory.
const char * get_periodofday(const int index)
give access to weekday names
void object_add_weight(object *op, signed long weight)
object_add_weight(object, weight) adds the specified weight to an object, and also updates how much t...
void clear_los(player *pl)
Clears/initialises the los-array associated to the player controlling the object.
mapstruct * get_empty_map(int sizex, int sizey)
Creates and returns a map of the specific size.
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(),...
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
object * object_find_by_flag_applied(const object *who, int flag)
Find applied object in inventory by flag.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
One general message, from the lib/messages file.
int dirdiff(int dir1, int dir2)
Computes a direction difference.
unsigned int tick_length(float seconds)
Calculate the number of ticks that correspond to real time.
StringBuffer * stringbuffer_new(void)
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
bool object_value_set_shared(const object *op, sstring key)
Determine if an extra value is set to a non empty or 0 value.
void replace(const char *src, const char *key, const char *replacement, char *result, size_t resultsize)
Replace in string src all occurrences of key by replacement.
void register_describe(int ob_type, describe_func method)
Registers the describe method for the given type.
const Face * try_find_face(const char *name, const Face *error)
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
void tailor_readable_ob(object *book, int msg_type)
The main routine.
int object_can_pick(const object *who, const object *item)
Finds out if an object can be picked up.
void free_player(player *pl)
Frees player structure, including pointed object (through object_free_drop_inventory()).
const char * player_get_own_title(const struct player *pl)
Returns the player's own title.
int player_has_own_title(const struct player *pl)
Returns whether the player has a custom title.
void free_objectlinkpt(oblinkpt *obp)
Recursively frees all linked list of objectlink pointers.
void * language_t
Strings that should be manipulated through add_string() and free_string().
FILE * tempnam_secure(const char *dir, const char *pfx, char **filename)
A replacement for the tempnam_local() function since that one is not very secure.
This stores, for a spell a player knows, the last sp/gr/dam information sent to client.
const char * get_region_longname(const region *r)
Gets the longname of a region.
void write_todclock(void)
Write out the current time to the file so time does not reset every time the server reboots.
void transmute_materialname(object *op, const object *change)
When doing transmutation of objects, we have to recheck the resistances, as some that did not apply p...
int calculate_difficulty(mapstruct *m)
This routine is supposed to find out the difficulty of the map.
method_ret(* trigger_func)(object *, object *, int)
void create_template_pathname(const char *name, char *buf, size_t size)
same as create_pathname(), but for the template maps.
int get_dialog_message(object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply)
Tries to find a message matching the said text.
void init_msgfile(FILE *file, const char *filename)
const Face * find_face(const char *name)
void free_experience(void)
Frees experience-related memory.
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
Returns true if the given coordinate is blocked except by the object passed is not blocking.
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
long seconds(void)
Return wall clock time in seconds.
void init_attackmess(BufferReader *reader, const char *filename)
Initializes the attack messages.
object * object_find_by_type_applied(const object *who, int type)
Find applied object in inventory.
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
void dump_arch(archetype *at, StringBuffer *sb)
Dumps an archetype to buffer.
object * object_find_by_type(const object *who, int type)
Find object in inventory.
void animate_turning(object *op)
Animates one step of object.
const Face * get_face_by_id(uint16_t id)
Get a face from its unique identifier.
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
char * path_combine(const char *src, const char *dst, char *path, size_t size)
Combines 2 paths, which can be relative.
void dump_experience(void)
Dump the experience table, then calls exit() - useful in terms of debugging to make sure the format o...
StringBuffer * describe_attacktype(const char *attack, int value, StringBuffer *buf)
Describe the specified attack type.
int is_type_valid(uint8_t type)
Checks if the specified type is a valid one for a Crossfire object.
int nstrtok(const char *buf1, const char *buf2)
Simple routine to return the number of list items in buf1 as separated by the value of buf2.
int object_count_free(void)
Objects statistics.
size_t get_faces_count(void)
object * arch_present_in_ob(const archetype *at, const object *op)
Searches for any objects with a matching archetype in the inventory of the given object.
void init_regions(BufferReader *reader, const char *filename)
Reads/parses the region file, and copies into a linked list of region structs.
int object_can_merge(object *ob1, object *ob2)
Examines the 2 objects given to it, and returns true if they can be merged together,...
void make_sure_seen(const object *op)
The object is supposed to be visible through walls, thus check if any players are nearby,...
void player_get_title(const struct player *pl, char *buf, size_t bufsize)
const object * find_god(const char *name)
Returns a god's object from its name.
void object_replace_insert_in_map(const char *arch_string, object *op)
This function inserts an object of a specified archetype in the map, but if it finds objects of its o...
float get_speed_bonus(int stat)
language_t i18n_get_language_by_code(const char *code)
Find the identifier of a language from its code.
void object_update_speed(object *op)
Updates the speed of an object.
#define PRINTF_ARGS(x, y)
Used for printf-like functions, mostly LOG and draw_ext_info_format.
int out_of_map(mapstruct *m, int x, int y)
Return 1 if coordinates X and Y are out of the map M, taking into account tiling.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
void object_dump_all(void)
Dumps all objects to console.
void query_weight(const object *op, char *buf, size_t size)
Formats the item's weight.
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
Describe the specified path attenuation.
void init_library(void)
It is vital that init_library() is called by any functions using this library.
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could al...
int is_identified(const object *op)
Return true if the item is identified, either because it is of a type that doesn't ever need identifi...
int get_randomized_dir(int dir)
Returns a random direction (1..8) similar to a given direction.
void set_tick_duration(long t)
Sets the tick duration.
Represents the ingame time.
const char * recipe_get_difficulty_string(int difficulty)
A method to produce a difficulty adjective to describe alchemy projects.
void treasure_free(treasure *t)
Frees a treasure, including its yes, no and next items.
void clear_player(player *pl)
Clears data in player structure.
int64_t level_exp(int level, double expmul)
Returns how much experience is needed for a player to become the given level.
method_ret(* process_func)(object *)
int remove_depletion(object *op, int level)
Remove depletion from op, if present, and warn player of such restorations.
object * check_inv_recursive(object *op, const object *trig)
Checks object and its inventory for specific item.
void drain_specific_stat(object *op, int deplete_stats)
Drain a specified stat from op.
int load_object_from_reader(BufferReader *reader, object *op, int map_flags, bool arch_init, bool artifact_init)
Load an object from the specified reader, stopping when the object is complete.
int get_rangevector_from_mapcoord(const mapstruct *m, int x, int y, const object *op2, rv_vector *retval)
This is basically the same as get_rangevector() above, but instead of the first parameter being an ob...
FILE * yyget_out(void)
Get the output stream.
void apply_death_exp_penalty(object *op)
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percent...
int get_button_value(const object *button)
Returns the first value linked to this button.
void get_search_arr(int *search_arr)
New function to make monster searching more efficient, and effective! This basically returns a random...
int calc_item_power(const object *op)
This takes an object 'op' and figures out what its item_power rating should be.
static const flag_definition flags[]
Flag mapping.
archetype * find_archetype_by_object_type_name(int type, const char *name)
This function retrieves an archetype by type and name that appears during the game.
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
fix_generated_item(): This is called after an item is generated, in order to set it up right.
object * object_find_by_flag(const object *who, int flag)
Find object in inventory by flag.
void make_list_like(char *input)
Taking a string as an argument, mutate it into a string that looks like a list.
void object_update(object *op, int action)
object_update() updates the array which represents the map.
void check_inv(object *op, object *trig)
Function to search the inventory, of a player and then based on a set of conditions,...
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
object * get_random_mon(int level)
Returns a random monster selected from linked list of all monsters in the current game.
void treasure_remove_item(treasurelist *list, int position)
Remove the treasure at the specified position from the list.
void object_free_all_data(void)
Destroys all allocated objects.
StringBuffer * describe_resistance(const object *op, int newline, int use_media_tags, StringBuffer *buf)
Generates the visible naming for resistances.
void free_all_maps(void)
Frees all allocated maps.
archetype * get_archetype_by_type_subtype(int type, int subtype)
Retrieves an archetype by type and subtype.
long usec_elapsed(struct timespec first, struct timespec second)
Return the number of microseconds between two timespec structures.
Used to link together several object links.
void object_give_identified_properties(object *op)
Ensure op has all its "identified" properties set.
void add_statbonus(object *op)
Adds stat-bonuses given by the class which the player has chosen.
void set_materialname(object *op)
Set the material name and type for an item, if not set.
int adjust_dir(int dir, int destination_dir)
Adjusts a given direction by +/-1 towards a destination direction.
int object_check_move_on(object *op, object *originator)
Checks if any objects has a move_type that matches objects that effect this object on this space.
void yyset_in(FILE *in_str)
Set the input stream.
int load_object(FILE *fp, object *op, int bufstate, int map_flags, bool artifact_init)
Loads an object from the given file-pointer.
void init_objects(void)
Sets up and initialises the linked list of free and used objects.
client_spell * get_client_spell_state(player *pl, object *spell)
Gets the (client-side) spell state for specified spell.
const artifact * find_artifact(const object *op, const char *name)
Searches and returns a specific artifact compatible with an object, NULL if not found.
int is_wraith_pl(object *op)
Tests if a player is a wraith.
void void init_block(void)
initialises the array used by the LOS routines.
void free_all_recipes(void)
Frees all memory allocated to recipes and recipes lists.
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
void decay_objects(mapstruct *m)
Decay and destroy persihable items in a map.
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
void make_path_to_file(const char *filename)
Checks if any directories in the given path doesn't exist, and creates if necessary.
void create_overlay_pathname(const char *name, char *buf, size_t size)
Same as create_pathname(), but for the overlay maps.
sstring stringbuffer_finish_shared(StringBuffer *sb)
const object * get_rand_god(void)
Returns a random god.
void free_charlinks(linked_char *lc)
Frees a link structure and its next items.
void update_all_los(const mapstruct *map, int x, int y)
This function makes sure that update_los() will be called for all players on the given map within the...
void free_globals(void)
Cleans all memory allocated for global variables.
void yyset_lineno(int line_number)
Set the current line number.
void clean_tmp_map(mapstruct *m)
Removse the temporary file used by the map.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
object * object_find_by_type2(const object *who, int type1, int type2)
Find object in inventory.
void free_loader(void)
Frees all memory allocated by the loader.
const char * get_colorname(uint8_t index)
const typedata * get_typedata_by_name(const char *name)
Plugin animator file specs[Config] name
method_ret ob_trigger(object *op, object *cause, int state)
An object is triggered by another one.
int exp_level(int64_t exp)
Returns the level for a given exp.
uint32_t get_weight_limit(int stat)
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
From map.c This is used by get_player to determine where the other creature is.
const char * re_cmp(const char *str, const char *regexp)
re-cmp - get regular expression match.
sstring get_message_body(const GeneralMessage *message)
Get a message's body.
const char * get_name_of_region_for_map(const mapstruct *m)
Gets the name of a region for a map.
uint8_t find_color(const char *name)
Finds a color by name.
void yyset_debug(int bdebug)
void update_all_map_los(mapstruct *map)
update all_map_los is like update_all_los() below, but updates everyone on the map,...
void set_dragon_name(object *pl, const object *abil, const object *skin)
Set the new dragon name after gaining levels or changing ability focus (later this can be extended to...
Link an object type with skill needed to identify, and general name.
mapstruct * has_been_loaded(const char *name)
Checks whether map has been loaded.
static event_registration m
int64_t new_exp(const object *ob)
Alternative way to calculate experience based on the ability of a monster.
int describe_god(const object *god, int what, StringBuffer *buf, size_t maxlen)
Describe a god.
int find_smooth(const Face *face, const Face **smoothed)
Find the smooth face for a given face.
int is_valid_faceset(int fsn)
Checks specified faceset is valid.
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
Recursive routine to see if we can find a path to a certain point.
int load_png_file(FILE *file, const char *full_path)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
Computes the size of a multitile object.
bool check_formulae(void)
Check if formula don't have the same index.
object * create_singularity(const char *name)
Creates a dummy object.
int object_count_active(void)
Objects statistics.
void update_los(object *op)
Recalculates the array which specifies what is visible for the given player-object.
Animations * find_animation(const char *name)
int allowed_class(const object *op)
Returns true if the given player is a legal class.
int absdir(int d)
Computes an absolute direction.
Used to link together several objects.
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
List of recipes with a certain number of ingredients.
void add_button_link(object *button, mapstruct *map, int connected)
Links specified object in the map.
artifactlist * get_empty_artifactlist(void)
Allocate and return the pointer to an empty artifactlist structure.
void object_clear_owner(object *op)
Clears the owner of specified object.
void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat)
Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_s...
artifact * get_empty_artifact(void)
Allocate and return the pointer to an empty artifact structure.
void(* describe_func)(const object *, const object *, int use_media_tags, char *buf, size_t size)
void update_buttons(mapstruct *m)
Updates every button on the map (by calling update_button() for them).
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
void register_trigger(int ob_type, trigger_func method)
Registers the trigger method for the given type.
object * object_find_by_tag_global(tag_t i)
Returns the object which has the count-variable equal to the argument.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
int object_count_used(void)
Object statistics.
int region_is_child_of_region(const region *child, const region *r)
Checks if a region is a child of another.
treasurelist represents one logical group of items to be generated together.
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
const GeneralMessage * get_message_from_identifier(const char *identifier)
Find the message from its identifier.
object * object_get_player_container(object *op)
Finds the player carrying an object.
void object_merge_spell(object *op, int16_t x, int16_t y)
This sees if there are any objects on the space that can merge with op.
const char * get_region_msg(const region *r)
Gets a message for a region.
treasure * treasure_insert(treasurelist *list, int position)
Insert a new treasure in the treasure list, at a specific position in the children list.
uint16_t artifact_get_face(const artifact *art)
Get a suitable face number for representing an artifact.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
int load_face_file(FILE *file, const char *full_path)
void yypop_buffer_state(void)
Removes and deletes the top of the stack, if present.
This struct stores function pointers for actions that can be done to objects.
void dump_alchemy(void)
Dumps alchemy recipes to output.
int legal_artifact_combination(const object *op, const artifact *art)
Checks if op can be combined with art.
object * get_next_friend(object *current)
Get the next object on the friendly list.
oblinkpt * get_objectlinkpt(void)
Allocates a new oblinkpt structure, initialises it, and returns a pointer to it.
void give_artifact_abilities(object *op, const object *artifact)
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-...
int get_face_fallback(int faceset, uint16_t imageno)
This returns the set we will actually use when sending a face.
void print_monsters(void)
As dump_abilities(), but with an alternative way of output.
void dump_artifacts(void)
For debugging purposes.
char * ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Returns the description of an object, as seen by the given observer.
void dump_animations(void)
Dump all animations to stderr, for debugging purposes.
One reply a NPC can expect.
object * object_insert_in_map(object *op, mapstruct *m, object *originator, int flag)
This function inserts the object in the two-way linked list which represents what is on a map.
void free_map(mapstruct *m)
Frees everything allocated by the given mapstructure.
int get_learn_spell(int stat)
void init_ob_types(ob_methods *base_type)
Initializes the object system.
recipe * get_random_recipe(recipelist *rpl)
Gets a random recipe from a list, based on chance.
char * create_pathname(const char *name, char *buf, size_t size)
Get the full path to a map file.
void free_all_readable(void)
Free all readable-related information.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your message
int is_identifiable_type(const object *op)
Return true if this item's type is one that cares about whether or not it's been identified – e....
size_t stringbuffer_length(StringBuffer *sb)
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn t
const char * get_month_name(const int index)
give access to month names
void change_luck(object *op, int value)
Alter the object's luck.
archetype * get_archetype_by_skill_name(const char *skill, int type)
Retrieves an archetype by skill name and type.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
void init_stats()
This loads statistic bonus/penalties from the stat_bonus file.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
int strtoint(const char *buf)
Convert buf into an integer equal to the coadded sum of the (lowercase) character.
int object_distance(const object *ob1, const object *ob2)
Return the square of the distance between the two given objects.
archetype * find_archetype_by_object_name(const char *name)
This function retrieves an archetype given the name that appears during the game (for example,...
language_t i18n_find_language_by_code(const char *code)
Attempt to find the identifier of a language from its code.
Information on one title.
This represents all archetypes for one particular object type.
const char * time_format_time(const timeofday_t *tod, char *buf, size_t bufsize)
Formats a timestamp in Crossfire time.
void add_abilities(object *op, const object *change)
Apply artifact properties to an object.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
void object_copy_with_inv(const object *src_ob, object *dest_ob, bool update_speed)
Copy an object with an inventory, duplicate the inv too.
void object_free_inventory(object *ob)
Frees the inventory of an object, without any callback.
object * object_find_by_arch_name(const object *who, const char *name)
Find object in inventory by archetype name.
uint32_t tag_t
Object tag, unique during the whole game.
void animation_load_block(FILE *file, const char *full_path, const char *animation_name)
char * size
Human-readable set size.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
int save_object(FILE *fp, object *op, int flag)
Dumps all variables in an object to a file.
int is_old_wraith_pl(object *op)
Checks if player is a wraith without the 'wraith feed' skill.
void init_globals(void)
Initialises all global variables.
void fatal(enum fatal_error err) __attribute__((noreturn))
fatal() is meant to be called whenever a fatal signal is intercepted.
long timespec_diff(struct timespec *end, struct timespec *start)
Return the difference between two timespec's in microseconds.
const artifact * locate_recipe_artifact(const recipe *rp, size_t idx)
Finds an artifact for a recipe.
void dump_map(const mapstruct *m)
Prints out debug-information about a map.
archetype * get_archetype_struct(void)
Allocates, initialises and returns the pointer to an archetype structure.
void object_set_flag_inv(object *op, int flag)
Activate recursively a flag on an object's inventory.
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
char * stringbuffer_finish(StringBuffer *sb)
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be and may attack the nearest of your enemies Others can be in that they follow you around and help you in your quest to kill enemies and find treasure SPECIAL ITEMS There are many special items which can be found in of these the most important may be the signs all a player must do is apply the handle In the case of the player must move items over the button to hold it down Some of the larger buttons may need very large items to be moved onto before they can be activated Gates and locked but be for you could fall down into a pit full of ghosts or dragons and not be able to get back out Break away sometimes it may be worth a player s time to test the walls of a map for secret doors Fire such as missile weapons and spells you will notice them going up in smoke ! So be careful not to destroy valuable items Spellbooks sometimes a player can learn the other times they cannot There are many different types of books and scrolls out there Improve item have lower weight
int yyget_lineno(void)
Get the current line number.
void object_reset(object *op)
Totally resets the specified object, without freeing associated memory.
mapstruct * get_linked_map(void)
Allocates, initialises, and returns a pointer to a mapstruct, linked through first_map.
struct face_sets * fallback
Faceset to use when an image is not found in this faceset.
Various statistics of objects.
void object_insert_to_free_spot_or_free(object *op, mapstruct *map, int x, int y, int start, int stop, object *originator)
Inserts an object into its map.
void get_levelnumber(int i, char *buf, size_t size)
key_value * object_get_key_value(const object *ob, const char *key)
Search for a field by key.
void load_treasures(void)
int64_t random_roll64(int64_t min, int64_t max, const object *op, int goodbad)
This is a 64 bit version of random_roll() above.
void get_tod(timeofday_t *tod)
Computes the ingame time of the day.
uint64_t price_base(const object *obj)
Determine the base (intrinsic) value of an item.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
int get_power_from_ench(int ench)
void update_position(mapstruct *m, int x, int y)
This function updates various attributes about a specific space on the map (what it looks like,...
void write_book_archive(void)
Write out the updated book archive to bookarch file.
void change_attr_value(living *stats, int attr, int8_t value)
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat.
const Face * get_message_face(const GeneralMessage *message)
Get a message's face.
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Describes an item, in all its details.
float ticks_to_seconds(int ticks)
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for d
method_ret(* move_on_func)(object *, object *, object *)
void map_remove_unique_files(const mapstruct *map)
Remove files containing the map's unique items.
void dump_gods(void)
Prints all gods to stderr.
object * object_find_by_type_and_race(const object *who, int type, const char *race)
Find object in inventory by type and race.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
void init_experience(void)
This loads the experience table from the exp_table file.
void remove_directory(const char *path)
This function removes everything in the directory, and the directory itself.
char * strtoktolin(const char *buf1, const char *buf2, char *retbuf, size_t size)
Takes a string in buf1 and separates it into a list of strings delimited by buf2.
void dump_all_archetypes(void)
Dumps all archetypes to debug-level output.
int get_thaco_bonus(int stat)
void yyrestart(FILE *input_file)
Immediately switch to a different input stream.
A buffer that will be expanded as content is added to it.
const char * map_get_path(const object *item)
Return the map path on which the specified item is.
void stringbuffer_delete(StringBuffer *sb)
mapstruct * mapfile_load(const char *map, int flags)
Opens the file "filename" and reads information about the map from the given file,...
void dump_monster_treasure(const char *name)
For debugging purposes.
void object_handle_death_animation(object *op)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
void dump_alchemy_costs(void)
Dumps to output all costs of recipes.
char method_ret
Define some standard return values for callbacks which don't need to return any other results.
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void first_arch_pass(FILE *fp, const char *filename)
int set_variable(object *op, const char *buf)
This takes a buffer, scans it for variables, and sets those variables as appropriate in op.
archetype * get_next_archetype(archetype *current)
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object.
void set_abs_magic(object *op, int magic)
Sets magical bonus in an object, and recalculates the effect on the armour variable,...
int64_t check_exp_adjust(const object *op, int64_t exp)
Returns the maximum experience the object can gain or lose.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
One message a NPC can react to.
static ob_methods base_type
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
void replace_unprintable_chars(char *buf)
Replaces any unprintable character in the given buffer with a space.
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Find object in inventory.
void calc_perm_exp(object *op)
Ensure that the permanent experience requirements in an exp object are met.
int is_magical(const object *op)
Checks whether object is magical.
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
int get_random_dir(void)
Returns a random direction (1..8).
int did_make_save(const object *op, int level, int bonus)
This function takes an object (monster/player, op), and determines if it makes a basic save throw by ...
void object_clear(object *op)
Frees everything allocated by an object, and also clears all variables and flags to default settings.
void push_button(object *op)
Push the specified object.
const char * get_weekday(const int index)
give access to weekday names
void i18n_init(void)
Initializes the i18n subsystem.
long get_sleep_remaining(void)
method_ret ob_apply(object *op, object *applier, int aflags)
Apply an object by running an event hook or an object method.
object * give_skill_by_name(object *op, const char *skill_name)
Given the skill name skill_name, we find the skill archetype/object, set appropriate values,...
void trigger_connected(objectlink *ol, object *cause, const int state)
Trigger every object in an objectlink.
object * object_get_env_recursive(object *op)
Utility function.
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
Searches for any objects with a matching archetype at the given map and coordinates.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players.
void object_free_key_values(object *op)
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.
const typedef char * sstring
const char * get_god_for_race(const char *race)
Returns a string that is the name of the god that should be natively worshipped by a creature of who ...
int get_fear_bonus(int stat)
void get_ob_diff(StringBuffer *sb, const object *op, const object *op2)
Returns a pointer to a static string which contains all variables which are different in the two give...
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
This represents one animation.
void LOG(LogLevel logLevel, const char *format,...) PRINTF_ARGS(2
void register_move_on(int ob_type, move_on_func method)
Registers the move_on method for the given type.
int is_dragon_pl(const object *op)
Checks if player is a dragon.
void object_update_turn_face(object *op)
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the ot...
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
const Face * recipe_get_face(const recipe *rp)
Return the best face associated with a recipe.
int on_same_map(const object *op1, const object *op2)
Checks whether 2 objects are on the same map or not.
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
This is used by get_rangevector to determine where the other creature is.
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
Compute the chance for a specified item to become the specified artifact.
const typedata * get_typedata(int itemtype)
void clean_object(object *op)
Remove and free all objects in the inventory of the given object.
char * yyget_text(void)
Get the current token.
object * object_present_in_ob(uint8_t type, const object *op)
Searches for any objects with a matching type variable in the inventory of the given object.
FILE * yyget_in(void)
Get the input stream.
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
Find an object in inventory that does not have any of the provided flags set.
void reset_sleep(void)
Initialise all variables used in the timing routines.
int operate_altar(object *altar, object **sacrifice)
Checks if sacrifice was accepted and removes sacrificed objects.
void register_process(int ob_type, process_func method)
Registers the process method for the given type.
region * get_region_by_name(const char *region_name)
Gets a region by name.
void player_set_dragon_title(struct player *pl, int level, const char *attack, int skin_resist)
Updates the title of a dragon player to reflect the current level, attack type, and resistances.
void object_sub_weight(object *op, signed long weight)
Recursively (outwards) subtracts a number from the weight of an object (and what is carried by it's e...
int check_trigger(object *op, object *cause)
void player_set_own_title(struct player *pl, const char *title)
Sets the custom title.
object * object_find_by_type_and_skill(const object *who, int type, const char *skill)
Find object in inventory by type and skill.
void i18n_list_languages(object *who)
List all languages for who.
objectlink * get_objectlink(void)
Allocates a new objectlink structure, initialises it, and returns a pointer to it.
int64_t check_exp_loss(const object *op, int64_t exp)
This function checks to make sure that object 'op' can lose 'exp' experience.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various stats
void init_ob_method_struct(ob_methods *methods, ob_methods *fallback)
Initializes a ob_methods struct.
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
sstring i18n_get_language_code(language_t language)
Return the code of a specified language.
Struct to store the message_type and message_subtype for signs and books used by the player.
object * identify(object *op)
Identifies an item.
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
void dump_friendly_objects(void)
Dumps all friendly objects.
int ihypot(int a, int b)
Rough estimate of hypot(a, b).
int get_cleric_chance(int stat)
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
void stringbuffer_append_stringbuffer(StringBuffer *sb, const StringBuffer *sb2)
void i18n_free(void)
Clears all i18n-related data.
int book_overflow(const char *buf1, const char *buf2, size_t booksize)
Checks if buf1 and buf2 can be combined.
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
Find object in inventory by type and slaying.
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
int object_matches_pickup_mode(const object *item, int mode)
Checks if an item matches a specific pickup mode.
int calc_item_enhancement(const object *op)
object * map_find_by_type(mapstruct *m, int x, int y, uint8_t type)
Searches for any objects with a matching type variable at the given map and coordinates.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void register_apply(int ob_type, apply_func method)
Registers the apply method for the given type.
void free_all_artifacts(void)
Free all artifact-related information.
sstring get_message_title(const GeneralMessage *message)
Get a message's title.
char * path_combine_and_normalize(const char *src, const char *dst, char *path, size_t size)
Combines the 2 paths.
void object_copy_no_speed(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
void object_set_cheat(object *op)
object_set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in all it's inventory (recur...
void dump_all_maps(void)
Prints out debug-information about all maps.
Magical Runes Runes are magical inscriptions on the dungeon which cast a spell or detonate when something steps on them Flying objects don t detonate runes Beware ! Runes are invisible most of the time They are only visible occasionally ! There are several runes which are there are some special runes which may only be called with the invoke and people may apply it to read it Maybe useful for mazes ! This rune will not nor is it ordinarily invisible Partial Visibility of they ll be visible only part of the time They have a(your level/2) chance of being visible in any given round
int get_cha_bonus(int stat)
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying.
fatal_error
Fatal variables; used as arguments to fatal().
recipe * find_recipe_for_tool(const char *tool, recipe *from)
Find a recipe for a specified tool.
archetype * find_treasure_by_name(const treasure *t, const char *name, int depth)
Find a treasure with a matching name.
object * object_decrease_nrof(object *op, uint32_t i)
Decreases a specified number from the amount of an object.
void object_fix_multipart(object *tmp)
Ensures specified object has its more parts correctly inserted in map.
void tick_game_time(void)
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
object * object_find_by_tag(const object *who, tag_t tag)
Find object in inventory.
object * create_archetype_by_object_name(const char *name)
Creates an object given the name that appears during the game (for example, "writing pen" instead of ...
int object_find_multi_free_spot_around(const object *ob, const object *gen, int16_t *hx, int16_t *hy)
Sets hx and hy to the coords to insert a possibly multi-tile ob at, around gen.
int has_ability(const object *ob)
Checks whether object has innate abilities (spell/spellbook in inventory).
object * get_jail_exit(object *op)
Returns an object which is an exit through which the player represented by op should be sent in order...
void dump_faces(void)
Dump all faces to stderr, for debugging purposes.
Crossfire Architecture the general intention is to enhance the enjoyability and playability of CF In this code
object * map_find_by_flag(mapstruct *map, int x, int y, int flag)
Finds an object in a map tile by flag number.
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
Returns true if the given object can't fit in the given spot.
void init_readable(void)
Initialize linked lists utilized by message functions in tailor_readable_ob()
int check_altar_sacrifice(const object *altar, const object *sacrifice, int remove_others, int *toremove)
Checks whether the altar has enough to sacrifice.
int check_path(const char *name, int prepend_dir)
This function checks if a file with the given path exists.
void object_copy_owner(object *op, object *clone)
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (t...
archetype * find_archetype(const char *name)
method_ret ob_move_on(object *op, object *victim, object *originator)
Makes an object move on top of another one.
void load_image_info(FILE *file, const char *filename)
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
int has_carried_lights(const object *op)
Checks if op has a light source.
const char * destination_dir
Root destination dir.
void set_map_reset_time(mapstruct *map)
Updates the map's timeout.
const char * get_season_name(const int index)
give access to season names
treasure is one element in a linked list, which together consist of a complete treasure-list.
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for but you habe then to change the pathes in the VC settings Go in Settings C and Settings Link and change the optional include and libs path to the new python installation path o except the maps ! You must download a map package and install them the share folder Its must look like doubleclick on crossfire32 dsw There are projects in your libcross lib and plugin_python You need to compile all Easiest way is to select the plugin_python ReleaseLog as active this will compile all others too Then in Visual C press< F7 > to compile If you don t have an appropriate compiler you can try to get the the VC copies the crossfire32 exe in the crossfire folder and the plugin_python dll in the crossfire share plugins folder we will remove it when we get time for it o Last showing lots of weird write to the Crossfire mailing list
void object_dump(const object *op, StringBuffer *sb)
Dumps an object.
LogLevel
Log levels for the LOG() function.
This is one artifact, ie one special item.
object * object_create_clone(object *asrc)
Create clone from object to another.
StringBuffer * describe_monster(const object *op, int use_media_tags, StringBuffer *buf)
Describes a monster.
void strip_endline(char *buf)
Removes endline from buffer (modified in place).
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
void dump_abilities(void)
Dump to standard out the abilities of all monsters.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is for a more detailed look at the skills doc file Skill remove use magic items phys no fire cold Fireborns are supposed to be fire spirits They re closely in tune with magic and are powerful and learn magic easily Being fire they are immune to fire and and vulnerable to cold They are vulnerable to ghosthit and drain because being mostly non anything which strikes directly at the spirit hits them harder race attacktype restrictions immunities prot vuln Quetzalcoatl physical no armour fire cold Quetzalcoatl s are now born knowing the spell of burning but because of their negative wisdom bonus
int save_map(mapstruct *m, int flag)
Saves a map to file.
int get_turn_bonus(int stat)
archetype * try_find_archetype(const char *name)
Animations * try_find_animation(const char *name)
void free_dialog_information(object *op)
Frees obj::dialog_information.
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coor...
treasure * get_empty_treasure()
Allocate and return the pointer to an empty treasure structure.
materialtype_t * name_to_material(const char *name)
Convert materialname to materialtype_t.
int get_dam_bonus(int stat)
void remove_statbonus(object *op)
Subtracts stat-bonuses given by the class which the player has chosen.
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
void init_archetype_pointers(void)
Initialize global archtype pointers:
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
void use_trigger(object *op)
Toggles the state of specified button.
region * get_region_from_string(const char *name)
Tries to find a region that 'name' corresponds to.
void time_info(object *op)
Players wants to know the time.
void stringbuffer_append_multiline_block(StringBuffer *sb, const char *start, const char *content, const char *end)
void clean_friendly_list(void)
It traverses the friendly list removing objects that should not be here (ie, do not have friendly fla...
void print_los(object *op)
Debug-routine which dumps the array which specifies the visible area of a player.
void init_formulae(BufferReader *reader, const char *filename)
Builds up the lists of formula from the file in the libdir.
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
const readable_message_type * get_readable_message_type(object *readable)
Get the readable type for an object (hopefully book).
int find_dir_2(int x, int y)
Computes a direction which you should travel to move of x and y.
int rndm(int min, int max)
Returns a number between min and max.
object * object_find_by_name_global(const char *str)
Finds an object by name.
void remove_button_link(object *op)
Remove the object from the linked lists of buttons in the map.
int change_map_light(mapstruct *m, int change)
Used to change map light level (darkness) up or down.
void free_arch(archetype *at)
Frees archetype.
region * get_region_struct(void)
Allocates and zeros a region struct, this isn't free()'d anywhere, so might be a memory leak,...
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
void drain_stat(object *op)
Drains a random stat from op.
void make_sure_not_seen(const object *op)
The object which is supposed to be visible through walls has just been removed from the map,...
void query_name(const object *op, char *buf, size_t size)
Describes an item.
void save_object_in_sb(StringBuffer *sb, object *op, const int flag)
Store a string representation of op in sb.
int isqrt(int n)
Compute the square root.
void player_lvl_adj(object *who, object *op)
For the new exp system.
void free_all_god(void)
Frees all god information.
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings.
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the and treasurelist definitions into a single or trs file and the graphics into a face(metadata) and .tar(bitmaps) file
artifactlist * find_artifactlist(int type)
Finds the artifact list for a certain item type.
int is_friendly(const object *op)
Checks if the given object is already in the friendly list or not.
void update_button(object *op)
Updates everything connected with the button op.
method_ret(* apply_func)(object *, object *, int)
Typedefs for ob_methods.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...