From eb0d12f22038353342fccbd655e6d5c253df0ab3 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 17 Nov 2020 15:47:12 -0500 Subject: [PATCH] Save the rest_timer sooner to prevent issues We need to save the remaining time sooner to prevent circumstances described here: http://www.projecteq.net/forums/index.php?threads/raid-out-of-combat-regen-timers-resetting-on-non-raid-mobs.16114/ --- zone/client.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 562e6de58..087aeb1ec 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4725,6 +4725,12 @@ void Client::IncrementAggroCount(bool raid_target) uint32 newtimer = raid_target ? RuleI(Character, RestRegenRaidTimeToActivate) : RuleI(Character, RestRegenTimeToActivate); + // When our aggro count is 1 here, we are exiting rest state. We need to pause our current timer, if we have time remaining + // We should not actually have to do anything to the Timer object since the AggroCount counter blocks it from being checked + // and will have it's timer changed when we exit combat so let's not do any extra work + if (AggroCount == 1 && rest_timer.GetRemainingTime()) // the Client::rest_timer is never disabled, so don't need to check + m_pp.RestTimer = std::max(1u, rest_timer.GetRemainingTime() / 1000); // I guess round up? + // save the new timer if it's higher m_pp.RestTimer = std::max(m_pp.RestTimer, newtimer); @@ -4734,10 +4740,6 @@ void Client::IncrementAggroCount(bool raid_target) if(AggroCount > 1) return; - // Pause the rest timer, it's possible the new timer is a non-raid timer we're currently ticking down on a raid timer - if (AggroCount == 1) - m_pp.RestTimer = std::max(m_pp.RestTimer, rest_timer.GetRemainingTime() / 1000); - if (ClientVersion() >= EQ::versions::ClientVersion::SoF) { auto outapp = new EQApplicationPacket(OP_RestState, 1); char *Buffer = (char *)outapp->pBuffer;