diff options
author | shennetsind <ind@henn.et> | 2013-09-28 14:15:37 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-09-28 14:15:37 -0300 |
commit | 5fb0a480b35b58636f6314a193961541d06177b7 (patch) | |
tree | 406f75d91fcdf722b32b3f9dbff75a69e6d230f6 | |
parent | 8bed1531de1deceae20e09bc2d59470f586a94f6 (diff) | |
download | hercules-5fb0a480b35b58636f6314a193961541d06177b7.tar.gz hercules-5fb0a480b35b58636f6314a193961541d06177b7.tar.bz2 hercules-5fb0a480b35b58636f6314a193961541d06177b7.tar.xz hercules-5fb0a480b35b58636f6314a193961541d06177b7.zip |
HPM: Intif.c Completed
Moved missing vars and declarations of interest into the interface.
Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r-- | src/map/intif.c | 665 | ||||
-rw-r--r-- | src/map/intif.h | 104 |
2 files changed, 385 insertions, 384 deletions
diff --git a/src/map/intif.c b/src/map/intif.c index 97ff8a681..e42679ec6 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -33,18 +33,7 @@ #include <string.h> -static const int packet_len_table[]={ - -1,-1,27,-1, -1, 0,37,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f - 0, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810 - 39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820 - 10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830 - -1, 0, 0,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840 - -1,-1, 7, 7, 7,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] - -1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish] - -1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, 0, //0x3870 Mercenaries [Zephyrus] / Elemental [pakpil] - 11,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880 - -1,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator] -}; +struct intif_interface intif_s; #define inter_fd chrif->fd // alias @@ -850,7 +839,7 @@ int intif_homunculus_requestdelete(int homun_id) // Packets receive from inter server // Wisp/Page reception // rewritten by [Yor] -int intif_parse_WisMessage(int fd) { +void intif_parse_WisMessage(int fd) { struct map_session_data* sd; char *wisp_source; char name[NAME_LENGTH]; @@ -863,11 +852,11 @@ int intif_parse_WisMessage(int fd) { if(sd == NULL || strcmp(sd->status.name, name) != 0) { //Not found intif_wis_replay(id,1); - return 0; + return; } if(sd->state.ignoreAll) { intif_wis_replay(id, 2); - return 0; + return; } wisp_source = (char *) RFIFOP(fd,8); // speed up [Yor] for(i=0; i < MAX_IGNORE_LIST && @@ -878,17 +867,15 @@ int intif_parse_WisMessage(int fd) { if (i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0') { //Ignored intif_wis_replay(id, 2); - return 0; + return; } //Success to send whisper. clif->wis_message(sd->fd, wisp_source, (char*)RFIFOP(fd,56),RFIFOW(fd,2)-56); intif_wis_replay(id,0); // succes - return 0; } // Wisp/page transmission result reception -int intif_parse_WisEnd(int fd) -{ +void intif_parse_WisEnd(int fd) { struct map_session_data* sd; if (battle_config.etc_log) @@ -897,11 +884,10 @@ int intif_parse_WisEnd(int fd) if (sd != NULL) clif->wis_end(sd->fd, RFIFOB(fd,26)); - return 0; + return; } -static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) -{ +int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) { int permission = va_arg(va, int); char *wisp_name; char *message; @@ -918,7 +904,7 @@ static int mapif_parse_WisToGM_sub(struct map_session_data* sd,va_list va) // Received wisp message from map-server via char-server for ALL gm // 0x3003/0x3803 <packet_len>.w <wispname>.24B <permission>.l <message>.?B -int mapif_parse_WisToGM(int fd) +void mapif_parse_WisToGM(int fd) { int permission, mes_len; char Wisp_name[NAME_LENGTH]; @@ -936,11 +922,10 @@ int mapif_parse_WisToGM(int fd) if (message != mbuf) aFree(message); - return 0; } // Request player registre -int intif_parse_Registers(int fd) +void intif_parse_Registers(int fd) { int j,p,len,max, flag; struct map_session_data *sd; @@ -955,7 +940,7 @@ int intif_parse_Registers(int fd) if (sd && RFIFOB(fd,12) == 3 && sd->status.char_id != char_id) sd = NULL; //Character registry from another character. } - if (!sd) return 1; + if (!sd) return; flag = (sd->save_reg.global_num == -1 || sd->save_reg.account_num == -1 || sd->save_reg.account2_num == -1); @@ -977,7 +962,7 @@ int intif_parse_Registers(int fd) break; default: ShowError("intif_parse_Registers: Unrecognized type %d\n",RFIFOB(fd,12)); - return 0; + return; } for(j=0,p=13;j<max && p<RFIFOW(fd,2);j++){ sscanf((char*)RFIFOP(fd,p), "%31c%n", reg[j].str,&len); @@ -991,10 +976,9 @@ int intif_parse_Registers(int fd) if (flag && sd->save_reg.global_num > -1 && sd->save_reg.account_num > -1 && sd->save_reg.account2_num > -1) pc->reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex] - return 1; } -int intif_parse_LoadGuildStorage(int fd) +void intif_parse_LoadGuildStorage(int fd) { struct guild_storage *gstor; struct map_session_data *sd; @@ -1002,168 +986,143 @@ int intif_parse_LoadGuildStorage(int fd) guild_id = RFIFOL(fd,8); if(guild_id <= 0) - return 1; + return; sd=map->id2sd( RFIFOL(fd,4) ); if(sd==NULL){ ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); - return 1; + return; } gstor=gstorage->id2storage(guild_id); if(!gstor) { ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id); - return 1; + return; } if (gstor->storage_status == 1) { // Already open.. lets ignore this update ShowWarning("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); - return 1; + return; } if (gstor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex] ShowWarning("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); - return 1; + return; } if( RFIFOW(fd,2)-12 != sizeof(struct guild_storage) ){ ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-12 , sizeof(struct guild_storage)); gstor->storage_status = 0; - return 1; + return; } memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage)); gstorage->open(sd); - return 0; } // ACK guild_storage saved -int intif_parse_SaveGuildStorage(int fd) +void intif_parse_SaveGuildStorage(int fd) { gstorage->saved(/*RFIFOL(fd,2), */RFIFOL(fd,6)); - return 0; } // ACK party creation -int intif_parse_PartyCreated(int fd) +void intif_parse_PartyCreated(int fd) { if(battle_config.etc_log) ShowInfo("intif: party created by account %d\n\n", RFIFOL(fd,2)); party->created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15)); - return 0; } // Receive party info -int intif_parse_PartyInfo(int fd) +void intif_parse_PartyInfo(int fd) { if( RFIFOW(fd,2) == 12 ){ ShowWarning("intif: party noinfo (char_id=%d party_id=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8)); party->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4)); - return 0; + return; } if( RFIFOW(fd,2) != 8+sizeof(struct party) ) ShowError("intif: party info : data size error (char_id=%d party_id=%d packet_len=%d expected_len=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party)); party->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4)); - return 0; } // ACK adding party member -int intif_parse_PartyMemberAdded(int fd) +void intif_parse_PartyMemberAdded(int fd) { if(battle_config.etc_log) ShowInfo("intif: party member added Party (%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); party->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14)); - return 0; } // ACK changing party option -int intif_parse_PartyOptionChanged(int fd) +void intif_parse_PartyOptionChanged(int fd) { party->optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14)); - return 0; } // ACK member leaving party -int intif_parse_PartyMemberWithdraw(int fd) +void intif_parse_PartyMemberWithdraw(int fd) { if(battle_config.etc_log) ShowInfo("intif: party member withdraw: Party(%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); party->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); - return 0; } // ACK party break -int intif_parse_PartyBroken(int fd) -{ +void intif_parse_PartyBroken(int fd) { party->broken(RFIFOL(fd,2)); - return 0; } // ACK party on new map -int intif_parse_PartyMove(int fd) +void intif_parse_PartyMove(int fd) { party->recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17)); - return 0; } // ACK party messages -int intif_parse_PartyMessage(int fd) -{ +void intif_parse_PartyMessage(int fd) { party->recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12); - return 0; } // ACK guild creation -int intif_parse_GuildCreated(int fd) -{ +void intif_parse_GuildCreated(int fd) { guild->created(RFIFOL(fd,2),RFIFOL(fd,6)); - return 0; } // ACK guild infos -int intif_parse_GuildInfo(int fd) -{ +void intif_parse_GuildInfo(int fd) { if(RFIFOW(fd,2) == 8) { ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4)); guild->recv_noinfo(RFIFOL(fd,4)); - return 0; + return; } if( RFIFOW(fd,2)!=sizeof(struct guild)+4 ) ShowError("intif: guild info : data size error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4); guild->recv_info((struct guild *)RFIFOP(fd,4)); - return 0; } // ACK adding guild member -int intif_parse_GuildMemberAdded(int fd) -{ +void intif_parse_GuildMemberAdded(int fd) { if(battle_config.etc_log) ShowInfo("intif: guild member added %d %d %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14)); guild->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14)); - return 0; } // ACK member leaving guild -int intif_parse_GuildMemberWithdraw(int fd) -{ +void intif_parse_GuildMemberWithdraw(int fd) { guild->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(char *)RFIFOP(fd,55),(char *)RFIFOP(fd,15)); - return 0; } // ACK guild member basic info -int intif_parse_GuildMemberInfoShort(int fd) -{ +void intif_parse_GuildMemberInfoShort(int fd) { guild->recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); - return 0; } // ACK guild break -int intif_parse_GuildBroken(int fd) -{ +void intif_parse_GuildBroken(int fd) { guild->broken(RFIFOL(fd,2),RFIFOB(fd,6)); - return 0; } // basic guild info change notice // 0x3839 <packet len>.w <guild id>.l <type>.w <data>.?b -int intif_parse_GuildBasicInfoChanged(int fd) -{ +void intif_parse_GuildBasicInfoChanged(int fd) { //int len = RFIFOW(fd,2) - 10; int guild_id = RFIFOL(fd,4); int type = RFIFOW(fd,8); @@ -1171,21 +1130,18 @@ int intif_parse_GuildBasicInfoChanged(int fd) struct guild* g = guild->search(guild_id); if( g == NULL ) - return 0; + return; switch(type) { - case GBI_EXP: g->exp = RFIFOQ(fd,10); break; - case GBI_GUILDLV: g->guild_lv = RFIFOW(fd,10); break; - case GBI_SKILLPOINT: g->skill_point = RFIFOL(fd,10); break; + case GBI_EXP: g->exp = RFIFOQ(fd,10); break; + case GBI_GUILDLV: g->guild_lv = RFIFOW(fd,10); break; + case GBI_SKILLPOINT: g->skill_point = RFIFOL(fd,10); break; } - - return 0; } // guild member info change notice // 0x383a <packet len>.w <guild id>.l <account id>.l <char id>.l <type>.w <data>.?b -int intif_parse_GuildMemberInfoChanged(int fd) -{ +void intif_parse_GuildMemberInfoChanged(int fd) { //int len = RFIFOW(fd,2) - 18; int guild_id = RFIFOL(fd,4); int account_id = RFIFOL(fd,8); @@ -1198,130 +1154,103 @@ int intif_parse_GuildMemberInfoChanged(int fd) g = guild->search(guild_id); if( g == NULL ) - return 0; + return; idx = guild->getindex(g,account_id,char_id); if( idx == -1 ) - return 0; + return; switch( type ) { - case GMI_POSITION: g->member[idx].position = RFIFOW(fd,18); guild->memberposition_changed(g,idx,RFIFOW(fd,18)); break; - case GMI_EXP: g->member[idx].exp = RFIFOQ(fd,18); break; - case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break; - case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break; - case GMI_GENDER: g->member[idx].gender = RFIFOW(fd,18); break; - case GMI_CLASS: g->member[idx].class_ = RFIFOW(fd,18); break; - case GMI_LEVEL: g->member[idx].lv = RFIFOW(fd,18); break; + case GMI_POSITION: g->member[idx].position = RFIFOW(fd,18); guild->memberposition_changed(g,idx,RFIFOW(fd,18)); break; + case GMI_EXP: g->member[idx].exp = RFIFOQ(fd,18); break; + case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break; + case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break; + case GMI_GENDER: g->member[idx].gender = RFIFOW(fd,18); break; + case GMI_CLASS: g->member[idx].class_ = RFIFOW(fd,18); break; + case GMI_LEVEL: g->member[idx].lv = RFIFOW(fd,18); break; } - return 0; } // ACK change of guild title -int intif_parse_GuildPosition(int fd) -{ +void intif_parse_GuildPosition(int fd) { if( RFIFOW(fd,2)!=sizeof(struct guild_position)+12 ) ShowError("intif: guild info : data size error\n %d %d %d",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12); guild->position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); - return 0; } // ACK change of guild skill update -int intif_parse_GuildSkillUp(int fd) -{ +void intif_parse_GuildSkillUp(int fd) { guild->skillupack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); - return 0; } // ACK change of guild relationship -int intif_parse_GuildAlliance(int fd) -{ +void intif_parse_GuildAlliance(int fd) { guild->allianceack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18),(char *) RFIFOP(fd,19),(char *) RFIFOP(fd,43)); - return 0; } // ACK change of guild notice -int intif_parse_GuildNotice(int fd) -{ +void intif_parse_GuildNotice(int fd) { guild->notice_changed(RFIFOL(fd,2),(char *) RFIFOP(fd,6),(char *) RFIFOP(fd,66)); - return 0; } // ACK change of guild emblem -int intif_parse_GuildEmblem(int fd) -{ +void intif_parse_GuildEmblem(int fd) { guild->emblem_changed(RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8), (char *)RFIFOP(fd,12)); - return 0; } // ACK guild message -int intif_parse_GuildMessage(int fd) -{ +void intif_parse_GuildMessage(int fd) { guild->recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12); - return 0; } // Reply guild castle data request -int intif_parse_GuildCastleDataLoad(int fd) -{ - return guild->castledataloadack(RFIFOW(fd,2), (struct guild_castle *)RFIFOP(fd,4)); +void intif_parse_GuildCastleDataLoad(int fd) { + guild->castledataloadack(RFIFOW(fd,2), (struct guild_castle *)RFIFOP(fd,4)); } // ACK change of guildmaster -int intif_parse_GuildMasterChanged(int fd) -{ - return guild->gm_changed(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); +void intif_parse_GuildMasterChanged(int fd) { + guild->gm_changed(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); } // Request pet creation -int intif_parse_CreatePet(int fd) -{ +void intif_parse_CreatePet(int fd) { pet->get_egg(RFIFOL(fd,2),RFIFOL(fd,7),RFIFOB(fd,6)); - return 0; } // ACK pet data -int intif_parse_RecvPetData(int fd) -{ +void intif_parse_RecvPetData(int fd) { struct s_pet p; int len; len=RFIFOW(fd,2); if(sizeof(struct s_pet)!=len-9) { if(battle_config.etc_log) ShowError("intif: pet data: data size error %d %d\n",sizeof(struct s_pet),len-9); - } - else{ + } else { memcpy(&p,RFIFOP(fd,9),sizeof(struct s_pet)); pet->recv_petdata(RFIFOL(fd,4),&p,RFIFOB(fd,8)); } - - return 0; } - +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ // ACK pet save data -int intif_parse_SavePetOk(int fd) -{ +void intif_parse_SavePetOk(int fd) { if(RFIFOB(fd,6) == 1) ShowError("pet data save failure\n"); - - return 0; } - +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ // ACK deleting pet -int intif_parse_DeletePetOk(int fd) -{ +void intif_parse_DeletePetOk(int fd) { if(RFIFOB(fd,2) == 1) ShowError("pet data delete failure\n"); - - return 0; } // ACK changing name resquest, players,pets,hommon -int intif_parse_ChangeNameOk(int fd) +void intif_parse_ChangeNameOk(int fd) { struct map_session_data *sd = NULL; if((sd=map->id2sd(RFIFOL(fd,2)))==NULL || sd->status.char_id != RFIFOL(fd,6)) - return 0; + return; switch (RFIFOB(fd,10)) { case 0: //Players [NOT SUPPORTED YET] @@ -1333,54 +1262,43 @@ int intif_parse_ChangeNameOk(int fd) homun->change_name_ack(sd, (char*)RFIFOP(fd,12), RFIFOB(fd,11)); break; } - return 0; + return; } //---------------------------------------------------------------- // Homunculus recv packets [albator] -int intif_parse_CreateHomunculus(int fd) -{ - int len; - len=RFIFOW(fd,2)-9; +void intif_parse_CreateHomunculus(int fd) { + int len = RFIFOW(fd,2)-9; if(sizeof(struct s_homunculus)!=len) { if(battle_config.etc_log) ShowError("intif: create homun data: data size error %d != %d\n",sizeof(struct s_homunculus),len); - return 0; + return; } homun->recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8)) ; - return 0; } -int intif_parse_RecvHomunculusData(int fd) -{ - int len; - - len=RFIFOW(fd,2)-9; +void intif_parse_RecvHomunculusData(int fd) { + int len = RFIFOW(fd,2)-9; if(sizeof(struct s_homunculus)!=len) { if(battle_config.etc_log) ShowError("intif: homun data: data size error %d %d\n",sizeof(struct s_homunculus),len); - return 0; + return; } homun->recv_data(RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,9), RFIFOB(fd,8)); - return 0; } -int intif_parse_SaveHomunculusOk(int fd) -{ +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ +void intif_parse_SaveHomunculusOk(int fd) { if(RFIFOB(fd,6) != 1) ShowError("homunculus data save failure for account %d\n", RFIFOL(fd,2)); - - return 0; } -int intif_parse_DeleteHomunculusOk(int fd) -{ +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ +void intif_parse_DeleteHomunculusOk(int fd) { if(RFIFOB(fd,2) != 1) ShowError("Homunculus data delete failure\n"); - - return 0; } /************************************** @@ -1398,15 +1316,14 @@ int intif_request_questlog(TBL_PC *sd) return 0; } -int intif_parse_questlog(int fd) -{ +void intif_parse_QuestLog(int fd) { int char_id = RFIFOL(fd, 4); int i; TBL_PC * sd = map->charid2sd(char_id); //User not online anymore if(!sd) - return -1; + return; sd->avail_quests = sd->num_quests = (RFIFOW(fd, 2)-8)/sizeof(struct quest); @@ -1420,7 +1337,7 @@ int intif_parse_questlog(int fd) if( sd->quest_index[i] < 0 ) { - ShowError("intif_parse_questlog: quest %d not found in DB.\n",sd->quest_log[i].quest_id); + ShowError("intif_parse_QuestLog: quest %d not found in DB.\n",sd->quest_log[i].quest_id); sd->avail_quests--; sd->num_quests--; i--; @@ -1432,20 +1349,16 @@ int intif_parse_questlog(int fd) } quest->pc_login(sd); - - return 0; } -int intif_parse_questsave(int fd) { +void intif_parse_QuestSave(int fd) { int cid = RFIFOL(fd, 2); TBL_PC *sd = map->id2sd(cid); if( !RFIFOB(fd, 6) ) - ShowError("intif_parse_questsave: Failed to save quest(s) for character %d!\n", cid); + ShowError("intif_parse_QuestSave: Failed to save quest(s) for character %d!\n", cid); else if( sd ) sd->save_quest = false; - - return 0; } int intif_quest_save(TBL_PC *sd) @@ -1491,23 +1404,20 @@ int intif_Mail_requestinbox(int char_id, unsigned char flag) return 0; } -int intif_parse_Mail_inboxreceived(int fd) -{ +void intif_parse_MailInboxReceived(int fd) { struct map_session_data *sd; unsigned char flag = RFIFOB(fd,8); sd = map->charid2sd(RFIFOL(fd,4)); - if (sd == NULL) - { - ShowError("intif_parse_Mail_inboxreceived: char not found %d\n",RFIFOL(fd,4)); - return 1; + if (sd == NULL) { + ShowError("intif_parse_MailInboxReceived: char not found %d\n",RFIFOL(fd,4)); + return; } - if (RFIFOW(fd,2) - 9 != sizeof(struct mail_data)) - { - ShowError("intif_parse_Mail_inboxreceived: data size error %d %d\n", RFIFOW(fd,2) - 9, sizeof(struct mail_data)); - return 1; + if (RFIFOW(fd,2) - 9 != sizeof(struct mail_data)) { + ShowError("intif_parse_MailInboxReceived: data size error %d %d\n", RFIFOW(fd,2) - 9, sizeof(struct mail_data)); + return; } //FIXME: this operation is not safe [ultramage] @@ -1516,13 +1426,11 @@ int intif_parse_Mail_inboxreceived(int fd) if (flag) clif->mail_refreshinbox(sd); - else if( battle_config.mail_show_status && ( battle_config.mail_show_status == 1 || sd->mail.inbox.unread ) ) - { + else if( battle_config.mail_show_status && ( battle_config.mail_show_status == 1 || sd->mail.inbox.unread ) ) { char output[128]; sprintf(output, msg_txt(510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked); clif->disp_onlyself(sd, output, strlen(output)); } - return 0; } /*------------------------------------------ * Mail Read @@ -1556,29 +1464,26 @@ int intif_Mail_getattach(int char_id, int mail_id) return 0; } -int intif_parse_Mail_getattach(int fd) { +void intif_parse_MailGetAttach(int fd) { struct map_session_data *sd; struct item item; int zeny = RFIFOL(fd,8); sd = map->charid2sd( RFIFOL(fd,4) ); - if (sd == NULL) - { - ShowError("intif_parse_Mail_getattach: char not found %d\n",RFIFOL(fd,4)); - return 1; + if (sd == NULL) { + ShowError("intif_parse_MailGetAttach: char not found %d\n",RFIFOL(fd,4)); + return; } - if (RFIFOW(fd,2) - 12 != sizeof(struct item)) - { - ShowError("intif_parse_Mail_getattach: data size error %d %d\n", RFIFOW(fd,2) - 16, sizeof(struct item)); - return 1; + if (RFIFOW(fd,2) - 12 != sizeof(struct item)) { + ShowError("intif_parse_MailGetAttach: data size error %d %d\n", RFIFOW(fd,2) - 16, sizeof(struct item)); + return; } memcpy(&item, RFIFOP(fd,12), sizeof(struct item)); mail->getattachment(sd, zeny, &item); - return 0; } /*------------------------------------------ * Delete Message @@ -1597,24 +1502,21 @@ int intif_Mail_delete(int char_id, int mail_id) return 0; } -int intif_parse_Mail_delete(int fd) { +void intif_parse_MailDelete(int fd) { + struct map_session_data *sd; int char_id = RFIFOL(fd,2); int mail_id = RFIFOL(fd,6); bool failed = RFIFOB(fd,10); - - struct map_session_data *sd = map->charid2sd(char_id); - if (sd == NULL) - { - ShowError("intif_parse_Mail_delete: char not found %d\n", char_id); - return 1; + + if ( (sd = map->charid2sd(char_id)) == NULL) { + ShowError("intif_parse_MailDelete: char not found %d\n", char_id); + return; } - if (!failed) - { + if (!failed) { int i; ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id); - if( i < MAIL_MAX_INBOX ) - { + if( i < MAIL_MAX_INBOX ) { memset(&sd->mail.inbox.msg[i], 0, sizeof(struct mail_message)); sd->mail.inbox.amount--; } @@ -1624,7 +1526,6 @@ int intif_parse_Mail_delete(int fd) { } clif->mail_delete(sd->fd, mail_id, failed); - return 0; } /*------------------------------------------ * Return Message @@ -1643,23 +1544,20 @@ int intif_Mail_return(int char_id, int mail_id) return 0; } -int intif_parse_Mail_return(int fd) { +void intif_parse_MailReturn(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int mail_id = RFIFOL(fd,6); short fail = RFIFOB(fd,10); - if( sd == NULL ) - { - ShowError("intif_parse_Mail_return: char not found %d\n",RFIFOL(fd,2)); - return 1; + if( sd == NULL ) { + ShowError("intif_parse_MailReturn: char not found %d\n",RFIFOL(fd,2)); + return; } - if( !fail ) - { + if( !fail ) { int i; ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id); - if( i < MAIL_MAX_INBOX ) - { + if( i < MAIL_MAX_INBOX ) { memset(&sd->mail.inbox.msg[i], 0, sizeof(struct mail_message)); sd->mail.inbox.amount--; } @@ -1669,7 +1567,6 @@ int intif_parse_Mail_return(int fd) { } clif->mail_return(sd->fd, mail_id, fail); - return 0; } /*------------------------------------------ * Send Mail @@ -1691,15 +1588,13 @@ int intif_Mail_send(int account_id, struct mail_message *msg) return 1; } -static void intif_parse_Mail_send(int fd) -{ +void intif_parse_MailSend(int fd) { struct mail_message msg; struct map_session_data *sd; bool fail; - if( RFIFOW(fd,2) - 4 != sizeof(struct mail_message) ) - { - ShowError("intif_parse_Mail_send: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct mail_message)); + if( RFIFOW(fd,2) - 4 != sizeof(struct mail_message) ) { + ShowError("intif_parse_MailSend: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct mail_message)); return; } @@ -1719,7 +1614,7 @@ static void intif_parse_Mail_send(int fd) } } -static void intif_parse_Mail_new(int fd) { +void intif_parse_MailNew(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int mail_id = RFIFOL(fd,6); const char* sender_name = (char*)RFIFOP(fd,10); @@ -1756,7 +1651,7 @@ int intif_Auction_requestlist(int char_id, short type, int price, const char* se return 0; } -static void intif_parse_Auction_results(int fd) { +void intif_parse_AuctionResults(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,4)); short count = RFIFOW(fd,8); short pages = RFIFOW(fd,10); @@ -1784,12 +1679,12 @@ int intif_Auction_register(struct auction_data *auction) return 1; } -static void intif_parse_Auction_register(int fd) { +void intif_parse_AuctionRegister(int fd) { struct map_session_data *sd; struct auction_data auction; if( RFIFOW(fd,2) - 4 != sizeof(struct auction_data) ) { - ShowError("intif_parse_Auction_register: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct auction_data)); + ShowError("intif_parse_AuctionRegister: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct auction_data)); return; } @@ -1801,9 +1696,7 @@ static void intif_parse_Auction_register(int fd) { clif->auction_message(sd->fd, 1); // Confirmation Packet ?? if( map->save_settings&32 ) chrif->save(sd,0); - } - else - { + } else { int zeny = auction.hours*battle_config.auction_feeperhour; clif->auction_message(sd->fd, 4); @@ -1827,7 +1720,7 @@ int intif_Auction_cancel(int char_id, unsigned int auction_id) return 0; } -static void intif_parse_Auction_cancel(int fd) { +void intif_parse_AuctionCancel(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int result = RFIFOB(fd,6); @@ -1835,10 +1728,10 @@ static void intif_parse_Auction_cancel(int fd) { return; switch( result ) { - case 0: clif->auction_message(sd->fd, 2); break; - case 1: clif->auction_close(sd->fd, 2); break; - case 2: clif->auction_close(sd->fd, 1); break; - case 3: clif->auction_message(sd->fd, 3); break; + case 0: clif->auction_message(sd->fd, 2); break; + case 1: clif->auction_close(sd->fd, 2); break; + case 2: clif->auction_close(sd->fd, 1); break; + case 3: clif->auction_message(sd->fd, 3); break; } } @@ -1856,7 +1749,7 @@ int intif_Auction_close(int char_id, unsigned int auction_id) return 0; } -static void intif_parse_Auction_close(int fd) { +void intif_parse_AuctionClose(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); unsigned char result = RFIFOB(fd,6); @@ -1864,8 +1757,7 @@ static void intif_parse_Auction_close(int fd) { return; clif->auction_close(sd->fd, result); - if( result == 0 ) - { + if( result == 0 ) { // FIXME: Leeching off a parse function clif->pAuction_cancelreg(fd, sd); intif_Auction_requestlist(sd->status.char_id, 6, 0, "", 1); @@ -1891,7 +1783,7 @@ int intif_Auction_bid(int char_id, const char* name, unsigned int auction_id, in return 0; } -static void intif_parse_Auction_bid(int fd) { +void intif_parse_AuctionBid(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int bid = RFIFOL(fd,6); unsigned char result = RFIFOB(fd,10); @@ -1910,7 +1802,7 @@ static void intif_parse_Auction_bid(int fd) { } // Used to send 'You have won the auction' and 'You failed to won the auction' messages -static void intif_parse_Auction_message(int fd) { +void intif_parse_AuctionMessage(int fd) { struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); unsigned char result = RFIFOB(fd,6); @@ -1938,18 +1830,16 @@ int intif_mercenary_create(struct s_mercenary *merc) return 0; } -int intif_parse_mercenary_received(int fd) -{ +void intif_parse_MercenaryReceived(int fd) { int len = RFIFOW(fd,2) - 5; - if( sizeof(struct s_mercenary) != len ) - { + + if( sizeof(struct s_mercenary) != len ) { if( battle_config.etc_log ) ShowError("intif: create mercenary data size error %d != %d\n", sizeof(struct s_mercenary), len); - return 0; + return; } mercenary->data_received((struct s_mercenary*)RFIFOP(fd,5), RFIFOB(fd,4)); - return 0; } int intif_mercenary_request(int merc_id, int char_id) @@ -1976,13 +1866,10 @@ int intif_mercenary_delete(int merc_id) WFIFOSET(inter_fd,6); return 0; } - -int intif_parse_mercenary_deleted(int fd) -{ +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ +void intif_parse_MercenaryDeleted(int fd) { if( RFIFOB(fd,2) != 1 ) ShowError("Mercenary data delete failure\n"); - - return 0; } int intif_mercenary_save(struct s_mercenary *merc) @@ -1999,13 +1886,10 @@ int intif_mercenary_save(struct s_mercenary *merc) WFIFOSET(inter_fd,size); return 0; } - -int intif_parse_mercenary_saved(int fd) -{ +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ +void intif_parse_MercenarySaved(int fd) { if( RFIFOB(fd,2) != 1 ) ShowError("Mercenary data save failure\n"); - - return 0; } /*========================================== @@ -2026,18 +1910,16 @@ int intif_elemental_create(struct s_elemental *ele) return 0; } -int intif_parse_elemental_received(int fd) -{ +void intif_parse_ElementalReceived(int fd) { int len = RFIFOW(fd,2) - 5; - if( sizeof(struct s_elemental) != len ) - { + + if( sizeof(struct s_elemental) != len ) { if( battle_config.etc_log ) ShowError("intif: create elemental data size error %d != %d\n", sizeof(struct s_elemental), len); - return 0; + return; } elemental->data_received((struct s_elemental*)RFIFOP(fd,5), RFIFOB(fd,4)); - return 0; } int intif_elemental_request(int ele_id, int char_id) @@ -2064,13 +1946,10 @@ int intif_elemental_delete(int ele_id) WFIFOSET(inter_fd,6); return 0; } - -int intif_parse_elemental_deleted(int fd) -{ +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ +void intif_parse_ElementalDeleted(int fd) { if( RFIFOB(fd,2) != 1 ) ShowError("Elemental data delete failure\n"); - - return 0; } int intif_elemental_save(struct s_elemental *ele) @@ -2087,13 +1966,10 @@ int intif_elemental_save(struct s_elemental *ele) WFIFOSET(inter_fd,size); return 0; } - -int intif_parse_elemental_saved(int fd) -{ +/* Really? Whats the point, shouldn't be sent when successful then [Ind] */ +void intif_parse_ElementalSaved(int fd) { if( RFIFOB(fd,2) != 1 ) ShowError("Elemental data save failure\n"); - - return 0; } void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query ) { @@ -2139,12 +2015,12 @@ int intif_parse(int fd) int packet_len, cmd; cmd = RFIFOW(fd,0); // Verify ID of the packet - if(cmd<0x3800 || cmd>=0x3800+(sizeof(packet_len_table)/sizeof(packet_len_table[0])) || - packet_len_table[cmd-0x3800]==0){ + if(cmd<0x3800 || cmd>=0x3800+(sizeof(intif->packet_len_table)/sizeof(intif->packet_len_table[0])) || + intif->packet_len_table[cmd-0x3800]==0){ return 0; } // Check the length of the packet - packet_len = packet_len_table[cmd-0x3800]; + packet_len = intif->packet_len_table[cmd-0x3800]; if(packet_len==-1){ if(RFIFOREST(fd)<4) return 2; @@ -2155,81 +2031,81 @@ int intif_parse(int fd) } // Processing branch switch(cmd){ - case 0x3800: - if (RFIFOL(fd,4) == 0xFF000000) //Normal announce. - clif->broadcast(NULL, (char *) RFIFOP(fd,16), packet_len-16, BC_DEFAULT, ALL_CLIENT); - else //Color announce. - clif->broadcast2(NULL, (char *) RFIFOP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT); - break; - case 0x3801: intif_parse_WisMessage(fd); break; - case 0x3802: intif_parse_WisEnd(fd); break; - case 0x3803: mapif_parse_WisToGM(fd); break; - case 0x3804: intif_parse_Registers(fd); break; - case 0x3806: intif_parse_ChangeNameOk(fd); break; - case 0x3807: intif_parse_MessageToFD(fd); break; - case 0x3818: intif_parse_LoadGuildStorage(fd); break; - case 0x3819: intif_parse_SaveGuildStorage(fd); break; - case 0x3820: intif_parse_PartyCreated(fd); break; - case 0x3821: intif_parse_PartyInfo(fd); break; - case 0x3822: intif_parse_PartyMemberAdded(fd); break; - case 0x3823: intif_parse_PartyOptionChanged(fd); break; - case 0x3824: intif_parse_PartyMemberWithdraw(fd); break; - case 0x3825: intif_parse_PartyMove(fd); break; - case 0x3826: intif_parse_PartyBroken(fd); break; - case 0x3827: intif_parse_PartyMessage(fd); break; - case 0x3830: intif_parse_GuildCreated(fd); break; - case 0x3831: intif_parse_GuildInfo(fd); break; - case 0x3832: intif_parse_GuildMemberAdded(fd); break; - case 0x3834: intif_parse_GuildMemberWithdraw(fd); break; - case 0x3835: intif_parse_GuildMemberInfoShort(fd); break; - case 0x3836: intif_parse_GuildBroken(fd); break; - case 0x3837: intif_parse_GuildMessage(fd); break; - case 0x3839: intif_parse_GuildBasicInfoChanged(fd); break; - case 0x383a: intif_parse_GuildMemberInfoChanged(fd); break; - case 0x383b: intif_parse_GuildPosition(fd); break; - case 0x383c: intif_parse_GuildSkillUp(fd); break; - case 0x383d: intif_parse_GuildAlliance(fd); break; - case 0x383e: intif_parse_GuildNotice(fd); break; - case 0x383f: intif_parse_GuildEmblem(fd); break; - case 0x3840: intif_parse_GuildCastleDataLoad(fd); break; - case 0x3843: intif_parse_GuildMasterChanged(fd); break; - - //Quest system - case 0x3860: intif_parse_questlog(fd); break; - case 0x3861: intif_parse_questsave(fd); break; - -// Mail System - case 0x3848: intif_parse_Mail_inboxreceived(fd); break; - case 0x3849: intif_parse_Mail_new(fd); break; - case 0x384a: intif_parse_Mail_getattach(fd); break; - case 0x384b: intif_parse_Mail_delete(fd); break; - case 0x384c: intif_parse_Mail_return(fd); break; - case 0x384d: intif_parse_Mail_send(fd); break; -// Auction System - case 0x3850: intif_parse_Auction_results(fd); break; - case 0x3851: intif_parse_Auction_register(fd); break; - case 0x3852: intif_parse_Auction_cancel(fd); break; - case 0x3853: intif_parse_Auction_close(fd); break; - case 0x3854: intif_parse_Auction_message(fd); break; - case 0x3855: intif_parse_Auction_bid(fd); break; - -// Mercenary System - case 0x3870: intif_parse_mercenary_received(fd); break; - case 0x3871: intif_parse_mercenary_deleted(fd); break; - case 0x3872: intif_parse_mercenary_saved(fd); break; -// Elemental System - case 0x387c: intif_parse_elemental_received(fd); break; - case 0x387d: intif_parse_elemental_deleted(fd); break; - case 0x387e: intif_parse_elemental_saved(fd); break; - - case 0x3880: intif_parse_CreatePet(fd); break; - case 0x3881: intif_parse_RecvPetData(fd); break; - case 0x3882: intif_parse_SavePetOk(fd); break; - case 0x3883: intif_parse_DeletePetOk(fd); break; - case 0x3890: intif_parse_CreateHomunculus(fd); break; - case 0x3891: intif_parse_RecvHomunculusData(fd); break; - case 0x3892: intif_parse_SaveHomunculusOk(fd); break; - case 0x3893: intif_parse_DeleteHomunculusOk(fd); break; + case 0x3800: + if (RFIFOL(fd,4) == 0xFF000000) //Normal announce. + clif->broadcast(NULL, (char *) RFIFOP(fd,16), packet_len-16, BC_DEFAULT, ALL_CLIENT); + else //Color announce. + clif->broadcast2(NULL, (char *) RFIFOP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT); + break; + case 0x3801: intif->pWisMessage(fd); break; + case 0x3802: intif->pWisEnd(fd); break; + case 0x3803: intif->pWisToGM(fd); break; + case 0x3804: intif->pRegisters(fd); break; + case 0x3806: intif->pChangeNameOk(fd); break; + case 0x3807: intif->pMessageToFD(fd); break; + case 0x3818: intif->pLoadGuildStorage(fd); break; + case 0x3819: intif->pSaveGuildStorage(fd); break; + case 0x3820: intif->pPartyCreated(fd); break; + case 0x3821: intif->pPartyInfo(fd); break; + case 0x3822: intif->pPartyMemberAdded(fd); break; + case 0x3823: intif->pPartyOptionChanged(fd); break; + case 0x3824: intif->pPartyMemberWithdraw(fd); break; + case 0x3825: intif->pPartyMove(fd); break; + case 0x3826: intif->pPartyBroken(fd); break; + case 0x3827: intif->pPartyMessage(fd); break; + case 0x3830: intif->pGuildCreated(fd); break; + case 0x3831: intif->pGuildInfo(fd); break; + case 0x3832: intif->pGuildMemberAdded(fd); break; + case 0x3834: intif->pGuildMemberWithdraw(fd); break; + case 0x3835: intif->pGuildMemberInfoShort(fd); break; + case 0x3836: intif->pGuildBroken(fd); break; + case 0x3837: intif->pGuildMessage(fd); break; + case 0x3839: intif->pGuildBasicInfoChanged(fd); break; + case 0x383a: intif->pGuildMemberInfoChanged(fd); break; + case 0x383b: intif->pGuildPosition(fd); break; + case 0x383c: intif->pGuildSkillUp(fd); break; + case 0x383d: intif->pGuildAlliance(fd); break; + case 0x383e: intif->pGuildNotice(fd); break; + case 0x383f: intif->pGuildEmblem(fd); break; + case 0x3840: intif->pGuildCastleDataLoad(fd); break; + case 0x3843: intif->pGuildMasterChanged(fd); break; + + //Quest system + case 0x3860: intif->pQuestLog(fd); break; + case 0x3861: intif->pQuestSave(fd); break; + + // Mail System + case 0x3848: intif->pMailInboxReceived(fd); break; + case 0x3849: intif->pMailNew(fd); break; + case 0x384a: intif->pMailGetAttach(fd); break; + case 0x384b: intif->pMailDelete(fd); break; + case 0x384c: intif->pMailReturn(fd); break; + case 0x384d: intif->pMailSend(fd); break; + // Auction System + case 0x3850: intif->pAuctionResults(fd); break; + case 0x3851: intif->pAuctionRegister(fd); break; + case 0x3852: intif->pAuctionCancel(fd); break; + case 0x3853: intif->pAuctionClose(fd); break; + case 0x3854: intif->pAuctionMessage(fd); break; + case 0x3855: intif->pAuctionBid(fd); break; + + // Mercenary System + case 0x3870: intif->pMercenaryReceived(fd); break; + case 0x3871: intif->pMercenaryDeleted(fd); break; + case 0x3872: intif->pMercenarySaved(fd); break; + // Elemental System + case 0x387c: intif->pElementalReceived(fd); break; + case 0x387d: intif->pElementalDeleted(fd); break; + case 0x387e: intif->pElementalSaved(fd); break; + + case 0x3880: intif->pCreatePet(fd); break; + case 0x3881: intif->pRecvPetData(fd); break; + case 0x3882: intif->pSavePetOk(fd); break; + case 0x3883: intif->pDeletePetOk(fd); break; + case 0x3890: intif->pCreateHomunculus(fd); break; + case 0x3891: intif->pRecvHomunculusData(fd); break; + case 0x3892: intif->pSaveHomunculusOk(fd); break; + case 0x3893: intif->pDeleteHomunculusOk(fd); break; default: ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0)); return 0; @@ -2245,30 +2121,38 @@ int intif_parse(int fd) * created by Susu *-------------------------------------*/ void intif_defaults(void) { + const int packet_len_table [INTIF_PACKET_LEN_TABLE_SIZE] = { + -1,-1,27,-1, -1, 0,37,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f + 0, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810 + 39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820 + 10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830 + -1, 0, 0,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840 + -1,-1, 7, 7, 7,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] + -1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish] + -1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, 0, //0x3870 Mercenaries [Zephyrus] / Elemental [pakpil] + 11,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880 + -1,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator] + }; + intif = &intif_s; - /* funcs */ + /* */ + memcpy(intif->packet_len_table,&packet_len_table,sizeof(intif->packet_len_table)); + /* funcs */ intif->parse = intif_parse; - intif->create_pet = intif_create_pet; - intif->broadcast = intif_broadcast; intif->broadcast2 = intif_broadcast2; intif->main_message = intif_main_message; - intif->wis_message = intif_wis_message; intif->wis_message_to_gm = intif_wis_message_to_gm; - intif->saveregistry = intif_saveregistry; intif->request_registry = intif_request_registry; - intif->request_guild_storage = intif_request_guild_storage; intif->send_guild_storage = intif_send_guild_storage; - intif->create_party = intif_create_party; intif->request_partyinfo = intif_request_partyinfo; - intif->party_addmember = intif_party_addmember; intif->party_changeoption = intif_party_changeoption; intif->party_leave = intif_party_leave; @@ -2276,7 +2160,6 @@ void intif_defaults(void) { intif->break_party = intif_break_party; intif->party_message = intif_party_message; intif->party_leaderchange = intif_party_leaderchange; - intif->guild_create = intif_guild_create; intif->guild_request_info = intif_guild_request_info; intif->guild_addmember = intif_guild_addmember; @@ -2330,6 +2213,68 @@ void intif_defaults(void) { intif->elemental_save = intif_elemental_save; /* @accinfo */ intif->request_accinfo = intif_request_accinfo; - + /* */ intif->CheckForCharServer = CheckForCharServer; + /* */ + intif->pWisMessage = intif_parse_WisMessage; + intif->pWisEnd = intif_parse_WisEnd; + intif->pWisToGM_sub = mapif_parse_WisToGM_sub; + intif->pWisToGM = mapif_parse_WisToGM; + intif->pRegisters = intif_parse_Registers; + intif->pChangeNameOk = intif_parse_ChangeNameOk; + intif->pMessageToFD = intif_parse_MessageToFD; + intif->pLoadGuildStorage = intif_parse_LoadGuildStorage; + intif->pSaveGuildStorage = intif_parse_SaveGuildStorage; + intif->pPartyCreated = intif_parse_PartyCreated; + intif->pPartyInfo = intif_parse_PartyInfo; + intif->pPartyMemberAdded = intif_parse_PartyMemberAdded; + intif->pPartyOptionChanged = intif_parse_PartyOptionChanged; + intif->pPartyMemberWithdraw = intif_parse_PartyMemberWithdraw; + intif->pPartyMove = intif_parse_PartyMove; + intif->pPartyBroken = intif_parse_PartyBroken; + intif->pPartyMessage = intif_parse_PartyMessage; + intif->pGuildCreated = intif_parse_GuildCreated; + intif->pGuildInfo = intif_parse_GuildInfo; + intif->pGuildMemberAdded = intif_parse_GuildMemberAdded; + intif->pGuildMemberWithdraw = intif_parse_GuildMemberWithdraw; + intif->pGuildMemberInfoShort = intif_parse_GuildMemberInfoShort; + intif->pGuildBroken = intif_parse_GuildBroken; + intif->pGuildMessage = intif_parse_GuildMessage; + intif->pGuildBasicInfoChanged = intif_parse_GuildBasicInfoChanged; + intif->pGuildMemberInfoChanged = intif_parse_GuildMemberInfoChanged; + intif->pGuildPosition = intif_parse_GuildPosition; + intif->pGuildSkillUp = intif_parse_GuildSkillUp; + intif->pGuildAlliance = intif_parse_GuildAlliance; + intif->pGuildNotice = intif_parse_GuildNotice; + intif->pGuildEmblem = intif_parse_GuildEmblem; + intif->pGuildCastleDataLoad = intif_parse_GuildCastleDataLoad; + intif->pGuildMasterChanged = intif_parse_GuildMasterChanged; + intif->pQuestLog = intif_parse_QuestLog; + intif->pQuestSave = intif_parse_QuestSave; + intif->pMailInboxReceived = intif_parse_MailInboxReceived; + intif->pMailNew = intif_parse_MailNew; + intif->pMailGetAttach = intif_parse_MailGetAttach; + intif->pMailDelete = intif_parse_MailDelete; + intif->pMailReturn = intif_parse_MailReturn; + intif->pMailSend = intif_parse_MailSend; + intif->pAuctionResults = intif_parse_AuctionResults; + intif->pAuctionRegister = intif_parse_AuctionRegister; + intif->pAuctionCancel = intif_parse_AuctionCancel; + intif->pAuctionClose = intif_parse_AuctionClose; + intif->pAuctionMessage = intif_parse_AuctionMessage; + intif->pAuctionBid = intif_parse_AuctionBid; + intif->pMercenaryReceived = intif_parse_MercenaryReceived; + intif->pMercenaryDeleted = intif_parse_MercenaryDeleted; + intif->pMercenarySaved = intif_parse_MercenarySaved; + intif->pElementalReceived = intif_parse_ElementalReceived; + intif->pElementalDeleted = intif_parse_ElementalDeleted; + intif->pElementalSaved = intif_parse_ElementalSaved; + intif->pCreatePet = intif_parse_CreatePet; + intif->pRecvPetData = intif_parse_RecvPetData; + intif->pSavePetOk = intif_parse_SavePetOk; + intif->pDeletePetOk = intif_parse_DeletePetOk; + intif->pCreateHomunculus = intif_parse_CreateHomunculus; + intif->pRecvHomunculusData = intif_parse_RecvHomunculusData; + intif->pSaveHomunculusOk = intif_parse_SaveHomunculusOk; + intif->pDeleteHomunculusOk = intif_parse_DeleteHomunculusOk; } diff --git a/src/map/intif.h b/src/map/intif.h index 8abcf819d..768e735de 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -1,8 +1,14 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams + #ifndef _INTIF_H_ #define _INFIF_H_ -//#include "../common/mmo.h" + + +/** + * Declarations + **/ struct party_member; struct guild_member; struct guild_position; @@ -13,17 +19,13 @@ struct s_elemental; struct mail_message; struct auction_data; - - - - +/** + * Defines + **/ #define intif_rename_pc(sd, name) intif->rename(sd, 0, name) #define intif_rename_pet(sd, name) intif->rename(sd, 1, name) #define intif_rename_hom(sd, name) intif->rename(sd, 2, name) - - - - +#define INTIF_PACKET_LEN_TABLE_SIZE 161 /*===================================== @@ -32,30 +34,23 @@ struct auction_data; * created by Susu *-------------------------------------*/ struct intif_interface { + /* */ + int packet_len_table[INTIF_PACKET_LEN_TABLE_SIZE]; /* funcs */ - - int (*parse) (int fd); - int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name); - + short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name); int (*broadcast) (const char* mes, int len, int type); int (*broadcast2) (const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY); int (*main_message) (struct map_session_data* sd, const char* message); - int (*wis_message) (struct map_session_data *sd,char *nick,char *mes,int mes_len); int (*wis_message_to_gm) (char *Wisp_name, int permission, char *mes); - int (*saveregistry) (struct map_session_data *sd, int type); int (*request_registry) (struct map_session_data *sd, int flag); - int (*request_guild_storage) (int account_id, int guild_id); int (*send_guild_storage) (int account_id, struct guild_storage *gstor); - int (*create_party) (struct party_member *member,char *name,int item,int item2); int (*request_partyinfo) (int party_id, int char_id); - int (*party_addmember) (int party_id,struct party_member *member); int (*party_changeoption) (int party_id, int account_id, int exp, int item); int (*party_leave) (int party_id,int account_id, int char_id); @@ -63,7 +58,6 @@ struct intif_interface { int (*break_party) (int party_id); int (*party_message) (int party_id, int account_id, const char *mes,int len); int (*party_leaderchange) (int party_id,int account_id,int char_id); - int (*guild_create) (const char *name, const struct guild_member *master); int (*guild_request_info) (int guild_id); int (*guild_addmember) (int guild_id, struct guild_member *m); @@ -117,9 +111,71 @@ struct intif_interface { int (*elemental_save) (struct s_elemental *ele); /* @accinfo */ void (*request_accinfo) (int u_fd, int aid, int group_lv, char* query); - + /* */ int (*CheckForCharServer) (void); -} intif_s; + /* */ + void (*pWisMessage) (int fd); + void (*pWisEnd) (int fd); + int (*pWisToGM_sub) (struct map_session_data* sd,va_list va); + void (*pWisToGM) (int fd); + void (*pRegisters) (int fd); + void (*pChangeNameOk) (int fd); + void (*pMessageToFD) (int fd); + void (*pLoadGuildStorage) (int fd); + void (*pSaveGuildStorage) (int fd); + void (*pPartyCreated) (int fd); + void (*pPartyInfo) (int fd); + void (*pPartyMemberAdded) (int fd); + void (*pPartyOptionChanged) (int fd); + void (*pPartyMemberWithdraw) (int fd); + void (*pPartyMove) (int fd); + void (*pPartyBroken) (int fd); + void (*pPartyMessage) (int fd); + void (*pGuildCreated) (int fd); + void (*pGuildInfo) (int fd); + void (*pGuildMemberAdded) (int fd); + void (*pGuildMemberWithdraw) (int fd); + void (*pGuildMemberInfoShort) (int fd); + void (*pGuildBroken) (int fd); + void (*pGuildMessage) (int fd); + void (*pGuildBasicInfoChanged) (int fd); + void (*pGuildMemberInfoChanged) (int fd); + void (*pGuildPosition) (int fd); + void (*pGuildSkillUp) (int fd); + void (*pGuildAlliance) (int fd); + void (*pGuildNotice) (int fd); + void (*pGuildEmblem) (int fd); + void (*pGuildCastleDataLoad) (int fd); + void (*pGuildMasterChanged) (int fd); + void (*pQuestLog) (int fd); + void (*pQuestSave) (int fd); + void (*pMailInboxReceived) (int fd); + void (*pMailNew) (int fd); + void (*pMailGetAttach) (int fd); + void (*pMailDelete) (int fd); + void (*pMailReturn) (int fd); + void (*pMailSend) (int fd); + void (*pAuctionResults) (int fd); + void (*pAuctionRegister) (int fd); + void (*pAuctionCancel) (int fd); + void (*pAuctionClose) (int fd); + void (*pAuctionMessage) (int fd); + void (*pAuctionBid) (int fd); + void (*pMercenaryReceived) (int fd); + void (*pMercenaryDeleted) (int fd); + void (*pMercenarySaved) (int fd); + void (*pElementalReceived) (int fd); + void (*pElementalDeleted) (int fd); + void (*pElementalSaved) (int fd); + void (*pCreatePet) (int fd); + void (*pRecvPetData) (int fd); + void (*pSavePetOk) (int fd); + void (*pDeletePetOk) (int fd); + void (*pCreateHomunculus) (int fd); + void (*pRecvHomunculusData) (int fd); + void (*pSaveHomunculusOk) (int fd); + void (*pDeleteHomunculusOk) (int fd); +}; struct intif_interface *intif; |