From 6da12760fbcc987747c97f70521bd9add2e0060f Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 23 Apr 2010 13:19:25 +0000 Subject: Merged a few updates for supporting renewal clients (thanks to Diablo): [Skotlex] - Updated packet_db entries - Added slot info on packet 0x6b (PACKETVER > 20100413) - Trade add-item use packet 0x80f (PACKETVER > 20100223) - Guild storage add-item use packet 0x1c4 (PACKETVER > 20090603) - Vending list use packet 0x800 (PACKETVER > 20100105) - Allow client to change item-share party settings (PACKETVER > 20090603) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14286 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/char.c | 14 ++++-- src/char_sql/char.c | 14 ++++-- src/common/mmo.h | 7 ++- src/map/clif.c | 142 ++++++++++++++++++++++++++++++++++------------------ src/map/clif.h | 2 +- 5 files changed, 121 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index 4c4379074..6f65eec37 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1744,7 +1744,10 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) //---------------------------------------- int mmo_char_send006b(int fd, struct char_session_data* sd) { - int i, j, found_num; + int i, j, found_num, offset = 0; +#if PACKETVER >= 20100413 + offset += 3; +#endif; found_num = 0; for(i = 0; i < char_num; i++) { @@ -1757,10 +1760,15 @@ int mmo_char_send006b(int fd, struct char_session_data* sd) for(i = found_num; i < MAX_CHARS; i++) sd->found_char[i] = -1; - j = 24; // offset + j = 24 + offset; // offset WFIFOHEAD(fd,j + found_num*MAX_CHAR_BUF); WFIFOW(fd,0) = 0x6b; - memset(WFIFOP(fd,4), 0, 20); // unknown bytes +#if PACKETVER >= 20100413 + WFIFOB(fd,4) = MAX_CHARS; // Max slots. + WFIFOB(fd,5) = MAX_CHARS; // Available slots. + WFIFOB(fd,6) = MAX_CHARS; // Premium slots. +#endif + memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes for(i = 0; i < found_num; i++) j += mmo_char_tobuf(WFIFOP(fd,j), &char_dat[sd->found_char[i]].status); WFIFOW(fd,2) = j; // packet len diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 9fc4aea99..50fff099d 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -1601,15 +1601,23 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) int mmo_char_send006b(int fd, struct char_session_data* sd) { - int j; + int j, offset = 0; +#if PACKETVER >= 20100413 + offset += 3; +#endif if (save_log) ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id); - j = 24; // offset + j = 24 + offset; // offset WFIFOHEAD(fd,j + MAX_CHARS*MAX_CHAR_BUF); WFIFOW(fd,0) = 0x6b; - memset(WFIFOP(fd,4), 0, 20); // unknown bytes +#if PACKETVER >= 20100413 + WFIFOB(fd,4) = MAX_CHARS; // Max slots. + WFIFOB(fd,5) = MAX_CHARS; // Available slots. + WFIFOB(fd,6) = MAX_CHARS; // Premium slots. +#endif + memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes j+=mmo_chars_fromsql(sd, WFIFOP(fd,j)); WFIFOW(fd,2) = j; // packet len WFIFOSET(fd,j); diff --git a/src/common/mmo.h b/src/common/mmo.h index 8f31a9e0f..e21299ffe 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -29,10 +29,13 @@ // 20090603 - 2009-06-03aRagexeRE+ - 0x7d7, 0x7d8, 0x7d9, 0x7da // 20090617 - 2009-06-17aRagexeRE+ - 0x7d9 // 20090922 - 2009-09-22aRagexeRE+ - 0x7e5, 0x7e7, 0x7e8, 0x7e9 -// 20100105 - 2010-01-05aRagexeRE+ - 0x801 +// 20091103 - 2009-11-03aRagexeRE+ - 0x7f7, 0x7f8, 0x7f9 +// 20100105 - 2010-01-05aRagexeRE+ - 0x133, 0x800, 0x801 +// 20100223 - 2010-02-23aRagexeRE+ - 0x80f + #ifndef PACKETVER #define PACKETVER 20081126 - //#define PACKETVER 20100105 + //#define PACKETVER 20100223 #endif // backward compatible PACKETVER 8 and 9 #if PACKETVER == 8 diff --git a/src/map/clif.c b/src/map/clif.c index 7d14ac446..5f49ac039 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3298,37 +3298,62 @@ void clif_tradestart(struct map_session_data* sd, uint8 type) void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) { int fd; + unsigned char *buf; +#if PACKETVER < 20100223 + const int cmd = 0xe9; +#else + const int cmd = 0x80f; +#endif nullpo_retv(sd); nullpo_retv(tsd); fd = tsd->fd; - WFIFOHEAD(fd,packet_len(0xe9)); - WFIFOW(fd,0) = 0xe9; - WFIFOL(fd,2) = amount; + buf = WFIFOP(fd,0); + WFIFOHEAD(fd,packet_len(cmd)); + WBUFW(buf,0) = cmd; if( index == 0 ) { - WFIFOW(fd,6) = 0; // type id - WFIFOB(fd,8) = 0; //identify flag - WFIFOB(fd,9) = 0; // attribute - WFIFOB(fd,10)= 0; //refine - WFIFOW(fd,11)= 0; //card (4w) - WFIFOW(fd,13)= 0; //card (4w) - WFIFOW(fd,15)= 0; //card (4w) - WFIFOW(fd,17)= 0; //card (4w) +#if PACKETVER < 20100223 + WBUFL(buf,2) = amount; //amount + WBUFW(buf,6) = 0; // type id +#else + WBUFW(buf,2) = 0; // type id + WBUFB(buf,4) = 0; // item type + WBUFL(buf,5) = amount; // amount + buf = WBUFP(buf,1); //Advance 1B +#endif + WBUFB(buf,8) = 0; //identify flag + WBUFB(buf,9) = 0; // attribute + WBUFB(buf,10)= 0; //refine + WBUFW(buf,11)= 0; //card (4w) + WBUFW(buf,13)= 0; //card (4w) + WBUFW(buf,15)= 0; //card (4w) + WBUFW(buf,17)= 0; //card (4w) } else { index -= 2; //index fix +#if PACKETVER < 20100223 + WBUFL(buf,2) = amount; //amount if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) - WFIFOW(fd,6) = sd->inventory_data[index]->view_id; + WBUFW(buf,6) = sd->inventory_data[index]->view_id; else - WFIFOW(fd,6) = sd->status.inventory[index].nameid; // type id - WFIFOB(fd,8) = sd->status.inventory[index].identify; //identify flag - WFIFOB(fd,9) = sd->status.inventory[index].attribute; // attribute - WFIFOB(fd,10)= sd->status.inventory[index].refine; //refine - clif_addcards(WFIFOP(fd, 11), &sd->status.inventory[index]); + WBUFW(buf,6) = sd->status.inventory[index].nameid; // type id +#else + if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) + WBUFW(buf,2) = sd->inventory_data[index]->view_id; + else + WBUFW(buf,2) = sd->status.inventory[index].nameid; // type id + WBUFB(buf,4) = sd->inventory_data[index]->type; // item type + WBUFL(buf,5) = amount; // amount + buf = WBUFP(buf,1); //Advance 1B +#endif + WBUFB(buf,8) = sd->status.inventory[index].identify; //identify flag + WBUFB(buf,9) = sd->status.inventory[index].attribute; // attribute + WBUFB(buf,10)= sd->status.inventory[index].refine; //refine + clif_addcards(WBUFP(buf, 11), &sd->status.inventory[index]); } - WFIFOSET(fd,packet_len(0xe9)); + WFIFOSET(fd,packet_len(cmd)); } /*========================================== @@ -3469,22 +3494,33 @@ void clif_updateguildstorageamount(struct map_session_data* sd, int amount) void clif_guildstorageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) { int view,fd; + unsigned char *buf; +#if PACKETVER < 20090603 + const int cmd = 0xf4; +#else + const int cmd = 0x1c4; +#endif nullpo_retv(sd); nullpo_retv(i); fd=sd->fd; view = itemdb_viewid(i->nameid); + buf = WFIFOP(fd,0); - WFIFOHEAD(fd,packet_len(0xf4)); - WFIFOW(fd, 0) = 0xf4; // Storage item added - WFIFOW(fd, 2) = index+1; // index - WFIFOL(fd, 4) = amount; // amount - WFIFOW(fd, 8) = ( view > 0 ) ? view : i->nameid; // id - WFIFOB(fd,10) = i->identify; //identify flag - WFIFOB(fd,11) = i->attribute; // attribute - WFIFOB(fd,12) = i->refine; //refine - clif_addcards(WFIFOP(fd,13), i); - WFIFOSET(fd,packet_len(0xf4)); + WFIFOHEAD(fd,packet_len(cmd)); + WBUFW(buf, 0) = cmd; // Storage item added + WBUFW(buf, 2) = index+1; // index + WBUFL(buf, 4) = amount; // amount + WBUFW(buf, 8) = ( view > 0 ) ? view : i->nameid; // id +#if PACKETVER >= 20090603 + WBUFB(buf,10) = itemdb_type(i->nameid); //type + buf = WBUFP(buf,1); //Advance 1B +#endif + WBUFB(buf,10) = i->identify; //identify flag + WBUFB(buf,11) = i->attribute; // attribute + WBUFB(buf,12) = i->refine; //refine + clif_addcards(WBUFP(buf,13), i); + WFIFOSET(fd,packet_len(cmd)); } /*========================================== @@ -5489,6 +5525,7 @@ void clif_closevendingboard(struct block_list* bl, int fd) /*========================================== * Sends a list of items in a shop * R 0133 .w .l {.l .w .w .B .w .B .B .B .4w}.22B + * R 0800 .w .l .l {.l .w .w .B .w .B .B .B .4w}.22B *------------------------------------------*/ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* vending) { @@ -5496,8 +5533,10 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven int count; struct map_session_data* vsd; #if PACKETVER < 20100105 + const int cmd = 0x133; const int offset = 8; #else + const int cmd = 0x800; const int offset = 12; #endif @@ -5509,7 +5548,7 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven count = vsd->vend_num; WFIFOHEAD(fd, offset+count*22); - WFIFOW(fd,0) = 0x133; + WFIFOW(fd,0) = cmd; WFIFOW(fd,2) = offset+count*22; WFIFOL(fd,4) = id; #if PACKETVER >= 20100105 @@ -10445,10 +10484,12 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) if( !p->party.member[i].leader ) return; - //The client no longer can change the item-field, therefore it always - //comes as zero. Here, resend the item data as it is. -// party_changeoption(sd, RFIFOW(fd,2), RFIFOW(fd,4)); +#if PACKETVER < 20090603 + //Client can't change the item-field party_changeoption(sd, RFIFOW(fd,2), p->party.item); +#else + party_changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)+(RFIFOB(fd,7)?2:0))); +#endif } /*========================================== @@ -10483,7 +10524,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) party_send_message(sd, text, textlen); } -/* +/*========================================== * Changes Party Leader * S 07da .L *------------------------------------------*/ @@ -10526,7 +10567,7 @@ void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) /*========================================== * Shop item(s) purchase request - * S 0134 .w .l .l {.w .w}.4B* + * S 0134/0801 .w .l .l {.w .w}.4B* *------------------------------------------*/ void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) { @@ -13728,9 +13769,9 @@ static int packetdb_readdb(void) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PACKETVER <= 20081217 - 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,110, 3, 2, + 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,110, 3, 2, #else - 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,114, 3, 2, + 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,114, 3, 2, #endif #if PACKETVER < 2 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6, @@ -13801,7 +13842,7 @@ static int packetdb_readdb(void) //#0x02C0 0, 0, 0, 0, 0, 30, 0, 0, 0, 3, 0, 65, 4, 71, 10, 0, 0, 0, 0, 0, 29, 0, 6, -1, 10, 10, 3, 0, -1, 32, 6, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 59, 60, 8, 10, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //#0x0300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -13858,47 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8, 8, 32, -1, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - //#0x800 - 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 14, 93, 86, 87, 0, 0, 0, 0, 0, 0, + //#0x0800 + -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; struct { void (*func)(int, struct map_session_data *); diff --git a/src/map/clif.h b/src/map/clif.h index 605bbd762..958acc5ee 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -27,7 +27,7 @@ struct battleground_data; struct quest; #include // packet DB -#define MAX_PACKET_DB 0x810 +#define MAX_PACKET_DB 0x900 #define MAX_PACKET_VER 25 struct s_packet_db { -- cgit v1.2.3-60-g2f50