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/
This commit is contained in:
Michael Cook (mackal) 2020-11-17 15:47:12 -05:00
parent 1fc4073a05
commit eb0d12f220

View File

@ -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;