diff --git a/Source/Framework/Constants/Spells/SpellAuraConst.cs b/Source/Framework/Constants/Spells/SpellAuraConst.cs index 7fe19ee93..46a368abd 100644 --- a/Source/Framework/Constants/Spells/SpellAuraConst.cs +++ b/Source/Framework/Constants/Spells/SpellAuraConst.cs @@ -495,7 +495,7 @@ namespace Framework.Constants ModMovementForceMagnitude = 485, Unk486 = 486, CosmeticMounted = 487, - Unk488 = 488, + DisableGravity = 488, ModAlternativeDefaultLanguage = 489, // NYI Unk490 = 490, Unk491 = 491, diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 446620e13..6ff75aa64 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -5790,7 +5790,7 @@ namespace Game.Entities if (HasAuraType(AuraType.Hover)) setCompoundState.StateChanges.Add(new MoveSetCompoundState.MoveStateChange(ServerOpcodes.MoveSetHovering, m_movementCounter++)); - if (HasAuraType(AuraType.ModRootDisableGravity) || HasAuraType(AuraType.ModStunDisableGravity)) + if (HasAuraType(AuraType.ModRootDisableGravity) || HasAuraType(AuraType.ModStunDisableGravity) || HasAuraType(AuraType.DisableGravity)) setCompoundState.StateChanges.Add(new MoveSetCompoundState.MoveStateChange(ServerOpcodes.MoveDisableGravity, m_movementCounter++)); if (HasAuraType(AuraType.CanTurnWhileFalling)) diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index e5a0d3163..62ac8f192 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -2586,6 +2586,21 @@ namespace Game.Spells target.SetControlled(false, UnitState.Fleeing); } + static void HandleAuraDisableGravity(Unit target, bool apply) + { + // Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template. + if (!apply) + if (target.HasAuraType(AuraType.ModRootDisableGravity) + || target.HasAuraType(AuraType.ModStunDisableGravity) + || target.HasAuraType(AuraType.DisableGravity) + || (target.IsCreature() && target.ToCreature().IsFloating())) + return; + + if (target.SetDisableGravity(apply)) + if (!apply && !target.IsFlying()) + target.GetMotionMaster().MoveFall(); + } + [AuraEffectHandler(AuraType.ModRootDisableGravity)] void HandleAuraModRootAndDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) { @@ -2596,13 +2611,7 @@ namespace Game.Spells target.SetControlled(apply, UnitState.Root); - // Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template. - if (!apply && (target.HasAuraType(GetAuraType()) || target.HasAuraType(AuraType.ModRootDisableGravity) || (target.IsCreature() && target.ToCreature().IsFloating()))) - return; - - if (target.SetDisableGravity(apply)) - if (!apply && !target.IsFlying()) - target.GetMotionMaster().MoveFall(); + HandleAuraDisableGravity(target, apply); } [AuraEffectHandler(AuraType.ModStunDisableGravity)] @@ -2618,13 +2627,18 @@ namespace Game.Spells if (apply) target.GetThreatManager().EvaluateSuppressed(); - // Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template. - if (!apply && (target.HasAuraType(GetAuraType()) || target.HasAuraType(AuraType.ModStunDisableGravity) || (target.IsCreature() && target.ToCreature().IsFloating()))) + HandleAuraDisableGravity(target, apply); + } + + [AuraEffectHandler(AuraType.DisableGravity)] + void HandleAuraDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) + { + if (!mode.HasAnyFlag(AuraEffectHandleModes.Real)) return; - if (target.SetDisableGravity(apply)) - if (!apply && !target.IsFlying()) - target.GetMotionMaster().MoveFall(); + Unit target = aurApp.GetTarget(); + + HandleAuraDisableGravity(target, apply); } /***************************/