summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-24 21:17:04 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-11 04:32:23 +0300
commit7b72dee98c9cac94fe94c24d5ca791fac9f9f4ad (patch)
tree27cf981cb84b5acfe266f5795571bc119f3559df
parentc676bdd25be81095abec067aa61f18eb1cdbdd87 (diff)
downloadhercules-7b72dee98c9cac94fe94c24d5ca791fac9f9f4ad.tar.gz
hercules-7b72dee98c9cac94fe94c24d5ca791fac9f9f4ad.tar.bz2
hercules-7b72dee98c9cac94fe94c24d5ca791fac9f9f4ad.tar.xz
hercules-7b72dee98c9cac94fe94c24d5ca791fac9f9f4ad.zip
Fix friend list packet for clients 20180221 and newer.
-rw-r--r--src/map/clif.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 1aee4fc1d..e3e659234 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -14225,22 +14225,30 @@ int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap)
/// Sends the whole friends list (ZC_FRIENDS_LIST).
/// 0201 <packet len>.W { <account id>.L <char id>.L <name>.24B }*
+/// 0201 <packet len>.W { <account id>.L <char id>.L }*
void clif_friendslist_send(struct map_session_data *sd)
{
int i = 0, n, fd = sd->fd;
+#if !defined(PACKETVER_ZERO) && (PACKETVER >= 20180307 || (defined(PACKETVER_RE) && PACKETVER >= 20180221))
+ const int offset = 8;
+#else
+ const int offset = 32;
+#endif
nullpo_retv(sd);
// Send friends list
- WFIFOHEAD(fd, MAX_FRIENDS * 32 + 4);
+ WFIFOHEAD(fd, MAX_FRIENDS * offset + 4);
WFIFOW(fd, 0) = 0x201;
for(i = 0; i < MAX_FRIENDS && sd->status.friends[i].char_id; i++) {
- WFIFOL(fd, 4 + 32 * i + 0) = sd->status.friends[i].account_id;
- WFIFOL(fd, 4 + 32 * i + 4) = sd->status.friends[i].char_id;
- memcpy(WFIFOP(fd, 4 + 32 * i + 8), &sd->status.friends[i].name, NAME_LENGTH);
+ WFIFOL(fd, 4 + offset * i + 0) = sd->status.friends[i].account_id;
+ WFIFOL(fd, 4 + offset * i + 4) = sd->status.friends[i].char_id;
+#if !(!defined(PACKETVER_ZERO) && (PACKETVER >= 20180307 || (defined(PACKETVER_RE) && PACKETVER >= 20180221)))
+ memcpy(WFIFOP(fd, 4 + offset * i + 8), &sd->status.friends[i].name, NAME_LENGTH);
+#endif
}
if (i) {
- WFIFOW(fd,2) = 4 + 32 * i;
+ WFIFOW(fd,2) = 4 + offset * i;
WFIFOSET(fd, WFIFOW(fd,2));
}