diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index f8f50c7ee..d2dc12377 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6088,14 +6088,29 @@ void clif_wis_end(int fd, int flag) { /// Returns character name requested by char_id (ZC_ACK_REQNAME_BYGID). /// 0194 <char id>.L <name>.24B +/// 0af7 <flag>.W <char id>.L <name>.24B void clif_solved_charname(int fd, int charid, const char* name) { nullpo_retv(name); - WFIFOHEAD(fd,packet_len(0x194)); - WFIFOW(fd,0)=0x194; - WFIFOL(fd,2)=charid; - safestrncpy(WFIFOP(fd,6), name, NAME_LENGTH); - WFIFOSET(fd,packet_len(0x194)); +#if !defined(PACKETVER_ZERO) && (PACKETVER >= 20180307 || (defined(PACKETVER_RE) && PACKETVER >= 20180221)) + WFIFOHEAD(fd, packet_len(0x0af7)); + WFIFOW(fd, 0) = 0xaf7; + if (*name == 0) { + WFIFOW(fd, 2) = 2; + memset(WFIFOP(fd, 8), 0, NAME_LENGTH); + } else { + WFIFOW(fd, 2) = 3; + safestrncpy(WFIFOP(fd, 8), name, NAME_LENGTH); + } + WFIFOL(fd, 4) = charid; + WFIFOSET(fd, packet_len(0x0af7)); +#else + WFIFOHEAD(fd, packet_len(0x194)); + WFIFOW(fd, 0) = 0x194; + WFIFOL(fd, 2) = charid; + safestrncpy(WFIFOP(fd, 6), name, NAME_LENGTH); + WFIFOSET(fd, packet_len(0x194)); +#endif } /// Presents a list of items that can be carded/composed (ZC_ITEMCOMPOSITION_LIST). @@ -14182,6 +14197,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) /// Toggles a single friend online/offline [Skotlex] (ZC_FRIENDS_STATE). /// 0206 <account id>.L <char id>.L <state>.B +/// 0206 <account id>.L <char id>.L <state>.B <name>.24B /// state: /// 0 = online /// 1 = offline @@ -14201,7 +14217,13 @@ void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int cha WFIFOW(fd, 0) = 0x206; WFIFOL(fd, 2) = sd->status.friends[i].account_id; WFIFOL(fd, 6) = sd->status.friends[i].char_id; - WFIFOB(fd,10) = !online; //Yeah, a 1 here means "logged off", go figure... + WFIFOB(fd, 10) = !online; //Yeah, a 1 here means "logged off", go figure... +#ifndef PACKETVER_ZERO +#if PACKETVER >= 20180307 || (defined(PACKETVER_RE) && PACKETVER >= 20180221) + memcpy(WFIFOP(fd, 11), sd->status.friends[i].name, NAME_LENGTH); +#endif +#endif // PACKETVER_ZERO + WFIFOSET(fd, packet_len(0x206)); } @@ -14218,22 +14240,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)); } |