diff options
52 files changed, 19492 insertions, 3648 deletions
diff --git a/Hercules.xcodeproj/project.pbxproj b/Hercules.xcodeproj/project.pbxproj index 947603b65..6efdbfced 100644 --- a/Hercules.xcodeproj/project.pbxproj +++ b/Hercules.xcodeproj/project.pbxproj @@ -12,6 +12,9 @@ A5380CD91856CF4A0090CBC4 /* core.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC694185643BB009EB79C /* core.c */; }; A5380CDA1856D0650090CBC4 /* socket.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC6BA185643BB009EB79C /* socket.c */; }; A5380CDB1856D0690090CBC4 /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC6A3185643BB009EB79C /* malloc.c */; }; + A5467AD31A16FCB4008AFAA6 /* loginif.c in Sources */ = {isa = PBXBuildFile; fileRef = A5467AD11A16FCB4008AFAA6 /* loginif.c */; }; + A5467AD61A16FCDC008AFAA6 /* mapif.c in Sources */ = {isa = PBXBuildFile; fileRef = A5467AD41A16FCDC008AFAA6 /* mapif.c */; }; + A5467AD91A16FD08008AFAA6 /* geoip.c in Sources */ = {isa = PBXBuildFile; fileRef = A5467AD71A16FD08008AFAA6 /* geoip.c */; }; A567612D185D11D700997C0D /* nullpo.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC6B2185643BB009EB79C /* nullpo.c */; }; A56CC68918564387009EB79C /* account_sql.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68118564387009EB79C /* account_sql.c */; }; A56CC68A18564387009EB79C /* ipban_sql.c in Sources */ = {isa = PBXBuildFile; fileRef = A56CC68318564387009EB79C /* ipban_sql.c */; }; @@ -210,6 +213,12 @@ /* Begin PBXFileReference section */ A5380CCD1856CE180090CBC4 /* mapcache */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mapcache; sourceTree = BUILT_PRODUCTS_DIR; }; A5380CD61856CE3C0090CBC4 /* mapcache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mapcache.c; path = src/tool/mapcache.c; sourceTree = "<group>"; }; + A5467AD11A16FCB4008AFAA6 /* loginif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loginif.c; path = src/char/loginif.c; sourceTree = SOURCE_ROOT; }; + A5467AD21A16FCB4008AFAA6 /* loginif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = loginif.h; path = src/char/loginif.h; sourceTree = SOURCE_ROOT; }; + A5467AD41A16FCDC008AFAA6 /* mapif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mapif.c; path = src/char/mapif.c; sourceTree = SOURCE_ROOT; }; + A5467AD51A16FCDC008AFAA6 /* mapif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mapif.h; path = src/char/mapif.h; sourceTree = SOURCE_ROOT; }; + A5467AD71A16FD08008AFAA6 /* geoip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = geoip.c; path = src/char/geoip.c; sourceTree = SOURCE_ROOT; }; + A5467AD81A16FD08008AFAA6 /* geoip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = geoip.h; path = src/char/geoip.h; sourceTree = SOURCE_ROOT; }; A56CC66A18564315009EB79C /* login-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "login-server"; sourceTree = BUILT_PRODUCTS_DIR; }; A56CC6731856434D009EB79C /* char-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "char-server"; sourceTree = BUILT_PRODUCTS_DIR; }; A56CC67C18564356009EB79C /* map-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "map-server"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -549,6 +558,12 @@ A56CC6741856434D009EB79C /* char-server */ = { isa = PBXGroup; children = ( + A5467AD71A16FD08008AFAA6 /* geoip.c */, + A5467AD81A16FD08008AFAA6 /* geoip.h */, + A5467AD41A16FCDC008AFAA6 /* mapif.c */, + A5467AD51A16FCDC008AFAA6 /* mapif.h */, + A5467AD11A16FCB4008AFAA6 /* loginif.c */, + A5467AD21A16FCB4008AFAA6 /* loginif.h */, A5B894AB1A03CDFA005AD22E /* HPMchar.c */, A5B894AC1A03CDFA005AD22E /* HPMchar.h */, A56CC743185657D9009EB79C /* char.c */, @@ -1195,6 +1210,7 @@ A56CC75D185657D9009EB79C /* char.c in Sources */, A56CC6D9185643BB009EB79C /* ers.c in Sources */, A56CC6CA185643BB009EB79C /* conf.c in Sources */, + A5467AD91A16FD08008AFAA6 /* geoip.c in Sources */, A56CC718185643BB009EB79C /* utils.c in Sources */, A56CC715185643BB009EB79C /* timer.c in Sources */, A56CC6CD185643BB009EB79C /* console.c in Sources */, @@ -1202,6 +1218,7 @@ A56CC6EB185643BB009EB79C /* md5calc.c in Sources */, A56CC760185657D9009EB79C /* int_guild.c in Sources */, A56CC768185657D9009EB79C /* inter.c in Sources */, + A5467AD61A16FCDC008AFAA6 /* mapif.c in Sources */, A56CC73818564C05009EB79C /* scanner.c in Sources */, A56CC700185643BB009EB79C /* random.c in Sources */, A5B894AD1A03CDFA005AD22E /* HPMchar.c in Sources */, @@ -1224,6 +1241,7 @@ A56CC73518564C05009EB79C /* scanctx.c in Sources */, A56CC712185643BB009EB79C /* thread.c in Sources */, A56CC6D0185643BB009EB79C /* core.c in Sources */, + A5467AD31A16FCB4008AFAA6 /* loginif.c in Sources */, A56CC767185657D9009EB79C /* int_storage.c in Sources */, A56CC763185657D9009EB79C /* int_mercenary.c in Sources */, A56CC6D3185643BB009EB79C /* db.c in Sources */, diff --git a/src/char/Makefile.in b/src/char/Makefile.in index d591a5370..20d19966e 100644 --- a/src/char/Makefile.in +++ b/src/char/Makefile.in @@ -22,11 +22,11 @@ MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o MT19937AR_H = $(MT19937AR_D)/mt19937ar.h MT19937AR_INCLUDE = -I$(MT19937AR_D) -CHAR_C = char.c HPMchar.c inter.c int_auction.c int_elemental.c int_guild.c \ +CHAR_C = char.c HPMchar.c loginif.c mapif.c geoip.c inter.c int_auction.c int_elemental.c int_guild.c \ int_homun.c int_mail.c int_mercenary.c int_party.c int_pet.c \ int_quest.c int_storage.c pincode.c CHAR_OBJ = $(addprefix obj_sql/, $(patsubst %.c,%.o,$(CHAR_C))) -CHAR_H = char.h HPMchar.h inter.h int_auction.h int_elemental.h int_guild.h \ +CHAR_H = char.h HPMchar.h loginif.h mapif.h geoip.h inter.h int_auction.h int_elemental.h int_guild.h \ int_homun.h int_mail.h int_mercenary.h int_party.h int_pet.h \ int_quest.h int_storage.h pincode.h diff --git a/src/char/char.c b/src/char/char.c index 60ef11397..0dd7aaa79 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -16,13 +16,20 @@ #include <time.h> #include "HPMchar.h" +#include "geoip.h" +#include "int_auction.h" #include "int_elemental.h" #include "int_guild.h" #include "int_homun.h" +#include "int_mail.h" #include "int_mercenary.h" #include "int_party.h" +#include "int_pet.h" +#include "int_quest.h" #include "int_storage.h" #include "inter.h" +#include "loginif.h" +#include "mapif.h" #include "pincode.h" #include "../common/HPM.h" #include "../common/cbasetypes.h" @@ -80,11 +87,11 @@ char acc_reg_str_db[32] = "acc_reg_str_db"; char char_reg_str_db[32] = "char_reg_str_db"; char char_reg_num_db[32] = "char_reg_num_db"; +struct char_interface char_s; + // show loading/saving messages int save_log = 1; -static DBMap* char_db_; // int char_id -> struct mmo_charstatus* - char db_path[1024] = "db"; int db_use_sql_item_db; @@ -100,7 +107,6 @@ struct mmo_map_server { unsigned short maps; } server[MAX_MAP_SERVERS]; -int char_fd=-1; char userid[24]; char passwd[24]; char server_name[20]; @@ -130,7 +136,7 @@ int char_del_delay = 86400; int log_char = 1; // logging char or not [devil] int log_inter = 1; // logging inter or not [devil] -int char_aegis_delete = 0; // Verify if char is in guild/party or char and reacts as Aegis does (doesn't allow deletion), see char_delete2_req for more information +int char_aegis_delete = 0; // Verify if char is in guild/party or char and reacts as Aegis does (doesn't allow deletion), see chr->delete2_req for more information // Advanced subnet check [LuzZza] struct s_subnet { @@ -172,31 +178,16 @@ unsigned short skillid2idx[MAX_SKILL_ID]; //----------------------------------------------------- #define AUTH_TIMEOUT 30000 -struct 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; -}; - -static DBMap* auth_db; // int account_id -> struct auth_node* +static DBMap* auth_db; // int account_id -> struct char_auth_node* //----------------------------------------------------- // Online User Database //----------------------------------------------------- -static int chardb_waiting_disconnect(int tid, int64 tick, int id, intptr_t data); -int delete_char_sql(int char_id); - /** * @see DBCreateData */ -static DBData create_online_char_data(DBKey key, va_list args) +static DBData char_create_online_char_data(DBKey key, va_list args) { struct online_char_data* character; CREATE(character, struct online_char_data, 1); @@ -209,11 +200,27 @@ static DBData create_online_char_data(DBKey key, va_list args) return DB->ptr2data(character); } -void set_char_charselect(int account_id) +void char_set_account_online(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272b; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_account_offline(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272c; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void char_set_char_charselect(int account_id) { struct online_char_data* character; - character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data); + character = (struct online_char_data*)idb_ensure(chr->online_char_db, account_id, chr->create_online_char_data); if( character->server > -1 ) if( server[character->server].users > 0 ) // Prevent this value from going negative. @@ -225,36 +232,30 @@ void set_char_charselect(int account_id) character->pincode_enable = *pincode->charselect + *pincode->enabled; if(character->waiting_disconnect != INVALID_TIMER) { - timer->delete(character->waiting_disconnect, chardb_waiting_disconnect); + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } - if (login_fd > 0 && !session[login_fd]->flag.eof) - { - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x272b; - WFIFOL(login_fd,2) = account_id; - WFIFOSET(login_fd,6); - } - + if (chr->login_fd > 0 && !session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); } -void set_char_online(int map_id, int char_id, int account_id) +void char_set_char_online(int map_id, int char_id, int account_id) { struct online_char_data* character; struct mmo_charstatus *cp; //Update DB - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); //Check to see for online conflicts - character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data); + character = (struct online_char_data*)idb_ensure(chr->online_char_db, account_id, chr->create_online_char_data); if( character->char_id != -1 && character->server > -1 && character->server != map_id ) { - ShowNotice("set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n", + ShowNotice("chr->set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n", character->account_id, character->char_id, character->server, map_id, account_id, char_id); - mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); + mapif->disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); } //Update state data @@ -266,52 +267,47 @@ void set_char_online(int map_id, int char_id, int account_id) //Get rid of disconnect timer if(character->waiting_disconnect != INVALID_TIMER) { - timer->delete(character->waiting_disconnect, chardb_waiting_disconnect); + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } //Set char online in guild cache. If char is in memory, use the guild id on it, otherwise seek it. - cp = (struct mmo_charstatus*)idb_get(char_db_,char_id); - inter_guild_CharOnline(char_id, cp?cp->guild_id:-1); + cp = (struct mmo_charstatus*)idb_get(chr->char_db_,char_id); + inter_guild->CharOnline(char_id, cp?cp->guild_id:-1); //Notify login server - if (login_fd > 0 && !session[login_fd]->flag.eof) - { - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x272b; - WFIFOL(login_fd,2) = account_id; - WFIFOSET(login_fd,6); - } + if (chr->login_fd > 0 && !session[chr->login_fd]->flag.eof) + chr->set_account_online(account_id); } -void set_char_offline(int char_id, int account_id) +void char_set_char_offline(int char_id, int account_id) { struct online_char_data* character; if ( char_id == -1 ) { - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) + Sql_ShowDebug(inter->sql_handle); } else { - struct mmo_charstatus* cp = (struct mmo_charstatus*)idb_get(char_db_,char_id); - inter_guild_CharOffline(char_id, cp?cp->guild_id:-1); + struct mmo_charstatus* cp = (struct mmo_charstatus*)idb_get(chr->char_db_,char_id); + inter_guild->CharOffline(char_id, cp?cp->guild_id:-1); if (cp) - idb_remove(char_db_,char_id); + idb_remove(chr->char_db_,char_id); - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); } - if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL) + if ((character = (struct online_char_data*)idb_get(chr->online_char_db, account_id)) != NULL) { //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex] if( character->server > -1 ) if( server[character->server].users > 0 ) // Prevent this value from going negative. server[character->server].users--; if(character->waiting_disconnect != INVALID_TIMER){ - timer->delete(character->waiting_disconnect, chardb_waiting_disconnect); + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } @@ -326,13 +322,8 @@ void set_char_offline(int char_id, int account_id) } //Remove char if 1- Set all offline, or 2- character is no longer connected to char-server. - if (login_fd > 0 && !session[login_fd]->flag.eof && (char_id == -1 || character == NULL || character->fd == -1)) - { - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x272c; - WFIFOL(login_fd,2) = account_id; - WFIFOSET(login_fd,6); - } + if (chr->login_fd > 0 && !session[chr->login_fd]->flag.eof && (char_id == -1 || character == NULL || character->fd == -1)) + chr->set_account_offline(account_id); } /** @@ -346,7 +337,7 @@ static int char_db_setoffline(DBKey key, DBData *data, va_list ap) character->char_id = -1; character->server = -1; if(character->waiting_disconnect != INVALID_TIMER){ - timer->delete(character->waiting_disconnect, chardb_waiting_disconnect); + timer->delete(character->waiting_disconnect, chr->waiting_disconnect); character->waiting_disconnect = INVALID_TIMER; } } else if (character->server == server_id) @@ -367,46 +358,51 @@ static int char_db_kickoffline(DBKey key, DBData *data, va_list ap) //Kick out any connected characters, and set them offline as appropriate. if (character->server > -1) - mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 1); + mapif->disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 1); else if (character->waiting_disconnect == INVALID_TIMER) - set_char_offline(character->char_id, character->account_id); + chr->set_char_offline(character->char_id, character->account_id); else return 0; // fail return 1; } -void set_all_offline(int id) +void char_set_login_all_offline(void) +{ + //Tell login-server to also mark all our characters as offline. + WFIFOHEAD(chr->login_fd,2); + WFIFOW(chr->login_fd,0) = 0x2737; + WFIFOSET(chr->login_fd,2); +} + +void char_set_all_offline(int id) { if (id < 0) ShowNotice("Sending all users offline.\n"); else ShowNotice("Sending users of map-server %d offline.\n",id); - online_char_db->foreach(online_char_db,char_db_kickoffline,id); + chr->online_char_db->foreach(chr->online_char_db,chr->db_kickoffline,id); - if (id >= 0 || login_fd <= 0 || session[login_fd]->flag.eof) + if (id >= 0 || chr->login_fd <= 0 || session[chr->login_fd]->flag.eof) return; - //Tell login-server to also mark all our characters as offline. - WFIFOHEAD(login_fd,2); - WFIFOW(login_fd,0) = 0x2737; - WFIFOSET(login_fd,2); + chr->set_login_all_offline(); } -void set_all_offline_sql(void) +void char_set_all_offline_sql(void) { //Set all players to 'OFFLINE' - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", guild_member_db) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `connect_member` = '0'", guild_db) ) + Sql_ShowDebug(inter->sql_handle); } /** * @see DBCreateData */ -static DBData create_charstatus(DBKey key, va_list args) +static DBData char_create_charstatus(DBKey key, va_list args) { struct mmo_charstatus *cp; cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus)); @@ -414,9 +410,7 @@ static DBData create_charstatus(DBKey key, va_list args) return DB->ptr2data(cp); } -int inventory_to_sql(const struct item items[], int max, int id); - -int mmo_char_tosql(int char_id, struct mmo_charstatus* p) +int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) { int i = 0; int count = 0; @@ -428,14 +422,14 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) if (char_id!=p->char_id) return 0; - cp = idb_ensure(char_db_, char_id, create_charstatus); + cp = idb_ensure(chr->char_db_, char_id, chr->create_charstatus); StrBuf->Init(&buf); memset(save_status, 0, sizeof(save_status)); //map inventory data if( memcmp(p->inventory, cp->inventory, sizeof(p->inventory)) ) { - if (!inventory_to_sql(p->inventory, MAX_INVENTORY, p->char_id)) + if (!chr->inventory_to_sql(p->inventory, MAX_INVENTORY, p->char_id)) strcat(save_status, " inventory"); else errors++; @@ -443,7 +437,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) //map cart data if( memcmp(p->cart, cp->cart, sizeof(p->cart)) ) { - if (!memitemdata_to_sql(p->cart, MAX_CART, p->char_id, TABLE_CART)) + if (!chr->memitemdata_to_sql(p->cart, MAX_CART, p->char_id, TABLE_CART)) strcat(save_status, " cart"); else errors++; @@ -451,7 +445,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) //map storage data if( memcmp(p->storage.items, cp->storage.items, sizeof(p->storage.items)) ) { - if (!memitemdata_to_sql(p->storage.items, MAX_STORAGE, p->account_id, TABLE_STORAGE)) + if (!chr->memitemdata_to_sql(p->storage.items, MAX_STORAGE, p->account_id, TABLE_STORAGE)) strcat(save_status, " storage"); else errors++; @@ -484,7 +478,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) if( p->show_equip ) opt |= OPT_SHOW_EQUIP; - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d'," + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d'," "`base_exp`='%u', `job_exp`='%u', `zeny`='%d'," "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d'," "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d'," @@ -505,15 +499,15 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) p->robe,p->slotchange,opt,p->font,p->uniqueitem_counter, p->account_id, p->char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } else strcat(save_status, " status"); } if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != cp->mod_death ) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) { + Sql_ShowDebug(inter->sql_handle); errors++; } else strcat(save_status, " accdata"); @@ -529,7 +523,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) (p->fame != cp->fame) ) { - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `class`='%d'," + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d'," "`hair`='%d',`hair_color`='%d',`clothes_color`='%d'," "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d'," "`karma`='%d',`manner`='%d', `fame`='%d'" @@ -540,7 +534,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) p->karma, p->manner, p->fame, p->account_id, p->char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } else strcat(save_status, " status2"); @@ -552,7 +546,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) (p->spear_calls != cp->spear_calls) || (p->spear_faith != cp->spear_faith) || (p->sword_calls != cp->sword_calls) || (p->sword_faith != cp->sword_faith) ) { - if (mercenary_owner_tosql(char_id, p)) + if (inter_mercenary->owner_tosql(char_id, p)) strcat(save_status, " mercenary"); else errors++; @@ -564,9 +558,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) char esc_mapname[NAME_LENGTH*2+1]; //`memo` (`memo_id`,`char_id`,`map`,`x`,`y`) - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, p->char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } @@ -579,16 +573,16 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) { if( count ) StrBuf->AppendStr(&buf, ","); - SQL->EscapeString(sql_handle, esc_mapname, mapindex_id2name(p->memo_point[i].map)); + SQL->EscapeString(inter->sql_handle, esc_mapname, mapindex_id2name(p->memo_point[i].map)); StrBuf->Printf(&buf, "('%d', '%s', '%d', '%d')", char_id, esc_mapname, p->memo_point[i].x, p->memo_point[i].y); ++count; } } if( count ) { - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -598,8 +592,8 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) //skills if( memcmp(p->skill, cp->skill, sizeof(p->skill)) ) { //`skill` (`char_id`, `id`, `lv`) - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, p->char_id) ) { + Sql_ShowDebug(inter->sql_handle); errors++; } @@ -623,9 +617,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) } if( count ) { - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -644,9 +638,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) if(diff == 1) { //Save friends - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", friend_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } @@ -664,9 +658,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) } if( count ) { - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -688,9 +682,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) } } if(diff) { - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } else strcat(save_status, " hotkeys"); @@ -706,7 +700,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) } /// Saves an array of 'item' entries into the specified table. -int memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) +int char_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) { StringBuf buf; SqlStmt* stmt; @@ -741,7 +735,7 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit StrBuf->Printf(&buf, ", `card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id); - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtExecute(stmt) ) { @@ -802,9 +796,9 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -815,9 +809,9 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit } if( !found ) {// Item not present in inventory, remove it. - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", tablename, item.id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -850,9 +844,9 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit StrBuf->AppendStr(&buf, ")"); } - if( found && SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) + if( found && SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); errors++; } @@ -861,9 +855,9 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit return errors; } -/* pretty much a copy of memitemdata_to_sql except it handles inventory_db exclusively, +/* pretty much a copy of chr->memitemdata_to_sql except it handles inventory_db exclusively, * - this is required because inventory db is the only one with the 'favorite' column. */ -int inventory_to_sql(const struct item items[], int max, int id) { +int char_inventory_to_sql(const struct item items[], int max, int id) { StringBuf buf; SqlStmt* stmt; int i; @@ -885,7 +879,7 @@ int inventory_to_sql(const struct item items[], int max, int id) { StrBuf->Printf(&buf, ", `card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`='%d'", inventory_db, id); - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtExecute(stmt) ) { @@ -945,8 +939,8 @@ int inventory_to_sql(const struct item items[], int max, int id) { StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]); StrBuf->Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id); - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -956,8 +950,8 @@ int inventory_to_sql(const struct item items[], int max, int id) { } } if( !found ) {// Item not present in inventory, remove it. - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", inventory_db, item.id) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE from `%s` where `id`='%d' LIMIT 1", inventory_db, item.id) ) { + Sql_ShowDebug(inter->sql_handle); errors++; } } @@ -989,8 +983,8 @@ int inventory_to_sql(const struct item items[], int max, int id) { StrBuf->AppendStr(&buf, ")"); } - if( found && SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + if( found && SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) { + Sql_ShowDebug(inter->sql_handle); errors++; } @@ -1000,12 +994,9 @@ int inventory_to_sql(const struct item items[], int max, int id) { return errors; } - -int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p); - //===================================================================================================== // Loads the basic character rooster for the given account. Returns total buffer used. -int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) { SqlStmt* stmt; struct mmo_charstatus p; @@ -1014,7 +1005,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) time_t unban_time = 0; char sex[2]; - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( stmt == NULL ) { SqlStmt_ShowDebug(stmt); return 0; @@ -1097,7 +1088,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) p.sex = 99; break; } - j += mmo_char_tobuf(WBUFP(buf, j), &p); + j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); } memset(sd->new_name,0,sizeof(sd->new_name)); @@ -1107,7 +1098,7 @@ 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 char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything) { int i,j; char t_msg[128] = ""; @@ -1133,7 +1124,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything if (save_log) ShowInfo("Char load request (%d)\n", char_id); - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( stmt == NULL ) { SqlStmt_ShowDebug(stmt); @@ -1341,7 +1332,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything strcat(t_msg, " cart"); //read storage - storage_fromsql(p->account_id, &p->storage); + inter_storage->fromsql(p->account_id, &p->storage); strcat(t_msg, " storage"); //read skill @@ -1362,7 +1353,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything if( skillid2idx[tmp_skill.id] ) memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); else - ShowWarning("mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n", tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id); + ShowWarning("chr->mmo_char_fromsql: ignoring invalid skill (id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n", tmp_skill.id, tmp_skill.lv, p->name, p->account_id, p->char_id); } strcat(t_msg, " skills"); @@ -1399,13 +1390,13 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything if( hotkey_num >= 0 && hotkey_num < MAX_HOTKEYS ) memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey)); else - ShowWarning("mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n", hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id); + ShowWarning("chr->mmo_char_fromsql: ignoring invalid hotkey (hotkey=%d,type=%u,id=%u,lv=%u) of character %s (AID=%d,CID=%d)\n", hotkey_num, tmp_hotkey.type, tmp_hotkey.id, tmp_hotkey.lv, p->name, p->account_id, p->char_id); } strcat(t_msg, " hotkeys"); #endif /* Mercenary Owner DataBase */ - mercenary_owner_fromsql(char_id, p); + inter_mercenary->owner_fromsql(char_id, p); strcat(t_msg, " mercenary"); /* default */ @@ -1434,15 +1425,15 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything if( opt & OPT_SHOW_EQUIP ) p->show_equip = true; - cp = idb_ensure(char_db_, char_id, create_charstatus); + cp = idb_ensure(chr->char_db_, char_id, chr->create_charstatus); memcpy(cp, p, sizeof(struct mmo_charstatus)); return 1; } //========================================================================================================== -int mmo_char_sql_init(void) +int char_mmo_char_sql_init(void) { - char_db_= idb_alloc(DB_OPT_RELEASE_DATA); + chr->char_db_= idb_alloc(DB_OPT_RELEASE_DATA); //the 'set offline' part is now in check_login_conn ... //if the server connects to loginserver @@ -1451,19 +1442,20 @@ int mmo_char_sql_init(void) // Force all users offline in sql when starting char-server // (useful when servers crashes and don't clean the database) - set_all_offline_sql(); + chr->set_all_offline_sql(); return 0; } + /* [Ind/Hercules] - special thanks to Yommy for providing the packet structure/data */ -bool char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { +bool char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { struct mmo_charstatus char_dat; int from_id = 0; if( from > MAX_CHARS || to > MAX_CHARS || ( sd->char_slots && to > sd->char_slots ) || sd->found_char[from] <= 0 ) return false; - if( !mmo_char_fromsql(sd->found_char[from], &char_dat, false) ) // Only the short data is needed. + if( !chr->mmo_char_fromsql(sd->found_char[from], &char_dat, false) ) // Only the short data is needed. return false; if( char_dat.slotchange == 0 ) @@ -1474,30 +1466,30 @@ bool char_slotchange(struct char_session_data *sd, int fd, unsigned short from, if( sd->found_char[to] > 0 ) {/* moving char to occupied slot */ bool result = false; /* update both at once */ - if( SQL_SUCCESS != SQL->QueryStr(sql_handle, "START TRANSACTION") - || SQL_SUCCESS != SQL->Query(sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) - || SQL_SUCCESS != SQL->Query(sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) ) - Sql_ShowDebug(sql_handle); + if( SQL_SUCCESS != SQL->QueryStr(inter->sql_handle, "START TRANSACTION") + || SQL_SUCCESS != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, from, sd->found_char[to]) + || SQL_SUCCESS != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from]) ) + Sql_ShowDebug(inter->sql_handle); else result = true; - if( SQL_ERROR == SQL->QueryStr(sql_handle, (result == true) ? "COMMIT" : "ROLLBACK") ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, (result == true) ? "COMMIT" : "ROLLBACK") ) { + Sql_ShowDebug(inter->sql_handle); result = false; } if( !result ) return false; } else {/* slot is free. */ - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_num`='%d' WHERE `char_id`='%d' LIMIT 1", char_db, to, sd->found_char[from] ) ) { + Sql_ShowDebug(inter->sql_handle); return false; } } /* update count */ - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `slotchange`=`slotchange`-1 WHERE `char_id`='%d' LIMIT 1", char_db, from_id ) ) { + Sql_ShowDebug(inter->sql_handle); return false; } @@ -1507,7 +1499,7 @@ bool char_slotchange(struct char_session_data *sd, int fd, unsigned short from, //----------------------------------- // Function to change character's names //----------------------------------- -int rename_char_sql(struct char_session_data *sd, int char_id) +int char_rename_char_sql(struct char_session_data *sd, int char_id) { struct mmo_charstatus char_dat; char esc_name[NAME_LENGTH*2+1]; @@ -1515,30 +1507,30 @@ int rename_char_sql(struct char_session_data *sd, int char_id) if( sd->new_name[0] == 0 ) // Not ready for rename return 2; - if( !mmo_char_fromsql(char_id, &char_dat, false) ) // Only the short data is needed. + if( !chr->mmo_char_fromsql(char_id, &char_dat, false) ) // Only the short data is needed. return 2; if( char_dat.rename == 0 ) return 1; - SQL->EscapeStringLen(sql_handle, esc_name, sd->new_name, strnlen(sd->new_name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, sd->new_name, strnlen(sd->new_name, NAME_LENGTH)); // check if the char exist - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` LIKE '%s' LIMIT 1", char_db, esc_name) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 4; } - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name` = '%s', `rename` = '%d' WHERE `char_id` = '%d'", char_db, esc_name, --char_dat.rename, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 3; } // Change character's name into guild_db. if( char_dat.guild_id ) - inter_guild_charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); + inter_guild->charname_changed(char_dat.guild_id, sd->account_id, char_id, sd->new_name); safestrncpy(char_dat.name, sd->new_name, NAME_LENGTH); memset(sd->new_name,0,sizeof(sd->new_name)); @@ -1546,17 +1538,17 @@ int rename_char_sql(struct char_session_data *sd, int char_id) // log change if( log_char ) { - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '0', '0', '0', '0', '0', '0', '0', '0')", charlog_db, "change char name", sd->account_id, char_dat.char_id, char_dat.slot, esc_name) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } return 0; } -int check_char_name(char * name, char * esc_name) +int char_check_char_name(char * name, char * esc_name) { int i; @@ -1591,17 +1583,17 @@ int check_char_name(char * name, char * esc_name) return -5; } if( name_ignoring_case ) { - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE BINARY `name` = '%s' LIMIT 1", char_db, esc_name) ) { + Sql_ShowDebug(inter->sql_handle); return -2; } } else { - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT 1 FROM `%s` WHERE `name` = '%s' LIMIT 1", char_db, esc_name) ) { + Sql_ShowDebug(inter->sql_handle); return -2; } } - if( SQL->NumRows(sql_handle) > 0 ) + if( SQL->NumRows(inter->sql_handle) > 0 ) return -1; // name already exists return 0; @@ -1617,22 +1609,16 @@ int check_char_name(char * name, char * esc_name) * -5: 'Symbols in Character Names are forbidden' * char_id: Success **/ -#if PACKETVER >= 20120307 -int make_new_char_sql(struct char_session_data* sd, char* name_, int slot, int hair_color, int hair_style) { - int str = 1, agi = 1, vit = 1, int_ = 1, dex = 1, luk = 1; -#else -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) { -#endif - +int char_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) { char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; int char_id, flag, k, l; safestrncpy(name, name_, NAME_LENGTH); normalize_name(name,TRIM_CHARS); - SQL->EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); - flag = check_char_name(name,esc_name); + flag = chr->check_char_name(name,esc_name); if( flag < 0 ) return flag; @@ -1657,41 +1643,41 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag #if PACKETVER >= 20120307 //Insert the new char entry to the database - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" "'%d', '%d', '%s', '%d', '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", char_db, sd->account_id , slot, esc_name, start_zeny, 48, str, agi, vit, int_, dex, luk, (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return -2; //No, stop the procedure! } #else //Insert the new char entry to the database - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", char_db, sd->account_id , slot, esc_name, start_zeny, str, agi, vit, int_, dex, luk, (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return -2; //No, stop the procedure! } #endif //Retrieve the newly auto-generated char id - char_id = (int)SQL->LastInsertId(sql_handle); + char_id = (int)SQL->LastInsertId(inter->sql_handle); if( !char_id ) return -2; // Validation success, log result if (log_char) { - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `char_msg`,`account_id`,`char_id`,`char_num`,`name`,`str`,`agi`,`vit`,`int`,`dex`,`luk`,`hair`,`hair_color`)" "VALUES (NOW(), '%s', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", charlog_db, "make new char", sd->account_id, char_id, slot, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } //Give the char the default items @@ -1699,21 +1685,21 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag // FIXME: How to define if an item is stackable without having to lookup itemdb? [panikon] if( start_items[k+2] == 1 ) { - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", inventory_db, char_id, start_items[k], start_items[k + 1], 1) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } else if( start_items[k+2] == 0 ) { // Non-stackable items should have their own entries (issue: 7279) for( l = 0; l < start_items[k+1]; l++ ) { - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `identify`) VALUES ('%d', '%d', '%d', '%d')", inventory_db, char_id, start_items[k], 1, 1) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } } } @@ -1725,19 +1711,19 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag /*----------------------------------------------------------------------------------------------------------*/ /* Divorce Players */ /*----------------------------------------------------------------------------------------------------------*/ -int divorce_char_sql(int partner_id1, int partner_id2) +int char_divorce_char_sql(int partner_id1, int partner_id2) { unsigned char buf[64]; - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", char_db, partner_id1, partner_id2) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) ) + Sql_ShowDebug(inter->sql_handle); WBUFW(buf,0) = 0x2b12; WBUFL(buf,2) = partner_id1; WBUFL(buf,6) = partner_id2; - mapif_sendall(buf,10); + mapif->sendall(buf,10); return 0; } @@ -1748,7 +1734,7 @@ int divorce_char_sql(int partner_id1, int partner_id2) /* Returns 0 if successful * Returns < 0 for error */ -int delete_char_sql(int char_id) +int char_delete_char_sql(int char_id) { char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped. @@ -1756,30 +1742,30 @@ int delete_char_sql(int char_id) char *data; size_t len; - if (SQL_ERROR == SQL->Query(sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) - Sql_ShowDebug(sql_handle); + if (SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id)) + Sql_ShowDebug(inter->sql_handle); - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - ShowError("delete_char_sql: Unable to fetch character data, deletion aborted.\n"); - SQL->FreeResult(sql_handle); + ShowError("chr->delete_char_sql: Unable to fetch character data, deletion aborted.\n"); + SQL->FreeResult(inter->sql_handle); return -1; } - SQL->GetData(sql_handle, 0, &data, &len); safestrncpy(name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 1, &data, NULL); account_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); party_id = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); guild_id = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); base_level = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); hom_id = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); partner_id = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); father_id = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); mother_id = atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, &len); safestrncpy(name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 1, &data, NULL); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); hom_id = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); partner_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); father_id = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); mother_id = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); elemental_id = atoi(data); - SQL->EscapeStringLen(sql_handle, esc_name, name, min(len, NAME_LENGTH)); - SQL->FreeResult(sql_handle); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, min(len, NAME_LENGTH)); + SQL->FreeResult(inter->sql_handle); //check for config char del condition [Lupus] // TODO: Move this out to packet processing (0x68/0x1fb). @@ -1792,128 +1778,128 @@ int delete_char_sql(int char_id) /* Divorce [Wizputer] */ if( partner_id ) - divorce_char_sql(char_id, partner_id); + chr->divorce_char_sql(char_id, partner_id); /* De-addopt [Zephyrus] */ if( father_id || mother_id ) { // Char is Baby unsigned char buf[64]; - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `child`='0' WHERE `char_id`='%d' OR `char_id`='%d'", char_db, father_id, mother_id) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '410'AND (`char_id`='%d' OR `char_id`='%d')", skill_db, father_id, mother_id) ) + Sql_ShowDebug(inter->sql_handle); WBUFW(buf,0) = 0x2b25; WBUFL(buf,2) = father_id; WBUFL(buf,6) = mother_id; WBUFL(buf,10) = char_id; // Baby - mapif_sendall(buf,14); + mapif->sendall(buf,14); } //Make the character leave the party [Skotlex] if (party_id) - inter_party_leave(party_id, account_id, char_id); + inter_party->leave(party_id, account_id, char_id); /* delete char's pet */ //Delete the hatched pet if you have one... - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `incubate` = '0'", pet_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); //Delete all pets that are stored in eggs (inventory + cart) - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, inventory_db, inventory_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", pet_db, pet_db, cart_db, cart_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* remove homunculus */ if( hom_id ) - mapif_homunculus_delete(hom_id); + mapif->homunculus_delete(hom_id); /* remove elemental */ if (elemental_id) - mapif_elemental_delete(elemental_id); + mapif->elemental_delete(elemental_id); /* remove mercenary data */ - mercenary_owner_delete(char_id); + inter_mercenary->owner_delete(char_id); /* delete char's friends list */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", friend_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* delete char from other's friend list */ //NOTE: Won't this cause problems for people who are already online? [Skotlex] - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `friend_id` = '%d'", friend_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); #ifdef HOTKEY_SAVING /* delete hotkeys */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", hotkey_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); #endif /* delete inventory */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", inventory_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* delete cart inventory */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", cart_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* delete memo areas */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", memo_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* delete character registry */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* delete skills */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); /* delete mails (only received) */ - if (SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) - Sql_ShowDebug(sql_handle); + if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id)) + Sql_ShowDebug(inter->sql_handle); #ifdef ENABLE_SC_SAVING /* status changes */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, account_id, char_id) ) + Sql_ShowDebug(inter->sql_handle); #endif /* delete character */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); else if( log_char ) { - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `char_msg`, `name`)" " VALUES (NOW(), '%d', '%d', '%d', 'Deleted character', '%s')", charlog_db, account_id, char_id, 0, esc_name) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } - /* No need as we used inter_guild_leave [Skotlex] + /* No need as we used inter_guild->leave [Skotlex] // Also delete info from guildtables. - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", guild_member_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", guild_member_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); */ - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) - Sql_ShowDebug(sql_handle); - else if( SQL->NumRows(sql_handle) > 0 ) - mapif_parse_BreakGuild(0,guild_id); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `char_id` = '%d'", guild_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL->NumRows(inter->sql_handle) > 0 ) + mapif->parse_BreakGuild(0,guild_id); else if( guild_id ) - inter_guild_leave(guild_id, account_id, char_id);// Leave your guild. + inter_guild->leave(guild_id, account_id, char_id);// Leave your guild. return 0; } //--------------------------------------------------------------------- // This function return the number of online players in all map-servers //--------------------------------------------------------------------- -int count_users(void) +int char_count_users(void) { int i, users; @@ -1930,7 +1916,7 @@ int count_users(void) // Used in packets 0x6b (chars info) and 0x6d (new char info) // Returns the size #define MAX_CHAR_BUF 150 //Max size (for WFIFOHEAD calls) -int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { +int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { unsigned short offset = 0; uint8* buf; @@ -2025,15 +2011,16 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { } /* Made Possible by Yommy~! <3 */ -void mmo_char_send099d(int fd, struct char_session_data *sd) { +void char_mmo_char_send099d(int fd, struct char_session_data *sd) { WFIFOHEAD(fd,4 + (MAX_CHARS*MAX_CHAR_BUF)); WFIFOW(fd,0) = 0x99d; - WFIFOW(fd,2) = mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; + WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; WFIFOSET(fd,WFIFOW(fd,2)); } + /* Sends character ban list */ /* Made Possible by Yommy~! <3 */ -void mmo_char_send020d(int fd, struct char_session_data *sd) { +void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { int i; time_t now = time(NULL); @@ -2057,8 +2044,8 @@ void mmo_char_send020d(int fd, struct char_session_data *sd) { WFIFOL(fd, 4 + (24*c)) = 0; /* also update on mysql */ sd->unban_time[i] = 0; - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + Sql_ShowDebug(inter->sql_handle); } c++; } @@ -2069,11 +2056,11 @@ void mmo_char_send020d(int fd, struct char_session_data *sd) { WFIFOSET(fd, WFIFOW(fd, 2)); } } -int mmo_char_send006b(int fd, struct char_session_data* sd); + //---------------------------------------- // [Ind/Hercules] notify client about charselect window data //---------------------------------------- -void mmo_char_send082d(int fd, struct char_session_data* sd) { +void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { WFIFOHEAD(fd,29); WFIFOW(fd,0) = 0x82d; @@ -2085,13 +2072,11 @@ void mmo_char_send082d(int fd, struct char_session_data* sd) { WFIFOB(fd,8) = sd->char_slots; memset(WFIFOP(fd,9), 0, 20); // unused bytes WFIFOSET(fd,29); - - mmo_char_send006b(fd,sd); } //---------------------------------------- // Function to send characters to a player //---------------------------------------- -int mmo_char_send006b(int fd, struct char_session_data* sd) +int char_mmo_char_send_characters(int fd, struct char_session_data* sd) { int j, offset = 0; #if PACKETVER >= 20100413 @@ -2109,82 +2094,82 @@ int mmo_char_send006b(int fd, struct char_session_data* sd) WFIFOB(fd,6) = MAX_CHARS; // Premium slots. AKA any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red #endif memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes - j+=mmo_chars_fromsql(sd, WFIFOP(fd,j)); + j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); WFIFOW(fd,2) = j; // packet len WFIFOSET(fd,j); return 0; } -int char_married(int pl1, int pl2) +int char_char_married(int pl1, int pl2) { - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) - Sql_ShowDebug(sql_handle); - else if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char* data; - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); if( pl2 == atoi(data) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 1; } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 0; } -int char_child(int parent_id, int child_id) +int char_char_child(int parent_id, int child_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) - Sql_ShowDebug(sql_handle); - else if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char* data; - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); if( child_id == atoi(data) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 1; } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 0; } -int char_family(int cid1, int cid2, int cid3) +int char_char_family(int cid1, int cid2, int cid3) { - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) - Sql_ShowDebug(sql_handle); - else while( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) + Sql_ShowDebug(inter->sql_handle); + else while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { int charid; int partnerid; int childid; char* data; - SQL->GetData(sql_handle, 0, &data, NULL); charid = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); partnerid = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); childid = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); charid = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); partnerid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); childid = atoi(data); if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || (cid1 == childid && ((cid2 == charid && cid3 == partnerid) || (cid2 == partnerid && cid3 == charid ))) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return childid; } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 0; } //---------------------------------------------------------------------- // Force disconnection of an online player (with account value) by [Yor] //---------------------------------------------------------------------- -void disconnect_player(int account_id) +void char_disconnect_player(int account_id) { int i; struct char_session_data* sd; @@ -2195,64 +2180,66 @@ void disconnect_player(int account_id) set_eof(i); } +void char_authfail_fd(int fd, int type) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = type; + WFIFOSET(fd,3); +} + +void char_request_account_data(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2716; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + static void char_auth_ok(int fd, struct char_session_data *sd) { struct online_char_data* character; - if( (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) != NULL ) + if( (character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id)) != NULL ) { // check if character is not online already. [Skotlex] if (character->server > -1) { //Character already online. KICK KICK KICK - mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); + mapif->disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); if (character->waiting_disconnect == INVALID_TIMER) - character->waiting_disconnect = timer->add(timer->gettick()+20000, chardb_waiting_disconnect, character->account_id, 0); + character->waiting_disconnect = timer->add(timer->gettick()+20000, chr->waiting_disconnect, character->account_id, 0); if (character) character->pincode_enable = -1; - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x81; - WFIFOB(fd,2) = 8; - WFIFOSET(fd,3); + chr->authfail_fd(fd, 8); return; } if (character->fd >= 0 && character->fd != fd) { //There's already a connection from this account that hasn't picked a char yet. - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x81; - WFIFOB(fd,2) = 8; - WFIFOSET(fd,3); + chr->authfail_fd(fd, 8); return; } character->fd = fd; } - if (login_fd > 0) { - // request account data - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x2716; - WFIFOL(login_fd,2) = sd->account_id; - WFIFOSET(login_fd,6); + if (chr->login_fd > 0) { + chr->request_account_data(sd->account_id); } // mark session as 'authed' sd->auth = true; // set char online on charserver - set_char_charselect(sd->account_id); + chr->set_char_charselect(sd->account_id); // continues when account data is received... } -int send_accounts_tologin(int tid, int64 tick, int id, intptr_t data); -void mapif_server_reset(int id); - - /// Resets all the data. void loginif_reset(void) { int id; // TODO kick everyone out and reset everything or wait for connect and try to reacquire locks [FlavioJS] for( id = 0; id < ARRAYLENGTH(server); ++id ) - mapif_server_reset(id); + mapif->server_reset(id); flush_fifos(); exit(EXIT_FAILURE); } @@ -2281,10 +2268,10 @@ void loginif_on_ready(void) { int i; - loginif_check_shutdown(); + loginif->check_shutdown(); //Send online accounts to login server. - send_accounts_tologin(INVALID_TIMER, timer->gettick(), 0, 0); + chr->send_accounts_tologin(INVALID_TIMER, timer->gettick(), 0, 0); // if no map-server already connected, display a message... ARR_FIND( 0, ARRAYLENGTH(server), i, server[i].fd > 0 && server[i].map ); @@ -2292,37 +2279,352 @@ void loginif_on_ready(void) ShowStatus("Awaiting maps from map-server.\n"); } +void char_ping_login_server(int fd) +{ + WFIFOHEAD(fd,2);// sends a ping packet to login server (will receive pong 0x2718) + WFIFOW(fd,0) = 0x2719; + WFIFOSET(fd,2); +} + +int char_parse_fromlogin_connection_state(int fd) +{ + if (RFIFOB(fd,2)) { + //printf("connect login server error : %d\n", RFIFOB(fd,2)); + ShowError("Can not connect to login-server.\n"); + ShowError("The server communication passwords (default s1/p1) are probably invalid.\n"); + ShowError("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"); + ShowError("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"); + set_eof(fd); + return 1; + } else { + ShowStatus("Connected to login-server (connection #%d).\n", fd); + loginif->on_ready(); + } + RFIFOSKIP(fd,3); + return 0; +} -int parse_fromlogin(int fd) { +// 0 - rejected from server +// +void char_auth_error(int fd, unsigned char flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6c; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_fromlogin_auth_state(int fd) +{ struct char_session_data* sd = NULL; + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint8 sex = RFIFOB(fd,14); + uint8 result = RFIFOB(fd,15); + int request_id = RFIFOL(fd,16); + uint32 version = RFIFOL(fd,20); + uint8 clienttype = RFIFOB(fd,24); + int group_id = RFIFOL(fd,25); + unsigned int expiration_time = RFIFOL(fd, 29); + RFIFOSKIP(fd,33); + + if( session_isActive(request_id) && (sd=(struct char_session_data*)session[request_id]->session_data) && + !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) + { + int client_fd = request_id; + sd->version = version; + sd->clienttype = clienttype; + switch( result ) { + case 0:// ok + /* restrictions apply */ + if( char_server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { + chr->auth_error(client_fd, 0); + break; + } + /* the client will already deny this request, this check is to avoid someone bypassing. */ + if( char_server_type == CST_PAYING && (time_t)expiration_time < time(NULL) ) { + chr->auth_error(client_fd, 0); + break; + } + chr->auth_ok(client_fd, sd); + break; + case 1:// auth failed + chr->auth_error(client_fd, 0); + break; + } + } +} + +void char_parse_fromlogin_account_data(int fd) +{ + struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data; + int i; + // find the authenticated session with this account id + ARR_FIND( 0, sockt->fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2) ); + if( i < sockt->fd_max ) { + memcpy(sd->email, RFIFOP(fd,6), 40); + sd->expiration_time = (time_t)RFIFOL(fd,46); + sd->group_id = RFIFOB(fd,50); + sd->char_slots = RFIFOB(fd,51); + if( sd->char_slots > MAX_CHARS ) { + ShowError("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n",sd->account_id,sd->char_slots); + sd->char_slots = MAX_CHARS;/* cap to maximum */ + } else if ( sd->char_slots <= 0 )/* no value aka 0 in sql */ + sd->char_slots = MAX_CHARS;/* cap to maximum */ + safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,52), sizeof(sd->birthdate)); + safestrncpy(sd->pincode, (const char*)RFIFOP(fd,63), sizeof(sd->pincode)); + sd->pincode_change = RFIFOL(fd,68); + // continued from chr->auth_ok... + if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && chr->count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + // refuse connection (over populated) + chr->auth_error(i, 0); + } else { + // send characters to player + #if PACKETVER >= 20130000 + chr->mmo_char_send_slots_info(i, sd); + chr->mmo_char_send_characters(i, sd); + #else + chr->mmo_char_send_characters(i, sd); + #endif + #if PACKETVER >= 20060819 + chr->mmo_char_send_ban_list(i, sd); + #endif + #if PACKETVER >= 20110309 + pincode->handle(i, sd); + #endif + } + } + RFIFOSKIP(fd,72); +} + +void char_parse_fromlogin_login_pong(int fd) +{ + RFIFOSKIP(fd,2); + session[fd]->flag.ping = 0; +} + +void char_changesex(int account_id, int sex) +{ + unsigned char buf[7]; + + WBUFW(buf,0) = 0x2b0d; + WBUFL(buf,2) = account_id; + WBUFB(buf,6) = sex; + mapif->sendall(buf, 7); +} + +int char_parse_fromlogin_changesex_reply(int fd) +{ + int char_id[MAX_CHARS]; + int class_[MAX_CHARS]; + int guild_id[MAX_CHARS]; + int num; + int i; + char* data; + struct char_auth_node* node; + + int acc = RFIFOL(fd,2); + int sex = RFIFOB(fd,6); + + RFIFOSKIP(fd,7); + + // This should _never_ happen + if( acc <= 0 ) { + ShowError("Received invalid account id from login server! (aid: %d)\n", acc); + return 1; + } + + node = (struct char_auth_node*)idb_get(auth_db, acc); + if( node != NULL ) + node->sex = sex; + + // get characters + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) ) + Sql_ShowDebug(inter->sql_handle); + for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) + { + SQL->GetData(inter->sql_handle, 0, &data, NULL); char_id[i] = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); class_[i] = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); guild_id[i] = atoi(data); + } + num = i; + for( i = 0; i < num; ++i ) + { + if( class_[i] == JOB_BARD || class_[i] == JOB_DANCER || + class_[i] == JOB_CLOWN || class_[i] == JOB_GYPSY || + class_[i] == JOB_BABY_BARD || class_[i] == JOB_BABY_DANCER || + class_[i] == JOB_MINSTREL || class_[i] == JOB_WANDERER || + class_[i] == JOB_MINSTREL_T || class_[i] == JOB_WANDERER_T || + class_[i] == JOB_BABY_MINSTREL || class_[i] == JOB_BABY_WANDERER || + class_[i] == JOB_KAGEROU || class_[i] == JOB_OBORO ) + { + // job modification + if( class_[i] == JOB_BARD || class_[i] == JOB_DANCER ) + class_[i] = (sex ? JOB_BARD : JOB_DANCER); + else if( class_[i] == JOB_CLOWN || class_[i] == JOB_GYPSY ) + class_[i] = (sex ? JOB_CLOWN : JOB_GYPSY); + else if( class_[i] == JOB_BABY_BARD || class_[i] == JOB_BABY_DANCER ) + class_[i] = (sex ? JOB_BABY_BARD : JOB_BABY_DANCER); + else if( class_[i] == JOB_MINSTREL || class_[i] == JOB_WANDERER ) + class_[i] = (sex ? JOB_MINSTREL : JOB_WANDERER); + else if( class_[i] == JOB_MINSTREL_T || class_[i] == JOB_WANDERER_T ) + class_[i] = (sex ? JOB_MINSTREL_T : JOB_WANDERER_T); + else if( class_[i] == JOB_BABY_MINSTREL || class_[i] == JOB_BABY_WANDERER ) + class_[i] = (sex ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); + else if( class_[i] == JOB_KAGEROU || class_[i] == JOB_OBORO ) + class_[i] = (sex ? JOB_KAGEROU : JOB_OBORO); + } + + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id[i]) ) + Sql_ShowDebug(inter->sql_handle); + + if( SQL_ERROR == SQL->Query(inter->sql_handle, + "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', `head_top`='0', `head_mid`='0', " + "`head_bottom`='0' WHERE `char_id`='%d'", + char_db, class_[i], char_id[i]) ) + Sql_ShowDebug(inter->sql_handle); + + if( guild_id[i] )// If there is a guild, update the guild_member data [Skotlex] + inter_guild->sex_changed(guild_id[i], acc, char_id[i], sex); + } + SQL->FreeResult(inter->sql_handle); + + // disconnect player if online on char-server + chr->disconnect_player(acc); + + // notify all mapservers about this change + chr->changesex(acc, sex); + return 0; +} + +void char_parse_fromlogin_account_reg2(int fd) +{ + //Receive account_reg2 registry, forward to map servers. + mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); + RFIFOSKIP(fd, RFIFOW(fd,2)); +} +void mapif_ban(int id, unsigned int flag, int status) +{ + // send to all map-servers to disconnect the player + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = id; + WBUFB(buf,6) = flag; // 0: change of status, 1: ban + WBUFL(buf,7) = status; // status or final date of a banishment + mapif->sendall(buf, 11); +} + +void char_parse_fromlogin_ban(int fd) +{ + mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); + // disconnect player if online on char-server + chr->disconnect_player(RFIFOL(fd,2)); + RFIFOSKIP(fd,11); +} + +void char_parse_fromlogin_kick(int fd) +{ + int aid = RFIFOL(fd,2); + struct online_char_data* character = (struct online_char_data*)idb_get(chr->online_char_db, aid); + RFIFOSKIP(fd,6); + if( character != NULL ) + {// account is already marked as online! + if( character->server > -1 ) + { //Kick it from the map server it is on. + mapif->disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); + if (character->waiting_disconnect == INVALID_TIMER) + character->waiting_disconnect = timer->add(timer->gettick()+AUTH_TIMEOUT, chr->waiting_disconnect, character->account_id, 0); + } + else + {// Manual kick from char server. + struct char_session_data *tsd; + int i; + ARR_FIND( 0, sockt->fd_max, i, session[i] && (tsd = (struct char_session_data*)session[i]->session_data) && tsd->account_id == aid ); + if( i < sockt->fd_max ) + { + chr->authfail_fd(i, 2); + set_eof(i); + } + else // still moving to the map-server + chr->set_char_offline(-1, aid); + } + } + idb_remove(auth_db, aid);// reject auth attempts from map-server +} + +void char_update_ip(int fd) +{ + WFIFOHEAD(fd,6); + WFIFOW(fd,0) = 0x2736; + WFIFOL(fd,2) = htonl(char_ip); + WFIFOSET(fd,6); +} + +void char_parse_fromlogin_update_ip(int fd) +{ + unsigned char buf[2]; + uint32 new_ip = 0; + + WBUFW(buf,0) = 0x2b1e; + mapif->sendall(buf, 2); + + new_ip = host2ip(login_ip_str); + if (new_ip && new_ip != login_ip) + login_ip = new_ip; //Update login ip, too. + + new_ip = host2ip(char_ip_str); + if (new_ip && new_ip != char_ip) + { //Update ip. + char_ip = new_ip; + ShowInfo("Updating IP for [%s].\n", char_ip_str); + // notify login server about the change + chr->update_ip(fd); + } + RFIFOSKIP(fd,2); +} + +void char_parse_fromlogin_accinfo2_failed(int fd) +{ + mapif->parse_accinfo2(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1, 0, 0); + RFIFOSKIP(fd,18); +} + +void char_parse_fromlogin_accinfo2_ok(int fd) +{ + mapif->parse_accinfo2(true, RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), + (char*)RFIFOP(fd,2), (char*)RFIFOP(fd,26), (char*)RFIFOP(fd,59), + (char*)RFIFOP(fd,99), (char*)RFIFOP(fd,119), (char*)RFIFOP(fd,151), + (char*)RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOSKIP(fd,183); +} + +int char_parse_fromlogin(int fd) { // only process data from the login-server - if( fd != login_fd ) { - ShowDebug("parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n", fd); + if( fd != chr->login_fd ) { + ShowDebug("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n", fd); do_close(fd); return 0; } if( session[fd]->flag.eof ) { do_close(fd); - login_fd = -1; - loginif_on_disconnect(); + chr->login_fd = -1; + loginif->on_disconnect(); return 0; } else if ( session[fd]->flag.ping ) {/* we've reached stall time */ if( DIFF_TICK(sockt->last_tick, session[fd]->rdata_tick) > (sockt->stall_time * 2) ) {/* we can't wait any longer */ set_eof(fd); return 0; } else if( session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */ - WFIFOHEAD(fd,2);// sends a ping packet to login server (will receive pong 0x2718) - WFIFOW(fd,0) = 0x2719; - WFIFOSET(fd,2); - + chr->ping_login_server(fd); session[fd]->flag.ping = 2; } } - sd = (struct char_session_data*)session[fd]->session_data; - while(RFIFOREST(fd) >= 2) { uint16 command = RFIFOW(fd,0); @@ -2338,20 +2640,8 @@ int parse_fromlogin(int fd) { case 0x2711: if (RFIFOREST(fd) < 3) return 0; - - if (RFIFOB(fd,2)) { - //printf("connect login server error : %d\n", RFIFOB(fd,2)); - ShowError("Can not connect to login-server.\n"); - ShowError("The server communication passwords (default s1/p1) are probably invalid.\n"); - ShowError("Also, please make sure your login db has the correct communication username/passwords and the gender of the account is S.\n"); - ShowError("The communication passwords are set in /conf/map-server.conf and /conf/char-server.conf\n"); - set_eof(fd); + if (chr->parse_fromlogin_connection_state(fd)) return 0; - } else { - ShowStatus("Connected to login-server (connection #%d).\n", fd); - loginif_on_ready(); - } - RFIFOSKIP(fd,3); break; // acknowledgment of account authentication request @@ -2359,100 +2649,15 @@ int parse_fromlogin(int fd) { if (RFIFOREST(fd) < 33) return 0; { - int account_id = RFIFOL(fd,2); - uint32 login_id1 = RFIFOL(fd,6); - uint32 login_id2 = RFIFOL(fd,10); - uint8 sex = RFIFOB(fd,14); - uint8 result = RFIFOB(fd,15); - int request_id = RFIFOL(fd,16); - uint32 version = RFIFOL(fd,20); - uint8 clienttype = RFIFOB(fd,24); - int group_id = RFIFOL(fd,25); - unsigned int expiration_time = RFIFOL(fd, 29); - RFIFOSKIP(fd,33); - - if( session_isActive(request_id) && (sd=(struct char_session_data*)session[request_id]->session_data) && - !sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex ) - { - int client_fd = request_id; - sd->version = version; - sd->clienttype = clienttype; - switch( result ) { - case 0:// ok - /* restrictions apply */ - if( char_server_type == CST_MAINTENANCE && group_id < char_maintenance_min_group_id ) { - WFIFOHEAD(client_fd,3); - WFIFOW(client_fd,0) = 0x6c; - WFIFOB(client_fd,2) = 0;// rejected from server - WFIFOSET(client_fd,3); - break; - } - /* the client will already deny this request, this check is to avoid someone bypassing. */ - if( char_server_type == CST_PAYING && (time_t)expiration_time < time(NULL) ) { - WFIFOHEAD(client_fd,3); - WFIFOW(client_fd,0) = 0x6c; - WFIFOB(client_fd,2) = 0;// rejected from server - WFIFOSET(client_fd,3); - break; - } - char_auth_ok(client_fd, sd); - break; - case 1:// auth failed - WFIFOHEAD(client_fd,3); - WFIFOW(client_fd,0) = 0x6c; - WFIFOB(client_fd,2) = 0;// rejected from server - WFIFOSET(client_fd,3); - break; - } - } + chr->parse_fromlogin_auth_state(fd); } break; case 0x2717: // account data { - int i; if (RFIFOREST(fd) < 72) return 0; - - // find the authenticated session with this account id - ARR_FIND( 0, sockt->fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2) ); - if( i < sockt->fd_max ) { - memcpy(sd->email, RFIFOP(fd,6), 40); - sd->expiration_time = (time_t)RFIFOL(fd,46); - sd->group_id = RFIFOB(fd,50); - sd->char_slots = RFIFOB(fd,51); - if( sd->char_slots > MAX_CHARS ) { - ShowError("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n",sd->account_id,sd->char_slots); - sd->char_slots = MAX_CHARS;/* cap to maximum */ - } else if ( sd->char_slots <= 0 )/* no value aka 0 in sql */ - sd->char_slots = MAX_CHARS;/* cap to maximum */ - safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,52), sizeof(sd->birthdate)); - safestrncpy(sd->pincode, (const char*)RFIFOP(fd,63), sizeof(sd->pincode)); - sd->pincode_change = RFIFOL(fd,68); - // continued from char_auth_ok... - if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || - ( max_connect_user > 0 && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { - // refuse connection (over populated) - WFIFOHEAD(i,3); - WFIFOW(i,0) = 0x6c; - WFIFOW(i,2) = 0; - WFIFOSET(i,3); - } else { - // send characters to player - #if PACKETVER >= 20130000 - mmo_char_send082d(i, sd); - #else - mmo_char_send006b(i, sd); - #endif - #if PACKETVER >= 20060819 - mmo_char_send020d(i, sd); - #endif - #if PACKETVER >= 20110309 - pincode->handle(i, sd); - #endif - } - } - RFIFOSKIP(fd,72); + chr->parse_fromlogin_account_data(fd); } break; @@ -2460,8 +2665,7 @@ int parse_fromlogin(int fd) { case 0x2718: if (RFIFOREST(fd) < 2) return 0; - RFIFOSKIP(fd,2); - session[fd]->flag.ping = 0; + chr->parse_fromlogin_login_pong(fd); break; // changesex reply @@ -2469,90 +2673,8 @@ int parse_fromlogin(int fd) { if (RFIFOREST(fd) < 7) return 0; { - unsigned char buf[7]; - - int char_id[MAX_CHARS]; - int class_[MAX_CHARS]; - int guild_id[MAX_CHARS]; - int num; - int i; - char* data; - struct auth_node* node; - - int acc = RFIFOL(fd,2); - int sex = RFIFOB(fd,6); - - RFIFOSKIP(fd,7); - - // This should _never_ happen - if( acc <= 0 ) { - ShowError("Received invalid account id from login server! (aid: %d)\n", acc); + if (chr->parse_fromlogin_changesex_reply(fd)) return 0; - } - - node = (struct auth_node*)idb_get(auth_db, acc); - if( node != NULL ) - node->sex = sex; - - // get characters - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) ) - Sql_ShowDebug(sql_handle); - for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) - { - SQL->GetData(sql_handle, 0, &data, NULL); char_id[i] = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); class_[i] = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); guild_id[i] = atoi(data); - } - num = i; - for( i = 0; i < num; ++i ) - { - if( class_[i] == JOB_BARD || class_[i] == JOB_DANCER || - class_[i] == JOB_CLOWN || class_[i] == JOB_GYPSY || - class_[i] == JOB_BABY_BARD || class_[i] == JOB_BABY_DANCER || - class_[i] == JOB_MINSTREL || class_[i] == JOB_WANDERER || - class_[i] == JOB_MINSTREL_T || class_[i] == JOB_WANDERER_T || - class_[i] == JOB_BABY_MINSTREL || class_[i] == JOB_BABY_WANDERER || - class_[i] == JOB_KAGEROU || class_[i] == JOB_OBORO ) - { - // job modification - if( class_[i] == JOB_BARD || class_[i] == JOB_DANCER ) - class_[i] = (sex ? JOB_BARD : JOB_DANCER); - else if( class_[i] == JOB_CLOWN || class_[i] == JOB_GYPSY ) - class_[i] = (sex ? JOB_CLOWN : JOB_GYPSY); - else if( class_[i] == JOB_BABY_BARD || class_[i] == JOB_BABY_DANCER ) - class_[i] = (sex ? JOB_BABY_BARD : JOB_BABY_DANCER); - else if( class_[i] == JOB_MINSTREL || class_[i] == JOB_WANDERER ) - class_[i] = (sex ? JOB_MINSTREL : JOB_WANDERER); - else if( class_[i] == JOB_MINSTREL_T || class_[i] == JOB_WANDERER_T ) - class_[i] = (sex ? JOB_MINSTREL_T : JOB_WANDERER_T); - else if( class_[i] == JOB_BABY_MINSTREL || class_[i] == JOB_BABY_WANDERER ) - class_[i] = (sex ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER); - else if( class_[i] == JOB_KAGEROU || class_[i] == JOB_OBORO ) - class_[i] = (sex ? JOB_KAGEROU : JOB_OBORO); - } - - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id[i]) ) - Sql_ShowDebug(sql_handle); - - if( SQL_ERROR == SQL->Query(sql_handle, - "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', `head_top`='0', `head_mid`='0', " - "`head_bottom`='0' WHERE `char_id`='%d'", - char_db, class_[i], char_id[i]) ) - Sql_ShowDebug(sql_handle); - - if( guild_id[i] )// If there is a guild, update the guild_member data [Skotlex] - inter_guild_sex_changed(guild_id[i], acc, char_id[i], sex); - } - SQL->FreeResult(sql_handle); - - // disconnect player if online on char-server - disconnect_player(acc); - - // notify all mapservers about this change - WBUFW(buf,0) = 0x2b0d; - WBUFL(buf,2) = acc; - WBUFB(buf,6) = sex; - mapif_sendall(buf, 7); } break; @@ -2560,28 +2682,14 @@ int parse_fromlogin(int fd) { case 0x3804: if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; - //Receive account_reg2 registry, forward to map servers. - mapif_sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); - RFIFOSKIP(fd, RFIFOW(fd,2)); + chr->parse_fromlogin_account_reg2(fd); break; // State change of account/ban notification (from login-server) case 0x2731: if (RFIFOREST(fd) < 11) return 0; - - { // send to all map-servers to disconnect the player - unsigned char buf[11]; - WBUFW(buf,0) = 0x2b14; - WBUFL(buf,2) = RFIFOL(fd,2); - WBUFB(buf,6) = RFIFOB(fd,6); // 0: change of status, 1: ban - WBUFL(buf,7) = RFIFOL(fd,7); // status or final date of a banishment - mapif_sendall(buf, 11); - } - // disconnect player if online on char-server - disconnect_player(RFIFOL(fd,2)); - - RFIFOSKIP(fd,11); + chr->parse_fromlogin_ban(fd); break; // Login server request to kick a character out. [Skotlex] @@ -2589,64 +2697,14 @@ int parse_fromlogin(int fd) { if (RFIFOREST(fd) < 6) return 0; { - int aid = RFIFOL(fd,2); - struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, aid); - RFIFOSKIP(fd,6); - if( character != NULL ) - {// account is already marked as online! - if( character->server > -1 ) - { //Kick it from the map server it is on. - mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); - if (character->waiting_disconnect == INVALID_TIMER) - character->waiting_disconnect = timer->add(timer->gettick()+AUTH_TIMEOUT, chardb_waiting_disconnect, character->account_id, 0); - } - else - {// Manual kick from char server. - struct char_session_data *tsd; - int i; - ARR_FIND( 0, sockt->fd_max, i, session[i] && (tsd = (struct char_session_data*)session[i]->session_data) && tsd->account_id == aid ); - if( i < sockt->fd_max ) - { - WFIFOHEAD(i,3); - WFIFOW(i,0) = 0x81; - WFIFOB(i,2) = 2; // "Someone has already logged in with this id" - WFIFOSET(i,3); - set_eof(i); - } - else // still moving to the map-server - set_char_offline(-1, aid); - } - } - idb_remove(auth_db, aid);// reject auth attempts from map-server + chr->parse_fromlogin_kick(fd); } break; // ip address update signal from login server case 0x2735: { - unsigned char buf[2]; - uint32 new_ip = 0; - - WBUFW(buf,0) = 0x2b1e; - mapif_sendall(buf, 2); - - new_ip = host2ip(login_ip_str); - if (new_ip && new_ip != login_ip) - login_ip = new_ip; //Update login ip, too. - - new_ip = host2ip(char_ip_str); - if (new_ip && new_ip != char_ip) - { //Update ip. - char_ip = new_ip; - ShowInfo("Updating IP for [%s].\n", char_ip_str); - // notify login server about the change - WFIFOHEAD(fd,6); - WFIFOW(fd,0) = 0x2736; - WFIFOL(fd,2) = htonl(char_ip); - WFIFOSET(fd,6); - } - - RFIFOSKIP(fd,2); + chr->parse_fromlogin_update_ip(fd); } break; @@ -2654,20 +2712,14 @@ int parse_fromlogin(int fd) { if (RFIFOREST(fd) < 18) return 0; - mapif_parse_accinfo2(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), - NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1, 0, 0); - RFIFOSKIP(fd,18); + chr->parse_fromlogin_accinfo2_failed(fd); break; case 0x2737: // Successful accinfo lookup to forward to mapserver if (RFIFOREST(fd) < 183) return 0; - mapif_parse_accinfo2(true, RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), - (char*)RFIFOP(fd,2), (char*)RFIFOP(fd,26), (char*)RFIFOP(fd,59), - (char*)RFIFOP(fd,99), (char*)RFIFOP(fd,119), (char*)RFIFOP(fd,151), - (char*)RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); - RFIFOSKIP(fd,183); + chr->parse_fromlogin_accinfo2_ok(fd); break; default: @@ -2681,110 +2733,112 @@ int parse_fromlogin(int fd) { return 0; } -int check_connect_login_server(int tid, int64 tick, int id, intptr_t data); - void do_init_loginif(void) { // establish char-login connection if not present - timer->add_func_list(check_connect_login_server, "check_connect_login_server"); - timer->add_interval(timer->gettick() + 1000, check_connect_login_server, 0, 0, 10 * 1000); + timer->add_func_list(chr->check_connect_login_server, "chr->check_connect_login_server"); + timer->add_interval(timer->gettick() + 1000, chr->check_connect_login_server, 0, 0, 10 * 1000); // send a list of all online account IDs to login server - timer->add_func_list(send_accounts_tologin, "send_accounts_tologin"); - timer->add_interval(timer->gettick() + 1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour + timer->add_func_list(chr->send_accounts_tologin, "chr->send_accounts_tologin"); + timer->add_interval(timer->gettick() + 1000, chr->send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour } void do_final_loginif(void) { - if( login_fd != -1 ) + if( chr->login_fd != -1 ) { - do_close(login_fd); - login_fd = -1; + do_close(chr->login_fd); + chr->login_fd = -1; } } -int request_accreg2(int account_id, int char_id) +int char_request_accreg2(int account_id, int char_id) { - if (login_fd > 0) { - WFIFOHEAD(login_fd,10); - WFIFOW(login_fd,0) = 0x272e; - WFIFOL(login_fd,2) = account_id; - WFIFOL(login_fd,6) = char_id; - WFIFOSET(login_fd,10); + if (chr->login_fd > 0) { + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x272e; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = char_id; + WFIFOSET(chr->login_fd,10); return 1; } return 0; } + /** - * Handles global account reg saving that continues with global_accreg_to_login_add and global_accreg_to_send + * Handles global account reg saving that continues with chr->global_accreg_to_login_add and global_accreg_to_send **/ -void global_accreg_to_login_start (int account_id, int char_id) { - WFIFOHEAD(login_fd, 60000 + 300); - WFIFOW(login_fd,0) = 0x2728; - WFIFOW(login_fd,2) = 14; - WFIFOL(login_fd,4) = account_id; - WFIFOL(login_fd,8) = char_id; - WFIFOW(login_fd,12) = 0;/* count */ +void char_global_accreg_to_login_start (int account_id, int char_id) { + WFIFOHEAD(chr->login_fd, 60000 + 300); + WFIFOW(chr->login_fd,0) = 0x2728; + WFIFOW(chr->login_fd,2) = 14; + WFIFOL(chr->login_fd,4) = account_id; + WFIFOL(chr->login_fd,8) = char_id; + WFIFOW(chr->login_fd,12) = 0;/* count */ } + /** - * Completes global account reg saving that starts global_accreg_to_login_start and continues with global_accreg_to_login_add + * Completes global account reg saving that starts chr->global_accreg_to_login_start and continues with chr->global_accreg_to_login_add **/ -void global_accreg_to_login_send (void) { - WFIFOSET(login_fd, WFIFOW(login_fd,2)); +void char_global_accreg_to_login_send (void) { + WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); } + /** - * Handles global account reg saving that starts global_accreg_to_login_start and ends with global_accreg_to_send + * Handles global account reg saving that starts chr->global_accreg_to_login_start and ends with global_accreg_to_send **/ -void global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, bool is_string) { - int nlen = WFIFOW(login_fd, 2); +void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, bool is_string) { + int nlen = WFIFOW(chr->login_fd, 2); size_t len; len = strlen(key)+1; - WFIFOB(login_fd, nlen) = (unsigned char)len;/* won't be higher; the column size is 32 */ + WFIFOB(chr->login_fd, nlen) = (unsigned char)len;/* won't be higher; the column size is 32 */ nlen += 1; - safestrncpy((char*)WFIFOP(login_fd,nlen), key, len); + safestrncpy((char*)WFIFOP(chr->login_fd,nlen), key, len); nlen += len; - WFIFOL(login_fd, nlen) = index; + WFIFOL(chr->login_fd, nlen) = index; nlen += 4; if( is_string ) { - WFIFOB(login_fd, nlen) = val ? 2 : 3; + WFIFOB(chr->login_fd, nlen) = val ? 2 : 3; nlen += 1; if( val ) { char *sval = (char*)val; len = strlen(sval)+1; - WFIFOB(login_fd, nlen) = (unsigned char)len;/* won't be higher; the column size is 254 */ + WFIFOB(chr->login_fd, nlen) = (unsigned char)len;/* won't be higher; the column size is 254 */ nlen += 1; - safestrncpy((char*)WFIFOP(login_fd,nlen), sval, len); + safestrncpy((char*)WFIFOP(chr->login_fd,nlen), sval, len); nlen += len; } } else { - WFIFOB(login_fd, nlen) = val ? 0 : 1; + WFIFOB(chr->login_fd, nlen) = val ? 0 : 1; nlen += 1; if( val ) { - WFIFOL(login_fd, nlen) = (int)val; + WFIFOL(chr->login_fd, nlen) = (int)val; nlen += 4; } } - WFIFOW(login_fd,12) += 1; + WFIFOW(chr->login_fd,12) += 1; - WFIFOW(login_fd, 2) = nlen; - if( WFIFOW(login_fd, 2) > 60000 ) { - int account_id = WFIFOL(login_fd,4), char_id = WFIFOL(login_fd,8); - global_accreg_to_login_send(); - global_accreg_to_login_start(account_id,char_id);/* prepare next */ + WFIFOW(chr->login_fd, 2) = nlen; + if( WFIFOW(chr->login_fd, 2) > 60000 ) { + int account_id = WFIFOL(chr->login_fd,4), char_id = WFIFOL(chr->login_fd,8); + chr->global_accreg_to_login_send(); + chr->global_accreg_to_login_start(account_id,char_id);/* prepare next */ } } + void char_read_fame_list(void) { int i; char* data; @@ -2795,51 +2849,51 @@ void char_read_fame_list(void) { memset(chemist_fame_list, 0, sizeof(chemist_fame_list)); memset(taekwon_fame_list, 0, sizeof(taekwon_fame_list)); // Build Blacksmith ranking list - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) - Sql_ShowDebug(sql_handle); - for( i = 0; i < fame_list_size_smith && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_BLACKSMITH, JOB_WHITESMITH, JOB_BABY_BLACKSMITH, JOB_MECHANIC, JOB_MECHANIC_T, JOB_BABY_MECHANIC, fame_list_size_smith) ) + Sql_ShowDebug(inter->sql_handle); + for( i = 0; i < fame_list_size_smith && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { // char_id - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); smith_fame_list[i].id = atoi(data); // fame - SQL->GetData(sql_handle, 1, &data, &len); + SQL->GetData(inter->sql_handle, 1, &data, &len); smith_fame_list[i].fame = atoi(data); // name - SQL->GetData(sql_handle, 2, &data, &len); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(smith_fame_list[i].name, data, min(len, NAME_LENGTH)); } // Build Alchemist ranking list - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) - Sql_ShowDebug(sql_handle); - for( i = 0; i < fame_list_size_chemist && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) ) + Sql_ShowDebug(inter->sql_handle); + for( i = 0; i < fame_list_size_chemist && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { // char_id - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); chemist_fame_list[i].id = atoi(data); // fame - SQL->GetData(sql_handle, 1, &data, &len); + SQL->GetData(inter->sql_handle, 1, &data, &len); chemist_fame_list[i].fame = atoi(data); // name - SQL->GetData(sql_handle, 2, &data, &len); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(chemist_fame_list[i].name, data, min(len, NAME_LENGTH)); } // Build Taekwon ranking list - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) - Sql_ShowDebug(sql_handle); - for( i = 0; i < fame_list_size_taekwon && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", char_db, JOB_TAEKWON, fame_list_size_taekwon) ) + Sql_ShowDebug(inter->sql_handle); + for( i = 0; i < fame_list_size_taekwon && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { // char_id - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); taekwon_fame_list[i].id = atoi(data); // fame - SQL->GetData(sql_handle, 1, &data, &len); + SQL->GetData(inter->sql_handle, 1, &data, &len); taekwon_fame_list[i].fame = atoi(data); // name - SQL->GetData(sql_handle, 2, &data, &len); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(taekwon_fame_list[i].name, data, min(len, NAME_LENGTH)); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } // Send map-servers the fame ranking lists @@ -2871,9 +2925,9 @@ int char_send_fame_list(int fd) { WBUFW(buf, 2) = len; if (fd != -1) - mapif_send(fd, buf, len); + mapif->send(fd, buf, len); else - mapif_sendall(buf, len); + mapif->sendall(buf, len); return 0; } @@ -2884,7 +2938,7 @@ void char_update_fame_list(int type, int index, int fame) { WBUFB(buf,2) = type; WBUFB(buf,3) = index; WBUFL(buf,4) = fame; - mapif_sendall(buf, 8); + mapif->sendall(buf, 8); } //Loads a character's name and stores it in the buffer given (must be NAME_LENGTH in size) @@ -2894,11 +2948,11 @@ int char_loadName(int char_id, char* name) char* data; size_t len; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) - Sql_ShowDebug(sql_handle); - else if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { - SQL->GetData(sql_handle, 0, &data, &len); + SQL->GetData(inter->sql_handle, 0, &data, &len); safestrncpy(name, data, NAME_LENGTH); return 1; } @@ -2909,9 +2963,6 @@ int char_loadName(int char_id, char* name) return 0; } -int search_mapserver(unsigned short map, uint32 ip, uint16 port); - - /// Initializes a server structure. void mapif_server_init(int id) { @@ -2919,7 +2970,6 @@ void mapif_server_init(int id) server[id].fd = -1; } - /// Destroys a server structure. void mapif_server_destroy(int id) { @@ -2947,49 +2997,917 @@ void mapif_server_reset(int id) WBUFW(buf,10+(j++)*4) = server[id].map[i]; if (j > 0) { WBUFW(buf,2) = j * 4 + 10; - mapif_sendallwos(fd, buf, WBUFW(buf,2)); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); } - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, server[id].fd) ) - Sql_ShowDebug(sql_handle); - online_char_db->foreach(online_char_db,char_db_setoffline,id); //Tag relevant chars as 'in disconnected' server. - mapif_server_destroy(id); - mapif_server_init(id); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `index`='%d'", ragsrvinfo_db, server[id].fd) ) + Sql_ShowDebug(inter->sql_handle); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); //Tag relevant chars as 'in disconnected' server. + mapif->server_destroy(id); + mapif->server_init(id); } - /// Called when the connection to a Map Server is disconnected. void mapif_on_disconnect(int id) { ShowStatus("Map-server #%d has disconnected.\n", id); - mapif_server_reset(id); + mapif->server_reset(id); } void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { - WFIFOHEAD(login_fd,22); - WFIFOW(login_fd,0) = 0x2740; - WFIFOL(login_fd,2) = account_id; - WFIFOL(login_fd,6) = u_fd; - WFIFOL(login_fd,10) = u_aid; - WFIFOL(login_fd,14) = u_group; - WFIFOL(login_fd,18) = map_fd; - WFIFOSET(login_fd,22); + WFIFOHEAD(chr->login_fd,22); + WFIFOW(chr->login_fd,0) = 0x2740; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = u_fd; + WFIFOL(chr->login_fd,10) = u_aid; + WFIFOL(chr->login_fd,14) = u_group; + WFIFOL(chr->login_fd,18) = map_fd; + WFIFOSET(chr->login_fd,22); } -int parse_frommap(int fd) +void char_parse_frommap_datasync(int fd) { - int i, j; + sockt->datasync(fd, false); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_parse_frommap_skillid2idx(int fd) +{ + memset(&skillid2idx, 0, sizeof(skillid2idx)); + int i; + int j = RFIFOW(fd, 2) - 4; + if( j ) + j /= 4; + for(i = 0; i < j; i++) { + if( RFIFOW(fd, 4 + (i*4)) > MAX_SKILL_ID ) { + ShowWarning("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n",RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),MAX_SKILL_ID); + continue; + } + skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); + } + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_map_received_ok(int fd) +{ + WFIFOHEAD(fd, 3 + NAME_LENGTH); + WFIFOW(fd,0) = 0x2afb; + WFIFOB(fd,2) = 0; + memcpy(WFIFOP(fd,3), wisp_server_name, NAME_LENGTH); + WFIFOSET(fd,3+NAME_LENGTH); +} + +void char_send_maps(int fd, int id, int j) +{ + unsigned char buf[16384]; + int x; + if (j == 0) { + ShowWarning("Map-server %d has NO maps.\n", id); + } else { + // Transmitting maps information to the other map-servers + WBUFW(buf,0) = 0x2b04; + WBUFW(buf,2) = j * 4 + 10; + WBUFL(buf,4) = htonl(server[id].ip); + WBUFW(buf,8) = htons(server[id].port); + memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); + mapif->sendallwos(fd, buf, WBUFW(buf,2)); + } + // Transmitting the maps of the other map-servers to the new map-server + for(x = 0; x < ARRAYLENGTH(server); x++) { + if (server[x].fd > 0 && x != id) { + WFIFOHEAD(fd,10 +4*ARRAYLENGTH(server[x].map)); + WFIFOW(fd,0) = 0x2b04; + WFIFOL(fd,4) = htonl(server[x].ip); + WFIFOW(fd,8) = htons(server[x].port); + j = 0; + int i; + for(i = 0; i < ARRAYLENGTH(server[x].map); i++) + if (server[x].map[i]) + WFIFOW(fd,10+(j++)*4) = server[x].map[i]; + if (j > 0) { + WFIFOW(fd,2) = j * 4 + 10; + WFIFOSET(fd,WFIFOW(fd,2)); + } + } + } +} + +void char_parse_frommap_map_names(int fd, int id) +{ + if( server[id].map != NULL ) { aFree(server[id].map); server[id].map = NULL; } + + server[id].maps = ( RFIFOW(fd, 2) - 4 ) / 4; + CREATE(server[id].map, unsigned short, server[id].maps); + + int i; + int j = 0; + for(i = 4; i < RFIFOW(fd,2); i += 4) { + server[id].map[j] = RFIFOW(fd,i); + j++; + } + + ShowStatus("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d.\n", + id, j, CONVIP(server[id].ip), server[id].port); + ShowStatus("Map-server %d loading complete.\n", id); + + // send name for wisp to player + chr->map_received_ok(fd); + chr->send_fame_list(fd); //Send fame list. + chr->send_maps(fd, id, j); + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_send_scdata(int fd, int aid, int cid) +{ + #ifdef ENABLE_SC_SAVING + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", + scdata_db, aid, cid) ) + { + Sql_ShowDebug(inter->sql_handle); + return; + } + if( SQL->NumRows(inter->sql_handle) > 0 ) { + struct status_change_data scdata; + int count; + char* data; + + memset(&scdata, 0, sizeof(scdata)); + WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); + WFIFOW(fd,0) = 0x2b1d; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + for( count = 0; count < 50 && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++count ) + { + SQL->GetData(inter->sql_handle, 0, &data, NULL); scdata.type = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); scdata.tick = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); scdata.val4 = atoi(data); + memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); + } + if (count >= 50) + ShowWarning("Too many status changes for %d:%d, some of them were not loaded.\n", aid, cid); + if (count > 0) { + WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); + WFIFOW(fd,12) = count; + WFIFOSET(fd,WFIFOW(fd,2)); + + //Clear the data once loaded. + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + Sql_ShowDebug(inter->sql_handle); + } + } else { //no sc (needs a response) + WFIFOHEAD(fd,14); + WFIFOW(fd,0) = 0x2b1d; + WFIFOW(fd,2) = 14; + WFIFOL(fd,4) = aid; + WFIFOL(fd,8) = cid; + WFIFOW(fd,12) = 0; + WFIFOSET(fd,WFIFOW(fd,2)); + } + SQL->FreeResult(inter->sql_handle); + #endif +} + +void char_parse_frommap_request_scdata(int fd) +{ + #ifdef ENABLE_SC_SAVING + int aid = RFIFOL(fd,2); + int cid = RFIFOL(fd,6); + chr->send_scdata(fd, aid, cid); + #endif + RFIFOSKIP(fd, 10); +} + +void char_parse_frommap_set_users_count(int fd, int id) +{ + if (RFIFOW(fd,2) != server[id].users) { + server[id].users = RFIFOW(fd,2); + ShowInfo("User Count: %d (Server: %d)\n", server[id].users, id); + } + RFIFOSKIP(fd, 4); +} + +void char_parse_frommap_set_users(int fd, int id) +{ + //TODO: When data mismatches memory, update guild/party online/offline states. + int aid, cid; + struct online_char_data* character; + + server[id].users = RFIFOW(fd,4); + chr->online_char_db->foreach(chr->online_char_db,chr->db_setoffline,id); //Set all chars from this server as 'unknown' + int i; + for(i = 0; i < server[id].users; i++) { + aid = RFIFOL(fd,6+i*8); + cid = RFIFOL(fd,6+i*8+4); + character = idb_ensure(chr->online_char_db, aid, chr->create_online_char_data); + if( character->server > -1 && character->server != id ) + { + ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n", + character->account_id, character->char_id, character->server, id, aid, cid); + mapif->disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); + } + character->server = id; + character->char_id = cid; + } + //If any chars remain in -2, they will be cleaned in the cleanup timer. + RFIFOSKIP(fd,RFIFOW(fd,2)); +} + +void char_save_character_ack(int fd, int aid, int cid) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x2b21; //Save ack only needed on final save. + WFIFOL(fd,2) = aid; + WFIFOL(fd,6) = cid; + WFIFOSET(fd,10); +} + +void char_parse_frommap_save_character(int fd, int id) +{ + int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); + struct online_char_data* character; + + if (size - 13 != sizeof(struct mmo_charstatus)) { + ShowError("parse_from_map (save-char): Size mismatch! %d != %"PRIuS"\n", size-13, sizeof(struct mmo_charstatus)); + RFIFOSKIP(fd,size); + return; + } + //Check account only if this ain't final save. Final-save goes through because of the char-map reconnect + if (RFIFOB(fd,12) || ( + (character = (struct online_char_data*)idb_get(chr->online_char_db, aid)) != NULL && + character->char_id == cid)) + { + struct mmo_charstatus char_dat; + memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); + chr->mmo_char_tosql(cid, &char_dat); + } else { //This may be valid on char-server reconnection, when re-sending characters that already logged off. + ShowError("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n", aid, cid); + chr->set_char_online(id, cid, aid); + } + + if (RFIFOB(fd,12)) + { //Flag, set character offline after saving. [Skotlex] + chr->set_char_offline(cid, aid); + chr->save_character_ack(fd, aid, cid); + } + RFIFOSKIP(fd,size); +} + +// 0 - not ok +// 1 - ok +void char_select_ack(int fd, int account_id, uint8 flag) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x2b03; + WFIFOL(fd,2) = account_id; + WFIFOB(fd,6) = flag; + WFIFOSET(fd,7); +} + +void char_parse_frommap_char_select_req(int fd) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + uint32 ip = RFIFOL(fd,14); + int32 group_id = RFIFOL(fd, 18); + RFIFOSKIP(fd,22); + + if( runflag != CHARSERVER_ST_RUNNING ) + { + chr->select_ack(fd, account_id, 0); + } + else + { + struct char_auth_node* node; + + // create temporary auth entry + CREATE(node, struct char_auth_node, 1); + node->account_id = account_id; + node->char_id = 0; + node->login_id1 = login_id1; + node->login_id2 = login_id2; + node->group_id = group_id; + //node->sex = 0; + node->ip = ntohl(ip); + /* sounds troublesome. */ + //node->expiration_time = 0; // unlimited/unknown time by default (not display in map-server) + //node->gmlevel = 0; + idb_put(auth_db, account_id, node); + + //Set char to "@ char select" in online db [Kevin] + chr->set_char_charselect(account_id); + chr->select_ack(fd, account_id, 1); + } +} + +void char_change_map_server_ack(int fd, uint8 *data, bool ok) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b06; + memcpy(WFIFOP(fd,2), data, 28); + if (!ok) + WFIFOL(fd,6) = 0; //Set login1 to 0. + WFIFOSET(fd,30); +} + +void char_parse_frommap_change_map_server(int fd) +{ + int map_id, map_fd = -1; + struct mmo_charstatus* char_data; + + map_id = chr->search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); //Locate mapserver by ip and port. + if (map_id >= 0) + map_fd = server[map_id].fd; + //Char should just had been saved before this packet, so this should be safe. [Skotlex] + char_data = (struct mmo_charstatus*)uidb_get(chr->char_db_,RFIFOL(fd,14)); + if (char_data == NULL) { //Really shouldn't happen. + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(RFIFOL(fd,14), &char_dat, true); + char_data = (struct mmo_charstatus*)uidb_get(chr->char_db_,RFIFOL(fd,14)); + } + + if( runflag == CHARSERVER_ST_RUNNING && + session_isActive(map_fd) && + char_data ) + { //Send the map server the auth of this player. + struct online_char_data* data; + struct char_auth_node* node; + + //Update the "last map" as this is where the player must be spawned on the new map server. + char_data->last_point.map = RFIFOW(fd,18); + char_data->last_point.x = RFIFOW(fd,20); + char_data->last_point.y = RFIFOW(fd,22); + char_data->sex = RFIFOB(fd,30); + + // create temporary auth entry + CREATE(node, struct char_auth_node, 1); + node->account_id = RFIFOL(fd,2); + node->char_id = RFIFOL(fd,14); + node->login_id1 = RFIFOL(fd,6); + node->login_id2 = RFIFOL(fd,10); + node->sex = RFIFOB(fd,30); + node->expiration_time = 0; // FIXME (this thing isn't really supported we could as well purge it instead of fixing) + node->ip = ntohl(RFIFOL(fd,31)); + node->group_id = RFIFOL(fd,35); + node->changing_mapservers = 1; + idb_put(auth_db, RFIFOL(fd,2), node); + + data = idb_ensure(chr->online_char_db, RFIFOL(fd,2), chr->create_online_char_data); + data->char_id = char_data->char_id; + data->server = map_id; //Update server where char is. + + //Reply with an ack. + chr->change_map_server_ack(fd, RFIFOP(fd,2), true); + } else { //Reply with nak + chr->change_map_server_ack(fd, RFIFOP(fd,2), false); + } + RFIFOSKIP(fd,39); +} + +void char_parse_frommap_remove_friend(int fd) +{ + int char_id = RFIFOL(fd,2); + int friend_id = RFIFOL(fd,6); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", + friend_db, char_id, friend_id) ) { + Sql_ShowDebug(inter->sql_handle); + } + RFIFOSKIP(fd,10); +} + +void char_char_name_ack(int fd, int char_id) +{ + WFIFOHEAD(fd,30); + WFIFOW(fd,0) = 0x2b09; + WFIFOL(fd,2) = char_id; + chr->loadName(char_id, (char*)WFIFOP(fd,6)); + WFIFOSET(fd,30); +} + +void char_parse_frommap_char_name_request(int fd) +{ + chr->char_name_ack(fd, RFIFOL(fd,2)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_change_email(int fd) +{ + if (chr->login_fd > 0) { // don't send request if no login-server + WFIFOHEAD(chr->login_fd,86); + memcpy(WFIFOP(chr->login_fd,0), RFIFOP(fd,0),86); // 0x2722 <account_id>.L <actual_e-mail>.40B <new_e-mail>.40B + WFIFOW(chr->login_fd,0) = 0x2722; + WFIFOSET(chr->login_fd,86); + } + RFIFOSKIP(fd, 86); +} + +void loginif_block_account(int account_id, int flag) +{ + WFIFOHEAD(chr->login_fd,10); + WFIFOW(chr->login_fd,0) = 0x2724; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOL(chr->login_fd,6) = flag; // new account status + WFIFOSET(chr->login_fd,10); +} + +void loginif_ban_account(int account_id, short year, short month, short day, short hour, short minute, short second) +{ + WFIFOHEAD(chr->login_fd,18); + WFIFOW(chr->login_fd, 0) = 0x2725; + WFIFOL(chr->login_fd, 2) = account_id; + WFIFOW(chr->login_fd, 6) = year; + WFIFOW(chr->login_fd, 8) = month; + WFIFOW(chr->login_fd,10) = day; + WFIFOW(chr->login_fd,12) = hour; + WFIFOW(chr->login_fd,14) = minute; + WFIFOW(chr->login_fd,16) = second; + WFIFOSET(chr->login_fd,18); +} + +void loginif_unban_account(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x272a; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void loginif_changesex(int account_id) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2727; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); +} + +void mapif_char_ban(int char_id, time_t timestamp) +{ + unsigned char buf[11]; + WBUFW(buf,0) = 0x2b14; + WBUFL(buf,2) = char_id; + WBUFB(buf,6) = 2; + WBUFL(buf,7) = (unsigned int)timestamp; + mapif->sendall(buf, 11); +} + +void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +{ + time_t timestamp; + struct tm *tmtime; + SqlStmt* stmt = SQL->StmtMalloc(inter->sql_handle); + + if (*unban_time == 0 || *unban_time < time(NULL)) + timestamp = time(NULL); // new ban + else + timestamp = *unban_time; // add to existing ban + + tmtime = localtime(×tamp); + tmtime->tm_year = tmtime->tm_year + year; + tmtime->tm_mon = tmtime->tm_mon + month; + tmtime->tm_mday = tmtime->tm_mday + day; + tmtime->tm_hour = tmtime->tm_hour + hour; + tmtime->tm_min = tmtime->tm_min + minute; + tmtime->tm_sec = tmtime->tm_sec + second; + timestamp = mktime(tmtime); + + if( SQL_SUCCESS != SQL->StmtPrepare(stmt, + "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", + char_db) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, (void*)×tamp, sizeof(timestamp)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_INT, (void*)&char_id, sizeof(char_id)) + || SQL_SUCCESS != SQL->StmtExecute(stmt) + + ) { + SqlStmt_ShowDebug(stmt); + } + + SQL->StmtFree(stmt); + + // condition applies; send to all map-servers to disconnect the player + if( timestamp > time(NULL) ) { + mapif->char_ban(char_id, timestamp); + // disconnect player if online on char-server + chr->disconnect_player(account_id); + } +} + +void char_unban(int char_id, int *result) +{ + /* handled by char server, so no redirection */ + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { + Sql_ShowDebug(inter->sql_handle); + *result = 1; + } +} + +void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +{ + WFIFOHEAD(fd,34); + WFIFOW(fd, 0) = 0x2b0f; + WFIFOL(fd, 2) = acc; + safestrncpy((char*)WFIFOP(fd,6), name, NAME_LENGTH); + WFIFOW(fd,30) = type; + WFIFOW(fd,32) = result; + WFIFOSET(fd,34); +} + +void char_parse_frommap_change_account(int fd) +{ + int result = 0; // 0-login-server request done, 1-player not found, 2-gm level too low, 3-login-server offline + char esc_name[NAME_LENGTH*2+1]; + + int acc = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request) + const char* name = (char*)RFIFOP(fd,6); // name of the target character + int type = RFIFOW(fd,30); // type of operation: 1-block, 2-ban, 3-unblock, 4-unban, 5 changesex, 6 charban, 7 charunban + short year = RFIFOW(fd,32); + short month = RFIFOW(fd,34); + short day = RFIFOW(fd,36); + short hour = RFIFOW(fd,38); + short minute = RFIFOW(fd,40); + short second = RFIFOW(fd,42); + RFIFOSKIP(fd,44); + + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); + + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL->NumRows(inter->sql_handle) == 0 ) { + result = 1; // 1-player not found + } else if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { + Sql_ShowDebug(inter->sql_handle); + result = 1; // 1-player not found + } else { + int account_id, char_id; + char* data; + time_t unban_time; + + SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); unban_time = atol(data); + + if( chr->login_fd <= 0 ) + result = 3; // 3-login-server offline + //FIXME: need to move this check to login server [ultramage] + // else + // if( acc != -1 && isGM(acc) < isGM(account_id) ) + // result = 2; // 2-gm level too low + else { + switch( type ) { + case 1: // block + loginif->block_account(account_id, 5); + break; + case 2: // ban + loginif->ban_account(account_id, year, month, day, hour, minute, second); + break; + case 3: // unblock + loginif->block_account(account_id, 0); + break; + case 4: // unban + loginif->unban_account(account_id); + break; + case 5: // changesex + loginif->changesex(account_id); + break; + case 6: //char ban + /* handled by char server, so no redirection */ + { + chr->ban(account_id, char_id, &unban_time, year, month, day, hour, minute, second); + } + break; + case 7: //char unban + chr->unban(char_id, &result); + break; + + } + } + } + + SQL->FreeResult(inter->sql_handle); + + // send answer if a player ask, not if the server ask + if( acc != -1 && type != 5 ) { // Don't send answer for changesex + chr->ask_name_ack(fd, acc, name, type, result); + } +} + +void char_parse_frommap_fame_list(int fd) +{ + int cid = RFIFOL(fd, 2); + int fame = RFIFOL(fd, 6); + char type = RFIFOB(fd, 10); + int size; + struct fame_list* list; + int player_pos; + int fame_pos; + + switch(type) { + case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; + default: size = 0; list = NULL; break; + } + + ARR_FIND(0, size, player_pos, list[player_pos].id == cid);// position of the player + ARR_FIND(0, size, fame_pos, list[fame_pos].fame <= fame);// where the player should be + + if( player_pos == size && fame_pos == size ) + ;// not on list and not enough fame to get on it + else if( fame_pos == player_pos ) { + // same position + list[player_pos].fame = fame; + chr->update_fame_list(type, player_pos, fame); + } else { + // move in the list + if( player_pos == size ) { + // new ranker - not in the list + ARR_MOVE(size - 1, fame_pos, list, struct fame_list); + list[fame_pos].id = cid; + list[fame_pos].fame = fame; + chr->loadName(cid, list[fame_pos].name); + } else { + // already in the list + if( fame_pos == size ) + --fame_pos;// move to the end of the list + ARR_MOVE(player_pos, fame_pos, list, struct fame_list); + list[fame_pos].fame = fame; + } + chr->send_fame_list(-1); + } + + RFIFOSKIP(fd,11); +} + +void char_parse_frommap_divorce_char(int fd) +{ + chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_ragsrvinfo(int fd) +{ + char esc_server_name[sizeof(server_name)*2+1]; + + SQL->EscapeString(inter->sql_handle, esc_server_name, server_name); + + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'", + ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) + { + Sql_ShowDebug(inter->sql_handle); + } + RFIFOSKIP(fd,14); +} + +void char_parse_frommap_set_char_offline(int fd) +{ + chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_set_all_offline(int fd, int id) +{ + chr->set_all_offline(id); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_set_char_online(int fd, int id) +{ + chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); + RFIFOSKIP(fd,10); +} + +void char_parse_frommap_build_fame_list(int fd) +{ + chr->read_fame_list(); + chr->send_fame_list(-1); + RFIFOSKIP(fd,2); +} + +void char_parse_frommap_save_status_change_data(int fd) +{ + #ifdef ENABLE_SC_SAVING + int aid = RFIFOL(fd, 4); + int cid = RFIFOL(fd, 8); + int count = RFIFOW(fd, 12); + + /* clear; ensure no left overs e.g. permanent */ + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) + Sql_ShowDebug(inter->sql_handle); + + if( count > 0 ) + { + struct status_change_data data; + StringBuf buf; + + StrBuf->Init(&buf); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + int i; + for( i = 0; i < count; ++i ) + { + memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); + if( i > 0 ) + StrBuf->AppendStr(&buf, ", "); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + } + if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) + Sql_ShowDebug(inter->sql_handle); + StrBuf->Destroy(&buf); + } + #endif + RFIFOSKIP(fd, RFIFOW(fd, 2)); +} + +void char_send_pong(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x2b24; + WFIFOSET(fd,2); +} + +void char_parse_frommap_ping(int fd) +{ + chr->send_pong(fd); + RFIFOSKIP(fd,2); +} + +void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +{ + WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); + WFIFOW(fd,0) = 0x2afd; + WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); + WFIFOL(fd,4) = account_id; + if (node) + { + WFIFOL(fd,8) = node->login_id1; + WFIFOL(fd,12) = node->login_id2; + WFIFOL(fd,16) = (uint32)node->expiration_time; // FIXME: will wrap to negative after "19-Jan-2038, 03:14:07 AM GMT" + WFIFOL(fd,20) = node->group_id; + WFIFOB(fd,24) = node->changing_mapservers; + } + else + { + WFIFOL(fd,8) = 0; + WFIFOL(fd,12) = 0; + WFIFOL(fd,16) = 0; + WFIFOL(fd,20) = 0; + WFIFOB(fd,24) = 0; + } + memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); + WFIFOSET(fd, WFIFOW(fd,2)); +} + +void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +{ + WFIFOHEAD(fd,19); + WFIFOW(fd,0) = 0x2b27; + WFIFOL(fd,2) = account_id; + WFIFOL(fd,6) = char_id; + WFIFOL(fd,10) = login_id1; + WFIFOB(fd,14) = sex; + WFIFOL(fd,15) = htonl(ip); + WFIFOSET(fd,19); +} + +void char_parse_frommap_auth_request(int fd, int id) +{ + struct mmo_charstatus char_dat; + + int account_id = RFIFOL(fd,2); + int char_id = RFIFOL(fd,6); + int login_id1 = RFIFOL(fd,10); + char sex = RFIFOB(fd,14); + uint32 ip = ntohl(RFIFOL(fd,15)); + char standalone = RFIFOB(fd, 19); + RFIFOSKIP(fd,20); + + struct char_auth_node* node = (struct char_auth_node*)idb_get(auth_db, account_id); + struct mmo_charstatus* cd = (struct mmo_charstatus*)uidb_get(chr->char_db_,char_id); + + if( cd == NULL ) { //Really shouldn't happen. + chr->mmo_char_fromsql(char_id, &char_dat, true); + cd = (struct mmo_charstatus*)uidb_get(chr->char_db_,char_id); + } + + if( runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, NULL, cd); + chr->set_char_online(id, char_id, account_id); + return; + } + + if( runflag == CHARSERVER_ST_RUNNING && + cd != NULL && + node != NULL && + node->account_id == account_id && + node->char_id == char_id && + node->login_id1 == login_id1 /*&& + node->sex == sex && + node->ip == ip*/ ) + {// auth ok + if( cd->sex == 99 ) + cd->sex = sex; + + chr->map_auth_ok(fd, account_id, node, cd); + // only use the auth once and mark user online + idb_remove(auth_db, account_id); + chr->set_char_online(id, char_id, account_id); + } + else + {// auth failed + chr->map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } +} + +void char_parse_frommap_update_ip(int fd, int id) +{ + server[id].ip = ntohl(RFIFOL(fd, 2)); + ShowInfo("Updated IP address of map-server #%d to %d.%d.%d.%d.\n", id, CONVIP(server[id].ip)); + RFIFOSKIP(fd,6); +} + +void char_parse_frommap_request_stats_report(int fd) +{ + int sfd;/* stat server fd */ + struct hSockOpt opt; + RFIFOSKIP(fd, 2);/* we skip first 2 bytes which are the 0x3008, so we end up with a buffer equal to the one we send */ + + opt.silent = 1; + opt.setTimeo = 1; + + if( (sfd = make_connection(host2ip("stats.hercules.ws"),(uint16)25427,&opt) ) == -1 ) { + RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ + RFIFOFLUSH(fd); + return;/* connection not possible, we drop the report */ + } + + session[sfd]->flag.server = 1;/* to ensure we won't drop our own packet */ + realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + WFIFOHEAD(sfd, RFIFOW(fd,2) ); + + memcpy((char*)WFIFOP(sfd,0), (char*)RFIFOP(fd, 0), RFIFOW(fd,2)); + + WFIFOSET(sfd, RFIFOW(fd,2) ); + + flush_fifo(sfd); + + do_close(sfd); + + RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ + RFIFOFLUSH(fd); +} + +void char_parse_frommap_scdata_update(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + int val1 = RFIFOL(fd, 12); + int val2 = RFIFOL(fd, 16); + int val3 = RFIFOL(fd, 20); + int val4 = RFIFOL(fd, 24); + short type = RFIFOW(fd, 10); + + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`) VALUES ('%d','%d','%d',-1,'%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, val1, val2, val3, val4) ) + { + Sql_ShowDebug(inter->sql_handle); + } + RFIFOSKIP(fd, 28); +} + +void char_parse_frommap_scdata_delete(int fd) +{ + int account_id = RFIFOL(fd, 2); + int char_id = RFIFOL(fd, 6); + short type = RFIFOW(fd, 10); + + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", + scdata_db, account_id, char_id, type) ) + { + Sql_ShowDebug(inter->sql_handle); + } + RFIFOSKIP(fd, 12); +} + +int char_parse_frommap(int fd) +{ + int i; int id; ARR_FIND( 0, ARRAYLENGTH(server), id, server[id].fd == fd ); if( id == ARRAYLENGTH(server) ) {// not a map server - ShowDebug("parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n", fd); + ShowDebug("chr->parse_frommap: Disconnecting invalid session #%d (is not a map-server)\n", fd); do_close(fd); return 0; } if( session[fd]->flag.eof ) { do_close(fd); server[id].fd = -1; - mapif_on_disconnect(id); + mapif->on_disconnect(id); return 0; } @@ -3007,184 +3925,39 @@ int parse_frommap(int fd) case 0x2b0a: if( RFIFOREST(fd) < RFIFOW(fd, 2) ) return 0; - sockt->datasync(fd, false); - RFIFOSKIP(fd,RFIFOW(fd,2)); + chr->parse_frommap_datasync(fd); break; case 0x2b0b: if( RFIFOREST(fd) < RFIFOW(fd, 2) ) return 0; - memset(&skillid2idx, 0, sizeof(skillid2idx)); - j = RFIFOW(fd, 2) - 4; - if( j ) - j /= 4; - for(i = 0; i < j; i++) { - if( RFIFOW(fd, 4 + (i*4)) > MAX_SKILL_ID ) { - ShowWarning("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n",RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),MAX_SKILL_ID); - continue; - } - skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); - } - RFIFOSKIP(fd, RFIFOW(fd, 2)); + chr->parse_frommap_skillid2idx(fd); break; case 0x2afa: // Receiving map names list from the map-server if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; - if( server[id].map != NULL ) { aFree(server[id].map); server[id].map = NULL; } - - server[id].maps = ( RFIFOW(fd, 2) - 4 ) / 4; - CREATE(server[id].map, unsigned short, server[id].maps); - - j = 0; - for(i = 4; i < RFIFOW(fd,2); i += 4) { - server[id].map[j] = RFIFOW(fd,i); - j++; - } - - ShowStatus("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d.\n", - id, j, CONVIP(server[id].ip), server[id].port); - ShowStatus("Map-server %d loading complete.\n", id); - - // send name for wisp to player - WFIFOHEAD(fd, 3 + NAME_LENGTH); - WFIFOW(fd,0) = 0x2afb; - WFIFOB(fd,2) = 0; - memcpy(WFIFOP(fd,3), wisp_server_name, NAME_LENGTH); - WFIFOSET(fd,3+NAME_LENGTH); - - char_send_fame_list(fd); //Send fame list. - - { - unsigned char buf[16384]; - int x; - if (j == 0) { - ShowWarning("Map-server %d has NO maps.\n", id); - } else { - // Transmitting maps information to the other map-servers - WBUFW(buf,0) = 0x2b04; - WBUFW(buf,2) = j * 4 + 10; - WBUFL(buf,4) = htonl(server[id].ip); - WBUFW(buf,8) = htons(server[id].port); - memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4); - mapif_sendallwos(fd, buf, WBUFW(buf,2)); - } - // Transmitting the maps of the other map-servers to the new map-server - for(x = 0; x < ARRAYLENGTH(server); x++) { - if (server[x].fd > 0 && x != id) { - WFIFOHEAD(fd,10 +4*ARRAYLENGTH(server[x].map)); - WFIFOW(fd,0) = 0x2b04; - WFIFOL(fd,4) = htonl(server[x].ip); - WFIFOW(fd,8) = htons(server[x].port); - j = 0; - for(i = 0; i < ARRAYLENGTH(server[x].map); i++) - if (server[x].map[i]) - WFIFOW(fd,10+(j++)*4) = server[x].map[i]; - if (j > 0) { - WFIFOW(fd,2) = j * 4 + 10; - WFIFOSET(fd,WFIFOW(fd,2)); - } - } - } - } - RFIFOSKIP(fd,RFIFOW(fd,2)); + chr->parse_frommap_map_names(fd, id); break; case 0x2afc: //Packet command is now used for sc_data request. [Skotlex] if (RFIFOREST(fd) < 10) return 0; { - #ifdef ENABLE_SC_SAVING - int aid, cid; - aid = RFIFOL(fd,2); - cid = RFIFOL(fd,6); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " - "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", - scdata_db, aid, cid) ) - { - Sql_ShowDebug(sql_handle); - break; - } - if( SQL->NumRows(sql_handle) > 0 ) { - struct status_change_data scdata; - int count; - char* data; - - memset(&scdata, 0, sizeof(scdata)); - WFIFOHEAD(fd,14+50*sizeof(struct status_change_data)); - WFIFOW(fd,0) = 0x2b1d; - WFIFOL(fd,4) = aid; - WFIFOL(fd,8) = cid; - for( count = 0; count < 50 && SQL_SUCCESS == SQL->NextRow(sql_handle); ++count ) - { - SQL->GetData(sql_handle, 0, &data, NULL); scdata.type = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); scdata.tick = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); scdata.val1 = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); scdata.val2 = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); scdata.val3 = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); scdata.val4 = atoi(data); - memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); - } - if (count >= 50) - ShowWarning("Too many status changes for %d:%d, some of them were not loaded.\n", aid, cid); - if (count > 0) { - WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data); - WFIFOW(fd,12) = count; - WFIFOSET(fd,WFIFOW(fd,2)); - - //Clear the data once loaded. - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) - Sql_ShowDebug(sql_handle); - } - } else { //no sc (needs a response) - WFIFOHEAD(fd,14); - WFIFOW(fd,0) = 0x2b1d; - WFIFOW(fd,2) = 14; - WFIFOL(fd,4) = aid; - WFIFOL(fd,8) = cid; - WFIFOW(fd,12) = 0; - WFIFOSET(fd,WFIFOW(fd,2)); - } - SQL->FreeResult(sql_handle); - #endif - RFIFOSKIP(fd, 10); + chr->parse_frommap_request_scdata(fd); } break; case 0x2afe: //set MAP user count if (RFIFOREST(fd) < 4) return 0; - if (RFIFOW(fd,2) != server[id].users) { - server[id].users = RFIFOW(fd,2); - ShowInfo("User Count: %d (Server: %d)\n", server[id].users, id); - } - RFIFOSKIP(fd, 4); + chr->parse_frommap_set_users_count(fd, id); break; case 0x2aff: //set MAP users if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; { - //TODO: When data mismatches memory, update guild/party online/offline states. - int aid, cid; - struct online_char_data* character; - - server[id].users = RFIFOW(fd,4); - online_char_db->foreach(online_char_db,char_db_setoffline,id); //Set all chars from this server as 'unknown' - for(i = 0; i < server[id].users; i++) { - aid = RFIFOL(fd,6+i*8); - cid = RFIFOL(fd,6+i*8+4); - character = idb_ensure(online_char_db, aid, create_online_char_data); - if( character->server > -1 && character->server != id ) - { - ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n", - character->account_id, character->char_id, character->server, id, aid, cid); - mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2); - } - character->server = id; - character->char_id = cid; - } - //If any chars remain in -2, they will be cleaned in the cleanup timer. - RFIFOSKIP(fd,RFIFOW(fd,2)); + chr->parse_frommap_set_users(fd, id); } break; @@ -3192,37 +3965,8 @@ int parse_frommap(int fd) if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; { - int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); - struct online_char_data* character; + chr->parse_frommap_save_character(fd, id); - if (size - 13 != sizeof(struct mmo_charstatus)) { - ShowError("parse_from_map (save-char): Size mismatch! %d != %"PRIuS"\n", size-13, sizeof(struct mmo_charstatus)); - RFIFOSKIP(fd,size); - break; - } - //Check account only if this ain't final save. Final-save goes through because of the char-map reconnect - if (RFIFOB(fd,12) || ( - (character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL && - character->char_id == cid)) - { - struct mmo_charstatus char_dat; - memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus)); - mmo_char_tosql(cid, &char_dat); - } else { //This may be valid on char-server reconnection, when re-sending characters that already logged off. - ShowError("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n", aid, cid); - set_char_online(id, cid, aid); - } - - if (RFIFOB(fd,12)) - { //Flag, set character offline after saving. [Skotlex] - set_char_offline(cid, aid); - WFIFOHEAD(fd,10); - WFIFOW(fd,0) = 0x2b21; //Save ack only needed on final save. - WFIFOL(fd,2) = aid; - WFIFOL(fd,6) = cid; - WFIFOSET(fd,10); - } - RFIFOSKIP(fd,size); } break; @@ -3230,48 +3974,7 @@ int parse_frommap(int fd) if( RFIFOREST(fd) < 22 ) return 0; { - int account_id = RFIFOL(fd,2); - uint32 login_id1 = RFIFOL(fd,6); - uint32 login_id2 = RFIFOL(fd,10); - uint32 ip = RFIFOL(fd,14); - int32 group_id = RFIFOL(fd, 18); - RFIFOSKIP(fd,22); - - if( runflag != CHARSERVER_ST_RUNNING ) - { - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x2b03; - WFIFOL(fd,2) = account_id; - WFIFOB(fd,6) = 0;// not ok - WFIFOSET(fd,7); - } - else - { - struct auth_node* node; - - // create temporary auth entry - CREATE(node, struct auth_node, 1); - node->account_id = account_id; - node->char_id = 0; - node->login_id1 = login_id1; - node->login_id2 = login_id2; - node->group_id = group_id; - //node->sex = 0; - node->ip = ntohl(ip); - /* sounds troublesome. */ - //node->expiration_time = 0; // unlimited/unknown time by default (not display in map-server) - //node->gmlevel = 0; - idb_put(auth_db, account_id, node); - - //Set char to "@ char select" in online db [Kevin] - set_char_charselect(account_id); - - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x2b03; - WFIFOL(fd,2) = account_id; - WFIFOB(fd,6) = 1;// ok - WFIFOSET(fd,7); - } + chr->parse_frommap_char_select_req(fd); } break; @@ -3279,63 +3982,7 @@ int parse_frommap(int fd) if (RFIFOREST(fd) < 39) return 0; { - int map_id, map_fd = -1; - struct mmo_charstatus* char_data; - - map_id = search_mapserver(RFIFOW(fd,18), ntohl(RFIFOL(fd,24)), ntohs(RFIFOW(fd,28))); //Locate mapserver by ip and port. - if (map_id >= 0) - map_fd = server[map_id].fd; - //Char should just had been saved before this packet, so this should be safe. [Skotlex] - char_data = (struct mmo_charstatus*)uidb_get(char_db_,RFIFOL(fd,14)); - if (char_data == NULL) { //Really shouldn't happen. - struct mmo_charstatus char_dat; - mmo_char_fromsql(RFIFOL(fd,14), &char_dat, true); - char_data = (struct mmo_charstatus*)uidb_get(char_db_,RFIFOL(fd,14)); - } - - if( runflag == CHARSERVER_ST_RUNNING && - session_isActive(map_fd) && - char_data ) - { //Send the map server the auth of this player. - struct online_char_data* data; - struct auth_node* node; - - //Update the "last map" as this is where the player must be spawned on the new map server. - char_data->last_point.map = RFIFOW(fd,18); - char_data->last_point.x = RFIFOW(fd,20); - char_data->last_point.y = RFIFOW(fd,22); - char_data->sex = RFIFOB(fd,30); - - // create temporary auth entry - CREATE(node, struct auth_node, 1); - node->account_id = RFIFOL(fd,2); - node->char_id = RFIFOL(fd,14); - node->login_id1 = RFIFOL(fd,6); - node->login_id2 = RFIFOL(fd,10); - node->sex = RFIFOB(fd,30); - node->expiration_time = 0; // FIXME (this thing isn't really supported we could as well purge it instead of fixing) - node->ip = ntohl(RFIFOL(fd,31)); - node->group_id = RFIFOL(fd,35); - node->changing_mapservers = 1; - idb_put(auth_db, RFIFOL(fd,2), node); - - data = idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data); - data->char_id = char_data->char_id; - data->server = map_id; //Update server where char is. - - //Reply with an ack. - WFIFOHEAD(fd,30); - WFIFOW(fd,0) = 0x2b06; - memcpy(WFIFOP(fd,2), RFIFOP(fd,2), 28); - WFIFOSET(fd,30); - } else { //Reply with nak - WFIFOHEAD(fd,30); - WFIFOW(fd,0) = 0x2b06; - memcpy(WFIFOP(fd,2), RFIFOP(fd,2), 28); - WFIFOL(fd,6) = 0; //Set login1 to 0. - WFIFOSET(fd,30); - } - RFIFOSKIP(fd,39); + chr->parse_frommap_change_map_server(fd); } break; @@ -3343,15 +3990,7 @@ int parse_frommap(int fd) if (RFIFOREST(fd) < 10) return 0; { - int char_id, friend_id; - char_id = RFIFOL(fd,2); - friend_id = RFIFOL(fd,6); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1", - friend_db, char_id, friend_id) ) { - Sql_ShowDebug(sql_handle); - break; - } - RFIFOSKIP(fd,10); + chr->parse_frommap_remove_friend(fd); } break; @@ -3359,182 +3998,20 @@ int parse_frommap(int fd) if (RFIFOREST(fd) < 6) return 0; - WFIFOHEAD(fd,30); - WFIFOW(fd,0) = 0x2b09; - WFIFOL(fd,2) = RFIFOL(fd,2); - char_loadName((int)RFIFOL(fd,2), (char*)WFIFOP(fd,6)); - WFIFOSET(fd,30); - - RFIFOSKIP(fd,6); + chr->parse_frommap_char_name_request(fd); break; case 0x2b0c: // Map server send information to change an email of an account -> login-server if (RFIFOREST(fd) < 86) return 0; - if (login_fd > 0) { // don't send request if no login-server - WFIFOHEAD(login_fd,86); - memcpy(WFIFOP(login_fd,0), RFIFOP(fd,0),86); // 0x2722 <account_id>.L <actual_e-mail>.40B <new_e-mail>.40B - WFIFOW(login_fd,0) = 0x2722; - WFIFOSET(login_fd,86); - } - RFIFOSKIP(fd, 86); + chr->parse_frommap_change_email(fd); break; case 0x2b0e: // Request from map-server to change an account's or character's status (accounts will just be forwarded to login server) if (RFIFOREST(fd) < 44) return 0; { - int result = 0; // 0-login-server request done, 1-player not found, 2-gm level too low, 3-login-server offline - char esc_name[NAME_LENGTH*2+1]; - - int acc = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request) - const char* name = (char*)RFIFOP(fd,6); // name of the target character - int type = RFIFOW(fd,30); // type of operation: 1-block, 2-ban, 3-unblock, 4-unban, 5 changesex, 6 charban, 7 charunban - short year = RFIFOW(fd,32); - short month = RFIFOW(fd,34); - short day = RFIFOW(fd,36); - short hour = RFIFOW(fd,38); - short minute = RFIFOW(fd,40); - short second = RFIFOW(fd,42); - RFIFOSKIP(fd,44); - - SQL->EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); - - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`char_id`,`unban_time` FROM `%s` WHERE `name` = '%s'", char_db, esc_name) ) - Sql_ShowDebug(sql_handle); - else if( SQL->NumRows(sql_handle) == 0 ) { - result = 1; // 1-player not found - } else if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) { - Sql_ShowDebug(sql_handle); - result = 1; // 1-player not found - } else { - int account_id, char_id; - char* data; - time_t unban_time; - - SQL->GetData(sql_handle, 0, &data, NULL); account_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); char_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); unban_time = atol(data); - - if( login_fd <= 0 ) - result = 3; // 3-login-server offline - //FIXME: need to move this check to login server [ultramage] - // else - // if( acc != -1 && isGM(acc) < isGM(account_id) ) - // result = 2; // 2-gm level too low - else { - switch( type ) { - case 1: // block - WFIFOHEAD(login_fd,10); - WFIFOW(login_fd,0) = 0x2724; - WFIFOL(login_fd,2) = account_id; - WFIFOL(login_fd,6) = 5; // new account status - WFIFOSET(login_fd,10); - break; - case 2: // ban - WFIFOHEAD(login_fd,18); - WFIFOW(login_fd, 0) = 0x2725; - WFIFOL(login_fd, 2) = account_id; - WFIFOW(login_fd, 6) = year; - WFIFOW(login_fd, 8) = month; - WFIFOW(login_fd,10) = day; - WFIFOW(login_fd,12) = hour; - WFIFOW(login_fd,14) = minute; - WFIFOW(login_fd,16) = second; - WFIFOSET(login_fd,18); - break; - case 3: // unblock - WFIFOHEAD(login_fd,10); - WFIFOW(login_fd,0) = 0x2724; - WFIFOL(login_fd,2) = account_id; - WFIFOL(login_fd,6) = 0; // new account status - WFIFOSET(login_fd,10); - break; - case 4: // unban - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x272a; - WFIFOL(login_fd,2) = account_id; - WFIFOSET(login_fd,6); - break; - case 5: // changesex - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x2727; - WFIFOL(login_fd,2) = account_id; - WFIFOSET(login_fd,6); - break; - case 6: //char ban - /* handled by char server, so no redirection */ - { - time_t timestamp; - struct tm *tmtime; - SqlStmt* stmt = SQL->StmtMalloc(sql_handle); - - if (unban_time == 0 || unban_time < time(NULL)) - timestamp = time(NULL); // new ban - else - timestamp = unban_time; // add to existing ban - - tmtime = localtime(×tamp); - tmtime->tm_year = tmtime->tm_year + year; - tmtime->tm_mon = tmtime->tm_mon + month; - tmtime->tm_mday = tmtime->tm_mday + day; - tmtime->tm_hour = tmtime->tm_hour + hour; - tmtime->tm_min = tmtime->tm_min + minute; - tmtime->tm_sec = tmtime->tm_sec + second; - timestamp = mktime(tmtime); - - if( SQL_SUCCESS != SQL->StmtPrepare(stmt, - "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", - char_db) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, (void*)×tamp, sizeof(timestamp)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_INT, (void*)&char_id, sizeof(char_id)) - || SQL_SUCCESS != SQL->StmtExecute(stmt) - - ) { - SqlStmt_ShowDebug(stmt); - } - - SQL->StmtFree(stmt); - - // condition applies; send to all map-servers to disconnect the player - if( timestamp > time(NULL) ) { - unsigned char buf[11]; - - WBUFW(buf,0) = 0x2b14; - WBUFL(buf,2) = char_id; - WBUFB(buf,6) = 2; - WBUFL(buf,7) = (unsigned int)timestamp; - mapif_sendall(buf, 11); - - // disconnect player if online on char-server - disconnect_player(account_id); - } - } - break; - case 7: //char unban - /* handled by char server, so no redirection */ - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { - Sql_ShowDebug(sql_handle); - result = 1; - } - break; - - } - } - } - - SQL->FreeResult(sql_handle); - - // send answer if a player ask, not if the server ask - if( acc != -1 && type != 5 ) { // Don't send answer for changesex - WFIFOHEAD(fd,34); - WFIFOW(fd, 0) = 0x2b0f; - WFIFOL(fd, 2) = acc; - safestrncpy((char*)WFIFOP(fd,6), name, NAME_LENGTH); - WFIFOW(fd,30) = type; - WFIFOW(fd,32) = result; - WFIFOSET(fd,34); - } + chr->parse_frommap_change_account(fd); } break; @@ -3542,49 +4019,7 @@ int parse_frommap(int fd) if (RFIFOREST(fd) < 11) return 0; { - int cid = RFIFOL(fd, 2); - int fame = RFIFOL(fd, 6); - char type = RFIFOB(fd, 10); - int size; - struct fame_list* list; - int player_pos; - int fame_pos; - - switch(type) { - case RANKTYPE_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; - case RANKTYPE_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; - case RANKTYPE_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; - default: size = 0; list = NULL; break; - } - - ARR_FIND(0, size, player_pos, list[player_pos].id == cid);// position of the player - ARR_FIND(0, size, fame_pos, list[fame_pos].fame <= fame);// where the player should be - - if( player_pos == size && fame_pos == size ) - ;// not on list and not enough fame to get on it - else if( fame_pos == player_pos ) { - // same position - list[player_pos].fame = fame; - char_update_fame_list(type, player_pos, fame); - } else { - // move in the list - if( player_pos == size ) { - // new ranker - not in the list - ARR_MOVE(size - 1, fame_pos, list, struct fame_list); - list[fame_pos].id = cid; - list[fame_pos].fame = fame; - char_loadName(cid, list[fame_pos].name); - } else { - // already in the list - if( fame_pos == size ) - --fame_pos;// move to the end of the list - ARR_MOVE(player_pos, fame_pos, list, struct fame_list); - list[fame_pos].fame = fame; - } - char_send_fame_list(-1); - } - - RFIFOSKIP(fd,11); + chr->parse_frommap_fame_list(fd); } break; @@ -3593,96 +4028,49 @@ int parse_frommap(int fd) if( RFIFOREST(fd) < 10 ) return 0; - divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); - RFIFOSKIP(fd,10); + chr->parse_frommap_divorce_char(fd); break; case 0x2b16: // Receive rates [Wizputer] if( RFIFOREST(fd) < 14 ) return 0; { - char esc_server_name[sizeof(server_name)*2+1]; - - SQL->EscapeString(sql_handle, esc_server_name, server_name); - - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'", - ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) ) - Sql_ShowDebug(sql_handle); - RFIFOSKIP(fd,14); + chr->parse_frommap_ragsrvinfo(fd); } break; case 0x2b17: // Character disconnected set online 0 [Wizputer] if (RFIFOREST(fd) < 6) return 0; - set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); - RFIFOSKIP(fd,10); + chr->parse_frommap_set_char_offline(fd); break; case 0x2b18: // Reset all chars to offline [Wizputer] - set_all_offline(id); - RFIFOSKIP(fd,2); + chr->parse_frommap_set_all_offline(fd, id); break; case 0x2b19: // Character set online [Wizputer] if (RFIFOREST(fd) < 10) return 0; - set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); - RFIFOSKIP(fd,10); + chr->parse_frommap_set_char_online(fd, id); break; case 0x2b1a: // Build and send fame ranking lists [DracoRPG] if (RFIFOREST(fd) < 2) return 0; - char_read_fame_list(); - char_send_fame_list(-1); - RFIFOSKIP(fd,2); + chr->parse_frommap_build_fame_list(fd); break; case 0x2b1c: //Request to save status change data. [Skotlex] if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; { - #ifdef ENABLE_SC_SAVING - int count, aid, cid; - - aid = RFIFOL(fd, 4); - cid = RFIFOL(fd, 8); - count = RFIFOW(fd, 12); - - /* clear; ensure no left overs e.g. permanent */ - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) - Sql_ShowDebug(sql_handle); - - if( count > 0 ) - { - struct status_change_data data; - StringBuf buf; - - StrBuf->Init(&buf); - StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); - for( i = 0; i < count; ++i ) - { - memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); - if( i > 0 ) - StrBuf->AppendStr(&buf, ", "); - StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, - data.type, data.tick, data.val1, data.val2, data.val3, data.val4); - } - if( SQL_ERROR == SQL->QueryStr(sql_handle, StrBuf->Value(&buf)) ) - Sql_ShowDebug(sql_handle); - StrBuf->Destroy(&buf); - } - #endif - RFIFOSKIP(fd, RFIFOW(fd, 2)); + chr->parse_frommap_save_status_change_data(fd); } break; case 0x2b23: // map-server alive packet - WFIFOHEAD(fd,2); - WFIFOW(fd,0) = 0x2b24; - WFIFOSET(fd,2); - RFIFOSKIP(fd,2); + chr->parse_frommap_ping(fd); break; case 0x2b26: // auth request from map-server @@ -3690,131 +4078,20 @@ int parse_frommap(int fd) return 0; { - int account_id; - int char_id; - int login_id1; - char sex, standalone; - uint32 ip; - struct auth_node* node; - struct mmo_charstatus* cd; - struct mmo_charstatus char_dat; - - account_id = RFIFOL(fd,2); - char_id = RFIFOL(fd,6); - login_id1 = RFIFOL(fd,10); - sex = RFIFOB(fd,14); - ip = ntohl(RFIFOL(fd,15)); - standalone = RFIFOB(fd, 19); - RFIFOSKIP(fd,20); - - node = (struct auth_node*)idb_get(auth_db, account_id); - cd = (struct mmo_charstatus*)uidb_get(char_db_,char_id); - - if( cd == NULL ) { //Really shouldn't happen. - mmo_char_fromsql(char_id, &char_dat, true); - cd = (struct mmo_charstatus*)uidb_get(char_db_,char_id); - } - - if( runflag == CHARSERVER_ST_RUNNING && cd && standalone ) { - cd->sex = sex; - - WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); - WFIFOW(fd,0) = 0x2afd; - WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); - WFIFOL(fd,4) = account_id; - WFIFOL(fd,8) = 0; - WFIFOL(fd,12) = 0; - WFIFOL(fd,16) = 0; - WFIFOL(fd,20) = 0; - WFIFOB(fd,24) = 0; - memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); - WFIFOSET(fd, WFIFOW(fd,2)); - - set_char_online(id, char_id, account_id); - break; - } - - if( runflag == CHARSERVER_ST_RUNNING && - cd != NULL && - node != NULL && - node->account_id == account_id && - node->char_id == char_id && - node->login_id1 == login_id1 /*&& - node->sex == sex && - node->ip == ip*/ ) - {// auth ok - if( cd->sex == 99 ) - cd->sex = sex; - - WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); - WFIFOW(fd,0) = 0x2afd; - WFIFOW(fd,2) = 25 + sizeof(struct mmo_charstatus); - WFIFOL(fd,4) = account_id; - WFIFOL(fd,8) = node->login_id1; - WFIFOL(fd,12) = node->login_id2; - WFIFOL(fd,16) = (uint32)node->expiration_time; // FIXME: will wrap to negative after "19-Jan-2038, 03:14:07 AM GMT" - WFIFOL(fd,20) = node->group_id; - WFIFOB(fd,24) = node->changing_mapservers; - memcpy(WFIFOP(fd,25), cd, sizeof(struct mmo_charstatus)); - WFIFOSET(fd, WFIFOW(fd,2)); - - // only use the auth once and mark user online - idb_remove(auth_db, account_id); - set_char_online(id, char_id, account_id); - } - else - {// auth failed - WFIFOHEAD(fd,19); - WFIFOW(fd,0) = 0x2b27; - WFIFOL(fd,2) = account_id; - WFIFOL(fd,6) = char_id; - WFIFOL(fd,10) = login_id1; - WFIFOB(fd,14) = sex; - WFIFOL(fd,15) = htonl(ip); - WFIFOSET(fd,19); - } + chr->parse_frommap_auth_request(fd, id); } break; case 0x2736: // ip address update if (RFIFOREST(fd) < 6) return 0; - server[id].ip = ntohl(RFIFOL(fd, 2)); - ShowInfo("Updated IP address of map-server #%d to %d.%d.%d.%d.\n", id, CONVIP(server[id].ip)); - RFIFOSKIP(fd,6); + chr->parse_frommap_update_ip(fd, id); break; case 0x3008: if( RFIFOREST(fd) < RFIFOW(fd,4) ) return 0;/* packet wasn't fully received yet (still fragmented) */ else { - int sfd;/* stat server fd */ - struct hSockOpt opt; - RFIFOSKIP(fd, 2);/* we skip first 2 bytes which are the 0x3008, so we end up with a buffer equal to the one we send */ - - opt.silent = 1; - opt.setTimeo = 1; - - if( (sfd = make_connection(host2ip("stats.hercules.ws"),(uint16)25427,&opt) ) == -1 ) { - RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ - RFIFOFLUSH(fd); - break;/* connection not possible, we drop the report */ - } - - session[sfd]->flag.server = 1;/* to ensure we won't drop our own packet */ - realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); - - WFIFOHEAD(sfd, RFIFOW(fd,2) ); - - memcpy((char*)WFIFOP(sfd,0), (char*)RFIFOP(fd, 0), RFIFOW(fd,2)); - - WFIFOSET(sfd, RFIFOW(fd,2) ); - - flush_fifo(sfd); - - do_close(sfd); - - RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ - RFIFOFLUSH(fd); + chr->parse_frommap_request_stats_report(fd); } break; @@ -3823,16 +4100,7 @@ int parse_frommap(int fd) if( RFIFOREST(fd) < 28 ) return 0; else { - int account_id = RFIFOL(fd, 2), char_id = RFIFOL(fd, 6), - val1 = RFIFOL(fd, 12), val2 = RFIFOL(fd, 16), - val3 = RFIFOL(fd, 20), val4 = RFIFOL(fd, 24); - short type = RFIFOW(fd, 10); - - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`) VALUES ('%d','%d','%d',-1,'%d','%d','%d','%d')", - scdata_db, account_id, char_id, type, val1, val2, val3, val4) ) - Sql_ShowDebug(sql_handle); - - RFIFOSKIP(fd, 28); + chr->parse_frommap_scdata_update(fd); } break; @@ -3841,14 +4109,7 @@ int parse_frommap(int fd) if( RFIFOREST(fd) < 12 ) return 0; else { - int account_id = RFIFOL(fd, 2), char_id = RFIFOL(fd, 6); - short type = RFIFOW(fd, 10); - - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id` = '%d' AND `type` = '%d' LIMIT 1", - scdata_db, account_id, char_id, type) ) - Sql_ShowDebug(sql_handle); - - RFIFOSKIP(fd, 12); + chr->parse_frommap_scdata_delete(fd); } break; @@ -3856,7 +4117,7 @@ int parse_frommap(int fd) default: { // inter server - packet - int r = inter_parse_frommap(fd); + int r = inter->parse_frommap(fd); if (r == 1) break; // processed if (r == 2) return 0; // need more packet @@ -3875,19 +4136,19 @@ void do_init_mapif(void) { int i; for( i = 0; i < ARRAYLENGTH(server); ++i ) - mapif_server_init(i); + mapif->server_init(i); } void do_final_mapif(void) { int i; for( i = 0; i < ARRAYLENGTH(server); ++i ) - mapif_server_destroy(i); + mapif->server_destroy(i); } // Searches for the mapserver that has a given map (and optionally ip/port, if not -1). // If found, returns the server's index in the 'server' array (otherwise returns -1). -int search_mapserver(unsigned short map, uint32 ip, uint16 port) +int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) { int i, j; @@ -3909,13 +4170,13 @@ int search_mapserver(unsigned short map, uint32 ip, uint16 port) // Initialization process (currently only initialization inter_mapif) static int char_mapif_init(int fd) { - return inter_mapif_init(fd); + return inter->mapif_init(fd); } //-------------------------------------------- // Test to know if an IP come from LAN or WAN. //-------------------------------------------- -int lan_subnetcheck(uint32 ip) +int char_lan_subnetcheck(uint32 ip) { int i; ARR_FIND( 0, subnet_count, i, (subnet[i].char_ip & subnet[i].mask) == (ip & subnet[i].mask) ); @@ -3952,6 +4213,14 @@ void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) WFIFOSET(fd,14); } +void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +{ + WFIFOHEAD(fd,10); + WFIFOW(fd,0) = 0x82a; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = result; + WFIFOSET(fd,10); +} /// @param result /// 0 (0x718): An unknown error has occurred. @@ -3967,18 +4236,12 @@ void char_delete2_accept_ack(int fd, int char_id, uint32 result) #if PACKETVER >= 20130000 /* not sure the exact date -- must refresh or client gets stuck */ if( result == 1 ) { struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data; - mmo_char_send099d(fd, sd); + chr->mmo_char_send099d(fd, sd); } #endif - - WFIFOHEAD(fd,10); - WFIFOW(fd,0) = 0x82a; - WFIFOL(fd,2) = char_id; - WFIFOL(fd,6) = result; - WFIFOSET(fd,10); + chr->delete2_accept_actual_ack(fd, char_id, result); } - /// @param result /// 1 (0x718): none/success, (if char id not in deletion process): An unknown error has occurred. /// 2 (0x719): A database error occurred. @@ -3992,7 +4255,6 @@ void char_delete2_cancel_ack(int fd, int char_id, uint32 result) WFIFOSET(fd,10); } - static void char_delete2_req(int fd, struct char_session_data* sd) {// CH: <0827>.W <char id>.L int char_id, party_id, guild_id, i; @@ -4004,21 +4266,21 @@ static void char_delete2_req(int fd, struct char_session_data* sd) ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == char_id ); if( i == MAX_CHARS ) {// character not found - char_delete2_ack(fd, char_id, 3, 0); + chr->delete2_ack(fd, char_id, 3, 0); return; } - if( SQL_SUCCESS != SQL->Query(sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->Query(inter->sql_handle, "SELECT `delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - Sql_ShowDebug(sql_handle); - char_delete2_ack(fd, char_id, 3, 0); + Sql_ShowDebug(inter->sql_handle); + chr->delete2_ack(fd, char_id, 3, 0); return; } - SQL->GetData(sql_handle, 0, &data, NULL); delete_date = strtoul(data, NULL, 10); + SQL->GetData(inter->sql_handle, 0, &data, NULL); delete_date = strtoul(data, NULL, 10); if( delete_date ) {// character already queued for deletion - char_delete2_ack(fd, char_id, 0, 0); + chr->delete2_ack(fd, char_id, 0, 0); return; } @@ -4027,26 +4289,26 @@ static void char_delete2_req(int fd, struct char_session_data* sd) // see issue: 7338 if( char_aegis_delete ) { - if( SQL_SUCCESS != SQL->Query(sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) - || SQL_SUCCESS != SQL->NextRow(sql_handle) + if( SQL_SUCCESS != SQL->Query(inter->sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - Sql_ShowDebug(sql_handle); - char_delete2_ack(fd, char_id, 3, 0); + Sql_ShowDebug(inter->sql_handle); + chr->delete2_ack(fd, char_id, 3, 0); return; } - SQL->GetData(sql_handle, 0, &data, NULL); party_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); party_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); guild_id = atoi(data); if( guild_id ) { - char_delete2_ack(fd, char_id, 4, 0); + chr->delete2_ack(fd, char_id, 4, 0); return; } if( party_id ) { - char_delete2_ack(fd, char_id, 5, 0); + chr->delete2_ack(fd, char_id, 5, 0); return; } } @@ -4054,17 +4316,16 @@ static void char_delete2_req(int fd, struct char_session_data* sd) // success delete_date = time(NULL)+char_del_delay; - if( SQL_SUCCESS != SQL->Query(sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) + if( SQL_SUCCESS != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", char_db, (unsigned long)delete_date, char_id) ) { - Sql_ShowDebug(sql_handle); - char_delete2_ack(fd, char_id, 3, 0); + Sql_ShowDebug(inter->sql_handle); + chr->delete2_ack(fd, char_id, 3, 0); return; } - char_delete2_ack(fd, char_id, 1, delete_date); + chr->delete2_ack(fd, char_id, 1, delete_date); } - static void char_delete2_accept(int fd, struct char_session_data* sd) {// CH: <0829>.W <char id>.L <birth date:YYMMDD>.6B char birthdate[8+1]; @@ -4091,52 +4352,51 @@ static void char_delete2_accept(int fd, struct char_session_data* sd) ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == char_id ); if( i == MAX_CHARS ) {// character not found - char_delete2_accept_ack(fd, char_id, 3); + chr->delete2_accept_ack(fd, char_id, 3); return; } - if( SQL_SUCCESS != SQL->Query(sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->Query(inter->sql_handle, "SELECT `base_level`,`delete_date` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) || SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) {// data error - Sql_ShowDebug(sql_handle); - char_delete2_accept_ack(fd, char_id, 3); + Sql_ShowDebug(inter->sql_handle); + chr->delete2_accept_ack(fd, char_id, 3); return; } - SQL->GetData(sql_handle, 0, &data, NULL); base_level = (unsigned int)strtoul(data, NULL, 10); - SQL->GetData(sql_handle, 1, &data, NULL); delete_date = strtoul(data, NULL, 10); + SQL->GetData(inter->sql_handle, 0, &data, NULL); base_level = (unsigned int)strtoul(data, NULL, 10); + SQL->GetData(inter->sql_handle, 1, &data, NULL); delete_date = strtoul(data, NULL, 10); if( !delete_date || delete_date>time(NULL) ) {// not queued or delay not yet passed - char_delete2_accept_ack(fd, char_id, 4); + chr->delete2_accept_ack(fd, char_id, 4); return; } if( strcmp(sd->birthdate+2, birthdate) ) // +2 to cut off the century {// birth date is wrong - char_delete2_accept_ack(fd, char_id, 5); + chr->delete2_accept_ack(fd, char_id, 5); return; } if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) ) {// character level config restriction - char_delete2_accept_ack(fd, char_id, 2); + chr->delete2_accept_ack(fd, char_id, 2); return; } // success - if( delete_char_sql(char_id) < 0 ) + if( chr->delete_char_sql(char_id) < 0 ) { - char_delete2_accept_ack(fd, char_id, 3); + chr->delete2_accept_ack(fd, char_id, 3); return; } // refresh character list cache sd->found_char[i] = -1; - char_delete2_accept_ack(fd, char_id, 1); + chr->delete2_accept_ack(fd, char_id, 1); } - static void char_delete2_cancel(int fd, struct char_session_data* sd) {// CH: <082b>.W <char id>.L int char_id, i; @@ -4146,47 +4406,674 @@ static void char_delete2_cancel(int fd, struct char_session_data* sd) ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == char_id ); if( i == MAX_CHARS ) {// character not found - char_delete2_cancel_ack(fd, char_id, 2); + chr->delete2_cancel_ack(fd, char_id, 2); return; } // there is no need to check, whether or not the character was // queued for deletion, as the client prints an error message by - // itself, if it was not the case (@see char_delete2_cancel_ack) - if( SQL_SUCCESS != SQL->Query(sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) + // itself, if it was not the case (@see chr->delete2_cancel_ack) + if( SQL_SUCCESS != SQL->Query(inter->sql_handle, "UPDATE `%s` SET `delete_date`='0' WHERE `char_id`='%d'", char_db, char_id) ) { - Sql_ShowDebug(sql_handle); - char_delete2_cancel_ack(fd, char_id, 2); + Sql_ShowDebug(inter->sql_handle); + chr->delete2_cancel_ack(fd, char_id, 2); return; } - char_delete2_cancel_ack(fd, char_id, 1); + chr->delete2_cancel_ack(fd, char_id, 1); } +void char_send_account_id(int fd, int account_id) +{ + WFIFOHEAD(fd,4); + WFIFOL(fd,0) = account_id; + WFIFOSET(fd,4); +} + +void loginif_auth(int fd, struct char_session_data* sd, uint32 ipl) +{ + WFIFOHEAD(chr->login_fd,23); + WFIFOW(chr->login_fd,0) = 0x2712; // ask login-server to authenticate an account + WFIFOL(chr->login_fd,2) = sd->account_id; + WFIFOL(chr->login_fd,6) = sd->login_id1; + WFIFOL(chr->login_fd,10) = sd->login_id2; + WFIFOB(chr->login_fd,14) = sd->sex; + WFIFOL(chr->login_fd,15) = htonl(ipl); + WFIFOL(chr->login_fd,19) = fd; + WFIFOSET(chr->login_fd,23); +} + +void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +{ + int account_id = RFIFOL(fd,2); + uint32 login_id1 = RFIFOL(fd,6); + uint32 login_id2 = RFIFOL(fd,10); + int sex = RFIFOB(fd,16); + RFIFOSKIP(fd,17); + + ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2); + + if (sd) { + //Received again auth packet for already authenticated account?? Discard it. + //TODO: Perhaps log this as a hack attempt? + //TODO: and perhaps send back a reply? + return; + } + + CREATE(session[fd]->session_data, struct char_session_data, 1); + sd = (struct char_session_data*)session[fd]->session_data; + sd->account_id = account_id; + sd->login_id1 = login_id1; + sd->login_id2 = login_id2; + sd->sex = sex; + sd->auth = false; // not authed yet + + // send back account_id + chr->send_account_id(fd, account_id); + + if( runflag != CHARSERVER_ST_RUNNING ) { + chr->auth_error(fd, 0); + return; + } + + // search authentication + struct char_auth_node* node = (struct char_auth_node*)idb_get(auth_db, account_id); + if( node != NULL && + node->account_id == account_id && + node->login_id1 == login_id1 && + node->login_id2 == login_id2 /*&& + node->ip == ipl*/ ) + {// authentication found (coming from map server) + /* restrictions apply */ + if( char_server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { + chr->auth_error(fd, 0); + return; + } + /* the client will already deny this request, this check is to avoid someone bypassing. */ + if( char_server_type == CST_PAYING && (time_t)node->expiration_time < time(NULL) ) { + chr->auth_error(fd, 0); + return; + } + idb_remove(auth_db, account_id); + chr->auth_ok(fd, sd); + } + else + {// authentication not found (coming from login server) + if (chr->login_fd > 0) { // don't send request if no login-server + loginif->auth(fd, sd, ipl); + } else { // if no login-server, we must refuse connection + chr->auth_error(fd, 0); + } + } +} + +void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) +{ + WFIFOHEAD(fd,28); + WFIFOW(fd,0) = 0x71; + WFIFOL(fd,2) = cd->char_id; + mapindex->getmapname_ext(mapindex_id2name(cd->last_point.map), (char*)WFIFOP(fd,6)); + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : server[i].ip); + WFIFOW(fd,26) = ntows(htons(server[i].port)); // [!] LE byte order here [!] + WFIFOSET(fd,28); +} + +void char_send_wait_char_server(int fd) +{ + WFIFOHEAD(fd, 24); + WFIFOW(fd, 0) = 0x840; + WFIFOW(fd, 2) = 24; + safestrncpy((char*)WFIFOP(fd,4), "0", 20);/* we can't send empty (otherwise the list will pop up) */ + WFIFOSET(fd, 24); +} + +int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +{ + int i; + int j; + if ((i = chr->search_mapserver((j=mapindex->name2id(MAP_PRONTERA)),-1,-1)) >= 0) { + cd->last_point.x = 273; + cd->last_point.y = 354; + } else if ((i = chr->search_mapserver((j=mapindex->name2id(MAP_GEFFEN)),-1,-1)) >= 0) { + cd->last_point.x = 120; + cd->last_point.y = 100; + } else if ((i = chr->search_mapserver((j=mapindex->name2id(MAP_MORROC)),-1,-1)) >= 0) { + cd->last_point.x = 160; + cd->last_point.y = 94; + } else if ((i = chr->search_mapserver((j=mapindex->name2id(MAP_ALBERTA)),-1,-1)) >= 0) { + cd->last_point.x = 116; + cd->last_point.y = 57; + } else if ((i = chr->search_mapserver((j=mapindex->name2id(MAP_PAYON)),-1,-1)) >= 0) { + cd->last_point.x = 87; + cd->last_point.y = 117; + } else if ((i = chr->search_mapserver((j=mapindex->name2id(MAP_IZLUDE)),-1,-1)) >= 0) { + cd->last_point.x = 94; + cd->last_point.y = 103; + } + if (i >= 0) + { + cd->last_point.map = j; + ShowWarning("Unable to find map-server for '%s', sending to major city '%s'.\n", mapindex_id2name(cd->last_point.map), mapindex_id2name(j)); + } + return i; +} + +void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +{ + struct mmo_charstatus char_dat; + struct mmo_charstatus *cd; + char* data; + int char_id; + int server_id = 0; + int i; + + int slot = RFIFOB(fd,2); + RFIFOSKIP(fd,3); + +#if PACKETVER >= 20110309 + if( *pincode->enabled ){ // hack check + struct online_char_data* character; + character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); + if( character && character->pincode_enable == -1){ + chr->auth_error(fd, 0); + return; + } + } +#endif + + ARR_FIND( 0, ARRAYLENGTH(server), server_id, server[server_id].fd > 0 && server[server_id].map ); + /* not available, tell it to wait (client wont close; char select will respawn). + * magic response found by Ind thanks to Yommy <3 */ + if( server_id == ARRAYLENGTH(server) ) { + chr->send_wait_char_server(fd); + return; + } + + if ( SQL_SUCCESS != SQL->Query(inter->sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) + || SQL_SUCCESS != SQL->NextRow(inter->sql_handle) + || SQL_SUCCESS != SQL->GetData(inter->sql_handle, 0, &data, NULL) ) + { //Not found?? May be forged packet. + Sql_ShowDebug(inter->sql_handle); + SQL->FreeResult(inter->sql_handle); + chr->auth_error(fd, 0); + return; + } + + char_id = atoi(data); + SQL->FreeResult(inter->sql_handle); -int parse_char(int fd) + /* client doesn't let it get to this point if you're banned, so its a forged packet */ + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time(NULL) ) { + chr->auth_error(fd, 0); + return; + } + + /* set char as online prior to loading its data so 3rd party applications will realize the sql data is not reliable */ + chr->set_char_online(-2,char_id,sd->account_id); + if( !chr->mmo_char_fromsql(char_id, &char_dat, true) ) { /* failed? set it back offline */ + chr->set_char_offline(char_id, sd->account_id); + /* failed to load something. REJECT! */ + chr->auth_error(fd, 0); + return;/* jump off this boat */ + } + + //Have to switch over to the DB instance otherwise data won't propagate [Kevin] + cd = (struct mmo_charstatus *)idb_get(chr->char_db_, char_id); + if( cd->sex == 99 ) + cd->sex = sd->sex; + + if (log_char) { + char esc_name[NAME_LENGTH*2+1]; + // FIXME: Why are we re-escaping the name if it was already escaped in rename/make_new_char? [Panikon] + SQL->EscapeStringLen(inter->sql_handle, esc_name, char_dat.name, strnlen(char_dat.name, NAME_LENGTH)); + if( SQL_ERROR == SQL->Query(inter->sql_handle, + "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", + charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) + Sql_ShowDebug(inter->sql_handle); + } + ShowInfo("Selected char: (Account %d: %d - %s)\n", sd->account_id, slot, char_dat.name); + + // searching map server + i = chr->search_mapserver(cd->last_point.map, -1, -1); + + // if map is not found, we check major cities + if (i < 0 || !cd->last_point.map) { + unsigned short j; + //First check that there's actually a map server online. + ARR_FIND( 0, ARRAYLENGTH(server), j, server[j].fd >= 0 && server[j].map ); + if (j == ARRAYLENGTH(server)) { + ShowInfo("Connection Closed. No map servers available.\n"); + chr->authfail_fd(fd, 1); + return; + } + i = chr->search_default_maps_mapserver(cd); + if (i < 0) + { + ShowInfo("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n", mapindex_id2name(cd->last_point.map)); + chr->authfail_fd(fd, 1); + return; + } + } + + int map_fd; + //Send NEW auth packet [Kevin] + //FIXME: is this case even possible? [ultramage] + if ((map_fd = server[i].fd) < 1 || session[map_fd] == NULL) + { + ShowError("chr->parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n", map_fd, i); + server[i].fd = -1; + memset(&server[i], 0, sizeof(struct mmo_map_server)); + //Send server closed. + chr->authfail_fd(fd, 1); + return; + } + + uint32 subnet_map_ip = chr->lan_subnetcheck(ipl); // Advanced subnet check [LuzZza] + //Send player to map + chr->send_map_info(fd, i, subnet_map_ip, cd); + + struct char_auth_node* node; + // create temporary auth entry + CREATE(node, struct char_auth_node, 1); + node->account_id = sd->account_id; + node->char_id = cd->char_id; + node->login_id1 = sd->login_id1; + node->login_id2 = sd->login_id2; + node->sex = sd->sex; + node->expiration_time = sd->expiration_time; + node->group_id = sd->group_id; + node->ip = ipl; + idb_put(auth_db, sd->account_id, node); +} + +void char_creation_failed(int fd, int result) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x6e; + /* Others I found [Ind] */ + /* 0x02 = Symbols in Character Names are forbidden */ + /* 0x03 = You are not eligible to open the Character Slot. */ + /* 0x0B = This service is only available for premium users. */ + switch (result) { + case -1: WFIFOB(fd,2) = 0x00; break; // 'Charname already exists' + case -2: WFIFOB(fd,2) = 0xFF; break; // 'Char creation denied' + case -3: WFIFOB(fd,2) = 0x01; break; // 'You are underaged' + case -4: WFIFOB(fd,2) = 0x03; break; // 'You are not eligible to open the Character Slot.' + case -5: WFIFOB(fd,2) = 0x02; break; // 'Symbols in Character Names are forbidden' + + default: + ShowWarning("chr->parse_char: Unknown result received from chr->make_new_char_sql!\n"); + WFIFOB(fd,2) = 0xFF; + break; + } + WFIFOSET(fd,3); +} + +void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +{ + // send to player + WFIFOHEAD(fd,2+MAX_CHAR_BUF); + WFIFOW(fd,0) = 0x6d; + int len = 2 + chr->mmo_char_tobuf(WFIFOP(fd,2), char_dat); + WFIFOSET(fd,len); +} + +void char_parse_char_create_new_char(int fd, struct char_session_data* sd) { + int result; + if( !char_new ) //turn character creation on/off [Kevin] + result = -2; + else + #if PACKETVER >= 20120307 + result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + #else + result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); + #endif + + if (result < 0) { + chr->creation_failed(fd, result); + } else { + // retrieve data + struct mmo_charstatus char_dat; + chr->mmo_char_fromsql(result, &char_dat, false); //Only the short data is needed. + chr->creation_ok(fd, &char_dat); + + // add new entry to the chars list + sd->found_char[char_dat.slot] = result; // the char_id of the new char + } + #if PACKETVER >= 20120307 + RFIFOSKIP(fd,31); + #else + RFIFOSKIP(fd,37); + #endif +} + +// flag: +// 0 = Incorrect Email address +void char_delete_char_failed(int fd, int flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x70; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_delete_char_ok(int fd) +{ + WFIFOHEAD(fd,2); + WFIFOW(fd,0) = 0x6f; + WFIFOSET(fd,2); +} + +void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +{ + int cid = RFIFOL(fd,2); + int i; +#if PACKETVER >= 20110309 + if( *pincode->enabled ){ // hack check + struct online_char_data* character; + character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); + if( character && character->pincode_enable == -1 ){ + chr->auth_error(fd, 0); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + return; + } + } +#endif + ShowInfo(CL_RED"Request Char Deletion: "CL_GREEN"%d (%d)"CL_RESET"\n", sd->account_id, cid); char email[40]; + memcpy(email, RFIFOP(fd,6), 40); + RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); + + // Check if e-mail is correct + if(strcmpi(email, sd->email) && //email does not matches and + ( + strcmp("a@a.com", sd->email) || //it is not default email, or + (strcmp("a@a.com", email) && strcmp("", email)) //email sent does not matches default + )) { //Fail + chr->delete_char_failed(fd, 0); + return; + } + + // check if this char exists + ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); + if( i == MAX_CHARS ) + { // Such a character does not exist in the account + chr->delete_char_failed(fd, 0); + return; + } + + // remove char from list and compact it + sd->found_char[i] = -1; + + /* Delete character */ + if(chr->delete_char_sql(cid)<0){ + //can't delete the char + //either SQL error or can't delete by some CONFIG conditions + //del fail + chr->delete_char_failed(fd, 0); + return; + } + /* Char successfully deleted.*/ + chr->delete_char_ok(fd); +} + +void char_parse_char_ping(int fd) +{ + RFIFOSKIP(fd,6); +} + +void char_allow_rename(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x28e; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char(int fd, struct char_session_data* sd) +{ + int i, cid =RFIFOL(fd,2); + char name[NAME_LENGTH]; + char esc_name[NAME_LENGTH*2+1]; + safestrncpy(name, (char *)RFIFOP(fd,6), NAME_LENGTH); + RFIFOSKIP(fd,30); + + ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); + if( i == MAX_CHARS ) + return; + + normalize_name(name,TRIM_CHARS); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); + if( !chr->check_char_name(name,esc_name) ) { + i = 1; + safestrncpy(sd->new_name, name, NAME_LENGTH); + } else { + i = 0; + } + + chr->allow_rename(fd, i); +} + +void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +{ + int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); + char name[NAME_LENGTH]; + char esc_name[NAME_LENGTH*2+1]; + safestrncpy(name, (char *)RFIFOP(fd,10), NAME_LENGTH); + RFIFOSKIP(fd,34); + + if( aid != sd->account_id ) + return; + ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); + if( i == MAX_CHARS ) + return; + + normalize_name(name,TRIM_CHARS); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); + if( !chr->check_char_name(name,esc_name) ) + { + i = 1; + safestrncpy(sd->new_name, name, NAME_LENGTH); + } + else + i = 0; + + chr->allow_rename(fd, i); +} + +void char_rename_char_ack(int fd, int flag) +{ + WFIFOHEAD(fd, 4); + WFIFOW(fd,0) = 0x290; + WFIFOW(fd,2) = flag; + WFIFOSET(fd,4); +} + +void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +{ + int i; + int cid = RFIFOL(fd,2); + RFIFOSKIP(fd,6); + + ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); + if( i == MAX_CHARS ) + return; + i = chr->rename_char_sql(sd, cid); + + chr->rename_char_ack(fd, i); +} + +void char_captcha_notsupported(int fd) +{ + WFIFOHEAD(fd,5); + WFIFOW(fd,0) = 0x7e9; + WFIFOW(fd,2) = 5; + WFIFOB(fd,4) = 1; + WFIFOSET(fd,5); +} + +void char_parse_char_request_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,8); +} + +void char_parse_char_check_captcha(int fd) +{ + chr->captcha_notsupported(fd); + RFIFOSKIP(fd,32); +} + +void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +{ + chr->delete2_req(fd, sd); + RFIFOSKIP(fd,6); +} + +void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +{ + chr->delete2_accept(fd, sd); + RFIFOSKIP(fd,12); +} + +void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +{ + chr->delete2_cancel(fd, sd); + RFIFOSKIP(fd,6); +} + +// flag: +// 0 - ok +// 3 - error +void char_login_map_server_ack(int fd, uint8 flag) +{ + WFIFOHEAD(fd,3); + WFIFOW(fd,0) = 0x2af9; + WFIFOB(fd,2) = flag; + WFIFOSET(fd,3); +} + +void char_parse_char_login_map_server(int fd) +{ + char* l_user = (char*)RFIFOP(fd,2); + char* l_pass = (char*)RFIFOP(fd,26); + int i; + l_user[23] = '\0'; + l_pass[23] = '\0'; + ARR_FIND( 0, ARRAYLENGTH(server), i, server[i].fd <= 0 ); + if( runflag != CHARSERVER_ST_RUNNING || + i == ARRAYLENGTH(server) || + strcmp(l_user, userid) != 0 || + strcmp(l_pass, passwd) != 0 ) + { + chr->login_map_server_ack(fd, 3); + } else { + chr->login_map_server_ack(fd, 0); + + server[i].fd = fd; + server[i].ip = ntohl(RFIFOL(fd,54)); + server[i].port = ntohs(RFIFOW(fd,58)); + server[i].users = 0; + session[fd]->func_parse = chr->parse_frommap; + session[fd]->flag.server = 1; + realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + chr->mapif_init(fd); + } + sockt->datasync(fd, true); + + RFIFOSKIP(fd,60); +} + +void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +{ + if( RFIFOL(fd,2) == sd->account_id ) + pincode->check( fd, sd ); + + RFIFOSKIP(fd,10); +} + +void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +{ + if( RFIFOL(fd,2) == sd->account_id ) + pincode->sendstate( fd, sd, PINCODE_NOTSET ); + + RFIFOSKIP(fd,6); +} + +void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +{ + if( RFIFOL(fd,2) == sd->account_id ) + pincode->change( fd, sd ); + + RFIFOSKIP(fd,14); +} + +void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +{ + if( RFIFOL(fd,2) == sd->account_id ) + pincode->setnew( fd, sd ); + RFIFOSKIP(fd,10); +} + +void char_parse_char_request_chars(int fd, struct char_session_data* sd) +{ + chr->mmo_char_send099d(fd, sd); + RFIFOSKIP(fd,2); +} + +void char_change_character_slot_ack(int fd, bool ret) +{ + WFIFOHEAD(fd, 8); + WFIFOW(fd, 0) = 0x8d5; + WFIFOW(fd, 2) = 8; + WFIFOW(fd, 4) = ret?0:1; + WFIFOW(fd, 6) = 0;/* we enforce it elsewhere, go 0 */ + WFIFOSET(fd, 8); +} + +void char_parse_char_move_character(int fd, struct char_session_data* sd) +{ + bool ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); + chr->change_character_slot_ack(fd, ret); + /* for some stupid reason it requires the char data again (gravity -_-) */ + if( ret ) +#if PACKETVER >= 20130000 + chr->mmo_char_send099d(fd, sd); +#else + chr->mmo_char_send_characters(fd, sd); +#endif + RFIFOSKIP(fd, 8); +} + +int char_parse_char_unknown_packet(int fd, uint32 ipl) +{ + ShowError("chr->parse_char: Received unknown packet "CL_WHITE"0x%x"CL_RESET" from ip '"CL_WHITE"%s"CL_RESET"'! Disconnecting!\n", RFIFOW(fd,0), ip2str(ipl, NULL)); + set_eof(fd); + return 1; +} + +int char_parse_char(int fd) +{ unsigned short cmd; - int map_fd; struct char_session_data* sd; uint32 ipl = session[fd]->client_addr; sd = (struct char_session_data*)session[fd]->session_data; // disconnect any player if no login-server. - if(login_fd < 0) + if(chr->login_fd < 0) set_eof(fd); if(session[fd]->flag.eof) { if( sd != NULL && sd->auth ) { // already authed client - struct online_char_data* data = (struct online_char_data*)idb_get(online_char_db, sd->account_id); + struct online_char_data* data = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); if( data != NULL && data->fd == fd) data->fd = -1; if( data == NULL || data->server == -1) //If it is not in any server, send it offline. [Skotlex] - set_char_offline(-1,sd->account_id); + chr->set_char_offline(-1,sd->account_id); } do_close(fd); return 0; @@ -4212,90 +5099,7 @@ int parse_char(int fd) if( RFIFOREST(fd) < 17 ) return 0; { - struct auth_node* node; - - int account_id = RFIFOL(fd,2); - uint32 login_id1 = RFIFOL(fd,6); - uint32 login_id2 = RFIFOL(fd,10); - int sex = RFIFOB(fd,16); - RFIFOSKIP(fd,17); - - ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2); - - if (sd) { - //Received again auth packet for already authenticated account?? Discard it. - //TODO: Perhaps log this as a hack attempt? - //TODO: and perhaps send back a reply? - break; - } - - CREATE(session[fd]->session_data, struct char_session_data, 1); - sd = (struct char_session_data*)session[fd]->session_data; - sd->account_id = account_id; - sd->login_id1 = login_id1; - sd->login_id2 = login_id2; - sd->sex = sex; - sd->auth = false; // not authed yet - - // send back account_id - WFIFOHEAD(fd,4); - WFIFOL(fd,0) = account_id; - WFIFOSET(fd,4); - - if( runflag != CHARSERVER_ST_RUNNING ) { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0;// rejected from server - WFIFOSET(fd,3); - break; - } - - // search authentication - node = (struct auth_node*)idb_get(auth_db, account_id); - if( node != NULL && - node->account_id == account_id && - node->login_id1 == login_id1 && - node->login_id2 == login_id2 /*&& - node->ip == ipl*/ ) - {// authentication found (coming from map server) - /* restrictions apply */ - if( char_server_type == CST_MAINTENANCE && node->group_id < char_maintenance_min_group_id ) { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0;// rejected from server - WFIFOSET(fd,3); - break; - } - /* the client will already deny this request, this check is to avoid someone bypassing. */ - if( char_server_type == CST_PAYING && (time_t)node->expiration_time < time(NULL) ) { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0;// rejected from server - WFIFOSET(fd,3); - break; - } - idb_remove(auth_db, account_id); - char_auth_ok(fd, sd); - } - else - {// authentication not found (coming from login server) - if (login_fd > 0) { // don't send request if no login-server - WFIFOHEAD(login_fd,23); - WFIFOW(login_fd,0) = 0x2712; // ask login-server to authenticate an account - WFIFOL(login_fd,2) = sd->account_id; - WFIFOL(login_fd,6) = sd->login_id1; - WFIFOL(login_fd,10) = sd->login_id2; - WFIFOB(login_fd,14) = sd->sex; - WFIFOL(login_fd,15) = htonl(ipl); - WFIFOL(login_fd,19) = fd; - WFIFOSET(login_fd,23); - } else { // if no login-server, we must refuse connection - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0; - WFIFOSET(fd,3); - } - } + chr->parse_char_connect(fd, sd, ipl); } break; @@ -4303,179 +5107,7 @@ int parse_char(int fd) case 0x66: FIFOSD_CHECK(3); { - struct mmo_charstatus char_dat; - struct mmo_charstatus *cd; - char* data; - int char_id; - uint32 subnet_map_ip; - struct auth_node* node; - int server_id = 0; - int i; - - int slot = RFIFOB(fd,2); - RFIFOSKIP(fd,3); - -#if PACKETVER >= 20110309 - if( *pincode->enabled ){ // hack check - struct online_char_data* character; - character = (struct online_char_data*)idb_get(online_char_db, sd->account_id); - if( character && character->pincode_enable == -1){ - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0; - WFIFOSET(fd,3); - break; - } - } -#endif - - ARR_FIND( 0, ARRAYLENGTH(server), server_id, server[server_id].fd > 0 && server[server_id].map ); - /* not available, tell it to wait (client wont close; char select will respawn). - * magic response found by Ind thanks to Yommy <3 */ - if( server_id == ARRAYLENGTH(server) ) { - WFIFOHEAD(fd, 24); - WFIFOW(fd, 0) = 0x840; - WFIFOW(fd, 2) = 24; - safestrncpy((char*)WFIFOP(fd,4), "0", 20);/* we can't send empty (otherwise the list will pop up) */ - WFIFOSET(fd, 24); - break; - } - - if ( SQL_SUCCESS != SQL->Query(sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d'", char_db, sd->account_id, slot) - || SQL_SUCCESS != SQL->NextRow(sql_handle) - || SQL_SUCCESS != SQL->GetData(sql_handle, 0, &data, NULL) ) - { //Not found?? May be forged packet. - Sql_ShowDebug(sql_handle); - SQL->FreeResult(sql_handle); - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0; // rejected from server - WFIFOSET(fd,3); - break; - } - - char_id = atoi(data); - SQL->FreeResult(sql_handle); - - /* client doesn't let it get to this point if you're banned, so its a forged packet */ - if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time(NULL) ) { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0; // rejected from server - WFIFOSET(fd,3); - break; - } - - /* set char as online prior to loading its data so 3rd party applications will realize the sql data is not reliable */ - set_char_online(-2,char_id,sd->account_id); - if( !mmo_char_fromsql(char_id, &char_dat, true) ) { /* failed? set it back offline */ - set_char_offline(char_id, sd->account_id); - /* failed to load something. REJECT! */ - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0; - WFIFOSET(fd,3); - break;/* jump off this boat */ - } - - //Have to switch over to the DB instance otherwise data won't propagate [Kevin] - cd = (struct mmo_charstatus *)idb_get(char_db_, char_id); - if( cd->sex == 99 ) - cd->sex = sd->sex; - - if (log_char) { - char esc_name[NAME_LENGTH*2+1]; - // FIXME: Why are we re-escaping the name if it was already escaped in rename/make_new_char? [Panikon] - SQL->EscapeStringLen(sql_handle, esc_name, char_dat.name, strnlen(char_dat.name, NAME_LENGTH)); - if( SQL_ERROR == SQL->Query(sql_handle, - "INSERT INTO `%s`(`time`, `account_id`, `char_id`, `char_num`, `name`) VALUES (NOW(), '%d', '%d', '%d', '%s')", - charlog_db, sd->account_id, cd->char_id, slot, esc_name) ) - Sql_ShowDebug(sql_handle); - } - ShowInfo("Selected char: (Account %d: %d - %s)\n", sd->account_id, slot, char_dat.name); - - // searching map server - i = search_mapserver(cd->last_point.map, -1, -1); - - // if map is not found, we check major cities - if (i < 0 || !cd->last_point.map) { - unsigned short j; - //First check that there's actually a map server online. - ARR_FIND( 0, ARRAYLENGTH(server), j, server[j].fd >= 0 && server[j].map ); - if (j == ARRAYLENGTH(server)) { - ShowInfo("Connection Closed. No map servers available.\n"); - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x81; - WFIFOB(fd,2) = 1; // 01 = Server closed - WFIFOSET(fd,3); - break; - } - if ((i = search_mapserver((j=mapindex->name2id(MAP_PRONTERA)),-1,-1)) >= 0) { - cd->last_point.x = 273; - cd->last_point.y = 354; - } else if ((i = search_mapserver((j=mapindex->name2id(MAP_GEFFEN)),-1,-1)) >= 0) { - cd->last_point.x = 120; - cd->last_point.y = 100; - } else if ((i = search_mapserver((j=mapindex->name2id(MAP_MORROC)),-1,-1)) >= 0) { - cd->last_point.x = 160; - cd->last_point.y = 94; - } else if ((i = search_mapserver((j=mapindex->name2id(MAP_ALBERTA)),-1,-1)) >= 0) { - cd->last_point.x = 116; - cd->last_point.y = 57; - } else if ((i = search_mapserver((j=mapindex->name2id(MAP_PAYON)),-1,-1)) >= 0) { - cd->last_point.x = 87; - cd->last_point.y = 117; - } else if ((i = search_mapserver((j=mapindex->name2id(MAP_IZLUDE)),-1,-1)) >= 0) { - cd->last_point.x = 94; - cd->last_point.y = 103; - } else { - ShowInfo("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n", mapindex_id2name(cd->last_point.map)); - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x81; - WFIFOB(fd,2) = 1; // 01 = Server closed - WFIFOSET(fd,3); - break; - } - ShowWarning("Unable to find map-server for '%s', sending to major city '%s'.\n", mapindex_id2name(cd->last_point.map), mapindex_id2name(j)); - cd->last_point.map = j; - } - - //Send NEW auth packet [Kevin] - //FIXME: is this case even possible? [ultramage] - if ((map_fd = server[i].fd) < 1 || session[map_fd] == NULL) - { - ShowError("parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n", map_fd, i); - server[i].fd = -1; - memset(&server[i], 0, sizeof(struct mmo_map_server)); - //Send server closed. - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x81; - WFIFOB(fd,2) = 1; // 01 = Server closed - WFIFOSET(fd,3); - break; - } - - //Send player to map - WFIFOHEAD(fd,28); - WFIFOW(fd,0) = 0x71; - WFIFOL(fd,2) = cd->char_id; - mapindex->getmapname_ext(mapindex_id2name(cd->last_point.map), (char*)WFIFOP(fd,6)); - subnet_map_ip = lan_subnetcheck(ipl); // Advanced subnet check [LuzZza] - WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : server[i].ip); - WFIFOW(fd,26) = ntows(htons(server[i].port)); // [!] LE byte order here [!] - WFIFOSET(fd,28); - - // create temporary auth entry - CREATE(node, struct auth_node, 1); - node->account_id = sd->account_id; - node->char_id = cd->char_id; - node->login_id1 = sd->login_id1; - node->login_id2 = sd->login_id2; - node->sex = sd->sex; - node->expiration_time = sd->expiration_time; - node->group_id = sd->group_id; - node->ip = ipl; - idb_put(auth_db, sd->account_id, node); + chr->parse_char_select(fd, sd, ipl); } break; @@ -4485,65 +5117,15 @@ int parse_char(int fd) // S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W case 0x970: { - int result; FIFOSD_CHECK(31); #else // S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.W case 0x67: { - int result; FIFOSD_CHECK(37); #endif - if( !char_new ) //turn character creation on/off [Kevin] - result = -2; - else - #if PACKETVER >= 20120307 - result = make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); - #else - result = make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); - #endif - - if (result < 0) { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6e; - /* Others I found [Ind] */ - /* 0x02 = Symbols in Character Names are forbidden */ - /* 0x03 = You are not eligible to open the Character Slot. */ - /* 0x0B = This service is only available for premium users. */ - switch (result) { - case -1: WFIFOB(fd,2) = 0x00; break; // 'Charname already exists' - case -2: WFIFOB(fd,2) = 0xFF; break; // 'Char creation denied' - case -3: WFIFOB(fd,2) = 0x01; break; // 'You are underaged' - case -4: WFIFOB(fd,2) = 0x03; break; // 'You are not eligible to open the Character Slot.' - case -5: WFIFOB(fd,2) = 0x02; break; // 'Symbols in Character Names are forbidden' - - default: - ShowWarning("parse_char: Unknown result received from make_new_char_sql!\n"); - WFIFOB(fd,2) = 0xFF; - break; - } - WFIFOSET(fd,3); - } else { - int len; - // retrieve data - struct mmo_charstatus char_dat; - mmo_char_fromsql(result, &char_dat, false); //Only the short data is needed. - - // send to player - WFIFOHEAD(fd,2+MAX_CHAR_BUF); - WFIFOW(fd,0) = 0x6d; - len = 2 + mmo_char_tobuf(WFIFOP(fd,2), &char_dat); - WFIFOSET(fd,len); - - // add new entry to the chars list - sd->found_char[char_dat.slot] = result; // the char_id of the new char - } - #if PACKETVER >= 20120307 - RFIFOSKIP(fd,31); - #else - RFIFOSKIP(fd,37); - #endif + chr->parse_char_create_new_char(fd, sd); } break; @@ -4554,68 +5136,7 @@ int parse_char(int fd) if (cmd == 0x68) FIFOSD_CHECK(46); if (cmd == 0x1fb) FIFOSD_CHECK(56); { - int cid = RFIFOL(fd,2); - int i; -#if PACKETVER >= 20110309 - if( *pincode->enabled ){ // hack check - struct online_char_data* character; - character = (struct online_char_data*)idb_get(online_char_db, sd->account_id); - if( character && character->pincode_enable == -1 ){ - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x6c; - WFIFOB(fd,2) = 0; - WFIFOSET(fd,3); - RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); - break; - } - } -#endif - ShowInfo(CL_RED"Request Char Deletion: "CL_GREEN"%d (%d)"CL_RESET"\n", sd->account_id, cid); - memcpy(email, RFIFOP(fd,6), 40); - RFIFOSKIP(fd,( cmd == 0x68) ? 46 : 56); - - // Check if e-mail is correct - if(strcmpi(email, sd->email) && //email does not matches and - ( - strcmp("a@a.com", sd->email) || //it is not default email, or - (strcmp("a@a.com", email) && strcmp("", email)) //email sent does not matches default - )) { //Fail - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x70; - WFIFOB(fd,2) = 0; // 00 = Incorrect Email address - WFIFOSET(fd,3); - break; - } - - // check if this char exists - ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); - if( i == MAX_CHARS ) - { // Such a character does not exist in the account - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x70; - WFIFOB(fd,2) = 0; - WFIFOSET(fd,3); - break; - } - - // remove char from list and compact it - sd->found_char[i] = -1; - - /* Delete character */ - if(delete_char_sql(cid)<0){ - //can't delete the char - //either SQL error or can't delete by some CONFIG conditions - //del fail - WFIFOHEAD(fd,3); - WFIFOW(fd, 0) = 0x70; - WFIFOB(fd, 2) = 0; - WFIFOSET(fd, 3); - break; - } - /* Char successfully deleted.*/ - WFIFOHEAD(fd,2); - WFIFOW(fd,0) = 0x6f; - WFIFOSET(fd,2); + chr->parse_char_delete_char(fd, sd, cmd); } break; @@ -4624,35 +5145,14 @@ int parse_char(int fd) case 0x187: if (RFIFOREST(fd) < 6) return 0; - RFIFOSKIP(fd,6); + chr->parse_char_ping(fd); break; // char rename request // R 08fc <char ID>.l <new name>.24B case 0x8fc: FIFOSD_CHECK(30); { - int i, cid =RFIFOL(fd,2); - char name[NAME_LENGTH]; - char esc_name[NAME_LENGTH*2+1]; - safestrncpy(name, (char *)RFIFOP(fd,6), NAME_LENGTH); - RFIFOSKIP(fd,30); - - ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); - if( i == MAX_CHARS ) - break; - - normalize_name(name,TRIM_CHARS); - SQL->EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); - if( !check_char_name(name,esc_name) ) { - i = 1; - safestrncpy(sd->new_name, name, NAME_LENGTH); - } else - i = 0; - - WFIFOHEAD(fd, 4); - WFIFOW(fd,0) = 0x28e; - WFIFOW(fd,2) = i; - WFIFOSET(fd,4); + chr->parse_char_rename_char(fd, sd); } break; @@ -4661,32 +5161,7 @@ int parse_char(int fd) case 0x28d: FIFOSD_CHECK(34); { - int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); - char name[NAME_LENGTH]; - char esc_name[NAME_LENGTH*2+1]; - safestrncpy(name, (char *)RFIFOP(fd,10), NAME_LENGTH); - RFIFOSKIP(fd,34); - - if( aid != sd->account_id ) - break; - ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); - if( i == MAX_CHARS ) - break; - - normalize_name(name,TRIM_CHARS); - SQL->EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); - if( !check_char_name(name,esc_name) ) - { - i = 1; - safestrncpy(sd->new_name, name, NAME_LENGTH); - } - else - i = 0; - - WFIFOHEAD(fd, 4); - WFIFOW(fd,0) = 0x28e; - WFIFOW(fd,2) = i; - WFIFOSET(fd,4); + chr->parse_char_rename_char2(fd, sd); } break; //Confirm change name. @@ -4699,63 +5174,38 @@ int parse_char(int fd) // 4: Another user is using this character name, so please select another one. FIFOSD_CHECK(6); { - int i; - int cid = RFIFOL(fd,2); - RFIFOSKIP(fd,6); - - ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); - if( i == MAX_CHARS ) - break; - i = rename_char_sql(sd, cid); - - WFIFOHEAD(fd, 4); - WFIFOW(fd,0) = 0x290; - WFIFOW(fd,2) = i; - WFIFOSET(fd,4); + chr->parse_char_rename_char_confirm(fd, sd); } break; // captcha code request (not implemented) // R 07e5 <?>.w <aid>.l case 0x7e5: - WFIFOHEAD(fd,5); - WFIFOW(fd,0) = 0x7e9; - WFIFOW(fd,2) = 5; - WFIFOB(fd,4) = 1; - WFIFOSET(fd,5); - RFIFOSKIP(fd,8); + chr->parse_char_request_captcha(fd); break; // captcha code check (not implemented) // R 07e7 <len>.w <aid>.l <code>.b10 <?>.b14 case 0x7e7: - WFIFOHEAD(fd,5); - WFIFOW(fd,0) = 0x7e9; - WFIFOW(fd,2) = 5; - WFIFOB(fd,4) = 1; - WFIFOSET(fd,5); - RFIFOSKIP(fd,32); + chr->parse_char_check_captcha(fd); break; // deletion timer request case 0x827: FIFOSD_CHECK(6); - char_delete2_req(fd, sd); - RFIFOSKIP(fd,6); + chr->parse_char_delete2_req(fd, sd); break; // deletion accept request case 0x829: FIFOSD_CHECK(12); - char_delete2_accept(fd, sd); - RFIFOSKIP(fd,12); + chr->parse_char_delete2_accept(fd, sd); break; // deletion cancel request case 0x82b: FIFOSD_CHECK(6); - char_delete2_cancel(fd, sd); - RFIFOSKIP(fd,6); + chr->parse_char_delete2_cancel(fd, sd); break; // login as map-server @@ -4763,116 +5213,51 @@ int parse_char(int fd) if (RFIFOREST(fd) < 60) return 0; { - char* l_user = (char*)RFIFOP(fd,2); - char* l_pass = (char*)RFIFOP(fd,26); - int i; - l_user[23] = '\0'; - l_pass[23] = '\0'; - ARR_FIND( 0, ARRAYLENGTH(server), i, server[i].fd <= 0 ); - if( runflag != CHARSERVER_ST_RUNNING || - i == ARRAYLENGTH(server) || - strcmp(l_user, userid) != 0 || - strcmp(l_pass, passwd) != 0 ) - { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x2af9; - WFIFOB(fd,2) = 3; - WFIFOSET(fd,3); - } else { - WFIFOHEAD(fd,3); - WFIFOW(fd,0) = 0x2af9; - WFIFOB(fd,2) = 0; - WFIFOSET(fd,3); - - server[i].fd = fd; - server[i].ip = ntohl(RFIFOL(fd,54)); - server[i].port = ntohs(RFIFOW(fd,58)); - server[i].users = 0; - session[fd]->func_parse = parse_frommap; - session[fd]->flag.server = 1; - realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); - char_mapif_init(fd); - } - sockt->datasync(fd, true); - - RFIFOSKIP(fd,60); + chr->parse_char_login_map_server(fd); } return 0; // avoid processing of follow-up packets here // checks the entered pin case 0x8b8: FIFOSD_CHECK(10); - - if( RFIFOL(fd,2) == sd->account_id ) - pincode->check( fd, sd ); - - RFIFOSKIP(fd,10); + chr->parse_char_pincode_check(fd, sd); break; // request for PIN window case 0x8c5: FIFOSD_CHECK(6); - - if( RFIFOL(fd,2) == sd->account_id ) - pincode->sendstate( fd, sd, PINCODE_NOTSET ); - - RFIFOSKIP(fd,6); + chr->parse_char_pincode_window(fd, sd); break; // pincode change request case 0x8be: FIFOSD_CHECK(14); - - if( RFIFOL(fd,2) == sd->account_id ) - pincode->change( fd, sd ); - - RFIFOSKIP(fd,14); + chr->parse_char_pincode_change(fd, sd); break; // activate PIN system and set first PIN case 0x8ba: FIFOSD_CHECK(10); - - if( RFIFOL(fd,2) == sd->account_id ) - pincode->setnew( fd, sd ); - RFIFOSKIP(fd,10); + chr->parse_char_pincode_first_pin(fd, sd); break; case 0x9a1: FIFOSD_CHECK(2); - mmo_char_send099d(fd, sd); - RFIFOSKIP(fd,2); + chr->parse_char_request_chars(fd, sd); break; /* 0x8d4 <from>.W <to>.W <unused>.W (2+2+2+2) */ case 0x8d4: FIFOSD_CHECK(8); { - bool ret; - ret = char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); - WFIFOHEAD(fd, 8); - WFIFOW(fd, 0) = 0x8d5; - WFIFOW(fd, 2) = 8; - WFIFOW(fd, 4) = ret?0:1; - WFIFOW(fd, 6) = 0;/* we enforce it elsewhere, go 0 */ - WFIFOSET(fd, 8); - /* for some stupid reason it requires the char data again (gravity -_-) */ - if( ret ) -#if PACKETVER >= 20130000 - mmo_char_send099d(fd, sd); -#else - mmo_char_send006b(fd, sd); -#endif - - RFIFOSKIP(fd, 8); + chr->parse_char_move_character(fd, sd); } break; // unknown packet received default: - ShowError("parse_char: Received unknown packet "CL_WHITE"0x%x"CL_RESET" from ip '"CL_WHITE"%s"CL_RESET"'! Disconnecting!\n", RFIFOW(fd,0), ip2str(ipl, NULL)); - set_eof(fd); - return 0; + if (chr->parse_char_unknown_packet(fd, ipl)) + return 0; } } @@ -4932,9 +5317,25 @@ int mapif_send(int fd, unsigned char *buf, unsigned int len) return 0; } -int broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { +void loginif_send_users_count(int users) +{ + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2714; + WFIFOL(chr->login_fd,2) = users; + WFIFOSET(chr->login_fd,6); +} + +void mapif_send_users_count(int users) +{ uint8 buf[6]; - int users = count_users(); + // send number of players to all map-servers + WBUFW(buf,0) = 0x2b00; + WBUFL(buf,2) = users; + mapif->sendall(buf,6); +} + +int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int users = chr->count_users(); // only send an update when needed static int prev_users = 0; @@ -4942,19 +5343,13 @@ int broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { return 0; prev_users = users; - if( login_fd > 0 && session[login_fd] ) + if( chr->login_fd > 0 && session[chr->login_fd] ) { // send number of user to login server - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x2714; - WFIFOL(login_fd,2) = users; - WFIFOSET(login_fd,6); + loginif->send_users_count(users); } - // send number of players to all map-servers - WBUFW(buf,0) = 0x2b00; - WBUFL(buf,2) = users; - mapif_sendall(buf,6); + mapif->send_users_count(users); return 0; } @@ -4963,78 +5358,83 @@ int broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { * Load this character's account id into the 'online accounts' packet * @see DBApply */ -static int send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap) +static int char_send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap) { struct online_char_data* character = DB->data2ptr(data); int* i = va_arg(ap, int*); if(character->server > -1) { - WFIFOL(login_fd,8+(*i)*4) = character->account_id; + WFIFOL(chr->login_fd,8+(*i)*4) = character->account_id; (*i)++; return 1; } return 0; } -int send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { - if (login_fd > 0 && session[login_fd]) +int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && session[chr->login_fd]) { // send account list to login server - int users = online_char_db->size(online_char_db); + int users = chr->online_char_db->size(chr->online_char_db); int i = 0; - WFIFOHEAD(login_fd,8+users*4); - WFIFOW(login_fd,0) = 0x272d; - online_char_db->foreach(online_char_db, send_accounts_tologin_sub, &i, users); - WFIFOW(login_fd,2) = 8+ i*4; - WFIFOL(login_fd,4) = i; - WFIFOSET(login_fd,WFIFOW(login_fd,2)); + WFIFOHEAD(chr->login_fd,8+users*4); + WFIFOW(chr->login_fd,0) = 0x272d; + chr->online_char_db->foreach(chr->online_char_db, chr->send_accounts_tologin_sub, &i, users); + WFIFOW(chr->login_fd,2) = 8+ i*4; + WFIFOL(chr->login_fd,4) = i; + WFIFOSET(chr->login_fd,WFIFOW(chr->login_fd,2)); } return 0; } -int check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { - if (login_fd > 0 && session[login_fd] != NULL) +void loginif_connect_to_server(void) +{ + WFIFOHEAD(chr->login_fd,86); + WFIFOW(chr->login_fd,0) = 0x2710; + memcpy(WFIFOP(chr->login_fd,2), userid, 24); + memcpy(WFIFOP(chr->login_fd,26), passwd, 24); + WFIFOL(chr->login_fd,50) = 0; + WFIFOL(chr->login_fd,54) = htonl(char_ip); + WFIFOW(chr->login_fd,58) = htons(char_port); + memcpy(WFIFOP(chr->login_fd,60), server_name, 20); + WFIFOW(chr->login_fd,80) = 0; + WFIFOW(chr->login_fd,82) = char_server_type; + WFIFOW(chr->login_fd,84) = char_new_display; //only display (New) if they want to [Kevin] + WFIFOSET(chr->login_fd,86); +} + +int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + if (chr->login_fd > 0 && session[chr->login_fd] != NULL) return 0; ShowInfo("Attempt to connect to login-server...\n"); - if ( (login_fd = make_connection(login_ip, login_port, NULL)) == -1) { //Try again later. [Skotlex] - login_fd = 0; + if ( (chr->login_fd = make_connection(login_ip, login_port, NULL)) == -1) { //Try again later. [Skotlex] + chr->login_fd = 0; return 0; } - session[login_fd]->func_parse = parse_fromlogin; - session[login_fd]->flag.server = 1; - realloc_fifo(login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); - - WFIFOHEAD(login_fd,86); - WFIFOW(login_fd,0) = 0x2710; - memcpy(WFIFOP(login_fd,2), userid, 24); - memcpy(WFIFOP(login_fd,26), passwd, 24); - WFIFOL(login_fd,50) = 0; - WFIFOL(login_fd,54) = htonl(char_ip); - WFIFOW(login_fd,58) = htons(char_port); - memcpy(WFIFOP(login_fd,60), server_name, 20); - WFIFOW(login_fd,80) = 0; - WFIFOW(login_fd,82) = char_server_type; - WFIFOW(login_fd,84) = char_new_display; //only display (New) if they want to [Kevin] - WFIFOSET(login_fd,86); + session[chr->login_fd]->func_parse = chr->parse_fromlogin; + session[chr->login_fd]->flag.server = 1; + realloc_fifo(chr->login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + + loginif->connect_to_server(); return 1; } //------------------------------------------------ -//Invoked 15 seconds after mapif_disconnectplayer in case the map server doesn't +//Invoked 15 seconds after mapif->disconnectplayer in case the map server doesn't //replies/disconnect the player we tried to kick. [Skotlex] //------------------------------------------------ -static int chardb_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { struct online_char_data* character; - if ((character = (struct online_char_data*)idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid) + if ((character = (struct online_char_data*)idb_get(chr->online_char_db, id)) != NULL && character->waiting_disconnect == tid) { //Mark it offline due to timeout. character->waiting_disconnect = INVALID_TIMER; - set_char_offline(character->char_id, character->account_id); + chr->set_char_offline(character->char_id, character->account_id); } return 0; } @@ -5042,21 +5442,21 @@ static int chardb_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) /** * @see DBApply */ -static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap) +static int char_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap) { struct online_char_data *character= DB->data2ptr(data); if (character->fd != -1) return 0; //Character still connected if (character->server == -2) //Unknown server.. set them offline - set_char_offline(character->char_id, character->account_id); + chr->set_char_offline(character->char_id, character->account_id); if (character->server < 0) //Free data from players that have not been online for a while. - db_remove(online_char_db, key); + db_remove(chr->online_char_db, key); return 0; } -static int online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { - online_char_db->foreach(online_char_db, online_data_cleanup_sub); +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); return 0; } @@ -5114,7 +5514,7 @@ int char_lan_config_read(const char *lancfgName) return 0; } -void sql_config_read(const char* cfgName) +void char_sql_config_read(const char* cfgName) { char line[1024], w1[1024], w2[1024]; FILE* fp; @@ -5207,11 +5607,12 @@ void sql_config_read(const char* cfgName) //support the import command, just like any other config else if(!strcmpi(w1,"import")) - sql_config_read(w2); + chr->sql_config_read(w2); } fclose(fp); ShowInfo("Done reading %s.\n", cfgName); } + void char_config_dispatch(char *w1, char *w2) { bool (*dispatch_to[]) (char *w1, char *w2) = { /* as many as it needs */ @@ -5223,6 +5624,7 @@ void char_config_dispatch(char *w1, char *w2) { break;/* we found who this belongs to, can stop */ } } + int char_config_read(const char* cfgName) { char line[1024], w1[1024], w2[1024]; @@ -5333,7 +5735,7 @@ int char_config_read(const char* cfgName) // Format is: id1,quantity1,stackable1,idN,quantityN,stackableN if( i%3 ) { - ShowWarning("char_config_read: There are not enough parameters in start_items, ignoring last item...\n"); + ShowWarning("chr->config_read: There are not enough parameters in start_items, ignoring last item...\n"); if( i%3 == 1 ) start_items[i-1] = 0; else @@ -5385,9 +5787,9 @@ int char_config_read(const char* cfgName) } else if (strcmpi(w1, "char_maintenance_min_group_id") == 0) { char_maintenance_min_group_id = atoi(w2); } else if (strcmpi(w1, "import") == 0) { - char_config_read(w2); + chr->config_read(w2); } else - char_config_dispatch(w1,w2); + chr->config_dispatch(w1,w2); } fclose(fp); @@ -5402,31 +5804,31 @@ int do_final(void) { HPM->event(HPET_FINAL); - set_all_offline(-1); - set_all_offline_sql(); + chr->set_all_offline(-1); + chr->set_all_offline_sql(); - inter_final(); + inter->final(); flush_fifos(); do_final_mapif(); do_final_loginif(); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) + Sql_ShowDebug(inter->sql_handle); - char_db_->destroy(char_db_, NULL); - online_char_db->destroy(online_char_db, NULL); + chr->char_db_->destroy(chr->char_db_, NULL); + chr->online_char_db->destroy(chr->online_char_db, NULL); auth_db->destroy(auth_db, NULL); - if( char_fd != -1 ) { - do_close(char_fd); - char_fd = -1; + if( chr->char_fd != -1 ) { + do_close(chr->char_fd); + chr->char_fd = -1; } HPM_char_do_final(); - SQL->Free(sql_handle); + SQL->Free(inter->sql_handle); mapindex->final(); for(i = 0; i < MAX_MAP_SERVERS; i++ ) @@ -5451,7 +5853,6 @@ void set_server_type(void) { SERVER_TYPE = SERVER_TYPE_CHAR; } - /// Called when a terminate signal is received. void do_shutdown(void) { @@ -5462,15 +5863,31 @@ void do_shutdown(void) ShowStatus("Shutting down...\n"); // TODO proper shutdown procedure; wait for acks?, kick all characters, ... [FlavoJS] for( id = 0; id < ARRAYLENGTH(server); ++id ) - mapif_server_reset(id); - loginif_check_shutdown(); + mapif->server_reset(id); + loginif->check_shutdown(); flush_fifos(); runflag = CORE_ST_STOP; } } void char_hp_symbols(void) { - HPM->share(sql_handle,"sql_handle"); + HPM->share(chr, "chr"); + HPM->share(geoip, "geoip"); + HPM->share(inter_auction, "inter_auction"); + HPM->share(inter_elemental, "inter_elemental"); + HPM->share(inter_guild, "inter_guild"); + HPM->share(inter_homunculus, "inter_homunculus"); + HPM->share(inter_mail, "inter_mail"); + HPM->share(inter_mercenary, "inter_mercenary"); + HPM->share(inter_party, "inter_party"); + HPM->share(inter_pet, "inter_pet"); + HPM->share(inter_quest, "inter_quest"); + HPM->share(inter_storage, "inter_storage"); + HPM->share(inter, "inter"); + HPM->share(loginif, "loginif"); + HPM->share(mapif, "mapif"); + HPM->share(pincode, "pincode"); + HPM->share(inter->sql_handle, "sql_handle"); } int do_init(int argc, char **argv) { @@ -5480,8 +5897,7 @@ int do_init(int argc, char **argv) { for(i = 0; i < MAX_MAP_SERVERS; i++ ) server[i].map = NULL; - mapindex_defaults(); - pincode_defaults(); + char_load_defaults(); HPM_char_do_init(); HPM->symbol_defaults_sub = char_hp_symbols; @@ -5510,9 +5926,9 @@ int do_init(int argc, char **argv) { mapindex->init(); start_point.map = mapindex->name2id("new_zone01"); - char_config_read((argc < 2) ? CHAR_CONF_NAME : argv[1]); - char_lan_config_read((argc > 3) ? argv[3] : LAN_CONF_NAME); - sql_config_read(SQL_CONF_NAME); + chr->config_read((argc < 2) ? CHAR_CONF_NAME : argv[1]); + chr->lan_config_read((argc > 3) ? argv[3] : LAN_CONF_NAME); + chr->sql_config_read(SQL_CONF_NAME); if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) { ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"); @@ -5520,15 +5936,15 @@ int do_init(int argc, char **argv) { ShowNotice("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"); } - inter_init_sql((argc > 2) ? argv[2] : inter_cfgName); // inter server configuration + inter->init_sql((argc > 2) ? argv[2] : inter_cfgName); // inter server configuration auth_db = idb_alloc(DB_OPT_RELEASE_DATA); - online_char_db = idb_alloc(DB_OPT_RELEASE_DATA); + chr->online_char_db = idb_alloc(DB_OPT_RELEASE_DATA); HPM->event(HPET_INIT); - mmo_char_sql_init(); - char_read_fame_list(); //Read fame lists. + chr->mmo_char_sql_init(); + chr->read_fame_list(); //Read fame lists. if ((sockt->naddr_ != 0) && (!login_ip || !char_ip)) { char ip_str[16]; @@ -5552,39 +5968,39 @@ int do_init(int argc, char **argv) { do_init_mapif(); // periodically update the overall user count on all mapservers + login server - timer->add_func_list(broadcast_user_count, "broadcast_user_count"); - timer->add_interval(timer->gettick() + 1000, broadcast_user_count, 0, 0, 5 * 1000); + timer->add_func_list(chr->broadcast_user_count, "chr->broadcast_user_count"); + timer->add_interval(timer->gettick() + 1000, chr->broadcast_user_count, 0, 0, 5 * 1000); - // Timer to clear (online_char_db) - timer->add_func_list(chardb_waiting_disconnect, "chardb_waiting_disconnect"); + // Timer to clear (chr->online_char_db) + timer->add_func_list(chr->waiting_disconnect, "chr->waiting_disconnect"); // Online Data timers (checking if char still connected) - timer->add_func_list(online_data_cleanup, "online_data_cleanup"); - timer->add_interval(timer->gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000); + timer->add_func_list(chr->online_data_cleanup, "chr->online_data_cleanup"); + timer->add_interval(timer->gettick() + 1000, chr->online_data_cleanup, 0, 0, 600 * 1000); //Cleaning the tables for NULL entries @ startup [Sirius] //Chardb clean - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) ) + Sql_ShowDebug(inter->sql_handle); //guilddb clean - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) ) + Sql_ShowDebug(inter->sql_handle); //guildmemberdb clean - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) ) + Sql_ShowDebug(inter->sql_handle); - set_defaultparse(parse_char); + set_defaultparse(chr->parse_char); - if( (char_fd = make_listen_bind(bind_ip,char_port)) == -1 ) { + if( (chr->char_fd = make_listen_bind(bind_ip,char_port)) == -1 ) { ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",char_port); exit(EXIT_FAILURE); } - Sql_HerculesUpdateCheck(sql_handle); + Sql_HerculesUpdateCheck(inter->sql_handle); #ifdef CONSOLE_INPUT - console->input->setSQL(sql_handle); + console->input->setSQL(inter->sql_handle); #endif ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port); @@ -5598,3 +6014,193 @@ int do_init(int argc, char **argv) { return 0; } + +void char_load_defaults(void) +{ + mapindex_defaults(); + pincode_defaults(); + char_defaults(); + loginif_defaults(); + mapif_defaults(); + inter_auction_defaults(); + inter_elemental_defaults(); + inter_guild_defaults(); + inter_homunculus_defaults(); + inter_mail_defaults(); + inter_mercenary_defaults(); + inter_party_defaults(); + inter_pet_defaults(); + inter_quest_defaults(); + inter_storage_defaults(); + inter_defaults(); + geoip_defaults(); +} + +void char_defaults(void) +{ + chr = &char_s; + + chr->login_fd = 0; + chr->char_fd = -1; + chr->online_char_db = NULL; + chr->char_db_ = NULL; + + chr->waiting_disconnect = char_waiting_disconnect; + chr->delete_char_sql = char_delete_char_sql; + chr->create_online_char_data = char_create_online_char_data; + chr->set_account_online = char_set_account_online; + chr->set_account_offline = char_set_account_offline; + chr->set_char_charselect = char_set_char_charselect; + chr->set_char_online = char_set_char_online; + chr->set_char_offline = char_set_char_offline; + chr->db_setoffline = char_db_setoffline; + chr->db_kickoffline = char_db_kickoffline; + chr->set_login_all_offline = char_set_login_all_offline; + chr->set_all_offline = char_set_all_offline; + chr->set_all_offline_sql = char_set_all_offline_sql; + chr->create_charstatus = char_create_charstatus; + chr->mmo_char_tosql = char_mmo_char_tosql; + chr->memitemdata_to_sql = char_memitemdata_to_sql; + chr->inventory_to_sql = char_inventory_to_sql; + chr->mmo_chars_fromsql = char_mmo_chars_fromsql; + chr->mmo_char_fromsql = char_mmo_char_fromsql; + chr->mmo_char_sql_init = char_mmo_char_sql_init; + chr->char_slotchange = char_char_slotchange; + chr->rename_char_sql = char_rename_char_sql; + chr->check_char_name = char_check_char_name; + chr->make_new_char_sql = char_make_new_char_sql; + chr->divorce_char_sql = char_divorce_char_sql; + chr->count_users = char_count_users; + chr->mmo_char_tobuf = char_mmo_char_tobuf; + chr->mmo_char_send099d = char_mmo_char_send099d; + chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; + chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; + chr->mmo_char_send_characters = char_mmo_char_send_characters; + chr->char_married = char_char_married; + chr->char_child = char_char_child; + chr->char_family = char_char_family; + chr->disconnect_player = char_disconnect_player; + chr->authfail_fd = char_authfail_fd; + chr->request_account_data = char_request_account_data; + chr->auth_ok = char_auth_ok; + chr->ping_login_server = char_ping_login_server; + chr->parse_fromlogin_connection_state = char_parse_fromlogin_connection_state; + chr->auth_error = char_auth_error; + chr->parse_fromlogin_auth_state = char_parse_fromlogin_auth_state; + chr->parse_fromlogin_account_data = char_parse_fromlogin_account_data; + chr->parse_fromlogin_login_pong = char_parse_fromlogin_login_pong; + chr->changesex = char_changesex; + chr->parse_fromlogin_changesex_reply = char_parse_fromlogin_changesex_reply; + chr->parse_fromlogin_account_reg2 = char_parse_fromlogin_account_reg2; + chr->parse_fromlogin_ban = char_parse_fromlogin_ban; + chr->parse_fromlogin_kick = char_parse_fromlogin_kick; + chr->update_ip = char_update_ip; + chr->parse_fromlogin_update_ip = char_parse_fromlogin_update_ip; + chr->parse_fromlogin_accinfo2_failed = char_parse_fromlogin_accinfo2_failed; + chr->parse_fromlogin_accinfo2_ok = char_parse_fromlogin_accinfo2_ok; + chr->parse_fromlogin = char_parse_fromlogin; + chr->request_accreg2 = char_request_accreg2; + chr->global_accreg_to_login_start = char_global_accreg_to_login_start; + chr->global_accreg_to_login_send = char_global_accreg_to_login_send; + chr->global_accreg_to_login_add = char_global_accreg_to_login_add; + chr->read_fame_list = char_read_fame_list; + chr->send_fame_list = char_send_fame_list; + chr->update_fame_list = char_update_fame_list; + chr->loadName = char_loadName; + chr->parse_frommap_datasync = char_parse_frommap_datasync; + chr->parse_frommap_skillid2idx = char_parse_frommap_skillid2idx; + chr->map_received_ok = char_map_received_ok; + chr->send_maps = char_send_maps; + chr->parse_frommap_map_names = char_parse_frommap_map_names; + chr->send_scdata = char_send_scdata; + chr->parse_frommap_request_scdata = char_parse_frommap_request_scdata; + chr->parse_frommap_set_users_count = char_parse_frommap_set_users_count; + chr->parse_frommap_set_users = char_parse_frommap_set_users; + chr->save_character_ack = char_save_character_ack; + chr->parse_frommap_save_character = char_parse_frommap_save_character; + chr->select_ack = char_select_ack; + chr->parse_frommap_char_select_req = char_parse_frommap_char_select_req; + chr->change_map_server_ack = char_change_map_server_ack; + chr->parse_frommap_change_map_server = char_parse_frommap_change_map_server; + chr->parse_frommap_remove_friend = char_parse_frommap_remove_friend; + chr->char_name_ack = char_char_name_ack; + chr->parse_frommap_char_name_request = char_parse_frommap_char_name_request; + chr->parse_frommap_change_email = char_parse_frommap_change_email; + chr->ban = char_ban; + chr->unban = char_unban; + chr->ask_name_ack = char_ask_name_ack; + chr->parse_frommap_change_account = char_parse_frommap_change_account; + chr->parse_frommap_fame_list = char_parse_frommap_fame_list; + chr->parse_frommap_divorce_char = char_parse_frommap_divorce_char; + chr->parse_frommap_ragsrvinfo = char_parse_frommap_ragsrvinfo; + chr->parse_frommap_set_char_offline = char_parse_frommap_set_char_offline; + chr->parse_frommap_set_all_offline = char_parse_frommap_set_all_offline; + chr->parse_frommap_set_char_online = char_parse_frommap_set_char_online; + chr->parse_frommap_build_fame_list = char_parse_frommap_build_fame_list; + chr->parse_frommap_save_status_change_data = char_parse_frommap_save_status_change_data; + chr->send_pong = char_send_pong; + chr->parse_frommap_ping = char_parse_frommap_ping; + chr->map_auth_ok = char_map_auth_ok; + chr->map_auth_failed = char_map_auth_failed; + chr->parse_frommap_auth_request = char_parse_frommap_auth_request; + chr->parse_frommap_update_ip = char_parse_frommap_update_ip; + chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; + chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; + chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; + chr->parse_frommap = char_parse_frommap; + chr->search_mapserver = char_search_mapserver; + chr->mapif_init = char_mapif_init; + chr->lan_subnetcheck = char_lan_subnetcheck; + chr->delete2_ack = char_delete2_ack; + chr->delete2_accept_actual_ack = char_delete2_accept_actual_ack; + chr->delete2_accept_ack = char_delete2_accept_ack; + chr->delete2_cancel_ack = char_delete2_cancel_ack; + chr->delete2_req = char_delete2_req; + chr->delete2_accept = char_delete2_accept; + chr->delete2_cancel = char_delete2_cancel; + chr->send_account_id = char_send_account_id; + chr->parse_char_connect = char_parse_char_connect; + chr->send_map_info = char_send_map_info; + chr->send_wait_char_server = char_send_wait_char_server; + chr->search_default_maps_mapserver = char_search_default_maps_mapserver; + chr->parse_char_select = char_parse_char_select; + chr->creation_failed = char_creation_failed; + chr->creation_ok = char_creation_ok; + chr->parse_char_create_new_char = char_parse_char_create_new_char; + chr->delete_char_failed = char_delete_char_failed; + chr->delete_char_ok = char_delete_char_ok; + chr->parse_char_delete_char = char_parse_char_delete_char; + chr->parse_char_ping = char_parse_char_ping; + chr->allow_rename = char_allow_rename; + chr->parse_char_rename_char = char_parse_char_rename_char; + chr->parse_char_rename_char2 = char_parse_char_rename_char2; + chr->rename_char_ack = char_rename_char_ack; + chr->parse_char_rename_char_confirm = char_parse_char_rename_char_confirm; + chr->captcha_notsupported = char_captcha_notsupported; + chr->parse_char_request_captcha = char_parse_char_request_captcha; + chr->parse_char_check_captcha = char_parse_char_check_captcha; + chr->parse_char_delete2_req = char_parse_char_delete2_req; + chr->parse_char_delete2_accept = char_parse_char_delete2_accept; + chr->parse_char_delete2_cancel = char_parse_char_delete2_cancel; + chr->login_map_server_ack = char_login_map_server_ack; + chr->parse_char_login_map_server = char_parse_char_login_map_server; + chr->parse_char_pincode_check = char_parse_char_pincode_check; + chr->parse_char_pincode_window = char_parse_char_pincode_window; + chr->parse_char_pincode_change = char_parse_char_pincode_change; + chr->parse_char_pincode_first_pin = char_parse_char_pincode_first_pin; + chr->parse_char_request_chars = char_parse_char_request_chars; + chr->change_character_slot_ack = char_change_character_slot_ack; + chr->parse_char_move_character = char_parse_char_move_character; + chr->parse_char_unknown_packet = char_parse_char_unknown_packet; + chr->parse_char = char_parse_char; + chr->broadcast_user_count = char_broadcast_user_count; + chr->send_accounts_tologin_sub = char_send_accounts_tologin_sub; + chr->send_accounts_tologin = char_send_accounts_tologin; + chr->check_connect_login_server = char_check_connect_login_server; + chr->online_data_cleanup_sub = char_online_data_cleanup_sub; + chr->online_data_cleanup = char_online_data_cleanup; + chr->lan_config_read = char_lan_config_read; + chr->sql_config_read = char_sql_config_read; + chr->config_dispatch = char_config_dispatch; + chr->config_read = char_config_read; +} diff --git a/src/char/char.h b/src/char/char.h index 4d053484b..3bedbd0ce 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -42,7 +42,6 @@ struct online_char_data { int pincode_enable; }; -DBMap* online_char_db; // int account_id -> struct online_char_data* #define MAX_MAP_SERVERS 2 @@ -55,21 +54,6 @@ enum { TABLE_GUILD_STORAGE, }; -int 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 disconnect_player(int account_id); - -int char_married(int pl1,int pl2); -int char_child(int parent_id, int child_id); -int char_family(int pl1,int pl2,int pl3); - -int request_accreg2(int account_id, int char_id); -int login_fd; extern int char_name_option; extern char char_name_letters[]; extern bool char_gm_read; @@ -117,8 +101,189 @@ extern int db_use_sql_mob_skill_db; extern int guild_exp_rate; extern int log_inter; -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 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; +}; + +/** + * char interface + **/ +struct char_interface { + int login_fd; + int char_fd; + DBMap* online_char_db; // int account_id -> struct online_char_data* + DBMap* char_db_; + 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 */ diff --git a/src/char/geoip.c b/src/char/geoip.c new file mode 100644 index 000000000..9a78c1ebd --- /dev/null +++ b/src/char/geoip.c @@ -0,0 +1,32 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + +#define HERCULES_CORE + +#include "geoip.h" + +#include <stdlib.h> + +#include "../common/cbasetypes.h" +#include "../common/mmo.h" +#include "../common/random.h" +#include "../common/showmsg.h" +#include "../common/socket.h" +#include "../common/strlib.h" + +struct s_geoip geoip_data; + +const char* geoip_getcountry(uint32 ipnum); +void geoip_final(bool shutdown); +void geoip_init(void); + +void geoip_defaults(void) { + geoip = &geoip_s; + + geoip->data = &geoip_data; + + geoip->getcountry = geoip_getcountry; + geoip->final = geoip_final; + geoip->init = geoip_init; +} diff --git a/src/char/geoip.h b/src/char/geoip.h new file mode 100644 index 000000000..c83d886b5 --- /dev/null +++ b/src/char/geoip.h @@ -0,0 +1,32 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + +#ifndef CHAR_GEOIP_H +#define CHAR_GEOIP_H + +#include "../common/cbasetypes.h" + +/** + * GeoIP information + **/ +struct s_geoip { + unsigned char *cache; // GeoIP.dat information see geoip->init() + bool active; +}; + +/** + * geoip interface + **/ +struct geoip_interface { + struct s_geoip *data; + const char* (*getcountry) (uint32 ipnum); + void (*final) (bool shutdown); + void (*init) (void); +} geoip_s; + +struct geoip_interface *geoip; + +void geoip_defaults(void); + +#endif /* CHAR_GEOIP_H */ diff --git a/src/char/int_auction.c b/src/char/int_auction.c index ddfef68c2..684faa46b 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -13,6 +13,7 @@ #include "char.h" #include "int_mail.h" #include "inter.h" +#include "mapif.h" #include "../common/db.h" #include "../common/malloc.h" #include "../common/mmo.h" @@ -22,16 +23,13 @@ #include "../common/strlib.h" #include "../common/timer.h" -static DBMap* auction_db_ = NULL; // int auction_id -> struct auction_data* +struct inter_auction_interface inter_auction_s; -void auction_delete(struct auction_data *auction); -static int auction_end_timer(int tid, int64 tick, int id, intptr_t data); - -static int auction_count(int char_id, bool buy) +static int inter_auction_count(int char_id, bool buy) { int i = 0; struct auction_data *auction; - DBIterator *iter = db_iterator(auction_db_); + DBIterator *iter = db_iterator(inter_auction->db); for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) ) { @@ -43,7 +41,7 @@ static int auction_count(int char_id, bool buy) return i; } -void auction_save(struct auction_data *auction) +void inter_auction_save(struct auction_data *auction) { int j; StringBuf buf; @@ -59,7 +57,7 @@ void auction_save(struct auction_data *auction) StrBuf->Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]); StrBuf->Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id); - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH)) @@ -73,7 +71,7 @@ void auction_save(struct auction_data *auction) StrBuf->Destroy(&buf); } -unsigned int auction_create(struct auction_data *auction) +unsigned int inter_auction_create(struct auction_data *auction) { int j; StringBuf buf; @@ -94,7 +92,7 @@ unsigned int auction_create(struct auction_data *auction) StrBuf->Printf(&buf, ",'%d'", auction->item.card[j]); StrBuf->AppendStr(&buf, ")"); - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH)) @@ -114,12 +112,12 @@ unsigned int auction_create(struct auction_data *auction) auction->item.expire_time = 0; auction->auction_id = (unsigned int)SQL->StmtLastInsertId(stmt); - auction->auction_end_timer = timer->add( timer->gettick() + tick , auction_end_timer, auction->auction_id, 0); + auction->auction_end_timer = timer->add( timer->gettick() + tick , inter_auction->end_timer, auction->auction_id, 0); ShowInfo("New Auction %u | time left %"PRId64" ms | By %s.\n", auction->auction_id, tick, auction->seller_name); CREATE(auction_, struct auction_data, 1); memcpy(auction_, auction, sizeof(struct auction_data)); - idb_put(auction_db_, auction_->auction_id, auction_); + idb_put(inter_auction->db, auction_->auction_id, auction_); } SQL->StmtFree(stmt); @@ -128,49 +126,49 @@ unsigned int auction_create(struct auction_data *auction) return auction->auction_id; } -static void mapif_Auction_message(int char_id, unsigned char result) +void mapif_auction_message(int char_id, unsigned char result) { unsigned char buf[74]; WBUFW(buf,0) = 0x3854; WBUFL(buf,2) = char_id; WBUFL(buf,6) = result; - mapif_sendall(buf,7); + mapif->sendall(buf,7); } -static int auction_end_timer(int tid, int64 tick, int id, intptr_t data) { +static int inter_auction_end_timer(int tid, int64 tick, int id, intptr_t data) { struct auction_data *auction; - if( (auction = (struct auction_data *)idb_get(auction_db_, id)) != NULL ) + if( (auction = (struct auction_data *)idb_get(inter_auction->db, id)) != NULL ) { if( auction->buyer_id ) { - mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Thanks, you won the auction!.", 0, &auction->item); - mapif_Auction_message(auction->buyer_id, 6); // You have won the auction - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->price, NULL); + inter_mail->sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Thanks, you won the auction!.", 0, &auction->item); + mapif->auction_message(auction->buyer_id, 6); // You have won the auction + inter_mail->sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->price, NULL); } else - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "No buyers have been found for your auction.", 0, &auction->item); + inter_mail->sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "No buyers have been found for your auction.", 0, &auction->item); ShowInfo("Auction End: id %u.\n", auction->auction_id); auction->auction_end_timer = INVALID_TIMER; - auction_delete(auction); + inter_auction->delete_(auction); } return 0; } -void auction_delete(struct auction_data *auction) +void inter_auction_delete(struct auction_data *auction) { unsigned int auction_id = auction->auction_id; - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%d'", auction_db, auction_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%d'", auction_db, auction_id) ) + Sql_ShowDebug(inter->sql_handle); if( auction->auction_end_timer != INVALID_TIMER ) - timer->delete(auction->auction_end_timer, auction_end_timer); + timer->delete(auction->auction_end_timer, inter_auction->end_timer); - idb_remove(auction_db_, auction_id); + idb_remove(inter_auction->db, auction_id); } void inter_auctions_fromsql(void) @@ -190,32 +188,32 @@ void inter_auctions_fromsql(void) StrBuf->Printf(&buf, ",`card%d`", i); StrBuf->Printf(&buf, " FROM `%s` ORDER BY `auction_id` DESC", auction_db); - if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); - while( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { CREATE(auction, struct auction_data, 1); - SQL->GetData(sql_handle, 0, &data, NULL); auction->auction_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); auction->seller_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); safestrncpy(auction->seller_name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 3, &data, NULL); auction->buyer_id = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); safestrncpy(auction->buyer_name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 5, &data, NULL); auction->price = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); auction->buynow = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); auction->hours = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); auction->timestamp = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); auction->auction_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); auction->seller_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); safestrncpy(auction->seller_name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 3, &data, NULL); auction->buyer_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); safestrncpy(auction->buyer_name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 5, &data, NULL); auction->price = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); auction->buynow = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); auction->hours = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); auction->timestamp = atoi(data); item = &auction->item; - SQL->GetData(sql_handle, 9, &data, NULL); item->nameid = atoi(data); - SQL->GetData(sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH); - SQL->GetData(sql_handle,11, &data, NULL); auction->type = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); item->nameid = atoi(data); + SQL->GetData(inter->sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH); + SQL->GetData(inter->sql_handle,11, &data, NULL); auction->type = atoi(data); - SQL->GetData(sql_handle,12, &data, NULL); item->refine = atoi(data); - SQL->GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data); - SQL->GetData(sql_handle,14, &data, NULL); item->unique_id = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle,12, &data, NULL); item->refine = atoi(data); + SQL->GetData(inter->sql_handle,13, &data, NULL); item->attribute = atoi(data); + SQL->GetData(inter->sql_handle,14, &data, NULL); item->unique_id = strtoull(data, NULL, 10); item->identify = 1; item->amount = 1; @@ -223,7 +221,7 @@ void inter_auctions_fromsql(void) for( i = 0; i < MAX_SLOTS; i++ ) { - SQL->GetData(sql_handle, 15 + i, &data, NULL); + SQL->GetData(inter->sql_handle, 15 + i, &data, NULL); item->card[i] = atoi(data); } @@ -232,14 +230,14 @@ void inter_auctions_fromsql(void) else endtick = tick + 10000; // 10 seconds to process ended auctions - auction->auction_end_timer = timer->add(endtick, auction_end_timer, auction->auction_id, 0); - idb_put(auction_db_, auction->auction_id, auction); + auction->auction_end_timer = timer->add(endtick, inter_auction->end_timer, auction->auction_id, 0); + idb_put(inter_auction->db, auction->auction_id, auction); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } -static void mapif_Auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf) +void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf) { int len = (sizeof(struct auction_data) * count) + 12; @@ -253,14 +251,14 @@ static void mapif_Auction_sendlist(int fd, int char_id, short count, short pages WFIFOSET(fd,len); } -static void mapif_parse_Auction_requestlist(int fd) +void mapif_parse_auction_requestlist(int fd) { char searchtext[NAME_LENGTH]; int char_id = RFIFOL(fd,4), len = sizeof(struct auction_data); int price = RFIFOL(fd,10); short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14)); unsigned char buf[5 * sizeof(struct auction_data)]; - DBIterator *iter = db_iterator(auction_db_); + DBIterator *iter = db_iterator(inter_auction->db); struct auction_data *auction; short i = 0, j = 0, pages = 1; @@ -293,10 +291,10 @@ static void mapif_parse_Auction_requestlist(int fd) } dbi_destroy(iter); - mapif_Auction_sendlist(fd, char_id, j, pages, buf); + mapif->auction_sendlist(fd, char_id, j, pages, buf); } -static void mapif_Auction_register(int fd, struct auction_data *auction) +void mapif_auction_register(int fd, struct auction_data *auction) { int len = sizeof(struct auction_data) + 4; @@ -307,20 +305,20 @@ static void mapif_Auction_register(int fd, struct auction_data *auction) WFIFOSET(fd,len); } -static void mapif_parse_Auction_register(int fd) +void mapif_parse_auction_register(int fd) { struct auction_data auction; if( RFIFOW(fd,2) != sizeof(struct auction_data) + 4 ) return; memcpy(&auction, RFIFOP(fd,4), sizeof(struct auction_data)); - if( auction_count(auction.seller_id, false) < 5 ) - auction.auction_id = auction_create(&auction); + if( inter_auction->count(auction.seller_id, false) < 5 ) + auction.auction_id = inter_auction->create(&auction); - mapif_Auction_register(fd, &auction); + mapif->auction_register(fd, &auction); } -static void mapif_Auction_cancel(int fd, int char_id, unsigned char result) +void mapif_auction_cancel(int fd, int char_id, unsigned char result) { WFIFOHEAD(fd,7); WFIFOW(fd,0) = 0x3852; @@ -329,36 +327,36 @@ static void mapif_Auction_cancel(int fd, int char_id, unsigned char result) WFIFOSET(fd,7); } -static void mapif_parse_Auction_cancel(int fd) +void mapif_parse_auction_cancel(int fd) { int char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6); struct auction_data *auction; - if( (auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL ) + if( (auction = (struct auction_data *)idb_get(inter_auction->db, auction_id)) == NULL ) { - mapif_Auction_cancel(fd, char_id, 1); // Bid Number is Incorrect + mapif->auction_cancel(fd, char_id, 1); // Bid Number is Incorrect return; } if( auction->seller_id != char_id ) { - mapif_Auction_cancel(fd, char_id, 2); // You cannot end the auction + mapif->auction_cancel(fd, char_id, 2); // You cannot end the auction return; } if( auction->buyer_id > 0 ) { - mapif_Auction_cancel(fd, char_id, 3); // An auction with at least one bidder cannot be canceled + mapif->auction_cancel(fd, char_id, 3); // An auction with at least one bidder cannot be canceled return; } - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction canceled.", 0, &auction->item); - auction_delete(auction); + inter_mail->sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction canceled.", 0, &auction->item); + inter_auction->delete_(auction); - mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled + mapif->auction_cancel(fd, char_id, 0); // The auction has been canceled } -static void mapif_Auction_close(int fd, int char_id, unsigned char result) +void mapif_auction_close(int fd, int char_id, unsigned char result) { WFIFOHEAD(fd,7); WFIFOW(fd,0) = 0x3853; @@ -367,40 +365,40 @@ static void mapif_Auction_close(int fd, int char_id, unsigned char result) WFIFOSET(fd,7); } -static void mapif_parse_Auction_close(int fd) +void mapif_parse_auction_close(int fd) { int char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6); struct auction_data *auction; - if( (auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL ) + if( (auction = (struct auction_data *)idb_get(inter_auction->db, auction_id)) == NULL ) { - mapif_Auction_close(fd, char_id, 2); // Bid Number is Incorrect + mapif->auction_close(fd, char_id, 2); // Bid Number is Incorrect return; } if( auction->seller_id != char_id ) { - mapif_Auction_close(fd, char_id, 1); // You cannot end the auction + mapif->auction_close(fd, char_id, 1); // You cannot end the auction return; } if( auction->buyer_id == 0 ) { - mapif_Auction_close(fd, char_id, 1); // You cannot end the auction + mapif->auction_close(fd, char_id, 1); // You cannot end the auction return; } // Send Money to Seller - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction closed.", auction->price, NULL); + inter_mail->sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction closed.", auction->price, NULL); // Send Item to Buyer - mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Auction winner.", 0, &auction->item); - mapif_Auction_message(auction->buyer_id, 6); // You have won the auction - auction_delete(auction); + inter_mail->sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Auction winner.", 0, &auction->item); + mapif->auction_message(auction->buyer_id, 6); // You have won the auction + inter_auction->delete_(auction); - mapif_Auction_close(fd, char_id, 0); // You have ended the auction + mapif->auction_close(fd, char_id, 0); // You have ended the auction } -static void mapif_Auction_bid(int fd, int char_id, int bid, unsigned char result) +void mapif_auction_bid(int fd, int char_id, int bid, unsigned char result) { WFIFOHEAD(fd,11); WFIFOW(fd,0) = 0x3855; @@ -410,21 +408,21 @@ static void mapif_Auction_bid(int fd, int char_id, int bid, unsigned char result WFIFOSET(fd,11); } -static void mapif_parse_Auction_bid(int fd) +void mapif_parse_auction_bid(int fd) { int char_id = RFIFOL(fd,4), bid = RFIFOL(fd,12); unsigned int auction_id = RFIFOL(fd,8); struct auction_data *auction; - if( (auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL || auction->price >= bid || auction->seller_id == char_id ) + if( (auction = (struct auction_data *)idb_get(inter_auction->db, auction_id)) == NULL || auction->price >= bid || auction->seller_id == char_id ) { - mapif_Auction_bid(fd, char_id, bid, 0); // You have failed to bid in the auction + mapif->auction_bid(fd, char_id, bid, 0); // You have failed to bid in the auction return; } - if( auction_count(char_id, true) > 4 && bid < auction->buynow && auction->buyer_id != char_id ) + if( inter_auction->count(char_id, true) > 4 && bid < auction->buynow && auction->buyer_id != char_id ) { - mapif_Auction_bid(fd, char_id, bid, 9); // You cannot place more than 5 bids at a time + mapif->auction_bid(fd, char_id, bid, 9); // You cannot place more than 5 bids at a time return; } @@ -432,11 +430,11 @@ static void mapif_parse_Auction_bid(int fd) { // Send Money back to the previous Buyer if( auction->buyer_id != char_id ) { - mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Someone has placed a higher bid.", auction->price, NULL); - mapif_Auction_message(auction->buyer_id, 7); // You have failed to win the auction + inter_mail->sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Someone has placed a higher bid.", auction->price, NULL); + mapif->auction_message(auction->buyer_id, 7); // You have failed to win the auction } else - mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "You have placed a higher bid.", auction->price, NULL); + inter_mail->sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "You have placed a higher bid.", auction->price, NULL); } auction->buyer_id = char_id; @@ -445,19 +443,19 @@ static void mapif_parse_Auction_bid(int fd) if( bid >= auction->buynow ) { // Automatic won the auction - mapif_Auction_bid(fd, char_id, bid - auction->buynow, 1); // You have successfully bid in the auction + mapif->auction_bid(fd, char_id, bid - auction->buynow, 1); // You have successfully bid in the auction - mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "You have won the auction.", 0, &auction->item); - mapif_Auction_message(char_id, 6); // You have won the auction - mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->buynow, NULL); + inter_mail->sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "You have won the auction.", 0, &auction->item); + mapif->auction_message(char_id, 6); // You have won the auction + inter_mail->sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Payment for your auction!.", auction->buynow, NULL); - auction_delete(auction); + inter_auction->delete_(auction); return; } - auction_save(auction); + inter_auction->save(auction); - mapif_Auction_bid(fd, char_id, 0, 1); // You have successfully bid in the auction + mapif->auction_bid(fd, char_id, 0, 1); // You have successfully bid in the auction } /*========================================== @@ -467,11 +465,11 @@ int inter_auction_parse_frommap(int fd) { switch(RFIFOW(fd,0)) { - case 0x3050: mapif_parse_Auction_requestlist(fd); break; - case 0x3051: mapif_parse_Auction_register(fd); break; - case 0x3052: mapif_parse_Auction_cancel(fd); break; - case 0x3053: mapif_parse_Auction_close(fd); break; - case 0x3055: mapif_parse_Auction_bid(fd); break; + case 0x3050: mapif->parse_auction_requestlist(fd); break; + case 0x3051: mapif->parse_auction_register(fd); break; + case 0x3052: mapif->parse_auction_cancel(fd); break; + case 0x3053: mapif->parse_auction_close(fd); break; + case 0x3055: mapif->parse_auction_bid(fd); break; default: return 0; } @@ -480,15 +478,32 @@ int inter_auction_parse_frommap(int fd) int inter_auction_sql_init(void) { - auction_db_ = idb_alloc(DB_OPT_RELEASE_DATA); - inter_auctions_fromsql(); + inter_auction->db = idb_alloc(DB_OPT_RELEASE_DATA); + inter_auction->fromsql(); return 0; } void inter_auction_sql_final(void) { - auction_db_->destroy(auction_db_,NULL); + inter_auction->db->destroy(inter_auction->db,NULL); return; } + +void inter_auction_defaults(void) +{ + inter_auction = &inter_auction_s; + + inter_auction->db = NULL; // int auction_id -> struct auction_data* + + inter_auction->count = inter_auction_count; + inter_auction->save = inter_auction_save; + inter_auction->create = inter_auction_create; + inter_auction->end_timer = inter_auction_end_timer; + inter_auction->delete_ = inter_auction_delete; + inter_auction->fromsql = inter_auctions_fromsql; + inter_auction->parse_frommap = inter_auction_parse_frommap; + inter_auction->sql_init = inter_auction_sql_init; + inter_auction->sql_final = inter_auction_sql_final; +} diff --git a/src/char/int_auction.h b/src/char/int_auction.h index 17fd75a58..03efcdc51 100644 --- a/src/char/int_auction.h +++ b/src/char/int_auction.h @@ -4,9 +4,26 @@ #ifndef CHAR_INT_AUCTION_H #define CHAR_INT_AUCTION_H -int inter_auction_parse_frommap(int fd); +#include "../common/mmo.h" -int inter_auction_sql_init(void); -void inter_auction_sql_final(void); +void inter_auction_defaults(void); + +/** + * inter_auction_interface interface + **/ +struct inter_auction_interface { + DBMap* db; // int auction_id -> struct auction_data* + int (*count) (int char_id, bool buy); + void (*save) (struct auction_data *auction); + unsigned int (*create) (struct auction_data *auction); + int (*end_timer) (int tid, int64 tick, int id, intptr_t data); + void (*delete_) (struct auction_data *auction); + void (*fromsql) (void); + int (*parse_frommap) (int fd); + int (*sql_init) (void); + void (*sql_final) (void); +}; + +struct inter_auction_interface *inter_auction; #endif /* CHAR_INT_AUCTION_H */ diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c index 3a36e75a2..3f8e7b190 100644 --- a/src/char/int_elemental.c +++ b/src/char/int_elemental.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" @@ -20,28 +21,30 @@ #include "../common/strlib.h" #include "../common/utils.h" +struct inter_elemental_interface inter_elemental_s; + bool mapif_elemental_save(struct s_elemental* ele) { bool flag = true; if( ele->elemental_id == 0 ) { // Create new DB entry - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)" "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%u')", elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } else - ele->elemental_id = (int)SQL->LastInsertId(sql_handle); - } else if( SQL_ERROR == SQL->Query(sql_handle, + ele->elemental_id = (int)SQL->LastInsertId(inter->sql_handle); + } else if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d'," "`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d'," "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'", elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) ) { // Update DB entry - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } return flag; @@ -54,36 +57,36 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) { ele->elemental_id = ele_id; ele->char_id = char_id; - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `class`, `mode`, `hp`, `sp`, `max_hp`, `max_sp`, `atk1`, `atk2`, `matk`, `aspd`," "`def`, `mdef`, `flee`, `hit`, `life_time` FROM `%s` WHERE `ele_id` = '%d' AND `char_id` = '%d'", elemental_db, ele_id, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) { - SQL->FreeResult(sql_handle); + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { + SQL->FreeResult(inter->sql_handle); return false; } - SQL->GetData(sql_handle, 0, &data, NULL); ele->class_ = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); ele->mode = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); ele->hp = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); ele->sp = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); ele->max_hp = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); ele->max_sp = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); ele->atk = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); ele->atk2 = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); ele->matk = atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); ele->amotion = atoi(data); - SQL->GetData(sql_handle, 10, &data, NULL); ele->def = atoi(data); - SQL->GetData(sql_handle, 11, &data, NULL); ele->mdef = atoi(data); - SQL->GetData(sql_handle, 12, &data, NULL); ele->flee = atoi(data); - SQL->GetData(sql_handle, 13, &data, NULL); ele->hit = atoi(data); - SQL->GetData(sql_handle, 14, &data, NULL); ele->life_time = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 0, &data, NULL); ele->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); ele->mode = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); ele->hp = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); ele->sp = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); ele->max_hp = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); ele->max_sp = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); ele->atk = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); ele->atk2 = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); ele->matk = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); ele->amotion = atoi(data); + SQL->GetData(inter->sql_handle, 10, &data, NULL); ele->def = atoi(data); + SQL->GetData(inter->sql_handle, 11, &data, NULL); ele->mdef = atoi(data); + SQL->GetData(inter->sql_handle, 12, &data, NULL); ele->flee = atoi(data); + SQL->GetData(inter->sql_handle, 13, &data, NULL); ele->hit = atoi(data); + SQL->GetData(inter->sql_handle, 14, &data, NULL); ele->life_time = atoi(data); + SQL->FreeResult(inter->sql_handle); if( save_log ) ShowInfo("Elemental loaded (%d - %d).\n", ele->elemental_id, ele->char_id); @@ -91,15 +94,15 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) { } bool mapif_elemental_delete(int ele_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", elemental_db, ele_id) ) { - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", elemental_db, ele_id) ) { + Sql_ShowDebug(inter->sql_handle); return false; } return true; } -static void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { +void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { int size = sizeof(struct s_elemental) + 5; WFIFOHEAD(fd,size); @@ -110,44 +113,45 @@ static void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char WFIFOSET(fd,size); } -static void mapif_parse_elemental_create(int fd, struct s_elemental* ele) { - bool result = mapif_elemental_save(ele); - mapif_elemental_send(fd, ele, result); +void mapif_parse_elemental_create(int fd, struct s_elemental* ele) { + bool result = mapif->elemental_save(ele); + mapif->elemental_send(fd, ele, result); } -static void mapif_parse_elemental_load(int fd, int ele_id, int char_id) { +void mapif_parse_elemental_load(int fd, int ele_id, int char_id) { struct s_elemental ele; - bool result = mapif_elemental_load(ele_id, char_id, &ele); - mapif_elemental_send(fd, &ele, result); + bool result = mapif->elemental_load(ele_id, char_id, &ele); + mapif->elemental_send(fd, &ele, result); } -static void mapif_elemental_deleted(int fd, unsigned char flag) { +void mapif_elemental_deleted(int fd, unsigned char flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x387d; WFIFOB(fd,2) = flag; WFIFOSET(fd,3); } -static void mapif_parse_elemental_delete(int fd, int ele_id) { - bool result = mapif_elemental_delete(ele_id); - mapif_elemental_deleted(fd, result); +void mapif_parse_elemental_delete(int fd, int ele_id) { + bool result = mapif->elemental_delete(ele_id); + mapif->elemental_deleted(fd, result); } -static void mapif_elemental_saved(int fd, unsigned char flag) { +void mapif_elemental_saved(int fd, unsigned char flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x387e; WFIFOB(fd,2) = flag; WFIFOSET(fd,3); } -static void mapif_parse_elemental_save(int fd, struct s_elemental* ele) { - bool result = mapif_elemental_save(ele); - mapif_elemental_saved(fd, result); +void mapif_parse_elemental_save(int fd, struct s_elemental* ele) { + bool result = mapif->elemental_save(ele); + mapif->elemental_saved(fd, result); } void inter_elemental_sql_init(void) { return; } + void inter_elemental_sql_final(void) { return; } @@ -159,12 +163,21 @@ int inter_elemental_parse_frommap(int fd) { unsigned short cmd = RFIFOW(fd,0); switch( cmd ) { - case 0x307c: mapif_parse_elemental_create(fd, (struct s_elemental*)RFIFOP(fd,4)); break; - case 0x307d: mapif_parse_elemental_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; - case 0x307e: mapif_parse_elemental_delete(fd, (int)RFIFOL(fd,2)); break; - case 0x307f: mapif_parse_elemental_save(fd, (struct s_elemental*)RFIFOP(fd,4)); break; + case 0x307c: mapif->parse_elemental_create(fd, (struct s_elemental*)RFIFOP(fd,4)); break; + case 0x307d: mapif->parse_elemental_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; + case 0x307e: mapif->parse_elemental_delete(fd, (int)RFIFOL(fd,2)); break; + case 0x307f: mapif->parse_elemental_save(fd, (struct s_elemental*)RFIFOP(fd,4)); break; default: return 0; } return 1; } + +void inter_elemental_defaults(void) +{ + inter_elemental = &inter_elemental_s; + + inter_elemental->sql_init = inter_elemental_sql_init; + inter_elemental->sql_final = inter_elemental_sql_final; + inter_elemental->parse_frommap = inter_elemental_parse_frommap; +} diff --git a/src/char/int_elemental.h b/src/char/int_elemental.h index e28cfedea..995dfbfab 100644 --- a/src/char/int_elemental.h +++ b/src/char/int_elemental.h @@ -6,10 +6,17 @@ #include "../common/cbasetypes.h" -void inter_elemental_sql_init(void); -void inter_elemental_sql_final(void); -int inter_elemental_parse_frommap(int fd); +void inter_elemental_defaults(void); -bool mapif_elemental_delete(int ele_id); +/** + * inter_elemental_interface interface + **/ +struct inter_elemental_interface { + void (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + +struct inter_elemental_interface *inter_elemental; #endif /* CHAR_INT_ELEMENTAL_H */ diff --git a/src/char/int_guild.c b/src/char/int_guild.c index a6fcfe48c..9817f912d 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -13,6 +13,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/cbasetypes.h" #include "../common/db.h" #include "../common/malloc.h" @@ -33,26 +34,14 @@ #define GUILD_ALLIANCE_TYPE_MASK 0x01 #define GUILD_ALLIANCE_REMOVE 0x08 -static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - -//Guild cache -static DBMap* guild_db_; // int guild_id -> struct guild* -static DBMap *castle_db; +struct inter_guild_interface inter_guild_s; -static unsigned int guild_exp[MAX_GUILDLEVEL]; - -int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int flag,const char *mes); -int mapif_guild_broken(int guild_id,int flag); -static bool guild_check_empty(struct guild *g); -int guild_calcinfo(struct guild *g); -int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len); -int mapif_guild_info(int fd,struct guild *g); -int inter_guild_tosql(struct guild *g,int flag); +static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; -static int guild_save_timer(int tid, int64 tick, int id, intptr_t data) { +int inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) { static int last_id = 0; //To know in which guild we were. int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving. - DBIterator *iter = db_iterator(guild_db_); + DBIterator *iter = db_iterator(inter_guild->guild_db); DBKey key; struct guild* g; @@ -66,7 +55,7 @@ static int guild_save_timer(int tid, int64 tick, int id, intptr_t data) { else if( state == 1 && g->save_flag&GS_MASK ) { - inter_guild_tosql(g, g->save_flag&GS_MASK); + inter_guild->tosql(g, g->save_flag&GS_MASK); g->save_flag &= ~GS_MASK; //Some guild saved. @@ -78,7 +67,7 @@ static int guild_save_timer(int tid, int64 tick, int id, intptr_t data) { {// Nothing to save, guild is ready for removal. if (save_log) ShowInfo("Guild Unloaded (%d - %s)\n", g->guild_id, g->name); - db_remove(guild_db_, key); + db_remove(inter_guild->guild_db, key); } } dbi_destroy(iter); @@ -86,18 +75,18 @@ static int guild_save_timer(int tid, int64 tick, int id, intptr_t data) { if( state != 2 ) //Reached the end of the guild db without saving. last_id = 0; //Reset guild saved, return to beginning. - state = guild_db_->size(guild_db_); + state = inter_guild->guild_db->size(inter_guild->guild_db); if( state < 1 ) state = 1; //Calculate the time slot for the next save. - timer->add(tick + autosave_interval/state, guild_save_timer, 0, 0); + timer->add(tick + autosave_interval/state, inter_guild->save_timer, 0, 0); return 0; } int inter_guild_removemember_tosql(int account_id, int char_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE from `%s` where `account_id` = '%d' and `char_id` = '%d'", guild_member_db, account_id, char_id) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `guild_id` = '0' WHERE `char_id` = '%d'", char_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE from `%s` where `account_id` = '%d' and `char_id` = '%d'", guild_member_db, account_id, char_id) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `guild_id` = '0' WHERE `char_id` = '%d'", char_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); return 0; } @@ -131,8 +120,8 @@ int inter_guild_tosql(struct guild *g,int flag) ShowInfo("Save guild request ("CL_BOLD"%d"CL_RESET" - flag 0x%x).",g->guild_id, flag); #endif - SQL->EscapeStringLen(sql_handle, esc_name, g->name, strnlen(g->name, NAME_LENGTH)); - SQL->EscapeStringLen(sql_handle, esc_master, g->master, strnlen(g->master, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, g->name, strnlen(g->name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_master, g->master, strnlen(g->master, NAME_LENGTH)); *t_info = '\0'; // Insert a new guild the guild @@ -141,18 +130,18 @@ int inter_guild_tosql(struct guild *g,int flag) strcat(t_info, " guild_create"); // Create a new guild - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` " "(`name`,`master`,`guild_lv`,`max_member`,`average_lv`,`char_id`) " "VALUES ('%s', '%s', '%d', '%d', '%d', '%d')", guild_db, esc_name, esc_master, g->guild_lv, g->max_member, g->average_lv, g->member[0].char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); if (g->guild_id == -1) return 0; //Failed to create guild! } else { - g->guild_id = (int)SQL->LastInsertId(sql_handle); + g->guild_id = (int)SQL->LastInsertId(inter->sql_handle); new_guild = 1; } } @@ -210,8 +199,8 @@ int inter_guild_tosql(struct guild *g,int flag) StrBuf->AppendStr(&buf, ", "); else add_comma = true; - SQL->EscapeStringLen(sql_handle, esc_mes1, g->mes1, strnlen(g->mes1, sizeof(g->mes1))); - SQL->EscapeStringLen(sql_handle, esc_mes2, g->mes2, strnlen(g->mes2, sizeof(g->mes2))); + SQL->EscapeStringLen(inter->sql_handle, esc_mes1, g->mes1, strnlen(g->mes1, sizeof(g->mes1))); + SQL->EscapeStringLen(inter->sql_handle, esc_mes2, g->mes2, strnlen(g->mes2, sizeof(g->mes2))); StrBuf->Printf(&buf, "`mes1`='%s', `mes2`='%s'", esc_mes1, esc_mes2); } if (flag & GS_LEVEL) @@ -224,8 +213,8 @@ int inter_guild_tosql(struct guild *g,int flag) StrBuf->Printf(&buf, "`guild_lv`=%d, `skill_point`=%d, `exp`=%"PRIu64", `next_exp`=%u, `max_member`=%d", g->guild_lv, g->skill_point, g->exp, g->next_exp, g->max_member); } StrBuf->Printf(&buf, " WHERE `guild_id`=%d", g->guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "%s", StrBuf->Value(&buf)) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "%s", StrBuf->Value(&buf)) ) + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); } @@ -241,18 +230,18 @@ int inter_guild_tosql(struct guild *g,int flag) continue; if(m->account_id) { //Since nothing references guild member table as foreign keys, it's safe to use REPLACE INTO - SQL->EscapeStringLen(sql_handle, esc_name, m->name, strnlen(m->name, NAME_LENGTH)); - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name`) " + SQL->EscapeStringLen(inter->sql_handle, esc_name, m->name, strnlen(m->name, NAME_LENGTH)); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name`) " "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%"PRIu64"','%d','%d','%d','%s')", guild_member_db, g->guild_id, m->account_id, m->char_id, m->hair, m->hair_color, m->gender, m->class_, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); if (m->modified&GS_MEMBER_NEW || new_guild == 1) { - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `guild_id` = '%d' WHERE `char_id` = '%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `guild_id` = '%d' WHERE `char_id` = '%d'", char_db, g->guild_id, m->char_id) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } m->modified = GS_MEMBER_UNMODIFIED; } @@ -266,10 +255,10 @@ int inter_guild_tosql(struct guild *g,int flag) struct guild_position *p = &g->position[i]; if (!p->modified) continue; - SQL->EscapeStringLen(sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH)); - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`position`,`name`,`mode`,`exp_mode`) VALUES ('%d','%d','%s','%d','%d')", + SQL->EscapeStringLen(inter->sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH)); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`position`,`name`,`mode`,`exp_mode`) VALUES ('%d','%d','%s','%d','%d')", guild_position_db, g->guild_id, i, esc_name, p->mode, p->exp_mode) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); p->modified = GS_POSITION_UNMODIFIED; } } @@ -280,10 +269,10 @@ int inter_guild_tosql(struct guild *g,int flag) // NOTE: no need to do it on both sides since both guilds in memory had // their info changed, not to mention this would also mess up oppositions! // [Skotlex] - //if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d' OR `alliance_id`='%d'", guild_alliance_db, g->guild_id, g->guild_id) ) - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d'", guild_alliance_db, g->guild_id) ) + //if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d' OR `alliance_id`='%d'", guild_alliance_db, g->guild_id, g->guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d'", guild_alliance_db, g->guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } else { @@ -293,11 +282,11 @@ int inter_guild_tosql(struct guild *g,int flag) struct guild_alliance *a=&g->alliance[i]; if(a->guild_id>0) { - SQL->EscapeStringLen(sql_handle, esc_name, a->name, strnlen(a->name, NAME_LENGTH)); - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`opposition`,`alliance_id`,`name`) " + SQL->EscapeStringLen(inter->sql_handle, esc_name, a->name, strnlen(a->name, NAME_LENGTH)); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`opposition`,`alliance_id`,`name`) " "VALUES ('%d','%d','%d','%s')", guild_alliance_db, g->guild_id, a->opposition, a->guild_id, esc_name) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } } } @@ -311,11 +300,11 @@ int inter_guild_tosql(struct guild *g,int flag) if(e->account_id>0){ char esc_mes[sizeof(e->mes)*2+1]; - SQL->EscapeStringLen(sql_handle, esc_name, e->name, strnlen(e->name, NAME_LENGTH)); - SQL->EscapeStringLen(sql_handle, esc_mes, e->mes, strnlen(e->mes, sizeof(e->mes))); - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`name`,`mes`) " + SQL->EscapeStringLen(inter->sql_handle, esc_name, e->name, strnlen(e->name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_mes, e->mes, strnlen(e->mes, sizeof(e->mes))); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`name`,`mes`) " "VALUES ('%d','%d','%s','%s')", guild_expulsion_db, g->guild_id, e->account_id, esc_name, esc_mes) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } } } @@ -325,9 +314,9 @@ int inter_guild_tosql(struct guild *g,int flag) //printf("- Insert guild %d to guild_skill\n",g->guild_id); for(i=0;i<MAX_GUILDSKILL;i++){ if (g->skill[i].id>0 && g->skill[i].lv>0){ - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`id`,`lv`) VALUES ('%d','%d','%d')", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`guild_id`,`id`,`lv`) VALUES ('%d','%d','%d')", guild_skill_db, g->guild_id, g->skill[i].id, g->skill[i].lv) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } } } @@ -349,7 +338,7 @@ struct guild * inter_guild_fromsql(int guild_id) if( guild_id <= 0 ) return NULL; - g = (struct guild*)idb_get(guild_db_, guild_id); + g = (struct guild*)idb_get(inter_guild->guild_db, guild_id); if( g ) return g; @@ -357,38 +346,38 @@ struct guild * inter_guild_fromsql(int guild_id) ShowInfo("Guild load request (%d)...\n", guild_id); #endif - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT g.`name`,c.`name`,g.`guild_lv`,g.`connect_member`,g.`max_member`,g.`average_lv`,g.`exp`,g.`next_exp`,g.`skill_point`,g.`mes1`,g.`mes2`,g.`emblem_len`,g.`emblem_id`,g.`emblem_data` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT g.`name`,c.`name`,g.`guild_lv`,g.`connect_member`,g.`max_member`,g.`average_lv`,g.`exp`,g.`next_exp`,g.`skill_point`,g.`mes1`,g.`mes2`,g.`emblem_len`,g.`emblem_id`,g.`emblem_data` " "FROM `%s` g LEFT JOIN `%s` c ON c.`char_id` = g.`char_id` WHERE g.`guild_id`='%d'", guild_db, char_db, guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return NULL; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) return NULL;// Guild does not exists. CREATE(g, struct guild, 1); g->guild_id = guild_id; - SQL->GetData(sql_handle, 0, &data, &len); memcpy(g->name, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 1, &data, &len); memcpy(g->master, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 2, &data, NULL); g->guild_lv = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); g->connect_member = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); g->max_member = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, &len); memcpy(g->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 1, &data, &len); memcpy(g->master, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 2, &data, NULL); g->guild_lv = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); g->connect_member = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); g->max_member = atoi(data); if( g->max_member > MAX_GUILD ) { // Fix reduction of MAX_GUILD [PoW] ShowWarning("Guild %d:%s specifies higher capacity (%d) than MAX_GUILD (%d)\n", guild_id, g->name, g->max_member, MAX_GUILD); g->max_member = MAX_GUILD; } - SQL->GetData(sql_handle, 5, &data, NULL); g->average_lv = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); g->exp = strtoull(data, NULL, 10); - SQL->GetData(sql_handle, 7, &data, NULL); g->next_exp = (unsigned int)strtoul(data, NULL, 10); - SQL->GetData(sql_handle, 8, &data, NULL); g->skill_point = atoi(data); - SQL->GetData(sql_handle, 9, &data, &len); memcpy(g->mes1, data, min(len, sizeof(g->mes1))); - SQL->GetData(sql_handle, 10, &data, &len); memcpy(g->mes2, data, min(len, sizeof(g->mes2))); - SQL->GetData(sql_handle, 11, &data, &len); g->emblem_len = atoi(data); - SQL->GetData(sql_handle, 12, &data, &len); g->emblem_id = atoi(data); - SQL->GetData(sql_handle, 13, &data, &len); + SQL->GetData(inter->sql_handle, 5, &data, NULL); g->average_lv = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); g->exp = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle, 7, &data, NULL); g->next_exp = (unsigned int)strtoul(data, NULL, 10); + SQL->GetData(inter->sql_handle, 8, &data, NULL); g->skill_point = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, &len); memcpy(g->mes1, data, min(len, sizeof(g->mes1))); + SQL->GetData(inter->sql_handle, 10, &data, &len); memcpy(g->mes2, data, min(len, sizeof(g->mes2))); + SQL->GetData(inter->sql_handle, 11, &data, &len); g->emblem_len = atoi(data); + SQL->GetData(inter->sql_handle, 12, &data, &len); g->emblem_id = atoi(data); + SQL->GetData(inter->sql_handle, 13, &data, &len); // convert emblem data from hexadecimal to binary //TODO: why not store it in the db as binary directly? [ultramage] for( i = 0, p = g->emblem_data; i < g->emblem_len; ++i, ++p ) @@ -412,92 +401,92 @@ struct guild * inter_guild_fromsql(int guild_id) } // load guild member info - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`name` " "FROM `%s` WHERE `guild_id`='%d' ORDER BY `position`", guild_member_db, guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); aFree(g); return NULL; } - for( i = 0; i < g->max_member && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + for( i = 0; i < g->max_member && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { struct guild_member* m = &g->member[i]; - SQL->GetData(sql_handle, 0, &data, NULL); m->account_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); m->char_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); m->hair = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); m->hair_color = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); m->gender = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); m->class_ = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); m->lv = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); m->exp = strtoull(data, NULL, 10); - SQL->GetData(sql_handle, 8, &data, NULL); m->exp_payper = (unsigned int)atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); m->online = atoi(data); - SQL->GetData(sql_handle, 10, &data, NULL); m->position = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); m->account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); m->char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); m->hair = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); m->hair_color = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); m->gender = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); m->lv = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); m->exp = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle, 8, &data, NULL); m->exp_payper = (unsigned int)atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); m->online = atoi(data); + SQL->GetData(inter->sql_handle, 10, &data, NULL); m->position = atoi(data); if( m->position >= MAX_GUILDPOSITION ) // Fix reduction of MAX_GUILDPOSITION [PoW] m->position = MAX_GUILDPOSITION - 1; - SQL->GetData(sql_handle, 11, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 11, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH)); m->modified = GS_MEMBER_UNMODIFIED; } //printf("- Read guild_position %d from sql \n",guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `position`,`name`,`mode`,`exp_mode` FROM `%s` WHERE `guild_id`='%d'", guild_position_db, guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `position`,`name`,`mode`,`exp_mode` FROM `%s` WHERE `guild_id`='%d'", guild_position_db, guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); aFree(g); return NULL; } - while( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { int position; struct guild_position *pos; - SQL->GetData(sql_handle, 0, &data, NULL); position = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); position = atoi(data); if( position < 0 || position >= MAX_GUILDPOSITION ) continue;// invalid position pos = &g->position[position]; - SQL->GetData(sql_handle, 1, &data, &len); memcpy(pos->name, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 2, &data, NULL); pos->mode = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); pos->exp_mode = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, &len); memcpy(pos->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 2, &data, NULL); pos->mode = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); pos->exp_mode = atoi(data); pos->modified = GS_POSITION_UNMODIFIED; } //printf("- Read guild_alliance %d from sql \n",guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `opposition`,`alliance_id`,`name` FROM `%s` WHERE `guild_id`='%d'", guild_alliance_db, guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `opposition`,`alliance_id`,`name` FROM `%s` WHERE `guild_id`='%d'", guild_alliance_db, guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); aFree(g); return NULL; } - for( i = 0; i < MAX_GUILDALLIANCE && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + for( i = 0; i < MAX_GUILDALLIANCE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { struct guild_alliance* a = &g->alliance[i]; - SQL->GetData(sql_handle, 0, &data, NULL); a->opposition = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); a->guild_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, &len); memcpy(a->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 0, &data, NULL); a->opposition = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); a->guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(a->name, data, min(len, NAME_LENGTH)); } //printf("- Read guild_expulsion %d from sql \n",guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", guild_expulsion_db, guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", guild_expulsion_db, guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); aFree(g); return NULL; } - for( i = 0; i < MAX_GUILDEXPULSION && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + for( i = 0; i < MAX_GUILDEXPULSION && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { struct guild_expulsion *e = &g->expulsion[i]; - SQL->GetData(sql_handle, 0, &data, NULL); e->account_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 2, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes))); + SQL->GetData(inter->sql_handle, 0, &data, NULL); e->account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes))); } //printf("- Read guild_skill %d from sql \n",guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `id`,`lv` FROM `%s` WHERE `guild_id`='%d' ORDER BY `id`", guild_skill_db, guild_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `id`,`lv` FROM `%s` WHERE `guild_id`='%d' ORDER BY `id`", guild_skill_db, guild_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); aFree(g); return NULL; } @@ -507,17 +496,17 @@ struct guild * inter_guild_fromsql(int guild_id) g->skill[i].id = i + GD_SKILLBASE; } - while( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { int id; - SQL->GetData(sql_handle, 0, &data, NULL); id = atoi(data) - GD_SKILLBASE; + SQL->GetData(inter->sql_handle, 0, &data, NULL); id = atoi(data) - GD_SKILLBASE; if( id < 0 || id >= MAX_GUILDSKILL ) continue;// invalid guild skill - SQL->GetData(sql_handle, 1, &data, NULL); g->skill[id].lv = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); g->skill[id].lv = atoi(data); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); - idb_put(guild_db_, guild_id, g); //Add to cache + idb_put(inter_guild->guild_db, guild_id, g); //Add to cache g->save_flag |= GS_REMOVE; //But set it to be removed, in case it is not needed for long. if (save_log) @@ -527,7 +516,7 @@ struct guild * inter_guild_fromsql(int guild_id) } // `guild_castle` (`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`) -int inter_guildcastle_tosql(struct guild_castle *gc) +int inter_guild_castle_tosql(struct guild_castle *gc) { StringBuf buf; int i; @@ -540,8 +529,8 @@ int inter_guildcastle_tosql(struct guild_castle *gc) for (i = 0; i < MAX_GUARDIANS; ++i) StrBuf->Printf(&buf, ", `visibleG%d`='%d'", i, gc->guardian[i].visible); - if (SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf))) - Sql_ShowDebug(sql_handle); + if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) + Sql_ShowDebug(inter->sql_handle); else if(save_log) ShowInfo("Saved guild castle (%d)\n", gc->castle_id); @@ -550,12 +539,12 @@ int inter_guildcastle_tosql(struct guild_castle *gc) } // Read guild_castle from SQL -static struct guild_castle* inter_guildcastle_fromsql(int castle_id) +struct guild_castle* inter_guild_castle_fromsql(int castle_id) { char *data; int i; StringBuf buf; - struct guild_castle *gc = idb_get(castle_db, castle_id); + struct guild_castle *gc = idb_get(inter_guild->castle_db, castle_id); if (gc != NULL) return gc; @@ -566,8 +555,8 @@ static struct guild_castle* inter_guildcastle_fromsql(int castle_id) for (i = 0; i < MAX_GUARDIANS; ++i) StrBuf->Printf(&buf, ", `visibleG%d`", i); StrBuf->Printf(&buf, " FROM `%s` WHERE `castle_id`='%d'", guild_castle_db, castle_id); - if (SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf))) { - Sql_ShowDebug(sql_handle); + if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) { + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return NULL; } @@ -576,23 +565,23 @@ static struct guild_castle* inter_guildcastle_fromsql(int castle_id) CREATE(gc, struct guild_castle, 1); gc->castle_id = castle_id; - if (SQL_SUCCESS == SQL->NextRow(sql_handle)) { - SQL->GetData(sql_handle, 1, &data, NULL); gc->guild_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); gc->economy = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); gc->defense = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); gc->triggerE = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); gc->triggerD = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); gc->nextTime = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); gc->payTime = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); gc->createTime = atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); gc->visibleC = atoi(data); + if (SQL_SUCCESS == SQL->NextRow(inter->sql_handle)) { + SQL->GetData(inter->sql_handle, 1, &data, NULL); gc->guild_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); gc->economy = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); gc->defense = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); gc->triggerE = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); gc->triggerD = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); gc->nextTime = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); gc->payTime = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); gc->createTime = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); gc->visibleC = atoi(data); for (i = 10; i < 10+MAX_GUARDIANS; i++) { - SQL->GetData(sql_handle, i, &data, NULL); gc->guardian[i-10].visible = atoi(data); + SQL->GetData(inter->sql_handle, i, &data, NULL); gc->guardian[i-10].visible = atoi(data); } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); - idb_put(castle_db, castle_id, gc); + idb_put(inter_guild->castle_db, castle_id, gc); if (save_log) ShowInfo("Loaded guild castle (%d - guild %d)\n", castle_id, gc->guild_id); @@ -602,7 +591,7 @@ static struct guild_castle* inter_guildcastle_fromsql(int castle_id) // Read exp_guild.txt -static bool exp_guild_parse_row(char* split[], int column, int current) { +bool inter_guild_exp_parse_row(char* split[], int column, int current) { int64 exp = strtoll(split[0], NULL, 10); if (exp < 0 || exp >= UINT_MAX) { @@ -610,7 +599,7 @@ static bool exp_guild_parse_row(char* split[], int column, int current) { return false; } - guild_exp[current] = (unsigned int)exp; + inter_guild->exp[current] = (unsigned int)exp; return true; } @@ -621,29 +610,29 @@ int inter_guild_CharOnline(int char_id, int guild_id) { if (guild_id == -1) { //Get guild_id from the database - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT guild_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT guild_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char* data; - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); guild_id = atoi(data); } else { guild_id = 0; } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } if (guild_id == 0) return 0; //No guild... - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(!g) { ShowError("Character %d's guild %d not found!\n", char_id, guild_id); return 0; @@ -672,30 +661,30 @@ int inter_guild_CharOffline(int char_id, int guild_id) if (guild_id == -1) { //Get guild_id from the database - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT guild_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT guild_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char* data; - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); guild_id = atoi(data); } else { guild_id = 0; } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } if (guild_id == 0) return 0; //No guild... //Character has a guild, set character offline and check if they were the only member online - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if (g == NULL) //Guild not found? return 0; @@ -723,25 +712,25 @@ int inter_guild_CharOffline(int char_id, int guild_id) int inter_guild_sql_init(void) { //Initialize the guild cache - guild_db_= idb_alloc(DB_OPT_RELEASE_DATA); - castle_db = idb_alloc(DB_OPT_RELEASE_DATA); + inter_guild->guild_db= idb_alloc(DB_OPT_RELEASE_DATA); + inter_guild->castle_db = idb_alloc(DB_OPT_RELEASE_DATA); //Read exp file - sv->readdb("db", DBPATH"exp_guild.txt", ',', 1, 1, MAX_GUILDLEVEL, exp_guild_parse_row); + sv->readdb("db", DBPATH"exp_guild.txt", ',', 1, 1, MAX_GUILDLEVEL, inter_guild->exp_parse_row); - timer->add_func_list(guild_save_timer, "guild_save_timer"); - timer->add(timer->gettick() + 10000, guild_save_timer, 0, 0); + timer->add_func_list(inter_guild->save_timer, "inter_guild->save_timer"); + timer->add(timer->gettick() + 10000, inter_guild->save_timer, 0, 0); return 0; } /** * @see DBApply */ -static int guild_db_final(DBKey key, DBData *data, va_list ap) +int inter_guild_db_final(DBKey key, DBData *data, va_list ap) { struct guild *g = DB->data2ptr(data); if (g->save_flag&GS_MASK) { - inter_guild_tosql(g, g->save_flag&GS_MASK); + inter_guild->tosql(g, g->save_flag&GS_MASK); return 1; } return 0; @@ -749,42 +738,42 @@ static int guild_db_final(DBKey key, DBData *data, va_list ap) void inter_guild_sql_final(void) { - guild_db_->destroy(guild_db_, guild_db_final); - db_destroy(castle_db); + inter_guild->guild_db->destroy(inter_guild->guild_db, inter_guild->db_final); + db_destroy(inter_guild->castle_db); return; } // Get guild_id by its name. Returns 0 if not found, -1 on error. -int search_guildname(char *str) +int inter_guild_search_guildname(char *str) { int guild_id; char esc_name[NAME_LENGTH*2+1]; - SQL->EscapeStringLen(sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH)); //Lookup guilds with the same name - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT guild_id FROM `%s` WHERE name='%s'", guild_db, esc_name) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT guild_id FROM `%s` WHERE name='%s'", guild_db, esc_name) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return -1; } - if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char* data; - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); guild_id = atoi(data); } else { guild_id = 0; } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return guild_id; } // Check if guild is empty -static bool guild_check_empty(struct guild *g) +static bool inter_guild_check_empty(struct guild *g) { int i; ARR_FIND( 0, g->max_member, i, g->member[i].account_id > 0 ); @@ -796,16 +785,16 @@ static bool guild_check_empty(struct guild *g) return true; } -unsigned int guild_nextexp(int level) { +unsigned int inter_guild_nextexp(int level) { if (level == 0) return 1; if (level <= 0 || level >= MAX_GUILDLEVEL) return 0; - return guild_exp[level-1]; + return inter_guild->exp[level-1]; } -int guild_checkskill(struct guild *g,int id) +int inter_guild_checkskill(struct guild *g,int id) { int idx = id - GD_SKILLBASE; @@ -815,7 +804,7 @@ int guild_checkskill(struct guild *g,int id) return g->skill[idx].lv; } -int guild_calcinfo(struct guild *g) +int inter_guild_calcinfo(struct guild *g) { int i,c; unsigned int nextexp; @@ -823,21 +812,21 @@ int guild_calcinfo(struct guild *g) if(g->guild_lv<=0) g->guild_lv = 1; - nextexp = guild_nextexp(g->guild_lv); + nextexp = inter_guild->nextexp(g->guild_lv); // Consume guild exp and increase guild level while(g->exp >= nextexp && nextexp > 0) { // nextexp would be 0 if g->guild_lv was >= MAX_GUILDLEVEL g->exp-=nextexp; g->guild_lv++; g->skill_point++; - nextexp = guild_nextexp(g->guild_lv); + nextexp = inter_guild->nextexp(g->guild_lv); } // Save next exp step g->next_exp = nextexp; // Set the max number of members, Guild Extension skill - currently adds 6 to max per skill lv. - g->max_member = 16 + guild_checkskill(g, GD_EXTENSION) * 6; + g->max_member = 16 + inter_guild->checkskill(g, GD_EXTENSION) * 6; if(g->max_member > MAX_GUILD) { ShowError("Guild %d:%s has capacity for too many guild members (%d), max supported is %d\n", g->guild_id, g->name, g->max_member, MAX_GUILD); @@ -872,7 +861,7 @@ int guild_calcinfo(struct guild *g) if(g->max_member != before.max_member || g->guild_lv != before.guild_lv || g->skill_point != before.skill_point ) { g->save_flag |= GS_LEVEL; - mapif_guild_info(-1,g); + mapif->guild_info(-1,g); return 1; } @@ -882,7 +871,7 @@ int guild_calcinfo(struct guild *g) //------------------------------------------------------------------- // Packet sent to map server -int mapif_guild_created(int fd,int account_id,struct guild *g) +int mapif_guild_created(int fd, int account_id, struct guild *g) { WFIFOHEAD(fd, 10); WFIFOW(fd,0)=0x3830; @@ -899,7 +888,7 @@ int mapif_guild_created(int fd,int account_id,struct guild *g) } // Guild not found -int mapif_guild_noinfo(int fd,int guild_id) +int mapif_guild_noinfo(int fd, int guild_id) { unsigned char buf[12]; WBUFW(buf,0)=0x3831; @@ -907,28 +896,28 @@ int mapif_guild_noinfo(int fd,int guild_id) WBUFL(buf,4)=guild_id; ShowWarning("int_guild: info not found %d\n",guild_id); if(fd<0) - mapif_sendall(buf,8); + mapif->sendall(buf,8); else - mapif_send(fd,buf,8); + mapif->send(fd,buf,8); return 0; } // Send guild info -int mapif_guild_info(int fd,struct guild *g) +int mapif_guild_info(int fd, struct guild *g) { unsigned char buf[8+sizeof(struct guild)]; WBUFW(buf,0)=0x3831; WBUFW(buf,2)=4+sizeof(struct guild); memcpy(buf+4,g,sizeof(struct guild)); if(fd<0) - mapif_sendall(buf,WBUFW(buf,2)); + mapif->sendall(buf,WBUFW(buf,2)); else - mapif_send(fd,buf,WBUFW(buf,2)); + mapif->send(fd,buf,WBUFW(buf,2)); return 0; } // ACK member add -int mapif_guild_memberadded(int fd,int guild_id,int account_id,int char_id,int flag) +int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, int flag) { WFIFOHEAD(fd, 15); WFIFOW(fd,0)=0x3832; @@ -951,13 +940,13 @@ int mapif_guild_withdraw(int guild_id,int account_id,int char_id,int flag, const WBUFB(buf,14)=flag; memcpy(WBUFP(buf,15),mes,40); memcpy(WBUFP(buf,55),name,NAME_LENGTH); - mapif_sendall(buf,55+NAME_LENGTH); + mapif->sendall(buf,55+NAME_LENGTH); ShowInfo("int_guild: guild withdraw (%d - %d: %s - %s)\n",guild_id,account_id,name,mes); return 0; } // Send short member's info -int mapif_guild_memberinfoshort(struct guild *g,int idx) +int mapif_guild_memberinfoshort(struct guild *g, int idx) { unsigned char buf[19]; WBUFW(buf, 0)=0x3835; @@ -967,24 +956,24 @@ int mapif_guild_memberinfoshort(struct guild *g,int idx) WBUFB(buf,14)=(unsigned char)g->member[idx].online; WBUFW(buf,15)=g->member[idx].lv; WBUFW(buf,17)=g->member[idx].class_; - mapif_sendall(buf,19); + mapif->sendall(buf,19); return 0; } // Send guild broken -int mapif_guild_broken(int guild_id,int flag) +int mapif_guild_broken(int guild_id, int flag) { unsigned char buf[7]; WBUFW(buf,0)=0x3836; WBUFL(buf,2)=guild_id; WBUFB(buf,6)=flag; - mapif_sendall(buf,7); + mapif->sendall(buf,7); ShowInfo("int_guild: Guild broken (%d)\n",guild_id); return 0; } // Send guild message -int mapif_guild_message(int guild_id,int account_id,char *mes,int len, int sfd) +int mapif_guild_message(int guild_id, int account_id, char *mes, int len, int sfd) { unsigned char buf[512]; if (len > 500) @@ -994,12 +983,12 @@ int mapif_guild_message(int guild_id,int account_id,char *mes,int len, int sfd) WBUFL(buf,4)=guild_id; WBUFL(buf,8)=account_id; memcpy(WBUFP(buf,12),mes,len); - mapif_sendallwos(sfd, buf,len+12); + mapif->sendallwos(sfd, buf,len+12); return 0; } // Send basic info -int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len) +int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int len) { unsigned char buf[2048]; if (len > 2038) @@ -1009,12 +998,12 @@ int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len) WBUFL(buf, 4)=guild_id; WBUFW(buf, 8)=type; memcpy(WBUFP(buf,10),data,len); - mapif_sendall(buf,len+10); + mapif->sendall(buf,len+10); return 0; } // Send member info -int mapif_guild_memberinfochanged(int guild_id,int account_id,int char_id, int type,const void *data,int len) +int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len) { unsigned char buf[2048]; if (len > 2030) @@ -1026,24 +1015,24 @@ int mapif_guild_memberinfochanged(int guild_id,int account_id,int char_id, int t WBUFL(buf,12)=char_id; WBUFW(buf,16)=type; memcpy(WBUFP(buf,18),data,len); - mapif_sendall(buf,len+18); + mapif->sendall(buf,len+18); return 0; } // ACK guild skill up -int mapif_guild_skillupack(int guild_id,uint16 skill_id,int account_id) +int mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id) { unsigned char buf[14]; WBUFW(buf, 0)=0x383c; WBUFL(buf, 2)=guild_id; WBUFL(buf, 6)=skill_id; WBUFL(buf,10)=account_id; - mapif_sendall(buf,14); + mapif->sendall(buf,14); return 0; } // ACK guild alliance -int mapif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2) +int mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2) { unsigned char buf[19+2*NAME_LENGTH]; WBUFW(buf, 0)=0x383d; @@ -1054,12 +1043,12 @@ int mapif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account WBUFB(buf,18)=flag; memcpy(WBUFP(buf,19),name1,NAME_LENGTH); memcpy(WBUFP(buf,19+NAME_LENGTH),name2,NAME_LENGTH); - mapif_sendall(buf,19+2*NAME_LENGTH); + mapif->sendall(buf,19+2*NAME_LENGTH); return 0; } // Send a guild position desc -int mapif_guild_position(struct guild *g,int idx) +int mapif_guild_position(struct guild *g, int idx) { unsigned char buf[12 + sizeof(struct guild_position)]; WBUFW(buf,0)=0x383b; @@ -1067,7 +1056,7 @@ int mapif_guild_position(struct guild *g,int idx) WBUFL(buf,4)=g->guild_id; WBUFL(buf,8)=idx; memcpy(WBUFP(buf,12),&g->position[idx],sizeof(struct guild_position)); - mapif_sendall(buf,WBUFW(buf,2)); + mapif->sendall(buf,WBUFW(buf,2)); return 0; } @@ -1079,7 +1068,7 @@ int mapif_guild_notice(struct guild *g) WBUFL(buf,2)=g->guild_id; memcpy(WBUFP(buf,6),g->mes1,MAX_GUILDMES1); memcpy(WBUFP(buf,66),g->mes2,MAX_GUILDMES2); - mapif_sendall(buf,186); + mapif->sendall(buf,186); return 0; } @@ -1092,7 +1081,7 @@ int mapif_guild_emblem(struct guild *g) WBUFL(buf,4)=g->guild_id; WBUFL(buf,8)=g->emblem_id; memcpy(WBUFP(buf,12),g->emblem_data,g->emblem_len); - mapif_sendall(buf,WBUFW(buf,2)); + mapif->sendall(buf,WBUFW(buf,2)); return 0; } @@ -1103,7 +1092,7 @@ int mapif_guild_master_changed(struct guild *g, int aid, int cid) WBUFL(buf,2)=g->guild_id; WBUFL(buf,6)=aid; WBUFL(buf,10)=cid; - mapif_sendall(buf,14); + mapif->sendall(buf,14); return 0; } @@ -1118,7 +1107,7 @@ int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids) WFIFOW(fd, 0) = 0x3840; WFIFOW(fd, 2) = len; for (i = 0; i < num; i++) { - gc = inter_guildcastle_fromsql(*(castle_ids++)); + gc = inter_guild->castle_fromsql(*(castle_ids++)); memcpy(WFIFOP(fd, 4 + i * sizeof(*gc)), gc, sizeof(*gc)); } WFIFOSET(fd, len); @@ -1137,22 +1126,22 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member #ifdef NOISY ShowInfo("Creating Guild (%s)\n", name); #endif - if(search_guildname(name) != 0){ + if(inter_guild->search_guildname(name) != 0){ ShowInfo("int_guild: guild with same name exists [%s]\n",name); - mapif_guild_created(fd,account_id,NULL); + mapif->guild_created(fd,account_id,NULL); return 0; } // Check Authorized letters/symbols in the name of the character if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorized for (i = 0; i < NAME_LENGTH && name[i]; i++) if (strchr(char_name_letters, name[i]) == NULL) { - mapif_guild_created(fd,account_id,NULL); + mapif->guild_created(fd,account_id,NULL); return 0; } } else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden for (i = 0; i < NAME_LENGTH && name[i]; i++) if (strchr(char_name_letters, name[i]) != NULL) { - mapif_guild_created(fd,account_id,NULL); + mapif->guild_created(fd,account_id,NULL); return 0; } } @@ -1186,53 +1175,53 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member g->guild_id= -1; //Request to create guild. // Create the guild - if (!inter_guild_tosql(g,GS_BASIC|GS_POSITION|GS_SKILL|GS_MEMBER)) { + if (!inter_guild->tosql(g,GS_BASIC|GS_POSITION|GS_SKILL|GS_MEMBER)) { //Failed to Create guild.... ShowError("Failed to create Guild %s (Guild Master: %s)\n", g->name, g->master); - mapif_guild_created(fd,account_id,NULL); + mapif->guild_created(fd,account_id,NULL); aFree(g); return 0; } ShowInfo("Created Guild %d - %s (Guild Master: %s)\n", g->guild_id, g->name, g->master); //Add to cache - idb_put(guild_db_, g->guild_id, g); + idb_put(inter_guild->guild_db, g->guild_id, g); // Report to client - mapif_guild_created(fd,account_id,g); - mapif_guild_info(fd,g); + mapif->guild_created(fd,account_id,g); + mapif->guild_info(fd,g); if(log_inter) - inter_log("guild %s (id=%d) created by master %s (id=%d)\n", + inter->log("guild %s (id=%d) created by master %s (id=%d)\n", name, g->guild_id, master->name, master->account_id ); return 0; } // Return guild info to client -int mapif_parse_GuildInfo(int fd,int guild_id) +int mapif_parse_GuildInfo(int fd, int guild_id) { - struct guild * g = inter_guild_fromsql(guild_id); //We use this because on start-up the info of castle-owned guilds is required. [Skotlex] + struct guild * g = inter_guild->fromsql(guild_id); //We use this because on start-up the info of castle-owned guilds is required. [Skotlex] if(g) { - if (!guild_calcinfo(g)) - mapif_guild_info(fd,g); + if (!inter_guild->calcinfo(g)) + mapif->guild_info(fd,g); } else - mapif_guild_noinfo(fd,guild_id); // Failed to load info + mapif->guild_noinfo(fd,guild_id); // Failed to load info return 0; } // Add member to guild -int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m) +int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) { struct guild * g; int i; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL){ // Failed to add - mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,1); + mapif->guild_memberadded(fd,guild_id,m->account_id,m->char_id,1); return 0; } @@ -1243,9 +1232,9 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m) { memcpy(&g->member[i],m,sizeof(struct guild_member)); g->member[i].modified = (GS_MEMBER_NEW | GS_MEMBER_MODIFIED); - mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,0); - if (!guild_calcinfo(g)) //Send members if it was not invoked. - mapif_guild_info(-1,g); + mapif->guild_memberadded(fd,guild_id,m->account_id,m->char_id,0); + if (!inter_guild->calcinfo(g)) //Send members if it was not invoked. + mapif->guild_info(-1,g); g->save_flag |= GS_MEMBER; if (g->save_flag&GS_REMOVE) @@ -1255,7 +1244,7 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m) } // Failed to add - mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,1); + mapif->guild_memberadded(fd,guild_id,m->account_id,m->char_id,1); return 0; } @@ -1264,13 +1253,13 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in { int i; - struct guild* g = inter_guild_fromsql(guild_id); + struct guild* g = inter_guild->fromsql(guild_id); if( g == NULL ) { // Unknown guild, just update the player - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `guild_id`='0' WHERE `account_id`='%d' AND `char_id`='%d'", char_db, account_id, char_id) ) - Sql_ShowDebug(sql_handle); - // mapif_guild_withdraw(guild_id,account_id,char_id,flag,g->member[i].name,mes); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `guild_id`='0' WHERE `account_id`='%d' AND `char_id`='%d'", char_db, account_id, char_id) ) + Sql_ShowDebug(inter->sql_handle); + // mapif->guild_withdraw(guild_id,account_id,char_id,flag,g->member[i].name,mes); return 0; } @@ -1300,17 +1289,17 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in safestrncpy(g->expulsion[j].mes, mes, 40); } - mapif_guild_withdraw(guild_id,account_id,char_id,flag,g->member[i].name,mes); - inter_guild_removemember_tosql(g->member[i].account_id,g->member[i].char_id); + mapif->guild_withdraw(guild_id,account_id,char_id,flag,g->member[i].name,mes); + inter_guild->removemember_tosql(g->member[i].account_id,g->member[i].char_id); memset(&g->member[i],0,sizeof(struct guild_member)); - if( guild_check_empty(g) ) - mapif_parse_BreakGuild(-1,guild_id); //Break the guild. + if( inter_guild->check_empty(g) ) + mapif->parse_BreakGuild(-1,guild_id); //Break the guild. else { //Update member info. - if (!guild_calcinfo(g)) - mapif_guild_info(fd,g); + if (!inter_guild->calcinfo(g)) + mapif->guild_info(fd,g); g->save_flag |= GS_EXPULSION; } @@ -1318,14 +1307,14 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in } // Change member info -int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,int account_id,int char_id,int online,int lv,int class_) +int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { // Could speed up by manipulating only guild_member struct guild * g; int i,sum,c; int prev_count, prev_alv; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL) return 0; @@ -1336,7 +1325,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,int account_id,in g->member[i].lv = lv; g->member[i].class_ = class_; g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfoshort(g,i); + mapif->guild_memberinfoshort(g,i); } prev_count = g->connect_member; @@ -1371,58 +1360,58 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,int account_id,in } // BreakGuild -int mapif_parse_BreakGuild(int fd,int guild_id) +int mapif_parse_BreakGuild(int fd, int guild_id) { struct guild * g; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL) return 0; // Delete guild from sql //printf("- Delete guild %d from guild\n",guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_member_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_member_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_castle_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_castle_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_storage_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_storage_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d' OR `alliance_id` = '%d'", guild_alliance_db, guild_id, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d' OR `alliance_id` = '%d'", guild_alliance_db, guild_id, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_position_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_position_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_skill_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_skill_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_expulsion_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '%d'", guild_expulsion_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); //printf("- Update guild %d of char\n",guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `guild_id`='0' WHERE `guild_id`='%d'", char_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `guild_id`='0' WHERE `guild_id`='%d'", char_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); - mapif_guild_broken(guild_id,0); + mapif->guild_broken(guild_id,0); if(log_inter) - inter_log("guild %s (id=%d) broken\n",g->name,guild_id); + inter->log("guild %s (id=%d) broken\n",g->name,guild_id); //Remove the guild from memory. [Skotlex] - idb_remove(guild_db_, guild_id); + idb_remove(inter_guild->guild_db, guild_id); return 0; } // Forward Guild message to others map servers -int mapif_parse_GuildMessage(int fd,int guild_id,int account_id,char *mes,int len) +int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, char *mes, int len) { - return mapif_guild_message(guild_id,account_id,mes,len, fd); + return mapif->guild_message(guild_id,account_id,mes,len, fd); } /** @@ -1433,7 +1422,7 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void struct guild *g; struct guild_skill gd_skill; short value; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if( g == NULL ) return 0; @@ -1444,7 +1433,7 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void if( value < 0 && abs(value) > g->exp ) return 0; g->exp += value; - guild_calcinfo(g); + inter_guild->calcinfo(g); break; case GBI_GUILDLV: @@ -1466,31 +1455,31 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void case GBI_SKILLLV: gd_skill = *((const struct guild_skill*)data); memcpy(&(g->skill[(gd_skill.id - GD_SKILLBASE)]), &gd_skill, sizeof(gd_skill)); - if( !guild_calcinfo(g) ) - mapif_guild_info(-1,g); + if( !inter_guild->calcinfo(g) ) + mapif->guild_info(-1,g); g->save_flag |= GS_SKILL; - mapif_guild_skillupack(g->guild_id, gd_skill.id, 0); + mapif->guild_skillupack(g->guild_id, gd_skill.id, 0); break; default: ShowError("int_guild: GuildBasicInfoChange: Unknown type %d, see mmo.h::guild_basic_info for more information\n",type); return 0; } - mapif_guild_info(-1,g); + mapif->guild_info(-1,g); g->save_flag |= GS_LEVEL; - // Information is already sent in mapif_guild_info - //mapif_guild_basicinfochanged(guild_id,type,data,len); + // Information is already sent in mapif->guild_info + //mapif->guild_basicinfochanged(guild_id,type,data,len); return 0; } // Modification of the guild -int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int char_id,int type,const char *data,int len) +int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len) { // Could make some improvement in speed, because only change guild_member int i; struct guild * g; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL) return 0; @@ -1513,7 +1502,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha { g->member[i].position=*((short *)data); g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; break; } @@ -1536,11 +1525,11 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha else g->exp+=exp; - guild_calcinfo(g); - mapif_guild_basicinfochanged(guild_id,GBI_EXP,&g->exp,sizeof(g->exp)); + inter_guild->calcinfo(g); + mapif->guild_basicinfochanged(guild_id,GBI_EXP,&g->exp,sizeof(g->exp)); g->save_flag |= GS_LEVEL; } - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; break; } @@ -1548,7 +1537,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha { g->member[i].hair=*((short *)data); g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. break; } @@ -1556,7 +1545,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha { g->member[i].hair_color=*((short *)data); g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. break; } @@ -1564,7 +1553,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha { g->member[i].gender=*((short *)data); g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. break; } @@ -1572,7 +1561,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha { g->member[i].class_=*((short *)data); g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. break; } @@ -1580,7 +1569,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha { g->member[i].lv=*((short *)data); g->member[i].modified = GS_MEMBER_MODIFIED; - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); g->save_flag |= GS_MEMBER; //Save new data. break; } @@ -1591,17 +1580,17 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha return 0; } -int inter_guild_sex_changed(int guild_id,int account_id,int char_id, short gender) +int inter_guild_sex_changed(int guild_id, int account_id, int char_id, short gender) { - return mapif_parse_GuildMemberInfoChange(0, guild_id, account_id, char_id, GMI_GENDER, (const char*)&gender, sizeof(gender)); + return mapif->parse_GuildMemberInfoChange(0, guild_id, account_id, char_id, GMI_GENDER, (const char*)&gender, sizeof(gender)); } -int inter_guild_charname_changed(int guild_id,int account_id, int char_id, char *name) +int inter_guild_charname_changed(int guild_id, int account_id, int char_id, char *name) { struct guild *g; int i, flag = 0; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if( g == NULL ) { ShowError("inter_guild_charrenamed: Can't find guild %d.\n", guild_id); @@ -1624,38 +1613,38 @@ int inter_guild_charname_changed(int guild_id,int account_id, int char_id, char g->member[i].modified = GS_MEMBER_MODIFIED; flag |= GS_MEMBER; - if( !inter_guild_tosql(g, flag) ) + if( !inter_guild->tosql(g, flag) ) return 0; - mapif_guild_info(-1,g); + mapif->guild_info(-1,g); return 0; } // Change a position desc -int mapif_parse_GuildPosition(int fd,int guild_id,int idx,struct guild_position *p) +int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p) { // Could make some improvement in speed, because only change guild_position struct guild * g; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL || idx<0 || idx>=MAX_GUILDPOSITION) return 0; memcpy(&g->position[idx],p,sizeof(struct guild_position)); - mapif_guild_position(g,idx); + mapif->guild_position(g,idx); g->position[idx].modified = GS_POSITION_MODIFIED; g->save_flag |= GS_POSITION; // Change guild_position return 0; } // Guild Skill UP -int mapif_parse_GuildSkillUp(int fd,int guild_id,uint16 skill_id,int account_id,int max) +int mapif_parse_GuildSkillUp(int fd, int guild_id, uint16 skill_id, int account_id, int max) { struct guild * g; int idx = skill_id - GD_SKILLBASE; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) return 0; @@ -1663,16 +1652,16 @@ int mapif_parse_GuildSkillUp(int fd,int guild_id,uint16 skill_id,int account_id, { g->skill[idx].lv++; g->skill_point--; - if (!guild_calcinfo(g)) - mapif_guild_info(-1,g); - mapif_guild_skillupack(guild_id,skill_id,account_id); + if (!inter_guild->calcinfo(g)) + mapif->guild_info(-1,g); + mapif->guild_skillupack(guild_id,skill_id,account_id); g->save_flag |= (GS_LEVEL|GS_SKILL); // Change guild & guild_skill } return 0; } //Manual deletion of an alliance when partnering guild does not exists. [Skotlex] -static int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag) +int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag) { int i; char name[NAME_LENGTH]; @@ -1684,22 +1673,22 @@ static int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int ac strcpy(name, g->alliance[i].name); g->alliance[i].guild_id=0; - mapif_guild_alliance(g->guild_id,guild_id,account_id1,account_id2,flag,g->name,name); + mapif->guild_alliance(g->guild_id,guild_id,account_id1,account_id2,flag,g->name,name); g->save_flag |= GS_ALLIANCE; return 0; } // Alliance modification -int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,int account_id1,int account_id2,int flag) +int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) { // Could speed up struct guild *g[2] = { NULL }; int j,i; - g[0] = inter_guild_fromsql(guild_id1); - g[1] = inter_guild_fromsql(guild_id2); + g[0] = inter_guild->fromsql(guild_id1); + g[1] = inter_guild->fromsql(guild_id2); if(g[0] && g[1]==NULL && (flag & GUILD_ALLIANCE_REMOVE)) //Requested to remove an alliance with a not found guild. - return mapif_parse_GuildDeleteAlliance(g[0], guild_id2, account_id1, account_id2, flag); //Try to do a manual removal of said guild. + return mapif->parse_GuildDeleteAlliance(g[0], guild_id2, account_id1, account_id2, flag); //Try to do a manual removal of said guild. if(g[0]==NULL || g[1]==NULL) return 0; @@ -1726,7 +1715,7 @@ int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,int account_id1 } // Send on all map the new alliance/opposition - mapif_guild_alliance(guild_id1,guild_id2,account_id1,account_id2,flag,g[0]->name,g[1]->name); + mapif->guild_alliance(guild_id1,guild_id2,account_id1,account_id2,flag,g[0]->name,g[1]->name); // Mark the two guild to be saved g[0]->save_flag |= GS_ALLIANCE; @@ -1735,25 +1724,25 @@ int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,int account_id1 } // Change guild message -int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes2) +int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2) { struct guild *g; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL) return 0; memcpy(g->mes1,mes1,MAX_GUILDMES1); memcpy(g->mes2,mes2,MAX_GUILDMES2); g->save_flag |= GS_MES; //Change mes of guild - return mapif_guild_notice(g); + return mapif->guild_notice(g); } -int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *data) +int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data) { struct guild * g; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL) return 0; @@ -1764,20 +1753,20 @@ int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *da g->emblem_len=len; g->emblem_id++; g->save_flag |= GS_EMBLEM; //Change guild - return mapif_guild_emblem(g); + return mapif->guild_emblem(g); } int mapif_parse_GuildCastleDataLoad(int fd, int len, int *castle_ids) { - return mapif_guild_castle_dataload(fd, len, castle_ids); + return mapif->guild_castle_dataload(fd, len, castle_ids); } int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) { - struct guild_castle *gc = inter_guildcastle_fromsql(castle_id); + struct guild_castle *gc = inter_guild->castle_fromsql(castle_id); if (gc == NULL) { - ShowError("mapif_parse_GuildCastleDataSave: castle id=%d not found\n", castle_id); + ShowError("mapif->parse_GuildCastleDataSave: castle id=%d not found\n", castle_id); return 0; } @@ -1785,8 +1774,8 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) case 1: if (log_inter && gc->guild_id != value) { int gid = (value) ? value : gc->guild_id; - struct guild *g = idb_get(guild_db_, gid); - inter_log("guild %s (id=%d) %s castle id=%d\n", + struct guild *g = idb_get(inter_guild->guild_db, gid); + inter->log("guild %s (id=%d) %s castle id=%d\n", (g) ? g->name : "??", gid, (value) ? "occupy" : "abandon", castle_id); } gc->guild_id = value; @@ -1804,10 +1793,10 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) gc->guardian[index-10].visible = value; break; } - ShowError("mapif_parse_GuildCastleDataSave: not found index=%d\n", index); + ShowError("mapif->parse_GuildCastleDataSave: not found index=%d\n", index); return 0; } - inter_guildcastle_tosql(gc); + inter_guild->castle_tosql(gc); return 0; } @@ -1817,7 +1806,7 @@ int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int le struct guild_member gm; int pos; - g = inter_guild_fromsql(guild_id); + g = inter_guild->fromsql(guild_id); if(g==NULL || len > NAME_LENGTH) return 0; @@ -1845,7 +1834,7 @@ int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int le ShowInfo("int_guild: Guildmaster Changed to %s (Guild %d - %s)\n",g->master, guild_id, g->name); g->save_flag |= (GS_BASIC|GS_MEMBER); //Save main data and member data. - return mapif_guild_master_changed(g, g->member[0].account_id, g->member[0].char_id); + return mapif->guild_master_changed(g, g->member[0].account_id, g->member[0].char_id); } // Communication from the map server @@ -1859,23 +1848,23 @@ int inter_guild_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { - case 0x3030: mapif_parse_CreateGuild(fd,RFIFOL(fd,4),(char*)RFIFOP(fd,8),(struct guild_member *)RFIFOP(fd,32)); break; - case 0x3031: mapif_parse_GuildInfo(fd,RFIFOL(fd,2)); break; - case 0x3032: mapif_parse_GuildAddMember(fd,RFIFOL(fd,4),(struct guild_member *)RFIFOP(fd,8)); break; - case 0x3033: mapif_parse_GuildMasterChange(fd,RFIFOL(fd,4),(const char*)RFIFOP(fd,8),RFIFOW(fd,2)-8); break; - case 0x3034: mapif_parse_GuildLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(const char*)RFIFOP(fd,15)); break; - case 0x3035: mapif_parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); break; - case 0x3036: mapif_parse_BreakGuild(fd,RFIFOL(fd,2)); break; - case 0x3037: mapif_parse_GuildMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),(char*)RFIFOP(fd,12),RFIFOW(fd,2)-12); break; - case 0x3039: mapif_parse_GuildBasicInfoChange(fd,RFIFOL(fd,4),RFIFOW(fd,8),(const int16 *)RFIFOP(fd,10),RFIFOW(fd,2)-10); break; - case 0x303A: mapif_parse_GuildMemberInfoChange(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOL(fd,12),RFIFOW(fd,16),(const char*)RFIFOP(fd,18),RFIFOW(fd,2)-18); break; - case 0x303B: mapif_parse_GuildPosition(fd,RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); break; - case 0x303C: mapif_parse_GuildSkillUp(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14)); break; - case 0x303D: mapif_parse_GuildAlliance(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18)); break; - case 0x303E: mapif_parse_GuildNotice(fd,RFIFOL(fd,2),(const char*)RFIFOP(fd,6),(const char*)RFIFOP(fd,66)); break; - case 0x303F: mapif_parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),(const char*)RFIFOP(fd,12)); break; - case 0x3040: mapif_parse_GuildCastleDataLoad(fd,RFIFOW(fd,2),(int *)RFIFOP(fd,4)); break; - case 0x3041: mapif_parse_GuildCastleDataSave(fd,RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5)); break; + case 0x3030: mapif->parse_CreateGuild(fd,RFIFOL(fd,4),(char*)RFIFOP(fd,8),(struct guild_member *)RFIFOP(fd,32)); break; + case 0x3031: mapif->parse_GuildInfo(fd,RFIFOL(fd,2)); break; + case 0x3032: mapif->parse_GuildAddMember(fd,RFIFOL(fd,4),(struct guild_member *)RFIFOP(fd,8)); break; + case 0x3033: mapif->parse_GuildMasterChange(fd,RFIFOL(fd,4),(const char*)RFIFOP(fd,8),RFIFOW(fd,2)-8); break; + case 0x3034: mapif->parse_GuildLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(const char*)RFIFOP(fd,15)); break; + case 0x3035: mapif->parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); break; + case 0x3036: mapif->parse_BreakGuild(fd,RFIFOL(fd,2)); break; + case 0x3037: mapif->parse_GuildMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),(char*)RFIFOP(fd,12),RFIFOW(fd,2)-12); break; + case 0x3039: mapif->parse_GuildBasicInfoChange(fd,RFIFOL(fd,4),RFIFOW(fd,8),(const int16 *)RFIFOP(fd,10),RFIFOW(fd,2)-10); break; + case 0x303A: mapif->parse_GuildMemberInfoChange(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOL(fd,12),RFIFOW(fd,16),(const char*)RFIFOP(fd,18),RFIFOW(fd,2)-18); break; + case 0x303B: mapif->parse_GuildPosition(fd,RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); break; + case 0x303C: mapif->parse_GuildSkillUp(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14)); break; + case 0x303D: mapif->parse_GuildAlliance(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18)); break; + case 0x303E: mapif->parse_GuildNotice(fd,RFIFOL(fd,2),(const char*)RFIFOP(fd,6),(const char*)RFIFOP(fd,66)); break; + case 0x303F: mapif->parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),(const char*)RFIFOP(fd,12)); break; + case 0x3040: mapif->parse_GuildCastleDataLoad(fd,RFIFOW(fd,2),(int *)RFIFOP(fd,4)); break; + case 0x3041: mapif->parse_GuildCastleDataSave(fd,RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5)); break; default: return 0; @@ -1887,10 +1876,41 @@ int inter_guild_parse_frommap(int fd) //Leave request from the server (for deleting character from guild) int inter_guild_leave(int guild_id, int account_id, int char_id) { - return mapif_parse_GuildLeave(-1, guild_id, account_id, char_id, 0, "** Character Deleted **"); + return mapif->parse_GuildLeave(-1, guild_id, account_id, char_id, 0, "** Character Deleted **"); } int inter_guild_broken(int guild_id) { - return mapif_guild_broken(guild_id, 0); + return mapif->guild_broken(guild_id, 0); +} + +void inter_guild_defaults(void) +{ + inter_guild = &inter_guild_s; + + inter_guild->guild_db = NULL; + inter_guild->castle_db = NULL; + + inter_guild->save_timer = inter_guild_save_timer; + inter_guild->removemember_tosql = inter_guild_removemember_tosql; + inter_guild->tosql = inter_guild_tosql; + inter_guild->fromsql = inter_guild_fromsql; + inter_guild->castle_tosql = inter_guild_castle_tosql; + inter_guild->castle_fromsql = inter_guild_castle_fromsql; + inter_guild->exp_parse_row = inter_guild_exp_parse_row; + inter_guild->CharOnline = inter_guild_CharOnline; + inter_guild->CharOffline = inter_guild_CharOffline; + inter_guild->sql_init = inter_guild_sql_init; + inter_guild->db_final = inter_guild_db_final; + inter_guild->sql_final = inter_guild_sql_final; + inter_guild->search_guildname = inter_guild_search_guildname; + inter_guild->check_empty = inter_guild_check_empty; + inter_guild->nextexp = inter_guild_nextexp; + inter_guild->checkskill = inter_guild_checkskill; + inter_guild->calcinfo = inter_guild_calcinfo; + inter_guild->sex_changed = inter_guild_sex_changed; + inter_guild->charname_changed = inter_guild_charname_changed; + inter_guild->parse_frommap = inter_guild_parse_frommap; + inter_guild->leave = inter_guild_leave; + inter_guild->broken = inter_guild_broken; } diff --git a/src/char/int_guild.h b/src/char/int_guild.h index bc457d86b..c72856709 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -4,6 +4,8 @@ #ifndef CHAR_INT_GUILD_H #define CHAR_INT_GUILD_H +#include "../common/mmo.h" + enum { GS_BASIC = 0x0001, GS_MEMBER = 0x0002, @@ -20,15 +22,40 @@ enum { GS_REMOVE = 0x8000, }; -int inter_guild_parse_frommap(int fd); -int inter_guild_sql_init(void); -void inter_guild_sql_final(void); -int inter_guild_leave(int guild_id,int account_id,int char_id); -int mapif_parse_BreakGuild(int fd,int guild_id); -int inter_guild_broken(int guild_id); -int inter_guild_sex_changed(int guild_id,int account_id,int char_id, short gender); -int inter_guild_charname_changed(int guild_id,int account_id, int char_id, char *name); -int inter_guild_CharOnline(int char_id, int guild_id); -int inter_guild_CharOffline(int char_id, int guild_id); +void inter_guild_defaults(void); + +/** + * inter_guild interface + **/ +struct inter_guild_interface { + DBMap* guild_db; // int guild_id -> struct guild* + DBMap* castle_db; + unsigned int exp[MAX_GUILDLEVEL]; + + int (*save_timer) (int tid, int64 tick, int id, intptr_t data); + int (*removemember_tosql) (int account_id, int char_id); + int (*tosql) (struct guild *g, int flag); + struct guild* (*fromsql) (int guild_id); + int (*castle_tosql) (struct guild_castle *gc); + struct guild_castle* (*castle_fromsql) (int castle_id); + bool (*exp_parse_row) (char* split[], int column, int current); + int (*CharOnline) (int char_id, int guild_id); + int (*CharOffline) (int char_id, int guild_id); + int (*sql_init) (void); + int (*db_final) (DBKey key, DBData *data, va_list ap); + void (*sql_final) (void); + int (*search_guildname) (char *str); + bool (*check_empty) (struct guild *g); + unsigned int (*nextexp) (int level); + int (*checkskill) (struct guild *g, int id); + int (*calcinfo) (struct guild *g); + int (*sex_changed) (int guild_id, int account_id, int char_id, short gender); + int (*charname_changed) (int guild_id, int account_id, int char_id, char *name); + int (*parse_frommap) (int fd); + int (*leave) (int guild_id, int account_id, int char_id); + int (*broken) (int guild_id); +}; + +struct inter_guild_interface *inter_guild; #endif /* CHAR_INT_GUILD_H */ diff --git a/src/char/int_homun.c b/src/char/int_homun.c index acde9eb38..d3cc1c46c 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" @@ -20,6 +21,8 @@ #include "../common/strlib.h" #include "../common/utils.h" +struct inter_homunculus_interface inter_homunculus_s; + int inter_homunculus_sql_init(void) { return 0; @@ -29,7 +32,7 @@ void inter_homunculus_sql_final(void) return; } -static void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag) +void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag) { WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd,0) = 0x3890; @@ -40,7 +43,7 @@ static void mapif_homunculus_created(int fd, int account_id, struct s_homunculus WFIFOSET(fd, WFIFOW(fd,2)); } -static void mapif_homunculus_deleted(int fd, int flag) +void mapif_homunculus_deleted(int fd, int flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x3893; @@ -48,7 +51,7 @@ static void mapif_homunculus_deleted(int fd, int flag) WFIFOSET(fd, 3); } -static void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) +void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) { WFIFOHEAD(fd, sizeof(struct s_homunculus)+9); WFIFOW(fd,0) = 0x3891; @@ -67,7 +70,7 @@ static void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus WFIFOSET(fd, sizeof(struct s_homunculus)+9); } -static void mapif_homunculus_saved(int fd, int account_id, bool flag) +void mapif_homunculus_saved(int fd, int account_id, bool flag) { WFIFOHEAD(fd, 7); WFIFOW(fd,0) = 0x3892; @@ -76,7 +79,7 @@ static void mapif_homunculus_saved(int fd, int account_id, bool flag) WFIFOSET(fd, 7); } -static void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char* name) +void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char* name) { WFIFOHEAD(fd, NAME_LENGTH+12); WFIFOW(fd, 0) = 0x3894; @@ -92,31 +95,31 @@ bool mapif_homunculus_save(struct s_homunculus* hd) bool flag = true; char esc_name[NAME_LENGTH*2+1]; - SQL->EscapeStringLen(sql_handle, esc_name, hd->name, strnlen(hd->name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, hd->name, strnlen(hd->name, NAME_LENGTH)); if( hd->hom_id == 0 ) {// new homunculus - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` " "(`char_id`, `class`,`prev_class`,`name`,`level`,`exp`,`intimacy`,`hunger`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hp`,`max_hp`,`sp`,`max_sp`,`skill_point`, `rename_flag`, `vaporize`) " "VALUES ('%d', '%d', '%d', '%s', '%d', '%u', '%u', '%d', '%d', %d, '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", homunculus_db, hd->char_id, hd->class_, hd->prev_class, esc_name, hd->level, hd->exp, hd->intimacy, hd->hunger, hd->str, hd->agi, hd->vit, hd->int_, hd->dex, hd->luk, hd->hp, hd->max_hp, hd->sp, hd->max_sp, hd->skillpts, hd->rename_flag, hd->vaporize) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } else { - hd->hom_id = (int)SQL->LastInsertId(sql_handle); + hd->hom_id = (int)SQL->LastInsertId(inter->sql_handle); } } else { - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `char_id`='%d', `class`='%d',`prev_class`='%d',`name`='%s',`level`='%d',`exp`='%u',`intimacy`='%u',`hunger`='%d', `str`='%d', `agi`='%d', `vit`='%d', `int`='%d', `dex`='%d', `luk`='%d', `hp`='%d',`max_hp`='%d',`sp`='%d',`max_sp`='%d',`skill_point`='%d', `rename_flag`='%d', `vaporize`='%d' WHERE `homun_id`='%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_id`='%d', `class`='%d',`prev_class`='%d',`name`='%s',`level`='%d',`exp`='%u',`intimacy`='%u',`hunger`='%d', `str`='%d', `agi`='%d', `vit`='%d', `int`='%d', `dex`='%d', `luk`='%d', `hp`='%d',`max_hp`='%d',`sp`='%d',`max_sp`='%d',`skill_point`='%d', `rename_flag`='%d', `vaporize`='%d' WHERE `homun_id`='%d'", homunculus_db, hd->char_id, hd->class_, hd->prev_class, esc_name, hd->level, hd->exp, hd->intimacy, hd->hunger, hd->str, hd->agi, hd->vit, hd->int_, hd->dex, hd->luk, hd->hp, hd->max_hp, hd->sp, hd->max_sp, hd->skillpts, hd->rename_flag, hd->vaporize, hd->hom_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } else @@ -124,7 +127,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd) SqlStmt* stmt; int i; - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_ERROR == SQL->StmtPrepare(stmt, "REPLACE INTO `%s` (`homun_id`, `id`, `lv`) VALUES (%d, ?, ?)", skill_homunculus_db, hd->hom_id) ) SqlStmt_ShowDebug(stmt); for( i = 0; i < MAX_HOMUNSKILL; ++i ) @@ -149,8 +152,6 @@ bool mapif_homunculus_save(struct s_homunculus* hd) return flag; } - - // Load an homunculus bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) { @@ -160,61 +161,61 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) memset(hd, 0, sizeof(*hd)); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `homun_id`,`char_id`,`class`,`prev_class`,`name`,`level`,`exp`,`intimacy`,`hunger`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hp`,`max_hp`,`sp`,`max_sp`,`skill_point`,`rename_flag`, `vaporize` FROM `%s` WHERE `homun_id`='%u'", homunculus_db, homun_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `homun_id`,`char_id`,`class`,`prev_class`,`name`,`level`,`exp`,`intimacy`,`hunger`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hp`,`max_hp`,`sp`,`max_sp`,`skill_point`,`rename_flag`, `vaporize` FROM `%s` WHERE `homun_id`='%u'", homunculus_db, homun_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - if( !SQL->NumRows(sql_handle) ) + if( !SQL->NumRows(inter->sql_handle) ) { //No homunculus found. - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return false; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - Sql_ShowDebug(sql_handle); - SQL->FreeResult(sql_handle); + Sql_ShowDebug(inter->sql_handle); + SQL->FreeResult(inter->sql_handle); return false; } hd->hom_id = homun_id; - SQL->GetData(sql_handle, 1, &data, NULL); hd->char_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); hd->class_ = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); hd->prev_class = atoi(data); - SQL->GetData(sql_handle, 4, &data, &len); safestrncpy(hd->name, data, sizeof(hd->name)); - SQL->GetData(sql_handle, 5, &data, NULL); hd->level = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); hd->exp = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); hd->intimacy = (unsigned int)strtoul(data, NULL, 10); - SQL->GetData(sql_handle, 8, &data, NULL); hd->hunger = atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); hd->str = atoi(data); - SQL->GetData(sql_handle, 10, &data, NULL); hd->agi = atoi(data); - SQL->GetData(sql_handle, 11, &data, NULL); hd->vit = atoi(data); - SQL->GetData(sql_handle, 12, &data, NULL); hd->int_ = atoi(data); - SQL->GetData(sql_handle, 13, &data, NULL); hd->dex = atoi(data); - SQL->GetData(sql_handle, 14, &data, NULL); hd->luk = atoi(data); - SQL->GetData(sql_handle, 15, &data, NULL); hd->hp = atoi(data); - SQL->GetData(sql_handle, 16, &data, NULL); hd->max_hp = atoi(data); - SQL->GetData(sql_handle, 17, &data, NULL); hd->sp = atoi(data); - SQL->GetData(sql_handle, 18, &data, NULL); hd->max_sp = atoi(data); - SQL->GetData(sql_handle, 19, &data, NULL); hd->skillpts = atoi(data); - SQL->GetData(sql_handle, 20, &data, NULL); hd->rename_flag = atoi(data); - SQL->GetData(sql_handle, 21, &data, NULL); hd->vaporize = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 1, &data, NULL); hd->char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); hd->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); hd->prev_class = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, &len); safestrncpy(hd->name, data, sizeof(hd->name)); + SQL->GetData(inter->sql_handle, 5, &data, NULL); hd->level = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); hd->exp = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); hd->intimacy = (unsigned int)strtoul(data, NULL, 10); + SQL->GetData(inter->sql_handle, 8, &data, NULL); hd->hunger = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); hd->str = atoi(data); + SQL->GetData(inter->sql_handle, 10, &data, NULL); hd->agi = atoi(data); + SQL->GetData(inter->sql_handle, 11, &data, NULL); hd->vit = atoi(data); + SQL->GetData(inter->sql_handle, 12, &data, NULL); hd->int_ = atoi(data); + SQL->GetData(inter->sql_handle, 13, &data, NULL); hd->dex = atoi(data); + SQL->GetData(inter->sql_handle, 14, &data, NULL); hd->luk = atoi(data); + SQL->GetData(inter->sql_handle, 15, &data, NULL); hd->hp = atoi(data); + SQL->GetData(inter->sql_handle, 16, &data, NULL); hd->max_hp = atoi(data); + SQL->GetData(inter->sql_handle, 17, &data, NULL); hd->sp = atoi(data); + SQL->GetData(inter->sql_handle, 18, &data, NULL); hd->max_sp = atoi(data); + SQL->GetData(inter->sql_handle, 19, &data, NULL); hd->skillpts = atoi(data); + SQL->GetData(inter->sql_handle, 20, &data, NULL); hd->rename_flag = atoi(data); + SQL->GetData(inter->sql_handle, 21, &data, NULL); hd->vaporize = atoi(data); + SQL->FreeResult(inter->sql_handle); hd->intimacy = cap_value(hd->intimacy, 0, 100000); hd->hunger = cap_value(hd->hunger, 0, 100); // Load Homunculus Skill - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `id`,`lv` FROM `%s` WHERE `homun_id`=%d", skill_homunculus_db, homun_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `id`,`lv` FROM `%s` WHERE `homun_id`=%d", skill_homunculus_db, homun_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - while( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { // id - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); i = atoi(data); if( i < HM_SKILLBASE || i >= HM_SKILLBASE + MAX_HOMUNSKILL ) continue;// invalid skill id @@ -222,10 +223,10 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) hd->hskill[i].id = (unsigned short)atoi(data); // lv - SQL->GetData(sql_handle, 1, &data, NULL); + SQL->GetData(inter->sql_handle, 1, &data, NULL); hd->hskill[i].lv = (unsigned char)atoi(data); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); if( save_log ) ShowInfo("Homunculus loaded (%d - %s).\n", hd->hom_id, hd->name); @@ -235,10 +236,10 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) bool mapif_homunculus_delete(int homun_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", homunculus_db, homun_id) - || SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", skill_homunculus_db, homun_id) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", homunculus_db, homun_id) + || SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", skill_homunculus_db, homun_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } return true; @@ -266,35 +267,35 @@ bool mapif_homunculus_rename(char *name) } -static void mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus* phd) +void mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus* phd) { - bool result = mapif_homunculus_save(phd); - mapif_homunculus_created(fd, account_id, phd, result); + bool result = mapif->homunculus_save(phd); + mapif->homunculus_created(fd, account_id, phd, result); } -static void mapif_parse_homunculus_delete(int fd, int homun_id) +void mapif_parse_homunculus_delete(int fd, int homun_id) { - bool result = mapif_homunculus_delete(homun_id); - mapif_homunculus_deleted(fd, result); + bool result = mapif->homunculus_delete(homun_id); + mapif->homunculus_deleted(fd, result); } -static void mapif_parse_homunculus_load(int fd, int account_id, int homun_id) +void mapif_parse_homunculus_load(int fd, int account_id, int homun_id) { struct s_homunculus hd; - bool result = mapif_homunculus_load(homun_id, &hd); - mapif_homunculus_loaded(fd, account_id, ( result ? &hd : NULL )); + bool result = mapif->homunculus_load(homun_id, &hd); + mapif->homunculus_loaded(fd, account_id, ( result ? &hd : NULL )); } -static void mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus* phd) +void mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus* phd) { - bool result = mapif_homunculus_save(phd); - mapif_homunculus_saved(fd, account_id, result); + bool result = mapif->homunculus_save(phd); + mapif->homunculus_saved(fd, account_id, result); } -static void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char* name) +void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char* name) { - bool result = mapif_homunculus_rename(name); - mapif_homunculus_renamed(fd, account_id, char_id, result, name); + bool result = mapif->homunculus_rename(name); + mapif->homunculus_renamed(fd, account_id, char_id, result, name); } /*========================================== @@ -306,13 +307,22 @@ int inter_homunculus_parse_frommap(int fd) switch( cmd ) { - case 0x3090: mapif_parse_homunculus_create(fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break; - case 0x3091: mapif_parse_homunculus_load (fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; - case 0x3092: mapif_parse_homunculus_save (fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break; - case 0x3093: mapif_parse_homunculus_delete(fd, (int)RFIFOL(fd,2)); break; - case 0x3094: mapif_parse_homunculus_rename(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6), (char*)RFIFOP(fd,10)); break; + case 0x3090: mapif->parse_homunculus_create(fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break; + case 0x3091: mapif->parse_homunculus_load (fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; + case 0x3092: mapif->parse_homunculus_save (fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break; + case 0x3093: mapif->parse_homunculus_delete(fd, (int)RFIFOL(fd,2)); break; + case 0x3094: mapif->parse_homunculus_rename(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6), (char*)RFIFOP(fd,10)); break; default: return 0; } return 1; } + +void inter_homunculus_defaults(void) +{ + inter_homunculus = &inter_homunculus_s; + + inter_homunculus->sql_init = inter_homunculus_sql_init; + inter_homunculus->sql_final = inter_homunculus_sql_final; + inter_homunculus->parse_frommap = inter_homunculus_parse_frommap; +} diff --git a/src/char/int_homun.h b/src/char/int_homun.h index 6fa4f9dc7..69b30b781 100644 --- a/src/char/int_homun.h +++ b/src/char/int_homun.h @@ -8,13 +8,17 @@ struct s_homunculus; -int inter_homunculus_sql_init(void); -void inter_homunculus_sql_final(void); -int inter_homunculus_parse_frommap(int fd); +void inter_homunculus_defaults(void); -bool mapif_homunculus_save(struct s_homunculus* hd); -bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd); -bool mapif_homunculus_delete(int homun_id); -bool mapif_homunculus_rename(char *name); +/** + * inter_homunculus interface + **/ +struct inter_homunculus_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; + +struct inter_homunculus_interface *inter_homunculus; #endif /* CHAR_INT_HOMUN_H */ diff --git a/src/char/int_mail.c b/src/char/int_mail.c index 47d2cc1c5..c400ea01f 100644 --- a/src/char/int_mail.c +++ b/src/char/int_mail.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" @@ -20,7 +21,9 @@ #include "../common/strlib.h" #include "../common/timer.h" -static int mail_fromsql(int char_id, struct mail_data* md) +struct inter_mail_interface inter_mail_s; + +static int inter_mail_fromsql(int char_id, struct mail_data* md) { int i, j; struct mail_message *msg; @@ -42,45 +45,45 @@ static int mail_fromsql(int char_id, struct mail_data* md) StrBuf->Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' AND `status` < 3 ORDER BY `id` LIMIT %d", mail_db, char_id, MAIL_MAX_INBOX + 1); - if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); - for (i = 0; i < MAIL_MAX_INBOX && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + for (i = 0; i < MAIL_MAX_INBOX && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { msg = &md->msg[i]; - SQL->GetData(sql_handle, 0, &data, NULL); msg->id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 2, &data, NULL); msg->send_id = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 4, &data, NULL); msg->dest_id = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH); - SQL->GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH); - SQL->GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); msg->id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 2, &data, NULL); msg->send_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 4, &data, NULL); msg->dest_id = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH); + SQL->GetData(inter->sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH); + SQL->GetData(inter->sql_handle, 7, &data, NULL); msg->timestamp = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); msg->zeny = atoi(data); item = &msg->item; - SQL->GetData(sql_handle,10, &data, NULL); item->amount = (short)atoi(data); - SQL->GetData(sql_handle,11, &data, NULL); item->nameid = atoi(data); - SQL->GetData(sql_handle,12, &data, NULL); item->refine = atoi(data); - SQL->GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data); - SQL->GetData(sql_handle,14, &data, NULL); item->identify = atoi(data); - SQL->GetData(sql_handle,15, &data, NULL); item->unique_id = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle,10, &data, NULL); item->amount = (short)atoi(data); + SQL->GetData(inter->sql_handle,11, &data, NULL); item->nameid = atoi(data); + SQL->GetData(inter->sql_handle,12, &data, NULL); item->refine = atoi(data); + SQL->GetData(inter->sql_handle,13, &data, NULL); item->attribute = atoi(data); + SQL->GetData(inter->sql_handle,14, &data, NULL); item->identify = atoi(data); + SQL->GetData(inter->sql_handle,15, &data, NULL); item->unique_id = strtoull(data, NULL, 10); item->expire_time = 0; item->bound = 0; for (j = 0; j < MAX_SLOTS; j++) { - SQL->GetData(sql_handle, 16 + j, &data, NULL); + SQL->GetData(inter->sql_handle, 16 + j, &data, NULL); item->card[j] = atoi(data); } } - md->full = ( SQL->NumRows(sql_handle) > MAIL_MAX_INBOX ); + md->full = ( SQL->NumRows(inter->sql_handle) > MAIL_MAX_INBOX ); md->amount = i; - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); md->unchecked = 0; md->unread = 0; @@ -89,8 +92,8 @@ static int mail_fromsql(int char_id, struct mail_data* md) msg = &md->msg[i]; if( msg->status == MAIL_NEW ) { - if ( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_UNREAD, msg->id) ) - Sql_ShowDebug(sql_handle); + if ( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_UNREAD, msg->id) ) + Sql_ShowDebug(inter->sql_handle); msg->status = MAIL_UNREAD; md->unchecked++; @@ -105,7 +108,7 @@ static int mail_fromsql(int char_id, struct mail_data* md) /// Stores a single message in the database. /// Returns the message's ID if successful (or 0 if it fails). -int mail_savemessage(struct mail_message* msg) +int inter_mail_savemessage(struct mail_message* msg) { StringBuf buf; SqlStmt* stmt; @@ -123,7 +126,7 @@ int mail_savemessage(struct mail_message* msg) StrBuf->AppendStr(&buf, ")"); // prepare and execute query - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, msg->send_name, strnlen(msg->send_name, NAME_LENGTH)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, msg->dest_name, strnlen(msg->dest_name, NAME_LENGTH)) @@ -144,7 +147,7 @@ int mail_savemessage(struct mail_message* msg) /// Retrieves a single message from the database. /// Returns true if the operation succeeds (or false if it fails). -static bool mail_loadmessage(int mail_id, struct mail_message* msg) +static bool inter_mail_loadmessage(int mail_id, struct mail_message* msg) { int j; StringBuf buf; @@ -157,11 +160,11 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg) StrBuf->Printf(&buf, ",`card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `id` = '%d'", mail_db, mail_id); - if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) - || SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) + || SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - Sql_ShowDebug(sql_handle); - SQL->FreeResult(sql_handle); + Sql_ShowDebug(inter->sql_handle); + SQL->FreeResult(inter->sql_handle); StrBuf->Destroy(&buf); return false; } @@ -169,76 +172,77 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg) { char* data; - SQL->GetData(sql_handle, 0, &data, NULL); msg->id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 2, &data, NULL); msg->send_id = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH); - SQL->GetData(sql_handle, 4, &data, NULL); msg->dest_id = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH); - SQL->GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH); - SQL->GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data); - SQL->GetData(sql_handle,10, &data, NULL); msg->item.amount = (short)atoi(data); - SQL->GetData(sql_handle,11, &data, NULL); msg->item.nameid = atoi(data); - SQL->GetData(sql_handle,12, &data, NULL); msg->item.refine = atoi(data); - SQL->GetData(sql_handle,13, &data, NULL); msg->item.attribute = atoi(data); - SQL->GetData(sql_handle,14, &data, NULL); msg->item.identify = atoi(data); - SQL->GetData(sql_handle,15, &data, NULL); msg->item.unique_id = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle, 0, &data, NULL); msg->id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 2, &data, NULL); msg->send_id = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH); + SQL->GetData(inter->sql_handle, 4, &data, NULL); msg->dest_id = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH); + SQL->GetData(inter->sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH); + SQL->GetData(inter->sql_handle, 7, &data, NULL); msg->timestamp = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); msg->zeny = atoi(data); + SQL->GetData(inter->sql_handle,10, &data, NULL); msg->item.amount = (short)atoi(data); + SQL->GetData(inter->sql_handle,11, &data, NULL); msg->item.nameid = atoi(data); + SQL->GetData(inter->sql_handle,12, &data, NULL); msg->item.refine = atoi(data); + SQL->GetData(inter->sql_handle,13, &data, NULL); msg->item.attribute = atoi(data); + SQL->GetData(inter->sql_handle,14, &data, NULL); msg->item.identify = atoi(data); + SQL->GetData(inter->sql_handle,15, &data, NULL); msg->item.unique_id = strtoull(data, NULL, 10); msg->item.expire_time = 0; msg->item.bound = 0; for( j = 0; j < MAX_SLOTS; j++ ) { - SQL->GetData(sql_handle,16 + j, &data, NULL); + SQL->GetData(inter->sql_handle,16 + j, &data, NULL); msg->item.card[j] = atoi(data); } } StrBuf->Destroy(&buf); - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return true; } -/*========================================== - * Client Inbox Request - *------------------------------------------*/ -static void mapif_Mail_sendinbox(int fd, int char_id, unsigned char flag) +void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md) { - struct mail_data md; - memset(&md, 0, sizeof(md)); - mail_fromsql(char_id, &md); - //FIXME: dumping the whole structure like this is unsafe [ultramage] - WFIFOHEAD(fd, sizeof(md) + 9); + WFIFOHEAD(fd, sizeof(struct mail_data) + 9); WFIFOW(fd,0) = 0x3848; - WFIFOW(fd,2) = sizeof(md) + 9; + WFIFOW(fd,2) = sizeof(struct mail_data) + 9; WFIFOL(fd,4) = char_id; WFIFOB(fd,8) = flag; - memcpy(WFIFOP(fd,9),&md,sizeof(md)); + memcpy(WFIFOP(fd,9),md,sizeof(struct mail_data)); WFIFOSET(fd,WFIFOW(fd,2)); } -static void mapif_parse_Mail_requestinbox(int fd) +/*========================================== + * Client Inbox Request + *------------------------------------------*/ +void mapif_parse_mail_requestinbox(int fd) { - mapif_Mail_sendinbox(fd, RFIFOL(fd,2), RFIFOB(fd,6)); + int char_id = RFIFOL(fd,2); + unsigned char flag = RFIFOB(fd,6); + struct mail_data md; + memset(&md, 0, sizeof(md)); + inter_mail->fromsql(char_id, &md); + mapif->mail_sendinbox(fd, char_id, flag, &md); } /*========================================== * Mark mail as 'Read' *------------------------------------------*/ -static void mapif_parse_Mail_read(int fd) +void mapif_parse_mail_read(int fd) { int mail_id = RFIFOL(fd,2); - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_READ, mail_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_READ, mail_id) ) + Sql_ShowDebug(inter->sql_handle); } /*========================================== * Client Attachment Request *------------------------------------------*/ -static bool mail_DeleteAttach(int mail_id) +static bool inter_mail_DeleteAttach(int mail_id) { StringBuf buf; int i; @@ -249,9 +253,9 @@ static bool mail_DeleteAttach(int mail_id) StrBuf->Printf(&buf, ", `card%d` = '0'", i); StrBuf->Printf(&buf, " WHERE `id` = '%d'", mail_id); - if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return false; @@ -261,12 +265,23 @@ static bool mail_DeleteAttach(int mail_id) return true; } -static void mapif_Mail_getattach(int fd, int char_id, int mail_id) +void mapif_mail_sendattach(int fd, int char_id, struct mail_message *msg) +{ + WFIFOHEAD(fd, sizeof(struct item) + 12); + WFIFOW(fd,0) = 0x384a; + WFIFOW(fd,2) = sizeof(struct item) + 12; + WFIFOL(fd,4) = char_id; + WFIFOL(fd,8) = (msg->zeny > 0)?msg->zeny:0; + memcpy(WFIFOP(fd,12), &msg->item, sizeof(struct item)); + WFIFOSET(fd,WFIFOW(fd,2)); +} + +void mapif_mail_getattach(int fd, int char_id, int mail_id) { struct mail_message msg; memset(&msg, 0, sizeof(msg)); - if( !mail_loadmessage(mail_id, &msg) ) + if( !inter_mail->loadmessage(mail_id, &msg) ) return; if( msg.dest_id != char_id ) @@ -278,35 +293,22 @@ static void mapif_Mail_getattach(int fd, int char_id, int mail_id) if( (msg.item.nameid < 1 || msg.item.amount < 1) && msg.zeny < 1 ) return; // No Attachment - if( !mail_DeleteAttach(mail_id) ) + if( !inter_mail->DeleteAttach(mail_id) ) return; - WFIFOHEAD(fd, sizeof(struct item) + 12); - WFIFOW(fd,0) = 0x384a; - WFIFOW(fd,2) = sizeof(struct item) + 12; - WFIFOL(fd,4) = char_id; - WFIFOL(fd,8) = (msg.zeny > 0)?msg.zeny:0; - memcpy(WFIFOP(fd,12), &msg.item, sizeof(struct item)); - WFIFOSET(fd,WFIFOW(fd,2)); + mapif->mail_sendattach(fd, char_id, &msg); } -static void mapif_parse_Mail_getattach(int fd) +void mapif_parse_mail_getattach(int fd) { - mapif_Mail_getattach(fd, RFIFOL(fd,2), RFIFOL(fd,6)); + mapif->mail_getattach(fd, RFIFOL(fd,2), RFIFOL(fd,6)); } /*========================================== * Delete Mail *------------------------------------------*/ -static void mapif_Mail_delete(int fd, int char_id, int mail_id) +void mapif_mail_delete(int fd, int char_id, int mail_id, bool failed) { - bool failed = false; - if ( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) ) - { - Sql_ShowDebug(sql_handle); - failed = true; - } - WFIFOHEAD(fd,11); WFIFOW(fd,0) = 0x384b; WFIFOL(fd,2) = char_id; @@ -315,15 +317,23 @@ static void mapif_Mail_delete(int fd, int char_id, int mail_id) WFIFOSET(fd,11); } -static void mapif_parse_Mail_delete(int fd) +void mapif_parse_mail_delete(int fd) { - mapif_Mail_delete(fd, RFIFOL(fd,2), RFIFOL(fd,6)); + int char_id = RFIFOL(fd,2); + int mail_id = RFIFOL(fd,6); + bool failed = false; + if ( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) ) + { + Sql_ShowDebug(inter->sql_handle); + failed = true; + } + mapif->mail_delete(fd, char_id, mail_id, failed); } /*========================================== * Report New Mail to Map Server *------------------------------------------*/ -void mapif_Mail_new(struct mail_message *msg) +void mapif_mail_new(struct mail_message *msg) { unsigned char buf[74]; @@ -335,23 +345,35 @@ void mapif_Mail_new(struct mail_message *msg) WBUFL(buf,6) = msg->id; memcpy(WBUFP(buf,10), msg->send_name, NAME_LENGTH); memcpy(WBUFP(buf,34), msg->title, MAIL_TITLE_LENGTH); - mapif_sendall(buf, 74); + mapif->sendall(buf, 74); } /*========================================== * Return Mail *------------------------------------------*/ -static void mapif_Mail_return(int fd, int char_id, int mail_id) +void mapif_mail_return(int fd, int char_id, int mail_id, int new_mail) { + WFIFOHEAD(fd,11); + WFIFOW(fd,0) = 0x384c; + WFIFOL(fd,2) = char_id; + WFIFOL(fd,6) = mail_id; + WFIFOB(fd,10) = (new_mail == 0); + WFIFOSET(fd,11); +} + +void mapif_parse_mail_return(int fd) +{ + int char_id = RFIFOL(fd,2); + int mail_id = RFIFOL(fd,6); struct mail_message msg; int new_mail = 0; - if( mail_loadmessage(mail_id, &msg) ) + if( inter_mail->loadmessage(mail_id, &msg) ) { if( msg.dest_id != char_id) return; - else if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) ) - Sql_ShowDebug(sql_handle); + else if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) ) + Sql_ShowDebug(inter->sql_handle); else { char temp_[MAIL_TITLE_LENGTH]; @@ -369,28 +391,18 @@ static void mapif_Mail_return(int fd, int char_id, int mail_id) msg.status = MAIL_NEW; msg.timestamp = time(NULL); - new_mail = mail_savemessage(&msg); - mapif_Mail_new(&msg); + new_mail = inter_mail->savemessage(&msg); + mapif->mail_new(&msg); } } - WFIFOHEAD(fd,11); - WFIFOW(fd,0) = 0x384c; - WFIFOL(fd,2) = char_id; - WFIFOL(fd,6) = mail_id; - WFIFOB(fd,10) = (new_mail == 0); - WFIFOSET(fd,11); -} - -static void mapif_parse_Mail_return(int fd) -{ - mapif_Mail_return(fd, RFIFOL(fd,2), RFIFOL(fd,6)); + mapif->mail_return(fd, char_id, mail_id, new_mail); } /*========================================== * Send Mail *------------------------------------------*/ -static void mapif_Mail_send(int fd, struct mail_message* msg) +void mapif_mail_send(int fd, struct mail_message* msg) { int len = sizeof(struct mail_message) + 4; @@ -401,7 +413,7 @@ static void mapif_Mail_send(int fd, struct mail_message* msg) WFIFOSET(fd,len); } -static void mapif_parse_Mail_send(int fd) +void mapif_parse_mail_send(int fd) { struct mail_message msg; char esc_name[NAME_LENGTH*2+1]; @@ -414,31 +426,31 @@ static void mapif_parse_Mail_send(int fd) memcpy(&msg, RFIFOP(fd,8), sizeof(struct mail_message)); // Try to find the Dest Char by Name - SQL->EscapeStringLen(sql_handle, esc_name, msg.dest_name, strnlen(msg.dest_name, NAME_LENGTH)); - if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`, `char_id` FROM `%s` WHERE `name` = '%s'", char_db, esc_name) ) - Sql_ShowDebug(sql_handle); + SQL->EscapeStringLen(inter->sql_handle, esc_name, msg.dest_name, strnlen(msg.dest_name, NAME_LENGTH)); + if ( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`, `char_id` FROM `%s` WHERE `name` = '%s'", char_db, esc_name) ) + Sql_ShowDebug(inter->sql_handle); else - if ( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char *data; - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); if (atoi(data) != account_id) { // Cannot send mail to char in the same account - SQL->GetData(sql_handle, 1, &data, NULL); + SQL->GetData(inter->sql_handle, 1, &data, NULL); msg.dest_id = atoi(data); } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); msg.status = MAIL_NEW; if( msg.dest_id > 0 ) - msg.id = mail_savemessage(&msg); + msg.id = inter_mail->savemessage(&msg); - mapif_Mail_send(fd, &msg); // notify sender - mapif_Mail_new(&msg); // notify recipient + mapif->mail_send(fd, &msg); // notify sender + mapif->mail_new(&msg); // notify recipient } -void mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item) +void inter_mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item) { struct mail_message msg; memset(&msg, 0, sizeof(struct mail_message)); @@ -455,8 +467,8 @@ void mail_sendmail(int send_id, const char* send_name, int dest_id, const char* msg.timestamp = time(NULL); - mail_savemessage(&msg); - mapif_Mail_new(&msg); + inter_mail->savemessage(&msg); + mapif->mail_new(&msg); } /*========================================== @@ -466,12 +478,12 @@ int inter_mail_parse_frommap(int fd) { switch(RFIFOW(fd,0)) { - case 0x3048: mapif_parse_Mail_requestinbox(fd); break; - case 0x3049: mapif_parse_Mail_read(fd); break; - case 0x304a: mapif_parse_Mail_getattach(fd); break; - case 0x304b: mapif_parse_Mail_delete(fd); break; - case 0x304c: mapif_parse_Mail_return(fd); break; - case 0x304d: mapif_parse_Mail_send(fd); break; + case 0x3048: mapif->parse_mail_requestinbox(fd); break; + case 0x3049: mapif->parse_mail_read(fd); break; + case 0x304a: mapif->parse_mail_getattach(fd); break; + case 0x304b: mapif->parse_mail_delete(fd); break; + case 0x304c: mapif->parse_mail_return(fd); break; + case 0x304d: mapif->parse_mail_send(fd); break; default: return 0; } @@ -487,3 +499,17 @@ void inter_mail_sql_final(void) { return; } + +void inter_mail_defaults(void) +{ + inter_mail = &inter_mail_s; + + inter_mail->savemessage = inter_mail_savemessage; + inter_mail->DeleteAttach = inter_mail_DeleteAttach; + inter_mail->sendmail = inter_mail_sendmail; + inter_mail->parse_frommap = inter_mail_parse_frommap; + inter_mail->sql_init = inter_mail_sql_init; + inter_mail->sql_final = inter_mail_sql_final; + inter_mail->fromsql = inter_mail_fromsql; + inter_mail->loadmessage = inter_mail_loadmessage; +} diff --git a/src/char/int_mail.h b/src/char/int_mail.h index 8800061d7..b69b27079 100644 --- a/src/char/int_mail.h +++ b/src/char/int_mail.h @@ -4,16 +4,28 @@ #ifndef CHAR_INT_MAIL_H #define CHAR_INT_MAIL_H +#include "../common/cbasetypes.h" + struct item; +struct mail_data; struct mail_message; -int inter_mail_parse_frommap(int fd); -void mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +void inter_mail_defaults(void); -int inter_mail_sql_init(void); -void inter_mail_sql_final(void); +/** + * inter_mail interface + **/ +struct inter_mail_interface { + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); + int (*fromsql) (int char_id, struct mail_data* md); + int (*savemessage) (struct mail_message* msg); + bool (*loadmessage) (int mail_id, struct mail_message* msg); + bool (*DeleteAttach) (int mail_id); + void (*sendmail) (int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); +}; -int mail_savemessage(struct mail_message* msg); -void mapif_Mail_new(struct mail_message *msg); +struct inter_mail_interface *inter_mail; #endif /* CHAR_INT_MAIL_H */ diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c index 1dffb656c..0e91b6785 100644 --- a/src/char/int_mercenary.c +++ b/src/char/int_mercenary.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" @@ -20,53 +21,55 @@ #include "../common/strlib.h" #include "../common/utils.h" -bool mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) +struct inter_mercenary_interface inter_mercenary_s; + +bool inter_mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) { char* data; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith` FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith` FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return false; } - SQL->GetData(sql_handle, 0, &data, NULL); status->mer_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); status->arch_calls = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); status->arch_faith = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); status->spear_calls = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); status->spear_faith = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); status->sword_calls = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); status->sword_faith = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 0, &data, NULL); status->mer_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); status->arch_calls = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); status->arch_faith = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); status->spear_calls = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); status->spear_faith = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); status->sword_calls = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); status->sword_faith = atoi(data); + SQL->FreeResult(inter->sql_handle); return true; } -bool mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) +bool inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`char_id`, `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`char_id`, `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", mercenary_owner_db, char_id, status->mer_id, status->arch_calls, status->arch_faith, status->spear_calls, status->spear_faith, status->sword_calls, status->sword_faith) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } return true; } -bool mercenary_owner_delete(int char_id) +bool inter_mercenary_owner_delete(int char_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); return true; } @@ -77,21 +80,21 @@ bool mapif_mercenary_save(struct s_mercenary* merc) if( merc->mercenary_id == 0 ) { // Create new DB entry - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`char_id`,`class`,`hp`,`sp`,`kill_counter`,`life_time`) VALUES ('%d','%d','%d','%d','%u','%u')", mercenary_db, merc->char_id, merc->class_, merc->hp, merc->sp, merc->kill_count, merc->life_time) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } else - merc->mercenary_id = (int)SQL->LastInsertId(sql_handle); + merc->mercenary_id = (int)SQL->LastInsertId(inter->sql_handle); } - else if( SQL_ERROR == SQL->Query(sql_handle, + else if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `hp` = '%d', `sp` = '%d', `kill_counter` = '%u', `life_time` = '%u' WHERE `mer_id` = '%d'", mercenary_db, merc->char_id, merc->class_, merc->hp, merc->sp, merc->kill_count, merc->life_time, merc->mercenary_id) ) { // Update DB entry - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } @@ -106,24 +109,24 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) merc->mercenary_id = merc_id; merc->char_id = char_id; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `class`, `hp`, `sp`, `kill_counter`, `life_time` FROM `%s` WHERE `mer_id` = '%d' AND `char_id` = '%d'", mercenary_db, merc_id, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `class`, `hp`, `sp`, `kill_counter`, `life_time` FROM `%s` WHERE `mer_id` = '%d' AND `char_id` = '%d'", mercenary_db, merc_id, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return false; } - SQL->GetData(sql_handle, 0, &data, NULL); merc->class_ = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); merc->hp = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); merc->sp = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); merc->kill_count = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); merc->life_time = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 0, &data, NULL); merc->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); merc->hp = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); merc->sp = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); merc->kill_count = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); merc->life_time = atoi(data); + SQL->FreeResult(inter->sql_handle); if( save_log ) ShowInfo("Mercenary loaded (%d - %d).\n", merc->mercenary_id, merc->char_id); @@ -132,16 +135,16 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) bool mapif_mercenary_delete(int merc_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", mercenary_db, merc_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", mercenary_db, merc_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } return true; } -static void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) +void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) { int size = sizeof(struct s_mercenary) + 5; @@ -153,20 +156,20 @@ static void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char WFIFOSET(fd,size); } -static void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc) +void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc) { - bool result = mapif_mercenary_save(merc); - mapif_mercenary_send(fd, merc, result); + bool result = mapif->mercenary_save(merc); + mapif->mercenary_send(fd, merc, result); } -static void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) +void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) { struct s_mercenary merc; - bool result = mapif_mercenary_load(merc_id, char_id, &merc); - mapif_mercenary_send(fd, &merc, result); + bool result = mapif->mercenary_load(merc_id, char_id, &merc); + mapif->mercenary_send(fd, &merc, result); } -static void mapif_mercenary_deleted(int fd, unsigned char flag) +void mapif_mercenary_deleted(int fd, unsigned char flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x3871; @@ -174,13 +177,13 @@ static void mapif_mercenary_deleted(int fd, unsigned char flag) WFIFOSET(fd,3); } -static void mapif_parse_mercenary_delete(int fd, int merc_id) +void mapif_parse_mercenary_delete(int fd, int merc_id) { - bool result = mapif_mercenary_delete(merc_id); - mapif_mercenary_deleted(fd, result); + bool result = mapif->mercenary_delete(merc_id); + mapif->mercenary_deleted(fd, result); } -static void mapif_mercenary_saved(int fd, unsigned char flag) +void mapif_mercenary_saved(int fd, unsigned char flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x3872; @@ -188,10 +191,10 @@ static void mapif_mercenary_saved(int fd, unsigned char flag) WFIFOSET(fd,3); } -static void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc) +void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc) { - bool result = mapif_mercenary_save(merc); - mapif_mercenary_saved(fd, result); + bool result = mapif->mercenary_save(merc); + mapif->mercenary_saved(fd, result); } int inter_mercenary_sql_init(void) @@ -212,12 +215,25 @@ int inter_mercenary_parse_frommap(int fd) switch( cmd ) { - case 0x3070: mapif_parse_mercenary_create(fd, (struct s_mercenary*)RFIFOP(fd,4)); break; - case 0x3071: mapif_parse_mercenary_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; - case 0x3072: mapif_parse_mercenary_delete(fd, (int)RFIFOL(fd,2)); break; - case 0x3073: mapif_parse_mercenary_save(fd, (struct s_mercenary*)RFIFOP(fd,4)); break; + case 0x3070: mapif->parse_mercenary_create(fd, (struct s_mercenary*)RFIFOP(fd,4)); break; + case 0x3071: mapif->parse_mercenary_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; + case 0x3072: mapif->parse_mercenary_delete(fd, (int)RFIFOL(fd,2)); break; + case 0x3073: mapif->parse_mercenary_save(fd, (struct s_mercenary*)RFIFOP(fd,4)); break; default: return 0; } return 1; } + +void inter_mercenary_defaults(void) +{ + inter_mercenary = &inter_mercenary_s; + + inter_mercenary->owner_fromsql = inter_mercenary_owner_fromsql; + inter_mercenary->owner_tosql = inter_mercenary_owner_tosql; + inter_mercenary->owner_delete = inter_mercenary_owner_delete; + + inter_mercenary->sql_init = inter_mercenary_sql_init; + inter_mercenary->sql_final = inter_mercenary_sql_final; + inter_mercenary->parse_frommap = inter_mercenary_parse_frommap; +} diff --git a/src/char/int_mercenary.h b/src/char/int_mercenary.h index b03c20de3..900065cb7 100644 --- a/src/char/int_mercenary.h +++ b/src/char/int_mercenary.h @@ -8,15 +8,20 @@ struct mmo_charstatus; -int inter_mercenary_sql_init(void); -void inter_mercenary_sql_final(void); -int inter_mercenary_parse_frommap(int fd); +void inter_mercenary_defaults(void); -// Mercenary Owner Database -bool mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status); -bool mercenary_owner_tosql(int char_id, struct mmo_charstatus *status); -bool mercenary_owner_delete(int char_id); +/** + * inter_mercenary interface + **/ +struct inter_mercenary_interface { + bool (*owner_fromsql) (int char_id, struct mmo_charstatus *status); + bool (*owner_tosql) (int char_id, struct mmo_charstatus *status); + bool (*owner_delete) (int char_id); + int (*sql_init) (void); + void (*sql_final) (void); + int (*parse_frommap) (int fd); +}; -bool mapif_mercenary_delete(int merc_id); +struct inter_mercenary_interface *inter_mercenary; #endif /* CHAR_INT_MERCENARY_H */ diff --git a/src/char/int_party.c b/src/char/int_party.c index a8722fbe3..49873feff 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/cbasetypes.h" #include "../common/db.h" #include "../common/malloc.h" @@ -22,24 +23,10 @@ #include "../common/sql.h" #include "../common/strlib.h" -struct party_data { - struct party party; - unsigned int min_lv, max_lv; - int family; //Is this party a family? if so, this holds the child id. - unsigned char size; //Total size of party. -}; - -static struct party_data *party_pt; -static DBMap* party_db_; // int party_id -> struct party_data* - -int mapif_party_broken(int party_id,int flag); -int party_check_empty(struct party_data *p); -int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id); -int party_check_exp_share(struct party_data *p); -int mapif_party_optionchanged(int fd,struct party *p, int account_id, int flag); +struct inter_party_interface inter_party_s; //Updates party's level range and unsets even share if broken. -static int int_party_check_lv(struct party_data *p) { +static int inter_party_check_lv(struct party_data *p) { int i; unsigned int lv; p->min_lv = UINT_MAX; @@ -56,15 +43,15 @@ static int int_party_check_lv(struct party_data *p) { if (lv > p->max_lv) p->max_lv = lv; } - if (p->party.exp && !party_check_exp_share(p)) { + if (p->party.exp && !inter_party->check_exp_share(p)) { p->party.exp = 0; - mapif_party_optionchanged(0, &p->party, 0, 0); + mapif->party_optionchanged(0, &p->party, 0, 0); return 0; } return 1; } //Calculates the state of a party. -static void int_party_calc_state(struct party_data *p) +static void inter_party_calc_state(struct party_data *p) { int i; unsigned int lv; @@ -81,7 +68,7 @@ static void int_party_calc_state(struct party_data *p) if(p->party.member[i].online) p->party.count++; } - if( p->size == 2 && ( char_child(p->party.member[0].char_id,p->party.member[1].char_id) || char_child(p->party.member[1].char_id,p->party.member[0].char_id) ) ) { + if( p->size == 2 && ( chr->char_child(p->party.member[0].char_id,p->party.member[1].char_id) || chr->char_child(p->party.member[1].char_id,p->party.member[0].char_id) ) ) { //Child should be able to share with either of their parents [RoM] if(p->party.member[0].class_&0x2000) //first slot is the child? p->family = p->party.member[0].char_id; @@ -89,7 +76,7 @@ static void int_party_calc_state(struct party_data *p) p->family = p->party.member[1].char_id; } else if( p->size == 3 ) { //Check Family State. - p->family = char_family( + p->family = chr->char_family( p->party.member[0].char_id, p->party.member[1].char_id, p->party.member[2].char_id @@ -108,9 +95,9 @@ static void int_party_calc_state(struct party_data *p) } } - if (p->party.exp && !party_check_exp_share(p)) { + if (p->party.exp && !inter_party->check_exp_share(p)) { p->party.exp = 0; //Set off even share. - mapif_party_optionchanged(0, &p->party, 0, 0); + mapif->party_optionchanged(0, &p->party, 0, 0); } return; } @@ -129,59 +116,59 @@ int inter_party_tosql(struct party *p, int flag, int index) #ifdef NOISY ShowInfo("Save party request ("CL_BOLD"%d"CL_RESET" - %s).\n", party_id, p->name); #endif - SQL->EscapeStringLen(sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH)); if( flag & PS_BREAK ) {// Break the party // we'll skip name-checking and just reset everyone with the same party id [celest] - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d'", char_db, party_id) ) - Sql_ShowDebug(sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `party_id`='%d'", party_db, party_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d'", char_db, party_id) ) + Sql_ShowDebug(inter->sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `party_id`='%d'", party_db, party_id) ) + Sql_ShowDebug(inter->sql_handle); //Remove from memory - idb_remove(party_db_, party_id); + idb_remove(inter_party->db, party_id); return 1; } if( flag & PS_CREATE ) {// Create party - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` " "(`name`, `exp`, `item`, `leader_id`, `leader_char`) " "VALUES ('%s', '%d', '%d', '%d', '%d')", party_db, esc_name, p->exp, p->item, p->member[index].account_id, p->member[index].char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - party_id = p->party_id = (int)SQL->LastInsertId(sql_handle); + party_id = p->party_id = (int)SQL->LastInsertId(inter->sql_handle); } if( flag & PS_BASIC ) {// Update party info. - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `name`='%s', `exp`='%d', `item`='%d' WHERE `party_id`='%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `name`='%s', `exp`='%d', `item`='%d' WHERE `party_id`='%d'", party_db, esc_name, p->exp, p->item, party_id) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } if( flag & PS_LEADER ) {// Update leader - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `leader_id`='%d', `leader_char`='%d' WHERE `party_id`='%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `leader_id`='%d', `leader_char`='%d' WHERE `party_id`='%d'", party_db, p->member[index].account_id, p->member[index].char_id, party_id) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } if( flag & PS_ADDMEMBER ) {// Add one party member. - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `party_id`='%d' WHERE `account_id`='%d' AND `char_id`='%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `party_id`='%d' WHERE `account_id`='%d' AND `char_id`='%d'", char_db, party_id, p->member[index].account_id, p->member[index].char_id) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } if( flag & PS_DELMEMBER ) {// Remove one party member. - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `account_id`='%d' AND `char_id`='%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `account_id`='%d' AND `char_id`='%d'", char_db, party_id, p->member[index].account_id, p->member[index].char_id) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); } if( save_log ) @@ -207,122 +194,122 @@ struct party_data *inter_party_fromsql(int party_id) return NULL; //Load from memory - p = (struct party_data*)idb_get(party_db_, party_id); + p = (struct party_data*)idb_get(inter_party->db, party_id); if( p != NULL ) return p; - p = party_pt; + p = inter_party->pt; memset(p, 0, sizeof(struct party_data)); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `party_id`, `name`,`exp`,`item`, `leader_id`, `leader_char` FROM `%s` WHERE `party_id`='%d'", party_db, party_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `party_id`, `name`,`exp`,`item`, `leader_id`, `leader_char` FROM `%s` WHERE `party_id`='%d'", party_db, party_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return NULL; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) return NULL; p->party.party_id = party_id; - SQL->GetData(sql_handle, 1, &data, &len); memcpy(p->party.name, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 2, &data, NULL); p->party.exp = (atoi(data) ? 1 : 0); - SQL->GetData(sql_handle, 3, &data, NULL); p->party.item = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); leader_id = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); leader_char = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 1, &data, &len); memcpy(p->party.name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 2, &data, NULL); p->party.exp = (atoi(data) ? 1 : 0); + SQL->GetData(inter->sql_handle, 3, &data, NULL); p->party.item = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); leader_id = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); leader_char = atoi(data); + SQL->FreeResult(inter->sql_handle); // Load members - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`char_id`,`name`,`base_level`,`last_map`,`online`,`class` FROM `%s` WHERE `party_id`='%d'", char_db, party_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`char_id`,`name`,`base_level`,`last_map`,`online`,`class` FROM `%s` WHERE `party_id`='%d'", char_db, party_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return NULL; } - for( i = 0; i < MAX_PARTY && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + for( i = 0; i < MAX_PARTY && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { m = &p->party.member[i]; - SQL->GetData(sql_handle, 0, &data, NULL); m->account_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); m->char_id = atoi(data); - SQL->GetData(sql_handle, 2, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 3, &data, NULL); m->lv = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); m->map = mapindex->name2id(data); - SQL->GetData(sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0); - SQL->GetData(sql_handle, 6, &data, NULL); m->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); m->account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); m->char_id = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 3, &data, NULL); m->lv = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); m->map = mapindex->name2id(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0); + SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class_ = atoi(data); m->leader = (m->account_id == leader_id && m->char_id == leader_char ? 1 : 0); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); if( save_log ) ShowInfo("Party loaded (%d - %s).\n", party_id, p->party.name); //Add party to memory. CREATE(p, struct party_data, 1); - memcpy(p, party_pt, sizeof(struct party_data)); + memcpy(p, inter_party->pt, sizeof(struct party_data)); //init state - int_party_calc_state(p); - idb_put(party_db_, party_id, p); + inter_party->calc_state(p); + idb_put(inter_party->db, party_id, p); return p; } int inter_party_sql_init(void) { //memory alloc - party_db_ = idb_alloc(DB_OPT_RELEASE_DATA); - party_pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1); - if (!party_pt) { - ShowFatalError("inter_party_sql_init: Out of Memory!\n"); + inter_party->db = idb_alloc(DB_OPT_RELEASE_DATA); + inter_party->pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1); + if (!inter_party->pt) { + ShowFatalError("inter_party->sql_init: Out of Memory!\n"); exit(EXIT_FAILURE); } /* Uncomment the following if you want to do a party_db cleanup (remove parties with no members) on startup.[Skotlex] ShowStatus("cleaning party table...\n"); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` USING `%s` LEFT JOIN `%s` ON `%s`.leader_id =`%s`.account_id AND `%s`.leader_char = `%s`.char_id WHERE `%s`.account_id IS NULL", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` LEFT JOIN `%s` ON `%s`.leader_id =`%s`.account_id AND `%s`.leader_char = `%s`.char_id WHERE `%s`.account_id IS NULL", party_db, party_db, char_db, party_db, char_db, party_db, char_db, char_db) ) - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); */ return 0; } void inter_party_sql_final(void) { - party_db_->destroy(party_db_, NULL); - aFree(party_pt); + inter_party->db->destroy(inter_party->db, NULL); + aFree(inter_party->pt); return; } // Search for the party according to its name -struct party_data* search_partyname(char* str) +struct party_data* inter_party_search_partyname(const char *const str) { char esc_name[NAME_LENGTH*2+1]; char* data; struct party_data* p = NULL; - SQL->EscapeStringLen(sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH)); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `party_id` FROM `%s` WHERE `name`='%s'", party_db, esc_name) ) - Sql_ShowDebug(sql_handle); - else if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) { - SQL->GetData(sql_handle, 0, &data, NULL); - p = inter_party_fromsql(atoi(data)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH)); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `party_id` FROM `%s` WHERE `name`='%s'", party_db, esc_name) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { + SQL->GetData(inter->sql_handle, 0, &data, NULL); + p = inter_party->fromsql(atoi(data)); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return p; } // Returns whether this party can keep having exp share or not. -int party_check_exp_share(struct party_data *p) +int inter_party_check_exp_share(struct party_data *const p) { return (p->party.count < 2 || p->max_lv - p->min_lv <= party_share_level); } // Is there any member in the party? -int party_check_empty(struct party_data *p) +int inter_party_check_empty(struct party_data *p) { int i; if (p==NULL||p->party.party_id==0) return 1; for(i=0;i<MAX_PARTY && !p->party.member[i].account_id;i++); if (i < MAX_PARTY) return 0; // If there is no member, then break the party - mapif_party_broken(p->party.party_id,0); - inter_party_tosql(&p->party, PS_BREAK, 0); + mapif->party_broken(p->party.party_id,0); + inter_party->tosql(&p->party, PS_BREAK, 0); return 1; } @@ -331,7 +318,7 @@ int party_check_empty(struct party_data *p) // Create a party whether or not -int mapif_party_created(int fd,int account_id,int char_id,struct party *p) +int mapif_party_created(int fd, int account_id, int char_id, struct party *p) { WFIFOHEAD(fd, 39); WFIFOW(fd,0)=0x3820; @@ -353,7 +340,7 @@ int mapif_party_created(int fd,int account_id,int char_id,struct party *p) } //Party information not found -static void mapif_party_noinfo(int fd, int party_id, int char_id) +void mapif_party_noinfo(int fd, int party_id, int char_id) { WFIFOHEAD(fd, 12); WFIFOW(fd,0) = 0x3821; @@ -365,7 +352,7 @@ static void mapif_party_noinfo(int fd, int party_id, int char_id) } //Digest party information -static void mapif_party_info(int fd, struct party* p, int char_id) +void mapif_party_info(int fd, struct party* p, int char_id) { unsigned char buf[8 + sizeof(struct party)]; WBUFW(buf,0) = 0x3821; @@ -374,9 +361,9 @@ static void mapif_party_info(int fd, struct party* p, int char_id) memcpy(WBUFP(buf,8), p, sizeof(struct party)); if(fd<0) - mapif_sendall(buf,WBUFW(buf,2)); + mapif->sendall(buf,WBUFW(buf,2)); else - mapif_send(fd,buf,WBUFW(buf,2)); + mapif->send(fd,buf,WBUFW(buf,2)); } //Whether or not additional party members @@ -393,7 +380,7 @@ int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, i } // Party setting change notification -int mapif_party_optionchanged(int fd,struct party *p,int account_id,int flag) +int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag) { unsigned char buf[16]; WBUFW(buf,0)=0x3823; @@ -403,9 +390,9 @@ int mapif_party_optionchanged(int fd,struct party *p,int account_id,int flag) WBUFW(buf,12)=p->item; WBUFB(buf,14)=flag; if(flag==0) - mapif_sendall(buf,15); + mapif->sendall(buf,15); else - mapif_send(fd,buf,15); + mapif->send(fd,buf,15); return 0; } @@ -417,12 +404,12 @@ int mapif_party_withdraw(int party_id,int account_id, int char_id) { WBUFL(buf,2) = party_id; WBUFL(buf,6) = account_id; WBUFL(buf,10) = char_id; - mapif_sendall(buf, 14); + mapif->sendall(buf, 14); return 0; } //Party map update notification -int mapif_party_membermoved(struct party *p,int idx) +int mapif_party_membermoved(struct party *p, int idx) { unsigned char buf[20]; @@ -433,24 +420,24 @@ int mapif_party_membermoved(struct party *p,int idx) WBUFW(buf,14) = p->member[idx].map; WBUFB(buf,16) = p->member[idx].online; WBUFW(buf,17) = p->member[idx].lv; - mapif_sendall(buf, 19); + mapif->sendall(buf, 19); return 0; } //Dissolution party notification -int mapif_party_broken(int party_id,int flag) +int mapif_party_broken(int party_id, int flag) { unsigned char buf[16]; WBUFW(buf,0)=0x3826; WBUFL(buf,2)=party_id; WBUFB(buf,6)=flag; - mapif_sendall(buf,7); + mapif->sendall(buf,7); //printf("int_party: broken %d\n",party_id); return 0; } //Remarks in the party -int mapif_party_message(int party_id,int account_id,char *mes,int len, int sfd) +int mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd) { unsigned char buf[512]; WBUFW(buf,0)=0x3827; @@ -458,7 +445,7 @@ int mapif_party_message(int party_id,int account_id,char *mes,int len, int sfd) WBUFL(buf,4)=party_id; WBUFL(buf,8)=account_id; memcpy(WBUFP(buf,12),mes,len); - mapif_sendallwos(sfd, buf,len+12); + mapif->sendallwos(sfd, buf,len+12); return 0; } @@ -471,8 +458,8 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part { struct party_data *p; int i; - if( (p=search_partyname(name))!=NULL){ - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + if( (p=inter_party->search_partyname(name))!=NULL){ + mapif->party_created(fd,leader->account_id,leader->char_id,NULL); return 0; } // Check Authorized letters/symbols in the name of the character @@ -481,16 +468,16 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part if (strchr(char_name_letters, name[i]) == NULL) { if( name[i] == '"' ) { /* client-special-char */ normalize_name(name,"\""); - mapif_parse_CreateParty(fd,name,item,item2,leader); + mapif->parse_CreateParty(fd,name,item,item2,leader); return 0; } - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + mapif->party_created(fd,leader->account_id,leader->char_id,NULL); return 0; } } else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden for (i = 0; i < NAME_LENGTH && name[i]; i++) if (strchr(char_name_letters, name[i]) != NULL) { - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + mapif->party_created(fd,leader->account_id,leader->char_id,NULL); return 0; } } @@ -506,30 +493,30 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part p->party.member[0].online=1; p->party.party_id=-1;//New party. - if (inter_party_tosql(&p->party,PS_CREATE|PS_ADDMEMBER,0)) { + if (inter_party->tosql(&p->party,PS_CREATE|PS_ADDMEMBER,0)) { //Add party to db - int_party_calc_state(p); - idb_put(party_db_, p->party.party_id, p); - mapif_party_info(fd, &p->party, 0); - mapif_party_created(fd,leader->account_id,leader->char_id,&p->party); + inter_party->calc_state(p); + idb_put(inter_party->db, p->party.party_id, p); + mapif->party_info(fd, &p->party, 0); + mapif->party_created(fd,leader->account_id,leader->char_id,&p->party); } else { //Failed to create party. aFree(p); - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + mapif->party_created(fd,leader->account_id,leader->char_id,NULL); } return 0; } // Party information request -static void mapif_parse_PartyInfo(int fd, int party_id, int char_id) +void mapif_parse_PartyInfo(int fd, int party_id, int char_id) { struct party_data *p; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if (p) - mapif_party_info(fd, &p->party, char_id); + mapif->party_info(fd, &p->party, char_id); else - mapif_party_noinfo(fd, party_id, char_id); + mapif->party_noinfo(fd, party_id, char_id); } // Add a player to party request @@ -538,16 +525,16 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member struct party_data *p; int i; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if( p == NULL || p->size == MAX_PARTY ) { - mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1); + mapif->party_memberadded(fd, party_id, member->account_id, member->char_id, 1); return 0; } ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == 0 ); if( i == MAX_PARTY ) {// Party full - mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1); + mapif->party_memberadded(fd, party_id, member->account_id, member->char_id, 1); return 0; } @@ -556,16 +543,16 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member if (p->party.member[i].online) p->party.count++; p->size++; if (p->size == 2 || p->size == 3) // Check family state. And also accept either of their Parents. [RoM] - int_party_calc_state(p); + inter_party->calc_state(p); else //Check even share range. if (member->lv < p->min_lv || member->lv > p->max_lv || p->family) { if (p->family) p->family = 0; //Family state broken. - int_party_check_lv(p); + inter_party->check_lv(p); } - mapif_party_info(-1, &p->party, 0); - mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 0); - inter_party_tosql(&p->party, PS_ADDMEMBER, i); + mapif->party_info(-1, &p->party, 0); + mapif->party_memberadded(fd, party_id, member->account_id, member->char_id, 0); + inter_party->tosql(&p->party, PS_ADDMEMBER, i); return 0; } @@ -575,19 +562,19 @@ int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int { struct party_data *p; int flag = 0; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if(!p) return 0; p->party.exp=exp; - if( exp && !party_check_exp_share(p) ){ + if( exp && !inter_party->check_exp_share(p) ){ flag|=0x01; p->party.exp=0; } p->party.item = item&0x3; //Filter out invalid values. - mapif_party_optionchanged(fd,&p->party,account_id,flag); - inter_party_tosql(&p->party, PS_BASIC, 0); + mapif->party_optionchanged(fd,&p->party,account_id,flag); + inter_party->tosql(&p->party, PS_BASIC, 0); return 0; } @@ -597,11 +584,11 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) struct party_data *p; int i,j=-1; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if( p == NULL ) {// Party does not exists? - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d'", char_db, party_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d'", char_db, party_id) ) + Sql_ShowDebug(inter->sql_handle); return 0; } @@ -614,19 +601,19 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) if (i >= MAX_PARTY) return 0; //Member not found? - mapif_party_withdraw(party_id, account_id, char_id); + mapif->party_withdraw(party_id, account_id, char_id); if (p->party.member[i].leader){ p->party.member[i].account_id = 0; for (j = 0; j < MAX_PARTY; j++) { if (!p->party.member[j].account_id) continue; - mapif_party_withdraw(party_id, p->party.member[j].account_id, p->party.member[j].char_id); + mapif->party_withdraw(party_id, p->party.member[j].account_id, p->party.member[j].char_id); p->party.member[j].account_id = 0; } //Party gets deleted on the check_empty call below. } else { - inter_party_tosql(&p->party,PS_DELMEMBER,i); + inter_party->tosql(&p->party,PS_DELMEMBER,i); j = p->party.member[i].lv; if(p->party.member[i].online) p->party.count--; memset(&p->party.member[i], 0, sizeof(struct party_member)); @@ -634,12 +621,12 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) if (j == p->min_lv || j == p->max_lv || p->family) { if(p->family) p->family = 0; //Family state broken. - int_party_check_lv(p); + inter_party->check_lv(p); } } - if (party_check_empty(p) == 0) - mapif_party_info(-1, &p->party, 0); + if (inter_party->check_empty(p) == 0) + mapif->party_info(-1, &p->party, 0); return 0; } // When member goes to other map or levels up. @@ -648,7 +635,7 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id struct party_data *p; int i; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if (p == NULL) return 0; @@ -674,10 +661,10 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id ) { p->party.member[i].lv = lv; - int_party_check_lv(p); + inter_party->check_lv(p); } //Send online/offline update. - mapif_party_membermoved(&p->party, i); + mapif->party_membermoved(&p->party, i); } if (p->party.member[i].lv != lv) { @@ -685,7 +672,7 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id p->party.member[i].lv == p->max_lv) { p->party.member[i].lv = lv; - int_party_check_lv(p); + inter_party->check_lv(p); } else p->party.member[i].lv = lv; //There is no need to send level update to map servers @@ -694,37 +681,37 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id if (p->party.member[i].map != map) { p->party.member[i].map = map; - mapif_party_membermoved(&p->party, i); + mapif->party_membermoved(&p->party, i); } return 0; } //Request party dissolution -int mapif_parse_BreakParty(int fd,int party_id) +int mapif_parse_BreakParty(int fd, int party_id) { struct party_data *p; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if(!p) return 0; - inter_party_tosql(&p->party,PS_BREAK,0); - mapif_party_broken(fd,party_id); + inter_party->tosql(&p->party,PS_BREAK,0); + mapif->party_broken(fd,party_id); return 0; } //Party sending the message -int mapif_parse_PartyMessage(int fd,int party_id,int account_id,char *mes,int len) +int mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len) { - return mapif_party_message(party_id,account_id,mes,len, fd); + return mapif->party_message(party_id,account_id,mes,len, fd); } -int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id) +int mapif_parse_PartyLeaderChange(int fd, int party_id, int account_id, int char_id) { struct party_data *p; int i; - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if(!p) return 0; @@ -737,7 +724,7 @@ int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id p->party.member[i].char_id == char_id) { p->party.member[i].leader = 1; - inter_party_tosql(&p->party,PS_LEADER, i); + inter_party->tosql(&p->party,PS_LEADER, i); } } return 1; @@ -755,15 +742,15 @@ int inter_party_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { - case 0x3020: mapif_parse_CreateParty(fd, (char*)RFIFOP(fd,4), RFIFOB(fd,28), RFIFOB(fd,29), (struct party_member*)RFIFOP(fd,30)); break; - case 0x3021: mapif_parse_PartyInfo(fd, RFIFOL(fd,2), RFIFOL(fd,6)); break; - case 0x3022: mapif_parse_PartyAddMember(fd, RFIFOL(fd,4), (struct party_member*)RFIFOP(fd,8)); break; - case 0x3023: mapif_parse_PartyChangeOption(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOW(fd,10), RFIFOW(fd,12)); break; - case 0x3024: mapif_parse_PartyLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; - case 0x3025: mapif_parse_PartyChangeMap(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOW(fd,14), RFIFOB(fd,16), RFIFOW(fd,17)); break; - case 0x3026: mapif_parse_BreakParty(fd, RFIFOL(fd,2)); break; - case 0x3027: mapif_parse_PartyMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), (char*)RFIFOP(fd,12), RFIFOW(fd,2)-12); break; - case 0x3029: mapif_parse_PartyLeaderChange(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; + case 0x3020: mapif->parse_CreateParty(fd, (char*)RFIFOP(fd,4), RFIFOB(fd,28), RFIFOB(fd,29), (struct party_member*)RFIFOP(fd,30)); break; + case 0x3021: mapif->parse_PartyInfo(fd, RFIFOL(fd,2), RFIFOL(fd,6)); break; + case 0x3022: mapif->parse_PartyAddMember(fd, RFIFOL(fd,4), (struct party_member*)RFIFOP(fd,8)); break; + case 0x3023: mapif->parse_PartyChangeOption(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOW(fd,10), RFIFOW(fd,12)); break; + case 0x3024: mapif->parse_PartyLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; + case 0x3025: mapif->parse_PartyChangeMap(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOW(fd,14), RFIFOB(fd,16), RFIFOW(fd,17)); break; + case 0x3026: mapif->parse_BreakParty(fd, RFIFOL(fd,2)); break; + case 0x3027: mapif->parse_PartyMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), (char*)RFIFOP(fd,12), RFIFOW(fd,2)-12); break; + case 0x3029: mapif->parse_PartyLeaderChange(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; default: return 0; } @@ -773,7 +760,7 @@ int inter_party_parse_frommap(int fd) //Leave request from the server (for delete character) int inter_party_leave(int party_id,int account_id, int char_id) { - return mapif_parse_PartyLeave(-1,party_id,account_id, char_id); + return mapif->parse_PartyLeave(-1,party_id,account_id, char_id); } int inter_party_CharOnline(int char_id, int party_id) @@ -785,23 +772,23 @@ int inter_party_CharOnline(int char_id, int party_id) {// Get party_id from the database char* data; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT party_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT party_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) return 0; //Eh? No party? - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); party_id = atoi(data); - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } if (party_id == 0) return 0; //No party... - p = inter_party_fromsql(party_id); + p = inter_party->fromsql(party_id); if(!p) { ShowError("Character %d's party %d not found!\n", char_id, party_id); return 0; @@ -815,7 +802,7 @@ int inter_party_CharOnline(int char_id, int party_id) p->party.count++; if (p->party.member[i].lv < p->min_lv || p->party.member[i].lv > p->max_lv) - int_party_check_lv(p); + inter_party->check_lv(p); } break; } @@ -831,24 +818,24 @@ int inter_party_CharOffline(int char_id, int party_id) { {// Get guild_id from the database char* data; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT party_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT party_id FROM `%s` WHERE char_id='%d'", char_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) return 0; //Eh? No party? - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); party_id = atoi(data); - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } if (party_id == 0) return 0; //No party... //Character has a party, set character offline and check if they were the only member online - if ((p = inter_party_fromsql(party_id)) == NULL) + if ((p = inter_party->fromsql(party_id)) == NULL) return 0; //Set member offline @@ -859,13 +846,35 @@ int inter_party_CharOffline(int char_id, int party_id) { p->party.count--; if(p->party.member[i].lv == p->min_lv || p->party.member[i].lv == p->max_lv) - int_party_check_lv(p); + inter_party->check_lv(p); break; } } if(!p->party.count) //Parties don't have any data that needs be saved at this point... so just remove it from memory. - idb_remove(party_db_, party_id); + idb_remove(inter_party->db, party_id); return 1; } + +void inter_party_defaults(void) +{ + inter_party = &inter_party_s; + + inter_party->pt = NULL; + inter_party->db = NULL; + + inter_party->sql_init = inter_party_sql_init; + inter_party->sql_final = inter_party_sql_final; + inter_party->check_lv = inter_party_check_lv; + inter_party->calc_state = inter_party_calc_state; + inter_party->tosql = inter_party_tosql; + inter_party->fromsql = inter_party_fromsql; + inter_party->search_partyname = inter_party_search_partyname; + inter_party->check_exp_share = inter_party_check_exp_share; + inter_party->check_empty = inter_party_check_empty; + inter_party->parse_frommap = inter_party_parse_frommap; + inter_party->leave = inter_party_leave; + inter_party->CharOnline = inter_party_CharOnline; + inter_party->CharOffline = inter_party_CharOffline; +} diff --git a/src/char/int_party.h b/src/char/int_party.h index 2b24b1d1a..68fae32a8 100644 --- a/src/char/int_party.h +++ b/src/char/int_party.h @@ -4,6 +4,8 @@ #ifndef CHAR_INT_PARTY_H #define CHAR_INT_PARTY_H +#include "../common/mmo.h" + //Party Flags on what to save/delete. enum { PS_CREATE = 0x01, //Create a new party entry (index holds leader's info) @@ -14,11 +16,36 @@ enum { PS_BREAK = 0x20, //Specify that this party must be deleted. }; -int inter_party_parse_frommap(int fd); -int inter_party_sql_init(void); -void inter_party_sql_final(void); -int inter_party_leave(int party_id,int account_id, int char_id); -int inter_party_CharOnline(int char_id, int party_id); -int inter_party_CharOffline(int char_id, int party_id); +struct party_data { + struct party party; + unsigned int min_lv, max_lv; + int family; //Is this party a family? if so, this holds the child id. + unsigned char size; //Total size of party. +}; + +void inter_party_defaults(void); + +/** + * inter_party interface + **/ +struct inter_party_interface { + struct party_data *pt; + DBMap* db; // int party_id -> struct party_data* + int (*check_lv) (struct party_data *p); + void (*calc_state) (struct party_data *p); + int (*tosql) (struct party *p, int flag, int index); + struct party_data* (*fromsql) (int party_id); + int (*sql_init) (void); + void (*sql_final) (void); + struct party_data* (*search_partyname) (const char *str); + int (*check_exp_share) (struct party_data *p); + int (*check_empty) (struct party_data *p); + int (*parse_frommap) (int fd); + int (*leave) (int party_id,int account_id, int char_id); + int (*CharOnline) (int char_id, int party_id); + int (*CharOffline) (int char_id, int party_id); +}; + +struct inter_party_interface *inter_party; #endif /* CHAR_INT_PARTY_H */ diff --git a/src/char/int_pet.c b/src/char/int_pet.c index bf7961462..c68fe6476 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" @@ -20,7 +21,7 @@ #include "../common/strlib.h" #include "../common/utils.h" -struct s_pet *pet_pt; +struct inter_pet_interface inter_pet_s; //--------------------------------------------------------- int inter_pet_tosql(int pet_id, struct s_pet* p) @@ -28,30 +29,30 @@ int inter_pet_tosql(int pet_id, struct s_pet* p) //`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`) char esc_name[NAME_LENGTH*2+1];// escaped pet name - SQL->EscapeStringLen(sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH)); + SQL->EscapeStringLen(inter->sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH)); p->hungry = cap_value(p->hungry, 0, 100); p->intimate = cap_value(p->intimate, 0, 1000); if( pet_id == -1 ) {// New pet. - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` " "(`class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`) " "VALUES ('%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id, p->equip, p->intimate, p->hungry, p->rename_flag, p->incubate) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - p->pet_id = (int)SQL->LastInsertId(sql_handle); + p->pet_id = (int)SQL->LastInsertId(inter->sql_handle); } else {// Update pet. - if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incubate`='%d' WHERE `pet_id`='%d'", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incubate`='%d' WHERE `pet_id`='%d'", pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id, p->equip, p->intimate, p->hungry, p->rename_flag, p->incubate, p->pet_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } } @@ -73,28 +74,28 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p) //`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`) - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate` FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate` FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return 0; } - if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { p->pet_id = pet_id; - SQL->GetData(sql_handle, 1, &data, NULL); p->class_ = atoi(data); - SQL->GetData(sql_handle, 2, &data, &len); memcpy(p->name, data, min(len, NAME_LENGTH)); - SQL->GetData(sql_handle, 3, &data, NULL); p->account_id = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); p->char_id = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); p->level = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); p->egg_id = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); p->equip = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); p->intimate = atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); p->hungry = atoi(data); - SQL->GetData(sql_handle, 10, &data, NULL); p->rename_flag = atoi(data); - SQL->GetData(sql_handle, 11, &data, NULL); p->incubate = atoi(data); - - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 1, &data, NULL); p->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, &len); memcpy(p->name, data, min(len, NAME_LENGTH)); + SQL->GetData(inter->sql_handle, 3, &data, NULL); p->account_id = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); p->char_id = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); p->level = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); p->egg_id = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); p->equip = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); p->intimate = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); p->hungry = atoi(data); + SQL->GetData(inter->sql_handle, 10, &data, NULL); p->rename_flag = atoi(data); + SQL->GetData(inter->sql_handle, 11, &data, NULL); p->incubate = atoi(data); + + SQL->FreeResult(inter->sql_handle); p->hungry = cap_value(p->hungry, 0, 100); p->intimate = cap_value(p->intimate, 0, 1000); @@ -106,21 +107,21 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p) } //---------------------------------------------- -int inter_pet_sql_init(void){ +int inter_pet_sql_init(void) { //memory alloc - pet_pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1); + inter_pet->pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1); return 0; } -void inter_pet_sql_final(void){ - if (pet_pt) aFree(pet_pt); +void inter_pet_sql_final(void) { + if (inter_pet->pt) aFree(inter_pet->pt); return; } //---------------------------------- -int inter_pet_delete(int pet_id){ +int inter_pet_delete(int pet_id) { ShowInfo("delete pet request: %d...\n",pet_id); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) ) + Sql_ShowDebug(inter->sql_handle); return 0; } //------------------------------------------------------ @@ -142,7 +143,8 @@ int mapif_pet_created(int fd, int account_id, struct s_pet *p) return 0; } -int mapif_pet_info(int fd, int account_id, struct s_pet *p){ +int mapif_pet_info(int fd, int account_id, struct s_pet *p) +{ WFIFOHEAD(fd, sizeof(struct s_pet) + 9); WFIFOW(fd, 0) =0x3881; WFIFOW(fd, 2) =sizeof(struct s_pet) + 9; @@ -154,7 +156,8 @@ int mapif_pet_info(int fd, int account_id, struct s_pet *p){ return 0; } -int mapif_pet_noinfo(int fd, int account_id){ +int mapif_pet_noinfo(int fd, int account_id) +{ WFIFOHEAD(fd, sizeof(struct s_pet) + 9); WFIFOW(fd, 0) =0x3881; WFIFOW(fd, 2) =sizeof(struct s_pet) + 9; @@ -166,7 +169,8 @@ int mapif_pet_noinfo(int fd, int account_id){ return 0; } -int mapif_save_pet_ack(int fd, int account_id, int flag){ +int mapif_save_pet_ack(int fd, int account_id, int flag) +{ WFIFOHEAD(fd, 7); WFIFOW(fd, 0) =0x3882; WFIFOL(fd, 2) =account_id; @@ -176,7 +180,8 @@ int mapif_save_pet_ack(int fd, int account_id, int flag){ return 0; } -int mapif_delete_pet_ack(int fd, int flag){ +int mapif_delete_pet_ack(int fd, int flag) +{ WFIFOHEAD(fd, 3); WFIFOW(fd, 0) =0x3883; WFIFOB(fd, 2) =flag; @@ -188,63 +193,65 @@ int mapif_delete_pet_ack(int fd, int flag){ int mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) { - memset(pet_pt, 0, sizeof(struct s_pet)); - safestrncpy(pet_pt->name, pet_name, NAME_LENGTH); + memset(inter_pet->pt, 0, sizeof(struct s_pet)); + safestrncpy(inter_pet->pt->name, pet_name, NAME_LENGTH); if(incubate == 1) - pet_pt->account_id = pet_pt->char_id = 0; + inter_pet->pt->account_id = inter_pet->pt->char_id = 0; else { - pet_pt->account_id = account_id; - pet_pt->char_id = char_id; + inter_pet->pt->account_id = account_id; + inter_pet->pt->char_id = char_id; } - pet_pt->class_ = pet_class; - pet_pt->level = pet_lv; - pet_pt->egg_id = pet_egg_id; - pet_pt->equip = pet_equip; - pet_pt->intimate = intimate; - pet_pt->hungry = hungry; - pet_pt->rename_flag = rename_flag; - pet_pt->incubate = incubate; - - if(pet_pt->hungry < 0) - pet_pt->hungry = 0; - else if(pet_pt->hungry > 100) - pet_pt->hungry = 100; - if(pet_pt->intimate < 0) - pet_pt->intimate = 0; - else if(pet_pt->intimate > 1000) - pet_pt->intimate = 1000; - - pet_pt->pet_id = -1; //Signal NEW pet. - if (inter_pet_tosql(pet_pt->pet_id,pet_pt)) - mapif_pet_created(fd, account_id, pet_pt); + inter_pet->pt->class_ = pet_class; + inter_pet->pt->level = pet_lv; + inter_pet->pt->egg_id = pet_egg_id; + inter_pet->pt->equip = pet_equip; + inter_pet->pt->intimate = intimate; + inter_pet->pt->hungry = hungry; + inter_pet->pt->rename_flag = rename_flag; + inter_pet->pt->incubate = incubate; + + if(inter_pet->pt->hungry < 0) + inter_pet->pt->hungry = 0; + else if(inter_pet->pt->hungry > 100) + inter_pet->pt->hungry = 100; + if(inter_pet->pt->intimate < 0) + inter_pet->pt->intimate = 0; + else if(inter_pet->pt->intimate > 1000) + inter_pet->pt->intimate = 1000; + + inter_pet->pt->pet_id = -1; //Signal NEW pet. + if (inter_pet->tosql(inter_pet->pt->pet_id,inter_pet->pt)) + mapif->pet_created(fd, account_id, inter_pet->pt); else //Failed... - mapif_pet_created(fd, account_id, NULL); + mapif->pet_created(fd, account_id, NULL); return 0; } -int mapif_load_pet(int fd, int account_id, int char_id, int pet_id){ - memset(pet_pt, 0, sizeof(struct s_pet)); +int mapif_load_pet(int fd, int account_id, int char_id, int pet_id) +{ + memset(inter_pet->pt, 0, sizeof(struct s_pet)); - inter_pet_fromsql(pet_id, pet_pt); + inter_pet->fromsql(pet_id, inter_pet->pt); - if(pet_pt!=NULL) { - if(pet_pt->incubate == 1) { - pet_pt->account_id = pet_pt->char_id = 0; - mapif_pet_info(fd, account_id, pet_pt); + if(inter_pet->pt!=NULL) { + if(inter_pet->pt->incubate == 1) { + inter_pet->pt->account_id = inter_pet->pt->char_id = 0; + mapif->pet_info(fd, account_id, inter_pet->pt); } - else if(account_id == pet_pt->account_id && char_id == pet_pt->char_id) - mapif_pet_info(fd, account_id, pet_pt); + else if(account_id == inter_pet->pt->account_id && char_id == inter_pet->pt->char_id) + mapif->pet_info(fd, account_id, inter_pet->pt); else - mapif_pet_noinfo(fd, account_id); + mapif->pet_noinfo(fd, account_id); } else - mapif_pet_noinfo(fd, account_id); + mapif->pet_noinfo(fd, account_id); return 0; } -int mapif_save_pet(int fd, int account_id, struct s_pet *data) { +int mapif_save_pet(int fd, int account_id, struct s_pet *data) +{ //here process pet save request. int len; RFIFOHEAD(fd); @@ -262,52 +269,72 @@ int mapif_save_pet(int fd, int account_id, struct s_pet *data) { data->intimate = 0; else if (data->intimate > 1000) data->intimate = 1000; - inter_pet_tosql(data->pet_id,data); - mapif_save_pet_ack(fd, account_id, 0); + inter_pet->tosql(data->pet_id,data); + mapif->save_pet_ack(fd, account_id, 0); return 0; } -int mapif_delete_pet(int fd, int pet_id){ - mapif_delete_pet_ack(fd, inter_pet_delete(pet_id)); +int mapif_delete_pet(int fd, int pet_id) +{ + mapif->delete_pet_ack(fd, inter_pet->delete_(pet_id)); return 0; } -int mapif_parse_CreatePet(int fd){ +int mapif_parse_CreatePet(int fd) +{ RFIFOHEAD(fd); - mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), RFIFOW(fd, 16), RFIFOW(fd, 18), + mapif->create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), RFIFOW(fd, 16), RFIFOW(fd, 18), RFIFOW(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), (char*)RFIFOP(fd, 24)); return 0; } -int mapif_parse_LoadPet(int fd){ +int mapif_parse_LoadPet(int fd) +{ RFIFOHEAD(fd); - mapif_load_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOL(fd, 10)); + mapif->load_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOL(fd, 10)); return 0; } -int mapif_parse_SavePet(int fd){ +int mapif_parse_SavePet(int fd) +{ RFIFOHEAD(fd); - mapif_save_pet(fd, RFIFOL(fd, 4), (struct s_pet *) RFIFOP(fd, 8)); + mapif->save_pet(fd, RFIFOL(fd, 4), (struct s_pet *) RFIFOP(fd, 8)); return 0; } -int mapif_parse_DeletePet(int fd){ +int mapif_parse_DeletePet(int fd) +{ RFIFOHEAD(fd); - mapif_delete_pet(fd, RFIFOL(fd, 2)); + mapif->delete_pet(fd, RFIFOL(fd, 2)); return 0; } -int inter_pet_parse_frommap(int fd){ +int inter_pet_parse_frommap(int fd) +{ RFIFOHEAD(fd); switch(RFIFOW(fd, 0)){ - case 0x3080: mapif_parse_CreatePet(fd); break; - case 0x3081: mapif_parse_LoadPet(fd); break; - case 0x3082: mapif_parse_SavePet(fd); break; - case 0x3083: mapif_parse_DeletePet(fd); break; + case 0x3080: mapif->parse_CreatePet(fd); break; + case 0x3081: mapif->parse_LoadPet(fd); break; + case 0x3082: mapif->parse_SavePet(fd); break; + case 0x3083: mapif->parse_DeletePet(fd); break; default: return 0; } return 1; } + +void inter_pet_defaults(void) +{ + inter_pet = &inter_pet_s; + + inter_pet->pt = NULL; + + inter_pet->tosql = inter_pet_tosql; + inter_pet->fromsql = inter_pet_fromsql; + inter_pet->sql_init = inter_pet_sql_init; + inter_pet->sql_final = inter_pet_sql_final; + inter_pet->delete_ = inter_pet_delete; + inter_pet->parse_frommap = inter_pet_parse_frommap; +} diff --git a/src/char/int_pet.h b/src/char/int_pet.h index 52642fc54..fcb052f34 100644 --- a/src/char/int_pet.h +++ b/src/char/int_pet.h @@ -6,16 +6,21 @@ struct s_pet; -int inter_pet_init(void); -void inter_pet_sql_final(void); -int inter_pet_save(void); -int inter_pet_delete(int pet_id); +void inter_pet_defaults(void); -int inter_pet_parse_frommap(int fd); -int inter_pet_sql_init(void); -//extern char pet_txt[256]; +/** + * inter_pet interface + **/ +struct inter_pet_interface { + struct s_pet *pt; + int (*tosql) (int pet_id, struct s_pet* p); + int (*fromsql) (int pet_id, struct s_pet* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int pet_id); + int (*parse_frommap) (int fd); +}; -//Exported for use in the TXT-SQL converter. -int inter_pet_tosql(int pet_id, struct s_pet *p); +struct inter_pet_interface *inter_pet; #endif /* CHAR_INT_PET_H */ diff --git a/src/char/int_quest.c b/src/char/int_quest.c index d4155b0d6..a5721c430 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -12,6 +12,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/db.h" #include "../common/malloc.h" #include "../common/mmo.h" @@ -21,6 +22,8 @@ #include "../common/strlib.h" #include "../common/timer.h" +struct inter_quest_interface inter_quest_s; + /** * Loads the entire questlog for a character. * @@ -29,7 +32,8 @@ * @return Array of found entries. It has *count entries, and it is care of the * caller to aFree() it afterwards. */ -struct quest *mapif_quests_fromsql(int char_id, int *count) { +struct quest *mapif_quests_fromsql(int char_id, int *count) +{ struct quest *questlog = NULL; struct quest tmp_quest; SqlStmt *stmt; @@ -40,7 +44,7 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) { if (!count) return NULL; - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if (stmt == NULL) { SqlStmt_ShowDebug(stmt); *count = 0; @@ -106,9 +110,10 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) { * @param quest_id Quest ID * @return false in case of errors, true otherwise */ -bool mapif_quest_delete(int char_id, int quest_id) { - if (SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, quest_id, char_id)) { - Sql_ShowDebug(sql_handle); +bool mapif_quest_delete(int char_id, int quest_id) +{ + if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, quest_id, char_id)) { + Sql_ShowDebug(inter->sql_handle); return false; } @@ -122,7 +127,8 @@ bool mapif_quest_delete(int char_id, int quest_id) { * @param qd Quest data * @return false in case of errors, true otherwise */ -bool mapif_quest_add(int char_id, struct quest qd) { +bool mapif_quest_add(int char_id, struct quest qd) +{ StringBuf buf; int i; @@ -136,8 +142,8 @@ bool mapif_quest_add(int char_id, struct quest qd) { StrBuf->Printf(&buf, ", '%d'", qd.count[i]); } StrBuf->AppendStr(&buf, ")"); - if (SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf))) { - Sql_ShowDebug(sql_handle); + if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) { + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return false; } @@ -153,7 +159,8 @@ bool mapif_quest_add(int char_id, struct quest qd) { * @param qd Quest data * @return false in case of errors, true otherwise */ -bool mapif_quest_update(int char_id, struct quest qd) { +bool mapif_quest_update(int char_id, struct quest qd) +{ StringBuf buf; int i; @@ -164,8 +171,8 @@ bool mapif_quest_update(int char_id, struct quest qd) { } StrBuf->Printf(&buf, " WHERE `quest_id` = '%d' AND `char_id` = '%d'", qd.quest_id, char_id); - if (SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf))) { - Sql_ShowDebug(sql_handle); + if (SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf))) { + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); return false; } @@ -174,6 +181,15 @@ bool mapif_quest_update(int char_id, struct quest qd) { return true; } +void mapif_quest_save_ack(int fd, int char_id, bool success) +{ + WFIFOHEAD(fd,7); + WFIFOW(fd,0) = 0x3861; + WFIFOL(fd,2) = char_id; + WFIFOB(fd,6) = success?1:0; + WFIFOSET(fd,7); +} + /** * Handles the save request from mapserver for a character's questlog. * @@ -181,7 +197,8 @@ bool mapif_quest_update(int char_id, struct quest qd) { * * @see inter_parse_frommap */ -int mapif_parse_quest_save(int fd) { +int mapif_parse_quest_save(int fd) +{ int i, j, k, old_n, new_n = (RFIFOW(fd,2)-8)/sizeof(struct quest); int char_id = RFIFOL(fd,4); struct quest *old_qd = NULL, *new_qd = NULL; @@ -190,7 +207,7 @@ int mapif_parse_quest_save(int fd) { if (new_n > 0) new_qd = (struct quest*)RFIFOP(fd,8); - old_qd = mapif_quests_fromsql(char_id, &old_n); + old_qd = mapif->quests_fromsql(char_id, &old_n); for (i = 0; i < new_n; i++) { ARR_FIND( 0, old_n, j, new_qd[i].quest_id == old_qd[j].quest_id ); @@ -200,7 +217,7 @@ int mapif_parse_quest_save(int fd) { // Only states and counts are changeable. ARR_FIND( 0, MAX_QUEST_OBJECTIVES, k, new_qd[i].count[k] != old_qd[j].count[k] ); if (k != MAX_QUEST_OBJECTIVES || new_qd[i].state != old_qd[j].state) - success &= mapif_quest_update(char_id, new_qd[i]); + success &= mapif->quest_update(char_id, new_qd[i]); if (j < (--old_n)) { // Compact array @@ -209,26 +226,35 @@ int mapif_parse_quest_save(int fd) { } } else { // Add new quests - success &= mapif_quest_add(char_id, new_qd[i]); + success &= mapif->quest_add(char_id, new_qd[i]); } } for (i = 0; i < old_n; i++) // Quests not in new_qd but in old_qd are to be erased. - success &= mapif_quest_delete(char_id, old_qd[i].quest_id); + success &= mapif->quest_delete(char_id, old_qd[i].quest_id); if (old_qd) aFree(old_qd); // Send ack - WFIFOHEAD(fd,7); - WFIFOW(fd,0) = 0x3861; - WFIFOL(fd,2) = char_id; - WFIFOB(fd,6) = success?1:0; - WFIFOSET(fd,7); + mapif->quest_save_ack(fd, char_id, success); return 0; } +void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests) +{ + WFIFOHEAD(fd,num_quests*sizeof(struct quest)+8); + WFIFOW(fd,0) = 0x3860; + WFIFOW(fd,2) = num_quests*sizeof(struct quest)+8; + WFIFOL(fd,4) = char_id; + + if (num_quests > 0) + memcpy(WFIFOP(fd,8), tmp_questlog, sizeof(struct quest)*num_quests); + + WFIFOSET(fd,num_quests*sizeof(struct quest)+8); +} + /** * Sends questlog to the map server * @@ -238,22 +264,14 @@ int mapif_parse_quest_save(int fd) { * * @see inter_parse_frommap */ -int mapif_parse_quest_load(int fd) { +int mapif_parse_quest_load(int fd) +{ int char_id = RFIFOL(fd,2); struct quest *tmp_questlog = NULL; int num_quests; - tmp_questlog = mapif_quests_fromsql(char_id, &num_quests); - - WFIFOHEAD(fd,num_quests*sizeof(struct quest)+8); - WFIFOW(fd,0) = 0x3860; - WFIFOW(fd,2) = num_quests*sizeof(struct quest)+8; - WFIFOL(fd,4) = char_id; - - if (num_quests > 0) - memcpy(WFIFOP(fd,8), tmp_questlog, sizeof(struct quest)*num_quests); - - WFIFOSET(fd,num_quests*sizeof(struct quest)+8); + tmp_questlog = mapif->quests_fromsql(char_id, &num_quests); + mapif->send_quests(fd, char_id, tmp_questlog, num_quests); if (tmp_questlog) aFree(tmp_questlog); @@ -266,12 +284,20 @@ int mapif_parse_quest_load(int fd) { * * @see inter_parse_frommap */ -int inter_quest_parse_frommap(int fd) { +int inter_quest_parse_frommap(int fd) +{ switch(RFIFOW(fd,0)) { - case 0x3060: mapif_parse_quest_load(fd); break; - case 0x3061: mapif_parse_quest_save(fd); break; + case 0x3060: mapif->parse_quest_load(fd); break; + case 0x3061: mapif->parse_quest_save(fd); break; default: return 0; } return 1; } + +void inter_quest_defaults(void) +{ + inter_quest = &inter_quest_s; + + inter_quest->parse_frommap = inter_quest_parse_frommap; +} diff --git a/src/char/int_quest.h b/src/char/int_quest.h index f0dd370ea..17740341b 100644 --- a/src/char/int_quest.h +++ b/src/char/int_quest.h @@ -4,7 +4,16 @@ #ifndef CHAR_QUEST_H #define CHAR_QUEST_H -int inter_quest_parse_frommap(int fd); +void inter_quest_defaults(void); + +/** + * inter_quest interface + **/ +struct inter_quest_interface { + int (*parse_frommap) (int fd); +}; + +struct inter_quest_interface *inter_quest; #endif /* CHAR_QUEST_H */ diff --git a/src/char/int_storage.c b/src/char/int_storage.c index b9d9f2e2c..7cef7e6f0 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -13,6 +13,7 @@ #include "char.h" #include "inter.h" +#include "mapif.h" #include "../common/malloc.h" #include "../common/mmo.h" #include "../common/showmsg.h" @@ -22,15 +23,17 @@ #define STORAGE_MEMINC 16 +struct inter_storage_interface inter_storage_s; + /// Save storage data to sql -int storage_tosql(int account_id, struct storage_data* p) +int inter_storage_tosql(int account_id, struct storage_data* p) { - memitemdata_to_sql(p->items, MAX_STORAGE, account_id, TABLE_STORAGE); + chr->memitemdata_to_sql(p->items, MAX_STORAGE, account_id, TABLE_STORAGE); return 0; } /// Load storage data to mem -int storage_fromsql(int account_id, struct storage_data* p) +int inter_storage_fromsql(int account_id, struct storage_data* p) { StringBuf buf; struct item* item; @@ -48,46 +51,46 @@ int storage_fromsql(int account_id, struct storage_data* p) StrBuf->Printf(&buf, ",`card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `account_id`='%d' ORDER BY `nameid`", storage_db, account_id); - if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); - for( i = 0; i < MAX_STORAGE && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) + for( i = 0; i < MAX_STORAGE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { item = &p->items[i]; - SQL->GetData(sql_handle, 0, &data, NULL); item->id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); item->equip = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); item->identify = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); item->refine = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); item->attribute = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); item->expire_time = (unsigned int)atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); item->bound = atoi(data); - SQL->GetData(sql_handle, 9, &data, NULL); item->unique_id = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle, 0, &data, NULL); item->id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); item->nameid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); item->amount = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); item->equip = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); item->identify = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); item->refine = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); item->attribute = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); item->expire_time = (unsigned int)atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); item->bound = atoi(data); + SQL->GetData(inter->sql_handle, 9, &data, NULL); item->unique_id = strtoull(data, NULL, 10); for( j = 0; j < MAX_SLOTS; ++j ) { - SQL->GetData(sql_handle, 10+j, &data, NULL); item->card[j] = atoi(data); + SQL->GetData(inter->sql_handle, 10+j, &data, NULL); item->card[j] = atoi(data); } } p->storage_amount = i; - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); ShowInfo("storage load complete from DB - id: %d (total: %d)\n", account_id, p->storage_amount); return 1; } /// Save guild_storage data to sql -int guild_storage_tosql(int guild_id, struct guild_storage* p) +int inter_storage_guild_storage_tosql(int guild_id, struct guild_storage* p) { - memitemdata_to_sql(p->items, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE); + chr->memitemdata_to_sql(p->items, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE); ShowInfo ("guild storage save to DB - guild: %d\n", guild_id); return 0; } /// Load guild_storage data to mem -int guild_storage_fromsql(int guild_id, struct guild_storage* p) +int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) { StringBuf buf; struct item* item; @@ -106,30 +109,30 @@ int guild_storage_fromsql(int guild_id, struct guild_storage* p) StrBuf->Printf(&buf, ",`card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `guild_id`='%d' ORDER BY `nameid`", guild_storage_db, guild_id); - if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) ) + Sql_ShowDebug(inter->sql_handle); StrBuf->Destroy(&buf); - for( i = 0; i < MAX_GUILD_STORAGE && SQL_SUCCESS == SQL->NextRow(sql_handle); ++i ) { + for( i = 0; i < MAX_GUILD_STORAGE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { item = &p->items[i]; - SQL->GetData(sql_handle, 0, &data, NULL); item->id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); item->equip = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); item->identify = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); item->refine = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); item->attribute = atoi(data); - SQL->GetData(sql_handle, 7, &data, NULL); item->bound = atoi(data); - SQL->GetData(sql_handle, 8, &data, NULL); item->unique_id = strtoull(data, NULL, 10); + SQL->GetData(inter->sql_handle, 0, &data, NULL); item->id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); item->nameid = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); item->amount = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); item->equip = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); item->identify = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); item->refine = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); item->attribute = atoi(data); + SQL->GetData(inter->sql_handle, 7, &data, NULL); item->bound = atoi(data); + SQL->GetData(inter->sql_handle, 8, &data, NULL); item->unique_id = strtoull(data, NULL, 10); item->expire_time = 0; for( j = 0; j < MAX_SLOTS; ++j ) { - SQL->GetData(sql_handle, 9+j, &data, NULL); item->card[j] = atoi(data); + SQL->GetData(inter->sql_handle, 9+j, &data, NULL); item->card[j] = atoi(data); } } p->storage_amount = i; - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); ShowInfo("guild storage load complete from DB - id: %d (total: %d)\n", guild_id, p->storage_amount); return 0; @@ -150,25 +153,25 @@ void inter_storage_sql_final(void) // q?f[^? int inter_storage_delete(int account_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id`='%d'", storage_db, account_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id`='%d'", storage_db, account_id) ) + Sql_ShowDebug(inter->sql_handle); return 0; } -int inter_guild_storage_delete(int guild_id) +int inter_storage_guild_storage_delete(int guild_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d'", guild_storage_db, guild_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d'", guild_storage_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); return 0; } //--------------------------------------------------------- // packet from map server -int mapif_load_guild_storage(int fd,int account_id,int guild_id, char flag) +int mapif_load_guild_storage(int fd, int account_id, int guild_id, char flag) { - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id) ) - Sql_ShowDebug(sql_handle); - else if( SQL->NumRows(sql_handle) > 0 ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id) ) + Sql_ShowDebug(inter->sql_handle); + else if( SQL->NumRows(inter->sql_handle) > 0 ) {// guild exists WFIFOHEAD(fd, sizeof(struct guild_storage)+13); WFIFOW(fd,0) = 0x3818; @@ -176,12 +179,12 @@ int mapif_load_guild_storage(int fd,int account_id,int guild_id, char flag) WFIFOL(fd,4) = account_id; WFIFOL(fd,8) = guild_id; WFIFOB(fd,12) = flag; //1 open storage, 0 don't open - guild_storage_fromsql(guild_id, (struct guild_storage*)WFIFOP(fd,13)); + inter_storage->guild_storage_fromsql(guild_id, (struct guild_storage*)WFIFOP(fd,13)); WFIFOSET(fd, WFIFOW(fd,2)); return 0; } // guild does not exist - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); WFIFOHEAD(fd, 12); WFIFOW(fd,0) = 0x3818; WFIFOW(fd,2) = 12; @@ -190,7 +193,7 @@ int mapif_load_guild_storage(int fd,int account_id,int guild_id, char flag) WFIFOSET(fd, 12); return 0; } -int mapif_save_guild_storage_ack(int fd,int account_id,int guild_id,int fail) +int mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail) { WFIFOHEAD(fd,11); WFIFOW(fd,0)=0x3819; @@ -207,7 +210,7 @@ int mapif_save_guild_storage_ack(int fd,int account_id,int guild_id,int fail) int mapif_parse_LoadGuildStorage(int fd) { RFIFOHEAD(fd); - mapif_load_guild_storage(fd,RFIFOL(fd,2),RFIFOL(fd,6),1); + mapif->load_guild_storage(fd,RFIFOL(fd,2),RFIFOL(fd,6),1); return 0; } @@ -223,18 +226,18 @@ int mapif_parse_SaveGuildStorage(int fd) if (sizeof(struct guild_storage) != len - 12) { ShowError("inter storage: data size mismatch: %d != %"PRIuS"\n", len - 12, sizeof(struct guild_storage)); } else { - if (SQL_ERROR == SQL->Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id)) { - Sql_ShowDebug(sql_handle); - } else if(SQL->NumRows(sql_handle) > 0) { + if (SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id)) { + Sql_ShowDebug(inter->sql_handle); + } else if(SQL->NumRows(inter->sql_handle) > 0) { // guild exists - SQL->FreeResult(sql_handle); - guild_storage_tosql(guild_id, (struct guild_storage*)RFIFOP(fd,12)); - mapif_save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 0); + SQL->FreeResult(inter->sql_handle); + inter_storage->guild_storage_tosql(guild_id, (struct guild_storage*)RFIFOP(fd,12)); + mapif->save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 0); return 0; } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); } - mapif_save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 1); + mapif->save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 1); return 0; } @@ -249,6 +252,7 @@ int mapif_itembound_ack(int fd, int aid, int guild_id) #endif return 0; } + //------------------------------------------------ //Guild bound items pull for offline characters [Akinari] //Revised by [Mhalicot] @@ -272,11 +276,11 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) StrBuf->Printf(&buf, ", `card%d`", j); StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`='%d' AND `bound` = '%d'",inventory_db,char_id,IBT_GUILD); - stmt = SQL->StmtMalloc(sql_handle); + stmt = SQL->StmtMalloc(inter->sql_handle); if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtExecute(stmt) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); SQL->StmtFree(stmt); StrBuf->Destroy(&buf); return 1; @@ -300,7 +304,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) memcpy(&items[i],&item,sizeof(struct item)); i++; } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); if(!i) { //No items found - No need to continue StrBuf->Destroy(&buf); @@ -335,7 +339,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtExecute(stmt) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); SQL->StmtFree(stmt); StrBuf->Destroy(&buf); return 1; @@ -369,7 +373,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtExecute(stmt) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); SQL->StmtFree(stmt); StrBuf->Destroy(&buf); return 1; @@ -379,9 +383,9 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) //Now let's update the guild storage with those deleted items /// TODO/FIXME: - /// This approach is basically the same as the one from memitemdata_to_sql, but + /// This approach is basically the same as the one from chr->memitemdata_to_sql, but /// the latter compares current database values and this is not needed in this case - /// maybe sometime separate memitemdata_to_sql into different methods in order to use + /// maybe sometime separate chr->memitemdata_to_sql into different methods in order to use /// call that function here as well [Panikon] StrBuf->Clear(&buf); StrBuf->Printf(&buf,"INSERT INTO `%s` (`guild_id`,`nameid`,`amount`,`equip`,`identify`,`refine`," @@ -406,7 +410,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) || SQL_ERROR == SQL->StmtExecute(stmt) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); SQL->StmtFree(stmt); StrBuf->Destroy(&buf); return 1; @@ -416,29 +420,47 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) SQL->StmtFree(stmt); //Finally reload storage and tell map we're done - mapif_load_guild_storage(fd,aid,guild_id,0); + mapif->load_guild_storage(fd,aid,guild_id,0); // If character is logged in char, disconnect - disconnect_player(aid); + chr->disconnect_player(aid); #endif return 0; } -void mapif_parse_ItemBoundRetrieve(int fd) { - mapif_parse_ItemBoundRetrieve_sub(fd); + +void mapif_parse_ItemBoundRetrieve(int fd) +{ + mapif->parse_ItemBoundRetrieve_sub(fd); /* tell map server the operation is over and it can unlock the storage */ - mapif_itembound_ack(fd,RFIFOL(fd,6),RFIFOW(fd,10)); + mapif->itembound_ack(fd,RFIFOL(fd,6),RFIFOW(fd,10)); } + int inter_storage_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)){ - case 0x3018: mapif_parse_LoadGuildStorage(fd); break; - case 0x3019: mapif_parse_SaveGuildStorage(fd); break; + case 0x3018: mapif->parse_LoadGuildStorage(fd); break; + case 0x3019: mapif->parse_SaveGuildStorage(fd); break; #ifdef GP_BOUND_ITEMS - case 0x3056: mapif_parse_ItemBoundRetrieve(fd); break; + case 0x3056: mapif->parse_ItemBoundRetrieve(fd); break; #endif default: return 0; } return 1; } + +void inter_storage_defaults(void) +{ + inter_storage = &inter_storage_s; + + inter_storage->tosql = inter_storage_tosql; + inter_storage->fromsql = inter_storage_fromsql; + inter_storage->guild_storage_tosql = inter_storage_guild_storage_tosql; + inter_storage->guild_storage_fromsql = inter_storage_guild_storage_fromsql; + inter_storage->sql_init = inter_storage_sql_init; + inter_storage->sql_final = inter_storage_sql_final; + inter_storage->delete_ = inter_storage_delete; + inter_storage->guild_storage_delete = inter_storage_guild_storage_delete; + inter_storage->parse_frommap = inter_storage_parse_frommap; +} diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 1cef94d98..dcf8f07c1 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -7,16 +7,23 @@ struct storage_data; struct guild_storage; -int inter_storage_sql_init(void); -void inter_storage_sql_final(void); -int inter_storage_delete(int account_id); -int inter_guild_storage_delete(int guild_id); +void inter_storage_defaults(void); -int inter_storage_parse_frommap(int fd); +/** + * inter_storage interface + **/ +struct inter_storage_interface { + int (*tosql) (int account_id, struct storage_data* p); + int (*fromsql) (int account_id, struct storage_data* p); + int (*guild_storage_tosql) (int guild_id, struct guild_storage* p); + int (*guild_storage_fromsql) (int guild_id, struct guild_storage* p); + int (*sql_init) (void); + void (*sql_final) (void); + int (*delete_) (int account_id); + int (*guild_storage_delete) (int guild_id); + int (*parse_frommap) (int fd); +}; -//Exported for use in the TXT-SQL converter. -int storage_fromsql(int account_id, struct storage_data* p); -int storage_tosql(int account_id,struct storage_data *p); -int guild_storage_tosql(int guild_id, struct guild_storage *p); +struct inter_storage_interface *inter_storage; #endif /* CHAR_INT_STORAGE_H */ diff --git a/src/char/inter.c b/src/char/inter.c index df2920aa0..5ac065f23 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -13,6 +13,7 @@ #include <sys/stat.h> // for stat/lstat/fstat - [Dekamaster/Ultimate GM Tool] #include "char.h" +#include "geoip.h" #include "int_auction.h" #include "int_elemental.h" #include "int_guild.h" @@ -23,6 +24,7 @@ #include "int_pet.h" #include "int_quest.h" #include "int_storage.h" +#include "mapif.h" #include "../common/cbasetypes.h" #include "../common/db.h" #include "../common/malloc.h" @@ -35,8 +37,7 @@ #define WISDATA_TTL (60*1000) //Wis data Time To Live (60 seconds) #define WISDELLIST_MAX 256 // Number of elements in the list Delete data Wis - -Sql* sql_handle = NULL; +struct inter_interface inter_s; int char_server_port = 3306; char char_server_ip[32] = "127.0.0.1"; @@ -72,7 +73,7 @@ static int wis_dellist[WISDELLIST_MAX], wis_delnum; #define MAX_JOB_NAMES 150 static char* msg_table[MAX_JOB_NAMES]; // messages 550 ~ 699 are job names -const char* msg_txt(int msg_number) { +const char* inter_msg_txt(int msg_number) { msg_number -= 550; if (msg_number >= 0 && msg_number < MAX_JOB_NAMES && msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') @@ -84,14 +85,15 @@ const char* msg_txt(int msg_number) { /** * Reads Message Data. * - * This is a modified version of the mapserver's msg_config_read to + * This is a modified version of the mapserver's inter->msg_config_read to * only read messages with IDs between 550 and 550+MAX_JOB_NAMES. * * @param[in] cfg_name configuration filename to read. * @param[in] allow_override whether to allow duplicate message IDs to override the original value. * @return success state. */ -bool msg_config_read(const char *cfg_name, bool allow_override) { +bool inter_msg_config_read(const char *cfg_name, bool allow_override) +{ int msg_number; char line[1024], w1[1024], w2[1024]; FILE *fp; @@ -112,7 +114,7 @@ bool msg_config_read(const char *cfg_name, bool allow_override) { continue; if (strcmpi(w1, "import") == 0) - msg_config_read(w2, true); + inter->msg_config_read(w2, true); else { msg_number = atoi(w1); if( msg_number < 550 || msg_number > (550+MAX_JOB_NAMES) ) @@ -141,13 +143,15 @@ bool msg_config_read(const char *cfg_name, bool allow_override) { /*========================================== * Cleanup Message Data *------------------------------------------*/ -void do_final_msg(void) { +void inter_do_final_msg(void) +{ int i; for (i = 0; i < MAX_JOB_NAMES; i++) aFree(msg_table[i]); } /* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */ -const char* job_name(int class_) { +const char* inter_job_name(int class_) +{ switch (class_) { case JOB_NOVICE: // 550 case JOB_SWORDMAN: // 551 @@ -156,7 +160,7 @@ const char* job_name(int class_) { case JOB_ACOLYTE: // 554 case JOB_MERCHANT: // 555 case JOB_THIEF: // 556 - return msg_txt(550 - JOB_NOVICE+class_); + return inter->msg_txt(550 - JOB_NOVICE+class_); case JOB_KNIGHT: // 557 case JOB_PRIEST: // 558 @@ -164,10 +168,10 @@ const char* job_name(int class_) { case JOB_BLACKSMITH: // 560 case JOB_HUNTER: // 561 case JOB_ASSASSIN: // 562 - return msg_txt(557 - JOB_KNIGHT+class_); + return inter->msg_txt(557 - JOB_KNIGHT+class_); case JOB_KNIGHT2: - return msg_txt(557); + return inter->msg_txt(557); case JOB_CRUSADER: // 563 case JOB_MONK: // 564 @@ -176,20 +180,20 @@ const char* job_name(int class_) { case JOB_ALCHEMIST: // 567 case JOB_BARD: // 568 case JOB_DANCER: // 569 - return msg_txt(563 - JOB_CRUSADER+class_); + return inter->msg_txt(563 - JOB_CRUSADER+class_); case JOB_CRUSADER2: - return msg_txt(563); + return inter->msg_txt(563); case JOB_WEDDING: // 570 case JOB_SUPER_NOVICE: // 571 case JOB_GUNSLINGER: // 572 case JOB_NINJA: // 573 case JOB_XMAS: // 574 - return msg_txt(570 - JOB_WEDDING+class_); + return inter->msg_txt(570 - JOB_WEDDING+class_); case JOB_SUMMER: - return msg_txt(621); + return inter->msg_txt(621); case JOB_NOVICE_HIGH: // 575 case JOB_SWORDMAN_HIGH: // 576 @@ -198,7 +202,7 @@ const char* job_name(int class_) { case JOB_ACOLYTE_HIGH: // 579 case JOB_MERCHANT_HIGH: // 580 case JOB_THIEF_HIGH: // 581 - return msg_txt(575 - JOB_NOVICE_HIGH+class_); + return inter->msg_txt(575 - JOB_NOVICE_HIGH+class_); case JOB_LORD_KNIGHT: // 582 case JOB_HIGH_PRIEST: // 583 @@ -206,10 +210,10 @@ const char* job_name(int class_) { case JOB_WHITESMITH: // 585 case JOB_SNIPER: // 586 case JOB_ASSASSIN_CROSS: // 587 - return msg_txt(582 - JOB_LORD_KNIGHT+class_); + return inter->msg_txt(582 - JOB_LORD_KNIGHT+class_); case JOB_LORD_KNIGHT2: - return msg_txt(582); + return inter->msg_txt(582); case JOB_PALADIN: // 588 case JOB_CHAMPION: // 589 @@ -218,10 +222,10 @@ const char* job_name(int class_) { case JOB_CREATOR: // 592 case JOB_CLOWN: // 593 case JOB_GYPSY: // 594 - return msg_txt(588 - JOB_PALADIN + class_); + return inter->msg_txt(588 - JOB_PALADIN + class_); case JOB_PALADIN2: - return msg_txt(588); + return inter->msg_txt(588); case JOB_BABY: // 595 case JOB_BABY_SWORDMAN: // 596 @@ -230,7 +234,7 @@ const char* job_name(int class_) { case JOB_BABY_ACOLYTE: // 599 case JOB_BABY_MERCHANT: // 600 case JOB_BABY_THIEF: // 601 - return msg_txt(595 - JOB_BABY + class_); + return inter->msg_txt(595 - JOB_BABY + class_); case JOB_BABY_KNIGHT: // 602 case JOB_BABY_PRIEST: // 603 @@ -238,10 +242,10 @@ const char* job_name(int class_) { case JOB_BABY_BLACKSMITH: // 605 case JOB_BABY_HUNTER: // 606 case JOB_BABY_ASSASSIN: // 607 - return msg_txt(602 - JOB_BABY_KNIGHT + class_); + return inter->msg_txt(602 - JOB_BABY_KNIGHT + class_); case JOB_BABY_KNIGHT2: - return msg_txt(602); + return inter->msg_txt(602); case JOB_BABY_CRUSADER: // 608 case JOB_BABY_MONK: // 609 @@ -250,26 +254,26 @@ const char* job_name(int class_) { case JOB_BABY_ALCHEMIST: // 612 case JOB_BABY_BARD: // 613 case JOB_BABY_DANCER: // 614 - return msg_txt(608 - JOB_BABY_CRUSADER + class_); + return inter->msg_txt(608 - JOB_BABY_CRUSADER + class_); case JOB_BABY_CRUSADER2: - return msg_txt(608); + return inter->msg_txt(608); case JOB_SUPER_BABY: - return msg_txt(615); + return inter->msg_txt(615); case JOB_TAEKWON: - return msg_txt(616); + return inter->msg_txt(616); case JOB_STAR_GLADIATOR: case JOB_STAR_GLADIATOR2: - return msg_txt(617); + return inter->msg_txt(617); case JOB_SOUL_LINKER: - return msg_txt(618); + return inter->msg_txt(618); case JOB_GANGSI: // 622 case JOB_DEATH_KNIGHT: // 623 case JOB_DARK_COLLECTOR: // 624 - return msg_txt(622 - JOB_GANGSI+class_); + return inter->msg_txt(622 - JOB_GANGSI+class_); case JOB_RUNE_KNIGHT: // 625 case JOB_WARLOCK: // 626 @@ -277,7 +281,7 @@ const char* job_name(int class_) { case JOB_ARCH_BISHOP: // 628 case JOB_MECHANIC: // 629 case JOB_GUILLOTINE_CROSS: // 630 - return msg_txt(625 - JOB_RUNE_KNIGHT+class_); + return inter->msg_txt(625 - JOB_RUNE_KNIGHT+class_); case JOB_RUNE_KNIGHT_T: // 656 case JOB_WARLOCK_T: // 657 @@ -285,7 +289,7 @@ const char* job_name(int class_) { case JOB_ARCH_BISHOP_T: // 659 case JOB_MECHANIC_T: // 660 case JOB_GUILLOTINE_CROSS_T: // 661 - return msg_txt(656 - JOB_RUNE_KNIGHT_T+class_); + return inter->msg_txt(656 - JOB_RUNE_KNIGHT_T+class_); case JOB_ROYAL_GUARD: // 631 case JOB_SORCERER: // 632 @@ -294,7 +298,7 @@ const char* job_name(int class_) { case JOB_SURA: // 635 case JOB_GENETIC: // 636 case JOB_SHADOW_CHASER: // 637 - return msg_txt(631 - JOB_ROYAL_GUARD+class_); + return inter->msg_txt(631 - JOB_ROYAL_GUARD+class_); case JOB_ROYAL_GUARD_T: // 662 case JOB_SORCERER_T: // 663 @@ -303,31 +307,31 @@ const char* job_name(int class_) { case JOB_SURA_T: // 666 case JOB_GENETIC_T: // 667 case JOB_SHADOW_CHASER_T: // 668 - return msg_txt(662 - JOB_ROYAL_GUARD_T+class_); + return inter->msg_txt(662 - JOB_ROYAL_GUARD_T+class_); case JOB_RUNE_KNIGHT2: - return msg_txt(625); + return inter->msg_txt(625); case JOB_RUNE_KNIGHT_T2: - return msg_txt(656); + return inter->msg_txt(656); case JOB_ROYAL_GUARD2: - return msg_txt(631); + return inter->msg_txt(631); case JOB_ROYAL_GUARD_T2: - return msg_txt(662); + return inter->msg_txt(662); case JOB_RANGER2: - return msg_txt(627); + return inter->msg_txt(627); case JOB_RANGER_T2: - return msg_txt(658); + return inter->msg_txt(658); case JOB_MECHANIC2: - return msg_txt(629); + return inter->msg_txt(629); case JOB_MECHANIC_T2: - return msg_txt(660); + return inter->msg_txt(660); case JOB_BABY_RUNE: // 638 case JOB_BABY_WARLOCK: // 639 @@ -342,33 +346,33 @@ const char* job_name(int class_) { case JOB_BABY_SURA: // 648 case JOB_BABY_GENETIC: // 649 case JOB_BABY_CHASER: // 650 - return msg_txt(638 - JOB_BABY_RUNE+class_); + return inter->msg_txt(638 - JOB_BABY_RUNE+class_); case JOB_BABY_RUNE2: - return msg_txt(638); + return inter->msg_txt(638); case JOB_BABY_GUARD2: - return msg_txt(644); + return inter->msg_txt(644); case JOB_BABY_RANGER2: - return msg_txt(640); + return inter->msg_txt(640); case JOB_BABY_MECHANIC2: - return msg_txt(642); + return inter->msg_txt(642); case JOB_SUPER_NOVICE_E: // 651 case JOB_SUPER_BABY_E: // 652 - return msg_txt(651 - JOB_SUPER_NOVICE_E+class_); + return inter->msg_txt(651 - JOB_SUPER_NOVICE_E+class_); case JOB_KAGEROU: // 653 case JOB_OBORO: // 654 - return msg_txt(653 - JOB_KAGEROU+class_); + return inter->msg_txt(653 - JOB_KAGEROU+class_); case JOB_REBELLION: - return msg_txt(655); + return inter->msg_txt(655); default: - return msg_txt(620); // "Unknown Job" + return inter->msg_txt(620); // "Unknown Job" } } @@ -403,27 +407,21 @@ const char * geoip_countryname[GEOIP_MAX_COUNTRIES] = {"Unknown","Asia/Pacific R "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey", "Saint Barthelemy", "Saint Martin", "Bonaire, Saint Eustatius and Saba", "South Sudan"}; -/** - * GeoIP information - **/ -struct s_geoip { - unsigned char *cache; // GeoIP.dat information see geoip_init() - bool active; -} geoip; /* [Dekamaster/Nightroad] */ /* WHY NOT A DBMAP: There are millions of entries in GeoIP and it has its own algorithm to go quickly through them, a DBMap wouldn't be efficient */ -const char* geoip_getcountry(uint32 ipnum){ +const char* geoip_getcountry(uint32 ipnum) +{ int depth; unsigned int x; const unsigned char *buf; unsigned int offset = 0; - if( geoip.active == false ) + if( geoip->data->active == false ) return geoip_countryname[0]; for (depth = 31; depth >= 0; depth--) { - buf = geoip.cache + (long)6 *offset; + buf = geoip->data->cache + (long)6 *offset; if (ipnum & (1 << depth)) { /* Take the right-hand branch */ x = (buf[3*1 + 0] << (0*8)) @@ -455,16 +453,17 @@ const char* geoip_getcountry(uint32 ipnum){ * Disables GeoIP * frees geoip.cache **/ -void geoip_final(bool shutdown) { - if (geoip.cache) { - aFree(geoip.cache); - geoip.cache = NULL; +void geoip_final(bool shutdown) +{ + if (geoip->data->cache) { + aFree(geoip->data->cache); + geoip->data->cache = NULL; } - if (geoip.active) { + if (geoip->data->active) { if (!shutdown) ShowStatus("GeoIP "CL_RED"disabled"CL_RESET".\n"); - geoip.active = false; + geoip->data->active = false; } } @@ -473,32 +472,33 @@ void geoip_final(bool shutdown) { * geoip.cache should be freed after use! * http://dev.maxmind.com/geoip/legacy/geolite/ **/ -void geoip_init(void) { +void geoip_init(void) +{ int i, fno; char db_type = 1; unsigned char delim[3]; struct stat bufa; FILE *db; - geoip.active = true; + geoip->data->active = true; db = fopen("./db/GeoIP.dat","rb"); if (db == NULL) { ShowError("geoip_readdb: Error reading GeoIP.dat!\n"); - geoip_final(false); + geoip->final(false); return; } fno = fileno(db); if (fstat(fno, &bufa) < 0) { ShowError("geoip_readdb: Error stating GeoIP.dat! Error %d\n", errno); - geoip_final(false); + geoip->final(false); return; } - geoip.cache = aMalloc( (sizeof(geoip.cache) * bufa.st_size) ); - if (fread(geoip.cache, sizeof(unsigned char), bufa.st_size, db) != bufa.st_size) { + geoip->data->cache = aMalloc( (sizeof(geoip->data->cache) * bufa.st_size) ); + if (fread(geoip->data->cache, sizeof(unsigned char), bufa.st_size, db) != bufa.st_size) { ShowError("geoip_cache: Couldn't read all elements!\n"); fclose(db); - geoip_final(false); + geoip->final(false); return; } @@ -527,7 +527,7 @@ void geoip_init(void) { else ShowError("geoip_init(): GeoIP is corrupted!\n"); - geoip_final(false); + geoip->final(false); return; } ShowStatus("Finished Reading "CL_GREEN"GeoIP"CL_RESET" Database.\n"); @@ -537,7 +537,8 @@ void geoip_init(void) { * Argument-list version of inter_msg_to_fd * @see inter_msg_to_fd */ -void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) { +void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) +{ char msg_out[512]; va_list apcopy; int len = 1;/* yes we start at 1 */ @@ -569,15 +570,17 @@ void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) { * @param ... Additional parameters for (v)sprinf */ void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); -void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) { +void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) +{ va_list ap; va_start(ap,msg); - inter_vmsg_to_fd(fd, u_fd, aid, msg, ap); + inter->vmsg_to_fd(fd, u_fd, aid, msg, ap); va_end(ap); } /* [Dekamaster/Nightroad] */ -void mapif_parse_accinfo(int fd) { +void mapif_parse_accinfo(int fd) +{ int u_fd = RFIFOL(fd,2), aid = RFIFOL(fd,6), castergroup = RFIFOL(fd,10); char query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1]; int account_id; @@ -585,43 +588,43 @@ void mapif_parse_accinfo(int fd) { safestrncpy(query, (char*) RFIFOP(fd,14), NAME_LENGTH); - SQL->EscapeString(sql_handle, query_esq, query); + SQL->EscapeString(inter->sql_handle, query_esq, query); account_id = atoi(query); if (account_id < START_ACCOUNT_NUM) { // is string - if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`name`,`class`,`base_level`,`job_level`,`online` FROM `%s` WHERE `name` LIKE '%s' LIMIT 10", char_db, query_esq) - || SQL->NumRows(sql_handle) == 0 ) { - if( SQL->NumRows(sql_handle) == 0 ) { - inter_msg_to_fd(fd, u_fd, aid, "No matches were found for your criteria, '%s'",query); + if ( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `account_id`,`name`,`class`,`base_level`,`job_level`,`online` FROM `%s` WHERE `name` LIKE '%s' LIMIT 10", char_db, query_esq) + || SQL->NumRows(inter->sql_handle) == 0 ) { + if( SQL->NumRows(inter->sql_handle) == 0 ) { + inter->msg_to_fd(fd, u_fd, aid, "No matches were found for your criteria, '%s'",query); } else { - Sql_ShowDebug(sql_handle); - inter_msg_to_fd(fd, u_fd, aid, "An error occurred, bother your admin about it."); + Sql_ShowDebug(inter->sql_handle); + inter->msg_to_fd(fd, u_fd, aid, "An error occurred, bother your admin about it."); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return; } else { - if( SQL->NumRows(sql_handle) == 1 ) {//we found a perfect match - SQL->NextRow(sql_handle); - SQL->GetData(sql_handle, 0, &data, NULL); account_id = atoi(data); - SQL->FreeResult(sql_handle); + if( SQL->NumRows(inter->sql_handle) == 1 ) {//we found a perfect match + SQL->NextRow(inter->sql_handle); + SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data); + SQL->FreeResult(inter->sql_handle); } else {// more than one, listing... [Dekamaster/Nightroad] - inter_msg_to_fd(fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)SQL->NumRows(sql_handle)); - while ( SQL_SUCCESS == SQL->NextRow(sql_handle) ) { + inter->msg_to_fd(fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)SQL->NumRows(inter->sql_handle)); + while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { int class_; short base_level, job_level, online; char name[NAME_LENGTH]; - SQL->GetData(sql_handle, 0, &data, NULL); account_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); - SQL->GetData(sql_handle, 2, &data, NULL); class_ = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); base_level = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); job_level = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); online = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); + SQL->GetData(inter->sql_handle, 2, &data, NULL); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); job_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); online = atoi(data); - inter_msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline"); + inter->msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class_), base_level, job_level, online?"Online":"Offline"); } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return; } } @@ -630,63 +633,65 @@ void mapif_parse_accinfo(int fd) { /* it will only get here if we have a single match */ /* and we will send packet with account id to login server asking for account info */ if( account_id ) { - mapif_on_parse_accinfo(account_id, u_fd, aid, castergroup, fd); + mapif->on_parse_accinfo(account_id, u_fd, aid, castergroup, fd); } return; } -void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state) { +void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state) +{ if (map_fd <= 0 || !session_isActive(map_fd)) return; // check if we have a valid fd if (!success) { - inter_msg_to_fd(map_fd, u_fd, u_aid, "No account with ID '%d' was found.", account_id); + inter->msg_to_fd(map_fd, u_fd, u_aid, "No account with ID '%d' was found.", account_id); return; } - inter_msg_to_fd(map_fd, u_fd, u_aid, "-- Account %d --", account_id); - inter_msg_to_fd(map_fd, u_fd, u_aid, "User: %s | GM Group: %d | State: %d", userid, group_id, state); + inter->msg_to_fd(map_fd, u_fd, u_aid, "-- Account %d --", account_id); + inter->msg_to_fd(map_fd, u_fd, u_aid, "User: %s | GM Group: %d | State: %d", userid, group_id, state); if (user_pass && *user_pass != '\0') { /* password is only received if your gm level is greater than the one you're searching for */ if (pin_code && *pin_code != '\0') - inter_msg_to_fd(map_fd, u_fd, u_aid, "Password: %s (PIN:%s)", user_pass, pin_code); + inter->msg_to_fd(map_fd, u_fd, u_aid, "Password: %s (PIN:%s)", user_pass, pin_code); else - inter_msg_to_fd(map_fd, u_fd, u_aid, "Password: %s", user_pass ); + inter->msg_to_fd(map_fd, u_fd, u_aid, "Password: %s", user_pass ); } - inter_msg_to_fd(map_fd, u_fd, u_aid, "Account e-mail: %s | Birthdate: %s", email, birthdate); - inter_msg_to_fd(map_fd, u_fd, u_aid, "Last IP: %s (%s)", last_ip, geoip_getcountry(str2ip(last_ip))); - inter_msg_to_fd(map_fd, u_fd, u_aid, "This user has logged %d times, the last time were at %s", logincount, lastlogin); - inter_msg_to_fd(map_fd, u_fd, u_aid, "-- Character Details --"); + inter->msg_to_fd(map_fd, u_fd, u_aid, "Account e-mail: %s | Birthdate: %s", email, birthdate); + inter->msg_to_fd(map_fd, u_fd, u_aid, "Last IP: %s (%s)", last_ip, geoip->getcountry(str2ip(last_ip))); + inter->msg_to_fd(map_fd, u_fd, u_aid, "This user has logged %d times, the last time were at %s", logincount, lastlogin); + inter->msg_to_fd(map_fd, u_fd, u_aid, "-- Character Details --"); - if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `char_id`, `name`, `char_num`, `class`, `base_level`, `job_level`, `online` " + if ( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`, `name`, `char_num`, `class`, `base_level`, `job_level`, `online` " "FROM `%s` WHERE `account_id` = '%d' ORDER BY `char_num` LIMIT %d", char_db, account_id, MAX_CHARS) - || SQL->NumRows(sql_handle) == 0 ) { - if (SQL->NumRows(sql_handle) == 0) { - inter_msg_to_fd(map_fd, u_fd, u_aid, "This account doesn't have characters."); + || SQL->NumRows(inter->sql_handle) == 0 ) { + if (SQL->NumRows(inter->sql_handle) == 0) { + inter->msg_to_fd(map_fd, u_fd, u_aid, "This account doesn't have characters."); } else { - inter_msg_to_fd(map_fd, u_fd, u_aid, "An error occurred, bother your admin about it."); - Sql_ShowDebug(sql_handle); + inter->msg_to_fd(map_fd, u_fd, u_aid, "An error occurred, bother your admin about it."); + Sql_ShowDebug(inter->sql_handle); } } else { - while ( SQL_SUCCESS == SQL->NextRow(sql_handle) ) { + while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { char *data; int char_id, class_; short char_num, base_level, job_level, online; char name[NAME_LENGTH]; - SQL->GetData(sql_handle, 0, &data, NULL); char_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); - SQL->GetData(sql_handle, 2, &data, NULL); char_num = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); class_ = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); base_level = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); job_level = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); online = atoi(data); + SQL->GetData(inter->sql_handle, 0, &data, NULL); char_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); + SQL->GetData(inter->sql_handle, 2, &data, NULL); char_num = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); class_ = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); base_level = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); job_level = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); online = atoi(data); - inter_msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, job_name(class_), base_level, job_level, online?"On":"Off"); + inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class_), base_level, job_level, online?"On":"Off"); } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return; } @@ -696,48 +701,49 @@ void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int acc * @param val either str or int, depending on type * @param type false when int, true otherwise **/ -void inter_savereg(int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string) { +void inter_savereg(int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string) +{ /* to login server we go! */ if( key[0] == '#' && key[1] == '#' ) {/* global account reg */ - if( session_isValid(login_fd) ) - global_accreg_to_login_add(key,index,val,is_string); + if( session_isValid(chr->login_fd) ) + chr->global_accreg_to_login_add(key,index,val,is_string); else { ShowError("Login server unavailable, cant perform update on '%s' variable for AID:%d CID:%d\n",key,account_id,char_id); } } else if ( key[0] == '#' ) {/* local account reg */ if( is_string ) { if( val ) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%s')", acc_reg_str_db, account_id, key, index, (char*)val) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%s')", acc_reg_str_db, account_id, key, index, (char*)val) ) + Sql_ShowDebug(inter->sql_handle); } else { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", acc_reg_str_db, account_id, key, index) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", acc_reg_str_db, account_id, key, index) ) + Sql_ShowDebug(inter->sql_handle); } } else { if( val ) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%d')", acc_reg_num_db, account_id, key, index, (int)val) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%d')", acc_reg_num_db, account_id, key, index, (int)val) ) + Sql_ShowDebug(inter->sql_handle); } else { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", acc_reg_num_db, account_id, key, index) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", acc_reg_num_db, account_id, key, index) ) + Sql_ShowDebug(inter->sql_handle); } } } else { /* char reg */ if( is_string ) { if( val ) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`char_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%s')", char_reg_str_db, char_id, key, index, (char*)val) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`char_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%s')", char_reg_str_db, char_id, key, index, (char*)val) ) + Sql_ShowDebug(inter->sql_handle); } else { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", char_reg_str_db, char_id, key, index) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", char_reg_str_db, char_id, key, index) ) + Sql_ShowDebug(inter->sql_handle); } } else { if( val ) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`char_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%d')", char_reg_num_db, char_id, key, index, (int)val) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`char_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%d')", char_reg_num_db, char_id, key, index, (int)val) ) + Sql_ShowDebug(inter->sql_handle); } else { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", char_reg_num_db, char_id, key, index) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d' AND `key` = '%s' AND `index` = '%u' LIMIT 1", char_reg_num_db, char_id, key, index) ) + Sql_ShowDebug(inter->sql_handle); } } } @@ -753,18 +759,18 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) switch( type ) { case 3: //char reg - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `char_id`='%d'", char_reg_str_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); break; case 2: //account reg - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `account_id`='%d'", acc_reg_str_db, account_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `account_id`='%d'", acc_reg_str_db, account_id) ) + Sql_ShowDebug(inter->sql_handle); break; case 1: //account2 reg - ShowError("inter_accreg_fromsql: Char server shouldn't handle type 1 registry values (##). That is the login server's work!\n"); + ShowError("inter->accreg_fromsql: Char server shouldn't handle type 1 registry values (##). That is the login server's work!\n"); return 0; default: - ShowError("inter_accreg_fromsql: Invalid type %d\n", type); + ShowError("inter->accreg_fromsql: Invalid type %d\n", type); return 0; } @@ -784,9 +790,9 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) * str type * { keyLength(B), key(<keyLength>), index(L), valLength(B), val(<valLength>) } **/ - while ( SQL_SUCCESS == SQL->NextRow(sql_handle) ) { + while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len;/* won't be higher; the column size is 32 */ @@ -795,12 +801,12 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) safestrncpy((char*)WFIFOP(fd,plen), data, len); plen += len; - SQL->GetData(sql_handle, 1, &data, NULL); + SQL->GetData(inter->sql_handle, 1, &data, NULL); WFIFOL(fd, plen) = (unsigned int)atol(data); plen += 4; - SQL->GetData(sql_handle, 2, &data, NULL); + SQL->GetData(inter->sql_handle, 2, &data, NULL); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len;/* won't be higher; the column size is 254 */ @@ -832,19 +838,19 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) WFIFOW(fd, 2) = plen; WFIFOSET(fd, plen); - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); switch( type ) { case 3: //char reg - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `char_id`='%d'", char_reg_num_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); break; case 2: //account reg - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `account_id`='%d'", acc_reg_num_db, account_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `account_id`='%d'", acc_reg_num_db, account_id) ) + Sql_ShowDebug(inter->sql_handle); break; case 1: //account2 reg - ShowError("inter_accreg_fromsql: Char server shouldn't handle type 1 registry values (##). That is the login server's work!\n"); + ShowError("inter->accreg_fromsql: Char server shouldn't handle type 1 registry values (##). That is the login server's work!\n"); return 0; } @@ -864,9 +870,9 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) * int type * { keyLength(B), key(<keyLength>), index(L), value(L) } **/ - while ( SQL_SUCCESS == SQL->NextRow(sql_handle) ) { + while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) { - SQL->GetData(sql_handle, 0, &data, NULL); + SQL->GetData(inter->sql_handle, 0, &data, NULL); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len;/* won't be higher; the column size is 32 */ @@ -875,12 +881,12 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) safestrncpy((char*)WFIFOP(fd,plen), data, len); plen += len; - SQL->GetData(sql_handle, 1, &data, NULL); + SQL->GetData(inter->sql_handle, 1, &data, NULL); WFIFOL(fd, plen) = (unsigned int)atol(data); plen += 4; - SQL->GetData(sql_handle, 2, &data, NULL); + SQL->GetData(inter->sql_handle, 2, &data, NULL); WFIFOL(fd, plen) = atoi(data); plen += 4; @@ -909,7 +915,7 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) WFIFOW(fd, 2) = plen; WFIFOSET(fd, plen); - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 1; } @@ -956,7 +962,7 @@ static int inter_config_read(const char* cfgName) else if(!strcmpi(w1,"log_inter")) log_inter = atoi(w2); else if(!strcmpi(w1,"import")) - inter_config_read(w2); + inter->config_read(w2); } fclose(fp); @@ -969,7 +975,8 @@ static int inter_config_read(const char* cfgName) * Save interlog into sql (arglist version) * @see inter_log */ -int inter_vlog(char* fmt, va_list ap) { +int inter_vlog(char* fmt, va_list ap) +{ char str[255]; char esc_str[sizeof(str)*2+1];// escaped str va_list apcopy; @@ -978,9 +985,9 @@ int inter_vlog(char* fmt, va_list ap) { vsnprintf(str, sizeof(str), fmt, apcopy); va_end(apcopy); - SQL->EscapeStringLen(sql_handle, esc_str, str, strnlen(str, sizeof(str))); - if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` (`time`, `log`) VALUES (NOW(), '%s')", interlog_db, esc_str) ) - Sql_ShowDebug(sql_handle); + SQL->EscapeStringLen(inter->sql_handle, esc_str, str, strnlen(str, sizeof(str))); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`time`, `log`) VALUES (NOW(), '%s')", interlog_db, esc_str) ) + Sql_ShowDebug(inter->sql_handle); return 0; } @@ -991,12 +998,13 @@ int inter_vlog(char* fmt, va_list ap) { * @param ... Additional (printf-like) arguments * @return Always 0 // FIXME */ -int inter_log(char* fmt, ...) { +int inter_log(char* fmt, ...) +{ va_list ap; int ret; va_start(ap,fmt); - ret = inter_vlog(fmt, ap); + ret = inter->vlog(fmt, ap); va_end(ap); return ret; @@ -1007,36 +1015,36 @@ int inter_init_sql(const char *file) { //int i; - inter_config_read(file); + inter->config_read(file); //DB connection initialized - sql_handle = SQL->Malloc(); + inter->sql_handle = SQL->Malloc(); ShowInfo("Connect Character DB server.... (Character Server)\n"); - if( SQL_ERROR == SQL->Connect(sql_handle, char_server_id, char_server_pw, char_server_ip, (uint16)char_server_port, char_server_db) ) + if( SQL_ERROR == SQL->Connect(inter->sql_handle, char_server_id, char_server_pw, char_server_ip, (uint16)char_server_port, char_server_db) ) { - Sql_ShowDebug(sql_handle); - SQL->Free(sql_handle); + Sql_ShowDebug(inter->sql_handle); + SQL->Free(inter->sql_handle); exit(EXIT_FAILURE); } if( *default_codepage ) { - if( SQL_ERROR == SQL->SetEncoding(sql_handle, default_codepage) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->SetEncoding(inter->sql_handle, default_codepage) ) + Sql_ShowDebug(inter->sql_handle); } wis_db = idb_alloc(DB_OPT_RELEASE_DATA); - inter_guild_sql_init(); - inter_storage_sql_init(); - inter_party_sql_init(); - inter_pet_sql_init(); - inter_homunculus_sql_init(); - inter_mercenary_sql_init(); - inter_elemental_sql_init(); - inter_mail_sql_init(); - inter_auction_sql_init(); - - geoip_init(); - msg_config_read("conf/messages.conf", false); + inter_guild->sql_init(); + inter_storage->sql_init(); + inter_party->sql_init(); + inter_pet->sql_init(); + inter_homunculus->sql_init(); + inter_mercenary->sql_init(); + inter_elemental->sql_init(); + inter_mail->sql_init(); + inter_auction->sql_init(); + + geoip->init(); + inter->msg_config_read("conf/messages.conf", false); return 0; } @@ -1045,18 +1053,18 @@ void inter_final(void) { wis_db->destroy(wis_db, NULL); - inter_guild_sql_final(); - inter_storage_sql_final(); - inter_party_sql_final(); - inter_pet_sql_final(); - inter_homunculus_sql_final(); - inter_mercenary_sql_final(); - inter_elemental_sql_final(); - inter_mail_sql_final(); - inter_auction_sql_final(); - - geoip_final(true); - do_final_msg(); + inter_guild->sql_final(); + inter_storage->sql_final(); + inter_party->sql_final(); + inter_pet->sql_final(); + inter_homunculus->sql_final(); + inter_mercenary->sql_final(); + inter_elemental->sql_final(); + inter_mail->sql_final(); + inter_auction->sql_final(); + + geoip->final(true); + inter->do_final_msg(); return; } @@ -1081,7 +1089,7 @@ int mapif_broadcast(unsigned char *mes, int len, unsigned int fontColor, short f WBUFW(buf,12) = fontAlign; WBUFW(buf,14) = fontY; memcpy(WBUFP(buf,16), mes, len - 16); - mapif_sendallwos(sfd, buf, len); + mapif->sendallwos(sfd, buf, len); if (buf) aFree(buf); @@ -1100,20 +1108,24 @@ int mapif_wis_message(struct WisData *wd) memcpy(WBUFP(buf, 8), wd->src, NAME_LENGTH); memcpy(WBUFP(buf,32), wd->dst, NAME_LENGTH); memcpy(WBUFP(buf,56), wd->msg, wd->len); - wd->count = mapif_sendall(buf,WBUFW(buf,2)); + wd->count = mapif->sendall(buf,WBUFW(buf,2)); return 0; } -// Wis sending result -int mapif_wis_end(struct WisData *wd, int flag) +void mapif_wis_response(int fd, unsigned char *src, int flag) { unsigned char buf[27]; - WBUFW(buf, 0)=0x3802; - memcpy(WBUFP(buf, 2),wd->src,24); + memcpy(WBUFP(buf, 2),src,24); WBUFB(buf,26)=flag; - mapif_send(wd->fd,buf,27); + mapif->send(fd,buf,27); +} + +// Wis sending result +int mapif_wis_end(struct WisData *wd, int flag) +{ + mapif->wis_response(wd->fd, wd->src, flag); return 0; } @@ -1121,12 +1133,13 @@ int mapif_wis_end(struct WisData *wd, int flag) //static void mapif_account_reg(int fd, unsigned char *src) //{ // WBUFW(src,0)=0x3804; //NOTE: writing to RFIFO -// mapif_sendallwos(fd, src, WBUFW(src,2)); +// mapif->sendallwos(fd, src, WBUFW(src,2)); //} // Send the requested account_reg -int mapif_account_reg_reply(int fd,int account_id,int char_id, int type) { - inter_accreg_fromsql(account_id,char_id,fd,type); +int mapif_account_reg_reply(int fd,int account_id,int char_id, int type) +{ + inter->accreg_fromsql(account_id,char_id,fd,type); return 0; } @@ -1151,7 +1164,7 @@ int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason) * Existence check of WISP data * @see DBApply */ -int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap) +int inter_check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap) { int64 tick; struct WisData *wd = DB->data2ptr(data); @@ -1163,19 +1176,19 @@ int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap) return 0; } -int check_ttl_wisdata(void) +int inter_check_ttl_wisdata(void) { int64 tick = timer->gettick(); int i; do { wis_delnum = 0; - wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick); + wis_db->foreach(wis_db, inter->check_ttl_wisdata_sub, tick); for(i = 0; i < wis_delnum; i++) { struct WisData *wd = (struct WisData*)idb_get(wis_db, wis_dellist[i]); ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst); // removed. not send information after a timeout. Just no answer for the player - //mapif_wis_end(wd, 1); // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target + //mapif->wis_end(wd, 1); // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target idb_remove(wis_db, wd->id); } } while(wis_delnum >= WISDELLIST_MAX); @@ -1188,7 +1201,7 @@ int check_ttl_wisdata(void) // broadcast sending int mapif_parse_broadcast(int fd) { - mapif_broadcast(RFIFOP(fd,16), RFIFOW(fd,2), RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), fd); + mapif->broadcast(RFIFOP(fd,16), RFIFOW(fd,2), RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), fd); return 0; } @@ -1216,41 +1229,32 @@ int mapif_parse_WisRequest(int fd) safestrncpy(name, (char*)RFIFOP(fd,28), NAME_LENGTH); //Received name may be too large and not contain \0! [Skotlex] - SQL->EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `name` FROM `%s` WHERE `name`='%s'", char_db, esc_name) ) - Sql_ShowDebug(sql_handle); + SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `name`='%s'", char_db, esc_name) ) + Sql_ShowDebug(inter->sql_handle); // search if character exists before to ask all map-servers - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - unsigned char buf[27]; - WBUFW(buf, 0) = 0x3802; - memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), NAME_LENGTH); - WBUFB(buf,26) = 1; // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target - mapif_send(fd, buf, 27); + mapif->wis_response(fd, RFIFOP(fd, 4), 1); } else {// Character exists. So, ask all map-servers // to be sure of the correct name, rewrite it - SQL->GetData(sql_handle, 0, &data, &len); + SQL->GetData(inter->sql_handle, 0, &data, &len); memset(name, 0, NAME_LENGTH); memcpy(name, data, min(len, NAME_LENGTH)); // if source is destination, don't ask other servers. if( strncmp((const char*)RFIFOP(fd,4), name, NAME_LENGTH) == 0 ) { - uint8 buf[27]; - WBUFW(buf, 0) = 0x3802; - memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), NAME_LENGTH); - WBUFB(buf,26) = 1; // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target - mapif_send(fd, buf, 27); + mapif->wis_response(fd, RFIFOP(fd, 4), 1); } else { - CREATE(wd, struct WisData, 1); // Whether the failure of previous wisp/page transmission (timeout) - check_ttl_wisdata(); + inter->check_ttl_wisdata(); wd->id = ++wisid; wd->fd = fd; @@ -1260,11 +1264,11 @@ int mapif_parse_WisRequest(int fd) memcpy(wd->msg, RFIFOP(fd,52), wd->len); wd->tick = timer->gettick(); idb_put(wis_db, wd->id, wd); - mapif_wis_message(wd); + mapif->wis_message(wd); } } - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return 0; } @@ -1282,7 +1286,7 @@ int mapif_parse_WisReply(int fd) return 0; // This wisp was probably suppress before, because it was timeout of because of target was found on another map-server if ((--wd->count) <= 0 || flag != 1) { - mapif_wis_end(wd, flag); // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target + mapif->wis_end(wd, flag); // flag: 0: success to send whisper, 1: target character is not logged in?, 2: ignored by target idb_remove(wis_db, id); } @@ -1296,7 +1300,7 @@ int mapif_parse_WisToGM(int fd) memcpy(WBUFP(buf,0), RFIFOP(fd,0), RFIFOW(fd,2)); WBUFW(buf, 0) = 0x3803; - mapif_sendall(buf, RFIFOW(fd,2)); + mapif->sendall(buf, RFIFOW(fd,2)); return 0; } @@ -1310,10 +1314,10 @@ int mapif_parse_Registry(int fd) int cursor = 14, i; char key[32], sval[254]; unsigned int index; - bool isLoginActive = session_isActive(login_fd); + bool isLoginActive = session_isActive(chr->login_fd); if( isLoginActive ) - global_accreg_to_login_start(account_id,char_id); + chr->global_accreg_to_login_start(account_id,char_id); for(i = 0; i < count; i++) { safestrncpy(key, (char*)RFIFOP(fd, cursor + 1), RFIFOB(fd, cursor)); @@ -1325,31 +1329,31 @@ int mapif_parse_Registry(int fd) switch (RFIFOB(fd, cursor++)) { /* int */ case 0: - inter_savereg(account_id,char_id,key,index,RFIFOL(fd, cursor),false); + inter->savereg(account_id,char_id,key,index,RFIFOL(fd, cursor),false); cursor += 4; break; case 1: - inter_savereg(account_id,char_id,key,index,0,false); + inter->savereg(account_id,char_id,key,index,0,false); break; /* str */ case 2: safestrncpy(sval, (char*)RFIFOP(fd, cursor + 1), RFIFOB(fd, cursor)); cursor += RFIFOB(fd, cursor) + 1; - inter_savereg(account_id,char_id,key,index,(intptr_t)sval,true); + inter->savereg(account_id,char_id,key,index,(intptr_t)sval,true); break; case 3: - inter_savereg(account_id,char_id,key,index,0,true); + inter->savereg(account_id,char_id,key,index,0,true); break; default: - ShowError("mapif_parse_Registry: unknown type %d\n",RFIFOB(fd, cursor - 1)); + ShowError("mapif->parse_Registry: unknown type %d\n",RFIFOB(fd, cursor - 1)); return 1; } } if( isLoginActive ) - global_accreg_to_login_send(); + chr->global_accreg_to_login_send(); } return 0; } @@ -1358,15 +1362,15 @@ int mapif_parse_Registry(int fd) int mapif_parse_RegistryRequest(int fd) { //Load Char Registry - if (RFIFOB(fd,12)) mapif_account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6),3); + if (RFIFOB(fd,12)) mapif->account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6),3); //Load Account Registry - if (RFIFOB(fd,11)) mapif_account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6),2); + if (RFIFOB(fd,11)) mapif->account_reg_reply(fd,RFIFOL(fd,2),RFIFOL(fd,6),2); //Ask Login Server for Account2 values. - if (RFIFOB(fd,10)) request_accreg2(RFIFOL(fd,2),RFIFOL(fd,6)); + if (RFIFOB(fd,10)) chr->request_accreg2(RFIFOL(fd,2),RFIFOL(fd,6)); return 1; } -static void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, char *name) +void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, const char *const name) { WFIFOHEAD(fd, NAME_LENGTH+13); WFIFOW(fd, 0) = 0x3806; @@ -1393,13 +1397,13 @@ int mapif_parse_NameChangeRequest(int fd) if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorized for (i = 0; i < NAME_LENGTH && name[i]; i++) if (strchr(char_name_letters, name[i]) == NULL) { - mapif_namechange_ack(fd, account_id, char_id, type, 0, name); + mapif->namechange_ack(fd, account_id, char_id, type, 0, name); return 0; } } else if (char_name_option == 2) { // letters/symbols in char_name_letters are forbidden for (i = 0; i < NAME_LENGTH && name[i]; i++) if (strchr(char_name_letters, name[i]) != NULL) { - mapif_namechange_ack(fd, account_id, char_id, type, 0, name); + mapif->namechange_ack(fd, account_id, char_id, type, 0, name); return 0; } } @@ -1408,7 +1412,7 @@ int mapif_parse_NameChangeRequest(int fd) //updated here, because changing it on the map won't make it be saved [Skotlex] //name allowed. - mapif_namechange_ack(fd, account_id, char_id, type, 1, name); + mapif->namechange_ack(fd, account_id, char_id, type, 1, name); return 0; } @@ -1443,30 +1447,30 @@ int inter_parse_frommap(int fd) return 0; // Check packet length - if((len = inter_check_length(fd, inter_recv_packet_length[cmd - 0x3000])) == 0) + if((len = inter->check_length(fd, inter_recv_packet_length[cmd - 0x3000])) == 0) return 2; switch(cmd) { - case 0x3000: mapif_parse_broadcast(fd); break; - case 0x3001: mapif_parse_WisRequest(fd); break; - case 0x3002: mapif_parse_WisReply(fd); break; - case 0x3003: mapif_parse_WisToGM(fd); break; - case 0x3004: mapif_parse_Registry(fd); break; - case 0x3005: mapif_parse_RegistryRequest(fd); break; - case 0x3006: mapif_parse_NameChangeRequest(fd); break; - case 0x3007: mapif_parse_accinfo(fd); break; + case 0x3000: mapif->parse_broadcast(fd); break; + case 0x3001: mapif->parse_WisRequest(fd); break; + case 0x3002: mapif->parse_WisReply(fd); break; + case 0x3003: mapif->parse_WisToGM(fd); break; + case 0x3004: mapif->parse_Registry(fd); break; + case 0x3005: mapif->parse_RegistryRequest(fd); break; + case 0x3006: mapif->parse_NameChangeRequest(fd); break; + case 0x3007: mapif->parse_accinfo(fd); break; /* 0x3008 is used by the report stuff */ default: - if( inter_party_parse_frommap(fd) - || inter_guild_parse_frommap(fd) - || inter_storage_parse_frommap(fd) - || inter_pet_parse_frommap(fd) - || inter_homunculus_parse_frommap(fd) - || inter_mercenary_parse_frommap(fd) - || inter_elemental_parse_frommap(fd) - || inter_mail_parse_frommap(fd) - || inter_auction_parse_frommap(fd) - || inter_quest_parse_frommap(fd) + if( inter_party->parse_frommap(fd) + || inter_guild->parse_frommap(fd) + || inter_storage->parse_frommap(fd) + || inter_pet->parse_frommap(fd) + || inter_homunculus->parse_frommap(fd) + || inter_mercenary->parse_frommap(fd) + || inter_elemental->parse_frommap(fd) + || inter_mail->parse_frommap(fd) + || inter_auction->parse_frommap(fd) + || inter_quest->parse_frommap(fd) ) break; else @@ -1477,4 +1481,28 @@ int inter_parse_frommap(int fd) return 1; } - +void inter_defaults(void) +{ + inter = &inter_s; + + inter->sql_handle = NULL; + + inter->msg_txt = inter_msg_txt; + inter->msg_config_read = inter_msg_config_read; + inter->do_final_msg = inter_do_final_msg; + inter->job_name = inter_job_name; + inter->vmsg_to_fd = inter_vmsg_to_fd; + inter->msg_to_fd = inter_msg_to_fd; + inter->savereg = inter_savereg; + inter->accreg_fromsql = inter_accreg_fromsql; + inter->config_read = inter_config_read; + inter->vlog = inter_vlog; + inter->log = inter_log; + inter->init_sql = inter_init_sql; + inter->mapif_init = inter_mapif_init; + inter->check_ttl_wisdata_sub = inter_check_ttl_wisdata_sub; + inter->check_ttl_wisdata = inter->check_ttl_wisdata; + inter->check_length = inter_check_length; + inter->parse_frommap = inter_parse_frommap; + inter->final = inter_final; +} diff --git a/src/char/inter.h b/src/char/inter.h index d7d7c3c2b..f15c8b0f7 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -11,24 +11,37 @@ struct accreg; -int inter_init_sql(const char *file); -void inter_final(void); -int inter_parse_frommap(int fd); -int inter_mapif_init(int fd); -int mapif_send_gmaccounts(void); -int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason); -void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); - -int inter_log(char *fmt, ...) __attribute__((format(printf, 1, 2))); -int inter_vlog(char *fmt, va_list ap); - #define inter_cfgName "conf/inter-server.conf" extern unsigned int party_share_level; -extern Sql* sql_handle; -extern Sql* lsql_handle; - -int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type); +void inter_defaults(void); + +/** + * inter interface + **/ +struct inter_interface { + Sql* sql_handle; + const char* (*msg_txt) (int msg_number); + bool (*msg_config_read) (const char *cfg_name, bool allow_override); + void (*do_final_msg) (void); + const char* (*job_name) (int class_); + void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap); + void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...); + void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string); + int (*accreg_fromsql) (int account_id,int char_id, int fd, int type); + int (*config_read) (const char* cfgName); + int (*vlog) (char* fmt, va_list ap); + int (*log) (char* fmt, ...); + int (*init_sql) (const char *file); + int (*mapif_init) (int fd); + int (*check_ttl_wisdata_sub) (DBKey key, DBData *data, va_list ap); + int (*check_ttl_wisdata) (void); + int (*check_length) (int fd, int length); + int (*parse_frommap) (int fd); + void (*final) (void); +}; + +struct inter_interface *inter; #endif /* CHAR_INTER_H */ diff --git a/src/char/loginif.c b/src/char/loginif.c new file mode 100644 index 000000000..4026d1f7d --- /dev/null +++ b/src/char/loginif.c @@ -0,0 +1,45 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + +#define HERCULES_CORE + +#include "loginif.h" + +#include <stdlib.h> + +#include "char.h" +#include "../common/cbasetypes.h" +#include "../common/mmo.h" +#include "../common/random.h" +#include "../common/showmsg.h" +#include "../common/socket.h" +#include "../common/strlib.h" + +void loginif_reset(void); +void loginif_check_shutdown(void); +void loginif_on_disconnect(void); +void loginif_on_ready(void); +void loginif_block_account(int account_id, int flag); +void loginif_ban_account(int account_id, short year, short month, short day, short hour, short minute, short second); +void loginif_unban_account(int account_id); +void loginif_changesex(int account_id); +void loginif_auth(int fd, struct char_session_data* sd, uint32 ipl); +void loginif_send_users_count(int users); +void loginif_connect_to_server(void); + +void loginif_defaults(void) { + loginif = &loginif_s; + + loginif->reset = loginif_reset; + loginif->check_shutdown = loginif_check_shutdown; + loginif->on_disconnect = loginif_on_disconnect; + loginif->on_ready = loginif_on_ready; + loginif->block_account = loginif_block_account; + loginif->ban_account = loginif_ban_account; + loginif->unban_account = loginif_unban_account; + loginif->changesex = loginif_changesex; + loginif->auth = loginif_auth; + loginif->send_users_count = loginif_send_users_count; + loginif->connect_to_server = loginif_connect_to_server; +} diff --git a/src/char/loginif.h b/src/char/loginif.h new file mode 100644 index 000000000..374adbcac --- /dev/null +++ b/src/char/loginif.h @@ -0,0 +1,31 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + +#ifndef CHAR_LOGINIF_H +#define CHAR_LOGINIF_H + +#include "char.h" + +/** + * loginif interface + **/ +struct loginif_interface { + void (*reset) (void); + void (*check_shutdown) (void); + void (*on_disconnect) (void); + void (*on_ready) (void); + void (*block_account) (int account_id, int flag); + void (*ban_account) (int account_id, short year, short month, short day, short hour, short minute, short second); + void (*unban_account) (int account_id); + void (*changesex) (int account_id); + void (*auth) (int fd, struct char_session_data* sd, uint32 ipl); + void (*send_users_count) (int users); + void (*connect_to_server) (void); +} loginif_s; + +struct loginif_interface *loginif; + +void loginif_defaults(void); + +#endif /* CHAR_LOGINIF_H */ diff --git a/src/char/mapif.c b/src/char/mapif.c new file mode 100644 index 000000000..1cd4c3ea5 --- /dev/null +++ b/src/char/mapif.c @@ -0,0 +1,360 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + +#define HERCULES_CORE + +#include "mapif.h" + +#include <stdlib.h> + +#include "char.h" +#include "int_auction.h" +#include "int_homun.h" +#include "int_guild.h" +#include "../common/cbasetypes.h" +#include "../common/mmo.h" +#include "../common/random.h" +#include "../common/showmsg.h" +#include "../common/socket.h" +#include "../common/strlib.h" + +void mapif_ban(int id, unsigned int flag, int status); +void mapif_server_init(int id); +void mapif_server_destroy(int id); +void mapif_server_reset(int id); +void mapif_on_disconnect(int id); +void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd); +void mapif_char_ban(int char_id, time_t timestamp); +int mapif_sendall(unsigned char *buf, unsigned int len); +int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len); +int mapif_send(int fd, unsigned char *buf, unsigned int len); +void mapif_send_users_count(int users); +void mapif_auction_message(int char_id, unsigned char result); +void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf); +void mapif_parse_auction_requestlist(int fd); +void mapif_auction_register(int fd, struct auction_data *auction); +void mapif_parse_auction_register(int fd); +void mapif_auction_cancel(int fd, int char_id, unsigned char result); +void mapif_parse_auction_cancel(int fd); +void mapif_auction_close(int fd, int char_id, unsigned char result); +void mapif_parse_auction_close(int fd); +void mapif_auction_bid(int fd, int char_id, int bid, unsigned char result); +void mapif_parse_auction_bid(int fd); +bool mapif_elemental_save(struct s_elemental* ele); +bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele); +bool mapif_elemental_delete(int ele_id); +void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag); +void mapif_parse_elemental_create(int fd, struct s_elemental* ele); +void mapif_parse_elemental_load(int fd, int ele_id, int char_id); +void mapif_elemental_deleted(int fd, unsigned char flag); +void mapif_parse_elemental_delete(int fd, int ele_id); +void mapif_elemental_saved(int fd, unsigned char flag); +void mapif_parse_elemental_save(int fd, struct s_elemental* ele); +int mapif_guild_created(int fd, int account_id, struct guild *g); +int mapif_guild_noinfo(int fd, int guild_id); +int mapif_guild_info(int fd, struct guild *g); +int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, int flag); +int mapif_guild_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); +int mapif_guild_memberinfoshort(struct guild *g, int idx); +int mapif_guild_broken(int guild_id, int flag); +int mapif_guild_message(int guild_id,int account_id,char *mes,int len, int sfd); +int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int len); +int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len); +int mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id); +int mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); +int mapif_guild_position(struct guild *g, int idx); +int mapif_guild_notice(struct guild *g); +int mapif_guild_emblem(struct guild *g); +int mapif_guild_master_changed(struct guild *g, int aid, int cid); +int mapif_guild_castle_dataload(int fd, int sz, int *castle_ids); +int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member *master); +int mapif_parse_GuildInfo(int fd, int guild_id); +int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m); +int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); +int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); +int mapif_parse_BreakGuild(int fd, int guild_id); +int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, char *mes, int len); +int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len); +int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); +int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p); +int mapif_parse_GuildSkillUp(int fd, int guild_id, uint16 skill_id, int account_id, int max); +int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag); +int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); +int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2); +int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data); +int mapif_parse_GuildCastleDataLoad(int fd, int len, int *castle_ids); +int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value); +int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len); +void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag); +void mapif_homunculus_deleted(int fd, int flag); +void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd); +void mapif_homunculus_saved(int fd, int account_id, bool flag); +void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char* name); +bool mapif_homunculus_save(struct s_homunculus* hd); +bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd); +bool mapif_homunculus_delete(int homun_id); +bool mapif_homunculus_rename(char *name); +void mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus* phd); +void mapif_parse_homunculus_delete(int fd, int homun_id); +void mapif_parse_homunculus_load(int fd, int account_id, int homun_id); +void mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus* phd); +void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char* name); +void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md); +void mapif_parse_mail_requestinbox(int fd); +void mapif_parse_mail_read(int fd); +void mapif_mail_sendattach(int fd, int char_id, struct mail_message *msg); +void mapif_mail_getattach(int fd, int char_id, int mail_id); +void mapif_parse_mail_getattach(int fd); +void mapif_mail_delete(int fd, int char_id, int mail_id, bool failed); +void mapif_parse_mail_delete(int fd); +void mapif_mail_new(struct mail_message *msg); +void mapif_mail_return(int fd, int char_id, int mail_id, int new_mail); +void mapif_parse_mail_return(int fd); +void mapif_mail_send(int fd, struct mail_message* msg); +void mapif_parse_mail_send(int fd); +bool mapif_mercenary_save(struct s_mercenary* merc); +bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc); +bool mapif_mercenary_delete(int merc_id); +void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag); +void mapif_parse_mercenary_create(int fd, struct s_mercenary* merc); +void mapif_parse_mercenary_load(int fd, int merc_id, int char_id); +void mapif_mercenary_deleted(int fd, unsigned char flag); +void mapif_parse_mercenary_delete(int fd, int merc_id); +void mapif_mercenary_saved(int fd, unsigned char flag); +void mapif_parse_mercenary_save(int fd, struct s_mercenary* merc); +int mapif_party_created(int fd, int account_id, int char_id, struct party *p); +void mapif_party_noinfo(int fd, int party_id, int char_id); +void mapif_party_info(int fd, struct party* p, int char_id); +int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag); +int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag); +int mapif_party_withdraw(int party_id,int account_id, int char_id); +int mapif_party_membermoved(struct party *p, int idx); +int mapif_party_broken(int party_id, int flag); +int mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd); +int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader); +void mapif_parse_PartyInfo(int fd, int party_id, int char_id); +int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member); +int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int item); +int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id); +int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); +int mapif_parse_BreakParty(int fd, int party_id); +int mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len); +int mapif_parse_PartyLeaderChange(int fd, int party_id, int account_id, int char_id); +int mapif_pet_created(int fd, int account_id, struct s_pet *p); +int mapif_pet_info(int fd, int account_id, struct s_pet *p); +int mapif_pet_noinfo(int fd, int account_id); +int mapif_save_pet_ack(int fd, int account_id, int flag); +int mapif_delete_pet_ack(int fd, int flag); +int mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); +int mapif_load_pet(int fd, int account_id, int char_id, int pet_id); +int mapif_save_pet(int fd, int account_id, struct s_pet *data); +int mapif_delete_pet(int fd, int pet_id); +int mapif_parse_CreatePet(int fd); +int mapif_parse_LoadPet(int fd); +int mapif_parse_SavePet(int fd); +int mapif_parse_DeletePet(int fd); +struct quest *mapif_quests_fromsql(int char_id, int *count); +bool mapif_quest_delete(int char_id, int quest_id); +bool mapif_quest_add(int char_id, struct quest qd); +bool mapif_quest_update(int char_id, struct quest qd); +void mapif_quest_save_ack(int fd, int char_id, bool success); +int mapif_parse_quest_save(int fd); +void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests); +int mapif_parse_quest_load(int fd); +int mapif_load_guild_storage(int fd,int account_id,int guild_id, char flag); +int mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail); +int mapif_parse_LoadGuildStorage(int fd); +int mapif_parse_SaveGuildStorage(int fd); +int mapif_itembound_ack(int fd, int aid, int guild_id); +int mapif_parse_ItemBoundRetrieve_sub(int fd); +void mapif_parse_ItemBoundRetrieve(int fd); +void mapif_parse_accinfo(int fd); +void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); +int mapif_broadcast(unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); +int mapif_wis_message(struct WisData *wd); +void mapif_wis_response(int fd, unsigned char *src, int flag); +int mapif_wis_end(struct WisData *wd, int flag); +int mapif_account_reg_reply(int fd,int account_id,int char_id, int type); +int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason); +int mapif_parse_broadcast(int fd); +int mapif_parse_WisRequest(int fd); +int mapif_parse_WisReply(int fd); +int mapif_parse_WisToGM(int fd); +int mapif_parse_Registry(int fd); +int mapif_parse_RegistryRequest(int fd); +void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, const char *const name); +int mapif_parse_NameChangeRequest(int fd); + +void mapif_defaults(void) { + mapif = &mapif_s; + + mapif->ban = mapif_ban; + mapif->server_init = mapif_server_init; + mapif->server_destroy = mapif_server_destroy; + mapif->server_reset = mapif_server_reset; + mapif->on_disconnect = mapif_on_disconnect; + mapif->on_parse_accinfo = mapif_on_parse_accinfo; + mapif->char_ban = mapif_char_ban; + mapif->sendall = mapif_sendall; + mapif->sendallwos = mapif_sendallwos; + mapif->send = mapif_send; + mapif->send_users_count = mapif_send_users_count; + mapif->auction_message = mapif_auction_message; + mapif->auction_sendlist = mapif_auction_sendlist; + mapif->parse_auction_requestlist = mapif_parse_auction_requestlist; + mapif->auction_register = mapif_auction_register; + mapif->parse_auction_register = mapif_parse_auction_register; + mapif->auction_cancel = mapif_auction_cancel; + mapif->parse_auction_cancel = mapif_parse_auction_cancel; + mapif->auction_close = mapif_auction_close; + mapif->parse_auction_close = mapif_parse_auction_close; + mapif->auction_bid = mapif_auction_bid; + mapif->parse_auction_bid = mapif_parse_auction_bid; + mapif->elemental_save = mapif_elemental_save; + mapif->elemental_load = mapif_elemental_load; + mapif->elemental_delete = mapif_elemental_delete; + mapif->elemental_send = mapif_elemental_send; + mapif->parse_elemental_create = mapif_parse_elemental_create; + mapif->parse_elemental_load = mapif_parse_elemental_load; + mapif->elemental_deleted = mapif_elemental_deleted; + mapif->parse_elemental_delete = mapif_parse_elemental_delete; + mapif->elemental_saved = mapif_elemental_saved; + mapif->parse_elemental_save = mapif_parse_elemental_save; + mapif->guild_created = mapif_guild_created; + mapif->guild_noinfo = mapif_guild_noinfo; + mapif->guild_info = mapif_guild_info; + mapif->guild_memberadded = mapif_guild_memberadded; + mapif->guild_withdraw = mapif_guild_withdraw; + mapif->guild_memberinfoshort = mapif_guild_memberinfoshort; + mapif->guild_broken = mapif_guild_broken; + mapif->guild_message = mapif_guild_message; + mapif->guild_basicinfochanged = mapif_guild_basicinfochanged; + mapif->guild_memberinfochanged = mapif_guild_memberinfochanged; + mapif->guild_skillupack = mapif_guild_skillupack; + mapif->guild_alliance = mapif_guild_alliance; + mapif->guild_position = mapif_guild_position; + mapif->guild_notice = mapif_guild_notice; + mapif->guild_emblem = mapif_guild_emblem; + mapif->guild_master_changed = mapif_guild_master_changed; + mapif->guild_castle_dataload = mapif_guild_castle_dataload; + mapif->parse_CreateGuild = mapif_parse_CreateGuild; + mapif->parse_GuildInfo = mapif_parse_GuildInfo; + mapif->parse_GuildAddMember = mapif_parse_GuildAddMember; + mapif->parse_GuildLeave = mapif_parse_GuildLeave; + mapif->parse_GuildChangeMemberInfoShort = mapif_parse_GuildChangeMemberInfoShort; + mapif->parse_BreakGuild = mapif_parse_BreakGuild; + mapif->parse_GuildMessage = mapif_parse_GuildMessage; + mapif->parse_GuildBasicInfoChange = mapif_parse_GuildBasicInfoChange; + mapif->parse_GuildMemberInfoChange = mapif_parse_GuildMemberInfoChange; + mapif->parse_GuildPosition = mapif_parse_GuildPosition; + mapif->parse_GuildSkillUp = mapif_parse_GuildSkillUp; + mapif->parse_GuildDeleteAlliance = mapif_parse_GuildDeleteAlliance; + mapif->parse_GuildAlliance = mapif_parse_GuildAlliance; + mapif->parse_GuildNotice = mapif_parse_GuildNotice; + mapif->parse_GuildEmblem = mapif_parse_GuildEmblem; + mapif->parse_GuildCastleDataLoad = mapif_parse_GuildCastleDataLoad; + mapif->parse_GuildCastleDataSave = mapif_parse_GuildCastleDataSave; + mapif->parse_GuildMasterChange = mapif_parse_GuildMasterChange; + mapif->homunculus_created = mapif_homunculus_created; + mapif->homunculus_deleted = mapif_homunculus_deleted; + mapif->homunculus_loaded = mapif_homunculus_loaded; + mapif->homunculus_saved = mapif_homunculus_saved; + mapif->homunculus_renamed = mapif_homunculus_renamed; + mapif->homunculus_save = mapif_homunculus_save; + mapif->homunculus_load = mapif_homunculus_load; + mapif->homunculus_delete = mapif_homunculus_delete; + mapif->homunculus_rename = mapif_homunculus_rename; + mapif->parse_homunculus_create = mapif_parse_homunculus_create; + mapif->parse_homunculus_delete = mapif_parse_homunculus_delete; + mapif->parse_homunculus_load = mapif_parse_homunculus_load; + mapif->parse_homunculus_save = mapif_parse_homunculus_save; + mapif->parse_homunculus_rename = mapif_parse_homunculus_rename; + mapif->mail_sendinbox = mapif_mail_sendinbox; + mapif->parse_mail_requestinbox = mapif_parse_mail_requestinbox; + mapif->parse_mail_read = mapif_parse_mail_read; + mapif->mail_sendattach = mapif_mail_sendattach; + mapif->mail_getattach = mapif_mail_getattach; + mapif->parse_mail_getattach = mapif_parse_mail_getattach; + mapif->mail_delete = mapif_mail_delete; + mapif->parse_mail_delete = mapif_parse_mail_delete; + mapif->mail_new = mapif_mail_new; + mapif->mail_return = mapif_mail_return; + mapif->parse_mail_return = mapif_parse_mail_return; + mapif->mail_send = mapif_mail_send; + mapif->parse_mail_send = mapif_parse_mail_send; + mapif->mercenary_save = mapif_mercenary_save; + mapif->mercenary_load = mapif_mercenary_load; + mapif->mercenary_delete = mapif_mercenary_delete; + mapif->mercenary_send = mapif_mercenary_send; + mapif->parse_mercenary_create = mapif_parse_mercenary_create; + mapif->parse_mercenary_load = mapif_parse_mercenary_load; + mapif->mercenary_deleted = mapif_mercenary_deleted; + mapif->parse_mercenary_delete = mapif_parse_mercenary_delete; + mapif->mercenary_saved = mapif_mercenary_saved; + mapif->parse_mercenary_save = mapif_parse_mercenary_save; + mapif->party_created = mapif_party_created; + mapif->party_noinfo = mapif_party_noinfo; + mapif->party_info = mapif_party_info; + mapif->party_memberadded = mapif_party_memberadded; + mapif->party_optionchanged = mapif_party_optionchanged; + mapif->party_withdraw = mapif_party_withdraw; + mapif->party_membermoved = mapif_party_membermoved; + mapif->party_broken = mapif_party_broken; + mapif->party_message = mapif_party_message; + mapif->parse_CreateParty = mapif_parse_CreateParty; + mapif->parse_PartyInfo = mapif_parse_PartyInfo; + mapif->parse_PartyAddMember = mapif_parse_PartyAddMember; + mapif->parse_PartyChangeOption = mapif_parse_PartyChangeOption; + mapif->parse_PartyLeave = mapif_parse_PartyLeave; + mapif->parse_PartyChangeMap = mapif_parse_PartyChangeMap; + mapif->parse_BreakParty = mapif_parse_BreakParty; + mapif->parse_PartyMessage = mapif_parse_PartyMessage; + mapif->parse_PartyLeaderChange = mapif_parse_PartyLeaderChange; + mapif->pet_created = mapif_pet_created; + mapif->pet_info = mapif_pet_info; + mapif->pet_noinfo = mapif_pet_noinfo; + mapif->save_pet_ack = mapif_save_pet_ack; + mapif->delete_pet_ack = mapif_delete_pet_ack; + mapif->create_pet = mapif_create_pet; + mapif->load_pet = mapif_load_pet; + mapif->save_pet = mapif_save_pet; + mapif->delete_pet = mapif_delete_pet; + mapif->parse_CreatePet = mapif_parse_CreatePet; + mapif->parse_LoadPet = mapif_parse_LoadPet; + mapif->parse_SavePet = mapif_parse_SavePet; + mapif->parse_DeletePet = mapif_parse_DeletePet; + mapif->quests_fromsql = mapif_quests_fromsql; + mapif->quest_delete = mapif_quest_delete; + mapif->quest_add = mapif_quest_add; + mapif->quest_update = mapif_quest_update; + mapif->quest_save_ack = mapif_quest_save_ack; + mapif->parse_quest_save = mapif_parse_quest_save; + mapif->send_quests = mapif_send_quests; + mapif->parse_quest_load = mapif_parse_quest_load; + mapif->load_guild_storage = mapif_load_guild_storage; + mapif->save_guild_storage_ack = mapif_save_guild_storage_ack; + mapif->parse_LoadGuildStorage = mapif_parse_LoadGuildStorage; + mapif->parse_SaveGuildStorage = mapif_parse_SaveGuildStorage; + mapif->itembound_ack = mapif_itembound_ack; + mapif->parse_ItemBoundRetrieve_sub = mapif_parse_ItemBoundRetrieve_sub; + mapif->parse_ItemBoundRetrieve = mapif_parse_ItemBoundRetrieve; + mapif->parse_accinfo = mapif_parse_accinfo; + mapif->parse_accinfo2 = mapif_parse_accinfo2; + mapif->broadcast = mapif_broadcast; + mapif->wis_message = mapif_wis_message; + mapif->wis_response = mapif_wis_response; + mapif->wis_end = mapif_wis_end; + mapif->account_reg_reply = mapif_account_reg_reply; + mapif->disconnectplayer = mapif_disconnectplayer; + mapif->parse_broadcast = mapif_parse_broadcast; + mapif->parse_WisRequest = mapif_parse_WisRequest; + mapif->parse_WisReply = mapif_parse_WisReply; + mapif->parse_WisToGM = mapif_parse_WisToGM; + mapif->parse_Registry = mapif_parse_Registry; + mapif->parse_RegistryRequest = mapif_parse_RegistryRequest; + mapif->namechange_ack = mapif_namechange_ack; + mapif->parse_NameChangeRequest = mapif_parse_NameChangeRequest; +} diff --git a/src/char/mapif.h b/src/char/mapif.h new file mode 100644 index 000000000..dcb60d547 --- /dev/null +++ b/src/char/mapif.h @@ -0,0 +1,198 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + +#ifndef CHAR_MAPIF_H +#define CHAR_MAPIF_H + +#include "char.h" + +struct s_elemental; +struct s_homunculus; +struct s_mercenary; +struct s_pet; +struct guild_storage; +struct storage_data; +struct quest; +struct mail_message; +struct WisData; + +/** + * mapif interface + **/ +struct mapif_interface { + void (*ban) (int id, unsigned int flag, int status); + void (*server_init) (int id); + void (*server_destroy) (int id); + void (*server_reset) (int id); + void (*on_disconnect) (int id); + void (*on_parse_accinfo) (int account_id, int u_fd, int u_aid, int u_group, int map_fd); + void (*char_ban) (int char_id, time_t timestamp); + int (*sendall) (unsigned char *buf, unsigned int len); + int (*sendallwos) (int sfd, unsigned char *buf, unsigned int len); + int (*send) (int fd, unsigned char *buf, unsigned int len); + void (*send_users_count) (int users); + void (*auction_message) (int char_id, unsigned char result); + void (*auction_sendlist) (int fd, int char_id, short count, short pages, unsigned char *buf); + void (*parse_auction_requestlist) (int fd); + void (*auction_register) (int fd, struct auction_data *auction); + void (*parse_auction_register) (int fd); + void (*auction_cancel) (int fd, int char_id, unsigned char result); + void (*parse_auction_cancel) (int fd); + void (*auction_close) (int fd, int char_id, unsigned char result); + void (*parse_auction_close) (int fd); + void (*auction_bid) (int fd, int char_id, int bid, unsigned char result); + void (*parse_auction_bid) (int fd); + bool (*elemental_save) (struct s_elemental* ele); + bool (*elemental_load) (int ele_id, int char_id, struct s_elemental *ele); + bool (*elemental_delete) (int ele_id); + void (*elemental_send) (int fd, struct s_elemental *ele, unsigned char flag); + void (*parse_elemental_create) (int fd, struct s_elemental* ele); + void (*parse_elemental_load) (int fd, int ele_id, int char_id); + void (*elemental_deleted) (int fd, unsigned char flag); + void (*parse_elemental_delete) (int fd, int ele_id); + void (*elemental_saved) (int fd, unsigned char flag); + void (*parse_elemental_save) (int fd, struct s_elemental* ele); + int (*guild_created) (int fd, int account_id, struct guild *g); + int (*guild_noinfo) (int fd, int guild_id); + int (*guild_info) (int fd, struct guild *g); + int (*guild_memberadded) (int fd, int guild_id, int account_id, int char_id, int flag); + int (*guild_withdraw) (int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes); + int (*guild_memberinfoshort) (struct guild *g, int idx); + int (*guild_broken) (int guild_id, int flag); + int (*guild_message) (int guild_id,int account_id,char *mes,int len, int sfd); + int (*guild_basicinfochanged) (int guild_id, int type, const void *data, int len); + int (*guild_memberinfochanged) (int guild_id, int account_id, int char_id, int type, const void *data, int len); + int (*guild_skillupack) (int guild_id, uint16 skill_id, int account_id); + int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2); + int (*guild_position) (struct guild *g, int idx); + int (*guild_notice) (struct guild *g); + int (*guild_emblem) (struct guild *g); + int (*guild_master_changed) (struct guild *g, int aid, int cid); + int (*guild_castle_dataload) (int fd, int sz, int *castle_ids); + int (*parse_CreateGuild) (int fd,int account_id,char *name,struct guild_member *master); + int (*parse_GuildInfo) (int fd, int guild_id); + int (*parse_GuildAddMember) (int fd, int guild_id, struct guild_member *m); + int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes); + int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_); + int (*parse_BreakGuild) (int fd, int guild_id); + int (*parse_GuildMessage) (int fd, int guild_id, int account_id, char *mes, int len); + int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len); + int (*parse_GuildMemberInfoChange) (int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len); + int (*parse_GuildPosition) (int fd, int guild_id, int idx, struct guild_position *p); + int (*parse_GuildSkillUp) (int fd, int guild_id, uint16 skill_id, int account_id, int max); + int (*parse_GuildDeleteAlliance) (struct guild *g, int guild_id, int account_id1, int account_id2, int flag); + int (*parse_GuildAlliance) (int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag); + int (*parse_GuildNotice) (int fd, int guild_id, const char *mes1, const char *mes2); + int (*parse_GuildEmblem) (int fd, int len, int guild_id, int dummy, const char *data); + int (*parse_GuildCastleDataLoad) (int fd, int len, int *castle_ids); + int (*parse_GuildCastleDataSave) (int fd, int castle_id, int index, int value); + int (*parse_GuildMasterChange) (int fd, int guild_id, const char* name, int len); + void (*homunculus_created) (int fd, int account_id, struct s_homunculus *sh, unsigned char flag); + void (*homunculus_deleted) (int fd, int flag); + void (*homunculus_loaded) (int fd, int account_id, struct s_homunculus *hd); + void (*homunculus_saved) (int fd, int account_id, bool flag); + void (*homunculus_renamed) (int fd, int account_id, int char_id, unsigned char flag, char* name); + bool (*homunculus_save) (struct s_homunculus* hd); + bool (*homunculus_load) (int homun_id, struct s_homunculus* hd); + bool (*homunculus_delete) (int homun_id); + bool (*homunculus_rename) (char *name); + void (*parse_homunculus_create) (int fd, int len, int account_id, struct s_homunculus* phd); + void (*parse_homunculus_delete) (int fd, int homun_id); + void (*parse_homunculus_load) (int fd, int account_id, int homun_id); + void (*parse_homunculus_save) (int fd, int len, int account_id, struct s_homunculus* phd); + void (*parse_homunculus_rename) (int fd, int account_id, int char_id, char* name); + void (*mail_sendinbox) (int fd, int char_id, unsigned char flag, struct mail_data *md); + void (*parse_mail_requestinbox) (int fd); + void (*parse_mail_read) (int fd); + void (*mail_sendattach) (int fd, int char_id, struct mail_message *msg); + void (*mail_getattach) (int fd, int char_id, int mail_id); + void (*parse_mail_getattach) (int fd); + void (*mail_delete) (int fd, int char_id, int mail_id, bool failed); + void (*parse_mail_delete) (int fd); + void (*mail_new) (struct mail_message *msg); + void (*mail_return) (int fd, int char_id, int mail_id, int new_mail); + void (*parse_mail_return) (int fd); + void (*mail_send) (int fd, struct mail_message* msg); + void (*parse_mail_send) (int fd); + bool (*mercenary_save) (struct s_mercenary* merc); + bool (*mercenary_load) (int merc_id, int char_id, struct s_mercenary *merc); + bool (*mercenary_delete) (int merc_id); + void (*mercenary_send) (int fd, struct s_mercenary *merc, unsigned char flag); + void (*parse_mercenary_create) (int fd, struct s_mercenary* merc); + void (*parse_mercenary_load) (int fd, int merc_id, int char_id); + void (*mercenary_deleted) (int fd, unsigned char flag); + void (*parse_mercenary_delete) (int fd, int merc_id); + void (*mercenary_saved) (int fd, unsigned char flag); + void (*parse_mercenary_save) (int fd, struct s_mercenary* merc); + int (*party_created) (int fd, int account_id, int char_id, struct party *p); + void (*party_noinfo) (int fd, int party_id, int char_id); + void (*party_info) (int fd, struct party* p, int char_id); + int (*party_memberadded) (int fd, int party_id, int account_id, int char_id, int flag); + int (*party_optionchanged) (int fd, struct party *p, int account_id, int flag); + int (*party_withdraw) (int party_id,int account_id, int char_id); + int (*party_membermoved) (struct party *p, int idx); + int (*party_broken) (int party_id, int flag); + int (*party_message) (int party_id, int account_id, char *mes, int len, int sfd); + int (*parse_CreateParty) (int fd, char *name, int item, int item2, struct party_member *leader); + void (*parse_PartyInfo) (int fd, int party_id, int char_id); + int (*parse_PartyAddMember) (int fd, int party_id, struct party_member *member); + int (*parse_PartyChangeOption) (int fd,int party_id,int account_id,int exp,int item); + int (*parse_PartyLeave) (int fd, int party_id, int account_id, int char_id); + int (*parse_PartyChangeMap) (int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv); + int (*parse_BreakParty) (int fd, int party_id); + int (*parse_PartyMessage) (int fd, int party_id, int account_id, char *mes, int len); + int (*parse_PartyLeaderChange) (int fd, int party_id, int account_id, int char_id); + int (*pet_created) (int fd, int account_id, struct s_pet *p); + int (*pet_info) (int fd, int account_id, struct s_pet *p); + int (*pet_noinfo) (int fd, int account_id); + int (*save_pet_ack) (int fd, int account_id, int flag); + int (*delete_pet_ack) (int fd, int flag); + int (*create_pet) (int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, + short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); + int (*load_pet) (int fd, int account_id, int char_id, int pet_id); + int (*save_pet) (int fd, int account_id, struct s_pet *data); + int (*delete_pet) (int fd, int pet_id); + int (*parse_CreatePet) (int fd); + int (*parse_LoadPet) (int fd); + int (*parse_SavePet) (int fd); + int (*parse_DeletePet) (int fd); + struct quest *(*quests_fromsql) (int char_id, int *count); + bool (*quest_delete) (int char_id, int quest_id); + bool (*quest_add) (int char_id, struct quest qd); + bool (*quest_update) (int char_id, struct quest qd); + void (*quest_save_ack) (int fd, int char_id, bool success); + int (*parse_quest_save) (int fd); + void (*send_quests) (int fd, int char_id, struct quest *tmp_questlog, int num_quests); + int (*parse_quest_load) (int fd); + int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag); + int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail); + int (*parse_LoadGuildStorage) (int fd); + int (*parse_SaveGuildStorage) (int fd); + int (*itembound_ack) (int fd, int aid, int guild_id); + int (*parse_ItemBoundRetrieve_sub) (int fd); + void (*parse_ItemBoundRetrieve) (int fd); + void (*parse_accinfo) (int fd); + void (*parse_accinfo2) (bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, + const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state); + int (*broadcast) (unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd); + int (*wis_message) (struct WisData *wd); + void (*wis_response) (int fd, unsigned char *src, int flag); + int (*wis_end) (struct WisData *wd, int flag); + int (*account_reg_reply) (int fd,int account_id,int char_id, int type); + int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); + int (*parse_broadcast) (int fd); + int (*parse_WisRequest) (int fd); + int (*parse_WisReply) (int fd); + int (*parse_WisToGM) (int fd); + int (*parse_Registry) (int fd); + int (*parse_RegistryRequest) (int fd); + void (*namechange_ack) (int fd, int account_id, int char_id, int type, int flag, const char *name); + int (*parse_NameChangeRequest) (int fd); +} mapif_s; + +struct mapif_interface *mapif; + +void mapif_defaults(void); + +#endif /* CHAR_MAPIF_H */ diff --git a/src/char/pincode.c b/src/char/pincode.c index 18ad0ffc8..c8a76719f 100644 --- a/src/char/pincode.c +++ b/src/char/pincode.c @@ -16,14 +16,15 @@ #include "../common/socket.h" #include "../common/strlib.h" -int enabled = PINCODE_OK; -int changetime = 0; -int maxtry = 3; -int charselect = 0; -unsigned int multiplier = 0x3498, baseSeed = 0x881234; +int pincode_enabled = PINCODE_OK; +int pincode_changetime = 0; +int pincode_maxtry = 3; +int pincode_charselect = 0; +unsigned int pincode_multiplier = 0x3498; +unsigned int pincode_baseSeed = 0x881234; void pincode_handle ( int fd, struct char_session_data* sd ) { - struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, sd->account_id); + struct online_char_data* character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); if( character && character->pincode_enable > *pincode->charselect ){ character->pincode_enable = *pincode->charselect * 2; @@ -52,7 +53,7 @@ void pincode_check(int fd, struct char_session_data* sd) { pincode->decrypt(sd->pincode_seed, pin); if( pincode->compare( fd, sd, pin ) ){ struct online_char_data* character; - if( (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) ) + if( (character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id)) ) character->pincode_enable = *pincode->charselect * 2; pincode->sendstate( fd, sd, PINCODE_OK ); } @@ -115,18 +116,18 @@ void pincode_sendstate(int fd, struct char_session_data* sd, uint16 state) { } void pincode_notifyLoginPinUpdate(int account_id, char* pin) { - WFIFOHEAD(login_fd,11); - WFIFOW(login_fd,0) = 0x2738; - WFIFOL(login_fd,2) = account_id; - strncpy( (char*)WFIFOP(login_fd,6), pin, 5 ); - WFIFOSET(login_fd,11); + WFIFOHEAD(chr->login_fd,11); + WFIFOW(chr->login_fd,0) = 0x2738; + WFIFOL(chr->login_fd,2) = account_id; + strncpy( (char*)WFIFOP(chr->login_fd,6), pin, 5 ); + WFIFOSET(chr->login_fd,11); } void pincode_notifyLoginPinError(int account_id) { - WFIFOHEAD(login_fd,6); - WFIFOW(login_fd,0) = 0x2739; - WFIFOL(login_fd,2) = account_id; - WFIFOSET(login_fd,6); + WFIFOHEAD(chr->login_fd,6); + WFIFOW(chr->login_fd,0) = 0x2739; + WFIFOL(chr->login_fd,2) = account_id; + WFIFOSET(chr->login_fd,6); } void pincode_decrypt(unsigned int userSeed, char* pin) { @@ -155,23 +156,23 @@ bool pincode_config_read(char *w1, char *w2) { while ( true ) { if ( strcmpi(w1, "pincode_enabled") == 0 ) { - enabled = atoi(w2); + pincode_enabled = atoi(w2); #if PACKETVER < 20110309 - if( enabled ) { + if( pincode_enabled ) { ShowWarning("pincode_enabled requires PACKETVER 20110309 or higher. disabling...\n"); - enabled = 0; + pincode_enabled = 0; } #endif } else if ( strcmpi(w1, "pincode_changetime") == 0 ) { - changetime = atoi(w2)*60; + pincode_changetime = atoi(w2)*60; } else if ( strcmpi(w1, "pincode_maxtry") == 0 ) { - maxtry = atoi(w2); - if( maxtry > 3 ) { - ShowWarning("pincode_maxtry is too high (%d); maximum allowed: 3! capping to 3...\n",maxtry); - maxtry = 3; + pincode_maxtry = atoi(w2); + if( pincode_maxtry > 3 ) { + ShowWarning("pincode_maxtry is too high (%d); maximum allowed: 3! capping to 3...\n",pincode_maxtry); + pincode_maxtry = 3; } } else if ( strcmpi(w1, "pincode_charselect") == 0 ) { - charselect = atoi(w2); + pincode_charselect = atoi(w2); } else return false; @@ -184,12 +185,12 @@ bool pincode_config_read(char *w1, char *w2) { void pincode_defaults(void) { pincode = &pincode_s; - pincode->enabled = &enabled; - pincode->changetime = &changetime; - pincode->maxtry = &maxtry; - pincode->charselect = &charselect; - pincode->multiplier = &multiplier; - pincode->baseSeed = &baseSeed; + pincode->enabled = &pincode_enabled; + pincode->changetime = &pincode_changetime; + pincode->maxtry = &pincode_maxtry; + pincode->charselect = &pincode_charselect; + pincode->multiplier = &pincode_multiplier; + pincode->baseSeed = &pincode_baseSeed; pincode->handle = pincode_handle; pincode->decrypt = pincode_decrypt; diff --git a/src/char/pincode.h b/src/char/pincode.h index 1ed05095e..fa43eb9c2 100644 --- a/src/char/pincode.h +++ b/src/char/pincode.h @@ -14,7 +14,9 @@ #define PINCODE_UNUSED 7 #define PINCODE_WRONG 8 -/* Pincode Interface */ +/** + * pincode interface + **/ struct pincode_interface { /* vars */ int *enabled; diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index ccaf21828..e97a655e3 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -8,6 +8,87 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { + #ifdef CHAR_CHAR_H + { "char_interface", sizeof(struct char_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_CHAR_H + #endif // CHAR_CHAR_H + #ifdef CHAR_GEOIP_H + { "geoip_interface", sizeof(struct geoip_interface), SERVER_TYPE_CHAR }, + { "s_geoip", sizeof(struct s_geoip), SERVER_TYPE_CHAR }, + #else + #define CHAR_GEOIP_H + #endif // CHAR_GEOIP_H + #ifdef CHAR_INTER_H + { "inter_interface", sizeof(struct inter_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INTER_H + #endif // CHAR_INTER_H + #ifdef CHAR_INT_AUCTION_H + { "inter_auction_interface", sizeof(struct inter_auction_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_AUCTION_H + #endif // CHAR_INT_AUCTION_H + #ifdef CHAR_INT_ELEMENTAL_H + { "inter_elemental_interface", sizeof(struct inter_elemental_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_ELEMENTAL_H + #endif // CHAR_INT_ELEMENTAL_H + #ifdef CHAR_INT_GUILD_H + { "inter_guild_interface", sizeof(struct inter_guild_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_GUILD_H + #endif // CHAR_INT_GUILD_H + #ifdef CHAR_INT_HOMUN_H + { "inter_homunculus_interface", sizeof(struct inter_homunculus_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_HOMUN_H + #endif // CHAR_INT_HOMUN_H + #ifdef CHAR_INT_MAIL_H + { "inter_mail_interface", sizeof(struct inter_mail_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_MAIL_H + #endif // CHAR_INT_MAIL_H + #ifdef CHAR_INT_MERCENARY_H + { "inter_mercenary_interface", sizeof(struct inter_mercenary_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_MERCENARY_H + #endif // CHAR_INT_MERCENARY_H + #ifdef CHAR_INT_PARTY_H + { "inter_party_interface", sizeof(struct inter_party_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_PARTY_H + #endif // CHAR_INT_PARTY_H + #ifdef CHAR_INT_PET_H + { "inter_pet_interface", sizeof(struct inter_pet_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_PET_H + #endif // CHAR_INT_PET_H + #ifdef CHAR_INT_QUEST_H + { "inter_quest_interface", sizeof(struct inter_quest_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_QUEST_H + #endif // CHAR_INT_QUEST_H + #ifdef CHAR_INT_STORAGE_H + { "inter_storage_interface", sizeof(struct inter_storage_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_INT_STORAGE_H + #endif // CHAR_INT_STORAGE_H + #ifdef CHAR_LOGINIF_H + { "loginif_interface", sizeof(struct loginif_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_LOGINIF_H + #endif // CHAR_LOGINIF_H + #ifdef CHAR_MAPIF_H + { "mapif_interface", sizeof(struct mapif_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_MAPIF_H + #endif // CHAR_MAPIF_H + #ifdef CHAR_PINCODE_H + { "pincode_interface", sizeof(struct pincode_interface), SERVER_TYPE_CHAR }, + #else + #define CHAR_PINCODE_H + #endif // CHAR_PINCODE_H #ifdef COMMON_CONF_H { "libconfig_interface", sizeof(struct libconfig_interface), SERVER_TYPE_ALL }, #else diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index da92c90b4..e6f52790d 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -27,6 +27,21 @@ #define HPM_HOOKS_INCLUDE "../plugins/HPMHooking/HPMHooking_char.Hooks.inc" #define HPM_POINTS_INCLUDE "../plugins/HPMHooking/HPMHooking_char.HookingPoints.inc" #define HPM_SOURCES_INCLUDE "../plugins/HPMHooking/HPMHooking_char.sources.inc" +#include "../char/char.h" +#include "../char/geoip.h" +#include "../char/int_auction.h" +#include "../char/int_elemental.h" +#include "../char/int_guild.h" +#include "../char/int_homun.h" +#include "../char/int_mail.h" +#include "../char/int_mercenary.h" +#include "../char/int_party.h" +#include "../char/int_pet.h" +#include "../char/int_quest.h" +#include "../char/int_storage.h" +#include "../char/inter.h" +#include "../char/loginif.h" +#include "../char/mapif.h" #include "../char/pincode.h" #elif defined (HPMHOOKING_MAP) #define HPM_SERVER_TYPE SERVER_TYPE_MAP diff --git a/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc b/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc index 84800ca49..6d6db24ae 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.GetSymbol.inc @@ -4,4 +4,19 @@ // NOTE: This file was auto-generated and should never be manually edited, // as it will get overwritten. +if( !(chr = GET_SYMBOL("chr") ) ) return false; +if( !(geoip = GET_SYMBOL("geoip") ) ) return false; +if( !(inter_auction = GET_SYMBOL("inter_auction") ) ) return false; +if( !(inter_elemental = GET_SYMBOL("inter_elemental") ) ) return false; +if( !(inter_guild = GET_SYMBOL("inter_guild") ) ) return false; +if( !(inter_homunculus = GET_SYMBOL("inter_homunculus") ) ) return false; +if( !(inter = GET_SYMBOL("inter") ) ) return false; +if( !(inter_mail = GET_SYMBOL("inter_mail") ) ) return false; +if( !(inter_mercenary = GET_SYMBOL("inter_mercenary") ) ) return false; +if( !(inter_party = GET_SYMBOL("inter_party") ) ) return false; +if( !(inter_pet = GET_SYMBOL("inter_pet") ) ) return false; +if( !(inter_quest = GET_SYMBOL("inter_quest") ) ) return false; +if( !(inter_storage = GET_SYMBOL("inter_storage") ) ) return false; +if( !(loginif = GET_SYMBOL("loginif") ) ) return false; +if( !(mapif = GET_SYMBOL("mapif") ) ) return false; if( !(pincode = GET_SYMBOL("pincode") ) ) return false; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 4a940739f..46a225568 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -5,6 +5,874 @@ // as it will get overwritten. struct { + struct HPMHookPoint *HP_chr_waiting_disconnect_pre; + struct HPMHookPoint *HP_chr_waiting_disconnect_post; + struct HPMHookPoint *HP_chr_delete_char_sql_pre; + struct HPMHookPoint *HP_chr_delete_char_sql_post; + struct HPMHookPoint *HP_chr_create_online_char_data_pre; + struct HPMHookPoint *HP_chr_create_online_char_data_post; + struct HPMHookPoint *HP_chr_set_account_online_pre; + struct HPMHookPoint *HP_chr_set_account_online_post; + struct HPMHookPoint *HP_chr_set_account_offline_pre; + struct HPMHookPoint *HP_chr_set_account_offline_post; + struct HPMHookPoint *HP_chr_set_char_charselect_pre; + struct HPMHookPoint *HP_chr_set_char_charselect_post; + struct HPMHookPoint *HP_chr_set_char_online_pre; + struct HPMHookPoint *HP_chr_set_char_online_post; + struct HPMHookPoint *HP_chr_set_char_offline_pre; + struct HPMHookPoint *HP_chr_set_char_offline_post; + struct HPMHookPoint *HP_chr_db_setoffline_pre; + struct HPMHookPoint *HP_chr_db_setoffline_post; + struct HPMHookPoint *HP_chr_db_kickoffline_pre; + struct HPMHookPoint *HP_chr_db_kickoffline_post; + struct HPMHookPoint *HP_chr_set_login_all_offline_pre; + struct HPMHookPoint *HP_chr_set_login_all_offline_post; + struct HPMHookPoint *HP_chr_set_all_offline_pre; + struct HPMHookPoint *HP_chr_set_all_offline_post; + struct HPMHookPoint *HP_chr_set_all_offline_sql_pre; + struct HPMHookPoint *HP_chr_set_all_offline_sql_post; + struct HPMHookPoint *HP_chr_create_charstatus_pre; + struct HPMHookPoint *HP_chr_create_charstatus_post; + struct HPMHookPoint *HP_chr_mmo_char_tosql_pre; + struct HPMHookPoint *HP_chr_mmo_char_tosql_post; + struct HPMHookPoint *HP_chr_memitemdata_to_sql_pre; + struct HPMHookPoint *HP_chr_memitemdata_to_sql_post; + struct HPMHookPoint *HP_chr_inventory_to_sql_pre; + struct HPMHookPoint *HP_chr_inventory_to_sql_post; + struct HPMHookPoint *HP_chr_mmo_chars_fromsql_pre; + struct HPMHookPoint *HP_chr_mmo_chars_fromsql_post; + struct HPMHookPoint *HP_chr_mmo_char_fromsql_pre; + struct HPMHookPoint *HP_chr_mmo_char_fromsql_post; + struct HPMHookPoint *HP_chr_mmo_char_sql_init_pre; + struct HPMHookPoint *HP_chr_mmo_char_sql_init_post; + struct HPMHookPoint *HP_chr_char_slotchange_pre; + struct HPMHookPoint *HP_chr_char_slotchange_post; + struct HPMHookPoint *HP_chr_rename_char_sql_pre; + struct HPMHookPoint *HP_chr_rename_char_sql_post; + struct HPMHookPoint *HP_chr_check_char_name_pre; + struct HPMHookPoint *HP_chr_check_char_name_post; + struct HPMHookPoint *HP_chr_make_new_char_sql_pre; + struct HPMHookPoint *HP_chr_make_new_char_sql_post; + struct HPMHookPoint *HP_chr_divorce_char_sql_pre; + struct HPMHookPoint *HP_chr_divorce_char_sql_post; + struct HPMHookPoint *HP_chr_count_users_pre; + struct HPMHookPoint *HP_chr_count_users_post; + struct HPMHookPoint *HP_chr_mmo_char_tobuf_pre; + struct HPMHookPoint *HP_chr_mmo_char_tobuf_post; + struct HPMHookPoint *HP_chr_mmo_char_send099d_pre; + struct HPMHookPoint *HP_chr_mmo_char_send099d_post; + struct HPMHookPoint *HP_chr_mmo_char_send_ban_list_pre; + struct HPMHookPoint *HP_chr_mmo_char_send_ban_list_post; + struct HPMHookPoint *HP_chr_mmo_char_send_slots_info_pre; + struct HPMHookPoint *HP_chr_mmo_char_send_slots_info_post; + struct HPMHookPoint *HP_chr_mmo_char_send_characters_pre; + struct HPMHookPoint *HP_chr_mmo_char_send_characters_post; + struct HPMHookPoint *HP_chr_char_married_pre; + struct HPMHookPoint *HP_chr_char_married_post; + struct HPMHookPoint *HP_chr_char_child_pre; + struct HPMHookPoint *HP_chr_char_child_post; + struct HPMHookPoint *HP_chr_char_family_pre; + struct HPMHookPoint *HP_chr_char_family_post; + struct HPMHookPoint *HP_chr_disconnect_player_pre; + struct HPMHookPoint *HP_chr_disconnect_player_post; + struct HPMHookPoint *HP_chr_authfail_fd_pre; + struct HPMHookPoint *HP_chr_authfail_fd_post; + struct HPMHookPoint *HP_chr_request_account_data_pre; + struct HPMHookPoint *HP_chr_request_account_data_post; + struct HPMHookPoint *HP_chr_auth_ok_pre; + struct HPMHookPoint *HP_chr_auth_ok_post; + struct HPMHookPoint *HP_chr_ping_login_server_pre; + struct HPMHookPoint *HP_chr_ping_login_server_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_connection_state_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_connection_state_post; + struct HPMHookPoint *HP_chr_auth_error_pre; + struct HPMHookPoint *HP_chr_auth_error_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_auth_state_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_auth_state_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_account_data_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_account_data_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_login_pong_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_login_pong_post; + struct HPMHookPoint *HP_chr_changesex_pre; + struct HPMHookPoint *HP_chr_changesex_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_changesex_reply_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_changesex_reply_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_account_reg2_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_account_reg2_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_ban_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_ban_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_kick_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_kick_post; + struct HPMHookPoint *HP_chr_update_ip_pre; + struct HPMHookPoint *HP_chr_update_ip_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_update_ip_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_update_ip_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_accinfo2_failed_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_accinfo2_failed_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_accinfo2_ok_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_accinfo2_ok_post; + struct HPMHookPoint *HP_chr_parse_fromlogin_pre; + struct HPMHookPoint *HP_chr_parse_fromlogin_post; + struct HPMHookPoint *HP_chr_request_accreg2_pre; + struct HPMHookPoint *HP_chr_request_accreg2_post; + struct HPMHookPoint *HP_chr_global_accreg_to_login_start_pre; + struct HPMHookPoint *HP_chr_global_accreg_to_login_start_post; + struct HPMHookPoint *HP_chr_global_accreg_to_login_send_pre; + struct HPMHookPoint *HP_chr_global_accreg_to_login_send_post; + struct HPMHookPoint *HP_chr_global_accreg_to_login_add_pre; + struct HPMHookPoint *HP_chr_global_accreg_to_login_add_post; + struct HPMHookPoint *HP_chr_read_fame_list_pre; + struct HPMHookPoint *HP_chr_read_fame_list_post; + struct HPMHookPoint *HP_chr_send_fame_list_pre; + struct HPMHookPoint *HP_chr_send_fame_list_post; + struct HPMHookPoint *HP_chr_update_fame_list_pre; + struct HPMHookPoint *HP_chr_update_fame_list_post; + struct HPMHookPoint *HP_chr_loadName_pre; + struct HPMHookPoint *HP_chr_loadName_post; + struct HPMHookPoint *HP_chr_parse_frommap_datasync_pre; + struct HPMHookPoint *HP_chr_parse_frommap_datasync_post; + struct HPMHookPoint *HP_chr_parse_frommap_skillid2idx_pre; + struct HPMHookPoint *HP_chr_parse_frommap_skillid2idx_post; + struct HPMHookPoint *HP_chr_map_received_ok_pre; + struct HPMHookPoint *HP_chr_map_received_ok_post; + struct HPMHookPoint *HP_chr_send_maps_pre; + struct HPMHookPoint *HP_chr_send_maps_post; + struct HPMHookPoint *HP_chr_parse_frommap_map_names_pre; + struct HPMHookPoint *HP_chr_parse_frommap_map_names_post; + struct HPMHookPoint *HP_chr_send_scdata_pre; + struct HPMHookPoint *HP_chr_send_scdata_post; + struct HPMHookPoint *HP_chr_parse_frommap_request_scdata_pre; + struct HPMHookPoint *HP_chr_parse_frommap_request_scdata_post; + struct HPMHookPoint *HP_chr_parse_frommap_set_users_count_pre; + struct HPMHookPoint *HP_chr_parse_frommap_set_users_count_post; + struct HPMHookPoint *HP_chr_parse_frommap_set_users_pre; + struct HPMHookPoint *HP_chr_parse_frommap_set_users_post; + struct HPMHookPoint *HP_chr_save_character_ack_pre; + struct HPMHookPoint *HP_chr_save_character_ack_post; + struct HPMHookPoint *HP_chr_parse_frommap_save_character_pre; + struct HPMHookPoint *HP_chr_parse_frommap_save_character_post; + struct HPMHookPoint *HP_chr_select_ack_pre; + struct HPMHookPoint *HP_chr_select_ack_post; + struct HPMHookPoint *HP_chr_parse_frommap_char_select_req_pre; + struct HPMHookPoint *HP_chr_parse_frommap_char_select_req_post; + struct HPMHookPoint *HP_chr_change_map_server_ack_pre; + struct HPMHookPoint *HP_chr_change_map_server_ack_post; + struct HPMHookPoint *HP_chr_parse_frommap_change_map_server_pre; + struct HPMHookPoint *HP_chr_parse_frommap_change_map_server_post; + struct HPMHookPoint *HP_chr_parse_frommap_remove_friend_pre; + struct HPMHookPoint *HP_chr_parse_frommap_remove_friend_post; + struct HPMHookPoint *HP_chr_char_name_ack_pre; + struct HPMHookPoint *HP_chr_char_name_ack_post; + struct HPMHookPoint *HP_chr_parse_frommap_char_name_request_pre; + struct HPMHookPoint *HP_chr_parse_frommap_char_name_request_post; + struct HPMHookPoint *HP_chr_parse_frommap_change_email_pre; + struct HPMHookPoint *HP_chr_parse_frommap_change_email_post; + struct HPMHookPoint *HP_chr_ban_pre; + struct HPMHookPoint *HP_chr_ban_post; + struct HPMHookPoint *HP_chr_unban_pre; + struct HPMHookPoint *HP_chr_unban_post; + struct HPMHookPoint *HP_chr_ask_name_ack_pre; + struct HPMHookPoint *HP_chr_ask_name_ack_post; + struct HPMHookPoint *HP_chr_parse_frommap_change_account_pre; + struct HPMHookPoint *HP_chr_parse_frommap_change_account_post; + struct HPMHookPoint *HP_chr_parse_frommap_fame_list_pre; + struct HPMHookPoint *HP_chr_parse_frommap_fame_list_post; + struct HPMHookPoint *HP_chr_parse_frommap_divorce_char_pre; + struct HPMHookPoint *HP_chr_parse_frommap_divorce_char_post; + struct HPMHookPoint *HP_chr_parse_frommap_ragsrvinfo_pre; + struct HPMHookPoint *HP_chr_parse_frommap_ragsrvinfo_post; + struct HPMHookPoint *HP_chr_parse_frommap_set_char_offline_pre; + struct HPMHookPoint *HP_chr_parse_frommap_set_char_offline_post; + struct HPMHookPoint *HP_chr_parse_frommap_set_all_offline_pre; + struct HPMHookPoint *HP_chr_parse_frommap_set_all_offline_post; + struct HPMHookPoint *HP_chr_parse_frommap_set_char_online_pre; + struct HPMHookPoint *HP_chr_parse_frommap_set_char_online_post; + struct HPMHookPoint *HP_chr_parse_frommap_build_fame_list_pre; + struct HPMHookPoint *HP_chr_parse_frommap_build_fame_list_post; + struct HPMHookPoint *HP_chr_parse_frommap_save_status_change_data_pre; + struct HPMHookPoint *HP_chr_parse_frommap_save_status_change_data_post; + struct HPMHookPoint *HP_chr_send_pong_pre; + struct HPMHookPoint *HP_chr_send_pong_post; + struct HPMHookPoint *HP_chr_parse_frommap_ping_pre; + struct HPMHookPoint *HP_chr_parse_frommap_ping_post; + struct HPMHookPoint *HP_chr_map_auth_ok_pre; + struct HPMHookPoint *HP_chr_map_auth_ok_post; + struct HPMHookPoint *HP_chr_map_auth_failed_pre; + struct HPMHookPoint *HP_chr_map_auth_failed_post; + struct HPMHookPoint *HP_chr_parse_frommap_auth_request_pre; + struct HPMHookPoint *HP_chr_parse_frommap_auth_request_post; + struct HPMHookPoint *HP_chr_parse_frommap_update_ip_pre; + struct HPMHookPoint *HP_chr_parse_frommap_update_ip_post; + struct HPMHookPoint *HP_chr_parse_frommap_request_stats_report_pre; + struct HPMHookPoint *HP_chr_parse_frommap_request_stats_report_post; + struct HPMHookPoint *HP_chr_parse_frommap_scdata_update_pre; + struct HPMHookPoint *HP_chr_parse_frommap_scdata_update_post; + struct HPMHookPoint *HP_chr_parse_frommap_scdata_delete_pre; + struct HPMHookPoint *HP_chr_parse_frommap_scdata_delete_post; + struct HPMHookPoint *HP_chr_parse_frommap_pre; + struct HPMHookPoint *HP_chr_parse_frommap_post; + struct HPMHookPoint *HP_chr_search_mapserver_pre; + struct HPMHookPoint *HP_chr_search_mapserver_post; + struct HPMHookPoint *HP_chr_mapif_init_pre; + struct HPMHookPoint *HP_chr_mapif_init_post; + struct HPMHookPoint *HP_chr_lan_subnetcheck_pre; + struct HPMHookPoint *HP_chr_lan_subnetcheck_post; + struct HPMHookPoint *HP_chr_delete2_ack_pre; + struct HPMHookPoint *HP_chr_delete2_ack_post; + struct HPMHookPoint *HP_chr_delete2_accept_actual_ack_pre; + struct HPMHookPoint *HP_chr_delete2_accept_actual_ack_post; + struct HPMHookPoint *HP_chr_delete2_accept_ack_pre; + struct HPMHookPoint *HP_chr_delete2_accept_ack_post; + struct HPMHookPoint *HP_chr_delete2_cancel_ack_pre; + struct HPMHookPoint *HP_chr_delete2_cancel_ack_post; + struct HPMHookPoint *HP_chr_delete2_req_pre; + struct HPMHookPoint *HP_chr_delete2_req_post; + struct HPMHookPoint *HP_chr_delete2_accept_pre; + struct HPMHookPoint *HP_chr_delete2_accept_post; + struct HPMHookPoint *HP_chr_delete2_cancel_pre; + struct HPMHookPoint *HP_chr_delete2_cancel_post; + struct HPMHookPoint *HP_chr_send_account_id_pre; + struct HPMHookPoint *HP_chr_send_account_id_post; + struct HPMHookPoint *HP_chr_parse_char_connect_pre; + struct HPMHookPoint *HP_chr_parse_char_connect_post; + struct HPMHookPoint *HP_chr_send_map_info_pre; + struct HPMHookPoint *HP_chr_send_map_info_post; + struct HPMHookPoint *HP_chr_send_wait_char_server_pre; + struct HPMHookPoint *HP_chr_send_wait_char_server_post; + struct HPMHookPoint *HP_chr_search_default_maps_mapserver_pre; + struct HPMHookPoint *HP_chr_search_default_maps_mapserver_post; + struct HPMHookPoint *HP_chr_parse_char_select_pre; + struct HPMHookPoint *HP_chr_parse_char_select_post; + struct HPMHookPoint *HP_chr_creation_failed_pre; + struct HPMHookPoint *HP_chr_creation_failed_post; + struct HPMHookPoint *HP_chr_creation_ok_pre; + struct HPMHookPoint *HP_chr_creation_ok_post; + struct HPMHookPoint *HP_chr_parse_char_create_new_char_pre; + struct HPMHookPoint *HP_chr_parse_char_create_new_char_post; + struct HPMHookPoint *HP_chr_delete_char_failed_pre; + struct HPMHookPoint *HP_chr_delete_char_failed_post; + struct HPMHookPoint *HP_chr_delete_char_ok_pre; + struct HPMHookPoint *HP_chr_delete_char_ok_post; + struct HPMHookPoint *HP_chr_parse_char_delete_char_pre; + struct HPMHookPoint *HP_chr_parse_char_delete_char_post; + struct HPMHookPoint *HP_chr_parse_char_ping_pre; + struct HPMHookPoint *HP_chr_parse_char_ping_post; + struct HPMHookPoint *HP_chr_allow_rename_pre; + struct HPMHookPoint *HP_chr_allow_rename_post; + struct HPMHookPoint *HP_chr_parse_char_rename_char_pre; + struct HPMHookPoint *HP_chr_parse_char_rename_char_post; + struct HPMHookPoint *HP_chr_parse_char_rename_char2_pre; + struct HPMHookPoint *HP_chr_parse_char_rename_char2_post; + struct HPMHookPoint *HP_chr_rename_char_ack_pre; + struct HPMHookPoint *HP_chr_rename_char_ack_post; + struct HPMHookPoint *HP_chr_parse_char_rename_char_confirm_pre; + struct HPMHookPoint *HP_chr_parse_char_rename_char_confirm_post; + struct HPMHookPoint *HP_chr_captcha_notsupported_pre; + struct HPMHookPoint *HP_chr_captcha_notsupported_post; + struct HPMHookPoint *HP_chr_parse_char_request_captcha_pre; + struct HPMHookPoint *HP_chr_parse_char_request_captcha_post; + struct HPMHookPoint *HP_chr_parse_char_check_captcha_pre; + struct HPMHookPoint *HP_chr_parse_char_check_captcha_post; + struct HPMHookPoint *HP_chr_parse_char_delete2_req_pre; + struct HPMHookPoint *HP_chr_parse_char_delete2_req_post; + struct HPMHookPoint *HP_chr_parse_char_delete2_accept_pre; + struct HPMHookPoint *HP_chr_parse_char_delete2_accept_post; + struct HPMHookPoint *HP_chr_parse_char_delete2_cancel_pre; + struct HPMHookPoint *HP_chr_parse_char_delete2_cancel_post; + struct HPMHookPoint *HP_chr_login_map_server_ack_pre; + struct HPMHookPoint *HP_chr_login_map_server_ack_post; + struct HPMHookPoint *HP_chr_parse_char_login_map_server_pre; + struct HPMHookPoint *HP_chr_parse_char_login_map_server_post; + struct HPMHookPoint *HP_chr_parse_char_pincode_check_pre; + struct HPMHookPoint *HP_chr_parse_char_pincode_check_post; + struct HPMHookPoint *HP_chr_parse_char_pincode_window_pre; + struct HPMHookPoint *HP_chr_parse_char_pincode_window_post; + struct HPMHookPoint *HP_chr_parse_char_pincode_change_pre; + struct HPMHookPoint *HP_chr_parse_char_pincode_change_post; + struct HPMHookPoint *HP_chr_parse_char_pincode_first_pin_pre; + struct HPMHookPoint *HP_chr_parse_char_pincode_first_pin_post; + struct HPMHookPoint *HP_chr_parse_char_request_chars_pre; + struct HPMHookPoint *HP_chr_parse_char_request_chars_post; + struct HPMHookPoint *HP_chr_change_character_slot_ack_pre; + struct HPMHookPoint *HP_chr_change_character_slot_ack_post; + struct HPMHookPoint *HP_chr_parse_char_move_character_pre; + struct HPMHookPoint *HP_chr_parse_char_move_character_post; + struct HPMHookPoint *HP_chr_parse_char_unknown_packet_pre; + struct HPMHookPoint *HP_chr_parse_char_unknown_packet_post; + struct HPMHookPoint *HP_chr_parse_char_pre; + struct HPMHookPoint *HP_chr_parse_char_post; + struct HPMHookPoint *HP_chr_broadcast_user_count_pre; + struct HPMHookPoint *HP_chr_broadcast_user_count_post; + struct HPMHookPoint *HP_chr_send_accounts_tologin_sub_pre; + struct HPMHookPoint *HP_chr_send_accounts_tologin_sub_post; + struct HPMHookPoint *HP_chr_send_accounts_tologin_pre; + struct HPMHookPoint *HP_chr_send_accounts_tologin_post; + struct HPMHookPoint *HP_chr_check_connect_login_server_pre; + struct HPMHookPoint *HP_chr_check_connect_login_server_post; + struct HPMHookPoint *HP_chr_online_data_cleanup_sub_pre; + struct HPMHookPoint *HP_chr_online_data_cleanup_sub_post; + struct HPMHookPoint *HP_chr_online_data_cleanup_pre; + struct HPMHookPoint *HP_chr_online_data_cleanup_post; + struct HPMHookPoint *HP_chr_lan_config_read_pre; + struct HPMHookPoint *HP_chr_lan_config_read_post; + struct HPMHookPoint *HP_chr_sql_config_read_pre; + struct HPMHookPoint *HP_chr_sql_config_read_post; + struct HPMHookPoint *HP_chr_config_dispatch_pre; + struct HPMHookPoint *HP_chr_config_dispatch_post; + struct HPMHookPoint *HP_chr_config_read_pre; + struct HPMHookPoint *HP_chr_config_read_post; + struct HPMHookPoint *HP_geoip_getcountry_pre; + struct HPMHookPoint *HP_geoip_getcountry_post; + struct HPMHookPoint *HP_geoip_final_pre; + struct HPMHookPoint *HP_geoip_final_post; + struct HPMHookPoint *HP_geoip_init_pre; + struct HPMHookPoint *HP_geoip_init_post; + struct HPMHookPoint *HP_inter_auction_count_pre; + struct HPMHookPoint *HP_inter_auction_count_post; + struct HPMHookPoint *HP_inter_auction_save_pre; + struct HPMHookPoint *HP_inter_auction_save_post; + struct HPMHookPoint *HP_inter_auction_create_pre; + struct HPMHookPoint *HP_inter_auction_create_post; + struct HPMHookPoint *HP_inter_auction_end_timer_pre; + struct HPMHookPoint *HP_inter_auction_end_timer_post; + struct HPMHookPoint *HP_inter_auction_delete__pre; + struct HPMHookPoint *HP_inter_auction_delete__post; + struct HPMHookPoint *HP_inter_auction_fromsql_pre; + struct HPMHookPoint *HP_inter_auction_fromsql_post; + struct HPMHookPoint *HP_inter_auction_parse_frommap_pre; + struct HPMHookPoint *HP_inter_auction_parse_frommap_post; + struct HPMHookPoint *HP_inter_auction_sql_init_pre; + struct HPMHookPoint *HP_inter_auction_sql_init_post; + struct HPMHookPoint *HP_inter_auction_sql_final_pre; + struct HPMHookPoint *HP_inter_auction_sql_final_post; + struct HPMHookPoint *HP_inter_elemental_sql_init_pre; + struct HPMHookPoint *HP_inter_elemental_sql_init_post; + struct HPMHookPoint *HP_inter_elemental_sql_final_pre; + struct HPMHookPoint *HP_inter_elemental_sql_final_post; + struct HPMHookPoint *HP_inter_elemental_parse_frommap_pre; + struct HPMHookPoint *HP_inter_elemental_parse_frommap_post; + struct HPMHookPoint *HP_inter_guild_save_timer_pre; + struct HPMHookPoint *HP_inter_guild_save_timer_post; + struct HPMHookPoint *HP_inter_guild_removemember_tosql_pre; + struct HPMHookPoint *HP_inter_guild_removemember_tosql_post; + struct HPMHookPoint *HP_inter_guild_tosql_pre; + struct HPMHookPoint *HP_inter_guild_tosql_post; + struct HPMHookPoint *HP_inter_guild_fromsql_pre; + struct HPMHookPoint *HP_inter_guild_fromsql_post; + struct HPMHookPoint *HP_inter_guild_castle_tosql_pre; + struct HPMHookPoint *HP_inter_guild_castle_tosql_post; + struct HPMHookPoint *HP_inter_guild_castle_fromsql_pre; + struct HPMHookPoint *HP_inter_guild_castle_fromsql_post; + struct HPMHookPoint *HP_inter_guild_exp_parse_row_pre; + struct HPMHookPoint *HP_inter_guild_exp_parse_row_post; + struct HPMHookPoint *HP_inter_guild_CharOnline_pre; + struct HPMHookPoint *HP_inter_guild_CharOnline_post; + struct HPMHookPoint *HP_inter_guild_CharOffline_pre; + struct HPMHookPoint *HP_inter_guild_CharOffline_post; + struct HPMHookPoint *HP_inter_guild_sql_init_pre; + struct HPMHookPoint *HP_inter_guild_sql_init_post; + struct HPMHookPoint *HP_inter_guild_db_final_pre; + struct HPMHookPoint *HP_inter_guild_db_final_post; + struct HPMHookPoint *HP_inter_guild_sql_final_pre; + struct HPMHookPoint *HP_inter_guild_sql_final_post; + struct HPMHookPoint *HP_inter_guild_search_guildname_pre; + struct HPMHookPoint *HP_inter_guild_search_guildname_post; + struct HPMHookPoint *HP_inter_guild_check_empty_pre; + struct HPMHookPoint *HP_inter_guild_check_empty_post; + struct HPMHookPoint *HP_inter_guild_nextexp_pre; + struct HPMHookPoint *HP_inter_guild_nextexp_post; + struct HPMHookPoint *HP_inter_guild_checkskill_pre; + struct HPMHookPoint *HP_inter_guild_checkskill_post; + struct HPMHookPoint *HP_inter_guild_calcinfo_pre; + struct HPMHookPoint *HP_inter_guild_calcinfo_post; + struct HPMHookPoint *HP_inter_guild_sex_changed_pre; + struct HPMHookPoint *HP_inter_guild_sex_changed_post; + struct HPMHookPoint *HP_inter_guild_charname_changed_pre; + struct HPMHookPoint *HP_inter_guild_charname_changed_post; + struct HPMHookPoint *HP_inter_guild_parse_frommap_pre; + struct HPMHookPoint *HP_inter_guild_parse_frommap_post; + struct HPMHookPoint *HP_inter_guild_leave_pre; + struct HPMHookPoint *HP_inter_guild_leave_post; + struct HPMHookPoint *HP_inter_guild_broken_pre; + struct HPMHookPoint *HP_inter_guild_broken_post; + struct HPMHookPoint *HP_inter_homunculus_sql_init_pre; + struct HPMHookPoint *HP_inter_homunculus_sql_init_post; + struct HPMHookPoint *HP_inter_homunculus_sql_final_pre; + struct HPMHookPoint *HP_inter_homunculus_sql_final_post; + struct HPMHookPoint *HP_inter_homunculus_parse_frommap_pre; + struct HPMHookPoint *HP_inter_homunculus_parse_frommap_post; + struct HPMHookPoint *HP_inter_msg_txt_pre; + struct HPMHookPoint *HP_inter_msg_txt_post; + struct HPMHookPoint *HP_inter_msg_config_read_pre; + struct HPMHookPoint *HP_inter_msg_config_read_post; + struct HPMHookPoint *HP_inter_do_final_msg_pre; + struct HPMHookPoint *HP_inter_do_final_msg_post; + struct HPMHookPoint *HP_inter_job_name_pre; + struct HPMHookPoint *HP_inter_job_name_post; + struct HPMHookPoint *HP_inter_vmsg_to_fd_pre; + struct HPMHookPoint *HP_inter_vmsg_to_fd_post; + struct HPMHookPoint *HP_inter_savereg_pre; + struct HPMHookPoint *HP_inter_savereg_post; + struct HPMHookPoint *HP_inter_accreg_fromsql_pre; + struct HPMHookPoint *HP_inter_accreg_fromsql_post; + struct HPMHookPoint *HP_inter_config_read_pre; + struct HPMHookPoint *HP_inter_config_read_post; + struct HPMHookPoint *HP_inter_vlog_pre; + struct HPMHookPoint *HP_inter_vlog_post; + struct HPMHookPoint *HP_inter_init_sql_pre; + struct HPMHookPoint *HP_inter_init_sql_post; + struct HPMHookPoint *HP_inter_mapif_init_pre; + struct HPMHookPoint *HP_inter_mapif_init_post; + struct HPMHookPoint *HP_inter_check_ttl_wisdata_sub_pre; + struct HPMHookPoint *HP_inter_check_ttl_wisdata_sub_post; + struct HPMHookPoint *HP_inter_check_ttl_wisdata_pre; + struct HPMHookPoint *HP_inter_check_ttl_wisdata_post; + struct HPMHookPoint *HP_inter_check_length_pre; + struct HPMHookPoint *HP_inter_check_length_post; + struct HPMHookPoint *HP_inter_parse_frommap_pre; + struct HPMHookPoint *HP_inter_parse_frommap_post; + struct HPMHookPoint *HP_inter_final_pre; + struct HPMHookPoint *HP_inter_final_post; + struct HPMHookPoint *HP_inter_mail_sql_init_pre; + struct HPMHookPoint *HP_inter_mail_sql_init_post; + struct HPMHookPoint *HP_inter_mail_sql_final_pre; + struct HPMHookPoint *HP_inter_mail_sql_final_post; + struct HPMHookPoint *HP_inter_mail_parse_frommap_pre; + struct HPMHookPoint *HP_inter_mail_parse_frommap_post; + struct HPMHookPoint *HP_inter_mail_fromsql_pre; + struct HPMHookPoint *HP_inter_mail_fromsql_post; + struct HPMHookPoint *HP_inter_mail_savemessage_pre; + struct HPMHookPoint *HP_inter_mail_savemessage_post; + struct HPMHookPoint *HP_inter_mail_loadmessage_pre; + struct HPMHookPoint *HP_inter_mail_loadmessage_post; + struct HPMHookPoint *HP_inter_mail_DeleteAttach_pre; + struct HPMHookPoint *HP_inter_mail_DeleteAttach_post; + struct HPMHookPoint *HP_inter_mail_sendmail_pre; + struct HPMHookPoint *HP_inter_mail_sendmail_post; + struct HPMHookPoint *HP_inter_mercenary_owner_fromsql_pre; + struct HPMHookPoint *HP_inter_mercenary_owner_fromsql_post; + struct HPMHookPoint *HP_inter_mercenary_owner_tosql_pre; + struct HPMHookPoint *HP_inter_mercenary_owner_tosql_post; + struct HPMHookPoint *HP_inter_mercenary_owner_delete_pre; + struct HPMHookPoint *HP_inter_mercenary_owner_delete_post; + struct HPMHookPoint *HP_inter_mercenary_sql_init_pre; + struct HPMHookPoint *HP_inter_mercenary_sql_init_post; + struct HPMHookPoint *HP_inter_mercenary_sql_final_pre; + struct HPMHookPoint *HP_inter_mercenary_sql_final_post; + struct HPMHookPoint *HP_inter_mercenary_parse_frommap_pre; + struct HPMHookPoint *HP_inter_mercenary_parse_frommap_post; + struct HPMHookPoint *HP_inter_party_check_lv_pre; + struct HPMHookPoint *HP_inter_party_check_lv_post; + struct HPMHookPoint *HP_inter_party_calc_state_pre; + struct HPMHookPoint *HP_inter_party_calc_state_post; + struct HPMHookPoint *HP_inter_party_tosql_pre; + struct HPMHookPoint *HP_inter_party_tosql_post; + struct HPMHookPoint *HP_inter_party_fromsql_pre; + struct HPMHookPoint *HP_inter_party_fromsql_post; + struct HPMHookPoint *HP_inter_party_sql_init_pre; + struct HPMHookPoint *HP_inter_party_sql_init_post; + struct HPMHookPoint *HP_inter_party_sql_final_pre; + struct HPMHookPoint *HP_inter_party_sql_final_post; + struct HPMHookPoint *HP_inter_party_search_partyname_pre; + struct HPMHookPoint *HP_inter_party_search_partyname_post; + struct HPMHookPoint *HP_inter_party_check_exp_share_pre; + struct HPMHookPoint *HP_inter_party_check_exp_share_post; + struct HPMHookPoint *HP_inter_party_check_empty_pre; + struct HPMHookPoint *HP_inter_party_check_empty_post; + struct HPMHookPoint *HP_inter_party_parse_frommap_pre; + struct HPMHookPoint *HP_inter_party_parse_frommap_post; + struct HPMHookPoint *HP_inter_party_leave_pre; + struct HPMHookPoint *HP_inter_party_leave_post; + struct HPMHookPoint *HP_inter_party_CharOnline_pre; + struct HPMHookPoint *HP_inter_party_CharOnline_post; + struct HPMHookPoint *HP_inter_party_CharOffline_pre; + struct HPMHookPoint *HP_inter_party_CharOffline_post; + struct HPMHookPoint *HP_inter_pet_tosql_pre; + struct HPMHookPoint *HP_inter_pet_tosql_post; + struct HPMHookPoint *HP_inter_pet_fromsql_pre; + struct HPMHookPoint *HP_inter_pet_fromsql_post; + struct HPMHookPoint *HP_inter_pet_sql_init_pre; + struct HPMHookPoint *HP_inter_pet_sql_init_post; + struct HPMHookPoint *HP_inter_pet_sql_final_pre; + struct HPMHookPoint *HP_inter_pet_sql_final_post; + struct HPMHookPoint *HP_inter_pet_delete__pre; + struct HPMHookPoint *HP_inter_pet_delete__post; + struct HPMHookPoint *HP_inter_pet_parse_frommap_pre; + struct HPMHookPoint *HP_inter_pet_parse_frommap_post; + struct HPMHookPoint *HP_inter_quest_parse_frommap_pre; + struct HPMHookPoint *HP_inter_quest_parse_frommap_post; + struct HPMHookPoint *HP_inter_storage_tosql_pre; + struct HPMHookPoint *HP_inter_storage_tosql_post; + struct HPMHookPoint *HP_inter_storage_fromsql_pre; + struct HPMHookPoint *HP_inter_storage_fromsql_post; + struct HPMHookPoint *HP_inter_storage_guild_storage_tosql_pre; + struct HPMHookPoint *HP_inter_storage_guild_storage_tosql_post; + struct HPMHookPoint *HP_inter_storage_guild_storage_fromsql_pre; + struct HPMHookPoint *HP_inter_storage_guild_storage_fromsql_post; + struct HPMHookPoint *HP_inter_storage_sql_init_pre; + struct HPMHookPoint *HP_inter_storage_sql_init_post; + struct HPMHookPoint *HP_inter_storage_sql_final_pre; + struct HPMHookPoint *HP_inter_storage_sql_final_post; + struct HPMHookPoint *HP_inter_storage_delete__pre; + struct HPMHookPoint *HP_inter_storage_delete__post; + struct HPMHookPoint *HP_inter_storage_guild_storage_delete_pre; + struct HPMHookPoint *HP_inter_storage_guild_storage_delete_post; + struct HPMHookPoint *HP_inter_storage_parse_frommap_pre; + struct HPMHookPoint *HP_inter_storage_parse_frommap_post; + struct HPMHookPoint *HP_loginif_reset_pre; + struct HPMHookPoint *HP_loginif_reset_post; + struct HPMHookPoint *HP_loginif_check_shutdown_pre; + struct HPMHookPoint *HP_loginif_check_shutdown_post; + struct HPMHookPoint *HP_loginif_on_disconnect_pre; + struct HPMHookPoint *HP_loginif_on_disconnect_post; + struct HPMHookPoint *HP_loginif_on_ready_pre; + struct HPMHookPoint *HP_loginif_on_ready_post; + struct HPMHookPoint *HP_loginif_block_account_pre; + struct HPMHookPoint *HP_loginif_block_account_post; + struct HPMHookPoint *HP_loginif_ban_account_pre; + struct HPMHookPoint *HP_loginif_ban_account_post; + struct HPMHookPoint *HP_loginif_unban_account_pre; + struct HPMHookPoint *HP_loginif_unban_account_post; + struct HPMHookPoint *HP_loginif_changesex_pre; + struct HPMHookPoint *HP_loginif_changesex_post; + struct HPMHookPoint *HP_loginif_auth_pre; + struct HPMHookPoint *HP_loginif_auth_post; + struct HPMHookPoint *HP_loginif_send_users_count_pre; + struct HPMHookPoint *HP_loginif_send_users_count_post; + struct HPMHookPoint *HP_loginif_connect_to_server_pre; + struct HPMHookPoint *HP_loginif_connect_to_server_post; + struct HPMHookPoint *HP_mapif_ban_pre; + struct HPMHookPoint *HP_mapif_ban_post; + struct HPMHookPoint *HP_mapif_server_init_pre; + struct HPMHookPoint *HP_mapif_server_init_post; + struct HPMHookPoint *HP_mapif_server_destroy_pre; + struct HPMHookPoint *HP_mapif_server_destroy_post; + struct HPMHookPoint *HP_mapif_server_reset_pre; + struct HPMHookPoint *HP_mapif_server_reset_post; + struct HPMHookPoint *HP_mapif_on_disconnect_pre; + struct HPMHookPoint *HP_mapif_on_disconnect_post; + struct HPMHookPoint *HP_mapif_on_parse_accinfo_pre; + struct HPMHookPoint *HP_mapif_on_parse_accinfo_post; + struct HPMHookPoint *HP_mapif_char_ban_pre; + struct HPMHookPoint *HP_mapif_char_ban_post; + struct HPMHookPoint *HP_mapif_sendall_pre; + struct HPMHookPoint *HP_mapif_sendall_post; + struct HPMHookPoint *HP_mapif_sendallwos_pre; + struct HPMHookPoint *HP_mapif_sendallwos_post; + struct HPMHookPoint *HP_mapif_send_pre; + struct HPMHookPoint *HP_mapif_send_post; + struct HPMHookPoint *HP_mapif_send_users_count_pre; + struct HPMHookPoint *HP_mapif_send_users_count_post; + struct HPMHookPoint *HP_mapif_auction_message_pre; + struct HPMHookPoint *HP_mapif_auction_message_post; + struct HPMHookPoint *HP_mapif_auction_sendlist_pre; + struct HPMHookPoint *HP_mapif_auction_sendlist_post; + struct HPMHookPoint *HP_mapif_parse_auction_requestlist_pre; + struct HPMHookPoint *HP_mapif_parse_auction_requestlist_post; + struct HPMHookPoint *HP_mapif_auction_register_pre; + struct HPMHookPoint *HP_mapif_auction_register_post; + struct HPMHookPoint *HP_mapif_parse_auction_register_pre; + struct HPMHookPoint *HP_mapif_parse_auction_register_post; + struct HPMHookPoint *HP_mapif_auction_cancel_pre; + struct HPMHookPoint *HP_mapif_auction_cancel_post; + struct HPMHookPoint *HP_mapif_parse_auction_cancel_pre; + struct HPMHookPoint *HP_mapif_parse_auction_cancel_post; + struct HPMHookPoint *HP_mapif_auction_close_pre; + struct HPMHookPoint *HP_mapif_auction_close_post; + struct HPMHookPoint *HP_mapif_parse_auction_close_pre; + struct HPMHookPoint *HP_mapif_parse_auction_close_post; + struct HPMHookPoint *HP_mapif_auction_bid_pre; + struct HPMHookPoint *HP_mapif_auction_bid_post; + struct HPMHookPoint *HP_mapif_parse_auction_bid_pre; + struct HPMHookPoint *HP_mapif_parse_auction_bid_post; + struct HPMHookPoint *HP_mapif_elemental_save_pre; + struct HPMHookPoint *HP_mapif_elemental_save_post; + struct HPMHookPoint *HP_mapif_elemental_load_pre; + struct HPMHookPoint *HP_mapif_elemental_load_post; + struct HPMHookPoint *HP_mapif_elemental_delete_pre; + struct HPMHookPoint *HP_mapif_elemental_delete_post; + struct HPMHookPoint *HP_mapif_elemental_send_pre; + struct HPMHookPoint *HP_mapif_elemental_send_post; + struct HPMHookPoint *HP_mapif_parse_elemental_create_pre; + struct HPMHookPoint *HP_mapif_parse_elemental_create_post; + struct HPMHookPoint *HP_mapif_parse_elemental_load_pre; + struct HPMHookPoint *HP_mapif_parse_elemental_load_post; + struct HPMHookPoint *HP_mapif_elemental_deleted_pre; + struct HPMHookPoint *HP_mapif_elemental_deleted_post; + struct HPMHookPoint *HP_mapif_parse_elemental_delete_pre; + struct HPMHookPoint *HP_mapif_parse_elemental_delete_post; + struct HPMHookPoint *HP_mapif_elemental_saved_pre; + struct HPMHookPoint *HP_mapif_elemental_saved_post; + struct HPMHookPoint *HP_mapif_parse_elemental_save_pre; + struct HPMHookPoint *HP_mapif_parse_elemental_save_post; + struct HPMHookPoint *HP_mapif_guild_created_pre; + struct HPMHookPoint *HP_mapif_guild_created_post; + struct HPMHookPoint *HP_mapif_guild_noinfo_pre; + struct HPMHookPoint *HP_mapif_guild_noinfo_post; + struct HPMHookPoint *HP_mapif_guild_info_pre; + struct HPMHookPoint *HP_mapif_guild_info_post; + struct HPMHookPoint *HP_mapif_guild_memberadded_pre; + struct HPMHookPoint *HP_mapif_guild_memberadded_post; + struct HPMHookPoint *HP_mapif_guild_withdraw_pre; + struct HPMHookPoint *HP_mapif_guild_withdraw_post; + struct HPMHookPoint *HP_mapif_guild_memberinfoshort_pre; + struct HPMHookPoint *HP_mapif_guild_memberinfoshort_post; + struct HPMHookPoint *HP_mapif_guild_broken_pre; + struct HPMHookPoint *HP_mapif_guild_broken_post; + struct HPMHookPoint *HP_mapif_guild_message_pre; + struct HPMHookPoint *HP_mapif_guild_message_post; + struct HPMHookPoint *HP_mapif_guild_basicinfochanged_pre; + struct HPMHookPoint *HP_mapif_guild_basicinfochanged_post; + struct HPMHookPoint *HP_mapif_guild_memberinfochanged_pre; + struct HPMHookPoint *HP_mapif_guild_memberinfochanged_post; + struct HPMHookPoint *HP_mapif_guild_skillupack_pre; + struct HPMHookPoint *HP_mapif_guild_skillupack_post; + struct HPMHookPoint *HP_mapif_guild_alliance_pre; + struct HPMHookPoint *HP_mapif_guild_alliance_post; + struct HPMHookPoint *HP_mapif_guild_position_pre; + struct HPMHookPoint *HP_mapif_guild_position_post; + struct HPMHookPoint *HP_mapif_guild_notice_pre; + struct HPMHookPoint *HP_mapif_guild_notice_post; + struct HPMHookPoint *HP_mapif_guild_emblem_pre; + struct HPMHookPoint *HP_mapif_guild_emblem_post; + struct HPMHookPoint *HP_mapif_guild_master_changed_pre; + struct HPMHookPoint *HP_mapif_guild_master_changed_post; + struct HPMHookPoint *HP_mapif_guild_castle_dataload_pre; + struct HPMHookPoint *HP_mapif_guild_castle_dataload_post; + struct HPMHookPoint *HP_mapif_parse_CreateGuild_pre; + struct HPMHookPoint *HP_mapif_parse_CreateGuild_post; + struct HPMHookPoint *HP_mapif_parse_GuildInfo_pre; + struct HPMHookPoint *HP_mapif_parse_GuildInfo_post; + struct HPMHookPoint *HP_mapif_parse_GuildAddMember_pre; + struct HPMHookPoint *HP_mapif_parse_GuildAddMember_post; + struct HPMHookPoint *HP_mapif_parse_GuildLeave_pre; + struct HPMHookPoint *HP_mapif_parse_GuildLeave_post; + struct HPMHookPoint *HP_mapif_parse_GuildChangeMemberInfoShort_pre; + struct HPMHookPoint *HP_mapif_parse_GuildChangeMemberInfoShort_post; + struct HPMHookPoint *HP_mapif_parse_BreakGuild_pre; + struct HPMHookPoint *HP_mapif_parse_BreakGuild_post; + struct HPMHookPoint *HP_mapif_parse_GuildMessage_pre; + struct HPMHookPoint *HP_mapif_parse_GuildMessage_post; + struct HPMHookPoint *HP_mapif_parse_GuildBasicInfoChange_pre; + struct HPMHookPoint *HP_mapif_parse_GuildBasicInfoChange_post; + struct HPMHookPoint *HP_mapif_parse_GuildMemberInfoChange_pre; + struct HPMHookPoint *HP_mapif_parse_GuildMemberInfoChange_post; + struct HPMHookPoint *HP_mapif_parse_GuildPosition_pre; + struct HPMHookPoint *HP_mapif_parse_GuildPosition_post; + struct HPMHookPoint *HP_mapif_parse_GuildSkillUp_pre; + struct HPMHookPoint *HP_mapif_parse_GuildSkillUp_post; + struct HPMHookPoint *HP_mapif_parse_GuildDeleteAlliance_pre; + struct HPMHookPoint *HP_mapif_parse_GuildDeleteAlliance_post; + struct HPMHookPoint *HP_mapif_parse_GuildAlliance_pre; + struct HPMHookPoint *HP_mapif_parse_GuildAlliance_post; + struct HPMHookPoint *HP_mapif_parse_GuildNotice_pre; + struct HPMHookPoint *HP_mapif_parse_GuildNotice_post; + struct HPMHookPoint *HP_mapif_parse_GuildEmblem_pre; + struct HPMHookPoint *HP_mapif_parse_GuildEmblem_post; + struct HPMHookPoint *HP_mapif_parse_GuildCastleDataLoad_pre; + struct HPMHookPoint *HP_mapif_parse_GuildCastleDataLoad_post; + struct HPMHookPoint *HP_mapif_parse_GuildCastleDataSave_pre; + struct HPMHookPoint *HP_mapif_parse_GuildCastleDataSave_post; + struct HPMHookPoint *HP_mapif_parse_GuildMasterChange_pre; + struct HPMHookPoint *HP_mapif_parse_GuildMasterChange_post; + struct HPMHookPoint *HP_mapif_homunculus_created_pre; + struct HPMHookPoint *HP_mapif_homunculus_created_post; + struct HPMHookPoint *HP_mapif_homunculus_deleted_pre; + struct HPMHookPoint *HP_mapif_homunculus_deleted_post; + struct HPMHookPoint *HP_mapif_homunculus_loaded_pre; + struct HPMHookPoint *HP_mapif_homunculus_loaded_post; + struct HPMHookPoint *HP_mapif_homunculus_saved_pre; + struct HPMHookPoint *HP_mapif_homunculus_saved_post; + struct HPMHookPoint *HP_mapif_homunculus_renamed_pre; + struct HPMHookPoint *HP_mapif_homunculus_renamed_post; + struct HPMHookPoint *HP_mapif_homunculus_save_pre; + struct HPMHookPoint *HP_mapif_homunculus_save_post; + struct HPMHookPoint *HP_mapif_homunculus_load_pre; + struct HPMHookPoint *HP_mapif_homunculus_load_post; + struct HPMHookPoint *HP_mapif_homunculus_delete_pre; + struct HPMHookPoint *HP_mapif_homunculus_delete_post; + struct HPMHookPoint *HP_mapif_homunculus_rename_pre; + struct HPMHookPoint *HP_mapif_homunculus_rename_post; + struct HPMHookPoint *HP_mapif_parse_homunculus_create_pre; + struct HPMHookPoint *HP_mapif_parse_homunculus_create_post; + struct HPMHookPoint *HP_mapif_parse_homunculus_delete_pre; + struct HPMHookPoint *HP_mapif_parse_homunculus_delete_post; + struct HPMHookPoint *HP_mapif_parse_homunculus_load_pre; + struct HPMHookPoint *HP_mapif_parse_homunculus_load_post; + struct HPMHookPoint *HP_mapif_parse_homunculus_save_pre; + struct HPMHookPoint *HP_mapif_parse_homunculus_save_post; + struct HPMHookPoint *HP_mapif_parse_homunculus_rename_pre; + struct HPMHookPoint *HP_mapif_parse_homunculus_rename_post; + struct HPMHookPoint *HP_mapif_mail_sendinbox_pre; + struct HPMHookPoint *HP_mapif_mail_sendinbox_post; + struct HPMHookPoint *HP_mapif_parse_mail_requestinbox_pre; + struct HPMHookPoint *HP_mapif_parse_mail_requestinbox_post; + struct HPMHookPoint *HP_mapif_parse_mail_read_pre; + struct HPMHookPoint *HP_mapif_parse_mail_read_post; + struct HPMHookPoint *HP_mapif_mail_sendattach_pre; + struct HPMHookPoint *HP_mapif_mail_sendattach_post; + struct HPMHookPoint *HP_mapif_mail_getattach_pre; + struct HPMHookPoint *HP_mapif_mail_getattach_post; + struct HPMHookPoint *HP_mapif_parse_mail_getattach_pre; + struct HPMHookPoint *HP_mapif_parse_mail_getattach_post; + struct HPMHookPoint *HP_mapif_mail_delete_pre; + struct HPMHookPoint *HP_mapif_mail_delete_post; + struct HPMHookPoint *HP_mapif_parse_mail_delete_pre; + struct HPMHookPoint *HP_mapif_parse_mail_delete_post; + struct HPMHookPoint *HP_mapif_mail_new_pre; + struct HPMHookPoint *HP_mapif_mail_new_post; + struct HPMHookPoint *HP_mapif_mail_return_pre; + struct HPMHookPoint *HP_mapif_mail_return_post; + struct HPMHookPoint *HP_mapif_parse_mail_return_pre; + struct HPMHookPoint *HP_mapif_parse_mail_return_post; + struct HPMHookPoint *HP_mapif_mail_send_pre; + struct HPMHookPoint *HP_mapif_mail_send_post; + struct HPMHookPoint *HP_mapif_parse_mail_send_pre; + struct HPMHookPoint *HP_mapif_parse_mail_send_post; + struct HPMHookPoint *HP_mapif_mercenary_save_pre; + struct HPMHookPoint *HP_mapif_mercenary_save_post; + struct HPMHookPoint *HP_mapif_mercenary_load_pre; + struct HPMHookPoint *HP_mapif_mercenary_load_post; + struct HPMHookPoint *HP_mapif_mercenary_delete_pre; + struct HPMHookPoint *HP_mapif_mercenary_delete_post; + struct HPMHookPoint *HP_mapif_mercenary_send_pre; + struct HPMHookPoint *HP_mapif_mercenary_send_post; + struct HPMHookPoint *HP_mapif_parse_mercenary_create_pre; + struct HPMHookPoint *HP_mapif_parse_mercenary_create_post; + struct HPMHookPoint *HP_mapif_parse_mercenary_load_pre; + struct HPMHookPoint *HP_mapif_parse_mercenary_load_post; + struct HPMHookPoint *HP_mapif_mercenary_deleted_pre; + struct HPMHookPoint *HP_mapif_mercenary_deleted_post; + struct HPMHookPoint *HP_mapif_parse_mercenary_delete_pre; + struct HPMHookPoint *HP_mapif_parse_mercenary_delete_post; + struct HPMHookPoint *HP_mapif_mercenary_saved_pre; + struct HPMHookPoint *HP_mapif_mercenary_saved_post; + struct HPMHookPoint *HP_mapif_parse_mercenary_save_pre; + struct HPMHookPoint *HP_mapif_parse_mercenary_save_post; + struct HPMHookPoint *HP_mapif_party_created_pre; + struct HPMHookPoint *HP_mapif_party_created_post; + struct HPMHookPoint *HP_mapif_party_noinfo_pre; + struct HPMHookPoint *HP_mapif_party_noinfo_post; + struct HPMHookPoint *HP_mapif_party_info_pre; + struct HPMHookPoint *HP_mapif_party_info_post; + struct HPMHookPoint *HP_mapif_party_memberadded_pre; + struct HPMHookPoint *HP_mapif_party_memberadded_post; + struct HPMHookPoint *HP_mapif_party_optionchanged_pre; + struct HPMHookPoint *HP_mapif_party_optionchanged_post; + struct HPMHookPoint *HP_mapif_party_withdraw_pre; + struct HPMHookPoint *HP_mapif_party_withdraw_post; + struct HPMHookPoint *HP_mapif_party_membermoved_pre; + struct HPMHookPoint *HP_mapif_party_membermoved_post; + struct HPMHookPoint *HP_mapif_party_broken_pre; + struct HPMHookPoint *HP_mapif_party_broken_post; + struct HPMHookPoint *HP_mapif_party_message_pre; + struct HPMHookPoint *HP_mapif_party_message_post; + struct HPMHookPoint *HP_mapif_parse_CreateParty_pre; + struct HPMHookPoint *HP_mapif_parse_CreateParty_post; + struct HPMHookPoint *HP_mapif_parse_PartyInfo_pre; + struct HPMHookPoint *HP_mapif_parse_PartyInfo_post; + struct HPMHookPoint *HP_mapif_parse_PartyAddMember_pre; + struct HPMHookPoint *HP_mapif_parse_PartyAddMember_post; + struct HPMHookPoint *HP_mapif_parse_PartyChangeOption_pre; + struct HPMHookPoint *HP_mapif_parse_PartyChangeOption_post; + struct HPMHookPoint *HP_mapif_parse_PartyLeave_pre; + struct HPMHookPoint *HP_mapif_parse_PartyLeave_post; + struct HPMHookPoint *HP_mapif_parse_PartyChangeMap_pre; + struct HPMHookPoint *HP_mapif_parse_PartyChangeMap_post; + struct HPMHookPoint *HP_mapif_parse_BreakParty_pre; + struct HPMHookPoint *HP_mapif_parse_BreakParty_post; + struct HPMHookPoint *HP_mapif_parse_PartyMessage_pre; + struct HPMHookPoint *HP_mapif_parse_PartyMessage_post; + struct HPMHookPoint *HP_mapif_parse_PartyLeaderChange_pre; + struct HPMHookPoint *HP_mapif_parse_PartyLeaderChange_post; + struct HPMHookPoint *HP_mapif_pet_created_pre; + struct HPMHookPoint *HP_mapif_pet_created_post; + struct HPMHookPoint *HP_mapif_pet_info_pre; + struct HPMHookPoint *HP_mapif_pet_info_post; + struct HPMHookPoint *HP_mapif_pet_noinfo_pre; + struct HPMHookPoint *HP_mapif_pet_noinfo_post; + struct HPMHookPoint *HP_mapif_save_pet_ack_pre; + struct HPMHookPoint *HP_mapif_save_pet_ack_post; + struct HPMHookPoint *HP_mapif_delete_pet_ack_pre; + struct HPMHookPoint *HP_mapif_delete_pet_ack_post; + struct HPMHookPoint *HP_mapif_create_pet_pre; + struct HPMHookPoint *HP_mapif_create_pet_post; + struct HPMHookPoint *HP_mapif_load_pet_pre; + struct HPMHookPoint *HP_mapif_load_pet_post; + struct HPMHookPoint *HP_mapif_save_pet_pre; + struct HPMHookPoint *HP_mapif_save_pet_post; + struct HPMHookPoint *HP_mapif_delete_pet_pre; + struct HPMHookPoint *HP_mapif_delete_pet_post; + struct HPMHookPoint *HP_mapif_parse_CreatePet_pre; + struct HPMHookPoint *HP_mapif_parse_CreatePet_post; + struct HPMHookPoint *HP_mapif_parse_LoadPet_pre; + struct HPMHookPoint *HP_mapif_parse_LoadPet_post; + struct HPMHookPoint *HP_mapif_parse_SavePet_pre; + struct HPMHookPoint *HP_mapif_parse_SavePet_post; + struct HPMHookPoint *HP_mapif_parse_DeletePet_pre; + struct HPMHookPoint *HP_mapif_parse_DeletePet_post; + struct HPMHookPoint *HP_mapif_quests_fromsql_pre; + struct HPMHookPoint *HP_mapif_quests_fromsql_post; + struct HPMHookPoint *HP_mapif_quest_delete_pre; + struct HPMHookPoint *HP_mapif_quest_delete_post; + struct HPMHookPoint *HP_mapif_quest_add_pre; + struct HPMHookPoint *HP_mapif_quest_add_post; + struct HPMHookPoint *HP_mapif_quest_update_pre; + struct HPMHookPoint *HP_mapif_quest_update_post; + struct HPMHookPoint *HP_mapif_quest_save_ack_pre; + struct HPMHookPoint *HP_mapif_quest_save_ack_post; + struct HPMHookPoint *HP_mapif_parse_quest_save_pre; + struct HPMHookPoint *HP_mapif_parse_quest_save_post; + struct HPMHookPoint *HP_mapif_send_quests_pre; + struct HPMHookPoint *HP_mapif_send_quests_post; + struct HPMHookPoint *HP_mapif_parse_quest_load_pre; + struct HPMHookPoint *HP_mapif_parse_quest_load_post; + struct HPMHookPoint *HP_mapif_load_guild_storage_pre; + struct HPMHookPoint *HP_mapif_load_guild_storage_post; + struct HPMHookPoint *HP_mapif_save_guild_storage_ack_pre; + struct HPMHookPoint *HP_mapif_save_guild_storage_ack_post; + struct HPMHookPoint *HP_mapif_parse_LoadGuildStorage_pre; + struct HPMHookPoint *HP_mapif_parse_LoadGuildStorage_post; + struct HPMHookPoint *HP_mapif_parse_SaveGuildStorage_pre; + struct HPMHookPoint *HP_mapif_parse_SaveGuildStorage_post; + struct HPMHookPoint *HP_mapif_itembound_ack_pre; + struct HPMHookPoint *HP_mapif_itembound_ack_post; + struct HPMHookPoint *HP_mapif_parse_ItemBoundRetrieve_sub_pre; + struct HPMHookPoint *HP_mapif_parse_ItemBoundRetrieve_sub_post; + struct HPMHookPoint *HP_mapif_parse_ItemBoundRetrieve_pre; + struct HPMHookPoint *HP_mapif_parse_ItemBoundRetrieve_post; + struct HPMHookPoint *HP_mapif_parse_accinfo_pre; + struct HPMHookPoint *HP_mapif_parse_accinfo_post; + struct HPMHookPoint *HP_mapif_parse_accinfo2_pre; + struct HPMHookPoint *HP_mapif_parse_accinfo2_post; + struct HPMHookPoint *HP_mapif_broadcast_pre; + struct HPMHookPoint *HP_mapif_broadcast_post; + struct HPMHookPoint *HP_mapif_wis_message_pre; + struct HPMHookPoint *HP_mapif_wis_message_post; + struct HPMHookPoint *HP_mapif_wis_response_pre; + struct HPMHookPoint *HP_mapif_wis_response_post; + struct HPMHookPoint *HP_mapif_wis_end_pre; + struct HPMHookPoint *HP_mapif_wis_end_post; + struct HPMHookPoint *HP_mapif_account_reg_reply_pre; + struct HPMHookPoint *HP_mapif_account_reg_reply_post; + struct HPMHookPoint *HP_mapif_disconnectplayer_pre; + struct HPMHookPoint *HP_mapif_disconnectplayer_post; + struct HPMHookPoint *HP_mapif_parse_broadcast_pre; + struct HPMHookPoint *HP_mapif_parse_broadcast_post; + struct HPMHookPoint *HP_mapif_parse_WisRequest_pre; + struct HPMHookPoint *HP_mapif_parse_WisRequest_post; + struct HPMHookPoint *HP_mapif_parse_WisReply_pre; + struct HPMHookPoint *HP_mapif_parse_WisReply_post; + struct HPMHookPoint *HP_mapif_parse_WisToGM_pre; + struct HPMHookPoint *HP_mapif_parse_WisToGM_post; + struct HPMHookPoint *HP_mapif_parse_Registry_pre; + struct HPMHookPoint *HP_mapif_parse_Registry_post; + struct HPMHookPoint *HP_mapif_parse_RegistryRequest_pre; + struct HPMHookPoint *HP_mapif_parse_RegistryRequest_post; + struct HPMHookPoint *HP_mapif_namechange_ack_pre; + struct HPMHookPoint *HP_mapif_namechange_ack_post; + struct HPMHookPoint *HP_mapif_parse_NameChangeRequest_pre; + struct HPMHookPoint *HP_mapif_parse_NameChangeRequest_post; struct HPMHookPoint *HP_pincode_handle_pre; struct HPMHookPoint *HP_pincode_handle_post; struct HPMHookPoint *HP_pincode_decrypt_pre; @@ -28,6 +896,874 @@ struct { } list; struct { + int HP_chr_waiting_disconnect_pre; + int HP_chr_waiting_disconnect_post; + int HP_chr_delete_char_sql_pre; + int HP_chr_delete_char_sql_post; + int HP_chr_create_online_char_data_pre; + int HP_chr_create_online_char_data_post; + int HP_chr_set_account_online_pre; + int HP_chr_set_account_online_post; + int HP_chr_set_account_offline_pre; + int HP_chr_set_account_offline_post; + int HP_chr_set_char_charselect_pre; + int HP_chr_set_char_charselect_post; + int HP_chr_set_char_online_pre; + int HP_chr_set_char_online_post; + int HP_chr_set_char_offline_pre; + int HP_chr_set_char_offline_post; + int HP_chr_db_setoffline_pre; + int HP_chr_db_setoffline_post; + int HP_chr_db_kickoffline_pre; + int HP_chr_db_kickoffline_post; + int HP_chr_set_login_all_offline_pre; + int HP_chr_set_login_all_offline_post; + int HP_chr_set_all_offline_pre; + int HP_chr_set_all_offline_post; + int HP_chr_set_all_offline_sql_pre; + int HP_chr_set_all_offline_sql_post; + int HP_chr_create_charstatus_pre; + int HP_chr_create_charstatus_post; + int HP_chr_mmo_char_tosql_pre; + int HP_chr_mmo_char_tosql_post; + int HP_chr_memitemdata_to_sql_pre; + int HP_chr_memitemdata_to_sql_post; + int HP_chr_inventory_to_sql_pre; + int HP_chr_inventory_to_sql_post; + int HP_chr_mmo_chars_fromsql_pre; + int HP_chr_mmo_chars_fromsql_post; + int HP_chr_mmo_char_fromsql_pre; + int HP_chr_mmo_char_fromsql_post; + int HP_chr_mmo_char_sql_init_pre; + int HP_chr_mmo_char_sql_init_post; + int HP_chr_char_slotchange_pre; + int HP_chr_char_slotchange_post; + int HP_chr_rename_char_sql_pre; + int HP_chr_rename_char_sql_post; + int HP_chr_check_char_name_pre; + int HP_chr_check_char_name_post; + int HP_chr_make_new_char_sql_pre; + int HP_chr_make_new_char_sql_post; + int HP_chr_divorce_char_sql_pre; + int HP_chr_divorce_char_sql_post; + int HP_chr_count_users_pre; + int HP_chr_count_users_post; + int HP_chr_mmo_char_tobuf_pre; + int HP_chr_mmo_char_tobuf_post; + int HP_chr_mmo_char_send099d_pre; + int HP_chr_mmo_char_send099d_post; + int HP_chr_mmo_char_send_ban_list_pre; + int HP_chr_mmo_char_send_ban_list_post; + int HP_chr_mmo_char_send_slots_info_pre; + int HP_chr_mmo_char_send_slots_info_post; + int HP_chr_mmo_char_send_characters_pre; + int HP_chr_mmo_char_send_characters_post; + int HP_chr_char_married_pre; + int HP_chr_char_married_post; + int HP_chr_char_child_pre; + int HP_chr_char_child_post; + int HP_chr_char_family_pre; + int HP_chr_char_family_post; + int HP_chr_disconnect_player_pre; + int HP_chr_disconnect_player_post; + int HP_chr_authfail_fd_pre; + int HP_chr_authfail_fd_post; + int HP_chr_request_account_data_pre; + int HP_chr_request_account_data_post; + int HP_chr_auth_ok_pre; + int HP_chr_auth_ok_post; + int HP_chr_ping_login_server_pre; + int HP_chr_ping_login_server_post; + int HP_chr_parse_fromlogin_connection_state_pre; + int HP_chr_parse_fromlogin_connection_state_post; + int HP_chr_auth_error_pre; + int HP_chr_auth_error_post; + int HP_chr_parse_fromlogin_auth_state_pre; + int HP_chr_parse_fromlogin_auth_state_post; + int HP_chr_parse_fromlogin_account_data_pre; + int HP_chr_parse_fromlogin_account_data_post; + int HP_chr_parse_fromlogin_login_pong_pre; + int HP_chr_parse_fromlogin_login_pong_post; + int HP_chr_changesex_pre; + int HP_chr_changesex_post; + int HP_chr_parse_fromlogin_changesex_reply_pre; + int HP_chr_parse_fromlogin_changesex_reply_post; + int HP_chr_parse_fromlogin_account_reg2_pre; + int HP_chr_parse_fromlogin_account_reg2_post; + int HP_chr_parse_fromlogin_ban_pre; + int HP_chr_parse_fromlogin_ban_post; + int HP_chr_parse_fromlogin_kick_pre; + int HP_chr_parse_fromlogin_kick_post; + int HP_chr_update_ip_pre; + int HP_chr_update_ip_post; + int HP_chr_parse_fromlogin_update_ip_pre; + int HP_chr_parse_fromlogin_update_ip_post; + int HP_chr_parse_fromlogin_accinfo2_failed_pre; + int HP_chr_parse_fromlogin_accinfo2_failed_post; + int HP_chr_parse_fromlogin_accinfo2_ok_pre; + int HP_chr_parse_fromlogin_accinfo2_ok_post; + int HP_chr_parse_fromlogin_pre; + int HP_chr_parse_fromlogin_post; + int HP_chr_request_accreg2_pre; + int HP_chr_request_accreg2_post; + int HP_chr_global_accreg_to_login_start_pre; + int HP_chr_global_accreg_to_login_start_post; + int HP_chr_global_accreg_to_login_send_pre; + int HP_chr_global_accreg_to_login_send_post; + int HP_chr_global_accreg_to_login_add_pre; + int HP_chr_global_accreg_to_login_add_post; + int HP_chr_read_fame_list_pre; + int HP_chr_read_fame_list_post; + int HP_chr_send_fame_list_pre; + int HP_chr_send_fame_list_post; + int HP_chr_update_fame_list_pre; + int HP_chr_update_fame_list_post; + int HP_chr_loadName_pre; + int HP_chr_loadName_post; + int HP_chr_parse_frommap_datasync_pre; + int HP_chr_parse_frommap_datasync_post; + int HP_chr_parse_frommap_skillid2idx_pre; + int HP_chr_parse_frommap_skillid2idx_post; + int HP_chr_map_received_ok_pre; + int HP_chr_map_received_ok_post; + int HP_chr_send_maps_pre; + int HP_chr_send_maps_post; + int HP_chr_parse_frommap_map_names_pre; + int HP_chr_parse_frommap_map_names_post; + int HP_chr_send_scdata_pre; + int HP_chr_send_scdata_post; + int HP_chr_parse_frommap_request_scdata_pre; + int HP_chr_parse_frommap_request_scdata_post; + int HP_chr_parse_frommap_set_users_count_pre; + int HP_chr_parse_frommap_set_users_count_post; + int HP_chr_parse_frommap_set_users_pre; + int HP_chr_parse_frommap_set_users_post; + int HP_chr_save_character_ack_pre; + int HP_chr_save_character_ack_post; + int HP_chr_parse_frommap_save_character_pre; + int HP_chr_parse_frommap_save_character_post; + int HP_chr_select_ack_pre; + int HP_chr_select_ack_post; + int HP_chr_parse_frommap_char_select_req_pre; + int HP_chr_parse_frommap_char_select_req_post; + int HP_chr_change_map_server_ack_pre; + int HP_chr_change_map_server_ack_post; + int HP_chr_parse_frommap_change_map_server_pre; + int HP_chr_parse_frommap_change_map_server_post; + int HP_chr_parse_frommap_remove_friend_pre; + int HP_chr_parse_frommap_remove_friend_post; + int HP_chr_char_name_ack_pre; + int HP_chr_char_name_ack_post; + int HP_chr_parse_frommap_char_name_request_pre; + int HP_chr_parse_frommap_char_name_request_post; + int HP_chr_parse_frommap_change_email_pre; + int HP_chr_parse_frommap_change_email_post; + int HP_chr_ban_pre; + int HP_chr_ban_post; + int HP_chr_unban_pre; + int HP_chr_unban_post; + int HP_chr_ask_name_ack_pre; + int HP_chr_ask_name_ack_post; + int HP_chr_parse_frommap_change_account_pre; + int HP_chr_parse_frommap_change_account_post; + int HP_chr_parse_frommap_fame_list_pre; + int HP_chr_parse_frommap_fame_list_post; + int HP_chr_parse_frommap_divorce_char_pre; + int HP_chr_parse_frommap_divorce_char_post; + int HP_chr_parse_frommap_ragsrvinfo_pre; + int HP_chr_parse_frommap_ragsrvinfo_post; + int HP_chr_parse_frommap_set_char_offline_pre; + int HP_chr_parse_frommap_set_char_offline_post; + int HP_chr_parse_frommap_set_all_offline_pre; + int HP_chr_parse_frommap_set_all_offline_post; + int HP_chr_parse_frommap_set_char_online_pre; + int HP_chr_parse_frommap_set_char_online_post; + int HP_chr_parse_frommap_build_fame_list_pre; + int HP_chr_parse_frommap_build_fame_list_post; + int HP_chr_parse_frommap_save_status_change_data_pre; + int HP_chr_parse_frommap_save_status_change_data_post; + int HP_chr_send_pong_pre; + int HP_chr_send_pong_post; + int HP_chr_parse_frommap_ping_pre; + int HP_chr_parse_frommap_ping_post; + int HP_chr_map_auth_ok_pre; + int HP_chr_map_auth_ok_post; + int HP_chr_map_auth_failed_pre; + int HP_chr_map_auth_failed_post; + int HP_chr_parse_frommap_auth_request_pre; + int HP_chr_parse_frommap_auth_request_post; + int HP_chr_parse_frommap_update_ip_pre; + int HP_chr_parse_frommap_update_ip_post; + int HP_chr_parse_frommap_request_stats_report_pre; + int HP_chr_parse_frommap_request_stats_report_post; + int HP_chr_parse_frommap_scdata_update_pre; + int HP_chr_parse_frommap_scdata_update_post; + int HP_chr_parse_frommap_scdata_delete_pre; + int HP_chr_parse_frommap_scdata_delete_post; + int HP_chr_parse_frommap_pre; + int HP_chr_parse_frommap_post; + int HP_chr_search_mapserver_pre; + int HP_chr_search_mapserver_post; + int HP_chr_mapif_init_pre; + int HP_chr_mapif_init_post; + int HP_chr_lan_subnetcheck_pre; + int HP_chr_lan_subnetcheck_post; + int HP_chr_delete2_ack_pre; + int HP_chr_delete2_ack_post; + int HP_chr_delete2_accept_actual_ack_pre; + int HP_chr_delete2_accept_actual_ack_post; + int HP_chr_delete2_accept_ack_pre; + int HP_chr_delete2_accept_ack_post; + int HP_chr_delete2_cancel_ack_pre; + int HP_chr_delete2_cancel_ack_post; + int HP_chr_delete2_req_pre; + int HP_chr_delete2_req_post; + int HP_chr_delete2_accept_pre; + int HP_chr_delete2_accept_post; + int HP_chr_delete2_cancel_pre; + int HP_chr_delete2_cancel_post; + int HP_chr_send_account_id_pre; + int HP_chr_send_account_id_post; + int HP_chr_parse_char_connect_pre; + int HP_chr_parse_char_connect_post; + int HP_chr_send_map_info_pre; + int HP_chr_send_map_info_post; + int HP_chr_send_wait_char_server_pre; + int HP_chr_send_wait_char_server_post; + int HP_chr_search_default_maps_mapserver_pre; + int HP_chr_search_default_maps_mapserver_post; + int HP_chr_parse_char_select_pre; + int HP_chr_parse_char_select_post; + int HP_chr_creation_failed_pre; + int HP_chr_creation_failed_post; + int HP_chr_creation_ok_pre; + int HP_chr_creation_ok_post; + int HP_chr_parse_char_create_new_char_pre; + int HP_chr_parse_char_create_new_char_post; + int HP_chr_delete_char_failed_pre; + int HP_chr_delete_char_failed_post; + int HP_chr_delete_char_ok_pre; + int HP_chr_delete_char_ok_post; + int HP_chr_parse_char_delete_char_pre; + int HP_chr_parse_char_delete_char_post; + int HP_chr_parse_char_ping_pre; + int HP_chr_parse_char_ping_post; + int HP_chr_allow_rename_pre; + int HP_chr_allow_rename_post; + int HP_chr_parse_char_rename_char_pre; + int HP_chr_parse_char_rename_char_post; + int HP_chr_parse_char_rename_char2_pre; + int HP_chr_parse_char_rename_char2_post; + int HP_chr_rename_char_ack_pre; + int HP_chr_rename_char_ack_post; + int HP_chr_parse_char_rename_char_confirm_pre; + int HP_chr_parse_char_rename_char_confirm_post; + int HP_chr_captcha_notsupported_pre; + int HP_chr_captcha_notsupported_post; + int HP_chr_parse_char_request_captcha_pre; + int HP_chr_parse_char_request_captcha_post; + int HP_chr_parse_char_check_captcha_pre; + int HP_chr_parse_char_check_captcha_post; + int HP_chr_parse_char_delete2_req_pre; + int HP_chr_parse_char_delete2_req_post; + int HP_chr_parse_char_delete2_accept_pre; + int HP_chr_parse_char_delete2_accept_post; + int HP_chr_parse_char_delete2_cancel_pre; + int HP_chr_parse_char_delete2_cancel_post; + int HP_chr_login_map_server_ack_pre; + int HP_chr_login_map_server_ack_post; + int HP_chr_parse_char_login_map_server_pre; + int HP_chr_parse_char_login_map_server_post; + int HP_chr_parse_char_pincode_check_pre; + int HP_chr_parse_char_pincode_check_post; + int HP_chr_parse_char_pincode_window_pre; + int HP_chr_parse_char_pincode_window_post; + int HP_chr_parse_char_pincode_change_pre; + int HP_chr_parse_char_pincode_change_post; + int HP_chr_parse_char_pincode_first_pin_pre; + int HP_chr_parse_char_pincode_first_pin_post; + int HP_chr_parse_char_request_chars_pre; + int HP_chr_parse_char_request_chars_post; + int HP_chr_change_character_slot_ack_pre; + int HP_chr_change_character_slot_ack_post; + int HP_chr_parse_char_move_character_pre; + int HP_chr_parse_char_move_character_post; + int HP_chr_parse_char_unknown_packet_pre; + int HP_chr_parse_char_unknown_packet_post; + int HP_chr_parse_char_pre; + int HP_chr_parse_char_post; + int HP_chr_broadcast_user_count_pre; + int HP_chr_broadcast_user_count_post; + int HP_chr_send_accounts_tologin_sub_pre; + int HP_chr_send_accounts_tologin_sub_post; + int HP_chr_send_accounts_tologin_pre; + int HP_chr_send_accounts_tologin_post; + int HP_chr_check_connect_login_server_pre; + int HP_chr_check_connect_login_server_post; + int HP_chr_online_data_cleanup_sub_pre; + int HP_chr_online_data_cleanup_sub_post; + int HP_chr_online_data_cleanup_pre; + int HP_chr_online_data_cleanup_post; + int HP_chr_lan_config_read_pre; + int HP_chr_lan_config_read_post; + int HP_chr_sql_config_read_pre; + int HP_chr_sql_config_read_post; + int HP_chr_config_dispatch_pre; + int HP_chr_config_dispatch_post; + int HP_chr_config_read_pre; + int HP_chr_config_read_post; + int HP_geoip_getcountry_pre; + int HP_geoip_getcountry_post; + int HP_geoip_final_pre; + int HP_geoip_final_post; + int HP_geoip_init_pre; + int HP_geoip_init_post; + int HP_inter_auction_count_pre; + int HP_inter_auction_count_post; + int HP_inter_auction_save_pre; + int HP_inter_auction_save_post; + int HP_inter_auction_create_pre; + int HP_inter_auction_create_post; + int HP_inter_auction_end_timer_pre; + int HP_inter_auction_end_timer_post; + int HP_inter_auction_delete__pre; + int HP_inter_auction_delete__post; + int HP_inter_auction_fromsql_pre; + int HP_inter_auction_fromsql_post; + int HP_inter_auction_parse_frommap_pre; + int HP_inter_auction_parse_frommap_post; + int HP_inter_auction_sql_init_pre; + int HP_inter_auction_sql_init_post; + int HP_inter_auction_sql_final_pre; + int HP_inter_auction_sql_final_post; + int HP_inter_elemental_sql_init_pre; + int HP_inter_elemental_sql_init_post; + int HP_inter_elemental_sql_final_pre; + int HP_inter_elemental_sql_final_post; + int HP_inter_elemental_parse_frommap_pre; + int HP_inter_elemental_parse_frommap_post; + int HP_inter_guild_save_timer_pre; + int HP_inter_guild_save_timer_post; + int HP_inter_guild_removemember_tosql_pre; + int HP_inter_guild_removemember_tosql_post; + int HP_inter_guild_tosql_pre; + int HP_inter_guild_tosql_post; + int HP_inter_guild_fromsql_pre; + int HP_inter_guild_fromsql_post; + int HP_inter_guild_castle_tosql_pre; + int HP_inter_guild_castle_tosql_post; + int HP_inter_guild_castle_fromsql_pre; + int HP_inter_guild_castle_fromsql_post; + int HP_inter_guild_exp_parse_row_pre; + int HP_inter_guild_exp_parse_row_post; + int HP_inter_guild_CharOnline_pre; + int HP_inter_guild_CharOnline_post; + int HP_inter_guild_CharOffline_pre; + int HP_inter_guild_CharOffline_post; + int HP_inter_guild_sql_init_pre; + int HP_inter_guild_sql_init_post; + int HP_inter_guild_db_final_pre; + int HP_inter_guild_db_final_post; + int HP_inter_guild_sql_final_pre; + int HP_inter_guild_sql_final_post; + int HP_inter_guild_search_guildname_pre; + int HP_inter_guild_search_guildname_post; + int HP_inter_guild_check_empty_pre; + int HP_inter_guild_check_empty_post; + int HP_inter_guild_nextexp_pre; + int HP_inter_guild_nextexp_post; + int HP_inter_guild_checkskill_pre; + int HP_inter_guild_checkskill_post; + int HP_inter_guild_calcinfo_pre; + int HP_inter_guild_calcinfo_post; + int HP_inter_guild_sex_changed_pre; + int HP_inter_guild_sex_changed_post; + int HP_inter_guild_charname_changed_pre; + int HP_inter_guild_charname_changed_post; + int HP_inter_guild_parse_frommap_pre; + int HP_inter_guild_parse_frommap_post; + int HP_inter_guild_leave_pre; + int HP_inter_guild_leave_post; + int HP_inter_guild_broken_pre; + int HP_inter_guild_broken_post; + int HP_inter_homunculus_sql_init_pre; + int HP_inter_homunculus_sql_init_post; + int HP_inter_homunculus_sql_final_pre; + int HP_inter_homunculus_sql_final_post; + int HP_inter_homunculus_parse_frommap_pre; + int HP_inter_homunculus_parse_frommap_post; + int HP_inter_msg_txt_pre; + int HP_inter_msg_txt_post; + int HP_inter_msg_config_read_pre; + int HP_inter_msg_config_read_post; + int HP_inter_do_final_msg_pre; + int HP_inter_do_final_msg_post; + int HP_inter_job_name_pre; + int HP_inter_job_name_post; + int HP_inter_vmsg_to_fd_pre; + int HP_inter_vmsg_to_fd_post; + int HP_inter_savereg_pre; + int HP_inter_savereg_post; + int HP_inter_accreg_fromsql_pre; + int HP_inter_accreg_fromsql_post; + int HP_inter_config_read_pre; + int HP_inter_config_read_post; + int HP_inter_vlog_pre; + int HP_inter_vlog_post; + int HP_inter_init_sql_pre; + int HP_inter_init_sql_post; + int HP_inter_mapif_init_pre; + int HP_inter_mapif_init_post; + int HP_inter_check_ttl_wisdata_sub_pre; + int HP_inter_check_ttl_wisdata_sub_post; + int HP_inter_check_ttl_wisdata_pre; + int HP_inter_check_ttl_wisdata_post; + int HP_inter_check_length_pre; + int HP_inter_check_length_post; + int HP_inter_parse_frommap_pre; + int HP_inter_parse_frommap_post; + int HP_inter_final_pre; + int HP_inter_final_post; + int HP_inter_mail_sql_init_pre; + int HP_inter_mail_sql_init_post; + int HP_inter_mail_sql_final_pre; + int HP_inter_mail_sql_final_post; + int HP_inter_mail_parse_frommap_pre; + int HP_inter_mail_parse_frommap_post; + int HP_inter_mail_fromsql_pre; + int HP_inter_mail_fromsql_post; + int HP_inter_mail_savemessage_pre; + int HP_inter_mail_savemessage_post; + int HP_inter_mail_loadmessage_pre; + int HP_inter_mail_loadmessage_post; + int HP_inter_mail_DeleteAttach_pre; + int HP_inter_mail_DeleteAttach_post; + int HP_inter_mail_sendmail_pre; + int HP_inter_mail_sendmail_post; + int HP_inter_mercenary_owner_fromsql_pre; + int HP_inter_mercenary_owner_fromsql_post; + int HP_inter_mercenary_owner_tosql_pre; + int HP_inter_mercenary_owner_tosql_post; + int HP_inter_mercenary_owner_delete_pre; + int HP_inter_mercenary_owner_delete_post; + int HP_inter_mercenary_sql_init_pre; + int HP_inter_mercenary_sql_init_post; + int HP_inter_mercenary_sql_final_pre; + int HP_inter_mercenary_sql_final_post; + int HP_inter_mercenary_parse_frommap_pre; + int HP_inter_mercenary_parse_frommap_post; + int HP_inter_party_check_lv_pre; + int HP_inter_party_check_lv_post; + int HP_inter_party_calc_state_pre; + int HP_inter_party_calc_state_post; + int HP_inter_party_tosql_pre; + int HP_inter_party_tosql_post; + int HP_inter_party_fromsql_pre; + int HP_inter_party_fromsql_post; + int HP_inter_party_sql_init_pre; + int HP_inter_party_sql_init_post; + int HP_inter_party_sql_final_pre; + int HP_inter_party_sql_final_post; + int HP_inter_party_search_partyname_pre; + int HP_inter_party_search_partyname_post; + int HP_inter_party_check_exp_share_pre; + int HP_inter_party_check_exp_share_post; + int HP_inter_party_check_empty_pre; + int HP_inter_party_check_empty_post; + int HP_inter_party_parse_frommap_pre; + int HP_inter_party_parse_frommap_post; + int HP_inter_party_leave_pre; + int HP_inter_party_leave_post; + int HP_inter_party_CharOnline_pre; + int HP_inter_party_CharOnline_post; + int HP_inter_party_CharOffline_pre; + int HP_inter_party_CharOffline_post; + int HP_inter_pet_tosql_pre; + int HP_inter_pet_tosql_post; + int HP_inter_pet_fromsql_pre; + int HP_inter_pet_fromsql_post; + int HP_inter_pet_sql_init_pre; + int HP_inter_pet_sql_init_post; + int HP_inter_pet_sql_final_pre; + int HP_inter_pet_sql_final_post; + int HP_inter_pet_delete__pre; + int HP_inter_pet_delete__post; + int HP_inter_pet_parse_frommap_pre; + int HP_inter_pet_parse_frommap_post; + int HP_inter_quest_parse_frommap_pre; + int HP_inter_quest_parse_frommap_post; + int HP_inter_storage_tosql_pre; + int HP_inter_storage_tosql_post; + int HP_inter_storage_fromsql_pre; + int HP_inter_storage_fromsql_post; + int HP_inter_storage_guild_storage_tosql_pre; + int HP_inter_storage_guild_storage_tosql_post; + int HP_inter_storage_guild_storage_fromsql_pre; + int HP_inter_storage_guild_storage_fromsql_post; + int HP_inter_storage_sql_init_pre; + int HP_inter_storage_sql_init_post; + int HP_inter_storage_sql_final_pre; + int HP_inter_storage_sql_final_post; + int HP_inter_storage_delete__pre; + int HP_inter_storage_delete__post; + int HP_inter_storage_guild_storage_delete_pre; + int HP_inter_storage_guild_storage_delete_post; + int HP_inter_storage_parse_frommap_pre; + int HP_inter_storage_parse_frommap_post; + int HP_loginif_reset_pre; + int HP_loginif_reset_post; + int HP_loginif_check_shutdown_pre; + int HP_loginif_check_shutdown_post; + int HP_loginif_on_disconnect_pre; + int HP_loginif_on_disconnect_post; + int HP_loginif_on_ready_pre; + int HP_loginif_on_ready_post; + int HP_loginif_block_account_pre; + int HP_loginif_block_account_post; + int HP_loginif_ban_account_pre; + int HP_loginif_ban_account_post; + int HP_loginif_unban_account_pre; + int HP_loginif_unban_account_post; + int HP_loginif_changesex_pre; + int HP_loginif_changesex_post; + int HP_loginif_auth_pre; + int HP_loginif_auth_post; + int HP_loginif_send_users_count_pre; + int HP_loginif_send_users_count_post; + int HP_loginif_connect_to_server_pre; + int HP_loginif_connect_to_server_post; + int HP_mapif_ban_pre; + int HP_mapif_ban_post; + int HP_mapif_server_init_pre; + int HP_mapif_server_init_post; + int HP_mapif_server_destroy_pre; + int HP_mapif_server_destroy_post; + int HP_mapif_server_reset_pre; + int HP_mapif_server_reset_post; + int HP_mapif_on_disconnect_pre; + int HP_mapif_on_disconnect_post; + int HP_mapif_on_parse_accinfo_pre; + int HP_mapif_on_parse_accinfo_post; + int HP_mapif_char_ban_pre; + int HP_mapif_char_ban_post; + int HP_mapif_sendall_pre; + int HP_mapif_sendall_post; + int HP_mapif_sendallwos_pre; + int HP_mapif_sendallwos_post; + int HP_mapif_send_pre; + int HP_mapif_send_post; + int HP_mapif_send_users_count_pre; + int HP_mapif_send_users_count_post; + int HP_mapif_auction_message_pre; + int HP_mapif_auction_message_post; + int HP_mapif_auction_sendlist_pre; + int HP_mapif_auction_sendlist_post; + int HP_mapif_parse_auction_requestlist_pre; + int HP_mapif_parse_auction_requestlist_post; + int HP_mapif_auction_register_pre; + int HP_mapif_auction_register_post; + int HP_mapif_parse_auction_register_pre; + int HP_mapif_parse_auction_register_post; + int HP_mapif_auction_cancel_pre; + int HP_mapif_auction_cancel_post; + int HP_mapif_parse_auction_cancel_pre; + int HP_mapif_parse_auction_cancel_post; + int HP_mapif_auction_close_pre; + int HP_mapif_auction_close_post; + int HP_mapif_parse_auction_close_pre; + int HP_mapif_parse_auction_close_post; + int HP_mapif_auction_bid_pre; + int HP_mapif_auction_bid_post; + int HP_mapif_parse_auction_bid_pre; + int HP_mapif_parse_auction_bid_post; + int HP_mapif_elemental_save_pre; + int HP_mapif_elemental_save_post; + int HP_mapif_elemental_load_pre; + int HP_mapif_elemental_load_post; + int HP_mapif_elemental_delete_pre; + int HP_mapif_elemental_delete_post; + int HP_mapif_elemental_send_pre; + int HP_mapif_elemental_send_post; + int HP_mapif_parse_elemental_create_pre; + int HP_mapif_parse_elemental_create_post; + int HP_mapif_parse_elemental_load_pre; + int HP_mapif_parse_elemental_load_post; + int HP_mapif_elemental_deleted_pre; + int HP_mapif_elemental_deleted_post; + int HP_mapif_parse_elemental_delete_pre; + int HP_mapif_parse_elemental_delete_post; + int HP_mapif_elemental_saved_pre; + int HP_mapif_elemental_saved_post; + int HP_mapif_parse_elemental_save_pre; + int HP_mapif_parse_elemental_save_post; + int HP_mapif_guild_created_pre; + int HP_mapif_guild_created_post; + int HP_mapif_guild_noinfo_pre; + int HP_mapif_guild_noinfo_post; + int HP_mapif_guild_info_pre; + int HP_mapif_guild_info_post; + int HP_mapif_guild_memberadded_pre; + int HP_mapif_guild_memberadded_post; + int HP_mapif_guild_withdraw_pre; + int HP_mapif_guild_withdraw_post; + int HP_mapif_guild_memberinfoshort_pre; + int HP_mapif_guild_memberinfoshort_post; + int HP_mapif_guild_broken_pre; + int HP_mapif_guild_broken_post; + int HP_mapif_guild_message_pre; + int HP_mapif_guild_message_post; + int HP_mapif_guild_basicinfochanged_pre; + int HP_mapif_guild_basicinfochanged_post; + int HP_mapif_guild_memberinfochanged_pre; + int HP_mapif_guild_memberinfochanged_post; + int HP_mapif_guild_skillupack_pre; + int HP_mapif_guild_skillupack_post; + int HP_mapif_guild_alliance_pre; + int HP_mapif_guild_alliance_post; + int HP_mapif_guild_position_pre; + int HP_mapif_guild_position_post; + int HP_mapif_guild_notice_pre; + int HP_mapif_guild_notice_post; + int HP_mapif_guild_emblem_pre; + int HP_mapif_guild_emblem_post; + int HP_mapif_guild_master_changed_pre; + int HP_mapif_guild_master_changed_post; + int HP_mapif_guild_castle_dataload_pre; + int HP_mapif_guild_castle_dataload_post; + int HP_mapif_parse_CreateGuild_pre; + int HP_mapif_parse_CreateGuild_post; + int HP_mapif_parse_GuildInfo_pre; + int HP_mapif_parse_GuildInfo_post; + int HP_mapif_parse_GuildAddMember_pre; + int HP_mapif_parse_GuildAddMember_post; + int HP_mapif_parse_GuildLeave_pre; + int HP_mapif_parse_GuildLeave_post; + int HP_mapif_parse_GuildChangeMemberInfoShort_pre; + int HP_mapif_parse_GuildChangeMemberInfoShort_post; + int HP_mapif_parse_BreakGuild_pre; + int HP_mapif_parse_BreakGuild_post; + int HP_mapif_parse_GuildMessage_pre; + int HP_mapif_parse_GuildMessage_post; + int HP_mapif_parse_GuildBasicInfoChange_pre; + int HP_mapif_parse_GuildBasicInfoChange_post; + int HP_mapif_parse_GuildMemberInfoChange_pre; + int HP_mapif_parse_GuildMemberInfoChange_post; + int HP_mapif_parse_GuildPosition_pre; + int HP_mapif_parse_GuildPosition_post; + int HP_mapif_parse_GuildSkillUp_pre; + int HP_mapif_parse_GuildSkillUp_post; + int HP_mapif_parse_GuildDeleteAlliance_pre; + int HP_mapif_parse_GuildDeleteAlliance_post; + int HP_mapif_parse_GuildAlliance_pre; + int HP_mapif_parse_GuildAlliance_post; + int HP_mapif_parse_GuildNotice_pre; + int HP_mapif_parse_GuildNotice_post; + int HP_mapif_parse_GuildEmblem_pre; + int HP_mapif_parse_GuildEmblem_post; + int HP_mapif_parse_GuildCastleDataLoad_pre; + int HP_mapif_parse_GuildCastleDataLoad_post; + int HP_mapif_parse_GuildCastleDataSave_pre; + int HP_mapif_parse_GuildCastleDataSave_post; + int HP_mapif_parse_GuildMasterChange_pre; + int HP_mapif_parse_GuildMasterChange_post; + int HP_mapif_homunculus_created_pre; + int HP_mapif_homunculus_created_post; + int HP_mapif_homunculus_deleted_pre; + int HP_mapif_homunculus_deleted_post; + int HP_mapif_homunculus_loaded_pre; + int HP_mapif_homunculus_loaded_post; + int HP_mapif_homunculus_saved_pre; + int HP_mapif_homunculus_saved_post; + int HP_mapif_homunculus_renamed_pre; + int HP_mapif_homunculus_renamed_post; + int HP_mapif_homunculus_save_pre; + int HP_mapif_homunculus_save_post; + int HP_mapif_homunculus_load_pre; + int HP_mapif_homunculus_load_post; + int HP_mapif_homunculus_delete_pre; + int HP_mapif_homunculus_delete_post; + int HP_mapif_homunculus_rename_pre; + int HP_mapif_homunculus_rename_post; + int HP_mapif_parse_homunculus_create_pre; + int HP_mapif_parse_homunculus_create_post; + int HP_mapif_parse_homunculus_delete_pre; + int HP_mapif_parse_homunculus_delete_post; + int HP_mapif_parse_homunculus_load_pre; + int HP_mapif_parse_homunculus_load_post; + int HP_mapif_parse_homunculus_save_pre; + int HP_mapif_parse_homunculus_save_post; + int HP_mapif_parse_homunculus_rename_pre; + int HP_mapif_parse_homunculus_rename_post; + int HP_mapif_mail_sendinbox_pre; + int HP_mapif_mail_sendinbox_post; + int HP_mapif_parse_mail_requestinbox_pre; + int HP_mapif_parse_mail_requestinbox_post; + int HP_mapif_parse_mail_read_pre; + int HP_mapif_parse_mail_read_post; + int HP_mapif_mail_sendattach_pre; + int HP_mapif_mail_sendattach_post; + int HP_mapif_mail_getattach_pre; + int HP_mapif_mail_getattach_post; + int HP_mapif_parse_mail_getattach_pre; + int HP_mapif_parse_mail_getattach_post; + int HP_mapif_mail_delete_pre; + int HP_mapif_mail_delete_post; + int HP_mapif_parse_mail_delete_pre; + int HP_mapif_parse_mail_delete_post; + int HP_mapif_mail_new_pre; + int HP_mapif_mail_new_post; + int HP_mapif_mail_return_pre; + int HP_mapif_mail_return_post; + int HP_mapif_parse_mail_return_pre; + int HP_mapif_parse_mail_return_post; + int HP_mapif_mail_send_pre; + int HP_mapif_mail_send_post; + int HP_mapif_parse_mail_send_pre; + int HP_mapif_parse_mail_send_post; + int HP_mapif_mercenary_save_pre; + int HP_mapif_mercenary_save_post; + int HP_mapif_mercenary_load_pre; + int HP_mapif_mercenary_load_post; + int HP_mapif_mercenary_delete_pre; + int HP_mapif_mercenary_delete_post; + int HP_mapif_mercenary_send_pre; + int HP_mapif_mercenary_send_post; + int HP_mapif_parse_mercenary_create_pre; + int HP_mapif_parse_mercenary_create_post; + int HP_mapif_parse_mercenary_load_pre; + int HP_mapif_parse_mercenary_load_post; + int HP_mapif_mercenary_deleted_pre; + int HP_mapif_mercenary_deleted_post; + int HP_mapif_parse_mercenary_delete_pre; + int HP_mapif_parse_mercenary_delete_post; + int HP_mapif_mercenary_saved_pre; + int HP_mapif_mercenary_saved_post; + int HP_mapif_parse_mercenary_save_pre; + int HP_mapif_parse_mercenary_save_post; + int HP_mapif_party_created_pre; + int HP_mapif_party_created_post; + int HP_mapif_party_noinfo_pre; + int HP_mapif_party_noinfo_post; + int HP_mapif_party_info_pre; + int HP_mapif_party_info_post; + int HP_mapif_party_memberadded_pre; + int HP_mapif_party_memberadded_post; + int HP_mapif_party_optionchanged_pre; + int HP_mapif_party_optionchanged_post; + int HP_mapif_party_withdraw_pre; + int HP_mapif_party_withdraw_post; + int HP_mapif_party_membermoved_pre; + int HP_mapif_party_membermoved_post; + int HP_mapif_party_broken_pre; + int HP_mapif_party_broken_post; + int HP_mapif_party_message_pre; + int HP_mapif_party_message_post; + int HP_mapif_parse_CreateParty_pre; + int HP_mapif_parse_CreateParty_post; + int HP_mapif_parse_PartyInfo_pre; + int HP_mapif_parse_PartyInfo_post; + int HP_mapif_parse_PartyAddMember_pre; + int HP_mapif_parse_PartyAddMember_post; + int HP_mapif_parse_PartyChangeOption_pre; + int HP_mapif_parse_PartyChangeOption_post; + int HP_mapif_parse_PartyLeave_pre; + int HP_mapif_parse_PartyLeave_post; + int HP_mapif_parse_PartyChangeMap_pre; + int HP_mapif_parse_PartyChangeMap_post; + int HP_mapif_parse_BreakParty_pre; + int HP_mapif_parse_BreakParty_post; + int HP_mapif_parse_PartyMessage_pre; + int HP_mapif_parse_PartyMessage_post; + int HP_mapif_parse_PartyLeaderChange_pre; + int HP_mapif_parse_PartyLeaderChange_post; + int HP_mapif_pet_created_pre; + int HP_mapif_pet_created_post; + int HP_mapif_pet_info_pre; + int HP_mapif_pet_info_post; + int HP_mapif_pet_noinfo_pre; + int HP_mapif_pet_noinfo_post; + int HP_mapif_save_pet_ack_pre; + int HP_mapif_save_pet_ack_post; + int HP_mapif_delete_pet_ack_pre; + int HP_mapif_delete_pet_ack_post; + int HP_mapif_create_pet_pre; + int HP_mapif_create_pet_post; + int HP_mapif_load_pet_pre; + int HP_mapif_load_pet_post; + int HP_mapif_save_pet_pre; + int HP_mapif_save_pet_post; + int HP_mapif_delete_pet_pre; + int HP_mapif_delete_pet_post; + int HP_mapif_parse_CreatePet_pre; + int HP_mapif_parse_CreatePet_post; + int HP_mapif_parse_LoadPet_pre; + int HP_mapif_parse_LoadPet_post; + int HP_mapif_parse_SavePet_pre; + int HP_mapif_parse_SavePet_post; + int HP_mapif_parse_DeletePet_pre; + int HP_mapif_parse_DeletePet_post; + int HP_mapif_quests_fromsql_pre; + int HP_mapif_quests_fromsql_post; + int HP_mapif_quest_delete_pre; + int HP_mapif_quest_delete_post; + int HP_mapif_quest_add_pre; + int HP_mapif_quest_add_post; + int HP_mapif_quest_update_pre; + int HP_mapif_quest_update_post; + int HP_mapif_quest_save_ack_pre; + int HP_mapif_quest_save_ack_post; + int HP_mapif_parse_quest_save_pre; + int HP_mapif_parse_quest_save_post; + int HP_mapif_send_quests_pre; + int HP_mapif_send_quests_post; + int HP_mapif_parse_quest_load_pre; + int HP_mapif_parse_quest_load_post; + int HP_mapif_load_guild_storage_pre; + int HP_mapif_load_guild_storage_post; + int HP_mapif_save_guild_storage_ack_pre; + int HP_mapif_save_guild_storage_ack_post; + int HP_mapif_parse_LoadGuildStorage_pre; + int HP_mapif_parse_LoadGuildStorage_post; + int HP_mapif_parse_SaveGuildStorage_pre; + int HP_mapif_parse_SaveGuildStorage_post; + int HP_mapif_itembound_ack_pre; + int HP_mapif_itembound_ack_post; + int HP_mapif_parse_ItemBoundRetrieve_sub_pre; + int HP_mapif_parse_ItemBoundRetrieve_sub_post; + int HP_mapif_parse_ItemBoundRetrieve_pre; + int HP_mapif_parse_ItemBoundRetrieve_post; + int HP_mapif_parse_accinfo_pre; + int HP_mapif_parse_accinfo_post; + int HP_mapif_parse_accinfo2_pre; + int HP_mapif_parse_accinfo2_post; + int HP_mapif_broadcast_pre; + int HP_mapif_broadcast_post; + int HP_mapif_wis_message_pre; + int HP_mapif_wis_message_post; + int HP_mapif_wis_response_pre; + int HP_mapif_wis_response_post; + int HP_mapif_wis_end_pre; + int HP_mapif_wis_end_post; + int HP_mapif_account_reg_reply_pre; + int HP_mapif_account_reg_reply_post; + int HP_mapif_disconnectplayer_pre; + int HP_mapif_disconnectplayer_post; + int HP_mapif_parse_broadcast_pre; + int HP_mapif_parse_broadcast_post; + int HP_mapif_parse_WisRequest_pre; + int HP_mapif_parse_WisRequest_post; + int HP_mapif_parse_WisReply_pre; + int HP_mapif_parse_WisReply_post; + int HP_mapif_parse_WisToGM_pre; + int HP_mapif_parse_WisToGM_post; + int HP_mapif_parse_Registry_pre; + int HP_mapif_parse_Registry_post; + int HP_mapif_parse_RegistryRequest_pre; + int HP_mapif_parse_RegistryRequest_post; + int HP_mapif_namechange_ack_pre; + int HP_mapif_namechange_ack_post; + int HP_mapif_parse_NameChangeRequest_pre; + int HP_mapif_parse_NameChangeRequest_post; int HP_pincode_handle_pre; int HP_pincode_handle_post; int HP_pincode_decrypt_pre; @@ -51,5 +1787,20 @@ struct { } count; struct { + struct char_interface chr; + struct geoip_interface geoip; + struct inter_auction_interface inter_auction; + struct inter_elemental_interface inter_elemental; + struct inter_guild_interface inter_guild; + struct inter_homunculus_interface inter_homunculus; + struct inter_interface inter; + struct inter_mail_interface inter_mail; + struct inter_mercenary_interface inter_mercenary; + struct inter_party_interface inter_party; + struct inter_pet_interface inter_pet; + struct inter_quest_interface inter_quest; + struct inter_storage_interface inter_storage; + struct loginif_interface loginif; + struct mapif_interface mapif; struct pincode_interface pincode; } source; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 11c3b86a7..b1b64af18 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -5,6 +5,455 @@ // as it will get overwritten. struct HookingPointData HookingPoints[] = { +/* chr */ + { HP_POP(chr->waiting_disconnect, HP_chr_waiting_disconnect) }, + { HP_POP(chr->delete_char_sql, HP_chr_delete_char_sql) }, + { HP_POP(chr->create_online_char_data, HP_chr_create_online_char_data) }, + { HP_POP(chr->set_account_online, HP_chr_set_account_online) }, + { HP_POP(chr->set_account_offline, HP_chr_set_account_offline) }, + { HP_POP(chr->set_char_charselect, HP_chr_set_char_charselect) }, + { HP_POP(chr->set_char_online, HP_chr_set_char_online) }, + { HP_POP(chr->set_char_offline, HP_chr_set_char_offline) }, + { HP_POP(chr->db_setoffline, HP_chr_db_setoffline) }, + { HP_POP(chr->db_kickoffline, HP_chr_db_kickoffline) }, + { HP_POP(chr->set_login_all_offline, HP_chr_set_login_all_offline) }, + { HP_POP(chr->set_all_offline, HP_chr_set_all_offline) }, + { HP_POP(chr->set_all_offline_sql, HP_chr_set_all_offline_sql) }, + { HP_POP(chr->create_charstatus, HP_chr_create_charstatus) }, + { HP_POP(chr->mmo_char_tosql, HP_chr_mmo_char_tosql) }, + { HP_POP(chr->memitemdata_to_sql, HP_chr_memitemdata_to_sql) }, + { HP_POP(chr->inventory_to_sql, HP_chr_inventory_to_sql) }, + { HP_POP(chr->mmo_chars_fromsql, HP_chr_mmo_chars_fromsql) }, + { HP_POP(chr->mmo_char_fromsql, HP_chr_mmo_char_fromsql) }, + { HP_POP(chr->mmo_char_sql_init, HP_chr_mmo_char_sql_init) }, + { HP_POP(chr->char_slotchange, HP_chr_char_slotchange) }, + { HP_POP(chr->rename_char_sql, HP_chr_rename_char_sql) }, + { HP_POP(chr->check_char_name, HP_chr_check_char_name) }, + { HP_POP(chr->make_new_char_sql, HP_chr_make_new_char_sql) }, + { HP_POP(chr->divorce_char_sql, HP_chr_divorce_char_sql) }, + { HP_POP(chr->count_users, HP_chr_count_users) }, + { HP_POP(chr->mmo_char_tobuf, HP_chr_mmo_char_tobuf) }, + { HP_POP(chr->mmo_char_send099d, HP_chr_mmo_char_send099d) }, + { HP_POP(chr->mmo_char_send_ban_list, HP_chr_mmo_char_send_ban_list) }, + { HP_POP(chr->mmo_char_send_slots_info, HP_chr_mmo_char_send_slots_info) }, + { HP_POP(chr->mmo_char_send_characters, HP_chr_mmo_char_send_characters) }, + { HP_POP(chr->char_married, HP_chr_char_married) }, + { HP_POP(chr->char_child, HP_chr_char_child) }, + { HP_POP(chr->char_family, HP_chr_char_family) }, + { HP_POP(chr->disconnect_player, HP_chr_disconnect_player) }, + { HP_POP(chr->authfail_fd, HP_chr_authfail_fd) }, + { HP_POP(chr->request_account_data, HP_chr_request_account_data) }, + { HP_POP(chr->auth_ok, HP_chr_auth_ok) }, + { HP_POP(chr->ping_login_server, HP_chr_ping_login_server) }, + { HP_POP(chr->parse_fromlogin_connection_state, HP_chr_parse_fromlogin_connection_state) }, + { HP_POP(chr->auth_error, HP_chr_auth_error) }, + { HP_POP(chr->parse_fromlogin_auth_state, HP_chr_parse_fromlogin_auth_state) }, + { HP_POP(chr->parse_fromlogin_account_data, HP_chr_parse_fromlogin_account_data) }, + { HP_POP(chr->parse_fromlogin_login_pong, HP_chr_parse_fromlogin_login_pong) }, + { HP_POP(chr->changesex, HP_chr_changesex) }, + { HP_POP(chr->parse_fromlogin_changesex_reply, HP_chr_parse_fromlogin_changesex_reply) }, + { HP_POP(chr->parse_fromlogin_account_reg2, HP_chr_parse_fromlogin_account_reg2) }, + { HP_POP(chr->parse_fromlogin_ban, HP_chr_parse_fromlogin_ban) }, + { HP_POP(chr->parse_fromlogin_kick, HP_chr_parse_fromlogin_kick) }, + { HP_POP(chr->update_ip, HP_chr_update_ip) }, + { HP_POP(chr->parse_fromlogin_update_ip, HP_chr_parse_fromlogin_update_ip) }, + { HP_POP(chr->parse_fromlogin_accinfo2_failed, HP_chr_parse_fromlogin_accinfo2_failed) }, + { HP_POP(chr->parse_fromlogin_accinfo2_ok, HP_chr_parse_fromlogin_accinfo2_ok) }, + { HP_POP(chr->parse_fromlogin, HP_chr_parse_fromlogin) }, + { HP_POP(chr->request_accreg2, HP_chr_request_accreg2) }, + { HP_POP(chr->global_accreg_to_login_start, HP_chr_global_accreg_to_login_start) }, + { HP_POP(chr->global_accreg_to_login_send, HP_chr_global_accreg_to_login_send) }, + { HP_POP(chr->global_accreg_to_login_add, HP_chr_global_accreg_to_login_add) }, + { HP_POP(chr->read_fame_list, HP_chr_read_fame_list) }, + { HP_POP(chr->send_fame_list, HP_chr_send_fame_list) }, + { HP_POP(chr->update_fame_list, HP_chr_update_fame_list) }, + { HP_POP(chr->loadName, HP_chr_loadName) }, + { HP_POP(chr->parse_frommap_datasync, HP_chr_parse_frommap_datasync) }, + { HP_POP(chr->parse_frommap_skillid2idx, HP_chr_parse_frommap_skillid2idx) }, + { HP_POP(chr->map_received_ok, HP_chr_map_received_ok) }, + { HP_POP(chr->send_maps, HP_chr_send_maps) }, + { HP_POP(chr->parse_frommap_map_names, HP_chr_parse_frommap_map_names) }, + { HP_POP(chr->send_scdata, HP_chr_send_scdata) }, + { HP_POP(chr->parse_frommap_request_scdata, HP_chr_parse_frommap_request_scdata) }, + { HP_POP(chr->parse_frommap_set_users_count, HP_chr_parse_frommap_set_users_count) }, + { HP_POP(chr->parse_frommap_set_users, HP_chr_parse_frommap_set_users) }, + { HP_POP(chr->save_character_ack, HP_chr_save_character_ack) }, + { HP_POP(chr->parse_frommap_save_character, HP_chr_parse_frommap_save_character) }, + { HP_POP(chr->select_ack, HP_chr_select_ack) }, + { HP_POP(chr->parse_frommap_char_select_req, HP_chr_parse_frommap_char_select_req) }, + { HP_POP(chr->change_map_server_ack, HP_chr_change_map_server_ack) }, + { HP_POP(chr->parse_frommap_change_map_server, HP_chr_parse_frommap_change_map_server) }, + { HP_POP(chr->parse_frommap_remove_friend, HP_chr_parse_frommap_remove_friend) }, + { HP_POP(chr->char_name_ack, HP_chr_char_name_ack) }, + { HP_POP(chr->parse_frommap_char_name_request, HP_chr_parse_frommap_char_name_request) }, + { HP_POP(chr->parse_frommap_change_email, HP_chr_parse_frommap_change_email) }, + { HP_POP(chr->ban, HP_chr_ban) }, + { HP_POP(chr->unban, HP_chr_unban) }, + { HP_POP(chr->ask_name_ack, HP_chr_ask_name_ack) }, + { HP_POP(chr->parse_frommap_change_account, HP_chr_parse_frommap_change_account) }, + { HP_POP(chr->parse_frommap_fame_list, HP_chr_parse_frommap_fame_list) }, + { HP_POP(chr->parse_frommap_divorce_char, HP_chr_parse_frommap_divorce_char) }, + { HP_POP(chr->parse_frommap_ragsrvinfo, HP_chr_parse_frommap_ragsrvinfo) }, + { HP_POP(chr->parse_frommap_set_char_offline, HP_chr_parse_frommap_set_char_offline) }, + { HP_POP(chr->parse_frommap_set_all_offline, HP_chr_parse_frommap_set_all_offline) }, + { HP_POP(chr->parse_frommap_set_char_online, HP_chr_parse_frommap_set_char_online) }, + { HP_POP(chr->parse_frommap_build_fame_list, HP_chr_parse_frommap_build_fame_list) }, + { HP_POP(chr->parse_frommap_save_status_change_data, HP_chr_parse_frommap_save_status_change_data) }, + { HP_POP(chr->send_pong, HP_chr_send_pong) }, + { HP_POP(chr->parse_frommap_ping, HP_chr_parse_frommap_ping) }, + { HP_POP(chr->map_auth_ok, HP_chr_map_auth_ok) }, + { HP_POP(chr->map_auth_failed, HP_chr_map_auth_failed) }, + { HP_POP(chr->parse_frommap_auth_request, HP_chr_parse_frommap_auth_request) }, + { HP_POP(chr->parse_frommap_update_ip, HP_chr_parse_frommap_update_ip) }, + { HP_POP(chr->parse_frommap_request_stats_report, HP_chr_parse_frommap_request_stats_report) }, + { HP_POP(chr->parse_frommap_scdata_update, HP_chr_parse_frommap_scdata_update) }, + { HP_POP(chr->parse_frommap_scdata_delete, HP_chr_parse_frommap_scdata_delete) }, + { HP_POP(chr->parse_frommap, HP_chr_parse_frommap) }, + { HP_POP(chr->search_mapserver, HP_chr_search_mapserver) }, + { HP_POP(chr->mapif_init, HP_chr_mapif_init) }, + { HP_POP(chr->lan_subnetcheck, HP_chr_lan_subnetcheck) }, + { HP_POP(chr->delete2_ack, HP_chr_delete2_ack) }, + { HP_POP(chr->delete2_accept_actual_ack, HP_chr_delete2_accept_actual_ack) }, + { HP_POP(chr->delete2_accept_ack, HP_chr_delete2_accept_ack) }, + { HP_POP(chr->delete2_cancel_ack, HP_chr_delete2_cancel_ack) }, + { HP_POP(chr->delete2_req, HP_chr_delete2_req) }, + { HP_POP(chr->delete2_accept, HP_chr_delete2_accept) }, + { HP_POP(chr->delete2_cancel, HP_chr_delete2_cancel) }, + { HP_POP(chr->send_account_id, HP_chr_send_account_id) }, + { HP_POP(chr->parse_char_connect, HP_chr_parse_char_connect) }, + { HP_POP(chr->send_map_info, HP_chr_send_map_info) }, + { HP_POP(chr->send_wait_char_server, HP_chr_send_wait_char_server) }, + { HP_POP(chr->search_default_maps_mapserver, HP_chr_search_default_maps_mapserver) }, + { HP_POP(chr->parse_char_select, HP_chr_parse_char_select) }, + { HP_POP(chr->creation_failed, HP_chr_creation_failed) }, + { HP_POP(chr->creation_ok, HP_chr_creation_ok) }, + { HP_POP(chr->parse_char_create_new_char, HP_chr_parse_char_create_new_char) }, + { HP_POP(chr->delete_char_failed, HP_chr_delete_char_failed) }, + { HP_POP(chr->delete_char_ok, HP_chr_delete_char_ok) }, + { HP_POP(chr->parse_char_delete_char, HP_chr_parse_char_delete_char) }, + { HP_POP(chr->parse_char_ping, HP_chr_parse_char_ping) }, + { HP_POP(chr->allow_rename, HP_chr_allow_rename) }, + { HP_POP(chr->parse_char_rename_char, HP_chr_parse_char_rename_char) }, + { HP_POP(chr->parse_char_rename_char2, HP_chr_parse_char_rename_char2) }, + { HP_POP(chr->rename_char_ack, HP_chr_rename_char_ack) }, + { HP_POP(chr->parse_char_rename_char_confirm, HP_chr_parse_char_rename_char_confirm) }, + { HP_POP(chr->captcha_notsupported, HP_chr_captcha_notsupported) }, + { HP_POP(chr->parse_char_request_captcha, HP_chr_parse_char_request_captcha) }, + { HP_POP(chr->parse_char_check_captcha, HP_chr_parse_char_check_captcha) }, + { HP_POP(chr->parse_char_delete2_req, HP_chr_parse_char_delete2_req) }, + { HP_POP(chr->parse_char_delete2_accept, HP_chr_parse_char_delete2_accept) }, + { HP_POP(chr->parse_char_delete2_cancel, HP_chr_parse_char_delete2_cancel) }, + { HP_POP(chr->login_map_server_ack, HP_chr_login_map_server_ack) }, + { HP_POP(chr->parse_char_login_map_server, HP_chr_parse_char_login_map_server) }, + { HP_POP(chr->parse_char_pincode_check, HP_chr_parse_char_pincode_check) }, + { HP_POP(chr->parse_char_pincode_window, HP_chr_parse_char_pincode_window) }, + { HP_POP(chr->parse_char_pincode_change, HP_chr_parse_char_pincode_change) }, + { HP_POP(chr->parse_char_pincode_first_pin, HP_chr_parse_char_pincode_first_pin) }, + { HP_POP(chr->parse_char_request_chars, HP_chr_parse_char_request_chars) }, + { HP_POP(chr->change_character_slot_ack, HP_chr_change_character_slot_ack) }, + { HP_POP(chr->parse_char_move_character, HP_chr_parse_char_move_character) }, + { HP_POP(chr->parse_char_unknown_packet, HP_chr_parse_char_unknown_packet) }, + { HP_POP(chr->parse_char, HP_chr_parse_char) }, + { HP_POP(chr->broadcast_user_count, HP_chr_broadcast_user_count) }, + { HP_POP(chr->send_accounts_tologin_sub, HP_chr_send_accounts_tologin_sub) }, + { HP_POP(chr->send_accounts_tologin, HP_chr_send_accounts_tologin) }, + { HP_POP(chr->check_connect_login_server, HP_chr_check_connect_login_server) }, + { HP_POP(chr->online_data_cleanup_sub, HP_chr_online_data_cleanup_sub) }, + { HP_POP(chr->online_data_cleanup, HP_chr_online_data_cleanup) }, + { HP_POP(chr->lan_config_read, HP_chr_lan_config_read) }, + { HP_POP(chr->sql_config_read, HP_chr_sql_config_read) }, + { HP_POP(chr->config_dispatch, HP_chr_config_dispatch) }, + { HP_POP(chr->config_read, HP_chr_config_read) }, +/* geoip */ + { HP_POP(geoip->getcountry, HP_geoip_getcountry) }, + { HP_POP(geoip->final, HP_geoip_final) }, + { HP_POP(geoip->init, HP_geoip_init) }, +/* inter_auction */ + { HP_POP(inter_auction->count, HP_inter_auction_count) }, + { HP_POP(inter_auction->save, HP_inter_auction_save) }, + { HP_POP(inter_auction->create, HP_inter_auction_create) }, + { HP_POP(inter_auction->end_timer, HP_inter_auction_end_timer) }, + { HP_POP(inter_auction->delete_, HP_inter_auction_delete_) }, + { HP_POP(inter_auction->fromsql, HP_inter_auction_fromsql) }, + { HP_POP(inter_auction->parse_frommap, HP_inter_auction_parse_frommap) }, + { HP_POP(inter_auction->sql_init, HP_inter_auction_sql_init) }, + { HP_POP(inter_auction->sql_final, HP_inter_auction_sql_final) }, +/* inter_elemental */ + { HP_POP(inter_elemental->sql_init, HP_inter_elemental_sql_init) }, + { HP_POP(inter_elemental->sql_final, HP_inter_elemental_sql_final) }, + { HP_POP(inter_elemental->parse_frommap, HP_inter_elemental_parse_frommap) }, +/* inter_guild */ + { HP_POP(inter_guild->save_timer, HP_inter_guild_save_timer) }, + { HP_POP(inter_guild->removemember_tosql, HP_inter_guild_removemember_tosql) }, + { HP_POP(inter_guild->tosql, HP_inter_guild_tosql) }, + { HP_POP(inter_guild->fromsql, HP_inter_guild_fromsql) }, + { HP_POP(inter_guild->castle_tosql, HP_inter_guild_castle_tosql) }, + { HP_POP(inter_guild->castle_fromsql, HP_inter_guild_castle_fromsql) }, + { HP_POP(inter_guild->exp_parse_row, HP_inter_guild_exp_parse_row) }, + { HP_POP(inter_guild->CharOnline, HP_inter_guild_CharOnline) }, + { HP_POP(inter_guild->CharOffline, HP_inter_guild_CharOffline) }, + { HP_POP(inter_guild->sql_init, HP_inter_guild_sql_init) }, + { HP_POP(inter_guild->db_final, HP_inter_guild_db_final) }, + { HP_POP(inter_guild->sql_final, HP_inter_guild_sql_final) }, + { HP_POP(inter_guild->search_guildname, HP_inter_guild_search_guildname) }, + { HP_POP(inter_guild->check_empty, HP_inter_guild_check_empty) }, + { HP_POP(inter_guild->nextexp, HP_inter_guild_nextexp) }, + { HP_POP(inter_guild->checkskill, HP_inter_guild_checkskill) }, + { HP_POP(inter_guild->calcinfo, HP_inter_guild_calcinfo) }, + { HP_POP(inter_guild->sex_changed, HP_inter_guild_sex_changed) }, + { HP_POP(inter_guild->charname_changed, HP_inter_guild_charname_changed) }, + { HP_POP(inter_guild->parse_frommap, HP_inter_guild_parse_frommap) }, + { HP_POP(inter_guild->leave, HP_inter_guild_leave) }, + { HP_POP(inter_guild->broken, HP_inter_guild_broken) }, +/* inter_homunculus */ + { HP_POP(inter_homunculus->sql_init, HP_inter_homunculus_sql_init) }, + { HP_POP(inter_homunculus->sql_final, HP_inter_homunculus_sql_final) }, + { HP_POP(inter_homunculus->parse_frommap, HP_inter_homunculus_parse_frommap) }, +/* inter */ + { HP_POP(inter->msg_txt, HP_inter_msg_txt) }, + { HP_POP(inter->msg_config_read, HP_inter_msg_config_read) }, + { HP_POP(inter->do_final_msg, HP_inter_do_final_msg) }, + { HP_POP(inter->job_name, HP_inter_job_name) }, + { HP_POP(inter->vmsg_to_fd, HP_inter_vmsg_to_fd) }, + { HP_POP(inter->savereg, HP_inter_savereg) }, + { HP_POP(inter->accreg_fromsql, HP_inter_accreg_fromsql) }, + { HP_POP(inter->config_read, HP_inter_config_read) }, + { HP_POP(inter->vlog, HP_inter_vlog) }, + { HP_POP(inter->init_sql, HP_inter_init_sql) }, + { HP_POP(inter->mapif_init, HP_inter_mapif_init) }, + { HP_POP(inter->check_ttl_wisdata_sub, HP_inter_check_ttl_wisdata_sub) }, + { HP_POP(inter->check_ttl_wisdata, HP_inter_check_ttl_wisdata) }, + { HP_POP(inter->check_length, HP_inter_check_length) }, + { HP_POP(inter->parse_frommap, HP_inter_parse_frommap) }, + { HP_POP(inter->final, HP_inter_final) }, +/* inter_mail */ + { HP_POP(inter_mail->sql_init, HP_inter_mail_sql_init) }, + { HP_POP(inter_mail->sql_final, HP_inter_mail_sql_final) }, + { HP_POP(inter_mail->parse_frommap, HP_inter_mail_parse_frommap) }, + { HP_POP(inter_mail->fromsql, HP_inter_mail_fromsql) }, + { HP_POP(inter_mail->savemessage, HP_inter_mail_savemessage) }, + { HP_POP(inter_mail->loadmessage, HP_inter_mail_loadmessage) }, + { HP_POP(inter_mail->DeleteAttach, HP_inter_mail_DeleteAttach) }, + { HP_POP(inter_mail->sendmail, HP_inter_mail_sendmail) }, +/* inter_mercenary */ + { HP_POP(inter_mercenary->owner_fromsql, HP_inter_mercenary_owner_fromsql) }, + { HP_POP(inter_mercenary->owner_tosql, HP_inter_mercenary_owner_tosql) }, + { HP_POP(inter_mercenary->owner_delete, HP_inter_mercenary_owner_delete) }, + { HP_POP(inter_mercenary->sql_init, HP_inter_mercenary_sql_init) }, + { HP_POP(inter_mercenary->sql_final, HP_inter_mercenary_sql_final) }, + { HP_POP(inter_mercenary->parse_frommap, HP_inter_mercenary_parse_frommap) }, +/* inter_party */ + { HP_POP(inter_party->check_lv, HP_inter_party_check_lv) }, + { HP_POP(inter_party->calc_state, HP_inter_party_calc_state) }, + { HP_POP(inter_party->tosql, HP_inter_party_tosql) }, + { HP_POP(inter_party->fromsql, HP_inter_party_fromsql) }, + { HP_POP(inter_party->sql_init, HP_inter_party_sql_init) }, + { HP_POP(inter_party->sql_final, HP_inter_party_sql_final) }, + { HP_POP(inter_party->search_partyname, HP_inter_party_search_partyname) }, + { HP_POP(inter_party->check_exp_share, HP_inter_party_check_exp_share) }, + { HP_POP(inter_party->check_empty, HP_inter_party_check_empty) }, + { HP_POP(inter_party->parse_frommap, HP_inter_party_parse_frommap) }, + { HP_POP(inter_party->leave, HP_inter_party_leave) }, + { HP_POP(inter_party->CharOnline, HP_inter_party_CharOnline) }, + { HP_POP(inter_party->CharOffline, HP_inter_party_CharOffline) }, +/* inter_pet */ + { HP_POP(inter_pet->tosql, HP_inter_pet_tosql) }, + { HP_POP(inter_pet->fromsql, HP_inter_pet_fromsql) }, + { HP_POP(inter_pet->sql_init, HP_inter_pet_sql_init) }, + { HP_POP(inter_pet->sql_final, HP_inter_pet_sql_final) }, + { HP_POP(inter_pet->delete_, HP_inter_pet_delete_) }, + { HP_POP(inter_pet->parse_frommap, HP_inter_pet_parse_frommap) }, +/* inter_quest */ + { HP_POP(inter_quest->parse_frommap, HP_inter_quest_parse_frommap) }, +/* inter_storage */ + { HP_POP(inter_storage->tosql, HP_inter_storage_tosql) }, + { HP_POP(inter_storage->fromsql, HP_inter_storage_fromsql) }, + { HP_POP(inter_storage->guild_storage_tosql, HP_inter_storage_guild_storage_tosql) }, + { HP_POP(inter_storage->guild_storage_fromsql, HP_inter_storage_guild_storage_fromsql) }, + { HP_POP(inter_storage->sql_init, HP_inter_storage_sql_init) }, + { HP_POP(inter_storage->sql_final, HP_inter_storage_sql_final) }, + { HP_POP(inter_storage->delete_, HP_inter_storage_delete_) }, + { HP_POP(inter_storage->guild_storage_delete, HP_inter_storage_guild_storage_delete) }, + { HP_POP(inter_storage->parse_frommap, HP_inter_storage_parse_frommap) }, +/* loginif */ + { HP_POP(loginif->reset, HP_loginif_reset) }, + { HP_POP(loginif->check_shutdown, HP_loginif_check_shutdown) }, + { HP_POP(loginif->on_disconnect, HP_loginif_on_disconnect) }, + { HP_POP(loginif->on_ready, HP_loginif_on_ready) }, + { HP_POP(loginif->block_account, HP_loginif_block_account) }, + { HP_POP(loginif->ban_account, HP_loginif_ban_account) }, + { HP_POP(loginif->unban_account, HP_loginif_unban_account) }, + { HP_POP(loginif->changesex, HP_loginif_changesex) }, + { HP_POP(loginif->auth, HP_loginif_auth) }, + { HP_POP(loginif->send_users_count, HP_loginif_send_users_count) }, + { HP_POP(loginif->connect_to_server, HP_loginif_connect_to_server) }, +/* mapif */ + { HP_POP(mapif->ban, HP_mapif_ban) }, + { HP_POP(mapif->server_init, HP_mapif_server_init) }, + { HP_POP(mapif->server_destroy, HP_mapif_server_destroy) }, + { HP_POP(mapif->server_reset, HP_mapif_server_reset) }, + { HP_POP(mapif->on_disconnect, HP_mapif_on_disconnect) }, + { HP_POP(mapif->on_parse_accinfo, HP_mapif_on_parse_accinfo) }, + { HP_POP(mapif->char_ban, HP_mapif_char_ban) }, + { HP_POP(mapif->sendall, HP_mapif_sendall) }, + { HP_POP(mapif->sendallwos, HP_mapif_sendallwos) }, + { HP_POP(mapif->send, HP_mapif_send) }, + { HP_POP(mapif->send_users_count, HP_mapif_send_users_count) }, + { HP_POP(mapif->auction_message, HP_mapif_auction_message) }, + { HP_POP(mapif->auction_sendlist, HP_mapif_auction_sendlist) }, + { HP_POP(mapif->parse_auction_requestlist, HP_mapif_parse_auction_requestlist) }, + { HP_POP(mapif->auction_register, HP_mapif_auction_register) }, + { HP_POP(mapif->parse_auction_register, HP_mapif_parse_auction_register) }, + { HP_POP(mapif->auction_cancel, HP_mapif_auction_cancel) }, + { HP_POP(mapif->parse_auction_cancel, HP_mapif_parse_auction_cancel) }, + { HP_POP(mapif->auction_close, HP_mapif_auction_close) }, + { HP_POP(mapif->parse_auction_close, HP_mapif_parse_auction_close) }, + { HP_POP(mapif->auction_bid, HP_mapif_auction_bid) }, + { HP_POP(mapif->parse_auction_bid, HP_mapif_parse_auction_bid) }, + { HP_POP(mapif->elemental_save, HP_mapif_elemental_save) }, + { HP_POP(mapif->elemental_load, HP_mapif_elemental_load) }, + { HP_POP(mapif->elemental_delete, HP_mapif_elemental_delete) }, + { HP_POP(mapif->elemental_send, HP_mapif_elemental_send) }, + { HP_POP(mapif->parse_elemental_create, HP_mapif_parse_elemental_create) }, + { HP_POP(mapif->parse_elemental_load, HP_mapif_parse_elemental_load) }, + { HP_POP(mapif->elemental_deleted, HP_mapif_elemental_deleted) }, + { HP_POP(mapif->parse_elemental_delete, HP_mapif_parse_elemental_delete) }, + { HP_POP(mapif->elemental_saved, HP_mapif_elemental_saved) }, + { HP_POP(mapif->parse_elemental_save, HP_mapif_parse_elemental_save) }, + { HP_POP(mapif->guild_created, HP_mapif_guild_created) }, + { HP_POP(mapif->guild_noinfo, HP_mapif_guild_noinfo) }, + { HP_POP(mapif->guild_info, HP_mapif_guild_info) }, + { HP_POP(mapif->guild_memberadded, HP_mapif_guild_memberadded) }, + { HP_POP(mapif->guild_withdraw, HP_mapif_guild_withdraw) }, + { HP_POP(mapif->guild_memberinfoshort, HP_mapif_guild_memberinfoshort) }, + { HP_POP(mapif->guild_broken, HP_mapif_guild_broken) }, + { HP_POP(mapif->guild_message, HP_mapif_guild_message) }, + { HP_POP(mapif->guild_basicinfochanged, HP_mapif_guild_basicinfochanged) }, + { HP_POP(mapif->guild_memberinfochanged, HP_mapif_guild_memberinfochanged) }, + { HP_POP(mapif->guild_skillupack, HP_mapif_guild_skillupack) }, + { HP_POP(mapif->guild_alliance, HP_mapif_guild_alliance) }, + { HP_POP(mapif->guild_position, HP_mapif_guild_position) }, + { HP_POP(mapif->guild_notice, HP_mapif_guild_notice) }, + { HP_POP(mapif->guild_emblem, HP_mapif_guild_emblem) }, + { HP_POP(mapif->guild_master_changed, HP_mapif_guild_master_changed) }, + { HP_POP(mapif->guild_castle_dataload, HP_mapif_guild_castle_dataload) }, + { HP_POP(mapif->parse_CreateGuild, HP_mapif_parse_CreateGuild) }, + { HP_POP(mapif->parse_GuildInfo, HP_mapif_parse_GuildInfo) }, + { HP_POP(mapif->parse_GuildAddMember, HP_mapif_parse_GuildAddMember) }, + { HP_POP(mapif->parse_GuildLeave, HP_mapif_parse_GuildLeave) }, + { HP_POP(mapif->parse_GuildChangeMemberInfoShort, HP_mapif_parse_GuildChangeMemberInfoShort) }, + { HP_POP(mapif->parse_BreakGuild, HP_mapif_parse_BreakGuild) }, + { HP_POP(mapif->parse_GuildMessage, HP_mapif_parse_GuildMessage) }, + { HP_POP(mapif->parse_GuildBasicInfoChange, HP_mapif_parse_GuildBasicInfoChange) }, + { HP_POP(mapif->parse_GuildMemberInfoChange, HP_mapif_parse_GuildMemberInfoChange) }, + { HP_POP(mapif->parse_GuildPosition, HP_mapif_parse_GuildPosition) }, + { HP_POP(mapif->parse_GuildSkillUp, HP_mapif_parse_GuildSkillUp) }, + { HP_POP(mapif->parse_GuildDeleteAlliance, HP_mapif_parse_GuildDeleteAlliance) }, + { HP_POP(mapif->parse_GuildAlliance, HP_mapif_parse_GuildAlliance) }, + { HP_POP(mapif->parse_GuildNotice, HP_mapif_parse_GuildNotice) }, + { HP_POP(mapif->parse_GuildEmblem, HP_mapif_parse_GuildEmblem) }, + { HP_POP(mapif->parse_GuildCastleDataLoad, HP_mapif_parse_GuildCastleDataLoad) }, + { HP_POP(mapif->parse_GuildCastleDataSave, HP_mapif_parse_GuildCastleDataSave) }, + { HP_POP(mapif->parse_GuildMasterChange, HP_mapif_parse_GuildMasterChange) }, + { HP_POP(mapif->homunculus_created, HP_mapif_homunculus_created) }, + { HP_POP(mapif->homunculus_deleted, HP_mapif_homunculus_deleted) }, + { HP_POP(mapif->homunculus_loaded, HP_mapif_homunculus_loaded) }, + { HP_POP(mapif->homunculus_saved, HP_mapif_homunculus_saved) }, + { HP_POP(mapif->homunculus_renamed, HP_mapif_homunculus_renamed) }, + { HP_POP(mapif->homunculus_save, HP_mapif_homunculus_save) }, + { HP_POP(mapif->homunculus_load, HP_mapif_homunculus_load) }, + { HP_POP(mapif->homunculus_delete, HP_mapif_homunculus_delete) }, + { HP_POP(mapif->homunculus_rename, HP_mapif_homunculus_rename) }, + { HP_POP(mapif->parse_homunculus_create, HP_mapif_parse_homunculus_create) }, + { HP_POP(mapif->parse_homunculus_delete, HP_mapif_parse_homunculus_delete) }, + { HP_POP(mapif->parse_homunculus_load, HP_mapif_parse_homunculus_load) }, + { HP_POP(mapif->parse_homunculus_save, HP_mapif_parse_homunculus_save) }, + { HP_POP(mapif->parse_homunculus_rename, HP_mapif_parse_homunculus_rename) }, + { HP_POP(mapif->mail_sendinbox, HP_mapif_mail_sendinbox) }, + { HP_POP(mapif->parse_mail_requestinbox, HP_mapif_parse_mail_requestinbox) }, + { HP_POP(mapif->parse_mail_read, HP_mapif_parse_mail_read) }, + { HP_POP(mapif->mail_sendattach, HP_mapif_mail_sendattach) }, + { HP_POP(mapif->mail_getattach, HP_mapif_mail_getattach) }, + { HP_POP(mapif->parse_mail_getattach, HP_mapif_parse_mail_getattach) }, + { HP_POP(mapif->mail_delete, HP_mapif_mail_delete) }, + { HP_POP(mapif->parse_mail_delete, HP_mapif_parse_mail_delete) }, + { HP_POP(mapif->mail_new, HP_mapif_mail_new) }, + { HP_POP(mapif->mail_return, HP_mapif_mail_return) }, + { HP_POP(mapif->parse_mail_return, HP_mapif_parse_mail_return) }, + { HP_POP(mapif->mail_send, HP_mapif_mail_send) }, + { HP_POP(mapif->parse_mail_send, HP_mapif_parse_mail_send) }, + { HP_POP(mapif->mercenary_save, HP_mapif_mercenary_save) }, + { HP_POP(mapif->mercenary_load, HP_mapif_mercenary_load) }, + { HP_POP(mapif->mercenary_delete, HP_mapif_mercenary_delete) }, + { HP_POP(mapif->mercenary_send, HP_mapif_mercenary_send) }, + { HP_POP(mapif->parse_mercenary_create, HP_mapif_parse_mercenary_create) }, + { HP_POP(mapif->parse_mercenary_load, HP_mapif_parse_mercenary_load) }, + { HP_POP(mapif->mercenary_deleted, HP_mapif_mercenary_deleted) }, + { HP_POP(mapif->parse_mercenary_delete, HP_mapif_parse_mercenary_delete) }, + { HP_POP(mapif->mercenary_saved, HP_mapif_mercenary_saved) }, + { HP_POP(mapif->parse_mercenary_save, HP_mapif_parse_mercenary_save) }, + { HP_POP(mapif->party_created, HP_mapif_party_created) }, + { HP_POP(mapif->party_noinfo, HP_mapif_party_noinfo) }, + { HP_POP(mapif->party_info, HP_mapif_party_info) }, + { HP_POP(mapif->party_memberadded, HP_mapif_party_memberadded) }, + { HP_POP(mapif->party_optionchanged, HP_mapif_party_optionchanged) }, + { HP_POP(mapif->party_withdraw, HP_mapif_party_withdraw) }, + { HP_POP(mapif->party_membermoved, HP_mapif_party_membermoved) }, + { HP_POP(mapif->party_broken, HP_mapif_party_broken) }, + { HP_POP(mapif->party_message, HP_mapif_party_message) }, + { HP_POP(mapif->parse_CreateParty, HP_mapif_parse_CreateParty) }, + { HP_POP(mapif->parse_PartyInfo, HP_mapif_parse_PartyInfo) }, + { HP_POP(mapif->parse_PartyAddMember, HP_mapif_parse_PartyAddMember) }, + { HP_POP(mapif->parse_PartyChangeOption, HP_mapif_parse_PartyChangeOption) }, + { HP_POP(mapif->parse_PartyLeave, HP_mapif_parse_PartyLeave) }, + { HP_POP(mapif->parse_PartyChangeMap, HP_mapif_parse_PartyChangeMap) }, + { HP_POP(mapif->parse_BreakParty, HP_mapif_parse_BreakParty) }, + { HP_POP(mapif->parse_PartyMessage, HP_mapif_parse_PartyMessage) }, + { HP_POP(mapif->parse_PartyLeaderChange, HP_mapif_parse_PartyLeaderChange) }, + { HP_POP(mapif->pet_created, HP_mapif_pet_created) }, + { HP_POP(mapif->pet_info, HP_mapif_pet_info) }, + { HP_POP(mapif->pet_noinfo, HP_mapif_pet_noinfo) }, + { HP_POP(mapif->save_pet_ack, HP_mapif_save_pet_ack) }, + { HP_POP(mapif->delete_pet_ack, HP_mapif_delete_pet_ack) }, + { HP_POP(mapif->create_pet, HP_mapif_create_pet) }, + { HP_POP(mapif->load_pet, HP_mapif_load_pet) }, + { HP_POP(mapif->save_pet, HP_mapif_save_pet) }, + { HP_POP(mapif->delete_pet, HP_mapif_delete_pet) }, + { HP_POP(mapif->parse_CreatePet, HP_mapif_parse_CreatePet) }, + { HP_POP(mapif->parse_LoadPet, HP_mapif_parse_LoadPet) }, + { HP_POP(mapif->parse_SavePet, HP_mapif_parse_SavePet) }, + { HP_POP(mapif->parse_DeletePet, HP_mapif_parse_DeletePet) }, + { HP_POP(mapif->quests_fromsql, HP_mapif_quests_fromsql) }, + { HP_POP(mapif->quest_delete, HP_mapif_quest_delete) }, + { HP_POP(mapif->quest_add, HP_mapif_quest_add) }, + { HP_POP(mapif->quest_update, HP_mapif_quest_update) }, + { HP_POP(mapif->quest_save_ack, HP_mapif_quest_save_ack) }, + { HP_POP(mapif->parse_quest_save, HP_mapif_parse_quest_save) }, + { HP_POP(mapif->send_quests, HP_mapif_send_quests) }, + { HP_POP(mapif->parse_quest_load, HP_mapif_parse_quest_load) }, + { HP_POP(mapif->load_guild_storage, HP_mapif_load_guild_storage) }, + { HP_POP(mapif->save_guild_storage_ack, HP_mapif_save_guild_storage_ack) }, + { HP_POP(mapif->parse_LoadGuildStorage, HP_mapif_parse_LoadGuildStorage) }, + { HP_POP(mapif->parse_SaveGuildStorage, HP_mapif_parse_SaveGuildStorage) }, + { HP_POP(mapif->itembound_ack, HP_mapif_itembound_ack) }, + { HP_POP(mapif->parse_ItemBoundRetrieve_sub, HP_mapif_parse_ItemBoundRetrieve_sub) }, + { HP_POP(mapif->parse_ItemBoundRetrieve, HP_mapif_parse_ItemBoundRetrieve) }, + { HP_POP(mapif->parse_accinfo, HP_mapif_parse_accinfo) }, + { HP_POP(mapif->parse_accinfo2, HP_mapif_parse_accinfo2) }, + { HP_POP(mapif->broadcast, HP_mapif_broadcast) }, + { HP_POP(mapif->wis_message, HP_mapif_wis_message) }, + { HP_POP(mapif->wis_response, HP_mapif_wis_response) }, + { HP_POP(mapif->wis_end, HP_mapif_wis_end) }, + { HP_POP(mapif->account_reg_reply, HP_mapif_account_reg_reply) }, + { HP_POP(mapif->disconnectplayer, HP_mapif_disconnectplayer) }, + { HP_POP(mapif->parse_broadcast, HP_mapif_parse_broadcast) }, + { HP_POP(mapif->parse_WisRequest, HP_mapif_parse_WisRequest) }, + { HP_POP(mapif->parse_WisReply, HP_mapif_parse_WisReply) }, + { HP_POP(mapif->parse_WisToGM, HP_mapif_parse_WisToGM) }, + { HP_POP(mapif->parse_Registry, HP_mapif_parse_Registry) }, + { HP_POP(mapif->parse_RegistryRequest, HP_mapif_parse_RegistryRequest) }, + { HP_POP(mapif->namechange_ack, HP_mapif_namechange_ack) }, + { HP_POP(mapif->parse_NameChangeRequest, HP_mapif_parse_NameChangeRequest) }, /* pincode */ { HP_POP(pincode->handle, HP_pincode_handle) }, { HP_POP(pincode->decrypt, HP_pincode_decrypt) }, @@ -18,4 +467,4 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pincode->config_read, HP_pincode_config_read) }, }; -int HookingPointsLenMax = 20; +int HookingPointsLenMax = 42; diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index d795ebb4a..8a602686f 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -4,6 +4,11589 @@ // NOTE: This file was auto-generated and should never be manually edited, // as it will get overwritten. +/* chr */ +int HP_chr_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_waiting_disconnect_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_waiting_disconnect_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_waiting_disconnect_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.waiting_disconnect(tid, tick, id, data); + } + if( HPMHooks.count.HP_chr_waiting_disconnect_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_waiting_disconnect_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_waiting_disconnect_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +int HP_chr_delete_char_sql(int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_delete_char_sql_pre ) { + int (*preHookFunc) (int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete_char_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete_char_sql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.delete_char_sql(char_id); + } + if( HPMHooks.count.HP_chr_delete_char_sql_post ) { + int (*postHookFunc) (int retVal___, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete_char_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete_char_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id); + } + } + return retVal___; +} +DBData HP_chr_create_online_char_data(DBKey key, va_list args) { + int hIndex = 0; + DBData retVal___; + memset(&retVal___, '\0', sizeof(DBData)); + if( HPMHooks.count.HP_chr_create_online_char_data_pre ) { + DBData (*preHookFunc) (DBKey *key, va_list args); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_create_online_char_data_pre; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + preHookFunc = HPMHooks.list.HP_chr_create_online_char_data_pre[hIndex].func; + retVal___ = preHookFunc(&key, args___copy); + va_end(args___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list args___copy; va_copy(args___copy, args); + retVal___ = HPMHooks.source.chr.create_online_char_data(key, args___copy); + va_end(args___copy); + } + if( HPMHooks.count.HP_chr_create_online_char_data_post ) { + DBData (*postHookFunc) (DBData retVal___, DBKey *key, va_list args); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_create_online_char_data_post; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + postHookFunc = HPMHooks.list.HP_chr_create_online_char_data_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, args___copy); + va_end(args___copy); + } + } + return retVal___; +} +void HP_chr_set_account_online(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_account_online_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_account_online_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_account_online_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_account_online(account_id); + } + if( HPMHooks.count.HP_chr_set_account_online_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_account_online_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_account_online_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_chr_set_account_offline(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_account_offline_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_account_offline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_account_offline_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_account_offline(account_id); + } + if( HPMHooks.count.HP_chr_set_account_offline_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_account_offline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_account_offline_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_chr_set_char_charselect(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_char_charselect_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_char_charselect_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_char_charselect_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_char_charselect(account_id); + } + if( HPMHooks.count.HP_chr_set_char_charselect_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_char_charselect_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_char_charselect_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_chr_set_char_online(int map_id, int char_id, int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_char_online_pre ) { + void (*preHookFunc) (int *map_id, int *char_id, int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_char_online_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_char_online_pre[hIndex].func; + preHookFunc(&map_id, &char_id, &account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_char_online(map_id, char_id, account_id); + } + if( HPMHooks.count.HP_chr_set_char_online_post ) { + void (*postHookFunc) (int *map_id, int *char_id, int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_char_online_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_char_online_post[hIndex].func; + postHookFunc(&map_id, &char_id, &account_id); + } + } + return; +} +void HP_chr_set_char_offline(int char_id, int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_char_offline_pre ) { + void (*preHookFunc) (int *char_id, int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_char_offline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_char_offline_pre[hIndex].func; + preHookFunc(&char_id, &account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_char_offline(char_id, account_id); + } + if( HPMHooks.count.HP_chr_set_char_offline_post ) { + void (*postHookFunc) (int *char_id, int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_char_offline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_char_offline_post[hIndex].func; + postHookFunc(&char_id, &account_id); + } + } + return; +} +int HP_chr_db_setoffline(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_db_setoffline_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_db_setoffline_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_chr_db_setoffline_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.chr.db_setoffline(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_chr_db_setoffline_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_db_setoffline_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_chr_db_setoffline_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +int HP_chr_db_kickoffline(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_db_kickoffline_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_db_kickoffline_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_chr_db_kickoffline_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.chr.db_kickoffline(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_chr_db_kickoffline_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_db_kickoffline_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_chr_db_kickoffline_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +void HP_chr_set_login_all_offline(void) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_login_all_offline_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_login_all_offline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_login_all_offline_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_login_all_offline(); + } + if( HPMHooks.count.HP_chr_set_login_all_offline_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_login_all_offline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_login_all_offline_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_chr_set_all_offline(int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_all_offline_pre ) { + void (*preHookFunc) (int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_all_offline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_all_offline_pre[hIndex].func; + preHookFunc(&id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_all_offline(id); + } + if( HPMHooks.count.HP_chr_set_all_offline_post ) { + void (*postHookFunc) (int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_all_offline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_all_offline_post[hIndex].func; + postHookFunc(&id); + } + } + return; +} +void HP_chr_set_all_offline_sql(void) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_set_all_offline_sql_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_all_offline_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_set_all_offline_sql_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.set_all_offline_sql(); + } + if( HPMHooks.count.HP_chr_set_all_offline_sql_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_set_all_offline_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_set_all_offline_sql_post[hIndex].func; + postHookFunc(); + } + } + return; +} +DBData HP_chr_create_charstatus(DBKey key, va_list args) { + int hIndex = 0; + DBData retVal___; + memset(&retVal___, '\0', sizeof(DBData)); + if( HPMHooks.count.HP_chr_create_charstatus_pre ) { + DBData (*preHookFunc) (DBKey *key, va_list args); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_create_charstatus_pre; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + preHookFunc = HPMHooks.list.HP_chr_create_charstatus_pre[hIndex].func; + retVal___ = preHookFunc(&key, args___copy); + va_end(args___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list args___copy; va_copy(args___copy, args); + retVal___ = HPMHooks.source.chr.create_charstatus(key, args___copy); + va_end(args___copy); + } + if( HPMHooks.count.HP_chr_create_charstatus_post ) { + DBData (*postHookFunc) (DBData retVal___, DBKey *key, va_list args); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_create_charstatus_post; hIndex++ ) { + va_list args___copy; va_copy(args___copy, args); + postHookFunc = HPMHooks.list.HP_chr_create_charstatus_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, args___copy); + va_end(args___copy); + } + } + return retVal___; +} +int HP_chr_mmo_char_tosql(int char_id, struct mmo_charstatus *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_char_tosql_pre ) { + int (*preHookFunc) (int *char_id, struct mmo_charstatus *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_tosql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_char_tosql(char_id, p); + } + if( HPMHooks.count.HP_chr_mmo_char_tosql_post ) { + int (*postHookFunc) (int retVal___, int *char_id, struct mmo_charstatus *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, p); + } + } + return retVal___; +} +int HP_chr_memitemdata_to_sql(const struct item items[], int max, int id, int tableswitch) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_memitemdata_to_sql_pre ) { + int (*preHookFunc) (const struct item *items[], int *max, int *id, int *tableswitch); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_memitemdata_to_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_memitemdata_to_sql_pre[hIndex].func; + retVal___ = preHookFunc(&items, &max, &id, &tableswitch); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.memitemdata_to_sql(items, max, id, tableswitch); + } + if( HPMHooks.count.HP_chr_memitemdata_to_sql_post ) { + int (*postHookFunc) (int retVal___, const struct item *items[], int *max, int *id, int *tableswitch); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_memitemdata_to_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_memitemdata_to_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &items, &max, &id, &tableswitch); + } + } + return retVal___; +} +int HP_chr_inventory_to_sql(const struct item items[], int max, int id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_inventory_to_sql_pre ) { + int (*preHookFunc) (const struct item *items[], int *max, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_inventory_to_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_inventory_to_sql_pre[hIndex].func; + retVal___ = preHookFunc(&items, &max, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.inventory_to_sql(items, max, id); + } + if( HPMHooks.count.HP_chr_inventory_to_sql_post ) { + int (*postHookFunc) (int retVal___, const struct item *items[], int *max, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_inventory_to_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_inventory_to_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &items, &max, &id); + } + } + return retVal___; +} +int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_chars_fromsql_pre ) { + int (*preHookFunc) (struct char_session_data *sd, uint8 *buf); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_chars_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_chars_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(sd, buf); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_chars_fromsql(sd, buf); + } + if( HPMHooks.count.HP_chr_mmo_chars_fromsql_post ) { + int (*postHookFunc) (int retVal___, struct char_session_data *sd, uint8 *buf); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_chars_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_chars_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, buf); + } + } + return retVal___; +} +int HP_chr_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool load_everything) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_char_fromsql_pre ) { + int (*preHookFunc) (int *char_id, struct mmo_charstatus *p, bool *load_everything); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, p, &load_everything); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_char_fromsql(char_id, p, load_everything); + } + if( HPMHooks.count.HP_chr_mmo_char_fromsql_post ) { + int (*postHookFunc) (int retVal___, int *char_id, struct mmo_charstatus *p, bool *load_everything); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, p, &load_everything); + } + } + return retVal___; +} +int HP_chr_mmo_char_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_char_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_char_sql_init(); + } + if( HPMHooks.count.HP_chr_mmo_char_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +bool HP_chr_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_chr_char_slotchange_pre ) { + bool (*preHookFunc) (struct char_session_data *sd, int *fd, unsigned short *from, unsigned short *to); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_slotchange_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_char_slotchange_pre[hIndex].func; + retVal___ = preHookFunc(sd, &fd, &from, &to); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.char_slotchange(sd, fd, from, to); + } + if( HPMHooks.count.HP_chr_char_slotchange_post ) { + bool (*postHookFunc) (bool retVal___, struct char_session_data *sd, int *fd, unsigned short *from, unsigned short *to); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_slotchange_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_char_slotchange_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, &fd, &from, &to); + } + } + return retVal___; +} +int HP_chr_rename_char_sql(struct char_session_data *sd, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_rename_char_sql_pre ) { + int (*preHookFunc) (struct char_session_data *sd, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_rename_char_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_rename_char_sql_pre[hIndex].func; + retVal___ = preHookFunc(sd, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.rename_char_sql(sd, char_id); + } + if( HPMHooks.count.HP_chr_rename_char_sql_post ) { + int (*postHookFunc) (int retVal___, struct char_session_data *sd, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_rename_char_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_rename_char_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, &char_id); + } + } + return retVal___; +} +int HP_chr_check_char_name(char *name, char *esc_name) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_check_char_name_pre ) { + int (*preHookFunc) (char *name, char *esc_name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_check_char_name_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_check_char_name_pre[hIndex].func; + retVal___ = preHookFunc(name, esc_name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.check_char_name(name, esc_name); + } + if( HPMHooks.count.HP_chr_check_char_name_post ) { + int (*postHookFunc) (int retVal___, char *name, char *esc_name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_check_char_name_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_check_char_name_post[hIndex].func; + retVal___ = postHookFunc(retVal___, name, esc_name); + } + } + return retVal___; +} +int HP_chr_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 hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_make_new_char_sql_pre ) { + int (*preHookFunc) (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); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_make_new_char_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_make_new_char_sql_pre[hIndex].func; + retVal___ = preHookFunc(sd, name_, &str, &agi, &vit, &int_, &dex, &luk, &slot, &hair_color, &hair_style); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.make_new_char_sql(sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style); + } + if( HPMHooks.count.HP_chr_make_new_char_sql_post ) { + int (*postHookFunc) (int retVal___, 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); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_make_new_char_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_make_new_char_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, name_, &str, &agi, &vit, &int_, &dex, &luk, &slot, &hair_color, &hair_style); + } + } + return retVal___; +} +int HP_chr_divorce_char_sql(int partner_id1, int partner_id2) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_divorce_char_sql_pre ) { + int (*preHookFunc) (int *partner_id1, int *partner_id2); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_divorce_char_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_divorce_char_sql_pre[hIndex].func; + retVal___ = preHookFunc(&partner_id1, &partner_id2); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.divorce_char_sql(partner_id1, partner_id2); + } + if( HPMHooks.count.HP_chr_divorce_char_sql_post ) { + int (*postHookFunc) (int retVal___, int *partner_id1, int *partner_id2); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_divorce_char_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_divorce_char_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &partner_id1, &partner_id2); + } + } + return retVal___; +} +int HP_chr_count_users(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_count_users_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_count_users_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_count_users_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.count_users(); + } + if( HPMHooks.count.HP_chr_count_users_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_count_users_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_count_users_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +int HP_chr_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_char_tobuf_pre ) { + int (*preHookFunc) (uint8 *buffer, struct mmo_charstatus *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_tobuf_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_tobuf_pre[hIndex].func; + retVal___ = preHookFunc(buffer, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_char_tobuf(buffer, p); + } + if( HPMHooks.count.HP_chr_mmo_char_tobuf_post ) { + int (*postHookFunc) (int retVal___, uint8 *buffer, struct mmo_charstatus *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_tobuf_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_tobuf_post[hIndex].func; + retVal___ = postHookFunc(retVal___, buffer, p); + } + } + return retVal___; +} +void HP_chr_mmo_char_send099d(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_mmo_char_send099d_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send099d_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_send099d_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.mmo_char_send099d(fd, sd); + } + if( HPMHooks.count.HP_chr_mmo_char_send099d_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send099d_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_send099d_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_mmo_char_send_ban_list_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send_ban_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_send_ban_list_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.mmo_char_send_ban_list(fd, sd); + } + if( HPMHooks.count.HP_chr_mmo_char_send_ban_list_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send_ban_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_send_ban_list_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_mmo_char_send_slots_info(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_mmo_char_send_slots_info_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send_slots_info_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_send_slots_info_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.mmo_char_send_slots_info(fd, sd); + } + if( HPMHooks.count.HP_chr_mmo_char_send_slots_info_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send_slots_info_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_send_slots_info_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +int HP_chr_mmo_char_send_characters(int fd, struct char_session_data *sd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_char_send_characters_pre ) { + int (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send_characters_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_char_send_characters_pre[hIndex].func; + retVal___ = preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_char_send_characters(fd, sd); + } + if( HPMHooks.count.HP_chr_mmo_char_send_characters_post ) { + int (*postHookFunc) (int retVal___, int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send_characters_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_char_send_characters_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, sd); + } + } + return retVal___; +} +int HP_chr_char_married(int pl1, int pl2) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_char_married_pre ) { + int (*preHookFunc) (int *pl1, int *pl2); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_married_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_char_married_pre[hIndex].func; + retVal___ = preHookFunc(&pl1, &pl2); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.char_married(pl1, pl2); + } + if( HPMHooks.count.HP_chr_char_married_post ) { + int (*postHookFunc) (int retVal___, int *pl1, int *pl2); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_married_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_char_married_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &pl1, &pl2); + } + } + return retVal___; +} +int HP_chr_char_child(int parent_id, int child_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_char_child_pre ) { + int (*preHookFunc) (int *parent_id, int *child_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_child_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_char_child_pre[hIndex].func; + retVal___ = preHookFunc(&parent_id, &child_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.char_child(parent_id, child_id); + } + if( HPMHooks.count.HP_chr_char_child_post ) { + int (*postHookFunc) (int retVal___, int *parent_id, int *child_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_child_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_char_child_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &parent_id, &child_id); + } + } + return retVal___; +} +int HP_chr_char_family(int cid1, int cid2, int cid3) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_char_family_pre ) { + int (*preHookFunc) (int *cid1, int *cid2, int *cid3); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_family_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_char_family_pre[hIndex].func; + retVal___ = preHookFunc(&cid1, &cid2, &cid3); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.char_family(cid1, cid2, cid3); + } + if( HPMHooks.count.HP_chr_char_family_post ) { + int (*postHookFunc) (int retVal___, int *cid1, int *cid2, int *cid3); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_family_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_char_family_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &cid1, &cid2, &cid3); + } + } + return retVal___; +} +void HP_chr_disconnect_player(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_disconnect_player_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_disconnect_player_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_disconnect_player_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.disconnect_player(account_id); + } + if( HPMHooks.count.HP_chr_disconnect_player_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_disconnect_player_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_disconnect_player_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_chr_authfail_fd(int fd, int type) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_authfail_fd_pre ) { + void (*preHookFunc) (int *fd, int *type); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_authfail_fd_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_authfail_fd_pre[hIndex].func; + preHookFunc(&fd, &type); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.authfail_fd(fd, type); + } + if( HPMHooks.count.HP_chr_authfail_fd_post ) { + void (*postHookFunc) (int *fd, int *type); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_authfail_fd_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_authfail_fd_post[hIndex].func; + postHookFunc(&fd, &type); + } + } + return; +} +void HP_chr_request_account_data(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_request_account_data_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_request_account_data_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_request_account_data_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.request_account_data(account_id); + } + if( HPMHooks.count.HP_chr_request_account_data_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_request_account_data_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_request_account_data_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_chr_auth_ok(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_auth_ok_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_auth_ok_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_auth_ok_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.auth_ok(fd, sd); + } + if( HPMHooks.count.HP_chr_auth_ok_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_auth_ok_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_auth_ok_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_ping_login_server(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_ping_login_server_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_ping_login_server_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_ping_login_server_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.ping_login_server(fd); + } + if( HPMHooks.count.HP_chr_ping_login_server_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_ping_login_server_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_ping_login_server_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +int HP_chr_parse_fromlogin_connection_state(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_connection_state_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_connection_state_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_connection_state_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.parse_fromlogin_connection_state(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_connection_state_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_connection_state_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_connection_state_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_chr_auth_error(int fd, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_auth_error_pre ) { + void (*preHookFunc) (int *fd, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_auth_error_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_auth_error_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.auth_error(fd, flag); + } + if( HPMHooks.count.HP_chr_auth_error_post ) { + void (*postHookFunc) (int *fd, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_auth_error_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_auth_error_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_chr_parse_fromlogin_auth_state(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_auth_state_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_auth_state_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_auth_state_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_auth_state(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_auth_state_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_auth_state_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_auth_state_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_account_data(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_account_data_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_account_data_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_account_data_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_account_data(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_account_data_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_account_data_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_account_data_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_login_pong(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_login_pong_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_login_pong_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_login_pong_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_login_pong(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_login_pong_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_login_pong_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_login_pong_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_changesex(int account_id, int sex) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_changesex_pre ) { + void (*preHookFunc) (int *account_id, int *sex); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_changesex_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_changesex_pre[hIndex].func; + preHookFunc(&account_id, &sex); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.changesex(account_id, sex); + } + if( HPMHooks.count.HP_chr_changesex_post ) { + void (*postHookFunc) (int *account_id, int *sex); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_changesex_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_changesex_post[hIndex].func; + postHookFunc(&account_id, &sex); + } + } + return; +} +int HP_chr_parse_fromlogin_changesex_reply(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_changesex_reply_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_changesex_reply_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_changesex_reply_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.parse_fromlogin_changesex_reply(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_changesex_reply_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_changesex_reply_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_changesex_reply_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_chr_parse_fromlogin_account_reg2(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_account_reg2_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_account_reg2_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_account_reg2_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_account_reg2(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_account_reg2_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_account_reg2_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_account_reg2_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_ban(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_ban_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_ban_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_ban_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_ban(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_ban_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_ban_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_ban_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_kick(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_kick_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_kick_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_kick_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_kick(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_kick_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_kick_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_kick_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_update_ip(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_update_ip_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_update_ip_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_update_ip_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.update_ip(fd); + } + if( HPMHooks.count.HP_chr_update_ip_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_update_ip_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_update_ip_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_update_ip(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_update_ip_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_update_ip_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_update_ip_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_update_ip(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_update_ip_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_update_ip_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_update_ip_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_accinfo2_failed(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_failed_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_failed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_accinfo2_failed_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_accinfo2_failed(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_failed_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_failed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_accinfo2_failed_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_fromlogin_accinfo2_ok(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_ok_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_ok_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_accinfo2_ok_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_fromlogin_accinfo2_ok(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_ok_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_accinfo2_ok_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_accinfo2_ok_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +int HP_chr_parse_fromlogin(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_parse_fromlogin_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.parse_fromlogin(fd); + } + if( HPMHooks.count.HP_chr_parse_fromlogin_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_fromlogin_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_fromlogin_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_chr_request_accreg2(int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_request_accreg2_pre ) { + int (*preHookFunc) (int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_request_accreg2_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_request_accreg2_pre[hIndex].func; + retVal___ = preHookFunc(&account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.request_accreg2(account_id, char_id); + } + if( HPMHooks.count.HP_chr_request_accreg2_post ) { + int (*postHookFunc) (int retVal___, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_request_accreg2_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_request_accreg2_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &account_id, &char_id); + } + } + return retVal___; +} +void HP_chr_global_accreg_to_login_start(int account_id, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_global_accreg_to_login_start_pre ) { + void (*preHookFunc) (int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_global_accreg_to_login_start_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_global_accreg_to_login_start_pre[hIndex].func; + preHookFunc(&account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.global_accreg_to_login_start(account_id, char_id); + } + if( HPMHooks.count.HP_chr_global_accreg_to_login_start_post ) { + void (*postHookFunc) (int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_global_accreg_to_login_start_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_global_accreg_to_login_start_post[hIndex].func; + postHookFunc(&account_id, &char_id); + } + } + return; +} +void HP_chr_global_accreg_to_login_send(void) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_global_accreg_to_login_send_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_global_accreg_to_login_send_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_global_accreg_to_login_send_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.global_accreg_to_login_send(); + } + if( HPMHooks.count.HP_chr_global_accreg_to_login_send_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_global_accreg_to_login_send_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_global_accreg_to_login_send_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_chr_global_accreg_to_login_add(const char *key, unsigned int index, intptr_t val, bool is_string) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_global_accreg_to_login_add_pre ) { + void (*preHookFunc) (const char *key, unsigned int *index, intptr_t *val, bool *is_string); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_global_accreg_to_login_add_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_global_accreg_to_login_add_pre[hIndex].func; + preHookFunc(key, &index, &val, &is_string); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.global_accreg_to_login_add(key, index, val, is_string); + } + if( HPMHooks.count.HP_chr_global_accreg_to_login_add_post ) { + void (*postHookFunc) (const char *key, unsigned int *index, intptr_t *val, bool *is_string); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_global_accreg_to_login_add_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_global_accreg_to_login_add_post[hIndex].func; + postHookFunc(key, &index, &val, &is_string); + } + } + return; +} +void HP_chr_read_fame_list(void) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_read_fame_list_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_read_fame_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_read_fame_list_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.read_fame_list(); + } + if( HPMHooks.count.HP_chr_read_fame_list_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_read_fame_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_read_fame_list_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_chr_send_fame_list(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_send_fame_list_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_fame_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_fame_list_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.send_fame_list(fd); + } + if( HPMHooks.count.HP_chr_send_fame_list_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_fame_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_fame_list_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_chr_update_fame_list(int type, int index, int fame) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_update_fame_list_pre ) { + void (*preHookFunc) (int *type, int *index, int *fame); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_update_fame_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_update_fame_list_pre[hIndex].func; + preHookFunc(&type, &index, &fame); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.update_fame_list(type, index, fame); + } + if( HPMHooks.count.HP_chr_update_fame_list_post ) { + void (*postHookFunc) (int *type, int *index, int *fame); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_update_fame_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_update_fame_list_post[hIndex].func; + postHookFunc(&type, &index, &fame); + } + } + return; +} +int HP_chr_loadName(int char_id, char *name) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_loadName_pre ) { + int (*preHookFunc) (int *char_id, char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_loadName_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_loadName_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.loadName(char_id, name); + } + if( HPMHooks.count.HP_chr_loadName_post ) { + int (*postHookFunc) (int retVal___, int *char_id, char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_loadName_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_loadName_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, name); + } + } + return retVal___; +} +void HP_chr_parse_frommap_datasync(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_datasync_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_datasync_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_datasync_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_datasync(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_datasync_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_datasync_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_datasync_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_skillid2idx(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_skillid2idx_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_skillid2idx_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_skillid2idx_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_skillid2idx(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_skillid2idx_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_skillid2idx_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_skillid2idx_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_map_received_ok(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_map_received_ok_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_map_received_ok_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_map_received_ok_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.map_received_ok(fd); + } + if( HPMHooks.count.HP_chr_map_received_ok_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_map_received_ok_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_map_received_ok_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_send_maps(int fd, int id, int j) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_send_maps_pre ) { + void (*preHookFunc) (int *fd, int *id, int *j); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_maps_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_maps_pre[hIndex].func; + preHookFunc(&fd, &id, &j); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.send_maps(fd, id, j); + } + if( HPMHooks.count.HP_chr_send_maps_post ) { + void (*postHookFunc) (int *fd, int *id, int *j); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_maps_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_maps_post[hIndex].func; + postHookFunc(&fd, &id, &j); + } + } + return; +} +void HP_chr_parse_frommap_map_names(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_map_names_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_map_names_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_map_names_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_map_names(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_map_names_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_map_names_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_map_names_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_send_scdata(int fd, int aid, int cid) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_send_scdata_pre ) { + void (*preHookFunc) (int *fd, int *aid, int *cid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_scdata_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_scdata_pre[hIndex].func; + preHookFunc(&fd, &aid, &cid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.send_scdata(fd, aid, cid); + } + if( HPMHooks.count.HP_chr_send_scdata_post ) { + void (*postHookFunc) (int *fd, int *aid, int *cid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_scdata_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_scdata_post[hIndex].func; + postHookFunc(&fd, &aid, &cid); + } + } + return; +} +void HP_chr_parse_frommap_request_scdata(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_request_scdata_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_request_scdata_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_request_scdata_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_request_scdata(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_request_scdata_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_request_scdata_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_request_scdata_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_set_users_count(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_set_users_count_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_users_count_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_users_count_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_set_users_count(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_set_users_count_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_users_count_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_users_count_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_parse_frommap_set_users(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_set_users_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_users_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_users_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_set_users(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_set_users_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_users_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_users_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_save_character_ack(int fd, int aid, int cid) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_save_character_ack_pre ) { + void (*preHookFunc) (int *fd, int *aid, int *cid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_save_character_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_save_character_ack_pre[hIndex].func; + preHookFunc(&fd, &aid, &cid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.save_character_ack(fd, aid, cid); + } + if( HPMHooks.count.HP_chr_save_character_ack_post ) { + void (*postHookFunc) (int *fd, int *aid, int *cid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_save_character_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_save_character_ack_post[hIndex].func; + postHookFunc(&fd, &aid, &cid); + } + } + return; +} +void HP_chr_parse_frommap_save_character(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_save_character_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_save_character_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_save_character_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_save_character(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_save_character_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_save_character_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_save_character_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_select_ack(int fd, int account_id, uint8 flag) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_select_ack_pre ) { + void (*preHookFunc) (int *fd, int *account_id, uint8 *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_select_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_select_ack_pre[hIndex].func; + preHookFunc(&fd, &account_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.select_ack(fd, account_id, flag); + } + if( HPMHooks.count.HP_chr_select_ack_post ) { + void (*postHookFunc) (int *fd, int *account_id, uint8 *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_select_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_select_ack_post[hIndex].func; + postHookFunc(&fd, &account_id, &flag); + } + } + return; +} +void HP_chr_parse_frommap_char_select_req(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_char_select_req_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_char_select_req_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_char_select_req_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_char_select_req(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_char_select_req_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_char_select_req_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_char_select_req_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_change_map_server_ack(int fd, uint8 *data, bool ok) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_change_map_server_ack_pre ) { + void (*preHookFunc) (int *fd, uint8 *data, bool *ok); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_map_server_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_change_map_server_ack_pre[hIndex].func; + preHookFunc(&fd, data, &ok); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.change_map_server_ack(fd, data, ok); + } + if( HPMHooks.count.HP_chr_change_map_server_ack_post ) { + void (*postHookFunc) (int *fd, uint8 *data, bool *ok); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_map_server_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_change_map_server_ack_post[hIndex].func; + postHookFunc(&fd, data, &ok); + } + } + return; +} +void HP_chr_parse_frommap_change_map_server(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_change_map_server_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_change_map_server_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_change_map_server_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_change_map_server(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_change_map_server_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_change_map_server_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_change_map_server_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_remove_friend(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_remove_friend_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_remove_friend_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_remove_friend_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_remove_friend(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_remove_friend_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_remove_friend_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_remove_friend_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_char_name_ack(int fd, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_char_name_ack_pre ) { + void (*preHookFunc) (int *fd, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_name_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_char_name_ack_pre[hIndex].func; + preHookFunc(&fd, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.char_name_ack(fd, char_id); + } + if( HPMHooks.count.HP_chr_char_name_ack_post ) { + void (*postHookFunc) (int *fd, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_char_name_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_char_name_ack_post[hIndex].func; + postHookFunc(&fd, &char_id); + } + } + return; +} +void HP_chr_parse_frommap_char_name_request(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_char_name_request_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_char_name_request_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_char_name_request_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_char_name_request(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_char_name_request_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_char_name_request_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_char_name_request_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_change_email(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_change_email_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_change_email_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_change_email_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_change_email(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_change_email_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_change_email_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_change_email_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_ban_pre ) { + void (*preHookFunc) (int *account_id, int *char_id, time_t *unban_time, short *year, short *month, short *day, short *hour, short *minute, short *second); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_ban_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_ban_pre[hIndex].func; + preHookFunc(&account_id, &char_id, unban_time, &year, &month, &day, &hour, &minute, &second); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.ban(account_id, char_id, unban_time, year, month, day, hour, minute, second); + } + if( HPMHooks.count.HP_chr_ban_post ) { + void (*postHookFunc) (int *account_id, int *char_id, time_t *unban_time, short *year, short *month, short *day, short *hour, short *minute, short *second); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_ban_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_ban_post[hIndex].func; + postHookFunc(&account_id, &char_id, unban_time, &year, &month, &day, &hour, &minute, &second); + } + } + return; +} +void HP_chr_unban(int char_id, int *result) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_unban_pre ) { + void (*preHookFunc) (int *char_id, int *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_unban_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_unban_pre[hIndex].func; + preHookFunc(&char_id, result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.unban(char_id, result); + } + if( HPMHooks.count.HP_chr_unban_post ) { + void (*postHookFunc) (int *char_id, int *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_unban_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_unban_post[hIndex].func; + postHookFunc(&char_id, result); + } + } + return; +} +void HP_chr_ask_name_ack(int fd, int acc, const char *name, int type, int result) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_ask_name_ack_pre ) { + void (*preHookFunc) (int *fd, int *acc, const char *name, int *type, int *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_ask_name_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_ask_name_ack_pre[hIndex].func; + preHookFunc(&fd, &acc, name, &type, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.ask_name_ack(fd, acc, name, type, result); + } + if( HPMHooks.count.HP_chr_ask_name_ack_post ) { + void (*postHookFunc) (int *fd, int *acc, const char *name, int *type, int *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_ask_name_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_ask_name_ack_post[hIndex].func; + postHookFunc(&fd, &acc, name, &type, &result); + } + } + return; +} +void HP_chr_parse_frommap_change_account(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_change_account_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_change_account_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_change_account_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_change_account(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_change_account_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_change_account_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_change_account_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_fame_list(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_fame_list_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_fame_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_fame_list_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_fame_list(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_fame_list_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_fame_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_fame_list_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_divorce_char(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_divorce_char_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_divorce_char_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_divorce_char_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_divorce_char(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_divorce_char_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_divorce_char_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_divorce_char_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_ragsrvinfo(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_ragsrvinfo_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_ragsrvinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_ragsrvinfo_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_ragsrvinfo(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_ragsrvinfo_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_ragsrvinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_ragsrvinfo_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_set_char_offline(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_set_char_offline_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_char_offline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_char_offline_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_set_char_offline(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_set_char_offline_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_char_offline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_char_offline_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_set_all_offline(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_set_all_offline_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_all_offline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_all_offline_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_set_all_offline(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_set_all_offline_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_all_offline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_all_offline_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_parse_frommap_set_char_online(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_set_char_online_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_char_online_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_char_online_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_set_char_online(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_set_char_online_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_set_char_online_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_set_char_online_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_parse_frommap_build_fame_list(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_build_fame_list_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_build_fame_list_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_build_fame_list_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_build_fame_list(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_build_fame_list_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_build_fame_list_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_build_fame_list_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_save_status_change_data(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_save_status_change_data_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_save_status_change_data_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_save_status_change_data_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_save_status_change_data(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_save_status_change_data_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_save_status_change_data_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_save_status_change_data_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_send_pong(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_send_pong_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_pong_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_pong_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.send_pong(fd); + } + if( HPMHooks.count.HP_chr_send_pong_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_pong_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_pong_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_ping(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_ping_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_ping_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_ping_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_ping(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_ping_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_ping_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_ping_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_map_auth_ok(int fd, int account_id, struct char_auth_node *node, struct mmo_charstatus *cd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_map_auth_ok_pre ) { + void (*preHookFunc) (int *fd, int *account_id, struct char_auth_node *node, struct mmo_charstatus *cd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_map_auth_ok_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_map_auth_ok_pre[hIndex].func; + preHookFunc(&fd, &account_id, node, cd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.map_auth_ok(fd, account_id, node, cd); + } + if( HPMHooks.count.HP_chr_map_auth_ok_post ) { + void (*postHookFunc) (int *fd, int *account_id, struct char_auth_node *node, struct mmo_charstatus *cd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_map_auth_ok_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_map_auth_ok_post[hIndex].func; + postHookFunc(&fd, &account_id, node, cd); + } + } + return; +} +void HP_chr_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_map_auth_failed_pre ) { + void (*preHookFunc) (int *fd, int *account_id, int *char_id, int *login_id1, char *sex, uint32 *ip); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_map_auth_failed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_map_auth_failed_pre[hIndex].func; + preHookFunc(&fd, &account_id, &char_id, &login_id1, &sex, &ip); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.map_auth_failed(fd, account_id, char_id, login_id1, sex, ip); + } + if( HPMHooks.count.HP_chr_map_auth_failed_post ) { + void (*postHookFunc) (int *fd, int *account_id, int *char_id, int *login_id1, char *sex, uint32 *ip); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_map_auth_failed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_map_auth_failed_post[hIndex].func; + postHookFunc(&fd, &account_id, &char_id, &login_id1, &sex, &ip); + } + } + return; +} +void HP_chr_parse_frommap_auth_request(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_auth_request_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_auth_request_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_auth_request_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_auth_request(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_auth_request_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_auth_request_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_auth_request_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_parse_frommap_update_ip(int fd, int id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_update_ip_pre ) { + void (*preHookFunc) (int *fd, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_update_ip_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_update_ip_pre[hIndex].func; + preHookFunc(&fd, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_update_ip(fd, id); + } + if( HPMHooks.count.HP_chr_parse_frommap_update_ip_post ) { + void (*postHookFunc) (int *fd, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_update_ip_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_update_ip_post[hIndex].func; + postHookFunc(&fd, &id); + } + } + return; +} +void HP_chr_parse_frommap_request_stats_report(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_request_stats_report_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_request_stats_report_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_request_stats_report_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_request_stats_report(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_request_stats_report_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_request_stats_report_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_request_stats_report_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_scdata_update(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_scdata_update_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_scdata_update_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_scdata_update_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_scdata_update(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_scdata_update_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_scdata_update_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_scdata_update_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_frommap_scdata_delete(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_frommap_scdata_delete_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_scdata_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_scdata_delete_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_frommap_scdata_delete(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_scdata_delete_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_scdata_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_scdata_delete_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +int HP_chr_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.parse_frommap(fd); + } + if( HPMHooks.count.HP_chr_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_chr_search_mapserver(unsigned short map, uint32 ip, uint16 port) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_search_mapserver_pre ) { + int (*preHookFunc) (unsigned short *map, uint32 *ip, uint16 *port); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_search_mapserver_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_search_mapserver_pre[hIndex].func; + retVal___ = preHookFunc(&map, &ip, &port); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.search_mapserver(map, ip, port); + } + if( HPMHooks.count.HP_chr_search_mapserver_post ) { + int (*postHookFunc) (int retVal___, unsigned short *map, uint32 *ip, uint16 *port); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_search_mapserver_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_search_mapserver_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &map, &ip, &port); + } + } + return retVal___; +} +int HP_chr_mapif_init(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mapif_init_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mapif_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mapif_init_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mapif_init(fd); + } + if( HPMHooks.count.HP_chr_mapif_init_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mapif_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mapif_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_chr_lan_subnetcheck(uint32 ip) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_lan_subnetcheck_pre ) { + int (*preHookFunc) (uint32 *ip); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_lan_subnetcheck_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_lan_subnetcheck_pre[hIndex].func; + retVal___ = preHookFunc(&ip); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.lan_subnetcheck(ip); + } + if( HPMHooks.count.HP_chr_lan_subnetcheck_post ) { + int (*postHookFunc) (int retVal___, uint32 *ip); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_lan_subnetcheck_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_lan_subnetcheck_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &ip); + } + } + return retVal___; +} +void HP_chr_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_ack_pre ) { + void (*preHookFunc) (int *fd, int *char_id, uint32 *result, time_t *delete_date); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_ack_pre[hIndex].func; + preHookFunc(&fd, &char_id, &result, &delete_date); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_ack(fd, char_id, result, delete_date); + } + if( HPMHooks.count.HP_chr_delete2_ack_post ) { + void (*postHookFunc) (int *fd, int *char_id, uint32 *result, time_t *delete_date); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_ack_post[hIndex].func; + postHookFunc(&fd, &char_id, &result, &delete_date); + } + } + return; +} +void HP_chr_delete2_accept_actual_ack(int fd, int char_id, uint32 result) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_accept_actual_ack_pre ) { + void (*preHookFunc) (int *fd, int *char_id, uint32 *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_accept_actual_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_accept_actual_ack_pre[hIndex].func; + preHookFunc(&fd, &char_id, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_accept_actual_ack(fd, char_id, result); + } + if( HPMHooks.count.HP_chr_delete2_accept_actual_ack_post ) { + void (*postHookFunc) (int *fd, int *char_id, uint32 *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_accept_actual_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_accept_actual_ack_post[hIndex].func; + postHookFunc(&fd, &char_id, &result); + } + } + return; +} +void HP_chr_delete2_accept_ack(int fd, int char_id, uint32 result) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_accept_ack_pre ) { + void (*preHookFunc) (int *fd, int *char_id, uint32 *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_accept_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_accept_ack_pre[hIndex].func; + preHookFunc(&fd, &char_id, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_accept_ack(fd, char_id, result); + } + if( HPMHooks.count.HP_chr_delete2_accept_ack_post ) { + void (*postHookFunc) (int *fd, int *char_id, uint32 *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_accept_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_accept_ack_post[hIndex].func; + postHookFunc(&fd, &char_id, &result); + } + } + return; +} +void HP_chr_delete2_cancel_ack(int fd, int char_id, uint32 result) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_cancel_ack_pre ) { + void (*preHookFunc) (int *fd, int *char_id, uint32 *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_cancel_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_cancel_ack_pre[hIndex].func; + preHookFunc(&fd, &char_id, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_cancel_ack(fd, char_id, result); + } + if( HPMHooks.count.HP_chr_delete2_cancel_ack_post ) { + void (*postHookFunc) (int *fd, int *char_id, uint32 *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_cancel_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_cancel_ack_post[hIndex].func; + postHookFunc(&fd, &char_id, &result); + } + } + return; +} +void HP_chr_delete2_req(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_req_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_req_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_req_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_req(fd, sd); + } + if( HPMHooks.count.HP_chr_delete2_req_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_req_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_req_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_delete2_accept(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_accept_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_accept_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_accept_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_accept(fd, sd); + } + if( HPMHooks.count.HP_chr_delete2_accept_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_accept_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_accept_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_delete2_cancel(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete2_cancel_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_cancel_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete2_cancel_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete2_cancel(fd, sd); + } + if( HPMHooks.count.HP_chr_delete2_cancel_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete2_cancel_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete2_cancel_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_send_account_id(int fd, int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_send_account_id_pre ) { + void (*preHookFunc) (int *fd, int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_account_id_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_account_id_pre[hIndex].func; + preHookFunc(&fd, &account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.send_account_id(fd, account_id); + } + if( HPMHooks.count.HP_chr_send_account_id_post ) { + void (*postHookFunc) (int *fd, int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_account_id_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_account_id_post[hIndex].func; + postHookFunc(&fd, &account_id); + } + } + return; +} +void HP_chr_parse_char_connect(int fd, struct char_session_data *sd, uint32 ipl) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_connect_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd, uint32 *ipl); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_connect_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_connect_pre[hIndex].func; + preHookFunc(&fd, sd, &ipl); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_connect(fd, sd, ipl); + } + if( HPMHooks.count.HP_chr_parse_char_connect_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd, uint32 *ipl); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_connect_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_connect_post[hIndex].func; + postHookFunc(&fd, sd, &ipl); + } + } + return; +} +void HP_chr_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_send_map_info_pre ) { + void (*preHookFunc) (int *fd, int *i, uint32 *subnet_map_ip, struct mmo_charstatus *cd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_map_info_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_map_info_pre[hIndex].func; + preHookFunc(&fd, &i, &subnet_map_ip, cd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.send_map_info(fd, i, subnet_map_ip, cd); + } + if( HPMHooks.count.HP_chr_send_map_info_post ) { + void (*postHookFunc) (int *fd, int *i, uint32 *subnet_map_ip, struct mmo_charstatus *cd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_map_info_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_map_info_post[hIndex].func; + postHookFunc(&fd, &i, &subnet_map_ip, cd); + } + } + return; +} +void HP_chr_send_wait_char_server(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_send_wait_char_server_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_wait_char_server_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_wait_char_server_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.send_wait_char_server(fd); + } + if( HPMHooks.count.HP_chr_send_wait_char_server_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_wait_char_server_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_wait_char_server_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +int HP_chr_search_default_maps_mapserver(struct mmo_charstatus *cd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_search_default_maps_mapserver_pre ) { + int (*preHookFunc) (struct mmo_charstatus *cd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_search_default_maps_mapserver_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_search_default_maps_mapserver_pre[hIndex].func; + retVal___ = preHookFunc(cd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.search_default_maps_mapserver(cd); + } + if( HPMHooks.count.HP_chr_search_default_maps_mapserver_post ) { + int (*postHookFunc) (int retVal___, struct mmo_charstatus *cd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_search_default_maps_mapserver_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_search_default_maps_mapserver_post[hIndex].func; + retVal___ = postHookFunc(retVal___, cd); + } + } + return retVal___; +} +void HP_chr_parse_char_select(int fd, struct char_session_data *sd, uint32 ipl) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_select_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd, uint32 *ipl); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_select_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_select_pre[hIndex].func; + preHookFunc(&fd, sd, &ipl); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_select(fd, sd, ipl); + } + if( HPMHooks.count.HP_chr_parse_char_select_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd, uint32 *ipl); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_select_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_select_post[hIndex].func; + postHookFunc(&fd, sd, &ipl); + } + } + return; +} +void HP_chr_creation_failed(int fd, int result) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_creation_failed_pre ) { + void (*preHookFunc) (int *fd, int *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_creation_failed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_creation_failed_pre[hIndex].func; + preHookFunc(&fd, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.creation_failed(fd, result); + } + if( HPMHooks.count.HP_chr_creation_failed_post ) { + void (*postHookFunc) (int *fd, int *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_creation_failed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_creation_failed_post[hIndex].func; + postHookFunc(&fd, &result); + } + } + return; +} +void HP_chr_creation_ok(int fd, struct mmo_charstatus *char_dat) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_creation_ok_pre ) { + void (*preHookFunc) (int *fd, struct mmo_charstatus *char_dat); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_creation_ok_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_creation_ok_pre[hIndex].func; + preHookFunc(&fd, char_dat); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.creation_ok(fd, char_dat); + } + if( HPMHooks.count.HP_chr_creation_ok_post ) { + void (*postHookFunc) (int *fd, struct mmo_charstatus *char_dat); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_creation_ok_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_creation_ok_post[hIndex].func; + postHookFunc(&fd, char_dat); + } + } + return; +} +void HP_chr_parse_char_create_new_char(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_create_new_char_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_create_new_char_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_create_new_char_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_create_new_char(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_create_new_char_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_create_new_char_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_create_new_char_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_delete_char_failed(int fd, int flag) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete_char_failed_pre ) { + void (*preHookFunc) (int *fd, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete_char_failed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete_char_failed_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete_char_failed(fd, flag); + } + if( HPMHooks.count.HP_chr_delete_char_failed_post ) { + void (*postHookFunc) (int *fd, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete_char_failed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete_char_failed_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_chr_delete_char_ok(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_delete_char_ok_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete_char_ok_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_delete_char_ok_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.delete_char_ok(fd); + } + if( HPMHooks.count.HP_chr_delete_char_ok_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_delete_char_ok_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_delete_char_ok_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_char_delete_char(int fd, struct char_session_data *sd, unsigned short cmd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_delete_char_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd, unsigned short *cmd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete_char_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_delete_char_pre[hIndex].func; + preHookFunc(&fd, sd, &cmd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_delete_char(fd, sd, cmd); + } + if( HPMHooks.count.HP_chr_parse_char_delete_char_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd, unsigned short *cmd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete_char_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_delete_char_post[hIndex].func; + postHookFunc(&fd, sd, &cmd); + } + } + return; +} +void HP_chr_parse_char_ping(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_ping_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_ping_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_ping_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_ping(fd); + } + if( HPMHooks.count.HP_chr_parse_char_ping_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_ping_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_ping_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_allow_rename(int fd, int flag) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_allow_rename_pre ) { + void (*preHookFunc) (int *fd, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_allow_rename_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_allow_rename_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.allow_rename(fd, flag); + } + if( HPMHooks.count.HP_chr_allow_rename_post ) { + void (*postHookFunc) (int *fd, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_allow_rename_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_allow_rename_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_chr_parse_char_rename_char(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_rename_char_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_rename_char_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_rename_char_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_rename_char(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_rename_char_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_rename_char_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_rename_char_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_rename_char2(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_rename_char2_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_rename_char2_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_rename_char2_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_rename_char2(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_rename_char2_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_rename_char2_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_rename_char2_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_rename_char_ack(int fd, int flag) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_rename_char_ack_pre ) { + void (*preHookFunc) (int *fd, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_rename_char_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_rename_char_ack_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.rename_char_ack(fd, flag); + } + if( HPMHooks.count.HP_chr_rename_char_ack_post ) { + void (*postHookFunc) (int *fd, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_rename_char_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_rename_char_ack_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_chr_parse_char_rename_char_confirm(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_rename_char_confirm_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_rename_char_confirm_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_rename_char_confirm_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_rename_char_confirm(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_rename_char_confirm_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_rename_char_confirm_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_rename_char_confirm_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_captcha_notsupported(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_captcha_notsupported_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_captcha_notsupported_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_captcha_notsupported_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.captcha_notsupported(fd); + } + if( HPMHooks.count.HP_chr_captcha_notsupported_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_captcha_notsupported_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_captcha_notsupported_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_char_request_captcha(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_request_captcha_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_request_captcha_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_request_captcha_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_request_captcha(fd); + } + if( HPMHooks.count.HP_chr_parse_char_request_captcha_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_request_captcha_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_request_captcha_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_char_check_captcha(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_check_captcha_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_check_captcha_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_check_captcha_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_check_captcha(fd); + } + if( HPMHooks.count.HP_chr_parse_char_check_captcha_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_check_captcha_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_check_captcha_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_char_delete2_req(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_delete2_req_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete2_req_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_delete2_req_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_delete2_req(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_delete2_req_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete2_req_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_delete2_req_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_delete2_accept(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_delete2_accept_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete2_accept_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_delete2_accept_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_delete2_accept(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_delete2_accept_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete2_accept_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_delete2_accept_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_delete2_cancel(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_delete2_cancel_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete2_cancel_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_delete2_cancel_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_delete2_cancel(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_delete2_cancel_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_delete2_cancel_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_delete2_cancel_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_login_map_server_ack(int fd, uint8 flag) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_login_map_server_ack_pre ) { + void (*preHookFunc) (int *fd, uint8 *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_login_map_server_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_login_map_server_ack_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.login_map_server_ack(fd, flag); + } + if( HPMHooks.count.HP_chr_login_map_server_ack_post ) { + void (*postHookFunc) (int *fd, uint8 *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_login_map_server_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_login_map_server_ack_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_chr_parse_char_login_map_server(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_login_map_server_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_login_map_server_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_login_map_server_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_login_map_server(fd); + } + if( HPMHooks.count.HP_chr_parse_char_login_map_server_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_login_map_server_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_login_map_server_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_chr_parse_char_pincode_check(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_pincode_check_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_check_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_check_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_pincode_check(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_pincode_check_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_check_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_check_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_pincode_window(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_pincode_window_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_window_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_window_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_pincode_window(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_pincode_window_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_window_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_window_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_pincode_change(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_pincode_change_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_change_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_change_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_pincode_change(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_pincode_change_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_change_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_change_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_pincode_first_pin(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_pincode_first_pin_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_first_pin_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_first_pin_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_pincode_first_pin(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_pincode_first_pin_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pincode_first_pin_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_pincode_first_pin_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_parse_char_request_chars(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_request_chars_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_request_chars_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_request_chars_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_request_chars(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_request_chars_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_request_chars_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_request_chars_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +void HP_chr_change_character_slot_ack(int fd, bool ret) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_change_character_slot_ack_pre ) { + void (*preHookFunc) (int *fd, bool *ret); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_character_slot_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_change_character_slot_ack_pre[hIndex].func; + preHookFunc(&fd, &ret); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.change_character_slot_ack(fd, ret); + } + if( HPMHooks.count.HP_chr_change_character_slot_ack_post ) { + void (*postHookFunc) (int *fd, bool *ret); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_character_slot_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_change_character_slot_ack_post[hIndex].func; + postHookFunc(&fd, &ret); + } + } + return; +} +void HP_chr_parse_char_move_character(int fd, struct char_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_parse_char_move_character_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_move_character_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_move_character_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.parse_char_move_character(fd, sd); + } + if( HPMHooks.count.HP_chr_parse_char_move_character_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_move_character_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_move_character_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} +int HP_chr_parse_char_unknown_packet(int fd, uint32 ipl) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_parse_char_unknown_packet_pre ) { + int (*preHookFunc) (int *fd, uint32 *ipl); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_unknown_packet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_unknown_packet_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &ipl); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.parse_char_unknown_packet(fd, ipl); + } + if( HPMHooks.count.HP_chr_parse_char_unknown_packet_post ) { + int (*postHookFunc) (int retVal___, int *fd, uint32 *ipl); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_unknown_packet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_unknown_packet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &ipl); + } + } + return retVal___; +} +int HP_chr_parse_char(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_parse_char_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_parse_char_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.parse_char(fd); + } + if( HPMHooks.count.HP_chr_parse_char_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_char_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_parse_char_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_chr_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_broadcast_user_count_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_broadcast_user_count_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_broadcast_user_count_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.broadcast_user_count(tid, tick, id, data); + } + if( HPMHooks.count.HP_chr_broadcast_user_count_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_broadcast_user_count_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_broadcast_user_count_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +int HP_chr_send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_send_accounts_tologin_sub_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_accounts_tologin_sub_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_chr_send_accounts_tologin_sub_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.chr.send_accounts_tologin_sub(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_chr_send_accounts_tologin_sub_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_accounts_tologin_sub_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_chr_send_accounts_tologin_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +int HP_chr_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_send_accounts_tologin_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_accounts_tologin_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_send_accounts_tologin_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.send_accounts_tologin(tid, tick, id, data); + } + if( HPMHooks.count.HP_chr_send_accounts_tologin_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_accounts_tologin_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_send_accounts_tologin_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +int HP_chr_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_check_connect_login_server_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_check_connect_login_server_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_check_connect_login_server_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.check_connect_login_server(tid, tick, id, data); + } + if( HPMHooks.count.HP_chr_check_connect_login_server_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_check_connect_login_server_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_check_connect_login_server_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +int HP_chr_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_online_data_cleanup_sub_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_online_data_cleanup_sub_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_chr_online_data_cleanup_sub_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.chr.online_data_cleanup_sub(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_chr_online_data_cleanup_sub_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_online_data_cleanup_sub_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_chr_online_data_cleanup_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +int HP_chr_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_online_data_cleanup_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_online_data_cleanup_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_online_data_cleanup_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.online_data_cleanup(tid, tick, id, data); + } + if( HPMHooks.count.HP_chr_online_data_cleanup_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_online_data_cleanup_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_online_data_cleanup_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +int HP_chr_lan_config_read(const char *lancfgName) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_lan_config_read_pre ) { + int (*preHookFunc) (const char *lancfgName); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_lan_config_read_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_lan_config_read_pre[hIndex].func; + retVal___ = preHookFunc(lancfgName); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.lan_config_read(lancfgName); + } + if( HPMHooks.count.HP_chr_lan_config_read_post ) { + int (*postHookFunc) (int retVal___, const char *lancfgName); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_lan_config_read_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_lan_config_read_post[hIndex].func; + retVal___ = postHookFunc(retVal___, lancfgName); + } + } + return retVal___; +} +void HP_chr_sql_config_read(const char *cfgName) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_sql_config_read_pre ) { + void (*preHookFunc) (const char *cfgName); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_sql_config_read_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_sql_config_read_pre[hIndex].func; + preHookFunc(cfgName); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.sql_config_read(cfgName); + } + if( HPMHooks.count.HP_chr_sql_config_read_post ) { + void (*postHookFunc) (const char *cfgName); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_sql_config_read_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_sql_config_read_post[hIndex].func; + postHookFunc(cfgName); + } + } + return; +} +void HP_chr_config_dispatch(char *w1, char *w2) { + int hIndex = 0; + if( HPMHooks.count.HP_chr_config_dispatch_pre ) { + void (*preHookFunc) (char *w1, char *w2); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_config_dispatch_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_config_dispatch_pre[hIndex].func; + preHookFunc(w1, w2); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.config_dispatch(w1, w2); + } + if( HPMHooks.count.HP_chr_config_dispatch_post ) { + void (*postHookFunc) (char *w1, char *w2); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_config_dispatch_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_config_dispatch_post[hIndex].func; + postHookFunc(w1, w2); + } + } + return; +} +int HP_chr_config_read(const char *cfgName) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_config_read_pre ) { + int (*preHookFunc) (const char *cfgName); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_config_read_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_config_read_pre[hIndex].func; + retVal___ = preHookFunc(cfgName); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.config_read(cfgName); + } + if( HPMHooks.count.HP_chr_config_read_post ) { + int (*postHookFunc) (int retVal___, const char *cfgName); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_config_read_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_config_read_post[hIndex].func; + retVal___ = postHookFunc(retVal___, cfgName); + } + } + return retVal___; +} +/* geoip */ +const char* HP_geoip_getcountry(uint32 ipnum) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_geoip_getcountry_pre ) { + const char* (*preHookFunc) (uint32 *ipnum); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_geoip_getcountry_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_geoip_getcountry_pre[hIndex].func; + retVal___ = preHookFunc(&ipnum); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.geoip.getcountry(ipnum); + } + if( HPMHooks.count.HP_geoip_getcountry_post ) { + const char* (*postHookFunc) (const char* retVal___, uint32 *ipnum); + for(hIndex = 0; hIndex < HPMHooks.count.HP_geoip_getcountry_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_geoip_getcountry_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &ipnum); + } + } + return retVal___; +} +void HP_geoip_final(bool shutdown) { + int hIndex = 0; + if( HPMHooks.count.HP_geoip_final_pre ) { + void (*preHookFunc) (bool *shutdown); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_geoip_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_geoip_final_pre[hIndex].func; + preHookFunc(&shutdown); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.geoip.final(shutdown); + } + if( HPMHooks.count.HP_geoip_final_post ) { + void (*postHookFunc) (bool *shutdown); + for(hIndex = 0; hIndex < HPMHooks.count.HP_geoip_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_geoip_final_post[hIndex].func; + postHookFunc(&shutdown); + } + } + return; +} +void HP_geoip_init(void) { + int hIndex = 0; + if( HPMHooks.count.HP_geoip_init_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_geoip_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_geoip_init_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.geoip.init(); + } + if( HPMHooks.count.HP_geoip_init_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_geoip_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_geoip_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +/* inter_auction */ +int HP_inter_auction_count(int char_id, bool buy) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_auction_count_pre ) { + int (*preHookFunc) (int *char_id, bool *buy); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_count_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_count_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &buy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_auction.count(char_id, buy); + } + if( HPMHooks.count.HP_inter_auction_count_post ) { + int (*postHookFunc) (int retVal___, int *char_id, bool *buy); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_count_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_count_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &buy); + } + } + return retVal___; +} +void HP_inter_auction_save(struct auction_data *auction) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_auction_save_pre ) { + void (*preHookFunc) (struct auction_data *auction); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_save_pre[hIndex].func; + preHookFunc(auction); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_auction.save(auction); + } + if( HPMHooks.count.HP_inter_auction_save_post ) { + void (*postHookFunc) (struct auction_data *auction); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_save_post[hIndex].func; + postHookFunc(auction); + } + } + return; +} +unsigned int HP_inter_auction_create(struct auction_data *auction) { + int hIndex = 0; + unsigned int retVal___ = 0; + if( HPMHooks.count.HP_inter_auction_create_pre ) { + unsigned int (*preHookFunc) (struct auction_data *auction); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_create_pre[hIndex].func; + retVal___ = preHookFunc(auction); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_auction.create(auction); + } + if( HPMHooks.count.HP_inter_auction_create_post ) { + unsigned int (*postHookFunc) (unsigned int retVal___, struct auction_data *auction); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___, auction); + } + } + return retVal___; +} +int HP_inter_auction_end_timer(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_auction_end_timer_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_end_timer_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_end_timer_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_auction.end_timer(tid, tick, id, data); + } + if( HPMHooks.count.HP_inter_auction_end_timer_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_end_timer_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_end_timer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +void HP_inter_auction_delete_(struct auction_data *auction) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_auction_delete__pre ) { + void (*preHookFunc) (struct auction_data *auction); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_delete__pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_delete__pre[hIndex].func; + preHookFunc(auction); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_auction.delete_(auction); + } + if( HPMHooks.count.HP_inter_auction_delete__post ) { + void (*postHookFunc) (struct auction_data *auction); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_delete__post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_delete__post[hIndex].func; + postHookFunc(auction); + } + } + return; +} +void HP_inter_auction_fromsql(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_auction_fromsql_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_fromsql_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_auction.fromsql(); + } + if( HPMHooks.count.HP_inter_auction_fromsql_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_fromsql_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_auction_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_auction_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_auction.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_auction_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_inter_auction_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_auction_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_auction.sql_init(); + } + if( HPMHooks.count.HP_inter_auction_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_auction_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_auction_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_auction_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_auction.sql_final(); + } + if( HPMHooks.count.HP_inter_auction_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_auction_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_auction_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +/* inter_elemental */ +void HP_inter_elemental_sql_init(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_elemental_sql_init_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_elemental_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_elemental_sql_init_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_elemental.sql_init(); + } + if( HPMHooks.count.HP_inter_elemental_sql_init_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_elemental_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_elemental_sql_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_inter_elemental_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_elemental_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_elemental_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_elemental_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_elemental.sql_final(); + } + if( HPMHooks.count.HP_inter_elemental_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_elemental_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_elemental_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_elemental_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_elemental_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_elemental_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_elemental_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_elemental.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_elemental_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_elemental_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_elemental_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +/* inter_guild */ +int HP_inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_save_timer_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_save_timer_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_save_timer_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.save_timer(tid, tick, id, data); + } + if( HPMHooks.count.HP_inter_guild_save_timer_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_save_timer_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_save_timer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +int HP_inter_guild_removemember_tosql(int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_removemember_tosql_pre ) { + int (*preHookFunc) (int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_removemember_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_removemember_tosql_pre[hIndex].func; + retVal___ = preHookFunc(&account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.removemember_tosql(account_id, char_id); + } + if( HPMHooks.count.HP_inter_guild_removemember_tosql_post ) { + int (*postHookFunc) (int retVal___, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_removemember_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_removemember_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &account_id, &char_id); + } + } + return retVal___; +} +int HP_inter_guild_tosql(struct guild *g, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_tosql_pre ) { + int (*preHookFunc) (struct guild *g, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_tosql_pre[hIndex].func; + retVal___ = preHookFunc(g, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.tosql(g, flag); + } + if( HPMHooks.count.HP_inter_guild_tosql_post ) { + int (*postHookFunc) (int retVal___, struct guild *g, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g, &flag); + } + } + return retVal___; +} +struct guild* HP_inter_guild_fromsql(int guild_id) { + int hIndex = 0; + struct guild* retVal___ = NULL; + if( HPMHooks.count.HP_inter_guild_fromsql_pre ) { + struct guild* (*preHookFunc) (int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.fromsql(guild_id); + } + if( HPMHooks.count.HP_inter_guild_fromsql_post ) { + struct guild* (*postHookFunc) (struct guild* retVal___, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id); + } + } + return retVal___; +} +int HP_inter_guild_castle_tosql(struct guild_castle *gc) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_castle_tosql_pre ) { + int (*preHookFunc) (struct guild_castle *gc); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_castle_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_castle_tosql_pre[hIndex].func; + retVal___ = preHookFunc(gc); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.castle_tosql(gc); + } + if( HPMHooks.count.HP_inter_guild_castle_tosql_post ) { + int (*postHookFunc) (int retVal___, struct guild_castle *gc); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_castle_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_castle_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, gc); + } + } + return retVal___; +} +struct guild_castle* HP_inter_guild_castle_fromsql(int castle_id) { + int hIndex = 0; + struct guild_castle* retVal___ = NULL; + if( HPMHooks.count.HP_inter_guild_castle_fromsql_pre ) { + struct guild_castle* (*preHookFunc) (int *castle_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_castle_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_castle_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&castle_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.castle_fromsql(castle_id); + } + if( HPMHooks.count.HP_inter_guild_castle_fromsql_post ) { + struct guild_castle* (*postHookFunc) (struct guild_castle* retVal___, int *castle_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_castle_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_castle_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &castle_id); + } + } + return retVal___; +} +bool HP_inter_guild_exp_parse_row(char *split[], int column, int current) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_guild_exp_parse_row_pre ) { + bool (*preHookFunc) (char *split[], int *column, int *current); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_exp_parse_row_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_exp_parse_row_pre[hIndex].func; + retVal___ = preHookFunc(split, &column, ¤t); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.exp_parse_row(split, column, current); + } + if( HPMHooks.count.HP_inter_guild_exp_parse_row_post ) { + bool (*postHookFunc) (bool retVal___, char *split[], int *column, int *current); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_exp_parse_row_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_exp_parse_row_post[hIndex].func; + retVal___ = postHookFunc(retVal___, split, &column, ¤t); + } + } + return retVal___; +} +int HP_inter_guild_CharOnline(int char_id, int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_CharOnline_pre ) { + int (*preHookFunc) (int *char_id, int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_CharOnline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_CharOnline_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.CharOnline(char_id, guild_id); + } + if( HPMHooks.count.HP_inter_guild_CharOnline_post ) { + int (*postHookFunc) (int retVal___, int *char_id, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_CharOnline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_CharOnline_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &guild_id); + } + } + return retVal___; +} +int HP_inter_guild_CharOffline(int char_id, int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_CharOffline_pre ) { + int (*preHookFunc) (int *char_id, int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_CharOffline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_CharOffline_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.CharOffline(char_id, guild_id); + } + if( HPMHooks.count.HP_inter_guild_CharOffline_post ) { + int (*postHookFunc) (int retVal___, int *char_id, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_CharOffline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_CharOffline_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &guild_id); + } + } + return retVal___; +} +int HP_inter_guild_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.sql_init(); + } + if( HPMHooks.count.HP_inter_guild_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +int HP_inter_guild_db_final(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_db_final_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_db_final_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_inter_guild_db_final_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.inter_guild.db_final(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_inter_guild_db_final_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_db_final_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_inter_guild_db_final_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +void HP_inter_guild_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_guild_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_guild.sql_final(); + } + if( HPMHooks.count.HP_inter_guild_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_guild_search_guildname(char *str) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_search_guildname_pre ) { + int (*preHookFunc) (char *str); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_search_guildname_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_search_guildname_pre[hIndex].func; + retVal___ = preHookFunc(str); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.search_guildname(str); + } + if( HPMHooks.count.HP_inter_guild_search_guildname_post ) { + int (*postHookFunc) (int retVal___, char *str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_search_guildname_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_search_guildname_post[hIndex].func; + retVal___ = postHookFunc(retVal___, str); + } + } + return retVal___; +} +bool HP_inter_guild_check_empty(struct guild *g) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_guild_check_empty_pre ) { + bool (*preHookFunc) (struct guild *g); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_check_empty_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_check_empty_pre[hIndex].func; + retVal___ = preHookFunc(g); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.check_empty(g); + } + if( HPMHooks.count.HP_inter_guild_check_empty_post ) { + bool (*postHookFunc) (bool retVal___, struct guild *g); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_check_empty_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_check_empty_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g); + } + } + return retVal___; +} +unsigned int HP_inter_guild_nextexp(int level) { + int hIndex = 0; + unsigned int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_nextexp_pre ) { + unsigned int (*preHookFunc) (int *level); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_nextexp_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_nextexp_pre[hIndex].func; + retVal___ = preHookFunc(&level); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.nextexp(level); + } + if( HPMHooks.count.HP_inter_guild_nextexp_post ) { + unsigned int (*postHookFunc) (unsigned int retVal___, int *level); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_nextexp_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_nextexp_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &level); + } + } + return retVal___; +} +int HP_inter_guild_checkskill(struct guild *g, int id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_checkskill_pre ) { + int (*preHookFunc) (struct guild *g, int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_checkskill_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_checkskill_pre[hIndex].func; + retVal___ = preHookFunc(g, &id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.checkskill(g, id); + } + if( HPMHooks.count.HP_inter_guild_checkskill_post ) { + int (*postHookFunc) (int retVal___, struct guild *g, int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_checkskill_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_checkskill_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g, &id); + } + } + return retVal___; +} +int HP_inter_guild_calcinfo(struct guild *g) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_calcinfo_pre ) { + int (*preHookFunc) (struct guild *g); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_calcinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_calcinfo_pre[hIndex].func; + retVal___ = preHookFunc(g); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.calcinfo(g); + } + if( HPMHooks.count.HP_inter_guild_calcinfo_post ) { + int (*postHookFunc) (int retVal___, struct guild *g); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_calcinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_calcinfo_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g); + } + } + return retVal___; +} +int HP_inter_guild_sex_changed(int guild_id, int account_id, int char_id, short gender) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_sex_changed_pre ) { + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, short *gender); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_sex_changed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_sex_changed_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &gender); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.sex_changed(guild_id, account_id, char_id, gender); + } + if( HPMHooks.count.HP_inter_guild_sex_changed_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *account_id, int *char_id, short *gender); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_sex_changed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_sex_changed_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &account_id, &char_id, &gender); + } + } + return retVal___; +} +int HP_inter_guild_charname_changed(int guild_id, int account_id, int char_id, char *name) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_charname_changed_pre ) { + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_charname_changed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_charname_changed_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.charname_changed(guild_id, account_id, char_id, name); + } + if( HPMHooks.count.HP_inter_guild_charname_changed_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *account_id, int *char_id, char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_charname_changed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_charname_changed_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &account_id, &char_id, name); + } + } + return retVal___; +} +int HP_inter_guild_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_guild_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_inter_guild_leave(int guild_id, int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_leave_pre ) { + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_leave_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_leave_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.leave(guild_id, account_id, char_id); + } + if( HPMHooks.count.HP_inter_guild_leave_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_leave_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_leave_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &account_id, &char_id); + } + } + return retVal___; +} +int HP_inter_guild_broken(int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_guild_broken_pre ) { + int (*preHookFunc) (int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_broken_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_guild_broken_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_guild.broken(guild_id); + } + if( HPMHooks.count.HP_inter_guild_broken_post ) { + int (*postHookFunc) (int retVal___, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_guild_broken_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_guild_broken_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id); + } + } + return retVal___; +} +/* inter_homunculus */ +int HP_inter_homunculus_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_homunculus_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_homunculus_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_homunculus_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_homunculus.sql_init(); + } + if( HPMHooks.count.HP_inter_homunculus_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_homunculus_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_homunculus_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_homunculus_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_homunculus_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_homunculus_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_homunculus_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_homunculus.sql_final(); + } + if( HPMHooks.count.HP_inter_homunculus_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_homunculus_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_homunculus_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_homunculus_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_homunculus_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_homunculus_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_homunculus_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_homunculus.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_homunculus_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_homunculus_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_homunculus_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +/* inter */ +const char* HP_inter_msg_txt(int msg_number) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_inter_msg_txt_pre ) { + const char* (*preHookFunc) (int *msg_number); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_msg_txt_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_msg_txt_pre[hIndex].func; + retVal___ = preHookFunc(&msg_number); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.msg_txt(msg_number); + } + if( HPMHooks.count.HP_inter_msg_txt_post ) { + const char* (*postHookFunc) (const char* retVal___, int *msg_number); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_msg_txt_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_msg_txt_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &msg_number); + } + } + return retVal___; +} +bool HP_inter_msg_config_read(const char *cfg_name, bool allow_override) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_msg_config_read_pre ) { + bool (*preHookFunc) (const char *cfg_name, bool *allow_override); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_msg_config_read_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_msg_config_read_pre[hIndex].func; + retVal___ = preHookFunc(cfg_name, &allow_override); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.msg_config_read(cfg_name, allow_override); + } + if( HPMHooks.count.HP_inter_msg_config_read_post ) { + bool (*postHookFunc) (bool retVal___, const char *cfg_name, bool *allow_override); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_msg_config_read_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_msg_config_read_post[hIndex].func; + retVal___ = postHookFunc(retVal___, cfg_name, &allow_override); + } + } + return retVal___; +} +void HP_inter_do_final_msg(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_do_final_msg_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_do_final_msg_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_do_final_msg_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter.do_final_msg(); + } + if( HPMHooks.count.HP_inter_do_final_msg_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_do_final_msg_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_do_final_msg_post[hIndex].func; + postHookFunc(); + } + } + return; +} +const char* HP_inter_job_name(int class_) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_inter_job_name_pre ) { + const char* (*preHookFunc) (int *class_); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_job_name_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_job_name_pre[hIndex].func; + retVal___ = preHookFunc(&class_); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.job_name(class_); + } + if( HPMHooks.count.HP_inter_job_name_post ) { + const char* (*postHookFunc) (const char* retVal___, int *class_); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_job_name_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_job_name_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &class_); + } + } + return retVal___; +} +void HP_inter_vmsg_to_fd(int fd, int u_fd, int aid, char *msg, va_list ap) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_vmsg_to_fd_pre ) { + void (*preHookFunc) (int *fd, int *u_fd, int *aid, char *msg, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_vmsg_to_fd_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_inter_vmsg_to_fd_pre[hIndex].func; + preHookFunc(&fd, &u_fd, &aid, msg, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + HPMHooks.source.inter.vmsg_to_fd(fd, u_fd, aid, msg, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_inter_vmsg_to_fd_post ) { + void (*postHookFunc) (int *fd, int *u_fd, int *aid, char *msg, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_vmsg_to_fd_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_inter_vmsg_to_fd_post[hIndex].func; + postHookFunc(&fd, &u_fd, &aid, msg, ap___copy); + va_end(ap___copy); + } + } + return; +} +void HP_inter_savereg(int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_savereg_pre ) { + void (*preHookFunc) (int *account_id, int *char_id, const char *key, unsigned int *index, intptr_t *val, bool *is_string); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_savereg_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_savereg_pre[hIndex].func; + preHookFunc(&account_id, &char_id, key, &index, &val, &is_string); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter.savereg(account_id, char_id, key, index, val, is_string); + } + if( HPMHooks.count.HP_inter_savereg_post ) { + void (*postHookFunc) (int *account_id, int *char_id, const char *key, unsigned int *index, intptr_t *val, bool *is_string); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_savereg_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_savereg_post[hIndex].func; + postHookFunc(&account_id, &char_id, key, &index, &val, &is_string); + } + } + return; +} +int HP_inter_accreg_fromsql(int account_id, int char_id, int fd, int type) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_accreg_fromsql_pre ) { + int (*preHookFunc) (int *account_id, int *char_id, int *fd, int *type); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_accreg_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_accreg_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&account_id, &char_id, &fd, &type); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.accreg_fromsql(account_id, char_id, fd, type); + } + if( HPMHooks.count.HP_inter_accreg_fromsql_post ) { + int (*postHookFunc) (int retVal___, int *account_id, int *char_id, int *fd, int *type); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_accreg_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_accreg_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &account_id, &char_id, &fd, &type); + } + } + return retVal___; +} +int HP_inter_config_read(const char *cfgName) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_config_read_pre ) { + int (*preHookFunc) (const char *cfgName); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_config_read_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_config_read_pre[hIndex].func; + retVal___ = preHookFunc(cfgName); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.config_read(cfgName); + } + if( HPMHooks.count.HP_inter_config_read_post ) { + int (*postHookFunc) (int retVal___, const char *cfgName); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_config_read_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_config_read_post[hIndex].func; + retVal___ = postHookFunc(retVal___, cfgName); + } + } + return retVal___; +} +int HP_inter_vlog(char *fmt, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_vlog_pre ) { + int (*preHookFunc) (char *fmt, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_vlog_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_inter_vlog_pre[hIndex].func; + retVal___ = preHookFunc(fmt, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.inter.vlog(fmt, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_inter_vlog_post ) { + int (*postHookFunc) (int retVal___, char *fmt, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_vlog_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_inter_vlog_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fmt, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +int HP_inter_init_sql(const char *file) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_init_sql_pre ) { + int (*preHookFunc) (const char *file); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_init_sql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_init_sql_pre[hIndex].func; + retVal___ = preHookFunc(file); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.init_sql(file); + } + if( HPMHooks.count.HP_inter_init_sql_post ) { + int (*postHookFunc) (int retVal___, const char *file); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_init_sql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_init_sql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, file); + } + } + return retVal___; +} +int HP_inter_mapif_init(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mapif_init_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mapif_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mapif_init_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.mapif_init(fd); + } + if( HPMHooks.count.HP_inter_mapif_init_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mapif_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mapif_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_inter_check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_check_ttl_wisdata_sub_pre ) { + int (*preHookFunc) (DBKey *key, DBData *data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_check_ttl_wisdata_sub_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_inter_check_ttl_wisdata_sub_pre[hIndex].func; + retVal___ = preHookFunc(&key, data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.inter.check_ttl_wisdata_sub(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_inter_check_ttl_wisdata_sub_post ) { + int (*postHookFunc) (int retVal___, DBKey *key, DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_check_ttl_wisdata_sub_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_inter_check_ttl_wisdata_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} +int HP_inter_check_ttl_wisdata(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_check_ttl_wisdata_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_check_ttl_wisdata_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_check_ttl_wisdata_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.check_ttl_wisdata(); + } + if( HPMHooks.count.HP_inter_check_ttl_wisdata_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_check_ttl_wisdata_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_check_ttl_wisdata_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +int HP_inter_check_length(int fd, int length) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_check_length_pre ) { + int (*preHookFunc) (int *fd, int *length); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_check_length_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_check_length_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &length); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.check_length(fd, length); + } + if( HPMHooks.count.HP_inter_check_length_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *length); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_check_length_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_check_length_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &length); + } + } + return retVal___; +} +int HP_inter_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_inter_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter.final(); + } + if( HPMHooks.count.HP_inter_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +/* inter_mail */ +int HP_inter_mail_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mail_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mail.sql_init(); + } + if( HPMHooks.count.HP_inter_mail_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_mail_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_mail_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_mail.sql_final(); + } + if( HPMHooks.count.HP_inter_mail_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_mail_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mail_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mail.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_mail_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_inter_mail_fromsql(int char_id, struct mail_data *md) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mail_fromsql_pre ) { + int (*preHookFunc) (int *char_id, struct mail_data *md); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, md); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mail.fromsql(char_id, md); + } + if( HPMHooks.count.HP_inter_mail_fromsql_post ) { + int (*postHookFunc) (int retVal___, int *char_id, struct mail_data *md); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, md); + } + } + return retVal___; +} +int HP_inter_mail_savemessage(struct mail_message *msg) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mail_savemessage_pre ) { + int (*preHookFunc) (struct mail_message *msg); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_savemessage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_savemessage_pre[hIndex].func; + retVal___ = preHookFunc(msg); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mail.savemessage(msg); + } + if( HPMHooks.count.HP_inter_mail_savemessage_post ) { + int (*postHookFunc) (int retVal___, struct mail_message *msg); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_savemessage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_savemessage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, msg); + } + } + return retVal___; +} +bool HP_inter_mail_loadmessage(int mail_id, struct mail_message *msg) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_mail_loadmessage_pre ) { + bool (*preHookFunc) (int *mail_id, struct mail_message *msg); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_loadmessage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_loadmessage_pre[hIndex].func; + retVal___ = preHookFunc(&mail_id, msg); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mail.loadmessage(mail_id, msg); + } + if( HPMHooks.count.HP_inter_mail_loadmessage_post ) { + bool (*postHookFunc) (bool retVal___, int *mail_id, struct mail_message *msg); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_loadmessage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_loadmessage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &mail_id, msg); + } + } + return retVal___; +} +bool HP_inter_mail_DeleteAttach(int mail_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_mail_DeleteAttach_pre ) { + bool (*preHookFunc) (int *mail_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_DeleteAttach_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_DeleteAttach_pre[hIndex].func; + retVal___ = preHookFunc(&mail_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mail.DeleteAttach(mail_id); + } + if( HPMHooks.count.HP_inter_mail_DeleteAttach_post ) { + bool (*postHookFunc) (bool retVal___, int *mail_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_DeleteAttach_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_DeleteAttach_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &mail_id); + } + } + return retVal___; +} +void HP_inter_mail_sendmail(int send_id, const char *send_name, int dest_id, const char *dest_name, const char *title, const char *body, int zeny, struct item *item) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_mail_sendmail_pre ) { + void (*preHookFunc) (int *send_id, const char *send_name, int *dest_id, const char *dest_name, const char *title, const char *body, int *zeny, struct item *item); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_sendmail_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mail_sendmail_pre[hIndex].func; + preHookFunc(&send_id, send_name, &dest_id, dest_name, title, body, &zeny, item); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_mail.sendmail(send_id, send_name, dest_id, dest_name, title, body, zeny, item); + } + if( HPMHooks.count.HP_inter_mail_sendmail_post ) { + void (*postHookFunc) (int *send_id, const char *send_name, int *dest_id, const char *dest_name, const char *title, const char *body, int *zeny, struct item *item); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mail_sendmail_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mail_sendmail_post[hIndex].func; + postHookFunc(&send_id, send_name, &dest_id, dest_name, title, body, &zeny, item); + } + } + return; +} +/* inter_mercenary */ +bool HP_inter_mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_mercenary_owner_fromsql_pre ) { + bool (*preHookFunc) (int *char_id, struct mmo_charstatus *status); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_owner_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mercenary_owner_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, status); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mercenary.owner_fromsql(char_id, status); + } + if( HPMHooks.count.HP_inter_mercenary_owner_fromsql_post ) { + bool (*postHookFunc) (bool retVal___, int *char_id, struct mmo_charstatus *status); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_owner_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mercenary_owner_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, status); + } + } + return retVal___; +} +bool HP_inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_mercenary_owner_tosql_pre ) { + bool (*preHookFunc) (int *char_id, struct mmo_charstatus *status); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_owner_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mercenary_owner_tosql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, status); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mercenary.owner_tosql(char_id, status); + } + if( HPMHooks.count.HP_inter_mercenary_owner_tosql_post ) { + bool (*postHookFunc) (bool retVal___, int *char_id, struct mmo_charstatus *status); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_owner_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mercenary_owner_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, status); + } + } + return retVal___; +} +bool HP_inter_mercenary_owner_delete(int char_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_inter_mercenary_owner_delete_pre ) { + bool (*preHookFunc) (int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_owner_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mercenary_owner_delete_pre[hIndex].func; + retVal___ = preHookFunc(&char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mercenary.owner_delete(char_id); + } + if( HPMHooks.count.HP_inter_mercenary_owner_delete_post ) { + bool (*postHookFunc) (bool retVal___, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_owner_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mercenary_owner_delete_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id); + } + } + return retVal___; +} +int HP_inter_mercenary_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mercenary_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mercenary_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mercenary.sql_init(); + } + if( HPMHooks.count.HP_inter_mercenary_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mercenary_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_mercenary_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_mercenary_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mercenary_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_mercenary.sql_final(); + } + if( HPMHooks.count.HP_inter_mercenary_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mercenary_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_mercenary_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_mercenary_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_mercenary_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_mercenary.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_mercenary_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_mercenary_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_mercenary_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +/* inter_party */ +int HP_inter_party_check_lv(struct party_data *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_check_lv_pre ) { + int (*preHookFunc) (struct party_data *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_check_lv_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_check_lv_pre[hIndex].func; + retVal___ = preHookFunc(p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.check_lv(p); + } + if( HPMHooks.count.HP_inter_party_check_lv_post ) { + int (*postHookFunc) (int retVal___, struct party_data *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_check_lv_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_check_lv_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +void HP_inter_party_calc_state(struct party_data *p) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_party_calc_state_pre ) { + void (*preHookFunc) (struct party_data *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_calc_state_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_calc_state_pre[hIndex].func; + preHookFunc(p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_party.calc_state(p); + } + if( HPMHooks.count.HP_inter_party_calc_state_post ) { + void (*postHookFunc) (struct party_data *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_calc_state_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_calc_state_post[hIndex].func; + postHookFunc(p); + } + } + return; +} +int HP_inter_party_tosql(struct party *p, int flag, int index) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_tosql_pre ) { + int (*preHookFunc) (struct party *p, int *flag, int *index); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_tosql_pre[hIndex].func; + retVal___ = preHookFunc(p, &flag, &index); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.tosql(p, flag, index); + } + if( HPMHooks.count.HP_inter_party_tosql_post ) { + int (*postHookFunc) (int retVal___, struct party *p, int *flag, int *index); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p, &flag, &index); + } + } + return retVal___; +} +struct party_data* HP_inter_party_fromsql(int party_id) { + int hIndex = 0; + struct party_data* retVal___ = NULL; + if( HPMHooks.count.HP_inter_party_fromsql_pre ) { + struct party_data* (*preHookFunc) (int *party_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&party_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.fromsql(party_id); + } + if( HPMHooks.count.HP_inter_party_fromsql_post ) { + struct party_data* (*postHookFunc) (struct party_data* retVal___, int *party_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &party_id); + } + } + return retVal___; +} +int HP_inter_party_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.sql_init(); + } + if( HPMHooks.count.HP_inter_party_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_party_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_party_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_party.sql_final(); + } + if( HPMHooks.count.HP_inter_party_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +struct party_data* HP_inter_party_search_partyname(const char *str) { + int hIndex = 0; + struct party_data* retVal___ = NULL; + if( HPMHooks.count.HP_inter_party_search_partyname_pre ) { + struct party_data* (*preHookFunc) (const char *str); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_search_partyname_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_search_partyname_pre[hIndex].func; + retVal___ = preHookFunc(str); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.search_partyname(str); + } + if( HPMHooks.count.HP_inter_party_search_partyname_post ) { + struct party_data* (*postHookFunc) (struct party_data* retVal___, const char *str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_search_partyname_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_search_partyname_post[hIndex].func; + retVal___ = postHookFunc(retVal___, str); + } + } + return retVal___; +} +int HP_inter_party_check_exp_share(struct party_data *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_check_exp_share_pre ) { + int (*preHookFunc) (struct party_data *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_check_exp_share_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_check_exp_share_pre[hIndex].func; + retVal___ = preHookFunc(p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.check_exp_share(p); + } + if( HPMHooks.count.HP_inter_party_check_exp_share_post ) { + int (*postHookFunc) (int retVal___, struct party_data *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_check_exp_share_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_check_exp_share_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +int HP_inter_party_check_empty(struct party_data *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_check_empty_pre ) { + int (*preHookFunc) (struct party_data *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_check_empty_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_check_empty_pre[hIndex].func; + retVal___ = preHookFunc(p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.check_empty(p); + } + if( HPMHooks.count.HP_inter_party_check_empty_post ) { + int (*postHookFunc) (int retVal___, struct party_data *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_check_empty_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_check_empty_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +int HP_inter_party_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_party_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_inter_party_leave(int party_id, int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_leave_pre ) { + int (*preHookFunc) (int *party_id, int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_leave_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_leave_pre[hIndex].func; + retVal___ = preHookFunc(&party_id, &account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.leave(party_id, account_id, char_id); + } + if( HPMHooks.count.HP_inter_party_leave_post ) { + int (*postHookFunc) (int retVal___, int *party_id, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_leave_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_leave_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &party_id, &account_id, &char_id); + } + } + return retVal___; +} +int HP_inter_party_CharOnline(int char_id, int party_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_CharOnline_pre ) { + int (*preHookFunc) (int *char_id, int *party_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_CharOnline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_CharOnline_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &party_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.CharOnline(char_id, party_id); + } + if( HPMHooks.count.HP_inter_party_CharOnline_post ) { + int (*postHookFunc) (int retVal___, int *char_id, int *party_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_CharOnline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_CharOnline_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &party_id); + } + } + return retVal___; +} +int HP_inter_party_CharOffline(int char_id, int party_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_party_CharOffline_pre ) { + int (*preHookFunc) (int *char_id, int *party_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_CharOffline_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_party_CharOffline_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &party_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_party.CharOffline(char_id, party_id); + } + if( HPMHooks.count.HP_inter_party_CharOffline_post ) { + int (*postHookFunc) (int retVal___, int *char_id, int *party_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_party_CharOffline_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_party_CharOffline_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &party_id); + } + } + return retVal___; +} +/* inter_pet */ +int HP_inter_pet_tosql(int pet_id, struct s_pet *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_pet_tosql_pre ) { + int (*preHookFunc) (int *pet_id, struct s_pet *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_pet_tosql_pre[hIndex].func; + retVal___ = preHookFunc(&pet_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_pet.tosql(pet_id, p); + } + if( HPMHooks.count.HP_inter_pet_tosql_post ) { + int (*postHookFunc) (int retVal___, int *pet_id, struct s_pet *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_pet_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &pet_id, p); + } + } + return retVal___; +} +int HP_inter_pet_fromsql(int pet_id, struct s_pet *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_pet_fromsql_pre ) { + int (*preHookFunc) (int *pet_id, struct s_pet *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_pet_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&pet_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_pet.fromsql(pet_id, p); + } + if( HPMHooks.count.HP_inter_pet_fromsql_post ) { + int (*postHookFunc) (int retVal___, int *pet_id, struct s_pet *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_pet_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &pet_id, p); + } + } + return retVal___; +} +int HP_inter_pet_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_pet_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_pet_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_pet.sql_init(); + } + if( HPMHooks.count.HP_inter_pet_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_pet_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_pet_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_pet_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_pet_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_pet.sql_final(); + } + if( HPMHooks.count.HP_inter_pet_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_pet_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_pet_delete_(int pet_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_pet_delete__pre ) { + int (*preHookFunc) (int *pet_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_delete__pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_pet_delete__pre[hIndex].func; + retVal___ = preHookFunc(&pet_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_pet.delete_(pet_id); + } + if( HPMHooks.count.HP_inter_pet_delete__post ) { + int (*postHookFunc) (int retVal___, int *pet_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_delete__post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_pet_delete__post[hIndex].func; + retVal___ = postHookFunc(retVal___, &pet_id); + } + } + return retVal___; +} +int HP_inter_pet_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_pet_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_pet_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_pet.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_pet_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_pet_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +/* inter_quest */ +int HP_inter_quest_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_quest_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_quest_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_quest_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_quest.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_quest_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_quest_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_quest_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +/* inter_storage */ +int HP_inter_storage_tosql(int account_id, struct storage_data *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_tosql_pre ) { + int (*preHookFunc) (int *account_id, struct storage_data *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_tosql_pre[hIndex].func; + retVal___ = preHookFunc(&account_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.tosql(account_id, p); + } + if( HPMHooks.count.HP_inter_storage_tosql_post ) { + int (*postHookFunc) (int retVal___, int *account_id, struct storage_data *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &account_id, p); + } + } + return retVal___; +} +int HP_inter_storage_fromsql(int account_id, struct storage_data *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_fromsql_pre ) { + int (*preHookFunc) (int *account_id, struct storage_data *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&account_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.fromsql(account_id, p); + } + if( HPMHooks.count.HP_inter_storage_fromsql_post ) { + int (*postHookFunc) (int retVal___, int *account_id, struct storage_data *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &account_id, p); + } + } + return retVal___; +} +int HP_inter_storage_guild_storage_tosql(int guild_id, struct guild_storage *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_guild_storage_tosql_pre ) { + int (*preHookFunc) (int *guild_id, struct guild_storage *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_guild_storage_tosql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_guild_storage_tosql_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.guild_storage_tosql(guild_id, p); + } + if( HPMHooks.count.HP_inter_storage_guild_storage_tosql_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, struct guild_storage *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_guild_storage_tosql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_guild_storage_tosql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, p); + } + } + return retVal___; +} +int HP_inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_guild_storage_fromsql_pre ) { + int (*preHookFunc) (int *guild_id, struct guild_storage *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_guild_storage_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_guild_storage_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.guild_storage_fromsql(guild_id, p); + } + if( HPMHooks.count.HP_inter_storage_guild_storage_fromsql_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, struct guild_storage *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_guild_storage_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_guild_storage_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, p); + } + } + return retVal___; +} +int HP_inter_storage_sql_init(void) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_sql_init_pre ) { + int (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_sql_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_sql_init_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.sql_init(); + } + if( HPMHooks.count.HP_inter_storage_sql_init_post ) { + int (*postHookFunc) (int retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_sql_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_sql_init_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_inter_storage_sql_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_inter_storage_sql_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_sql_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_sql_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.inter_storage.sql_final(); + } + if( HPMHooks.count.HP_inter_storage_sql_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_sql_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_sql_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +int HP_inter_storage_delete_(int account_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_delete__pre ) { + int (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_delete__pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_delete__pre[hIndex].func; + retVal___ = preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.delete_(account_id); + } + if( HPMHooks.count.HP_inter_storage_delete__post ) { + int (*postHookFunc) (int retVal___, int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_delete__post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_delete__post[hIndex].func; + retVal___ = postHookFunc(retVal___, &account_id); + } + } + return retVal___; +} +int HP_inter_storage_guild_storage_delete(int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_guild_storage_delete_pre ) { + int (*preHookFunc) (int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_guild_storage_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_guild_storage_delete_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.guild_storage_delete(guild_id); + } + if( HPMHooks.count.HP_inter_storage_guild_storage_delete_post ) { + int (*postHookFunc) (int retVal___, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_guild_storage_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_guild_storage_delete_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id); + } + } + return retVal___; +} +int HP_inter_storage_parse_frommap(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_inter_storage_parse_frommap_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_parse_frommap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_inter_storage_parse_frommap_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.inter_storage.parse_frommap(fd); + } + if( HPMHooks.count.HP_inter_storage_parse_frommap_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_inter_storage_parse_frommap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_inter_storage_parse_frommap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +/* loginif */ +void HP_loginif_reset(void) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_reset_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_reset_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_reset_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.reset(); + } + if( HPMHooks.count.HP_loginif_reset_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_reset_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_reset_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_loginif_check_shutdown(void) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_check_shutdown_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_check_shutdown_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_check_shutdown_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.check_shutdown(); + } + if( HPMHooks.count.HP_loginif_check_shutdown_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_check_shutdown_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_check_shutdown_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_loginif_on_disconnect(void) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_on_disconnect_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_on_disconnect_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_on_disconnect_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.on_disconnect(); + } + if( HPMHooks.count.HP_loginif_on_disconnect_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_on_disconnect_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_on_disconnect_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_loginif_on_ready(void) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_on_ready_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_on_ready_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_on_ready_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.on_ready(); + } + if( HPMHooks.count.HP_loginif_on_ready_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_on_ready_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_on_ready_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_loginif_block_account(int account_id, int flag) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_block_account_pre ) { + void (*preHookFunc) (int *account_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_block_account_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_block_account_pre[hIndex].func; + preHookFunc(&account_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.block_account(account_id, flag); + } + if( HPMHooks.count.HP_loginif_block_account_post ) { + void (*postHookFunc) (int *account_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_block_account_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_block_account_post[hIndex].func; + postHookFunc(&account_id, &flag); + } + } + return; +} +void HP_loginif_ban_account(int account_id, short year, short month, short day, short hour, short minute, short second) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_ban_account_pre ) { + void (*preHookFunc) (int *account_id, short *year, short *month, short *day, short *hour, short *minute, short *second); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_ban_account_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_ban_account_pre[hIndex].func; + preHookFunc(&account_id, &year, &month, &day, &hour, &minute, &second); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.ban_account(account_id, year, month, day, hour, minute, second); + } + if( HPMHooks.count.HP_loginif_ban_account_post ) { + void (*postHookFunc) (int *account_id, short *year, short *month, short *day, short *hour, short *minute, short *second); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_ban_account_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_ban_account_post[hIndex].func; + postHookFunc(&account_id, &year, &month, &day, &hour, &minute, &second); + } + } + return; +} +void HP_loginif_unban_account(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_unban_account_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_unban_account_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_unban_account_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.unban_account(account_id); + } + if( HPMHooks.count.HP_loginif_unban_account_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_unban_account_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_unban_account_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_loginif_changesex(int account_id) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_changesex_pre ) { + void (*preHookFunc) (int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_changesex_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_changesex_pre[hIndex].func; + preHookFunc(&account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.changesex(account_id); + } + if( HPMHooks.count.HP_loginif_changesex_post ) { + void (*postHookFunc) (int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_changesex_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_changesex_post[hIndex].func; + postHookFunc(&account_id); + } + } + return; +} +void HP_loginif_auth(int fd, struct char_session_data *sd, uint32 ipl) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_auth_pre ) { + void (*preHookFunc) (int *fd, struct char_session_data *sd, uint32 *ipl); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_auth_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_auth_pre[hIndex].func; + preHookFunc(&fd, sd, &ipl); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.auth(fd, sd, ipl); + } + if( HPMHooks.count.HP_loginif_auth_post ) { + void (*postHookFunc) (int *fd, struct char_session_data *sd, uint32 *ipl); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_auth_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_auth_post[hIndex].func; + postHookFunc(&fd, sd, &ipl); + } + } + return; +} +void HP_loginif_send_users_count(int users) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_send_users_count_pre ) { + void (*preHookFunc) (int *users); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_send_users_count_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_send_users_count_pre[hIndex].func; + preHookFunc(&users); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.send_users_count(users); + } + if( HPMHooks.count.HP_loginif_send_users_count_post ) { + void (*postHookFunc) (int *users); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_send_users_count_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_send_users_count_post[hIndex].func; + postHookFunc(&users); + } + } + return; +} +void HP_loginif_connect_to_server(void) { + int hIndex = 0; + if( HPMHooks.count.HP_loginif_connect_to_server_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_connect_to_server_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_loginif_connect_to_server_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.loginif.connect_to_server(); + } + if( HPMHooks.count.HP_loginif_connect_to_server_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_loginif_connect_to_server_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_loginif_connect_to_server_post[hIndex].func; + postHookFunc(); + } + } + return; +} +/* mapif */ +void HP_mapif_ban(int id, unsigned int flag, int status) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_ban_pre ) { + void (*preHookFunc) (int *id, unsigned int *flag, int *status); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_ban_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_ban_pre[hIndex].func; + preHookFunc(&id, &flag, &status); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.ban(id, flag, status); + } + if( HPMHooks.count.HP_mapif_ban_post ) { + void (*postHookFunc) (int *id, unsigned int *flag, int *status); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_ban_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_ban_post[hIndex].func; + postHookFunc(&id, &flag, &status); + } + } + return; +} +void HP_mapif_server_init(int id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_server_init_pre ) { + void (*preHookFunc) (int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_server_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_server_init_pre[hIndex].func; + preHookFunc(&id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.server_init(id); + } + if( HPMHooks.count.HP_mapif_server_init_post ) { + void (*postHookFunc) (int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_server_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_server_init_post[hIndex].func; + postHookFunc(&id); + } + } + return; +} +void HP_mapif_server_destroy(int id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_server_destroy_pre ) { + void (*preHookFunc) (int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_server_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_server_destroy_pre[hIndex].func; + preHookFunc(&id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.server_destroy(id); + } + if( HPMHooks.count.HP_mapif_server_destroy_post ) { + void (*postHookFunc) (int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_server_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_server_destroy_post[hIndex].func; + postHookFunc(&id); + } + } + return; +} +void HP_mapif_server_reset(int id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_server_reset_pre ) { + void (*preHookFunc) (int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_server_reset_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_server_reset_pre[hIndex].func; + preHookFunc(&id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.server_reset(id); + } + if( HPMHooks.count.HP_mapif_server_reset_post ) { + void (*postHookFunc) (int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_server_reset_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_server_reset_post[hIndex].func; + postHookFunc(&id); + } + } + return; +} +void HP_mapif_on_disconnect(int id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_on_disconnect_pre ) { + void (*preHookFunc) (int *id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_on_disconnect_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_on_disconnect_pre[hIndex].func; + preHookFunc(&id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.on_disconnect(id); + } + if( HPMHooks.count.HP_mapif_on_disconnect_post ) { + void (*postHookFunc) (int *id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_on_disconnect_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_on_disconnect_post[hIndex].func; + postHookFunc(&id); + } + } + return; +} +void HP_mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_on_parse_accinfo_pre ) { + void (*preHookFunc) (int *account_id, int *u_fd, int *u_aid, int *u_group, int *map_fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_on_parse_accinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_on_parse_accinfo_pre[hIndex].func; + preHookFunc(&account_id, &u_fd, &u_aid, &u_group, &map_fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.on_parse_accinfo(account_id, u_fd, u_aid, u_group, map_fd); + } + if( HPMHooks.count.HP_mapif_on_parse_accinfo_post ) { + void (*postHookFunc) (int *account_id, int *u_fd, int *u_aid, int *u_group, int *map_fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_on_parse_accinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_on_parse_accinfo_post[hIndex].func; + postHookFunc(&account_id, &u_fd, &u_aid, &u_group, &map_fd); + } + } + return; +} +void HP_mapif_char_ban(int char_id, time_t timestamp) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_char_ban_pre ) { + void (*preHookFunc) (int *char_id, time_t *timestamp); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_char_ban_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_char_ban_pre[hIndex].func; + preHookFunc(&char_id, ×tamp); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.char_ban(char_id, timestamp); + } + if( HPMHooks.count.HP_mapif_char_ban_post ) { + void (*postHookFunc) (int *char_id, time_t *timestamp); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_char_ban_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_char_ban_post[hIndex].func; + postHookFunc(&char_id, ×tamp); + } + } + return; +} +int HP_mapif_sendall(unsigned char *buf, unsigned int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_sendall_pre ) { + int (*preHookFunc) (unsigned char *buf, unsigned int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_sendall_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_sendall_pre[hIndex].func; + retVal___ = preHookFunc(buf, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.sendall(buf, len); + } + if( HPMHooks.count.HP_mapif_sendall_post ) { + int (*postHookFunc) (int retVal___, unsigned char *buf, unsigned int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_sendall_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_sendall_post[hIndex].func; + retVal___ = postHookFunc(retVal___, buf, &len); + } + } + return retVal___; +} +int HP_mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_sendallwos_pre ) { + int (*preHookFunc) (int *sfd, unsigned char *buf, unsigned int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_sendallwos_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_sendallwos_pre[hIndex].func; + retVal___ = preHookFunc(&sfd, buf, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.sendallwos(sfd, buf, len); + } + if( HPMHooks.count.HP_mapif_sendallwos_post ) { + int (*postHookFunc) (int retVal___, int *sfd, unsigned char *buf, unsigned int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_sendallwos_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_sendallwos_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &sfd, buf, &len); + } + } + return retVal___; +} +int HP_mapif_send(int fd, unsigned char *buf, unsigned int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_send_pre ) { + int (*preHookFunc) (int *fd, unsigned char *buf, unsigned int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_send_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_send_pre[hIndex].func; + retVal___ = preHookFunc(&fd, buf, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.send(fd, buf, len); + } + if( HPMHooks.count.HP_mapif_send_post ) { + int (*postHookFunc) (int retVal___, int *fd, unsigned char *buf, unsigned int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_send_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_send_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, buf, &len); + } + } + return retVal___; +} +void HP_mapif_send_users_count(int users) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_send_users_count_pre ) { + void (*preHookFunc) (int *users); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_send_users_count_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_send_users_count_pre[hIndex].func; + preHookFunc(&users); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.send_users_count(users); + } + if( HPMHooks.count.HP_mapif_send_users_count_post ) { + void (*postHookFunc) (int *users); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_send_users_count_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_send_users_count_post[hIndex].func; + postHookFunc(&users); + } + } + return; +} +void HP_mapif_auction_message(int char_id, unsigned char result) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_auction_message_pre ) { + void (*preHookFunc) (int *char_id, unsigned char *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_auction_message_pre[hIndex].func; + preHookFunc(&char_id, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.auction_message(char_id, result); + } + if( HPMHooks.count.HP_mapif_auction_message_post ) { + void (*postHookFunc) (int *char_id, unsigned char *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_auction_message_post[hIndex].func; + postHookFunc(&char_id, &result); + } + } + return; +} +void HP_mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_auction_sendlist_pre ) { + void (*preHookFunc) (int *fd, int *char_id, short *count, short *pages, unsigned char *buf); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_sendlist_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_auction_sendlist_pre[hIndex].func; + preHookFunc(&fd, &char_id, &count, &pages, buf); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.auction_sendlist(fd, char_id, count, pages, buf); + } + if( HPMHooks.count.HP_mapif_auction_sendlist_post ) { + void (*postHookFunc) (int *fd, int *char_id, short *count, short *pages, unsigned char *buf); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_sendlist_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_auction_sendlist_post[hIndex].func; + postHookFunc(&fd, &char_id, &count, &pages, buf); + } + } + return; +} +void HP_mapif_parse_auction_requestlist(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_auction_requestlist_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_requestlist_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_auction_requestlist_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_auction_requestlist(fd); + } + if( HPMHooks.count.HP_mapif_parse_auction_requestlist_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_requestlist_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_auction_requestlist_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_auction_register(int fd, struct auction_data *auction) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_auction_register_pre ) { + void (*preHookFunc) (int *fd, struct auction_data *auction); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_register_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_auction_register_pre[hIndex].func; + preHookFunc(&fd, auction); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.auction_register(fd, auction); + } + if( HPMHooks.count.HP_mapif_auction_register_post ) { + void (*postHookFunc) (int *fd, struct auction_data *auction); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_register_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_auction_register_post[hIndex].func; + postHookFunc(&fd, auction); + } + } + return; +} +void HP_mapif_parse_auction_register(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_auction_register_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_register_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_auction_register_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_auction_register(fd); + } + if( HPMHooks.count.HP_mapif_parse_auction_register_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_register_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_auction_register_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_auction_cancel(int fd, int char_id, unsigned char result) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_auction_cancel_pre ) { + void (*preHookFunc) (int *fd, int *char_id, unsigned char *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_cancel_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_auction_cancel_pre[hIndex].func; + preHookFunc(&fd, &char_id, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.auction_cancel(fd, char_id, result); + } + if( HPMHooks.count.HP_mapif_auction_cancel_post ) { + void (*postHookFunc) (int *fd, int *char_id, unsigned char *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_cancel_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_auction_cancel_post[hIndex].func; + postHookFunc(&fd, &char_id, &result); + } + } + return; +} +void HP_mapif_parse_auction_cancel(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_auction_cancel_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_cancel_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_auction_cancel_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_auction_cancel(fd); + } + if( HPMHooks.count.HP_mapif_parse_auction_cancel_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_cancel_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_auction_cancel_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_auction_close(int fd, int char_id, unsigned char result) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_auction_close_pre ) { + void (*preHookFunc) (int *fd, int *char_id, unsigned char *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_close_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_auction_close_pre[hIndex].func; + preHookFunc(&fd, &char_id, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.auction_close(fd, char_id, result); + } + if( HPMHooks.count.HP_mapif_auction_close_post ) { + void (*postHookFunc) (int *fd, int *char_id, unsigned char *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_close_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_auction_close_post[hIndex].func; + postHookFunc(&fd, &char_id, &result); + } + } + return; +} +void HP_mapif_parse_auction_close(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_auction_close_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_close_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_auction_close_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_auction_close(fd); + } + if( HPMHooks.count.HP_mapif_parse_auction_close_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_close_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_auction_close_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_auction_bid(int fd, int char_id, int bid, unsigned char result) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_auction_bid_pre ) { + void (*preHookFunc) (int *fd, int *char_id, int *bid, unsigned char *result); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_bid_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_auction_bid_pre[hIndex].func; + preHookFunc(&fd, &char_id, &bid, &result); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.auction_bid(fd, char_id, bid, result); + } + if( HPMHooks.count.HP_mapif_auction_bid_post ) { + void (*postHookFunc) (int *fd, int *char_id, int *bid, unsigned char *result); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_auction_bid_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_auction_bid_post[hIndex].func; + postHookFunc(&fd, &char_id, &bid, &result); + } + } + return; +} +void HP_mapif_parse_auction_bid(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_auction_bid_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_bid_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_auction_bid_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_auction_bid(fd); + } + if( HPMHooks.count.HP_mapif_parse_auction_bid_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_auction_bid_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_auction_bid_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +bool HP_mapif_elemental_save(struct s_elemental *ele) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_elemental_save_pre ) { + bool (*preHookFunc) (struct s_elemental *ele); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_elemental_save_pre[hIndex].func; + retVal___ = preHookFunc(ele); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.elemental_save(ele); + } + if( HPMHooks.count.HP_mapif_elemental_save_post ) { + bool (*postHookFunc) (bool retVal___, struct s_elemental *ele); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_elemental_save_post[hIndex].func; + retVal___ = postHookFunc(retVal___, ele); + } + } + return retVal___; +} +bool HP_mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_elemental_load_pre ) { + bool (*preHookFunc) (int *ele_id, int *char_id, struct s_elemental *ele); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_elemental_load_pre[hIndex].func; + retVal___ = preHookFunc(&ele_id, &char_id, ele); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.elemental_load(ele_id, char_id, ele); + } + if( HPMHooks.count.HP_mapif_elemental_load_post ) { + bool (*postHookFunc) (bool retVal___, int *ele_id, int *char_id, struct s_elemental *ele); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_elemental_load_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &ele_id, &char_id, ele); + } + } + return retVal___; +} +bool HP_mapif_elemental_delete(int ele_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_elemental_delete_pre ) { + bool (*preHookFunc) (int *ele_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_elemental_delete_pre[hIndex].func; + retVal___ = preHookFunc(&ele_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.elemental_delete(ele_id); + } + if( HPMHooks.count.HP_mapif_elemental_delete_post ) { + bool (*postHookFunc) (bool retVal___, int *ele_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_elemental_delete_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &ele_id); + } + } + return retVal___; +} +void HP_mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_elemental_send_pre ) { + void (*preHookFunc) (int *fd, struct s_elemental *ele, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_send_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_elemental_send_pre[hIndex].func; + preHookFunc(&fd, ele, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.elemental_send(fd, ele, flag); + } + if( HPMHooks.count.HP_mapif_elemental_send_post ) { + void (*postHookFunc) (int *fd, struct s_elemental *ele, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_send_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_elemental_send_post[hIndex].func; + postHookFunc(&fd, ele, &flag); + } + } + return; +} +void HP_mapif_parse_elemental_create(int fd, struct s_elemental *ele) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_elemental_create_pre ) { + void (*preHookFunc) (int *fd, struct s_elemental *ele); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_elemental_create_pre[hIndex].func; + preHookFunc(&fd, ele); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_elemental_create(fd, ele); + } + if( HPMHooks.count.HP_mapif_parse_elemental_create_post ) { + void (*postHookFunc) (int *fd, struct s_elemental *ele); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_elemental_create_post[hIndex].func; + postHookFunc(&fd, ele); + } + } + return; +} +void HP_mapif_parse_elemental_load(int fd, int ele_id, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_elemental_load_pre ) { + void (*preHookFunc) (int *fd, int *ele_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_elemental_load_pre[hIndex].func; + preHookFunc(&fd, &ele_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_elemental_load(fd, ele_id, char_id); + } + if( HPMHooks.count.HP_mapif_parse_elemental_load_post ) { + void (*postHookFunc) (int *fd, int *ele_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_elemental_load_post[hIndex].func; + postHookFunc(&fd, &ele_id, &char_id); + } + } + return; +} +void HP_mapif_elemental_deleted(int fd, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_elemental_deleted_pre ) { + void (*preHookFunc) (int *fd, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_deleted_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_elemental_deleted_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.elemental_deleted(fd, flag); + } + if( HPMHooks.count.HP_mapif_elemental_deleted_post ) { + void (*postHookFunc) (int *fd, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_deleted_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_elemental_deleted_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_mapif_parse_elemental_delete(int fd, int ele_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_elemental_delete_pre ) { + void (*preHookFunc) (int *fd, int *ele_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_elemental_delete_pre[hIndex].func; + preHookFunc(&fd, &ele_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_elemental_delete(fd, ele_id); + } + if( HPMHooks.count.HP_mapif_parse_elemental_delete_post ) { + void (*postHookFunc) (int *fd, int *ele_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_elemental_delete_post[hIndex].func; + postHookFunc(&fd, &ele_id); + } + } + return; +} +void HP_mapif_elemental_saved(int fd, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_elemental_saved_pre ) { + void (*preHookFunc) (int *fd, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_saved_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_elemental_saved_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.elemental_saved(fd, flag); + } + if( HPMHooks.count.HP_mapif_elemental_saved_post ) { + void (*postHookFunc) (int *fd, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_elemental_saved_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_elemental_saved_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_mapif_parse_elemental_save(int fd, struct s_elemental *ele) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_elemental_save_pre ) { + void (*preHookFunc) (int *fd, struct s_elemental *ele); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_elemental_save_pre[hIndex].func; + preHookFunc(&fd, ele); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_elemental_save(fd, ele); + } + if( HPMHooks.count.HP_mapif_parse_elemental_save_post ) { + void (*postHookFunc) (int *fd, struct s_elemental *ele); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_elemental_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_elemental_save_post[hIndex].func; + postHookFunc(&fd, ele); + } + } + return; +} +int HP_mapif_guild_created(int fd, int account_id, struct guild *g) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_created_pre ) { + int (*preHookFunc) (int *fd, int *account_id, struct guild *g); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_created_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_created_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, g); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_created(fd, account_id, g); + } + if( HPMHooks.count.HP_mapif_guild_created_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, struct guild *g); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_created_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_created_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, g); + } + } + return retVal___; +} +int HP_mapif_guild_noinfo(int fd, int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_noinfo_pre ) { + int (*preHookFunc) (int *fd, int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_noinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_noinfo_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_noinfo(fd, guild_id); + } + if( HPMHooks.count.HP_mapif_guild_noinfo_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_noinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_noinfo_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id); + } + } + return retVal___; +} +int HP_mapif_guild_info(int fd, struct guild *g) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_info_pre ) { + int (*preHookFunc) (int *fd, struct guild *g); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_info_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_info_pre[hIndex].func; + retVal___ = preHookFunc(&fd, g); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_info(fd, g); + } + if( HPMHooks.count.HP_mapif_guild_info_post ) { + int (*postHookFunc) (int retVal___, int *fd, struct guild *g); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_info_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_info_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, g); + } + } + return retVal___; +} +int HP_mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_memberadded_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_memberadded_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_memberadded_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_memberadded(fd, guild_id, account_id, char_id, flag); + } + if( HPMHooks.count.HP_mapif_guild_memberadded_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *account_id, int *char_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_memberadded_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_memberadded_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &account_id, &char_id, &flag); + } + } + return retVal___; +} +int HP_mapif_guild_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_withdraw_pre ) { + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *flag, const char *name, const char *mes); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_withdraw_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_withdraw_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &flag, name, mes); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_withdraw(guild_id, account_id, char_id, flag, name, mes); + } + if( HPMHooks.count.HP_mapif_guild_withdraw_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *account_id, int *char_id, int *flag, const char *name, const char *mes); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_withdraw_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_withdraw_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &account_id, &char_id, &flag, name, mes); + } + } + return retVal___; +} +int HP_mapif_guild_memberinfoshort(struct guild *g, int idx) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_memberinfoshort_pre ) { + int (*preHookFunc) (struct guild *g, int *idx); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_memberinfoshort_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_memberinfoshort_pre[hIndex].func; + retVal___ = preHookFunc(g, &idx); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_memberinfoshort(g, idx); + } + if( HPMHooks.count.HP_mapif_guild_memberinfoshort_post ) { + int (*postHookFunc) (int retVal___, struct guild *g, int *idx); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_memberinfoshort_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_memberinfoshort_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g, &idx); + } + } + return retVal___; +} +int HP_mapif_guild_broken(int guild_id, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_broken_pre ) { + int (*preHookFunc) (int *guild_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_broken_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_broken_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_broken(guild_id, flag); + } + if( HPMHooks.count.HP_mapif_guild_broken_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_broken_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_broken_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &flag); + } + } + return retVal___; +} +int HP_mapif_guild_message(int guild_id, int account_id, char *mes, int len, int sfd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_message_pre ) { + int (*preHookFunc) (int *guild_id, int *account_id, char *mes, int *len, int *sfd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_message_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &account_id, mes, &len, &sfd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_message(guild_id, account_id, mes, len, sfd); + } + if( HPMHooks.count.HP_mapif_guild_message_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *account_id, char *mes, int *len, int *sfd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_message_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &account_id, mes, &len, &sfd); + } + } + return retVal___; +} +int HP_mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_basicinfochanged_pre ) { + int (*preHookFunc) (int *guild_id, int *type, const void *data, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_basicinfochanged_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_basicinfochanged_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &type, data, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_basicinfochanged(guild_id, type, data, len); + } + if( HPMHooks.count.HP_mapif_guild_basicinfochanged_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *type, const void *data, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_basicinfochanged_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_basicinfochanged_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &type, data, &len); + } + } + return retVal___; +} +int HP_mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_memberinfochanged_pre ) { + int (*preHookFunc) (int *guild_id, int *account_id, int *char_id, int *type, const void *data, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_memberinfochanged_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_memberinfochanged_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &account_id, &char_id, &type, data, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_memberinfochanged(guild_id, account_id, char_id, type, data, len); + } + if( HPMHooks.count.HP_mapif_guild_memberinfochanged_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, int *account_id, int *char_id, int *type, const void *data, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_memberinfochanged_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_memberinfochanged_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &account_id, &char_id, &type, data, &len); + } + } + return retVal___; +} +int HP_mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_skillupack_pre ) { + int (*preHookFunc) (int *guild_id, uint16 *skill_id, int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_skillupack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_skillupack_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id, &skill_id, &account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_skillupack(guild_id, skill_id, account_id); + } + if( HPMHooks.count.HP_mapif_guild_skillupack_post ) { + int (*postHookFunc) (int retVal___, int *guild_id, uint16 *skill_id, int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_skillupack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_skillupack_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id, &skill_id, &account_id); + } + } + return retVal___; +} +int HP_mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_alliance_pre ) { + int (*preHookFunc) (int *guild_id1, int *guild_id2, int *account_id1, int *account_id2, int *flag, const char *name1, const char *name2); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_alliance_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_alliance_pre[hIndex].func; + retVal___ = preHookFunc(&guild_id1, &guild_id2, &account_id1, &account_id2, &flag, name1, name2); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_alliance(guild_id1, guild_id2, account_id1, account_id2, flag, name1, name2); + } + if( HPMHooks.count.HP_mapif_guild_alliance_post ) { + int (*postHookFunc) (int retVal___, int *guild_id1, int *guild_id2, int *account_id1, int *account_id2, int *flag, const char *name1, const char *name2); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_alliance_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_alliance_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &guild_id1, &guild_id2, &account_id1, &account_id2, &flag, name1, name2); + } + } + return retVal___; +} +int HP_mapif_guild_position(struct guild *g, int idx) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_position_pre ) { + int (*preHookFunc) (struct guild *g, int *idx); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_position_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_position_pre[hIndex].func; + retVal___ = preHookFunc(g, &idx); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_position(g, idx); + } + if( HPMHooks.count.HP_mapif_guild_position_post ) { + int (*postHookFunc) (int retVal___, struct guild *g, int *idx); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_position_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_position_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g, &idx); + } + } + return retVal___; +} +int HP_mapif_guild_notice(struct guild *g) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_notice_pre ) { + int (*preHookFunc) (struct guild *g); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_notice_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_notice_pre[hIndex].func; + retVal___ = preHookFunc(g); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_notice(g); + } + if( HPMHooks.count.HP_mapif_guild_notice_post ) { + int (*postHookFunc) (int retVal___, struct guild *g); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_notice_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_notice_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g); + } + } + return retVal___; +} +int HP_mapif_guild_emblem(struct guild *g) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_emblem_pre ) { + int (*preHookFunc) (struct guild *g); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_emblem_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_emblem_pre[hIndex].func; + retVal___ = preHookFunc(g); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_emblem(g); + } + if( HPMHooks.count.HP_mapif_guild_emblem_post ) { + int (*postHookFunc) (int retVal___, struct guild *g); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_emblem_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_emblem_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g); + } + } + return retVal___; +} +int HP_mapif_guild_master_changed(struct guild *g, int aid, int cid) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_master_changed_pre ) { + int (*preHookFunc) (struct guild *g, int *aid, int *cid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_master_changed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_master_changed_pre[hIndex].func; + retVal___ = preHookFunc(g, &aid, &cid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_master_changed(g, aid, cid); + } + if( HPMHooks.count.HP_mapif_guild_master_changed_post ) { + int (*postHookFunc) (int retVal___, struct guild *g, int *aid, int *cid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_master_changed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_master_changed_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g, &aid, &cid); + } + } + return retVal___; +} +int HP_mapif_guild_castle_dataload(int fd, int sz, int *castle_ids) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_guild_castle_dataload_pre ) { + int (*preHookFunc) (int *fd, int *sz, int *castle_ids); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_castle_dataload_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_guild_castle_dataload_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sz, castle_ids); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.guild_castle_dataload(fd, sz, castle_ids); + } + if( HPMHooks.count.HP_mapif_guild_castle_dataload_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *sz, int *castle_ids); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_guild_castle_dataload_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_guild_castle_dataload_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &sz, castle_ids); + } + } + return retVal___; +} +int HP_mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_member *master) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_CreateGuild_pre ) { + int (*preHookFunc) (int *fd, int *account_id, char *name, struct guild_member *master); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_CreateGuild_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_CreateGuild_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, name, master); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_CreateGuild(fd, account_id, name, master); + } + if( HPMHooks.count.HP_mapif_parse_CreateGuild_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, char *name, struct guild_member *master); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_CreateGuild_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_CreateGuild_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, name, master); + } + } + return retVal___; +} +int HP_mapif_parse_GuildInfo(int fd, int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildInfo_pre ) { + int (*preHookFunc) (int *fd, int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildInfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildInfo_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildInfo(fd, guild_id); + } + if( HPMHooks.count.HP_mapif_parse_GuildInfo_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildInfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildInfo_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id); + } + } + return retVal___; +} +int HP_mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildAddMember_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, struct guild_member *m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildAddMember_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildAddMember_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildAddMember(fd, guild_id, m); + } + if( HPMHooks.count.HP_mapif_parse_GuildAddMember_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, struct guild_member *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildAddMember_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildAddMember_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, m); + } + } + return retVal___; +} +int HP_mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildLeave_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *flag, const char *mes); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildLeave_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildLeave_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &flag, mes); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildLeave(fd, guild_id, account_id, char_id, flag, mes); + } + if( HPMHooks.count.HP_mapif_parse_GuildLeave_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *account_id, int *char_id, int *flag, const char *mes); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildLeave_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildLeave_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &account_id, &char_id, &flag, mes); + } + } + return retVal___; +} +int HP_mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildChangeMemberInfoShort_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &online, &lv, &class_); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildChangeMemberInfoShort(fd, guild_id, account_id, char_id, online, lv, class_); + } + if( HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *account_id, int *char_id, int *online, int *lv, int *class_); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildChangeMemberInfoShort_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildChangeMemberInfoShort_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &account_id, &char_id, &online, &lv, &class_); + } + } + return retVal___; +} +int HP_mapif_parse_BreakGuild(int fd, int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_BreakGuild_pre ) { + int (*preHookFunc) (int *fd, int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_BreakGuild_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_BreakGuild_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_BreakGuild(fd, guild_id); + } + if( HPMHooks.count.HP_mapif_parse_BreakGuild_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_BreakGuild_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_BreakGuild_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id); + } + } + return retVal___; +} +int HP_mapif_parse_GuildMessage(int fd, int guild_id, int account_id, char *mes, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildMessage_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, char *mes, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildMessage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildMessage_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &account_id, mes, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildMessage(fd, guild_id, account_id, mes, len); + } + if( HPMHooks.count.HP_mapif_parse_GuildMessage_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *account_id, char *mes, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildMessage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildMessage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &account_id, mes, &len); + } + } + return retVal___; +} +int HP_mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildBasicInfoChange_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *type, const void *data, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildBasicInfoChange_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildBasicInfoChange_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &type, data, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildBasicInfoChange(fd, guild_id, type, data, len); + } + if( HPMHooks.count.HP_mapif_parse_GuildBasicInfoChange_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *type, const void *data, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildBasicInfoChange_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildBasicInfoChange_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &type, data, &len); + } + } + return retVal___; +} +int HP_mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildMemberInfoChange_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *account_id, int *char_id, int *type, const char *data, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildMemberInfoChange_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildMemberInfoChange_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &account_id, &char_id, &type, data, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildMemberInfoChange(fd, guild_id, account_id, char_id, type, data, len); + } + if( HPMHooks.count.HP_mapif_parse_GuildMemberInfoChange_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *account_id, int *char_id, int *type, const char *data, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildMemberInfoChange_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildMemberInfoChange_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &account_id, &char_id, &type, data, &len); + } + } + return retVal___; +} +int HP_mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildPosition_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, int *idx, struct guild_position *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildPosition_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildPosition_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &idx, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildPosition(fd, guild_id, idx, p); + } + if( HPMHooks.count.HP_mapif_parse_GuildPosition_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, int *idx, struct guild_position *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildPosition_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildPosition_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &idx, p); + } + } + return retVal___; +} +int HP_mapif_parse_GuildSkillUp(int fd, int guild_id, uint16 skill_id, int account_id, int max) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildSkillUp_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, uint16 *skill_id, int *account_id, int *max); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildSkillUp_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildSkillUp_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, &skill_id, &account_id, &max); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildSkillUp(fd, guild_id, skill_id, account_id, max); + } + if( HPMHooks.count.HP_mapif_parse_GuildSkillUp_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, uint16 *skill_id, int *account_id, int *max); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildSkillUp_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildSkillUp_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, &skill_id, &account_id, &max); + } + } + return retVal___; +} +int HP_mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildDeleteAlliance_pre ) { + int (*preHookFunc) (struct guild *g, int *guild_id, int *account_id1, int *account_id2, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildDeleteAlliance_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildDeleteAlliance_pre[hIndex].func; + retVal___ = preHookFunc(g, &guild_id, &account_id1, &account_id2, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildDeleteAlliance(g, guild_id, account_id1, account_id2, flag); + } + if( HPMHooks.count.HP_mapif_parse_GuildDeleteAlliance_post ) { + int (*postHookFunc) (int retVal___, struct guild *g, int *guild_id, int *account_id1, int *account_id2, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildDeleteAlliance_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildDeleteAlliance_post[hIndex].func; + retVal___ = postHookFunc(retVal___, g, &guild_id, &account_id1, &account_id2, &flag); + } + } + return retVal___; +} +int HP_mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildAlliance_pre ) { + int (*preHookFunc) (int *fd, int *guild_id1, int *guild_id2, int *account_id1, int *account_id2, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildAlliance_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildAlliance_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id1, &guild_id2, &account_id1, &account_id2, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildAlliance(fd, guild_id1, guild_id2, account_id1, account_id2, flag); + } + if( HPMHooks.count.HP_mapif_parse_GuildAlliance_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id1, int *guild_id2, int *account_id1, int *account_id2, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildAlliance_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildAlliance_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id1, &guild_id2, &account_id1, &account_id2, &flag); + } + } + return retVal___; +} +int HP_mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildNotice_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, const char *mes1, const char *mes2); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildNotice_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildNotice_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, mes1, mes2); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildNotice(fd, guild_id, mes1, mes2); + } + if( HPMHooks.count.HP_mapif_parse_GuildNotice_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, const char *mes1, const char *mes2); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildNotice_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildNotice_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, mes1, mes2); + } + } + return retVal___; +} +int HP_mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildEmblem_pre ) { + int (*preHookFunc) (int *fd, int *len, int *guild_id, int *dummy, const char *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildEmblem_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildEmblem_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &len, &guild_id, &dummy, data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildEmblem(fd, len, guild_id, dummy, data); + } + if( HPMHooks.count.HP_mapif_parse_GuildEmblem_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *len, int *guild_id, int *dummy, const char *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildEmblem_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildEmblem_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &len, &guild_id, &dummy, data); + } + } + return retVal___; +} +int HP_mapif_parse_GuildCastleDataLoad(int fd, int len, int *castle_ids) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildCastleDataLoad_pre ) { + int (*preHookFunc) (int *fd, int *len, int *castle_ids); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildCastleDataLoad_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildCastleDataLoad_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &len, castle_ids); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildCastleDataLoad(fd, len, castle_ids); + } + if( HPMHooks.count.HP_mapif_parse_GuildCastleDataLoad_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *len, int *castle_ids); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildCastleDataLoad_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildCastleDataLoad_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &len, castle_ids); + } + } + return retVal___; +} +int HP_mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildCastleDataSave_pre ) { + int (*preHookFunc) (int *fd, int *castle_id, int *index, int *value); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildCastleDataSave_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildCastleDataSave_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &castle_id, &index, &value); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildCastleDataSave(fd, castle_id, index, value); + } + if( HPMHooks.count.HP_mapif_parse_GuildCastleDataSave_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *castle_id, int *index, int *value); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildCastleDataSave_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildCastleDataSave_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &castle_id, &index, &value); + } + } + return retVal___; +} +int HP_mapif_parse_GuildMasterChange(int fd, int guild_id, const char *name, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_GuildMasterChange_pre ) { + int (*preHookFunc) (int *fd, int *guild_id, const char *name, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildMasterChange_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_GuildMasterChange_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &guild_id, name, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_GuildMasterChange(fd, guild_id, name, len); + } + if( HPMHooks.count.HP_mapif_parse_GuildMasterChange_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *guild_id, const char *name, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_GuildMasterChange_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_GuildMasterChange_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &guild_id, name, &len); + } + } + return retVal___; +} +void HP_mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_homunculus_created_pre ) { + void (*preHookFunc) (int *fd, int *account_id, struct s_homunculus *sh, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_created_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_created_pre[hIndex].func; + preHookFunc(&fd, &account_id, sh, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.homunculus_created(fd, account_id, sh, flag); + } + if( HPMHooks.count.HP_mapif_homunculus_created_post ) { + void (*postHookFunc) (int *fd, int *account_id, struct s_homunculus *sh, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_created_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_created_post[hIndex].func; + postHookFunc(&fd, &account_id, sh, &flag); + } + } + return; +} +void HP_mapif_homunculus_deleted(int fd, int flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_homunculus_deleted_pre ) { + void (*preHookFunc) (int *fd, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_deleted_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_deleted_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.homunculus_deleted(fd, flag); + } + if( HPMHooks.count.HP_mapif_homunculus_deleted_post ) { + void (*postHookFunc) (int *fd, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_deleted_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_deleted_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_homunculus_loaded_pre ) { + void (*preHookFunc) (int *fd, int *account_id, struct s_homunculus *hd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_loaded_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_loaded_pre[hIndex].func; + preHookFunc(&fd, &account_id, hd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.homunculus_loaded(fd, account_id, hd); + } + if( HPMHooks.count.HP_mapif_homunculus_loaded_post ) { + void (*postHookFunc) (int *fd, int *account_id, struct s_homunculus *hd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_loaded_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_loaded_post[hIndex].func; + postHookFunc(&fd, &account_id, hd); + } + } + return; +} +void HP_mapif_homunculus_saved(int fd, int account_id, bool flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_homunculus_saved_pre ) { + void (*preHookFunc) (int *fd, int *account_id, bool *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_saved_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_saved_pre[hIndex].func; + preHookFunc(&fd, &account_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.homunculus_saved(fd, account_id, flag); + } + if( HPMHooks.count.HP_mapif_homunculus_saved_post ) { + void (*postHookFunc) (int *fd, int *account_id, bool *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_saved_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_saved_post[hIndex].func; + postHookFunc(&fd, &account_id, &flag); + } + } + return; +} +void HP_mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char *name) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_homunculus_renamed_pre ) { + void (*preHookFunc) (int *fd, int *account_id, int *char_id, unsigned char *flag, char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_renamed_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_renamed_pre[hIndex].func; + preHookFunc(&fd, &account_id, &char_id, &flag, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.homunculus_renamed(fd, account_id, char_id, flag, name); + } + if( HPMHooks.count.HP_mapif_homunculus_renamed_post ) { + void (*postHookFunc) (int *fd, int *account_id, int *char_id, unsigned char *flag, char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_renamed_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_renamed_post[hIndex].func; + postHookFunc(&fd, &account_id, &char_id, &flag, name); + } + } + return; +} +bool HP_mapif_homunculus_save(struct s_homunculus *hd) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_homunculus_save_pre ) { + bool (*preHookFunc) (struct s_homunculus *hd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_save_pre[hIndex].func; + retVal___ = preHookFunc(hd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.homunculus_save(hd); + } + if( HPMHooks.count.HP_mapif_homunculus_save_post ) { + bool (*postHookFunc) (bool retVal___, struct s_homunculus *hd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_save_post[hIndex].func; + retVal___ = postHookFunc(retVal___, hd); + } + } + return retVal___; +} +bool HP_mapif_homunculus_load(int homun_id, struct s_homunculus *hd) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_homunculus_load_pre ) { + bool (*preHookFunc) (int *homun_id, struct s_homunculus *hd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_load_pre[hIndex].func; + retVal___ = preHookFunc(&homun_id, hd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.homunculus_load(homun_id, hd); + } + if( HPMHooks.count.HP_mapif_homunculus_load_post ) { + bool (*postHookFunc) (bool retVal___, int *homun_id, struct s_homunculus *hd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_load_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &homun_id, hd); + } + } + return retVal___; +} +bool HP_mapif_homunculus_delete(int homun_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_homunculus_delete_pre ) { + bool (*preHookFunc) (int *homun_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_delete_pre[hIndex].func; + retVal___ = preHookFunc(&homun_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.homunculus_delete(homun_id); + } + if( HPMHooks.count.HP_mapif_homunculus_delete_post ) { + bool (*postHookFunc) (bool retVal___, int *homun_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_delete_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &homun_id); + } + } + return retVal___; +} +bool HP_mapif_homunculus_rename(char *name) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_homunculus_rename_pre ) { + bool (*preHookFunc) (char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_rename_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_homunculus_rename_pre[hIndex].func; + retVal___ = preHookFunc(name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.homunculus_rename(name); + } + if( HPMHooks.count.HP_mapif_homunculus_rename_post ) { + bool (*postHookFunc) (bool retVal___, char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_homunculus_rename_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_homunculus_rename_post[hIndex].func; + retVal___ = postHookFunc(retVal___, name); + } + } + return retVal___; +} +void HP_mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus *phd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_homunculus_create_pre ) { + void (*preHookFunc) (int *fd, int *len, int *account_id, struct s_homunculus *phd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_create_pre[hIndex].func; + preHookFunc(&fd, &len, &account_id, phd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_homunculus_create(fd, len, account_id, phd); + } + if( HPMHooks.count.HP_mapif_parse_homunculus_create_post ) { + void (*postHookFunc) (int *fd, int *len, int *account_id, struct s_homunculus *phd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_create_post[hIndex].func; + postHookFunc(&fd, &len, &account_id, phd); + } + } + return; +} +void HP_mapif_parse_homunculus_delete(int fd, int homun_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_homunculus_delete_pre ) { + void (*preHookFunc) (int *fd, int *homun_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_delete_pre[hIndex].func; + preHookFunc(&fd, &homun_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_homunculus_delete(fd, homun_id); + } + if( HPMHooks.count.HP_mapif_parse_homunculus_delete_post ) { + void (*postHookFunc) (int *fd, int *homun_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_delete_post[hIndex].func; + postHookFunc(&fd, &homun_id); + } + } + return; +} +void HP_mapif_parse_homunculus_load(int fd, int account_id, int homun_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_homunculus_load_pre ) { + void (*preHookFunc) (int *fd, int *account_id, int *homun_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_load_pre[hIndex].func; + preHookFunc(&fd, &account_id, &homun_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_homunculus_load(fd, account_id, homun_id); + } + if( HPMHooks.count.HP_mapif_parse_homunculus_load_post ) { + void (*postHookFunc) (int *fd, int *account_id, int *homun_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_load_post[hIndex].func; + postHookFunc(&fd, &account_id, &homun_id); + } + } + return; +} +void HP_mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus *phd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_homunculus_save_pre ) { + void (*preHookFunc) (int *fd, int *len, int *account_id, struct s_homunculus *phd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_save_pre[hIndex].func; + preHookFunc(&fd, &len, &account_id, phd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_homunculus_save(fd, len, account_id, phd); + } + if( HPMHooks.count.HP_mapif_parse_homunculus_save_post ) { + void (*postHookFunc) (int *fd, int *len, int *account_id, struct s_homunculus *phd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_save_post[hIndex].func; + postHookFunc(&fd, &len, &account_id, phd); + } + } + return; +} +void HP_mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char *name) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_homunculus_rename_pre ) { + void (*preHookFunc) (int *fd, int *account_id, int *char_id, char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_rename_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_rename_pre[hIndex].func; + preHookFunc(&fd, &account_id, &char_id, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_homunculus_rename(fd, account_id, char_id, name); + } + if( HPMHooks.count.HP_mapif_parse_homunculus_rename_post ) { + void (*postHookFunc) (int *fd, int *account_id, int *char_id, char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_homunculus_rename_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_homunculus_rename_post[hIndex].func; + postHookFunc(&fd, &account_id, &char_id, name); + } + } + return; +} +void HP_mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_sendinbox_pre ) { + void (*preHookFunc) (int *fd, int *char_id, unsigned char *flag, struct mail_data *md); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_sendinbox_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_sendinbox_pre[hIndex].func; + preHookFunc(&fd, &char_id, &flag, md); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_sendinbox(fd, char_id, flag, md); + } + if( HPMHooks.count.HP_mapif_mail_sendinbox_post ) { + void (*postHookFunc) (int *fd, int *char_id, unsigned char *flag, struct mail_data *md); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_sendinbox_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_sendinbox_post[hIndex].func; + postHookFunc(&fd, &char_id, &flag, md); + } + } + return; +} +void HP_mapif_parse_mail_requestinbox(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mail_requestinbox_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_requestinbox_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mail_requestinbox_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mail_requestinbox(fd); + } + if( HPMHooks.count.HP_mapif_parse_mail_requestinbox_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_requestinbox_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mail_requestinbox_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_parse_mail_read(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mail_read_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_read_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mail_read_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mail_read(fd); + } + if( HPMHooks.count.HP_mapif_parse_mail_read_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_read_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mail_read_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_mail_sendattach(int fd, int char_id, struct mail_message *msg) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_sendattach_pre ) { + void (*preHookFunc) (int *fd, int *char_id, struct mail_message *msg); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_sendattach_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_sendattach_pre[hIndex].func; + preHookFunc(&fd, &char_id, msg); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_sendattach(fd, char_id, msg); + } + if( HPMHooks.count.HP_mapif_mail_sendattach_post ) { + void (*postHookFunc) (int *fd, int *char_id, struct mail_message *msg); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_sendattach_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_sendattach_post[hIndex].func; + postHookFunc(&fd, &char_id, msg); + } + } + return; +} +void HP_mapif_mail_getattach(int fd, int char_id, int mail_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_getattach_pre ) { + void (*preHookFunc) (int *fd, int *char_id, int *mail_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_getattach_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_getattach_pre[hIndex].func; + preHookFunc(&fd, &char_id, &mail_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_getattach(fd, char_id, mail_id); + } + if( HPMHooks.count.HP_mapif_mail_getattach_post ) { + void (*postHookFunc) (int *fd, int *char_id, int *mail_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_getattach_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_getattach_post[hIndex].func; + postHookFunc(&fd, &char_id, &mail_id); + } + } + return; +} +void HP_mapif_parse_mail_getattach(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mail_getattach_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_getattach_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mail_getattach_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mail_getattach(fd); + } + if( HPMHooks.count.HP_mapif_parse_mail_getattach_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_getattach_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mail_getattach_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_mail_delete(int fd, int char_id, int mail_id, bool failed) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_delete_pre ) { + void (*preHookFunc) (int *fd, int *char_id, int *mail_id, bool *failed); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_delete_pre[hIndex].func; + preHookFunc(&fd, &char_id, &mail_id, &failed); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_delete(fd, char_id, mail_id, failed); + } + if( HPMHooks.count.HP_mapif_mail_delete_post ) { + void (*postHookFunc) (int *fd, int *char_id, int *mail_id, bool *failed); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_delete_post[hIndex].func; + postHookFunc(&fd, &char_id, &mail_id, &failed); + } + } + return; +} +void HP_mapif_parse_mail_delete(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mail_delete_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mail_delete_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mail_delete(fd); + } + if( HPMHooks.count.HP_mapif_parse_mail_delete_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mail_delete_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_mail_new(struct mail_message *msg) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_new_pre ) { + void (*preHookFunc) (struct mail_message *msg); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_new_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_new_pre[hIndex].func; + preHookFunc(msg); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_new(msg); + } + if( HPMHooks.count.HP_mapif_mail_new_post ) { + void (*postHookFunc) (struct mail_message *msg); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_new_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_new_post[hIndex].func; + postHookFunc(msg); + } + } + return; +} +void HP_mapif_mail_return(int fd, int char_id, int mail_id, int new_mail) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_return_pre ) { + void (*preHookFunc) (int *fd, int *char_id, int *mail_id, int *new_mail); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_return_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_return_pre[hIndex].func; + preHookFunc(&fd, &char_id, &mail_id, &new_mail); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_return(fd, char_id, mail_id, new_mail); + } + if( HPMHooks.count.HP_mapif_mail_return_post ) { + void (*postHookFunc) (int *fd, int *char_id, int *mail_id, int *new_mail); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_return_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_return_post[hIndex].func; + postHookFunc(&fd, &char_id, &mail_id, &new_mail); + } + } + return; +} +void HP_mapif_parse_mail_return(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mail_return_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_return_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mail_return_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mail_return(fd); + } + if( HPMHooks.count.HP_mapif_parse_mail_return_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_return_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mail_return_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_mail_send(int fd, struct mail_message *msg) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mail_send_pre ) { + void (*preHookFunc) (int *fd, struct mail_message *msg); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_send_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mail_send_pre[hIndex].func; + preHookFunc(&fd, msg); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mail_send(fd, msg); + } + if( HPMHooks.count.HP_mapif_mail_send_post ) { + void (*postHookFunc) (int *fd, struct mail_message *msg); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mail_send_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mail_send_post[hIndex].func; + postHookFunc(&fd, msg); + } + } + return; +} +void HP_mapif_parse_mail_send(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mail_send_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_send_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mail_send_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mail_send(fd); + } + if( HPMHooks.count.HP_mapif_parse_mail_send_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mail_send_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mail_send_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +bool HP_mapif_mercenary_save(struct s_mercenary *merc) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_mercenary_save_pre ) { + bool (*preHookFunc) (struct s_mercenary *merc); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mercenary_save_pre[hIndex].func; + retVal___ = preHookFunc(merc); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.mercenary_save(merc); + } + if( HPMHooks.count.HP_mapif_mercenary_save_post ) { + bool (*postHookFunc) (bool retVal___, struct s_mercenary *merc); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mercenary_save_post[hIndex].func; + retVal___ = postHookFunc(retVal___, merc); + } + } + return retVal___; +} +bool HP_mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_mercenary_load_pre ) { + bool (*preHookFunc) (int *merc_id, int *char_id, struct s_mercenary *merc); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mercenary_load_pre[hIndex].func; + retVal___ = preHookFunc(&merc_id, &char_id, merc); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.mercenary_load(merc_id, char_id, merc); + } + if( HPMHooks.count.HP_mapif_mercenary_load_post ) { + bool (*postHookFunc) (bool retVal___, int *merc_id, int *char_id, struct s_mercenary *merc); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mercenary_load_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &merc_id, &char_id, merc); + } + } + return retVal___; +} +bool HP_mapif_mercenary_delete(int merc_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_mercenary_delete_pre ) { + bool (*preHookFunc) (int *merc_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mercenary_delete_pre[hIndex].func; + retVal___ = preHookFunc(&merc_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.mercenary_delete(merc_id); + } + if( HPMHooks.count.HP_mapif_mercenary_delete_post ) { + bool (*postHookFunc) (bool retVal___, int *merc_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mercenary_delete_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &merc_id); + } + } + return retVal___; +} +void HP_mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mercenary_send_pre ) { + void (*preHookFunc) (int *fd, struct s_mercenary *merc, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_send_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mercenary_send_pre[hIndex].func; + preHookFunc(&fd, merc, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mercenary_send(fd, merc, flag); + } + if( HPMHooks.count.HP_mapif_mercenary_send_post ) { + void (*postHookFunc) (int *fd, struct s_mercenary *merc, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_send_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mercenary_send_post[hIndex].func; + postHookFunc(&fd, merc, &flag); + } + } + return; +} +void HP_mapif_parse_mercenary_create(int fd, struct s_mercenary *merc) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mercenary_create_pre ) { + void (*preHookFunc) (int *fd, struct s_mercenary *merc); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_create_pre[hIndex].func; + preHookFunc(&fd, merc); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mercenary_create(fd, merc); + } + if( HPMHooks.count.HP_mapif_parse_mercenary_create_post ) { + void (*postHookFunc) (int *fd, struct s_mercenary *merc); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_create_post[hIndex].func; + postHookFunc(&fd, merc); + } + } + return; +} +void HP_mapif_parse_mercenary_load(int fd, int merc_id, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mercenary_load_pre ) { + void (*preHookFunc) (int *fd, int *merc_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_load_pre[hIndex].func; + preHookFunc(&fd, &merc_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mercenary_load(fd, merc_id, char_id); + } + if( HPMHooks.count.HP_mapif_parse_mercenary_load_post ) { + void (*postHookFunc) (int *fd, int *merc_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_load_post[hIndex].func; + postHookFunc(&fd, &merc_id, &char_id); + } + } + return; +} +void HP_mapif_mercenary_deleted(int fd, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mercenary_deleted_pre ) { + void (*preHookFunc) (int *fd, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_deleted_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mercenary_deleted_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mercenary_deleted(fd, flag); + } + if( HPMHooks.count.HP_mapif_mercenary_deleted_post ) { + void (*postHookFunc) (int *fd, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_deleted_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mercenary_deleted_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_mapif_parse_mercenary_delete(int fd, int merc_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mercenary_delete_pre ) { + void (*preHookFunc) (int *fd, int *merc_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_delete_pre[hIndex].func; + preHookFunc(&fd, &merc_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mercenary_delete(fd, merc_id); + } + if( HPMHooks.count.HP_mapif_parse_mercenary_delete_post ) { + void (*postHookFunc) (int *fd, int *merc_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_delete_post[hIndex].func; + postHookFunc(&fd, &merc_id); + } + } + return; +} +void HP_mapif_mercenary_saved(int fd, unsigned char flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_mercenary_saved_pre ) { + void (*preHookFunc) (int *fd, unsigned char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_saved_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_mercenary_saved_pre[hIndex].func; + preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.mercenary_saved(fd, flag); + } + if( HPMHooks.count.HP_mapif_mercenary_saved_post ) { + void (*postHookFunc) (int *fd, unsigned char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_mercenary_saved_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_mercenary_saved_post[hIndex].func; + postHookFunc(&fd, &flag); + } + } + return; +} +void HP_mapif_parse_mercenary_save(int fd, struct s_mercenary *merc) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_mercenary_save_pre ) { + void (*preHookFunc) (int *fd, struct s_mercenary *merc); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_save_pre[hIndex].func; + preHookFunc(&fd, merc); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_mercenary_save(fd, merc); + } + if( HPMHooks.count.HP_mapif_parse_mercenary_save_post ) { + void (*postHookFunc) (int *fd, struct s_mercenary *merc); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_mercenary_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_mercenary_save_post[hIndex].func; + postHookFunc(&fd, merc); + } + } + return; +} +int HP_mapif_party_created(int fd, int account_id, int char_id, struct party *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_created_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *char_id, struct party *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_created_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_created_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &char_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_created(fd, account_id, char_id, p); + } + if( HPMHooks.count.HP_mapif_party_created_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *char_id, struct party *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_created_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_created_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &char_id, p); + } + } + return retVal___; +} +void HP_mapif_party_noinfo(int fd, int party_id, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_party_noinfo_pre ) { + void (*preHookFunc) (int *fd, int *party_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_noinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_noinfo_pre[hIndex].func; + preHookFunc(&fd, &party_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.party_noinfo(fd, party_id, char_id); + } + if( HPMHooks.count.HP_mapif_party_noinfo_post ) { + void (*postHookFunc) (int *fd, int *party_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_noinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_noinfo_post[hIndex].func; + postHookFunc(&fd, &party_id, &char_id); + } + } + return; +} +void HP_mapif_party_info(int fd, struct party *p, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_party_info_pre ) { + void (*preHookFunc) (int *fd, struct party *p, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_info_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_info_pre[hIndex].func; + preHookFunc(&fd, p, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.party_info(fd, p, char_id); + } + if( HPMHooks.count.HP_mapif_party_info_post ) { + void (*postHookFunc) (int *fd, struct party *p, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_info_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_info_post[hIndex].func; + postHookFunc(&fd, p, &char_id); + } + } + return; +} +int HP_mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_memberadded_pre ) { + int (*preHookFunc) (int *fd, int *party_id, int *account_id, int *char_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_memberadded_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_memberadded_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, &account_id, &char_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_memberadded(fd, party_id, account_id, char_id, flag); + } + if( HPMHooks.count.HP_mapif_party_memberadded_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, int *account_id, int *char_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_memberadded_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_memberadded_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, &account_id, &char_id, &flag); + } + } + return retVal___; +} +int HP_mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_optionchanged_pre ) { + int (*preHookFunc) (int *fd, struct party *p, int *account_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_optionchanged_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_optionchanged_pre[hIndex].func; + retVal___ = preHookFunc(&fd, p, &account_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_optionchanged(fd, p, account_id, flag); + } + if( HPMHooks.count.HP_mapif_party_optionchanged_post ) { + int (*postHookFunc) (int retVal___, int *fd, struct party *p, int *account_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_optionchanged_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_optionchanged_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, p, &account_id, &flag); + } + } + return retVal___; +} +int HP_mapif_party_withdraw(int party_id, int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_withdraw_pre ) { + int (*preHookFunc) (int *party_id, int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_withdraw_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_withdraw_pre[hIndex].func; + retVal___ = preHookFunc(&party_id, &account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_withdraw(party_id, account_id, char_id); + } + if( HPMHooks.count.HP_mapif_party_withdraw_post ) { + int (*postHookFunc) (int retVal___, int *party_id, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_withdraw_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_withdraw_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &party_id, &account_id, &char_id); + } + } + return retVal___; +} +int HP_mapif_party_membermoved(struct party *p, int idx) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_membermoved_pre ) { + int (*preHookFunc) (struct party *p, int *idx); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_membermoved_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_membermoved_pre[hIndex].func; + retVal___ = preHookFunc(p, &idx); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_membermoved(p, idx); + } + if( HPMHooks.count.HP_mapif_party_membermoved_post ) { + int (*postHookFunc) (int retVal___, struct party *p, int *idx); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_membermoved_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_membermoved_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p, &idx); + } + } + return retVal___; +} +int HP_mapif_party_broken(int party_id, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_broken_pre ) { + int (*preHookFunc) (int *party_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_broken_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_broken_pre[hIndex].func; + retVal___ = preHookFunc(&party_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_broken(party_id, flag); + } + if( HPMHooks.count.HP_mapif_party_broken_post ) { + int (*postHookFunc) (int retVal___, int *party_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_broken_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_broken_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &party_id, &flag); + } + } + return retVal___; +} +int HP_mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_party_message_pre ) { + int (*preHookFunc) (int *party_id, int *account_id, char *mes, int *len, int *sfd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_party_message_pre[hIndex].func; + retVal___ = preHookFunc(&party_id, &account_id, mes, &len, &sfd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.party_message(party_id, account_id, mes, len, sfd); + } + if( HPMHooks.count.HP_mapif_party_message_post ) { + int (*postHookFunc) (int retVal___, int *party_id, int *account_id, char *mes, int *len, int *sfd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_party_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_party_message_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &party_id, &account_id, mes, &len, &sfd); + } + } + return retVal___; +} +int HP_mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_CreateParty_pre ) { + int (*preHookFunc) (int *fd, char *name, int *item, int *item2, struct party_member *leader); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_CreateParty_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_CreateParty_pre[hIndex].func; + retVal___ = preHookFunc(&fd, name, &item, &item2, leader); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_CreateParty(fd, name, item, item2, leader); + } + if( HPMHooks.count.HP_mapif_parse_CreateParty_post ) { + int (*postHookFunc) (int retVal___, int *fd, char *name, int *item, int *item2, struct party_member *leader); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_CreateParty_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_CreateParty_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, name, &item, &item2, leader); + } + } + return retVal___; +} +void HP_mapif_parse_PartyInfo(int fd, int party_id, int char_id) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_PartyInfo_pre ) { + void (*preHookFunc) (int *fd, int *party_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyInfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyInfo_pre[hIndex].func; + preHookFunc(&fd, &party_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_PartyInfo(fd, party_id, char_id); + } + if( HPMHooks.count.HP_mapif_parse_PartyInfo_post ) { + void (*postHookFunc) (int *fd, int *party_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyInfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyInfo_post[hIndex].func; + postHookFunc(&fd, &party_id, &char_id); + } + } + return; +} +int HP_mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_PartyAddMember_pre ) { + int (*preHookFunc) (int *fd, int *party_id, struct party_member *member); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyAddMember_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyAddMember_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, member); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_PartyAddMember(fd, party_id, member); + } + if( HPMHooks.count.HP_mapif_parse_PartyAddMember_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, struct party_member *member); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyAddMember_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyAddMember_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, member); + } + } + return retVal___; +} +int HP_mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_PartyChangeOption_pre ) { + int (*preHookFunc) (int *fd, int *party_id, int *account_id, int *exp, int *item); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyChangeOption_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyChangeOption_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, &account_id, &exp, &item); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_PartyChangeOption(fd, party_id, account_id, exp, item); + } + if( HPMHooks.count.HP_mapif_parse_PartyChangeOption_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, int *account_id, int *exp, int *item); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyChangeOption_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyChangeOption_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, &account_id, &exp, &item); + } + } + return retVal___; +} +int HP_mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_PartyLeave_pre ) { + int (*preHookFunc) (int *fd, int *party_id, int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyLeave_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyLeave_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, &account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_PartyLeave(fd, party_id, account_id, char_id); + } + if( HPMHooks.count.HP_mapif_parse_PartyLeave_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyLeave_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyLeave_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, &account_id, &char_id); + } + } + return retVal___; +} +int HP_mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_PartyChangeMap_pre ) { + int (*preHookFunc) (int *fd, int *party_id, int *account_id, int *char_id, unsigned short *map, int *online, unsigned int *lv); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyChangeMap_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyChangeMap_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, &account_id, &char_id, &map, &online, &lv); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_PartyChangeMap(fd, party_id, account_id, char_id, map, online, lv); + } + if( HPMHooks.count.HP_mapif_parse_PartyChangeMap_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, int *account_id, int *char_id, unsigned short *map, int *online, unsigned int *lv); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyChangeMap_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyChangeMap_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, &account_id, &char_id, &map, &online, &lv); + } + } + return retVal___; +} +int HP_mapif_parse_BreakParty(int fd, int party_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_BreakParty_pre ) { + int (*preHookFunc) (int *fd, int *party_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_BreakParty_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_BreakParty_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_BreakParty(fd, party_id); + } + if( HPMHooks.count.HP_mapif_parse_BreakParty_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_BreakParty_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_BreakParty_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id); + } + } + return retVal___; +} +int HP_mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_PartyMessage_pre ) { + int (*preHookFunc) (int *fd, int *party_id, int *account_id, char *mes, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyMessage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyMessage_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, &account_id, mes, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_PartyMessage(fd, party_id, account_id, mes, len); + } + if( HPMHooks.count.HP_mapif_parse_PartyMessage_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, int *account_id, char *mes, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyMessage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyMessage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, &account_id, mes, &len); + } + } + return retVal___; +} +int HP_mapif_parse_PartyLeaderChange(int fd, int party_id, int account_id, int char_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_PartyLeaderChange_pre ) { + int (*preHookFunc) (int *fd, int *party_id, int *account_id, int *char_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyLeaderChange_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_PartyLeaderChange_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &party_id, &account_id, &char_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_PartyLeaderChange(fd, party_id, account_id, char_id); + } + if( HPMHooks.count.HP_mapif_parse_PartyLeaderChange_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *party_id, int *account_id, int *char_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_PartyLeaderChange_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_PartyLeaderChange_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &party_id, &account_id, &char_id); + } + } + return retVal___; +} +int HP_mapif_pet_created(int fd, int account_id, struct s_pet *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_pet_created_pre ) { + int (*preHookFunc) (int *fd, int *account_id, struct s_pet *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pet_created_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_pet_created_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.pet_created(fd, account_id, p); + } + if( HPMHooks.count.HP_mapif_pet_created_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, struct s_pet *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pet_created_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_pet_created_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, p); + } + } + return retVal___; +} +int HP_mapif_pet_info(int fd, int account_id, struct s_pet *p) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_pet_info_pre ) { + int (*preHookFunc) (int *fd, int *account_id, struct s_pet *p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pet_info_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_pet_info_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.pet_info(fd, account_id, p); + } + if( HPMHooks.count.HP_mapif_pet_info_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, struct s_pet *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pet_info_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_pet_info_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, p); + } + } + return retVal___; +} +int HP_mapif_pet_noinfo(int fd, int account_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_pet_noinfo_pre ) { + int (*preHookFunc) (int *fd, int *account_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pet_noinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_pet_noinfo_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.pet_noinfo(fd, account_id); + } + if( HPMHooks.count.HP_mapif_pet_noinfo_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_pet_noinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_pet_noinfo_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id); + } + } + return retVal___; +} +int HP_mapif_save_pet_ack(int fd, int account_id, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_save_pet_ack_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_save_pet_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_save_pet_ack_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.save_pet_ack(fd, account_id, flag); + } + if( HPMHooks.count.HP_mapif_save_pet_ack_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_save_pet_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_save_pet_ack_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &flag); + } + } + return retVal___; +} +int HP_mapif_delete_pet_ack(int fd, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_delete_pet_ack_pre ) { + int (*preHookFunc) (int *fd, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_delete_pet_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_delete_pet_ack_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.delete_pet_ack(fd, flag); + } + if( HPMHooks.count.HP_mapif_delete_pet_ack_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_delete_pet_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_delete_pet_ack_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &flag); + } + } + return retVal___; +} +int HP_mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_create_pet_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *char_id, short *pet_class, short *pet_lv, short *pet_egg_id, short *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, char *pet_name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_create_pet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_create_pet_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &char_id, &pet_class, &pet_lv, &pet_egg_id, &pet_equip, &intimate, &hungry, &rename_flag, &incubate, pet_name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.create_pet(fd, account_id, char_id, pet_class, pet_lv, pet_egg_id, pet_equip, intimate, hungry, rename_flag, incubate, pet_name); + } + if( HPMHooks.count.HP_mapif_create_pet_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *char_id, short *pet_class, short *pet_lv, short *pet_egg_id, short *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, char *pet_name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_create_pet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_create_pet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &char_id, &pet_class, &pet_lv, &pet_egg_id, &pet_equip, &intimate, &hungry, &rename_flag, &incubate, pet_name); + } + } + return retVal___; +} +int HP_mapif_load_pet(int fd, int account_id, int char_id, int pet_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_load_pet_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *char_id, int *pet_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_load_pet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_load_pet_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &char_id, &pet_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.load_pet(fd, account_id, char_id, pet_id); + } + if( HPMHooks.count.HP_mapif_load_pet_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *char_id, int *pet_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_load_pet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_load_pet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &char_id, &pet_id); + } + } + return retVal___; +} +int HP_mapif_save_pet(int fd, int account_id, struct s_pet *data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_save_pet_pre ) { + int (*preHookFunc) (int *fd, int *account_id, struct s_pet *data); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_save_pet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_save_pet_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.save_pet(fd, account_id, data); + } + if( HPMHooks.count.HP_mapif_save_pet_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, struct s_pet *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_save_pet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_save_pet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, data); + } + } + return retVal___; +} +int HP_mapif_delete_pet(int fd, int pet_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_delete_pet_pre ) { + int (*preHookFunc) (int *fd, int *pet_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_delete_pet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_delete_pet_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &pet_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.delete_pet(fd, pet_id); + } + if( HPMHooks.count.HP_mapif_delete_pet_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *pet_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_delete_pet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_delete_pet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &pet_id); + } + } + return retVal___; +} +int HP_mapif_parse_CreatePet(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_CreatePet_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_CreatePet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_CreatePet_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_CreatePet(fd); + } + if( HPMHooks.count.HP_mapif_parse_CreatePet_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_CreatePet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_CreatePet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_LoadPet(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_LoadPet_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_LoadPet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_LoadPet_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_LoadPet(fd); + } + if( HPMHooks.count.HP_mapif_parse_LoadPet_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_LoadPet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_LoadPet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_SavePet(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_SavePet_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_SavePet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_SavePet_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_SavePet(fd); + } + if( HPMHooks.count.HP_mapif_parse_SavePet_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_SavePet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_SavePet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_DeletePet(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_DeletePet_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_DeletePet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_DeletePet_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_DeletePet(fd); + } + if( HPMHooks.count.HP_mapif_parse_DeletePet_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_DeletePet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_DeletePet_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +struct quest* HP_mapif_quests_fromsql(int char_id, int *count) { + int hIndex = 0; + struct quest* retVal___ = NULL; + if( HPMHooks.count.HP_mapif_quests_fromsql_pre ) { + struct quest* (*preHookFunc) (int *char_id, int *count); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quests_fromsql_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_quests_fromsql_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, count); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.quests_fromsql(char_id, count); + } + if( HPMHooks.count.HP_mapif_quests_fromsql_post ) { + struct quest* (*postHookFunc) (struct quest* retVal___, int *char_id, int *count); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quests_fromsql_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_quests_fromsql_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, count); + } + } + return retVal___; +} +bool HP_mapif_quest_delete(int char_id, int quest_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_quest_delete_pre ) { + bool (*preHookFunc) (int *char_id, int *quest_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_delete_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_quest_delete_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &quest_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.quest_delete(char_id, quest_id); + } + if( HPMHooks.count.HP_mapif_quest_delete_post ) { + bool (*postHookFunc) (bool retVal___, int *char_id, int *quest_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_delete_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_quest_delete_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &quest_id); + } + } + return retVal___; +} +bool HP_mapif_quest_add(int char_id, struct quest qd) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_quest_add_pre ) { + bool (*preHookFunc) (int *char_id, struct quest *qd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_add_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_quest_add_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &qd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.quest_add(char_id, qd); + } + if( HPMHooks.count.HP_mapif_quest_add_post ) { + bool (*postHookFunc) (bool retVal___, int *char_id, struct quest *qd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_add_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_quest_add_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &qd); + } + } + return retVal___; +} +bool HP_mapif_quest_update(int char_id, struct quest qd) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mapif_quest_update_pre ) { + bool (*preHookFunc) (int *char_id, struct quest *qd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_update_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_quest_update_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &qd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.quest_update(char_id, qd); + } + if( HPMHooks.count.HP_mapif_quest_update_post ) { + bool (*postHookFunc) (bool retVal___, int *char_id, struct quest *qd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_update_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_quest_update_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &qd); + } + } + return retVal___; +} +void HP_mapif_quest_save_ack(int fd, int char_id, bool success) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_quest_save_ack_pre ) { + void (*preHookFunc) (int *fd, int *char_id, bool *success); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_save_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_quest_save_ack_pre[hIndex].func; + preHookFunc(&fd, &char_id, &success); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.quest_save_ack(fd, char_id, success); + } + if( HPMHooks.count.HP_mapif_quest_save_ack_post ) { + void (*postHookFunc) (int *fd, int *char_id, bool *success); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_quest_save_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_quest_save_ack_post[hIndex].func; + postHookFunc(&fd, &char_id, &success); + } + } + return; +} +int HP_mapif_parse_quest_save(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_quest_save_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_quest_save_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_quest_save_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_quest_save(fd); + } + if( HPMHooks.count.HP_mapif_parse_quest_save_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_quest_save_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_quest_save_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_send_quests_pre ) { + void (*preHookFunc) (int *fd, int *char_id, struct quest *tmp_questlog, int *num_quests); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_send_quests_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_send_quests_pre[hIndex].func; + preHookFunc(&fd, &char_id, tmp_questlog, &num_quests); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.send_quests(fd, char_id, tmp_questlog, num_quests); + } + if( HPMHooks.count.HP_mapif_send_quests_post ) { + void (*postHookFunc) (int *fd, int *char_id, struct quest *tmp_questlog, int *num_quests); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_send_quests_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_send_quests_post[hIndex].func; + postHookFunc(&fd, &char_id, tmp_questlog, &num_quests); + } + } + return; +} +int HP_mapif_parse_quest_load(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_quest_load_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_quest_load_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_quest_load_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_quest_load(fd); + } + if( HPMHooks.count.HP_mapif_parse_quest_load_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_quest_load_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_quest_load_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_load_guild_storage(int fd, int account_id, int guild_id, char flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_load_guild_storage_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *guild_id, char *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_load_guild_storage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_load_guild_storage_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &guild_id, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.load_guild_storage(fd, account_id, guild_id, flag); + } + if( HPMHooks.count.HP_mapif_load_guild_storage_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *guild_id, char *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_load_guild_storage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_load_guild_storage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &guild_id, &flag); + } + } + return retVal___; +} +int HP_mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_save_guild_storage_ack_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *guild_id, int *fail); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_save_guild_storage_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_save_guild_storage_ack_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &guild_id, &fail); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.save_guild_storage_ack(fd, account_id, guild_id, fail); + } + if( HPMHooks.count.HP_mapif_save_guild_storage_ack_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *guild_id, int *fail); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_save_guild_storage_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_save_guild_storage_ack_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &guild_id, &fail); + } + } + return retVal___; +} +int HP_mapif_parse_LoadGuildStorage(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_LoadGuildStorage_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_LoadGuildStorage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_LoadGuildStorage_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_LoadGuildStorage(fd); + } + if( HPMHooks.count.HP_mapif_parse_LoadGuildStorage_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_LoadGuildStorage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_LoadGuildStorage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_SaveGuildStorage(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_SaveGuildStorage_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_SaveGuildStorage_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_SaveGuildStorage_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_SaveGuildStorage(fd); + } + if( HPMHooks.count.HP_mapif_parse_SaveGuildStorage_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_SaveGuildStorage_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_SaveGuildStorage_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_itembound_ack(int fd, int aid, int guild_id) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_itembound_ack_pre ) { + int (*preHookFunc) (int *fd, int *aid, int *guild_id); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_itembound_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_itembound_ack_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &aid, &guild_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.itembound_ack(fd, aid, guild_id); + } + if( HPMHooks.count.HP_mapif_itembound_ack_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *aid, int *guild_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_itembound_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_itembound_ack_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &aid, &guild_id); + } + } + return retVal___; +} +int HP_mapif_parse_ItemBoundRetrieve_sub(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_sub_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_ItemBoundRetrieve_sub_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_ItemBoundRetrieve_sub(fd); + } + if( HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_sub_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_ItemBoundRetrieve_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_mapif_parse_ItemBoundRetrieve(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_ItemBoundRetrieve_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_ItemBoundRetrieve(fd); + } + if( HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_ItemBoundRetrieve_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_ItemBoundRetrieve_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_parse_accinfo(int fd) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_accinfo_pre ) { + void (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_accinfo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_accinfo_pre[hIndex].func; + preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_accinfo(fd); + } + if( HPMHooks.count.HP_mapif_parse_accinfo_post ) { + void (*postHookFunc) (int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_accinfo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_accinfo_post[hIndex].func; + postHookFunc(&fd); + } + } + return; +} +void HP_mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_parse_accinfo2_pre ) { + void (*preHookFunc) (bool *success, int *map_fd, int *u_fd, int *u_aid, int *account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int *group_id, int *logincount, int *state); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_accinfo2_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_accinfo2_pre[hIndex].func; + preHookFunc(&success, &map_fd, &u_fd, &u_aid, &account_id, userid, user_pass, email, last_ip, lastlogin, pin_code, birthdate, &group_id, &logincount, &state); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.parse_accinfo2(success, map_fd, u_fd, u_aid, account_id, userid, user_pass, email, last_ip, lastlogin, pin_code, birthdate, group_id, logincount, state); + } + if( HPMHooks.count.HP_mapif_parse_accinfo2_post ) { + void (*postHookFunc) (bool *success, int *map_fd, int *u_fd, int *u_aid, int *account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int *group_id, int *logincount, int *state); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_accinfo2_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_accinfo2_post[hIndex].func; + postHookFunc(&success, &map_fd, &u_fd, &u_aid, &account_id, userid, user_pass, email, last_ip, lastlogin, pin_code, birthdate, &group_id, &logincount, &state); + } + } + return; +} +int HP_mapif_broadcast(unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_broadcast_pre ) { + int (*preHookFunc) (unsigned char *mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY, int *sfd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_broadcast_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_broadcast_pre[hIndex].func; + retVal___ = preHookFunc(mes, &len, &fontColor, &fontType, &fontSize, &fontAlign, &fontY, &sfd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.broadcast(mes, len, fontColor, fontType, fontSize, fontAlign, fontY, sfd); + } + if( HPMHooks.count.HP_mapif_broadcast_post ) { + int (*postHookFunc) (int retVal___, unsigned char *mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY, int *sfd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_broadcast_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_broadcast_post[hIndex].func; + retVal___ = postHookFunc(retVal___, mes, &len, &fontColor, &fontType, &fontSize, &fontAlign, &fontY, &sfd); + } + } + return retVal___; +} +int HP_mapif_wis_message(struct WisData *wd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_wis_message_pre ) { + int (*preHookFunc) (struct WisData *wd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_wis_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_wis_message_pre[hIndex].func; + retVal___ = preHookFunc(wd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.wis_message(wd); + } + if( HPMHooks.count.HP_mapif_wis_message_post ) { + int (*postHookFunc) (int retVal___, struct WisData *wd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_wis_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_wis_message_post[hIndex].func; + retVal___ = postHookFunc(retVal___, wd); + } + } + return retVal___; +} +void HP_mapif_wis_response(int fd, unsigned char *src, int flag) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_wis_response_pre ) { + void (*preHookFunc) (int *fd, unsigned char *src, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_wis_response_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_wis_response_pre[hIndex].func; + preHookFunc(&fd, src, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.wis_response(fd, src, flag); + } + if( HPMHooks.count.HP_mapif_wis_response_post ) { + void (*postHookFunc) (int *fd, unsigned char *src, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_wis_response_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_wis_response_post[hIndex].func; + postHookFunc(&fd, src, &flag); + } + } + return; +} +int HP_mapif_wis_end(struct WisData *wd, int flag) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_wis_end_pre ) { + int (*preHookFunc) (struct WisData *wd, int *flag); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_wis_end_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_wis_end_pre[hIndex].func; + retVal___ = preHookFunc(wd, &flag); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.wis_end(wd, flag); + } + if( HPMHooks.count.HP_mapif_wis_end_post ) { + int (*postHookFunc) (int retVal___, struct WisData *wd, int *flag); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_wis_end_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_wis_end_post[hIndex].func; + retVal___ = postHookFunc(retVal___, wd, &flag); + } + } + return retVal___; +} +int HP_mapif_account_reg_reply(int fd, int account_id, int char_id, int type) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_account_reg_reply_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *char_id, int *type); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_account_reg_reply_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_account_reg_reply_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &char_id, &type); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.account_reg_reply(fd, account_id, char_id, type); + } + if( HPMHooks.count.HP_mapif_account_reg_reply_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *char_id, int *type); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_account_reg_reply_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_account_reg_reply_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &char_id, &type); + } + } + return retVal___; +} +int HP_mapif_disconnectplayer(int fd, int account_id, int char_id, int reason) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_disconnectplayer_pre ) { + int (*preHookFunc) (int *fd, int *account_id, int *char_id, int *reason); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_disconnectplayer_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_disconnectplayer_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &account_id, &char_id, &reason); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.disconnectplayer(fd, account_id, char_id, reason); + } + if( HPMHooks.count.HP_mapif_disconnectplayer_post ) { + int (*postHookFunc) (int retVal___, int *fd, int *account_id, int *char_id, int *reason); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_disconnectplayer_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_disconnectplayer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, &account_id, &char_id, &reason); + } + } + return retVal___; +} +int HP_mapif_parse_broadcast(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_broadcast_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_broadcast_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_broadcast_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_broadcast(fd); + } + if( HPMHooks.count.HP_mapif_parse_broadcast_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_broadcast_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_broadcast_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_WisRequest(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_WisRequest_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_WisRequest_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_WisRequest_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_WisRequest(fd); + } + if( HPMHooks.count.HP_mapif_parse_WisRequest_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_WisRequest_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_WisRequest_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_WisReply(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_WisReply_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_WisReply_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_WisReply_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_WisReply(fd); + } + if( HPMHooks.count.HP_mapif_parse_WisReply_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_WisReply_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_WisReply_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_WisToGM(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_WisToGM_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_WisToGM_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_WisToGM_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_WisToGM(fd); + } + if( HPMHooks.count.HP_mapif_parse_WisToGM_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_WisToGM_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_WisToGM_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_Registry(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_Registry_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_Registry_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_Registry_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_Registry(fd); + } + if( HPMHooks.count.HP_mapif_parse_Registry_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_Registry_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_Registry_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +int HP_mapif_parse_RegistryRequest(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_RegistryRequest_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_RegistryRequest_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_RegistryRequest_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_RegistryRequest(fd); + } + if( HPMHooks.count.HP_mapif_parse_RegistryRequest_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_RegistryRequest_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_RegistryRequest_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} +void HP_mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, const char *name) { + int hIndex = 0; + if( HPMHooks.count.HP_mapif_namechange_ack_pre ) { + void (*preHookFunc) (int *fd, int *account_id, int *char_id, int *type, int *flag, const char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_namechange_ack_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_namechange_ack_pre[hIndex].func; + preHookFunc(&fd, &account_id, &char_id, &type, &flag, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mapif.namechange_ack(fd, account_id, char_id, type, flag, name); + } + if( HPMHooks.count.HP_mapif_namechange_ack_post ) { + void (*postHookFunc) (int *fd, int *account_id, int *char_id, int *type, int *flag, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_namechange_ack_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_namechange_ack_post[hIndex].func; + postHookFunc(&fd, &account_id, &char_id, &type, &flag, name); + } + } + return; +} +int HP_mapif_parse_NameChangeRequest(int fd) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_mapif_parse_NameChangeRequest_pre ) { + int (*preHookFunc) (int *fd); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_NameChangeRequest_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mapif_parse_NameChangeRequest_pre[hIndex].func; + retVal___ = preHookFunc(&fd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mapif.parse_NameChangeRequest(fd); + } + if( HPMHooks.count.HP_mapif_parse_NameChangeRequest_post ) { + int (*postHookFunc) (int retVal___, int *fd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mapif_parse_NameChangeRequest_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mapif_parse_NameChangeRequest_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd); + } + } + return retVal___; +} /* pincode */ void HP_pincode_handle(int fd, struct char_session_data *sd) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc index fd5d2d2bf..00700756c 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc @@ -4,4 +4,19 @@ // NOTE: This file was auto-generated and should never be manually edited, // as it will get overwritten. +memcpy(&HPMHooks.source.chr, chr, sizeof(struct char_interface)); +memcpy(&HPMHooks.source.geoip, geoip, sizeof(struct geoip_interface)); +memcpy(&HPMHooks.source.inter_auction, inter_auction, sizeof(struct inter_auction_interface)); +memcpy(&HPMHooks.source.inter_elemental, inter_elemental, sizeof(struct inter_elemental_interface)); +memcpy(&HPMHooks.source.inter_guild, inter_guild, sizeof(struct inter_guild_interface)); +memcpy(&HPMHooks.source.inter_homunculus, inter_homunculus, sizeof(struct inter_homunculus_interface)); +memcpy(&HPMHooks.source.inter, inter, sizeof(struct inter_interface)); +memcpy(&HPMHooks.source.inter_mail, inter_mail, sizeof(struct inter_mail_interface)); +memcpy(&HPMHooks.source.inter_mercenary, inter_mercenary, sizeof(struct inter_mercenary_interface)); +memcpy(&HPMHooks.source.inter_party, inter_party, sizeof(struct inter_party_interface)); +memcpy(&HPMHooks.source.inter_pet, inter_pet, sizeof(struct inter_pet_interface)); +memcpy(&HPMHooks.source.inter_quest, inter_quest, sizeof(struct inter_quest_interface)); +memcpy(&HPMHooks.source.inter_storage, inter_storage, sizeof(struct inter_storage_interface)); +memcpy(&HPMHooks.source.loginif, loginif, sizeof(struct loginif_interface)); +memcpy(&HPMHooks.source.mapif, mapif, sizeof(struct mapif_interface)); memcpy(&HPMHooks.source.pincode, pincode, sizeof(struct pincode_interface)); diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index 5c93edb84..802d1015a 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -28,7 +28,7 @@ HPMHOOKING = $(addprefix HPMHooking_, login char map) ALLPLUGINS = $(filter-out HPMHooking, $(basename $(wildcard *.c))) $(HPMHOOKING) # Plugins that will be built through 'make plugins' or 'make all' -PLUGINS = sample db2sql HPMHooking_login HPMHooking_map $(MYPLUGINS) +PLUGINS = sample db2sql HPMHooking_char HPMHooking_login HPMHooking_map $(MYPLUGINS) COMMON_D = ../common COMMON_H = $(wildcard $(COMMON_D)/*.h) diff --git a/src/plugins/sample.c b/src/plugins/sample.c index 88ef84d48..a2bf2c1bc 100644 --- a/src/plugins/sample.c +++ b/src/plugins/sample.c @@ -19,7 +19,7 @@ HPExport struct hplugin_info pinfo = { "Sample", // Plugin name - SERVER_TYPE_LOGIN|SERVER_TYPE_MAP,// Which server types this plugin works with? + SERVER_TYPE_CHAR|SERVER_TYPE_LOGIN|SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated) }; diff --git a/tools/HPMHookGen/HPMDataCheckGen.pl b/tools/HPMHookGen/HPMDataCheckGen.pl index f950152d1..01728341d 100644 --- a/tools/HPMHookGen/HPMDataCheckGen.pl +++ b/tools/HPMHookGen/HPMDataCheckGen.pl @@ -20,17 +20,18 @@ my %out; foreach my $file (@files) { my $xml = new XML::Simple; - my $data = $xml->XMLin($file); - next unless $data->{compounddef}->{includes}; # means its a struct from a .c file, plugins cant access those so we don't care. - next if $data->{compounddef}->{compoundname} =~ /::/; # its a duplicate with a :: name e.g. struct script_state {<...>} ay; - my @filepath = split(/[\/\\]/, $data->{compounddef}->{location}->{file}); + my $data = $xml->XMLin($file, ForceArray => 1); + my $filekey = (keys $data->{compounddef})[0]; + next unless $data->{compounddef}->{$filekey}->{includes}; # means its a struct from a .c file, plugins cant access those so we don't care. + next if $data->{compounddef}->{$filekey}->{compoundname}->[0] =~ /::/; # its a duplicate with a :: name e.g. struct script_state {<...>} ay; + my @filepath = split(/[\/\\]/, $data->{compounddef}->{$filekey}->{location}->[0]->{file}); my $foldername = uc($filepath[-2]); my $filename = uc($filepath[-1]); $filename =~ s/-/_/g; $filename =~ s/\.[^.]*$//; my $plugintypes = 'SERVER_TYPE_UNKNOWN'; $plugintypes = 'SERVER_TYPE_ALL' if $foldername eq 'COMMON'; $plugintypes = "SERVER_TYPE_${foldername}" if $foldername =~ /^(LOGIN|CHAR|MAP)/; my $symboldata = { - name => $data->{compounddef}->{compoundname}, + name => $data->{compounddef}->{$filekey}->{compoundname}->[0], type => $plugintypes, }; my $name = "${foldername}_${filename}_H"; diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl index 71bd8f245..3daf742bc 100755 --- a/tools/HPMHookGen/HPMHookGen.pl +++ b/tools/HPMHookGen/HPMHookGen.pl @@ -258,13 +258,14 @@ my %keys = ( foreach my $file (@files) { # Loop through the xml files my $xml = new XML::Simple; - my $data = $xml->XMLin($file); + my $data = $xml->XMLin($file, ForceArray => 1); - my $loc = $data->{compounddef}->{location}; + my $filekey = (keys $data->{compounddef})[0]; + my $loc = $data->{compounddef}->{$filekey}->{location}->[0]; next unless $loc->{file} =~ /src\/(map|char|login)\//; my $servertype = $1; - my $key = $data->{compounddef}->{compoundname}; + my $key = $data->{compounddef}->{$filekey}->{compoundname}->[0]; my $original = $key; # Some known interfaces with different names @@ -272,6 +273,8 @@ foreach my $file (@files) { # Loop through the xml files $key = "bg"; } elsif ($key =~ /guild_storage/) { $key = "gstorage"; + } elsif ($key =~ /inter_homunculus/) { # to avoid replace to homun + $key = "inter_homunculus"; } elsif ($key =~ /homunculus/) { $key = "homun"; } elsif ($key =~ /irc_bot/) { @@ -280,23 +283,23 @@ foreach my $file (@files) { # Loop through the xml files $key = "logs"; } elsif ($key =~ /pc_groups_interface/) { $key = "pcg"; + } elsif ($key =~ /char_interface/) { + $key = "chr"; } else { $key =~ s/_interface//; } - foreach my $v ($data->{compounddef}->{sectiondef}) { # Loop through the sections + foreach my $v ($data->{compounddef}->{$filekey}->{sectiondef}->[0]) { # Loop through the sections my $memberdef = $v->{memberdef}; - foreach my $fk (sort { # Sort the members in declaration order according to what the xml says - my $astart = $memberdef->{$a}->{location}->{bodystart} || $memberdef->{$a}->{location}->{line}; - my $bstart = $memberdef->{$b}->{location}->{bodystart} || $memberdef->{$b}->{location}->{line}; + foreach my $f (sort { # Sort the members in declaration order according to what the xml says + my $astart = $a->{location}->[0]->{bodystart} || $a->{location}->[0]->{line}; + my $bstart = $b->{location}->[0]->{bodystart} || $b->{location}->[0]->{line}; $astart <=> $bstart - } keys %$memberdef) { # Loop through the members - my $f = $memberdef->{$fk}; - - my $t = $f->{argsstring}; + } @$memberdef) { # Loop through the members + my $t = $f->{argsstring}->[0]; next unless ref $t ne 'HASH' and $t =~ /^[^\[]/; # If it's not a string, or if it starts with an array subscript, we can skip it - my $if = parse($t, $f->{definition}); + my $if = parse($t, $f->{definition}->[0]); next unless scalar keys %$if; # If it returns an empty hash reference, an error must've occurred # Skip variadic functions, we only allow hooks on their arglist equivalents. diff --git a/vcproj-10/char-server.vcxproj b/vcproj-10/char-server.vcxproj index 6b2fc82cd..9659e7c56 100644 --- a/vcproj-10/char-server.vcxproj +++ b/vcproj-10/char-server.vcxproj @@ -137,7 +137,6 @@ <ClInclude Include="..\3rdparty\libconfig\strbuf.h" /> <ClInclude Include="..\3rdparty\libconfig\wincompat.h" /> <ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h" /> - <ClInclude Include="..\src\char\HPMchar.h" /> <ClInclude Include="..\src\common\cbasetypes.h" /> <ClInclude Include="..\src\common\conf.h" /> <ClInclude Include="..\src\common\core.h" /> @@ -154,13 +153,16 @@ <ClInclude Include="..\src\common\random.h" /> <ClInclude Include="..\src\common\showmsg.h" /> <ClInclude Include="..\src\common\socket.h" /> - <ClInclude Include="..\src\common\sysinfo.h" /> <ClInclude Include="..\src\common\sql.h" /> <ClInclude Include="..\src\common\strlib.h" /> + <ClInclude Include="..\src\common\sysinfo.h" /> <ClInclude Include="..\src\common\thread.h" /> <ClInclude Include="..\src\common\timer.h" /> <ClInclude Include="..\src\common\utils.h" /> + <ClInclude Include="..\src\common\winapi.h" /> + <ClInclude Include="..\src\char\HPMchar.h" /> <ClInclude Include="..\src\char\char.h" /> + <ClInclude Include="..\src\char\geoip.h" /> <ClInclude Include="..\src\char\int_auction.h" /> <ClInclude Include="..\src\char\int_elemental.h" /> <ClInclude Include="..\src\char\int_guild.h" /> @@ -172,8 +174,9 @@ <ClInclude Include="..\src\char\int_quest.h" /> <ClInclude Include="..\src\char\int_storage.h" /> <ClInclude Include="..\src\char\inter.h" /> + <ClInclude Include="..\src\char\loginif.h" /> + <ClInclude Include="..\src\char\mapif.h" /> <ClInclude Include="..\src\char\pincode.h" /> - <ClInclude Include="..\src\common\winapi.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\3rdparty\libconfig\grammar.c" /> @@ -182,7 +185,6 @@ <ClCompile Include="..\3rdparty\libconfig\scanner.c" /> <ClCompile Include="..\3rdparty\libconfig\strbuf.c" /> <ClCompile Include="..\3rdparty\mt19937ar\mt19937ar.c" /> - <ClCompile Include="..\src\char\HPMchar.c" /> <ClCompile Include="..\src\common\conf.c" /> <ClCompile Include="..\src\common\core.c" /> <ClCompile Include="..\src\common\console.c" /> @@ -202,7 +204,9 @@ <ClCompile Include="..\src\common\thread.c" /> <ClCompile Include="..\src\common\timer.c" /> <ClCompile Include="..\src\common\utils.c" /> + <ClCompile Include="..\src\char\HPMchar.c" /> <ClCompile Include="..\src\char\char.c" /> + <ClCompile Include="..\src\char\geoip.c" /> <ClCompile Include="..\src\char\int_auction.c" /> <ClCompile Include="..\src\char\int_elemental.c" /> <ClCompile Include="..\src\char\int_guild.c" /> @@ -214,6 +218,8 @@ <ClCompile Include="..\src\char\int_quest.c" /> <ClCompile Include="..\src\char\int_storage.c" /> <ClCompile Include="..\src\char\inter.c" /> + <ClCompile Include="..\src\char\loginif.c" /> + <ClCompile Include="..\src\char\mapif.c" /> <ClCompile Include="..\src\char\pincode.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> diff --git a/vcproj-10/char-server.vcxproj.filters b/vcproj-10/char-server.vcxproj.filters index b674bcd9b..b3b9e49cd 100644 --- a/vcproj-10/char-server.vcxproj.filters +++ b/vcproj-10/char-server.vcxproj.filters @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> + <ClCompile Include="..\src\common\conf.c"> + <Filter>common</Filter> + </ClCompile> <ClCompile Include="..\src\common\core.c"> <Filter>common</Filter> </ClCompile> @@ -49,9 +52,15 @@ <ClCompile Include="..\src\common\utils.c"> <Filter>common</Filter> </ClCompile> + <ClCompile Include="..\src\char\HPMchar.c"> + <Filter>char_sql</Filter> + </ClCompile> <ClCompile Include="..\src\char\char.c"> <Filter>char_sql</Filter> </ClCompile> + <ClCompile Include="..\src\char\geoip.c"> + <Filter>char_sql</Filter> + </ClCompile> <ClCompile Include="..\src\char\int_auction.c"> <Filter>char_sql</Filter> </ClCompile> @@ -85,6 +94,12 @@ <ClCompile Include="..\src\char\inter.c"> <Filter>char_sql</Filter> </ClCompile> + <ClCompile Include="..\src\char\loginif.c"> + <Filter>char_sql</Filter> + </ClCompile> + <ClCompile Include="..\src\char\mapif.c"> + <Filter>char_sql</Filter> + </ClCompile> <ClCompile Include="..\src\char\pincode.c"> <Filter>char_sql</Filter> </ClCompile> @@ -112,17 +127,14 @@ <ClCompile Include="..\src\common\mutex.c"> <Filter>common</Filter> </ClCompile> - <ClCompile Include="..\src\common\conf.c"> - <Filter>common</Filter> - </ClCompile> - <ClCompile Include="..\src\char\HPMchar.c"> - <Filter>char_sql</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\src\common\cbasetypes.h"> <Filter>common</Filter> </ClInclude> + <ClInclude Include="..\src\common\conf.h"> + <Filter>common</Filter> + </ClInclude> <ClInclude Include="..\src\common\core.h"> <Filter>common</Filter> </ClInclude> @@ -177,13 +189,13 @@ <ClInclude Include="..\src\common\utils.h"> <Filter>common</Filter> </ClInclude> - <ClInclude Include="..\src\char\inter.h"> + <ClInclude Include="..\src\char\HPMchar.h"> <Filter>char_sql</Filter> </ClInclude> - <ClInclude Include="..\src\char\pincode.h"> + <ClInclude Include="..\src\char\char.h"> <Filter>char_sql</Filter> </ClInclude> - <ClInclude Include="..\src\char\char.h"> + <ClInclude Include="..\src\char\geoip.h"> <Filter>char_sql</Filter> </ClInclude> <ClInclude Include="..\src\char\int_auction.h"> @@ -216,6 +228,18 @@ <ClInclude Include="..\src\char\int_storage.h"> <Filter>char_sql</Filter> </ClInclude> + <ClInclude Include="..\src\char\inter.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\loginif.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\mapif.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\pincode.h"> + <Filter>char_sql</Filter> + </ClInclude> <ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h"> <Filter>3rdparty\mt19937ar</Filter> </ClInclude> @@ -249,12 +273,6 @@ <ClInclude Include="..\src\common\mutex.h"> <Filter>common</Filter> </ClInclude> - <ClInclude Include="..\src\common\conf.h"> - <Filter>common</Filter> - </ClInclude> - <ClInclude Include="..\src\char\HPMchar.h"> - <Filter>char_sql</Filter> - </ClInclude> </ItemGroup> <ItemGroup> <Filter Include="common"> diff --git a/vcproj-11/char-server.vcxproj b/vcproj-11/char-server.vcxproj index f3f75d663..08b4ed856 100644 --- a/vcproj-11/char-server.vcxproj +++ b/vcproj-11/char-server.vcxproj @@ -141,9 +141,9 @@ <ClInclude Include="..\3rdparty\libconfig\wincompat.h" /> <ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h" /> <ClInclude Include="..\src\common\cbasetypes.h" /> - <ClInclude Include="..\src\common\conf.h" /> + <ClInclude Include="..\src\common\conf.h" /> <ClInclude Include="..\src\common\core.h" /> - <ClInclude Include="..\src\common\console.h" /> + <ClInclude Include="..\src\common\console.h" /> <ClInclude Include="..\src\common\db.h" /> <ClInclude Include="..\src\common\ers.h" /> <ClInclude Include="..\src\common\HPM.h" /> @@ -162,8 +162,10 @@ <ClInclude Include="..\src\common\thread.h" /> <ClInclude Include="..\src\common\timer.h" /> <ClInclude Include="..\src\common\utils.h" /> + <ClInclude Include="..\src\common\winapi.h" /> + <ClInclude Include="..\src\char\HPMchar.h" /> <ClInclude Include="..\src\char\char.h" /> - <ClInclude Include="..\src\char\HPMchar.h" /> + <ClInclude Include="..\src\char\geoip.h" /> <ClInclude Include="..\src\char\int_auction.h" /> <ClInclude Include="..\src\char\int_elemental.h" /> <ClInclude Include="..\src\char\int_guild.h" /> @@ -175,8 +177,9 @@ <ClInclude Include="..\src\char\int_quest.h" /> <ClInclude Include="..\src\char\int_storage.h" /> <ClInclude Include="..\src\char\inter.h" /> - <ClInclude Include="..\src\char\pincode.h" /> - <ClInclude Include="..\src\common\winapi.h" /> + <ClInclude Include="..\src\char\loginif.h" /> + <ClInclude Include="..\src\char\mapif.h" /> + <ClInclude Include="..\src\char\pincode.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\3rdparty\libconfig\grammar.c" /> @@ -185,9 +188,9 @@ <ClCompile Include="..\3rdparty\libconfig\scanner.c" /> <ClCompile Include="..\3rdparty\libconfig\strbuf.c" /> <ClCompile Include="..\3rdparty\mt19937ar\mt19937ar.c" /> - <ClCompile Include="..\src\common\conf.c" /> + <ClCompile Include="..\src\common\conf.c" /> <ClCompile Include="..\src\common\core.c" /> - <ClCompile Include="..\src\common\console.c" /> + <ClCompile Include="..\src\common\console.c" /> <ClCompile Include="..\src\common\db.c" /> <ClCompile Include="..\src\common\ers.c" /> <ClCompile Include="..\src\common\HPM.c" /> @@ -204,8 +207,9 @@ <ClCompile Include="..\src\common\thread.c" /> <ClCompile Include="..\src\common\timer.c" /> <ClCompile Include="..\src\common\utils.c" /> + <ClCompile Include="..\src\char\HPMchar.c" /> <ClCompile Include="..\src\char\char.c" /> - <ClCompile Include="..\src\char\HPMchar.c" /> + <ClCompile Include="..\src\char\geoip.c" /> <ClCompile Include="..\src\char\int_auction.c" /> <ClCompile Include="..\src\char\int_elemental.c" /> <ClCompile Include="..\src\char\int_guild.c" /> @@ -217,7 +221,9 @@ <ClCompile Include="..\src\char\int_quest.c" /> <ClCompile Include="..\src\char\int_storage.c" /> <ClCompile Include="..\src\char\inter.c" /> - <ClCompile Include="..\src\char\pincode.c" /> + <ClCompile Include="..\src\char\loginif.c" /> + <ClCompile Include="..\src\char\mapif.c" /> + <ClCompile Include="..\src\char\pincode.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/vcproj-11/char-server.vcxproj.filters b/vcproj-11/char-server.vcxproj.filters index c7d498190..b3b9e49cd 100644 --- a/vcproj-11/char-server.vcxproj.filters +++ b/vcproj-11/char-server.vcxproj.filters @@ -7,7 +7,7 @@ <ClCompile Include="..\src\common\core.c"> <Filter>common</Filter> </ClCompile> - <ClCompile Include="..\src\common\console.c"> + <ClCompile Include="..\src\common\console.c"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\src\common\db.c"> @@ -52,10 +52,13 @@ <ClCompile Include="..\src\common\utils.c"> <Filter>common</Filter> </ClCompile> + <ClCompile Include="..\src\char\HPMchar.c"> + <Filter>char_sql</Filter> + </ClCompile> <ClCompile Include="..\src\char\char.c"> <Filter>char_sql</Filter> </ClCompile> - <ClCompile Include="..\src\char\HPMchar.c"> + <ClCompile Include="..\src\char\geoip.c"> <Filter>char_sql</Filter> </ClCompile> <ClCompile Include="..\src\char\int_auction.c"> @@ -91,7 +94,13 @@ <ClCompile Include="..\src\char\inter.c"> <Filter>char_sql</Filter> </ClCompile> - <ClCompile Include="..\src\char\pincode.c"> + <ClCompile Include="..\src\char\loginif.c"> + <Filter>char_sql</Filter> + </ClCompile> + <ClCompile Include="..\src\char\mapif.c"> + <Filter>char_sql</Filter> + </ClCompile> + <ClCompile Include="..\src\char\pincode.c"> <Filter>char_sql</Filter> </ClCompile> <ClCompile Include="..\3rdparty\mt19937ar\mt19937ar.c"> @@ -129,7 +138,7 @@ <ClInclude Include="..\src\common\core.h"> <Filter>common</Filter> </ClInclude> - <ClInclude Include="..\src\common\console.h"> + <ClInclude Include="..\src\common\console.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\src\common\db.h"> @@ -180,16 +189,13 @@ <ClInclude Include="..\src\common\utils.h"> <Filter>common</Filter> </ClInclude> - <ClInclude Include="..\src\char\inter.h"> - <Filter>char_sql</Filter> - </ClInclude> - <ClInclude Include="..\src\char\pincode.h"> + <ClInclude Include="..\src\char\HPMchar.h"> <Filter>char_sql</Filter> </ClInclude> <ClInclude Include="..\src\char\char.h"> <Filter>char_sql</Filter> </ClInclude> - <ClInclude Include="..\src\char\HPMchar.h"> + <ClInclude Include="..\src\char\geoip.h"> <Filter>char_sql</Filter> </ClInclude> <ClInclude Include="..\src\char\int_auction.h"> @@ -222,6 +228,18 @@ <ClInclude Include="..\src\char\int_storage.h"> <Filter>char_sql</Filter> </ClInclude> + <ClInclude Include="..\src\char\inter.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\loginif.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\mapif.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\pincode.h"> + <Filter>char_sql</Filter> + </ClInclude> <ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h"> <Filter>3rdparty\mt19937ar</Filter> </ClInclude> diff --git a/vcproj-12/char-server.vcxproj b/vcproj-12/char-server.vcxproj index 973d9d781..e7473369d 100644 --- a/vcproj-12/char-server.vcxproj +++ b/vcproj-12/char-server.vcxproj @@ -161,8 +161,10 @@ <ClInclude Include="..\src\common\thread.h" /> <ClInclude Include="..\src\common\timer.h" /> <ClInclude Include="..\src\common\utils.h" /> - <ClInclude Include="..\src\char\char.h" /> + <ClInclude Include="..\src\common\winapi.h" /> <ClInclude Include="..\src\char\HPMchar.h" /> + <ClInclude Include="..\src\char\char.h" /> + <ClInclude Include="..\src\char\geoip.h" /> <ClInclude Include="..\src\char\int_auction.h" /> <ClInclude Include="..\src\char\int_elemental.h" /> <ClInclude Include="..\src\char\int_guild.h" /> @@ -174,8 +176,9 @@ <ClInclude Include="..\src\char\int_quest.h" /> <ClInclude Include="..\src\char\int_storage.h" /> <ClInclude Include="..\src\char\inter.h" /> + <ClInclude Include="..\src\char\loginif.h" /> + <ClInclude Include="..\src\char\mapif.h" /> <ClInclude Include="..\src\char\pincode.h" /> - <ClInclude Include="..\src\common\winapi.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\3rdparty\libconfig\grammar.c" /> @@ -203,8 +206,9 @@ <ClCompile Include="..\src\common\thread.c" /> <ClCompile Include="..\src\common\timer.c" /> <ClCompile Include="..\src\common\utils.c" /> - <ClCompile Include="..\src\char\char.c" /> <ClCompile Include="..\src\char\HPMchar.c" /> + <ClCompile Include="..\src\char\char.c" /> + <ClCompile Include="..\src\char\geoip.c" /> <ClCompile Include="..\src\char\int_auction.c" /> <ClCompile Include="..\src\char\int_elemental.c" /> <ClCompile Include="..\src\char\int_guild.c" /> @@ -216,6 +220,8 @@ <ClCompile Include="..\src\char\int_quest.c" /> <ClCompile Include="..\src\char\int_storage.c" /> <ClCompile Include="..\src\char\inter.c" /> + <ClCompile Include="..\src\char\loginif.c" /> + <ClCompile Include="..\src\char\mapif.c" /> <ClCompile Include="..\src\char\pincode.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> diff --git a/vcproj-12/char-server.vcxproj.filters b/vcproj-12/char-server.vcxproj.filters index c7d498190..b3b9e49cd 100644 --- a/vcproj-12/char-server.vcxproj.filters +++ b/vcproj-12/char-server.vcxproj.filters @@ -7,7 +7,7 @@ <ClCompile Include="..\src\common\core.c"> <Filter>common</Filter> </ClCompile> - <ClCompile Include="..\src\common\console.c"> + <ClCompile Include="..\src\common\console.c"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\src\common\db.c"> @@ -52,10 +52,13 @@ <ClCompile Include="..\src\common\utils.c"> <Filter>common</Filter> </ClCompile> + <ClCompile Include="..\src\char\HPMchar.c"> + <Filter>char_sql</Filter> + </ClCompile> <ClCompile Include="..\src\char\char.c"> <Filter>char_sql</Filter> </ClCompile> - <ClCompile Include="..\src\char\HPMchar.c"> + <ClCompile Include="..\src\char\geoip.c"> <Filter>char_sql</Filter> </ClCompile> <ClCompile Include="..\src\char\int_auction.c"> @@ -91,7 +94,13 @@ <ClCompile Include="..\src\char\inter.c"> <Filter>char_sql</Filter> </ClCompile> - <ClCompile Include="..\src\char\pincode.c"> + <ClCompile Include="..\src\char\loginif.c"> + <Filter>char_sql</Filter> + </ClCompile> + <ClCompile Include="..\src\char\mapif.c"> + <Filter>char_sql</Filter> + </ClCompile> + <ClCompile Include="..\src\char\pincode.c"> <Filter>char_sql</Filter> </ClCompile> <ClCompile Include="..\3rdparty\mt19937ar\mt19937ar.c"> @@ -129,7 +138,7 @@ <ClInclude Include="..\src\common\core.h"> <Filter>common</Filter> </ClInclude> - <ClInclude Include="..\src\common\console.h"> + <ClInclude Include="..\src\common\console.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\src\common\db.h"> @@ -180,16 +189,13 @@ <ClInclude Include="..\src\common\utils.h"> <Filter>common</Filter> </ClInclude> - <ClInclude Include="..\src\char\inter.h"> - <Filter>char_sql</Filter> - </ClInclude> - <ClInclude Include="..\src\char\pincode.h"> + <ClInclude Include="..\src\char\HPMchar.h"> <Filter>char_sql</Filter> </ClInclude> <ClInclude Include="..\src\char\char.h"> <Filter>char_sql</Filter> </ClInclude> - <ClInclude Include="..\src\char\HPMchar.h"> + <ClInclude Include="..\src\char\geoip.h"> <Filter>char_sql</Filter> </ClInclude> <ClInclude Include="..\src\char\int_auction.h"> @@ -222,6 +228,18 @@ <ClInclude Include="..\src\char\int_storage.h"> <Filter>char_sql</Filter> </ClInclude> + <ClInclude Include="..\src\char\inter.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\loginif.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\mapif.h"> + <Filter>char_sql</Filter> + </ClInclude> + <ClInclude Include="..\src\char\pincode.h"> + <Filter>char_sql</Filter> + </ClInclude> <ClInclude Include="..\3rdparty\mt19937ar\mt19937ar.h"> <Filter>3rdparty\mt19937ar</Filter> </ClInclude> diff --git a/vcproj-9/char-server.vcproj b/vcproj-9/char-server.vcproj index a532db231..bed338264 100644 --- a/vcproj-9/char-server.vcproj +++ b/vcproj-9/char-server.vcproj @@ -461,6 +461,30 @@ > </File> <File + RelativePath="..\src\char\loginif.c" + > + </File> + <File + RelativePath="..\src\char\loginif.h" + > + </File> + <File + RelativePath="..\src\char\mapif.c" + > + </File> + <File + RelativePath="..\src\char\mapif.h" + > + </File> + <File + RelativePath="..\src\char\geoip.c" + > + </File> + <File + RelativePath="..\src\char\geoip.h" + > + </File> + <File RelativePath="..\src\char\int_auction.c" > </File> |