From 58ebd1d40c058a9b046de41d4a7e42b3949b7226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Wed, 21 Sep 2022 12:12:26 -0600 Subject: [PATCH] Update Vanilla instance scripts to support latest AC --- src/naxx40Scripts/instance_naxxramas.cpp | 41 +++++++++++++++++-- src/vanillaScripts/blackrock_spire.h | 9 +++- .../instance_blackrock_spire.cpp | 40 +++++++++++++----- 3 files changed, 75 insertions(+), 15 deletions(-) diff --git a/src/naxx40Scripts/instance_naxxramas.cpp b/src/naxx40Scripts/instance_naxxramas.cpp index f4f7b33..b036217 100644 --- a/src/naxx40Scripts/instance_naxxramas.cpp +++ b/src/naxx40Scripts/instance_naxxramas.cpp @@ -701,6 +701,27 @@ public: return 0; } + bool AreAllWingsCleared() const + { + return (GetBossState(BOSS_MAEXXNA) == DONE) && (GetBossState(BOSS_LOATHEB) == DONE) && (GetBossState(BOSS_THADDIUS) == DONE) && (GetBossState(BOSS_HORSEMAN) == DONE); + } + + bool CheckRequiredBosses(uint32 bossId, Player const* /* player */) const override + { + switch (bossId) + { + case BOSS_SAPPHIRON: + if (!AreAllWingsCleared()) + { + return false; + } + break; + default: + break; + } + return true; + } + bool SetBossState(uint32 bossId, EncounterState state) override { // pull all the trash if not killed @@ -1424,10 +1445,12 @@ public: }; +const Position sapphironEntryTP = { 3498.300049f, -5349.490234f, 144.968002f, 1.3698910f }; + class naxx_hub_portal : public AreaTriggerScript { public: - naxx_hub_portal() : AreaTriggerScript("naxx_hub_portal") { } + naxx_hub_portal() : AreaTriggerScript("at_naxxramas_hub_portal") { } bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/) override { @@ -1440,8 +1463,18 @@ public: return false; } } - player->TeleportTo(533, 3500.87f, -5339.03f, 145.0f, 1.34f); - return true; + if (player->IsAlive() && !player->IsInCombat()) + { + if (InstanceScript *instance = player->GetInstanceScript()) + { + if (instance->CheckRequiredBosses(BOSS_SAPPHIRON)) + { + player->TeleportTo(533, sapphironEntryTP.m_positionX, sapphironEntryTP.m_positionY, sapphironEntryTP.m_positionZ, sapphironEntryTP.m_orientation); + return true; + } + } + } + return false; } }; @@ -1453,7 +1486,7 @@ public: { } - void OnPlayerEnterAll(Map* map, Player* player) + void OnPlayerEnterAll(Map* map, Player* player) override { if (player->IsGameMaster()) return; diff --git a/src/vanillaScripts/blackrock_spire.h b/src/vanillaScripts/blackrock_spire.h index 1f032d8..88e7fa0 100644 --- a/src/vanillaScripts/blackrock_spire.h +++ b/src/vanillaScripts/blackrock_spire.h @@ -52,9 +52,11 @@ enum DataTypes DATA_HALL_RUNE_6 = 21, DATA_HALL_RUNE_7 = 22, DATA_SOLAKAR_FLAMEWREATH = 23, + DATA_MOR_GRAYHOOF = 24, + DATA_VAELASTRASZ = 25, // Progression module - DATA_UBRS_DOOR_OPEN = 24, + DATA_UBRS_DOOR_OPEN = 26 }; enum CreaturesIds @@ -78,6 +80,10 @@ enum CreaturesIds NPC_BLACKHAND_VETERAN = 9819, NPC_BLACKHAND_INCARCERATOR = 10316, NPC_LORD_VICTOR_NEFARIUS = 10162, + NPC_VAELASTRASZ_THE_RED = 10340, + NPC_VAELASTRASZ_UBRS = 10538, + + NPC_SCARSHIELD_INFILTRATOR = 10299, NPC_SOLAKAR = 10264, NPC_ROOKERY_GUARDIAN = 10258, @@ -99,6 +105,7 @@ enum AdditionalData AREATRIGGER_DRAGONSPIRE_HALL = 2046, AREATRIGGER_BLACKROCK_STADIUM = 2026, SAY_FINKLE_GANG = 0, + ITEM_UNADORNED_SEAL = 12219, // Progression module ITEM_SEAL_OF_ASCENSION = 12344 diff --git a/src/vanillaScripts/instance_blackrock_spire.cpp b/src/vanillaScripts/instance_blackrock_spire.cpp index 3fd631a..83d271e 100644 --- a/src/vanillaScripts/instance_blackrock_spire.cpp +++ b/src/vanillaScripts/instance_blackrock_spire.cpp @@ -27,6 +27,7 @@ #include "ObjectMgr.h" #include "ScriptedCreature.h" #include "ScriptMgr.h" +#include "SpellScript.h" //uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 }; @@ -61,8 +62,9 @@ Position ModSolakarPosBoss = Position(80.0f, -280.0f, 93.0f, 3.0f * M_PI / 2.0) enum Texts { - SAY_NEFARIUS_REND_WIPE = 11, - SAY_SOLAKAR_FIRST_HATCHER = 0 + SAY_NEFARIUS_REND_WIPE = 11, + SAY_SOLAKAR_FIRST_HATCHER = 0, + SAY_SCARSHIELD_INF_WHISPER = 0 }; MinionData const minionData[] = @@ -87,7 +89,8 @@ public: { uint32 CurrentSolakarWave = 0; uint32 SolakarState = NOT_STARTED; // there should be a global instance encounter state, where is it? - std::vector SolakarSummons; + GuidVector SolakarSummons; + uint32 VaelastraszState = NOT_STARTED; instance_blackrock_spireMapScript(InstanceMap* map) : InstanceScript(map) @@ -98,6 +101,7 @@ public: CurrentSolakarWave = 0; SolakarState = NOT_STARTED; SolakarSummons.clear(); + VaelastraszState = NOT_STARTED; UBRSDoorOpen = false; } @@ -418,11 +422,11 @@ public: } break; case FAIL: - for (const auto& creature : SolakarSummons) + for (ObjectGuid const& guid : SolakarSummons) { - if (creature) + if (Creature* creature = instance->GetCreature(guid)) { - creature->RemoveFromWorld(); + creature->DespawnOrUnsummon(); } } SolakarSummons.clear(); @@ -434,6 +438,9 @@ public: } SolakarState = data; break; + case DATA_VAELASTRASZ: + VaelastraszState = data; + break; case DATA_UROK_DOOMHOWL: if (data == FAIL) { @@ -479,6 +486,8 @@ public: return SolakarState; case DATA_UBRS_DOOR_OPEN: return UBRSDoorOpen ? 1 : 0; + case DATA_VAELASTRASZ: + return VaelastraszState; default: return InstanceScript::GetData(type); } @@ -488,11 +497,19 @@ public: { if (number < MAX_WAVE_COUNT) { - SolakarSummons.push_back(instance->SummonCreature(NPC_ROOKERY_GUARDIAN, ModSolakarPosLeft)); - SolakarSummons.push_back(instance->SummonCreature(NPC_ROOKERY_HATCHER, ModSolakarPosRight)); + if (Creature* summon = instance->SummonCreature(NPC_ROOKERY_GUARDIAN, ModSolakarPosLeft)) + { + SolakarSummons.push_back(summon->GetGUID()); + } + + if (Creature* summon = instance->SummonCreature(NPC_ROOKERY_HATCHER, ModSolakarPosRight)) + { + SolakarSummons.push_back(summon->GetGUID()); + } + if (number == 0) { - if (Creature* FirstHatcher = SolakarSummons.back()) // works because we spawned a hatcher second + if (Creature* FirstHatcher = instance->GetCreature(SolakarSummons.back())) // works because we spawned a hatcher second { FirstHatcher->AI()->Talk(SAY_SOLAKAR_FIRST_HATCHER); } @@ -500,7 +517,10 @@ public: } else if (number == MAX_WAVE_COUNT) { - SolakarSummons.push_back(instance->SummonCreature(NPC_SOLAKAR, ModSolakarPosBoss)); + if (Creature* summon = instance->SummonCreature(NPC_SOLAKAR, ModSolakarPosBoss)) + { + SolakarSummons.push_back(summon->GetGUID()); + } } }