summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 00:07:12 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-28 00:07:12 +0000
commitb3f8687feebcd9fd8d4f27e97ed33e4b0f951a63 (patch)
tree5c8c8f44d5645f35e894a03aed4d5fc0334851fe /src/map/clif.c
parentaafdd20c6f7ea338999bbf7b42bbb948aa8c7a0b (diff)
downloadhercules-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/clif.c')
-rw-r--r--src/map/clif.c55
1 files changed, 40 insertions, 15 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
}
/*==========================================