summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-04-26 19:31:52 +0300
committerAndrei Karas <akaras@inbox.ru>2019-05-05 22:24:25 +0300
commit19a162b61f14883ae0a2e25b6252796cc4c77cb9 (patch)
tree1c74fe43af0cd31bd7d26b63ff5501b3e7b74ec3 /src/map/clif.c
parent554072b191c0aadab9e874d6ec0e7b954477e595 (diff)
downloadhercules-19a162b61f14883ae0a2e25b6252796cc4c77cb9.tar.gz
hercules-19a162b61f14883ae0a2e25b6252796cc4c77cb9.tar.bz2
hercules-19a162b61f14883ae0a2e25b6252796cc4c77cb9.tar.xz
hercules-19a162b61f14883ae0a2e25b6252796cc4c77cb9.zip
Move packet ZC_SE_PC_BUY_CASHITEM_RESULT into separate function and convert to struct
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 4ebdad5f1..1348889d3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19518,18 +19518,24 @@ static void clif_parse_CashShopBuy(int fd, struct map_session_data *sd)
} else {
result = CSBR_UNKONWN_ITEM;
}
-
- WFIFOHEAD(fd, 16);
- WFIFOW(fd, 0) = 0x849;
- WFIFOL(fd, 2) = id;
- WFIFOW(fd, 6) = result;/* result */
- WFIFOL(fd, 8) = sd->cashPoints;/* current cash point */
- WFIFOL(fd, 12) = sd->kafraPoints;// [Ryuuzaki]
- WFIFOSET(fd, 16);
+ clif->cashShopBuyAck(fd, sd, id, result);
}
}
+static void clif_cashShopBuyAck(int fd, struct map_session_data *sd, int itemId, enum CASH_SHOP_BUY_RESULT result)
+{
+ nullpo_retv(sd);
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT));
+ struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT *p = WFIFOP(fd, 0);
+ p->packetType = 0x849;
+ p->itemId = itemId;
+ p->result = result;
+ p->cashPoints = sd->cashPoints;
+ p->kafraPoints = sd->kafraPoints;
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT));
+}
+
static void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
/* [Ind/Hercules] */
static void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd)
@@ -23580,6 +23586,7 @@ void clif_defaults(void)
clif->pCashShopReqTab = clif_parse_CashShopReqTab;
clif->pCashShopSchedule = clif_parse_CashShopSchedule;
clif->pCashShopBuy = clif_parse_CashShopBuy;
+ clif->cashShopBuyAck = clif_cashShopBuyAck;
/* */
clif->pPartyTick = clif_parse_PartyTick;
clif->pGuildInvite2 = clif_parse_GuildInvite2;