Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
instance_serpent_shrine.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Instance_Serpent_Shrine
8SD%Complete: 100
9SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Serpent Shrine Scripts
10SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "InstanceScript.h"
15#include "serpent_shrine.h"
16#include "Player.h"
17#include "TemporarySummon.h"
18
19#define MAX_ENCOUNTER 6
20
21enum Misc
22{
23 // Spells
25
26 // Creatures
30
31 // Misc
33};
34
35
36//NOTE: there are 6 platforms
37//there should be 3 shatterers and 2 priestess on all platforms, total of 30 elites, else it won't work!
38//delete all other elites not on platforms! these mobs should only be on those platforms nowhere else.
39
40/* Serpentshrine cavern encounters:
410 - Hydross The Unstable event
421 - Leotheras The Blind Event
432 - The Lurker Below Event
443 - Fathom-Lord Karathress Event
454 - Morogrim Tidewalker Event
465 - Lady Vashj Event
47*/
48
50{
51 public:
52 go_bridge_console() : GameObjectScript("go_bridge_console") { }
53
54 bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE
55 {
56 InstanceScript* instance = go->GetInstanceScript();
57
58 if (!instance)
59 return false;
60
61 if (instance)
63
64 return true;
65 }
66};
67
69{
70 public:
71 instance_serpent_shrine() : InstanceMapScript("instance_serpent_shrine", 548) { }
72
74 {
78
80 {
81 memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
82
83 LurkerBelow = 0;
84 Sharkkis = 0;
85 Tidalvess = 0;
86 Caribdis = 0;
87 LadyVashj = 0;
88 Karathress = 0;
92
94 BridgePart[0] = 0;
95 BridgePart[1] = 0;
96 BridgePart[2] = 0;
97 StrangePool = 0;
99
104 FishingTimer = 1000;
105 WaterCheckTimer = 500;
106 FrenzySpawnTimer = 2000;
107 DoSpawnFrenzy = false;
108 TrashCount = 0;
109 }
110
112 {
113 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
114 if (m_auiEncounter[i] == IN_PROGRESS)
115 return true;
116
117 return false;
118 }
119
121 {
122 //Water checks
123 if (WaterCheckTimer <= diff)
124 {
125 if (TrashCount >= MIN_KILLS)
127 else
129
130 Map::PlayerList const &PlayerList = instance->GetPlayers();
131 if (PlayerList.isEmpty())
132 return;
133 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
134 {
135 if (Player* player = i->GetSource())
136 {
137 if (player->IsAlive() && /*i->GetSource()->GetPositionZ() <= -21.434931f*/player->IsInWater())
138 {
140 {
141 if (!player->HasAura(SPELL_SCALDINGWATER))
142 {
143 player->CastSpell(player, SPELL_SCALDINGWATER, true);
144 }
145 } else if (Water == WATERSTATE_FRENZY)
146 {
147 //spawn frenzy
148 if (DoSpawnFrenzy)
149 {
150 if (Creature* frenzy = player->SummonCreature(NPC_COILFANG_FRENZY, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2000))
151 {
152 frenzy->Attack(player, false);
153 frenzy->SetSwim(true);
154 frenzy->SetDisableGravity(true);
155 }
156 DoSpawnFrenzy = false;
157 }
158 }
159 }
160 if (!player->IsInWater())
161 player->RemoveAurasDueToSpell(SPELL_SCALDINGWATER);
162 }
163 }
164 WaterCheckTimer = 500;//remove stress from core
165 }
166 else
167 WaterCheckTimer -= diff;
168
169 if (FrenzySpawnTimer <= diff)
170 {
171 DoSpawnFrenzy = true;
172 FrenzySpawnTimer = 2000;
173 }
174 else
175 FrenzySpawnTimer -= diff;
176 }
177
179 {
180 switch (go->GetEntry())
181 {
182 case 184568:
183 ControlConsole = go->GetGUID();
184 go->setActive(true);
185 break;
186 case 184203:
187 BridgePart[0] = go->GetGUID();
188 go->setActive(true);
189 break;
190 case 184204:
191 BridgePart[1] = go->GetGUID();
192 go->setActive(true);
193 break;
194 case 184205:
195 BridgePart[2] = go->GetGUID();
196 go->setActive(true);
197 break;
198 default:
199 break;
200 }
201 }
202
204 {
205 switch (creature->GetEntry())
206 {
207 case 21212:
208 LadyVashj = creature->GetGUID();
209 break;
210 case 21214:
211 Karathress = creature->GetGUID();
212 break;
213 case 21966:
214 Sharkkis = creature->GetGUID();
215 break;
216 case 21217:
217 LurkerBelow = creature->GetGUID();
218 break;
219 case 21965:
220 Tidalvess = creature->GetGUID();
221 break;
222 case 21964:
223 Caribdis = creature->GetGUID();
224 break;
225 case 21215:
226 LeotherasTheBlind = creature->GetGUID();
227 break;
228 default:
229 break;
230 }
231 }
232
234 {
239 }
240
241 uint64 GetData64(uint32 identifier) const OVERRIDE
242 {
243 switch (identifier)
244 {
246 return LurkerBelow;
247 case DATA_SHARKKIS:
248 return Sharkkis;
249 case DATA_TIDALVESS:
250 return Tidalvess;
251 case DATA_CARIBDIS:
252 return Caribdis;
253 case DATA_LADYVASHJ:
254 return LadyVashj;
255 case DATA_KARATHRESS:
256 return Karathress;
259 case DATA_LEOTHERAS:
260 return LeotherasTheBlind;
263 default:
264 break;
265 }
266 return 0;
267 }
268
269 void SetData(uint32 type, uint32 data) OVERRIDE
270 {
271 switch (type)
272 {
274 StrangePool = data;
275 break;
277 if (data == DONE)
278 {
282 }
283 ControlConsole = data;
284 break;
285 case DATA_TRASH:
286 if (data == 1 && TrashCount < MIN_KILLS)
287 ++TrashCount;//+1 died
288 SaveToDB();
289 break;
290 case DATA_WATER:
291 Water = data;
292 break;
294 m_auiEncounter[0] = data;
295 break;
297 m_auiEncounter[1] = data;
298 break;
300 m_auiEncounter[2] = data;
301 break;
303 m_auiEncounter[3] = data;
304 break;
306 m_auiEncounter[4] = data;
307 break;
308 //Lady Vashj
310 if (data == NOT_STARTED)
311 {
316 }
317 m_auiEncounter[5] = data;
318 break;
320 ShieldGeneratorDeactivated[0] = data != 0;
321 break;
323 ShieldGeneratorDeactivated[1] = data != 0;
324 break;
326 ShieldGeneratorDeactivated[2] = data != 0;
327 break;
329 ShieldGeneratorDeactivated[3] = data != 0;
330 break;
331 default:
332 break;
333 }
334
335 if (data == DONE)
336 SaveToDB();
337 }
338
340 {
341 switch (type)
342 {
344 return m_auiEncounter[0];
346 return m_auiEncounter[1];
348 return m_auiEncounter[2];
350 return m_auiEncounter[3];
352 return m_auiEncounter[4];
353 //Lady Vashj
355 return m_auiEncounter[5];
366 return 1;
367 break;
369 return StrangePool;
370 case DATA_WATER:
371 return Water;
372 default:
373 break;
374 }
375
376 return 0;
377 }
378
379 std::string GetSaveData() OVERRIDE
380 {
382 std::ostringstream stream;
383 stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
384 << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' << TrashCount;
386 return stream.str();
387 }
388
389 void Load(const char* in) OVERRIDE
390 {
391 if (!in)
392 {
394 return;
395 }
396
398 std::istringstream stream(in);
399 stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]
401
402 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
403 if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead.
405
407 }
408
409 private:
419
428
432 };
433
438};
439
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
#define OUT_LOAD_INST_DATA_FAIL
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
#define OUT_SAVE_INST_DATA_COMPLETE
#define OUT_LOAD_INST_DATA_COMPLETE
#define OUT_SAVE_INST_DATA
#define OUT_LOAD_INST_DATA(a)
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
GameObjectScript(const char *name)
InstanceMapScript(const char *name, uint32 mapId)
InstanceScript(Map *map)
void HandleGameObject(uint64 guid, bool open, GameObject *go=NULL)
bool isEmpty() const
Definition LinkedList.h:86
Definition Map.h:238
MapRefManager PlayerList
Definition Map.h:406
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition Object.cpp:2703
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:37
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
@ DATA_TRASH
Definition hyjal.h:28
@ NPC_COILFANG_PRIESTESS
@ NPC_COILFANG_SHATTERER
#define MAX_ENCOUNTER
void AddSC_instance_serpentshrine_cavern()
@ WATERSTATE_SCALDING
@ WATERSTATE_FRENZY
@ DATA_LEOTHERAS
@ DATA_CARIBDIS
@ DATA_LEOTHERAS_EVENT_STARTER
@ DATA_KARATHRESSEVENT_STARTER
@ DATA_HYDROSSTHEUNSTABLEEVENT
@ DATA_SHIELDGENERATOR1
@ DATA_SHIELDGENERATOR3
@ DATA_SHIELDGENERATOR2
@ DATA_KARATHRESS
@ DATA_STRANGE_POOL
@ DATA_CONTROL_CONSOLE
@ DATA_LADYVASHJEVENT
@ DATA_TIDALVESS
@ DATA_KARATHRESSEVENT
@ DATA_THELURKERBELOWEVENT
@ DATA_LEOTHERASTHEBLINDEVENT
@ DATA_WATER
@ DATA_CANSTARTPHASE3
@ DATA_SHIELDGENERATOR4
@ DATA_LADYVASHJ
@ DATA_THELURKERBELOW
@ DATA_MOROGRIMTIDEWALKEREVENT
@ DATA_SHARKKIS