diff options
author | Aokromes <Aokromes@users.noreply.github.com> | 2016-06-26 00:27:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-26 00:27:19 +0200 |
commit | b0e5f6de47e85e1ca7cd3cc54dcf31fddac71a9f (patch) | |
tree | e1a3066a12d5c0cfa8bba9ed7d8edbf70492fb6e | |
parent | fdf0092ac24a27f1e95ffeb4f0257404998980ee (diff) |
Scripts/Midsummer: Burning hot pole dance (#17445)
* Scripts/Midsummer: Burning hot pole dance
By zwerg, closes #6876
-rw-r--r-- | sql/updates/world/3.3.5/2016_99_99_99_world_.sql | 10 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_holiday.cpp | 65 |
2 files changed, 75 insertions, 0 deletions
diff --git a/sql/updates/world/3.3.5/2016_99_99_99_world_.sql b/sql/updates/world/3.3.5/2016_99_99_99_world_.sql new file mode 100644 index 00000000000..b9ab8f12a54 --- /dev/null +++ b/sql/updates/world/3.3.5/2016_99_99_99_world_.sql @@ -0,0 +1,10 @@ +-- Link Dancer Check Aura and Visual to Ribbon Pole Channel +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (29531,45390); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(29531,45390,0, 'Ribbon Pole - Dancer Check Aura'), +(45390,45406,2, 'Ribbon Pole - Periodic Visual'); + +-- Spell Script +DELETE FROM `spell_script_names` WHERE `spell_id`=45390; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(45390, 'spell_gen_ribbon_pole_dancer_check'); diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 6442eb8acca..73347ff1163 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -1183,6 +1183,70 @@ class spell_midsummer_braziers_hit : public SpellScriptLoader } }; +enum RibbonPoleData +{ + SPELL_HAS_FULL_MIDSUMMER_SET = 58933, + SPELL_BURNING_HOT_POLE_DANCE = 58934, + SPELL_RIBBON_DANCE = 29175, + GO_RIBBON_POLE = 181605, +}; + +class spell_gen_ribbon_pole_dancer_check : public SpellScriptLoader +{ + public: + spell_gen_ribbon_pole_dancer_check() : SpellScriptLoader("spell_gen_ribbon_pole_dancer_check") { } + + class spell_gen_ribbon_pole_dancer_check_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_ribbon_pole_dancer_check_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_HAS_FULL_MIDSUMMER_SET) + || !sSpellMgr->GetSpellInfo(SPELL_RIBBON_DANCE) + || !sSpellMgr->GetSpellInfo(SPELL_BURNING_HOT_POLE_DANCE)) + return false; + return true; + } + + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + + // check if aura needs to be removed + if (!target->FindNearestGameObject(GO_RIBBON_POLE, 20.0f) || !target->HasUnitState(UNIT_STATE_CASTING)) + { + target->InterruptNonMeleeSpells(false); + target->RemoveAurasDueToSpell(GetId()); + return; + } + + // set xp buff duration + if (Aura* aur = target->GetAura(SPELL_RIBBON_DANCE)) + { + aur->SetMaxDuration(std::min(3600000, aur->GetMaxDuration() + 180000)); + aur->RefreshDuration(); + + // reward achievement criteria + if (aur->GetMaxDuration() == 3600000 && target->HasAura(SPELL_HAS_FULL_MIDSUMMER_SET)) + target->CastSpell(target, SPELL_BURNING_HOT_POLE_DANCE, true); + } + else + target->AddAura(SPELL_RIBBON_DANCE, target); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_ribbon_pole_dancer_check_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_ribbon_pole_dancer_check_AuraScript(); + } +}; + void AddSC_holiday_spell_scripts() { // Love is in the Air @@ -1219,4 +1283,5 @@ void AddSC_holiday_spell_scripts() new spell_brewfest_barker_bunny(); // Midsummer Fire Festival new spell_midsummer_braziers_hit(); + new spell_gen_ribbon_pole_dancer_check(); } |