*Try to fix a crash caused by single target auras. Thanks to QAston.
--HG-- branch : trunk
This commit is contained in:
+6
-8
@@ -1169,6 +1169,11 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||||||
|
|
||||||
Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
|
Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
|
||||||
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
|
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
|
||||||
|
if(!aura->CanBeSaved())
|
||||||
|
{
|
||||||
|
delete aura;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
AddAura(aura);
|
AddAura(aura);
|
||||||
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
|
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
|
||||||
}
|
}
|
||||||
@@ -1185,15 +1190,8 @@ void Pet::_SaveAuras()
|
|||||||
AuraMap const& auras = GetAuras();
|
AuraMap const& auras = GetAuras();
|
||||||
for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
|
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.
|
if(!itr->second->CanBeSaved())
|
||||||
// do not save single target auras (unless they were cast by the player)
|
|
||||||
if (itr->second->IsPassive() || itr->second->IsAuraType(SPELL_AURA_MOD_STEALTH))
|
|
||||||
continue;
|
continue;
|
||||||
bool isCaster = itr->second->GetCasterGUID() == GetGUID();
|
|
||||||
if (!isCaster)
|
|
||||||
if (itr->second->IsSingleTarget()
|
|
||||||
|| itr->second->IsAreaAura())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int32 amounts[MAX_SPELL_EFFECTS];
|
int32 amounts[MAX_SPELL_EFFECTS];
|
||||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
|
|||||||
+6
-9
@@ -15195,6 +15195,11 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
|
|||||||
|
|
||||||
Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
|
Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
|
||||||
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
|
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
|
||||||
|
if(!aura->CanBeSaved())
|
||||||
|
{
|
||||||
|
delete aura;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
AddAura(aura);
|
AddAura(aura);
|
||||||
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
|
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
|
||||||
}
|
}
|
||||||
@@ -16275,17 +16280,9 @@ void Player::_SaveAuras()
|
|||||||
AuraMap const& auras = GetAuras();
|
AuraMap const& auras = GetAuras();
|
||||||
for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
|
for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
|
||||||
{
|
{
|
||||||
// skip:
|
if(!itr->second->CanBeSaved())
|
||||||
// area auras or single cast auras casted by other unit
|
|
||||||
// passive auras and stances
|
|
||||||
if (itr->second->IsPassive())
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (itr->second->GetCasterGUID() != GetGUID())
|
|
||||||
if (IsSingleTargetSpell(itr->second->GetSpellProto())
|
|
||||||
|| itr->second->IsAreaAura())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int32 amounts[MAX_SPELL_EFFECTS];
|
int32 amounts[MAX_SPELL_EFFECTS];
|
||||||
for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
|
for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-1
@@ -1521,6 +1521,18 @@ bool Aura::DropAuraCharge()
|
|||||||
return false;
|
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
|
bool Aura::IsPersistent() const
|
||||||
{
|
{
|
||||||
for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
@@ -1799,7 +1811,7 @@ void Aura::UnregisterSingleCastAura()
|
|||||||
}
|
}
|
||||||
else
|
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);
|
assert(false);
|
||||||
}
|
}
|
||||||
m_isSingleTargetAura = false;
|
m_isSingleTargetAura = false;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class TRINITY_DLL_SPEC Aura
|
|||||||
bool IsPassive() const { return m_isPassive; }
|
bool IsPassive() const { return m_isPassive; }
|
||||||
bool IsDeathPersistent() const { return m_isDeathPersist; }
|
bool IsDeathPersistent() const { return m_isDeathPersist; }
|
||||||
bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
|
bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
|
||||||
|
bool CanBeSaved() const;
|
||||||
bool IsUpdated() const { return m_updated; }
|
bool IsUpdated() const { return m_updated; }
|
||||||
bool IsRemoved() const { return m_isRemoved; }
|
bool IsRemoved() const { return m_isRemoved; }
|
||||||
void SetUpdated(bool val) { m_updated = val; }
|
void SetUpdated(bool val) { m_updated = val; }
|
||||||
|
|||||||
+2
-3
@@ -3924,8 +3924,7 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects)
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
Unit* caster = Aur->GetCaster();
|
Unit* caster = Aur->GetCaster();
|
||||||
if(!caster) // caster deleted and not required adding scAura
|
assert(caster);
|
||||||
break;
|
|
||||||
|
|
||||||
bool restart = false;
|
bool restart = false;
|
||||||
AuraList& scAuras = caster->GetSingleCastAuras();
|
AuraList& scAuras = caster->GetSingleCastAuras();
|
||||||
@@ -4251,7 +4250,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
|||||||
if (aura->GetTarget() != this && !aura->GetTarget()->InSamePhase(newPhase))
|
if (aura->GetTarget() != this && !aura->GetTarget()->InSamePhase(newPhase))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAurasCount;
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
aura->GetTarget()->RemoveAura(aura->GetId(),aura->GetCasterGUID());
|
aura->GetTarget()->RemoveAura(aura);
|
||||||
if (removedAuras+1<m_removedAurasCount)
|
if (removedAuras+1<m_removedAurasCount)
|
||||||
iter=scAuras.begin();
|
iter=scAuras.begin();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user