diff options
author | QAston <none@none> | 2009-07-02 00:03:57 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-07-02 00:03:57 +0200 |
commit | 69f36d7af4724b68c7a3a104b2913d1e2743971b (patch) | |
tree | e36624b856ec14cf17384860e2d4fb05079dc7d1 /src/game/ThreatManager.cpp | |
parent | fd86e6a369b03d496988673f97409c5b74e99c52 (diff) |
*Send threat messages to client - thanks to megamage for research.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ThreatManager.cpp')
-rw-r--r-- | src/game/ThreatManager.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index a0459aa81dc..e982cbbfe22 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -346,7 +346,7 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe //=================== ThreatManager ========================== //============================================================ -ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(NULL), iOwner(owner) +ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(NULL), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL) { } @@ -357,6 +357,7 @@ void ThreatManager::clearReferences() iThreatContainer.clearReferences(); iThreatOfflineContainer.clearReferences(); iCurrentVictim = NULL; + iUpdateTimer = THREAT_UPDATE_INTERVAL; } //============================================================ @@ -470,6 +471,10 @@ void ThreatManager::tauntFadeOut(Unit *pTaunter) void ThreatManager::setCurrentVictim(HostilReference* pHostilReference) { + if (pHostilReference && pHostilReference != iCurrentVictim) + { + iOwner->SendChangeCurrentVictimOpcode(pHostilReference); + } iCurrentVictim = pHostilReference; } @@ -515,6 +520,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat setCurrentVictim(NULL); setDirty(true); } + iOwner->SendRemoveFromThreatListOpcode(hostilReference); if(hostilReference->isOnline()) iThreatContainer.remove(hostilReference); else @@ -523,3 +529,16 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat } } +bool ThreatManager::isNeedUpdateToClient(uint32 time) +{ + if (isThreatListEmpty()) + return false; + if (time >= iUpdateTimer) + { + iUpdateTimer = THREAT_UPDATE_INTERVAL; + return true; + } + iUpdateTimer -= time; + return false; +} + |