TrinityCore
Loading...
Searching...
No Matches
instance_shattered_halls.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/* ScriptData
19SDName: Instance_Shattered_Halls
20SD%Complete: 50
21SDComment: instance not complete
22SDCategory: Hellfire Citadel, Shattered Halls
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "Map.h"
28#include "Player.h"
29#include "ScriptedCreature.h"
30#include "shattered_halls.h"
31#include "SpellAuras.h"
32
38
39static constexpr DungeonEncounterData encounters[] =
40{
41 { DATA_NETHEKURSE, {{ 1936 }} },
42 { DATA_PORUNG, {{ 1935 }} },
43 { DATA_OMROGG, {{ 1937 }} },
44 { DATA_KARGATH, {{ 1938 }} },
45};
46
48{
49 public:
51
56
58 {
68
69 void OnPlayerEnter(Player* player) override
70 {
71 Aura* ex = nullptr;
72
73 player->CastSpell(player, SPELL_REMOVE_KARGATH_EXECUTIONER, true);
74
76 return;
77
78 switch (executed)
79 {
80 case 0:
81 ex = player->AddAura(SPELL_KARGATH_EXECUTIONER_1, player);
82 break;
83 case 1:
84 ex = player->AddAura(SPELL_KARGATH_EXECUTIONER_2, player);
85 break;
86 case 2:
87 ex = player->AddAura(SPELL_KARGATH_EXECUTIONER_3, player);
88 break;
89 default:
90 break;
91 }
92
93 if (ex)
95 }
96
97 void OnCreatureCreate(Creature* creature) override
98 {
99 switch (creature->GetEntry())
100 {
102 nethekurseGUID = creature->GetGUID();
103 break;
105 kargathGUID = creature->GetGUID();
106 break;
109 creature->UpdateEntry(NPC_DRISELLA);
110 break;
114 executionerGUID = creature->GetGUID();
115 break;
118 victimsGUID[0] = creature->GetGUID();
119 break;
122 victimsGUID[1] = creature->GetGUID();
123 break;
126 victimsGUID[2] = creature->GetGUID();
127 break;
128 }
129 }
130
131 void OnUnitDeath(Unit* unit) override
132 {
133 if (unit->GetEntry() == NPC_BLOOD_GUARD_PORUNG)
135 }
136
137 bool SetBossState(uint32 type, EncounterState state) override
138 {
139 if (!InstanceScript::SetBossState(type, state))
140 return false;
141
142 switch (type)
143 {
145 if (state == DONE)
146 {
148 executionTimer = 0;
149 }
150 break;
151 case DATA_KARGATH:
152 if (Creature* executioner = instance->GetCreature(executionerGUID))
153 executioner->AI()->Reset(); // trigger removal of IMMUNE_TO_PC flag
154 break;
155 case DATA_OMROGG:
156 break;
157 }
158 return true;
159 }
160
161 ObjectGuid GetGuidData(uint32 data) const override
162 {
163 switch (data)
164 {
166 return nethekurseGUID;
168 return kargathGUID;
170 return executionerGUID;
174 return victimsGUID[data - DATA_FIRST_PRISONER];
175 default:
176 return ObjectGuid::Empty;
177 }
178 }
179
180 void AfterDataLoad() override
181 {
182 // timed events are not resumable after reset/crash
184 executionTimer = 0;
185 }
186
187 uint32 GetData(uint32 type) const override
188 {
189 switch (type)
190 {
192 return executed;
194 return instance->GetTeamInInstance();
195 default:
196 return 0;
197 }
198 }
199
200 void Update(uint32 diff) override
201 {
202 if (!executionTimer)
203 return;
204
205 if (executionTimer <= diff)
206 {
208 switch (++executed)
209 {
210 case 1:
213 break;
214 case 2:
217 break;
218 default:
219 executionTimer = 0;
220 break;
221 }
222
223 if (Creature* executioner = instance->GetCreature(executionerGUID))
224 executioner->AI()->SetData(DATA_PRISONERS_EXECUTED, executed);
225 }
226 else
227 executionTimer -= diff;
228 }
229
230 private:
235
238 };
239};
240
@ IN_MILLISECONDS
Definition Common.h:38
@ MINUTE
Definition Common.h:32
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ DONE
@ HORDE
#define DataHeader
uint32 const EncounterCount
void SetDuration(int32 duration, bool withMods=false)
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:593
Team GetTeamInInstance() const
Definition Map.h:903
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void DoCastSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
void LoadDoorData(std::span< DoorData const > data)
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
static ObjectGuid const Empty
Definition ObjectGuid.h:314
bool IsEmpty() const
Definition ObjectGuid.h:362
uint32 GetEntry() const
Definition Object.h:89
Definition Unit.h:635
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:12249
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_TEAM_IN_INSTANCE
void AddSC_instance_shattered_halls()
static constexpr DoorData doorData[]
static constexpr DungeonEncounterData encounters[]
#define SHScriptName
@ DATA_PORUNG
@ DATA_KARGATH
@ DATA_OMROGG
@ DATA_SHATTERED_EXECUTIONER
@ DATA_SECOND_PRISONER
@ DATA_PRISONERS_EXECUTED
@ DATA_NETHEKURSE
@ DATA_THIRD_PRISONER
@ DATA_FIRST_PRISONER
@ NPC_ALLIANCE_VICTIM_1
@ NPC_HORDE_VICTIM_2
@ NPC_BLOOD_GUARD_PORUNG
@ NPC_CAPTAIN_ALINA
@ NPC_ALLIANCE_VICTIM_2
@ NPC_SHATTERED_EXECUTIONER
@ NPC_DRISELLA
@ NPC_GRAND_WARLOCK_NETHEKURSE
@ NPC_RANDY_WHIZZLESPROCKET
@ NPC_HORDE_VICTIM_1
@ NPC_KARGATH_BLADEFIST
@ NPC_CAPTAIN_BONESHATTER
@ GO_GRAND_WARLOCK_CHAMBER_DOOR_1
@ GO_GRAND_WARLOCK_CHAMBER_DOOR_2
@ SPELL_KARGATH_EXECUTIONER_2
@ SPELL_KARGATH_EXECUTIONER_3
@ SPELL_REMOVE_KARGATH_EXECUTIONER
@ SPELL_KARGATH_EXECUTIONER_1
uint32 const VictimCount