fix(Scripts/Karazhan): Implement the side entrance door area trigger … (#17556)

fix(Scripts/Karazhan): Implement the side entrance door area trigger handling
This commit is contained in:
Andrew
2023-10-21 22:52:07 -03:00
committed by GitHub
parent 945d7c6afe
commit 4e41a02be2
3 changed files with 35 additions and 7 deletions

View File

@@ -0,0 +1,4 @@
--
DELETE FROM `areatrigger_scripts` WHERE `entry` = 4522;
INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES
(4522, 'at_karazhan_side_entrance');

View File

@@ -48,6 +48,12 @@ ObjectData const creatureData[] =
{ 0, 0 }
};
ObjectData const gameObjectData[] =
{
{ GO_SIDE_ENTRANCE_DOOR, DATA_GO_SIDE_ENTRANCE_DOOR },
{ 0, 0 }
};
class instance_karazhan : public InstanceMapScript
{
public:
@@ -64,7 +70,7 @@ public:
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadObjectData(creatureData, nullptr);
LoadObjectData(creatureData, gameObjectData);
// 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
OperaEvent = urand(EVENT_OZ, EVENT_RAJ);
@@ -300,8 +306,6 @@ public:
{
HandleGameObject(m_uiStageDoorLeftGUID, true);
HandleGameObject(m_uiStageDoorRightGUID, true);
if (GameObject* sideEntrance = instance->GetGameObject(m_uiSideEntranceDoor))
sideEntrance->RemoveGameObjectFlag(GO_FLAG_LOCKED);
instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, 16812, nullptr);
}
else if (state == FAIL)
@@ -372,7 +376,6 @@ public:
MastersTerraceDoor[1] = go->GetGUID();
break;
case GO_SIDE_ENTRANCE_DOOR:
m_uiSideEntranceDoor = go->GetGUID();
if (GetBossState(DATA_OPERA_PERFORMANCE) == DONE)
go->RemoveGameObjectFlag(GO_FLAG_LOCKED);
else
@@ -477,8 +480,6 @@ public:
return m_uiLibraryDoor;
case DATA_GO_MASSIVE_DOOR:
return m_uiMassiveDoor;
case DATA_GO_SIDE_ENTRANCE_DOOR:
return m_uiSideEntranceDoor;
case DATA_GO_GAME_DOOR:
return m_uiGamesmansDoor;
case DATA_GO_GAME_EXIT_DOOR:
@@ -519,7 +520,6 @@ public:
ObjectGuid m_uiNightBaneGUID;
ObjectGuid m_uiLibraryDoor; // Door at Shade of Aran
ObjectGuid m_uiMassiveDoor; // Door at Netherspite
ObjectGuid m_uiSideEntranceDoor; // Side Entrance
ObjectGuid m_uiGamesmansDoor; // Door before Chess
ObjectGuid m_uiGamesmansExitDoor; // Door after Chess
ObjectGuid m_uiNetherspaceDoor; // Door at Malchezaar

View File

@@ -562,8 +562,32 @@ public:
};
};
class at_karazhan_side_entrance : public OnlyOnceAreaTriggerScript
{
public:
at_karazhan_side_entrance() : OnlyOnceAreaTriggerScript("at_karazhan_side_entrance") { }
bool _OnTrigger(Player* player, AreaTrigger const* /*at*/) override
{
if (InstanceScript* instance = player->GetInstanceScript())
{
if (instance->GetBossState(DATA_OPERA_PERFORMANCE) == DONE)
{
if (GameObject* door = instance->GetGameObject(DATA_GO_SIDE_ENTRANCE_DOOR))
{
instance->HandleGameObject(ObjectGuid::Empty, true, door);
door->RemoveGameObjectFlag(GO_FLAG_LOCKED);
}
}
}
return false;
}
};
void AddSC_karazhan()
{
new npc_barnes();
new npc_image_of_medivh();
new at_karazhan_side_entrance();
}