From 12d81c4f8fff03eb01636a0eb99c6fccf1c13726 Mon Sep 17 00:00:00 2001 From: gumi Date: Wed, 20 May 2020 17:04:04 +0000 Subject: add support for SMSG_ONLINE_LIST2 --- src/emap/init.c | 1 + src/emap/map.c | 13 ++++++++++--- src/emap/send.c | 13 +++++++++++++ src/emap/send.h | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/emap/init.c b/src/emap/init.c index 9bc0324..e22805f 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -243,6 +243,7 @@ HPExport void plugin_init (void) packets->addLen(0xb0a + evolPacketOffset, -1); packets->addLen(0xb0b + evolPacketOffset, -1); packets->addLen(0xb10 + evolPacketOffset, -1); + packets->addLen(0xb11 + evolPacketOffset, -1); packets->addLen(0xb16 + evolPacketOffset, -1); packets->addLen(0xb17 + evolPacketOffset, 19); packets->addLen(0xb18 + evolPacketOffset, 28); diff --git a/src/emap/map.c b/src/emap/map.c index 1c60e8b..473fb2a 100644 --- a/src/emap/map.c +++ b/src/emap/map.c @@ -153,7 +153,8 @@ void emap_online_list(int fd) else state = (state | BEINGFLAG_GENDER_HIDDEN) & ~BEINGFLAG_GENDER_MALE; - if (pc_has_permission(sd, permission_send_gm_flag)) + if (pc_has_permission(sd, permission_send_gm_flag) + && data1->clientVersion < 27) state |= BEINGFLAG_GM; else state &= ~BEINGFLAG_GM; @@ -164,8 +165,10 @@ void emap_online_list(int fd) *ptr = sd->status.base_level; ptr ++; - if (showVersion) + if (showVersion && data1->clientVersion < 27) *ptr = data->clientVersion; + else if (data1->clientVersion >= 27) + *ptr = pc_get_group_level(sd); else *ptr = 0; ptr ++; @@ -177,7 +180,11 @@ void emap_online_list(int fd) } dbi_destroy(iter); - send_online_list(fd, buf, (unsigned int)(ptr - buf)); + + if (data1->clientVersion >= 27) + send_online_list2(fd, buf, (unsigned int)(ptr - buf)); + else + send_online_list(fd, buf, (unsigned int)(ptr - buf)); aFree(buf); } diff --git a/src/emap/send.c b/src/emap/send.c index 08c57b0..ed5d000 100644 --- a/src/emap/send.c +++ b/src/emap/send.c @@ -376,6 +376,19 @@ void send_online_list(int fd, const char *buf, unsigned size) WFIFOSET (fd, len); } +void send_online_list2(int fd, const char *buf, unsigned size) +{ + if (!buf) + return; + const unsigned int len = size + 4 + 1; + WFIFOHEAD (fd, len); + WFIFOW (fd, 0) = 0xb11 + evolPacketOffset; + WFIFOW (fd, 2) = len; + memcpy (WFIFOP (fd, 4), buf, size); + WFIFOB (fd, size + 4) = 0; + WFIFOSET (fd, len); +} + void send_client_command(struct map_session_data *sd, const char *const command) { if (!command) diff --git a/src/emap/send.h b/src/emap/send.h index b89f1fc..7e15a03 100644 --- a/src/emap/send.h +++ b/src/emap/send.h @@ -37,6 +37,7 @@ void send_slave_say(struct map_session_data *sd, const char *const name, const char *const message); void send_online_list(int fd, const char *buf, unsigned size); +void send_online_list2(int fd, const char *buf, unsigned size); void send_client_command(struct map_session_data *sd, const char *const command); void send_changelook2(struct map_session_data* sd, -- cgit v1.2.3-70-g09d2