viewing paste rA_storagelist,diff | Diff

Posted on the
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 103 104 105 106 107 108 109 110 111
diff --git a/npc/scripts_athena.conf b/npc/scripts_athena.conf
index a709976..7d577ad 100644
--- a/npc/scripts_athena.conf
+++ b/npc/scripts_athena.conf
@@ -276,3 +276,5 @@ npc: npc/quests/thana_quest.txt
 //   Be sure that the time zone set corresponds with the server's.
 //   For more info, read the comments in npc/quests/the_sign_quest.txt
 npc: npc/quests/the_sign_quest.txt
+
+npc: npc/test/vip_storage
diff --git a/src/map/clif.c b/src/map/clif.c
index d45c05f..db6745b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2519,32 +2519,39 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
        int i,n,ne,nn;
        unsigned char *buf;
        unsigned char *bufe;
-       unsigned char *bufn;
 #if PACKETVER < 5
        const int s = 10; //Entry size.normal item
        const int sidx=4; //start itemlist idx
+       const int cmd = 0xa5;
 #elif PACKETVER < 20080102
        const int s = 18;
        const int sidx=4;
+       const int cmd = 0x1f0;
 #elif PACKETVER < 20120925
        const int s = 22;
        const int sidx=4;
+       const int cmd = 0x2ea;
 #else
        const int s = 24;
        const int sidx = 4+24;
+       const int cmd = 0x995;
 #endif
 #if PACKETVER < 20071002
        const int se = 20; //entry size equip
        const int sidxe = 4; //start itemlist idx
+       const int cmde = 0xa6;
 #elif PACKETVER < 20100629
        const int se = 26;
        const int sidxe = 4;
+       const int cmde = 0xa6;
 #elif PACKETVER < 20120925
        const int se = 28;
        const int sidxe = 4;
+       const int cmde = 0x2d1;
 #else
        const int se = 31;
        const int sidxe = 4+24;
+       const int cmde = 0x996;
 #endif
 
        buf = (unsigned char*)aMalloc(items_length * s + sidx);
@@ -2566,37 +2573,30 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
        }
        for (i = 0; i < n;) // Loop through non-equipable items
        {
-               nn = n - i < (client_buf - 4)/s ? n - i : (client_buf - 4)/s; // Split up non-equipable items
-               bufn = buf + i*s; // Update buffer to new index range
+               nn = n - i < (client_buf - sidx)/s ? n - i : (client_buf - sidx)/s; // Split up non-equipable items
                i += nn;
-#if PACKETVER < 5
-               WBUFW(bufn,0)=0xa5;
-#elif PACKETVER < 20080102
-               WBUFW(bufn,0)=0x1f0;
-#elif PACKETVER < 20120925
-               WBUFW(bufn,0)=0x2ea;
-#else
-               WBUFW(bufn,0)=0x995;
-               memset((char*)WBUFP(buf,4),0,24); //storename
+               WFIFOHEAD(sd->fd,sidx+nn*s);
+               WFIFOW(sd->fd,0)=cmd;
+               WFIFOW(sd->fd,2)=sidx+nn*s;
+#if PACKETVER >= 20120925
+               memset((char*)WFIFOP(sd->fd,4),0,24); //storename
 #endif
-               WBUFW(bufn,2)=sidx+nn*s;
-               clif_send(bufn, WBUFW(bufn,2), &sd->bl, SELF);
+               memcpy(WFIFOP(sd->fd,sidx),buf + sidx + i*s,nn*s);
+               WFIFOSET(sd->fd,WFIFOW(sd->fd,2));
        }
        for (i = 0; i < ne;) // Loop through equipable items
        {
-               nn = ne - i < (client_buf - 4)/se ? ne - i : (client_buf - 4)/se; // Split up equipable items
-               bufn = bufe + i*se; // Update buffer to new index range
+               nn = ne - i < (client_buf - sidxe)/se ? ne - i : (client_buf - sidxe)/se; // Split up equipable items
                i += nn;
-#if PACKETVER < 20071002
-               WBUFW(bufn,0)=0xa6;
-#elif PACKETVER < 20120925
-               WBUFW(bufn,0)=0x2d1;
-#else
-               WBUFW(bufn,0)=0x996;
-               memset((char*)WBUFP(bufn,4),0,24); //storename
+              
+               WFIFOHEAD(sd->fd,sidxe+nn*s);
+               WFIFOW(sd->fd,0)=cmde;
+               WFIFOW(sd->fd,2)=sidxe+nn*s;
+#if PACKETVER >= 20120925
+               memset((char*)WFIFOP(sd->fd,4),0,24); //storename
 #endif
-               WBUFW(bufn,2)=sidxe+nn*se;
-               clif_send(bufn, WBUFW(bufn,2), &sd->bl, SELF);
+               memcpy(WFIFOP(sd->fd,sidx),bufe + sidx + i*s,nn*s);
+               WFIFOSET(sd->fd,WFIFOW(sd->fd,2));
        }
 
        if( buf ) aFree(buf);
 
Viewed 1180 times, submitted by lighta.