From 762ec0b14290211f35f0287656884af9d5f90d28 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Sun, 22 Oct 2023 00:32:01 -0300 Subject: [PATCH] fix(Scripts/Events): Implement headless horseman downscale (#360) --- src/Bracket_1_19/Bracket_1_19_loader.cpp | 2 + .../scripts/events/hallows_end.cpp | 83 +++++++++++++++++++ .../world/progression_1_19_hallows_end.sql | 9 ++ .../progression_1_19_hallows_end_down.sql | 12 +++ 4 files changed, 106 insertions(+) create mode 100644 src/Bracket_1_19/scripts/events/hallows_end.cpp create mode 100644 src/Bracket_1_19/sql/world/progression_1_19_hallows_end.sql create mode 100644 src/Bracket_80_1/sql/world/progression_1_19_hallows_end_down.sql diff --git a/src/Bracket_1_19/Bracket_1_19_loader.cpp b/src/Bracket_1_19/Bracket_1_19_loader.cpp index c7671055..88a4d414 100644 --- a/src/Bracket_1_19/Bracket_1_19_loader.cpp +++ b/src/Bracket_1_19/Bracket_1_19_loader.cpp @@ -7,6 +7,7 @@ void AddSC_event_love_in_the_air_1_19(); void AddSC_event_brewfest_1_19(); void AddSC_event_midsummer_1_19(); +void AddSC_event_hallows_end_1_19(); void AddBracket_1_19_Scripts() { @@ -16,4 +17,5 @@ void AddBracket_1_19_Scripts() AddSC_event_love_in_the_air_1_19(); AddSC_event_brewfest_1_19(); AddSC_event_midsummer_1_19(); + AddSC_event_hallows_end_1_19(); } diff --git a/src/Bracket_1_19/scripts/events/hallows_end.cpp b/src/Bracket_1_19/scripts/events/hallows_end.cpp new file mode 100644 index 00000000..8d19696d --- /dev/null +++ b/src/Bracket_1_19/scripts/events/hallows_end.cpp @@ -0,0 +1,83 @@ +/* + * This file is part of the AzerothCore 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 Affero General Public License as published by the + * Free Software Foundation; either version 3 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 Affero 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 . + */ + +#include "Player.h" +#include "ScriptMgr.h" + +#include "ProgressionSystem.h" + +enum Misc +{ + MAP_SCARLET_MONASTERY = 189, + + QUEST_HEADLESS_HORSEMAN = 50000, + + NPC_HEADLESS_HORSEMAN = 23682 +}; + +class mod_progression_eventquest_playerscript : public PlayerScript +{ +public: + mod_progression_eventquest_playerscript() : PlayerScript("mod_progression_eventquest_playerscript") { } + + void OnMapChanged(Player* player) + { + if (player->GetMap()->GetId() == MAP_SCARLET_MONASTERY && sGameEventMgr->IsActiveEvent(12)) + { + if (Quest const* quest = sObjectMgr->GetQuestTemplate(QUEST_HEADLESS_HORSEMAN)) + { + if (player->CanTakeQuest(quest, false)) + { + player->AddQuestAndCheckCompletion(quest, nullptr); + } + } + } + } +}; + +class unit_headless_horseman_script : public UnitScript +{ +public: + unit_headless_horseman_script() : UnitScript("unit_headless_horseman_script") { } + + void OnUnitDeath(Unit* me, Unit* killer) override + { + if (me->GetEntry() != NPC_HEADLESS_HORSEMAN) + { + return; + } + + if (killer->GetMap() && killer->GetMap()->IsDungeon()) + { + killer->GetMap()->DoForAllPlayers([&](Player* player) + { + player->CompleteQuest(QUEST_HEADLESS_HORSEMAN); + + if (Quest const* quest = sObjectMgr->GetQuestTemplate(QUEST_HEADLESS_HORSEMAN)) + { + player->RewardQuest(quest, 0, nullptr, true, true); + } + }); + } + } +}; + +void AddSC_event_hallows_end_1_19() +{ + new mod_progression_eventquest_playerscript(); + new unit_headless_horseman_script(); +} diff --git a/src/Bracket_1_19/sql/world/progression_1_19_hallows_end.sql b/src/Bracket_1_19/sql/world/progression_1_19_hallows_end.sql new file mode 100644 index 00000000..091747eb --- /dev/null +++ b/src/Bracket_1_19/sql/world/progression_1_19_hallows_end.sql @@ -0,0 +1,9 @@ +SET @QUESTID = 50000; +SET @TITLE = 'The Time is Nigh!'; +DELETE FROM `quest_template` WHERE `ID` = @QUESTID; +INSERT INTO `quest_template` (`ID`, `QuestType`, `QuestLevel`, `MinLevel`, `QuestSortID`, `QuestInfoID`, `SuggestedGroupNum`, `Flags`, `RewardItem1`, `RewardAmount1`, `LogTitle`, `LogDescription`, `QuestDescription`, `RequiredNpcOrGo1`, `RequiredNpcOrGoCount1`) VALUES +(@QUESTID, 2, -1, 70, -22, 0, 5, 4096, 54516, 1, @TITLE, 'Venture into the Scarlet Monastery and put an end to the Headless Horseman\'s menace.', 'Slay the Headless Horseman', 23682, 1); + +DELETE FROM `item_loot_template` WHERE `entry` = 54516 AND `item` IN (49426, 49128, 49126); + +UPDATE `creature_template` SET `minlevel` = 70, `maxlevel` = 70 WHERE `entry` IN (23682, 23775,23694, 23545); diff --git a/src/Bracket_80_1/sql/world/progression_1_19_hallows_end_down.sql b/src/Bracket_80_1/sql/world/progression_1_19_hallows_end_down.sql new file mode 100644 index 00000000..1b51d80d --- /dev/null +++ b/src/Bracket_80_1/sql/world/progression_1_19_hallows_end_down.sql @@ -0,0 +1,12 @@ +SET @QUESTID = 50000; +DELETE FROM `quest_template` WHERE `ID` = @QUESTID; + +DELETE FROM `item_loot_template` WHERE `entry` = 54516 AND `item` IN (49426, 49128, 49126); +INSERT INTO `item_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES +(54516,49126,0,2,0,1,0,1,1,'Loot-Filled Pumpkin - The Horseman\'s Horrific Helm'), +(54516,49128,0,2,0,1,0,1,1,'Loot-Filled Pumpkin - The Horseman\'s Baleful Blade'), +(54516,49426,0,100,0,1,0,2,2,'Loot-Filled Pumpkin - Emblem of Frost'); + +UPDATE `creature_template` SET `minlevel` = 80, `maxlevel` = 80 WHERE `entry` IN (23682, 23775,23694, 23545); + +