[8642] Replace the Spanish word 'hostil' with the English one.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2009-10-14 12:44:15 +02:00
parent da4a1037e7
commit 65965bc5fa
22 changed files with 150 additions and 150 deletions

View file

@ -298,7 +298,7 @@ bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTa
void ScriptedAI::UpdateAI(const uint32) void ScriptedAI::UpdateAI(const uint32)
{ {
//Check if we have a current target //Check if we have a current target
if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim()) if( m_creature->isAlive() && m_creature->SelectHostileTarget() && m_creature->getVictim())
{ {
//If we are within range melee the target //If we are within range melee the target
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))

View file

@ -122,7 +122,7 @@ void
AggressorAI::UpdateAI(const uint32 /*diff*/) AggressorAI::UpdateAI(const uint32 /*diff*/)
{ {
// update i_victimGuid if m_creature->getVictim() !=0 and changed // update i_victimGuid if m_creature->getVictim() !=0 and changed
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return; return;
i_victimGuid = m_creature->getVictim()->GetGUID(); i_victimGuid = m_creature->getVictim()->GetGUID();

View file

@ -749,7 +749,7 @@ void BattleGround::EndBattleGround(uint32 winner)
{ {
//needed cause else in av some creatures will kill the players at the end //needed cause else in av some creatures will kill the players at the end
plr->CombatStop(); plr->CombatStop();
plr->getHostilRefManager().deleteReferences(); plr->getHostileRefManager().deleteReferences();
} }
//this line is obsolete - team is set ALWAYS //this line is obsolete - team is set ALWAYS

View file

@ -524,8 +524,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break; break;
case ACTION_T_THREAT_ALL_PCT: case ACTION_T_THREAT_ALL_PCT:
{ {
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i) for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid())) if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break; break;
@ -635,8 +635,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break; break;
case ACTION_T_CAST_EVENT_ALL: case ACTION_T_CAST_EVENT_ALL:
{ {
std::list<HostilReference*>& threatList = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i) for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid())) if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
if (Temp->GetTypeId() == TYPEID_PLAYER) if (Temp->GetTypeId() == TYPEID_PLAYER)
((Player*)Temp)->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId); ((Player*)Temp)->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId);
@ -1034,7 +1034,7 @@ void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
void CreatureEventAI::UpdateAI(const uint32 diff) void CreatureEventAI::UpdateAI(const uint32 diff)
{ {
//Check if we are in combat (also updates calls threat update code) //Check if we are in combat (also updates calls threat update code)
bool Combat = m_creature->SelectHostilTarget() && m_creature->getVictim(); bool Combat = m_creature->SelectHostileTarget() && m_creature->getVictim();
//Must return if creature isn't alive. Normally select hostil target and get victim prevent this //Must return if creature isn't alive. Normally select hostil target and get victim prevent this
if (!m_creature->isAlive()) if (!m_creature->isAlive())
@ -1115,9 +1115,9 @@ bool CreatureEventAI::IsVisible(Unit *pl) const
inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position) inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position)
{ {
//ThreatList m_threatlist; //ThreatList m_threatlist;
std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList(); std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostilReference*>::iterator i = m_threatlist.begin(); std::list<HostileReference*>::iterator i = m_threatlist.begin();
std::list<HostilReference*>::reverse_iterator r = m_threatlist.rbegin(); std::list<HostileReference*>::reverse_iterator r = m_threatlist.rbegin();
if (position >= m_threatlist.size() || !m_threatlist.size()) if (position >= m_threatlist.size() || !m_threatlist.size())
return NULL; return NULL;

View file

@ -108,7 +108,7 @@ void GuardAI::EnterEvadeMode()
void GuardAI::UpdateAI(const uint32 /*diff*/) void GuardAI::UpdateAI(const uint32 /*diff*/)
{ {
// update i_victimGuid if i_creature.getVictim() !=0 and changed // update i_victimGuid if i_creature.getVictim() !=0 and changed
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return; return;
i_victimGuid = m_creature->getVictim()->GetGUID(); i_victimGuid = m_creature->getVictim()->GetGUID();

View file

@ -22,7 +22,7 @@
#include "DBCStructure.h" #include "DBCStructure.h"
#include "SpellMgr.h" #include "SpellMgr.h"
HostilRefManager::~HostilRefManager() HostileRefManager::~HostileRefManager()
{ {
deleteReferences(); deleteReferences();
} }
@ -32,9 +32,9 @@ HostilRefManager::~HostilRefManager()
// The pVictim is hated than by them as well // The pVictim is hated than by them as well
// use for buffs and healing threat functionality // use for buffs and healing threat functionality
void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget) void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
{ {
HostilReference* ref; HostileReference* ref;
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
ref = getFirst(); ref = getFirst();
@ -51,9 +51,9 @@ void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry con
//================================================= //=================================================
void HostilRefManager::addThreatPercent(int32 pValue) void HostileRefManager::addThreatPercent(int32 pValue)
{ {
HostilReference* ref; HostileReference* ref;
ref = getFirst(); ref = getFirst();
while(ref != NULL) while(ref != NULL)
@ -66,9 +66,9 @@ void HostilRefManager::addThreatPercent(int32 pValue)
//================================================= //=================================================
// The online / offline status is given to the method. The calculation has to be done before // The online / offline status is given to the method. The calculation has to be done before
void HostilRefManager::setOnlineOfflineState(bool pIsOnline) void HostileRefManager::setOnlineOfflineState(bool pIsOnline)
{ {
HostilReference* ref; HostileReference* ref;
ref = getFirst(); ref = getFirst();
while(ref != NULL) while(ref != NULL)
@ -81,9 +81,9 @@ void HostilRefManager::setOnlineOfflineState(bool pIsOnline)
//================================================= //=================================================
// The online / offline status is calculated and set // The online / offline status is calculated and set
void HostilRefManager::updateThreatTables() void HostileRefManager::updateThreatTables()
{ {
HostilReference* ref = getFirst(); HostileReference* ref = getFirst();
while(ref) while(ref)
{ {
ref->updateOnlineStatus(); ref->updateOnlineStatus();
@ -95,12 +95,12 @@ void HostilRefManager::updateThreatTables()
// The references are not needed anymore // The references are not needed anymore
// tell the source to remove them from the list and free the mem // 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) while(ref)
{ {
HostilReference* nextRef = ref->next(); HostileReference* nextRef = ref->next();
ref->removeReference(); ref->removeReference();
delete ref; delete ref;
ref = nextRef; ref = nextRef;
@ -110,12 +110,12 @@ void HostilRefManager::deleteReferences()
//================================================= //=================================================
// delete one reference, defined by Unit // delete one reference, defined by Unit
void HostilRefManager::deleteReference(Unit *pCreature) void HostileRefManager::deleteReference(Unit *pCreature)
{ {
HostilReference* ref = getFirst(); HostileReference* ref = getFirst();
while(ref) while(ref)
{ {
HostilReference* nextRef = ref->next(); HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature) if(ref->getSource()->getOwner() == pCreature)
{ {
ref->removeReference(); ref->removeReference();
@ -129,12 +129,12 @@ void HostilRefManager::deleteReference(Unit *pCreature)
//================================================= //=================================================
// set state for one reference, defined by Unit // set state for one reference, defined by Unit
void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline) void HostileRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
{ {
HostilReference* ref = getFirst(); HostileReference* ref = getFirst();
while(ref) while(ref)
{ {
HostilReference* nextRef = ref->next(); HostileReference* nextRef = ref->next();
if(ref->getSource()->getOwner() == pCreature) if(ref->getSource()->getOwner() == pCreature)
{ {
ref->setOnlineOfflineState(pIsOnline); ref->setOnlineOfflineState(pIsOnline);

View file

@ -24,18 +24,18 @@
class Unit; class Unit;
class ThreatManager; class ThreatManager;
class HostilReference; class HostileReference;
struct SpellEntry; struct SpellEntry;
//================================================= //=================================================
class HostilRefManager : public RefManager<Unit, ThreatManager> class HostileRefManager : public RefManager<Unit, ThreatManager>
{ {
private: private:
Unit *iOwner; Unit *iOwner;
public: public:
explicit HostilRefManager(Unit *pOwner) { iOwner = pOwner; } explicit HostileRefManager(Unit *pOwner) { iOwner = pOwner; }
~HostilRefManager(); ~HostileRefManager();
Unit* getOwner() { return iOwner; } Unit* getOwner() { return iOwner; }
@ -50,7 +50,7 @@ class HostilRefManager : public RefManager<Unit, ThreatManager>
// tell the source to remove them from the list and free the mem // tell the source to remove them from the list and free the mem
void deleteReferences(); void deleteReferences();
HostilReference* getFirst() { return ((HostilReference* ) RefManager<Unit, ThreatManager>::getFirst()); } HostileReference* getFirst() { return ((HostileReference* ) RefManager<Unit, ThreatManager>::getFirst()); }
void updateThreatTables(); void updateThreatTables();

View file

@ -3904,7 +3904,7 @@ bool ChatHandler::HandleCombatStopCommand(const char* args)
return false; return false;
target->CombatStop(); target->CombatStop();
target->getHostilRefManager().deleteReferences(); target->getHostileRefManager().deleteReferences();
return true; return true;
} }

View file

@ -106,7 +106,7 @@ void PetAI::_stopAttack()
m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMotionMaster()->MoveIdle();
m_creature->CombatStop(); m_creature->CombatStop();
m_creature->getHostilRefManager().deleteReferences(); m_creature->getHostileRefManager().deleteReferences();
return; return;
} }

View file

@ -2185,7 +2185,7 @@ void Player::SetInWater(bool apply)
// remove auras that need water/land // remove auras that need water/land
RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER); RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER);
getHostilRefManager().updateThreatTables(); getHostileRefManager().updateThreatTables();
} }
void Player::SetGameMaster(bool on) void Player::SetGameMaster(bool on)
@ -2199,7 +2199,7 @@ void Player::SetGameMaster(bool on)
if (Pet* pet = GetPet()) if (Pet* pet = GetPet())
{ {
pet->setFaction(35); pet->setFaction(35);
pet->getHostilRefManager().setOnlineOfflineState(false); pet->getHostileRefManager().setOnlineOfflineState(false);
} }
for (int8 i = 0; i < MAX_TOTEM; ++i) for (int8 i = 0; i < MAX_TOTEM; ++i)
@ -2210,7 +2210,7 @@ void Player::SetGameMaster(bool on)
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
ResetContestedPvP(); ResetContestedPvP();
getHostilRefManager().setOnlineOfflineState(false); getHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets(); CombatStopWithPets();
SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases
@ -2228,7 +2228,7 @@ void Player::SetGameMaster(bool on)
if (Pet* pet = GetPet()) if (Pet* pet = GetPet())
{ {
pet->setFaction(getFaction()); pet->setFaction(getFaction());
pet->getHostilRefManager().setOnlineOfflineState(true); pet->getHostileRefManager().setOnlineOfflineState(true);
} }
for (int8 i = 0; i < MAX_TOTEM; ++i) for (int8 i = 0; i < MAX_TOTEM; ++i)
@ -2243,7 +2243,7 @@ void Player::SetGameMaster(bool on)
// restore FFA PvP area state, remove not allowed for GM mounts // restore FFA PvP area state, remove not allowed for GM mounts
UpdateArea(m_areaUpdateId); UpdateArea(m_areaUpdateId);
getHostilRefManager().setOnlineOfflineState(true); getHostileRefManager().setOnlineOfflineState(true);
} }
UpdateVisibilityForPlayer(); UpdateVisibilityForPlayer();

View file

@ -68,7 +68,7 @@ void
ReactorAI::UpdateAI(const uint32 /*time_diff*/) ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{ {
// update i_victimGuid if i_creature.getVictim() !=0 and changed // update i_victimGuid if i_creature.getVictim() !=0 and changed
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return; return;
i_victimGuid = m_creature->getVictim()->GetGUID(); i_victimGuid = m_creature->getVictim()->GetGUID();

View file

@ -970,7 +970,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo); caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit); 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 // Do damage and triggers
else if (m_damage) else if (m_damage)
@ -1116,7 +1116,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if (unit->isInCombat() && !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO)) if (unit->isInCombat() && !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO))
{ {
realCaster->SetInCombatState(unit->GetCombatTimer() > 0); realCaster->SetInCombatState(unit->GetCombatTimer() > 0);
unit->getHostilRefManager().threatAssist(realCaster, 0.0f); unit->getHostileRefManager().threatAssist(realCaster, 0.0f);
} }
} }
} }

View file

@ -4038,7 +4038,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount); float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount);
m_target->getHostilRefManager().threatAssist(caster, threatMod); m_target->getHostileRefManager().threatAssist(caster, threatMod);
} }
void Aura::HandleModTaunt(bool apply, bool Real) void Aura::HandleModTaunt(bool apply, bool Real)
@ -6408,7 +6408,7 @@ void Aura::PeriodicTick()
uint32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetStackAmount()); uint32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetStackAmount());
int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto()); int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto());
pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto()); pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto());
break; break;
} }
case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_PERIODIC_HEAL:
@ -6460,7 +6460,7 @@ void Aura::PeriodicTick()
if( BattleGround *bg = ((Player*)pCaster)->GetBattleGround() ) if( BattleGround *bg = ((Player*)pCaster)->GetBattleGround() )
bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain); bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain);
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
SpellEntry const* spellProto = GetSpellProto(); SpellEntry const* spellProto = GetSpellProto();
@ -6590,7 +6590,7 @@ void Aura::PeriodicTick()
int32 gain = m_target->ModifyPower(power,pdamage); int32 gain = m_target->ModifyPower(power,pdamage);
if(Unit* pCaster = GetCaster()) if(Unit* pCaster = GetCaster())
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
break; break;
} }
case SPELL_AURA_OBS_MOD_MANA: case SPELL_AURA_OBS_MOD_MANA:
@ -6612,7 +6612,7 @@ void Aura::PeriodicTick()
int32 gain = m_target->ModifyPower(POWER_MANA, pdamage); int32 gain = m_target->ModifyPower(POWER_MANA, pdamage);
if(Unit* pCaster = GetCaster()) if(Unit* pCaster = GetCaster())
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
break; break;
} }
case SPELL_AURA_POWER_BURN_MANA: case SPELL_AURA_POWER_BURN_MANA:
@ -6665,7 +6665,7 @@ void Aura::PeriodicTick()
{ {
int32 gain = m_target->ModifyHealth(m_modifier.m_amount); int32 gain = m_target->ModifyHealth(m_modifier.m_amount);
if (Unit *caster = GetCaster()) if (Unit *caster = GetCaster())
m_target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); m_target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
break; break;
} }
case SPELL_AURA_MOD_POWER_REGEN: case SPELL_AURA_MOD_POWER_REGEN:

View file

@ -2584,7 +2584,7 @@ void Spell::EffectHealPct( uint32 /*i*/ )
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo); 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);
} }
} }
@ -5513,7 +5513,7 @@ void Spell::EffectSanctuary(uint32 /*i*/)
//unitTarget->CombatStop(); //unitTarget->CombatStop();
unitTarget->CombatStop(); 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 // Vanish allows to remove all threat and cast regular stealth so other spells can be used
if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_VANISH)) if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_VANISH))
{ {

View file

@ -41,10 +41,10 @@ float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pT
} }
//============================================================ //============================================================
//================= HostilReference ========================== //================= HostileReference ==========================
//============================================================ //============================================================
HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat) HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat)
{ {
iThreat = pThreat; iThreat = pThreat;
iTempThreatModifyer = 0.0f; iTempThreatModifyer = 0.0f;
@ -56,14 +56,14 @@ HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, flo
//============================================================ //============================================================
// Tell our refTo (target) object that we have a link // Tell our refTo (target) object that we have a link
void HostilReference::targetObjectBuildLink() void HostileReference::targetObjectBuildLink()
{ {
getTarget()->addHatedBy(this); getTarget()->addHatedBy(this);
} }
//============================================================ //============================================================
// Tell our refTo (taget) object, that the link is cut // Tell our refTo (taget) object, that the link is cut
void HostilReference::targetObjectDestroyLink() void HostileReference::targetObjectDestroyLink()
{ {
getTarget()->removeHatedBy(this); getTarget()->removeHatedBy(this);
} }
@ -71,7 +71,7 @@ void HostilReference::targetObjectDestroyLink()
//============================================================ //============================================================
// Tell our refFrom (source) object, that the link is cut (Target destroyed) // Tell our refFrom (source) object, that the link is cut (Target destroyed)
void HostilReference::sourceObjectDestroyLink() void HostileReference::sourceObjectDestroyLink()
{ {
setOnlineOfflineState(false); setOnlineOfflineState(false);
} }
@ -79,7 +79,7 @@ void HostilReference::sourceObjectDestroyLink()
//============================================================ //============================================================
// Inform the source, that the status of the reference changed // Inform the source, that the status of the reference changed
void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent) void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{ {
if(getSource()) if(getSource())
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent); getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
@ -87,7 +87,7 @@ void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefSt
//============================================================ //============================================================
void HostilReference::addThreat(float pMod) void HostileReference::addThreat(float pMod)
{ {
iThreat += pMod; iThreat += pMod;
// the threat is changed. Source and target unit have to be availabe // the threat is changed. Source and target unit have to be availabe
@ -111,7 +111,7 @@ void HostilReference::addThreat(float pMod)
//============================================================ //============================================================
// check, if source can reach target and set the status // check, if source can reach target and set the status
void HostilReference::updateOnlineStatus() void HostileReference::updateOnlineStatus()
{ {
bool online = false; bool online = false;
bool accessible = false; bool accessible = false;
@ -148,7 +148,7 @@ void HostilReference::updateOnlineStatus()
//============================================================ //============================================================
// set the status and fire the event on status change // set the status and fire the event on status change
void HostilReference::setOnlineOfflineState(bool pIsOnline) void HostileReference::setOnlineOfflineState(bool pIsOnline)
{ {
if(iOnline != pIsOnline) if(iOnline != pIsOnline)
{ {
@ -163,7 +163,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline)
//============================================================ //============================================================
void HostilReference::setAccessibleState(bool pIsAccessible) void HostileReference::setAccessibleState(bool pIsAccessible)
{ {
if(iAccessible != pIsAccessible) if(iAccessible != pIsAccessible)
{ {
@ -178,7 +178,7 @@ void HostilReference::setAccessibleState(bool pIsAccessible)
// prepare the reference for deleting // prepare the reference for deleting
// this is called be the target // this is called be the target
void HostilReference::removeReference() void HostileReference::removeReference()
{ {
invalidate(); invalidate();
@ -188,7 +188,7 @@ void HostilReference::removeReference()
//============================================================ //============================================================
Unit* HostilReference::getSourceUnit() Unit* HostileReference::getSourceUnit()
{ {
return (getSource()->getOwner()); return (getSource()->getOwner());
} }
@ -199,7 +199,7 @@ Unit* HostilReference::getSourceUnit()
void ThreatContainer::clearReferences() 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(); (*i)->unlink();
delete (*i); delete (*i);
@ -208,12 +208,12 @@ void ThreatContainer::clearReferences()
} }
//============================================================ //============================================================
// Return the HostilReference of NULL, if not found // Return the HostileReference of NULL, if not found
HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
{ {
HostilReference* result = NULL; HostileReference* result = NULL;
uint64 guid = pVictim->GetGUID(); 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) if((*i)->getUnitGuid() == guid)
{ {
@ -228,9 +228,9 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim)
//============================================================ //============================================================
// Add the threat, if we find the reference // Add the threat, if we find the reference
HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat) HostileReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
{ {
HostilReference* ref = getReferenceByTarget(pVictim); HostileReference* ref = getReferenceByTarget(pVictim);
if(ref) if(ref)
ref->addThreat(pThreat); ref->addThreat(pThreat);
return ref; return ref;
@ -240,13 +240,13 @@ HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 pPercent) void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 pPercent)
{ {
if(HostilReference* ref = getReferenceByTarget(pVictim)) if(HostileReference* ref = getReferenceByTarget(pVictim))
ref->addThreatPercent(pPercent); ref->addThreatPercent(pPercent);
} }
//============================================================ //============================================================
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 // std::list::sort ordering predicate must be: (Pred(x,y)&&Pred(y,x))==false
return lhs->getThreat() > rhs->getThreat(); // reverse sorting return lhs->getThreat() > rhs->getThreat(); // reverse sorting
@ -259,7 +259,7 @@ void ThreatContainer::update()
{ {
if(iDirty && iThreatList.size() >1) if(iDirty && iThreatList.size() >1)
{ {
iThreatList.sort(HostilReferenceSortPredicate); iThreatList.sort(HostileReferenceSortPredicate);
} }
iDirty = false; iDirty = false;
} }
@ -268,16 +268,16 @@ void ThreatContainer::update()
// return the next best victim // return the next best victim
// could be the current 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 found = false;
bool noPriorityTargetFound = false; bool noPriorityTargetFound = false;
std::list<HostilReference*>::const_iterator lastRef = iThreatList.end(); std::list<HostileReference*>::const_iterator lastRef = iThreatList.end();
lastRef--; 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); currentRef = (*iter);
@ -380,7 +380,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell); float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell);
HostilReference* ref = iThreatContainer.addThreat(pVictim, threat); HostileReference* ref = iThreatContainer.addThreat(pVictim, threat);
// Ref is not in the online refs, search the offline refs next // Ref is not in the online refs, search the offline refs next
if(!ref) if(!ref)
ref = iThreatOfflineContainer.addThreat(pVictim, threat); ref = iThreatOfflineContainer.addThreat(pVictim, threat);
@ -388,11 +388,11 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho
if(!ref) // there was no ref => create a new one if(!ref) // there was no ref => create a new one
{ {
// threat has to be 0 here // threat has to be 0 here
HostilReference* hostilReference = new HostilReference(pVictim, this, 0); HostileReference* hostileReference = new HostileReference(pVictim, this, 0);
iThreatContainer.addReference(hostilReference); iThreatContainer.addReference(hostileReference);
hostilReference->addThreat(threat); // now we add the real threat hostileReference->addThreat(threat); // now we add the real threat
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()) if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostilReference->setOnlineOfflineState(false); // GM is always offline hostileReference->setOnlineOfflineState(false); // GM is always offline
} }
} }
@ -405,10 +405,10 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 pPercent)
//============================================================ //============================================================
Unit* ThreatManager::getHostilTarget() Unit* ThreatManager::getHostileTarget()
{ {
iThreatContainer.update(); iThreatContainer.update();
HostilReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim()); HostileReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim());
setCurrentVictim(nextVictim); setCurrentVictim(nextVictim);
return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL; return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL;
} }
@ -418,7 +418,7 @@ Unit* ThreatManager::getHostilTarget()
float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList) float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
{ {
float threat = 0.0f; float threat = 0.0f;
HostilReference* ref = iThreatContainer.getReferenceByTarget(pVictim); HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim);
if(!ref && pAlsoSearchOfflineList) if(!ref && pAlsoSearchOfflineList)
ref = iThreatOfflineContainer.getReferenceByTarget(pVictim); ref = iThreatOfflineContainer.getReferenceByTarget(pVictim);
if(ref) if(ref)
@ -430,7 +430,7 @@ float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList)
void ThreatManager::tauntApply(Unit* pTaunter) void ThreatManager::tauntApply(Unit* pTaunter)
{ {
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat())) if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
{ {
if(ref->getTempThreatModifyer() == 0.0f) if(ref->getTempThreatModifyer() == 0.0f)
@ -443,16 +443,16 @@ void ThreatManager::tauntApply(Unit* pTaunter)
void ThreatManager::tauntFadeOut(Unit *pTaunter) void ThreatManager::tauntFadeOut(Unit *pTaunter)
{ {
HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter);
if(ref) if(ref)
ref->resetTempThreat(); ref->resetTempThreat();
} }
//============================================================ //============================================================
void ThreatManager::setCurrentVictim(HostilReference* pHostilReference) void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
{ {
iCurrentVictim = pHostilReference; iCurrentVictim = pHostileReference;
} }
//============================================================ //============================================================
@ -463,44 +463,44 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
{ {
threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager
HostilReference* hostilReference = threatRefStatusChangeEvent->getReference(); HostileReference* hostileReference = threatRefStatusChangeEvent->getReference();
switch(threatRefStatusChangeEvent->getType()) switch(threatRefStatusChangeEvent->getType())
{ {
case UEV_THREAT_REF_THREAT_CHANGE: case UEV_THREAT_REF_THREAT_CHANGE:
if((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) || if((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue()<0.0f) ||
(getCurrentVictim() != hostilReference && threatRefStatusChangeEvent->getFValue()>0.0f)) (getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue()>0.0f))
setDirty(true); // the order in the threat list might have changed setDirty(true); // the order in the threat list might have changed
break; break;
case UEV_THREAT_REF_ONLINE_STATUS: case UEV_THREAT_REF_ONLINE_STATUS:
if(!hostilReference->isOnline()) if(!hostileReference->isOnline())
{ {
if (hostilReference == getCurrentVictim()) if (hostileReference == getCurrentVictim())
{ {
setCurrentVictim(NULL); setCurrentVictim(NULL);
setDirty(true); setDirty(true);
} }
iThreatContainer.remove(hostilReference); iThreatContainer.remove(hostileReference);
iThreatOfflineContainer.addReference(hostilReference); iThreatOfflineContainer.addReference(hostileReference);
} }
else else
{ {
if(getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat())) if(getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
setDirty(true); setDirty(true);
iThreatContainer.addReference(hostilReference); iThreatContainer.addReference(hostileReference);
iThreatOfflineContainer.remove(hostilReference); iThreatOfflineContainer.remove(hostileReference);
} }
break; break;
case UEV_THREAT_REF_REMOVE_FROM_LIST: case UEV_THREAT_REF_REMOVE_FROM_LIST:
if (hostilReference == getCurrentVictim()) if (hostileReference == getCurrentVictim())
{ {
setCurrentVictim(NULL); setCurrentVictim(NULL);
setDirty(true); setDirty(true);
} }
if(hostilReference->isOnline()) if(hostileReference->isOnline())
iThreatContainer.remove(hostilReference); iThreatContainer.remove(hostileReference);
else else
iThreatOfflineContainer.remove(hostilReference); iThreatOfflineContainer.remove(hostileReference);
break; break;
} }
} }

View file

@ -43,10 +43,10 @@ class ThreatCalcHelper
}; };
//============================================================== //==============================================================
class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager> class MANGOS_DLL_SPEC HostileReference : public Reference<Unit, ThreatManager>
{ {
public: public:
HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat); HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat);
//================================================= //=================================================
void addThreat(float pMod); void addThreat(float pMod);
@ -86,7 +86,7 @@ class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
void setAccessibleState(bool pIsAccessible); void setAccessibleState(bool pIsAccessible);
//================================================= //=================================================
bool operator ==(const HostilReference& pHostilReference) const { return pHostilReference.getUnitGuid() == getUnitGuid(); } bool operator ==(const HostileReference& pHostileReference) const { return pHostileReference.getUnitGuid() == getUnitGuid(); }
//================================================= //=================================================
@ -99,7 +99,7 @@ class MANGOS_DLL_SPEC HostilReference : public Reference<Unit, ThreatManager>
//================================================= //=================================================
HostilReference* next() { return ((HostilReference* ) Reference<Unit, ThreatManager>::next()); } HostileReference* next() { return ((HostileReference* ) Reference<Unit, ThreatManager>::next()); }
//================================================= //=================================================
@ -130,13 +130,13 @@ class ThreatManager;
class MANGOS_DLL_SPEC ThreatContainer class MANGOS_DLL_SPEC ThreatContainer
{ {
private: private:
std::list<HostilReference*> iThreatList; std::list<HostileReference*> iThreatList;
bool iDirty; bool iDirty;
protected: protected:
friend class ThreatManager; friend class ThreatManager;
void remove(HostilReference* pRef) { iThreatList.remove(pRef); } void remove(HostileReference* pRef) { iThreatList.remove(pRef); }
void addReference(HostilReference* pHostilReference) { iThreatList.push_back(pHostilReference); } void addReference(HostileReference* pHostileReference) { iThreatList.push_back(pHostileReference); }
void clearReferences(); void clearReferences();
// Sort the list if necessary // Sort the list if necessary
void update(); void update();
@ -144,11 +144,11 @@ class MANGOS_DLL_SPEC ThreatContainer
ThreatContainer() { iDirty = false; } ThreatContainer() { iDirty = false; }
~ThreatContainer() { clearReferences(); } ~ThreatContainer() { clearReferences(); }
HostilReference* addThreat(Unit* pVictim, float pThreat); HostileReference* addThreat(Unit* pVictim, float pThreat);
void modifyThreatPercent(Unit *pVictim, int32 percent); void modifyThreatPercent(Unit *pVictim, int32 percent);
HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim); HostileReference* selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim);
void setDirty(bool pDirty) { iDirty = pDirty; } void setDirty(bool pDirty) { iDirty = pDirty; }
@ -156,11 +156,11 @@ class MANGOS_DLL_SPEC ThreatContainer
bool empty() { return(iThreatList.empty()); } 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; }
}; };
//================================================= //=================================================
@ -168,7 +168,7 @@ class MANGOS_DLL_SPEC ThreatContainer
class MANGOS_DLL_SPEC ThreatManager class MANGOS_DLL_SPEC ThreatManager
{ {
public: public:
friend class HostilReference; friend class HostileReference;
explicit ThreatManager(Unit *pOwner); explicit ThreatManager(Unit *pOwner);
@ -185,27 +185,27 @@ class MANGOS_DLL_SPEC ThreatManager
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent); void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
HostilReference* getCurrentVictim() { return iCurrentVictim; } HostileReference* getCurrentVictim() { return iCurrentVictim; }
Unit* getOwner() { return iOwner; } Unit* getOwner() { return iOwner; }
Unit* getHostilTarget(); Unit* getHostileTarget();
void tauntApply(Unit* pTaunter); void tauntApply(Unit* pTaunter);
void tauntFadeOut(Unit *pTaunter); void tauntFadeOut(Unit *pTaunter);
void setCurrentVictim(HostilReference* pHostilReference); void setCurrentVictim(HostileReference* pHostileReference);
void setDirty(bool pDirty) { iThreatContainer.setDirty(pDirty); } void setDirty(bool pDirty) { iThreatContainer.setDirty(pDirty); }
// methods to access the lists from the outside to do sume dirty manipulation (scriping and such) // methods to access the lists from the outside to do sume dirty manipulation (scriping and such)
// I hope they are used as little as possible. // I hope they are used as little as possible.
std::list<HostilReference*>& getThreatList() { return iThreatContainer.getThreatList(); } std::list<HostileReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
std::list<HostilReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); } std::list<HostileReference*>& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; } ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private: private:
HostilReference* iCurrentVictim; HostileReference* iCurrentVictim;
Unit* iOwner; Unit* iOwner;
ThreatContainer iThreatContainer; ThreatContainer iThreatContainer;
ThreatContainer iThreatOfflineContainer; ThreatContainer iThreatOfflineContainer;

View file

@ -71,7 +71,7 @@ static bool isNonTriggerAura[TOTAL_AURAS];
static bool procPrepared = InitTriggerAuraData(); static bool procPrepared = InitTriggerAuraData();
Unit::Unit() Unit::Unit()
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostileRefManager(this)
{ {
m_objectType |= TYPEMASK_UNIT; m_objectType |= TYPEMASK_UNIT;
m_objectTypeId = TYPEID_UNIT; m_objectTypeId = TYPEID_UNIT;
@ -211,7 +211,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 // 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. // targets without stopping half way there and running off.
// These flags are reset after target dies or another command is given. // 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 // m_CombatTimer set at aura start and it will be freeze until aura removing
if ( m_CombatTimer <= p_time ) if ( m_CombatTimer <= p_time )
@ -576,7 +576,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// stop combat // stop combat
pVictim->CombatStop(); pVictim->CombatStop();
pVictim->getHostilRefManager().deleteReferences(); pVictim->getHostileRefManager().deleteReferences();
bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795; bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795;
@ -10253,7 +10253,7 @@ void Unit::TauntFadeOut(Unit *taunter)
} }
m_ThreatManager.tauntFadeOut(taunter); m_ThreatManager.tauntFadeOut(taunter);
target = m_ThreatManager.getHostilTarget(); target = m_ThreatManager.getHostileTarget();
if (target && target != taunter) if (target && target != taunter)
{ {
@ -10265,7 +10265,7 @@ void Unit::TauntFadeOut(Unit *taunter)
//====================================================================== //======================================================================
bool Unit::SelectHostilTarget() bool Unit::SelectHostileTarget()
{ {
//function provides main threat functionality //function provides main threat functionality
//next-victim-selection algorithm and evade mode are called //next-victim-selection algorithm and evade mode are called
@ -10312,7 +10312,7 @@ bool Unit::SelectHostilTarget()
if ( !target && !m_ThreatManager.isThreatListEmpty() ) if ( !target && !m_ThreatManager.isThreatListEmpty() )
// No taunt aura or taunt aura caster is dead standart target selection // No taunt aura or taunt aura caster is dead standart target selection
target = m_ThreatManager.getHostilTarget(); target = m_ThreatManager.getHostileTarget();
if(target) if(target)
{ {
@ -11005,7 +11005,7 @@ void Unit::CleanupsBeforeDelete()
CombatStop(); CombatStop();
ClearComboPointHolders(); ClearComboPointHolders();
DeleteThreatList(); DeleteThreatList();
getHostilRefManager().setOnlineOfflineState(false); getHostileRefManager().setOnlineOfflineState(false);
RemoveAllAuras(); RemoveAllAuras();
RemoveAllGameObjects(); RemoveAllGameObjects();
RemoveAllDynObjects(); RemoveAllDynObjects();
@ -11793,7 +11793,7 @@ void Unit::SetFeignDeath(bool apply, uint64 const& casterGUID, uint32 spellID)
if (casterGUID == GetGUID()) if (casterGUID == GetGUID())
FinishSpell(CURRENT_GENERIC_SPELL,false); FinishSpell(CURRENT_GENERIC_SPELL,false);
InterruptNonMeleeSpells(true); InterruptNonMeleeSpells(true);
getHostilRefManager().deleteReferences(); getHostileRefManager().deleteReferences();
} }
else else
{ {

View file

@ -1338,13 +1338,13 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL); void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList(); void DeleteThreatList();
bool SelectHostilTarget(); bool SelectHostileTarget();
void TauntApply(Unit* pVictim); void TauntApply(Unit* pVictim);
void TauntFadeOut(Unit *taunter); void TauntFadeOut(Unit *taunter);
ThreatManager& getThreatManager() { return m_ThreatManager; } ThreatManager& getThreatManager() { return m_ThreatManager; }
void addHatedBy(HostilReference* pHostilReference) { m_HostilRefManager.insertFirst(pHostilReference); }; void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ } void removeHatedBy(HostileReference* /*pHostileReference*/ ) { /* nothing to do yet */ }
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; } HostileRefManager& getHostileRefManager() { return m_HostileRefManager; }
uint32 GetVisibleAura(uint8 slot) uint32 GetVisibleAura(uint8 slot)
{ {
@ -1580,7 +1580,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
// Manage all Units threatening us // Manage all Units threatening us
ThreatManager m_ThreatManager; ThreatManager m_ThreatManager;
// Manage all Units that are threatened by us // Manage all Units that are threatened by us
HostilRefManager m_HostilRefManager; HostileRefManager m_HostileRefManager;
FollowerRefManager m_FollowingRefManager; FollowerRefManager m_FollowingRefManager;

View file

@ -23,7 +23,7 @@
class ThreatContainer; class ThreatContainer;
class ThreatManager; class ThreatManager;
class HostilReference; class HostileReference;
//============================================================== //==============================================================
//============================================================== //==============================================================
@ -85,7 +85,7 @@ class MANGOS_DLL_SPEC UnitBaseEvent
class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent
{ {
private: private:
HostilReference* iHostilReference; HostileReference* iHostileReference;
union union
{ {
float iFValue; float iFValue;
@ -94,13 +94,13 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent
}; };
ThreatManager* iThreatManager; ThreatManager* iThreatManager;
public: 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; } int32 getIValue() const { return iIValue; }
@ -110,7 +110,7 @@ class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent
void setBValue(bool pValue) { iBValue = pValue; } void setBValue(bool pValue) { iBValue = pValue; }
HostilReference* getReference() const { return iHostilReference; } HostileReference* getReference() const { return iHostileReference; }
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; } void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
@ -125,7 +125,7 @@ class MANGOS_DLL_SPEC ThreatManagerEvent : public ThreatRefStatusChangeEvent
ThreatContainer* iThreatContainer; ThreatContainer* iThreatContainer;
public: public:
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {} 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; } void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }

View file

@ -233,7 +233,7 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
void FlightPathMovementGenerator::Initialize(Player &player) void FlightPathMovementGenerator::Initialize(Player &player)
{ {
player.getHostilRefManager().setOnlineOfflineState(false); player.getHostileRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT); player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player); LoadPath(player);
@ -258,7 +258,7 @@ void FlightPathMovementGenerator::Finalize(Player & player)
if(player.m_taxi.empty()) if(player.m_taxi.empty())
{ {
player.getHostilRefManager().setOnlineOfflineState(true); player.getHostileRefManager().setOnlineOfflineState(true);
if(player.pvpInfo.inHostileArea) if(player.pvpInfo.inHostileArea)
player.CastSpell(&player, 2479, true); player.CastSpell(&player, 2479, true);

View file

@ -297,14 +297,14 @@ void WorldSession::LogoutPlayer(bool Save)
//FIXME: logout must be delayed in case lost connection with client in time of combat //FIXME: logout must be delayed in case lost connection with client in time of combat
if (_player->GetDeathTimer()) if (_player->GetDeathTimer())
{ {
_player->getHostilRefManager().deleteReferences(); _player->getHostileRefManager().deleteReferences();
_player->BuildPlayerRepop(); _player->BuildPlayerRepop();
_player->RepopAtGraveyard(); _player->RepopAtGraveyard();
} }
else if (!_player->getAttackers().empty()) else if (!_player->getAttackers().empty())
{ {
_player->CombatStop(); _player->CombatStop();
_player->getHostilRefManager().setOnlineOfflineState(false); _player->getHostileRefManager().setOnlineOfflineState(false);
_player->RemoveAllAurasOnDeath(); _player->RemoveAllAurasOnDeath();
// build set of player who attack _player or who have pet attacking of _player // build set of player who attack _player or who have pet attacking of _player

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8641" #define REVISION_NR "8642"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__