TrinityCore
Loading...
Searching...
No Matches
instance_blackwing_lair.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 "blackwing_lair.h"
20#include "GameObject.h"
21#include "InstanceScript.h"
22#include "Map.h"
23#include "MotionMaster.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "TemporarySummon.h"
27
40
54
56{
58 { 0, 0 } //END
59};
60
62{
63 {-7661.207520f, -1043.268188f, 407.199554f, 6.280452f},
64 {-7644.145020f, -1065.628052f, 407.204956f, 0.501492f},
65 {-7624.260742f, -1095.196899f, 407.205017f, 0.544694f},
66 {-7608.501953f, -1116.077271f, 407.199921f, 0.816443f},
67 {-7531.841797f, -1063.765381f, 407.199615f, 2.874187f},
68 {-7547.319336f, -1040.971924f, 407.205078f, 3.789175f},
69 {-7568.547852f, -1013.112488f, 407.204926f, 3.773467f},
70 {-7584.175781f, -989.6691289f, 407.199585f, 4.527447f},
71};
72
73uint32 const Entry[5] = {12422, 12458, 12416, 12420, 12459};
74
76{
77public:
79
81 {
93
94 void OnCreatureCreate(Creature* creature) override
95 {
97
98 switch (creature->GetEntry())
99 {
105 if (CreatureAI* razorAI = razor->AI())
106 razorAI->JustSummoned(creature);
107 break;
108 default:
109 break;
110 }
111 }
112
114 {
116
117 switch(go->GetEntry())
118 {
121 go->SetPhaseMask(2, true);
122 else
123 _eggList.push_back(go->GetGUID());
124 break;
126 _drakonicBonesList.push_back(go->GetGUID());
127 break;
128 default:
129 break;
130 }
131 }
132
134 {
136
137 if (go->GetEntry() == GO_BLACK_DRAGON_EGG)
138 _eggList.remove(go->GetGUID());
139 }
140
141 bool CheckRequiredBosses(uint32 bossId, Player const* player /*= nullptr*/) const override
142 {
143 if (_SkipCheckRequiredBosses(player))
144 return true;
145
146 switch (bossId)
147 {
150 return false;
151 break;
152 case DATA_FIREMAW:
153 case DATA_EBONROC:
154 case DATA_FLAMEGOR:
156 return false;
157 break;
158 case DATA_CHROMAGGUS:
162 return false;
163 break;
164 default:
165 break;
166 }
167
168 return true;
169 }
170
171 bool SetBossState(uint32 type, EncounterState state) override
172 {
173 if (!InstanceScript::SetBossState(type, state))
174 return false;
175
176 switch (type)
177 {
179 if (state == DONE)
180 {
181 for (GuidList::const_iterator itr = _eggList.begin(); itr != _eggList.end(); ++itr)
182 if (GameObject* egg = instance->GetGameObject(*itr))
183 egg->SetPhaseMask(2, true);
184 }
186 break;
187 case DATA_NEFARIAN:
188 switch (state)
189 {
190 case NOT_STARTED:
191 if (Creature* nefarian = GetCreature(DATA_NEFARIAN))
192 nefarian->DespawnOrUnsummon();
193 break;
194 case FAIL:
197 break;
198 default:
199 break;
200 }
201 break;
202 }
203 return true;
204 }
205
206 void SetData(uint32 type, uint32 data) override
207 {
208 if (type == DATA_EGG_EVENT)
209 {
210 switch (data)
211 {
212 case IN_PROGRESS:
214 _eggEvent = data;
215 _eggCount = 0;
216 break;
217 case NOT_STARTED:
219 _eggEvent = data;
220 _eggCount = 0;
221 break;
222 case SPECIAL:
223 if (++_eggCount == 15)
224 {
226 {
228 razor->RemoveAurasDueToSpell(42013); // MindControl
229 DoRemoveAurasDueToSpellOnPlayers(42013, true, true);
230 }
233 }
234 if (_eggEvent == NOT_STARTED)
236 break;
237 }
238 }
239 else if (type == DATA_DRAKONID_BONES)
240 {
241 for (ObjectGuid const& guid : _drakonicBonesList)
242 if (GameObject* go = instance->GetGameObject(guid))
243 go->DespawnOrUnsummon();
244 _drakonicBonesList.clear();
245 }
246 }
247
254
255 void Update(uint32 diff) override
256 {
257 if (_events.Empty())
258 return;
259
260 _events.Update(diff);
261
262 while (uint32 eventId = _events.ExecuteEvent())
263 {
264 switch (eventId)
265 {
267 for (uint8 i = urand(2, 5); i > 0; --i)
268 if (Creature* summon = instance->SummonCreature(Entry[urand(0, 4)], SummonPosition[urand(0, 7)]))
269 summon->AI()->DoZoneInCombat();
271 break;
275 razor->AI()->DoAction(ACTION_PHASE_TWO);
276 break;
279 {
280 nefarius->SetPhaseMask(1, true);
281 nefarius->setActive(true);
282 nefarius->SetFarVisible(true);
283 nefarius->Respawn();
284 nefarius->GetMotionMaster()->MoveTargetedHome();
285 }
286 break;
287 }
288 }
289 }
290
291 protected:
292 // Misc
294
295 // Razorgore
299
300 // Nefarian
302 };
303
305 {
307 }
308};
309
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
EncounterState
@ IN_PROGRESS
@ FAIL
@ DONE
@ SPECIAL
@ NOT_STARTED
@ DOOR_TYPE_ROOM
@ DOOR_TYPE_PASSAGE
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:261
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define DataHeader
uint32 const EncounterCount
@ EVENT_RAZOR_PHASE_TWO
@ EVENT_RAZOR_SPAWN
@ EVENT_RESPAWN_NEFARIUS
@ DATA_DRAKONID_BONES
@ DATA_EGG_EVENT
@ ACTION_PHASE_TWO
@ GO_PORTCULLIS_CHROMAGGUS
@ GO_PORTCULLIS_BROODLORD
@ GO_PORTCULLIS_NEFARIAN
@ GO_CHROMAGGUS_DOOR
@ GO_BLACK_DRAGON_EGG
@ GO_PORTCULLIS_VAELASTRASZ
@ GO_PORTCULLIS_THREEDRAGONS
@ GO_DRAKONID_BONES
@ GO_PORTCULLIS_RAZORGORE
#define BWLScriptName
@ DATA_VAELASTRAZ_THE_CORRUPT
@ DATA_FLAMEGOR
@ DATA_LORD_VICTOR_NEFARIUS
@ DATA_CHROMAGGUS
@ DATA_NEFARIAN
@ DATA_GO_CHROMAGGUS_DOOR
@ DATA_EBONROC
@ DATA_BROODLORD_LASHLAYER
@ DATA_FIREMAW
@ DATA_RAZORGORE_THE_UNTAMED
@ NPC_BROODLORD
@ NPC_VICTOR_NEFARIUS
@ NPC_BLACKWING_DRAGON
@ NPC_CHROMAGGUS
@ NPC_EBONROC
@ NPC_BLACKWING_TASKMASTER
@ NPC_FIREMAW
@ NPC_RAZORGORE
@ NPC_BLACKWING_LEGIONAIRE
@ NPC_BLACKWING_WARLOCK
@ NPC_VAELASTRAZ
@ NPC_FLAMEGOR
@ NPC_NEFARIAN
void Update(uint32 time)
Definition EventMap.h:67
bool Empty() const
Definition EventMap.h:95
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void SetPhaseMask(uint32 newPhaseMask, bool update) override
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
virtual void OnCreatureCreate(Creature *creature) override
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
Creature * GetCreature(uint32 type)
virtual void OnGameObjectRemove(GameObject *go) override
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
virtual void OnGameObjectCreate(GameObject *go) override
void LoadDoorData(DoorData const *data)
bool _SkipCheckRequiredBosses(Player const *player=nullptr) const
void SetHeaders(std::string const &dataHeaders)
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:4430
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
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
Definition Unit.h:769
InstanceScript * GetInstanceScript(InstanceMap *map) const override
ObjectData const gameObjectData[]
Position const SummonPosition[8]
ObjectData const creatureData[]
uint32 const Entry[5]
DoorData const doorData[]
void AddSC_instance_blackwing_lair()
bool CheckRequiredBosses(uint32 bossId, Player const *player) const override