Jump to content

[crash] SpellAuras.cpp


Auntie Mangos

Recommended Posts

  • 40 years later...

i think your crash dump can't say anything, anyway by fast looking into the code i find one thing, we didn't check if target is in world :/

 src/game/SpellAuras.cpp |   57 ++++++++++++++++++----------------------------
1 files changed, 22 insertions(+), 35 deletions(-)

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 59b037f..d9af2ae 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -7284,13 +7284,32 @@ void Aura::PeriodicTick()
{
    switch(m_modifier.m_auraname)
    {
+        // don't do anything to target that isn't in world or dead, possible death persistent effects
        case SPELL_AURA_PERIODIC_DAMAGE:
        case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
-        {
-            // don't damage target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
+        case SPELL_AURA_PERIODIC_LEECH:
+        case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
+        case SPELL_AURA_PERIODIC_HEAL:
+        case SPELL_AURA_OBS_MOD_HEALTH:
+        case SPELL_AURA_PERIODIC_MANA_LEECH:
+        case SPELL_AURA_POWER_BURN_MANA:
+        case SPELL_AURA_PERIODIC_ENERGIZE:
+        case SPELL_AURA_OBS_MOD_MANA:
+        case SPELL_AURA_POWER_BURN_MANA:
+        case SPELL_AURA_MOD_REGEN:
+        case SPELL_AURA_MOD_POWER_REGEN:
+            if (!m_target->IsInWorld() || !m_target->isAlive())
                return;
+            break;
+        default:
+            break;
+    }

+    switch(m_modifier.m_auraname)
+    {
+        case SPELL_AURA_PERIODIC_DAMAGE:
+        case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
+        {
            Unit *pCaster = GetCaster();
            if(!pCaster)
                return;
@@ -7427,10 +7446,6 @@ void Aura::PeriodicTick()
        case SPELL_AURA_PERIODIC_LEECH:
        case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
        {
-            // don't damage target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            Unit *pCaster = GetCaster();
            if(!pCaster)
                return;
@@ -7516,10 +7531,6 @@ void Aura::PeriodicTick()
        case SPELL_AURA_PERIODIC_HEAL:
        case SPELL_AURA_OBS_MOD_HEALTH:
        {
-            // don't heal target if not alive, mostly death persistent effects from items
-            if (!m_target->isAlive())
-                return;
-
            Unit *pCaster = GetCaster();
            if(!pCaster)
                return;
@@ -7618,10 +7629,6 @@ void Aura::PeriodicTick()
        }
        case SPELL_AURA_PERIODIC_MANA_LEECH:
        {
-            // don't damage target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
                return;

@@ -7695,10 +7702,6 @@ void Aura::PeriodicTick()
        }
        case SPELL_AURA_PERIODIC_ENERGIZE:
        {
-            // don't energize target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            // ignore non positive values (can be result apply spellmods to aura damage
            uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;

@@ -7724,10 +7727,6 @@ void Aura::PeriodicTick()
        }
        case SPELL_AURA_OBS_MOD_MANA:
        {
-            // don't energize target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            // ignore non positive values (can be result apply spellmods to aura damage
            uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;

@@ -7750,10 +7749,6 @@ void Aura::PeriodicTick()
        }
        case SPELL_AURA_POWER_BURN_MANA:
        {
-            // don't mana burn target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            Unit *pCaster = GetCaster();
            if(!pCaster)
                return;
@@ -7800,10 +7795,6 @@ void Aura::PeriodicTick()
        }
        case SPELL_AURA_MOD_REGEN:
        {
-            // don't heal target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            int32 gain = m_target->ModifyHealth(m_modifier.m_amount);
            if (Unit *caster = GetCaster())
                m_target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
@@ -7811,10 +7802,6 @@ void Aura::PeriodicTick()
        }
        case SPELL_AURA_MOD_POWER_REGEN:
        {
-            // don't energize target if not alive, possible death persistent effects
-            if (!m_target->isAlive())
-                return;
-
            Powers pt = m_target->getPowerType();
            if(int32(pt) != m_modifier.m_miscvalue)
                return;

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use