Crossfire Server, Trunk  R20513
Functions
sproto.h File Reference

Go to the source code of this file.

Functions

int account_change_password (const char *account_name, const char *current_password, const char *new_password)
 Change an account password. More...
 
Account_Characcount_char_add (Account_Char *chars, player *pl)
 This adds a player to the list of accounts. More...
 
void account_char_free (Account_Char *chars)
 This frees all data associated with the character information. More...
 
Account_Characcount_char_load (const char *account_name)
 For a given account name, load the character information and return it. More...
 
Account_Characcount_char_remove (Account_Char *chars, const char *pl_name)
 This removes a character on this account. More...
 
void account_char_save (const char *account, Account_Char *chars)
 Saves the character information for the given account. More...
 
int account_check_string (const char *str)
 Checks a string to make sure it does not have any invalid characters. More...
 
const char * account_exists (const char *account_name)
 Checks the existing accounts, and see if this account exists. More...
 
const char * account_get_account_for_char (const char *charname)
 This looks at all the accounts and sees if charname is associated with any of them. More...
 
socket_structaccount_get_logged_in_init_socket (const char *name)
 This is like the above routine, but checks the init_sockets (account in process of logging in). More...
 
playeraccount_get_logged_in_player (const char *name)
 This checks to see if the account is logged in with a player attached If so, it returns the player object. More...
 
char ** account_get_players_for_account (const char *account_name)
 Returns an array of strings for the characters on this account - the array is null terminated. More...
 
int account_is_logged_in (const char *name)
 This checkes if an account is logged in. More...
 
int account_link (const char *account_name, const char *player_name)
 Adds a player name to an account. More...
 
int account_login (const char *account_name, const char *account_password)
 Check if the given account exists, and whether the password is correct. More...
 
int account_new (const char *account_name, const char *account_password)
 Adds an account. More...
 
int account_remove_player (const char *account_name, const char *player_name)
 Removes a player name from an account. More...
 
void accounts_clear (void)
 This is used purely by the test harness - by clearing the accounts, it can then verify that the data is added is loaded back into memory properly. More...
 
void accounts_load (void)
 This loads all the account entries into memory. More...
 
void accounts_save (void)
 Save all the account information. More...
 
playeradd_player (socket_struct *ns, int flags)
 Tries to add player on the connection passwd in ns. More...
 
int alchemy (object *op, object *caster, object *spell_ob)
 Change items to gold nuggets. More...
 
int animate_weapon (object *op, object *caster, object *spell, int dir)
 Generalization of staff_to_snake(). More...
 
int apply_auto (object *op)
 Map was just loaded, handle op's initialization. More...
 
void apply_auto_fix (mapstruct *m)
 Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff). More...
 
void apply_builder_remove (object *pl, int dir)
 Item remover. More...
 
int apply_by_living (object *pl, object *op, int aflag, int quiet)
 Living thing is applying an object. More...
 
void apply_by_living_below (object *pl)
 Attempt to apply the object 'below' the player. More...
 
int apply_can_apply_object (const object *who, const object *op)
 Checks to see if 'who' can apply object 'op'. More...
 
void apply_changes_to_player (object *pl, object *change, int limit_stats)
 Applies (race) changes to a player. More...
 
int apply_check_weapon_power (const object *who, int improves)
 This checks to see of the player (who) is sufficient level to use a weapon with improves improvements (typically last_eat). More...
 
int apply_container (object *op, object *sack)
 Handle apply on containers. More...
 
void apply_handle_yield (object *tmp)
 This checks whether the object has a "on_use_yield" field, and if so generated and drops matching item. More...
 
int apply_manual (object *op, object *tmp, int aflag)
 Main apply handler. More...
 
void apply_map_builder (object *pl, int dir)
 Global building function. More...
 
int apply_race_and_class (object *op, archetype *race, archetype *opclass, living *stats)
 This is somewhat like key_change_class() above, except we know the race to change to, but we still basically need to do the same work (apply bonuses, update archetype, etc.) More...
 
int apply_special (object *who, object *op, int aflags)
 Apply an object. More...
 
int attack_ob (object *op, object *hitter)
 Simple wrapper for attack_ob_simple(), will use hitter's values. More...
 
int become_follower (object *op, const object *new_god)
 This function is called whenever a player has switched to a new god. More...
 
void blind_living (object *op, object *hitter, int dam)
 Blind a living thing. More...
 
int64_t calc_skill_exp (const object *who, const object *op, const object *skill)
 Calculates amount of experience can be gained for successful use of a skill. More...
 
int cast_bless (object *op, object *caster, object *spell_ob, int dir)
 Improve statistics of some living object. More...
 
int cast_cause_disease (object *op, object *caster, object *spell, int dir)
 Let's try to infect something. More...
 
int cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent)
 Cast some stat-improving spell. More...
 
int cast_change_map_lightlevel (object *op, object *caster, object *spell)
 This changes the light level for the entire map. More...
 
int cast_cone (object *op, object *caster, int dir, object *spell)
 Casts a cone spell. More...
 
int cast_consecrate (object *op, object *caster, object *spell)
 A spell to make an altar your god's. More...
 
int cast_create_food (object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
 Create food. More...
 
int cast_create_missile (object *op, object *caster, object *spell, int dir, const char *stringarg)
 Create a missile (nonmagic - magic +4). More...
 
int cast_create_obj (object *op, object *new_op, int dir)
 Creates object new_op in direction dir or if that is blocked, beneath the player (op). More...
 
int cast_create_town_portal (object *op, object *caster, object *spell, int dir)
 This function cast the spell of town portal for op. More...
 
int cast_curse (object *op, object *caster, object *spell_ob, int dir)
 Curse an object, reducing its statistics. More...
 
int cast_destruction (object *op, object *caster, object *spell_ob)
 Hit all monsters around the caster. More...
 
int cast_detection (object *op, object *caster, object *spell)
 Detect magic or invisible items. More...
 
void cast_dust (object *op, object *throw_ob, int dir)
 Handles op throwing objects of type 'DUST'. More...
 
int cast_earth_to_dust (object *op, object *caster, object *spell_ob)
 Basically destroys earthwalls in the area. More...
 
int cast_heal (object *op, object *caster, object *spell, int dir)
 Heals something. More...
 
int cast_identify (object *op, object *caster, object *spell)
 Identifies objects in the players inventory/on the ground. More...
 
int cast_invisible (object *op, object *caster, object *spell_ob)
 Makes the player or character invisible. More...
 
int cast_item_curse_or_curse (object *op, object *caster, object *spell_ob)
 This alters player's marked item's cursed or blessed status, based on the spell_ob's fields. More...
 
int cast_light (object *op, object *caster, object *spell, int dir)
 Illuminates something on a map, or try to blind a living thing. More...
 
void cast_magic_storm (object *op, object *tmp, int lvl)
 This is really used mostly for spell fumbles and the like. More...
 
int cast_polymorph (object *op, object *caster, object *spell_ob, int dir)
 Polymorph spell casting. More...
 
int cast_raise_dead_spell (object *op, object *caster, object *spell, int dir, const char *arg)
 This handles the raise dead / resurrection spells. More...
 
int cast_smite_spell (object *op, object *caster, int dir, object *spell)
 The priest points to a creature and causes a 'godly curse' to descend. More...
 
int cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg)
 Main dispatch when someone casts a spell. More...
 
int cast_transfer (object *op, object *caster, object *spell, int dir)
 This spell transfers sp from the player to another person. More...
 
int cast_wonder (object *op, object *caster, int dir, object *spell_ob)
 wonder is really just a spell that will likely cast another spell. More...
 
int cast_word_of_recall (object *op, object *caster, object *spell_ob)
 Word of recall causes the player to return 'home'. More...
 
int caster_level (const object *caster, const object *spell)
 This function returns the effective level the spell is being cast at. More...
 
int cftimer_create (int id, long delay, object *ob, int mode)
 Creates a new timer. More...
 
int cftimer_destroy (int id)
 Destroys an existing timer. More...
 
int cftimer_find_free_id (void)
 Finds a free ID for a new timer. More...
 
void cftimer_init (void)
 Initialize timers. More...
 
void cftimer_process_timers (void)
 Processes all timers. More...
 
void change_object (object *op)
 Replaces op with its other_arch if it has reached its end of life. More...
 
int change_skill (object *who, object *new_skill, int flag)
 This changes the object's skill to new_skill. More...
 
void check_active_maps (void)
 Finds maps in memory to reset. More...
 
void check_bullet (object *op)
 Checks to see what op should do, given the space it is on (eg, explode, damage player, etc). More...
 
void check_login (object *op, int check_pass)
 Actually login a player, load from disk and such. More...
 
int check_name (player *me, const char *name)
 Ensure player's name is valid. More...
 
bool check_password (const char *typed, const char *crypted)
 Hash a password and compare it to the stored version. More...
 
void check_physically_infect (object *victim, object *hitter)
 Possibly infect due to direct physical contact i.e., AT_PHYSICAL. More...
 
int check_pick (object *op)
 Sees if there is stuff to be picked up/picks up stuff, for players only. More...
 
int check_race_and_class (living *stats, archetype *race, archetype *opclass)
 This checks to see if the race and class are legal. More...
 
void check_spell_expiry (object *spell)
 Checks if player should be warned of soon expiring spell. More...
 
objectcheck_spell_known (object *op, const char *name)
 Checks to see if player knows the spell. More...
 
void check_spells (void)
 It goes through the spells looking for any obvious errors. More...
 
int checkbanned (const char *login, const char *host)
 Check if a player and/or host is banned. More...
 
void clean_tmp_files (void)
 Remove temporary map files. More...
 
void cleanup (void)
 Clean up everything and exit. More...
 
void cleanupPlugins (void)
 Call the crossfire_plugin::closefunc on the various plugins, used at server shutdown. More...
 
void clear_skill (object *who)
 This function just clears the chosen_skill and range_skill values in the player. More...
 
void command_abil (object *op, const char *params)
 Changes an object's statistics. More...
 
void command_accuse (object *op, const char *params)
 'accuse' command. More...
 
void command_addexp (object *op, const char *params)
 This adds exp to a player. More...
 
void command_afk (object *op, const char *params)
 Toggles the afk status of a player. More...
 
void command_apply (object *op, const char *params)
 'apply' command. More...
 
void command_applymode (object *op, const char *params)
 Players wants to change the apply mode, ie how to handle applying an item when no body slot available. More...
 
void command_archs (object *op, const char *params)
 Archetype-related statistics. More...
 
void command_arrest (object *op, const char *params)
 Wizard jails player. More...
 
void command_banish (object *op, const char *params)
 Add player's IP to ban_file and kick them off the server. More...
 
void command_beg (object *op, const char *params)
 'beg' command. More...
 
void command_bleed (object *op, const char *params)
 'bleed' command. More...
 
void command_blush (object *op, const char *params)
 'blush' command. More...
 
void command_body (object *op, const char *params)
 This command dumps the body information for object *op. More...
 
void command_bounce (object *op, const char *params)
 'bounce' command. More...
 
void command_bow (object *op, const char *params)
 'bow' command. More...
 
void command_bowmode (object *op, const char *params)
 Player wants to change the bowmode, how arrows are fired. More...
 
void command_brace (object *op, const char *params)
 Player toggles her braced status. More...
 
void command_burp (object *op, const char *params)
 'burp' command. More...
 
void command_cackle (object *op, const char *params)
 'cackle' command. More...
 
void command_cast (object *op, const char *params)
 'cast' command, prepares a spell for laster casting. More...
 
void command_cast_spell (object *op, const char *params, char command)
 Sets up to cast a spell. More...
 
void command_chat (object *op, const char *params)
 'chat' command. More...
 
void command_chuckle (object *op, const char *params)
 'chuckle' command. More...
 
void command_clap (object *op, const char *params)
 'clap' command. More...
 
void command_cointoss (object *op, const char *params)
 'cointoss' command. More...
 
void command_cough (object *op, const char *params)
 'cough' command. More...
 
void command_create (object *op, const char *params)
 Wizard wants to create an object. More...
 
void command_cringe (object *op, const char *params)
 'cringe' command. More...
 
void command_cry (object *op, const char *params)
 'cry' command. More...
 
void command_dance (object *op, const char *params)
 'dance' command. More...
 
void command_debug (object *op, const char *params)
 Player wants to see/change the debug level. More...
 
void command_diff (object *op, const char *params)
 Get a diff of specified items. More...
 
void command_disarm (object *op, const char *params)
 'disarm' command. More...
 
void command_dm (object *op, const char *params)
 Actual command to perhaps become dm. More...
 
void command_dmhide (object *op, const char *params)
 A players wants to become DM and hide. More...
 
void command_dmtell (object *op, const char *params)
 Private communication, by a DM (can't be ignored by player). More...
 
void command_drop (object *op, const char *params)
 'drop' command. More...
 
void command_dropall (object *op, const char *params)
 Command to drop all items that have not been locked. More...
 
void command_dump (object *op, const char *params)
 Dumps the difference between an object and its archetype. More...
 
void command_dumpallarchetypes (object *op, const char *params)
 Various archetypes-related statistics. More...
 
void command_dumpallmaps (object *op, const char *params)
 Various map-related statistics. More...
 
void command_dumpallobjects (object *op, const char *params)
 Various object-related statistics. More...
 
void command_dumpbelow (object *op, const char *params)
 Player wants to dump object below her. More...
 
void command_dumpfriendlyobjects (object *op, const char *params)
 Various friendly object-related statistics. More...
 
void command_dumpmap (object *op, const char *params)
 Various map-related statistics. More...
 
void command_east (object *op, const char *params)
 'east' command. More...
 
void command_empty (object *op, const char *params)
 'empty' command. More...
 
void command_examine (object *op, const char *params)
 'examine' command. More...
 
void command_fire (object *op, const char *params)
 Player wants to start furing. More...
 
void command_fire_stop (object *op, const char *params)
 Player wants to stop firing. More...
 
void command_fix_me (object *op, const char *params)
 Wrapper to fix a player. More...
 
void command_flip (object *op, const char *params)
 'flip' command. More...
 
void command_follow (object *op, const char *params)
 DM wants to follow a player, or stop following a player. More...
 
void command_forget_spell (object *op, const char *params)
 Command for players to forget a spell. More...
 
void command_free (object *op, const char *params)
 Totally free an object. More...
 
void command_freeze (object *op, const char *params)
 Freezes a player for a specified tick count, 100 by default. More...
 
void command_frown (object *op, const char *params)
 'frown' command. More...
 
void command_gasp (object *op, const char *params)
 'gasp' command. More...
 
void command_giggle (object *op, const char *params)
 'giggle' command. More...
 
void command_glare (object *op, const char *params)
 'glare' command. More...
 
void command_goto (object *op, const char *params)
 Wizard teleports to a map. More...
 
void command_grin (object *op, const char *params)
 'grin' command. More...
 
void command_groan (object *op, const char *params)
 'groan' command. More...
 
void command_growl (object *op, const char *params)
 'growl' command. More...
 
void command_gsay (object *op, const char *params)
 'gsay' command, talks to party. More...
 
void command_help (object *op, const char *params)
 Player is asking for some help. More...
 
void command_hiccup (object *op, const char *params)
 'hiccup' command. More...
 
void command_hide (object *op, const char *params)
 Wizard 'hide' command. More...
 
void command_hiscore (object *op, const char *params)
 Player is asking for the hiscore. More...
 
void command_hug (object *op, const char *params)
 'hug' command. More...
 
void command_insert_into (object *op, const char *params)
 Puts an object into another. More...
 
void command_inventory (object *op, const char *params)
 Shows the inventory or some item. More...
 
void command_invisible (object *op, const char *params)
 Wizard wants to become invisible. More...
 
void command_invoke (object *op, const char *params)
 'invoke' command, fires a spell immediately. More...
 
void command_kick (object *op, const char *params)
 Kicks a player from the server. More...
 
void command_kill_pets (object *op, const char *params)
 Player wants to get rid of pets. More...
 
void command_kiss (object *op, const char *params)
 'kiss' command. More...
 
void command_knowledge (object *pl, const char *params)
 Handle the 'knowledge' for a player. More...
 
void command_language (object *op, const char *params)
 This is the 'language' command. More...
 
void command_laugh (object *op, const char *params)
 'laugh' command. More...
 
void command_learn_special_prayer (object *op, const char *params)
 Wizard wants to learn a god-given spell. More...
 
void command_learn_spell (object *op, const char *params)
 Wizard wants to learn a regular spell. More...
 
void command_lick (object *op, const char *params)
 'lick' command. More...
 
void command_listen (object *op, const char *params)
 Change the player's listen level. More...
 
void command_listplugins (object *op, const char *params)
 Lists all plugins currently loaded with their IDs and full names. More...
 
void command_loadplugin (object *op, const char *params)
 Loads the given plugin. More...
 
void command_loadtest (object *op, const char *params)
 This command will stress server. More...
 
void command_lock_item (object *op, const char *params)
 Alternate way to lock/unlock items (command line). More...
 
void command_malloc (object *op, const char *params)
 Display memory information. More...
 
void command_mapinfo (object *op, const char *params)
 'mapinfo' command. More...
 
void command_maps (object *op, const char *params)
 'maps' command. More...
 
void command_mark (object *op, const char *params)
 'mark' command, to mark an item for some effects (enchant armor, ...). More...
 
void command_me (object *op, const char *params)
 'me' command. More...
 
void command_mon_aggr (object *op, const char *params)
 When DM is possessing a monster, flip aggression on and off, to allow better motion. More...
 
void command_motd (object *op, const char *params)
 Display the message of the day. More...
 
void command_news (object *op, const char *params)
 Display the server news. More...
 
void command_nod (object *op, const char *params)
 'nod' command. More...
 
void command_north (object *op, const char *params)
 'north' command. More...
 
void command_northeast (object *op, const char *params)
 'northeast' command. More...
 
void command_northwest (object *op, const char *params)
 'northwest' command. More...
 
void command_nowiz (object *op, const char *params)
 Steps down from wizard mode. More...
 
void command_orcknuckle (object *op, const char *params)
 Plays the "orcknucke" game. More...
 
void command_overlay_reset (object *op, const char *params)
 Removes the overlay for op's current map. More...
 
void command_overlay_save (object *op, const char *params)
 Saves the op's map as an overlay - objects are persisted. More...
 
void command_party (object *op, const char *params)
 'party' command, subdivided in different sub commands. More...
 
void command_party_rejoin (object *op, const char *params)
 Handles the 'party_rejoin' command. More...
 
void command_passwd (object *pl, const char *params)
 Player is asking to change password. More...
 
void command_patch (object *op, const char *params)
 Wizard wants to altar an object. More...
 
void command_peaceful (object *op, const char *params)
 Player toggles her peaceful status. More...
 
void command_petmode (object *op, const char *params)
 Player wants to change how her pets behave. More...
 
void command_pickup (object *op, const char *params)
 'pickup' command. More...
 
void command_players (object *op, const char *params)
 Display all known players. More...
 
void command_poke (object *op, const char *params)
 'poke' command. More...
 
void command_possess (object *op, const char *params)
 DM can possess a monster. More...
 
void command_pout (object *op, const char *params)
 'pout' command. More...
 
void command_prepare (object *op, const char *params)
 Equivalent to command_cast(). More...
 
void command_printlos (object *op, const char *params)
 Various LOS-related statistics. More...
 
void command_puke (object *op, const char *params)
 'puke' command. More...
 
void command_purge_quest (object *op, const char *param)
 
void command_purge_quest_definitions (object *op, const char *param)
 
void command_quest (object *op, const char *params)
 Command handler for 'quest'. More...
 
void command_quit (object *op, const char *params)
 Player wants to totally delete her character. More...
 
void command_remove (object *op, const char *params)
 Remove an object from its position. More...
 
void command_rename_item (object *op, const char *params)
 Changing the custom name of an item. More...
 
void command_reply (object *op, const char *params)
 Reply to last person who told you something [mids 01/14/2002]. More...
 
void command_reset (object *op, const char *params)
 Resets a map. More...
 
void command_resistances (object *op, const char *params)
 Players wants to know her resistances. More...
 
void command_rotateshoottype (object *op, const char *params)
 'rotateshoottype' command, switch range attack. More...
 
void command_rskill (object *pl, const char *params)
 'ready_skill' command. More...
 
void command_rules (object *op, const char *params)
 Display the server rules. More...
 
void command_run (object *op, const char *params)
 Player wants to start running. More...
 
void command_run_stop (object *op, const char *params)
 Player wants to stop running. More...
 
void command_save (object *op, const char *params)
 Player wants to get saved. More...
 
void command_say (object *op, const char *params)
 'say' command. More...
 
void command_scream (object *op, const char *params)
 'scream' command. More...
 
void command_search (object *op, const char *params)
 'search' command. More...
 
void command_search_items (object *op, const char *params)
 'search-items' command. More...
 
void command_setgod (object *op, const char *params)
 Sets the god for some objects. More...
 
void command_settings (object *op, const char *ignored)
 Wizard wants to know some server settings, so display. More...
 
void command_shake (object *op, const char *params)
 'shake' command. More...
 
void command_shiver (object *op, const char *params)
 'shiver' command. More...
 
void command_shout (object *op, const char *params)
 'shout' command. More...
 
void command_showpets (object *op, const char *params)
 Players wants to know her pets. More...
 
void command_shrug (object *op, const char *params)
 'shrug' command. More...
 
void command_shutdown (object *op, const char *params)
 Totally shutdowns the server. More...
 
void command_sigh (object *op, const char *params)
 'sigh' command. More...
 
void command_skills (object *op, const char *params)
 Player is asking for her skills. More...
 
void command_slap (object *op, const char *params)
 'slap' command. More...
 
void command_smile (object *op, const char *params)
 'smile' command. More...
 
void command_smirk (object *op, const char *params)
 'smirk' command. More...
 
void command_snap (object *op, const char *params)
 'snap' command. More...
 
void command_sneeze (object *op, const char *params)
 'sneeze' command. More...
 
void command_snicker (object *op, const char *params)
 'snicker' command. More...
 
void command_sniff (object *op, const char *params)
 'sniff' command. More...
 
void command_snore (object *op, const char *params)
 'snore' command. More...
 
void command_sound (object *op, const char *params)
 Player wants to change sound status. More...
 
void command_south (object *op, const char *params)
 'south' command. More...
 
void command_southeast (object *op, const char *params)
 'southeast' command. More...
 
void command_southwest (object *op, const char *params)
 'southwest' command. More...
 
void command_speed (object *op, const char *params)
 Changes the server speed. More...
 
void command_spit (object *op, const char *params)
 'spit' command. More...
 
void command_ssdumptable (object *op, const char *params)
 Various string-related statistics. More...
 
void command_stack_clear (object *op, const char *params)
 Empty DM item stack. More...
 
void command_stack_list (object *op, const char *params)
 Displays stack contents. More...
 
void command_stack_pop (object *op, const char *params)
 Pop the stack top. More...
 
void command_stack_push (object *op, const char *params)
 Push specified item on stack. More...
 
void command_statistics (object *pl, const char *params)
 Prints out some useful information for the character. More...
 
void command_stats (object *op, const char *params)
 Displays the statistics of a player. More...
 
void command_stay (object *op, const char *params)
 'stay' command. More...
 
void command_strings (object *op, const char *params)
 Various string-related statistics. More...
 
void command_strut (object *op, const char *params)
 'strut' command. More...
 
void command_style_map_info (object *op, const char *params)
 Displays information about styles loaded for random maps. More...
 
void command_sulk (object *op, const char *params)
 'sulk' command. More...
 
void command_summon (object *op, const char *params)
 Summons player near DM. More...
 
void command_take (object *op, const char *params)
 This takes (picks up) and item. More...
 
void command_teleport (object *op, const char *params)
 Teleport next to target player. More...
 
void command_tell (object *op, const char *params)
 Private communication. More...
 
void command_thank (object *op, const char *params)
 'thank' command. More...
 
void command_think (object *op, const char *params)
 'think' command. More...
 
void command_throw (object *op, const char *params)
 'throw' command. More...
 
void command_time (object *op, const char *params)
 Players asks for the time. More...
 
void command_title (object *op, const char *params)
 Player wishes to change her title. More...
 
void command_toggle_shout (object *op, const char *params)
 A simple toggle for the no_shout field. More...
 
void command_twiddle (object *op, const char *params)
 'twiddle' command. More...
 
void command_unarmed_skill (object *op, const char *params)
 Player wants to change prefered unarmed skill. More...
 
void command_unloadplugin (object *op, const char *params)
 Unloads the given plugin. More...
 
void command_use (object *op, const char *params)
 Try to use an item on another. More...
 
void command_usekeys (object *op, const char *params)
 Player wants to change how keys are used. More...
 
void command_uskill (object *pl, const char *params)
 'use_skill' command. More...
 
void command_version (object *op, const char *params)
 Server version. More...
 
void command_wave (object *op, const char *params)
 'wave' command. More...
 
void command_west (object *op, const char *params)
 'west' command. More...
 
void command_whereabouts (object *op, const char *params)
 'whereabouts' command. More...
 
void command_whereami (object *op, const char *params)
 'whereami' command. More...
 
void command_whistle (object *op, const char *params)
 'whistle' command. More...
 
void command_who (object *op, const char *params)
 'who' command. More...
 
void command_wimpy (object *op, const char *params)
 Player wants to change how soon she'll flee. More...
 
void command_wink (object *op, const char *params)
 'wink' command. More...
 
void command_wizcast (object *op, const char *params)
 Wizard toggling "cast everywhere" ability. More...
 
void command_wizpass (object *op, const char *params)
 Wizard toggling wall-crossing. More...
 
void command_yawn (object *op, const char *params)
 'yawn' command. More...
 
void cone_drop (object *op)
 Drops an object based on what is in the cone's "other_arch". More...
 
int confirm_party_password (object *op)
 Is the password the player entered to join a party the right one? More...
 
void confirm_password (object *op)
 Ask the player to confirm her password during creation. More...
 
void confuse_living (object *op, object *hitter, int dam)
 Confuse a living thing. More...
 
void counterspell (object *op, int dir)
 Nullifies spell effects. More...
 
int create_aura (object *op, object *caster, object *spell)
 Create an aura spell object and put it in the player's inventory. More...
 
int create_bomb (object *op, object *caster, int dir, object *spell)
 Create a bomb. More...
 
int cure_disease (object *sufferer, object *caster, sstring skill)
 Do the cure disease stuff, from the spell "cure disease". More...
 
void current_map_info (object *op)
 'mapinfo' command. More...
 
void current_region_info (object *op)
 'whereami' command. More...
 
void dead_player (object *op)
 Kill a player on a permanent death server with resurrection. More...
 
void delete_character (const char *name)
 Totally deletes a character. More...
 
void destroy_object (object *op)
 Recursively object_free_drop_inventory() op and its inventory. More...
 
int detect_curse_on_item (object *pl, object *tmp, object *skill)
 Runs a 'detect curse' check on a given item. More...
 
int detect_magic_on_item (object *pl, object *tmp, object *skill)
 Runs a 'detect magic' check on a given item. More...
 
const char * determine_god (object *op)
 Determines if op worships a god. More...
 
archetypedetermine_holy_arch (const object *god, const char *type)
 Determines the archetype for holy servant and god avatar. More...
 
int dimension_door (object *op, object *caster, object *spob, int dir)
 Teleport through some doors and space. More...
 
int dispel_rune (object *op, object *caster, object *spell, object *skill, int dir)
 Someone is trying to disarm a rune. More...
 
void display_motd (const object *op)
 Sends the message of the day to the player. More...
 
void display_who_entry (object *op, player *pl, const char *format)
 Display a line of 'who' to op, about pl, using the formatting specified by format. More...
 
void do_forget_spell (object *op, const char *spell)
 Erases spell from player's inventory. More...
 
void do_harvest (object *pl, int dir, object *skill)
 Player is trying to harvest something. More...
 
void do_hidden_move (object *op)
 For hidden creatures - a chance of becoming 'unhidden' every time they move - as we subtract off 'invisibility' AND, for players, if they move into a ridiculously unhideable spot (surrounded by clear terrain in broad daylight). More...
 
void do_learn_spell (object *op, object *spell, int special_prayer)
 Actually makes op learn spell. More...
 
int do_skill (object *op, object *part, object *skill, int dir, const char *string)
 Main skills use function-similar in scope to cast_spell(). More...
 
void do_some_living (object *op)
 Regenerate hp/sp/gr, decreases food. More...
 
void dragon_ability_gain (object *who, int atnr, int level)
 When a dragon-player gains a new stage of evolution, he gets some treasure. More...
 
void drain_rod_charge (object *rod)
 Drain charges from a rod. More...
 
void drain_wand_charge (object *wand)
 Drains a charge from a wand. More...
 
void drop (object *op, object *tmp)
 Drop an item, either on the floor or in a container. More...
 
objectdrop_object (object *op, object *tmp, uint32_t nrof)
 Try to drop an object on the floor. More...
 
void dump_quests (void)
 Dump all of the quests, then calls exit() - useful in terms of debugging to make sure that quests are set up and recognised correctly. More...
 
void dump_spells (void)
 Dumps all the spells - now also dumps skill associated with the spell. More...
 
void emergency_save (int flag)
 Save all players. More...
 
void enter_exit (object *op, object *exit_ob)
 Tries to move 'op' to exit_ob. More...
 
void enter_player_maplevel (object *op)
 Move a player to its stored map level. More...
 
void enter_player_savebed (object *op)
 This is a basic little function to put the player back to his savebed. More...
 
void examine (object *op, object *tmp)
 Player examines some object. More...
 
void examine_monster (object *op, object *tmp, int level)
 Player examine a monster. More...
 
int execute_event (object *op, int eventcode, object *activator, object *third, const char *message, int fix)
 
int execute_global_event (int eventcode,...)
 
void execute_newserver_command (object *pl, char *command)
 Player issued a command, let's handle it. More...
 
void explode_bullet (object *op)
 Causes an object to explode, eg, a firebullet, poison cloud ball, etc. More...
 
const objectfind_god (const char *name)
 Returns pointer to specified god's object through pntr_to_god_obj(). More...
 
objectfind_key (object *pl, object *container, object *door)
 We try to find a key for the door as passed. More...
 
objectfind_marked_object (object *op)
 Return the object the player has marked with the 'mark' command below. More...
 
playerfind_player (const char *plname)
 Find a player by her full name. More...
 
playerfind_player_options (const char *plname, int options, const mapstruct *map)
 Find a player. More...
 
playerfind_player_partial_name (const char *plname)
 Find a player by a partial name. More...
 
playerfind_player_socket (const socket_struct *ns)
 Return a player for a socket structure. More...
 
command_array_structfind_plugin_command (const char *cmd, command_array_struct *command)
 Tries to find if a given command is handled by a plugin. More...
 
racelinkfind_racelink (const char *name)
 Find the race information for the specified name. More...
 
objectfind_random_spell_in_ob (object *ob, const char *skill)
 This returns a random spell from 'ob'. More...
 
objectfind_skill_by_name (object *who, const char *name)
 This returns the skill pointer of the given name (the one that accumulates exp, has the level, etc). More...
 
objectfind_skill_by_number (object *who, int skillno)
 This returns the skill pointer of the given name (the one that accumulates exp, has the level, etc). More...
 
objectfind_target_for_friendly_spell (object *op, int dir)
 This function is commonly used to find a friendly target for spells such as heal or protection or armour. More...
 
int find_traps (object *pl, object *skill)
 Checks for traps on the spaces around the player or in certain objects. More...
 
void fire (object *op, int dir)
 Received a fire command for the player - go and do it. More...
 
int fire_arch_from_position (object *op, object *caster, int16_t x, int16_t y, int dir, object *spell)
 Fires an archetype. More...
 
int fire_bolt (object *op, object *caster, int dir, object *spob)
 Cast a bolt-like spell. More...
 
int fire_bow (object *op, object *arrow, int dir, int wc_mod, int16_t sx, int16_t sy)
 Creature (monster or player) fires a bow. More...
 
int fire_swarm (object *op, object *caster, object *spell, int dir)
 The following routine creates a swarm of objects. More...
 
void fix_luck (void)
 Fixes luck of players, slowly move it towards 0. More...
 
objectfix_stopped_arrow (object *op)
 An ARROW stops moving. More...
 
void fix_stopped_item (object *op, mapstruct *map, object *originator)
 Put stopped item where stop_item() had found it. More...
 
void fix_weight (void)
 Check recursively the weight of all players, and fix what needs to be fixed. More...
 
void flush_old_maps (void)
 Removes tmp-files of maps which are going to be reset next time they are visited. More...
 
int forbid_play (void)
 Checks if server should be started. More...
 
void free_knowledge (void)
 Free all knowledge data. More...
 
int free_no_drop (object *op)
 Check whether the given object is FLAG_NO_DROP. More...
 
void free_quest (void)
 Free all quest status structures. More...
 
void free_quest_definitions (void)
 Free all quest definitions and steps. More...
 
void free_server (void)
 Frees all memory allocated around here: More...
 
int friendly_fire (object *op, object *hitter)
 Find out if this is friendly fire (PVP and attacker is peaceful) or not. More...
 
void get_name (object *op)
 Waiting for the player's name. More...
 
objectget_nearest_player (object *mon)
 Finds the nearest visible player for some object. More...
 
int get_party_password (object *op, partylist *party)
 Ask the player for the password of the party she wants to join. More...
 
void get_password (object *op)
 Waiting for the player's password. More...
 
playerget_player (player *p)
 Create a player's object, initialize a player's structure. More...
 
void get_who_escape_code_value (char *return_val, int size, const char letter, player *pl)
 Returns the value of the escape code used in the who format specifier. More...
 
void give_initial_items (object *pl, treasurelist *items)
 Gives a new player her initial items. More...
 
int handle_newcs_player (object *op)
 Handles commands the player can send us, and various checks on invisibility, golem and such. More...
 
int hide (object *op, object *skill)
 Main hide handling. More...
 
int hideability (object *ob)
 Look at the surrounding terrain to determine the hideability of this object. More...
 
void hiscore_check (object *op, int quiet)
 Checks if player should enter the hiscore, and if so writes her into the list. More...
 
void hiscore_display (object *op, int max, const char *match)
 Displays the high score file. More...
 
void hiscore_init (void)
 Initializes the module. More...
 
int hit_map (object *op, int dir, uint32_t type, int full_hit)
 Attack a spot on the map. More...
 
int hit_player (object *op, int dam, object *hitter, uint32_t type, int full_hit)
 Object is attacked by something. More...
 
objecthit_with_arrow (object *op, object *victim)
 hit_with_arrow() disassembles the missile, attacks the victim and reassembles the missile. More...
 
int identify_object_with_skill (object *tmp, object *pl, object *skill, int print_on_success)
 Helper function for do_skill_ident, so that we can loop over inventory AND objects on the ground conveniently. More...
 
int infect_object (object *victim, object *disease, int force)
 Try to infect something with a disease. More...
 
void init (int argc, char **argv)
 This is the main server initialization function. More...
 
void init_commands (void)
 Sorts the command arrays for easy search through bsearch(). More...
 
void init_ob_methods (void)
 Initializes the ob_method system. More...
 
void init_skills (void)
 This just sets up the skill_names table above. More...
 
void initPlugins (void)
 Plugins initialization. More...
 
void inventory (object *op, object *inv)
 Prints object's inventory. More...
 
int is_true_undead (object *op)
 Is the object a true undead? More...
 
int jump (object *pl, int dir, object *skill)
 Jump skill handling. More...
 
void key_change_class (object *op, char key)
 This function takes the key that is passed, and does the appropriate action with it (change race, or other things). More...
 
void key_confirm_quit (object *op, char key)
 We receive the reply to the 'quit confirmation' message. More...
 
void key_roll_stat (object *op, char key)
 Player is currently swapping stats. More...
 
void kill_player (object *op, const object *killer)
 Handle a player's death. More...
 
void knowledge_first_player_save (player *pl)
 Ensure the knowledge state is correctly saved for the player. More...
 
void knowledge_give (player *pl, const char *marker, const object *book)
 Give a knowledge item from its code. More...
 
void knowledge_item_can_be_used_alchemy (object *op, const object *item)
 Displays known alchemy recipes an item can be used in. More...
 
int knowledge_player_knows (const player *pl, const char *knowledge)
 Determines whether a player knows a specific knowledge or not. More...
 
void knowledge_process_incremental (void)
 Incrementally send knowledge information to players, and remove information for players who left. More...
 
void knowledge_read (player *pl, object *book)
 Player is reading a book, give knowledge if needed, warn player, and such. More...
 
void knowledge_send_info (socket_struct *ns)
 Send the reply_info for 'knowledge_info'. More...
 
void knowledge_send_known (player *pl)
 Send initial known knowledge to player, if requested. More...
 
void knowledge_show_monster_detail (object *op, const char *name)
 Display the details of a monster if the player knows them. More...
 
int learn_skill (object *pl, object *scroll)
 Player is trying to learn a skill. More...
 
void leave (player *pl, int draw_exit)
 Player logs out, or was disconnected. More...
 
void legacy_animate_trigger (object *op)
 
void legacy_apply_container (object *op, object *sack)
 
void legacy_move_hole (object *op)
 
void legacy_remove_force (object *op)
 
int legal_range (object *op, int r)
 Check for the validity of a player range. More...
 
void link_player_skills (object *op)
 This function goes through the player inventory and sets up the last_skills[] array in the player object. More...
 
void list_players (object *op, region *reg, partylist *party)
 Displays the players in a region or party. More...
 
objectlookup_spell_by_name (object *op, const char *spname)
 Look at object 'op' and see if they know the spell spname. More...
 
int magic_wall (object *op, object *caster, int dir, object *spell_ob)
 This creates magic walls. More...
 
void make_visible (object *op)
 Makes an object visible again. More...
 
int makes_invisible_to (object *pl, object *mon)
 This checks to see if 'pl' is invisible to 'mon'. More...
 
void map_info (object *op, const char *search)
 This is the 'maps' command. More...
 
void meditate (object *pl, object *skill)
 Meditation skill handling. More...
 
int min_casting_level (const object *caster, const object *spell)
 This function takes a caster and spell and presents the effective level the caster needs to be to cast the spell. More...
 
int monster_can_detect_enemy (object *op, object *enemy, rv_vector *rv)
 Determine if we can 'detect' the enemy. More...
 
int monster_can_see_enemy (object *op, object *enemy)
 Assuming no walls/barriers, lets check to see if its possible to see an enemy. More...
 
void monster_check_apply_all (object *monster)
 Calls monster_check_apply() for all inventory objects. More...
 
void monster_check_doors (object *op, mapstruct *m, int x, int y)
 Living creature attempts to open a door. More...
 
void monster_check_earthwalls (object *op, mapstruct *m, int x, int y)
 Living creature attempts to hit an earthwall. More...
 
objectmonster_check_enemy (object *npc, rv_vector *rv)
 Checks npc->enemy and returns that enemy if still valid, NULL otherwise. More...
 
void monster_communicate (object *op, const char *txt)
 This function looks for an object or creature that is listening to said text. More...
 
int monster_compute_path (object *source, object *target, int default_dir)
 Computes a path from source to target. More...
 
void monster_do_living (object *op)
 For a monster, regenerate hp and sp, potentially clear scared status. More...
 
void monster_do_say (const mapstruct *map, const char *message)
 Output a NPC message on a map. More...
 
objectmonster_find_nearest_living_creature (object *npc)
 Returns the nearest living creature (monster or generator). More...
 
objectmonster_find_throw_ob (object *op)
 Find an item for the monster to throw. More...
 
int monster_move (object *op)
 Main monster processing routine. More...
 
void monster_npc_call_help (object *op)
 A monster calls for help against its enemy. More...
 
void monster_npc_say (object *npc, const char *cp)
 Simple function to have some NPC say something. More...
 
int monster_stand_in_light (object *op)
 Determine if op stands in a lighted square. More...
 
int mood_change (object *op, object *caster, object *spell)
 This covers the various spells that change the moods of monsters - makes them angry, peaceful, friendly, etc. More...
 
int move_disease (object *disease)
 Ticks the clock for disease: infect, aggravate symptoms, ... More...
 
void move_firewall (object *op)
 Move for FIREWALL. More...
 
int move_ob (object *op, int dir, object *originator)
 Op is trying to move in direction dir. More...
 
int move_object (object *op, int dir)
 Try to move op in the direction "dir". More...
 
int move_player (object *op, int dir)
 Player gave us a direction, check whether to move or fire. More...
 
void move_player_attack (object *op, int dir)
 The player is also actually going to try and move (not fire weapons). More...
 
void move_player_mover (object *op)
 This function takes a PLAYERMOVER as an argument, and performs the function of a player mover, which is: More...
 
void move_symptom (object *symptom)
 Make the symptom do the nasty things it does. More...
 
int move_to (object *op, int x, int y)
 Move an object one square toward a specified destination on the same map. More...
 
char const * newhash (char const password[static 1])
 
int ok_to_put_more (mapstruct *m, int16_t x, int16_t y, object *op, uint32_t immune_stop)
 Returns true if it is ok to put spell op on the space/may provided. More...
 
int onoff_value (const char *line)
 Utility function to convert a reply to a yes/no or on/off value. More...
 
int op_on_battleground (object *op, int *x, int *y, archetype **trophy)
 Check if the given object (usually a player) is standing on a battleground tile. More...
 
void paralyze_living (object *op, int dam)
 Paralyze a living thing. More...
 
int party_confirm_password (const partylist *party, const char *password)
 Checks whether a given password matches the party's password. More...
 
partylistparty_find (const char *partyname)
 Find a party by name. More...
 
partylistparty_form (object *op, const char *partyname)
 Forms the party struct for a party called 'partyname'. More...
 
partylistparty_get_first (void)
 Returns the first party from the list of all parties. More...
 
const char * party_get_leader (const partylist *party)
 Returns the name of the party's leader. More...
 
partylistparty_get_next (const partylist *party)
 Returns the next party from the list of all parties. More...
 
const char * party_get_password (const partylist *party)
 Returns the party's password. More...
 
void party_join (object *op, partylist *party)
 Makes a player join a party. More...
 
void party_leave (object *op)
 Makes a player leave his party. More...
 
void party_obsolete_parties (void)
 Remove unused parties (no players), this could be made to scale a lot better. More...
 
void party_remove (partylist *party)
 Removes and frees a party. More...
 
void party_send_message (object *op, const char *message)
 Send a message to all party members except the speaker. More...
 
void party_set_password (partylist *party, const char *password)
 Sets a party's password. More...
 
int path_to_player (object *mon, object *pl, unsigned mindiff)
 Returns the direction to the player, if valid. More...
 
int perceive_self (object *op)
 Living thing wants to know information. More...
 
void pets_control_golem (object *op, int dir)
 Makes the golem go in specified direction. More...
 
void pets_follow_owner (object *ob, object *owner)
 A pet is trying to follow its owner. More...
 
objectpets_get_enemy (object *pet, rv_vector *rv)
 Given that 'pet' is a friendly object, this function returns a monster the pet should attack, NULL if nothing appropriate is found. More...
 
void pets_move (object *ob)
 Handles a pet's movement. More...
 
void pets_move_golem (object *op)
 Handles a golem's movement. More...
 
void pets_remove_all (void)
 This function checks all pets so they try to follow their master around the world. More...
 
int pets_should_arena_attack (object *pet, object *owner, object *target)
 Determines if checks so pets don't attack players or other pets should be overruled by the arena petmode. More...
 
int pets_summon_golem (object *op, object *caster, int dir, object *spob)
 Summons a monster. More...
 
int pets_summon_object (object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
 General purpose summoning function. More...
 
void pets_terminate_all (object *owner)
 Removes all pets someone owns. More...
 
int pick_lock (object *pl, int dir, object *skill)
 Lock pick handling. More...
 
void pick_up (object *op, object *alt)
 Try to pick up an item. More...
 
void play_again (object *op)
 Ask the player whether to play again or disconnect. More...
 
int player_arrest (object *who)
 Put a player into jail, taking into account cursed exits and player's region. More...
 
int player_can_view (object *pl, object *op)
 Check the player los field for viewability of the object op. More...
 
void player_set_state (player *pl, uint8_t state)
 Set the player's state to the specified one. More...
 
void player_unready_range_ob (player *pl, object *ob)
 Unready an object for a player. More...
 
int playername_ok (const char *cp)
 Is the player name valid. More...
 
int players_on_map (mapstruct *m, int show_all)
 Returns the count of players on a map, calculated from player list. More...
 
int plugin_event_say (object *npc, talk_info *talk)
 
void plugins_display_list (object *op)
 Displays a list of loaded plugins (keystrings and description) in the game log window. More...
 
int plugins_init_plugin (const char *libfile)
 Try to load the specified plugin. More...
 
int plugins_remove_plugin (const char *id)
 Unload the specified plugin. More...
 
void polymorph (object *op, object *who, int level)
 Handles polymorphing an object, living or not. More...
 
int pray (object *pl, object *skill)
 Praying skill handling. More...
 
void pray_at_altar (object *pl, object *altar, object *skill)
 Player prays at altar. More...
 
int probe (object *op, object *caster, object *spell_ob, int dir, int level)
 Try to get information about a living thing. More...
 
void process_events (void)
 Process all active objects. More...
 
int process_object (object *op)
 Main object move function. More...
 
int push_ob (object *who, int dir, object *pusher)
 Something is pushing some other object. More...
 
void put_object_in_sack (object *op, object *sack, object *tmp, uint32_t nrof)
 Something tries to put an object into another. More...
 
void quest_first_player_save (player *pl)
 Ensure the quest state is correctly saved for a player. More...
 
int quest_get_player_state (player *pl, sstring quest_code)
 Get the quest state for a player. More...
 
void quest_send_initial_states (player *pl)
 Send the current quest states for the specified player, if the client supports those notifications. More...
 
void quest_set_player_state (player *pl, sstring quest_code, int state)
 Set the state of a quest for a player. More...
 
void quest_start (player *pl, sstring quest_code, int state)
 Start a quest for a player. More...
 
int quest_was_completed (player *pl, sstring quest_code)
 Check if a quest was completed once for a player, without taking account the current state. More...
 
void read_map_log (void)
 Reads temporary maps information from disk. More...
 
void receive_party_password (object *op)
 Player entered a party password. More...
 
void receive_play_again (object *op, char key)
 Player replied to play again / disconnect. More...
 
void receive_player_name (object *op)
 A player just entered her name. More...
 
void receive_player_password (object *op)
 A player just entered her password, including for changing it. More...
 
int recharge (object *op, object *caster, object *spell_ob)
 Recharge wands. More...
 
void recursive_roll (object *op, int dir, object *pusher)
 An object is pushed by another which is trying to take its place. More...
 
int reflwall (mapstruct *m, int x, int y, object *sp_op)
 Decides weither the (spell-)object sp_op will be reflected from the given mapsquare. More...
 
void regenerate_rod (object *rod)
 Regenerates a rod's charges. More...
 
void register_all_ob_types (void)
 Calls the intialization functions for all individual types. More...
 
int remove_curse (object *op, object *caster, object *spell)
 This function removes the cursed/damned status on equipped items. More...
 
void remove_door (object *op)
 Remove non locked doors. More...
 
void remove_locked_door (object *op)
 Same as remove_door() but for locked doors. More...
 
int remove_trap (object *op, object *skill)
 This skill will disarm any previously discovered trap. More...
 
void remove_unpaid_objects (object *op, object *env, int free_items)
 This goes throws the inventory and removes unpaid objects, and puts them back in the map (location and map determined by values of env) or frees them. More...
 
void rod_adjust (object *rod)
 Adjusts rod attributes. More...
 
void roll_again (object *op)
 Ask the player what to do with the statistics. More...
 
int roll_stat (void)
 This rolls four 1-6 rolls and sums the best 3 of the 4. More...
 
void roll_stats (object *op)
 Roll the initial player's statistics. More...
 
int sack_can_hold (const object *pl, const object *sack, const object *op, uint32_t nrof)
 Check if an item op can be put into a sack. More...
 
int save_player (object *op, int flag)
 Saves a player to disk. More...
 
void save_throw_object (object *op, uint32_t type, object *originator)
 Object is attacked with some attacktype (fire, ice, ...). More...
 
void scroll_failure (object *op, int failure, int power)
 op made some mistake with a scroll, this takes care of punishment. More...
 
void send_news (const object *op)
 Send the news to a player. More...
 
void send_rules (const object *op)
 Send the rules to a player. More...
 
void server_main (int argc, char *argv[])
 Server main function. More...
 
void set_darkness_map (mapstruct *m)
 Set the darkness level for a map, based on the time of the day. More...
 
void set_first_map (object *op)
 This loads the first map an puts the player on it. More...
 
void set_map_timeout (mapstruct *oldmap)
 Applies the map timeout. More...
 
int set_object_face_main (object *op)
 Makes an object's face the main face, which is supposed to be the "closed" one. More...
 
void set_spell_skill (object *op, object *caster, object *spob, object *dest)
 Utility function to assign the correct skill when casting. More...
 
int should_director_abort (const object *op, const object *victim)
 Check if op should abort moving victim because of it's race or slaying. More...
 
void show_skills (object *op, const char *search)
 Displays a player's skill list, and some other non skill related info (god, max weapon improvements, item power). More...
 
void shuffle_attack (object *op, int change_face)
 This routine shuffles the attack of op to one of the ones in the list. More...
 
int singing (object *pl, int dir, object *skill)
 Singing skill handling. More...
 
void skill_attack (object *tmp, object *pl, int dir, const char *string, object *skill)
 Core routine for use when we attack using a skills system. More...
 
int skill_ident (object *pl, object *skill)
 Main identification skill handling. More...
 
int skill_throw (object *op, object *part, int dir, object *skill)
 Throwing skill handling. More...
 
int SP_level_dam_adjust (const object *caster, const object *spob)
 Returns adjusted damage based on the caster. More...
 
int SP_level_duration_adjust (const object *caster, const object *spob)
 Adjust the duration of the spell based on level. More...
 
int SP_level_range_adjust (const object *caster, const object *spob)
 Adjust the range of the spell based on level. More...
 
int16_t SP_level_spellpoint_cost (object *caster, object *spell, int flags)
 Scales the spellpoint cost of a spell by it's increased effectiveness. More...
 
int SP_level_wc_adjust (const object *caster, const object *spob)
 Returns adjusted wc based on the caster and the spell. More...
 
void spell_effect (object *spob, int x, int y, mapstruct *map, object *originator)
 Inserts into map a spell effect based on other_arch. More...
 
void spell_failure (object *op, int failure, int power, object *skill)
 Handles the various effects for differing degrees of failure badness. More...
 
int spell_find_dir (mapstruct *m, int x, int y, object *exclude)
 Search what direction a spell should go in, first the center square then some close squares in the given map at the given coordinates for live objects. More...
 
void spring_trap (object *trap, object *victim)
 This function generalizes attacks by runes/traps. More...
 
int stand_near_hostile (object *who)
 Determine if who is standing near a hostile creature. More...
 
int steal (object *op, int dir, object *skill)
 Main stealing function. More...
 
objectstop_item (object *op)
 An item (ARROW or such) stops moving. More...
 
void store_spell_expiry (object *spell)
 Stores in the spell when to warn player of expiration. More...
 
int summon_hostile_monsters (object *op, int n, const char *monstername)
 Summons hostile monsters and places them in nearby squares. More...
 
void swap_below_max (const char *except_level)
 Tries to swap out maps which are still in memory, because of MAP_TIMEOUT until used objects is below MAX_OBJECTS or there are no more maps to swap. More...
 
int swap_map (mapstruct *map)
 Swaps a map to disk. More...
 
int tailor_god_spell (object *spellop, object *caster)
 Changes the attributes of cone, smite, and ball spells as needed by the code. More...
 
int teleport (object *teleporter, uint8_t tele_type, object *user)
 Teleport an item around a nearby random teleporter of specified type. More...
 
int tick_length (float seconds)
 Calculate the number of ticks that correspond to real time. More...
 
void tick_the_clock (void)
 This performs the basic function of advancing the clock one tick forward. More...
 
int transfer_ob (object *op, int x, int y, int randomly, object *originator)
 Move an object (even linked objects) to another spot on the same map. More...
 
int transport_can_hold (const object *transport, const object *op, int nrof)
 Can transport hold object op? This is a pretty trivial function, but in the future, possible transport may have more restrictions or weight reduction like containers. More...
 
int trap_disarm (object *disarmer, object *trap, int risk, object *skill)
 Try to disarm a trap/rune. More...
 
int trap_see (object *op, object *trap)
 Should op see trap? More...
 
int trap_show (object *trap, object *where)
 Handles showing a trap/rune detonation. More...
 
int use_alchemy (object *op)
 Handle use_skill for alchemy-like items. More...
 
int use_oratory (object *pl, int dir, object *skill)
 Oratory skill handling. More...
 
int use_skill (object *op, const char *string)
 Similar to invoke command, it executes the skill in the direction that the user is facing. More...
 
int user_event (object *op, object *activator, object *third, const char *message, int fix)
 
int verify_player (const char *name, char *password)
 This verify that a character of name exits, and that it matches password. More...
 
int write_mark (object *op, object *spell, const char *msg)
 This writes a rune that contains the appropriate message. More...
 
int write_on_item (object *pl, const char *params, object *skill)
 Implement the 'inscription' skill, which checks for the required skills and marked items before running either write_note() or write_scroll(). More...
 
int write_rune (object *op, object *caster, object *spell, int dir, const char *runename)
 Player is attempting to write a magical rune. More...
 

Function Documentation

int account_change_password ( const char *  account_name,
const char *  current_password,
const char *  new_password 
)

Change an account password.

It does error checking, but the caller might want to do checking before getting here.

Parameters
account_nameaccount name we are changing
current_passwordcurrent password for the account. This is the unencrypted password (password as entered by user)
new_passwordnew password to set, unencrypted.
Return values
0password changed successfully.
1account name, old or new password has invalid character.
2account does not exist.
3current password is invalid.

Definition at line 657 of file account.c.

References account_check_string(), check_password(), account_struct::name, newhash(), account_struct::next, account_struct::password, strcasecmp(), and strdup_local.

Referenced by account_password().

Here is the call graph for this function:

Here is the caller graph for this function:

Account_Char* account_char_add ( Account_Char chars,
player pl 
)

This adds a player to the list of accounts.

We check to see if the player has already been added to this account - if so, we just update the infromation. Note that all strings are filled in, even if that may just be a blank field. This simplifies a lot of the code instead of having to deal with NULL values. Note that this routine is also used to update existing entries - if the character already exists, we update it, otherwise it is added.

Parameters
charsExisting list of characters for account. May be NULL.
plPlayer structure to add
Returns
Returns new list of characters for account.

Definition at line 192 of file account_char.c.

References add_string(), obj::arch, account_char_struct::character_class, archt::clone, account_char_struct::face, obj::face, free_string(), account_char_struct::isDead, account_char_struct::level, obj::level, account_char_struct::map, obj::map, pl::maplevel, new_face_struct::name, account_char_struct::name, obj::name, mapdef::name, account_char_struct::next, pl::ob, account_char_struct::party, pl::party, party_struct::partyname, and account_char_struct::race.

Referenced by save_player(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

void account_char_free ( Account_Char chars)

This frees all data associated with the character information.

Parameters
charsData to free. The caller should make sure it no longer uses any data in this list.

Definition at line 332 of file account_char.c.

References account_char_struct::character_class, account_char_struct::face, free_string(), account_char_struct::map, account_char_struct::name, account_char_struct::next, account_struct::next, account_char_struct::party, and account_char_struct::race.

Referenced by account_add_player_cmd(), free_newsocket(), key_confirm_quit(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

Account_Char* account_char_load ( const char *  account_name)

For a given account name, load the character information and return it.

It is the responsibility of the caller to call account_char_free() on the returned value to free it.

Parameters
account_nameName of the account. The name should be validated before this routine is called (eg, passed checks for legitimate characters and logged in)
Returns
linked list of the character data.

Definition at line 79 of file account_char.c.

References ACCOUNT_DIR, add_string(), llevError, llevInfo, Settings::localdir, LOG(), MAX_BUF, NUM_ACCOUNT_CHAR_FIELDS, settings, snprintf, split_string(), and VERY_BIG_BUF.

Referenced by account_add_player_cmd(), make_perma_dead(), send_account_players(), START_TEST(), and unmake_perma_dead().

Here is the call graph for this function:

Here is the caller graph for this function:

Account_Char* account_char_remove ( Account_Char chars,
const char *  pl_name 
)

This removes a character on this account.

This is typically used when a character has been deleted, and not for general cleanup

Parameters
charsExisting list of characters for account.
pl_nameThe name of the character
Returns
Returns new list of characters for account.

Definition at line 296 of file account_char.c.

References account_char_struct::character_class, account_char_struct::face, free_string(), account_char_struct::map, account_char_struct::name, account_char_struct::next, account_char_struct::party, and account_char_struct::race.

Here is the call graph for this function:

void account_char_save ( const char *  account,
Account_Char chars 
)

Saves the character information for the given account.

Parameters
accountaccount name to save data for.
charspreviously loaded/generated list of character information for this account.

Definition at line 145 of file account_char.c.

References ACCOUNT_DIR, account_char_struct::character_class, account_char_struct::face, account_char_struct::isDead, account_char_struct::level, Settings::localdir, account_char_struct::map, MAX_BUF, account_char_struct::name, account_char_struct::next, of_close(), of_open(), account_char_struct::party, account_char_struct::race, settings, snprintf, and unlink.

Referenced by account_add_player_cmd(), free_newsocket(), key_confirm_quit(), make_perma_dead(), save_player(), START_TEST(), and unmake_perma_dead().

Here is the call graph for this function:

Here is the caller graph for this function:

int account_check_string ( const char *  str)

Checks a string to make sure it does not have any invalid characters.

We are fairly permissive on character here. String must start with alphanumeric String must not contain :;/'[ String can not end if a space This string will get used for file/directory names, but so long as as characters are not included that are not illegal, one can still manipulate the file/directory by putting it in quotes. If one starts to block all characters that may get interperted by shells, a large number of characters now get blocked (|*]()!, etc), and deciding which should be allowed and not just becomes a judgement call, so easier to just allow all and have the user put it in quotes.

Parameters
strstring to check
Returns
0 if ok, 1 if we have an invalid character, 2 if string is too long.

Definition at line 368 of file account.c.

References MAX_NAME.

Referenced by account_change_password(), account_new(), account_new_cmd(), account_password(), create_player_cmd(), and START_TEST().

Here is the caller graph for this function:

const char* account_exists ( const char *  account_name)

Checks the existing accounts, and see if this account exists.

This can also be used to get the official name for the account (eg, as user first entered, so Mark instead of mARk)

Parameters
account_nameaccount name we are looking for.
Returns
returns official name on match, NULL on no match.

Definition at line 308 of file account.c.

References account_struct::name, account_struct::next, and strcasecmp().

Referenced by account_login_cmd(), account_new(), account_new_cmd(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* account_get_account_for_char ( const char *  charname)

This looks at all the accounts and sees if charname is associated with any of them.

Parameters
charnamecharacter name to check for.
Returns
Account name the character is associated with, NULL if none.

Definition at line 561 of file account.c.

References account_struct::character_names, account_struct::name, account_struct::next, and account_struct::num_characters.

Referenced by account_add_player_cmd(), and save_player().

Here is the caller graph for this function:

socket_struct* account_get_logged_in_init_socket ( const char *  name)

This is like the above routine, but checks the init_sockets (account in process of logging in).

Parameters
nameaccount name to check against
Returns
index value into init_sockets[] of matching socket, or -1 if no match.

Definition at line 607 of file account.c.

References Socket_Info::allocated_sockets, init_sockets, Ns_Add, socket_info, and strcasecmp().

Referenced by account_is_logged_in(), and account_login_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

player* account_get_logged_in_player ( const char *  name)

This checks to see if the account is logged in with a player attached If so, it returns the player object.

Parameters
nameaccount name to check against.
Returns
player structure of matching account, or NULL if no match.

Definition at line 586 of file account.c.

References socket_struct::account_name, first_player, pl::next, pl::socket, and strcasecmp().

Referenced by account_is_logged_in(), and account_login_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

char** account_get_players_for_account ( const char *  account_name)

Returns an array of strings for the characters on this account - the array is null terminated.

In fact, it just returns the ac->character_names.

Parameters
account_namename of the account to get the players for.
Returns
array of character names for this account. This will return NULL in the case where we can not find the account. It will return an array with the first entry being NULL in the case of a valid account with no characters added. This returned data should not be altered in any way.

Definition at line 542 of file account.c.

References account_struct::character_names, account_struct::name, account_struct::next, and strcasecmp().

Referenced by account_play_cmd(), send_account_players(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

int account_is_logged_in ( const char *  name)

This checkes if an account is logged in.

It is mainly used because some operations should not be done on logged in accounts (keeping everything synchronized is harder.)

Parameters
namename to look for.
Returns
0 if not logged in, 1 if logged in.

Definition at line 629 of file account.c.

References account_get_logged_in_init_socket(), and account_get_logged_in_player().

Referenced by account_add_player_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

int account_link ( const char *  account_name,
const char *  player_name 
)

Adds a player name to an account.

Player corresponds to the names used in the pl object, not the person sitting at the computer. This function presumes that the caller has done the work to verify that the player does in fact exist, and does any related work to update the player. What this function does is simply update the account structure.

Parameters
account_namename of the account we are adding this player to.
player_namename of this player.
Return values
0player name added successfully.
1could not find account of that name.
2number of characters on this account has reached a maximum.

Definition at line 460 of file account.c.

References account_struct::character_names, MAX_CHARACTERS_PER_ACCOUNT, account_struct::name, account_struct::next, account_struct::num_characters, strcasecmp(), and strdup_local.

Referenced by account_add_player_cmd(), save_player(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

int account_login ( const char *  account_name,
const char *  account_password 
)

Check if the given account exists, and whether the password is correct.

Note - if we do get a match, we update the last_login value - it is presumed that if someone knows the right accountname/password, that the account is effectively getting logged in.

Parameters
account_nameaccount name we are looking for.
account_passwordpassword for the account. This is the unencrypted password (password as entered by user)
Returns
0 if no match/wrong password, 1 if a match is found and password matches.

Definition at line 332 of file account.c.

References check_password(), account_struct::last_login, account_struct::name, account_struct::next, account_struct::password, and strcasecmp().

Referenced by account_login_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

int account_new ( const char *  account_name,
const char *  account_password 
)

Adds an account.

It does error checking, but the caller might want to do checking before getting here.

Parameters
account_nameaccount name we are adding
account_passwordpassword for the account. This is the unencrypted password (password as entered by user)
Return values
0account added successfully.
1name or password has invalid character.
2account already exists.

Definition at line 407 of file account.c.

References account_check_string(), account_exists(), accounts, accounts_loaded, account_struct::character_names, account_struct::created, account_struct::last_login, MAX_CHARACTERS_PER_ACCOUNT, account_struct::name, newhash(), account_struct::next, account_struct::num_characters, account_struct::password, and strdup_local.

Referenced by account_new_cmd(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

int account_remove_player ( const char *  account_name,
const char *  player_name 
)

Removes a player name from an account.

Player corresponds to the names used in the pl object, not the person sitting at the computer. This function presumes that the caller has done the work to verify that the player does in fact exist, and does any related work to update the player. What this function does is simply update the account structure.

Parameters
account_namename of the account we are removing this player from.
player_namename of this player.
Return values
0player name removed successfully.
1could not find account of that name.
2player of this name not on account.

Definition at line 496 of file account.c.

References account_struct::character_names, account_struct::name, account_struct::next, account_struct::num_characters, and strcasecmp().

Referenced by account_add_player_cmd(), key_confirm_quit(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

void accounts_clear ( void  )

This is used purely by the test harness - by clearing the accounts, it can then verify that the data is added is loaded back into memory properly.

As such, we don't worry about memory cleanup, etc.

Definition at line 112 of file account.c.

References accounts_loaded.

Referenced by START_TEST().

Here is the caller graph for this function:

void accounts_load ( void  )

This loads all the account entries into memory.

It is presumed to only be called once during the program startup.

Definition at line 121 of file account.c.

References ACCOUNT_FILE, accounts_loaded, account_struct::character_names, account_struct::created, account_struct::last_login, llevError, llevInfo, Settings::localdir, LOG(), MAX_BUF, MAX_CHARACTERS_PER_ACCOUNT, account_struct::name, account_struct::next, NUM_ACCOUNT_FIELDS, account_struct::num_characters, account_struct::password, settings, snprintf, split_string(), strdup_local, and VERY_BIG_BUF.

Referenced by init(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

void accounts_save ( void  )

Save all the account information.

Since the data is stored in a flat file, if an update is needed for an account, the only way to save updates is to save all the data - there isn't an easy way to just add another player name for an account.

Definition at line 267 of file account.c.

References ACCOUNT_FILE, account_write_entry(), accounts_loaded, account_struct::created, Settings::localdir, MAX_BUF, account_struct::next, account_struct::num_characters, of_close(), of_open(), settings, and snprintf.

Referenced by account_new_cmd(), cleanup(), do_specials(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

player* add_player ( socket_struct ns,
int  flags 
)

Tries to add player on the connection passwd in ns.

Player object is created and put on the first map, rules/news/motd are sent.

Parameters
nsconnection.
flagsflag values are define in player.h: ADD_PLAYER_NEW - If set, go right to new character creation - used in case of new account code. We don't display motd and other bits in this case either. ADD_PLAYER_NO_MAP - Do not set up map information - used in character login method >2 where we do not use the same starting map.
Returns
player returns pointer to newly created player structure.

Definition at line 453 of file player.c.

References add_friendly_object(), ADD_PLAYER_NEW, ADD_PLAYER_NO_MAP, ADD_PLAYER_NO_STATS_ROLL, CLEAR_FLAG, display_motd(), FLAG_FRIENDLY, get_name(), get_player(), pl::ob, player_set_state(), roll_again(), send_news(), send_rules(), set_first_map(), set_player_socket(), and ST_ROLL_STAT.

Referenced by add_me_cmd(), and create_player_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

int alchemy ( object op,
object caster,
object spell_ob 
)

Change items to gold nuggets.

Only works for players.

Parameters
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
Return values
0op isn't a player.
1op is a player.

Definition at line 2250 of file spell_effect.c.

References alchemy_object(), obj::contr, obj::duration, FLAG_ALIVE, FLAG_IS_CAULDRON, FLAG_NO_PICK, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_flags(), GET_MAP_MOVE_BLOCK, socket_struct::look_position, obj::map, MOVE_WALK, P_NO_MAGIC, P_OUT_OF_MAP, place_alchemy_objects(), PLAYER, QUERY_FLAG, pl::socket, SP_level_dam_adjust(), SP_level_duration_adjust(), obj::type, obj::x, and obj::y.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int animate_weapon ( object op,
object caster,
object spell,
int  dir 
)

Generalization of staff_to_snake().

Makes a golem out of the caster's weapon. The golem is based on the archetype specified, modified by the caster's level and the attributes of the weapon. The weapon is inserted in the golem's inventory so that it falls to the ground when the golem dies. This code was very odd - code early on would only let players use the spell, yet the code was full of player checks. I've presumed that the code that only let players use it was correct, and removed all the other player checks. MSW 2003-01-06

Parameters
opwho is casting.
casterwhat is casting.
spellactual spell object.
dircasting direction.
Return values
0spell failure.
1spell was successful.

Definition at line 3012 of file spell_effect.c.

References add_friendly_object(), add_string(), obj::anim_speed, obj::animation_id, obj::arch, arch_to_object(), AT_PHYSICAL, ATNR_BLIND, ATNR_CONFUSION, ATNR_DEATH, ATNR_DEPLETE, ATNR_FEAR, ATNR_PARALYZE, ATNR_PHYSICAL, ATNR_POISON, ATNR_SLOW, ATNR_TURN_UNDEAD, obj::attacktype, caster_level(), CLEAR_FLAG, archt::clone, liv::Con, obj::contr, obj::count, liv::dam, liv::Dex, obj::direction, draw_ext_info(), draw_ext_info_format(), obj::duration, esrv_update_item(), liv::exp, obj::face, find_marked_object(), fix_object(), FLAG_ANIMATE, FLAG_APPLIED, FLAG_FRIENDLY, FLAG_MONSTER, FLAG_REMOVED, FLAG_UNPAID, FLAG_USE_WEAPON, free_string(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, GOLEM, pl::golem_count, liv::hp, obj::last_anim, llevError, LOG(), obj::magic, obj::map, obj::materialname, MAX, MAX_BUF, liv::maxgrace, liv::maxhp, obj::move_type, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, obj::name, archt::name, name_to_material(), NDI_BLACK, NDI_UNIQUE, obj::nrof, NROFATTACKS, object_find_free_spot(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_set_owner(), object_split(), object_update_speed(), obj::other_arch, P_OUT_OF_MAP, pets_control_golem(), PLAYER, QUERY_FLAG, query_name(), obj::race, range_golem, pl::ranges, obj::resist, _materialtype::save, SET_FLAG, set_spell_skill(), pl::shoottype, snprintf, liv::sp, SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), obj::speed, obj::speed_left, obj::state, obj::stats, liv::Str, obj::type, UPD_NROF, liv::wc, WEAPON, obj::x, and obj::y.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_auto ( object op)

Map was just loaded, handle op's initialization.

Generates shop floor's item, and treasures.

Parameters
opobject to initialize.
Returns
1 if object was initialized, 0 else.
Note
auto_apply() has been renamed to apply_auto()

Definition at line 214 of file main.c.

References BOOK, CLEAR_FLAG, create_treasure(), mapdef::difficulty, obj::env, liv::exp, FLAG_AUTO_APPLY, FLAG_BLESSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IS_A_TEMPLATE, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_NO_DESTROY_CALLBACK, generate_treasure(), GT_ENVIRONMENT, GT_ONLY_GOOD, HAS_RANDOM_ITEMS, liv::hp, identify(), obj::map, MAX, object_free2(), object_free_drop_inventory(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), QUERY_FLAG, obj::randomitems, SET_FLAG, SHOP_FLOOR, obj::stats, TREASURE, obj::type, obj::x, and obj::y.

Referenced by apply_auto_fix(), and do_auto_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_auto_fix ( mapstruct m)

Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff).

Calls apply_auto() if appropriate.

Parameters
mmap to fix.
Note
fix_auto_apply() has been renamed to apply_auto_fix()

Go through the entire map (only the first time when an original map is loaded) and performs special actions for certain objects (most initialization of chests and creation of treasures and stuff).

Added as part of glue cleaning. Ryo 2005-07-15

Definition at line 261 of file main.c.

References obj::above, ALTAR, apply_auto(), obj::arch, check_trigger(), CLASS, CONTAINER, create_treasure(), mapdef::difficulty, FIREWALL, FLAG_AUTO_APPLY, FLAG_IS_LINKED, FLAG_MONSTER, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_OB, HAS_RANDOM_ITEMS, HEAD, liv::hp, MAP_HEIGHT, MAP_WIDTH, monster_check_apply_all(), object_update_speed(), PLAYER, PLAYER_CHANGER, POTION, QUERY_FLAG, obj::randomitems, ROD, SCROLL, SPELL, SPELLBOOK, obj::stats, TIMED_GATE, TREASURE, TRIGGER_BUTTON, TRIGGER_PEDESTAL, obj::type, and WAND.

Referenced by enter_unique_map(), generate_random_map(), mapfile_load(), and START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_builder_remove ( object pl,
int  dir 
)

Item remover.

Removes first buildable item, either under or above the floor

Parameters
plplayer removing an item.
dirdirection the player is trying to remove.

Definition at line 889 of file build_map.c.

References obj::above, BUTTON, CF_HANDLE, DETECTOR, DOOR, draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FLAG_IS_LINKED, FLOOR, freearr_x, freearr_y, GATE, GET_MAP_OB, llevError, LOG(), MAGIC_EAR, obj::map, MAX_BUF, MSG_TYPE_APPLY, MSG_TYPE_APPLY_BUILD, archt::name, NDI_UNIQUE, object_free_drop_inventory(), object_remove(), mapdef::path, PEDESTAL, QUERY_FLAG, query_name(), remove_button_link(), SIGN, TIMED_GATE, obj::type, WALL, obj::x, and obj::y.

Referenced by apply_map_builder().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_by_living ( object pl,
object op,
int  aflag,
int  quiet 
)

Living thing is applying an object.

Parameters
plobject causing op to be applied.
opobject being applied.
aflagspecial (always apply/unapply) flags. Nothing is done with them in this function - they are passed to apply_special().
quietif 1, suppresses the "don't know how to apply" and "you must get it first" messages as needed by apply_by_living_below(). There can still be "but you are floating high above the ground" messages.
Returns
  • 0: player or monster can't apply objects of that type
  • 1: has been applied, or there was an error applying the object
  • 2: objects of that type can't be applied if not in inventory
Note
player_apply() has been renamed to apply_by_living()

Definition at line 557 of file apply.c.

References obj::anim_suffix, apply_anim_suffix(), apply_manual(), draw_ext_info(), draw_ext_info_format(), obj::env, FLAG_WAS_WIZ, FLAG_WIZ, MAX_BUF, METHOD_ERROR, METHOD_OK, METHOD_SILENT_ERROR, METHOD_UNHANDLED, MOVE_FLYING, obj::move_type, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, account_struct::name, NDI_UNIQUE, object_free2(), object_remove(), play_sound_map(), PLAYER, QUERY_FLAG, query_name(), SOUND_TYPE_ITEM, and obj::type.

Referenced by apply_by_living_below(), apply_cmd(), and command_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_by_living_below ( object pl)

Attempt to apply the object 'below' the player.

If the player has an open container, we use that for below, otherwise we use the ground.

Parameters
plplayer.
Note
player_apply_below() has been renamed to apply_by_living_below()

Definition at line 618 of file apply.c.

References apply_by_living(), obj::below, obj::container, obj::contr, FLAG_IS_FLOOR, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, obj::inv, obj::invisible, METHOD_OK, obj::move_on, obj::move_type, ob_apply(), QUERY_FLAG, TRANSPORT, pl::transport, and obj::type.

Referenced by cfapi_object_apply_below(), command_apply(), and knowledge_alchemy_attempt().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_can_apply_object ( const object who,
const object op 
)

Checks to see if 'who' can apply object 'op'.

Parameters
wholiving thing trying to apply op.
opobject applied.
Returns
0 if apply can be done without anything special. Otherwise returns a bitmask of CAN_APPLY_xxx - potentially several of these may be set, but largely depends on circumstance - in the future, processing may be pruned once we know some status (eg, once CAN_APPLY_NEVER is set, do we really are what the other flags may be?) See include/define.h for detailed description of the meaning of these return values.
Note
can_apply_object() has been renamed to apply_can_apply_object()

Definition at line 942 of file apply.c.

References obj::body_info, obj::body_used, BOW, CAN_APPLY_NEVER, CAN_APPLY_RESTRICTION, CAN_APPLY_UNAPPLY, CAN_APPLY_UNAPPLY_CHOICE, CAN_APPLY_UNAPPLY_MULT, FABS, FLAG_USE_ARMOUR, FLAG_USE_BOW, FLAG_USE_RANGE, FLAG_USE_RING, FLAG_USE_SHIELD, FLAG_USE_WEAPON, get_item_from_body_location(), obj::inv, IS_ARMOR, IS_SHIELD, IS_WEAPON, NUM_BODY_LOCATIONS, object_find_by_type_applied(), PLAYER, QUERY_FLAG, RING, ROD, SHIELD, obj::type, WAND, and WEAPON.

Referenced by apply_check_apply_restrictions(), and monster_check_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_changes_to_player ( object pl,
object change,
int  limit_stats 
)

Applies (race) changes to a player.

Parameters
plobject to change.
changewhat kind of changes to apply. Should be of type CLASS.
limit_statsuses the AC_PLAYER_STAT defines from define.h: AC_PLAYER_STAT_LIMIT: Limit stats to racial maximum AC_PLAYER_STAT_NO_CHANGE: Do not make any stat adjustments

Definition at line 1581 of file apply.c.

References AC_PLAYER_STAT_LIMIT, AC_PLAYER_STAT_NO_CHANGE, obj::anim_speed, obj::anim_suffix, animate_object(), obj::animation_id, animations, obj::arch, change_attr_value(), CHARISMA, CLASS, CLEAR_FLAG, archt::clone, obj::contr, obj::face, obj::facing, FLAG_ANIMATE, FLAG_USE_WEAPON, FORCE, GET_ANIM_ID, get_attr_value(), give_initial_items(), MAX_BUF, animations_struct::name, NUM_STATS, object_find_by_name(), object_present_in_ob_by_name(), pl::orig_stats, QUERY_FLAG, obj::randomitems, rndm(), set_attr_value(), SET_FLAG, snprintf, obj::stats, try_find_animation(), and obj::type.

Referenced by apply_race_and_class(), and player_changer_type_process().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_check_weapon_power ( const object who,
int  improves 
)

This checks to see of the player (who) is sufficient level to use a weapon with improves improvements (typically last_eat).

We take an int here instead of the object so that the improvement code can pass along the increased value to see if the object is usable. we return 1 (true) if the player can use the weapon. See ../types/weapon_improver/weapon_improver.c

Parameters
wholiving to check
improvesimprovement level.
Returns
1 if who can use the item, 0 else.

Definition at line 1057 of file apply.c.

References obj::level.

Referenced by apply_special(), and improve_weapon().

Here is the caller graph for this function:

int apply_container ( object op,
object sack 
)

Handle apply on containers.

This is for containers that are applied by a player, whether in inventory or on the ground: eg, sacks, luggage, etc.

Moved to own function and added many features [Tero.Haatanen(at)lut.fi] This version is for client/server mode.

Reminder - there are three states for any container - closed (non applied), applied (not open, but objects that match get tossed into it), and open (applied flag set, and op->container points to the open container)

Parameters
opplayer.
sackcontainer the player is opening or closing.
Returns
1 if an object is applied somehow or another, 0 if error/no apply
Author
Eneq(at)(csd.uu.se)

Definition at line 216 of file apply.c.

References CLEAR_FLAG, CONTAINER, obj::container, socket_struct::container_position, obj::contr, obj::count, draw_ext_info_format(), obj::env, esrv_send_inventory(), esrv_send_item(), esrv_update_item(), EVENT_CLOSE, execute_event(), find_key(), FLAG_APPLIED, INS_NO_MERGE, llevError, LOG(), obj::map, MAX_BUF, MOVE_ALL, obj::move_off, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, MSG_TYPE_APPLY_UNAPPLY, obj::name, NDI_UNIQUE, obj::nrof, object_insert_in_map_at(), object_insert_in_ob(), object_split(), object_was_destroyed, PLAYER, QUERY_FLAG, query_name(), SCRIPT_FIX_ALL, SET_FLAG, set_object_face_main(), set_object_face_other(), obj::slaying, pl::socket, obj::type, UPD_FACE, UPD_FLAGS, obj::x, and obj::y.

Referenced by legacy_apply_container(), and loot_object().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_handle_yield ( object tmp)

This checks whether the object has a "on_use_yield" field, and if so generated and drops matching item.

Parameters
tmpitem that was applied.
Note
handle_apply_yield() has been renamed to apply_handle_yield()

Definition at line 125 of file apply.c.

References create_archetype(), drop(), obj::env, INS_BELOW_ORIGINATOR, obj::map, object_get_value(), object_insert_in_map_at(), object_insert_in_ob(), obj::x, and obj::y.

Referenced by food_type_apply(), poison_type_apply(), and potion_type_apply().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_manual ( object op,
object tmp,
int  aflag 
)

Main apply handler.

Checks for unpaid items before applying.

Parameters
opobject causing tmp to be applied.
tmpobject being applied.
aflagspecial (always apply/unapply) flags. Nothing is done with them in this function - they are passed to apply_special().
Returns
  • 0: player or monster can't apply objects of that type
  • 1: has been applied, or there was an error applying the object
  • 2: objects of that type can't be applied if not in inventory
Note
manual_apply() has been renamed to apply_manual()

Definition at line 510 of file apply.c.

References apply_check_race_restrictions(), obj::contr, draw_ext_info(), EVENT_APPLY, execute_event(), FLAG_APPLIED, FLAG_UNPAID, HEAD, METHOD_OK, METHOD_SILENT_ERROR, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, NDI_UNIQUE, ob_apply(), play_sound_player_only(), PLAYER, QUERY_FLAG, SCRIPT_FIX_ALL, SOUND_TYPE_ITEM, and obj::type.

Referenced by apply_by_living(), cfapi_object_apply(), give_initial_items(), monster_apply_below(), monster_check_apply(), polymorph_living(), transmute_item_to_flower(), and write_scroll().

Here is the call graph for this function:

Here is the caller graph for this function:

void apply_map_builder ( object pl,
int  dir 
)

Global building function.

This is the general map building function. Called when the player 'fires' a builder or remover object.

Parameters
plplayer building or removing.
dirbuilding direction.

Definition at line 959 of file build_map.c.

References apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), obj::arch, can_build_over(), obj::contr, draw_ext_info(), find_archetype(), find_marked_object(), FLAG_IS_BUILDABLE, FOR_OB_AND_ABOVE_FINISH, FOR_OB_AND_ABOVE_PREPARE, freearr_x, freearr_y, GET_MAP_OB, llevError, LOG(), obj::map, MAP_HEIGHT, MAP_WIDTH, MATERIAL, MSG_TYPE_APPLY, MSG_TYPE_APPLY_BUILD, archt::name, NDI_UNIQUE, object_create_arch(), object_decrease_nrof_by_one, mapdef::path, PLAYER, QUERY_FLAG, range_builder, pl::ranges, SET_FLAG, SIGN, obj::slaying, ST_BD_BUILD, ST_BD_REMOVE, ST_MAT_FLOOR, ST_MAT_ITEM, ST_MAT_WALL, ST_MAT_WINDOW, obj::subtype, obj::type, obj::x, and obj::y.

Referenced by fire().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_race_and_class ( object op,
archetype race,
archetype opclass,
living stats 
)

This is somewhat like key_change_class() above, except we know the race to change to, but we still basically need to do the same work (apply bonuses, update archetype, etc.)

Parameters
opPlayer object
racerace to use - caller should do sanity checking that this is a valid race.
opclassclass to use - like race, caller should do sanity checking.
statsIf set, use these stats for the character, do not apply new ones. Note: It is required that the caller only use valid stat values (generated by check_race_and_class() for example), as this function will not do checking on the stats.
Returns
0 on success, non zero on failure (may be extended with unique error codes). It is the responsibility of the caller to notify the client of this failure.

Definition at line 1450 of file player.c.

References AC_PLAYER_STAT_NO_CHANGE, add_statbonus(), add_string(), allowed_class(), apply_changes_to_player(), obj::arch, obj::carrying, CLEAR_FLAG, archt::clone, obj::contr, create_treasure(), esrv_new_player(), esrv_send_inventory(), esrv_update_item(), EVENT_BORN, EVENT_LOGIN, execute_global_event(), find_treasurelist(), fix_object(), FLAG_WIZ, free_string(), get_attr_value(), give_initial_items(), liv::grace, socket_struct::host, liv::hp, obj::inv, link_player_skills(), Settings::localdir, make_path_to_file(), MAX_BUF, liv::maxhp, liv::maxsp, obj::name, obj::name_pl, NUM_STATS, object_copy(), object_free2(), object_remove(), object_set_msg(), object_update(), pl::orig_stats, Settings::playerdir, pticks, obj::randomitems, SET_ANIMATION, set_attr_value(), settings, snprintf, pl::socket, liv::sp, obj::stats, pl::title, UP_OBJ_FACE, UPD_FACE, and obj::weight.

Referenced by create_player_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

int apply_special ( object who,
object op,
int  aflags 
)

Apply an object.

This function doesn't check for unpaid items, but check other restrictions.

Usage example: apply_special (who, op, AP_UNAPPLY | AP_IGNORE_CURSE)

Parameters
whoobject using op. It can be a monster.
opobject being used. Should be an equipment type item, eg, one which you put on and keep on for a while, and not something like a potion or scroll.
aflagscombination of AP_xxx flags.
Returns
1 if the action could not be completed, 0 on success. However, success is a matter of meaning - if the user passes the 'apply' flag to an object already applied, nothing is done, and 0 is returned.

Definition at line 1082 of file apply.c.

References AMULET, AP_APPLY, AP_BASIC_FLAGS, AP_IGNORE_CURSE, AP_NOPRINT, AP_UNAPPLY, apply_check_apply_restrictions(), apply_check_item_power(), apply_check_owner(), apply_check_personalized_blessings(), apply_check_weapon_power(), apply_update_ranged_skill(), ARMOUR, BOOTS, BOW, BRACERS, BUILDER, change_abil(), change_skill(), obj::chosen_skill, CLOAK, obj::contr, draw_ext_info(), draw_ext_info_format(), obj::env, esrv_update_item(), find_skill_by_name(), fix_object(), FLAG_APPLIED, FLAG_BEEN_APPLIED, FLAG_CURSED, FLAG_DAMNED, FLAG_KNOWN_CURSED, FLAG_READY_BOW, FLAG_READY_RANGE, FLAG_READY_SKILL, FLAG_READY_WEAPON, GIRDLE, GLOVES, HELMET, obj::last_eat, llevError, LOG(), MAX_BUF, MSG_TYPE_APPLY, MSG_TYPE_APPLY_CURSED, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, MSG_TYPE_APPLY_UNAPPLY, NDI_UNIQUE, obj::nrof, object_insert_in_ob(), object_split(), PLAYER, QUERY_FLAG, query_name(), obj::race, range_bow, range_builder, range_misc, pl::ranges, RING, ROD, SET_FLAG, SHIELD, pl::shoottype, SKILL, obj::skill, SKILL_TOOL, obj::type, unapply_special(), UPD_FLAGS, UPD_NROF, UPD_WEIGHT, WAND, and WEAPON.

Referenced by adjust_skill_tool(), attack_hth(), change_skill(), drop_object(), find_throw_ob(), improve_armour(), improve_weapon(), legacy_ob_apply(), put_object_in_sack(), and stop_using_item().

Here is the call graph for this function:

Here is the caller graph for this function:

int attack_ob ( object op,
object hitter 
)

Simple wrapper for attack_ob_simple(), will use hitter's values.

Parameters
opvictim.
hitterattacker.
Returns
dealt damage.

Definition at line 903 of file attack.c.

References attack_ob_simple(), liv::dam, HEAD, obj::stats, and liv::wc.

Referenced by do_skill_attack(), CRECombatSimulator::fight(), monsterFight(), and pets_move_golem().

Here is the call graph for this function:

Here is the caller graph for this function:

int become_follower ( object op,
const object new_god 
)

This function is called whenever a player has switched to a new god.

It handles basically all the stat changes that happen to the player, including the removal of godgiven items (from the former cult). Handles race restrictions on god, and will punish player if needed.

Parameters
opplayer switching cults.
new_godnew god to worship.
Returns
1 if successfully converted, 0 if the god doesn't like the race, or something else.
Todo:

isn't there duplication with remove_special_prayers() for spell removing?

split the check to make this function only actually become follower

Definition at line 466 of file gods.c.

References add_string(), ARMOUR, ATNR_COLD, ATNR_ELECTRICITY, ATNR_FIRE, ATNR_POISON, BOOK, BOOTS, cast_magic_storm(), change_abil(), CLEAR_FLAG, archt::clone, obj::contr, create_archetype(), determine_god(), draw_ext_info_format(), find_god(), FLAG_APPLIED, FLAG_BLIND, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STARTEQUIP, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_USE_SHIELD, FLAG_USE_WEAPON, FLAG_XRAYS, follower_remove_given_items(), liv::food, FOR_INV_FINISH, FOR_INV_PREPARE, FORCE, free_string(), get_archetype_by_type_subtype(), give_skill_by_name(), GLOVES, god_gives_present(), liv::grace, HELMET, liv::hp, obj::invisible, treasurestruct::item, treasureliststruct::items, obj::last_eat, obj::last_grace, obj::last_heal, obj::last_sp, obj::level, link_player_skills(), LOOSE_MANA, liv::luck, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_GOD, obj::name, NDI_NAVY, NDI_UNIQUE, treasurestruct::next, NROFATTACKS, object_find_by_type_subtype(), object_free_drop_inventory(), object_present_in_ob_by_name(), object_remove(), obj::path_attuned, obj::path_denied, obj::path_repelled, player_unready_range_ob(), PREFER_LOW, QUERY_FLAG, obj::race, random_roll(), obj::randomitems, obj::resist, SET_FLAG, SHIELD, SK_PRAYING, SKILL, obj::slaying, liv::sp, SPELL, SPELLBOOK, obj::stats, stop_using_item(), obj::title, obj::type, update_priest_flag(), WEAPON, and worship_forbids_use().

Referenced by command_setgod(), and pray_at_altar().

Here is the call graph for this function:

Here is the caller graph for this function:

void blind_living ( object op,
object hitter,
int  dam 
)

Blind a living thing.

Parameters
opvictim.
hitterwho is attacking.
damdamage to deal.

Definition at line 2260 of file attack.c.

References ATNR_BLIND, BLINDNESS, change_abil(), create_archetype(), draw_ext_info_format(), fix_object(), FLAG_APPLIED, FLAG_BLIND, liv::food, MAX_BUF, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_DID_HIT, NDI_UNIQUE, object_get_owner(), object_insert_in_ob(), object_present_in_ob(), query_name(), obj::resist, SET_FLAG, obj::speed, and obj::stats.

Referenced by hit_with_one_attacktype(), and scroll_failure().

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t calc_skill_exp ( const object who,
const object op,
const object skill 
)

Calculates amount of experience can be gained for successful use of a skill.

Here we take the view that a player must 'overcome an opponent' in order to gain experience. Examples include foes killed combat, finding/disarming a trap, stealing from somebeing, etc.

The gained experience is based primarily on the difference in levels, exp point value of vanquished foe, the relevant stats of the skill being used and modifications in the skills[] table.

For now, monsters and players will be treated differently. Below I give the algorithm for *PLAYER *experience gain. Monster exp gain is simpler. Monsters just get 10% of the exp of the opponent.

Players get a ratio, eg, opponent lvl / player level. This is then multiplied by various things. If simple exp is true, then this multiplier, include the level difference, is always 1. This revised method prevents some cases where there are big gaps in the amount you get just because you are now equal level vs lower level

Parameters
whoplayer/creature that used the skill.
opobject that was 'defeated'.
skillused skill. If none, it should just point back to who or be NULL.
Returns
experience for the skill use.

Definition at line 658 of file skill_util.c.

References obj::arch, liv::Cha, archt::clone, mapdef::difficulty, liv::exp, FLAG_ALIVE, obj::level, llevDebug, LOG(), obj::magic, obj::map, MAX, obj::name, PLAYER, QUERY_FLAG, RUNE, settings, Settings::simple_exp, SKILL, obj::stats, TRAP, and obj::type.

Referenced by book_type_apply(), detect_curse_on_item(), detect_magic_on_item(), do_hidden_move(), find_traps(), hide(), identify_object_with_skill(), kill_object(), pick_lock(), remove_trap(), scroll_type_apply(), singing(), spellbook_type_apply(), steal(), use_oratory(), and write_scroll().

Here is the call graph for this function: