aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-16 15:46:27 -0600
committermegamage <none@none>2009-03-16 15:46:27 -0600
commit8921eb048dcc1d8d92219c94640ae228a3fa83e7 (patch)
treed12925840cb4614c886cfb95944f9c2f032ee2e7 /src
parent3eba06e4ad7c9b92babd3df14d0602212e60b7cc (diff)
[7469] Allow scripting aura spell triggering in case not existed spell. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 3fa0a58c307..c43319b7e72 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -43,6 +43,7 @@
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
#include "CreatureAI.h"
+#include "ScriptCalls.h"
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -1310,7 +1311,7 @@ void Aura::TriggerSpell()
caster->ModifyPower( POWER_MANA, mana );
caster->SendEnergizeSpellLog(caster, 23493, mana, POWER_MANA);
}
- break;
+ return;
}
// // Stoneclaw Totem Passive TEST
// case 23792: break;
@@ -1389,8 +1390,6 @@ void Aura::TriggerSpell()
// case 28522: break;
// // Silithyst
// case 29519: break;
-// // Inoculate Nestlewood Owlkin
- case 29528: trigger_spell_id = 28713; break;
// // Overload
// case 29768: break;
// // Return Fire
@@ -1432,7 +1431,6 @@ void Aura::TriggerSpell()
creature->SetHealth(0); // just for nice GM-mode view
}
return;
- break;
}
// Quake
case 30576: trigger_spell_id = 30571; break;
@@ -1826,13 +1824,9 @@ void Aura::TriggerSpell()
default:
break;
}
+
// Reget trigger spell proto
triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id);
- if(triggeredSpellInfo == NULL)
- {
- sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
- return;
- }
}
else
{
@@ -1884,17 +1878,19 @@ void Aura::TriggerSpell()
}
}
}
+
if(!caster->GetSpellMaxRangeForTarget(m_target,sSpellRangeStore.LookupEntry(triggeredSpellInfo->rangeIndex)))
target = m_target; //for druid dispel poison
- m_target->CastSpell(target, triggeredSpellInfo, true, 0, this, GetCasterGUID());
+
+ if(triggeredSpellInfo)
+ m_target->CastSpell(target, triggeredSpellInfo, true, 0, this, GetCasterGUID());
+ else if(target->GetTypeId()!=TYPEID_UNIT || !Script->EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)target))
+ sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
}
Unit* Aura::GetTriggerTarget() const
{
- Unit* target = ObjectAccessor::GetUnit(*m_target,
- /*m_target->GetTypeId()==TYPEID_PLAYER ?
- ((Player*)m_target)->GetSelection() :*/
- m_target->GetUInt64Value(UNIT_FIELD_TARGET));
+ Unit* target = ObjectAccessor::GetUnit(*m_target, m_target->GetUInt64Value(UNIT_FIELD_TARGET));
return target ? target : m_target;
}