diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Pet.cpp | 14 | ||||
-rw-r--r-- | src/game/Player.cpp | 15 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 14 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/Unit.cpp | 5 |
5 files changed, 28 insertions, 21 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index b4ee8b6732b..894a3b37f32 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1169,6 +1169,11 @@ void Pet::_LoadAuras(uint32 timediff) Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL); aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]); + if(!aura->CanBeSaved()) + { + delete aura; + continue; + } AddAura(aura); sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask); } @@ -1185,15 +1190,8 @@ void Pet::_SaveAuras() AuraMap const& auras = GetAuras(); for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr) { - // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras. - // do not save single target auras (unless they were cast by the player) - if (itr->second->IsPassive() || itr->second->IsAuraType(SPELL_AURA_MOD_STEALTH)) + if(!itr->second->CanBeSaved()) continue; - bool isCaster = itr->second->GetCasterGUID() == GetGUID(); - if (!isCaster) - if (itr->second->IsSingleTarget() - || itr->second->IsAreaAura()) - continue; int32 amounts[MAX_SPELL_EFFECTS]; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index dc28d3c9a8c..d9ffdab5365 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15195,6 +15195,11 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL); aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]); + if(!aura->CanBeSaved()) + { + delete aura; + continue; + } AddAura(aura); sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask); } @@ -16275,17 +16280,9 @@ void Player::_SaveAuras() AuraMap const& auras = GetAuras(); for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr) { - // skip: - // area auras or single cast auras casted by other unit - // passive auras and stances - if (itr->second->IsPassive()) + if(!itr->second->CanBeSaved()) continue; - if (itr->second->GetCasterGUID() != GetGUID()) - if (IsSingleTargetSpell(itr->second->GetSpellProto()) - || itr->second->IsAreaAura()) - continue; - int32 amounts[MAX_SPELL_EFFECTS]; for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i) { diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 038583bee42..9eb9a4ef62b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1521,6 +1521,18 @@ bool Aura::DropAuraCharge() return false; } +bool Aura::CanBeSaved() const +{ + if (IsPassive()) + return false; + + if (GetCasterGUID() != m_target->GetGUID()) + if (IsSingleTargetSpell(GetSpellProto()) || IsAreaAura()) + return false; + + return true; +} + bool Aura::IsPersistent() const { for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -1799,7 +1811,7 @@ void Aura::UnregisterSingleCastAura() } else { - sLog.outError("Couldn't find the caster of the single target aura, may crash later!"); + sLog.outCrash("Couldn't find the caster (guid: "UI64FMTD") of the single target aura %u which is on unit entry %u class %u, may crash later!", GetCasterGUID(), GetId(), m_target->GetEntry(), m_target->getClass()); assert(false); } m_isSingleTargetAura = false; diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index e05e255b412..c1756a0429f 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -101,6 +101,7 @@ class TRINITY_DLL_SPEC Aura bool IsPassive() const { return m_isPassive; } bool IsDeathPersistent() const { return m_isDeathPersist; } bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; } + bool CanBeSaved() const; bool IsUpdated() const { return m_updated; } bool IsRemoved() const { return m_isRemoved; } void SetUpdated(bool val) { m_updated = val; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a124dc464c0..01bfe2bf812 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3924,8 +3924,7 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects) for(;;) { Unit* caster = Aur->GetCaster(); - if(!caster) // caster deleted and not required adding scAura - break; + assert(caster); bool restart = false; AuraList& scAuras = caster->GetSingleCastAuras(); @@ -4251,7 +4250,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase) if (aura->GetTarget() != this && !aura->GetTarget()->InSamePhase(newPhase)) { uint32 removedAuras = m_removedAurasCount; - aura->GetTarget()->RemoveAura(aura->GetId(),aura->GetCasterGUID()); + aura->GetTarget()->RemoveAura(aura); if (removedAuras+1<m_removedAurasCount) iter=scAuras.begin(); } |