TrinityCore/TrinityCore — Issue #5153: [PET] Focus regen sometimes gets stuck
Author: MrSmite
Created: 2012-02-09 09:04:26+00:00
State: open

Occasionally pet focus regen gets stuck because

m_regenTimer > PET_FOCUS_REGEN_INTERVAL

which makes the following not evaluate properly

m_regenTimer += PET_FOCUS_REGEN_INTERVAL - diff;
if (!m_regenTimer) ++m_regenTimer;

The following patch will fix the problem (old patch that was removed for some reason):

From 033e560080a504c6a75fb52764cb3966d78f1f74 Mon Sep 17 00:00:00 2001
From: MrSmite
Date: Wed, 2 Nov 2011 16:25:30 -0400
Subject: [PATCH 1/1] Fix pet focus regen getting stuck

---
src/server/game/Entities/Pet/Pet.cpp | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 6075085..6547028 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -537,6 +537,12 @@ void Pet::Update(uint32 diff)
Regenerate(POWER_FOCUS);
m_regenTimer += PET_FOCUS_REGEN_INTERVAL - diff;
if (!m_regenTimer) ++m_regenTimer;
+
+ // MrSmite
+ // Fix for focus regen getting stuck
+ if (m_regenTimer > PET_FOCUS_REGEN_INTERVAL)
+ m_regenTimer = PET_FOCUS_REGEN_INTERVAL;
+
break;
// in creature::update
//case POWER_ENERGY:
--
1.7.3.1.msysgit.0