* 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://svn.code.sf.net/p/rathena/svn/trunk@11830 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-11-28 00:07:12 +00:00
parent c89ad7bb99
commit 1f8e1313df
4 changed files with 57 additions and 18 deletions

View File

@ -3,6 +3,13 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/11/28
* Reconstructed a list of all PACKETVER types, by reverse-engineering
it from places in the code where the define is used [ultramage]
- 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
2007/11/27 2007/11/27
* Added safesnprintf to strlib.c/h (bugreport:372) [FlavioJS] * Added safesnprintf to strlib.c/h (bugreport:372) [FlavioJS]
* removed login/char server_fd[] arrays, added server[].fd instead * removed login/char server_fd[] arrays, added server[].fd instead

View File

@ -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) 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)) if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER))
{ {
*rhand = *lhand = 0; *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 && if (sd->equip_index[EQI_HAND_R] >= 0 &&
sd->inventory_data[sd->equip_index[EQI_HAND_R]]) 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) if (id->view_id > 0)
*rhand = id->view_id; *rhand = id->view_id;
else 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->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] &&
sd->inventory_data[sd->equip_index[EQI_HAND_L]]) 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) if (id->view_id > 0)
*lhand = id->view_id; *lhand = id->view_id;
else 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' * Opens a trade request window from char 'name'
* R 00e5 <nick>.24B * R 00e5 <nick>.24B
* R 01f4 <nick>.24B <charid>.L <baselvl>.W
*------------------------------------------*/ *------------------------------------------*/
void clif_traderequest(struct map_session_data* sd, const char* name) void clif_traderequest(struct map_session_data* sd, const char* name)
{ {
int fd; int fd = sd->fd;
nullpo_retv(sd);
fd = sd->fd; #if PACKETVER < 6
WFIFOHEAD(fd,packet_len(0xe5)); WFIFOHEAD(fd,packet_len(0xe5));
WFIFOW(fd,0) = 0xe5; WFIFOW(fd,0) = 0xe5;
safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH); safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH);
WFIFOSET(fd,packet_len(0xe5)); 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; int fd = sd->fd;
nullpo_retv(sd);
#if PACKETVER < 6
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0xe7)); WFIFOHEAD(fd,packet_len(0xe7));
WFIFOW(fd,0) = 0xe7; WFIFOW(fd,0) = 0xe7;
WFIFOB(fd,2) = type; WFIFOB(fd,2) = type;
WFIFOSET(fd,packet_len(0xe7)); 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
} }
/*========================================== /*==========================================

View File

@ -26,6 +26,13 @@ struct guild;
#include <stdarg.h> #include <stdarg.h>
// server->client protocol version // 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 // v7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c
// v8 - 2007-05-21aSakexe+ - 0x283 // v8 - 2007-05-21aSakexe+ - 0x283
// v9 - 2007-11-06aSakexe+ - 0x78, 0x7c, 0x22c // v9 - 2007-11-06aSakexe+ - 0x78, 0x7c, 0x22c
@ -168,7 +175,7 @@ void clif_hotkeys_send(struct map_session_data *sd);
// trade // trade
void clif_traderequest(struct map_session_data* sd, const char* name); 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_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_tradeitemok(struct map_session_data* sd, int index, int fail);
void clif_tradedeal_lock(struct map_session_data* sd, int fail); void clif_tradedeal_lock(struct map_session_data* sd, int fail);

View File

@ -84,8 +84,8 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
* Reply to a trade-request. * Reply to a trade-request.
* Type values: * Type values:
* 0: Char is too far * 0: Char is too far
* 1: Character does not exists * 1: Character does not exist
* 2: Trade failed * 2: Trade failed
* 3: Accept * 3: Accept
* 4: Cancel * 4: Cancel
* Weird enough, the client should only send 3/4 * Weird enough, the client should only send 3/4