diff options
author | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-16 03:13:00 +0000 |
---|---|---|
committer | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-16 03:13:00 +0000 |
commit | fbd51f951c20db0b1e4ecf96ef8f2415defacc89 (patch) | |
tree | ba32259e9199ca77cf75821db665c5b6b2591e42 /src/map/clif.c | |
parent | a228f0d083df0e7839884371e772f89087641cf5 (diff) | |
download | hercules-fbd51f951c20db0b1e4ecf96ef8f2415defacc89.tar.gz hercules-fbd51f951c20db0b1e4ecf96ef8f2415defacc89.tar.bz2 hercules-fbd51f951c20db0b1e4ecf96ef8f2415defacc89.tar.xz hercules-fbd51f951c20db0b1e4ecf96ef8f2415defacc89.zip |
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
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 42 |
1 files changed, 28 insertions, 14 deletions
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 <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.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); } /*========================================== |