From ecf7124424ce3a052123fb29407fb2114d168843 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Thu, 11 Aug 2011 02:56:17 +0000 Subject: * Added support for cash shop packets without kafra points for clients 2007-07-10aSakexe and older (bugreport:4701, related r10888 and r11548). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14932 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + src/map/clif.c | 40 ++++++++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 443e31ddf..256b2f0e1 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,7 @@ Date Added 2011/08/10 + * Added support for cash shop packets without kafra points for clients 2007-07-10aSakexe and older (bugreport:4701, related r10888 and r11548). [Ai4rei] * Added sending a dummy 0x08b9 packet (PIN auth system) in the char-server, required to support clients from this year. [Skotlex] * Updated unitwarp so that an id of "0" causes the script's rid to be warped. This allows OnTouchNPC scripts to warp the monster. [Skotlex] * Updated @warp/@jump commands so that when an invalid tile is specified, a nearby cell is chosen. diff --git a/src/map/clif.c b/src/map/clif.c index 574bb2c7d..5ee32c3e1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13246,34 +13246,46 @@ void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) /*========================================== * CASH/POINT SHOP *==========================================*/ + +/// List of items offered in a cash shop (ZC_PC_CASH_POINT_ITEMLIST) +/// 0287 .W .L { .L .L .B .W }* +/// 0287 .W .L .L { .L .L .B .W }* (PACKETVER >= 20070711) void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { int fd,i; +#if PACKETVER < 20070711 + const int offset = 8; +#else + const int offset = 12; +#endif nullpo_retv(sd); nullpo_retv(nd); fd = sd->fd; sd->npc_shopid = nd->bl.id; - WFIFOHEAD(fd, 200 * 11 + 12); + WFIFOHEAD(fd,offset+nd->u.shop.count*11); WFIFOW(fd,0) = 0x287; - WFIFOW(fd,2) = 12 + nd->u.shop.count*11; + WFIFOW(fd,2) = offset+nd->u.shop.count*11; WFIFOL(fd,4) = sd->cashPoints; // Cash Points +#if PACKETVER >= 20070711 WFIFOL(fd,8) = sd->kafraPoints; // Kafra Points +#endif for( i = 0; i < nd->u.shop.count; i++ ) { struct item_data* id = itemdb_search(nd->u.shop.shop_item[i].nameid); - WFIFOL(fd,12+i*11) = nd->u.shop.shop_item[i].value; - WFIFOL(fd,16+i*11) = nd->u.shop.shop_item[i].value; // Discount Price? Maybe a Discount item - WFIFOB(fd,20+i*11) = itemtype(id->type); - WFIFOW(fd,21+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; + WFIFOL(fd,offset+0+i*11) = nd->u.shop.shop_item[i].value; + WFIFOL(fd,offset+4+i*11) = nd->u.shop.shop_item[i].value; // Discount Price + WFIFOB(fd,offset+8+i*11) = itemtype(id->type); + WFIFOW(fd,offset+9+i*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; } WFIFOSET(fd,WFIFOW(fd,2)); } /// Cashshop Buy Ack (ZC_PC_CASH_POINT_UPDATE) -/// S 0289 .L .L .W +/// S 0289 .L .W +/// S 0289 .L .L .W (PACKETVER >= 20070711) /// /// @param error /// 0: The deal has successfully completed. (ERROR_TYPE_NONE) @@ -13292,11 +13304,19 @@ void clif_cashshop_ack(struct map_session_data* sd, int error) WFIFOHEAD(fd, packet_len(0x289)); WFIFOW(fd,0) = 0x289; WFIFOL(fd,2) = sd->cashPoints; +#if PACKETVER < 20070711 + WFIFOW(fd,6) = TOW(error); +#else WFIFOL(fd,6) = sd->kafraPoints; WFIFOW(fd,10) = TOW(error); +#endif WFIFOSET(fd, packet_len(0x289)); } +/// Request to buy item(s) from cash shop (CZ_PC_BUY_CASH_POINT_ITEM). +/// 0288 .W .W +/// 0288 .W .W .L (PACKETVER >= 20070711) +/// 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; @@ -14951,7 +14971,11 @@ static int packetdb_readdb(void) 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //#0x0280 - 0, 0, 0, 6, 0, 0, 0, 0, 0, 12, 18, 0, 0, 0, 0, 0, +#if PACKETVER < 20070711 + 0, 0, 0, 6, 0, 0, 0, -1, 6, 8, 18, 0, 0, 0, 0, 0, +#else + 0, 0, 0, 6, 0, 0, 0, -1, 10, 12, 18, 0, 0, 0, 0, 0, // 0x288, 0x289 increase by 4 (kafra points) +#endif 0, 4, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, -1, -1,107, 6, -1, 7, 7, 22,191, 0, 0, 0, 0, 0, 0, -- cgit v1.2.3-70-g09d2