From ba184ab9a2a932b6ce2eba279fdc379b50b430a5 Mon Sep 17 00:00:00 2001 From: Napster Date: Fri, 18 Dec 2015 23:00:53 +0700 Subject: [PATCH] Follow up to https://github.com/rathena/rathena/commit/d2d1fd2 * Update Packets Change size for newer client --- db/packet_db.txt | 1 - src/map/clif.c | 72 +++++++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/db/packet_db.txt b/db/packet_db.txt index 5b6d1f74bc..7d3a981054 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -2473,7 +2473,6 @@ packet_keys: 0x62C86D09,0x75944F17,0x112C133D // [YomRawr] 0x09EA,11,dull,0 // CZ_REQ_READ_MAIL 0x09EB,-1 // ZC_ACK_READ_MAIL 0x09EC,-1,dull,0 // CZ_REQ_WRITE_MAIL -0x0A2E,6,dull,0 // CZ_REQ_CHANGE_TITLE 0x09ED,3 // ZC_ACK_WRITE_MAIL 0x09EE,11,dull,0 // CZ_REQ_NEXT_MAIL_LIST 0x09EF,11,dull,0 // CZ_REQ_REFRESH_MAIL_LIST diff --git a/src/map/clif.c b/src/map/clif.c index 260f27bf40..7f02d9dc70 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6048,19 +6048,29 @@ void clif_channel_msg(struct Channel *channel, struct map_session_data *sd, char WFIFOSET(sd->fd, msg_len + 12); } -/// Displays heal effect (ZC_RECOVERY). -/// 013d .W .W +/// Displays heal effect. +/// 013d .W .W (ZC_RECOVERY) +/// 0a27 .W .L (ZC_RECOVERY2) /// var id: /// 5 = HP (SP_HP) /// 7 = SP (SP_SP) /// ? = ignored -void clif_heal(int fd,int type,int val) -{ - WFIFOHEAD(fd,packet_len(0x13d)); - WFIFOW(fd,0)=0x13d; - WFIFOW(fd,2)=type; - WFIFOW(fd,4)=cap_value(val,0,INT16_MAX); - WFIFOSET(fd,packet_len(0x13d)); +void clif_heal(int fd,int type,int val) { +#if PACKETVER < 20150513 + const int cmd = 0x13d; +#else + const int cmd = 0xa27; +#endif + + WFIFOHEAD(fd, packet_len(cmd)); + WFIFOW(fd,0) = cmd; + WFIFOW(fd,2) = type; +#if PACKETVER < 20150513 + WFIFOW(fd,4) = min(val, INT16_MAX); +#else + WFIFOL(fd,4) = min(val, INT32_MAX); +#endif + WFIFOSET(fd, packet_len(cmd)); } @@ -16237,29 +16247,39 @@ void clif_readbook(int fd, int book_id, int page) /// Battlegrounds /// -/// Updates HP bar of a camp member (ZC_BATTLEFIELD_NOTIFY_HP). -/// 02e0 .L .24B .W .W -void clif_bg_hp(struct map_session_data *sd) -{ +/// Updates HP bar of a camp member. +/// 02e0 .L .24B .W .W (ZC_BATTLEFIELD_NOTIFY_HP) +/// 0a0e .L .L .L (ZC_BATTLEFIELD_NOTIFY_HP2) +void clif_bg_hp(struct map_session_data *sd) { +#if PACKETVER < 20140613 unsigned char buf[34]; const int cmd = 0x2e0; +#else + unsigned char buf[14]; + const int cmd = 0xa0e; +#endif nullpo_retv(sd); WBUFW(buf,0) = cmd; WBUFL(buf,2) = sd->status.account_id; - memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH); - - if( sd->battle_status.max_hp > INT16_MAX ) - { // To correctly display the %hp bar. [Skotlex] +#if PACKETVER < 20140613 + memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH); + if( sd->battle_status.max_hp > INT16_MAX ) { // To correctly display the %hp bar. [Skotlex] WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); - WBUFW(buf,32) = 100; - } - else - { + WBUFW(buf,32) = 100; + } else { WBUFW(buf,30) = sd->battle_status.hp; WBUFW(buf,32) = sd->battle_status.max_hp; - } - + } +#else + if( sd->battle_status.max_hp > INT32_MAX ) { + WBUFL(buf,6) = sd->battle_status.hp/(sd->battle_status.max_hp/100); + WBUFL(buf,10) = 100; + } else { + WBUFL(buf,6) = sd->battle_status.hp; + WBUFL(buf,10) = sd->battle_status.max_hp; + } +#endif clif_send(buf, packet_len(cmd), &sd->bl, BG_AREA_WOS); } @@ -18920,12 +18940,12 @@ void packetdb_readdb(bool reload) 0, 11, 12, 11, 0, 0, 0, 75, -1,143, 0, 0, 0, -1, -1, -1, //#0x0A00 #if PACKETVER >= 20141022 - 269, 3, 4, 2, 6, 49, 6, 9, 26, 45, 47, 47, 56, -1, 0, -1, + 269, 3, 4, 2, 6, 49, 6, 9, 26, 45, 47, 47, 56, -1, 14, -1, #else - 269, 0, 0, 2, 6, 48, 6, 9, 26, 45, 47, 47, 56, -1, 0, 0, + 269, 0, 0, 2, 6, 48, 6, 9, 26, 45, 47, 47, 56, -1, 14, 0, #endif -1, 0, 0, 26, 0, 0, 0, 0, 14, 2, 23, 2, -1, 2, 3, 2, - 21, 3, 5, 0, 66, 0, 0, 0, 3, 0, 0, 0, 0, -1, 0, 0, + 21, 3, 5, 0, 66, 0, 0, 8, 3, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; struct {