TrinityCore
Loading...
Searching...
No Matches
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 "EventMap.h"
27#include "GameObject.h"
28#include "GameObjectAI.h"
29#include "InstanceScript.h"
30#include "Map.h"
31#include "Player.h"
32#include "serpent_shrine.h"
33#include "TemporarySummon.h"
34
35#define MAX_ENCOUNTER 6
36
37enum Misc
38{
39 // Spells
41
42 // Creatures
46
47 // Misc
48 MIN_KILLS = 30
49};
50
51//NOTE: there are 6 platforms
52//there should be 3 shatterers and 2 priestess on all platforms, total of 30 elites, else it won't work!
53//delete all other elites not on platforms! these mobs should only be on those platforms nowhere else.
54
55/* Serpentshrine cavern encounters:
560 - Hydross The Unstable event
571 - Leotheras The Blind Event
582 - The Lurker Below Event
593 - Fathom-Lord Karathress Event
604 - Morogrim Tidewalker Event
615 - Lady Vashj Event
62*/
63
64static constexpr ObjectData creatureData[] =
65{
67 { 0, 0 } // END
68};
69
81
83{
84 public:
86
88 {
102
103 void Update(uint32 diff) override
104 {
105 //Water checks
106 if (WaterCheckTimer <= diff)
107 {
108 if (TrashCount >= MIN_KILLS)
110 else
112
113 Map::PlayerList const& PlayerList = instance->GetPlayers();
114 if (PlayerList.isEmpty())
115 return;
116 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
117 {
118 if (Player* player = i->GetSource())
119 {
120 if (player->IsAlive() && /*i->GetSource()->GetPositionZ() <= -21.434931f*/player->IsInWater())
121 {
123 {
124 if (!player->HasAura(SPELL_SCALDINGWATER))
125 player->CastSpell(player, SPELL_SCALDINGWATER, true);
126
127 }
128 else
129 {
130 //spawn frenzy
131 if (DoSpawnFrenzy)
132 {
133 if (Creature* frenzy = player->SummonCreature(NPC_COILFANG_FRENZY, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2s))
134 {
135 frenzy->Attack(player, false);
136 frenzy->SetSwim(true);
137 frenzy->SetDisableGravity(true);
138 }
139 DoSpawnFrenzy = false;
140 }
141 }
142 }
143 if (!player->IsInWater())
144 player->RemoveAurasDueToSpell(SPELL_SCALDINGWATER);
145 }
146
147 }
148 WaterCheckTimer = 500;//remove stress from core
149 }
150 else
151 WaterCheckTimer -= diff;
152
153 if (FrenzySpawnTimer <= diff)
154 {
155 DoSpawnFrenzy = true;
156 FrenzySpawnTimer = 2000;
157 }
158 else
159 FrenzySpawnTimer -= diff;
160
161 Events.Update(diff);
162
163 if (Events.ExecuteEvent() == EVENT_RESPAWN_STRANGE_POOL)
165 }
166
167 void OnCreatureCreate(Creature* creature) override
168 {
170
171 switch (creature->GetEntry())
172 {
173 case 21214:
174 Karathress = creature->GetGUID();
175 break;
176 case 21966:
177 Sharkkis = creature->GetGUID();
178 break;
179 case 21965:
180 Tidalvess = creature->GetGUID();
181 break;
182 case 21964:
183 Caribdis = creature->GetGUID();
184 break;
185 case 21215:
186 LeotherasTheBlind = creature->GetGUID();
187 break;
188 default:
189 break;
190 }
191 }
192
193 bool SetBossState(uint32 id, EncounterState state) override
194 {
195 if (!InstanceScript::SetBossState(id, state))
196 return false;
197
198 switch (id)
199 {
201 if (state == FAIL)
202 Events.ScheduleEvent(EVENT_RESPAWN_STRANGE_POOL, 15s);
203 break;
204 default:
205 break;
206 }
207
208 return true;
209 }
210
211 void SetGuidData(uint32 type, ObjectGuid data) override
212 {
215 }
216
217 ObjectGuid GetGuidData(uint32 identifier) const override
218 {
219 switch (identifier)
220 {
221 case DATA_SHARKKIS:
222 return Sharkkis;
223 case DATA_TIDALVESS:
224 return Tidalvess;
225 case DATA_CARIBDIS:
226 return Caribdis;
227 case DATA_KARATHRESS:
228 return Karathress;
229 case DATA_LEOTHERAS:
230 return LeotherasTheBlind;
233 default:
234 break;
235 }
236 return ObjectGuid::Empty;
237 }
238
239 void SetData(uint32 type, uint32 data) override
240 {
241 switch (type)
242 {
243 case DATA_TRASH:
244 if (data == 1 && TrashCount < MIN_KILLS)
245 ++TrashCount;//+1 died
246 SaveToDB();
247 break;
248 case DATA_WATER:
249 Water = data;
250 break;
251 default:
252 break;
253 }
254 }
255
256 uint32 GetData(uint32 type) const override
257 {
258 switch (type)
259 {
260 case DATA_WATER:
261 return Water;
262 default:
263 break;
264 }
265
266 return 0;
267 }
268
269 void WriteSaveDataMore(std::ostringstream& stream) override
270 {
271 stream << TrashCount;
272 }
273
274 void ReadSaveDataMore(std::istringstream& stream) override
275 {
276 stream >> TrashCount;
277 }
278
279 private:
286
291
293
294 protected:
296 };
297
302};
303
uint32_t uint32
Definition Define.h:133
EncounterState
@ FAIL
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
#define DataHeader
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
virtual void OnCreatureCreate(Creature *creature) override
InstanceMap * instance
void SetHeaders(std::string const &dataHeaders)
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
bool isEmpty() const
Definition LinkedList.h:108
iterator end()
iterator begin()
PlayerList const & GetPlayers() const
Definition Map.h:448
static ObjectGuid const Empty
Definition ObjectGuid.h:140
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
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:1992
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_TRASH
Definition hyjal.h:39
static constexpr ObjectData creatureData[]
@ NPC_COILFANG_PRIESTESS
@ NPC_COILFANG_SHATTERER
#define MAX_ENCOUNTER
static constexpr ObjectData gameObjectData[]
void AddSC_instance_serpentshrine_cavern()
@ GO_SHIELD_GENERATOR_4
@ GO_SHIELD_GENERATOR_1
@ GO_SHIELD_GENERATOR_2
@ GO_BRIDGE_PART_2
@ GO_BRIDGE_PART_3
@ GO_SHIELD_GENERATOR_3
@ GO_BRIDGE_PART_1
@ DATA_SHIELD_GENERATOR_1
@ DATA_LEOTHERAS
@ DATA_CARIBDIS
@ DATA_LEOTHERAS_EVENT_STARTER
@ DATA_SHIELD_GENERATOR_2
@ DATA_KARATHRESS
@ DATA_BRIDGE_PART_2
@ DATA_TIDALVESS
@ DATA_BRIDGE_PART_1
@ DATA_WATER
@ DATA_SHIELD_GENERATOR_3
@ DATA_BRIDGE_PART_3
@ DATA_SHARKKIS
@ DATA_SHIELD_GENERATOR_4
@ EVENT_RESPAWN_STRANGE_POOL
@ NPC_LADY_VASHJ
@ WATERSTATE_SCALDING
@ WATERSTATE_FRENZY
#define SSCScriptName
@ BOSS_LADY_VASHJ
@ BOSS_THE_LURKER_BELOW