diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-04-25 01:02:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-05-05 22:22:06 +0300 |
commit | 88221a48d2829d0124a8534bd3ac964a9ea9c3b7 (patch) | |
tree | 62364e4ddad342d855aa55cd6adf7f94c39deb5b | |
parent | 4eba922c4a3be24e8214608c8a6b39d64f1ed312 (diff) | |
download | hercules-88221a48d2829d0124a8534bd3ac964a9ea9c3b7.tar.gz hercules-88221a48d2829d0124a8534bd3ac964a9ea9c3b7.tar.bz2 hercules-88221a48d2829d0124a8534bd3ac964a9ea9c3b7.tar.xz hercules-88221a48d2829d0124a8534bd3ac964a9ea9c3b7.zip |
Update packet ZC_BAN_LIST
-rw-r--r-- | src/map/clif.c | 46 | ||||
-rw-r--r-- | src/map/packets_struct.h | 43 |
2 files changed, 67 insertions, 22 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 803d92b2f..a7bcc5801 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8416,42 +8416,44 @@ static void clif_guild_expulsion(struct map_session_data *sd, const char *name, /// 0163 <packet len>.W { <char name>.24B <reason>.40B }* (PACKETVER >= 20100803) static void clif_guild_expulsionlist(struct map_session_data *sd) { -#if PACKETVER < 20100803 - const int offset = NAME_LENGTH*2+40; -#else - const int offset = NAME_LENGTH+40; -#endif - int fd, i, c = 0; - struct guild* g; - nullpo_retv(sd); - if( (g = sd->guild) == NULL ) + int c = 0; + + struct guild* g; + if ((g = sd->guild) == NULL) return; - fd = sd->fd; + int fd = sd->fd; - WFIFOHEAD(fd,4 + MAX_GUILDEXPULSION * offset); - WFIFOW(fd,0) = 0x163; + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_BAN_LIST) + MAX_GUILDEXPULSION * sizeof(struct PACKET_ZC_BAN_LIST_sub)); + struct PACKET_ZC_BAN_LIST *packet = WFIFOP(fd, 0); + packet->packetType = HEADER_ZC_BAN_LIST; - for( i = 0; i < MAX_GUILDEXPULSION; i++ ) + for (int i = 0; i < MAX_GUILDEXPULSION; i++) { struct guild_expulsion* e = &g->expulsion[i]; - if( e->account_id > 0 ) + if (e->account_id > 0) { - memcpy(WFIFOP(fd,4 + c*offset), e->name, NAME_LENGTH); -#if PACKETVER < 20100803 - memset(WFIFOP(fd,4 + c*offset+24), 0, NAME_LENGTH); // account name (not used for security reasons) - memcpy(WFIFOP(fd,4 + c*offset+48), e->mes, 40); +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) + packet->chars[c].char_id = 0; // for now char_id unknown [4144] +// version unconfirmed +#elif PACKETVER >= 20100803 + memcpy(packet->chars[c].char_name, e->name, NAME_LENGTH); + #else - memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40); + memcpy(packet->chars[c].char_name, e->name, NAME_LENGTH); + memset(packet->chars[c].account_name, 0, NAME_LENGTH); // account name (not used for security reasons) + #endif - c++; + memcpy(packet->chars[c].message, e->mes, 40); + + c ++; } } - WFIFOW(fd,2) = 4 + c*offset; - WFIFOSET(fd,WFIFOW(fd,2)); + packet->packetLen = sizeof(struct PACKET_ZC_BAN_LIST) + c * sizeof(struct PACKET_ZC_BAN_LIST_sub); + WFIFOSET(fd, packet->packetLen); } /// Guild chat message (ZC_GUILD_CHAT). diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 55d21f6b0..445e9a3e2 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3234,6 +3234,49 @@ struct PACKET_ZC_ROLE_CHANGE { } __attribute__((packed)); DEFINE_PACKET_HEADER(ZC_ROLE_CHANGE, 0x00e1); +#if PACKETVER_MAIN_NUM >= 20161019 || PACKETVER_RE_NUM >= 20160921 || defined(PACKETVER_ZERO) +struct PACKET_ZC_BAN_LIST_sub { + int char_id; + char message[40]; +} __attribute__((packed)); + +struct PACKET_ZC_BAN_LIST { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_BAN_LIST_sub chars[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_BAN_LIST, 0x0a87); +// version unconfirmed +#elif PACKETVER >= 20100803 +struct PACKET_ZC_BAN_LIST_sub { + char char_name[NAME_LENGTH]; + char message[40]; +} __attribute__((packed)); + +struct PACKET_ZC_BAN_LIST { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_BAN_LIST_sub chars[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_BAN_LIST, 0x0163); +#else +struct PACKET_ZC_BAN_LIST_sub { + char char_name[NAME_LENGTH]; + char account_name[NAME_LENGTH]; + char message[40]; +} __attribute__((packed)); + +struct PACKET_ZC_BAN_LIST { + int16 packetType; + uint16 packetLen; + struct PACKET_ZC_BAN_LIST_sub chars[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_BAN_LIST, 0x0163); +#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 |