From e73bc865155c275994d24a87e54b7e5ae327493d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 4 Aug 2018 21:02:36 +0300 Subject: Split packet CZ_REQ_STYLE_CHANGE to CZ_REQ_STYLE_CHANGE and CZ_REQ_STYLE_CHANGE2. --- src/map/clif.c | 24 ++++++++++++++++++++++-- src/map/clif.h | 1 + src/map/packets.h | 4 ++-- src/map/packets_struct.h | 12 ++++++++++-- 4 files changed, 35 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 4e8e84f41..dfb6aae06 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -21548,13 +21548,32 @@ static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) clif->cz_req_style_change_sub(sd, LOOK_HEAD_MID, p->MidAccessory, true); if (p->BottomAccessory > 0) clif->cz_req_style_change_sub(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); -#if PACKETVER_RE_NUM >= 20180718 + clif->style_change_response(sd, STYLIST_SHOP_SUCCESS); + return; +} + +static void clif_parse_cz_req_style_change2(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_cz_req_style_change2(int fd, struct map_session_data *sd) +{ + const struct PACKET_CZ_REQ_STYLE_CHANGE2 *p = RP2PTR(fd); + + if (p->HeadStyle > 0) + clif->cz_req_style_change_sub(sd, LOOK_HAIR, p->HeadStyle, false); + if (p->HeadPalette > 0) + clif->cz_req_style_change_sub(sd, LOOK_HAIR_COLOR, p->HeadPalette, false); + if (p->BodyPalette > 0) + clif->cz_req_style_change_sub(sd, LOOK_CLOTHES_COLOR, p->BodyPalette, false); + if (p->TopAccessory > 0) + clif->cz_req_style_change_sub(sd, LOOK_HEAD_TOP, p->TopAccessory, true); + if (p->MidAccessory > 0) + clif->cz_req_style_change_sub(sd, LOOK_HEAD_MID, p->MidAccessory, true); + if (p->BottomAccessory > 0) + clif->cz_req_style_change_sub(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); if (p->BodyStyle > 0) { if (pc->has_second_costume(sd)) { clif->cz_req_style_change_sub(sd, LOOK_BODY2, p->BodyStyle, false); } } -#endif clif->style_change_response(sd, STYLIST_SHOP_SUCCESS); return; } @@ -22775,6 +22794,7 @@ void clif_defaults(void) clif->style_change_validate_requirements = clif_style_change_validate_requirements; clif->stylist_send_rodexitem = clif_stylist_send_rodexitem; clif->pReqStyleChange = clif_parse_cz_req_style_change; + clif->pReqStyleChange2 = clif_parse_cz_req_style_change2; clif->cz_req_style_change_sub = clif_cz_req_style_change_sub; clif->style_change_response = clif_style_change_response; diff --git a/src/map/clif.h b/src/map/clif.h index 3ed9b96ae..406c6ca6a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1514,6 +1514,7 @@ struct clif_interface { bool (*style_change_validate_requirements) (struct map_session_data *sd, int type, int16 idx); void (*stylist_send_rodexitem) (struct map_session_data *sd, int itemid); void (*pReqStyleChange) (int fd, struct map_session_data *sd); + void (*pReqStyleChange2) (int fd, struct map_session_data *sd); void (*cz_req_style_change_sub) (struct map_session_data *sd, int type, int16 idx, bool isitem); void (*style_change_response) (struct map_session_data *sd, enum stylist_shop flag); void (*pPetEvolution) (int fd, struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index f2f642dbc..94da86b9e 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -4121,7 +4121,7 @@ packet(0x96e,-1,clif->ackmergeitems); // 2018-05-16cRagexe, 2018-05-16cRagexeRE #if PACKETVER >= 20180516 // new packets - packet(0x0afc,16,clif->pReqStyleChange); + packet(0x0afc,16,clif->pReqStyleChange2); // changed packet sizes #endif #endif // PACKETVER_ZERO @@ -4130,7 +4130,7 @@ packet(0x96e,-1,clif->ackmergeitems); // 2018-05-23aRagexe_zero #if PACKETVER >= 20180523 // new packets - packet(0x0afc,16,clif->pReqStyleChange); + packet(0x0afc,16,clif->pReqStyleChange2); // changed packet sizes #endif #endif // PACKETVER_ZERO diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index e6d207fad..d0815317f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1883,9 +1883,17 @@ struct PACKET_CZ_REQ_STYLE_CHANGE { int16 TopAccessory; int16 MidAccessory; int16 BottomAccessory; -#if PACKETVER_RE_NUM >= 20180718 +} __attribute__((packed)); + +struct PACKET_CZ_REQ_STYLE_CHANGE2 { + int16 PacketType; + int16 HeadPalette; + int16 HeadStyle; + int16 BodyPalette; + int16 TopAccessory; + int16 MidAccessory; + int16 BottomAccessory; int16 BodyStyle; -#endif } __attribute__((packed)); struct PACKET_ZC_STYLE_CHANGE_RES { -- cgit v1.2.3-70-g09d2