Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mackal
Last active January 25, 2020 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mackal/de08636fed3d9f793f060ebed224ef40 to your computer and use it in GitHub Desktop.
Save mackal/de08636fed3d9f793f060ebed224ef40 to your computer and use it in GitHub Desktop.
diff --git a/zone/mob.cpp b/zone/mob.cpp
index 71e876938..db7793605 100644
--- a/zone/mob.cpp
+++ b/zone/mob.cpp
@@ -186,6 +186,7 @@ Mob::Mob(
last_hp_percent = 0;
last_hp = 0;
+ last_max_hp = 0;
current_speed = base_runspeed;
@@ -1331,20 +1332,22 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= false*/) {
/**
- * If our HP is different from last HP update call - let's update selves
+ * If our HP/max HP is different from last HP/max HP update call - let's update selves
*/
if (IsClient()) {
- if (current_hp != last_hp || force_update_all) {
+ if (current_hp != last_hp || max_hp != last_max_hp || force_update_all) {
/**
* This is to prevent excessive packet sending under trains/fast combat
*/
if (this->CastToClient()->hp_self_update_throttle_timer.Check() || force_update_all) {
Log(Logs::General, Logs::HPUpdate,
- "Mob::SendHPUpdate :: Update HP of self (%s) HP: %i last: %i skip_self: %s",
+ "Mob::SendHPUpdate :: Update HP of self (%s) HP: %i/%i last: %i/%i skip_self: %s",
this->GetCleanName(),
current_hp,
+ max_hp,
last_hp,
+ last_max_hp,
(skip_self ? "true" : "false")
);
@@ -1367,6 +1370,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
* Used to check if HP has changed to update self next round
*/
last_hp = current_hp;
+ last_max_hp = max_hp;
}
}
}
diff --git a/zone/mob.h b/zone/mob.h
index d48f47e6d..7c095a001 100644
--- a/zone/mob.h
+++ b/zone/mob.h
@@ -1526,6 +1526,7 @@ protected:
int8 last_hp_percent;
int32 last_hp;
+ int32 last_max_hp;
int cur_wp;
glm::vec4 m_CurrentWayPoint;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment