Core/Spells: Add GetTriggeringSpell() method to SpellScript and use it to properly filter server side spell 18350's script.

This commit is contained in:
Machiavelli
2011-08-06 19:39:45 +02:00
parent 157dff1ed3
commit 156d491c27
3 changed files with 16 additions and 0 deletions

View File

@@ -455,6 +455,11 @@ void SpellScript::CreateItem(uint32 effIndex, uint32 itemId)
m_spell->DoCreateItem(effIndex, itemId);
}
SpellInfo const* SpellScript::GetTriggeringSpell()
{
return m_spell->m_triggeredByAuraSpell;
}
void SpellScript::FinishCast(SpellCastResult result)
{
m_spell->SendCastResult(result);

View File

@@ -320,6 +320,9 @@ class SpellScript : public _SpellScript
// Creates item. Calls Spell::DoCreateItem method.
void CreateItem(uint32 effIndex, uint32 itemId);
// Returns SpellInfo from the spell that triggered the current one
SpellInfo const* GetTriggeringSpell();
// finishes spellcast prematurely with selected error message
void FinishCast(SpellCastResult result);

View File

@@ -1210,6 +1210,7 @@ class spell_gen_soul_preserver : public SpellScriptLoader
{
enum Spells
{
SOUL_PRESERVER = 60510,
HEALING_TRANCE_DRUID = 60512,
HEALING_TRANCE_PALADIN = 60513,
HEALING_TRANCE_PRIEST = 60514,
@@ -1223,6 +1224,13 @@ class spell_gen_soul_preserver : public SpellScriptLoader
{
PrepareSpellScript(spell_gen_soul_preserver_SpellScript);
bool Load()
{
// 18350 is a common placeholder for trigered spells
// this script only applies to 60510
return GetTriggeringSpell()->Id == SOUL_PRESERVER;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
uint32 triggeredSpell = 0;