Crossfire Server, Trunk
|
#include "global.h"
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "define.h"
#include "loader.h"
#include "output_file.h"
#include "spells.h"
#include "sproto.h"
#include "server.h"
Go to the source code of this file.
Functions | |
void | check_login (object *op, const char *password) |
int | check_name (player *me, const char *name) |
static void | copy_file (const char *filename, FILE *fpout) |
void | delete_character (const char *name) |
void | destroy_object (object *op) |
void | emergency_save (int flag) |
int | save_player (object *op, int flag) |
int | verify_player (const char *name, char *password) |
static void | wrong_password (object *op) |
Player login/logout/save functions.
Definition in file login.cpp.
void check_login | ( | object * | op, |
const char * | password | ||
) |
Actually login a player, load from disk and such.
op | player. |
password | if not NULL, the uncrypted password the user entered. If NULL, no password check is done, coming from the account code which already does authentication. |
Definition at line 511 of file login.cpp.
References add_string(), buf, check_password(), check_path(), CLEAR_FLAG, confirm_password(), containers, disinfect::count, draw_ext_info(), draw_ext_info_format(), enter_player_maplevel(), esrv_add_spells(), esrv_new_player(), esrv_send_inventory(), esrv_send_pickup(), EVENT_LOGIN, events_execute_global_event(), npc_dialog::filename, final_free_player(), first_map_path, first_player, fix_object(), FLAG_FRIENDLY, FLAG_NO_FIX_PLAYER, FLAG_REMOVED, FLAG_USE_ARMOUR, FLAG_USE_SHIELD, FORCE, has_been_loaded(), i18n_get_language_by_code(), if(), is_dragon_pl(), key_inventory, keyrings, kill_player(), knowledge_send_known(), leave(), legal_range(), link_player_skills(), llevDebug, llevError, llevInfo, LO_NEWFILE, load_object(), Settings::localdir, LOG(), login_check_shutdown(), MAX_BUF, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOGIN, MSG_TYPE_ADMIN_PLAYER, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, NDI_ALL, NDI_DK_ORANGE, NDI_UNIQUE, player::next, Ns_Dead, object_find_by_type_and_arch_name(), object_remove(), object_reset(), object_sum_weight(), object_update_speed(), give::op, party_confirm_password(), party_find(), party_form(), party_join(), party_rejoin_always, party_rejoin_no, party_set_password(), partylist::partyname, altar_valkyrie::pl, PLAYER, player_set_own_title(), player_set_state(), Settings::playerdir, PROFILE_BEGIN, PROFILE_END, pticks, QUERY_FLAG, quest_send_initial_states(), range_none, remove_unpaid_objects(), Settings::reset_loc_time, save_player(), Settings::search_items, set_dragon_name(), SET_FLAG, Settings::set_title, settings, ST_PLAYING, strdup_local, strlcpy(), TRUE, unapply_always, unapply_never, unapply_nochoice, autojail::value, and wrong_password().
Referenced by account_play_cmd(), and receive_player_password().
int check_name | ( | player * | me, |
const char * | name | ||
) |
Ensure player's name is valid.
me | player to report to. |
name | name to check. |
0 | invalid name. |
1 | valid name. |
Definition at line 181 of file login.cpp.
References draw_ext_info(), draw_ext_info_format(), MAX_NAME, curse_on_apply::me, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOGIN, give::name, NDI_UNIQUE, and playername_ok().
Referenced by receive_player_name().
|
static |
Copy a file.
filename | source file. |
fpout | where to copy to. |
Definition at line 455 of file login.cpp.
References buf, npc_dialog::filename, llevError, LOG(), and MAX_BUF.
Referenced by save_player().
void delete_character | ( | const char * | name | ) |
Totally deletes a character. The contents of its directory are effectively totally removed. Used when a player 'quits' the game, or dies on a server with permadeath and no resurrect.
name | player to delete. |
Definition at line 88 of file login.cpp.
References buf, Settings::localdir, MAX_BUF, give::name, Settings::playerdir, remove_directory(), and settings.
Referenced by key_confirm_quit(), and kill_player_permadeath().
void destroy_object | ( | object * | op | ) |
Recursively object_free_drop_inventory() op and its inventory.
op | object to totally object_free_drop_inventory(). |
Definition at line 209 of file login.cpp.
References FLAG_REMOVED, object_free_drop_inventory(), object_remove(), give::op, and QUERY_FLAG.
Referenced by save_player(), and trap_disarm().
void emergency_save | ( | int | flag | ) |
Save all players.
flag | if non zero, it means that we want to try and save everyone, but keep the game running. Thus, we don't want to free any information. |
Definition at line 41 of file login.cpp.
References draw_ext_info(), first_map_path, first_player, hiscore_check(), llevError, llevInfo, LOG(), MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOADSAVE, NDI_UNIQUE, altar_valkyrie::pl, save_player(), trying_emergency_save, and nlohmann::detail::void().
int save_player | ( | object * | op, |
int | flag | ||
) |
Saves a player to disk.
op | player to save. |
flag | if is set, it's only backup, ie dont remove objects from inventory. If BACKUP_SAVE_AT_HOME is set, and the flag is set, then the player will be saved at the emergency save location. |
Definition at line 230 of file login.cpp.
References account_char_add(), account_char_save(), account_get_account_for_char(), account_link(), checksum(), CLEAR_FLAG, copy_file(), destroy_object(), draw_ext_info(), draw_ext_info_format(), Settings::emergency_mapname, esrv_send_inventory(), npc_dialog::filename, FLAG_NO_FIX_PLAYER, FLAG_WIZ, i18n_get_language_code(), key_inventory, keyrings, knowledge_first_player_save(), llevDebug, llevError, Settings::localdir, LOG(), make_path_to_file(), MAX_BUF, MAX_SKILLS, MIN, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOADSAVE, NDI_ALL_DMS, NDI_RED, NDI_UNIQUE, of_close(), of_open(), give::op, party_get_password(), pets_terminate_all(), altar_valkyrie::pl, PLAYER, player_get_own_title(), player_has_own_title(), Settings::playerdir, PROFILE_BEGIN, PROFILE_END, QUERY_FLAG, quest_first_player_save(), range_none, SAVE_ERROR_OK, SAVE_FLAG_NO_REMOVE, SAVE_FLAG_SAVE_UNPAID, SAVE_MODE, save_object(), SET_FLAG, Settings::set_title, settings, ST_GET_PARTY_PASSWORD, ST_PLAYING, tempnam_secure(), Settings::tmpdir, TRUE, unapply_never, and unapply_nochoice.
Referenced by account_play_cmd(), apply_savebed(), check_login(), command_save(), do_server(), drop_object(), emergency_save(), enter_exit(), kill_player_not_permadeath(), kill_player_permadeath(), player_changer_type_process(), process_players1(), and save_and_kick_all_players().
int verify_player | ( | const char * | name, |
char * | password | ||
) |
This verify that a character of name exits, and that it matches password.
name | player name. |
password | player's password, not encrypted. |
0 | there is match. |
1 | no such player. |
2 | incorrect password. |
Definition at line 111 of file login.cpp.
References buf, check_password(), first_player, llevDebug, llevError, Settings::localdir, LOG(), MAX_BUF, give::name, object::name, player::next, player::ob, Settings::playerdir, and settings.
Referenced by account_add_player_cmd(), and create_player_cmd().
|
static |
Simple function to print errors when password is not correct, and reinitialise the name.
op | player. |
Definition at line 476 of file login.cpp.
References draw_ext_info(), FREE_AND_COPY, get_name(), llevInfo, LOG(), MAX_PASSWORD_FAILURES, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_LOGIN, NDI_UNIQUE, Ns_Dead, and give::op.
Referenced by check_login().