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 "Containers.h"
21#include "GameObject.h"
22#include "InstanceScript.h"
23#include "Map.h"
24#include "MotionMaster.h"
25#include "Player.h"
26#include "ScriptedCreature.h"
27#include "TemporarySummon.h"
28
40
53
58
59static constexpr DungeonEncounterData encounters[] =
60{
61 { DATA_RAZORGORE_THE_UNTAMED, {{ 610 }} },
62 { DATA_VAELASTRAZ_THE_CORRUPT, {{ 611 }} },
63 { DATA_BROODLORD_LASHLAYER, {{ 612 }} },
64 { DATA_FIREMAW, {{ 613 }} },
65 { DATA_EBONROC, {{ 614 }} },
66 { DATA_FLAMEGOR, {{ 615 }} },
67 { DATA_CHROMAGGUS, {{ 616 }} },
68 { DATA_NEFARIAN, {{ 617 }} }
69};
70
71static constexpr Position SummonPosition[8] =
72{
73 { -7661.207520f, -1043.268188f, 407.199554f, 6.280452f },
74 { -7644.145020f, -1065.628052f, 407.204956f, 0.501492f },
75 { -7624.260742f, -1095.196899f, 407.205017f, 0.544694f },
76 { -7608.501953f, -1116.077271f, 407.199921f, 0.816443f },
77 { -7531.841797f, -1063.765381f, 407.199615f, 2.874187f },
78 { -7547.319336f, -1040.971924f, 407.205078f, 3.789175f },
79 { -7568.547852f, -1013.112488f, 407.204926f, 3.773467f },
80 { -7584.175781f, -989.6691289f, 407.199585f, 4.527447f },
81};
82
83static constexpr uint32 Entry[5] = {12422, 12458, 12416, 12420, 12459};
84
86{
87public:
89
91 {
104
105 void OnCreatureCreate(Creature* creature) override
106 {
108
109 switch (creature->GetEntry())
110 {
116 if (CreatureAI* razorAI = razor->AI())
117 razorAI->JustSummoned(creature);
118 break;
119 default:
120 break;
121 }
122 }
123
125 {
127 return 0;
128 return entry;
129 }
130
132 {
134
135 switch(go->GetEntry())
136 {
138 EggList.push_back(go->GetGUID());
139 break;
140 default:
141 break;
142 }
143 }
144
146 {
148
149 if (go->GetEntry() == GO_BLACK_DRAGON_EGG)
150 EggList.remove(go->GetGUID());
151 }
152
153 bool CheckRequiredBosses(uint32 bossId, Player const* player /*= nullptr*/) const override
154 {
155 if (_SkipCheckRequiredBosses(player))
156 return true;
157
158 switch (bossId)
159 {
162 return false;
163 break;
164 case DATA_FIREMAW:
165 case DATA_EBONROC:
166 case DATA_FLAMEGOR:
168 return false;
169 break;
170 case DATA_CHROMAGGUS:
174 return false;
175 break;
176 default:
177 break;
178 }
179
180 return true;
181 }
182
183 bool SetBossState(uint32 type, EncounterState state) override
184 {
185 if (!InstanceScript::SetBossState(type, state))
186 return false;
187
188 switch (type)
189 {
191 if (state == DONE)
192 {
193 for (GuidList::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr)
194 if (GameObject* egg = instance->GetGameObject(*itr))
195 egg->SetLootState(GO_JUST_DEACTIVATED);
196 }
198 break;
199 case DATA_NEFARIAN:
200 switch (state)
201 {
202 case NOT_STARTED:
203 if (Creature* nefarian = GetCreature(DATA_NEFARIAN))
204 nefarian->DespawnOrUnsummon();
205 break;
206 case FAIL:
209 break;
210 default:
211 break;
212 }
213 break;
214 }
215 return true;
216 }
217
218 void SetData(uint32 type, uint32 data) override
219 {
220 if (type == DATA_EGG_EVENT)
221 {
222 switch (data)
223 {
224 case IN_PROGRESS:
226 EggEvent = data;
227 EggCount = 0;
228 break;
229 case NOT_STARTED:
231 EggEvent = data;
232 EggCount = 0;
233 break;
234 case SPECIAL:
235 if (++EggCount == 15)
236 {
238 {
240 razor->RemoveAurasDueToSpell(42013); // MindControl
241 DoRemoveAurasDueToSpellOnPlayers(42013, true, true);
242 }
245 }
246 if (EggEvent == NOT_STARTED)
248 break;
249 }
250 }
251 }
252
259
260 void Update(uint32 diff) override
261 {
262 if (_events.Empty())
263 return;
264
265 _events.Update(diff);
266
267 while (uint32 eventId = _events.ExecuteEvent())
268 {
269 switch (eventId)
270 {
272 for (uint8 i = urand(2, 5); i > 0; --i)
274 summon->AI()->DoZoneInCombat();
276 break;
280 razor->AI()->DoAction(ACTION_PHASE_TWO);
281 break;
284 {
285 nefarius->setActive(true);
286 nefarius->SetFarVisible(true);
287 nefarius->Respawn();
288 nefarius->GetMotionMaster()->MoveTargetedHome();
289 }
290 break;
291 }
292 }
293 }
294
295 protected:
296 // Misc
298
299 // Razorgore
303 };
304
306 {
308 }
309};
310
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ GO_JUST_DEACTIVATED
Definition GameObject.h:159
EncounterState
@ IN_PROGRESS
@ FAIL
@ DONE
@ SPECIAL
@ NOT_STARTED
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:433
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
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
bool Empty() const
Definition EventMap.h:89
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void CancelEvent(uint32 eventId)
Definition EventMap.cpp:135
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
void LoadObjectData(std::span< ObjectData const > creatureData, std::span< ObjectData const > gameObjectData)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
EncounterState GetBossState(uint32 id) const
virtual void OnGameObjectCreate(GameObject *go) override
void LoadDoorData(std::span< DoorData const > data)
bool _SkipCheckRequiredBosses(Player const *player=nullptr) const
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:1186
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
uint64 LowType
Definition ObjectGuid.h:321
uint32 GetEntry() const
Definition Object.h:89
Definition Unit.h:635
InstanceScript * GetInstanceScript(InstanceMap *map) const override
static constexpr ObjectData creatureData[]
static constexpr Position SummonPosition[8]
static constexpr uint32 Entry[5]
static constexpr DoorData doorData[]
void AddSC_instance_blackwing_lair()
static constexpr ObjectData gameObjectData[]
static constexpr DungeonEncounterData encounters[]
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
bool CheckRequiredBosses(uint32 bossId, Player const *player) const override
uint32 GetGameObjectEntry(ObjectGuid::LowType, uint32 entry) override