Crossfire Server, Trunk
R22047
|
Go to the source code of this file.
Functions | |
void | account_add_player_cmd (char *buf, int len, socket_struct *ns) |
void | account_login_cmd (char *buf, int len, socket_struct *ns) |
void | account_new_cmd (char *buf, int len, socket_struct *ns) |
void | account_password (char *buf, int len, socket_struct *ns) |
void | account_play_cmd (char *buf, int len, socket_struct *ns) |
void | add_me_cmd (char *buf, int len, socket_struct *ns) |
void | apply_cmd (char *buf, int len, player *pl) |
void | ask_smooth_cmd (char *buf, int len, socket_struct *ns) |
void | create_player_cmd (char *buf, int len, socket_struct *ns) |
void | do_server (void) |
void | draw_client_map (object *pl) |
void | draw_ext_info (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message) |
void | draw_ext_info_format (int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) |
void | draw_magic_map (object *pl) |
void | esrv_add_spells (player *pl, object *spell) |
void | esrv_del_item (player *pl, object *ob) |
void | esrv_draw_look (object *pl) |
void | esrv_map_scroll (socket_struct *ns, int dx, int dy) |
void | esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) |
void | esrv_new_player (player *pl, uint32_t weight) |
void | esrv_remove_spell (player *pl, object *spell) |
void | esrv_send_animation (socket_struct *ns, const Animations *anim) |
void | esrv_send_face (socket_struct *ns, const Face *face, int nocache) |
void | esrv_send_inventory (object *pl, object *op) |
void | esrv_send_item (object *pl, object *op) |
void | esrv_send_pickup (player *pl) |
void | esrv_update_item (int flags, object *pl, object *op) |
void | esrv_update_spells (player *pl) |
void | esrv_update_stats (player *pl) |
void | examine_cmd (char *buf, int len, player *pl) |
void | ext_info_map (int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1) |
void | ext_info_map_except (int color, const mapstruct *map, const object *op, uint8_t type, uint8_t subtype, const char *str1) |
void | ext_info_map_except2 (int color, const mapstruct *map, const object *op1, const object *op2, int type, int subtype, const char *str1) |
void | final_free_player (player *pl) |
void | free_all_newserver (void) |
void | free_newsocket (socket_struct *ns) |
int | GetInt_String (const unsigned char *data) |
short | GetShort_String (const unsigned char *data) |
bool | handle_client (socket_struct *ns, player *pl) |
void | init_connection (socket_struct *ns, const char *from_ip) |
void | init_listening_socket (socket_struct *ns) |
void | init_server (void) |
void | inscribe_scroll_cmd (char *buf, int len, player *pl) |
int | is_valid_faceset (int fsn) |
void | lock_item_cmd (uint8_t *data, int len, player *pl) |
void | look_at (object *op, int dx, int dy) |
void | look_at_cmd (char *buf, int len, player *pl) |
void | magic_mapping_mark (object *pl, char *map_mark, int strength) |
void | map_newmap_cmd (socket_struct *ns) |
void | mark_item_cmd (uint8_t *data, int len, player *pl) |
int | metaserver2_init (void) |
void * | metaserver2_thread (void *junk) |
void | metaserver_init (void) |
void | metaserver_update (void) |
void | move_cmd (char *buf, int len, player *pl) |
void | new_player_cmd (uint8_t *buf, int len, player *pl) |
void | play_sound_map (int8_t sound_type, object *emitter, int dir, const char *action) |
void | play_sound_player_only (player *pl, int8_t sound_type, object *emitter, int dir, const char *action) |
void | player_update_bg_music (object *player) |
void | print_ext_msg (socket_struct *ns, int color, uint8_t type, uint8_t subtype, const char *message) |
void | rangetostring (const object *pl, char *obuf, size_t len) |
void | reply_cmd (char *buf, int len, player *pl) |
void | request_info_cmd (char *buf, int len, socket_struct *ns) |
void | send_account_players (socket_struct *ns) |
void | send_background_music (player *pl, const char *music) |
void | send_class_info (socket_struct *ns, char *params) |
void | send_class_list (socket_struct *ns, char *params) |
void | send_exp_table (socket_struct *ns, char *params) |
void | send_face_cmd (char *buff, int len, socket_struct *ns) |
void | send_file (socket_struct *ns, const char *file) |
void | send_image_info (socket_struct *ns) |
void | send_image_sums (socket_struct *ns, char *params) |
void | send_map_info (socket_struct *ns) |
void | send_new_char_info (socket_struct *ns) |
void | send_plugin_custom_message (object *pl, char *buf) |
void | send_query (socket_struct *ns, uint8_t flags, const char *text) |
void | send_race_info (socket_struct *ns, char *params) |
void | send_race_list (socket_struct *ns, char *params) |
void | send_skill_info (socket_struct *ns, char *params) |
void | send_spell_paths (socket_struct *ns, char *params) |
void | send_tick (player *pl) |
void | Send_With_Handling (socket_struct *ns, SockList *sl) |
void | set_face_mode_cmd (char *buf, int len, socket_struct *ns) |
void | set_sound_cmd (char *buf, int len, socket_struct *ns) |
void | set_title (const object *pl, char *buf, size_t len) |
void | set_up_cmd (char *buf, int len, socket_struct *ns) |
void | SockList_AddChar (SockList *sl, unsigned char c) |
void | SockList_AddData (SockList *sl, const void *data, size_t len) |
void | SockList_AddInt (SockList *sl, uint32_t data) |
void | SockList_AddInt64 (SockList *sl, uint64_t data) |
void | SockList_AddLen16Data (SockList *sl, const void *data, size_t len) |
void | SockList_AddLen8Data (SockList *sl, const void *data, size_t len) |
void | SockList_AddPrintf (SockList *sl, const char *format,...) |
void | SockList_AddShort (SockList *sl, uint16_t data) |
void | SockList_AddString (SockList *sl, const char *data) |
void | SockList_AddStringBuffer (SockList *sl, StringBuffer *sb) |
size_t | SockList_Avail (const SockList *sl) |
void | SockList_Init (SockList *sl) |
void | SockList_NullTerminate (SockList *sl) |
int | SockList_ReadPacket (int fd, SockList *sl, int len) |
void | SockList_Reset (SockList *sl) |
void | SockList_ResetRead (SockList *sl) |
void | SockList_Term (SockList *sl) |
void | toggle_extended_infos_cmd (char *buf, int len, socket_struct *ns) |
void | toggle_extended_text_cmd (char *buf, int len, socket_struct *ns) |
void | update_players (void) |
void | version_cmd (char *buf, int len, socket_struct *ns) |
void | watchdog (void) |
void | write_cs_stats (void) |
void account_add_player_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
Handle accountaddplayer from server (add a character to this account). We check to see if character exists, if password is correct, if character is associated with other account.
buf | socket data to process |
len | length of socket data. |
ns | socket of incoming request. |
Definition at line 2318 of file request.c.
References account_char_free(), account_char_load(), account_char_remove(), account_char_save(), socket_struct::account_chars, account_get_account_for_char(), account_is_logged_in(), account_link(), socket_struct::account_name, account_remove_player(), decode_name_password(), socket_struct::host, llevDebug, LOG(), MAX_BUF, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), SockList_Term(), and verify_player().
void account_login_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
Handles the account login
buf | remaining socket data - from this we need to extract name & password |
len | length of this buffer |
ns | pointer to socket structure. |
Definition at line 2077 of file request.c.
References account_exists(), account_get_logged_in_init_socket(), account_get_logged_in_player(), account_login(), socket_struct::account_name, decode_name_password(), socket_struct::host, llevDebug, llevInfo, LOG(), MAX_BUF, Ns_Dead, send_account_players(), Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Init(), SockList_Term(), socket_struct::status, and strdup_local.
void account_new_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
Handles the account creation This function shares a fair amount of the same logic as account_login_cmd() above.
buf | remaining socket data - from this we need to extract name & password |
len | length of this buffer |
ns | pointer to socket structure. |
Definition at line 2204 of file request.c.
References account_block_create(), account_check_string(), account_exists(), socket_struct::account_name, account_new(), accounts_save(), decode_name_password(), socket_struct::host, llevDebug, llevInfo, LOG(), MAX_BUF, Settings::min_name, send_account_players(), Send_With_Handling(), settings, SockList_AddString(), SockList_Init(), SockList_Term(), and strdup_local.
void account_password | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
Handles the account password change.
buf | remaining socket data - from this we need to extract old & new password |
len | length of this buffer |
ns | pointer to socket structure. |
Definition at line 2956 of file request.c.
References account_change_password(), account_check_string(), socket_struct::account_name, decode_name_password(), socket_struct::host, llevDebug, LOG(), MAX_BUF, send_account_players(), Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().
void account_play_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
We have received an accountplay command. try to log in and play the character.
Definition at line 2447 of file request.c.
References account_get_players_for_account(), socket_struct::account_name, add_string(), check_login(), socket_struct::faces_sent, first_player, get_player(), socket_struct::host, socket_struct::inbuf, llevDebug, LOG(), MAX_CHARACTERS_PER_ACCOUNT, pl::next, Ns_Add, Ns_Avail, pl::ob, save_player(), Send_With_Handling(), pl::socket, SockList_AddPrintf(), SockList_AddString(), SockList_Init(), SockList_ResetRead(), SockList_Term(), ST_PLAYING, pl::state, and socket_struct::status.
void add_me_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
The client has requested to be added to the game. This is what takes care of it. We tell the client how things worked out. I am not sure if this file is the best place for this function. However, it either has to be here or init_sockets needs to be exported.
Definition at line 347 of file request.c.
References add_player(), socket_struct::cs_version, find_player_socket(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_VERSION, NDI_RED, Ns_Add, print_ext_msg(), socket_struct::sc_version, Send_With_Handling(), settings, SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::status.
void apply_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Client wants to apply some object. Lets do so.
Definition at line 633 of file item.c.
References apply_by_living(), socket_struct::container_position, esrv_get_ob_from_count(), esrv_send_inventory(), FLAG_REMOVED, llevDebug, LOG(), socket_struct::look_position, pl::ob, QUERY_FLAG, pl::socket, socket_struct::update_inventory, and socket_struct::update_look.
void ask_smooth_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
Tells client the picture it has to use to smooth a picture number given as argument.
Definition at line 425 of file request.c.
References get_face_by_id(), socket_struct::host, llevDebug, LOG(), and send_smooth().
void create_player_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
We have received a createplayer command.
buf | received command. |
len | length of buf. |
ns | socket to communicate with the client. |
too long, buffer overflow
Definition at line 2540 of file request.c.
References account_check_string(), add_player(), ADD_PLAYER_NEW, ADD_PLAYER_NO_MAP, ADD_PLAYER_NO_STATS_ROLL, apply_race_and_class(), arch_to_object(), pl::bed_x, pl::bed_y, check_race_and_class(), decode_name_password(), draw_ext_info_format(), enter_exit(), first_player, FLAG_AUTO_APPLY, FLAG_REMOVED, FREE_AND_COPY, get_archetype_by_type_subtype(), get_attr_value(), socket_struct::host, llevDebug, llevError, llevInfo, LOG(), socket_struct::login_method, MAP_TYPE_CHOICE, MAP_TYPE_DEFAULT, MAX_BUF, MAX_CHOICES, Settings::min_name, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_PLAYER, pl::name_changed, NDI_ALL, NDI_DK_ORANGE, NDI_UNIQUE, newhash(), pl::next, Ns_Add, Ns_Avail, NUM_STATS, pl::ob, ob_apply(), object_get_value(), object_insert_in_ob(), object_remove(), pl::password, player_set_state(), QUERY_FLAG, safe_strncpy, pl::savebed_map, Send_With_Handling(), set_attr_value(), settings, short_stat_name, pl::socket, SockList_AddPrintf(), SockList_AddString(), SockList_Init(), SockList_Term(), ST_PLAYING, Settings::starting_stat_max, Settings::starting_stat_min, Settings::starting_stat_points, socket_struct::status, strcasecmp(), try_find_archetype(), and verify_player().
void do_server | ( | void | ) |
This checks the sockets for input and exceptions, does the right thing.
A bit of this code is grabbed out of socket.c There are 2 lists we need to look through - init_sockets is a list
Definition at line 536 of file loop.c.
References Socket_Info::allocated_sockets, block_until_new_connection(), socket_struct::fd, final_free_player(), first_player, free_newsocket(), get_sleep_remaining(), handle_client(), socket_struct::host, init_listening_socket(), init_sockets, is_fd_valid(), jump_time(), leave(), llevError, llevInfo, LOG(), Socket_Info::max_filedescriptor, new_connection(), pl::next, Ns_Add, Ns_Avail, Ns_Dead, pl::ob, save_player(), send_updates(), pl::socket, socket_info, socket_struct::status, and Socket_Info::timeout.
Referenced by server_main().
void draw_client_map | ( | object * | pl | ) |
Draws client map.
Definition at line 1476 of file request.c.
References draw_client_map2(), get_map_flags(), mapdef::in_memory, llevError, LOG(), MAP_IN_MEMORY, P_NEED_UPDATE, P_NEW_MAP, P_OUT_OF_MAP, mapdef::timeout, update_los(), and update_position().
Referenced by send_updates().
void draw_ext_info | ( | int | flags, |
int | pri, | ||
const object * | pl, | ||
uint8_t | type, | ||
uint8_t | subtype, | ||
const char * | txt | ||
) |
Sends message to player(s).
flags | Various flags - mostly color, plus a few specials. If NDI_ALL or NDI_ALL_DMS is set, pl is ignored and the message is resent to all players or all DMs individually. |
pri | Priority. The lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what. |
pl | Who to send the message to. pl may be NULL, particularly if flags has NDI_ALL or NDI_DMS set since it is ignored in that case. If NDI_ALL and NDI_DMS are not set, when pl is NULL, nobody gets the message. This is sometimes useful when a function that can be invoked by a player is automatically called by some other mechanism. For example, if a player tries to put something in a container, they should get a message that tells them they cannot put it in an unsuitable container, but when auto-pickup is at work, all containers are tried, even unsuitable ones, and so messages should not be sent to the player. |
type | The type MSG_TYPE for the type of message. |
subtype | The subtype of the message. |
message | The message to send. |
Those are dummy functions defined to resolve all symboles. Added as part of glue cleaning. Ryo 2005-07-15
Dummy functions to link the library.
Definition at line 308 of file main.c.
References first_player, FLAG_WIZ, llevInfo, LOG(), logfile, NDI_ALL, NDI_ALL_DMS, NDI_COLOR_MASK, pl::next, pl::ob, print_ext_msg(), and QUERY_FLAG.
Referenced by adj_stealchance(), adjust_sign_msg(), alchemy_failure_effect(), animate_weapon(), apply_builder_floor(), apply_builder_item(), apply_builder_remove(), apply_builder_wall(), apply_builder_window(), apply_by_living(), apply_check_apply_restrictions(), apply_check_item_power(), apply_check_owner(), apply_manual(), apply_map_builder(), apply_sign(), apply_special(), armour_improver_type_apply(), attack_hth(), attack_melee_weapon(), attack_message(), attack_ob_simple(), attempt_do_alchemy(), attempt_jump(), attempt_recipe(), attempt_steal(), basic_emote(), blocked_link(), book_type_apply(), can_pay(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_change_map_lightlevel(), cast_cone(), cast_consecrate(), cast_create_food(), cast_create_obj(), cast_create_town_portal(), cast_curse(), cast_heal(), cast_identify(), cast_invisible(), cast_item_curse_or_curse(), cast_light(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), cast_transfer(), cast_word_of_recall(), cf_handle_type_apply(), cfapi_player_message(), change_abil(), change_spell(), charge_mana_effect(), check_login(), check_name(), check_pick(), command_abil(), command_addexp(), command_afk(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_brace(), command_create(), command_delete(), command_diff(), command_drop(), command_dropall(), command_dump(), command_empty(), command_face(), command_fire(), command_follow(), command_forget_spell(), command_free(), command_freeze(), command_goto(), command_gsay(), command_help(), command_insert_into(), command_inventory(), command_invisible(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_mon_aggr(), command_nowiz(), command_overlay_reset(), command_overlay_save(), command_party(), command_passwd(), command_patch(), command_peaceful(), command_pickup(), command_possess(), command_purge_quest(), command_purge_quest_definitions(), command_quest(), command_quit(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_run(), command_save(), command_search_items(), command_setgod(), command_settings(), command_showpets(), command_shutdown(), command_sound(), command_stack_clear(), command_stack_list(), command_statistics(), command_stats(), command_strings(), command_style_map_info(), command_summon(), command_take(), command_teleport(), command_tell_all(), command_title(), command_toggle_shout(), command_unloadplugin(), command_use(), command_uskill(), command_whereabouts(), command_wizcast(), command_wizpass(), confuse_living(), create_aura(), create_bomb(), cure_disease(), current_map_info(), cursed_food_effects(), dimension_door(), dispel_rune(), display_motd(), display_new_pickup(), display_who_entry(), dm_stack_peek(), dm_stack_pop(), dm_stack_push(), do_dump(), do_hidden_move(), do_shutdown(), do_skill(), do_skill_attack(), do_skill_by_number(), do_tell(), do_throw(), do_turn(), do_wizard_dm(), do_wizard_hide(), dragon_ability_gain(), dragon_eat_flesh(), drain_specific_stat(), draw_ext_info_format(), drop(), drop_object(), eat_common(), emergency_save(), enter_map(), examine(), examine_monster(), exit_type_apply(), exit_type_move_on(), ext_info_map(), ext_info_map_except(), ext_info_map_except2(), find_or_create_connection_for_map(), find_traps(), fire(), fire_arch_from_position(), fire_bow(), fire_misc_object(), food_type_apply(), get_other_player_from_name(), god_enchants_weapon(), god_intervention(), god_removes_curse(), handle_newcs_player(), help_topics(), hide(), hiscore_check(), hiscore_display(), hole_type_move_on(), identify_altar_type_move_on(), improve_armour(), improve_weapon(), improve_weapon_magic(), improve_weapon_stat(), infect_object(), inscribe_scroll_cmd(), inventory(), jump(), key_change_class(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player(), kill_player_not_permadeath(), kill_player_permadeath(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_attempt(), knowledge_do_display(), knowledge_item_can_be_used_alchemy(), knowledge_show(), knowledge_show_monster_detail(), knowledge_write_player_data(), lighter_type_apply(), list_players(), lock_item_cmd(), look_at(), magic_wall(), map_info(), mark_item_cmd(), meditate(), mimic_type_apply(), monster_can_see_enemy(), monster_communicate(), move_marker(), move_player_attack(), move_symptom(), paralyze_living(), party_help(), party_send_message(), perceive_self(), pets_follow_owner(), pets_move(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), pick_lock(), pick_up(), pick_up_object(), player_attack_door(), player_lvl_adj(), plugins_display_list(), poison_living(), poison_type_apply(), poisoning_type_process(), potion_type_apply(), power_crystal_type_apply(), pray(), pray_at_altar(), prayer_failure(), prepare_weapon(), print_los(), probe(), put_object_in_sack(), quest_help(), quest_info(), quest_set_state(), quest_write_player_data(), receive_party_password(), receive_play_again(), receive_player_name(), receive_player_password(), recharge(), remove_curse(), remove_depletion(), remove_force(), restore_player(), save_player(), scroll_failure(), scroll_type_apply(), send_rules(), set_pickup_mode(), shop_describe(), shop_inventory_type_apply(), shop_mat_type_move_on(), show_commands(), show_matching_spells(), show_skills(), skill_attack(), skill_ident(), slow_living(), spell_failure(), spellbook_type_apply(), spring_trap(), tailor_god_spell(), town_portal_destroy_existing(), town_portal_find_force(), trap_disarm(), trapdoor_type_move_on(), treasure_type_apply(), trigger_type_apply(), unapply_for_ob(), unhide(), use_alchemy(), use_oratory(), weapon_improver_type_apply(), write_mark(), write_note(), write_on_item(), write_rune(), write_scroll(), and wrong_password().
void draw_ext_info_format | ( | int | flags, |
int | pri, | ||
const object * | pl, | ||
uint8_t | type, | ||
uint8_t | subtype, | ||
const char * | format, | ||
... | |||
) |
Sends message to player(s).
This function is the same as draw_ext_info, but takes varargs format. Otherwise, the meaning of all the fields is the same. This is perhaps not the most efficient as we do vsnprintf on both the old and newbuf, but it simplifies the code greatly since we can just call draw_ext_info.
flags | Various flags - mostly color, plus a few specials. |
pri | Priority. It is a little odd - the lower the value, the more important it is. Thus, 0 gets sent no matter what. Otherwise, the value must be less than the listening level that the player has set. Unfortunately, there is no clear guideline on what each level does what. |
pl | Can be passed as NULL - in fact, this will be done if NDI_ALL is set in the flags. |
type | The type MSG_TYPE for the type of message. |
subtype | The type MSG_TYPE for the subtype of message. |
format | The message to send, with optional format specifiers. |
Definition at line 313 of file main.c.
References buf, draw_ext_info(), HUGE_BUF, logfile, and vsnprintf.
Referenced by action_makes_visible(), alchemy_failure_effect(), altar_type_move_on(), animate_weapon(), apply_builder_item(), apply_builder_remove(), apply_by_living(), apply_check_apply_restrictions(), apply_check_personalized_blessings(), apply_check_race_restrictions(), apply_container(), apply_savebed(), apply_special(), apply_update_ranged_skill(), attack_hth(), attack_message(), attack_ob_simple(), attempt_do_alchemy(), attempt_jump(), attempt_recipe(), attempt_steal(), basic_emote(), become_follower(), blind_living(), book_type_apply(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_consecrate(), cast_create_missile(), cast_curse(), cast_dust(), cast_identify(), cast_item_curse_or_curse(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), change_abil(), change_spell(), check_login(), check_name(), check_pick(), check_sacrifice(), check_shutdown(), check_spell_expiry(), choose_cult_monster(), clock_type_apply(), command_abil(), command_addexp(), command_apply(), command_applymode(), command_arrest(), command_banish(), command_body(), command_bowmode(), command_cast_spell(), command_cointoss(), command_create(), command_debug(), command_drop(), command_examine(), command_face(), command_follow(), command_forget_spell(), command_freeze(), command_help(), command_insert_into(), command_kick2(), command_kill_pets(), command_language(), command_learn_spell_or_prayer(), command_listen(), command_loadplugin(), command_loadtest(), command_lock_item(), command_mark(), command_party(), command_party_rejoin(), command_patch(), command_petmode(), command_pickup(), command_players(), command_quest(), command_remove(), command_rename_item(), command_reply(), command_reset(), command_resistances(), command_rskill(), command_search_items(), command_setgod(), command_settings(), command_showpets(), command_shutdown(), command_speed(), command_stack_list(), command_statistics(), command_stats(), command_strings(), command_style_map_info(), command_summon(), command_take(), command_teleport(), command_tell_all(), command_toggle_shout(), command_unarmed_skill(), command_unloadplugin(), command_use(), command_usekeys(), command_version(), command_whereabouts(), command_wimpy(), converter_type_move_on(), create_player_cmd(), cure_disease(), current_map_info(), current_region_info(), deep_swamp_type_move_on(), deep_swamp_type_process(), display_new_pickup(), dm_stack_pop(), dm_stack_push(), do_forget_spell(), do_harvest(), do_learn_spell(), do_skill_attack(), do_tell(), do_throw(), do_turn(), do_wizard_hide(), dragon_ability_gain(), dragon_eat_flesh(), dragon_level_gain(), drop_object(), empty_container(), enter_exit(), enter_fixed_template_map(), enter_player_maplevel(), enter_unique_map(), examine(), execute_newserver_command(), exit_type_apply(), find_best_player_hth_skill(), find_key(), find_throw_ob(), fire_bow(), fire_misc_object(), follower_remove_given_items(), food_type_apply(), gate_type_process(), get_dm_object(), get_spell_by_name(), god_enchants_weapon(), god_examines_item(), god_examines_priest(), god_gives_present(), god_intervention(), hiscore_check(), hiscore_display(), hit_with_one_attacktype(), i18n_list_languages(), identify_altar_type_move_on(), identify_object_with_skill(), improve_weapon(), improve_weapon_stat(), inventory(), key_change_class(), key_confirm_quit(), key_roll_stat(), kill_object(), kill_player_not_permadeath(), knowledge_alchemy_attempt(), knowledge_display(), knowledge_do_display(), knowledge_give(), lamp_type_apply(), leave(), lighter_type_apply(), list_players(), lock_item_cmd(), login_check_shutdown(), look_at(), magic_wall(), make_matcher(), malloc_info(), map_info(), mark_item_cmd(), monster_can_detect_enemy(), monster_communicate(), new_player_cmd(), party_form(), party_join(), party_leave(), peacemaker_type_process(), perceive_self(), pets_move_golem(), pets_summon_golem(), pets_summon_object(), pick_up(), player_attack_door(), plugins_display_list(), poison_living(), polymorph_melt(), potion_type_apply(), pray_at_altar(), prayer_failure(), prepare_weapon(), print_tod(), process_object(), process_players1(), push_ob(), put_object_in_sack(), quest_display(), quest_info(), quest_list(), quest_set_state(), quest_start(), recharge(), recursive_roll(), remove_force(), remove_special_prayers(), resurrect_player(), sack_can_hold(), save_life(), save_player(), save_throw_object(), scroll_type_apply(), sell_item(), send_news(), shop_describe(), shop_inventory_type_apply(), shop_pay_unpaid(), show_matching_spells(), show_skills(), singing(), skill_ident(), skillscroll_type_apply(), spell_consume_items(), spellbook_type_apply(), swap_map(), swap_random_stats(), swap_stat(), time_info(), transmute_item_to_flower(), transport_type_apply(), trap_disarm(), trap_see(), treasure_type_apply(), unapply_for_ob(), unapply_special(), unhide(), use_alchemy(), use_oratory(), use_skill(), worship_forbids_use(), write_note(), write_on_item(), write_rune(), and write_scroll().
void draw_magic_map | ( | object * | pl | ) |
Creates and sends magic map to player.
@ param pl The player to send the magic map to
The following function is a lot messier than it really should be, but there is no real easy solution.
Mark Wedel
Definition at line 440 of file info.c.
References FACE_FLOOR, llevError, LOG(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark(), MAX, MIN, Send_With_Handling(), SockList_AddChar(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().
Referenced by cast_spell().
void esrv_add_spells | ( | player * | pl, |
object * | spell | ||
) |
This tells the client to add the spell *spell, if spell is NULL, then add all spells in the player's inventory.
Definition at line 1778 of file request.c.
References append_spell(), FOR_INV_FINISH, FOR_INV_PREPARE, llevError, LOG(), socket_struct::monitor_spells, pl::ob, object_get_value(), Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().
Referenced by check_login(), and do_learn_spell().
void esrv_del_item | ( | player * | pl, |
object * | ob | ||
) |
Tells the client to delete an item. Uses the item command with a -1 location.
Definition at line 353 of file main.c.
References pl::ob, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::update_inventory.
Referenced by object_remove(), and transmute_item_to_flower().
void esrv_draw_look | ( | object * | pl | ) |
Send the look window. Don't need to do animations here This sends all the faces to the client, not just updates. This is because object ordering would otherwise be inconsistent
Definition at line 187 of file item.c.
References add_object_to_socklist(), buf, empty_face, esrv_send_face(), FLAG_IS_FLOOR, FLAG_REMOVED, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, GET_MAP_OB, llevDebug, LOG(), MAP_IN_MEMORY, MAX, MAX_BUF, MAXITEMLEN, MIN, NS_FACESENT_FACE, Face::number, out_of_map(), QUERY_FLAG, Send_With_Handling(), snprintf, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().
Referenced by send_updates(), and set_up_cmd().
void esrv_map_scroll | ( | socket_struct * | ns, |
int | dx, | ||
int | dy | ||
) |
Definition at line 1537 of file request.c.
References Map::cells, socket_struct::lastmap, socket_struct::map_scroll_x, socket_struct::map_scroll_y, socket_struct::mapx, socket_struct::mapy, and MAX_HEAD_OFFSET.
Referenced by attempt_jump(), move_ob(), push_ob(), shop_mat_type_move_on(), transport_type_apply(), and turn_one_transport().
void esrv_move_object | ( | object * | pl, |
tag_t | to, | ||
tag_t | tag, | ||
long | nrof | ||
) |
Move an object to a new location
Definition at line 852 of file item.c.
References drop_object(), esrv_get_ob_from_count(), esrv_update_item(), FLAG_APPLIED, FOR_INV_FINISH, FOR_INV_PREPARE, llevDebug, LOG(), object_can_pick(), pick_up(), put_object_in_sack(), QUERY_FLAG, sack_can_hold(), transport_can_hold(), and UPD_WEIGHT.
Referenced by move_cmd().
Tells the client that here is a player it should start using.
Definition at line 868 of file request.c.
References esrv_send_face(), socket_struct::faces_sent, FLAG_CLIENT_SENT, pl::last_weight, NS_FACESENT_FACE, pl::ob, Send_With_Handling(), SET_FLAG, pl::socket, SockList_AddInt(), SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by apply_race_and_class(), check_login(), command_possess(), key_change_class(), and roll_again().
void esrv_remove_spell | ( | player * | pl, |
object * | spell | ||
) |
Definition at line 1641 of file request.c.
References llevError, LOG(), socket_struct::monitor_spells, pl::ob, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by do_forget_spell().
void esrv_send_animation | ( | socket_struct * | ns, |
const Animations * | anim | ||
) |
Need to send an animation sequence to the client. We will send appropriate face commands to the client if we haven't sent them the face yet (this can become quite costly in terms of how much we are sending - on the other hand, this should only happen when the player logs in and picks stuff up.
ns | where to send the animation. |
anim | animation to send. |
Definition at line 898 of file request.c.
References socket_struct::anims_sent, esrv_send_face(), animations_struct::faces, socket_struct::faces_sent, llevError, LOG(), NS_FACESENT_FACE, animations_struct::num, animations_struct::num_animations, Face::number, Send_With_Handling(), SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by add_object_to_socklist(), and map2_add_ob().
void esrv_send_face | ( | socket_struct * | ns, |
const Face * | face, | ||
int | nocache | ||
) |
Sends a face to a client if they are in pixmap mode, nothing gets sent in bitmap mode. If nocache is true (nonzero), ignore the cache setting from the client - this is needed for the askface, in which we really do want to send the face (and askface is the only place that should be setting it). Otherwise, we look at the facecache, and if set, send the image name.
ns | socket to send the date to. |
face | face to send. |
nocache | if 1 then send a 'image2', else depending on client cache setting. |
Definition at line 71 of file image.c.
References face_info::checksum, face_info::data, face_info::datalen, socket_struct::facecache, face_sets::faces, socket_struct::faces_sent, socket_struct::faceset, find_faceset(), get_face_fallback(), face_sets::id, llevError, LOG(), Face::name, NS_FACESENT_FACE, Face::number, Send_With_Handling(), SockList_AddChar(), SockList_AddData(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by add_object_to_socklist(), append_spell(), esrv_draw_look(), esrv_new_player(), esrv_send_animation(), esrv_update_item(), knowledge_process_incremental(), knowledge_send_info(), map2_add_ob(), quest_send_initial_states(), quest_set_state(), send_account_players(), send_face_cmd(), send_skill_info(), and send_smooth().
void esrv_send_inventory | ( | object * | pl, |
object * | op | ||
) |
Sends inventory of a container. If pl == op, then the whole contents are sent, else the contents is sent with "next group" and "prev group" arrows if required.
pl | who to send to. |
op | what item's contents to send. |
Definition at line 307 of file item.c.
References add_object_to_socklist(), buf, empty_face, FOR_INV_FINISH, FOR_INV_PREPARE, MAX, MAX_BUF, MAXITEMLEN, MIN, Face::number, Send_With_Handling(), snprintf, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().
Referenced by apply_cmd(), apply_container(), apply_race_and_class(), check_login(), command_possess(), key_change_class(), player_changer_type_process(), save_player(), send_updates(), and use_alchemy().
void esrv_send_item | ( | object * | pl, |
object * | op | ||
) |
Sends item's info to player.
Definition at line 337 of file main.c.
References add_object_to_socklist(), FLAG_CLIENT_SENT, Send_With_Handling(), SET_FLAG, SockList_AddInt(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by apply_container(), cast_detection(), dragon_ability_gain(), object_insert_in_ob(), and transmute_item_to_flower().
void esrv_send_pickup | ( | player * | pl | ) |
Sends the "pickup" state to pl if client wants it requested.
pl | player that just logged in. |
Definition at line 1664 of file request.c.
References pl::mode, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::want_pickup.
Referenced by check_login(), display_new_pickup(), and kill_player_not_permadeath().
void esrv_update_item | ( | int | flags, |
object * | pl, | ||
object * | op | ||
) |
Updates object *op for player *pl.
flags is a list of values to update to the client (as defined in newclient.h - might as well use the same value both places.
Definition at line 340 of file main.c.
References esrv_send_face(), FABS, FLAG_ANIMATE, FLAG_CLIENT_SENT, FLAG_NO_PICK, MAX_BUF, NS_FACESENT_FACE, query_base_name(), QUERY_FLAG, query_flags(), Send_With_Handling(), snprintf, SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), strlcpy(), UPD_ANIM, UPD_ANIMSPEED, UPD_FACE, UPD_FLAGS, UPD_LOCATION, UPD_NAME, UPD_NROF, UPD_WEIGHT, and WEIGHT.
Referenced by animate_weapon(), apply_container(), apply_race_and_class(), apply_special(), book_type_apply(), cancellation(), cast_identify(), cast_item_curse_or_curse(), cfapi_object_set_property(), command_drop(), command_dropall(), command_insert_into(), command_lock_item(), command_rename_item(), command_take(), detect_curse_on_item(), detect_magic_on_item(), drain_wand_charge(), drop_object(), empty_container(), esrv_move_object(), god_enchants_weapon(), god_removes_curse(), hit_with_one_attacktype(), identify(), improve_armour(), improve_weapon(), improve_weapon_magic(), insert_objects(), key_change_class(), lock_item_cmd(), object_decrease_nrof(), object_increase_nrof(), object_update(), pick_up_object(), player_changer_type_process(), power_crystal_type_apply(), prepare_weapon(), put_object_in_sack(), remove_curse(), sell_item(), send_changed_object(), send_updates(), shop_pay_unpaid(), spellbook_type_apply(), unapply_special(), and weapon_improver_type_apply().
void esrv_update_spells | ( | player * | pl | ) |
This looks for any spells the player may have that have changed their stats. It then sends an updspell packet for each spell that has changed in this way.
Definition at line 356 of file main.c.
References flags, FOR_INV_FINISH, FOR_INV_PREPARE, get_client_spell_state(), client_spell::last_dam, client_spell::last_grace, client_spell::last_sp, socket_struct::monitor_spells, pl::ob, Send_With_Handling(), pl::socket, SockList_AddChar(), SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), SP_level_dam_adjust(), SP_level_spellpoint_cost(), SPELL_GRACE, SPELL_MANA, pl::spell_state, UPD_SP_DAMAGE, UPD_SP_GRACE, and UPD_SP_MANA.
Referenced by fix_player().
void esrv_update_stats | ( | player * | pl | ) |
Sends a statistics update. We look at the old values, and only send what has changed. Stat mapping values are in newclient.h Since this gets sent a lot, this is actually one of the few binary commands for now.
Definition at line 728 of file request.c.
References liv::ac, AddIfFloat, AddIfInt, AddIfInt64, AddIfShort, AddIfString, pl::applied_stats, atnr_cs_stat, ATNR_PHYSICAL, buf, liv::Cha, liv::Con, CS_STAT_AC, CS_STAT_APPLIED_CHA, CS_STAT_APPLIED_CON, CS_STAT_APPLIED_DEX, CS_STAT_APPLIED_INT, CS_STAT_APPLIED_POW, CS_STAT_APPLIED_STR, CS_STAT_APPLIED_WIS, CS_STAT_ARMOUR, CS_STAT_BASE_CHA, CS_STAT_BASE_CON, CS_STAT_BASE_DEX, CS_STAT_BASE_INT, CS_STAT_BASE_POW, CS_STAT_BASE_STR, CS_STAT_BASE_WIS, CS_STAT_CHA, CS_STAT_CON, CS_STAT_DAM, CS_STAT_DEX, CS_STAT_EXP64, CS_STAT_FLAGS, CS_STAT_FOOD, CS_STAT_GOLEM_HP, CS_STAT_GOLEM_MAXHP, CS_STAT_GRACE, CS_STAT_HP, CS_STAT_INT, CS_STAT_LEVEL, CS_STAT_MAXGRACE, CS_STAT_MAXHP, CS_STAT_MAXSP, CS_STAT_POW, CS_STAT_RACE_CHA, CS_STAT_RACE_CON, CS_STAT_RACE_DEX, CS_STAT_RACE_INT, CS_STAT_RACE_POW, CS_STAT_RACE_STR, CS_STAT_RACE_WIS, CS_STAT_RANGE, CS_STAT_SKILLINFO, CS_STAT_SP, CS_STAT_SPEED, CS_STAT_SPELL_ATTUNE, CS_STAT_SPELL_DENY, CS_STAT_SPELL_REPEL, CS_STAT_STR, CS_STAT_TITLE, CS_STAT_WC, CS_STAT_WEAP_SP, CS_STAT_WEIGHT_LIM, CS_STAT_WIS, liv::dam, liv::Dex, liv::exp, socket_struct::extended_stats, pl::fire_on, FLAG_FREED, FLAG_REMOVED, flags, liv::food, get_skill_client_code(), get_weight_limit(), pl::golem_count, liv::grace, liv::hp, liv::Int, pl::last_applied_stats, pl::last_flags, pl::last_golem_hp, pl::last_golem_maxhp, pl::last_level, pl::last_orig_stats, pl::last_path_attuned, pl::last_path_denied, pl::last_path_repelled, pl::last_race_stats, pl::last_resist, pl::last_skill_exp, pl::last_skill_ob, pl::last_speed, pl::last_stats, pl::last_weapon_sp, pl::last_weight_limit, SockList::len, llevDebug, LOG(), MAX_BUF, MAX_SKILLS, liv::maxgrace, liv::maxhp, liv::maxsp, socket_struct::monitor_spells, NROFATTACKS, pl::ob, pl::orig_stats, liv::Pow, QUERY_FLAG, statsinfo::range, range_golem, pl::ranges, rangetostring(), pl::run_on, socket_struct::sc_version, Send_With_Handling(), set_title(), SF_FIREON, SF_RUNON, pl::socket, SockList_AddChar(), SockList_AddInt64(), SockList_AddString(), SockList_Init(), SockList_Term(), liv::sp, socket_struct::stats, liv::Str, statsinfo::title, liv::wc, and liv::Wis.
Referenced by send_updates().
void examine_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
void ext_info_map | ( | int | color, |
const mapstruct * | map, | ||
uint8_t | type, | ||
uint8_t | subtype, | ||
const char * | str1 | ||
) |
Writes to everyone on the specified map
color | The color of the message |
map | The map where the players receiving the message are located |
type | The message type |
subtype | The message subtype |
str1 | The message to be sent |
Definition at line 323 of file main.c.
References draw_ext_info(), first_player, logfile, pl::next, and pl::ob.
Referenced by cfapi_map_message(), change_map_light(), command_me(), monster_do_say(), monster_do_talk_npc(), operate_altar(), and trigger_connected().
void ext_info_map_except | ( | int | color, |
const mapstruct * | map, | ||
const object * | op, | ||
uint8_t | type, | ||
uint8_t | subtype, | ||
const char * | str1 | ||
) |
Writes to everyone on the map except *op. This is useful for emotions.
color | The color of the message |
map | The map where the players receiving the message are located |
op | The player object to skip sending the message to on the map |
type | The message type |
subtype | The message subtype |
str1 | The message to be sent |
Definition at line 185 of file info.c.
References draw_ext_info(), first_player, pl::next, and pl::ob.
Referenced by basic_emote(), command_cointoss(), and monster_communicate().
void ext_info_map_except2 | ( | int | color, |
const mapstruct * | map, | ||
const object * | op1, | ||
const object * | op2, | ||
int | type, | ||
int | subtype, | ||
const char * | str1 | ||
) |
Writes to everyone on the map except op1 and op2
color | The message color |
map | The map where the players receiving the message are located |
op1 | The first player object to skip sending the message to |
op2 | The second player object to skip sending the message to |
type | The message type |
subtype | The message subtype |
str1 | The message to be sent |
Definition at line 211 of file info.c.
References draw_ext_info(), first_player, pl::next, and pl::ob.
Referenced by basic_emote().
void final_free_player | ( | player * | pl | ) |
Sends the 'goodbye' command to the player, and closes connection.
Definition at line 441 of file init.c.
References free_newsocket(), free_player(), Send_With_Handling(), pl::socket, SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by check_login(), and do_server().
void free_all_newserver | ( | void | ) |
Free's all the memory that ericserver allocates.
Definition at line 393 of file init.c.
References Socket_Info::allocated_sockets, socket_struct::listen, llevDebug, and LOG().
Referenced by cleanup().
void free_newsocket | ( | socket_struct * | ns | ) |
Frees a socket. Basically, all we need to do here is free all data structures that might be associated with the socket. It is up to the caller to update the list
Definition at line 410 of file init.c.
References account_char_free(), account_char_save(), socket_struct::account_chars, socket_struct::account_name, socket_struct::fd, FREE_AND_CLEAR, socket_struct::host, socket_struct::inbuf, llevDebug, LOG(), statsinfo::range, SockList_Term(), socket_struct::stats, and statsinfo::title.
Referenced by do_server(), and final_free_player().
int GetInt_String | ( | const unsigned char * | data | ) |
Basically does the reverse of SockList_AddInt, but on strings instead. Same for the GetShort, but for 16 bits.
Definition at line 246 of file lowlevel.c.
Referenced by inscribe_scroll_cmd(), lock_item_cmd(), mark_item_cmd(), and new_player_cmd().
short GetShort_String | ( | const unsigned char * | data | ) |
Definition at line 250 of file lowlevel.c.
Referenced by new_player_cmd().
bool handle_client | ( | socket_struct * | ns, |
player * | pl | ||
) |
Handle commands from a client. This function should only be called when the socket is readable. If an error occurs, the socket status will be set to Ns_Dead; it is up to the caller to clean it up.
ns | Socket sending the command |
pl | Player associated with this socket, or NULL |
Definition at line 242 of file loop.c.
References SockList::buf, socket_struct::faces_sent, socket_struct::fd, handle_cmd(), socket_struct::inbuf, socket_struct::last_tick, SockList::len, Ns_Dead, pl::ob, SockList_NullTerminate(), SockList_ReadPacket(), SockList_ResetRead(), ST_PLAYING, pl::state, socket_struct::status, strtok_r, todtick, and watchdog().
Referenced by do_server().
void init_connection | ( | socket_struct * | ns, |
const char * | from_ip | ||
) |
Initializes a connection. Really, it just sets up the data structure, socket setup is handled elsewhere. We do send a version to the client.
Definition at line 83 of file init.c.
References socket_struct::account_chars, socket_struct::account_name, Socket_Info::allocated_sockets, socket_struct::anims_sent, SockList::buf, socket_struct::container_position, cst_lst, cst_tot, socket_struct::darkness, DEFAULT_NUM_LOOK_OBJECTS, socket_struct::extended_stats, socket_struct::facecache, socket_struct::faces_sent, socket_struct::faces_sent_len, socket_struct::faceset, socket_struct::fd, get_faces_count(), socket_struct::heartbeat, socket_struct::host, socket_struct::inbuf, socket_struct::is_bot, socket_struct::lastmap, llevError, LOG(), socket_struct::login_method, socket_struct::look_position, socket_struct::map_scroll_x, socket_struct::map_scroll_y, socket_struct::mapx, socket_struct::mapy, CS_Stats::max_conn, socket_struct::monitor_spells, socket_struct::notifications, Ns_Add, NS_FACESENT_FACE, socket_struct::num_look_objects, socket_struct::password_fails, Send_With_Handling(), set_output_sock_buf(), SOCKETBUFSIZE, SockList_AddPrintf(), SockList_Init(), SockList_ResetRead(), SockList_Term(), socket_struct::sound, socket_struct::sounds_this_tick, socket_struct::stats, socket_struct::status, strdup_local, socket_struct::tick, socket_struct::update_inventory, socket_struct::update_look, VERSION_CS, VERSION_INFO, VERSION_SC, and socket_struct::want_pickup.
Referenced by new_connection().
void init_listening_socket | ( | socket_struct * | ns | ) |
This opens *ns for listening to connections. The structure must be allocated already and ns->listen must be initialized. No other variable is changed.
Definition at line 171 of file init.c.
References listen_info::addr, listen_info::addrlen, listen_info::family, fatal(), socket_struct::fd, socket_struct::listen, llevError, LOG(), MAX_BUF, Ns_Add, Ns_Dead, listen_info::protocol, SEE_LAST_ERROR, snprintf, listen_info::socktype, and socket_struct::status.
Referenced by do_server(), and init_server().
void init_server | ( | void | ) |
This sets up the socket and reads all the image information into memory.
Definition at line 262 of file init.c.
References socket_struct::account_name, listen_info::addr, listen_info::addrlen, Socket_Info::allocated_sockets, buf, Settings::csport, cst_lst, cst_tot, socket_struct::faces_sent, listen_info::family, fatal(), init_listening_socket(), socket_struct::listen, llevDebug, llevError, LOG(), MAX_BUF, Socket_Info::max_filedescriptor, listen_info::protocol, SEE_LAST_ERROR, settings, snprintf, listen_info::socktype, CS_Stats::time_start, and Socket_Info::timeout.
Referenced by init().
void inscribe_scroll_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Definition at line 917 of file item.c.
References draw_ext_info(), esrv_get_ob_from_count(), find_skill_by_name(), GetInt_String(), llevDebug, LOG(), pl::mark, pl::mark_count, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, pl::ob, range_magic, pl::ranges, and write_on_item().
int is_valid_faceset | ( | int | fsn | ) |
Checks specified faceset is valid
fsn | faceset number |
Definition at line 116 of file image.c.
References find_faceset().
Referenced by main(), and set_up_cmd().
Client wants to apply some object. Lets do so.
Definition at line 673 of file item.c.
References CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), esrv_update_item(), FLAG_INV_LOCKED, GetInt_String(), HUGE_BUF, llevDebug, LOG(), MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_FAILURE, NDI_UNIQUE, pl::ob, object_merge(), query_short_name(), SET_FLAG, and UPD_FLAGS.
void look_at | ( | object * | op, |
int | dx, | ||
int | dy | ||
) |
Prints items on the specified square.
[ removed EARTHWALL check and added check for containers inventory. Tero. ] Haat anen@ lut. fi
Definition at line 763 of file item.c.
References draw_ext_info(), draw_ext_info_format(), FLAG_IS_FLOOR, FLAG_WIZ, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, get_map_from_coord(), GET_MAP_OB, inventory(), MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, out_of_map(), QUERY_FLAG, and query_name().
Referenced by look_at_cmd().
void look_at_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
Client wants to look at some object. Lets do so.
Definition at line 828 of file item.c.
References pl::blocked_los, FABS, llevDebug, LOG(), look_at(), MAP_CLIENT_X, MAP_CLIENT_Y, socket_struct::mapx, socket_struct::mapy, pl::ob, and pl::socket.
void magic_mapping_mark | ( | object * | pl, |
char * | map_mark, | ||
int | strength | ||
) |
Creates magic map for player.
pl | The player making the magic map |
map_mark | Holds flags for each tile analyzed. Should have been initialized to zero before this function is called. |
strength | An initial strength*2 rectangular area that we automatically see in/penetrate through. |
Note: For improved magic mapping display, the space that blocks the view is now marked with value 2. Any dependencies of map_mark being nonzero have been changed to check for 1. Also, since map_mark is a char value, putting 2 in should cause no problems.
This function examines the map the player is on, and determines what is visible. 2 is set for walls or objects that blocks view. 1 is for open spaces.
Definition at line 393 of file info.c.
References blank_face, FACE_FLOOR, FACE_WALL, GET_MAP_FACE_OBJ, get_map_flags(), MAGIC_MAP_HALF, MAGIC_MAP_SIZE, magic_mapping_mark_recursive(), Face::magicmap, MAP_LAYERS, P_BLOCKSVIEW, and P_OUT_OF_MAP.
Referenced by draw_magic_map().
void map_newmap_cmd | ( | socket_struct * | ns | ) |
Sound related function.
Newmap command
Definition at line 618 of file request.c.
References socket_struct::lastmap, socket_struct::map_scroll_x, socket_struct::map_scroll_y, Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by cfapi_object_teleport(), dimension_door(), enter_map(), process_players1(), set_up_cmd(), teleport(), and transfer_ob().
Client wants to mark some object. Lets do so.
data | object tag (4 chars). |
len | data size. |
pl | player. |
Definition at line 732 of file item.c.
References draw_ext_info(), draw_ext_info_format(), esrv_get_ob_from_count(), GetInt_String(), llevDebug, LOG(), pl::mark, pl::mark_count, MAX_BUF, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, MSG_TYPE_COMMAND_SUCCESS, NDI_UNIQUE, pl::ob, and query_name().
int metaserver2_init | ( | void | ) |
This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away. Note that it may be possible/desirable for the server to re-read the values and restart connections (for example, a new metaserver has been added and you want to start updates to it immediately and not restart the server). Because of that, there is some extra logic (has_init) to try to take that into account.
Definition at line 163 of file metaserver.c.
References _LocalMeta2Info::archbase, buf, _LocalMeta2Info::codebase, Settings::confdir, Settings::csport, FALSE, _LocalMeta2Info::flags, FREE_AND_CLEAR, free_metaserver2(), _MetaServer2::hostname, _LocalMeta2Info::hostname, _LocalMeta2Info::html_comment, llevError, LOG(), _LocalMeta2Info::mapbase, MAX_BUF, metaserver2, metaserver2_thread(), ms2_info_mutex, _MetaServer2::next, _LocalMeta2Info::notification, _LocalMeta2Info::portnumber, settings, snprintf, strcasecmp(), strdup_local, _LocalMeta2Info::text_comment, and TRUE.
Referenced by init().
void* metaserver2_thread | ( | void * | junk | ) |
metserver2_thread is the function called from pthread_create. it is a trivial function - it just sleeps and calls the update function. The sleep time here is really quite arbitrary, but once a minute is probably often enough. A better approach might be to do a time() call and see how long the update takes, and sleep according to that.
junk | unused. |
Definition at line 507 of file metaserver.c.
References metaserver2_updates(), and sleep.
Referenced by metaserver2_init().
void metaserver_init | ( | void | ) |
void metaserver_update | ( | void | ) |
Updates our info in the metaserver Note that this is used for both metaserver1 and metaserver2 - for metaserver2, it just copies dynamic data into private data structure, doing locking in the process.
Definition at line 52 of file metaserver.c.
References cst_tot, first_player, FLAG_AFK, FLAG_WIZ, pl::hidden, CS_Stats::ibytes, _MetaServer2_UpdateInfo::in_bytes, socket_struct::is_bot, metaserver2_updateinfo, ms2_info_mutex, pl::next, _MetaServer2_UpdateInfo::num_players, pl::ob, CS_Stats::obytes, _MetaServer2_UpdateInfo::out_bytes, QUERY_FLAG, pl::socket, ST_GET_PARTY_PASSWORD, ST_PLAYING, pl::state, CS_Stats::time_start, and _MetaServer2_UpdateInfo::uptime.
Referenced by block_until_new_connection(), and do_specials().
void move_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
This handles the commands issued by the player (ie, north, fire, cast, etc.). This is called with the 'ncom' method which gives more information back to the client so it can throttle.
buf | data received. |
len | length of buf. |
pl | player who issued the command. Mustn't be NULL. |
Definition at line 449 of file request.c.
References pl::count, draw_ext_info_format(), execute_newserver_command(), FABS, GetInt_String(), GetShort_String(), llevDebug, llevError, LOG(), MAX_BUF, MAX_TIME, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, NDI_UNIQUE, pl::ob, Send_With_Handling(), pl::socket, SockList_AddInt(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), ST_PLAYING, and pl::state.
void play_sound_map | ( | int8_t | sound_type, |
object * | emitter, | ||
int | dir, | ||
const char * | action | ||
) |
Plays a sound on a map.
sound_type | sound type, see the sound types. |
emitter | object emitting the sound. Must be on a map. |
dir | direction the sound is moving. |
action | sound name to play. |
Definition at line 107 of file sounds.c.
References first_player, isqrt(), MAX_SOUND_DISTANCE, pl::next, pl::ob, play_sound_player_only(), and POW2.
Referenced by apply_by_living(), attack_message(), attack_ob_simple(), button_type_move_on(), cast_spell(), cf_handle_type_apply(), fire_bow(), food_type_apply(), gate_type_process(), hole_type_move_on(), kill_object(), move_ob(), move_player_attack(), player_attack_door(), polymorph_melt(), potion_type_apply(), recharge(), save_life(), trapdoor_type_move_on(), and trigger_type_apply().
void play_sound_player_only | ( | player * | pl, |
int8_t | sound_type, | ||
object * | emitter, | ||
int | dir, | ||
const char * | action | ||
) |
Plays a sound for specified player only.
pl | player to play sound to. |
sound_type | sound type, see the sound types. |
emitter | object emitting a sound. |
dir | direction the sound is moving into. |
action | sound name to play. |
Definition at line 51 of file sounds.c.
References FABS, MAX_SOUNDS_TICK, MIN, pl::ob, Send_With_Handling(), SND_EFFECTS, SND_MUTE, pl::socket, SockList_AddChar(), SockList_AddLen8Data(), SockList_AddString(), SockList_Init(), SockList_Term(), socket_struct::sound, and socket_struct::sounds_this_tick.
Referenced by apply_manual(), cast_spell(), clock_type_apply(), do_learn_spell(), fire_misc_object(), kill_player(), play_sound_map(), poison_type_apply(), and spellbook_type_apply().
void player_update_bg_music | ( | object * | player | ) |
Referenced by cfapi_object_teleport(), dimension_door(), player_map_change_common(), process_players1(), teleport(), and transfer_ob().
void print_ext_msg | ( | socket_struct * | ns, |
int | color, | ||
uint8_t | type, | ||
uint8_t | subtype, | ||
const char * | message | ||
) |
Draws an extended message on the client.
ns | The socket to send message to |
color | Color informations (used mainly if client does not support message type) |
type | The type of text message |
subtype | The subtype of text message |
message | The main message |
make this non-static, so other files can use this to send messages to client before player has been added.
Definition at line 49 of file info.c.
References Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().
Referenced by add_me_cmd(), and draw_ext_info().
void rangetostring | ( | const object * | pl, |
char * | obuf, | ||
size_t | len | ||
) |
Get player's current range attack in obuf.
pl | The player who is being evaluated |
obuf | The buffer for the range attack string |
len | The length of the buffer |
Definition at line 230 of file info.c.
References Settings::casting_time, FLAG_APPLIED, MAX_BUF, query_base_name(), QUERY_FLAG, range_bow, range_builder, range_golem, range_magic, range_misc, range_none, range_skill, settings, snprintf, and TRUE.
Referenced by esrv_update_stats().
void reply_cmd | ( | char * | buf, |
int | len, | ||
player * | pl | ||
) |
This is a reply to a previous query.
Definition at line 511 of file request.c.
References key_change_class(), key_confirm_quit(), key_roll_stat(), llevDebug, llevError, LOG(), pl::ob, receive_party_password(), receive_play_again(), receive_player_name(), receive_player_password(), snprintf, ST_CHANGE_CLASS, ST_CHANGE_PASSWORD_CONFIRM, ST_CHANGE_PASSWORD_NEW, ST_CHANGE_PASSWORD_OLD, ST_CONFIRM_PASSWORD, ST_CONFIRM_QUIT, ST_GET_NAME, ST_GET_PARTY_PASSWORD, ST_GET_PASSWORD, ST_PLAY_AGAIN, ST_PLAYING, ST_ROLL_STAT, pl::state, and pl::write_buf.
void request_info_cmd | ( | char * | buf, |
int | len, | ||
socket_struct * | ns | ||
) |
request_info_cmd is sort of a meta command. There is some specific request of information, but we call other functions to provide that information.
buf | buffer containing the information requested. |
len | length of buf, ignored. |
ns | socket to write data to. |
Definition at line 132 of file loop.c.
References socket_struct::host, knowledge_send_info(), llevDebug, LOG(), send_class_info(), send_class_list(), send_exp_table(), send_file(), send_image_info(), send_image_sums(), send_map_info(), send_new_char_info(), send_race_info(), send_race_list(), send_skill_info(), send_spell_paths(), Send_With_Handling(), SockList_AddString(), SockList_Init(), and SockList_Term().
void send_account_players | ( | socket_struct * | ns | ) |
Upon successful login/account creation, we send a list of characters associated with the account to the client - in this way, it lets the client present a nice list so that the player can choose one. Note it is important that ns->account_name is set before calling this. Note 2: Some of the operations here are not especially efficient - O(n^2) or repeating same loop instead of trying to combine them. This is not a worry as MAX_CHARACTERS_PER_ACCOUNT is a fairly low value (less than 20), so even inefficient operations don't take much time. If that value as a lot larger, then some rethink may be needed. For now, having clearer code is better than trying to save a few microseconds of execution time.
ns | socket structure to send data for. |
Definition at line 1901 of file request.c.
References account_char_load(), socket_struct::account_chars, account_get_players_for_account(), socket_struct::account_name, ACL_CLASS, ACL_FACE, ACL_FACE_NUM, ACL_LEVEL, ACL_MAP, ACL_NAME, ACL_PARTY, ACL_RACE, add_char_field(), account_char_struct::character_class, esrv_send_face(), account_char_struct::face, socket_struct::faces_sent, account_char_struct::isDead, account_char_struct::level, account_char_struct::map, MAX_CHARACTERS_PER_ACCOUNT, account_char_struct::name, account_char_struct::next, NS_FACESENT_FACE, Face::number, account_char_struct::party, account_char_struct::race, Send_With_Handling(), SockList_AddChar(), SockList_AddShort(), SockList_AddString(), SockList_Init(), SockList_Term(), and try_find_face().
Referenced by account_add_player_cmd(), account_login_cmd(), account_new_cmd(), account_password(), key_confirm_quit(), and receive_play_again().
void send_background_music | ( | player * | pl, |
const char * | music | ||
) |
Sends background music to client.
pl | player |
music | background music name. Can be NULL. |
Definition at line 135 of file sounds.c.
References Send_With_Handling(), SND_MUSIC, SND_MUTE, pl::socket, SockList_AddString(), SockList_Init(), SockList_Term(), and socket_struct::sound.
Referenced by player_update_bg_music().
void send_class_info | ( | socket_struct * | ns, |
char * | params | ||
) |
Send information on the specified class.
ns | where to send. |
params | class name to send. |
Definition at line 390 of file requestinfo.c.
References send_arch_info(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_class_list | ( | socket_struct * | ns, |
char * | params | ||
) |
Sends the list of classes to the client. The reply is kept in a static buffer, as it won't change during server run.
ns | client to send to. |
params | ignored. |
Definition at line 369 of file requestinfo.c.
References build_class_list_reply(), Send_With_Handling(), and SockList_Init().
Referenced by request_info_cmd().
void send_exp_table | ( | socket_struct * | ns, |
char * | params | ||
) |
This sends the experience table the sever is using
Definition at line 122 of file requestinfo.c.
References levels, llevError, LOG(), Settings::max_level, Send_With_Handling(), settings, SockList_AddInt64(), SockList_AddShort(), SockList_AddString(), SockList_Avail(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_face_cmd | ( | char * | buff, |
int | len, | ||
socket_struct * | ns | ||
) |
Client has requested pixmap that it somehow missed getting. This will be called often if the client is caching images.
buff | data received from the client. |
len | length of buff, ignored. |
ns | socket to send data to. |
Definition at line 44 of file image.c.
References esrv_send_face(), get_face_by_id(), socket_struct::host, llevDebug, and LOG().
void send_file | ( | socket_struct * | ns, |
const char * | file | ||
) |
Sends the desired file to the client. In all three cases, we are basically just dumping file contents to the client - nothing more.
ns | socket to send to |
file | Which file to send - string of either motd, news, rules |
Definition at line 456 of file requestinfo.c.
References buf, Settings::confdir, llevError, LOG(), MAX_BUF, Settings::motd, Settings::news, Settings::rules, Send_With_Handling(), settings, snprintf, SockList_AddChar(), SockList_AddString(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_image_info | ( | socket_struct * | ns | ) |
Sends the number of images, checksum of the face file, and the image_info file information. See the doc/Developers/protocol if you want further detail.
ns | socket to send data to. |
Definition at line 121 of file image.c.
References do_faceset(), facesets_for_each(), get_bitmap_checksum(), get_faces_count(), Send_With_Handling(), SockList_AddPrintf(), SockList_Init(), and SockList_Term().
Referenced by request_info_cmd().
void send_image_sums | ( | socket_struct * | ns, |
char * | params | ||
) |
Sends requested face information.
ns | socket to send to |
params | contains first and last index of face |
For each image in [start..stop] sends
Definition at line 143 of file image.c.
References face_info::checksum, face_sets::faces, socket_struct::faces_sent, socket_struct::faceset, find_faceset(), get_face_by_id(), get_face_fallback(), get_faces_count(), face_sets::id, llevError, LOG(), Face::name, NS_FACESENT_FACE, Face::number, Send_With_Handling(), SockList_AddChar(), SockList_AddInt(), SockList_AddLen8Data(), SockList_AddPrintf(), SockList_AddShort(), SockList_Avail(), SockList_Init(), SockList_Reset(), and SockList_Term().
Referenced by request_info_cmd().