[10291] Use new fast/safe way for access aura in drink item spells.

Access useing aura->holder->some_effect_aura let have always pointer to exactly
expected aura from same cast if this need.
This commit is contained in:
VladimirMangos 2010-07-30 19:30:49 +04:00
parent ccd8f4f825
commit b1cbb1634d
2 changed files with 21 additions and 37 deletions

View file

@ -6917,44 +6917,9 @@ void Aura::PeriodicDummyTick()
switch (spell->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
switch (spell->Id)
{
// Drink
case 430:
case 431:
case 432:
case 1133:
case 1135:
case 1137:
case 10250:
case 22734:
case 27089:
case 34291:
case 43182:
case 43183:
case 43706:
case 46755:
case 49472: // Drink Coffee
case 57073:
case 61830:
{
if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus
Unit::AuraList const& aura = target->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN);
for(Unit::AuraList::const_iterator i = aura.begin(); i != aura.end(); ++i)
{
if ((*i)->GetId() == GetId())
{
(*i)->GetModifier()->m_amount = m_modifier.m_amount;
((Player*)target)->UpdateManaRegen();
// Disable continue
m_isPeriodic = false;
return;
}
}
return;
}
// Forsaken Skills
case 7054:
{
@ -7184,6 +7149,24 @@ void Aura::PeriodicDummyTick()
default:
break;
}
// Drink (item drink spells)
if (GetEffIndex() > EFFECT_INDEX_0 && spell->EffectApplyAuraName[GetEffIndex()-1] == SPELL_AURA_MOD_POWER_REGEN)
{
if (target->GetTypeId() != TYPEID_PLAYER)
return;
// Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus
if (Aura* aura = GetHolder()->GetAuraByEffectIndex(SpellEffectIndex(GetEffIndex() - 1)))
{
aura->GetModifier()->m_amount = m_modifier.m_amount;
((Player*)target)->UpdateManaRegen();
// Disable continue
m_isPeriodic = false;
return;
}
return;
}
// Prey on the Weak
if (spell->SpellIconID == 2983)
{
@ -7200,6 +7183,7 @@ void Aura::PeriodicDummyTick()
target->RemoveAurasDueToSpell(58670);
}
break;
}
case SPELLFAMILY_MAGE:
{
// Mirror Image

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10290"
#define REVISION_NR "10291"
#endif // __REVISION_NR_H__