From d172c28f9b25a780235c7c7a7f4db9ca9866f531 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Jul 2018 05:21:33 +0300 Subject: Update packet ZC_ACK_ITEMLIST_BUYING_STORE. --- src/map/clif.c | 30 +++++++++++++++++------------- src/map/packets_struct.h | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 265757220..5560eaa25 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17754,26 +17754,30 @@ static void clif_buyingstore_itemlist(struct map_session_data *sd, struct map_se { int fd; unsigned int i; + struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE *p; + int len; nullpo_retv(sd); nullpo_retv(pl_sd); fd = sd->fd; - WFIFOHEAD(fd,16+pl_sd->buyingstore.slots*9); - WFIFOW(fd,0) = 0x818; - WFIFOW(fd,2) = 16+pl_sd->buyingstore.slots*9; - WFIFOL(fd,4) = pl_sd->bl.id; - WFIFOL(fd,8) = pl_sd->buyer_id; - WFIFOL(fd,12) = pl_sd->buyingstore.zenylimit; - - for( i = 0; i < pl_sd->buyingstore.slots; i++ ) + len = sizeof(struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE) + pl_sd->buyingstore.slots * sizeof(struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub); + WFIFOHEAD(fd, len); + p = WFIFOP(fd, 0); + p->packetType = 0x818; + p->packetLength = len; + p->AID = pl_sd->bl.id; + p->storeId = pl_sd->buyer_id; + p->zenyLimit = pl_sd->buyingstore.zenylimit; + + for (i = 0; i < pl_sd->buyingstore.slots; i++) { - WFIFOL(fd,16+i*9) = pl_sd->buyingstore.items[i].price; - WFIFOW(fd,20+i*9) = pl_sd->buyingstore.items[i].amount; // TODO: Figure out, if no longer needed items (amount == 0) are listed on official. - WFIFOB(fd,22+i*9) = itemtype(itemdb_type(pl_sd->buyingstore.items[i].nameid)); - WFIFOW(fd,23+i*9) = pl_sd->buyingstore.items[i].nameid; + p->items[i].price = pl_sd->buyingstore.items[i].price; + p->items[i].amount = pl_sd->buyingstore.items[i].amount; // TODO: Figure out, if no longer needed items (amount == 0) are listed on official. + p->items[i].itemType = itemtype(itemdb_type(pl_sd->buyingstore.items[i].nameid)); + p->items[i].itemId = pl_sd->buyingstore.items[i].nameid; } - WFIFOSET(fd,WFIFOW(fd,2)); + WFIFOSET(fd, len); } static void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 64a10e887..c89093e01 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2352,6 +2352,26 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_FROMMC { struct PACKET_ZC_PC_PURCHASE_ITEMLIST_FROMMC_sub items[]; } __attribute__((packed)); +struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub { + uint32 price; + uint16 amount; + uint8 itemType; +#if PACKETVER_RE_NUM >= 20180704 + uint32 itemId; +#else + uint16 itemId; +#endif +} __attribute__((packed)); + +struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE { + int16 packetType; + int16 packetLength; + uint32 AID; + uint32 storeId; + uint32 zenyLimit; + struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub items[]; +} __attribute__((packed)); + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris -- cgit v1.2.3-70-g09d2