Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
- index c84b2a3..f4a135b 100644
- --- a/src/game/DynamicObject.cpp
- +++ b/src/game/DynamicObject.cpp
- @@ -170,7 +170,7 @@ void DynamicObject::Delay(int32 delaytime)
- bool foundAura = false;
- for (int32 i = m_effIndex + 1; i < MAX_EFFECT_INDEX; ++i)
- {
- - if ((holder->GetSpellProto()->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA || holder->GetSpellProto()->Effect[i] == SPELL_EFFECT_ADD_FARSIGHT) && holder->m_auras[i])
- + if ((holder->GetSpellProto()->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA || holder->GetSpellProto()->Effect[i] == SPELL_EFFECT_ADD_FARSIGHT) && holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
- {
- foundAura = true;
- break;
- 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 13c2542..18acaee 100644
- --- a/src/game/Pet.cpp
- +++ b/src/game/Pet.cpp
- @@ -406,7 +406,13 @@ void Pet::SavePetToDB(PetSaveMode mode)
- CharacterDatabase.BeginTransaction();
- _SaveSpells();
- _SaveSpellCooldowns();
- - _SaveAuras();
- + if (GetMap())
- + {
- + MAPLOCK_READ(this,MAP_LOCK_TYPE_AURAS)
- + _SaveAuras();
- + }
- + else
- + _SaveAuras();
- uint32 ownerLow = GetOwnerGuid().GetCounter();
- // remove current data
- @@ -1394,12 +1400,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())
- @@ -1415,6 +1420,8 @@ void Pet::_LoadAuras(uint32 timediff)
- void Pet::_SaveAuras()
- {
- + MAPLOCK_READ(this,MAP_LOCK_TYPE_AURAS);
- +
- static SqlStatementID delAuras ;
- static SqlStatementID insAuras ;
- @@ -1430,14 +1437,20 @@ 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();
- + if (!spellInfo)
- + continue;
- +
- 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 )
- @@ -3073,8 +3086,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 086d2ca..6f59567 100644
- --- a/src/game/Player.cpp
- +++ b/src/game/Player.cpp
- @@ -16791,12 +16791,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())
- @@ -18160,7 +18160,14 @@ void Player::SaveToDB()
- _SaveSpells();
- _SaveSpellCooldowns();
- _SaveActions();
- - _SaveAuras();
- + if (GetMap())
- + {
- + MAPLOCK_READ(this,MAP_LOCK_TYPE_AURAS)
- + _SaveAuras();
- + }
- + else
- + _SaveAuras();
- +
- _SaveSkills();
- m_achievementMgr.SaveToDB();
- m_reputationMgr.SaveToDB();
- @@ -19489,6 +19496,10 @@ void Player::RemovePetActionBar()
- void Player::AddSpellMod(Aura* aura, bool apply)
- {
- + // For deleted auras enable only unapply mods!
- + if (!aura || (aura->IsDeleted() && apply))
- + return;
- +
- Modifier const* mod = aura->GetModifier();
- uint16 Opcode= (mod->m_auraname == SPELL_AURA_ADD_FLAT_MODIFIER) ? SMSG_SET_FLAT_SPELL_MODIFIER : SMSG_SET_PCT_SPELL_MODIFIER;
- diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
- index b161c40..f1eb19b 100644
- --- a/src/game/SpellAuras.cpp
- +++ b/src/game/SpellAuras.cpp
- @@ -372,10 +372,10 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
- static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE };
- -Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem) :
- +Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target, Unit *caster, Item* castItem) :
- m_periodicTimer(0), m_periodicTick(0), m_removeMode(AURA_REMOVE_BY_DEFAULT),
- m_effIndex(eff), m_positive(false), m_isPeriodic(false), m_isAreaAura(false),
- -m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder)
- +m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder), m_deleted(false)
- {
- MANGOS_ASSERT(target);
- MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
- @@ -447,7 +447,7 @@ Aura::~Aura()
- {
- }
- -AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target,
- +AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target,
- Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem)
- {
- m_isAreaAura = true;
- @@ -501,7 +501,7 @@ AreaAura::~AreaAura()
- {
- }
- -PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target,
- +PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target,
- Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem)
- {
- m_isPersistent = true;
- @@ -511,7 +511,7 @@ PersistentAreaAura::~PersistentAreaAura()
- {
- }
- -SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target,
- +SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target,
- Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem)
- {
- if (caster)
- @@ -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)
- @@ -565,6 +590,9 @@ void Aura::SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue)
- void Aura::Update(uint32 diff)
- {
- + if (IsDeleted())
- + return;
- +
- if (m_isPeriodic)
- {
- m_periodicTimer -= diff;
- @@ -779,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)
- {
- @@ -890,6 +917,10 @@ void PersistentAreaAura::Update(uint32 diff)
- void Aura::ApplyModifier(bool apply, bool Real)
- {
- + // For deleted auras accept only remove modifier!
- + if (IsDeleted() && apply)
- + return;
- +
- AuraType aura = m_modifier.m_auraname;
- GetHolder()->SetInUse(true);
- @@ -1037,11 +1068,17 @@ void Aura::ReapplyAffectedPassiveAuras()
- GetTarget()->CallForAllControlledUnits(ReapplyAffectedPassiveAurasHelper(this), CONTROLLED_PET|CONTROLLED_TOTEMS);
- // re-apply talents/passives/area auras applied to group members (it affected by player spellmods)
- - if (Group* group = ((Player*)GetTarget())->GetGroup())
- - for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- - if (Player* member = itr->getSource())
- - if (member != GetTarget() && member->IsInMap(GetTarget()))
- - ReapplyAffectedPassiveAuras(member, false);
- + if (GetTarget() && GetTarget()->IsInWorld() && GetTarget()->GetTypeId() == TYPEID_PLAYER)
- + {
- + if (Group* group = ((Player*)GetTarget())->GetGroup())
- + {
- + // Group locking implement required
- + for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- + if (Player* member = itr->getSource())
- + if (member != GetTarget() && member->IsInMap(GetTarget()))
- + ReapplyAffectedPassiveAuras(member, false);
- + }
- + }
- }
- bool Aura::IsEffectStacking()
- @@ -1188,7 +1225,16 @@ void Aura::HandleAddModifier(bool apply, bool Real)
- entry->EffectSpellClassMask[GetEffIndex()] = ClassFamilyMask::create<CF_SHAMAN_FLAMETONGUE_WEAPON>();
- }
- }
- - ((Player*)GetTarget())->AddSpellMod(this, apply);
- + if (GetTarget()->IsInWorld() && GetTarget()->GetMap())
- + {
- + MAPLOCK_READ(GetTarget(),MAP_LOCK_TYPE_AURAS)
- + ((Player*)GetTarget())->AddSpellMod(this, apply);
- + }
- + else
- + {
- + DEBUG_LOG("Player::AddSpellMod player %u not in world!",GetTarget()->GetObjectGuid().GetCounter());
- + ((Player*)GetTarget())->AddSpellMod(this, apply);
- + }
- ReapplyAffectedPassiveAuras();
- }
- @@ -9765,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;
- }
- @@ -9784,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();
- @@ -9842,16 +9889,53 @@ 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;
- }
- void SpellAuraHolder::ApplyAuraModifiers(bool apply, bool real)
- @@ -9904,7 +9988,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);
- @@ -10177,7 +10261,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);
- @@ -10221,13 +10305,16 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount)
- Unit* SpellAuraHolder::GetCaster() const
- {
- + if (!m_target)
- + return NULL;
- +
- if (GetCasterGuid() == m_target->GetObjectGuid())
- return m_target;
- return ObjectAccessor::GetUnit(*m_target, m_casterGuid);// player will search at any maps
- }
- -bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) const
- +bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref)
- {
- // only item casted spells
- if (!GetCastItemGuid())
- @@ -11298,10 +11385,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)
- @@ -11340,7 +11423,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
- @@ -11394,59 +11477,59 @@ void SpellAuraHolder::SetAuraMaxDuration(int32 duration)
- SetAuraFlags(GetAuraFlags() & ~AFLAG_DURATION);
- }
- -bool SpellAuraHolder::HasMechanic(uint32 mechanic) const
- +bool SpellAuraHolder::HasMechanic(uint32 mechanic)
- {
- if (mechanic == m_spellProto->Mechanic)
- return true;
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (m_auras[i] && m_spellProto->EffectMechanic[i] == mechanic)
- + if (GetAuraByEffectIndex(SpellEffectIndex(i)) && m_spellProto->EffectMechanic[i] == mechanic)
- return true;
- return false;
- }
- -bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const
- +bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask)
- {
- if (mechanicMask & (1 << (m_spellProto->Mechanic - 1)))
- 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 (GetAuraByEffectIndex(SpellEffectIndex(i)) && m_spellProto->EffectMechanic[i] && ((1 << (m_spellProto->EffectMechanic[i] -1)) & mechanicMask))
- return true;
- return false;
- }
- -bool SpellAuraHolder::IsPersistent() const
- +bool SpellAuraHolder::IsPersistent()
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- + if (Aura *aur = GetAuraByEffectIndex(SpellEffectIndex(i)))
- if (aur->IsPersistent())
- return true;
- return false;
- }
- -bool SpellAuraHolder::IsAreaAura() const
- +bool SpellAuraHolder::IsAreaAura()
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- + if (Aura *aur = GetAuraByEffectIndex(SpellEffectIndex(i)))
- if (aur->IsAreaAura())
- return true;
- return false;
- }
- -bool SpellAuraHolder::IsPositive() const
- +bool SpellAuraHolder::IsPositive()
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (Aura *aur = m_auras[i])
- + if (Aura *aur = GetAuraByEffectIndex(SpellEffectIndex(i)))
- if (!aur->IsPositive())
- return false;
- return true;
- }
- -bool SpellAuraHolder::IsEmptyHolder() const
- +bool SpellAuraHolder::IsEmptyHolder()
- {
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- - if (m_auras[i])
- + if (GetAuraByEffectIndex(SpellEffectIndex(i)))
- return false;
- return true;
- }
- diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
- index 7518fa8..5f21d07 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,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- void SetStackAmount(uint32 stackAmount);
- bool ModStackAmount(int32 num); // return true if last charge dropped
- - Aura* GetAuraByEffectIndex(SpellEffectIndex index) const { return m_auras[index]; }
- + Aura* GetAuraByEffectIndex(SpellEffectIndex index);
- uint32 GetId() const { return m_spellProto->Id; }
- SpellEntry const* GetSpellProto() const { return m_spellProto; }
- @@ -81,15 +87,15 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- void SetPermanent(bool permanent) { m_permanent = permanent; }
- bool IsPassive() const { return m_isPassive; }
- bool IsDeathPersistent() const { return m_isDeathPersist; }
- - bool IsPersistent() const;
- - bool IsPositive() const;
- - bool IsAreaAura() const; // if one from auras of holder applied as area aura
- - bool IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) const;
- + bool IsPersistent();
- + bool IsPositive();
- + bool IsAreaAura(); // if one from auras of holder applied as area aura
- + bool IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref);
- bool IsNeedVisibleSlot(Unit const* caster) const;
- bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
- bool IsInUse() const { return (m_in_use > 0);}
- bool IsDeleted() const { return m_deleted;}
- - bool IsEmptyHolder() const;
- + bool IsEmptyHolder();
- void SetDeleted() { m_deleted = true; }
- @@ -157,11 +163,13 @@ class MANGOS_DLL_SPEC SpellAuraHolder
- SetAuraDuration(duration);
- }
- - bool HasMechanic(uint32 mechanic) const;
- - bool HasMechanicMask(uint32 mechanicMask) const;
- + bool HasMechanic(uint32 mechanic);
- + bool HasMechanicMask(uint32 mechanicMask);
- ~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 +189,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 +217,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
- @@ -458,15 +468,18 @@ class MANGOS_DLL_SPEC Aura
- bool isAffectedOnSpell(SpellEntry const *spell) const;
- bool CanProcFrom(SpellEntry const *spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const;
- - //SpellAuraHolder const* GetHolder() const { return m_spellHolder; }
- - SpellAuraHolder* GetHolder() { return m_spellAuraHolder; }
- + SpellAuraHolder* GetHolder() { return m_spellAuraHolder; }
- SpellAuraHolder* const GetHolder() const { return m_spellAuraHolder; }
- bool IsLastAuraOnHolder();
- bool HasMechanic(uint32 mechanic) const;
- +
- + bool IsDeleted() const { return m_deleted;}
- + void SetDeleted() { m_deleted = true; }
- +
- protected:
- - Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- + Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- // must be called only from Aura::UpdateAura
- virtual void Update(uint32 diff);
- @@ -497,10 +510,11 @@ class MANGOS_DLL_SPEC Aura
- bool m_stacking:1; // Aura is not overwritten, but effects are not cumulative with similar effects
- int32 m_in_use; // > 0 while in Aura::ApplyModifier call/Aura::Update/etc
- + bool m_deleted;
- bool IsEffectStacking();
- - SpellAuraHolder* const m_spellAuraHolder;
- + SpellAuraHolder* m_spellAuraHolder;
- private:
- void ReapplyAffectedPassiveAuras(Unit* target, bool owner_mode);
- };
- @@ -508,7 +522,7 @@ class MANGOS_DLL_SPEC Aura
- class MANGOS_DLL_SPEC AreaAura : public Aura
- {
- public:
- - AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- + AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- ~AreaAura();
- protected:
- void Update(uint32 diff);
- @@ -520,7 +534,7 @@ class MANGOS_DLL_SPEC AreaAura : public Aura
- class MANGOS_DLL_SPEC PersistentAreaAura : public Aura
- {
- public:
- - PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- + PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- ~PersistentAreaAura();
- protected:
- void Update(uint32 diff);
- @@ -528,17 +542,16 @@ 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();
- Unit* GetTriggerTarget() const;
- protected:
- - SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- + SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder* holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- 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 2468eb9..994dcbd 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 76ccc5b..e3907df 100644
- --- a/src/game/Unit.cpp
- +++ b/src/game/Unit.cpp
- @@ -3720,7 +3720,7 @@ void Unit::_UpdateSpells( uint32 time )
- {
- SpellAuraHolder *holder = iter->second;
- - if (!(holder->IsPermanent() || holder->IsPassive()) && holder->GetAuraDuration() == 0)
- + if (!holder->IsDeleted() && !(holder->IsPermanent() || holder->IsPassive()) && holder->GetAuraDuration() == 0)
- {
- RemoveSpellAuraHolder(holder, AURA_REMOVE_BY_EXPIRE);
- iter = m_spellAuraHolders.begin();
- @@ -4726,7 +4726,7 @@ void Unit::RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except)
- SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId);
- for(SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; )
- {
- - Aura *aur = iter->second->m_auras[effindex];
- + Aura *aur = iter->second->GetAuraByEffectIndex(effindex);
- if (aur && aur != except)
- {
- RemoveSingleAuraFromSpellAuraHolder(iter->second, effindex);
- @@ -4776,7 +4776,7 @@ void Unit::RemoveSingleAuraFromSpellAuraHolder(uint32 spellId, SpellEffectIndex
- SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(spellId);
- for(SpellAuraHolderMap::iterator iter = spair.first; iter != spair.second; )
- {
- - Aura *aur = iter->second->m_auras[effindex];
- + Aura* aur = iter->second->GetAuraByEffectIndex(effindex);
- if (aur && aur->GetCasterGuid() == casterGuid)
- {
- RemoveSingleAuraFromSpellAuraHolder(iter->second, effindex, mode);
- @@ -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)
- @@ -5126,7 +5123,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
- void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode)
- {
- - if (!holder)
- + if (!holder || holder->IsDeleted())
- return;
- if (mode != AURA_REMOVE_BY_DELETE)
- @@ -5135,10 +5132,10 @@ void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode)
- // Statue unsummoned at holder remove
- SpellEntry const* AurSpellInfo = holder->GetSpellProto();
- Totem* statue = NULL;
- - Unit* caster = holder->GetCaster();
- - if (IsChanneledSpell(AurSpellInfo) && caster)
- - if (caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->IsTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
- - statue = ((Totem*)caster);
- + if (Unit* caster = holder->GetCaster())
- + if (IsChanneledSpell(AurSpellInfo))
- + if (caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->IsTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
- + statue = ((Totem*)caster);
- if (m_spellAuraHoldersUpdateIterator != m_spellAuraHolders.end() && m_spellAuraHoldersUpdateIterator->second == holder)
- ++m_spellAuraHoldersUpdateIterator;
- @@ -5158,7 +5155,7 @@ void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode)
- for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
- {
- - if (Aura *aura = holder->m_auras[i])
- + if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
- RemoveAura(aura, mode);
- }
- @@ -5178,11 +5175,12 @@ void Unit::RemoveSpellAuraHolder(SpellAuraHolder *holder, AuraRemoveMode mode)
- m_deletedHolders.push_back(holder);
- }
- - if (mode != AURA_REMOVE_BY_EXPIRE && IsChanneledSpell(AurSpellInfo) && !IsAreaOfEffectSpell(AurSpellInfo) &&
- - caster && caster->GetObjectGuid() != GetObjectGuid())
- - {
- - caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
- - }
- + if (Unit* caster = holder->GetCaster())
- + if (mode != AURA_REMOVE_BY_EXPIRE && IsChanneledSpell(AurSpellInfo) && !IsAreaOfEffectSpell(AurSpellInfo) &&
- + caster->GetObjectGuid() != GetObjectGuid())
- + {
- + caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
- + }
- }
- void Unit::RemoveSingleAuraFromSpellAuraHolder(SpellAuraHolder *holder, SpellEffectIndex index, AuraRemoveMode mode)
- @@ -5199,6 +5197,9 @@ void Unit::RemoveSingleAuraFromSpellAuraHolder(SpellAuraHolder *holder, SpellEff
- void Unit::RemoveAura(Aura *Aur, AuraRemoveMode mode)
- {
- + if (Aur->IsDeleted())
- + return;
- +
- // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
- if (Aur->GetModifier()->m_auraname < TOTAL_AURAS)
- {
- @@ -5212,12 +5213,12 @@ void Unit::RemoveAura(Aura *Aur, AuraRemoveMode mode)
- // remove aura from list before to prevent deleting it before
- ///m_Auras.erase(i);
- - DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
- + DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura (spell %u) %u now is remove mode %d",Aur->GetId(),Aur->GetModifier()->m_auraname, mode);
- // aura _MUST_ be remove from holder before unapply.
- // un-apply code expected that aura not find by diff searches
- // in another case it can be double removed for example, if target die/etc in un-apply process.
- - Aur->GetHolder()->RemoveAura(Aur->GetEffIndex());
- + Aur->SetDeleted();
- // some auras also need to apply modifier (on caster) on remove
- if (mode == AURA_REMOVE_BY_DELETE)
- @@ -7113,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* const 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;
- }
- @@ -12094,14 +12095,43 @@ bool Unit::IsIgnoreUnitState(SpellEntry const *spell, IgnoreUnitState ignoreStat
- void Unit::CleanupDeletedAuras()
- {
- - for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter)
- - delete *iter;
- - m_deletedHolders.clear();
- -
- // really delete auras "deleted" while processing its ApplyModify code
- - for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.end(); ++itr)
- - delete *itr;
- + if (IsInWorld()) // Not require true deleting aura in not-in-world unit. be removed in holders.
- + {
- + for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.end(); ++itr)
- + {
- + Aura* aura = *itr;
- + if (!aura)
- + continue;
- +
- + SpellAuraHolder* holder = aura->GetHolder();
- +
- + if (!holder) // now this impossible. need ASSERT in this.
- + {
- + sLog.outError("Unit::CleanupDeletedAuras - attempt to delete aura withot holder!");
- + continue;
- + }
- +
- + if (holder->IsDeleted()) // not need cleanup deleted holders - be removed later.
- + continue;
- +
- + holder->RemoveAura(aura->GetEffIndex());
- + }
- + }
- m_deletedAuras.clear();
- +
- + // really delete holders, "deleted" while processing update code
- + for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter)
- + {
- + if (*iter && (*iter)->IsDeleted())
- + delete *iter;
- + else if (*iter)
- + {
- + DEBUG_LOG("Unit::CleanupDeletedAuras - attempt to delete not marked for delete holder, unit %u, spell %u",GetObjectGuid().GetCounter(),(*iter)->GetId());
- + delete *iter;
- + }
- + }
- + m_deletedHolders.clear();
- }
- bool Unit::CheckAndIncreaseCastCounter()
- @@ -12154,8 +12184,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 e2a9e02..99ee2b7 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