From fbd51f951c20db0b1e4ecf96ef8f2415defacc89 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 16 Dec 2011 03:13:00 +0000 Subject: RE cashshop fix, bugreport:4764 -- requires a msgstringtable.txt modification or client will crash (will be in the client svn asap) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15137 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 8b6284a9c..576aaa4d1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13609,22 +13609,36 @@ void clif_cashshop_ack(struct map_session_data* sd, int error) /// 0288 .W .L .W { .W .W }.4B*count (PACKETVER >= 20100803) void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) { - int fail = 0, amount, points = 0; - short nameid; - nullpo_retv(sd); - - nameid = RFIFOW(fd,2); - amount = RFIFOW(fd,4); -#if PACKETVER >= 20070711 - points = RFIFOL(fd,6); // Not Implemented. Should be 0 -#endif + int fail = 0; + struct npc_data *nd; + nullpo_retv(sd); - if( sd->state.trading || !sd->npc_shopid ) - fail = 1; - else - fail = npc_cashshop_buy(sd, nameid, amount, points); + if( sd->state.trading || !sd->npc_shopid ) + fail = 1; + else + { +#if PACKETVER < 20101116 + short nameid = RFIFOW(fd,2); + short amount = RFIFOW(fd,4); + int points = RFIFOL(fd,6); - clif_cashshop_ack(sd, fail); + fail = npc_cashshop_buy(sd, nameid, amount, points); +#else + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + unsigned short* item_list = (unsigned short*)RFIFOP(fd,10); + + 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); + return; + } + fail = npc_cashshop_buylist(sd,points,count,item_list); +#endif + } + + clif_cashshop_ack(sd,fail); } /*========================================== -- cgit v1.2.3-70-g09d2