summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-08 21:22:02 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-12 01:03:20 +0300
commitfcffa6cafb701073995107748aaab9d6adb97224 (patch)
tree0214203af6eb4d46f6eff9607b628d3cb34ab0a5 /src
parentb6690d7bb05e75d28891f360f42e0dfe19ea0904 (diff)
downloadhercules-fcffa6cafb701073995107748aaab9d6adb97224.tar.gz
hercules-fcffa6cafb701073995107748aaab9d6adb97224.tar.bz2
hercules-fcffa6cafb701073995107748aaab9d6adb97224.tar.xz
hercules-fcffa6cafb701073995107748aaab9d6adb97224.zip
Add packet id clif_bg_hp (0xa0e)
Based on rAthena commit: commit ba184ab9a2a932b6ce2eba279fdc379b50b430a5 Author: Napster <arokaice@live.com> Date: Fri Dec 18 23:00:53 2015 +0700
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c38
-rw-r--r--src/map/packets.h4
2 files changed, 32 insertions, 10 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 749b3d068..183229f95 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -16181,28 +16181,46 @@ 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
+/// 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)
{
unsigned char buf[34];
+
+// packet version can be wrong, because inconsistend data in other servers.
+#if PACKETVER < 20140613
const int cmd = 0x2e0;
nullpo_retv(sd);
- WBUFW(buf,0) = cmd;
- WBUFL(buf,2) = sd->status.account_id;
- memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH);
+ 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 )
+ 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;
+ WBUFW(buf, 30) = sd->battle_status.hp / (sd->battle_status.max_hp / 100);
+ WBUFW(buf, 32) = 100;
}
else
{
- WBUFW(buf,30) = sd->battle_status.hp;
- WBUFW(buf,32) = sd->battle_status.max_hp;
+ WBUFW(buf, 30) = sd->battle_status.hp;
+ WBUFW(buf, 32) = sd->battle_status.max_hp;
}
+#else
+ const int cmd = 0xa0e;
+ nullpo_retv(sd);
+
+ WBUFW(buf, 0) = cmd;
+ WBUFL(buf, 2) = sd->status.account_id;
+ 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);
}
diff --git a/src/map/packets.h b/src/map/packets.h
index 33fa5236d..8b0a733c7 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2787,6 +2787,10 @@ packet(0x96e,-1,clif->ackmergeitems);
packet(0x09DF,7);
#endif
+#if PACKETVER >= 20140613
+ packet(0x0a0e,14);
+#endif
+
// 2014-10-16aRagexe - YomRawr
#if PACKETVER >= 20141016
packet(0x0369,7,clif->pActionRequest,2,6);