diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/Kalimdor/zone_durotar.cpp | 63 | ||||
| -rw-r--r-- | src/server/scripts/Kalimdor/zone_orgrimmar.cpp | 46 | ||||
| -rw-r--r-- | src/server/scripts/Pandaria/pandaria_scripts_loader.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Pandaria/zone_the_jade_forest.cpp | 120 |
4 files changed, 210 insertions, 21 deletions
diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index 181151a15a7..9e69f784319 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -21,6 +21,8 @@ #include "Player.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Spell.h" +#include "SpellAuraEffects.h" #include "SpellInfo.h" #include "SpellScript.h" #include "ScriptedGossip.h" @@ -31,7 +33,9 @@ namespace Durotar { namespace Spells { - static constexpr uint32 PhasePlayer = 130750; + static constexpr uint32 PhasePlayer = 130750; + static constexpr uint32 TeleportTimer = 132034; + static constexpr uint32 TeleportPlayerToCrashSite = 102930; } } @@ -1240,6 +1244,57 @@ public: } }; +// 130810 - Teleport Prep +class spell_teleport_prep : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + Durotar::Spells::TeleportTimer + }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + Unit* hitUnit = GetHitUnit(); + + hitUnit->CastSpell(hitUnit, Durotar::Spells::TeleportTimer, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .OriginalCastId = GetSpell()->m_castId + }); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_teleport_prep::HandleHitTarget, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + } +}; + +// 132034 - Teleport Timer +class spell_teleport_timer : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + Durotar::Spells::TeleportPlayerToCrashSite + }); + } + + void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + Unit* target = GetTarget(); + + target->CastSpell(target, Durotar::Spells::TeleportPlayerToCrashSite, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_teleport_timer::HandleAfterEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_durotar() { new npc_lazy_peon(); @@ -1281,6 +1336,10 @@ void AddSC_durotar() RegisterCreatureAI(npc_voljin_garrosh_vision); RegisterCreatureAI(npc_voljin_thrall_vision); - // Hellscream's Fist + // AreaTriggers new at_hellscreams_fist_gunship(); + + // Spells + RegisterSpellScript(spell_teleport_prep); + RegisterSpellScript(spell_teleport_timer); } diff --git a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp index 31ddbac6e11..83c2e6711b6 100644 --- a/src/server/scripts/Kalimdor/zone_orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/zone_orgrimmar.cpp @@ -17,9 +17,8 @@ #include "Define.h" #include "ScriptMgr.h" -#include "SpellAuraDefines.h" +#include "Spell.h" #include "SpellAuraEffects.h" -#include "SpellDefines.h" #include "SpellScript.h" #include "Unit.h" @@ -33,48 +32,57 @@ namespace Orgrimmar } // 130412 - Art of War Movie Aura -class spell_art_of_war_movie_aura : public AuraScript +class spell_art_of_war_movie_aura : public SpellScript { bool Validate(SpellInfo const* /*spellInfo*/) override { return ValidateSpellInfo({ - Orgrimmar::Spells::MOPHordeIntroMoviePlay, Orgrimmar::Spells::FadeToBlack }); } - void HandleAfterEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const + void HandleHitTarget(SpellEffIndex /*effIndex*/) const { - Unit* caster = GetCaster(); - if (!caster) - return; + Unit* hitUnit = GetHitUnit(); - caster->CastSpell(GetTarget(), Orgrimmar::Spells::FadeToBlack, CastSpellExtraArgsInit{ + hitUnit->CastSpell(hitUnit, Orgrimmar::Spells::FadeToBlack, CastSpellExtraArgsInit{ .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, - .TriggeringAura = aurEff + .OriginalCastId = GetSpell()->m_castId }); } - void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_art_of_war_movie_aura::HandleHitTarget, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + } +}; + +class spell_art_of_war_movie_aura_aura : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + Orgrimmar::Spells::MOPHordeIntroMoviePlay + }); + } + + void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const { - Unit* caster = GetCaster(); - if (!caster) - return; + Unit* target = GetTarget(); - caster->CastSpell(GetTarget(), Orgrimmar::Spells::MOPHordeIntroMoviePlay, CastSpellExtraArgsInit{ + target->CastSpell(target, Orgrimmar::Spells::MOPHordeIntroMoviePlay, CastSpellExtraArgsInit{ .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR }); } void Register() override { - AfterEffectApply += AuraEffectApplyFn(spell_art_of_war_movie_aura::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_art_of_war_movie_aura::HandleAfterEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_art_of_war_movie_aura_aura::HandleAfterEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; void AddSC_orgrimmar() { - // Grommash Hold - RegisterSpellScript(spell_art_of_war_movie_aura); + // Spells + RegisterSpellAndAuraScriptPair(spell_art_of_war_movie_aura, spell_art_of_war_movie_aura_aura); } diff --git a/src/server/scripts/Pandaria/pandaria_scripts_loader.cpp b/src/server/scripts/Pandaria/pandaria_scripts_loader.cpp index e84ea05039c..39dac4bf71e 100644 --- a/src/server/scripts/Pandaria/pandaria_scripts_loader.cpp +++ b/src/server/scripts/Pandaria/pandaria_scripts_loader.cpp @@ -16,11 +16,13 @@ */ // This is where scripts loading function should be declared: +void AddSC_zone_the_jade_forest(); void AddSC_zone_the_wandering_isle(); // The name of this function should match: // void Add${NameOfDirectory}Scripts() void AddPandariaScripts() { + AddSC_zone_the_jade_forest(); AddSC_zone_the_wandering_isle(); } diff --git a/src/server/scripts/Pandaria/zone_the_jade_forest.cpp b/src/server/scripts/Pandaria/zone_the_jade_forest.cpp new file mode 100644 index 00000000000..834c27926ab --- /dev/null +++ b/src/server/scripts/Pandaria/zone_the_jade_forest.cpp @@ -0,0 +1,120 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "Spell.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" +#include "Unit.h" + +namespace TheJadeForest +{ + namespace Spells + { + static constexpr uint32 CancelBlackout = 130812; + static constexpr uint32 TeleportPrep = 130810; + static constexpr uint32 TeleportPlayerToCrashSite = 102930; + static constexpr uint32 CutToBlack = 122343; + static constexpr uint32 WakeUpDead = 122344; + } +} + +// 121545 - Into the Mists Scene - JF +class spell_into_the_mists_scene_jf : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + TheJadeForest::Spells::CancelBlackout + }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + Unit* hitUnit = GetHitUnit(); + + hitUnit->CastSpell(hitUnit, TheJadeForest::Spells::CancelBlackout, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .OriginalCastId = GetSpell()->m_castId + }); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_into_the_mists_scene_jf::HandleHitTarget, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 130812 - Cancel Blackout +class spell_cancel_blackout : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + TheJadeForest::Spells::TeleportPrep + }); + } + + void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + GetTarget()->RemoveAurasDueToSpell(TheJadeForest::Spells::TeleportPrep); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_cancel_blackout::HandleAfterEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 130723 - Into the Mists Scene End +class spell_into_the_mists_scene_end : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ + TheJadeForest::Spells::TeleportPlayerToCrashSite, + TheJadeForest::Spells::CutToBlack, + TheJadeForest::Spells::WakeUpDead + }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + Unit* hitUnit = GetHitUnit(); + + CastSpellExtraArgs const& castSpellExtraArgs = CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .OriginalCastId = GetSpell()->m_castId + }; + hitUnit->CastSpell(hitUnit, TheJadeForest::Spells::TeleportPlayerToCrashSite, castSpellExtraArgs); + hitUnit->CastSpell(hitUnit, TheJadeForest::Spells::CutToBlack, castSpellExtraArgs); + hitUnit->CastSpell(hitUnit, TheJadeForest::Spells::WakeUpDead, castSpellExtraArgs); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_into_the_mists_scene_end::HandleHitTarget, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +void AddSC_zone_the_jade_forest() +{ + // Spells + RegisterSpellScript(spell_into_the_mists_scene_jf); + RegisterSpellScript(spell_cancel_blackout); + RegisterSpellScript(spell_into_the_mists_scene_end); +} |
