TrinityCore
Loading...
Searching...
No Matches
instance_pit_of_saron.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 "InstanceScript.h"
21#include "Map.h"
22#include "pit_of_saron.h"
23#include "TemporarySummon.h"
24
25// positions for Martin Victus (37591) and Gorkun Ironskull (37592)
26static constexpr Position SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f};
27// position for Jaina and Sylvanas
28static constexpr Position EventLeaderPos2 = {1054.368f, 107.14620f, 628.4467f, 0.0f};
29
36
37static constexpr DungeonEncounterData encounters[] =
38{
39 { DATA_GARFROST, {{ 1999 }} },
40 { DATA_ICK, {{ 2001 }} },
41 { DATA_TYRANNUS, {{ 2000 }} }
42};
43
45{
46 public:
48
50 {
60
61 void OnCreatureCreate(Creature* creature) override
62 {
63 switch (creature->GetEntry())
64 {
65 case NPC_GARFROST:
66 _garfrostGUID = creature->GetGUID();
67 break;
68 case NPC_KRICK:
69 _krickGUID = creature->GetGUID();
70 break;
71 case NPC_ICK:
72 _ickGUID = creature->GetGUID();
73 break;
74 case NPC_TYRANNUS:
75 _tyrannusGUID = creature->GetGUID();
76 break;
77 case NPC_RIMEFANG:
78 _rimefangGUID = creature->GetGUID();
79 break;
81 _tyrannusEventGUID = creature->GetGUID();
82 break;
84 _cavernstriggersVector.push_back(creature->GetGUID());
85 break;
88 case NPC_JAINA_PART1:
89 case NPC_JAINA_PART2:
90 _jainaOrSylvanas1GUID = creature->GetGUID();
91 break;
92 default:
93 break;
94 }
95 }
96
97 uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
98 {
99 uint32 entry = data->id;
100 switch (entry)
101 {
106 case NPC_KILARA:
108 case NPC_KORALEN:
136 default:
137 return entry;
138 }
139 }
140
141 bool SetBossState(uint32 type, EncounterState state) override
142 {
143 if (!InstanceScript::SetBossState(type, state))
144 return false;
145
146 switch (type)
147 {
148 case DATA_GARFROST:
149 if (state == DONE)
150 {
152 {
154 {
156 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
157 }
158 else
159 {
161 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
162 }
163 }
164 }
165 break;
166 case DATA_TYRANNUS:
167 if (state == DONE)
168 {
170 {
172 {
174 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
175 }
176 else
177 {
179 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
180 }
181 }
182 }
183 break;
184 default:
185 break;
186 }
187
188 return true;
189 }
190
191 uint32 GetData(uint32 type) const override
192 {
193 switch (type)
194 {
196 return instance->GetTeamInInstance();
198 return _shardsHit;
200 return _cavernActive;
201 default:
202 break;
203 }
204
205 return 0;
206 }
207
208 void SetData(uint32 type, uint32 data) override
209 {
210 switch (type)
211 {
213 _shardsHit = data;
214 break;
216 if (data)
217 {
218 _cavernActive = data;
220 }
221 else
223 break;
224 default:
225 break;
226 }
227 }
228
229 ObjectGuid GetGuidData(uint32 type) const override
230 {
231 switch (type)
232 {
233 case DATA_GARFROST:
234 return _garfrostGUID;
235 case DATA_KRICK:
236 return _krickGUID;
237 case DATA_ICK:
238 return _ickGUID;
239 case DATA_TYRANNUS:
240 return _tyrannusGUID;
241 case DATA_RIMEFANG:
242 return _rimefangGUID;
244 return _tyrannusEventGUID;
249 default:
250 break;
251 }
252
253 return ObjectGuid::Empty;
254 }
255
256 void HandleCavernEventTrigger(bool activate)
257 {
259 if (Creature* trigger = instance->GetCreature(guid))
260 {
261 if (activate)
262 trigger->m_Events.AddEvent(new ScheduledIcicleSummons(trigger), trigger->m_Events.CalculateTime(1s));
263 else
264 trigger->m_Events.KillAllEvents(false);
265 }
266 }
267
268 private:
274
279
282 };
283
285 {
287 }
288};
289
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ DONE
@ TEMPSUMMON_MANUAL_DESPAWN
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
@ ALLIANCE
#define DataHeader
uint32 const EncounterCount
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
Team GetTeamInInstance() const
Definition Map.h:903
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
void LoadDoorData(std::span< DoorData const > data)
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty, SmoothPhasingInfo const *smoothPhasingInfo=nullptr)
Definition Object.cpp:1186
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
static ObjectGuid const Empty
Definition ObjectGuid.h:314
uint64 LowType
Definition ObjectGuid.h:321
uint32 GetEntry() const
Definition Object.h:89
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_TEAM_IN_INSTANCE
@ NPC_JAINA_PART1
@ NPC_CHAMPION_1_ALLIANCE
@ NPC_JAINA_PART2
@ NPC_CHAMPION_1_HORDE
@ NPC_CHAMPION_2_ALLIANCE
@ NPC_SYLVANAS_PART2
@ NPC_ELANDRA
@ NPC_CHAMPION_3_HORDE
@ NPC_CHAMPION_2_HORDE
@ NPC_SYLVANAS_PART1
@ GO_ICE_WALL
void AddSC_instance_pit_of_saron()
static constexpr Position SlaveLeaderPos
static constexpr Position EventLeaderPos2
static constexpr DoorData Doors[]
static constexpr DungeonEncounterData encounters[]
#define PoSScriptName
@ DATA_ICK
@ DATA_CAVERN_ACTIVE
@ DATA_JAINA_SYLVANAS_2
@ DATA_ICE_SHARDS_HIT
@ DATA_TYRANNUS_EVENT
@ DATA_RIMEFANG
@ DATA_KRICK
@ DATA_JAINA_SYLVANAS_1
@ DATA_GARFROST
@ DATA_TYRANNUS
@ GO_HALLS_OF_REFLECTION_PORTCULLIS
@ NPC_ICK
@ NPC_FREED_SLAVE_1_ALLIANCE
@ NPC_KORALEN
@ NPC_HORDE_SLAVE_3
@ NPC_RIMEFANG
@ NPC_ALLIANCE_SLAVE_2
@ NPC_FREED_SLAVE_3_HORDE
@ NPC_FREED_SLAVE_3_ALLIANCE
@ NPC_KORLAEN
@ NPC_KILARA
@ NPC_GARFROST
@ NPC_CAVERN_EVENT_TRIGGER
@ NPC_FREED_SLAVE_2_HORDE
@ NPC_HORDE_SLAVE_2
@ NPC_TYRANNUS_EVENTS
@ NPC_HORDE_SLAVE_1
@ NPC_KRICK
@ NPC_GORKUN_IRONSKULL_2
@ NPC_FREED_SLAVE_1_HORDE
@ NPC_RESCUED_SLAVE_HORDE
@ NPC_MARTIN_VICTUS_1
@ NPC_TYRANNUS
@ NPC_ALLIANCE_SLAVE_4
@ NPC_RESCUED_SLAVE_ALLIANCE
@ NPC_MARTIN_VICTUS_2
@ NPC_HORDE_SLAVE_4
@ NPC_ALLIANCE_SLAVE_3
@ NPC_FREED_SLAVE_2_ALLIANCE
@ NPC_ALLIANCE_SLAVE_1
@ NPC_GORKUN_IRONSKULL_1
uint32 id
Definition SpawnData.h:135
uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data) override
bool SetBossState(uint32 type, EncounterState state) override