aboutsummaryrefslogtreecommitdiff
path: root/src/game/HostilRefManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/HostilRefManager.cpp')
-rw-r--r--src/game/HostilRefManager.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/game/HostilRefManager.cpp b/src/game/HostilRefManager.cpp
index 567ec634cd4..4a51d54248d 100644
--- a/src/game/HostilRefManager.cpp
+++ b/src/game/HostilRefManager.cpp
@@ -17,22 +17,27 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "HostilRefManager.h"
#include "ThreatManager.h"
#include "Unit.h"
#include "DBCStructure.h"
#include "SpellMgr.h"
+
HostilRefManager::~HostilRefManager()
{
deleteReferences();
}
+
//=================================================
// send threat to all my hateres for the pVictim
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
+
void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{
HostilReference* ref;
+
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
ref = getFirst();
while(ref != NULL)
@@ -45,10 +50,13 @@ void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry con
ref = ref->next();
}
}
+
//=================================================
+
void HostilRefManager::addThreatPercent(int32 pValue)
{
HostilReference* ref;
+
ref = getFirst();
while(ref != NULL)
{
@@ -56,11 +64,14 @@ void HostilRefManager::addThreatPercent(int32 pValue)
ref = ref->next();
}
}
+
//=================================================
// The online / offline status is given to the method. The calculation has to be done before
+
void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
{
HostilReference* ref;
+
ref = getFirst();
while(ref != NULL)
{
@@ -68,8 +79,10 @@ void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
ref = ref->next();
}
}
+
//=================================================
// The online / offline status is calculated and set
+
void HostilRefManager::updateThreatTables()
{
HostilReference* ref = getFirst();
@@ -79,9 +92,11 @@ void HostilRefManager::updateThreatTables()
ref = ref->next();
}
}
+
//=================================================
// The references are not needed anymore
// tell the source to remove them from the list and free the mem
+
void HostilRefManager::deleteReferences()
{
HostilReference* ref = getFirst();
@@ -93,8 +108,10 @@ void HostilRefManager::deleteReferences()
ref = nextRef;
}
}
+
//=================================================
// delete one reference, defined by Unit
+
void HostilRefManager::deleteReference(Unit *pCreature)
{
HostilReference* ref = getFirst();
@@ -110,8 +127,10 @@ void HostilRefManager::deleteReference(Unit *pCreature)
ref = nextRef;
}
}
+
//=================================================
// set state for one reference, defined by Unit
+
void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
{
HostilReference* ref = getFirst();
@@ -126,5 +145,6 @@ void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
ref = nextRef;
}
}
+
//=================================================