-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement all bosses cleared requirement to SSC (#366)
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/Bracket_70_3_1/scripts/SerpentshrineCavern/serpentshrine_cavern.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |