diff options
author | Naddley <64811442+Naddley@users.noreply.github.com> | 2025-05-14 21:37:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-14 21:37:48 +0200 |
commit | 019869f8d9101d7f4e9ff2f7c43fea598178c38a (patch) | |
tree | 2d8cbb118c760ba338cccf517315d6ab21a5dbe4 /src | |
parent | 1d36eeaa280d0148aa571bee4a14e076666a522b (diff) |
Scripts/Drustvar: Implement Quest: "Really Big Problem" (#30939)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/KulTiras/Drustvar/zone_drustvar.cpp | 99 | ||||
-rw-r--r-- | src/server/scripts/KulTiras/kultiras_script_loader.cpp | 2 |
2 files changed, 101 insertions, 0 deletions
diff --git a/src/server/scripts/KulTiras/Drustvar/zone_drustvar.cpp b/src/server/scripts/KulTiras/Drustvar/zone_drustvar.cpp new file mode 100644 index 00000000000..1cc41e4286a --- /dev/null +++ b/src/server/scripts/KulTiras/Drustvar/zone_drustvar.cpp @@ -0,0 +1,99 @@ +/* + * 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 "Containers.h" +#include "Conversation.h" +#include "ConversationAI.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "Player.h" +#include "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "SpellAuras.h" +#include "SpellInfo.h" +#include "SpellScript.h" + +enum ReallyBigProblemData +{ + NPC_SUMMONED_THORNGUARD_IRONCLAW = 140049, + + CONVO_ACTOR_THORNGUARD_IRONCLAW = 65120, + + SPELL_DISMISS_TRADEWIND = 274789 +}; + +// 8790 - Conversation +class conversation_drustvar_really_big_problem_complete : public ConversationAI +{ +public: + conversation_drustvar_really_big_problem_complete(Conversation* conversation) : ConversationAI(conversation) {} + + void OnCreate(Unit* creator) override + { + Creature* thornguardIronclaw = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_SUMMONED_THORNGUARD_IRONCLAW, .IgnorePhases = true, .OwnerGuid = creator->GetGUID() }); + if (!thornguardIronclaw) + return; + + thornguardIronclaw->SetReactState(REACT_PASSIVE); + thornguardIronclaw->SetImmuneToAll(true); + + conversation->AddActor(CONVO_ACTOR_THORNGUARD_IRONCLAW, 0, thornguardIronclaw->GetGUID()); + conversation->Start(); + } + + void OnStart() override + { + LocaleConstant privateOwnerLocale = conversation->GetPrivateObjectOwnerLocale(); + + conversation->m_Events.AddEvent([conversation = conversation]() + { + Creature* thornguardIronclaw = conversation->GetActorCreature(0); + if (!thornguardIronclaw) + return; + + thornguardIronclaw->GetMotionMaster()->MovePoint(0, thornguardIronclaw->GetFirstCollisionPosition(20.0f, 0)); + thornguardIronclaw->CastSpell(thornguardIronclaw, SPELL_DISMISS_TRADEWIND, TRIGGERED_IGNORE_CAST_TIME); + }, conversation->GetLastLineEndTime(privateOwnerLocale) + 3s); + } +}; + +// 274789 - Dismiss Tradewind +class spell_drustvar_dismiss_tradewind : public SpellScript +{ + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + if (Creature* hitUnit = GetHitCreature()) + { + if (hitUnit->GetEntry() == NPC_SUMMONED_THORNGUARD_IRONCLAW) + hitUnit->DespawnOrUnsummon(2s); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_drustvar_dismiss_tradewind::HandleHitTarget, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +void AddSC_zone_drustvar() +{ + // Conversation + RegisterConversationAI(conversation_drustvar_really_big_problem_complete); + + // Spells + RegisterSpellScript(spell_drustvar_dismiss_tradewind); +} diff --git a/src/server/scripts/KulTiras/kultiras_script_loader.cpp b/src/server/scripts/KulTiras/kultiras_script_loader.cpp index 05b6a43fc2d..550cc2e01bf 100644 --- a/src/server/scripts/KulTiras/kultiras_script_loader.cpp +++ b/src/server/scripts/KulTiras/kultiras_script_loader.cpp @@ -20,6 +20,7 @@ void AddSC_zone_boralus(); // Drustvar +void AddSC_zone_drustvar(); void AddSC_drustvar_chapter_1_the_final_effigy(); void AddSC_drustvar_chapter_2_the_burden_of_proof(); @@ -41,6 +42,7 @@ void AddKulTirasScripts() AddSC_zone_boralus(); // Drustvar + AddSC_zone_drustvar(); AddSC_drustvar_chapter_1_the_final_effigy(); AddSC_drustvar_chapter_2_the_burden_of_proof(); |