Core/Spells: Added safe-checks for places where caster/victim can be null.
And some random cleanup
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1755,7 +1755,7 @@ class Unit : public WorldObject
|
||||
AuraMap const& GetOwnedAuras() const { return m_ownedAuras; }
|
||||
|
||||
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveOwnedAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const;
|
||||
@@ -1765,12 +1765,12 @@ class Unit : public WorldObject
|
||||
AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; }
|
||||
|
||||
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAuraFromStack(uint32 spellId, uint64 caster = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
|
||||
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer);
|
||||
void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId);
|
||||
|
||||
@@ -5599,6 +5599,9 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
|
||||
case 66149: // Bullet Controller Periodic - 10 Man
|
||||
case 68396: // Bullet Controller Periodic - 25 Man
|
||||
{
|
||||
if (!caster)
|
||||
break;
|
||||
|
||||
caster->CastCustomSpell(66152, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true);
|
||||
caster->CastCustomSpell(66153, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user