summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-12-13 08:23:29 +0300
committerAndrei Karas <akaras@inbox.ru>2019-12-13 08:36:08 +0300
commit3acb36c33e06a8a7e226e43ff8656c8cffa2eeb3 (patch)
treebb255692e83f0c733692dc8932fdba307c1a2474 /src
parent1f78dc3468f1a4afe1f8bd09ea340a715af1d206 (diff)
downloadhercules-3acb36c33e06a8a7e226e43ff8656c8cffa2eeb3.tar.gz
hercules-3acb36c33e06a8a7e226e43ff8656c8cffa2eeb3.tar.bz2
hercules-3acb36c33e06a8a7e226e43ff8656c8cffa2eeb3.tar.xz
hercules-3acb36c33e06a8a7e226e43ff8656c8cffa2eeb3.zip
Convert packet CZ_SE_CASHSHOP_OPEN to structure and add new packet version
Diffstat (limited to 'src')
-rw-r--r--src/common/packetsstatic_len.h4
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/packets.h10
-rw-r--r--src/map/packets_struct.h13
4 files changed, 28 insertions, 1 deletions
diff --git a/src/common/packetsstatic_len.h b/src/common/packetsstatic_len.h
index 730516c27..f721ab882 100644
--- a/src/common/packetsstatic_len.h
+++ b/src/common/packetsstatic_len.h
@@ -32,6 +32,10 @@
#define DEFINE_PACKET_ID(name, id) \
enum { HEADER_##name = id };
+#define CHECK_PACKET_HEADER(name, id) \
+ STATIC_ASSERT((int32)(PACKET_LEN_##id) == -1 || sizeof(struct PACKET_##name) == \
+ (size_t)PACKET_LEN_##id, "Wrong size PACKET_"#name); \
+
#define packetLen(id, len) PACKET_LEN_##id = (len),
enum packet_lengths {
#include "common/packets_len.h"
diff --git a/src/map/clif.c b/src/map/clif.c
index ade56b53b..a1c1bce19 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19983,6 +19983,7 @@ static void clif_parse_dull(int fd, struct map_session_data *sd)
static void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
static void clif_parse_CashShopOpen(int fd, struct map_session_data *sd)
{
+#if PACKETVER >= 20100824
if (sd->state.trading || pc_isdead(sd) || pc_isvending(sd))
return;
@@ -19996,6 +19997,7 @@ static void clif_parse_CashShopOpen(int fd, struct map_session_data *sd)
WFIFOL(fd, 2) = sd->cashPoints; //[Ryuuzaki] - switched positions to reflect proper values
WFIFOL(fd, 6) = sd->kafraPoints;
WFIFOSET(fd, 10);
+#endif
}
static void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
diff --git a/src/map/packets.h b/src/map/packets.h
index 326f41791..48d937957 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -726,6 +726,11 @@ packet(0x96e,clif->ackmergeitems);
packet(0x0843,clif->pGMRemove2,2);
#endif
+// all versions
+#if PACKETVER >= 20100824
+ packet(0x0844,clif->pCashShopOpen,2);
+#endif
+
//2010-11-24aRagexeRE
#if PACKETVER >= 20101124
packet(0x0288,clif->pcashshop_buy,4,8);
@@ -776,7 +781,6 @@ packet(0x96e,clif->ackmergeitems);
//2011-07-18aRagexe (Thanks to Yommy!)
#if PACKETVER >= 20110718
// shuffle packets not added
- packet(0x0844,clif->pCashShopOpen,2);/* tell server cashshop window is being open */
packet(0x084a,clif->pCashShopClose,2);/* tell server cashshop window is being closed */
packet(0x0846,clif->pCashShopReqTab,2);
packet(0x0848,clif->pCashShopBuy,2);
@@ -1975,4 +1979,8 @@ packet(0x96e,clif->ackmergeitems);
packet(0x0b35,clif->pReqGearOff);
#endif
+#if PACKETVER >= 20190724
+ packet(0x0b4c,clif->pCashShopOpen,2);
+#endif
+
#endif /* MAP_PACKETS_H */
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index fa9a0c873..a98317364 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -3748,6 +3748,19 @@ struct PACKET_ZC_NOTIFY_EFFECT3 {
DEFINE_PACKET_HEADER(ZC_NOTIFY_EFFECT3, 0x0284);
#endif
+#if PACKETVER >= 20190724
+struct PACKET_CZ_SE_CASHSHOP_OPEN {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_SE_CASHSHOP_OPEN, 0x0b4c);
+CHECK_PACKET_HEADER(CZ_SE_CASHSHOP_OPEN, 0x0844);
+#elif PACKETVER >= 20100824
+struct PACKET_CZ_SE_CASHSHOP_OPEN {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_SE_CASHSHOP_OPEN, 0x0844);
+#endif
+
#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