From e23b6436c5f84aa229af92c57e0ebc5fb04ec6c6 Mon Sep 17 00:00:00 2001 From: Kirkhammett Date: Thu, 29 Aug 2013 14:37:29 +0200 Subject: Core/Quests: Escape from Silverbrook 12308 --- src/server/scripts/Spells/spell_quest.cpp | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 1e340354ff6..2a23d6d8135 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1963,6 +1963,77 @@ class spell_q12690_burst_at_the_seams : public SpellScriptLoader } }; +enum EscapeFromSilverbrook +{ + SPELL_SUMMON_WORGEN = 48681 +}; + +// 48682 - Escape from Silverbrook - Periodic Dummy +class spell_q12308_escape_from_silverbrook : public SpellScriptLoader +{ + public: + spell_q12308_escape_from_silverbrook() : SpellScriptLoader("spell_q12308_escape_from_silverbrook") { } + + class spell_q12308_escape_from_silverbrook_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12308_escape_from_silverbrook_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_WORGEN)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_WORGEN, true); + } + + void Register() OVERRIDE + { + OnEffectHit += SpellEffectFn(spell_q12308_escape_from_silverbrook_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_q12308_escape_from_silverbrook_SpellScript(); + } +}; + +// 48681 - Summon Silverbrook Worgen +class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoader +{ + public: + spell_q12308_escape_from_silverbrook_summon_worgen() : SpellScriptLoader("spell_q12308_escape_from_silverbrook_summon_worgen") { } + + class spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript); + + void ModDest(SpellEffIndex effIndex) + { + float dist = GetSpellInfo()->Effects[effIndex].CalcRadius(GetCaster()); + float angle = (urand(0, 1) ? -1 : 1) * (frand(0.75f, 1.0f) * M_PI); + + Position pos; + GetCaster()->GetNearPosition(pos, dist, angle); + GetHitDest()->Relocate(&pos); + } + + void Register() OVERRIDE + { + OnEffectHit += SpellEffectFn(spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript::ModDest, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_q12308_escape_from_silverbrook_summon_worgen_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -2010,4 +2081,6 @@ void AddSC_quest_spell_scripts() new spell_q13011_bear_flank_master(); new spell_q13086_cannons_target(); new spell_q12690_burst_at_the_seams(); + new spell_q12308_escape_from_silverbrook_summon_worgen(); + new spell_q12308_escape_from_silverbrook(); } -- cgit v1.2.3