TrinityCore
instance_serpent_shrine.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_Serpent_Shrine
20SD%Complete: 100
21SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Serpent Shrine Scripts
22SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "GameObject.h"
27#include "GameObjectAI.h"
28#include "InstanceScript.h"
29#include "Map.h"
30#include "Player.h"
31#include "serpent_shrine.h"
32#include "TemporarySummon.h"
33
34#define MAX_ENCOUNTER 6
35
36enum Misc
37{
38 // Spells
40
41 // Creatures
45
46 // Misc
47 MIN_KILLS = 30
48};
49
50//NOTE: there are 6 platforms
51//there should be 3 shatterers and 2 priestess on all platforms, total of 30 elites, else it won't work!
52//delete all other elites not on platforms! these mobs should only be on those platforms nowhere else.
53
54/* Serpentshrine cavern encounters:
550 - Hydross The Unstable event
561 - Leotheras The Blind Event
572 - The Lurker Below Event
583 - Fathom-Lord Karathress Event
594 - Morogrim Tidewalker Event
605 - Lady Vashj Event
61*/
62
64{
65 { BOSS_HYDROSS_THE_UNSTABLE, {{ 623 }} },
66 { BOSS_THE_LURKER_BELOW, {{ 624 }} },
67 { BOSS_LEOTHERAS_THE_BLIND, {{ 625 }} },
68 { BOSS_FATHOM_LORD_KARATHRESS, {{ 626 }} },
69 { BOSS_MOROGRIM_TIDEWALKER, {{ 627 }} },
70 { BOSS_LADY_VASHJ, {{ 628 }} }
71};
72
74{
75 public:
76 go_bridge_console() : GameObjectScript("go_bridge_console") { }
77
79 {
80 go_bridge_consoleAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
81
83
84 bool OnGossipHello(Player* /*player*/) override
85 {
86 if (instance)
88 return true;
89 }
90 };
91
92 GameObjectAI* GetAI(GameObject* go) const override
93 {
94 return GetSerpentshrineCavernAI<go_bridge_consoleAI>(go);
95 }
96};
97
99{
100 public:
102
104 {
106 {
110
111 StrangePool = 0;
113
118 FishingTimer = 1000;
119 WaterCheckTimer = 500;
120 FrenzySpawnTimer = 2000;
121 DoSpawnFrenzy = false;
122 TrashCount = 0;
123 }
124
125 void Update(uint32 diff) override
126 {
127 //Water checks
128 if (WaterCheckTimer <= diff)
129 {
130 if (TrashCount >= MIN_KILLS)
132 else
134
135 Map::PlayerList const& PlayerList = instance->GetPlayers();
136 if (PlayerList.isEmpty())
137 return;
138 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
139 {
140 if (Player* player = i->GetSource())
141 {
142 if (player->IsAlive() && /*i->GetSource()->GetPositionZ() <= -21.434931f*/player->IsInWater())
143 {
145 {
146 if (!player->HasAura(SPELL_SCALDINGWATER))
147 player->CastSpell(player, SPELL_SCALDINGWATER, true);
148
149 }
150 else
151 {
152 //spawn frenzy
153 if (DoSpawnFrenzy)
154 {
155 if (Creature* frenzy = player->SummonCreature(NPC_COILFANG_FRENZY, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2s))
156 {
157 frenzy->Attack(player, false);
158 frenzy->SetSwim(true);
159 frenzy->SetDisableGravity(true);
160 }
161 DoSpawnFrenzy = false;
162 }
163 }
164 }
165 if (!player->IsInWater())
166 player->RemoveAurasDueToSpell(SPELL_SCALDINGWATER);
167 }
168
169 }
170 WaterCheckTimer = 500;//remove stress from core
171 }
172 else
173 WaterCheckTimer -= diff;
174
175 if (FrenzySpawnTimer <= diff)
176 {
177 DoSpawnFrenzy = true;
178 FrenzySpawnTimer = 2000;
179 }
180 else
181 FrenzySpawnTimer -= diff;
182 }
183
185 {
186 switch (go->GetEntry())
187 {
188 case 184568:
189 ControlConsole = go->GetGUID();
190 go->setActive(true);
191 go->SetFarVisible(true);
192 break;
193 case 184203:
194 BridgePart[0] = go->GetGUID();
195 go->setActive(true);
196 go->SetFarVisible(true);
197 break;
198 case 184204:
199 BridgePart[1] = go->GetGUID();
200 go->setActive(true);
201 go->SetFarVisible(true);
202 break;
203 case 184205:
204 BridgePart[2] = go->GetGUID();
205 go->setActive(true);
206 go->SetFarVisible(true);
207 break;
208 default:
209 break;
210 }
211 }
212
213 void OnCreatureCreate(Creature* creature) override
214 {
215 switch (creature->GetEntry())
216 {
217 case 21212:
218 LadyVashj = creature->GetGUID();
219 break;
220 case 21214:
221 Karathress = creature->GetGUID();
222 break;
223 case 21966:
224 Sharkkis = creature->GetGUID();
225 break;
226 case 21217:
227 LurkerBelow = creature->GetGUID();
228 break;
229 case 21965:
230 Tidalvess = creature->GetGUID();
231 break;
232 case 21964:
233 Caribdis = creature->GetGUID();
234 break;
235 case 21215:
236 LeotherasTheBlind = creature->GetGUID();
237 break;
238 default:
239 break;
240 }
241 }
242
243 void SetGuidData(uint32 type, ObjectGuid data) override
244 {
249 }
250
251 ObjectGuid GetGuidData(uint32 identifier) const override
252 {
253 switch (identifier)
254 {
256 return LurkerBelow;
257 case DATA_SHARKKIS:
258 return Sharkkis;
259 case DATA_TIDALVESS:
260 return Tidalvess;
261 case DATA_CARIBDIS:
262 return Caribdis;
263 case DATA_LADYVASHJ:
264 return LadyVashj;
265 case DATA_KARATHRESS:
266 return Karathress;
269 case DATA_LEOTHERAS:
270 return LeotherasTheBlind;
273 default:
274 break;
275 }
276 return ObjectGuid::Empty;
277 }
278
279 void SetData(uint32 type, uint32 data) override
280 {
281 switch (type)
282 {
284 StrangePool = data;
285 break;
287 if (data == DONE)
288 {
292 }
293 break;
294 case DATA_TRASH:
295 if (data == 1 && TrashCount < MIN_KILLS)
296 ++TrashCount;//+1 died
297 break;
298 case DATA_WATER:
299 Water = data;
300 break;
302 ShieldGeneratorDeactivated[0] = data != 0;
303 break;
305 ShieldGeneratorDeactivated[1] = data != 0;
306 break;
308 ShieldGeneratorDeactivated[2] = data != 0;
309 break;
311 ShieldGeneratorDeactivated[3] = data != 0;
312 break;
313 default:
314 break;
315 }
316 }
317
318 bool SetBossState(uint32 id, EncounterState state) override
319 {
320 if (!InstanceScript::SetBossState(id, state))
321 return false;
322
323 if (id == BOSS_LADY_VASHJ && state == NOT_STARTED)
324 {
329 }
330
331 return true;
332 }
333
334 uint32 GetData(uint32 type) const override
335 {
336 switch (type)
337 {
348 return 1;
349 break;
351 return StrangePool;
352 case DATA_WATER:
353 return Water;
354 default:
355 break;
356 }
357
358 return 0;
359 }
360
361 private:
371
380
383 };
384
386 {
388 }
389};
390
392{
394 new go_bridge_console();
395}
uint32_t uint32
Definition: Define.h:142
EncounterState
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: ObjectDefines.h:66
#define DataHeader
LadyVashj
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
void LoadDungeonEncounterData(T const &encounters)
InstanceMap * instance
void SetHeaders(std::string const &dataHeaders)
bool isEmpty() const
Definition: LinkedList.h:110
iterator end()
Definition: MapRefManager.h:35
iterator begin()
Definition: MapRefManager.h:34
PlayerList const & GetPlayers() const
Definition: Map.h:367
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
void setActive(bool isActiveObject)
Definition: Object.cpp:922
void SetFarVisible(bool on)
Definition: Object.cpp:973
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
GameObjectAI * GetAI(GameObject *go) const override
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_TRASH
Definition: hyjal.h:39
@ SPELL_SCALDINGWATER
@ NPC_COILFANG_PRIESTESS
@ NPC_COILFANG_SHATTERER
@ NPC_COILFANG_FRENZY
#define MAX_ENCOUNTER
void AddSC_instance_serpentshrine_cavern()
DungeonEncounterData const encounters[]
@ DATA_LEOTHERAS
@ DATA_CARIBDIS
@ DATA_LEOTHERAS_EVENT_STARTER
@ DATA_KARATHRESSEVENT_STARTER
@ DATA_SHIELDGENERATOR1
@ DATA_SHIELDGENERATOR3
@ DATA_SHIELDGENERATOR2
@ DATA_KARATHRESS
@ DATA_STRANGE_POOL
@ DATA_CONTROL_CONSOLE
@ DATA_TIDALVESS
@ DATA_WATER
@ DATA_CANSTARTPHASE3
@ DATA_SHIELDGENERATOR4
@ DATA_LADYVASHJ
@ DATA_THELURKERBELOW
@ DATA_SHARKKIS
@ WATERSTATE_SCALDING
@ WATERSTATE_FRENZY
#define SSCScriptName
@ BOSS_FATHOM_LORD_KARATHRESS
@ BOSS_LADY_VASHJ
@ BOSS_THE_LURKER_BELOW
@ BOSS_HYDROSS_THE_UNSTABLE
@ BOSS_MOROGRIM_TIDEWALKER
@ BOSS_LEOTHERAS_THE_BLIND