aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellAuras.cpp
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/game/SpellAuras.cpp
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/game/SpellAuras.cpp')
-rw-r--r--src/game/SpellAuras.cpp31
1 files changed, 11 insertions, 20 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);
}