diff --git a/conf/progression_system.conf.dist b/conf/progression_system.conf.dist index 28396d1f..344c1ec4 100644 --- a/conf/progression_system.conf.dist +++ b/conf/progression_system.conf.dist @@ -114,3 +114,13 @@ ProgressionSystem.60.WorldBosses.KazzakPhasing = 1 # ProgressionSystem.70.SerpentshrineCavern.RequireAllBosses = 1 + +# +# ProgressionSystem.70.TheEye.RequireAllBosses +# Description: Requires all bosses being killed to open the doors to Kael +# Default: 1 - Enabled +# 0 - Disabled +# +# + +ProgressionSystem.70.TheEye.RequireAllBosses = 1 diff --git a/src/Bracket_70_3_2/Bracket_70_3_2_loader.cpp b/src/Bracket_70_3_2/Bracket_70_3_2_loader.cpp index 69d0bb68..e9c24304 100644 --- a/src/Bracket_70_3_2/Bracket_70_3_2_loader.cpp +++ b/src/Bracket_70_3_2/Bracket_70_3_2_loader.cpp @@ -4,8 +4,12 @@ #include "ProgressionSystem.h" +void AddSC_the_eye_70(); + void AddBracket_70_3_B_Scripts() { if (!(sConfigMgr->GetOption("ProgressionSystem.Bracket_70_3_2", false))) return; + + AddSC_the_eye_70(); } diff --git a/src/Bracket_70_3_2/scripts/the_eye.cpp b/src/Bracket_70_3_2/scripts/the_eye.cpp new file mode 100644 index 00000000..db36142e --- /dev/null +++ b/src/Bracket_70_3_2/scripts/the_eye.cpp @@ -0,0 +1,96 @@ +/* + * 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" +#include "SpellInfo.h" + +enum SSCMisc +{ + GO_RIGHT_KAEL_DOOR = 184327, + GO_LEFT_KAEL_DOOR = 184329, + MAP_TK = 550, + DATA_KAEL = 3 +}; + +class GlobalTheEyeScript : public GlobalScript +{ +public: + GlobalTheEyeScript() : GlobalScript("GlobalTheEyeScript") { } + + bool IsAnyBossAlive(Map* map, uint32 bossId = 0, uint32 newState = 0) + { + if (InstanceMap* instanceMap = map->ToInstanceMap()) + { + if (InstanceScript* instance = instanceMap->GetInstanceScript()) + { + uint32 bossCount = instance->GetEncounterCount() - 1; + for (uint8 id = 0; id < bossCount; ++id) + { + if (id == bossId && newState == DONE) + { + continue; + } + + if (instance->GetBossState(id) != DONE) + { + return true; + } + } + } + } + + return false; + } + + void AfterInstanceGameObjectCreate(Map* map, GameObject* go) override + { + if (sConfigMgr->GetOption("ProgressionSystem.70.TheEye.RequireAllBosses", 1)) + { + if (go->GetEntry() == GO_RIGHT_KAEL_DOOR || go->GetEntry() == GO_LEFT_KAEL_DOOR) + { + if (IsAnyBossAlive(map)) + { + go->SetGoState(GO_STATE_READY); + } + } + } + } + + void OnBeforeSetBossState(uint32 bossId, EncounterState newState, EncounterState /*oldState*/, Map* map) override + { + if (sConfigMgr->GetOption("ProgressionSystem.70.TheEye.RequireAllBosses", 1)) + { + if (map->GetEntry()->MapID == MAP_TK) + { + if (InstanceMap* instanceMap = map->ToInstanceMap()) + { + if (InstanceScript* instance = instanceMap->GetInstanceScript()) + { + if (!IsAnyBossAlive(map, bossId, newState)) + { + if (Creature* kael = instance->GetCreature(DATA_KAEL)) + { + if (GameObject* rightDoor = kael->FindNearestGameObject(GO_RIGHT_KAEL_DOOR, 600.0f)) + { + if (GameObject* leftDoor = kael->FindNearestGameObject(GO_LEFT_KAEL_DOOR, 600.0f)) + { + rightDoor->SetGoState(GO_STATE_ACTIVE); + leftDoor->SetGoState(GO_STATE_ACTIVE); + } + } + } + } + } + } + } + } + } +}; + +void AddSC_the_eye_70() +{ + new GlobalTheEyeScript(); +}