Skip to content

Commit

Permalink
fix(TheEye): make sure kael'thas is blocked off until all 3 prior bos…
Browse files Browse the repository at this point in the history
…ses die (#388)

* initial

* fix
  • Loading branch information
elthehablo authored Mar 12, 2024
1 parent ae4b322 commit e0c74dc
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
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();
}

0 comments on commit e0c74dc

Please sign in to comment.