aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAqua Deus <95978183+aquadeus@users.noreply.github.com>2022-08-22 22:17:42 +0200
committerGitHub <noreply@github.com>2022-08-22 22:17:42 +0200
commitbccfc203c07c88dab8583cf3be8624810b5d3713 (patch)
tree63a047c13d6d406a79621020cda0918ce47c2e7f /src
parent889ea0eed416b60056ca71b661379708f5850592 (diff)
Scripts/Draenor: Implement script for quest 34586 (Establish your Garrison) (#28057)
Co-authored-by: Naddley <64811442+Naddley@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Draenor/draenor_script_loader.cpp26
-rw-r--r--src/server/scripts/Draenor/zone_draenor_shadowmoon_valley.cpp97
2 files changed, 123 insertions, 0 deletions
diff --git a/src/server/scripts/Draenor/draenor_script_loader.cpp b/src/server/scripts/Draenor/draenor_script_loader.cpp
new file mode 100644
index 00000000000..f5f4f416a2b
--- /dev/null
+++ b/src/server/scripts/Draenor/draenor_script_loader.cpp
@@ -0,0 +1,26 @@
+/*
+ * 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/>.
+ */
+
+ // This is where scripts' loading functions should be declared:
+void AddSC_draenor_shadowmoon_valley();
+
+// The name of this function should match:
+// void Add${NameOfDirectory}Scripts()
+void AddDraenorScripts()
+{
+ AddSC_draenor_shadowmoon_valley();
+}
diff --git a/src/server/scripts/Draenor/zone_draenor_shadowmoon_valley.cpp b/src/server/scripts/Draenor/zone_draenor_shadowmoon_valley.cpp
new file mode 100644
index 00000000000..e372731f3ca
--- /dev/null
+++ b/src/server/scripts/Draenor/zone_draenor_shadowmoon_valley.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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 "PhasingHandler.h"
+#include "Player.h"
+#include "QuestDef.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+
+// 79243 - Baros Alexston
+enum BarosAlexstonMisc
+{
+ // Quest
+ QUEST_ESTABLISH_YOUR_GARRISON = 34586,
+
+ // Gossip
+ GOSSIP_OPTION_ESTABLISH_GARRISON = 0,
+
+ // Text
+ SAY_START_CONSTRUCTION = 0,
+
+ // Spells
+ SPELL_QUEST_34586_KILLCREDIT = 161033,
+ SPELL_CREATE_GARRISON_SHADOWMOON_VALLEY_ALLIANCE = 156020,
+ SPELL_DESPAWN_ALL_SUMMONS_GARRISON_INTRO_ONLY = 160938
+};
+
+Position const GarrisonLevelOneCreationPlayerPosition = { 1904.58f, 312.906f, 88.9542f, 4.303615f };
+
+struct npc_baros_alexston : public ScriptedAI
+{
+ npc_baros_alexston(Creature* creature) : ScriptedAI(creature) { }
+
+ bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
+ {
+ if (gossipListId == GOSSIP_OPTION_ESTABLISH_GARRISON)
+ {
+ CloseGossipMenuFor(player);
+ player->CastSpell(player, SPELL_QUEST_34586_KILLCREDIT, true);
+ player->CastSpell(player, SPELL_CREATE_GARRISON_SHADOWMOON_VALLEY_ALLIANCE, true);
+ player->CastSpell(player, SPELL_DESPAWN_ALL_SUMMONS_GARRISON_INTRO_ONLY, true);
+ player->NearTeleportTo(GarrisonLevelOneCreationPlayerPosition);
+
+ PhasingHandler::OnConditionChange(player);
+ }
+
+ return true;
+ }
+
+ void OnQuestAccept(Player* player , Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_ESTABLISH_YOUR_GARRISON)
+ Talk(SAY_START_CONSTRUCTION, player);
+ }
+};
+
+// 160938 - Despawn All Summons (Garrison Intro Only)
+class spell_despawn_all_summons_garrison_intro_only : public SpellScript
+{
+ PrepareSpellScript(spell_despawn_all_summons_garrison_intro_only);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Creature* hitCreature = GetHitCreature())
+ {
+ if (hitCreature->GetOwner() == GetCaster())
+ hitCreature->DespawnOrUnsummon();
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_despawn_all_summons_garrison_intro_only::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+};
+
+void AddSC_draenor_shadowmoon_valley()
+{
+ RegisterCreatureAI(npc_baros_alexston);
+ RegisterSpellScript(spell_despawn_all_summons_garrison_intro_only);
+};