Core/Auras: Implement SPELL_AURA_DISABLE_GRAVITY
Port From (https://github.com/TrinityCore/TrinityCore/commit/765beae741ea0f332fe2ac1b4180b632462d1611)
This commit is contained in:
@@ -495,7 +495,7 @@ namespace Framework.Constants
|
|||||||
ModMovementForceMagnitude = 485,
|
ModMovementForceMagnitude = 485,
|
||||||
Unk486 = 486,
|
Unk486 = 486,
|
||||||
CosmeticMounted = 487,
|
CosmeticMounted = 487,
|
||||||
Unk488 = 488,
|
DisableGravity = 488,
|
||||||
ModAlternativeDefaultLanguage = 489, // NYI
|
ModAlternativeDefaultLanguage = 489, // NYI
|
||||||
Unk490 = 490,
|
Unk490 = 490,
|
||||||
Unk491 = 491,
|
Unk491 = 491,
|
||||||
|
|||||||
@@ -5790,7 +5790,7 @@ namespace Game.Entities
|
|||||||
if (HasAuraType(AuraType.Hover))
|
if (HasAuraType(AuraType.Hover))
|
||||||
setCompoundState.StateChanges.Add(new MoveSetCompoundState.MoveStateChange(ServerOpcodes.MoveSetHovering, m_movementCounter++));
|
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++));
|
setCompoundState.StateChanges.Add(new MoveSetCompoundState.MoveStateChange(ServerOpcodes.MoveDisableGravity, m_movementCounter++));
|
||||||
|
|
||||||
if (HasAuraType(AuraType.CanTurnWhileFalling))
|
if (HasAuraType(AuraType.CanTurnWhileFalling))
|
||||||
|
|||||||
@@ -2586,6 +2586,21 @@ namespace Game.Spells
|
|||||||
target.SetControlled(false, UnitState.Fleeing);
|
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)]
|
[AuraEffectHandler(AuraType.ModRootDisableGravity)]
|
||||||
void HandleAuraModRootAndDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
void HandleAuraModRootAndDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||||
{
|
{
|
||||||
@@ -2596,13 +2611,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
target.SetControlled(apply, UnitState.Root);
|
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.
|
HandleAuraDisableGravity(target, apply);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AuraEffectHandler(AuraType.ModStunDisableGravity)]
|
[AuraEffectHandler(AuraType.ModStunDisableGravity)]
|
||||||
@@ -2618,13 +2627,18 @@ namespace Game.Spells
|
|||||||
if (apply)
|
if (apply)
|
||||||
target.GetThreatManager().EvaluateSuppressed();
|
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.
|
HandleAuraDisableGravity(target, apply);
|
||||||
if (!apply && (target.HasAuraType(GetAuraType()) || target.HasAuraType(AuraType.ModStunDisableGravity) || (target.IsCreature() && target.ToCreature().IsFloating())))
|
}
|
||||||
|
|
||||||
|
[AuraEffectHandler(AuraType.DisableGravity)]
|
||||||
|
void HandleAuraDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||||
|
{
|
||||||
|
if (!mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target.SetDisableGravity(apply))
|
Unit target = aurApp.GetTarget();
|
||||||
if (!apply && !target.IsFlying())
|
|
||||||
target.GetMotionMaster().MoveFall();
|
HandleAuraDisableGravity(target, apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user