Core/Auras: Convert most rules from Aura::CanBeSaved to a custom spell attribute

Port From (https://github.com/TrinityCore/TrinityCore/commit/b4aa698acb88e1a74bc22d97279148a567b88cad)
This commit is contained in:
hondacrx
2021-03-08 14:26:51 -05:00
parent c54c27f831
commit 5eea1fec98
4 changed files with 37 additions and 47 deletions
@@ -1996,10 +1996,11 @@ namespace Framework.Constants
ReqCasterBehindTarget = 0x20000,
AllowInflightTarget = 0x40000,
NeedsAmmoData = 0x80000,
BinarySpell = 0x00100000,
SchoolmaskNormalWithMagic = 0x00200000,
LiquidAura = 0x00400000,
IsTalent = 0x00800000
BinarySpell = 0x100000,
SchoolmaskNormalWithMagic = 0x200000,
LiquidAura = 0x400000,
IsTalent = 0x800000,
AuraCannotBeSaved = 0x1000000
}
#endregion
+1 -43
View File
@@ -957,49 +957,7 @@ namespace Game.Spells
if (GetSpellInfo().IsSingleTarget())
return false;
// No point in saving this, since the stable dialog can't be open on aura load anyway.
if (HasEffectType(AuraType.OpenStable))
return false;
// Can't save vehicle auras, it requires both caster & target to be in world
if (HasEffectType(AuraType.ControlVehicle))
return false;
// do not save bind sight auras
if (HasEffectType(AuraType.BindSight))
return false;
// no charming auras (taking direct control)
if (HasEffectType(AuraType.ModPossess) || HasEffectType(AuraType.ModPossessPet))
return false;
// no charming auras can be saved
if (HasEffectType(AuraType.ModCharm) || HasEffectType(AuraType.AoeCharm))
return false;
// no battleground player positions
if (HasEffectType(AuraType.BattleGroundPlayerPosition) || HasEffectType(AuraType.BattleGroundPlayerPositionFactional))
return false;
// Incanter's Absorbtion - considering the minimal duration and problems with aura stacking
// we skip saving this aura
// Also for some reason other auras put as MultiSlot crash core on keeping them after restart,
// so put here only these for which you are sure they get removed
switch (GetId())
{
case 44413: // Incanter's Absorption
case 40075: // Fel Flak Fire
case 55849: // Power Spark
return false;
}
// When a druid logins, he doesnt have either eclipse power, nor the marker auras, nor the eclipse buffs. Dont save them.
if (GetId() == 67483 || GetId() == 67484 || GetId() == 48517 || GetId() == 48518)
return false;
// Don't save druid forms, only the dummy. It will cast the appropriate form
// Swift Flight Flight Aquatic Stag
if (GetId() == 40120 || GetId() == 33943 || GetId() == 1066 || GetId() == 165961)
if (GetSpellInfo().HasAttribute(SpellCustomAttributes.AuraCannotBeSaved))
return false;
// don't save auras removed by proc system
+17
View File
@@ -2438,6 +2438,23 @@ namespace Game.Entities
break;
}
switch (effect.ApplyAuraName)
{
case AuraType.OpenStable: // No point in saving this, since the stable dialog can't be open on aura load anyway.
// Auras that require both caster & target to be in world cannot be saved
case AuraType.ControlVehicle:
case AuraType.BindSight:
case AuraType.ModPossess:
case AuraType.ModPossessPet:
case AuraType.ModCharm:
case AuraType.AoeCharm:
// Controlled by Battleground
case AuraType.BattleGroundPlayerPosition:
case AuraType.BattleGroundPlayerPositionFactional:
spellInfo.AttributesCu |= SpellCustomAttributes.AuraCannotBeSaved;
break;
}
switch (effect.Effect)
{
case SpellEffectName.SchoolDamage: