diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2018-03-01 20:38:07 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2018-03-01 20:38:07 -0300 |
| commit | 54e841888621ce2ea6fbfde2f86842ec088cd575 (patch) | |
| tree | 5dffde96ff42aff6fa48ab6d0eaa6fab843f5493 /src | |
| parent | fbb92047d7a0e4f3f2eacd749bb3c484d3b3bc88 (diff) | |
Core/Auras: added sanity checks for area auras having a different owner unit than caster
Closes #21517
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 17 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 7 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index ae18d81c7f3..3c74c75018a 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1019,8 +1019,20 @@ bool Aura::CanBeSaved() const // Check if aura is single target, not only spell info if (GetCasterGUID() != GetOwner()->GetGUID()) - if (GetSpellInfo()->IsSingleTarget() || IsSingleTarget()) + { + // owner == caster for area auras, check for possible bad data in DB + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if (!GetSpellInfo()->Effects[i].IsEffect()) + continue; + + if (GetSpellInfo()->Effects[i].IsTargetingArea() || GetSpellInfo()->Effects[i].IsAreaAuraEffect()) + return false; + } + + if (IsSingleTarget() || GetSpellInfo()->IsSingleTarget()) return false; + } // Can't be saved - aura handler relies on calculated amount and changes it if (HasEffectType(SPELL_AURA_CONVERT_RUNE)) @@ -2521,6 +2533,9 @@ void UnitAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* ca } 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 12c4408c84f..f8a2f8b5ef2 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4814,6 +4814,13 @@ void SpellMgr::LoadSpellInfoCorrections() if (spellInfo->IsPassive() && GetTalentSpellCost(i)) if (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET) spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER); + + // Area auras may not target area (they're self cast) + if (spellInfo->Effects[j].IsAreaAuraEffect() && spellInfo->Effects[j].IsTargetingArea()) + { + spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER); + spellInfo->Effects[j].TargetB = SpellImplicitTargetInfo(0); + } } // disable proc for magnet auras, they're handled differently |
