diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-08-24 02:19:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-08-24 02:19:04 +0300 |
commit | 8829a0c4cfeebed780b4ec31bde3bf84b1658e37 (patch) | |
tree | 62cf7acbc3fdfeb35a86bf114d82c2e228186ace | |
parent | 69165395c7c6d4d23cd8b3044a4a5bf82a4216d1 (diff) | |
download | hercules-8829a0c4cfeebed780b4ec31bde3bf84b1658e37.tar.gz hercules-8829a0c4cfeebed780b4ec31bde3bf84b1658e37.tar.bz2 hercules-8829a0c4cfeebed780b4ec31bde3bf84b1658e37.tar.xz hercules-8829a0c4cfeebed780b4ec31bde3bf84b1658e37.zip |
Update packet ZC_ACK_LEAVE_GUILD.
-rw-r--r-- | src/map/clif.c | 19 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/packets_struct.h | 23 |
4 files changed, 37 insertions, 9 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 41076b160..71ae22ec3 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8111,16 +8111,21 @@ static void clif_guild_inviteack(struct map_session_data *sd, int flag) /// Notifies clients of a guild of a leaving member (ZC_ACK_LEAVE_GUILD). /// 015a <char name>.24B <reason>.40B -static void clif_guild_leave(struct map_session_data *sd, const char *name, const char *mes) +static void clif_guild_leave(struct map_session_data *sd, const char *name, int char_id, const char *mes) { - unsigned char buf[128]; - nullpo_retv(sd); + nullpo_retv(name); + nullpo_retv(mes); - WBUFW(buf, 0)=0x15a; - memcpy(WBUFP(buf, 2),name,NAME_LENGTH); - memcpy(WBUFP(buf,26),mes,40); - clif->send(buf,packet_len(0x15a),&sd->bl,GUILD_NOBG); + struct PACKET_ZC_ACK_LEAVE_GUILD p; + p.packetType = guildLeave; +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) + p.GID = char_id; +#else + safestrncpy(&p.name[0], name, NAME_LENGTH); +#endif + safestrncpy(&p.reason[0], mes, 40); + clif->send(&p, sizeof(p), &sd->bl, GUILD_NOBG); } /// Notifies clients of a guild of an expelled member. diff --git a/src/map/clif.h b/src/map/clif.h index 7307e7461..d20c30a24 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1024,7 +1024,7 @@ struct clif_interface { void (*guild_memberlogin_notice) (struct guild *g,int idx,int flag); void (*guild_invite) (struct map_session_data *sd,struct guild *g); void (*guild_inviteack) (struct map_session_data *sd,int flag); - void (*guild_leave) (struct map_session_data *sd,const char *name,const char *mes); + void (*guild_leave) (struct map_session_data *sd, const char *name, int char_id, const char *mes); void (*guild_expulsion) (struct map_session_data* sd, const char* name, int char_id, const char* mes, int account_id); void (*guild_positionchanged) (struct guild *g,int idx); void (*guild_memberpositionchanged) (struct guild *g,int idx); diff --git a/src/map/guild.c b/src/map/guild.c index 01372921b..780d21326 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -925,7 +925,7 @@ static int guild_member_withdraw(int guild_id, int account_id, int char_id, int #endif if(!flag) - clif->guild_leave(online_member_sd, name, mes); + clif->guild_leave(online_member_sd, name, char_id, mes); else clif->guild_expulsion(online_member_sd, name, char_id, mes, account_id); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 5aeb40be5..852a44cb8 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -428,6 +428,11 @@ enum packet_headers { #else guildExpulsion = 0x15c, #endif +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) + guildLeave = 0xa83, +#else + guildLeave = 0x15a, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -2761,6 +2766,24 @@ struct PACKET_ZC_ACK_BAN_GUILD3 { uint32 GID; } __attribute__((packed)); +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) +#define PACKET_ZC_ACK_LEAVE_GUILD PACKET_ZC_ACK_LEAVE_GUILD2 +#else +#define PACKET_ZC_ACK_LEAVE_GUILD PACKET_ZC_ACK_LEAVE_GUILD1 +#endif + +struct PACKET_ZC_ACK_LEAVE_GUILD1 { + int16 packetType; + char name[NAME_LENGTH]; + char reason[40]; +} __attribute__((packed)); + +struct PACKET_ZC_ACK_LEAVE_GUILD2 { + int16 packetType; + uint32 GID; + char reason[40]; +} __attribute__((packed)); + #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 |