Преглед изворни кода

Added correct extended info packets for items that are being moved into storage or cart.
This caused items to visually lose their properties once they have been moved from inventory (bugreport:250).

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

ultramage пре 17 година
родитељ
комит
14017b0f8a
3 измењених фајлова са 46 додато и 6 уклоњено
  1. 5 0
      Changelog-Trunk.txt
  2. 40 5
      src/map/clif.c
  3. 1 1
      src/map/clif.h

+ 5 - 0
Changelog-Trunk.txt

@@ -3,6 +3,11 @@ Date	Added
 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.
 
+2008/05/09
+	* Added correct extended info packets for items that are being moved
+	  into storage or cart. This caused items to visually lose their
+	  properties once they have been moved from inventory (bugreport:250).
+	  The modification is mostly copypaste but it works nicely [ultramage]
 2008/05/07
 	* Corrected default guild positions not being saved during guild creation.
 	* Did some cleanup of the splash code, the NPC_WIDE* skills now send the

+ 40 - 5
src/map/clif.c

@@ -3201,8 +3201,9 @@ int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int i
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, stor);
-
 	fd=sd->fd;
+
+#if PACKETVER < 5
 	WFIFOHEAD(fd,packet_len(0xf4));
 	WFIFOW(fd,0) =0xf4; // Storage item added
 	WFIFOW(fd,2) =index+1; // index
@@ -3216,6 +3217,22 @@ int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int i
 	WFIFOB(fd,12)=stor->storage_[index].refine; //refine
 	clif_addcards(WFIFOP(fd,13), &stor->storage_[index]);
 	WFIFOSET(fd,packet_len(0xf4));
+#else
+	WFIFOHEAD(fd,packet_len(0x1c4));
+	WFIFOW(fd,0) =0x1c4; // Storage item added
+	WFIFOW(fd,2) =index+1; // index
+	WFIFOL(fd,4) =amount; // amount
+	if((view = itemdb_viewid(stor->storage_[index].nameid)) > 0)
+		WFIFOW(fd,8) =view;
+	else
+		WFIFOW(fd,8) =stor->storage_[index].nameid; // id
+	WFIFOB(fd,10)=itemdb_type(stor->storage_[index].nameid); //type
+	WFIFOB(fd,11)=stor->storage_[index].identify; //identify flag
+	WFIFOB(fd,12)=stor->storage_[index].attribute; // attribute
+	WFIFOB(fd,13)=stor->storage_[index].refine; //refine
+	clif_addcards(WFIFOP(fd,14), &stor->storage_[index]);
+	WFIFOSET(fd,packet_len(0x1c4));
+#endif
 
 	return 0;
 }
@@ -4348,8 +4365,7 @@ int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
 //		The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex]
 //		WBUFB(buf,20+i)= (unsigned char)((fix=battle_attr_ratio(i+1,status->def_ele, status->ele_lv))<0?0:fix);
 
-	clif_send(buf,packet_len(0x18c),&sd->bl,
-		sd->status.party_id>0?PARTY_SAMEMAP:SELF);
+	clif_send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF);
 	return 0;
 }
 /*==========================================
@@ -5002,11 +5018,12 @@ int clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
 	nullpo_retr(0, sd);
 
 	fd=sd->fd;
-	WFIFOHEAD(fd,packet_len(0x124));
-	buf=WFIFOP(fd,0);
 	if(n<0 || n>=MAX_CART || sd->status.cart[n].nameid<=0)
 		return 1;
 
+#if PACKETVER < 5
+	WFIFOHEAD(fd,packet_len(0x124));
+	buf=WFIFOP(fd,0);
 	WBUFW(buf,0)=0x124;
 	WBUFW(buf,2)=n+2;
 	WBUFL(buf,4)=amount;
@@ -5019,6 +5036,24 @@ int clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
 	WBUFB(buf,12)=sd->status.cart[n].refine;
 	clif_addcards(WBUFP(buf,13), &sd->status.cart[n]);
 	WFIFOSET(fd,packet_len(0x124));
+#else
+	WFIFOHEAD(fd,packet_len(0x1c5));
+	buf=WFIFOP(fd,0);
+	WBUFW(buf,0)=0x1c5;
+	WBUFW(buf,2)=n+2;
+	WBUFL(buf,4)=amount;
+	if((view = itemdb_viewid(sd->status.cart[n].nameid)) > 0)
+		WBUFW(buf,8)=view;
+	else
+		WBUFW(buf,8)=sd->status.cart[n].nameid;
+	WBUFB(buf,10)=itemdb_type(sd->status.cart[n].nameid);
+	WBUFB(buf,11)=sd->status.cart[n].identify;
+	WBUFB(buf,12)=sd->status.cart[n].attribute;
+	WBUFB(buf,13)=sd->status.cart[n].refine;
+	clif_addcards(WBUFP(buf,14), &sd->status.cart[n]);
+	WFIFOSET(fd,packet_len(0x1c5));
+#endif
+
 	return 0;
 }
 

+ 1 - 1
src/map/clif.h

@@ -32,7 +32,7 @@ struct quest;
 //        2 - ?                  - 0x78, 0x79
 //        3 - ?                  - 0x1c8, 0x1c9, 0x1de
 //        4 - ?                  - 0x1d7, 0x1d8, 0x1d9, 0x1da
-//        5 - 2003-12-18aSakexe+ - 0x1ee, 0x1ef, 0x1f0
+//        5 - 2003-12-18aSakexe+ - 0x1ee, 0x1ef, 0x1f0, ?0x1c4, 0x1c5?
 //        6 - 2004-03-02aSakexe+ - 0x1f4, 0x1f5
 //        7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c
 // 20070521 - 2007-05-21aSakexe+ - 0x283