diff --git a/conf/progression_system.conf.dist b/conf/progression_system.conf.dist index 350b8e47..28396d1f 100644 --- a/conf/progression_system.conf.dist +++ b/conf/progression_system.conf.dist @@ -105,3 +105,12 @@ ProgressionSystem.60.MoltenCore.AqualEssenceCooldownReduction = 0 ProgressionSystem.60.WorldBosses.KazzakPhasing = 1 +# +# ProgressionSystem.70.SerpentshrineCavern.RequireAllBosses +# Description: Requires all bosses being killed before accessing Vashj's console panel. +# Default: 1 - Enabled +# 0 - Disabled +# +# + +ProgressionSystem.70.SerpentshrineCavern.RequireAllBosses = 1 diff --git a/src/Bracket_70_3_1/Bracket_70_3_1_loader.cpp b/src/Bracket_70_3_1/Bracket_70_3_1_loader.cpp index 59b6d680..187582d2 100644 --- a/src/Bracket_70_3_1/Bracket_70_3_1_loader.cpp +++ b/src/Bracket_70_3_1/Bracket_70_3_1_loader.cpp @@ -4,8 +4,12 @@ #include "ProgressionSystem.h" +void AddSC_serpentshrine_cavern_70(); + void AddBracket_70_3_A_Scripts() { if (!(sConfigMgr->GetOption("ProgressionSystem.Bracket_70_3_1", false))) return; + + AddSC_serpentshrine_cavern_70(); } diff --git a/src/Bracket_70_3_1/scripts/SerpentshrineCavern/serpentshrine_cavern.cpp b/src/Bracket_70_3_1/scripts/SerpentshrineCavern/serpentshrine_cavern.cpp new file mode 100644 index 00000000..4c34eb30 --- /dev/null +++ b/src/Bracket_70_3_1/scripts/SerpentshrineCavern/serpentshrine_cavern.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +#include "Config.h" +#include "Player.h" +#include "ScriptMgr.h" + +enum SSCMisc +{ + GO_LADY_VASHJ_BRIDGE_CONSOLE = 184568, + MAP_SSC = 548, + DATA_VASHJ = 6 +}; + +class GlobalSerpentshrineScript : public GlobalScript +{ +public: + GlobalSerpentshrineScript() : GlobalScript("GlobalSerpentshrineScript") { } + + void AfterInstanceGameObjectCreate(Map* /*map*/, GameObject* go) override + { + if (sConfigMgr->GetOption("ProgressionSystem.70.SerpentshrineCavern.RequireAllBosses", 1)) + { + if (go->GetEntry() == GO_LADY_VASHJ_BRIDGE_CONSOLE) + { + go->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE); + } + } + } + + void OnBeforeSetBossState(uint32 bossId, EncounterState newState, EncounterState /*oldState*/, Map* map) override + { + if (sConfigMgr->GetOption("ProgressionSystem.70.SerpentshrineCavern.RequireAllBosses", 1)) + { + if (map->GetEntry()->MapID == MAP_SSC) + { + if (InstanceMap* instanceMap = map->ToInstanceMap()) + { + if (InstanceScript* instance = instanceMap->GetInstanceScript()) + { + uint32 bossCount = instance->GetEncounterCount() - 3; + bool hasIncompleteBosses = false; + for (uint8 id = 0; id <= bossCount; ++id) + { + if (id == bossId && newState == DONE) + { + continue; + } + + if (instance->GetBossState(id) != DONE) + { + hasIncompleteBosses = true; + } + } + + if (!hasIncompleteBosses) + { + if (Creature* vashj = instance->GetCreature(DATA_VASHJ)) + { + if (GameObject* console = vashj->FindNearestGameObject(GO_LADY_VASHJ_BRIDGE_CONSOLE, 600.0f)) + { + console->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE); + } + } + } + } + } + } + } + } +}; + +void AddSC_serpentshrine_cavern_70() +{ + new GlobalSerpentshrineScript(); +}