diff options
-rw-r--r-- | sql/updates/world/2015_08_29_00_world.sql | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_holiday.cpp | 56 |
2 files changed, 59 insertions, 0 deletions
diff --git a/sql/updates/world/2015_08_29_00_world.sql b/sql/updates/world/2015_08_29_00_world.sql new file mode 100644 index 00000000000..2e42d16cd7b --- /dev/null +++ b/sql/updates/world/2015_08_29_00_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=45724; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(45724, 'spell_midsummer_braziers_hit'); diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 93e13667cb0..98ac71e3672 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -824,6 +824,60 @@ class spell_brewfest_barker_bunny : public SpellScriptLoader } }; +enum TorchSpells +{ + SPELL_TORCH_TOSSING_TRAINING = 45716, + SPELL_TORCH_TOSSING_PRACTICE = 46630, + SPELL_TORCH_TOSSING_TRAINING_SUCCESS_ALLIANCE = 45719, + SPELL_TORCH_TOSSING_TRAINING_SUCCESS_HORDE = 46651, + SPELL_BRAZIERS_HIT = 45724 +}; + +// 45724 - Braziers Hit! +class spell_midsummer_braziers_hit : public SpellScriptLoader +{ + public: + spell_midsummer_braziers_hit() : SpellScriptLoader("spell_midsummer_braziers_hit") { } + + class spell_midsummer_braziers_hit_AuraScript : public AuraScript + { + PrepareAuraScript(spell_midsummer_braziers_hit_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_TORCH_TOSSING_TRAINING) || !sSpellMgr->GetSpellInfo(SPELL_TORCH_TOSSING_PRACTICE)) + return false; + return true; + } + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Player* player = GetTarget()->ToPlayer(); + if (!player) + return; + + if ((player->HasAura(SPELL_TORCH_TOSSING_TRAINING) && GetStackAmount() == 8) || (player->HasAura(SPELL_TORCH_TOSSING_PRACTICE) && GetStackAmount() == 20)) + { + if (player->GetTeam() == ALLIANCE) + player->CastSpell(player, SPELL_TORCH_TOSSING_TRAINING_SUCCESS_ALLIANCE, true); + else if (player->GetTeam() == HORDE) + player->CastSpell(player, SPELL_TORCH_TOSSING_TRAINING_SUCCESS_HORDE, true); + Remove(); + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_midsummer_braziers_hit_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AuraEffectHandleModes(AURA_EFFECT_HANDLE_REAPPLY)); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_midsummer_braziers_hit_AuraScript(); + } +}; + void AddSC_holiday_spell_scripts() { // Love is in the Air @@ -850,4 +904,6 @@ void AddSC_holiday_spell_scripts() new spell_brewfest_relay_race_intro_force_player_to_throw(); new spell_brewfest_dismount_ram(); new spell_brewfest_barker_bunny(); + //Midsummer Fire Festival + new spell_midsummer_braziers_hit(); } |