mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 04:11:30 +00:00
[Hitpoints] Remove HP Update Throttling (#1517)
* Remove HP update throttling and increase HP update resolution and accuracy * Make some log statements detail * Add better logging messages * Remove old self update throttle block check preventing updates to self
This commit is contained in:
parent
7f823256f4
commit
e1df72d64d
@ -169,8 +169,6 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
last_region_type(RegionTypeUnsupported),
|
last_region_type(RegionTypeUnsupported),
|
||||||
m_dirtyautohaters(false),
|
m_dirtyautohaters(false),
|
||||||
mob_close_scan_timer(6000),
|
mob_close_scan_timer(6000),
|
||||||
hp_self_update_throttle_timer(300),
|
|
||||||
hp_other_update_throttle_timer(500),
|
|
||||||
position_update_timer(10000),
|
position_update_timer(10000),
|
||||||
consent_throttle_timer(2000),
|
consent_throttle_timer(2000),
|
||||||
tmSitting(0)
|
tmSitting(0)
|
||||||
@ -2503,7 +2501,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(EQ::skills::SkillType skillid
|
|||||||
uint16 PrimarySpecialization = 0, SecondaryForte = 0;
|
uint16 PrimarySpecialization = 0, SecondaryForte = 0;
|
||||||
|
|
||||||
uint16 PrimarySkillValue = 0, SecondarySkillValue = 0;
|
uint16 PrimarySkillValue = 0, SecondarySkillValue = 0;
|
||||||
|
|
||||||
uint16 MaxSpecializations = aabonuses.SecondaryForte ? 2 : 1;
|
uint16 MaxSpecializations = aabonuses.SecondaryForte ? 2 : 1;
|
||||||
|
|
||||||
if (skillid >= EQ::skills::SkillSpecializeAbjure && skillid <= EQ::skills::SkillSpecializeEvocation)
|
if (skillid >= EQ::skills::SkillSpecializeAbjure && skillid <= EQ::skills::SkillSpecializeEvocation)
|
||||||
|
|||||||
@ -1818,8 +1818,6 @@ private:
|
|||||||
Timer helm_toggle_timer;
|
Timer helm_toggle_timer;
|
||||||
Timer aggro_meter_timer;
|
Timer aggro_meter_timer;
|
||||||
Timer mob_close_scan_timer;
|
Timer mob_close_scan_timer;
|
||||||
Timer hp_self_update_throttle_timer; /* This is to prevent excessive packet sending under trains/fast combat */
|
|
||||||
Timer hp_other_update_throttle_timer; /* This is to keep clients from DOSing the server with macros that change client targets constantly */
|
|
||||||
Timer position_update_timer; /* Timer used when client hasn't updated within a 10 second window */
|
Timer position_update_timer; /* Timer used when client hasn't updated within a 10 second window */
|
||||||
Timer consent_throttle_timer;
|
Timer consent_throttle_timer;
|
||||||
Timer dynamiczone_removal_timer;
|
Timer dynamiczone_removal_timer;
|
||||||
|
|||||||
@ -119,8 +119,9 @@ bool Client::Process() {
|
|||||||
|
|
||||||
// SendHPUpdate calls hpupdate_timer.Start so it can delay this timer, so lets not reset with the check
|
// SendHPUpdate calls hpupdate_timer.Start so it can delay this timer, so lets not reset with the check
|
||||||
// since the function will anyways
|
// since the function will anyways
|
||||||
if (hpupdate_timer.Check(false))
|
if (hpupdate_timer.Check(false)) {
|
||||||
SendHPUpdate();
|
SendHPUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
/* I haven't naturally updated my position in 10 seconds, updating manually */
|
/* I haven't naturally updated my position in 10 seconds, updating manually */
|
||||||
if (!is_client_moving && position_update_timer.Check()) {
|
if (!is_client_moving && position_update_timer.Check()) {
|
||||||
@ -466,7 +467,7 @@ bool Client::Process() {
|
|||||||
if (gravity_timer.Check())
|
if (gravity_timer.Check())
|
||||||
DoGravityEffect();
|
DoGravityEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shield_timer.Check()) {
|
if (shield_timer.Check()) {
|
||||||
ShieldAbilityFinish();
|
ShieldAbilityFinish();
|
||||||
}
|
}
|
||||||
|
|||||||
110
zone/mob.cpp
110
zone/mob.cpp
@ -1355,82 +1355,72 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= false*/) {
|
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 is different from last HP update call - let's update selves
|
|
||||||
*/
|
|
||||||
if (IsClient()) {
|
if (IsClient()) {
|
||||||
|
|
||||||
// delay to allow the client to catch up on buff states
|
// delay allowing the client to catch up on buff states
|
||||||
if (max_hp != last_max_hp) {
|
if (max_hp != last_max_hp) {
|
||||||
|
|
||||||
last_max_hp = max_hp;
|
last_max_hp = max_hp;
|
||||||
CastToClient()->hp_self_update_throttle_timer.Trigger();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_hp != last_hp || force_update_all) {
|
if (current_hp != last_hp || force_update_all) {
|
||||||
|
|
||||||
/**
|
// This is to prevent excessive packet sending under trains/fast combat
|
||||||
* This is to prevent excessive packet sending under trains/fast combat
|
LogHPUpdate(
|
||||||
*/
|
"[SendHPUpdate] Update HP of self [{}] HP: [{}/{}] last: [{}/{}] skip_self: [{}]",
|
||||||
if (this->CastToClient()->hp_self_update_throttle_timer.Check() || force_update_all) {
|
GetCleanName(),
|
||||||
Log(Logs::General, Logs::HPUpdate,
|
current_hp,
|
||||||
"Mob::SendHPUpdate :: Update HP of self (%s) HP: %i/%i last: %i/%i skip_self: %s",
|
max_hp,
|
||||||
this->GetCleanName(),
|
last_hp,
|
||||||
current_hp,
|
last_max_hp,
|
||||||
max_hp,
|
(skip_self ? "true" : "false")
|
||||||
last_hp,
|
);
|
||||||
last_max_hp,
|
|
||||||
(skip_self ? "true" : "false")
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!skip_self || this->CastToClient()->ClientVersion() >= EQ::versions::ClientVersion::SoD) {
|
if (!skip_self || this->CastToClient()->ClientVersion() >= EQ::versions::ClientVersion::SoD) {
|
||||||
auto client_packet = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct));
|
auto client_packet = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct));
|
||||||
auto *hp_packet_client = (SpawnHPUpdate_Struct *) client_packet->pBuffer;
|
auto *hp_packet_client = (SpawnHPUpdate_Struct *) client_packet->pBuffer;
|
||||||
|
|
||||||
hp_packet_client->cur_hp = static_cast<uint32>(CastToClient()->GetHP() - itembonuses.HP);
|
hp_packet_client->cur_hp = static_cast<uint32>(CastToClient()->GetHP() - itembonuses.HP);
|
||||||
hp_packet_client->spawn_id = GetID();
|
hp_packet_client->spawn_id = GetID();
|
||||||
hp_packet_client->max_hp = CastToClient()->GetMaxHP() - itembonuses.HP;
|
hp_packet_client->max_hp = CastToClient()->GetMaxHP() - itembonuses.HP;
|
||||||
|
|
||||||
CastToClient()->QueuePacket(client_packet);
|
CastToClient()->QueuePacket(client_packet);
|
||||||
|
|
||||||
safe_delete(client_packet);
|
safe_delete(client_packet);
|
||||||
|
|
||||||
ResetHPUpdateTimer();
|
ResetHPUpdateTimer();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to check if HP has changed to update self next round
|
|
||||||
*/
|
|
||||||
last_hp = current_hp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used to check if HP has changed to update self next round
|
||||||
|
last_hp = current_hp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto current_hp_percent = GetIntHPRatio();
|
auto current_hp_percent = GetIntHPRatio();
|
||||||
|
|
||||||
Log(Logs::General,
|
LogHPUpdateDetail(
|
||||||
Logs::HPUpdate,
|
"[SendHPUpdate] Client [{}] HP is [{}] last [{}]",
|
||||||
"Mob::SendHPUpdate :: SendHPUpdate %s HP is %i last %i",
|
GetCleanName(),
|
||||||
this->GetCleanName(),
|
|
||||||
current_hp_percent,
|
current_hp_percent,
|
||||||
last_hp_percent);
|
last_hp_percent
|
||||||
|
);
|
||||||
|
|
||||||
if (current_hp_percent == last_hp_percent && !force_update_all) {
|
if (current_hp_percent == last_hp_percent && !force_update_all) {
|
||||||
Log(Logs::General, Logs::HPUpdate, "Mob::SendHPUpdate :: Same HP - skipping update");
|
LogHPUpdateDetail("[SendHPUpdate] Same HP for mob [{}] skipping update", GetCleanName());
|
||||||
ResetHPUpdateTimer();
|
ResetHPUpdateTimer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (IsClient() && RuleB(Character, MarqueeHPUpdates)) {
|
if (IsClient() && RuleB(Character, MarqueeHPUpdates)) {
|
||||||
this->CastToClient()->SendHPUpdateMarquee();
|
CastToClient()->SendHPUpdateMarquee();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(Logs::General, Logs::HPUpdate, "Mob::SendHPUpdate :: HP Changed - Send update");
|
LogHPUpdate("[SendHPUpdate] HP Changed for mob [{}] send update", GetCleanName());
|
||||||
|
|
||||||
last_hp_percent = current_hp_percent;
|
last_hp_percent = current_hp_percent;
|
||||||
}
|
}
|
||||||
@ -1440,24 +1430,16 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
|||||||
|
|
||||||
CreateHPPacket(&hp_packet);
|
CreateHPPacket(&hp_packet);
|
||||||
|
|
||||||
/**
|
// update those who have us targeted
|
||||||
* Update those who have us targeted
|
|
||||||
*/
|
|
||||||
entity_list.QueueClientsByTarget(this, &hp_packet, false, 0, false, true, EQ::versions::maskAllClients);
|
entity_list.QueueClientsByTarget(this, &hp_packet, false, 0, false, true, EQ::versions::maskAllClients);
|
||||||
|
|
||||||
/**
|
// Update those who have us on x-target
|
||||||
* Update those who have us on x-target
|
|
||||||
*/
|
|
||||||
entity_list.QueueClientsByXTarget(this, &hp_packet, false);
|
entity_list.QueueClientsByXTarget(this, &hp_packet, false);
|
||||||
|
|
||||||
/**
|
// Update groups using Group LAA health name tag counter
|
||||||
* Update groups using Group LAA health name tag counter
|
|
||||||
*/
|
|
||||||
entity_list.QueueToGroupsForNPCHealthAA(this, &hp_packet);
|
entity_list.QueueToGroupsForNPCHealthAA(this, &hp_packet);
|
||||||
|
|
||||||
/**
|
// Group
|
||||||
* Group
|
|
||||||
*/
|
|
||||||
if (IsGrouped()) {
|
if (IsGrouped()) {
|
||||||
group = entity_list.GetGroupByMob(this);
|
group = entity_list.GetGroupByMob(this);
|
||||||
if (group) {
|
if (group) {
|
||||||
@ -1465,9 +1447,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Raid
|
||||||
* Raid
|
|
||||||
*/
|
|
||||||
if (IsClient()) {
|
if (IsClient()) {
|
||||||
Raid *raid = entity_list.GetRaidByClient(CastToClient());
|
Raid *raid = entity_list.GetRaidByClient(CastToClient());
|
||||||
if (raid) {
|
if (raid) {
|
||||||
@ -1475,9 +1455,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Pet
|
||||||
* Pet
|
|
||||||
*/
|
|
||||||
if (GetOwner() && GetOwner()->IsClient()) {
|
if (GetOwner() && GetOwner()->IsClient()) {
|
||||||
GetOwner()->CastToClient()->QueuePacket(&hp_packet, false);
|
GetOwner()->CastToClient()->QueuePacket(&hp_packet, false);
|
||||||
group = entity_list.GetGroupByClient(GetOwner()->CastToClient());
|
group = entity_list.GetGroupByClient(GetOwner()->CastToClient());
|
||||||
@ -3282,8 +3260,8 @@ void Mob::SetTarget(Mob *mob)
|
|||||||
else if (IsClient()) {
|
else if (IsClient()) {
|
||||||
parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0);
|
parse->EventPlayer(EVENT_TARGET_CHANGE, CastToClient(), "", 0);
|
||||||
|
|
||||||
if (this->CastToClient()->admin > 200) {
|
if (CastToClient()->admin > 200) {
|
||||||
this->DisplayInfo(mob);
|
DisplayInfo(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
@ -3295,8 +3273,8 @@ void Mob::SetTarget(Mob *mob)
|
|||||||
GetOwner()->CastToClient()->UpdateXTargetType(MyPetTarget, mob);
|
GetOwner()->CastToClient()->UpdateXTargetType(MyPetTarget, mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->IsClient() && this->GetTarget() && this->CastToClient()->hp_other_update_throttle_timer.Check()) {
|
if (IsClient() && GetTarget()) {
|
||||||
this->GetTarget()->SendHPUpdate(false, true);
|
GetTarget()->SendHPUpdate(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user