viewing paste ra_cashshopupd | Diff

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
Index: db/packet_db.txt
===================================================================
--- db/packet_db.txt    (revision 17418)
+++ db/packet_db.txt    (working copy)
@@ -1707,7 +1707,7 @@
 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 @@
 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
Index: src/map/clif.c
===================================================================
--- src/map/clif.c      (revision 17418)
+++ src/map/clif.c      (working copy)
@@ -14520,13 +14520,13 @@
        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;
 
@@ -14544,23 +14544,30 @@
 
                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
 ///
@@ -16503,22 +16510,8 @@
        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 );
        WFIFOW( sd->fd, 0 ) = 0x849;
 
Viewed 1646 times, submitted by lighta.