[10627] Use ObjectGuid for player's selection and unit's target

This commit is contained in:
VladimirMangos 2010-10-20 08:15:30 +04:00
parent e74d56f9d2
commit c955941b55
21 changed files with 66 additions and 73 deletions

View file

@ -525,9 +525,7 @@ SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, Spell
Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem)
{
if (caster)
m_casters_target_guid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelection() : caster->GetTargetGUID();
else
m_casters_target_guid = 0;
m_castersTargetGuid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelectionGuid() : caster->GetTargetGuid();
}
SingleEnemyTargetAura::~SingleEnemyTargetAura()
@ -536,7 +534,7 @@ SingleEnemyTargetAura::~SingleEnemyTargetAura()
Unit* SingleEnemyTargetAura::GetTriggerTarget() const
{
return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_casters_target_guid);
return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_castersTargetGuid);
}
Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem)
@ -3776,7 +3774,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
target->ModifyAuraState(AURA_STATE_FROZEN, apply);
target->addUnitState(UNIT_STAT_STUNNED);
target->SetTargetGUID(0);
target->SetTargetGuid(ObjectGuid());
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
target->CastStop(target->GetGUID() == GetCasterGUID() ? GetId() : 0);
@ -3846,7 +3844,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
if(!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
{
if(target->getVictim() && target->isAlive())
target->SetTargetGUID(target->getVictim()->GetGUID());
target->SetTargetGuid(target->getVictim()->GetObjectGuid());
WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4);
data << target->GetPackGUID();
@ -4063,7 +4061,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
target->ModifyAuraState(AURA_STATE_FROZEN, apply);
target->addUnitState(UNIT_STAT_ROOT);
target->SetTargetGUID(0);
target->SetTargetGuid(ObjectGuid());
//Save last orientation
if( target->getVictim() )
@ -4116,7 +4114,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
if(!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect
{
if(target->getVictim() && target->isAlive())
target->SetTargetGUID(target->getVictim()->GetGUID());
target->SetTargetGuid(target->getVictim()->GetObjectGuid());
if(target->GetTypeId() == TYPEID_PLAYER)
{