aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-06-30 12:59:21 +0200
committerQAston <none@none>2009-06-30 12:59:21 +0200
commit788a699ae8556b45d1c570253290968224b054fb (patch)
tree1349ac253ba3be5cd48d95efae5eeadfbcd8641c /src
parent97027e0ff3430e19d714e0516870083163dfeca5 (diff)
*Prevent some possible crashes with charm auras.
*Allow non-dmg spells to proc dmg requiring effects if spellfamily specified in spell_proc_event table. --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp31
-rw-r--r--src/game/SpellMgr.cpp11
-rw-r--r--src/game/Unit.cpp2
3 files changed, 23 insertions, 21 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 5503dce1b3d..4d619f5fa5a 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -7227,6 +7227,9 @@ void AuraEffect::HandleModPossess(bool apply, bool Real, bool /*changeAmount*/)
if(!Real)
return;
+ if(m_target->getLevel() > m_amount)
+ return;
+
Unit* caster = GetCaster();
if(caster && caster->GetTypeId() == TYPEID_UNIT)
{
@@ -7235,12 +7238,7 @@ void AuraEffect::HandleModPossess(bool apply, bool Real, bool /*changeAmount*/)
}
if(apply)
- {
- if(m_target->getLevel() > m_amount)
- return;
-
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
- }
else
m_target->RemoveCharmedBy(caster);
}
@@ -7253,14 +7251,11 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*
Unit* caster = GetCaster();
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;
+ if(caster->GetGuardianPet() != m_target)
+ return;
if(apply)
- {
- if(caster->GetGuardianPet() != m_target)
- return;
-
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
- }
else
{
m_target->RemoveCharmedBy(caster);
@@ -7282,13 +7277,11 @@ void AuraEffect::HandleModCharm(bool apply, bool Real, bool /*changeAmount*/)
Unit* caster = GetCaster();
- if(apply)
- {
- if(m_amount && int32(m_target->getLevel()) > m_amount)
- return;
+ if(m_amount && int32(m_target->getLevel()) > m_amount)
+ return;
+ if(apply)
m_target->SetCharmedBy(caster, CHARM_TYPE_CHARM);
- }
else
m_target->RemoveCharmedBy(caster);
}
@@ -7298,15 +7291,13 @@ void AuraEffect::HandleCharmConvert(bool apply, bool Real, bool /*changeAmount*/
if(!Real)
return;
+ if(m_amount && int32(m_target->getLevel()) > m_amount)
+ return;
+
Unit* caster = GetCaster();
if(apply)
- {
- if(m_amount && int32(m_target->getLevel()) > m_amount)
- return;
-
m_target->SetCharmedBy(caster, CHARM_TYPE_CONVERT);
- }
else
m_target->RemoveCharmedBy(caster);
}
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index c92a75e4661..f47b1cb8ca2 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1272,6 +1272,17 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
// No extra req need
uint32 procEvent_procEx = PROC_EX_NONE;
+ // Some of not damaging spells have on damage procflags
+ // And all of them are specified by spellfamilymask in proc entry
+ // so, lets allow non dmg spells to proc on dmg auras if they have correct spellfamily
+ if (spellProcEvent && spellProcEvent->spellFamilyMask)
+ {
+ if (EventProcFlag & PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT && procFlags & PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT)
+ procFlags |= PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT;
+ if (EventProcFlag & PROC_FLAG_SUCCESSFUL_HEALING_SPELL && procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL)
+ procFlags |= PROC_FLAG_SUCCESSFUL_HEALING_SPELL;
+ }
+
// check prockFlags for condition
if((procFlags & EventProcFlag) == 0)
return false;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 227f75a8578..6da5ae063d4 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7894,7 +7894,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// try detect target manually if not set
if ( target == NULL )
- target = !(procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL | PROC_FLAG_SUCCESSFUL_HEALING_SPELL) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
+ target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL | PROC_FLAG_SUCCESSFUL_HEALING_SPELL)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
// default case
if(!target || target!=this && !target->isAlive())