Jump to content

[patch]Tricks of the Trade, Misdirection


Auntie Mangos

Recommended Posts

  • 40 years later...

Description of the feature?

none

For which repository revision was the patch created?

10409

Is there a thread in the bug report section or at lighthouse?

Spell.h

         void EffectTitanGrip(SpellEffectIndex eff_idx);
         void EffectEnchantItemPrismatic(SpellEffectIndex eff_idx);
         void EffectPlayMusic(SpellEffectIndex eff_idx); 
+         void EffectRedirectThreat(SpellEffectIndex eff_idx);
         void EffectSpecCount(SpellEffectIndex eff_idx);
         void EffectActivateSpec(SpellEffectIndex eff_idx);

SpellAuras.cpp

                   return;
            }

+             case 34477: //Misdirection    
+             case 57934: //Tricks of Trade    
+             {    
+                 if(Unit * caster = GetCaster())    
+                     caster->SetThreatRedirectionTarget(0, 0);    
+                 return;    
+             }    
            case 58600:                                     // Restricted Flight Area    
            {    
                AreaTableEntry const* area = GetAreaEntryByAreaID(target->GetAreaId());

SpellEffects.cpp

    &Spell::EffectProspecting,                              //127 SPELL_EFFECT_PROSPECTING Prospecting spell    
    &Spell::EffectApplyAreaAura,                            //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
    &Spell::EffectApplyAreaAura,                            //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY     
-    &Spell::EffectNULL,                                     //130 SPELL_EFFECT_REDIRECT_THREAT    
+    &Spell::EffectRedirectThreat,                           //130 SPELL_EFFECT_REDIRECT_THREAT    
    &Spell::EffectUnused,                                   //131 SPELL_EFFECT_131                      used in some test spells    
    &Spell::EffectPlayMusic,                                //132 SPELL_EFFECT_PLAY_MUSIC               sound id in misc value (SoundEntries.dbc)    
    &Spell::EffectUnlearnSpecialization,                    //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION   unlearn profession specialization
...    ...    
@@ -8348,6 +8348,17 @@ void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx )    
    item->RestoreCharges();    
}    

+void Spell::EffectRedirectThreat(SpellEffectIndex eff_idx)    
+{    
+    if(unitTarget)    
+    {    
+        m_caster->SetThreatRedirectionTarget(unitTarget->GetGUID(), (uint32)damage);    
+    
+        // Tricks of trade hacky buff applying (15% damage increase)    
+        if( m_spellInfo->Id == 57934 )    
+            unitTarget->CastSpell(unitTarget, 57933, true);    
+    }    
+}    
void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx )    
{    
    if (unitTarget->GetTypeId() != TYPEID_PLAYER)

SpellMgr.cpp

            if( spellInfo_1->SpellIconID == 2285 && spellInfo_2->SpellIconID == 2285 )    
                return false;    

+            //Tricks of Trade
+            if( spellInfo_1->SpellIconID == 3413 && spellInfo_2->SpellIconID == 3413 )
+                return false;
+    
            // Garrote -> Garrote-Silence (multi-family check)
            if( spellInfo_1->SpellIconID == 498 && spellInfo_2->SpellIconID == 498 && spellInfo_2->SpellVisual[0] == 0 )
                return false;

ThreatManager.cpp

    float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, crit, schoolMask, pThreatSpell);    

+    if( pVictim->GetThreatRedirectionPercent() && threat > 0.0f )    
+    {    
+        float redirectedThreat = threat * pVictim->GetThreatRedirectionPercent() / 100;    
+        threat -= redirectedThreat;    
+        if(Unit *unit = pVictim->GetMisdirectionTarget())    
+            iThreatContainer.addThreat(unit, redirectedThreat);    
+    }    
+    
    HostileReference* ref = iThreatContainer.addThreat(pVictim, threat);    
    // Ref is online    
    if (ref)

Unit.cpp

    m_charmInfo = NULL;    

+    m_ThreatRedirectionPercent = 0;
+    m_misdirectionTargetGUID = 0;
+    
    // remove aurastates allowing special moves
    for(int i=0; i < MAX_REACTIVE; ++i)    
        m_reactiveTimer[i] = 0;

Unit.h

        void AddPetAura(PetAura const* petSpell);    
        void RemovePetAura(PetAura const* petSpell);

+        void SetThreatRedirectionTarget(uint64 guid, uint32 pct)    
+        {
+            m_misdirectionTargetGUID = guid;    
+            m_ThreatRedirectionPercent = pct;    
+        }    
+        uint32 GetThreatRedirectionPercent() { return m_ThreatRedirectionPercent; }
+        Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetMap()->GetUnit(m_misdirectionTargetGUID) : NULL; }    
+    
        // Movement info    
        MovementInfo m_movementInfo;    

...    ...    
@@ -1971,6 +1979,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject    
        ComboPointHolderSet m_ComboPointHolders;

        GuardianPetList m_guardianPets;
+        uint32 m_ThreatRedirectionPercent;    
+        uint64 m_misdirectionTargetGUID;

        uint64 m_TotemSlot[MAX_TOTEM_SLOT];    
};

good luck

Link to comment
Share on other sites

sure, but i think this patch have some mistake. anyone help

Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; }

this bug fix.

this patch make july 21.

so change some code. but i don't know so, help us.

Link to comment
Share on other sites

I have merge the patch from Toinan67 and ascent to a useable patch with

-handles correctly Tricks of the Trade and Misdirection. 30 sec buff apply, then 6 sec (4 for misdirection) buff when the player does anything that modify his threat

- didn't test it

I have test and it works great

The patchfile: http://paste2.org/p/968584

Enjoy

use my patch? don't have bug :D

In my testing the player have not the 4 or 6 sec buff

Link to comment
Share on other sites

Unit.h

-               #include "map.h"
-               Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; }
+              Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetMap()->GetUnit(m_misdirectionTargetGUID) : NULL; }

first post add ^^;;

Link to comment
Share on other sites

I said to "prevent" crash, just for safe

your care is good, but,

And this will most wrong way from possible.

Remember simple thing: never never add new includes to .h file if you not 100% sure that this correct and will not add unexpected results.

In C/C++ very easy get cyclic header dependences with very unclear error messages.

Alswasy instead if possible use forward class/structure declarations.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use