diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/packets_struct.h | 19 |
2 files changed, 34 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 9be2def2e..992525107 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17657,24 +17657,28 @@ static void clif_buyingstore_myitemlist(struct map_session_data *sd) { int fd; unsigned int i; + struct PACKET_ZC_MYITEMLIST_BUYING_STORE *p; + int len; nullpo_retv(sd); fd = sd->fd; - WFIFOHEAD(fd,12+sd->buyingstore.slots*9); - WFIFOW(fd,0) = 0x813; - WFIFOW(fd,2) = 12+sd->buyingstore.slots*9; - WFIFOL(fd,4) = sd->bl.id; - WFIFOL(fd,8) = sd->buyingstore.zenylimit; + len = sizeof(struct PACKET_ZC_MYITEMLIST_BUYING_STORE) + sd->buyingstore.slots * sizeof(struct PACKET_ZC_MYITEMLIST_BUYING_STORE_sub); + WFIFOHEAD(fd, len); + p = WFIFOP(fd, 0); + p->packetType = 0x813; + p->packetLength = len; + p->AID = sd->bl.id; + p->zenyLimit = sd->buyingstore.zenylimit; - for( i = 0; i < sd->buyingstore.slots; i++ ) + for (i = 0; i < sd->buyingstore.slots; i++) { - WFIFOL(fd,12+i*9) = sd->buyingstore.items[i].price; - WFIFOW(fd,16+i*9) = sd->buyingstore.items[i].amount; - WFIFOB(fd,18+i*9) = itemtype(itemdb_type(sd->buyingstore.items[i].nameid)); - WFIFOW(fd,19+i*9) = sd->buyingstore.items[i].nameid; + p->items[i].price = sd->buyingstore.items[i].price; + p->items[i].amount = sd->buyingstore.items[i].amount; + p->items[i].itemType = itemtype(itemdb_type(sd->buyingstore.items[i].nameid)); + p->items[i].itemId = sd->buyingstore.items[i].nameid; } - WFIFOSET(fd,WFIFOW(fd,2)); + WFIFOSET(fd, len); } /// Notifies clients in area of a buying store (ZC_BUYING_STORE_ENTRY). diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 3c2d5dee1..69bfa6f81 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2299,6 +2299,25 @@ struct PACKET_CZ_REQ_OPEN_BUYING_STORE { struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub items[]; } __attribute__((packed)); +struct PACKET_ZC_MYITEMLIST_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_MYITEMLIST_BUYING_STORE { + int16 packetType; + int16 packetLength; + uint32 AID; + uint32 zenyLimit; + struct PACKET_ZC_MYITEMLIST_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 |