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:
QAston
2011-05-29 13:18:47 +02:00
parent b2096c711e
commit 42a20f14ef
18 changed files with 139 additions and 139 deletions
+55 -34
View File
@@ -3143,35 +3143,62 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const * newAura, uint8 effMask, int32 *baseAmount, Item * castItem, uint64 casterGUID)
{
ASSERT(casterGUID);
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
if (!IsPassiveSpell(newAura) && newAura->Id != 44413)
{
// check if cast item changed
uint64 castItemGUID = 0;
if (castItem)
castItemGUID = castItem->GetGUID();
// find current aura from spell and change it's stackamount, or refresh it's duration
if (Aura * foundAura = GetOwnedAura(newAura->Id, casterGUID, (sSpellMgr->GetSpellCustomAttr(newAura->Id) & SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : 0, 0))
{
// effect masks do not match
// extremely rare case
// let's just recreate aura
if (effMask != foundAura->GetEffectMask())
return false;
// update basepoints with new values - effect amount will be recalculated in ModStackAmount
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!foundAura->m_effects[i])
continue;
int bp;
if (baseAmount)
bp = *(baseAmount + i);
else
bp = foundAura->GetSpellProto()->EffectBasePoints[i];
int32 *oldBP = const_cast<int32 *>(&(foundAura->m_effects[i]->m_baseAmount));
*oldBP = bp;
}
// correct cast item guid if needed
if (castItemGUID != foundAura->GetCastItemGUID())
{
uint64 *oldGUID = const_cast<uint64 *>(&foundAura->m_castItemGuid);
*oldGUID = castItemGUID;
}
// try to increase stack amount
foundAura->ModStackAmount(1);
return foundAura;
}
}
return NULL;
}
void Unit::_AddAura(UnitAura * aura, Unit * caster)
{
ASSERT(!m_cleanupDone);
m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
// passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
if (!aura->IsPassive() && aura->GetId() != 44413)
{
// find current aura from spell and change it's stackamount
if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), (sSpellMgr->GetSpellCustomAttr(aura->GetId()) & SPELL_ATTR0_CU_ENCHANT_PROC) ? aura->GetCastItemGUID() : 0, 0, aura))
{
if (aura->GetSpellProto()->StackAmount)
aura->ModStackAmount(foundAura->GetStackAmount());
// Update periodic timers from the previous aura
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
AuraEffect *existingEff = foundAura->GetEffect(i);
AuraEffect *newEff = aura->GetEffect(i);
if (!existingEff || !newEff)
continue;
newEff->SetPeriodicTimer(existingEff->GetPeriodicTimer());
}
// Use the new one to replace the old one
// This is the only place where AURA_REMOVE_BY_STACK should be used
RemoveOwnedAura(foundAura, AURA_REMOVE_BY_STACK);
}
}
_RemoveNoStackAurasDueToAura(aura);
if (aura->IsRemoved())
@@ -3648,11 +3675,11 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster, AuraRemoveMode rem
{
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
{
Aura const * aura = iter->second;
Aura * aura = iter->second;
if ((aura->GetType() == UNIT_AURA_TYPE)
&& (!caster || aura->GetCasterGUID() == caster))
{
RemoveAuraFromStack(iter, removeMode);
aura->ModStackAmount(-1,removeMode);
return;
}
else
@@ -3660,12 +3687,6 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster, AuraRemoveMode rem
}
}
inline void Unit::RemoveAuraFromStack(AuraMap::iterator &iter, AuraRemoveMode removeMode, uint8 chargesRemoved/*= 1*/)
{
if (iter->second->ModStackAmount(-chargesRemoved))
RemoveOwnedAura(iter, removeMode);
}
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/)
{
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
@@ -3679,7 +3700,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
aura->DropCharge();
}
else
RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL, chargesRemoved);
aura->ModStackAmount(-chargesRemoved, AURA_REMOVE_BY_ENEMY_SPELL);
switch (aura->GetSpellProto()->SpellFamilyName)
{
@@ -3837,7 +3858,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
if (stealCharge)
aura->DropCharge();
else
RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL);
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
return;
}
+1 -2
View File
@@ -372,7 +372,6 @@ enum AuraRemoveMode
{
AURA_REMOVE_NONE = 0,
AURA_REMOVE_BY_DEFAULT = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove
AURA_REMOVE_BY_STACK, // replace by aura with same id
AURA_REMOVE_BY_CANCEL,
AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
AURA_REMOVE_BY_EXPIRE, // aura duration has ended
@@ -1617,6 +1616,7 @@ class Unit : public WorldObject
bool InitTamedPet(Pet * pet, uint8 level, uint32 spell_id);
// aura apply/remove helpers - you should better not use these
Aura * _TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, int32 *baseAmount = NULL, Item * castItem = NULL, uint64 casterGUID = 0);
void _AddAura(UnitAura * aura, Unit * caster);
AuraApplication * _CreateAuraApplication(Aura * aura, uint8 effMask);
void _ApplyAuraEffect(Aura * aura, uint8 effIndex);
@@ -1649,7 +1649,6 @@ class Unit : public WorldObject
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, uint64 caster = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
inline void RemoveAuraFromStack(AuraMap::iterator &iter, AuraRemoveMode removeMode, uint8 chargesRemoved = 1);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller, uint8 chargesRemoved = 1);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId);
@@ -33,16 +33,20 @@ enum AURA_FLAGS
AFLAG_NEGATIVE = 0x80
};
// these are modes, in which aura effect handler may be called
enum AuraEffectHandleModes
{
AURA_EFFECT_HANDLE_DEFAULT = 0x0,
AURA_EFFECT_HANDLE_REAL = 0x01,
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT = 0x02,
AURA_EFFECT_HANDLE_CHANGE_AMOUNT = 0x04,
AURA_EFFECT_HANDLE_STAT = 0x08,
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL),
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL),
AURA_EFFECT_HANDLE_REAL = 0x01, // handler applies/removes effect from unit
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT = 0x02, // handler sends apply/remove packet to unit
AURA_EFFECT_HANDLE_CHANGE_AMOUNT = 0x04, // handler updates effect on target after effect amount change
AURA_EFFECT_HANDLE_REAPPLY = 0x08, // handler updates effect on target after aura is reapplied on target
AURA_EFFECT_HANDLE_STAT = 0x10, // handler updates effect on target when stat removal/apply is needed for calculations by core
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL), // any case handler need to send packet
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL), // any case handler applies effect depending on amount
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK),
AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL),
};
//m_schoolAbsorb
@@ -41,8 +41,8 @@ class Aura;
// EFFECT HANDLER NOTES
//
// in aura handler there should be check for modes:
// AURA_EFFECT_HANDLE_REAL set - aura mod is just applied/removed on the target
// AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK set - aura is just applied/removed, or aura packet request is made
// AURA_EFFECT_HANDLE_REAL set
// AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK set
// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK set - aura is recalculated or is just applied/removed - need to redo all things related to m_amount
// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK - logical or of above conditions
// AURA_EFFECT_HANDLE_STAT - set when stats are reapplied
@@ -940,38 +940,46 @@ void AuraEffect::CalculateSpellMod()
GetBase()->CallScriptEffectCalcSpellModHandlers(const_cast<AuraEffect const *>(this), m_spellmod);
}
void AuraEffect::ChangeAmount(int32 newAmount, bool mark)
void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
{
//Unit * caster = GetCaster();
// Reapply if amount change
uint8 handleMask = 0;
if (newAmount != GetAmount())
handleMask |= AURA_EFFECT_HANDLE_CHANGE_AMOUNT;
if (onStackOrReapply)
handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
if (!handleMask)
return;
UnitList targetList;
GetTargetList(targetList);
for (UnitList::iterator aurEffTarget = targetList.begin(); aurEffTarget != targetList.end(); ++aurEffTarget)
{
HandleEffect(*aurEffTarget, handleMask, false);
}
if (handleMask & AURA_EFFECT_HANDLE_REAPPLY)
{
UnitList targetList;
GetTargetList(targetList);
for (UnitList::iterator aurEffTarget = targetList.begin(); aurEffTarget != targetList.end(); ++aurEffTarget)
{
HandleEffect(*aurEffTarget, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, false);
}
if (!mark)
m_amount = newAmount;
else
SetAmount(newAmount);
CalculateSpellMod();
for (UnitList::iterator aurEffTarget = targetList.begin(); aurEffTarget != targetList.end(); ++aurEffTarget)
{
HandleEffect(*aurEffTarget, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, true);
}
}
for (UnitList::iterator aurEffTarget = targetList.begin(); aurEffTarget != targetList.end(); ++aurEffTarget)
{
HandleEffect(*aurEffTarget, handleMask, true);
}
}
void AuraEffect::HandleEffect(AuraApplication const * aurApp, uint8 mode, bool apply)
{
// check if call is correct
// check if call is correct, we really don't want using bitmasks here (with 1 exception)
ASSERT(!mode
|| mode == AURA_EFFECT_HANDLE_REAL
|| mode == AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
|| mode == AURA_EFFECT_HANDLE_CHANGE_AMOUNT
|| mode == AURA_EFFECT_HANDLE_STAT);
|| mode == AURA_EFFECT_HANDLE_STAT
|| mode == AURA_EFFECT_HANDLE_REAPPLY
|| mode == (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAPPLY));
// register/unregister effect in lists in case of real AuraEffect apply/remove
// registration/unregistration is done always before real effect handling (some effect handlers code is depending on this)
@@ -5748,7 +5756,7 @@ void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const * aurApp, uin
void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK))
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_REAPPLY)))
return;
Unit * target = aurApp->GetTarget();
@@ -5767,7 +5775,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
}
}
if (mode & AURA_EFFECT_HANDLE_REAL)
if (mode & AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY)
{
// AT APPLY
if (apply)
@@ -6546,7 +6554,7 @@ void AuraEffect::HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mod
void AuraEffect::HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
if (!(mode & AURA_EFFECT_HANDLE_REAL))
if (!(mode & (AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY)))
return;
Unit * target = aurApp->GetTarget();
@@ -14,6 +14,7 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const * aurApp, ui
class AuraEffect
{
friend void Aura::_InitEffects(uint8 effMask, Unit * caster, int32 *baseAmount);
friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const * newAura, uint8 effMask, int32 *baseAmount, Item * castItem, uint64 casterGUID);
friend Aura::~Aura();
private:
~AuraEffect();
@@ -43,7 +44,7 @@ class AuraEffect
int32 CalculateAmount(Unit * caster);
void CalculatePeriodic(Unit * caster, bool create = false);
void CalculateSpellMod();
void ChangeAmount(int32 newAmount, bool mark = true);
void ChangeAmount(int32 newAmount, bool mark = true, bool onStackOrReapply = false);
void RecalculateAmount() { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); }
void RecalculateAmount(Unit * caster) { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }
bool CanBeRecalculated() const { return m_canBeRecalculated; }
+27 -29
View File
@@ -311,6 +311,8 @@ Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * o
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
if (aura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, baseAmount, castItem, casterGUID))
return aura;
aura = new UnitAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
break;
case TYPEID_DYNAMICOBJECT:
@@ -717,9 +719,6 @@ void Aura::SetDuration(int32 duration, bool withMods)
void Aura::RefreshDuration()
{
SetDuration(GetMaxDuration());
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_effects[i])
m_effects[i]->ResetPeriodic();
if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
@@ -748,31 +747,36 @@ bool Aura::DropCharge()
return false;
}
void Aura::SetStackAmount(uint8 stackAmount, bool /*applied*/)
void Aura::SetStackAmount(uint8 stackAmount)
{
if (stackAmount != m_stackAmount)
{
m_stackAmount = stackAmount;
RecalculateAmountOfEffects();
}
m_stackAmount = stackAmount;
Unit * caster = GetCaster();
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (HasEffect(i))
m_effects[i]->ChangeAmount(m_effects[i]->CalculateAmount(caster), false, true);
SetNeedClientUpdateForTargets();
}
bool Aura::ModStackAmount(int32 num)
void Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
{
// Can`t mod
if (!m_spellProto->StackAmount || !GetStackAmount())
return true;
// Modify stack but limit it
int32 stackAmount = m_stackAmount + num;
// limit the stack amount
if (stackAmount > int32(m_spellProto->StackAmount))
stackAmount = m_spellProto->StackAmount;
else if (stackAmount <= 0) // Last aura from stack removed
{
m_stackAmount = 0;
return true; // need remove aura
// not stackable aura - set stack amount to 1
if(!m_spellProto->StackAmount)
stackAmount = 1;
else
stackAmount = m_spellProto->StackAmount;
}
// we're out of stacks, remove
else if (stackAmount <= 0)
{
Remove(removeMode);
return;
}
bool refresh = stackAmount >= GetStackAmount();
// Update stack amount
@@ -781,8 +785,6 @@ bool Aura::ModStackAmount(int32 num)
if (refresh)
RefreshDuration();
SetNeedClientUpdateForTargets();
return false;
}
bool Aura::IsPassive() const
@@ -859,7 +861,7 @@ bool Aura::HasEffectType(AuraType type) const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_effects[i] && m_effects[i]->GetAuraType() == type)
if (HasEffect(i) && m_effects[i]->GetAuraType() == type)
return true;
}
return false;
@@ -870,7 +872,7 @@ void Aura::RecalculateAmountOfEffects()
ASSERT (!IsRemoved());
Unit * caster = GetCaster();
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_effects[i])
if (HasEffect(i))
m_effects[i]->RecalculateAmount(caster);
}
@@ -1135,7 +1137,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
else
{
// Remove Linked Auras
if (removeMode != AURA_REMOVE_BY_STACK && removeMode != AURA_REMOVE_BY_DEATH)
if (removeMode != AURA_REMOVE_BY_DEATH)
{
if (uint32 customAttr = sSpellMgr->GetSpellCustomAttr(GetId()))
{
@@ -1275,11 +1277,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
switch(GetId())
{
case 48018: // Demonic Circle
// Do not remove GO when aura is removed by stack
// to prevent remove GO added by new spell
// old one is already removed
if (removeMode != AURA_REMOVE_BY_STACK)
target->RemoveGameObject(GetId(), true);
target->RemoveGameObject(GetId(), true);
target->RemoveAura(62388);
break;
}
+3 -2
View File
@@ -79,6 +79,7 @@ class AuraApplication
class Aura
{
friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const * newAura, uint8 effMask, int32 *baseAmount, Item * castItem, uint64 casterGUID);
public:
typedef std::map<uint64, AuraApplication *> ApplicationMap;
@@ -130,8 +131,8 @@ class Aura
bool DropCharge();
uint8 GetStackAmount() const { return m_stackAmount; }
void SetStackAmount(uint8 num, bool applied = true);
bool ModStackAmount(int32 num); // return true if last charge dropped
void SetStackAmount(uint8 num);
void ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
uint8 GetCasterLevel() const { return m_casterLevel; }
-2
View File
@@ -3118,8 +3118,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return true;
}
//-----------TRINITY-------------
bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCaster) const
{
SpellEntry const *spellInfo_1 = aura1->GetSpellProto();
+4 -4
View File
@@ -793,14 +793,14 @@ uint8 AuraScript::GetStackAmount() const
return m_aura->GetStackAmount();
}
void AuraScript::SetStackAmount(uint8 num, bool applied)
void AuraScript::SetStackAmount(uint8 num)
{
m_aura->SetStackAmount(num, applied);
m_aura->SetStackAmount(num);
}
bool AuraScript::ModStackAmount(int32 num)
void AuraScript::ModStackAmount(int32 num, AuraRemoveMode removeMode)
{
return m_aura->ModStackAmount(num);
return m_aura->ModStackAmount(num, removeMode);
}
bool AuraScript::IsPassive() const
+2 -2
View File
@@ -606,8 +606,8 @@ class AuraScript : public _SpellScript
// stack amount manipulation
uint8 GetStackAmount() const;
void SetStackAmount(uint8 num, bool applied = true);
bool ModStackAmount(int32 num);
void SetStackAmount(uint8 num);
void ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
// passive - "working in background", not saved, not removed by immonities, not seen by player
bool IsPassive() const;
@@ -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());
}
+1 -27
View File
@@ -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);
}
-3
View File
@@ -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);
}
+2 -2
View File
@@ -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);
}
};
+1 -1
View File
@@ -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);
}
};