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 "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
38
40{
41 public:
43
45 {
55
56 void OnPlayerEnter(Player* player) override
57 {
58 if (!_teamInInstance)
59 _teamInInstance = player->GetTeam();
60 }
61
62 void OnCreatureCreate(Creature* creature) override
63 {
64 if (!_teamInInstance)
65 {
66 Map::PlayerList const& players = instance->GetPlayers();
67 if (!players.isEmpty())
68 if (Player* player = players.begin()->GetSource())
69 _teamInInstance = player->GetTeam();
70 }
71
72 switch (creature->GetEntry())
73 {
74 case NPC_GARFROST:
75 _garfrostGUID = creature->GetGUID();
76 break;
77 case NPC_KRICK:
78 _krickGUID = creature->GetGUID();
79 break;
80 case NPC_ICK:
81 _ickGUID = creature->GetGUID();
82 break;
83 case NPC_TYRANNUS:
84 _tyrannusGUID = creature->GetGUID();
85 break;
86 case NPC_RIMEFANG:
87 _rimefangGUID = creature->GetGUID();
88 break;
90 _tyrannusEventGUID = creature->GetGUID();
91 break;
93 _cavernstriggersVector.push_back(creature->GetGUID());
94 break;
97 case NPC_JAINA_PART1:
98 case NPC_JAINA_PART2:
99 _jainaOrSylvanas1GUID = creature->GetGUID();
100 break;
101 default:
102 break;
103 }
104 }
105
106 uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
107 {
108 uint32 entry = data->id;
109 switch (entry)
110 {
115 case NPC_KILARA:
117 case NPC_KORALEN:
145 default:
146 return entry;
147 }
148 }
149
150 bool SetBossState(uint32 type, EncounterState state) override
151 {
152 if (!InstanceScript::SetBossState(type, state))
153 return false;
154
155 switch (type)
156 {
157 case DATA_GARFROST:
158 if (state == DONE)
159 {
161 {
163 {
165 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
166 }
167 else
168 {
170 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
171 }
172 }
173 }
174 break;
175 case DATA_TYRANNUS:
176 if (state == DONE)
177 {
179 {
181 {
183 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
184 }
185 else
186 {
188 summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN);
189 }
190 }
191 }
192 break;
193 default:
194 break;
195 }
196
197 return true;
198 }
199
200 uint32 GetData(uint32 type) const override
201 {
202 switch (type)
203 {
205 return _teamInInstance;
207 return _shardsHit;
209 return _cavernActive;
210 default:
211 break;
212 }
213
214 return 0;
215 }
216
217 void SetData(uint32 type, uint32 data) override
218 {
219 switch (type)
220 {
222 _shardsHit = data;
223 break;
225 if (data)
226 {
227 _cavernActive = data;
229 }
230 else
232 break;
233 default:
234 break;
235 }
236 }
237
238 ObjectGuid GetGuidData(uint32 type) const override
239 {
240 switch (type)
241 {
242 case DATA_GARFROST:
243 return _garfrostGUID;
244 case DATA_KRICK:
245 return _krickGUID;
246 case DATA_ICK:
247 return _ickGUID;
248 case DATA_TYRANNUS:
249 return _tyrannusGUID;
250 case DATA_RIMEFANG:
251 return _rimefangGUID;
253 return _tyrannusEventGUID;
258 default:
259 break;
260 }
261
262 return ObjectGuid::Empty;
263 }
264
265 void HandleCavernEventTrigger(bool activate)
266 {
268 if (Creature* trigger = instance->GetCreature(guid))
269 {
270 if (activate)
271 trigger->m_Events.AddEvent(new ScheduledIcicleSummons(trigger), trigger->m_Events.CalculateTime(1s));
272 else
273 trigger->m_Events.KillAllEvents(false);
274 }
275 }
276
277 private:
283
288
292 };
293
295 {
297 }
298};
299
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
EncounterState
@ DONE
@ DOOR_TYPE_ROOM
@ DOOR_TYPE_PASSAGE
@ TEMPSUMMON_MANUAL_DESPAWN
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:262
@ ALLIANCE
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
InstanceMap * instance
void LoadDoorData(DoorData const *data)
void SetHeaders(std::string const &dataHeaders)
bool isEmpty() const
Definition LinkedList.h:108
iterator begin()
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1852
PlayerList const & GetPlayers() const
Definition Map.h:448
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:4397
static ObjectGuid const Empty
Definition ObjectGuid.h:140
uint32 LowType
Definition ObjectGuid.h:142
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 GetTeam() const
Definition Player.h:1832
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
DoorData const Doors[]
#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:96
uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data) override
bool SetBossState(uint32 type, EncounterState state) override