Browse Source

* Updated packet for the view players' equip feature for 2010-11-24aRagexeRE+ and made it support robes (follow up to r14797).
- Fixed spawn/walking packets using wrong variable for shifting buffer reference (since r14797).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14799 54d463be-8e91-2dee-dedb-b68131a5f0ec

ai4rei 14 years ago
parent
commit
97eded0c3e
2 changed files with 39 additions and 27 deletions
  1. 2 0
      Changelog-Trunk.txt
  2. 37 27
      src/map/clif.c

+ 2 - 0
Changelog-Trunk.txt

@@ -1,6 +1,8 @@
 Date	Added
 
 2011/04/17
+	* Updated packet for the view players' equip feature for 2010-11-24aRagexeRE+ and made it support robes (follow up to r14797). [Ai4rei]
+	- Fixed spawn/walking packets using wrong variable for shifting buffer reference (since r14797).
 	* Fixed char-server missing some WFIFOHEAD (partially due to r10909 being reverted by r11245, follow up to r9307 and r14618). [Ai4rei]
 2011/04/16
 	* Added support for visible garments/robes. [Ai4rei]

+ 37 - 27
src/map/clif.c

@@ -886,7 +886,7 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
 #if PACKETVER >= 20110111
 	WBUFW(buf,34) = vd->robe;
 	offset+= 2;
-	buf = WBUFP(buf,offset);
+	buf = WBUFP(buffer,offset);
 #endif
 	WBUFL(buf,34) = status_get_guild_id(bl);
 	WBUFW(buf,38) = status_get_emblem_id(bl);
@@ -1009,7 +1009,7 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
 #if PACKETVER >= 20110111
 	WBUFW(buf,38) = vd->robe;
 	offset+= 2;
-	buf = WBUFP(buf,offset);
+	buf = WBUFP(buffer,offset);
 #endif
 	WBUFL(buf,38) = status_get_guild_id(bl);
 	WBUFW(buf,42) = status_get_emblem_id(bl);
@@ -8056,15 +8056,15 @@ void clif_equipcheckbox(struct map_session_data* sd)
 	WFIFOSET(fd, packet_len(0x2da));
 }
 
-/*==========================================
- * Sends info about a player's equipped items
- * R 002d7 <length>.W <name>.24B <class>.w <hairstyle>.w <up-viewid>.w <mid-viewid>.w <low-viewid>.w <haircolor>.w <cloth-dye>.w <gender>.1B {equip item}.26B*
- * for PACKETVER >= 20100629
- * R 002d7 <length>.W <name>.24B <class>.w <hairstyle>.w <bottom-viewid>.w <mid-viewid>.w <up-viewid>.w <haircolor>.w <cloth-dye>.w <gender>.1B {equip item}.28B*
- *------------------------------------------*/
+/// Sends info about a player's equipped items (ZC_EQUIPWIN_MICROSCOPE)
+/// 02d7 <packet len>.W <name>.24B <class>.W <hairstyle>.W <up-viewid>.W <mid-viewid>.W <low-viewid>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.26B*
+/// 02d7 <packet len>.W <name>.24B <class>.W <hairstyle>.W <bottom-viewid>.W <mid-viewid>.W <up-viewid>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.28B* (PACKETVER >= 20100629)
+/// 0859 <packet len>.W <name>.24B <class>.W <hairstyle>.W <bottom-viewid>.W <mid-viewid>.W <up-viewid>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.28B* (PACKETVER >= 20101124)
+/// 0859 <packet len>.W <name>.24B <class>.W <hairstyle>.W <bottom-viewid>.W <mid-viewid>.W <up-viewid>.W <robe>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.28B* (PACKETVER >= 20110111)
 void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd)
 {
-	int i, n, fd;
+	uint8* buf;
+	int i, n, fd, offset = 0;
 #if PACKETVER < 20100629
 	const int s = 26;
 #else
@@ -8075,17 +8075,27 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
 	fd = sd->fd;
 	
 	WFIFOHEAD(fd, MAX_INVENTORY * s + 43);
+	buf = WFIFOP(fd,0);
 
-	WFIFOW(fd, 0) = 0x2d7;
-	safestrncpy((char*)WFIFOP(fd, 4), tsd->status.name, NAME_LENGTH);
-	WFIFOW(fd,28) = tsd->status.class_;
-	WFIFOW(fd,30) = tsd->vd.hair_style;	
-	WFIFOW(fd,32) = tsd->vd.head_bottom;
-	WFIFOW(fd,34) = tsd->vd.head_mid;
-	WFIFOW(fd,36) = tsd->vd.head_top;
-	WFIFOW(fd,38) = tsd->vd.hair_color;
-	WFIFOW(fd,40) = tsd->vd.cloth_color;
-	WFIFOB(fd,42) = tsd->vd.sex;
+#if PACKETVER < 20101124
+	WBUFW(buf, 0) = 0x2d7;
+#else
+	WBUFW(buf, 0) = 0x859;
+#endif
+	safestrncpy((char*)WBUFP(buf, 4), tsd->status.name, NAME_LENGTH);
+	WBUFW(buf,28) = tsd->status.class_;
+	WBUFW(buf,30) = tsd->vd.hair_style;	
+	WBUFW(buf,32) = tsd->vd.head_bottom;
+	WBUFW(buf,34) = tsd->vd.head_mid;
+	WBUFW(buf,36) = tsd->vd.head_top;
+#if PACKETVER >= 20110111
+	WBUFW(buf,38) = tsd->vd.robe;
+	offset+= 2;
+	buf = WBUFP(buf,2);
+#endif
+	WBUFW(buf,38) = tsd->vd.hair_color;
+	WBUFW(buf,40) = tsd->vd.cloth_color;
+	WBUFB(buf,42) = tsd->vd.sex;
 	
 	for(i=0,n=0; i < MAX_INVENTORY; i++)
 	{
@@ -8095,24 +8105,24 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
 			continue;
 	
 		// Inventory position
-		WFIFOW(fd, n*s+43) = i + 2;
+		WBUFW(buf, n*s+43) = i + 2;
 		// Add refine, identify flag, element, etc.
-		clif_item_sub(WFIFOP(fd,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc_equippoint(tsd, i));
+		clif_item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc_equippoint(tsd, i));
 		// Add cards
-		clif_addcards(WFIFOP(fd, n*s+55), &tsd->status.inventory[i]);	
+		clif_addcards(WBUFP(buf, n*s+55), &tsd->status.inventory[i]);	
 		// Expiration date stuff, if all of those are set to 0 then the client doesn't show anything related (6 bytes)
-		WFIFOL(fd, n*s+63) = tsd->status.inventory[i].expire_time;
-		WFIFOW(fd, n*s+67) = 0;
+		WBUFL(buf, n*s+63) = tsd->status.inventory[i].expire_time;
+		WBUFW(buf, n*s+67) = 0;
 #if PACKETVER >= 20100629
 		if (tsd->inventory_data[i]->equip&EQP_VISIBLE)
-			WFIFOW(fd, n*s+69) = tsd->inventory_data[i]->look;
+			WBUFW(buf, n*s+69) = tsd->inventory_data[i]->look;
 		else
-			WFIFOW(fd, n*s+69) = 0;
+			WBUFW(buf, n*s+69) = 0;
 #endif
 		n++;
 	}
 
-	WFIFOW(fd, 2) = 43 + n*s;	// Set length
+	WFIFOW(fd, 2) = 43+offset+n*s;	// Set length
 	WFIFOSET(fd, WFIFOW(fd, 2));
 }