diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 19 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 7 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index e906511df52..2a6cb060419 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1022,9 +1022,21 @@ bool Aura::CanBeSaved() const return false; // Check if aura is single target, not only spell info - if (GetCasterGUID() != GetOwner()->GetGUID() || IsSingleTarget()) - if (GetSpellInfo()->IsSingleTarget()) + if (GetCasterGUID() != GetOwner()->GetGUID()) + { + // owner == caster for area auras, check for possible bad data in DB + for (SpellEffectInfo const* effect : GetSpellInfo()->GetEffects()) + { + if (!effect || !effect->IsEffect()) + continue; + + if (effect->IsTargetingArea() || effect->IsAreaAuraEffect()) + return false; + } + + if (IsSingleTarget() || GetSpellInfo()->IsSingleTarget()) return false; + } if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED)) return false; @@ -2283,6 +2295,9 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint32>& targets, Unit* c } else { + ASSERT(caster, "Area aura (Id: %u) has nullptr caster (%s)", m_spellInfo->Id, GetCasterGUID().ToString().c_str()); + ASSERT(GetCasterGUID() == GetUnitOwner()->GetGUID(), "Area aura (Id: %u) has owner (%s) different to caster (%s)", m_spellInfo->Id, GetUnitOwner()->GetGUID().ToString().c_str(), GetCasterGUID().ToString().c_str()); + // skip area update if owner is not in world! if (!GetUnitOwner()->IsInWorld()) continue; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 8422ff6360c..d07cd6a54cb 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4541,6 +4541,13 @@ void SpellMgr::LoadSpellInfoCorrections() if (effect->TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE || effect->TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE) if (G3D::fuzzyEq(spellInfo->ConeAngle, 0.f)) spellInfo->ConeAngle = 90.f; + + // Area auras may not target area (they're self cast) + if (effect->IsAreaAuraEffect() && effect->IsTargetingArea()) + { + const_cast<SpellEffectInfo*>(effect)->TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER); + const_cast<SpellEffectInfo*>(effect)->TargetB = SpellImplicitTargetInfo(0); + } } // disable proc for magnet auras, they're handled differently |