Update Vanilla instance scripts to support latest AC

This commit is contained in:
郑佩茹
2022-09-21 12:12:26 -06:00
parent cf2ab74a06
commit 58ebd1d40c
3 changed files with 75 additions and 15 deletions

View File

@@ -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,9 +1463,19 @@ public:
return false;
}
}
player->TeleportTo(533, 3500.87f, -5339.03f, 145.0f, 1.34f);
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;
}
};
class NaxxEntryFlag_AllMapScript : public AllMapScript
@@ -1453,7 +1486,7 @@ public:
{
}
void OnPlayerEnterAll(Map* map, Player* player)
void OnPlayerEnterAll(Map* map, Player* player) override
{
if (player->IsGameMaster())
return;

View File

@@ -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

View File

@@ -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 };
@@ -62,7 +63,8 @@ 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_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<TempSummon*> 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());
}
}
}