Core/Spells: Added safe-checks for places where caster/victim can be null.
And some random cleanup
This commit is contained in:
1 parent
ad1f1dad59
commit
e16e18da23
3 files changed
+17
-12
No files matched your search
@@ -3475,10 +3475,10 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
|
||||
i = m_ownedAuras.begin();
|
||||
}
|
||||
|
||||
void Unit::RemoveOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
void Unit::RemoveOwnedAura(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
{
|
||||
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
|
||||
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster))
|
||||
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
|
||||
{
|
||||
RemoveOwnedAura(itr, removeMode);
|
||||
itr = m_ownedAuras.lower_bound(spellId);
|
||||
@@ -3581,13 +3581,13 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
|
||||
RemoveAura(aurApp, mode);
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
{
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
{
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
|
||||
&& (!caster || aura->GetCasterGUID() == caster))
|
||||
&& (!casterGUID || aura->GetCasterGUID() == casterGUID))
|
||||
{
|
||||
RemoveAura(iter, removeMode);
|
||||
iter = m_appliedAuras.lower_bound(spellId);
|
||||
@@ -3597,13 +3597,13 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster, uint8 reqEffMask
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster, AuraRemoveMode removeMode)
|
||||
void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
if ((aura->GetType() == UNIT_AURA_TYPE)
|
||||
&& (!caster || aura->GetCasterGUID() == caster))
|
||||
&& (!casterGUID || aura->GetCasterGUID() == casterGUID))
|
||||
{
|
||||
aura->ModStackAmount(-1, removeMode);
|
||||
return;
|
||||
@@ -5286,7 +5286,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
|
||||
{
|
||||
// triggered at positive/self casts also, current attack target used then
|
||||
if (IsFriendlyTo(target))
|
||||
if (target && IsFriendlyTo(target))
|
||||
{
|
||||
target = getVictim();
|
||||
if (!target)
|
||||
@@ -14349,8 +14349,10 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
|
||||
}
|
||||
case SPELL_AURA_PROC_TRIGGER_DAMAGE:
|
||||
{
|
||||
if(!target) //Crash: spell 49065 casted by GO
|
||||
// target has to be valid
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", triggeredByAura->GetAmount(), spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
|
||||
SpellNonMeleeDamage damageInfo(this, target, spellInfo->Id, spellInfo->SchoolMask);
|
||||
uint32 damage = SpellDamageBonus(target, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
|
||||
|
||||
Reference in new issue
Block a user