Core/Units: Added helper methods to cancel mount/shapeshift auras
Port From (https://github.com/TrinityCore/TrinityCore/commit/0b16756172b2c3cc78b0861af86b93daae60edda)
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user