TrinityCore
zone_isle_of_queldanas.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 "ScriptedCreature.h"
20#include "ScriptedGossip.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "Player.h"
24#include "TemporarySummon.h"
25
27{
38
43 SAY_MORLEN_5 = 4
44};
45
47{
52};
53
55{
57};
58
60{
83 EVENT_KNEEL = 23
84};
85
87{
89
96
101
102uint8 const defenders = 10;
103float const defendersOrientation = 5.67232f;
105{
106 { 11934.78f, -7064.424f, 33.38046f },
107 { 11927.9f, -7061.303f, 32.00986f },
108 { 11927.81f, -7067.289f, 31.81058f },
109 { 11927.89f, -7058.299f, 32.13486f },
110 { 11927.9f, -7061.303f, 32.00986f },
111
112 { 11934.78f, -7064.424f, 33.38046f },
113 { 11920.69f, -7061.134f, 30.40684f },
114 { 11920.56f, -7067.133f, 30.41605f },
115 { 11920.76f, -7058.135f, 30.61656f },
116 { 11920.5f, -7070.132f, 30.40836f }
117};
118
119Position const thalorienSummon = { 11795.32f, -7070.476f, 26.27511f, 5.67232f };
120Position const thalorienFight = { 11788.46f, -7063.375f, 25.79677f, 3.054326f };
121Position const morlenSummon = { 11766.46f, -7050.078f, 26.19846f, 5.637414f };
122
124{
126 {
127 }
128
129 bool OnGossipSelect(Player* player, uint32 menuId, uint32 /*gossipListId*/) override
130 {
131 if (menuId == MENU_EXAMINE_REMAINS)
132 {
133 CloseGossipMenuFor(player);
135 _playerGUID = player->GetGUID();
136 }
137 return false;
138 }
139
140 void DoAction(int32 action) override
141 {
142 if (action == ACTION_START_QUEST)
143 {
145
147 _thalorienGUID = thalorien->GetGUID();
149
151 }
152 }
153
154 void Reset() override
155 {
161 _events.Reset();
162 }
163
165 {
167 thalorien->AI()->Talk(id);
168 }
169
171 {
173 morlen->AI()->Talk(id);
174 }
175
176 void UpdateAI(uint32 diff) override
177 {
178 _events.Update(diff);
179
180 while (uint32 eventId = _events.ExecuteEvent())
181 {
182 switch (eventId)
183 {
184 case EVENT_INTRO_0:
186
188 break;
189 case EVENT_INTRO_1:
191
193 break;
194 case EVENT_INTRO_2:
196
198 break;
199
200 case EVENT_INTRO_3:
202
204 break;
205 case EVENT_SALUTE:
206 for (auto& summon : _summons)
207 if (Creature* creature = ObjectAccessor::GetCreature(*me, summon))
208 creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
209
211 break;
213 {
216
217 uint8 defendersCount = 0;
218 for (auto& summon : _summons)
219 {
220 Creature* creature = ObjectAccessor::GetCreature(*me, summon);
221 if (!creature)
222 continue;
223
224 if (creature->GetEntry() != NPC_SUNWELL_DEFENDER)
225 continue;
226
227 defendersCount++;
228 if (defendersCount <= 5)
230 else
231 if (defendersCount - 1 < defenders)
232 creature->GetMotionMaster()->MovePoint(0, defendersRun[defendersCount - 1]);
233 }
234
235 break;
236 }
238 {
239 uint8 defendersCount = 0;
240 for (auto& summon : _summons)
241 {
242 Creature* creature = ObjectAccessor::GetCreature(*me, summon);
243 if (!creature)
244 continue;
245
246 if (creature->GetEntry() != NPC_SUNWELL_DEFENDER)
247 continue;
248
249 ++defendersCount;
250 if (defendersCount < defenders)
251 creature->GetMotionMaster()->MovePoint(0, defendersRun[defendersCount]);
252 }
253
254 break;
255 }
258 {
259 thalorien->SetWalk(true);
260 thalorien->GetMotionMaster()->MovePoint(0, thalorienFight);
261 thalorien->SetEmoteState(EMOTE_STATE_READY2H);
262 thalorien->SetHomePosition(thalorienFight);
263 }
264
266 break;
267 case EVENT_INTRO_4:
269
272 break;
273 case EVENT_INTRO_5:
275
277 break;
280 {
281 _morlenGUID = morlen->GetGUID();
282 morlen->AI()->DoCastSelf(SPELL_BLOOD_PRESENCE);
283 }
284
285 break;
286 case EVENT_MORLEN_1:
288
290 break;
293
295
297 break;
300
302
304 break;
307
309
311 break;
313 for (auto& summon : _summons)
314 {
315 Creature* creature = ObjectAccessor::GetCreature(*me, summon);
316 if (!creature)
317 continue;
318
319 if (creature->GetEntry() == NPC_THALORIEN_DAWNSEEKER ||
320 creature->GetEntry() == NPC_MORLEN_GOLDGRIP)
321 continue;
322
323 creature->SetImmuneToPC(false);
324 creature->SetImmuneToNPC(false);
326 creature->AI()->AttackStart(thalorien);
327 }
328
329 break;
330 case EVENT_MORLEN_2:
332
334 break;
337 {
338 morlen->SetImmuneToPC(false);
339 morlen->SetImmuneToNPC(false);
341 morlen->AI()->AttackStart(thalorien);
342 }
343
344 break;
345 case EVENT_OUTRO_1:
348 thalorien->AI()->DoCast(player, SPELL_KILL_CREDIT);
349
351
353 break;
354 case EVENT_OUTRO_2:
356
358 break;
359 case EVENT_OUTRO_3:
361 thalorien->AI()->DoCastSelf(SPELL_POLYMORPH_VISUAL);
362
364
366 break;
367 case EVENT_OUTRO_4:
369
371 break;
372 case EVENT_KNEEL:
374 {
375 thalorien->SetStandState(UNIT_STAND_STATE_KNEEL);
376 thalorien->DespawnOrUnsummon(5s);
377 }
378
380
381 break;
382 }
383 }
384 }
385
386 void JustSummoned(Creature* summon) override
387 {
388 _summons.Summon(summon);
389 }
390
391 void SummonedCreatureDespawn(Creature* summon) override
392 {
393 _summons.Despawn(summon);
394
395 if (_summons.size() == 2)
396 {
397 if (summon->GetEntry() == NPC_SCOURGE_ZOMBIE)
399 else if (summon->GetEntry() == NPC_GHOUL_INVADER)
401 else if (summon->GetEntry() == NPC_CRYPT_RAIDER)
403 }
404 else if (_summons.size() == 1)
405 {
406 if (summon->GetEntry() == NPC_MORLEN_GOLDGRIP)
408 }
409 }
410
411private:
417};
418
420{
422}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: ObjectDefines.h:67
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
void CloseGossipMenuFor(Player *player)
@ EMOTE_ONESHOT_SALUTE
@ EMOTE_STATE_READY2H
@ UNIT_STAND_STATE_KNEEL
Definition: UnitDefines.h:50
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void SetImmuneToPC(bool apply) override
Definition: Creature.h:170
void SetImmuneToNPC(bool apply) override
Definition: Creature.h:173
CreatureAI * AI() const
Definition: Creature.h:214
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
void Clear()
Definition: ObjectGuid.h:286
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void Despawn(Creature const *summon)
void Summon(Creature const *summon)
size_type size() const
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
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 SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition: Object.cpp:2131
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void UpdateAI(uint32 diff) override
bool OnGossipSelect(Player *player, uint32 menuId, uint32) override
npc_thalorien_dawnseeker(Creature *creature)
void SummonedCreatureDespawn(Creature *summon) override
void DoAction(int32 action) override
void JustSummoned(Creature *summon) override
void AddSC_isle_of_queldanas()
ThalorienDawnseekerActions
@ ACTION_START_QUEST
Position const defendersRun[]
Position const thalorienFight
Position const morlenSummon
ThalorienDawnseekerSummons
@ SUMMON_CRYPT_RAIDER
@ SUMMON_SUNWELL_DEFENDER
@ SUMMON_SCOURGE_ZOMBIE
@ SUMMON_GHOUL_INVADER
ThalorienDawnseekerEvents
@ EVENT_MORLEN_ATTACK
@ EVENT_THALORIEN_GO
@ EVENT_SPAWN_WAVE_2
@ EVENT_DEFENDERS_RUN
@ EVENT_SUMMON_MORLEN
@ EVENT_SPAWN_WAVE_3
@ EVENT_DEFENDERS_RUN_2
@ EVENT_SPAWN_WAVE_1
@ EVENT_WAVE_ATTACK
Position const thalorienSummon
@ SPELL_BLOOD_PRESENCE
@ NPC_THALORIEN_DAWNSEEKER
@ NPC_SCOURGE_ZOMBIE
@ SPELL_KILL_CREDIT
@ MENU_EXAMINE_REMAINS
@ NPC_MORLEN_GOLDGRIP
@ NPC_GHOUL_INVADER
@ NPC_CRYPT_RAIDER
@ NPC_SUNWELL_DEFENDER
@ SPELL_POLYMORPH_VISUAL
ThalorienDawnseekerTexts
@ SAY_THALORIEN_10
float const defendersOrientation
uint8 const defenders