mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[6821] More cleanups in spell proc event code.
This commit is contained in:
parent
3aa2669160
commit
02ec0d5233
2 changed files with 18 additions and 13 deletions
|
|
@ -10041,19 +10041,24 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is aura triggering code call
|
/// this is aura triggering code call
|
||||||
Aura* triggeredByAura = i->triggeredByAura;
|
Aura* triggeredByAura = i->triggeredByAura;
|
||||||
|
|
||||||
// save charges existence before processing to prevent crash at access to deleted triggered aura after
|
/// save charges existence before processing to prevent crash at access to deleted triggered aura after
|
||||||
|
/// used in speedup code check before check aura existance.
|
||||||
bool triggeredByAuraWithCharges = triggeredByAura->m_procCharges > 0;
|
bool triggeredByAuraWithCharges = triggeredByAura->m_procCharges > 0;
|
||||||
|
|
||||||
|
/// success in event proccesing
|
||||||
|
/// used in speedup code check before check aura existance.
|
||||||
bool casted = false;
|
bool casted = false;
|
||||||
|
|
||||||
|
/// process triggered code
|
||||||
switch(*aur)
|
switch(*aur)
|
||||||
{
|
{
|
||||||
case SPELL_AURA_PROC_TRIGGER_SPELL:
|
case SPELL_AURA_PROC_TRIGGER_SPELL:
|
||||||
{
|
{
|
||||||
sLog.outDebug("ProcDamageAndSpell: casting spell (triggered by %s proc aura of spell %u)",
|
sLog.outDebug("ProcDamageAndSpell: casting spell (triggered by %s proc aura of spell %u)",
|
||||||
(isVictim?"a victim's":"an attacker's"),i->triggeredByAura->GetId());
|
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
|
||||||
casted = HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, attType, i->cooldown);
|
casted = HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, attType, i->cooldown);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -10086,7 +10091,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||||
{
|
{
|
||||||
sLog.outDebug("ProcDamageAndSpell: casting spell (triggered by %s haste aura of spell %u)",
|
sLog.outDebug("ProcDamageAndSpell: casting spell (triggered by %s haste aura of spell %u)",
|
||||||
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
|
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
|
||||||
casted = HandleHasteAuraProc(pTarget, damage, i->triggeredByAura, procSpell, procFlag,i->cooldown);
|
casted = HandleHasteAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag,i->cooldown);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
|
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
|
||||||
|
|
@ -10100,7 +10105,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||||
{
|
{
|
||||||
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s class script aura of spell %u)",
|
sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s class script aura of spell %u)",
|
||||||
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
|
(isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
|
||||||
casted = HandleOverrideClassScriptAuraProc(pTarget, i->triggeredByAura, procSpell,i->cooldown);
|
casted = HandleOverrideClassScriptAuraProc(pTarget, triggeredByAura, procSpell,i->cooldown);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -10111,27 +10116,27 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update charge (aura can be removed by triggers)
|
/// Update charge (aura can be removed by triggers)
|
||||||
if(casted && triggeredByAuraWithCharges)
|
if(casted && triggeredByAuraWithCharges)
|
||||||
{
|
{
|
||||||
// need found aura (can be dropped by triggers)
|
/// need re-found aura (can be dropped by triggers)
|
||||||
AuraMap::const_iterator lower = GetAuras().lower_bound(i->triggeredByAura_SpellPair);
|
AuraMap::const_iterator lower = GetAuras().lower_bound(i->triggeredByAura_SpellPair);
|
||||||
AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair);
|
AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair);
|
||||||
for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr)
|
for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr)
|
||||||
{
|
{
|
||||||
if(itr->second == i->triggeredByAura)
|
if(itr->second == triggeredByAura) // pointer still valid
|
||||||
{
|
{
|
||||||
if(i->triggeredByAura->m_procCharges > 0)
|
if(triggeredByAura->m_procCharges > 0)
|
||||||
i->triggeredByAura->m_procCharges -= 1;
|
triggeredByAura->m_procCharges -= 1;
|
||||||
|
|
||||||
i->triggeredByAura->UpdateAuraCharges();
|
triggeredByAura->UpdateAuraCharges();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Safely remove auras with zero charges
|
/// Safely remove auras with zero charges
|
||||||
for(AuraList::const_iterator i = auras.begin(), next; i != auras.end(); i = next)
|
for(AuraList::const_iterator i = auras.begin(), next; i != auras.end(); i = next)
|
||||||
{
|
{
|
||||||
next = i; ++next;
|
next = i; ++next;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6820"
|
#define REVISION_NR "6821"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue