*Send threat messages to client - thanks to megamage for research.
--HG-- branch : trunk
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user