TrinityCore
Loading...
Searching...
No Matches
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
45
53
58
85
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
325 creature->AI()->AttackStart(thalorien);
326 }
327
328 break;
329 case EVENT_MORLEN_2:
331
333 break;
336 {
337 morlen->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
339 morlen->AI()->AttackStart(thalorien);
340 }
341
342 break;
343 case EVENT_OUTRO_1:
346 thalorien->AI()->DoCast(player, SPELL_KILL_CREDIT);
347
349
351 break;
352 case EVENT_OUTRO_2:
354
356 break;
357 case EVENT_OUTRO_3:
359 thalorien->AI()->DoCastSelf(SPELL_POLYMORPH_VISUAL);
360
362
364 break;
365 case EVENT_OUTRO_4:
367
369 break;
370 case EVENT_KNEEL:
372 {
373 thalorien->SetStandState(UNIT_STAND_STATE_KNEEL);
374 thalorien->DespawnOrUnsummon(5s);
375 }
376
378
379 break;
380 }
381 }
382 }
383
384 void JustSummoned(Creature* summon) override
385 {
386 _summons.Summon(summon);
387 }
388
389 void SummonedCreatureDespawn(Creature* summon) override
390 {
391 _summons.Despawn(summon);
392
393 if (_summons.size() == 2)
394 {
395 if (summon->GetEntry() == NPC_SCOURGE_ZOMBIE)
397 else if (summon->GetEntry() == NPC_GHOUL_INVADER)
399 else if (summon->GetEntry() == NPC_CRYPT_RAIDER)
401 }
402 else if (_summons.size() == 1)
403 {
404 if (summon->GetEntry() == NPC_MORLEN_GOLDGRIP)
406 }
407 }
408
409private:
415};
416
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_CORPSE_DESPAWN
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1139
void CloseGossipMenuFor(Player *player)
@ EMOTE_ONESHOT_SALUTE
@ EMOTE_STATE_READY2H
@ UNIT_STAND_STATE_KNEEL
Definition UnitDefines.h:42
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_FLAG_IMMUNE_TO_NPC
@ UNIT_FLAG_IMMUNE_TO_PC
Creature *const me
Definition CreatureAI.h:82
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void Clear()
Definition ObjectGuid.h:150
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void Despawn(Creature const *summon)
void Summon(Creature const *summon)
size_type size() const
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
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
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
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
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_DEFENDERS_RUN
@ EVENT_SUMMON_MORLEN
@ EVENT_DEFENDERS_RUN_2
Position const thalorienSummon
@ SPELL_BLOOD_PRESENCE
@ NPC_THALORIEN_DAWNSEEKER
@ MENU_EXAMINE_REMAINS
@ NPC_MORLEN_GOLDGRIP
@ NPC_SUNWELL_DEFENDER
@ SPELL_POLYMORPH_VISUAL
float const defendersOrientation
uint8 const defenders