[3.3.5a] Problem with DK - Death Grip spell when Jump

Hi, i ’ m using the latest Rev of TC for Wotlk. I was trying to fix the Death Grip spell of Dk, the spell can be used when the caster is jumping or falling and that its wrong.

The problem in my code is that i cannot make that the code check if the caster is jumping or not, i try with :

if (!player->HasUnitState(UNIT_STATE_JUMPING))

But not success, also i was tried with if (!player->IsFalling()) and i have the same result.

What i m doing wrong?

Sorry if its a noob question but i m learning.
Sorry about the bad english.
Thanks in advance, regards.

Path: TrinitysrcserverscriptsSpellsspell_dk.cpp

[CODE]
// 49560 - Death Grip
class spell_dk_death_grip : public SpellScriptLoader
{
public:
spell_dk_death_grip() : SpellScriptLoader(“spell_dk_death_grip”) { }

    class spell_dk_death_grip_SpellScript : public SpellScript
    {
        PrepareSpellScript(spell_dk_death_grip_SpellScript);


        //CRT03
        SpellCastResult CheckCast()
        {
            
            Player* player = GetCaster()->ToPlayer();

            //check if player is jumping
            if (!player->HasUnitState(UNIT_STATE_JUMPING))
            {
              player->AddAura(74396, player); // Remove later just for check in game
              return SPELL_CAST_OK;
            }
            
            else
           {
             player->AddAura(70753, player); // Remove later just for check in game
             return SPELL_FAILED_SPELL_UNAVAILABLE;
               
           }


            return SPELL_CAST_OK;
        }
        // CRT03

void HandleDummy(SpellEffIndex /effIndex/)
{
int32 damage = GetEffectValue();
Position const* pos = GetExplTargetDest();

if (Unit* target = GetHitUnit())
{
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true);
}

        }


        void Register()
        {

OnCheckCast += SpellCheckCastFn(spell_dk_death_grip_SpellScript::CheckCast); // CRT03
OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}

    };


    SpellScript* GetSpellScript() const
    {
        return new spell_dk_death_grip_SpellScript();
    }

};[/CODE]

DK Death Grip Spell Id is 49576 Not 49560

[COLOR=rgb(136,0,0)]

try this

diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 2e9fb79..ef5ccac 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4720,6 +4720,8 @@ SpellCastResult Spell::CheckCast(bool strict)
 
         if (reqCombat && m_caster->IsInCombat() && !m_spellInfo->CanBeUsedInCombat())
             return SPELL_FAILED_AFFECTING_COMBAT;
+        if (m_spellInfo->SpellIconID == 2723 && m_caster->HasUnitState(UNIT_STATE_JUMPING) || m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
+            return SPELL_FAILED_SPELL_UNAVAILABLE;
     }
 
     // cancel autorepeat spells if cast start when moving

Fix for this already on core.