Jump to content
TrinityCore

Help with implementing legion trinket procs (AshamaneCore, Legion 7.3.5)


frostys11
 Share

Recommended Posts

Hey again,  I'm implementing the script for the Aman'thuls Vision trinket and the procs are working correct although it procs from pretty much anything like mounting etc. Is there anyway I can change that? I know this might have to do with the spellfamily masks in the spellclassoptions.db2 file. However, how does bit mask matching actually work? I tried to add a new bit mask in the spell_proc table in trinitycore but was unable to get it to work correctly. I could hardcode it in the script files to trigger from the spells I want but that would be an ugly solution in my opinion.

The second question is that I get the wrong stat from Aman'Thul's Grandeur buff (http://www.wowhead.com/spell=256832/amanthuls-grandeur). I noticed it has four different auraeffects. How can i cast a spell in trintycore with a specific aura effect to get the right stat?

The third question is that I have implemented the Acrid Catalyst trinket proc and the logic works correctly but I'm getting 0 stat for the buffs and the proc chance seems to be slightly off. How could I fix these two things? I guess its a db thing since the stat needs to scale accroding to the ilvl version of the trinket? I tried to look a trinitycore documentation regarding this and I cant seem to find nor can I find it in the mangos documentation

This is the code for the two trinket implementations:

enum AcridCatalystInjector
{
    SPELL_FERVOR_OF_THE_LEGION = 253261, // Haste
    SPELL_BURTALITY_OF_THE_LEGION = 255742, // Critical
    SPELL_MALICE_OF_THE_LEGION = 255744, // Mastery
    SPELL_CYCLE_OF_THE_LEGION = 253260 // Haste, Mastery, and Critical
};

// Item - 151955: Acrid Catalyst Injector
// 253259 - Item - Antorus, the Burning Throne (End raid of legion expansion)
template <uint32 CriticalSpellId, uint32 HasteSpellId, uint32 MasterySpellId>
class SpellItemAcridCatalystInjector : public SpellScriptLoader
{
public:
    SpellItemAcridCatalystInjector(char const* ScriptName) : SpellScriptLoader(ScriptName) { }

    template <uint32 Critical, uint32 Haste, uint32 Mastery>
    class SpellItemAcridCatalystInjectorAuraScript : public AuraScript
    {
        PrepareAuraScript(SpellItemAcridCatalystInjectorAuraScript);

        bool Validate(SpellInfo const* /*spellInfo*/) override
        {
            return ValidateSpellInfo(
                {
                    Critical,
                    Haste,
                    Mastery
                });
        }

        void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
        {
            /*if (eventInfo.GetHitMask() & PROC_HIT_CRITICAL)
            {*/
                static std::vector<uint32> const triggeredSpells[1] =
                {
                    { Critical, Haste, Mastery }
                };

                PreventDefaultAction();
                Unit* caster = eventInfo.GetActor();
                std::vector<uint32> const& randomSpells = triggeredSpells[0];
                if (randomSpells.empty())
                    return;

                uint32 spellId = Trinity::Containers::SelectRandomContainerElement(randomSpells);

                caster->CastSpell(caster, spellId, true, nullptr, aurEff);

                for (std::vector<uint32>::const_iterator it = randomSpells.begin(); it != randomSpells.end(); ++it)
                {
                    if (caster->HasAura((*it)))
                    {
                        auto trinketAura = caster->GetAura((*it));
                        if (trinketAura->GetStackAmount() >= 5)
                        {
                            caster->CastSpell(caster, SPELL_CYCLE_OF_THE_LEGION, true, nullptr, aurEff);
                            caster->RemoveAura(Critical);
                            caster->RemoveAura(Haste);
                            caster->RemoveAura(Mastery);
                            break;
                        }
                    }
                }
            //}
        }

        void Register() override
        {
            OnEffectProc += AuraEffectProcFn(SpellItemAcridCatalystInjectorAuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
        }
    };

    AuraScript* GetAuraScript() const override
    {
        return new SpellItemAcridCatalystInjectorAuraScript<CriticalSpellId, HasteSpellId, MasterySpellId>();
    }
};

enum AmanThulsVision
{
    SPELL_GLIMPSE_OF_ENLIGHTENMENT = 256818,
    SPELL_AMANTHULS_GRANDEUR = 256832
};

// Item - 154172: Aman'Thul's Vision
// 256817 - Item - Antorus, the Burning Throne (End raid of legion expansion)
template <uint32 GlimpseOfEnlightenmentSpellId, uint32 AmanthulsGrandeurSpellId>
class SpellItemAmanThulsVision : public SpellScriptLoader
{
public:
    SpellItemAmanThulsVision(char const* ScriptName) : SpellScriptLoader(ScriptName) { }

    template <uint32 GlimpseOfEnlightenment, uint32 AmanthulsGrandeur>
    class SpellItemAmanThulsVisionAuraScript : public AuraScript
    {
        PrepareAuraScript(SpellItemAmanThulsVisionAuraScript);

        bool Validate(SpellInfo const* /*spellInfo*/) override
        {
            return ValidateSpellInfo(
                {
                    GlimpseOfEnlightenment,
                    AmanthulsGrandeur
                });
        }

        void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
        {
            static std::vector<uint32> const triggeredSpells[1] =
            {
                { GlimpseOfEnlightenment, AmanthulsGrandeur }
            };
            PreventDefaultAction();
            Unit* caster = eventInfo.GetActor();
            caster->CastSpell(caster, GlimpseOfEnlightenment, true, nullptr, aurEff);
            //AuraEffect* test = caster->GetAuraEffect(256817, EFFECT_2, GetCasterGUID());

      
            caster->CastSpell(caster, AmanthulsGrandeur, true, nullptr, aurEff); //<--- How do I get the specific aureffect from SPELL_AMANTHULS_GRANDEUR?

            //AuraEffect* test2 = caster->GetAuraEffect(SPELL_AMANTHULS_GRANDEUR, EFFECT_2, GetCasterGUID());

            //caster->CastSpell(caster, AmanthulsGrandeur, true, nullptr, aurEff);
        }

        void Register() override
        {
            OnEffectProc += AuraEffectProcFn(SpellItemAmanThulsVisionAuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
        }
    };

    AuraScript* GetAuraScript() const override
    {
        return new SpellItemAmanThulsVisionAuraScript<GlimpseOfEnlightenmentSpellId, AmanthulsGrandeurSpellId>();
    }
};

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By oRKENtaL
      Hello,
      I'm trying to get the hang of SmartAI but it's proving to be difficult. Starting with someone easy, I picked a random npc (Jaina, entry id 35320) and doing
      event is on recieve_emote (id 17, which is kiss)
      the action is DIE (37)
      And target self.


      UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 35320;
      DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 35320); INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES (35320, 0, 0, 0, 22, 0, 100, 0, 17, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Lady Jaina Proudmoore - Received Emote 17 - Kill Self');
      But the problem is that it doesn't work. I've resspawned her, restarted the server but she still doesn't die.
      Any help would be most appreciated.

      Thanks!
    • By LordPsyan
      I am trying to make a spell script, something I have never messed with before. Simply put, a spell is cast upon you when you touch an object. I have that working, since that is a game object script. it also adds a 30 second duration, which also works, but does not show the countdown timer like many other spells. I think this needs to be done in a spell script, instead of newSpell->SetDuration(30000); in gameobject script.
      I cannot figure out how to get the timer working, and then get another spell cast upon the player.
      I have this set in my spell script, so if the spell is removed by any other means, the script shouldn't do anything:
                      if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
                          return;
      so to sum up my question:
      spell cast upon player. timer counts down 30 seconds, which gives player enough time to remove the spell, then at end of countdown, another spell cast upon player. Can anyone give me some sample code? I tried working with professor putricide spell codes, and the life bloom spell, but its just not triggering. Yes I added an entry in spell_script_names...
       
      Thanks.
    • By AutoFX
      I greet you gave comends such as cd ~ /
        git clone git b 3.3.5: //github.com/TrinityCore/TrinityCore.git but it does not work I tried git clone git b 3.3.5: //github.com/TrinityCore/TrinityCore.git
        and so it entered the Komeda not work in putty trying to do this on Linux but Tables of your Komeda does not work I do not know how I give myself the trick ....
×
×
  • Create New...