From c76f8ded8743966abe10a15a3a03604d76d2d5df Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Nov 2018 05:57:43 +0300 Subject: Add packet ZC_ENCHANT_EQUIPMENT --- src/map/clif.c | 16 ++++++++++++++++ src/map/clif.h | 1 + src/map/packets_struct.h | 15 +++++++++++++++ 3 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 19f7a082a..00d3d8908 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -21991,6 +21991,21 @@ static void clif_item_preview(struct map_session_data *sd, int n) #endif } +// insert cardId into equipped item in pos equipment slot into slot cardSlot. +static void clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId) +{ +#if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + Assert_retv(cardSlot >= 0 && cardSlot <= 3); + struct PACKET_ZC_ENCHANT_EQUIPMENT p; + p.packetType = HEADER_ZC_ENCHANT_EQUIPMENT; + p.wearState = pos; + p.cardSlot = cardSlot; + p.itemId = cardId; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -23157,6 +23172,7 @@ void clif_defaults(void) clif->camera_showWindow = clif_camera_showWindow; clif->camera_change = clif_camera_change; clif->item_preview = clif_item_preview; + clif->enchant_equipment = clif_enchant_equipment; // -- Pet Evolution clif->pPetEvolution = clif_parse_pet_evolution; diff --git a/src/map/clif.h b/src/map/clif.h index 593dc15c1..088e7827e 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1554,6 +1554,7 @@ struct clif_interface { void (*camera_showWindow) (struct map_session_data *sd); void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); void (*item_preview) (struct map_session_data *sd, int n); + void (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); }; #ifdef HERCULES_CORE diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 357627ce7..c1b93e781 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2919,6 +2919,21 @@ DEFINE_PACKET_HEADER(ZC_ITEM_PREVIEW, 0x0ab9); #endif // PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 || PACKETVER_ZERO_NUM >= 20181024 #endif // PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) +#if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) +struct PACKET_ZC_ENCHANT_EQUIPMENT { + int16 packetType; + int16 wearState; + int16 cardSlot; +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 + int32 itemId; +#else + int16 itemId; +#endif + int8 equipFlag; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ENCHANT_EQUIPMENT, 0x0a3f); +#endif // PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) + #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 -- cgit v1.2.3-60-g2f50