TrinityCore
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 "Player.h"
24#include "TemporarySummon.h"
25
26// positions for Martin Victus (37591) and Gorkun Ironskull (37592)
27Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f};
28// position for Jaina and Sylvanas
29Position const EventLeaderPos2 = {1054.368f, 107.14620f, 628.4467f, 0.0f};
30
31DoorData const Doors[] =
32{
37};
38
40{
41 { DATA_GARFROST, {{ 1999 }} },
42 { DATA_ICK, {{ 2001 }} },
43 { DATA_TYRANNUS, {{ 2000 }} }
44};
45
47{
48 public:
50
52 {
54 {
60 _cavernActive = 0;
61 _shardsHit = 0;
62 }
63
64 void OnPlayerEnter(Player* player) override
65 {
66 if (!_teamInInstance)
67 _teamInInstance = player->GetTeam();
68 }
69
70 void OnCreatureCreate(Creature* creature) override
71 {
72 if (!_teamInInstance)
73 {
74 Map::PlayerList const& players = instance->GetPlayers();
75 if (!players.isEmpty())
76 if (Player* player = players.begin()->GetSource())
77 _teamInInstance = player->GetTeam();
78 }
79
80 switch (creature->GetEntry())
81 {
82 case NPC_GARFROST:
83 _garfrostGUID = creature->GetGUID();
84 break;
85 case NPC_KRICK:
86 _krickGUID = creature->GetGUID();
87 break;
88 case NPC_ICK:
89 _ickGUID = creature->GetGUID();
90 break;
91 case NPC_TYRANNUS:
92 _tyrannusGUID = creature->GetGUID();
93 break;
94 case NPC_RIMEFANG:
95 _rimefangGUID = creature->GetGUID();
96 break;
98 _tyrannusEventGUID = creature->GetGUID();
99 break;
101 _cavernstriggersVector.push_back(creature->GetGUID());
102 break;
105 case NPC_JAINA_PART1:
106 case NPC_JAINA_PART2:
107 _jainaOrSylvanas1GUID = creature->GetGUID();
108 break;
109 default:
110 break;
111 }
112 }
113
114 uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
115 {
116 uint32 entry = data->id;
117 switch (entry)
118 {
123 case NPC_KILARA:
125 case NPC_KORALEN:
153 default:
154 return entry;
155 }
156 }
157
158 bool SetBossState(uint32 type, EncounterState state) override
159 {
160 if (!InstanceScript::SetBossState(type, state))
161 return false;
162
163 switch (type)
164 {
165 case DATA_GARFROST:
166 if (state == DONE)
167 {
169 {
171 {
173 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
174 }
175 else
176 {
178 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
179 }
180 }
181 }
182 break;
183 case DATA_TYRANNUS:
184 if (state == DONE)
185 {
187 {
189 {
191 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
192 }
193 else
194 {
196 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
197 }
198 }
199 }
200 break;
201 default:
202 break;
203 }
204
205 return true;
206 }
207
208 uint32 GetData(uint32 type) const override
209 {
210 switch (type)
211 {
213 return _teamInInstance;
215 return _shardsHit;
217 return _cavernActive;
218 default:
219 break;
220 }
221
222 return 0;
223 }
224
225 void SetData(uint32 type, uint32 data) override
226 {
227 switch (type)
228 {
230 _shardsHit = data;
231 break;
233 if (data)
234 {
235 _cavernActive = data;
237 }
238 else
240 break;
241 default:
242 break;
243 }
244 }
245
246 ObjectGuid GetGuidData(uint32 type) const override
247 {
248 switch (type)
249 {
250 case DATA_GARFROST:
251 return _garfrostGUID;
252 case DATA_KRICK:
253 return _krickGUID;
254 case DATA_ICK:
255 return _ickGUID;
256 case DATA_TYRANNUS:
257 return _tyrannusGUID;
258 case DATA_RIMEFANG:
259 return _rimefangGUID;
261 return _tyrannusEventGUID;
266 default:
267 break;
268 }
269
270 return ObjectGuid::Empty;
271 }
272
273 void HandleCavernEventTrigger(bool activate)
274 {
276 if (Creature* trigger = instance->GetCreature(guid))
277 {
278 if (activate)
279 trigger->m_Events.AddEvent(new ScheduledIcicleSummons(trigger), trigger->m_Events.CalculateTime(1s));
280 else
281 trigger->m_Events.KillAllEvents(false);
282 }
283 }
284
285 private:
291
296
300 };
301
303 {
305 }
306};
307
309{
311}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
EncounterState
@ DONE
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:395
@ ALLIANCE
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void LoadDungeonEncounterData(T const &encounters)
InstanceMap * instance
void LoadDoorData(DoorData const *data)
void SetHeaders(std::string const &dataHeaders)
bool isEmpty() const
Definition: LinkedList.h:110
iterator begin()
Definition: MapRefManager.h:34
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:1836
PlayerList const & GetPlayers() const
Definition: Map.h:367
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3479
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
uint64 LowType
Definition: ObjectGuid.h:278
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
Team GetTeam() const
Definition: Player.h:2235
FROM * GetSource() const
Definition: Reference.h:96
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()
Position const EventLeaderPos2
Position const SlaveLeaderPos
DungeonEncounterData const encounters[]
DoorData const Doors[]
#define PoSScriptName
Definition: pit_of_saron.h:24
@ DATA_ICK
Definition: pit_of_saron.h:33
@ DATA_CAVERN_ACTIVE
Definition: pit_of_saron.h:44
@ DATA_JAINA_SYLVANAS_2
Definition: pit_of_saron.h:40
@ DATA_ICE_SHARDS_HIT
Definition: pit_of_saron.h:43
@ DATA_TYRANNUS_EVENT
Definition: pit_of_saron.h:41
@ DATA_RIMEFANG
Definition: pit_of_saron.h:37
@ DATA_KRICK
Definition: pit_of_saron.h:38
@ DATA_JAINA_SYLVANAS_1
Definition: pit_of_saron.h:39
@ DATA_GARFROST
Definition: pit_of_saron.h:32
@ DATA_TYRANNUS
Definition: pit_of_saron.h:34
@ GO_HALLS_OF_REFLECTION_PORTCULLIS
Definition: pit_of_saron.h:102
@ NPC_ICK
Definition: pit_of_saron.h:51
@ NPC_FREED_SLAVE_1_ALLIANCE
Definition: pit_of_saron.h:78
@ NPC_KORALEN
Definition: pit_of_saron.h:62
@ NPC_HORDE_SLAVE_3
Definition: pit_of_saron.h:72
@ NPC_RIMEFANG
Definition: pit_of_saron.h:53
@ NPC_ALLIANCE_SLAVE_2
Definition: pit_of_saron.h:75
@ NPC_FREED_SLAVE_3_HORDE
Definition: pit_of_saron.h:83
@ NPC_FREED_SLAVE_3_ALLIANCE
Definition: pit_of_saron.h:80
@ NPC_KORLAEN
Definition: pit_of_saron.h:63
@ NPC_KILARA
Definition: pit_of_saron.h:60
@ NPC_GARFROST
Definition: pit_of_saron.h:49
@ NPC_CAVERN_EVENT_TRIGGER
Definition: pit_of_saron.h:95
@ NPC_FREED_SLAVE_2_HORDE
Definition: pit_of_saron.h:82
@ NPC_HORDE_SLAVE_2
Definition: pit_of_saron.h:71
@ NPC_TYRANNUS_EVENTS
Definition: pit_of_saron.h:55
@ NPC_HORDE_SLAVE_1
Definition: pit_of_saron.h:70
@ NPC_KRICK
Definition: pit_of_saron.h:50
@ NPC_GORKUN_IRONSKULL_2
Definition: pit_of_saron.h:89
@ NPC_FREED_SLAVE_1_HORDE
Definition: pit_of_saron.h:81
@ NPC_RESCUED_SLAVE_HORDE
Definition: pit_of_saron.h:85
@ NPC_MARTIN_VICTUS_1
Definition: pit_of_saron.h:86
@ NPC_TYRANNUS
Definition: pit_of_saron.h:52
@ NPC_ALLIANCE_SLAVE_4
Definition: pit_of_saron.h:77
@ NPC_RESCUED_SLAVE_ALLIANCE
Definition: pit_of_saron.h:84
@ NPC_MARTIN_VICTUS_2
Definition: pit_of_saron.h:87
@ NPC_HORDE_SLAVE_4
Definition: pit_of_saron.h:73
@ NPC_ALLIANCE_SLAVE_3
Definition: pit_of_saron.h:76
@ NPC_FREED_SLAVE_2_ALLIANCE
Definition: pit_of_saron.h:79
@ NPC_ALLIANCE_SLAVE_1
Definition: pit_of_saron.h:74
@ NPC_GORKUN_IRONSKULL_1
Definition: pit_of_saron.h:88
uint32 id
Definition: SpawnData.h:104
uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data) override
bool SetBossState(uint32 type, EncounterState state) override