Skip to content

Commit

Permalink
fix(Scripts/Events): Implement headless horseman downscale (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah authored Oct 22, 2023
1 parent b7f0255 commit 762ec0b
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Bracket_1_19/Bracket_1_19_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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();
}
83 changes: 83 additions & 0 deletions src/Bracket_1_19/scripts/events/hallows_end.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#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();
}
9 changes: 9 additions & 0 deletions src/Bracket_1_19/sql/world/progression_1_19_hallows_end.sql
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions src/Bracket_80_1/sql/world/progression_1_19_hallows_end_down.sql
Original file line number Diff line number Diff line change
@@ -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);


0 comments on commit 762ec0b

Please sign in to comment.