Core/Auras: added sanity checks for area auras having a different owner unit than caster
Port From (https://github.com/TrinityCore/TrinityCore/commit/6c642f33b58ce81eb5b1345a7f0eb89de6040251)
This commit is contained in:
@@ -965,9 +965,21 @@ namespace Game.Spells
|
||||
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
|
||||
foreach (SpellEffectInfo effect in GetSpellInfo().GetEffects())
|
||||
{
|
||||
if (effect == null || !effect.IsEffect())
|
||||
continue;
|
||||
|
||||
if (effect.IsTargetingArea() || effect.IsAreaAuraEffect())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsSingleTarget() || GetSpellInfo().IsSingleTarget())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetSpellInfo().HasAttribute(SpellCustomAttributes.AuraCannotBeSaved))
|
||||
return false;
|
||||
@@ -2547,6 +2559,9 @@ namespace Game.Spells
|
||||
}
|
||||
else
|
||||
{
|
||||
Cypher.Assert(caster != null, $"Area aura (Id: {GetSpellInfo().Id}) has nullptr caster ({GetCasterGUID()})");
|
||||
Cypher.Assert(GetCasterGUID() == GetUnitOwner().GetGUID(), $"Area aura (Id: {GetSpellInfo().Id}) has owner ({GetUnitOwner().GetGUID()}) different to caster ({GetCasterGUID()})");
|
||||
|
||||
// skip area update if owner is not in world!
|
||||
if (!GetUnitOwner().IsInWorld)
|
||||
continue;
|
||||
|
||||
@@ -2962,6 +2962,13 @@ namespace Game.Entities
|
||||
if (effect.TargetA.GetSelectionCategory() == SpellTargetSelectionCategories.Cone || effect.TargetB.GetSelectionCategory() == SpellTargetSelectionCategories.Cone)
|
||||
if (MathFunctions.fuzzyEq(spellInfo.ConeAngle, 0.0f))
|
||||
spellInfo.ConeAngle = 90.0f;
|
||||
|
||||
// Area auras may not target area (they're self cast)
|
||||
if (effect.IsAreaAuraEffect() && effect.IsTargetingArea())
|
||||
{
|
||||
effect.TargetA = new(Targets.UnitCaster);
|
||||
effect.TargetB = new();
|
||||
}
|
||||
}
|
||||
|
||||
// disable proc for magnet auras, they're handled differently
|
||||
|
||||
Reference in New Issue
Block a user