diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2024-11-10 20:23:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-10 20:23:09 +0100 |
commit | 765beae741ea0f332fe2ac1b4180b632462d1611 (patch) | |
tree | 3b77df76ed48d002a78d268f86c91df3399cafcb | |
parent | d6ae7030dac388bbdf79954bd235c98209b53630 (diff) |
Core/Auras: Implement SPELL_AURA_DISABLE_GRAVITY (#30365)
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraDefines.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 39 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 1 |
4 files changed, 29 insertions, 15 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index bca4dc9b59e..3021111b303 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -24574,7 +24574,7 @@ void Player::SendInitialPacketsAfterAddToMap() if (HasAuraType(SPELL_AURA_HOVER)) setCompoundState.StateChanges.emplace_back(SMSG_MOVE_SET_HOVERING, m_movementCounter++); - if (HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY)) + if (HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY) || HasAuraType(SPELL_AURA_DISABLE_GRAVITY)) setCompoundState.StateChanges.emplace_back(SMSG_MOVE_DISABLE_GRAVITY, m_movementCounter++); if (HasAuraType(SPELL_AURA_CAN_TURN_WHILE_FALLING)) diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h index d5c86f32b25..537bc68defa 100644 --- a/src/server/game/Spells/Auras/SpellAuraDefines.h +++ b/src/server/game/Spells/Auras/SpellAuraDefines.h @@ -579,7 +579,7 @@ enum AuraType : uint32 SPELL_AURA_MOD_MOVEMENT_FORCE_MAGNITUDE = 485, SPELL_AURA_486 = 486, SPELL_AURA_COSMETIC_MOUNTED = 487, - SPELL_AURA_488 = 488, + SPELL_AURA_DISABLE_GRAVITY = 488, SPELL_AURA_MOD_ALTERNATIVE_DEFAULT_LANGUAGE = 489, SPELL_AURA_490 = 490, SPELL_AURA_491 = 491, diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 3c65a72b5f8..14b3e40b3ed 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -557,7 +557,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleModMovementForceMagnitude, //485 SPELL_AURA_MOD_MOVEMENT_FORCE_MAGNITUDE &AuraEffect::HandleNULL, //486 &AuraEffect::HandleCosmeticMounted, //487 SPELL_AURA_COSMETIC_MOUNTED - &AuraEffect::HandleNULL, //488 + &AuraEffect::HandleAuraDisableGravity, //488 SPELL_AURA_DISABLE_GRAVITY &AuraEffect::HandleModAlternativeDefaultLanguage, //489 SPELL_AURA_MOD_ALTERNATIVE_DEFAULT_LANGUAGE &AuraEffect::HandleNULL, //490 &AuraEffect::HandleNULL, //491 @@ -3144,6 +3144,21 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, target->SetControlled(false, UNIT_STATE_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(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) + || target->HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY) + || target->HasAuraType(SPELL_AURA_DISABLE_GRAVITY) + || (target->IsCreature() && target->ToCreature()->IsFloating())) + return; + + if (target->SetDisableGravity(apply)) + if (!apply && !target->IsFlying()) + target->GetMotionMaster()->MoveFall(); +} + void AuraEffect::HandleAuraModRootAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const { if (!(mode & AURA_EFFECT_HANDLE_REAL)) @@ -3153,13 +3168,7 @@ void AuraEffect::HandleAuraModRootAndDisableGravity(AuraApplication const* aurAp target->SetControlled(apply, UNIT_STATE_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(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY) || (target->IsCreature() && target->ToCreature()->IsFloating()))) - return; - - if (target->SetDisableGravity(apply)) - if (!apply && !target->IsFlying()) - target->GetMotionMaster()->MoveFall(); + ::HandleAuraDisableGravity(target, apply); } void AuraEffect::HandleAuraModStunAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -3174,13 +3183,17 @@ void AuraEffect::HandleAuraModStunAndDisableGravity(AuraApplication const* aurAp 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(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || (target->IsCreature() && target->ToCreature()->IsFloating()))) + ::HandleAuraDisableGravity(target, apply); +} + +void AuraEffect::HandleAuraDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const +{ + if (!(mode & AURA_EFFECT_HANDLE_REAL)) return; - if (target->SetDisableGravity(apply)) - if (!apply && !target->IsFlying()) - target->GetMotionMaster()->MoveFall(); + Unit* target = aurApp->GetTarget(); + + ::HandleAuraDisableGravity(target, apply); } /***************************/ diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index aab03b03cf9..78b45cfd5c4 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -204,6 +204,7 @@ class TC_GAME_API AuraEffect void HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraModRootAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraModStunAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandleAuraDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const; // charm void HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const; |