• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Cat Form Custom Display Script

Status
Not open for further replies.

Mathex

Respected Member
Hello I've made a "hack fix" for changing the catform's display id when the aura is applied, somehow it doesn't work, here's the script:

Code:
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "Player.h"

enum Spells
{
    SPELL_TRIGGERED = 768
};

class spell_ex_768 : public SpellScriptLoader
{
    public:
        spell_ex_768() : SpellScriptLoader("spell_ex_768") { }

        class spell_ex_768AuraScript : public AuraScript
        {
            PrepareAuraScript(spell_ex_768AuraScript);
            bool Validate(SpellInfo const* /*spellEntry*/)
            {
                if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
                    return false;
                return true;
            }

            bool Load()
            {
                if (Unit* caster = GetCaster())
                    if (caster->GetTypeId() == TYPEID_PLAYER)
                        return true;
                return false;
            }

            void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!");
                Unit* target = GetTarget();
				Player* caster = GetCaster()->ToPlayer();
                
				if (caster->getRace() == RACE_TAUREN)
				{
					caster->SetDisplayId(43775);
				}

				if (caster->getRace() == RACE_NIGHTELF)
				{
					caster->SetDisplayId(43765);
				}
            }

            void Register()
            {
                AfterEffectApply += AuraEffectApplyFn(spell_ex_768AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
            }
        };

        AuraScript* GetAuraScript() const
        {
            return new spell_ex_768AuraScript();
        }
};

void AddSC_DruidHax()
{
    new spell_ex_768;
}

This gives no errors compiling but yeah..
Also added it in the spell_script_names table too :)

So if anyone knew anything I did wrong it'd be great :)
--Also willing to know where the morph id for druid forms is called or defined :)
 
Last edited:

Tommy

Founder
3.3.5a TrinityCore - Eluna, the model is the MoP cat form, tested with .morph :)

So you have converted Mists models on your 3.3.5a server? I see.

Are you sure you set it up? I see you set it up in the ScriptNames, but you never mention the ScriptLoader.cpp. If you have, I'll test the script and fix it up for you.
 

Mathex

Respected Member
So you have converted Mists models on your 3.3.5a server? I see.

Are you sure you set it up? I see you set it up in the ScriptNames, but you never mention the ScriptLoader.cpp. If you have, I'll test the script and fix it up for you.

Here's some pictures of my "stuff"

Firstly, my scriptloader.cpp:
7DKDnSO.png


And secondly my database
GgFJxDH.png
 

Tommy

Founder
I'm assuming you added it in your CMakeLists.txt too?

Did you test normal 3.3.5a displayIds first? Erm, I'll fix up your script.
 

Mathex

Respected Member
I'm assuming you added it in your CMakeLists.txt too?

Did you test normal 3.3.5a displayIds first? Erm, I'll fix up your script.

I did try the display ids first, but yeah it loads fine, it said when I didn't add it to the spell_script_names something about it was not added :p Thank you, can't wait :)
 

Tommy

Founder
However, you might be getting this:

http://prntscr.com/11pjxe

Seeing the spell doesn't match the dbc effect.


I also looked in the Spell.dbc file and found the correct SPELL_AURA: (DBC): http://prntscr.com/11pqky

Effect: SPELL_AURA_MOD_SHAPESHIFT


Boom:

163bd7c926cd492c9b35356.png





Code:
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "Player.h"

enum Spells
{
    SPELL_TRIGGERED = 768
};

class spell_ex_768 : public SpellScriptLoader
{
public:
    spell_ex_768() : SpellScriptLoader("spell_ex_768") { }

    class spell_ex_768_AuraScript : public AuraScript
    {
        PrepareAuraScript(spell_ex_768_AuraScript);

        bool Validate(SpellInfo const* /*spellEntry*/)
        {
            if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
                return false;
            return true;
        }

        bool Load()
        {
            if (Unit* caster = GetCaster())
                if (caster->GetTypeId() == TYPEID_PLAYER)
                    return true;
            return false;
        }

        void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
        {
            sLog->outError(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!");
            Player* caster = GetCaster()->ToPlayer();

            if (caster->getRace() == RACE_TAUREN)
                caster->SetDisplayId(43775);
            if (caster->getRace() == RACE_NIGHTELF)
                caster->SetDisplayId(43765);
        };

        void Register()
        {
            AfterEffectApply += AuraEffectApplyFn(spell_ex_768_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
        }
    };

    AuraScript* GetAuraScript() const
    {
        return new spell_ex_768_AuraScript();
    }
};

void AddSC_DruidHax()
{
    new spell_ex_768;
}


As you see, I changed it up a bit. Enjoy!
 

Mathex

Respected Member
Works as a charm, I'd like to thank you very much Tommy, great and fast help, nice explanation also. Thank you very very much :)
 
Status
Not open for further replies.
Top