TrinityCore
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
29{
39};
40
42{
52 { 0, 0 } // END
53};
54
56{
58 { 0, 0 } //END
59};
60
62{
63 { DATA_RAZORGORE_THE_UNTAMED, {{ 610 }} },
64 { DATA_VAELASTRAZ_THE_CORRUPT, {{ 611 }} },
65 { DATA_BROODLORD_LASHLAYER, {{ 612 }} },
66 { DATA_FIREMAW, {{ 613 }} },
67 { DATA_EBONROC, {{ 614 }} },
68 { DATA_FLAMEGOR, {{ 615 }} },
69 { DATA_CHROMAGGUS, {{ 616 }} },
70 { DATA_NEFARIAN, {{ 617 }} }
71};
72
74{
75 {-7661.207520f, -1043.268188f, 407.199554f, 6.280452f},
76 {-7644.145020f, -1065.628052f, 407.204956f, 0.501492f},
77 {-7624.260742f, -1095.196899f, 407.205017f, 0.544694f},
78 {-7608.501953f, -1116.077271f, 407.199921f, 0.816443f},
79 {-7531.841797f, -1063.765381f, 407.199615f, 2.874187f},
80 {-7547.319336f, -1040.971924f, 407.205078f, 3.789175f},
81 {-7568.547852f, -1013.112488f, 407.204926f, 3.773467f},
82 {-7584.175781f, -989.6691289f, 407.199585f, 4.527447f},
83};
84
85uint32 const Entry[5] = {12422, 12458, 12416, 12420, 12459};
86
88{
89public:
91
93 {
95 {
101
102 // Razorgore
103 EggCount = 0;
104 EggEvent = 0;
105 }
106
107 void OnCreatureCreate(Creature* creature) override
108 {
110
111 switch (creature->GetEntry())
112 {
118 if (CreatureAI* razorAI = razor->AI())
119 razorAI->JustSummoned(creature);
120 break;
121 default:
122 break;
123 }
124 }
125
127 {
129 return 0;
130 return entry;
131 }
132
134 {
136
137 switch(go->GetEntry())
138 {
140 EggList.push_back(go->GetGUID());
141 break;
142 default:
143 break;
144 }
145 }
146
148 {
150
151 if (go->GetEntry() == GO_BLACK_DRAGON_EGG)
152 EggList.remove(go->GetGUID());
153 }
154
155 bool CheckRequiredBosses(uint32 bossId, Player const* player /*= nullptr*/) const override
156 {
157 if (_SkipCheckRequiredBosses(player))
158 return true;
159
160 switch (bossId)
161 {
164 return false;
165 break;
166 case DATA_FIREMAW:
167 case DATA_EBONROC:
168 case DATA_FLAMEGOR:
170 return false;
171 break;
172 case DATA_CHROMAGGUS:
176 return false;
177 break;
178 default:
179 break;
180 }
181
182 return true;
183 }
184
185 bool SetBossState(uint32 type, EncounterState state) override
186 {
187 if (!InstanceScript::SetBossState(type, state))
188 return false;
189
190 switch (type)
191 {
193 if (state == DONE)
194 {
195 for (GuidList::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr)
196 if (GameObject* egg = instance->GetGameObject(*itr))
197 egg->SetLootState(GO_JUST_DEACTIVATED);
198 }
200 break;
201 case DATA_NEFARIAN:
202 switch (state)
203 {
204 case NOT_STARTED:
205 if (Creature* nefarian = GetCreature(DATA_NEFARIAN))
206 nefarian->DespawnOrUnsummon();
207 break;
208 case FAIL:
211 break;
212 default:
213 break;
214 }
215 break;
216 }
217 return true;
218 }
219
220 void SetData(uint32 type, uint32 data) override
221 {
222 if (type == DATA_EGG_EVENT)
223 {
224 switch (data)
225 {
226 case IN_PROGRESS:
228 EggEvent = data;
229 EggCount = 0;
230 break;
231 case NOT_STARTED:
233 EggEvent = data;
234 EggCount = 0;
235 break;
236 case SPECIAL:
237 if (++EggCount == 15)
238 {
240 {
242 razor->RemoveAurasDueToSpell(42013); // MindControl
243 DoRemoveAurasDueToSpellOnPlayers(42013, true, true);
244 }
247 }
248 if (EggEvent == NOT_STARTED)
250 break;
251 }
252 }
253 }
254
255 void OnUnitDeath(Unit* unit) override
256 {
260 }
261
262 void Update(uint32 diff) override
263 {
264 if (_events.Empty())
265 return;
266
267 _events.Update(diff);
268
269 while (uint32 eventId = _events.ExecuteEvent())
270 {
271 switch (eventId)
272 {
274 for (uint8 i = urand(2, 5); i > 0; --i)
275 if (Creature* summon = instance->SummonCreature(Entry[urand(0, 4)], SummonPosition[urand(0, 7)]))
276 summon->AI()->DoZoneInCombat();
278 break;
282 razor->AI()->DoAction(ACTION_PHASE_TWO);
283 break;
286 {
287 nefarius->setActive(true);
288 nefarius->SetFarVisible(true);
289 nefarius->Respawn();
290 nefarius->GetMotionMaster()->MoveTargetedHome();
291 }
292 break;
293 }
294 }
295 }
296
297 protected:
298 // Misc
300
301 // Razorgore
305 };
306
308 {
310 }
311};
312
314{
316}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:159
EncounterState
@ IN_PROGRESS
@ FAIL
@ DONE
@ SPECIAL
@ NOT_STARTED
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:394
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define DataHeader
uint32 const EncounterCount
@ NPC_NEFARIAN
@ EVENT_RAZOR_PHASE_TWO
@ EVENT_RAZOR_SPAWN
@ EVENT_RESPAWN_NEFARIUS
@ 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_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
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
bool Empty() const
Definition: EventMap.h:84
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
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)
void LoadDungeonEncounterData(T const &encounters)
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)
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty, SmoothPhasingInfo const *smoothPhasingInfo=nullptr)
Definition: Object.cpp:1836
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3489
uint64 LowType
Definition: ObjectGuid.h:278
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
Definition: Unit.h:627
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()
DungeonEncounterData const encounters[]
bool CheckRequiredBosses(uint32 bossId, Player const *player) const override
uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry) override