TrinityCore/TrinityCore — comment on commit 2f2b84f6e58107f8ae237749299f95d89ed93b23
File:  line 0
By oMadMano:

so let me understand if i try to use all the possible crashes in spellauraseffects it should not change any of ingame mechanics

example:
'''
@@ -692,11 +692,11 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (!caster)
break;
// Icebound Fortitude
if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00100000)
{
- if (caster->GetTypeId() == TYPEID_PLAYER)
+ if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
int32 value = (-1 * amount) - 10;
uint32 defva = uint32(caster->ToPlayer()->GetSkillValue(SKILL_DEFENSE) + caster->ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));

if (defva > 400)
@@ -1013,11 +1013,11 @@ void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply)
HandleEffect(aurApp, mode, apply);
}

void AuraEffect::ApplySpellMod(Unit* target, bool apply)
{
- if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
+ if (!m_spellmod || (target && target->GetTypeId() != TYPEID_PLAYER))
return;

target->ToPlayer()->AddSpellMod(m_spellmod, apply);

// Auras with charges do not mod amount of passive auras
@@ -1129,11 +1129,11 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
case 43183:
case 46755:
case 49472: // Drink Coffee
case 57073:
case 61830:
- if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
+ if (!caster || caster && caster->GetTypeId() != TYPEID_PLAYER)
return;
// Get SPELL_AURA_MOD_POWER_REGEN aura from spell
if (AuraEffect* aurEff = GetBase()->GetEffect(0))
{
if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
@@ -1142,11 +1142,11 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
sLog->outError("Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
}
else
{
// default case - not in arena
- if (!caster->ToPlayer()->InArena())
+ if (caster && !caster->ToPlayer()->InArena())
{
aurEff->ChangeAmount(GetAmount());
m_isPeriodic = false;
}
else
@@ -1451,18 +1451,18 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
if (apply)
{
// Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell
if (spellId)
{
- if (target->GetTypeId() == TYPEID_PLAYER)
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->RemoveSpellCooldown(spellId);
target->CastSpell(target, spellId, true, NULL, this);
}

if (spellId2)
{
- if (target->GetTypeId() == TYPEID_PLAYER)
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->RemoveSpellCooldown(spellId2);
target->CastSpell(target, spellId2, true, NULL, this);
}

if (target->GetTypeId() == TYPEID_PLAYER)

'''