Skip to content

Commit

Permalink
Add new version for packet ZC_NOTIFY_EFFECT3 and convert to structure
Browse files Browse the repository at this point in the history
  • Loading branch information
4144 committed Dec 5, 2019
1 parent fd1d1fd commit 5de4c18
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac b3a11d273.
# From configure.ac 9bce92f63.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
Expand Down
27 changes: 16 additions & 11 deletions src/map/clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion src/map/clif.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
19 changes: 19 additions & 0 deletions src/map/packets_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5de4c18

Please sign in to comment.