Merge pull request #1137 from EQEmu/bug_fix/rest_timer

Save the rest_timer sooner to prevent issues
This commit is contained in:
Michael Cook (mackal) 2020-11-22 14:35:24 -05:00 committed by GitHub
commit 31019b8832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4725,6 +4725,12 @@ void Client::IncrementAggroCount(bool raid_target)
uint32 newtimer = raid_target ? RuleI(Character, RestRegenRaidTimeToActivate) : RuleI(Character, RestRegenTimeToActivate); 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 // save the new timer if it's higher
m_pp.RestTimer = std::max(m_pp.RestTimer, newtimer); m_pp.RestTimer = std::max(m_pp.RestTimer, newtimer);
@ -4734,10 +4740,6 @@ void Client::IncrementAggroCount(bool raid_target)
if(AggroCount > 1) if(AggroCount > 1)
return; 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) { if (ClientVersion() >= EQ::versions::ClientVersion::SoF) {
auto outapp = new EQApplicationPacket(OP_RestState, 1); auto outapp = new EQApplicationPacket(OP_RestState, 1);
char *Buffer = (char *)outapp->pBuffer; char *Buffer = (char *)outapp->pBuffer;