Skip to content

Commit

Permalink
feat: Implement all bosses cleared requirement to SSC (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah authored Dec 3, 2023
1 parent 8818388 commit c597333
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
9 changes: 9 additions & 0 deletions conf/progression_system.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/Bracket_70_3_1/Bracket_70_3_1_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

#include "ProgressionSystem.h"

void AddSC_serpentshrine_cavern_70();

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

AddSC_serpentshrine_cavern_70();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* 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"

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<int>("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<int>("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();
}

0 comments on commit c597333

Please sign in to comment.