From dd9eae9be585da9d7e8e5e39f6831f4ff641ad3f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 5 Oct 2016 18:55:00 +0300 Subject: Dont send packets for known unsupported client versions. Fixed packets between 20111005 to 20141022. As reference was used client packet logs from https://gitlab.com/4144/servergreps/tree/master/peek_all/packets --- src/char/char.c | 6 +++++- src/map/clif.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/char/char.c b/src/char/char.c index 952c3d781..945111640 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1945,11 +1945,15 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { } /* Made Possible by Yommy~! <3 */ -void char_mmo_char_send099d(int fd, struct char_session_data *sd) { +void char_mmo_char_send099d(int fd, struct char_session_data *sd) +{ +// support added for client between 20121010 and 20130320 +#if PACKETVER > 20120418 WFIFOHEAD(fd,4 + (MAX_CHARS*MAX_CHAR_BUF)); WFIFOW(fd,0) = 0x99d; WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; WFIFOSET(fd,WFIFOW(fd,2)); +#endif } /* Sends character ban list */ diff --git a/src/map/clif.c b/src/map/clif.c index 8a79cbab1..b92c3185f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -14216,7 +14216,9 @@ void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { } /// 097d .W {.24B L}*10 L (ZC_ACK_RANKING) -void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) +{ +#if PACKETVER >= 20120502 int fd; int mypoint = 0; int upperMask; @@ -14240,6 +14242,7 @@ void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { WFIFOL(fd, 284) = mypoint; //mypoint WFIFOSET(fd, 288); +#endif } void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); @@ -17630,7 +17633,9 @@ void clif_snap( struct block_list *bl, short x, short y ) { #endif } -void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { +void clif_monster_hp_bar(struct mob_data *md, struct map_session_data *sd) +{ +#if PACKETVER >= 20120228 struct packet_monster_hp p; nullpo_retv(md); @@ -17641,6 +17646,7 @@ void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { p.MaxHP = md->status.max_hp; clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif } /* [Ind/Hercules] placeholder for unsupported incoming packets (avoids server disconnecting client) */ @@ -18160,7 +18166,9 @@ void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) } void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_BankCheck(int fd, struct map_session_data* sd) { +void clif_parse_BankCheck(int fd, struct map_session_data* sd) +{ +#if PACKETVER >= 20130313 struct packet_banking_check p; if (!battle_config.feature_banking) { @@ -18173,6 +18181,7 @@ void clif_parse_BankCheck(int fd, struct map_session_data* sd) { p.Reason = (short)0; clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); @@ -18185,7 +18194,9 @@ void clif_parse_BankClose(int fd, struct map_session_data* sd) { return; } -void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { +void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) +{ +#if PACKETVER >= 20130313 struct packet_banking_deposit_ack p; nullpo_retv(sd); @@ -18195,9 +18206,12 @@ void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK r p.Reason = (short)reason; clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } -void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) { +void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) +{ +#if PACKETVER >= 20130313 struct packet_banking_withdraw_ack p; nullpo_retv(sd); @@ -18207,6 +18221,7 @@ void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK p.Reason = (short)reason; clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } /* TODO: official response packet (tried 0x8cb/0x97b but the display was quite screwed up.) */ @@ -18463,6 +18478,7 @@ void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, i void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); /* Roulette System [Yommy/Hercules] */ void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { +#if PACKETVER >= 20140612 struct packet_roulette_open_ack p; if( !battle_config.feature_roulette ) { @@ -18481,10 +18497,13 @@ void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { p.SilverPoint = pc_readglobalreg(sd, script->add_str("TmpRouletteSilver")); clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { +void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) +{ +#if PACKETVER >= 20140612 struct packet_roulette_info_ack p; unsigned short i, j, count = 0; @@ -18507,7 +18526,7 @@ void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) { } } clif->send(&p,sizeof(p), &sd->bl, SELF); - return; +#endif } void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); @@ -18581,7 +18600,9 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribut /** * Request to cash in! **/ -void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { +void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) +{ +#if PACKETVER >= 20140612 struct packet_roulette_itemrecv_ack p; if( !battle_config.feature_roulette ) { @@ -18624,7 +18645,7 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) { p.Result = RECV_ITEM_FAILED; clif->send(&p,sizeof(p), &sd->bl, SELF); - return; +#endif } bool clif_parse_roulette_db(void) { @@ -18719,7 +18740,9 @@ bool clif_parse_roulette_db(void) { /** * **/ -void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { +void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) +{ +#if PACKETVER >= 20140612 struct packet_roulette_generate_ack p; nullpo_retv(sd); @@ -18733,6 +18756,7 @@ void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char resul p.RemainSilver = pc_readglobalreg(sd, script->add_str("TmpRouletteSilver")); clif->send(&p,sizeof(p), &sd->bl, SELF); +#endif } /** @@ -18740,6 +18764,7 @@ void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char resul */ void clif_openmergeitem(int fd, struct map_session_data *sd) { +#if PACKETVER > 20120228 int i = 0, n = 0, j = 0; struct merge_item merge_items[MAX_INVENTORY]; struct merge_item *merge_items_[MAX_INVENTORY] = {0}; @@ -18782,6 +18807,7 @@ void clif_openmergeitem(int fd, struct map_session_data *sd) for ( i = 0; i < j; i++ ) WFIFOW(fd,i*2+4) = merge_items_[i]->position; WFIFOSET(fd,2*j+4); +#endif } int clif_comparemergeitem(const void *a, const void *b) @@ -18798,6 +18824,7 @@ int clif_comparemergeitem(const void *a, const void *b) void clif_ackmergeitems(int fd, struct map_session_data *sd) { +#if PACKETVER > 20120228 int i = 0, n = 0, length = 0, count = 0; int16 nameid = 0, indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; struct item item_data; @@ -18877,6 +18904,7 @@ void clif_ackmergeitems(int fd, struct map_session_data *sd) WFIFOW(fd,4) = count; WFIFOB(fd,6) = MERGEITEM_SUCCESS; WFIFOSET(fd,7); +#endif } void clif_cancelmergeitem (int fd, struct map_session_data *sd) -- cgit v1.2.3-70-g09d2