summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-11 00:02:55 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-15 20:36:27 +0300
commit94cc5fd8dc967acde5f79f789044c2b60d4267b3 (patch)
treea739a6474bd39edcfe042ffd3f1b7b00b13a882e /src/map
parent481a832c4675b026a4361fc401a0ca2e7e1aa56c (diff)
downloadhercules-94cc5fd8dc967acde5f79f789044c2b60d4267b3.tar.gz
hercules-94cc5fd8dc967acde5f79f789044c2b60d4267b3.tar.bz2
hercules-94cc5fd8dc967acde5f79f789044c2b60d4267b3.tar.xz
hercules-94cc5fd8dc967acde5f79f789044c2b60d4267b3.zip
Update packet ZC_PC_CASH_POINT_ITEMLIST.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c37
-rw-r--r--src/map/packets_struct.h21
2 files changed, 39 insertions, 19 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 9bab5c831..a133b8da1 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -16197,13 +16197,10 @@ static void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
{
struct npc_item_list *shop = NULL;
unsigned short shop_size = 0;
- int fd,i, c = 0;
+ int fd, i, c = 0;
int currency[2] = { 0,0 };
-#if PACKETVER < 20070711
- const int offset = 8;
-#else
- const int offset = 12;
-#endif
+ int len;
+ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST *p;
nullpo_retv(sd);
nullpo_retv(nd);
@@ -16226,26 +16223,28 @@ static void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
fd = sd->fd;
sd->npc_shopid = nd->bl.id;
- WFIFOHEAD(fd,offset+shop_size*11);
- WFIFOW(fd,0) = 0x287;
- /* 0x2 = length, set after parsing */
- WFIFOL(fd,4) = currency[0]; // Cash Points
+ len = sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST) + shop_size * sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub);
+ WFIFOHEAD(fd, len);
+ p = WFIFOP(fd, 0);
+ p->packetType = 0x287;
+ p->cashPoints = currency[0];
#if PACKETVER >= 20070711
- WFIFOL(fd,8) = currency[1]; // Kafra Points
+ p->kafraPoints = currency[1];
#endif
- for( i = 0; i < shop_size; i++ ) {
- if( shop[i].nameid ) {
+ for (i = 0; i < shop_size; i++) {
+ if (shop[i].nameid) {
struct item_data* id = itemdb->search(shop[i].nameid);
- WFIFOL(fd,offset+0+i*11) = shop[i].value;
- WFIFOL(fd,offset+4+i*11) = shop[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;
+ p->items[c].price = shop[i].value;
+ p->items[c].discountPrice = shop[i].value;
+ p->items[c].itemType = itemtype(id->type);
+ p->items[c].itemId = (id->view_id > 0) ? id->view_id : id->nameid;
c++;
}
}
- WFIFOW(fd,2) = offset+c*11;
- WFIFOSET(fd,WFIFOW(fd,2));
+ len = sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST) + c * sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub);
+ p->packetLength = len;
+ WFIFOSET(fd, len);
}
/// Cashshop Buy Ack (ZC_PC_CASH_POINT_UPDATE).
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 2489f0625..3db9c7322 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -2478,6 +2478,27 @@ struct PACKET_ZC_MAKINGITEM_LIST {
struct PACKET_ZC_MAKINGITEM_LIST_sub items[];
} __attribute__((packed));
+struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub {
+ uint32 price;
+ uint32 discountPrice;
+ uint8 itemType;
+#if PACKETVER_RE_NUM >= 20180704
+ uint32 itemId;
+#else
+ uint16 itemId;
+#endif
+} __attribute__((packed));
+
+struct PACKET_ZC_PC_CASH_POINT_ITEMLIST {
+ int16 packetType;
+ int16 packetLength;
+ uint32 cashPoints;
+#if PACKETVER >= 20070711
+ uint32 kafraPoints;
+#endif
+ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_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