Core/Units: Added helper methods to cancel mount/shapeshift auras

Port From (https://github.com/TrinityCore/TrinityCore/commit/0b16756172b2c3cc78b0861af86b93daae60edda)
This commit is contained in:
Hondacrx
2025-05-19 17:42:40 -04:00
parent 3e0e2354b7
commit f62d303ec7
3 changed files with 58 additions and 2 deletions
@@ -938,6 +938,18 @@ namespace Game.Entities
return true;
}
void CancelMountAura(bool force)
{
if (!HasAuraType(AuraType.Mounted))
return;
RemoveAurasByType(AuraType.Mounted, aurApp =>
{
SpellInfo spellInfo = aurApp.GetBase().GetSpellInfo();
return force || (!spellInfo.HasAttribute(SpellAttr0.NoAuraCancel) && spellInfo.IsPositive() && !spellInfo.IsPassive());
});
}
public MountCapabilityRecord GetMountCapability(uint mountType)
{
if (mountType == 0)
@@ -1043,6 +1055,14 @@ namespace Game.Entities
if (IsLoading())
return;
var spellShapeshiftForm = CliDB.SpellShapeshiftFormStorage.LookupByKey(GetShapeshiftForm());
if (spellShapeshiftForm != null)
{
uint mountType = spellShapeshiftForm.MountTypeID;
if (mountType != 0 && GetMountCapability(mountType) == null)
CancelTravelShapeshiftForm(AuraRemoveMode.Interrupt);
}
var mounts = GetAuraEffectsByType(AuraType.Mounted);
foreach (AuraEffect aurEff in mounts.ToArray())
{