From 109bcb0927d853c9a7340ac55f84003d12ff4762 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 3 Aug 2010 10:47:38 +0200 Subject: [PATCH] Fixed Heart of the Phoenix pet spell --HG-- branch : trunk --- sql/base/world_database.sql | 1 + sql/updates/9149_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_hunter.cpp | 50 ++++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 sql/updates/9149_world_spell_script_names.sql diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql index 221f374844..d5d2efda35 100644 --- a/sql/base/world_database.sql +++ b/sql/base/world_database.sql @@ -14693,6 +14693,7 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES ( 23989, 'spell_hun_readiness'), ( 53271, 'spell_hun_masters_call'), ( 53478, 'spell_hun_last_stand_pet'), +( 55709, 'spell_hun_pet_heart_of_the_phoenix'), -- rogue ( 5938, 'spell_rog_shiv'), ( 14185, 'spell_rog_preparation'), diff --git a/sql/updates/9149_world_spell_script_names.sql b/sql/updates/9149_world_spell_script_names.sql new file mode 100644 index 0000000000..5ca5b8c2f5 --- /dev/null +++ b/sql/updates/9149_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=55709 AND `ScriptName`='spell_hun_pet_heart_of_the_phoenix'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(55709, 'spell_hun_pet_heart_of_the_phoenix'); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 17c5858f00..f5aa0d1f1d 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -28,6 +28,9 @@ enum HunterSpells HUNTER_SPELL_READINESS = 23989, HUNTER_SPELL_BESTIAL_WRATH = 19574, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED = 53479, + HUNTER_PET_HEART_OF_THE_PHOENIX = 55709, + HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114, + HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711, }; class spell_hun_last_stand_pet_SpellScript : public SpellScript @@ -121,6 +124,46 @@ SpellScript * GetSpellScript_spell_hun_readiness() return new spell_hun_readiness_SpellScript(); } +class spell_hun_pet_heart_of_the_phoenix : public SpellScript +{ + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED)) + return false; + if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + if (caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + return; + Unit *caster = GetCaster(); + int32 bp0healPercent = 100; + caster->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); + caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); + } + + void Register() + { + // add dummy effect spell handler to pet's Last Stand + EffectHandlers += EffectHandlerFn(spell_hun_pet_heart_of_the_phoenix::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + + bool Load() + { + if (!GetCaster()->isPet()) + return false; + return true; + } +}; + +SpellScript * GetSpellScript_spell_hun_pet_heart_of_the_phoenix() +{ + return new spell_hun_pet_heart_of_the_phoenix(); +} + void AddSC_hunter_spell_scripts() { Script *newscript; @@ -139,4 +182,9 @@ void AddSC_hunter_spell_scripts() newscript->Name = "spell_hun_readiness"; newscript->GetSpellScript = &GetSpellScript_spell_hun_readiness; newscript->RegisterSelf(); -} \ No newline at end of file + + newscript = new Script; + newscript->Name = "spell_hun_pet_heart_of_the_phoenix"; + newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_heart_of_the_phoenix; + newscript->RegisterSelf(); +}