Rename 'Hostil' to 'Hostile'
Credits to NoFantasy (Mangos) Closes issue #411 --HG-- branch : trunk
This commit is contained in:
@@ -767,7 +767,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//needed cause else in av some creatures will kill the players at the end
|
||||
plr->CombatStop();
|
||||
plr->getHostilRefManager().deleteReferences();
|
||||
plr->getHostileRefManager().deleteReferences();
|
||||
}
|
||||
|
||||
//this line is obsolete - team is set ALWAYS
|
||||
|
||||
@@ -125,8 +125,8 @@ SET(game_STAT_SRCS
|
||||
GuildHandler.cpp
|
||||
HomeMovementGenerator.cpp
|
||||
HomeMovementGenerator.h
|
||||
HostilRefManager.cpp
|
||||
HostilRefManager.h
|
||||
HostileRefManager.cpp
|
||||
HostileRefManager.h
|
||||
IdleMovementGenerator.cpp
|
||||
IdleMovementGenerator.h
|
||||
InstanceData.cpp
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{
|
||||
{ "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSet32Bit, "", NULL },
|
||||
{ "threat", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugThreatList, "", NULL },
|
||||
{ "hostil", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugHostilRefList, "", NULL },
|
||||
{ "hostil", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugHostileRefList, "", NULL },
|
||||
{ "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugAnimCommand, "", NULL },
|
||||
{ "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL },
|
||||
{ "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL },
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ class ChatHandler
|
||||
|
||||
bool HandleDebugSet32Bit(const char* args);
|
||||
bool HandleDebugThreatList(const char * args);
|
||||
bool HandleDebugHostilRefList(const char * args);
|
||||
bool HandleDebugHostileRefList(const char * args);
|
||||
bool HandlePossessCommand(const char* args);
|
||||
bool HandleUnPossessCommand(const char* args);
|
||||
bool HandleBindSightCommand(const char* args);
|
||||
|
||||
@@ -248,7 +248,7 @@ void TurretAI::UpdateAI(const uint32 diff)
|
||||
DoSpellAttackIfReady(me->m_spells[0]);
|
||||
|
||||
//if(!DoSpellAttackIfReady(me->m_spells[0]))
|
||||
//if(HostilReference *ref = me->getThreatManager().getCurrentVictim())
|
||||
//if(HostileReference *ref = me->getThreatManager().getCurrentVictim())
|
||||
//ref->removeReference();
|
||||
}
|
||||
|
||||
|
||||
@@ -525,8 +525,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
break;
|
||||
case ACTION_T_THREAT_ALL_PCT:
|
||||
{
|
||||
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
|
||||
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
|
||||
break;
|
||||
@@ -627,8 +627,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
break;
|
||||
case ACTION_T_CAST_EVENT_ALL:
|
||||
{
|
||||
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
|
||||
if (Temp->GetTypeId() == TYPEID_PLAYER)
|
||||
Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId);
|
||||
@@ -1105,9 +1105,9 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
||||
inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position)
|
||||
{
|
||||
//ThreatList m_threatlist;
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostilReference*>::reverse_iterator r = m_threatlist.rbegin();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostileReference*>::reverse_iterator r = m_threatlist.rbegin();
|
||||
|
||||
if (position >= m_threatlist.size() || !m_threatlist.size())
|
||||
return NULL;
|
||||
|
||||
@@ -665,8 +665,8 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
|
||||
if(!target || target->isTotem() || target->isPet())
|
||||
return false;
|
||||
|
||||
std::list<HostilReference*>& tlist = target->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator itr;
|
||||
std::list<HostileReference*>& tlist = target->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator itr;
|
||||
uint32 cnt = 0;
|
||||
PSendSysMessage("Threat list of %s (guid %u)",target->GetName(), target->GetGUIDLow());
|
||||
for (itr = tlist.begin(); itr != tlist.end(); ++itr)
|
||||
@@ -681,12 +681,12 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/)
|
||||
bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/)
|
||||
{
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
target = m_session->GetPlayer();
|
||||
HostilReference* ref = target->getHostilRefManager().getFirst();
|
||||
HostileReference* ref = target->getHostileRefManager().getFirst();
|
||||
uint32 cnt = 0;
|
||||
PSendSysMessage("Hostil reference list of %s (guid %u)",target->GetName(), target->GetGUIDLow());
|
||||
while(ref)
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "HostilRefManager.h"
|
||||
#include "HostileRefManager.h"
|
||||
#include "ThreatManager.h"
|
||||
#include "Unit.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
HostilRefManager::~HostilRefManager()
|
||||
HostileRefManager::~HostileRefManager()
|
||||
{
|
||||
deleteReferences();
|
||||
}
|
||||
@@ -34,9 +34,9 @@ HostilRefManager::~HostilRefManager()
|
||||
// The pVictim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
|
||||
void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
|
||||
void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
|
||||
{
|
||||
HostilReference* ref;
|
||||
HostileReference* ref;
|
||||
|
||||
float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat
|
||||
ref = getFirst();
|
||||
@@ -53,9 +53,9 @@ void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry con
|
||||
|
||||
//=================================================
|
||||
|
||||
void HostilRefManager::addTempThreat(float fThreat, bool apply)
|
||||
void HostileRefManager::addTempThreat(float fThreat, bool apply)
|
||||
{
|
||||
HostilReference* ref = getFirst();
|
||||
HostileReference* ref = getFirst();
|
||||
|
||||
while(ref != NULL)
|
||||
{
|
||||
@@ -74,9 +74,9 @@ void HostilRefManager::addTempThreat(float fThreat, bool apply)
|
||||
|
||||
//=================================================
|
||||
|
||||
void HostilRefManager::addThreatPercent(int32 iPercent)
|
||||
void HostileRefManager::addThreatPercent(int32 iPercent)
|
||||
{
|
||||
HostilReference* ref;
|
||||
HostileReference* ref;
|
||||
|
||||
ref = getFirst();
|
||||
while (ref != NULL)
|
||||
@@ -89,9 +89,9 @@ void HostilRefManager::addThreatPercent(int32 iPercent)
|
||||
//=================================================
|
||||
// The online / offline status is given to the method. The calculation has to be done before
|
||||
|
||||
void HostilRefManager::setOnlineOfflineState(bool bIsOnline)
|
||||
void HostileRefManager::setOnlineOfflineState(bool bIsOnline)
|
||||
{
|
||||
HostilReference* ref;
|
||||
HostileReference* ref;
|
||||
|
||||
ref = getFirst();
|
||||
while(ref != NULL)
|
||||
@@ -104,9 +104,9 @@ void HostilRefManager::setOnlineOfflineState(bool bIsOnline)
|
||||
//=================================================
|
||||
// The online / offline status is calculated and set
|
||||
|
||||
void HostilRefManager::updateThreatTables()
|
||||
void HostileRefManager::updateThreatTables()
|
||||
{
|
||||
HostilReference* ref = getFirst();
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
{
|
||||
ref->updateOnlineStatus();
|
||||
@@ -118,12 +118,12 @@ void HostilRefManager::updateThreatTables()
|
||||
// The references are not needed anymore
|
||||
// tell the source to remove them from the list and free the mem
|
||||
|
||||
void HostilRefManager::deleteReferences()
|
||||
void HostileRefManager::deleteReferences()
|
||||
{
|
||||
HostilReference* ref = getFirst();
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
{
|
||||
HostilReference* nextRef = ref->next();
|
||||
HostileReference* nextRef = ref->next();
|
||||
ref->removeReference();
|
||||
delete ref;
|
||||
ref = nextRef;
|
||||
@@ -133,12 +133,12 @@ void HostilRefManager::deleteReferences()
|
||||
//=================================================
|
||||
// delete one reference, defined by faction
|
||||
|
||||
void HostilRefManager::deleteReferencesForFaction(uint32 faction)
|
||||
void HostileRefManager::deleteReferencesForFaction(uint32 faction)
|
||||
{
|
||||
HostilReference* ref = getFirst();
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
{
|
||||
HostilReference* nextRef = ref->next();
|
||||
HostileReference* nextRef = ref->next();
|
||||
if(ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
|
||||
{
|
||||
ref->removeReference();
|
||||
@@ -151,12 +151,12 @@ void HostilRefManager::deleteReferencesForFaction(uint32 faction)
|
||||
//=================================================
|
||||
// delete one reference, defined by Unit
|
||||
|
||||
void HostilRefManager::deleteReference(Unit *pCreature)
|
||||
void HostileRefManager::deleteReference(Unit *pCreature)
|
||||
{
|
||||
HostilReference* ref = getFirst();
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
{
|
||||
HostilReference* nextRef = ref->next();
|
||||
HostileReference* nextRef = ref->next();
|
||||
if(ref->getSource()->getOwner() == pCreature)
|
||||
{
|
||||
ref->removeReference();
|
||||
@@ -170,12 +170,12 @@ void HostilRefManager::deleteReference(Unit *pCreature)
|
||||
//=================================================
|
||||
// set state for one reference, defined by Unit
|
||||
|
||||
void HostilRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
|
||||
void HostileRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline)
|
||||
{
|
||||
HostilReference* ref = getFirst();
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
{
|
||||
HostilReference* nextRef = ref->next();
|
||||
HostileReference* nextRef = ref->next();
|
||||
if(ref->getSource()->getOwner() == pCreature)
|
||||
{
|
||||
ref->setOnlineOfflineState(bIsOnline);
|
||||
@@ -26,18 +26,18 @@
|
||||
|
||||
class Unit;
|
||||
class ThreatManager;
|
||||
class HostilReference;
|
||||
class HostileReference;
|
||||
struct SpellEntry;
|
||||
|
||||
//=================================================
|
||||
|
||||
class HostilRefManager : public RefManager<Unit, ThreatManager>
|
||||
class HostileRefManager : public RefManager<Unit, ThreatManager>
|
||||
{
|
||||
private:
|
||||
Unit *iOwner;
|
||||
public:
|
||||
explicit HostilRefManager(Unit *pOwner) { iOwner = pOwner; }
|
||||
~HostilRefManager();
|
||||
explicit HostileRefManager(Unit *pOwner) { iOwner = pOwner; }
|
||||
~HostileRefManager();
|
||||
|
||||
Unit* getOwner() { return iOwner; }
|
||||
|
||||
@@ -57,7 +57,7 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
|
||||
// Remove specific faction references
|
||||
void deleteReferencesForFaction(uint32 faction);
|
||||
|
||||
HostilReference* getFirst() { return ((HostilReference* ) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
HostileReference* getFirst() { return ((HostileReference* ) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
|
||||
void updateThreatTables();
|
||||
|
||||
+1
-1
@@ -3596,7 +3596,7 @@ bool ChatHandler::HandleCombatStopCommand(const char* args)
|
||||
return false;
|
||||
|
||||
target->CombatStop();
|
||||
target->getHostilRefManager().deleteReferences();
|
||||
target->getHostileRefManager().deleteReferences();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -924,7 +924,7 @@ bool OutdoorPvPWG::UpdateQuestGiverPosition(uint32 guid, Creature *creature)
|
||||
if (creature->isAlive() && creature->isInCombat())
|
||||
{
|
||||
creature->CombatStop(true);
|
||||
creature->getHostilRefManager().deleteReferences();
|
||||
creature->getHostileRefManager().deleteReferences();
|
||||
}
|
||||
creature->SetHomePosition(pos);
|
||||
creature->DestroyForNearbyPlayers();
|
||||
@@ -1456,7 +1456,7 @@ void OutdoorPvPWG::EndBattle()
|
||||
}
|
||||
(*itr)->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||
(*itr)->CombatStop(true);
|
||||
(*itr)->getHostilRefManager().deleteReferences();
|
||||
(*itr)->getHostileRefManager().deleteReferences();
|
||||
}
|
||||
|
||||
if (m_timer == 1) // Battle End was forced so no reward.
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ void PetAI::_stopAttack()
|
||||
m_creature->GetMotionMaster()->Clear();
|
||||
m_creature->GetMotionMaster()->MoveIdle();
|
||||
m_creature->CombatStop();
|
||||
m_creature->getHostilRefManager().deleteReferences();
|
||||
m_creature->getHostileRefManager().deleteReferences();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
+6
-6
@@ -2323,7 +2323,7 @@ void Player::SetInWater(bool apply)
|
||||
// remove auras that need water/land
|
||||
RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
|
||||
|
||||
getHostilRefManager().updateThreatTables();
|
||||
getHostileRefManager().updateThreatTables();
|
||||
}
|
||||
|
||||
void Player::SetGameMaster(bool on)
|
||||
@@ -2337,13 +2337,13 @@ void Player::SetGameMaster(bool on)
|
||||
if (Pet* pet = GetPet())
|
||||
{
|
||||
pet->setFaction(35);
|
||||
pet->getHostilRefManager().setOnlineOfflineState(false);
|
||||
pet->getHostileRefManager().setOnlineOfflineState(false);
|
||||
}
|
||||
|
||||
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||
ResetContestedPvP();
|
||||
|
||||
getHostilRefManager().setOnlineOfflineState(false);
|
||||
getHostileRefManager().setOnlineOfflineState(false);
|
||||
CombatStopWithPets();
|
||||
|
||||
SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases
|
||||
@@ -2361,7 +2361,7 @@ void Player::SetGameMaster(bool on)
|
||||
if (Pet* pet = GetPet())
|
||||
{
|
||||
pet->setFaction(getFaction());
|
||||
pet->getHostilRefManager().setOnlineOfflineState(true);
|
||||
pet->getHostileRefManager().setOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
// restore FFA PvP Server state
|
||||
@@ -2371,7 +2371,7 @@ void Player::SetGameMaster(bool on)
|
||||
// restore FFA PvP area state, remove not allowed for GM mounts
|
||||
UpdateArea(m_areaUpdateId);
|
||||
|
||||
getHostilRefManager().setOnlineOfflineState(true);
|
||||
getHostileRefManager().setOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
UpdateObjectVisibility();
|
||||
@@ -18909,7 +18909,7 @@ void Player::CleanupAfterTaxiFlight()
|
||||
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
|
||||
Unmount();
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
getHostilRefManager().setOnlineOfflineState(true);
|
||||
getHostileRefManager().setOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
void Player::ContinueTaxiFlight()
|
||||
|
||||
@@ -168,9 +168,9 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ,
|
||||
Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition)
|
||||
{
|
||||
//ThreatList m_threatlist;
|
||||
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator itr = threatlist.begin();
|
||||
std::list<HostilReference*>::reverse_iterator ritr = threatlist.rbegin();
|
||||
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator itr = threatlist.begin();
|
||||
std::list<HostileReference*>::reverse_iterator ritr = threatlist.rbegin();
|
||||
|
||||
if (uiPosition >= threatlist.size() || !threatlist.size())
|
||||
return NULL;
|
||||
@@ -401,9 +401,9 @@ void ScriptedAI::DoResetThreat()
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
|
||||
@@ -636,8 +636,8 @@ void BossAI::TeleportCheaters()
|
||||
{
|
||||
float x, y, z;
|
||||
me->GetPosition(x, y, z);
|
||||
std::list<HostilReference*> &m_threatlist = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr)
|
||||
std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr)
|
||||
if((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget()))
|
||||
(*itr)->getTarget()->NearTeleportTo(x, y, z, 0);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1160,7 +1160,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
|
||||
|
||||
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit);
|
||||
unitTarget->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
|
||||
unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
|
||||
}
|
||||
// Do damage and triggers
|
||||
else if (m_damage > 0)
|
||||
@@ -1325,7 +1325,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
if( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) )
|
||||
{
|
||||
m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit);
|
||||
unit->getHostilRefManager().threatAssist(m_caster, 0.0f);
|
||||
unit->getHostileRefManager().threatAssist(m_caster, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1395,7 +1395,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetBase()->GetStackAmount()));
|
||||
|
||||
int32 gain = caster->DealHeal(caster, heal, GetSpellProto());
|
||||
caster->getHostilRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto());
|
||||
caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto());
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: // only three spells
|
||||
@@ -1470,7 +1470,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
if( BattleGround *bg = caster->ToPlayer()->GetBattleGround() )
|
||||
bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain);
|
||||
|
||||
target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
|
||||
bool haveCastItem = GetBase()->GetCastItemGUID() != 0;
|
||||
|
||||
@@ -1631,7 +1631,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
int32 gain = target->ModifyPower(power,amount);
|
||||
|
||||
if(caster)
|
||||
target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_PERIODIC_ENERGIZE:
|
||||
@@ -1659,7 +1659,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
int32 gain = target->ModifyPower(power,amount);
|
||||
|
||||
if(caster)
|
||||
target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_POWER_BURN_MANA:
|
||||
@@ -3189,7 +3189,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo
|
||||
if(GetCasterGUID()==target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
|
||||
target->FinishSpell(CURRENT_GENERIC_SPELL, false);
|
||||
target->InterruptNonMeleeSpells(true);
|
||||
target->getHostilRefManager().deleteReferences();
|
||||
target->getHostileRefManager().deleteReferences();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3727,7 +3727,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8
|
||||
if (!caster || !caster->isAlive())
|
||||
return;
|
||||
|
||||
target->getHostilRefManager().addTempThreat(GetAmount(), apply);
|
||||
target->getHostileRefManager().addTempThreat(GetAmount(), apply);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
|
||||
@@ -2909,7 +2909,7 @@ void Spell::EffectHealPct( uint32 /*i*/ )
|
||||
// modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
|
||||
|
||||
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo);
|
||||
unitTarget->getHostilRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
|
||||
unitTarget->getHostileRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4441,7 +4441,7 @@ void Spell::EffectTaunt(uint32 /*i*/)
|
||||
|
||||
//Set aggro victim to caster
|
||||
if (!unitTarget->getThreatManager().getOnlineContainer().empty())
|
||||
if (HostilReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster))
|
||||
if (HostileReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster))
|
||||
unitTarget->getThreatManager().setCurrentVictim(forcedVictim);
|
||||
|
||||
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
|
||||
@@ -6146,7 +6146,7 @@ void Spell::EffectSanctuary(uint32 /*i*/)
|
||||
}
|
||||
|
||||
unitTarget->CombatStop();
|
||||
unitTarget->getHostilRefManager().deleteReferences(); // stop all fighting
|
||||
unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting
|
||||
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER
|
||||
&& m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE
|
||||
|
||||
+39
-39
@@ -42,10 +42,10 @@ float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fT
|
||||
}
|
||||
|
||||
//============================================================
|
||||
//================= HostilReference ==========================
|
||||
//================= HostileReference ==========================
|
||||
//============================================================
|
||||
|
||||
HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat)
|
||||
HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat)
|
||||
{
|
||||
iThreat = fThreat;
|
||||
iTempThreatModifier = 0.0f;
|
||||
@@ -57,14 +57,14 @@ HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, flo
|
||||
|
||||
//============================================================
|
||||
// Tell our refTo (target) object that we have a link
|
||||
void HostilReference::targetObjectBuildLink()
|
||||
void HostileReference::targetObjectBuildLink()
|
||||
{
|
||||
getTarget()->addHatedBy(this);
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// Tell our refTo (taget) object, that the link is cut
|
||||
void HostilReference::targetObjectDestroyLink()
|
||||
void HostileReference::targetObjectDestroyLink()
|
||||
{
|
||||
getTarget()->removeHatedBy(this);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ void HostilReference::targetObjectDestroyLink()
|
||||
//============================================================
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
|
||||
void HostilReference::sourceObjectDestroyLink()
|
||||
void HostileReference::sourceObjectDestroyLink()
|
||||
{
|
||||
setOnlineOfflineState(false);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void HostilReference::sourceObjectDestroyLink()
|
||||
//============================================================
|
||||
// Inform the source, that the status of the reference changed
|
||||
|
||||
void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
|
||||
void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
|
||||
{
|
||||
if (getSource())
|
||||
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
|
||||
@@ -88,7 +88,7 @@ void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefSt
|
||||
|
||||
//============================================================
|
||||
|
||||
void HostilReference::addThreat(float fModThreat)
|
||||
void HostileReference::addThreat(float fModThreat)
|
||||
{
|
||||
iThreat += fModThreat;
|
||||
// the threat is changed. Source and target unit have to be available
|
||||
@@ -112,7 +112,7 @@ void HostilReference::addThreat(float fModThreat)
|
||||
//============================================================
|
||||
// check, if source can reach target and set the status
|
||||
|
||||
void HostilReference::updateOnlineStatus()
|
||||
void HostileReference::updateOnlineStatus()
|
||||
{
|
||||
bool online = false;
|
||||
bool accessible = false;
|
||||
@@ -147,7 +147,7 @@ void HostilReference::updateOnlineStatus()
|
||||
//============================================================
|
||||
// set the status and fire the event on status change
|
||||
|
||||
void HostilReference::setOnlineOfflineState(bool pIsOnline)
|
||||
void HostileReference::setOnlineOfflineState(bool pIsOnline)
|
||||
{
|
||||
if (iOnline != pIsOnline)
|
||||
{
|
||||
@@ -162,7 +162,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline)
|
||||
|
||||
//============================================================
|
||||
|
||||
void HostilReference::setAccessibleState(bool pIsAccessible)
|
||||
void HostileReference::setAccessibleState(bool pIsAccessible)
|
||||
{
|
||||
if (iAccessible != pIsAccessible)
|
||||
{
|
||||
@@ -177,7 +177,7 @@ void HostilReference::setAccessibleState(bool pIsAccessible)
|
||||
// prepare the reference for deleting
|
||||
// this is called be the target
|
||||
|
||||
void HostilReference::removeReference()
|
||||
void HostileReference::removeReference()
|
||||
{
|
||||
invalidate();
|
||||
|
||||
@@ -187,7 +187,7 @@ void HostilReference::removeReference()
|
||||
|
||||
//============================================================
|
||||
|
||||
Unit* HostilReference::getSourceUnit()
|
||||
Unit* HostileReference::getSourceUnit()
|
||||
{
|
||||
return (getSource()->getOwner());
|
||||
}
|
||||
@@ -198,7 +198,7 @@ Unit* HostilReference::getSourceUnit()
|
||||
|
||||
void ThreatContainer::clearReferences()
|
||||
{
|
||||
for (std::list<HostilReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
|
||||
for (std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
|
||||
{
|
||||
(*i)->unlink();
|
||||
delete (*i);
|
||||
@@ -207,13 +207,13 @@ void ThreatContainer::clearReferences()
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// Return the HostilReference of NULL, if not found
|
||||
HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
|
||||
// Return the HostileReference of NULL, if not found
|
||||
HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
|
||||
{
|
||||
HostilReference* result = NULL;
|
||||
HostileReference* result = NULL;
|
||||
|
||||
uint64 guid = pVictim->GetGUID();
|
||||
for (std::list<HostilReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
|
||||
for (std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
|
||||
{
|
||||
if((*i)->getUnitGuid() == guid)
|
||||
{
|
||||
@@ -228,9 +228,9 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
|
||||
//============================================================
|
||||
// Add the threat, if we find the reference
|
||||
|
||||
HostilReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat)
|
||||
HostileReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat)
|
||||
{
|
||||
HostilReference* ref = getReferenceByTarget(pVictim);
|
||||
HostileReference* ref = getReferenceByTarget(pVictim);
|
||||
if (ref)
|
||||
ref->addThreat(fThreat);
|
||||
return ref;
|
||||
@@ -240,13 +240,13 @@ HostilReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat)
|
||||
|
||||
void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent)
|
||||
{
|
||||
if(HostilReference* ref = getReferenceByTarget(pVictim))
|
||||
if(HostileReference* ref = getReferenceByTarget(pVictim))
|
||||
ref->addThreatPercent(iPercent);
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
||||
bool HostilReferenceSortPredicate(const HostilReference* lhs, const HostilReference* rhs)
|
||||
bool HostileReferenceSortPredicate(const HostileReference* lhs, const HostileReference* rhs)
|
||||
{
|
||||
// std::list::sort ordering predicate must be: (Pred(x,y)&&Pred(y,x))==false
|
||||
return lhs->getThreat() > rhs->getThreat(); // reverse sorting
|
||||
@@ -259,7 +259,7 @@ void ThreatContainer::update()
|
||||
{
|
||||
if(iDirty && iThreatList.size() >1)
|
||||
{
|
||||
iThreatList.sort(HostilReferenceSortPredicate);
|
||||
iThreatList.sort(HostileReferenceSortPredicate);
|
||||
}
|
||||
iDirty = false;
|
||||
}
|
||||
@@ -268,16 +268,16 @@ void ThreatContainer::update()
|
||||
// return the next best victim
|
||||
// could be the current victim
|
||||
|
||||
HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim)
|
||||
HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim)
|
||||
{
|
||||
HostilReference* currentRef = NULL;
|
||||
HostileReference* currentRef = NULL;
|
||||
bool found = false;
|
||||
bool noPriorityTargetFound = false;
|
||||
|
||||
std::list<HostilReference*>::const_iterator lastRef = iThreatList.end();
|
||||
std::list<HostileReference*>::const_iterator lastRef = iThreatList.end();
|
||||
lastRef--;
|
||||
|
||||
for (std::list<HostilReference*>::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
|
||||
for (std::list<HostileReference*>::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
|
||||
{
|
||||
currentRef = (*iter);
|
||||
|
||||
@@ -395,7 +395,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho
|
||||
|
||||
void ThreatManager::_addThreat(Unit *pVictim, float fThreat)
|
||||
{
|
||||
HostilReference* ref = iThreatContainer.addThreat(pVictim, fThreat);
|
||||
HostileReference* ref = iThreatContainer.addThreat(pVictim, fThreat);
|
||||
// Ref is not in the online refs, search the offline refs next
|
||||
if (!ref)
|
||||
ref = iThreatOfflineContainer.addThreat(pVictim, fThreat);
|
||||
@@ -403,7 +403,7 @@ void ThreatManager::_addThreat(Unit *pVictim, float fThreat)
|
||||
if (!ref) // there was no ref => create a new one
|
||||
{
|
||||
// threat has to be 0 here
|
||||
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
|
||||
HostileReference* hostilReference = new HostileReference(pVictim, this, 0);
|
||||
iThreatContainer.addReference(hostilReference);
|
||||
hostilReference->addThreat(fThreat); // now we add the real threat
|
||||
if(pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster())
|
||||
@@ -423,7 +423,7 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent)
|
||||
Unit* ThreatManager::getHostilTarget()
|
||||
{
|
||||
iThreatContainer.update();
|
||||
HostilReference* nextVictim = iThreatContainer.selectNextVictim( getOwner()->ToCreature(), getCurrentVictim());
|
||||
HostileReference* nextVictim = iThreatContainer.selectNextVictim( getOwner()->ToCreature(), getCurrentVictim());
|
||||
setCurrentVictim(nextVictim);
|
||||
return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL;
|
||||
}
|
||||
@@ -433,7 +433,7 @@ Unit* ThreatManager::getHostilTarget()
|
||||
float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
|
||||
{
|
||||
float threat = 0.0f;
|
||||
HostilReference* ref = iThreatContainer.getReferenceByTarget(pVictim);
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim);
|
||||
if(!ref && pAlsoSearchOfflineList)
|
||||
ref = iThreatOfflineContainer.getReferenceByTarget(pVictim);
|
||||
if(ref)
|
||||
@@ -445,7 +445,7 @@ float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
|
||||
|
||||
void ThreatManager::tauntApply(Unit* pTaunter)
|
||||
{
|
||||
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
|
||||
if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
|
||||
{
|
||||
if(ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
|
||||
@@ -457,20 +457,20 @@ void ThreatManager::tauntApply(Unit* pTaunter)
|
||||
|
||||
void ThreatManager::tauntFadeOut(Unit *pTaunter)
|
||||
{
|
||||
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
|
||||
if(ref)
|
||||
ref->resetTempThreat();
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::setCurrentVictim(HostilReference* pHostilReference)
|
||||
void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
|
||||
{
|
||||
if (pHostilReference && pHostilReference != iCurrentVictim)
|
||||
if (pHostileReference && pHostileReference != iCurrentVictim)
|
||||
{
|
||||
iOwner->SendChangeCurrentVictimOpcode(pHostilReference);
|
||||
iOwner->SendChangeCurrentVictimOpcode(pHostileReference);
|
||||
}
|
||||
iCurrentVictim = pHostilReference;
|
||||
iCurrentVictim = pHostileReference;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
@@ -481,7 +481,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
||||
{
|
||||
threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager
|
||||
|
||||
HostilReference* hostilReference = threatRefStatusChangeEvent->getReference();
|
||||
HostileReference* hostilReference = threatRefStatusChangeEvent->getReference();
|
||||
|
||||
switch(threatRefStatusChangeEvent->getType())
|
||||
{
|
||||
@@ -540,11 +540,11 @@ bool ThreatManager::isNeedUpdateToClient(uint32 time)
|
||||
// Reset all aggro without modifying the threadlist.
|
||||
void ThreatManager::resetAllAggro()
|
||||
{
|
||||
std::list<HostilReference*> &threatlist = getThreatList();
|
||||
std::list<HostileReference*> &threatlist = getThreatList();
|
||||
if (threatlist.empty())
|
||||
return;
|
||||
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
(*itr)->setThreat(0);
|
||||
}
|
||||
|
||||
+21
-21
@@ -47,10 +47,10 @@ class ThreatCalcHelper
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
class HostilReference : public Reference<Unit, ThreatManager>
|
||||
class HostileReference : public Reference<Unit, ThreatManager>
|
||||
{
|
||||
public:
|
||||
HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat);
|
||||
HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat);
|
||||
|
||||
//=================================================
|
||||
void addThreat(float fModThreat);
|
||||
@@ -106,7 +106,7 @@ class HostilReference : public Reference<Unit, ThreatManager>
|
||||
void setAccessibleState(bool pIsAccessible);
|
||||
//=================================================
|
||||
|
||||
bool operator ==(const HostilReference& pHostilReference) const { return pHostilReference.getUnitGuid() == getUnitGuid(); }
|
||||
bool operator ==(const HostileReference& pHostileReference) const { return pHostileReference.getUnitGuid() == getUnitGuid(); }
|
||||
|
||||
//=================================================
|
||||
|
||||
@@ -119,7 +119,7 @@ class HostilReference : public Reference<Unit, ThreatManager>
|
||||
|
||||
//=================================================
|
||||
|
||||
HostilReference* next() { return ((HostilReference* ) Reference<Unit, ThreatManager>::next()); }
|
||||
HostileReference* next() { return ((HostileReference* ) Reference<Unit, ThreatManager>::next()); }
|
||||
|
||||
//=================================================
|
||||
|
||||
@@ -150,13 +150,13 @@ class ThreatManager;
|
||||
class ThreatContainer
|
||||
{
|
||||
private:
|
||||
std::list<HostilReference*> iThreatList;
|
||||
std::list<HostileReference*> iThreatList;
|
||||
bool iDirty;
|
||||
protected:
|
||||
friend class ThreatManager;
|
||||
|
||||
void remove(HostilReference* pRef) { iThreatList.remove(pRef); }
|
||||
void addReference(HostilReference* pHostilReference) { iThreatList.push_back(pHostilReference); }
|
||||
void remove(HostileReference* pRef) { iThreatList.remove(pRef); }
|
||||
void addReference(HostileReference* pHostileReference) { iThreatList.push_back(pHostileReference); }
|
||||
void clearReferences();
|
||||
// Sort the list if necessary
|
||||
void update();
|
||||
@@ -164,11 +164,11 @@ class ThreatContainer
|
||||
ThreatContainer() { iDirty = false; }
|
||||
~ThreatContainer() { clearReferences(); }
|
||||
|
||||
HostilReference* addThreat(Unit* pVictim, float fThreat);
|
||||
HostileReference* addThreat(Unit* pVictim, float fThreat);
|
||||
|
||||
void modifyThreatPercent(Unit *pVictim, int32 iPercent);
|
||||
|
||||
HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim);
|
||||
HostileReference* selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim);
|
||||
|
||||
void setDirty(bool pDirty) { iDirty = pDirty; }
|
||||
|
||||
@@ -176,11 +176,11 @@ class ThreatContainer
|
||||
|
||||
bool empty() { return(iThreatList.empty()); }
|
||||
|
||||
HostilReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }
|
||||
HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }
|
||||
|
||||
HostilReference* getReferenceByTarget(Unit* pVictim);
|
||||
HostileReference* getReferenceByTarget(Unit* pVictim);
|
||||
|
||||
std::list<HostilReference*>& getThreatList() { return iThreatList; }
|
||||
std::list<HostileReference*>& getThreatList() { return iThreatList; }
|
||||
};
|
||||
|
||||
//=================================================
|
||||
@@ -188,7 +188,7 @@ class ThreatContainer
|
||||
class ThreatManager
|
||||
{
|
||||
public:
|
||||
friend class HostilReference;
|
||||
friend class HostileReference;
|
||||
|
||||
explicit ThreatManager(Unit *pOwner);
|
||||
|
||||
@@ -207,7 +207,7 @@ class ThreatManager
|
||||
|
||||
bool isNeedUpdateToClient(uint32 time);
|
||||
|
||||
HostilReference* getCurrentVictim() { return iCurrentVictim; }
|
||||
HostileReference* getCurrentVictim() { return iCurrentVictim; }
|
||||
|
||||
Unit* getOwner() { return iOwner; }
|
||||
|
||||
@@ -216,7 +216,7 @@ class ThreatManager
|
||||
void tauntApply(Unit* pTaunter);
|
||||
void tauntFadeOut(Unit *pTaunter);
|
||||
|
||||
void setCurrentVictim(HostilReference* pHostilReference);
|
||||
void setCurrentVictim(HostileReference* pHostileReference);
|
||||
|
||||
void setDirty(bool bDirty) { iThreatContainer.setDirty(bDirty); }
|
||||
|
||||
@@ -226,13 +226,13 @@ class ThreatManager
|
||||
// Reset all aggro of unit in threadlist satisfying the predicate.
|
||||
template<class PREDICATE> void resetAggro(PREDICATE predicate)
|
||||
{
|
||||
std::list<HostilReference*> &threatlist = getThreatList();
|
||||
std::list<HostileReference*> &threatlist = getThreatList();
|
||||
if (threatlist.empty())
|
||||
return;
|
||||
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
HostilReference* ref = (*itr);
|
||||
HostileReference* ref = (*itr);
|
||||
|
||||
if (predicate(ref->getTarget()))
|
||||
{
|
||||
@@ -244,14 +244,14 @@ class ThreatManager
|
||||
|
||||
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
|
||||
// I hope they are used as little as possible.
|
||||
std::list<HostilReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
|
||||
std::list<HostilReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
|
||||
std::list<HostileReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
|
||||
std::list<HostileReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
|
||||
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
|
||||
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
|
||||
private:
|
||||
void _addThreat(Unit *pVictim, float fThreat);
|
||||
|
||||
HostilReference* iCurrentVictim;
|
||||
HostileReference* iCurrentVictim;
|
||||
Unit* iOwner;
|
||||
uint32 iUpdateTimer;
|
||||
ThreatContainer iThreatContainer;
|
||||
|
||||
+14
-14
@@ -91,7 +91,7 @@ static bool isNonTriggerAura[TOTAL_AURAS];
|
||||
static bool procPrepared = InitTriggerAuraData();
|
||||
|
||||
Unit::Unit()
|
||||
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
|
||||
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostileRefManager(this)
|
||||
, IsAIEnabled(false), NeedChangeAI(false)
|
||||
, i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_vehicle(NULL), m_transport(NULL)
|
||||
, m_ControlledByPlayer(false), m_procDeep(0), m_unitTypeMask(UNIT_MASK_NONE), m_vehicleKit(NULL)
|
||||
@@ -246,7 +246,7 @@ void Unit::Update(uint32 p_time)
|
||||
// Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away
|
||||
// targets without stopping half way there and running off.
|
||||
// These flags are reset after target dies or another command is given.
|
||||
if (m_HostilRefManager.isEmpty())
|
||||
if (m_HostileRefManager.isEmpty())
|
||||
{
|
||||
// m_CombatTimer set at aura start and it will be freeze until aura removing
|
||||
if (m_CombatTimer <= p_time)
|
||||
@@ -11984,7 +11984,7 @@ void Unit::setDeathState(DeathState s)
|
||||
{
|
||||
CombatStop();
|
||||
DeleteThreatList();
|
||||
getHostilRefManager().deleteReferences();
|
||||
getHostileRefManager().deleteReferences();
|
||||
ClearComboPointHolders(); // any combo points pointed to unit lost at it death
|
||||
|
||||
if (IsNonMeleeSpellCasted(false))
|
||||
@@ -13108,7 +13108,7 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
|
||||
CombatStop();
|
||||
ClearComboPointHolders();
|
||||
DeleteThreatList();
|
||||
getHostilRefManager().setOnlineOfflineState(false);
|
||||
getHostileRefManager().setOnlineOfflineState(false);
|
||||
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
|
||||
}
|
||||
|
||||
@@ -15075,7 +15075,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
||||
|
||||
CastStop();
|
||||
CombatStop(); //TODO: CombatStop(true) may cause crash (interrupt spells)
|
||||
getHostilRefManager().deleteReferences();
|
||||
getHostileRefManager().deleteReferences();
|
||||
DeleteThreatList();
|
||||
RestoreFaction();
|
||||
GetMotionMaster()->InitDefault();
|
||||
@@ -16103,8 +16103,8 @@ void Unit::SendThreatListUpdate()
|
||||
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
|
||||
data.append(GetPackGUID());
|
||||
data << uint32(count);
|
||||
std::list<HostilReference*>& tlist = getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
|
||||
std::list<HostileReference*>& tlist = getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
|
||||
{
|
||||
data.appendPackGUID((*itr)->getUnitGuid());
|
||||
data << uint32((*itr)->getThreat());
|
||||
@@ -16113,17 +16113,17 @@ void Unit::SendThreatListUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SendChangeCurrentVictimOpcode(HostilReference* pHostilReference)
|
||||
void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
|
||||
{
|
||||
if (uint32 count = getThreatManager().getThreatList().size())
|
||||
{
|
||||
sLog.outDebug( "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message" );
|
||||
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
|
||||
data.append(GetPackGUID());
|
||||
data.appendPackGUID(pHostilReference->getUnitGuid());
|
||||
data.appendPackGUID(pHostileReference->getUnitGuid());
|
||||
data << uint32(count);
|
||||
std::list<HostilReference*>& tlist = getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
|
||||
std::list<HostileReference*>& tlist = getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
|
||||
{
|
||||
data.appendPackGUID((*itr)->getUnitGuid());
|
||||
data << uint32((*itr)->getThreat());
|
||||
@@ -16140,12 +16140,12 @@ void Unit::SendClearThreatListOpcode()
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
void Unit::SendRemoveFromThreatListOpcode(HostilReference* pHostilReference)
|
||||
void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference)
|
||||
{
|
||||
sLog.outDebug( "WORLD: Send SMSG_THREAT_REMOVE Message" );
|
||||
WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
|
||||
data.append(GetPackGUID());
|
||||
data.appendPackGUID(pHostilReference->getUnitGuid());
|
||||
data.appendPackGUID(pHostileReference->getUnitGuid());
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
@@ -16208,7 +16208,7 @@ void Unit::StopAttackFaction(uint32 faction_id)
|
||||
++itr;
|
||||
}
|
||||
|
||||
getHostilRefManager().deleteReferencesForFaction(faction_id);
|
||||
getHostileRefManager().deleteReferencesForFaction(faction_id);
|
||||
|
||||
for(ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
|
||||
(*itr)->StopAttackFaction(faction_id);
|
||||
|
||||
+7
-7
@@ -28,7 +28,7 @@
|
||||
#include "UpdateFields.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ThreatManager.h"
|
||||
#include "HostilRefManager.h"
|
||||
#include "HostileRefManager.h"
|
||||
#include "FollowerReference.h"
|
||||
#include "FollowerRefManager.h"
|
||||
#include "Utilities/EventProcessor.h"
|
||||
@@ -1442,9 +1442,9 @@ class Unit : public WorldObject
|
||||
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
|
||||
void SendMovementFlagUpdate();
|
||||
|
||||
void SendChangeCurrentVictimOpcode(HostilReference* pHostilReference);
|
||||
void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference);
|
||||
void SendClearThreatListOpcode();
|
||||
void SendRemoveFromThreatListOpcode(HostilReference* pHostilReference);
|
||||
void SendRemoveFromThreatListOpcode(HostileReference* pHostileReference);
|
||||
void SendThreatListUpdate();
|
||||
|
||||
void BuildHeartBeatMsg(WorldPacket *data) const;
|
||||
@@ -1752,9 +1752,9 @@ class Unit : public WorldObject
|
||||
void TauntApply(Unit* pVictim);
|
||||
void TauntFadeOut(Unit *taunter);
|
||||
ThreatManager& getThreatManager() { return m_ThreatManager; }
|
||||
void addHatedBy(HostilReference* pHostilReference) { m_HostilRefManager.insertFirst(pHostilReference); };
|
||||
void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ }
|
||||
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
|
||||
void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
|
||||
void removeHatedBy(HostileReference* /*pHostileReference*/ ) { /* nothing to do yet */ }
|
||||
HostileRefManager& getHostileRefManager() { return m_HostileRefManager; }
|
||||
|
||||
VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; }
|
||||
AuraApplication * GetVisibleAura(uint8 slot)
|
||||
@@ -2064,7 +2064,7 @@ class Unit : public WorldObject
|
||||
// Manage all Units threatening us
|
||||
// ThreatManager m_ThreatManager;
|
||||
// Manage all Units that are threatened by us
|
||||
HostilRefManager m_HostilRefManager;
|
||||
HostileRefManager m_HostileRefManager;
|
||||
|
||||
FollowerRefManager m_FollowingRefManager;
|
||||
|
||||
|
||||
+6
-6
@@ -127,13 +127,13 @@ Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float
|
||||
|
||||
void UnitAI::SelectTargetList(std::list<Unit*> &targetList, uint32 num, SelectAggroTarget targetType, float dist, bool playerOnly, int32 aura)
|
||||
{
|
||||
const std::list<HostilReference*> &threatlist = me->getThreatManager().getThreatList();
|
||||
const std::list<HostileReference*> &threatlist = me->getThreatManager().getThreatList();
|
||||
|
||||
if (threatlist.empty())
|
||||
return;
|
||||
|
||||
DefaultTargetSelector targetSelector(me, dist,playerOnly, aura);
|
||||
for (std::list<HostilReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
if (targetSelector((*itr)->getTarget()))
|
||||
targetList.push_back((*itr)->getTarget());
|
||||
|
||||
@@ -167,8 +167,8 @@ void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
|
||||
{
|
||||
if (me->isInCombat())
|
||||
{
|
||||
std::list<HostilReference*>& threatlist = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid()))
|
||||
if (pTemp->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -182,8 +182,8 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
|
||||
{
|
||||
if (me->isInCombat())
|
||||
{
|
||||
std::list<HostilReference*>& threatlist = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid()))
|
||||
if (pTemp->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
+3
-3
@@ -72,15 +72,15 @@ class UnitAI
|
||||
// predicate shall extend std::unary_function<Unit *, bool>
|
||||
template<class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE predicate)
|
||||
{
|
||||
const std::list<HostilReference *> &threatlist = me->getThreatManager().getThreatList();
|
||||
const std::list<HostileReference *> &threatlist = me->getThreatManager().getThreatList();
|
||||
std::list<Unit*> targetList;
|
||||
|
||||
if (position >= threatlist.size())
|
||||
return NULL;
|
||||
|
||||
for (std::list<HostilReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
HostilReference* ref = (*itr);
|
||||
HostileReference* ref = (*itr);
|
||||
if (predicate(ref->getTarget()))
|
||||
targetList.push_back(ref->getTarget());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
class ThreatContainer;
|
||||
class ThreatManager;
|
||||
class HostilReference;
|
||||
class HostileReference;
|
||||
|
||||
//==============================================================
|
||||
//==============================================================
|
||||
@@ -87,7 +87,7 @@ class UnitBaseEvent
|
||||
class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
||||
{
|
||||
private:
|
||||
HostilReference* iHostilReference;
|
||||
HostileReference* iHostileReference;
|
||||
union
|
||||
{
|
||||
float iFValue;
|
||||
@@ -96,13 +96,13 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
||||
};
|
||||
ThreatManager* iThreatManager;
|
||||
public:
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostilReference = NULL; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference, float pValue) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; iFValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference, bool pValue) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; iBValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
|
||||
int32 getIValue() const { return iIValue; }
|
||||
|
||||
@@ -112,7 +112,7 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
||||
|
||||
void setBValue(bool pValue) { iBValue = pValue; }
|
||||
|
||||
HostilReference* getReference() const { return iHostilReference; }
|
||||
HostileReference* getReference() const { return iHostileReference; }
|
||||
|
||||
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
|
||||
|
||||
@@ -127,7 +127,7 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
|
||||
ThreatContainer* iThreatContainer;
|
||||
public:
|
||||
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {}
|
||||
ThreatManagerEvent(uint32 pType, HostilReference* pHostilReference) : ThreatRefStatusChangeEvent(pType, pHostilReference) {}
|
||||
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {}
|
||||
|
||||
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
|
||||
|
||||
void FlightPathMovementGenerator::Initialize(Player &player)
|
||||
{
|
||||
player.getHostilRefManager().setOnlineOfflineState(false);
|
||||
player.getHostileRefManager().setOnlineOfflineState(false);
|
||||
player.addUnitState(UNIT_STAT_IN_FLIGHT);
|
||||
player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
LoadPath(player);
|
||||
|
||||
@@ -311,14 +311,14 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||
//FIXME: logout must be delayed in case lost connection with client in time of combat
|
||||
if (_player->GetDeathTimer())
|
||||
{
|
||||
_player->getHostilRefManager().deleteReferences();
|
||||
_player->getHostileRefManager().deleteReferences();
|
||||
_player->BuildPlayerRepop();
|
||||
_player->RepopAtGraveyard();
|
||||
}
|
||||
else if (!_player->getAttackers().empty())
|
||||
{
|
||||
_player->CombatStop();
|
||||
_player->getHostilRefManager().setOnlineOfflineState(false);
|
||||
_player->getHostileRefManager().setOnlineOfflineState(false);
|
||||
_player->RemoveAllAurasOnDeath();
|
||||
|
||||
// build set of player who attack _player or who have pet attacking of _player
|
||||
|
||||
@@ -229,8 +229,8 @@ struct boss_chromaggusAI : public ScriptedAI
|
||||
//Affliction_Timer
|
||||
if (Affliction_Timer <= diff)
|
||||
{
|
||||
std::list<HostilReference*> threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator i = threatlist.begin(); i != threatlist.end(); ++i)
|
||||
std::list<HostileReference*> threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = threatlist.begin(); i != threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit;
|
||||
if ((*i) && (*i)->getSource())
|
||||
|
||||
@@ -244,9 +244,9 @@ struct boss_attumenAI : public ScriptedAI
|
||||
if (ChargeTimer <= diff)
|
||||
{
|
||||
Unit *pTarget;
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit *> target_list;
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (pTarget && !pTarget->IsWithinDist(m_creature, ATTACK_DISTANCE, false))
|
||||
|
||||
@@ -281,14 +281,14 @@ struct boss_malchezaarAI : public ScriptedAI
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit *> targets;
|
||||
|
||||
if (!t_list.size())
|
||||
return;
|
||||
|
||||
//begin + 1, so we don't target the one with the highest threat
|
||||
std::list<HostilReference *>::iterator itr = t_list.begin();
|
||||
std::list<HostileReference *>::iterator itr = t_list.begin();
|
||||
std::advance(itr, 1);
|
||||
for (; itr != t_list.end(); ++itr) //store the threat list in a different container
|
||||
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
|
||||
|
||||
@@ -175,13 +175,13 @@ struct boss_aranAI : public ScriptedAI
|
||||
void FlameWreathEffect()
|
||||
{
|
||||
std::vector<Unit*> targets;
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
|
||||
if (!t_list.size())
|
||||
return;
|
||||
|
||||
//store the threat list in a different container
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
//only on alive players
|
||||
|
||||
@@ -177,8 +177,8 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
|
||||
if (!SummonedUnit)
|
||||
return;
|
||||
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator i = m_threatlist.begin();
|
||||
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
@@ -196,7 +196,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
|
||||
float y = KaelLocations[0][1];
|
||||
m_creature->GetMap()->CreatureRelocation(m_creature, x, y, LOCATION_Z, 0.0f);
|
||||
//m_creature->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues...
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
@@ -208,7 +208,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
|
||||
|
||||
void CastGravityLapseKnockUp()
|
||||
{
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
@@ -220,7 +220,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
|
||||
|
||||
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
|
||||
{
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
@@ -240,7 +240,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
|
||||
|
||||
void RemoveGravityLapse()
|
||||
{
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -796,8 +796,8 @@ struct boss_yazzaiAI : public boss_priestess_lackey_commonAI
|
||||
if (Blink_Timer <= diff)
|
||||
{
|
||||
bool InMeleeRange = false;
|
||||
std::list<HostilReference*>& t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
|
||||
{
|
||||
@@ -876,8 +876,8 @@ struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI
|
||||
if (Intercept_Stun_Timer <= diff)
|
||||
{
|
||||
bool InMeleeRange = false;
|
||||
std::list<HostilReference*>& t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
|
||||
{
|
||||
|
||||
@@ -559,7 +559,7 @@ struct boss_headless_horsemanAI : public ScriptedAI
|
||||
caster->GetMotionMaster()->Clear(false);
|
||||
caster->GetMotionMaster()->MoveFollow(m_creature,6,urand(0,5));
|
||||
//DoResetThreat();//not sure if need
|
||||
std::list<HostilReference*>::iterator itr;
|
||||
std::list<HostileReference*>::iterator itr;
|
||||
for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
|
||||
@@ -300,9 +300,9 @@ struct boss_kalecgosAI : public ScriptedAI
|
||||
|
||||
if (SpectralBlastTimer <= diff)
|
||||
{
|
||||
std::list<HostilReference*> &m_threatlist = me->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
|
||||
std::list<Unit*> targetList;
|
||||
for (std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
|
||||
if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5)
|
||||
targetList.push_back((*itr)->getTarget());
|
||||
if(targetList.empty())
|
||||
@@ -614,7 +614,7 @@ struct boss_sathrovarrAI : public ScriptedAI
|
||||
|
||||
if (ResetThreat <= diff)
|
||||
{
|
||||
for (std::list<HostilReference*>::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
|
||||
{
|
||||
if(Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
|
||||
{
|
||||
|
||||
@@ -944,7 +944,7 @@ struct mob_hand_of_the_deceiverAI : public ScriptedAI
|
||||
Creature* Portal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000);
|
||||
if (Portal)
|
||||
{
|
||||
std::list<HostilReference*>::iterator itr;
|
||||
std::list<HostileReference*>::iterator itr;
|
||||
for (itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
|
||||
@@ -218,7 +218,7 @@ struct boss_mandokirAI : public ScriptedAI
|
||||
{
|
||||
TargetInRange = 0;
|
||||
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit(*m_creature, (*i)->getUnitGuid());
|
||||
|
||||
@@ -71,8 +71,8 @@ struct boss_azuregosAI : public ScriptedAI
|
||||
if (Teleport_Timer <= diff)
|
||||
{
|
||||
DoScriptText(SAY_TELEPORT, m_creature);
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator i = m_threatlist.begin();
|
||||
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -302,12 +302,12 @@ struct boss_archimondeAI : public hyjal_trashAI
|
||||
if (victim && m_creature->IsWithinDistInMap(victim, m_creature->GetAttackDistance(victim)))
|
||||
return false;
|
||||
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
if (m_threatlist.empty())
|
||||
return false;
|
||||
|
||||
std::list<Unit*> targets;
|
||||
std::list<HostilReference*>::iterator itr = m_threatlist.begin();
|
||||
std::list<HostileReference*>::iterator itr = m_threatlist.begin();
|
||||
for (; itr != m_threatlist.end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
|
||||
@@ -152,8 +152,8 @@ struct boss_kazrogalAI : public hyjal_trashAI
|
||||
//cast dummy, useful for bos addons
|
||||
m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID());
|
||||
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA)
|
||||
|
||||
@@ -654,7 +654,7 @@ struct cthunAI : public Scripted_NoMovementAI
|
||||
//Place all units in threat list on outside of stomach
|
||||
Stomach_Map.clear();
|
||||
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
//Outside stomach
|
||||
|
||||
@@ -240,7 +240,7 @@ struct aqsentinelAI : public ScriptedAI
|
||||
|
||||
Unit *GetHatedManaUser() const
|
||||
{
|
||||
std::list<HostilReference*>::iterator i;
|
||||
std::list<HostileReference*>::iterator i;
|
||||
for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -213,9 +213,9 @@ struct boss_taldaramAI : public ScriptedAI
|
||||
{
|
||||
//Count alive players
|
||||
Unit *pTarget = NULL;
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit *> target_list;
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
// exclude pets & totems
|
||||
|
||||
@@ -165,8 +165,8 @@ struct boss_tharon_jaAI : public ScriptedAI
|
||||
{
|
||||
DoScriptText(RAND(SAY_FLESH_1,SAY_FLESH_2),m_creature);
|
||||
m_creature->SetDisplayId(MODEL_FLESH);
|
||||
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
|
||||
if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -221,8 +221,8 @@ struct boss_tharon_jaAI : public ScriptedAI
|
||||
uiCurseOfLifeTimer = 1000;
|
||||
uiRainOfFireTimer = urand(14000,18000);
|
||||
uiShadowVolleyTimer = urand(8000,10000);
|
||||
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||
{
|
||||
Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
|
||||
if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
@@ -579,8 +579,8 @@ struct boss_kelthuzadAI : public BossAI
|
||||
case EVENT_DETONATE:
|
||||
{
|
||||
std::vector<Unit*> unitList;
|
||||
std::list<HostilReference*> *threatList = &me->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr)
|
||||
std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr)
|
||||
{
|
||||
if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER
|
||||
&& (*itr)->getTarget()->getPowerType() == POWER_MANA
|
||||
|
||||
@@ -111,7 +111,7 @@ struct boss_patchwerkAI : public BossAI
|
||||
//amount of HP within melee distance
|
||||
uint32 MostHP = 0;
|
||||
Unit* pMostHPTarget = NULL;
|
||||
std::list<HostilReference*>::iterator i = me->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin();
|
||||
for (; i != me->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit *pTarget = (*i)->getTarget();
|
||||
|
||||
@@ -291,7 +291,7 @@ struct boss_sapphironAI : public BossAI
|
||||
case EVENT_ICEBOLT:
|
||||
{
|
||||
std::vector<Unit*> targets;
|
||||
std::list<HostilReference*>::iterator i = me->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin();
|
||||
for (; i != me->getThreatManager().getThreatList().end(); ++i)
|
||||
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT))
|
||||
targets.push_back((*i)->getTarget());
|
||||
@@ -348,7 +348,7 @@ struct boss_sapphironAI : public BossAI
|
||||
{
|
||||
DoZoneInCombat(); // make sure everyone is in threatlist
|
||||
std::vector<Unit*> targets;
|
||||
std::list<HostilReference*>::iterator i = me->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = me->getThreatManager().getThreatList().begin();
|
||||
for (; i != me->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit *pTarget = (*i)->getTarget();
|
||||
|
||||
@@ -171,8 +171,8 @@ struct boss_keristraszaAI : public ScriptedAI
|
||||
|
||||
if (CheckIntenseColdTimer < diff && !MoreThanTwoIntenseCold)
|
||||
{
|
||||
std::list<HostilReference*> ThreatList = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++)
|
||||
std::list<HostileReference*> ThreatList = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++)
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
|
||||
@@ -184,7 +184,7 @@ struct boss_ormorokAI : public ScriptedAI
|
||||
case 3: Healer = CLASS_DRUID; break;
|
||||
case 4: Healer = CLASS_SHAMAN; break;
|
||||
}
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pTemp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid());
|
||||
|
||||
@@ -121,8 +121,8 @@ struct boss_blackheart_the_inciterAI : public ScriptedAI
|
||||
{
|
||||
DoCast(m_creature, SPELL_INCITE_CHAOS);
|
||||
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
@@ -67,8 +67,8 @@ struct boss_murmurAI : public ScriptedAI
|
||||
|
||||
void SonicBoomEffect()
|
||||
{
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -152,8 +152,8 @@ struct boss_murmurAI : public ScriptedAI
|
||||
// Thundering Storm
|
||||
if (ThunderingStorm_Timer <= diff)
|
||||
{
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
|
||||
if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()))
|
||||
if (pTarget->isAlive() && !m_creature->IsWithinDist(pTarget, 35, false))
|
||||
DoCast(pTarget, SPELL_THUNDERING_STORM, true);
|
||||
@@ -175,8 +175,8 @@ struct boss_murmurAI : public ScriptedAI
|
||||
return;
|
||||
if (!m_creature->IsWithinMeleeRange(m_creature->getVictim()))
|
||||
{
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
|
||||
if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()))
|
||||
if (pTarget->isAlive() && m_creature->IsWithinMeleeRange(pTarget))
|
||||
{
|
||||
|
||||
@@ -130,13 +130,13 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI
|
||||
void CastBloodboil()
|
||||
{
|
||||
// Get the Threat List
|
||||
std::list<HostilReference *> m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
|
||||
if (!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue
|
||||
return;
|
||||
|
||||
std::list<Unit *> targets;
|
||||
std::list<HostilReference *>::iterator itr = m_threatlist.begin();
|
||||
std::list<HostileReference *>::iterator itr = m_threatlist.begin();
|
||||
for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
|
||||
@@ -501,7 +501,7 @@ struct boss_illidan_stormrageAI : public ScriptedAI
|
||||
|
||||
void DeleteFromThreatList(uint64 TargetGUID)
|
||||
{
|
||||
for (std::list<HostilReference*>::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
|
||||
{
|
||||
if ((*itr)->getUnitGuid() == TargetGUID)
|
||||
{
|
||||
@@ -1070,9 +1070,9 @@ struct npc_akama_illidanAI : public ScriptedAI
|
||||
|
||||
void KillAllElites()
|
||||
{
|
||||
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit*> eliteList;
|
||||
for (std::list<HostilReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE)
|
||||
|
||||
@@ -188,8 +188,8 @@ struct boss_reliquary_of_soulsAI : public ScriptedAI
|
||||
if (!pTarget)
|
||||
return;
|
||||
|
||||
std::list<HostilReference*>& m_threatlist = pTarget->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator itr = m_threatlist.begin();
|
||||
std::list<HostileReference*>& m_threatlist = pTarget->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator itr = m_threatlist.begin();
|
||||
for (; itr != m_threatlist.end(); itr++)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
@@ -386,11 +386,11 @@ struct boss_essence_of_sufferingAI : public ScriptedAI
|
||||
|
||||
void CastFixate()
|
||||
{
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
if (m_threatlist.empty())
|
||||
return; // No point continuing if empty threatlist.
|
||||
std::list<Unit*> targets;
|
||||
std::list<HostilReference*>::iterator itr = m_threatlist.begin();
|
||||
std::list<HostileReference*>::iterator itr = m_threatlist.begin();
|
||||
for (; itr != m_threatlist.end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
|
||||
@@ -149,8 +149,8 @@ struct boss_supremusAI : public ScriptedAI
|
||||
uint32 health = 0;
|
||||
Unit *pTarget = NULL;
|
||||
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator i = m_threatlist.begin();
|
||||
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -142,10 +142,10 @@ struct mob_shadowy_constructAI : public ScriptedAI
|
||||
|
||||
void CheckPlayers()
|
||||
{
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
if (m_threatlist.empty())
|
||||
return; // No threat list. Don't continue.
|
||||
std::list<HostilReference*>::iterator itr = m_threatlist.begin();
|
||||
std::list<HostileReference*>::iterator itr = m_threatlist.begin();
|
||||
std::list<Unit*> targets;
|
||||
for (; itr != m_threatlist.end(); ++itr)
|
||||
{
|
||||
@@ -282,8 +282,8 @@ struct boss_teron_gorefiendAI : public ScriptedAI
|
||||
{
|
||||
if (!Blossom) return;
|
||||
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostilReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator i = m_threatlist.begin();
|
||||
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -439,8 +439,8 @@ struct boss_lady_vashjAI : public ScriptedAI
|
||||
{
|
||||
bool InMeleeRange = false;
|
||||
Unit *pTarget;
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
//if in melee range
|
||||
|
||||
@@ -478,9 +478,9 @@ struct boss_leotheras_the_blindAI : public ScriptedAI
|
||||
//Summon Inner Demon
|
||||
if (InnerDemons_Timer <= diff)
|
||||
{
|
||||
std::list<HostilReference *>& ThreatList = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *>& ThreatList = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit *> TargetList;
|
||||
for (std::list<HostilReference *>::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
|
||||
for (std::list<HostileReference *>::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
|
||||
{
|
||||
Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5)
|
||||
|
||||
@@ -706,9 +706,9 @@ struct boss_krosh_firehandAI : public ScriptedAI
|
||||
if (BlastWave_Timer <= diff)
|
||||
{
|
||||
Unit *pTarget;
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit *> target_list;
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
//15 yard radius minimum
|
||||
|
||||
@@ -743,10 +743,10 @@ struct mob_phase_hunterAI : public ScriptedAI
|
||||
// some code to cast spell Mana Burn on random target which has mana
|
||||
if (ManaBurnTimer <= diff)
|
||||
{
|
||||
std::list<HostilReference*> AggroList = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*> AggroList = m_creature->getThreatManager().getThreatList();
|
||||
std::list<Unit*> UnitsWithMana;
|
||||
|
||||
for(std::list<HostilReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
|
||||
for(std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
|
||||
{
|
||||
if(Unit *pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
|
||||
{
|
||||
|
||||
@@ -230,7 +230,7 @@ struct mob_enslaved_netherwing_drakeAI : public ScriptedAI
|
||||
AttackStart(Dragonmaw);
|
||||
}
|
||||
|
||||
HostilReference* ref = m_creature->getThreatManager().getOnlineContainer().getReferenceByTarget(caster);
|
||||
HostileReference* ref = m_creature->getThreatManager().getOnlineContainer().getReferenceByTarget(caster);
|
||||
if (ref)
|
||||
ref->removeReference();
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ struct boss_kaelthasAI : public ScriptedAI
|
||||
//GravityLapse_Timer
|
||||
if (GravityLapse_Timer <= diff)
|
||||
{
|
||||
std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
switch (GravityLapse_Phase)
|
||||
{
|
||||
case 0:
|
||||
@@ -1196,8 +1196,8 @@ struct boss_grand_astromancer_capernianAI : public advisorbase_ai
|
||||
{
|
||||
bool InMeleeRange = false;
|
||||
Unit *pTarget = NULL;
|
||||
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostilReference*>::iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
//if in melee range
|
||||
|
||||
@@ -109,9 +109,9 @@ struct boss_void_reaverAI : public ScriptedAI
|
||||
if (ArcaneOrb_Timer <= diff)
|
||||
{
|
||||
Unit *pTarget = NULL;
|
||||
std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
std::vector<Unit *> target_list;
|
||||
for (std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (!pTarget)
|
||||
|
||||
@@ -1355,11 +1355,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\HostilRefManager.cpp"
|
||||
RelativePath="..\..\src\game\HostileRefManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\HostilRefManager.h"
|
||||
RelativePath="..\..\src\game\HostileRefManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
Reference in New Issue
Block a user