From 7332d10a5961e767091639e9666e2594834fc4d1 Mon Sep 17 00:00:00 2001
From: skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>
Date: Fri, 7 Jul 2006 19:30:53 +0000
Subject: - Should have fixed clif_item_sub to properly store pet egg/armor
 data. There should be no more "random refine levels" bugs related to these.

git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7574 54d463be-8e91-2dee-dedb-b68131a5f0ec
---
 Changelog-Trunk.txt |  3 +++
 src/map/clif.c      | 20 ++++++++++----------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index a511ab40b..c5fc31863 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/07/07
+	* Should have fixed clif_item_sub to properly store pet egg/armor data.
+	  There should be no more "random refine levels" bugs related to these.
+	  [Skotlex]
 	* itemdb_exists will now return NULL for item_id 0. [Skotlex]
 	* Added a check to free a character from memory when changing map servers.
 	  [Skotlex]
diff --git a/src/map/clif.c b/src/map/clif.c
index e0ddc6504..3ee121d2f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2214,8 +2214,8 @@ int clif_delitem(struct map_session_data *sd,int n,int amount)
 }
 
 // Simplifies inventory/cart/storage packets by handling the packet section relevant to items. [Skotlex]
-// Equip is > 0 for equippable items (holds the equip-point)
-// 0 for stackable items, -1 for stackable items where arrows must send in the equip-point.
+// Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet 
+// armor/egg) -1 for stackable items, -2 for stackable items where arrows must send in the equip-point.
 void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip)
 {
 	if (id->view_id > 0)
@@ -2224,15 +2224,15 @@ void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *
 		WBUFW(buf,n)=i->nameid;
 	WBUFB(buf,n+2)=itemtype(id->type);
 	WBUFB(buf,n+3)=i->identify;
-	if (equip > 0 || id->type == 7) { //Equippable item (pet eggs also count).
+	if (equip >= 0) { //Equippable item 
 		WBUFW(buf,n+4)=equip;
 		WBUFW(buf,n+6)=i->equip;
 		WBUFB(buf,n+8)=i->attribute;
 		WBUFB(buf,n+9)=i->refine;
 	} else { //Stackable item.
 		WBUFW(buf,n+4)=i->amount;
-		if (equip == -1 && id->equip == 0x8000)
-			WBUFW(buf,n+6)=0x8000;
+		if (equip == -2 && id->equip == EQP_AMMO)
+			WBUFW(buf,n+6)=EQP_AMMO;
 		else
 			WBUFW(buf,n+6)=0;
 	}
@@ -2265,8 +2265,8 @@ void clif_inventorylist(struct map_session_data *sd)
 			ne++;
 		} else { //Stackable.
 			WBUFW(buf,n*s+4)=i+2;
-			clif_item_sub(buf, n*s+6, &sd->status.inventory[i], sd->inventory_data[i], -1);
-			if (sd->inventory_data[i]->equip == 0x8000 &&
+			clif_item_sub(buf, n*s+6, &sd->status.inventory[i], sd->inventory_data[i], -2);
+			if (sd->inventory_data[i]->equip == EQP_AMMO &&
 				sd->status.inventory[i].equip)
 				arrow=i;
 #if PACKETVER >= 5
@@ -2349,7 +2349,7 @@ void clif_storagelist(struct map_session_data *sd,struct storage *stor)
 			ne++;
 		} else { //Stackable
 			WBUFW(buf,n*s+4)=i+1;
-			clif_item_sub(buf, n*s+6, &stor->storage_[i], id, 0);
+			clif_item_sub(buf, n*s+6, &stor->storage_[i], id,-1);
 #if PACKETVER >= 5
 			clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
 #endif
@@ -2399,7 +2399,7 @@ void clif_guildstoragelist(struct map_session_data *sd,struct guild_storage *sto
 			ne++;
 		} else { //Stackable
 			WBUFW(buf,n*s+4)=i+1;
-			clif_item_sub(buf, n*s+6, &stor->storage_[i], id, 0);
+			clif_item_sub(buf, n*s+6, &stor->storage_[i], id,-1);
 #if PACKETVER >= 5
 			clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
 #endif
@@ -2448,7 +2448,7 @@ void clif_cartlist(struct map_session_data *sd)
 			ne++;
 		} else { //Stackable
 			WBUFW(buf,n*s+4)=i+2;
-			clif_item_sub(buf, n*s+6, &sd->status.cart[i], id, 0);
+			clif_item_sub(buf, n*s+6, &sd->status.cart[i], id,-1);
 #if PACKETVER >= 5
 			clif_addcards(WBUFP(buf,n*s+14), &sd->status.cart[i]);
 #endif
-- 
cgit v1.2.3-70-g09d2