Skip to content

Commit

Permalink
Follow up to d2d1fd2
Browse files Browse the repository at this point in the history
* Update Packets Change size for newer client
  • Loading branch information
icxbb-xx committed Dec 18, 2015
1 parent c75cc2a commit ba184ab
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 27 deletions.
1 change: 0 additions & 1 deletion db/packet_db.txt
Expand Up @@ -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
Expand Down
72 changes: 46 additions & 26 deletions src/map/clif.c
Expand Up @@ -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 <var id>.W <amount>.W
/// Displays heal effect.
/// 013d <var id>.W <amount>.W (ZC_RECOVERY)
/// 0a27 <var id>.W <amount>.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));
}


Expand Down Expand Up @@ -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 <account id>.L <name>.24B <hp>.W <max hp>.W
void clif_bg_hp(struct map_session_data *sd)
{
/// Updates HP bar of a camp member.
/// 02e0 <account id>.L <name>.24B <hp>.W <max hp>.W (ZC_BATTLEFIELD_NOTIFY_HP)
/// 0a0e <account id>.L <hp>.L <max hp>.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);
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ba184ab

Please sign in to comment.