Kaynağa Gözat

Fix bugreport:7806 (cashshop buy_list index typo for 2012 client, remove duplicated code)
Upd gitignore to exclude conf/msg_conf/import as well

lighta 12 yıl önce
ebeveyn
işleme
e28c507477
3 değiştirilmiş dosya ile 18 ekleme ve 23 silme
  1. 2 0
      .gitignore
  2. 2 2
      db/packet_db.txt
  3. 14 21
      src/map/clif.c

+ 2 - 0
.gitignore

@@ -23,6 +23,7 @@
 /Makefile.cache
 /map-server_sql
 /mapcache
+/nbproject
 
 # /3rdparty/libconfig/
 /3rdparty/libconfig/Makefile
@@ -34,6 +35,7 @@
 
 # /conf/
 /conf/import
+/conf/msg_conf/import
 
 # /log/
 /log/*.log

+ 2 - 2
db/packet_db.txt

@@ -1707,7 +1707,7 @@ packet_ver: 30
 0x089c,26,friendslistadd,2
 0x0885,5,hommenu,2:4
 0x0961,36,storagepassword,2:4:20
-0x0288,-1,cashshopbuy,2:4:6:10
+0x0288,-1,cashshopbuy,2:4:8:10
 0x091c,26,partyinvite2,2
 0x094b,19,wanttoconnection,2:6:10:14:18
 0x0369,7,actionrequest,2:6
@@ -1816,7 +1816,7 @@ packet_ver: 34
 0x0447,2,booking_playcancel,0
 0x044A,6,clientversion,2
 0x0844,2,cashshopopen,0
-0x0848,-1,cashshopbuy,2:4:6:10
+0x0848,-1,cashshopbuy,2:6:4:10
 0x084a,2,cashshopclose,0
 0x084b,19 //fallitem4
 0x085a,90,useskilltoposinfo,2:4:6:8:10

+ 14 - 21
src/map/clif.c

@@ -14523,13 +14523,13 @@ void clif_cashshop_ack(struct map_session_data* sd, int error)
 	WFIFOSET(fd, packet_len(0x289));
 }
 
-// TODO: find a more accurate date for this
-#if PACKETVER < 20130320
 /// Request to buy item(s) from cash shop (CZ_PC_BUY_CASH_POINT_ITEM).
 /// 0288 <name id>.W <amount>.W
 /// 0288 <name id>.W <amount>.W <kafra points>.L (PACKETVER >= 20070711)
 /// 0288 <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W }.4B*count (PACKETVER >= 20100803)
+/// 0848 <packet len>.W <count>.W <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W <tab>.W }.6B*count (PACKETVER >= 20130000)
 void clif_parse_cashshop_buy(int fd, struct map_session_data *sd){
+
 	int fail = 0;
 	struct s_packet_db* info;
 
@@ -14547,23 +14547,30 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd){
 
 		fail = npc_cashshop_buy(sd, nameid, amount, points);
 #else
+	#if PACKETVER < 20130000 //found accurate date
+		int s_itl = 6;
+	#else
+		int s_itl = 4;//item _list size
+	#endif
 		int len    = RFIFOW(fd,info->pos[0]);
 		int points = RFIFOL(fd,info->pos[1]);
 		int count  = RFIFOW(fd,info->pos[2]);
 		unsigned short* item_list = (unsigned short*)RFIFOP(fd,info->pos[3]);
-
-		if( len < 10 || len != 10 + count * 4)
-		{
-			ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * 4);
+	
+		if( len < 10 || len != 10 + count * s_itl){
+			ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * s_itl);
 			return;
 		}
+	#if PACKETVER < 20130000
 		fail = npc_cashshop_buylist(sd,points,count,item_list);
+	#else PACKETVER >= 20130000
+		cashshop_buylist( sd, points, count, item_list);
+	#endif
 #endif
 	}
 
 	clif_cashshop_ack(sd,fail);
 }
-#endif
 
 /// Adoption System
 ///
@@ -16506,21 +16513,7 @@ void clif_parse_cashshop_list_request( int fd, struct map_session_data* sd ){
 	clif_cashshop_list( fd );
 }
 
-// TODO: find a more accurate date for this
-#if PACKETVER >= 20130320
-void clif_parse_cashshop_buy( int fd, struct map_session_data *sd ){
-	struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
-	uint16 length = RFIFOW( fd, info->pos[0] );
-	uint16 count = RFIFOW( fd, info->pos[1] );
-
-	if( length < 10 || length < ( 10 + count * 6 ) ){
-		return;
-	}
 
-	cashshop_buylist( sd, RFIFOL( fd, info->pos[2] ),
-	    count, (uint16 *)RFIFOP( fd, info->pos[3] ) );
-}
-#endif
 
 void clif_cashshop_result( struct map_session_data *sd, uint16 item_id, uint16 result ){
 	WFIFOHEAD( sd->fd, 16 );