mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Auras: Use existing aura object on aura reapply/stack increase instead of creating a new one.
You can hook on reapply/stack event by checking for AURA_EFFECT_HANDLE_REAPPLY aura handler mode, AURA_EFFECT_HANDLE_REAL is now not triggered on aura refresh/stack.
This commit is contained in:
@@ -259,7 +259,8 @@ class spell_ex_66244 : public SpellScriptLoader
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_ex_66244AuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_ex_66244AuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_ex_66244AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
// AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK - makes handler to be called when aura is reapplied on target
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_ex_66244AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_ex_66244AuraScript::HandleAfterEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
|
||||
@@ -610,7 +610,7 @@ class spell_exploding_orb_hasty_grow : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_exploding_orb_hasty_grow_AuraScript::OnStackChange, EFFECT_0, SPELL_AURA_MOD_SCALE, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_exploding_orb_hasty_grow_AuraScript::OnStackChange, EFFECT_0, SPELL_AURA_MOD_SCALE, AURA_EFFECT_HANDLE_REAPPLY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ class spell_festergut_blighted_spores : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_festergut_blighted_spores_AuraScript::ExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_festergut_blighted_spores_AuraScript::ExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1232,8 +1232,6 @@ class spell_putricide_mutated_plague : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_STACK)
|
||||
return;
|
||||
uint32 healSpell = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0));
|
||||
GetTarget()->CastSpell(GetTarget(), healSpell, true, NULL, NULL, GetCasterGUID());
|
||||
}
|
||||
|
||||
@@ -1010,30 +1010,6 @@ class spell_gen_turkey_marker : public SpellScriptLoader
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_STACK)
|
||||
return;
|
||||
|
||||
// find our new aura which replaces this one aura is inserted to m_ownedAuras before old removal takes place
|
||||
Aura* newAura = GetTarget()->GetOwnedAura(GetId(), 0, 0, 0, GetAura());
|
||||
// this should never happen
|
||||
if (!newAura)
|
||||
return;
|
||||
|
||||
std::list<AuraScript*> const& loadedScripts = newAura->m_loadedScripts;
|
||||
|
||||
// find the new aura's script and give it our stored stack apply times
|
||||
for (std::list<AuraScript*>::const_iterator itr = loadedScripts.begin(); itr != loadedScripts.end(); ++itr)
|
||||
{
|
||||
if (spell_gen_turkey_marker_AuraScript* scr = dynamic_cast<spell_gen_turkey_marker_AuraScript*>(*itr))
|
||||
{
|
||||
scr->_applyTimes.splice(scr->_applyTimes.begin(), _applyTimes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (_applyTimes.empty())
|
||||
@@ -1041,14 +1017,12 @@ class spell_gen_turkey_marker : public SpellScriptLoader
|
||||
|
||||
// pop stack if it expired for us
|
||||
if (_applyTimes.front() + GetMaxDuration() < getMSTime())
|
||||
if (ModStackAmount(-1))
|
||||
GetTarget()->RemoveOwnedAura(GetAura(), AURA_REMOVE_BY_EXPIRE);
|
||||
ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_gen_turkey_marker_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_turkey_marker_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_turkey_marker_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
|
||||
|
||||
@@ -722,9 +722,6 @@ public:
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_STACK)
|
||||
return;
|
||||
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW);
|
||||
target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH);
|
||||
}
|
||||
|
||||
@@ -199,8 +199,8 @@ public:
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -668,7 +668,7 @@ public:
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_q12851_going_bearback_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_q12851_going_bearback_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user