summaryrefslogtreecommitdiff
path: root/src/char/char.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-07 17:38:31 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-15 11:47:29 +0300
commit8338483dd4c41bc9831bebc9d6dc1808247fc497 (patch)
tree62af0b36fdd3552eda22e3197f1d3e0e7fb30fc1 /src/char/char.h
parent9658066ce2f411375b9876d0c02737752b816e58 (diff)
downloadhercules-8338483dd4c41bc9831bebc9d6dc1808247fc497.tar.gz
hercules-8338483dd4c41bc9831bebc9d6dc1808247fc497.tar.bz2
hercules-8338483dd4c41bc9831bebc9d6dc1808247fc497.tar.xz
hercules-8338483dd4c41bc9831bebc9d6dc1808247fc497.zip
Add most functions from char.c to interfaces.
Introduced interfaces: chr, mapif, loginif.
Diffstat (limited to 'src/char/char.h')
-rw-r--r--src/char/char.h194
1 files changed, 177 insertions, 17 deletions
diff --git a/src/char/char.h b/src/char/char.h
index 8c3e726c6..b971abbea 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -55,20 +55,6 @@ enum {
TABLE_GUILD_STORAGE,
};
-int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch);
-
-int mapif_sendall(unsigned char *buf,unsigned int len);
-int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len);
-int mapif_send(int fd,unsigned char *buf,unsigned int len);
-void mapif_on_parse_accinfo(int account_id,int u_fd, int aid, int castergroup, int map_fd);
-
-void char_disconnect_player(int account_id);
-
-int char_char_married(int pl1,int pl2);
-int char_char_child(int parent_id, int child_id);
-int char_char_family(int pl1,int pl2,int pl3);
-
-int char_request_accreg2(int account_id, int char_id);
int login_fd;
extern int char_name_option;
extern char char_name_letters[];
@@ -117,8 +103,182 @@ extern int db_use_sql_mob_skill_db;
extern int guild_exp_rate;
extern int log_inter;
-void char_global_accreg_to_login_start (int account_id, int char_id);
-void char_global_accreg_to_login_send (void);
-void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, bool is_string);
+void char_load_defaults();
+void char_defaults();
+
+struct char_auth_node {
+ int account_id;
+ int char_id;
+ uint32 login_id1;
+ uint32 login_id2;
+ uint32 ip;
+ int sex;
+ time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
+ int group_id;
+ unsigned changing_mapservers : 1;
+};
+
+struct char_interface {
+ int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data);
+ int (*delete_char_sql) (int char_id);
+ DBData (*create_online_char_data) (DBKey key, va_list args);
+ void (*set_account_online) (int account_id);
+ void (*set_account_offline) (int account_id);
+ void (*set_char_charselect) (int account_id);
+ void (*set_char_online) (int map_id, int char_id, int account_id);
+ void (*set_char_offline) (int char_id, int account_id);
+ int (*db_setoffline) (DBKey key, DBData *data, va_list ap);
+ int (*db_kickoffline) (DBKey key, DBData *data, va_list ap);
+ void (*set_login_all_offline) (void);
+ void (*set_all_offline) (int id);
+ void (*set_all_offline_sql) (void);
+ DBData (*create_charstatus) (DBKey key, va_list args);
+ int (*mmo_char_tosql) (int char_id, struct mmo_charstatus* p);
+ int (*memitemdata_to_sql) (const struct item items[], int max, int id, int tableswitch);
+ int (*inventory_to_sql) (const struct item items[], int max, int id);
+ int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf);
+ int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, bool load_everything);
+ int (*mmo_char_sql_init) (void);
+ bool (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to);
+ int (*rename_char_sql) (struct char_session_data *sd, int char_id);
+ int (*check_char_name) (char * name, char * esc_name);
+ int (*make_new_char_sql) (struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style);
+ int (*divorce_char_sql) (int partner_id1, int partner_id2);
+ int (*count_users) (void);
+ int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p);
+ void (*mmo_char_send099d) (int fd, struct char_session_data *sd);
+ void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd);
+ void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd);
+ int (*mmo_char_send_characters) (int fd, struct char_session_data* sd);
+ int (*char_married) (int pl1, int pl2);
+ int (*char_child) (int parent_id, int child_id);
+ int (*char_family) (int cid1, int cid2, int cid3);
+ void (*disconnect_player) (int account_id);
+ void (*authfail_fd) (int fd, int type);
+ void (*request_account_data) (int account_id);
+ void (*auth_ok) (int fd, struct char_session_data *sd);
+ void (*ping_login_server) (int fd);
+ int (*parse_fromlogin_connection_state) (int fd);
+ void (*auth_error) (int fd, unsigned char flag);
+ void (*parse_fromlogin_auth_state) (int fd);
+ void (*parse_fromlogin_account_data) (int fd);
+ void (*parse_fromlogin_login_pong) (int fd);
+ void (*changesex) (int account_id, int sex);
+ int (*parse_fromlogin_changesex_reply) (int fd);
+ void (*parse_fromlogin_account_reg2) (int fd);
+ void (*parse_fromlogin_ban) (int fd);
+ void (*parse_fromlogin_kick) (int fd);
+ void (*update_ip) (int fd);
+ void (*parse_fromlogin_update_ip) (int fd);
+ void (*parse_fromlogin_accinfo2_failed) (int fd);
+ void (*parse_fromlogin_accinfo2_ok) (int fd);
+ int (*parse_fromlogin) (int fd);
+ int (*request_accreg2) (int account_id, int char_id);
+ void (*global_accreg_to_login_start) (int account_id, int char_id);
+ void (*global_accreg_to_login_send) (void);
+ void (*global_accreg_to_login_add) (const char *key, unsigned int index, intptr_t val, bool is_string);
+ void (*read_fame_list) (void);
+ int (*send_fame_list) (int fd);
+ void (*update_fame_list) (int type, int index, int fame);
+ int (*loadName) (int char_id, char* name);
+ void (*parse_frommap_datasync) (int fd);
+ void (*parse_frommap_skillid2idx) (int fd);
+ void (*map_received_ok) (int fd);
+ void (*send_maps) (int fd, int id, int j);
+ void (*parse_frommap_map_names) (int fd, int id);
+ void (*send_scdata) (int fd, int aid, int cid);
+ void (*parse_frommap_request_scdata) (int fd);
+ void (*parse_frommap_set_users_count) (int fd, int id);
+ void (*parse_frommap_set_users) (int fd, int id);
+ void (*save_character_ack) (int fd, int aid, int cid);
+ void (*parse_frommap_save_character) (int fd, int id);
+ void (*select_ack) (int fd, int account_id, uint8 flag);
+ void (*parse_frommap_char_select_req) (int fd);
+ void (*change_map_server_ack) (int fd, uint8 *data, bool ok);
+ void (*parse_frommap_change_map_server) (int fd);
+ void (*parse_frommap_remove_friend) (int fd);
+ void (*char_name_ack) (int fd, int char_id);
+ void (*parse_frommap_char_name_request) (int fd);
+ void (*parse_frommap_change_email) (int fd);
+ void (*ban) (int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second);
+ void (*unban) (int char_id, int *result);
+ void (*ask_name_ack) (int fd, int acc, const char* name, int type, int result);
+ void (*parse_frommap_change_account) (int fd);
+ void (*parse_frommap_fame_list) (int fd);
+ void (*parse_frommap_divorce_char) (int fd);
+ void (*parse_frommap_ragsrvinfo) (int fd);
+ void (*parse_frommap_set_char_offline) (int fd);
+ void (*parse_frommap_set_all_offline) (int fd, int id);
+ void (*parse_frommap_set_char_online) (int fd, int id);
+ void (*parse_frommap_build_fame_list) (int fd);
+ void (*parse_frommap_save_status_change_data) (int fd);
+ void (*send_pong) (int fd);
+ void (*parse_frommap_ping) (int fd);
+ void (*map_auth_ok) (int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd);
+ void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip);
+ void (*parse_frommap_auth_request) (int fd, int id);
+ void (*parse_frommap_update_ip) (int fd, int id);
+ void (*parse_frommap_request_stats_report) (int fd);
+ void (*parse_frommap_scdata_update) (int fd);
+ void (*parse_frommap_scdata_delete) (int fd);
+ int (*parse_frommap) (int fd);
+ int (*search_mapserver) (unsigned short map, uint32 ip, uint16 port);
+ int (*mapif_init) (int fd);
+ int (*lan_subnetcheck) (uint32 ip);
+ void (*delete2_ack) (int fd, int char_id, uint32 result, time_t delete_date);
+ void (*delete2_accept_actual_ack) (int fd, int char_id, uint32 result);
+ void (*delete2_accept_ack) (int fd, int char_id, uint32 result);
+ void (*delete2_cancel_ack) (int fd, int char_id, uint32 result);
+ void (*delete2_req) (int fd, struct char_session_data* sd);
+ void (*delete2_accept) (int fd, struct char_session_data* sd);
+ void (*delete2_cancel) (int fd, struct char_session_data* sd);
+ void (*send_account_id) (int fd, int account_id);
+ void (*parse_char_connect) (int fd, struct char_session_data* sd, uint32 ipl);
+ void (*send_map_info) (int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd);
+ void (*send_wait_char_server) (int fd);
+ int (*search_default_maps_mapserver) (struct mmo_charstatus *cd);
+ void (*parse_char_select) (int fd, struct char_session_data* sd, uint32 ipl);
+ void (*creation_failed) (int fd, int result);
+ void (*creation_ok) (int fd, struct mmo_charstatus *char_dat);
+ void (*parse_char_create_new_char) (int fd, struct char_session_data* sd);
+ void (*delete_char_failed) (int fd, int flag);
+ void (*delete_char_ok) (int fd);
+ void (*parse_char_delete_char) (int fd, struct char_session_data* sd, unsigned short cmd);
+ void (*parse_char_ping) (int fd);
+ void (*allow_rename) (int fd, int flag);
+ void (*parse_char_rename_char) (int fd, struct char_session_data* sd);
+ void (*parse_char_rename_char2) (int fd, struct char_session_data* sd);
+ void (*rename_char_ack) (int fd, int flag);
+ void (*parse_char_rename_char_confirm) (int fd, struct char_session_data* sd);
+ void (*captcha_notsupported) (int fd);
+ void (*parse_char_request_captcha) (int fd);
+ void (*parse_char_check_captcha) (int fd);
+ void (*parse_char_delete2_req) (int fd, struct char_session_data* sd);
+ void (*parse_char_delete2_accept) (int fd, struct char_session_data* sd);
+ void (*parse_char_delete2_cancel) (int fd, struct char_session_data* sd);
+ void (*login_map_server_ack) (int fd, uint8 flag);
+ void (*parse_char_login_map_server) (int fd);
+ void (*parse_char_pincode_check) (int fd, struct char_session_data* sd);
+ void (*parse_char_pincode_window) (int fd, struct char_session_data* sd);
+ void (*parse_char_pincode_change) (int fd, struct char_session_data* sd);
+ void (*parse_char_pincode_first_pin) (int fd, struct char_session_data* sd);
+ void (*parse_char_request_chars) (int fd, struct char_session_data* sd);
+ void (*change_character_slot_ack) (int fd, bool ret);
+ void (*parse_char_move_character) (int fd, struct char_session_data* sd);
+ int (*parse_char_unknown_packet) (int fd, uint32 ipl);
+ int (*parse_char) (int fd);
+ int (*broadcast_user_count) (int tid, int64 tick, int id, intptr_t data);
+ int (*send_accounts_tologin_sub) (DBKey key, DBData *data, va_list ap);
+ int (*send_accounts_tologin) (int tid, int64 tick, int id, intptr_t data);
+ int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data);
+ int (*online_data_cleanup_sub) (DBKey key, DBData *data, va_list ap);
+ int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data);
+ int (*lan_config_read) (const char *lancfgName);
+ void (*sql_config_read) (const char* cfgName);
+ void (*config_dispatch) (char *w1, char *w2);
+ int (*config_read) (const char* cfgName);
+};
+
+struct char_interface *chr;
#endif /* COMMON_CHAR_H */