Core/Spells: Implemented SPELL_ATTR9_ONLY_WHEN_ILLEGALLY_MOUNTED
Port From (https://github.com/TrinityCore/TrinityCore/commit/1f3af18e3a17096748a621c9171feb30047287be)
This commit is contained in:
@@ -1968,7 +1968,7 @@ namespace Framework.Constants
|
||||
{
|
||||
ForceDestLocation = 0x01, // Force Dest Location DESCRIPTION Ignores collision with terrain (unsure if it also ignores terrain height and can go under map)
|
||||
ModInvisIncludesParty = 0x02, // Mod Invis Includes Party 1@Attr9 DESCRIPTION Causes invisibility auras to ignore "can always see party member invis" rule
|
||||
RestrictedFlightArea = 0x04, // 2
|
||||
OnlyWhenIllegallyMounted = 0x04, // Only When Illegally Mounted
|
||||
Unk3 = 0x08, // 3
|
||||
SpecialDelayCalculation = 0x10, // 4
|
||||
SummonPlayerTotem = 0x20, // 5
|
||||
|
||||
@@ -5148,6 +5148,23 @@ namespace Game.Spells
|
||||
|
||||
if (unitCaster.IsInCombat() && !m_spellInfo.CanBeUsedInCombat(unitCaster))
|
||||
return SpellCastResult.AffectingCombat;
|
||||
|
||||
if (m_spellInfo.HasAttribute(SpellAttr9.OnlyWhenIllegallyMounted))
|
||||
{
|
||||
bool hasInvalidMountAura = unitCaster.GetAuraEffectsByType(AuraType.Mounted).Any(mountEffect =>
|
||||
{
|
||||
uint mountType = (uint)mountEffect.GetSpellEffectInfo().MiscValueB;
|
||||
var mountEntry = Global.DB2Mgr.GetMount(mountEffect.GetId());
|
||||
if (mountEntry != null)
|
||||
mountType = mountEntry.MountTypeID;
|
||||
|
||||
var mountCapability = unitCaster.GetMountCapability(mountType);
|
||||
return mountCapability == null || mountCapability.Id != mountEffect.GetAmount();
|
||||
});
|
||||
|
||||
if (!hasInvalidMountAura)
|
||||
return SpellCastResult.OnlyMounted;
|
||||
}
|
||||
}
|
||||
|
||||
// Check vehicle flags
|
||||
|
||||
Reference in New Issue
Block a user