Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TheEye): make sure kael'thas is blocked off until all 3 prior bosses die #388

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions conf/progression_system.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/Bracket_70_3_2/Bracket_70_3_2_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

#include "ProgressionSystem.h"

void AddSC_the_eye_70();

void AddBracket_70_3_B_Scripts()
{
if (!(sConfigMgr->GetOption<bool>("ProgressionSystem.Bracket_70_3_2", false)))
return;

AddSC_the_eye_70();
}
96 changes: 96 additions & 0 deletions src/Bracket_70_3_2/scripts/the_eye.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, 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<int>("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<int>("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();
}
Loading