Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
- index f8e8e8f..cd79f20 100644
- --- a/src/game/GridNotifiersImpl.h
- +++ b/src/game/GridNotifiersImpl.h
- @@ -166,8 +166,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
- {
- if (!holder->GetAuraByEffectIndex(eff_index))
- {
- - PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, holder, target, i_dynobject.GetCaster());
- - holder->AddAura(Aur, eff_index);
- + PersistentAreaAura* Aur = holder->CreatePersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster());
- target->AddAuraToModList(Aur);
- holder->SetInUse(true);
- Aur->ApplyModifier(true,true);
- @@ -182,8 +181,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
- else
- {
- holder = CreateSpellAuraHolder(spellInfo, target, i_dynobject.GetCaster());
- - PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, holder, target, i_dynobject.GetCaster());
- - holder->AddAura(Aur, eff_index);
- + holder->CreatePersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster());
- target->AddSpellAuraHolder(holder);
- }
- diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
- index 3e83a72..27e708e 100644
- --- a/src/game/Level3.cpp
- +++ b/src/game/Level3.cpp
- @@ -4018,8 +4018,7 @@ bool ChatHandler::HandleAuraCommand(char* args)
- eff == SPELL_EFFECT_APPLY_AURA ||
- eff == SPELL_EFFECT_PERSISTENT_AREA_AURA)
- {
- - Aura *aur = CreateAura(spellInfo, SpellEffectIndex(i), NULL, holder, target);
- - holder->AddAura(aur, SpellEffectIndex(i));
- + holder->CreateAura(spellInfo, SpellEffectIndex(i), NULL, target, NULL, NULL);
- }
- }
- target->AddSpellAuraHolder(holder);
- diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
- index 233cf25..4112b60 100644
- --- a/src/game/Pet.cpp
- +++ b/src/game/Pet.cpp
- @@ -1401,12 +1401,11 @@ void Pet::_LoadAuras(uint32 timediff)
- if ((effIndexMask & (1 << i)) == 0)
- continue;
- - Aura* aura = CreateAura(spellproto, SpellEffectIndex(i), NULL, holder, this);
- + Aura* aura = holder->CreateAura(spellproto, SpellEffectIndex(i), NULL, (Unit*)this, NULL, NULL);
- if (!damage[i])
- damage[i] = aura->GetModifier()->m_amount;
- aura->SetLoadedState(damage[i], periodicTime[i]);
- - holder->AddAura(aura, SpellEffectIndex(i));
- }
- if (!holder->IsEmptyHolder())
- @@ -1439,14 +1438,18 @@ void Pet::_SaveAuras()
- "basepoints0, basepoints1, basepoints2, periodictime0, periodictime1, periodictime2, maxduration, remaintime, effIndexMask) "
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
- - for(SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
- + for (SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
- {
- SpellAuraHolder *holder = itr->second;
- + if (!holder || holder->IsDeleted())
- + continue;
- +
- + SpellEntry const* spellInfo = holder->GetSpellProto();
- +
- bool save = true;
- for (int32 j = 0; j < MAX_EFFECT_INDEX; ++j)
- {
- - SpellEntry const* spellInfo = holder->GetSpellProto();
- if (spellInfo->EffectApplyAuraName[j] == SPELL_AURA_MOD_STEALTH ||
- spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
- spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AREA_AURA_PET )
- @@ -3082,8 +3085,7 @@ bool Pet::ReapplyScalingAura(SpellAuraHolder* holder, SpellEntry const *spellpro
- RemoveAura(oldaura, AURA_REMOVE_BY_STACK);
- }
- - Aura* aura = CreateAura(spellproto, index, &basePoints, holder, this, this, NULL);
- - holder->AddAura(aura, index);
- + Aura* aura = holder->CreateAura(spellproto, index, &basePoints, this, this, NULL);
- holder->SetAuraDuration(aura->GetAuraMaxDuration());
- AddAuraToModList(aura);
- aura->ApplyModifier(true,true);
- diff --git a/src/game/Player.cpp b/src/game/Player.cpp
- index 04846e7..4cfed79 100644
- --- a/src/game/Player.cpp
- +++ b/src/game/Player.cpp
- @@ -16792,12 +16792,12 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
- if ((effIndexMask & (1 << i)) == 0)
- continue;
- - Aura* aura = CreateAura(spellproto, SpellEffectIndex(i), NULL, holder, this);
- + Aura* aura = holder->CreateAura(spellproto, SpellEffectIndex(i), NULL, this, NULL, NULL);
- +
- if (!damage[i])
- damage[i] = aura->GetModifier()->m_amount;
- aura->SetLoadedState(damage[i], periodicTime[i]);
- - holder->AddAura(aura, SpellEffectIndex(i));
- }
- if (!holder->IsEmptyHolder())
- diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
- index 9d42d94..eca078e 100644
- --- a/src/game/SpellAuras.cpp
- +++ b/src/game/SpellAuras.cpp
- @@ -534,19 +534,44 @@ Unit* SingleEnemyTargetAura::GetTriggerTarget() const
- return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_castersTargetGuid);
- }
- -Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem)
- +Aura* SpellAuraHolder::CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, Unit *target, Unit *caster, Item* castItem)
- {
- - if (IsAreaAuraEffect(spellproto->Effect[eff]))
- - return new AreaAura(spellproto, eff, currentBasePoints, holder, target, caster, castItem);
- -
- uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff];
- -
- - if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId))
- + if (IsAreaAuraEffect(spellproto->Effect[eff]))
- + {
- + AddAura((Aura)AreaAura(spellproto, eff, currentBasePoints, this, target, caster, castItem), eff);
- + return GetAuraByEffectIndex(eff);
- + }
- + else if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId))
- + {
- for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
- + {
- if (triggeredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY)
- - return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, holder, target, caster, castItem);
- + {
- + AddAura((Aura)SingleEnemyTargetAura(spellproto, eff, currentBasePoints, this, target, caster, castItem),eff);
- + return GetAuraByEffectIndex(eff);
- + }
- + }
- + }
- + // else - normal aura
- - return new Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem);
- + AddAura(Aura(spellproto, eff, currentBasePoints, this, target, caster, castItem),eff);
- +
- + return GetAuraByEffectIndex(eff);
- +}
- +
- +PersistentAreaAura* SpellAuraHolder::CreatePersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, Unit* target, Unit* caster, Item* castItem)
- +{
- + AddAura((Aura)PersistentAreaAura(spellproto, eff, currentBasePoints, this, target, caster, castItem),eff);
- +
- + return ((PersistentAreaAura*)GetAuraByEffectIndex(eff));
- +}
- +
- +AreaAura* SpellAuraHolder::CreateAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, Unit* target, Unit* caster, Item* castItem)
- +{
- + AddAura((Aura)AreaAura(spellproto, eff, currentBasePoints, this, target, caster, castItem),eff);
- +
- + return ((AreaAura*)GetAuraByEffectIndex(eff));
- }
- SpellAuraHolder* CreateSpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem)
- @@ -782,8 +807,7 @@ void AreaAura::Update(uint32 diff)
- holder->SetAuraDuration(GetAuraDuration());
- - AreaAura *aur = new AreaAura(actualSpellInfo, m_effIndex, &actualBasePoints, holder, (*tIter), caster, NULL);
- - holder->AddAura(aur, m_effIndex);
- + AreaAura* aur = holder->CreateAreaAura(actualSpellInfo, m_effIndex, &actualBasePoints, (*tIter), caster, NULL);
- if (addedToExisting)
- {
- @@ -9787,7 +9811,7 @@ void Aura::HandleAuraStopNaturalManaRegen(bool apply, bool Real)
- bool Aura::IsLastAuraOnHolder()
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (i != GetEffIndex() && GetHolder()->m_auras[i])
- + if (i != GetEffIndex() && GetHolder()->GetAuraByEffectIndex(SpellEffectIndex(i)))
- return false;
- return true;
- }
- @@ -9806,6 +9830,7 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0)
- {
- MANGOS_ASSERT(target);
- MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
- + m_aurasStorage.clear();
- if (!caster)
- m_casterGuid = target->GetObjectGuid();
- @@ -9864,24 +9889,60 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0)
- RemoveAura(SpellEffectIndex(i));
- }
- -void SpellAuraHolder::AddAura(Aura *aura, SpellEffectIndex index)
- +void SpellAuraHolder::AddAura(Aura aura, SpellEffectIndex index)
- {
- - m_auras[index] = aura;
- + if (Aura* _aura = GetAuraByEffectIndex(index))
- + {
- + if (!_aura->IsDeleted())
- + {
- + DEBUG_LOG("SpellAuraHolder::AddAura attempt to add aura (effect %u) to holder of spell %u, but holder already have active aura!", index, GetId());
- + return;
- + }
- + else
- + RemoveAura(index);
- + }
- + m_aurasStorage.insert(std::make_pair(index,aura));
- m_auraFlags |= (1 << index);
- }
- void SpellAuraHolder::RemoveAura(SpellEffectIndex index)
- {
- - m_auras[index] = (Aura*)NULL;
- - m_auraFlags &= ~(1 << index);
- +
- + if (m_auraFlags & (1 << index))
- + {
- + m_auraFlags &= ~(1 << index);
- +
- + if (m_aurasStorage.empty())
- + return;
- +
- + AuraStorage::iterator itr = m_aurasStorage.find(index);
- + if (itr != m_aurasStorage.end())
- + m_aurasStorage.erase(itr);
- + }
- + else
- + {
- + m_auraFlags &= ~(1 << index);
- + }
- +}
- +
- +Aura* SpellAuraHolder::GetAuraByEffectIndex(SpellEffectIndex index)
- +{
- + if (m_auraFlags & (1 << index))
- + {
- + AuraStorage::iterator itr = m_aurasStorage.find(index);
- + if (itr != m_aurasStorage.end())
- + return &itr->second;
- + }
- + return (Aura*)NULL;
- }
- -Aura* SpellAuraHolder::GetAuraByEffectIndex(SpellEffectIndex index) const
- +Aura const* SpellAuraHolder::GetAura(SpellEffectIndex index) const
- {
- if (m_auraFlags & (1 << index))
- {
- - if (m_auras[index] && !m_auras[index]->IsDeleted())
- - return m_auras[index];
- + AuraStorage::const_iterator itr = m_aurasStorage.find(index);
- + if (itr != m_aurasStorage.end())
- + return &itr->second;
- }
- return (Aura*)NULL;
- }
- @@ -9936,7 +9997,7 @@ void SpellAuraHolder::_AddSpellAuraHolder()
- uint8 flags = 0;
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- {
- - if (m_auras[i])
- + if (GetAuraByEffectIndex(SpellEffectIndex(i)))
- flags |= (1 << i);
- }
- flags |= ((GetCasterGuid() == GetTarget()->GetObjectGuid()) ? AFLAG_NOT_CASTER : AFLAG_NONE) | ((GetSpellMaxDuration(m_spellProto) > 0 && !(m_spellProto->AttributesEx5 & SPELL_ATTR_EX5_NO_DURATION)) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE);
- @@ -10209,7 +10270,7 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount)
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- {
- - if (Aura *aur = m_auras[i])
- + if (Aura* aur = GetAuraByEffectIndex(SpellEffectIndex(i)))
- {
- int32 bp = aur->GetBasePoints();
- int32 amount = m_stackAmount * caster->CalculateSpellDamage(target, m_spellProto, SpellEffectIndex(i), &bp);
- @@ -11333,10 +11394,6 @@ void SpellAuraHolder::HandleSpellSpecificBoostsForward(bool apply)
- SpellAuraHolder::~SpellAuraHolder()
- {
- - // note: auras in delete list won't be affected since they clear themselves from holder when adding to deletedAuraslist
- - for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- - delete aur;
- }
- void SpellAuraHolder::Update(uint32 diff)
- @@ -11375,7 +11432,7 @@ void SpellAuraHolder::Update(uint32 diff)
- }
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aura = m_auras[i])
- + if (Aura *aura = GetAuraByEffectIndex(SpellEffectIndex(i)))
- aura->UpdateAura(diff);
- // Channeled aura required check distance from caster
- @@ -11435,7 +11492,7 @@ bool SpellAuraHolder::HasMechanic(uint32 mechanic) const
- return true;
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (m_auras[i] && m_spellProto->EffectMechanic[i] == mechanic)
- + if (GetAura(SpellEffectIndex(i)) && m_spellProto->EffectMechanic[i] == mechanic)
- return true;
- return false;
- }
- @@ -11446,7 +11503,7 @@ bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const
- return true;
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (m_auras[i] && m_spellProto->EffectMechanic[i] && ((1 << (m_spellProto->EffectMechanic[i] -1)) & mechanicMask))
- + if (GetAura(SpellEffectIndex(i)) && m_spellProto->EffectMechanic[i] && ((1 << (m_spellProto->EffectMechanic[i] -1)) & mechanicMask))
- return true;
- return false;
- }
- @@ -11454,7 +11511,7 @@ bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const
- bool SpellAuraHolder::IsPersistent() const
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- + if (Aura const* aur = GetAura(SpellEffectIndex(i)))
- if (aur->IsPersistent())
- return true;
- return false;
- @@ -11463,7 +11520,7 @@ bool SpellAuraHolder::IsPersistent() const
- bool SpellAuraHolder::IsAreaAura() const
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- + if (Aura const* aur = GetAura(SpellEffectIndex(i)))
- if (aur->IsAreaAura())
- return true;
- return false;
- @@ -11472,7 +11529,7 @@ bool SpellAuraHolder::IsAreaAura() const
- bool SpellAuraHolder::IsPositive() const
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- + if (Aura const* aur = GetAura(SpellEffectIndex(i)))
- if (!aur->IsPositive())
- return false;
- return true;
- @@ -11481,7 +11538,7 @@ bool SpellAuraHolder::IsPositive() const
- bool SpellAuraHolder::IsEmptyHolder() const
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (m_auras[i])
- + if (GetAura(SpellEffectIndex(i)))
- return false;
- return true;
- }
- diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
- index 9f9d27a..0171cc8 100644
- --- a/src/game/SpellAuras.h
- +++ b/src/game/SpellAuras.h
- @@ -37,6 +37,10 @@ struct ProcTriggerSpell;
- // forward decl
- class Aura;
- +class AreaAura;
- +class PersistentAreaAura;
- +
- +typedef std::map<SpellEffectIndex,Aura> AuraStorage;
- // internal helper
- struct ReapplyAffectedPassiveAurasHelper;
- @@ -45,9 +49,11 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- {
- public:
- SpellAuraHolder (SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem);
- - Aura* m_auras[MAX_EFFECT_INDEX];
- - void AddAura(Aura *aura, SpellEffectIndex index);
- + Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, Unit *target, Unit *caster, Item* castItem);
- + PersistentAreaAura* CreatePersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- + AreaAura* CreateAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- +
- void RemoveAura(SpellEffectIndex index);
- void ApplyAuraModifiers(bool apply, bool real = false);
- void _AddSpellAuraHolder();
- @@ -65,7 +71,8 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- void SetStackAmount(uint32 stackAmount);
- bool ModStackAmount(int32 num); // return true if last charge dropped
- - Aura* GetAuraByEffectIndex(SpellEffectIndex index) const;
- + Aura* GetAuraByEffectIndex(SpellEffectIndex index);
- + Aura const* GetAura(SpellEffectIndex index) const;
- uint32 GetId() const { return m_spellProto->Id; }
- SpellEntry const* GetSpellProto() const { return m_spellProto; }
- @@ -161,7 +168,9 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- bool HasMechanicMask(uint32 mechanicMask) const;
- ~SpellAuraHolder();
- +
- private:
- + void AddAura(Aura aura, SpellEffectIndex index);
- Unit* m_target;
- ObjectGuid m_casterGuid;
- ObjectGuid m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
- @@ -181,6 +190,8 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
- DiminishingGroup m_AuraDRGroup:8; // Diminishing
- + AuraStorage m_aurasStorage; // Auras storage
- +
- bool m_permanent:1;
- bool m_isPassive:1;
- bool m_isDeathPersist:1;
- @@ -207,8 +218,8 @@ typedef void(Aura::*pAuraHandler)(bool Apply, bool Real);
- class MANGOS_DLL_SPEC Aura
- {
- + friend class SpellAuraHolder;
- friend struct ReapplyAffectedPassiveAurasHelper;
- - MANGOS_DLL_SPEC friend Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem);
- public:
- //aura handlers
- @@ -421,7 +432,7 @@ class MANGOS_DLL_SPEC Aura
- m_periodicTick = maxticks - GetAuraDuration() / m_modifier.periodictime;
- }
- - bool IsPositive() { return m_positive; }
- + bool IsPositive() const { return m_positive; }
- bool IsPersistent() const { return m_isPersistent; }
- bool IsAreaAura() const { return m_isAreaAura; }
- bool IsPeriodic() const { return m_isPeriodic; }
- @@ -532,7 +543,7 @@ class MANGOS_DLL_SPEC PersistentAreaAura : public Aura
- class MANGOS_DLL_SPEC SingleEnemyTargetAura : public Aura
- {
- - MANGOS_DLL_SPEC friend Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem);
- + friend class SpellAuraHolder;
- public:
- ~SingleEnemyTargetAura();
- @@ -543,6 +554,5 @@ class MANGOS_DLL_SPEC SingleEnemyTargetAura : public Aura
- ObjectGuid m_castersTargetGuid;
- };
- -MANGOS_DLL_SPEC Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- MANGOS_DLL_SPEC SpellAuraHolder* CreateSpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem = NULL);
- #endif
- diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
- index c7af1d5..d9fa76e 100644
- --- a/src/game/SpellEffects.cpp
- +++ b/src/game/SpellEffects.cpp
- @@ -4485,7 +4485,7 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx)
- DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell: Aura is: %u", m_spellInfo->EffectApplyAuraName[eff_idx]);
- - Aura* aur = CreateAura(m_spellInfo, eff_idx, &m_currentBasePoints[eff_idx], m_spellAuraHolder, unitTarget, caster, m_CastItem);
- + Aura* aur = m_spellAuraHolder->CreateAura(m_spellInfo, eff_idx, &m_currentBasePoints[eff_idx], unitTarget, caster, m_CastItem);
- // Now Reduce spell duration using data received at spell hit
- int32 duration = aur->GetAuraMaxDuration();
- @@ -4510,8 +4510,6 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx)
- m_spellAuraHolder->SetAuraMaxDuration(duration);
- m_spellAuraHolder->SetAuraDuration(duration);
- }
- -
- - m_spellAuraHolder->AddAura(aur, eff_idx);
- }
- void Spell::EffectUnlearnSpecialization(SpellEffectIndex eff_idx)
- @@ -5341,8 +5339,7 @@ void Spell::EffectApplyAreaAura(SpellEffectIndex eff_idx)
- if (!unitTarget->isAlive())
- return;
- - AreaAura* Aur = new AreaAura(m_spellInfo, eff_idx, &m_currentBasePoints[eff_idx], m_spellAuraHolder, unitTarget, m_caster, m_CastItem);
- - m_spellAuraHolder->AddAura(Aur, eff_idx);
- + m_spellAuraHolder->CreateAreaAura(m_spellInfo, eff_idx, &m_currentBasePoints[eff_idx], unitTarget, m_caster, m_CastItem);
- }
- void Spell::EffectSummonType(SpellEffectIndex eff_idx)
- diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
- index 8299300..0a68592 100644
- --- a/src/game/Unit.cpp
- +++ b/src/game/Unit.cpp
- @@ -4420,14 +4420,14 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder)
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- {
- - if (Aura *aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
- + if (Aura* aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
- {
- // m_auraname can be modified to SPELL_AURA_NONE for area auras, use original
- AuraType aurNameReal = AuraType(aurSpellInfo->EffectApplyAuraName[i]);
- if (aurNameReal == SPELL_AURA_PERIODIC_DAMAGE && aur->GetAuraDuration() > 0)
- {
- - if (Aura *existing = foundHolder->GetAuraByEffectIndex(SpellEffectIndex(i)))
- + if (Aura* existing = foundHolder->GetAuraByEffectIndex(SpellEffectIndex(i)))
- {
- int32 remainingTicks = existing->GetAuraMaxTicks() - existing->GetAuraTicks();
- int32 remainingDamage = existing->GetModifier()->m_amount * remainingTicks;
- @@ -4905,14 +4905,11 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, U
- int32 basePoints = aur->GetBasePoints();
- // construct the new aura for the attacker - will never return NULL, it's just a wrapper for
- // some different constructors
- - Aura * new_aur = CreateAura(spellProto, aur->GetEffIndex(), &basePoints, new_holder, stealer, this);
- + Aura* new_aur = new_holder->CreateAura(spellProto, aur->GetEffIndex(), &basePoints, stealer, this, NULL);
- // set periodic to do at least one tick (for case when original aura has been at last tick preparing)
- int32 periodic = aur->GetModifier()->periodictime;
- new_aur->GetModifier()->periodictime = periodic < new_max_dur ? periodic : new_max_dur;
- -
- - // add the new aura to stealer
- - new_holder->AddAura(new_aur, new_aur->GetEffIndex());
- }
- if (holder->GetSpellProto()->AttributesEx7 & SPELL_ATTR_EX7_DISPEL_CHARGES)
- @@ -7117,10 +7114,10 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
- else if (spellProto->SpellFamilyFlags.test<CF_PRIEST_SHADOW_WORD_DEATH_TARGET>())
- {
- // Glyph of Shadow word: Death
- - if (SpellAuraHolder const* glyph = GetSpellAuraHolder(55682))
- + if (SpellAuraHolder* glyph = GetSpellAuraHolder(55682))
- {
- - Aura const* hpPct = glyph->GetAuraByEffectIndex(EFFECT_INDEX_0);
- - Aura const* dmPct = glyph->GetAuraByEffectIndex(EFFECT_INDEX_1);
- + Aura* hpPct = glyph->GetAuraByEffectIndex(EFFECT_INDEX_0);
- + Aura* dmPct = glyph->GetAuraByEffectIndex(EFFECT_INDEX_1);
- if (hpPct && dmPct && pVictim->GetHealth() * 100 <= pVictim->GetMaxHealth() * hpPct->GetModifier()->m_amount)
- DoneTotalMod *= (dmPct->GetModifier()->m_amount + 100.0f) / 100.0f;
- }
- @@ -12158,8 +12155,7 @@ void Unit::_AddAura(uint32 spellID, uint32 duration)
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
- spellInfo->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA )
- {
- - Aura *aura = CreateAura(spellInfo, SpellEffectIndex(i), NULL, holder, this);
- - holder->AddAura(aura, SpellEffectIndex(i));
- + Aura *aura = holder->CreateAura(spellInfo, SpellEffectIndex(i), NULL, this, NULL, NULL);
- holder->SetAuraDuration(duration);
- DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Manually adding aura of spell %u, index %u, duration %u ms", spellID, i, duration);
- }
- diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp
- index f474af5..989a410 100644
- --- a/src/game/UnitAuraProcHandler.cpp
- +++ b/src/game/UnitAuraProcHandler.cpp
- @@ -4671,8 +4671,7 @@ SpellAuraProcResult Unit::HandleMendingAuraProc( Unit* /*pVictim*/, uint32 /*dam
- continue;
- int32 basePoints = aur->GetBasePoints();
- - Aura * new_aur = CreateAura(spellProto, aur->GetEffIndex(), &basePoints, new_holder, target, caster);
- - new_holder->AddAura(new_aur, new_aur->GetEffIndex());
- + new_holder->CreateAura(spellProto, aur->GetEffIndex(), &basePoints, target, caster, NULL);
- }
- new_holder->SetAuraCharges(jumps, false);
Add Comment
Please, Sign In to add comment