From 5e87f3144cca2cae1add4acd18affcfbb2d981e5 Mon Sep 17 00:00:00 2001 From: krz Date: Sun, 7 Jun 2009 19:06:51 +0200 Subject: Fix crash in Aura::Update. Check if target has Invisibility or Stealth aura before checking IsVisibleForOrDetect to allow cast spells on invisible triggers and fix pet linked spells. Send correct message to client if target is not visible for caster. Sorry for my previous buging commits. --HG-- branch : trunk --- src/game/Spell.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/game/Spell.cpp') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ecd2852dd7c..411a130539e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2241,11 +2241,13 @@ void Spell::cast(bool skipCheck) // update pointers base at GUIDs to prevent access to non-existed already object UpdatePointers(); - if(m_targets.getUnitTarget() && m_targets.getUnitTarget()->isAlive() && !m_targets.getUnitTarget()->isVisibleForOrDetect(m_caster, true)) - { - cancel(); - return; - } + if(Unit *pTarget = m_targets.getUnitTarget()) + if(pTarget->isAlive() && (pTarget->HasAuraType(SPELL_AURA_MOD_STEALTH) || pTarget->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) && !pTarget->IsFriendlyTo(m_caster) && !pTarget->isVisibleForOrDetect(m_caster, true)) + { + SendCastResult(SPELL_FAILED_BAD_TARGETS); + finish(false); + return; + } SetExecutedCurrently(true); uint8 castResult = 0; -- cgit v1.2.3