Originally posted by [b]Feanorko[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4878
RE client 2011 02 25.
This is my fix:
UPDATED:
CODE
diff -rub --strip-trailing-cr old/clif.c new/clif.c
--- old/clif.c 2011-04-26 13:23:47.138792400 +0400
+++ new/clif.c 2011-04-26 18:46:04.730839400 +0400
@@ -13259,18 +13259,42 @@
void clif_parse_cashshop_buy(int fd, struct map_session_data *sd)
{
- int fail = 0, amount, points;
- short nameid;
+ int fail;
+ short cmd;
nullpo_retv(sd);
- nameid = RFIFOW(fd,2);
- amount = RFIFOW(fd,4);
- points = RFIFOL(fd,6); // Not Implemented. Should be 0
+ if(sd->state.trading || !sd->npc_shopid) {
+ clif_cashshop_ack(sd, 1);
+ return;
+ }
+
+ cmd = RFIFOW(fd, 0);
+
+ if(sd->packet_ver > 25) {
+ uint16 len = RFIFOW(fd, 2), count, *p;
+ int points;
+
+ if(len < 10 || len != 10 + (count = RFIFOW(fd, packet_db[sd->packet_ver][cmd].pos[1])) * 4) {
+ ShowWarning("Player %u sent incorrect cash shop buy packet(len %u:%u)!\n", sd->status.char_id, len, 10 + count * 4); // [Randajad]
+ return;
+ }
+
+ p = RFIFOP(fd, 10);
+ points = RFIFOL(fd, packet_db[sd->packet_ver][cmd].pos[0]); // Not Implemented. Should be 0
+
+ while(count--) {
+ if((fail = npc_cashshop_buy(sd, p[1], p[0], points)) != 0)
+ break;
+ p += 2;
+ }
+
+ } else {
+ short nameid = RFIFOW(fd, packet_db[sd->packet_ver][cmd].pos[0]);
+ short amount = RFIFOW(fd, packet_db[sd->packet_ver][cmd].pos[1]);
+ int points = RFIFOL(fd, packet_db[sd->packet_ver][cmd].pos[2]); // Not Implemented. Should be 0
- if( sd->state.trading || !sd->npc_shopid )
- fail = 1;
- else
fail = npc_cashshop_buy(sd, nameid, amount, points);
+ }
clif_cashshop_ack(sd, fail);
}
diff -rub --strip-trailing-cr old/packet_db.txt new/packet_db.txt
--- old/packet_db.txt 2011-04-26 13:23:46.860776500 +0400
+++ new/packet_db.txt 2011-04-26 17:30:07.584185500 +0400
@@ -1603,6 +1603,7 @@
0x0856,-1
0x0857,-1
0x0858,-1
+0x0288,-1,cashshopbuy,4:8
//Add new packets here
//packet_ver: 27
This post has been edited by Feanorko: Jul 6 2011, 12:51 PM