*Use original caster to check quest spell hit. This fixes the bug that some quest cannot be finished when using controlled creatures to cast spell.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-26 15:31:47 -05:00
parent 375be3648e
commit 18252e5f79
+6 -4
View File
@@ -1128,10 +1128,12 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... )
if(!((Creature*)spellHitTarget)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) if(m_originalCaster && m_originalCaster->IsControlledByPlayer() && !((Creature*)spellHitTarget)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
{ {
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) if ( Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself() )
{
p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id); p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id);
}
} }
} }
@@ -1379,9 +1381,9 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) if(m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
{ {
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) if ( Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself() )
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
} }
} }