TrinityCore
Loading...
Searching...
No Matches
instance_shadow_labyrinth.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Creature.h"
20#include "CreatureAI.h"
21#include "GameObject.h"
22#include "InstanceScript.h"
23#include "Map.h"
24#include "shadow_labyrinth.h"
25
31
32static constexpr DungeonEncounterData encounters[] =
33{
34 { DATA_AMBASSADOR_HELLMAW, {{ 1908 }} },
35 { DATA_BLACKHEART_THE_INCITER, {{ 1909 }} },
36 { DATA_GRANDMASTER_VORPIL, {{ 1911 }} },
37 { DATA_MURMUR, {{ 1910 }} }
38};
39
41{
42 public:
44
46 {
56
57 void OnCreatureCreate(Creature* creature) override
58 {
59 switch (creature->GetEntry())
60 {
62 AmbassadorHellmawGUID = creature->GetGUID();
63 break;
64 case NPC_BLACKHEART:
65 BlackheartGUID = creature->GetGUID();
66 break;
72 BlackheartDummyGUIDs.insert(creature->GetGUID());
73 break;
75 GrandmasterVorpilGUID = creature->GetGUID();
76 break;
78 if (creature->IsAlive())
79 {
82 hellmaw->AI()->DoAction(ACTION_AMBASSADOR_HELLMAW_BANISH);
83 }
84 break;
85 default:
86 break;
87 }
88 }
89
90 void OnCreatureRemove(Creature* creature) override
91 {
92 switch (creature->GetEntry())
93 {
99 BlackheartDummyGUIDs.erase(creature->GetGUID());
100 break;
101 default:
102 break;
103 }
104 }
105
107 {
108 switch (go->GetEntry())
109 {
112 AddDoor(go, true);
113 break;
114 default:
115 break;
116 }
117 }
118
120 {
121 switch (go->GetEntry())
122 {
125 AddDoor(go, false);
126 break;
127 default:
128 break;
129 }
130 }
131
132 void OnUnitDeath(Unit* unit) override
133 {
134 Creature* creature = unit->ToCreature();
135 if (!creature)
136 return;
137
138 if (creature->GetEntry() == NPC_FEL_OVERSEER)
139 {
142
143 if (!FelOverseerCount)
146 }
147 }
148
149 uint32 GetData(uint32 type) const override
150 {
151 switch (type)
152 {
154 return !FelOverseerCount ? 1 : 0;
155 default:
156 break;
157 }
158 return 0;
159 }
160
161 ObjectGuid GetGuidData(uint32 type) const override
162 {
163 switch (type)
164 {
166 return BlackheartGUID;
169 default:
170 break;
171 }
172 return ObjectGuid::Empty;
173 }
174
176
177 protected:
183 };
184
186 {
188 }
189};
190
192{
193 if (auto* script = dynamic_cast<instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript const*>(s))
194 return &script->GetBlackheartDummies();
195
196 return nullptr;
197}
198
uint32_t uint32
Definition Define.h:154
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition ObjectGuid.h:435
#define DataHeader
uint32 const EncounterCount
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
CreatureAI * AI() const
Definition Creature.h:228
void SetBossNumber(uint32 number)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
virtual void AddDoor(GameObject *door, bool add)
void LoadDoorData(std::span< DoorData const > data)
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
static ObjectGuid const Empty
Definition ObjectGuid.h:314
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
virtual void DoAction(int32 param)
Definition UnitAI.h:73
Definition Unit.h:635
bool IsAlive() const
Definition Unit.h:1185
InstanceScript * GetInstanceScript(InstanceMap *map) const override
GuidUnorderedSet const * GetBlackheartDummies(InstanceScript const *s)
static constexpr DoorData doorData[]
void AddSC_instance_shadow_labyrinth()
static constexpr DungeonEncounterData encounters[]
@ GO_REFECTORY_DOOR
@ GO_SCREAMING_HALL_DOOR
#define SLScriptName
@ NPC_GRANDMASTER_VORPIL
@ NPC_BLACKHEART_DUMMY1
@ NPC_BLACKHEART_DUMMY4
@ NPC_BLACKHEART_DUMMY2
@ NPC_BLACKHEART_DUMMY5
@ NPC_FEL_OVERSEER
@ NPC_BLACKHEART_DUMMY3
@ NPC_AMBASSADOR_HELLMAW
@ NPC_BLACKHEART
@ ACTION_AMBASSADOR_HELLMAW_BANISH
@ ACTION_AMBASSADOR_HELLMAW_INTRO
@ DATA_MURMUR
@ DATA_AMBASSADOR_HELLMAW
@ DATA_GRANDMASTER_VORPIL
@ DATA_FEL_OVERSEER
@ DATA_BLACKHEART_THE_INCITER