summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-12-27 22:51:05 +0300
committerAndrei Karas <akaras@inbox.ru>2020-01-09 09:37:39 +0300
commitd26dd0680197754a97e86e9fb7146e13460fa355 (patch)
tree2cb00914150f0b011ddec1ecefd39687bbb44025 /src/map
parente0ea615fce928b8385afa501add1c3c67ce6f9f3 (diff)
downloadhercules-d26dd0680197754a97e86e9fb7146e13460fa355.tar.gz
hercules-d26dd0680197754a97e86e9fb7146e13460fa355.tar.bz2
hercules-d26dd0680197754a97e86e9fb7146e13460fa355.tar.xz
hercules-d26dd0680197754a97e86e9fb7146e13460fa355.zip
Move packet ZC_SE_CASHSHOP_OPEN into separate function
And update to latest packet.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c24
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h18
3 files changed, 37 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 31fb00c37..4adf605e1 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19990,15 +19990,26 @@ static void clif_parse_CashShopOpen(int fd, struct map_session_data *sd)
return;
if (map->list[sd->bl.m].flag.nocashshop) {
- clif->messagecolor_self(fd, COLOR_RED, msg_fd(fd,1489)); //Cash Shop is disabled in this map
+ clif->messagecolor_self(fd, COLOR_RED, msg_fd(fd, 1489)); //Cash Shop is disabled in this map
return;
}
- WFIFOHEAD(fd, 10);
- WFIFOW(fd, 0) = 0x845;
- WFIFOL(fd, 2) = sd->cashPoints; //[Ryuuzaki] - switched positions to reflect proper values
- WFIFOL(fd, 6) = sd->kafraPoints;
- WFIFOSET(fd, 10);
+ clif->cashShopOpen(fd, sd, 0);
+#endif
+}
+
+static void clif_cashShopOpen(int fd, struct map_session_data *sd, int tab)
+{
+#if PACKETVER_MAIN_NUM >= 20101123 || PACKETVER_RE_NUM >= 20120328 || PACKETVER_ZERO_NUM >= defined(PACKETVER_ZERO)
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_SE_CASHSHOP_OPEN));
+ struct PACKET_ZC_SE_CASHSHOP_OPEN *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_SE_CASHSHOP_OPEN;
+ p->cashPoints = sd->cashPoints; //[Ryuuzaki] - switched positions to reflect proper values
+ p->kafraPoints = sd->kafraPoints;
+#if PACKETVER_ZERO_NUM >= 20191224
+ p->tab = tab;
+#endif
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_SE_CASHSHOP_OPEN));
#endif
}
@@ -24621,6 +24632,7 @@ void clif_defaults(void)
clif->pCashShopSchedule = clif_parse_CashShopSchedule;
clif->pCashShopBuy = clif_parse_CashShopBuy;
clif->cashShopBuyAck = clif_cashShopBuyAck;
+ clif->cashShopOpen = clif_cashShopOpen;
/* */
clif->pPartyTick = clif_parse_PartyTick;
clif->pGuildInvite2 = clif_parse_GuildInvite2;
diff --git a/src/map/clif.h b/src/map/clif.h
index 14a7997a1..7812b5366 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1556,6 +1556,7 @@ struct clif_interface {
void (*pPartyTick) (int fd, struct map_session_data *sd);
void (*pGuildInvite2) (int fd, struct map_session_data *sd);
void (*cashShopBuyAck) (int fd, struct map_session_data *sd, int itemId, enum CASH_SHOP_BUY_RESULT result);
+ void (*cashShopOpen) (int fd, struct map_session_data *sd, int tab);
/* Group Search System Update */
void (*pPartyBookingAddFilter) (int fd, struct map_session_data *sd);
void (*pPartyBookingSubFilter) (int fd, struct map_session_data *sd);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index a98317364..afc8045ec 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -3761,6 +3761,24 @@ struct PACKET_CZ_SE_CASHSHOP_OPEN {
DEFINE_PACKET_HEADER(CZ_SE_CASHSHOP_OPEN, 0x0844);
#endif
+#if PACKETVER_ZERO_NUM >= 20191224
+struct PACKET_ZC_SE_CASHSHOP_OPEN {
+ int16 packetType;
+ uint32 cashPoints;
+ uint32 kafraPoints;
+ uint32 tab;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_SE_CASHSHOP_OPEN, 0x0b6e);
+// for ragexeRE in some version this packet unused [4144]
+#elif PACKETVER_MAIN_NUM >= 20101123 || PACKETVER_RE_NUM >= 20120328 || PACKETVER_ZERO_NUM >= defined(PACKETVER_ZERO)
+struct PACKET_ZC_SE_CASHSHOP_OPEN {
+ int16 packetType;
+ uint32 cashPoints;
+ uint32 kafraPoints;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_SE_CASHSHOP_OPEN, 0x0845);
+#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