From 79f7a2274092f892ec183ed11cc16609c3a2f180 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 28 Nov 2019 03:15:45 +0300 Subject: Add new version for packet ZC_NOTIFY_EFFECT3 and convert to structure --- src/map/clif.c | 27 ++++++++++++++++----------- src/map/clif.h | 2 +- src/map/packets_struct.h | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index b9ca44dec..bfbb88c71 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9087,21 +9087,26 @@ static void clif_specialeffect_single(struct block_list *bl, int type, int fd) /// @see doc/effect_list.txt /// num data: /// effect-dependent value -static void clif_specialeffect_value(struct block_list *bl, int effect_id, int num, send_target target) -{ - uint8 buf[14]; - - WBUFW(buf,0) = 0x284; - WBUFL(buf,2) = bl->id; - WBUFL(buf,6) = effect_id; - WBUFL(buf,10) = num; +static void clif_specialeffect_value(struct block_list *bl, int effect_id, uint64 num, send_target target) +{ +#if PACKETVER_MAIN_NUM >= 20060911 || PACKETVER_AD_NUM >= 20060911 || PACKETVER_SAK_NUM >= 20060911 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) + struct PACKET_ZC_NOTIFY_EFFECT3 packet; + packet.packetType = HEADER_ZC_NOTIFY_EFFECT3; + packet.aid = bl->id; + packet.effectId = effect_id; +#if PACKETVER >= 20191127 + packet.num = num; +#else + packet.num = (uint32)num; +#endif - clif->send(buf, packet_len(0x284), bl, target); + clif->send(&packet, sizeof(struct PACKET_ZC_NOTIFY_EFFECT3), bl, target); if (clif->isdisguised(bl)) { - WBUFL(buf,2) = -bl->id; - clif->send(buf, packet_len(0x284), bl, SELF); + packet.aid = -bl->id; + clif->send(&packet, sizeof(struct PACKET_ZC_NOTIFY_EFFECT3), bl, SELF); } +#endif } /// Remove special effects (ZC_REMOVE_EFFECT). diff --git a/src/map/clif.h b/src/map/clif.h index 27f1060ff..498cbc046 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1030,7 +1030,7 @@ struct clif_interface { void (*weather) (int16 m); void (*specialeffect) (struct block_list* bl, int type, enum send_target target); void (*specialeffect_single) (struct block_list* bl, int type, int fd); - void (*specialeffect_value) (struct block_list* bl, int effect_id, int num, send_target target); + void (*specialeffect_value) (struct block_list* bl, int effect_id, uint64 num, send_target target); void (*removeSpecialEffect) (struct block_list *bl, int effectId, enum send_target target); void (*removeSpecialEffect_single) (struct block_list *bl, int effectId, struct block_list *targetBl); void (*millenniumshield) (struct block_list *bl, short shields ); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index a7a9e2e63..fa9a0c873 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3729,6 +3729,25 @@ struct PACKET_CZ_REQ_MOUNTOFF { DEFINE_PACKET_HEADER(CZ_REQ_MOUNTOFF, 0x0b35); #endif +// in 3 clients from same version +#if PACKETVER >= 20191127 +struct PACKET_ZC_NOTIFY_EFFECT3 { + int16 packetType; + uint32 aid; + uint32 effectId; + uint64 num; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_NOTIFY_EFFECT3, 0x0b69); +#elif PACKETVER_MAIN_NUM >= 20060911 || PACKETVER_AD_NUM >= 20060911 || PACKETVER_SAK_NUM >= 20060911 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) +struct PACKET_ZC_NOTIFY_EFFECT3 { + int16 packetType; + uint32 aid; + uint32 effectId; + uint32 num; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_NOTIFY_EFFECT3, 0x0284); +#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 -- cgit v1.2.3-60-g2f50