diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-28 00:07:12 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-28 00:07:12 +0000 |
commit | b3f8687feebcd9fd8d4f27e97ed33e4b0f951a63 (patch) | |
tree | 5c8c8f44d5645f35e894a03aed4d5fc0334851fe /src/map | |
parent | aafdd20c6f7ea338999bbf7b42bbb948aa8c7a0b (diff) | |
download | hercules-b3f8687feebcd9fd8d4f27e97ed33e4b0f951a63.tar.gz hercules-b3f8687feebcd9fd8d4f27e97ed33e4b0f951a63.tar.bz2 hercules-b3f8687feebcd9fd8d4f27e97ed33e4b0f951a63.tar.xz hercules-b3f8687feebcd9fd8d4f27e97ed33e4b0f951a63.zip |
* Reconstructed a list of all PACKETVER types, by reverse-engineering it from places in the code where the define is used
- recovered PACKETVER 6 which was added in r51, but overwritten by r141, one of the dumbest commits that I have seen so far
- since 6 was the 'new trade window' update, it and its corresponding reply packet will now be used from now on instead the old version
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11830 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 55 | ||||
-rw-r--r-- | src/map/clif.h | 9 | ||||
-rw-r--r-- | src/map/trade.c | 4 |
3 files changed, 50 insertions, 18 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 2dfad87a8..ba50ea01a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -700,10 +700,6 @@ int clif_clearunit_delayed(struct block_list* bl, unsigned int tick) void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand) { -#if PACKETVER > 3 - struct item_data *id; -#endif - if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER)) { *rhand = *lhand = 0; @@ -717,7 +713,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un if (sd->equip_index[EQI_HAND_R] >= 0 && sd->inventory_data[sd->equip_index[EQI_HAND_R]]) { - id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; if (id->view_id > 0) *rhand = id->view_id; else @@ -729,7 +725,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && sd->inventory_data[sd->equip_index[EQI_HAND_L]]) { - id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; + struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; if (id->view_id > 0) *lhand = id->view_id; else @@ -3155,32 +3151,61 @@ void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, bool flag /*========================================== * Opens a trade request window from char 'name' * R 00e5 <nick>.24B + * R 01f4 <nick>.24B <charid>.L <baselvl>.W *------------------------------------------*/ void clif_traderequest(struct map_session_data* sd, const char* name) { - int fd; - nullpo_retv(sd); + int fd = sd->fd; - fd = sd->fd; +#if PACKETVER < 6 WFIFOHEAD(fd,packet_len(0xe5)); WFIFOW(fd,0) = 0xe5; safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH); WFIFOSET(fd,packet_len(0xe5)); +#else + struct map_session_data* tsd = map_id2sd(sd->trade_partner); + if( !tsd ) return; + + WFIFOHEAD(fd,packet_len(0x1f4)); + WFIFOW(fd,0) = 0x1f4; + safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH); + WFIFOL(fd,26) = tsd->status.char_id; + WFIFOW(fd,30) = tsd->status.base_level; + WFIFOSET(fd,packet_len(0x1f4)); +#endif } /*========================================== - * 取り引き要求応答 + * Reply to a trade-request. + * R 00e7 <type>.B + * R 01f5 <type>.B <charid>.L <baselvl>.W + * Type: + * 0: Char is too far + * 1: Character does not exist + * 2: Trade failed + * 3: Accept + * 4: Cancel *------------------------------------------*/ -void clif_tradestart(struct map_session_data* sd, int type) +void clif_tradestart(struct map_session_data* sd, uint8 type) { - int fd; - nullpo_retv(sd); - - fd = sd->fd; + int fd = sd->fd; + +#if PACKETVER < 6 WFIFOHEAD(fd,packet_len(0xe7)); WFIFOW(fd,0) = 0xe7; WFIFOB(fd,2) = type; WFIFOSET(fd,packet_len(0xe7)); +#else + struct map_session_data* tsd = map_id2sd(sd->trade_partner); + if( !tsd ) return; + + WFIFOHEAD(fd,packet_len(0x1f5)); + WFIFOW(fd,0) = 0x1f5; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = tsd->status.char_id; + WFIFOW(fd,7) = tsd->status.base_level; + WFIFOSET(fd,packet_len(0x1f5)); +#endif } /*========================================== diff --git a/src/map/clif.h b/src/map/clif.h index daca310ef..a1246f97a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -26,6 +26,13 @@ struct guild; #include <stdarg.h> // server->client protocol version +// v0 - pre-? +// v1 - ? - 0x196 +// v2 - ? - 0x78, 0x79 +// v3 - ? - 0x1c8, 0x1c9, 0x1de +// v4 - ? - 0x1d7, 0x1d8, 0x1d9, 0x1da +// v5 - 2003-12-18aSakexe+ - 0x1ee, 0x1ef, 0x1f0 +// v6 - 2004-03-02aSakexe+ - 0x1f4, 0x1f5 // v7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c // v8 - 2007-05-21aSakexe+ - 0x283 // v9 - 2007-11-06aSakexe+ - 0x78, 0x7c, 0x22c @@ -168,7 +175,7 @@ void clif_hotkeys_send(struct map_session_data *sd); // trade void clif_traderequest(struct map_session_data* sd, const char* name); -void clif_tradestart(struct map_session_data* sd, int type); +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); void clif_tradeitemok(struct map_session_data* sd, int index, int fail); void clif_tradedeal_lock(struct map_session_data* sd, int fail); diff --git a/src/map/trade.c b/src/map/trade.c index eadc115a7..fcb116d06 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -84,8 +84,8 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta * Reply to a trade-request. * Type values: * 0: Char is too far - * 1: Character does not exists - * 2: Trade failed + * 1: Character does not exist + * 2: Trade failed * 3: Accept * 4: Cancel * Weird enough, the client should only send 3/4 |