[11459] More ObjectGuid using in Aura/SpellAuraHolder code.

Also fix build in PetAI code. Thanks to rsa for fix code.
This commit is contained in:
VladimirMangos 2011-05-09 23:09:39 +04:00
parent 151e5eae9c
commit 44f2c26389
15 changed files with 104 additions and 96 deletions

View file

@ -2876,7 +2876,7 @@ void Spell::cancel()
{
Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit && unit->isAlive())
unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid());
}
}
@ -3971,12 +3971,12 @@ void Spell::SendChannelUpdate(uint32 time)
{
if(time == 0)
{
m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid());
ObjectGuid target_guid = m_caster->GetChannelObjectGuid();
if (target_guid != m_caster->GetObjectGuid() && target_guid.IsUnit())
if (Unit* target = ObjectAccessor::GetUnit(*m_caster, target_guid))
target->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
target->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid());
m_caster->SetChannelObjectGuid(ObjectGuid());
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
@ -4561,7 +4561,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if(non_caster_target)
{
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
if (m_spellInfo->TargetAuraState && !target->HasAuraStateForCaster(AuraState(m_spellInfo->TargetAuraState), m_caster->GetGUID()) &&
if (m_spellInfo->TargetAuraState && !target->HasAuraStateForCaster(AuraState(m_spellInfo->TargetAuraState), m_caster->GetObjectGuid()) &&
!m_caster->IsIgnoreUnitState(m_spellInfo, m_spellInfo->TargetAuraState == AURA_STATE_FROZEN ? IGNORE_UNIT_TARGET_NON_FROZEN : IGNORE_UNIT_TARGET_STATE))
return SPELL_FAILED_TARGET_AURASTATE;
@ -6561,7 +6561,7 @@ void Spell::DelayedChannel()
if ((*ihit).missCondition == SPELL_MISS_NONE)
{
if (Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->DelaySpellAuraHolder(m_spellInfo->Id, delaytime, unit->GetGUID());
unit->DelaySpellAuraHolder(m_spellInfo->Id, delaytime, unit->GetObjectGuid());
}
}