Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_wandering_island.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "ScriptedGossip.h"
9#include "Player.h"
10#include "Spell.h"
11
12const Position balloonPos1 = { 915.123, 4564.1523, 231.37447 };
13const Position balloonPos2 = { 922.3584, 4567.7495, 234.48523 };
14const Position balloonPos3 = { 954.0022, 4578.619, 230.6169 };
15const Position balloonPos4 = { 1005.63586, 4599.781, 219.48938 };
16const Position balloonPos5 = { 1035.7178, 4621.3955, 205.60277 };
17const Position balloonPos6 = { 1056.7085, 4664.024, 186.15259 };
18const Position balloonPos7 = { 1079.8335, 4795.34, 157.87029 };
19const Position balloonPos8 = { 1091.337, 4865.452, 144.9579 };
20const Position balloonPos9 = { 1090.1652, 4928.4194, 138.01312 };
21const Position balloonPos10 = { 1062.7473, 5065.7837, 137.5515 };
22const Position balloonPos11 = { 992.0422, 5163.364, 137.56874 };
23const Position balloonPos12 = { 885.60614, 5206.965, 135.15846 };
24const Position balloonPos13 = { 779.9042, 5208.6396, 135.60544 };
25const Position balloonPos14 = { 736.7593, 5192.4, 137.05084 };
26const Position balloonPos15 = { 649.841, 5145.8667, 141.09795 };
27const Position balloonPos16 = { 623.2541, 5131.7183, 142.2216 };
28const Position balloonPos17 = { 560.43494, 5053.6377, 132.38977 };
29const Position balloonPos18 = { 485.70917, 4949.409, 125.14896 };
30const Position balloonPos19 = { 429.59842, 4820.912, 110.39427 };
31const Position balloonPos20 = { 305.63647, 4435.072, 79.58694 };
32const Position balloonPos21 = { 156.1306, 4266.2583, 116.03974 };
33const Position balloonPos22 = { 112.64921, 4032.78, 125.91718 };
34const Position balloonPos23 = { 203.35933, 3835.7214, 136.13402 };
35const Position balloonPos24 = { 395.93735, 3764.5327, 160.51057 };
36const Position balloonPos25 = { 744.496, 3664.6455, 193.9989 };
38{
68public:
69 npc_hot_air_balloon_vehicle() : CreatureScript("npc_hot_air_balloon_vehicle") { }
70
72 {
75
77 {
78 if (type != POINT_MOTION_TYPE)
79 return;
80
81 switch (id)
82 {
83 case 0:
84 {
85 events.ScheduleEvent(EVENT_BALOON_MOVE_POS_1, 1000);
86 break;
87 }
88 default:
89 break;
90 }
91 }
93 {
94 events.Update(diff);
95 while (uint32 eventId = events.ExecuteEvent())
96 {
97 switch (eventId)
98 {
100 {
101 me->GetMotionMaster()->MovePoint(1, balloonPos1);
102 events.ScheduleEvent(EVENT_BALLON_MOVE_POS_2, 1000);
103 break;
104 }
106 {
107 me->GetMotionMaster()->MovePoint(2, balloonPos2);
108 events.ScheduleEvent(EVENT_BALLON_AYSA_TALK_1, 2000);
109 break;
110 }
112 {
113 me->GetMotionMaster()->MovePoint(3, balloonPos3);
114 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
115 {
116 aysa->MonsterSay("...Ji, were in the Wood of Staves. You know where Master Shang is now.", Language::LANG_UNIVERSAL, aysa);
117 aysa->SendPlaySound(27431, true);
118 }
119 events.ScheduleEvent(EVENT_BALLON_JI_TALK_2, 8000);
120 break;
121 }
123 {
124 me->GetMotionMaster()->MovePoint(4, balloonPos4);
125 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
126 {
127 ji->MonsterSay("Bah, let a pandaren hope, would you? I'm going to miss the old man.", Language::LANG_UNIVERSAL, ji);
128 ji->SendPlaySound(27298, true);
129 }
130 events.ScheduleEvent(EVENT_BALLOON_AYSA_TALK_2, 12000);
131 break;
132 }
134 {
135 me->GetMotionMaster()->MovePoint(5, balloonPos5);
136 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
137 {
138 aysa->MonsterSay("Ji, be respectful when we speak to Shen-zin Su.", Language::LANG_UNIVERSAL, aysa);
139 aysa->SendPlaySound(27432, true);
140 }
141 events.ScheduleEvent(EVENT_BALLON_JI_TALK_3, 4000);
142 break;
143 }
145 {
146 me->GetMotionMaster()->MovePoint(6, balloonPos6);
147 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
148 {
149 ji->MonsterSay("When am I not respectful? You hurt me, Aysa.", Language::LANG_UNIVERSAL, ji);
150 ji->SendPlaySound(27299, true);
151 }
152
153 events.ScheduleEvent(EVENT_BALLOON_AYSA_TALK_3, 5000);
154 break;
155 }
157 {
158 me->GetMotionMaster()->MovePoint(7, balloonPos7);
159 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
160 {
161 aysa->MonsterSay("I might if you embarrass us.", Language::LANG_UNIVERSAL, aysa);
162 aysa->SendPlaySound(27433, true);
163 }
164
165 events.ScheduleEvent(EVENT_BALLOON_AYSA_YELL_1, 8000);
166 break;
167 }
169 {
170 me->GetMotionMaster()->MovePoint(8, balloonPos8);
171 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
172 {
173 aysa->MonsterYell("Shen-zin Su, we are the descendants of Liu Lang. We've sensed your pain, and we want to help.", Language::LANG_UNIVERSAL, aysa);
174 aysa->SendPlaySound(27434, true);
175 }
176 events.ScheduleEvent(EVENT_BALLOON_AYSA_YELL_2, 12000);
177 break;
178 }
180 {
181 me->GetMotionMaster()->MovePoint(9, balloonPos9);
182 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
183 {
184 aysa->MonsterYell("What ails you Shen-zin Su? What can we do?", Language::LANG_UNIVERSAL, aysa);
185 aysa->SendPlaySound(27435, true);
186 }
187 events.ScheduleEvent(EVENT_BALLOON_SHENZINSU_TALK_1, 7000);
188 break;
189 }
191 {
192 me->GetMotionMaster()->MovePoint(10, balloonPos10);
193 if (Creature* shenzinsu = me->FindNearestCreature(57769, 90.0f, true))
194 {
195 shenzinsu->MonsterSay("I am in pain, but it warms my heart that Liu Lang's grandchildren have not forgotten me.", Language::LANG_UNIVERSAL, shenzinsu);
196 shenzinsu->SendPlaySound(27435, true);
197 }
198 events.ScheduleEvent(EVENT_BALLOON_SHENZINSU_TALK_2, 15000);
199 break;
200 }
202 {
203 me->GetMotionMaster()->MovePoint(11, balloonPos11);
204 if (Creature* shenzinsu = me->FindNearestCreature(57769, 90.0f, true))
205 {
206 shenzinsu->MonsterSay("There is a thorn in my side. I cannot remove it.", Language::LANG_UNIVERSAL, shenzinsu);
207 shenzinsu->SendPlaySound(27823, true);
208 }
209 events.ScheduleEvent(EVENT_BALLOON_SHENZINSU_TALK_3, 14000);
210 break;
211 }
213 {
214 me->GetMotionMaster()->MovePoint(12, balloonPos12);
215 if (Creature* shenzinsu = me->FindNearestCreature(57769, 90.0f, true))
216 {
217 shenzinsu->MonsterSay("The pain is unbearable, and I can no longer swim straight.", Language::LANG_UNIVERSAL, shenzinsu);
218 shenzinsu->SendPlaySound(27824, true);
219 }
220 events.ScheduleEvent(EVENT_BALLOON_SHENZINSU_TALK_4, 15000);
221 break;
222 }
224 {
225 me->GetMotionMaster()->MovePoint(13, balloonPos13);
226 if (Creature* shenzinsu = me->FindNearestCreature(57769, 90.0f, true))
227 {
228 shenzinsu->MonsterSay("Please grandchildren, can you remove this thorn? I cannot do so on my own.", Language::LANG_UNIVERSAL, shenzinsu);
229 shenzinsu->SendPlaySound(27825, true);
230 }
231 events.ScheduleEvent(EVENT_BALLOON_AYSA_YELL_3, 15000);
232 break;
233 }
235 {
236 me->GetMotionMaster()->MovePoint(14, balloonPos14);
237 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
238 {
239 aysa->MonsterYell("Of course, Shen-zin Su! But your shell is large, and I do not know where this thorn could be.", Language::LANG_UNIVERSAL, aysa);
240 aysa->SendPlaySound(27436, true);
241 }
242 events.ScheduleEvent(EVENT_BALLOON_SHENZINSU_TALK_5, 7000);
243 break;
244 }
246 {
247 me->GetMotionMaster()->MovePoint(15, balloonPos15);
248 if (Creature* shenzinsu = me->FindNearestCreature(57769, 90.0f, true))
249 {
250 shenzinsu->MonsterSay("It is in the forest where your feet do not walk. Continue along the mountains and you will find it.", Language::LANG_UNIVERSAL, shenzinsu);
251 shenzinsu->SendPlaySound(27826, true);
252 }
253 events.ScheduleEvent(EVENT_BALLOON_AYSA_YELL_4, 18000);
254 break;
255 }
257 {
258 me->GetMotionMaster()->MovePoint(16, balloonPos16);
259 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
260 {
261 aysa->MonsterYell("We will find it, and we will remove it. You have our word!", Language::LANG_UNIVERSAL, aysa);
262 aysa->SendPlaySound(27437, true);
263 }
264 events.ScheduleEvent(EVENT_BALLOON_SHENZINSU_TALK_6, 8000);
265 break;
266 }
268 {
269 me->GetMotionMaster()->MovePoint(17, balloonPos17);
270 if (Creature* shenzinsu = me->FindNearestCreature(57769, 90.0f, true))
271 {
272 shenzinsu->MonsterSay("Thank you, grandchildren.", Language::LANG_UNIVERSAL, shenzinsu);
273 shenzinsu->SendPlaySound(27827, true);
274 }
275 events.ScheduleEvent(EVENT_BALLON_JI_TALK_4, 5000);
276 break;
277 }
279 {
280 me->SetSpeed(MOVE_RUN, 4.0f);
281 me->GetMotionMaster()->MovePoint(18, balloonPos18);
282 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
283 {
284 ji->MonsterSay("A thorn? And I left my tweezers at home.", Language::LANG_UNIVERSAL, ji);
285 ji->SendPlaySound(27300, true);
286 }
287 events.ScheduleEvent(EVENT_BALLON_JI_TALK_5, 7000);
288 break;
289 }
291 {
292 me->GetMotionMaster()->MovePoint(19, balloonPos19);
293 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
294 {
295 ji->MonsterSay("How could such a thing cause pain to something so large?", Language::LANG_UNIVERSAL, ji);
296 ji->SendPlaySound(27301, true);
297 }
298 events.ScheduleEvent(EVENT_BALLON_AYSA_TALK_4, 7000);
299 break;
300 }
302 {
303 me->GetMotionMaster()->MovePoint(20, balloonPos20);
304 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
305 {
306 aysa->MonsterSay("We'll know soon enough.", Language::LANG_UNIVERSAL, aysa);
307 aysa->SendPlaySound(27438, true);
308 }
309 events.ScheduleEvent(EVENT_BALLOON_JI_TALK_6, 14000);
310 break;
311 }
313 {
314 me->GetMotionMaster()->MovePoint(21, balloonPos21);
315 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
316 {
317 ji->MonsterSay("Are you seeing what I'm seeing?! Is that a boat?!", Language::LANG_UNIVERSAL, ji);
318 ji->SendPlaySound(27302, true);
319 }
320
321 events.ScheduleEvent(EVENT_BALLON_AYSA_TALK_5, 6000);
322 break;
323 }
325 {
326 me->GetMotionMaster()->MovePoint(22, balloonPos22);
327 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
328 {
329 aysa->MonsterSay("It is a boat... a whole airship! That's a bigger thorn than I was expecting.", Language::LANG_UNIVERSAL, aysa);
330 aysa->SendPlaySound(27439, true);
331 }
332
333 events.ScheduleEvent(EVENT_BALLOON_JI_TALK_7, 8000);
334 break;
335 }
337 {
338 me->GetMotionMaster()->MovePoint(23, balloonPos23);
339 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
340 {
341 ji->MonsterSay("And those aren't pandaren down there. They've got no fur.", Language::LANG_UNIVERSAL, ji);
342 ji->SendPlaySound(27303, true);
343 }
344 events.ScheduleEvent(EVENT_BALLON_AYSA_TALK_6, 7000);
345 break;
346 }
348 {
349 me->GetMotionMaster()->MovePoint(24, balloonPos24);
350 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
351 {
352 aysa->MonsterSay("Someone has crashed into our island. Removing this thorn may be more complicated than we thought.", Language::LANG_UNIVERSAL, aysa);
353 aysa->SendPlaySound(27440, true);
354 }
355
356 events.ScheduleEvent(EVENT_BALLON_AYSA_TALK_7, 8000);
357 break;
358 }
360 {
361 me->GetMotionMaster()->MovePoint(25, balloonPos25);
362 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
363 {
364 aysa->MonsterSay("We should let Elder Shaopai know and then plan our next move.", Language::LANG_UNIVERSAL, aysa);
365 aysa->SendPlaySound(27441, true);
366 }
367
368 events.ScheduleEvent(EVENT_BALLON_DESPAWN, 20000);
369 break;
370 }
372 {
373 std::list<Player*> playerList;
374 GetPlayerListInGrid(playerList, me, 15.0f);
375
376 for (auto&& player : playerList)
377 {
378 player->KilledMonsterCredit(56378);
379 player->KilledMonsterCredit(55939);
380 }
381
382 if (Creature* aysa = me->FindNearestCreature(56661, 15.0f, true))
383 {
384 aysa->DespawnOrUnsummon();
385 }
386 if (Creature* ji = me->FindNearestCreature(56663, 15.0f, true))
387 {
388 ji->DespawnOrUnsummon();
389 }
390 me->DespawnOrUnsummon();
391 break;
392 }
393 }
394 }
395 }
396 };
397
399 {
400 return new npc_hot_air_balloon_vehicleAI(creature);
401 }
402};
403
405{
406public:
407 npc_hot_air_balloon() : CreatureScript("npc_hot_air_balloon") { }
408
410 {
411 npc_hot_air_balloonAI(Creature* creature) : CreatureAI(creature) { }
412
413 void OnSpellClick(Unit* Clicker, bool& /*result*/) OVERRIDE
414 {
415 Player* player = Clicker->ToPlayer();
416 if (!player)
417 return;
418
419 if (Creature* vehicle = me->SummonCreature(55649, me->GetHomePosition(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 500000))
420 {
421 player->EnterVehicle(vehicle, 0);
422
423 if (Creature* ji = me->SummonCreature(56663, me->GetHomePosition(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 500000))
424 {
425 ji->EnterVehicle(vehicle, 1);
426 ji->MonsterSay("$n, where's Master Shang?", Language::LANG_UNIVERSAL, Clicker);
427 ji->SendPlaySound(27297, true);
428 }
429
430 if (Creature* aysa = me->SummonCreature(56661, me->GetHomePosition(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 500000))
431 aysa->EnterVehicle(vehicle, 2);
432
433
434 vehicle->GetMotionMaster()->MovePoint(0, me->GetHomePosition());
435 }
436 }
437 };
439 {
440 return new npc_hot_air_balloonAI(creature);
441 }
442};
443
444const Position masterShangXiWoodsPos1 = { 871.0573f, 4460.548f, 241.33667f };
445const Position masterShangXiWoodsPos2 = { 868.00696f, 4464.8384f, 241.60161f };
446const Position masterShangXiWoodsPos3 = { 869.67883f, 4467.752f, 241.66815f };
447const Position masterShangXiWoodsPos4 = { 872.2448f, 4467.272f, 241.60721f };
448const Position masterShangXiWoodsPos5 = { 872.7934f, 4465.126f, 241.33447f };
449const Position masterShangXiWoodsPos6 = { 874.205f, 4464.75f, 241.35117f };
451{
471public:
472 npc_master_shang_xi_wood_of_staves() : CreatureScript("npc_master_shang_xi_wood_of_staves") { }
473
474 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
475 {
476 if (quest->GetQuestId() == 29790) // Passing Wisdom
477 {
478 creature->SetWalk(true);
479 creature->GetMotionMaster()->MovePoint(0, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
480 return true;
481 }
482 return false;
483 }
484
486 {
489
491 {
492 if (type != POINT_MOTION_TYPE)
493 return;
494
495 switch (id)
496 {
497 case 0:
498 {
499 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_TALK1, 1000);
500 break;
501 }
502 default:
503 break;
504 }
505 }
506
508 {
509 events.Update(diff);
510 while (uint32 eventId = events.ExecuteEvent())
511 {
512 switch (eventId)
513 {
515 {
516 me->MonsterSay("For 3,000 years, we have passed the knowledge of our people down. Elder to youth. Master to student.", Language::LANG_UNIVERSAL, me);
517 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_TALK2, 10000);
518 break;
519 }
521 {
522 me->MonsterSay("Every elder reaches the day where he must pass on and plant his stave with the staves of his ancestors. Today is the day when my staff joins these woods.", Language::LANG_UNIVERSAL, me);
524 break;
525 }
527 {
528 me->GetMotionMaster()->MovePoint(1, masterShangXiWoodsPos1);
530 break;
531 }
532
534 {
535 me->SetFacingTo(-M_PI * 1.75);
536 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_TALK3, 8000);
537 break;
538 }
540 {
541 std::list<Player*> playerList;
542 GetPlayerListInGrid(playerList, me, 15.0f);
543
544 for (auto&& player : playerList)
545 {
546 me->MonsterSay("$p, our people have lived the wholes of their lives on this great turtle, Shen-zin Su, but not in hundreds of years has anyone spoken to him.", Language::LANG_UNIVERSAL, player);
547 }
549 break;
550 }
552 {
553 me->GetMotionMaster()->MovePoint(2, masterShangXiWoodsPos2);
555 break;
556 }
558 {
559 me->GetMotionMaster()->MovePoint(3, masterShangXiWoodsPos3);
561 break;
562 }
564 {
565 me->GetMotionMaster()->MovePoint(4, masterShangXiWoodsPos4);
567 break;
568 }
570 {
571 me->GetMotionMaster()->MovePoint(5, masterShangXiWoodsPos5);
572 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_TALK4, 1000);
573 break;
574 }
576 {
577 if (Creature* staff = me->SummonCreature(57874, 873.09375f, 4462.259765625f, 241.41162109375f, 3.804818391799926757f, TempSummonType::TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 70000))
578 me->SetFacingToObject(staff);
579 me->MonsterSay("Now Shen-zin Su is ill, and we are all in danger. With the help of the elements, you will break the silence. You will speak to him.", Language::LANG_UNIVERSAL, me);
581 break;
582 }
584 {
585 me->GetMotionMaster()->MovePoint(6, masterShangXiWoodsPos6);
586 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_TALK5, 2000);
587 break;
588 }
590 {
591 me->SetFacingTo(M_PI * 1.25);
592 me->MonsterSay("Aysa and Ji have retrieved the spirits and brought them here. You are to go with them, speak to the great Shen-zin Su, and do what must be done to save our people.", Language::LANG_UNIVERSAL, me);
593
594 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_TALK6, 5000);
595 break;
596 }
598 {
599 me->MonsterSay("You've come far, my young student. I see within you a great hero. I leave the fate of this land to you.", Language::LANG_UNIVERSAL, me);
600 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_KNEEL, 5000);
601 break;
602 }
604 {
605 me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
606 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_CREDIT, 2000);
607 break;
608 }
610 {
611 std::list<Player*> playerList;
612 GetPlayerListInGrid(playerList, me, 15.0f);
613
614 for (auto&& player : playerList)
615 {
616 player->KilledMonsterCredit(56688);
617 }
618 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_WOODS_RESET, 60000);
619 break;
620 }
622 {
623 me->GetMotionMaster()->MovePoint(7, me->GetHomePosition());
624 break;
625 }
626 default:
627 break;
628 }
629 }
630 }
631 };
632
634 {
635 return new npc_master_shang_xi_wood_of_stavesAI(creature);
636 }
637};
638
640{
641public:
642 npc_guardian_of_the_elders() : CreatureScript("npc_guardian_of_the_elders") { }
643
645 {
647
648 void JustDied(Unit* killer) OVERRIDE
649 {
650 if (GameObject* door = me->FindNearestGameObject(209922, 40.0f))
651 {
652 door->UseDoorOrButton(60000);
653
654 if (Creature* masterShangXi = me->FindNearestCreature(56159, 40.0f, true))
655 {
656 masterShangXi->SetWalk(false);
657 masterShangXi->GetMotionMaster()->MovePoint(10, masterShangXi->GetPositionX(), masterShangXi->GetPositionY(), masterShangXi->GetPositionZ());
658 }
659 }
660 }
661 void UpdateAI(uint32 /*diff*/) OVERRIDE
662 {
664 }
665 };
666
668 {
669 return new npc_guardian_of_the_eldersAI(creature);
670 }
671};
672
673const Position masterShangXiWorthyPos1 = { 776.52606f, 4178.652f, 206.94368f };
674const Position masterShangXiWorthyPos2 = { 792.8524f, 4185.137f, 208.41711f };
675const Position masterShangXiWorthyPos3 = { 827.27637f, 4205.244f, 199.61674f };
676const Position masterShangXiWorthyPos4 = { 839.7535f, 4215.7915f, 197.77382f };
677const Position masterShangXiWorthyPos5 = { 845.00696f, 4267.5884f, 196.7384f };
678const Position masterShangXiWorthyPos6 = { 843.81946f, 4301.1743f, 210.9836f };
679const Position masterShangXiWorthyPos7 = { 843.26215f, 4339.1035f, 223.98082f };
680const Position masterShangXiWorthyPos8 = { 828.6528f, 4353.315f, 223.98082f };
681const Position masterShangXiWorthyPos9 = { 830.25867f, 4368.5503f, 223.94623f };
682const Position masterShangXiWorthyPos10 = { 845.59398f, 4372.6298f, 224.06399f };
683const Position masterShangXiWorthyPos11 = { 844.69406f, 4401.2700f, 237.26740f };
684const Position masterShangXiWorthyEndPos = { 874.10767f, 4459.6313f, 241.18892f };
686{
687public:
688 npc_master_shang_xi_worthy_questgiver() : CreatureScript("npc_master_shang_xi_worthy_questgiver") { }
689
690 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
691 {
692 if (quest->GetQuestId() == 29787) // Worthy of Passing
693 {
694 if (Creature* masterShangXi = creature->SummonCreature(56159, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN))
695 {
696 masterShangXi->GetMotionMaster()->MovePoint(0, masterShangXi->GetPositionX(), masterShangXi->GetPositionY(), masterShangXi->GetPositionZ());
697 }
698
699 return true;
700 }
701 return false;
702 }
703
708
710 {
711 return new npc_master_shang_xi_worthy_questgiverAI(creature);
712 }
713};
715{
716public:
717 npc_master_shang_xi_worthy_of_passing() : CreatureScript("npc_master_shang_xi_worthy_of_passing") { }
718
737
739 {
743 {
744 if (type != POINT_MOTION_TYPE)
745 return;
746
747 switch (id)
748 {
749 case 0:
750 {
751 events.ScheduleEvent(EVENT_WORTHY_TALK1, 5000);
752 break;
753 }
754 case 10:
755 {
756 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS9, 1000);
757 break;
758 }
759 default:
760 break;
761 }
762 }
764 {
765 events.Update(diff);
766 while (uint32 eventId = events.ExecuteEvent())
767 {
768 switch (eventId)
769 {
771 {
772 me->MonsterSay("Come child. We have one final journey to take together before your training is complete.", Language::LANG_UNIVERSAL, me);
773 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS1, 5000);
774 break;
775 }
777 {
778 me->GetMotionMaster()->MovePoint(1, masterShangXiWorthyPos1);
779 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS2, 5000);
780 break;
781 }
783 {
784 me->GetMotionMaster()->MovePoint(2, masterShangXiWorthyPos2);
785 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS3, 5000);
786 break;
787 }
789 {
790 me->GetMotionMaster()->MovePoint(3, masterShangXiWorthyPos3);
791 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS4, 5000);
792 break;
793 }
795 {
796 me->GetMotionMaster()->MovePoint(4, masterShangXiWorthyPos4);
797 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS5, 5000);
798 break;
799 }
801 {
802 me->GetMotionMaster()->MovePoint(5, masterShangXiWorthyPos5);
803 events.ScheduleEvent(EVENT_WORTHY_TALK2, 5000);
804 break;
805 }
807 {
808 me->SetWalk(true);
809 me->MonsterSay("Beyond the Elders' Path lies the Wood of Staves, a sacred place that only the worthy may enter.", Language::LANG_UNIVERSAL, me);
810 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS6, 5000);
811 break;
812 }
814 {
815 me->GetMotionMaster()->MovePoint(6, masterShangXiWorthyPos6);
816 events.ScheduleEvent(EVENT_WORTHY_TALK3, 15000);
817 break;
818 }
820 {
821 me->MonsterSay("Of the many ways to prove your worth, I require the simplest of you now. I must know that you will fight for our people. I must know that you can keep them safe.", Language::LANG_UNIVERSAL, me);
822 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS7, 10000);
823 break;
824 }
826 {
827 me->GetMotionMaster()->MovePoint(7, masterShangXiWorthyPos7);
828 events.ScheduleEvent(EVENT_WORTHY_TALK4, 20000);
829 break;
830 }
832 {
833 me->MonsterSay("Defeat the Guardian of the Elders, and we may pass.", Language::LANG_UNIVERSAL, me);
834 me->GetMotionMaster()->MovePoint(8, masterShangXiWorthyPos8);
835 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS8, 5000);
836 break;
837 }
839 {
840 me->GetMotionMaster()->MovePoint(9, masterShangXiWorthyPos9);
841 break;
842 }
843
845 {
846 me->MonsterSay("You've become strong indeed, child. This is good. You will need that strength soon.", Language::LANG_UNIVERSAL, me);
847 me->GetMotionMaster()->MovePoint(11, masterShangXiWorthyPos10);
848 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS10, 3000);
849 break;
850 }
851
853 {
854 me->GetMotionMaster()->MovePoint(12, masterShangXiWorthyPos11);
855 events.ScheduleEvent(EVENT_WORTHY_MOVE_POS11, 5000);
856 break;
857 }
859 {
860 me->GetMotionMaster()->MovePoint(13, masterShangXiWorthyEndPos);
861 me->DespawnOrUnsummon(10000);
862 break;
863 }
864 default:
865 break;
866 }
867 }
868 }
869 };
870
872 {
873 return new npc_master_shang_xi_worthy_of_passingAI(creature);
874 }
875};
876
878{
879public:
880 npc_firework_launcher() : CreatureScript("npc_firework_launcher") { }
881
883 {
884 npc_firework_launcherAI(Creature* creature) : ScriptedAI(creature) { }
885
887
889 {
890 cooldown = 0;
892 }
893
894 void OnSpellClick(Unit* Clicker, bool& /*result*/) OVERRIDE
895 {
896 if (cooldown)
897 return;
898
899 Creature* const zhao = GetClosestCreatureWithEntry(me, 55786, 50.0f);
900
901 if (zhao && zhao->IsWithinDist2d(Clicker, 25.0f))
902 zhao->CastSpell(zhao, 104855, false);
903 else
904 {
905 return;
906 }
907
908 cooldown = 5000;
910 }
911
912 void EnterCombat(Unit* /*who*/) OVERRIDE
913 {
914 return;
915 }
916
918 {
919 if (cooldown)
920 {
921 if (cooldown <= diff)
922 {
924 cooldown = 0;
925 }
926 else
927 cooldown -= diff;
928 }
929 }
930 };
931
933 {
934 return new npc_firework_launcherAI(creature);
935 }
936};
937
938static Position const ZhaoPos[] =
939{
940 {719.36f, 4164.60f, 216.06f },
941 {736.90f, 4183.85f, 221.41f },
942 {704.77f, 4190.16f, 218.24f },
943 {684.53f, 4173.24f, 216.98f },
944 {689.62f, 4153.16f, 217.63f },
945 {717.04f, 4141.16f, 219.83f },
946 {745.91f, 4154.35f, 223.48f }
947};
948
949const Position zhaoStunPos = { 723.163025f, 4163.799805f, 202.082993f };
950
952{
959public:
960 boss_zhao_ren() : CreatureScript("boss_zhao_ren") { }
961
963 {
968 boss_zhao_renAI(Creature* creature) : CreatureAI(creature) { }
969
971 {
972 events.Reset();
973 me->SetReactState(REACT_PASSIVE);
974 me->SetDisableGravity(true);
975 encounterStarted = false;
976 fireworkHits = 0;
977 currentPos = 0;
978 me->SetFullHealth();
979 me->GetMotionMaster()->Clear();
980 me->GetMotionMaster()->MovePoint(0, ZhaoPos[0].GetPositionX(), ZhaoPos[0].GetPositionY(), ZhaoPos[0].GetPositionZ());
981 }
982
983 void JustDied(Unit* /*killer*/) OVERRIDE
984 {
985 std::list<Player*> playerList;
986 GetPlayerListInGrid(playerList, me, 60.0f);
987
988 for (auto player : playerList)
989 {
990 player->KilledMonsterCredit(me->GetEntry());
991 player->CastSpell(player, 60922);
992 player->SetPhased(169, true, true);
993 player->SetPhased(524, true, false);
994 }
995 }
996
998 {
999 if (type != POINT_MOTION_TYPE)
1000 return;
1001
1002 if (!pointId)
1003 return;
1004
1005 if (pointId == 100)
1006 {
1007 me->CastSpell(me, 125992, true);
1008 events.RescheduleEvent(EVENT_LIGHTNING, 17000);
1009 events.ScheduleEvent(EVENT_STUNNED, 12000);
1010 }
1011 else
1012 events.ScheduleEvent(EVENT_MOVE_POSITION, 1000);
1013 }
1014
1016 {
1017 if (checkParticipants())
1018 {
1019 if (!encounterStarted) // Event not started, player found
1020 {
1021 events.ScheduleEvent(EVENT_MOVE_POSITION, 1000);
1022 events.ScheduleEvent(EVENT_LIGHTNING, 5000);
1023 encounterStarted = true;
1024 }
1025 }
1026 else
1027 {
1028 if (encounterStarted) // Event started, no player found
1029 Reset();
1030
1031 return;
1032 }
1033
1034 events.Update(diff);
1035
1036 switch (events.ExecuteEvent())
1037 {
1039 {
1040 if (me->HasAura(125992))
1041 events.ScheduleEvent(EVENT_MOVE_POSITION, 2000);
1042
1044 break;
1045 }
1046 case EVENT_STUNNED:
1047 {
1048 me->RemoveAurasDueToSpell(125992);
1049 me->CastSpell(me, 125990, false);
1050 me->SetDisableGravity(true);
1051 events.ScheduleEvent(EVENT_MOVE_POSITION, 4000);
1052 break;
1053 }
1054 case EVENT_LIGHTNING:
1055 {
1056 if (Player* player = GetRandomPlayer())
1057 me->CastSpell(player, 126006, false);
1058
1059 events.ScheduleEvent(EVENT_LIGHTNING, 5000);
1060 break;
1061 }
1062 }
1063 }
1064
1065 void SpellHit(Unit* /*caster*/, const SpellInfo* spell) OVERRIDE
1066 {
1067 if (spell->Id == 104855)
1068 {
1069 if (++fireworkHits >= 5)
1070 {
1071 me->GetMotionMaster()->Clear();
1072 me->GetMotionMaster()->MovePoint(100, zhaoStunPos);
1073 fireworkHits = 0;
1074 }
1075 }
1076 }
1077
1079 {
1080 if (++currentPos > 6)
1081 currentPos = 1;
1082
1083 me->GetMotionMaster()->MovePoint(currentPos, ZhaoPos[currentPos].GetPositionX(), ZhaoPos[currentPos].GetPositionY(), ZhaoPos[currentPos].GetPositionZ());
1084 }
1085
1087 {
1088 std::list<Player*> playerList;
1089 GetPlayerListInGrid(playerList, me, 45.0f);
1090
1091 if (playerList.empty())
1092 return NULL;
1093
1095
1096 return *playerList.begin();
1097 }
1099 {
1100 std::list<Player*> playerList;
1101 GetPlayerListInGrid(playerList, me, 60.0f);
1102
1103 for (auto player : playerList)
1104 if (player->GetQuestStatus(29786) == QUEST_STATUS_INCOMPLETE)
1105 if (player->IsAlive())
1106 return true;
1107
1108 return false;
1109 }
1110 };
1111
1112
1114 {
1115 return new boss_zhao_renAI(creature);
1116 }
1117};
1118
1119const Position aysaChamberMovePos1 = { 647.493f, 4224.63f, 202.90865f, 2.426f };
1121{
1122public:
1123 npc_aysa_in_wind_temple() : CreatureScript("npc_aysa_in_wind_temple") { }
1124
1125 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
1126 {
1127 if (quest->GetQuestId() == 29786) // Battle for the skies
1128 {
1129 player->SetPhased(524, true, true);
1130 creature->SetPhased(524, true, true);
1131 creature->GetMotionMaster()->MovePoint(0, aysaChamberMovePos1);
1132 creature->DespawnOrUnsummon(10000);
1133 }
1134 return true;
1135 }
1137 {
1139 };
1141 {
1142 return new npc_aysa_in_wind_templeAI(creature);
1143 }
1144};
1145
1146const Position aysaChamberMovePos2 = { 598.57294f, 4266.661f, 206.54927f };
1147const Position aysaChamberMovePos3 = { 580.1649f, 4283.193f, 210.18248f };
1148const Position aysaChamberMoveEnd = { 543.9549, 4317.2744, 212.22935 };
1150{
1151public:
1152 npc_aysa_chamber_of_whispers() : CreatureScript("npc_aysa_chamber_of_whispers") { }
1153
1155 {
1168 {
1169 creature->MonsterSay("Wait!", Language::LANG_UNIVERSAL, creature);
1170 events.ScheduleEvent(EVENT_INTRO, 1000);
1171 }
1173 {
1174 events.Update(diff);
1175
1176 switch (events.ExecuteEvent())
1177 {
1178 case EVENT_INTRO:
1179 {
1180 me->MonsterSay("We need to wait for the winds to settle, then make a break for the cover of the far hallway.", Language::LANG_UNIVERSAL, me);
1181 me->GetMotionMaster()->MovePoint(0, aysaChamberMovePos1);
1182 events.ScheduleEvent(EVENT_DEACTIVATE_1, 2000);
1183 break;
1184 }
1185 case EVENT_DEACTIVATE_1:
1186 {
1187 if (GameObject* cloud1 = me->FindNearestGameObject(209685, 30.0f))
1188 {
1189 cloud1->UseDoorOrButton(60000);
1190 }
1191 events.ScheduleEvent(EVENT_MOVE_POS_MID, 5000);
1192 break;
1193 }
1194 case EVENT_MOVE_POS_MID:
1195 {
1196 me->GetMotionMaster()->MovePoint(1, aysaChamberMovePos2);
1197 events.ScheduleEvent(EVENT_MOVE_POS_3, 10000);
1198 break;
1199 }
1200 case EVENT_MOVE_POS_3:
1201 {
1202 me->MonsterSay("Wait for another opening. I'll meet you on the far side.", Language::LANG_UNIVERSAL, me);
1203 events.ScheduleEvent(EVENT_DEACTIVATE_2, 2000);
1204 break;
1205 }
1206 case EVENT_DEACTIVATE_2:
1207 {
1208 me->GetMotionMaster()->MovePoint(2, aysaChamberMovePos3);
1209 std::list<GameObject*> clouds;
1210 me->GetGameObjectListWithEntryInGrid(clouds, 209685, 60.0f);
1211 if (!clouds.empty())
1212 {
1213 for (std::list<GameObject*>::iterator itr = clouds.begin(); itr != clouds.end(); ++itr)
1214 {
1215 if ((*itr)->GetGUIDLow() == 88728)
1216 {
1217 if (GameObject* cloud2 = (*itr))
1218 cloud2->UseDoorOrButton(60000);
1219 }
1220 }
1221 }
1222 events.ScheduleEvent(EVENT_MOVE_POS_END, 1000);
1223 break;
1224 }
1225 case EVENT_MOVE_POS_END:
1226 {
1227 me->GetMotionMaster()->MovePoint(3, aysaChamberMoveEnd);
1228 events.ScheduleEvent(EVENT_OUTRO, 10000);
1229 break;
1230 }
1231 case EVENT_OUTRO:
1232 {
1233 me->MonsterSay("Dafeng! What's wrong? Why are you hiding back here?", Language::LANG_UNIVERSAL, me);
1234 std::list<Player*> playerList;
1235 GetPlayerListInGrid(playerList, me, 45.0f);
1236
1237 for (auto&& player : playerList)
1238 {
1239 player->KilledMonsterCredit(55666);
1240 }
1241 me->DespawnOrUnsummon();
1242 break;
1243 }
1244 }
1245 }
1246 };
1248 {
1249 return new npc_aysa_chamber_of_whispersAI(creature);
1250 }
1251};
1252
1253
1254const Position shuPos1 = { 650.30f, 3127.16f, 89.62f };
1255const Position shuPos2 = { 625.25f, 3127.88f, 87.95f };
1256const Position shuPos3 = { 624.44f, 3142.94f, 87.75f };
1258{
1259public:
1260 npc_shu_dailo() : CreatureScript("npc_shu_dailo") { }
1261
1270
1271
1272 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
1273 {
1274 if (creature->IsQuestGiver())
1275 player->PrepareQuestMenu(creature->GetGUID());
1276
1277 if (player->GetQuestStatus(29774) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(29774) == QUEST_STATUS_REWARDED)
1278 player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Can you please help us to wake up Wugou ?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
1279
1280 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
1281
1282 return true;
1283 }
1284
1285 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
1286 {
1287 player->PlayerTalkClass->ClearMenus();
1288 if (action == GOSSIP_ACTION_INFO_DEF + 1)
1289 {
1290 player->CLOSE_GOSSIP_MENU();
1291 player->KilledMonsterCredit(55548);
1292
1293 creature->GetMotionMaster()->MovePoint(0, shuPos1);
1294 }
1295 return true;
1296 }
1297
1299 {
1301
1302 npc_shu_dailoAI(Creature* creature) : CreatureAI(creature) { }
1303
1305 {
1306 if (type != POINT_MOTION_TYPE)
1307 return;
1308
1309 switch (id)
1310 {
1311 case 0:
1312 {
1313 events.ScheduleEvent(EVENT_MOVE_POS1, 1000);
1314 break;
1315 }
1316 default:
1317 break;
1318 }
1319 }
1320
1322 {
1323 events.Update(diff);
1324
1325 switch (events.ExecuteEvent())
1326 {
1327 case EVENT_MOVE_POS1:
1328 {
1329 me->GetMotionMaster()->MovePoint(1, shuPos1);
1330 events.ScheduleEvent(EVENT_MOVE_POS2, 500);
1331 break;
1332 }
1333 case EVENT_MOVE_POS2:
1334 {
1335 me->GetMotionMaster()->MovePoint(2, shuPos2);
1336 events.ScheduleEvent(EVENT_MOVE_POS3, 4000);
1337 break;
1338 }
1339 case EVENT_MOVE_POS3:
1340 {
1341 me->GetMotionMaster()->MovePoint(3, shuPos3);
1342 events.ScheduleEvent(EVENT_CAST, 3000);
1343 break;
1344 }
1345 case EVENT_CAST:
1346 {
1347 if (Creature* wugou = me->FindNearestCreature(55539, 15.0f, true))
1348 {
1349 wugou->CastSpell(wugou, 118027);
1350 me->SetFacingToObject(wugou);
1351 events.ScheduleEvent(EVENT_GIVE_CREDIT, 5000);
1352 }
1353 break;
1354 }
1355 case EVENT_GIVE_CREDIT:
1356 {
1357 if (Creature* wugou = me->FindNearestCreature(55539, 15.0f, true))
1358 {
1359 std::list<Player*> playerList;
1360 GetPlayerListInGrid(playerList, wugou, 15.0f);
1361
1362 for (auto&& player : playerList)
1363 {
1364 player->KilledMonsterCredit(55547);
1365
1366 if (Creature* wugouCopy = player->SummonCreature(55539, wugou->GetHomePosition(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN))
1367 {
1368 wugouCopy->SetOwnerGUID(player->GetGUID());
1369 wugouCopy->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
1370 }
1371
1372 if (Creature* shuCopy = player->SummonCreature(55558, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TempSummonType::TEMPSUMMON_MANUAL_DESPAWN))
1373 {
1374 shuCopy->SetOwnerGUID(player->GetGUID());
1375 shuCopy->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, -PET_FOLLOW_ANGLE);
1376 }
1377 }
1378 wugou->DespawnOrUnsummon();
1379 me->DespawnOrUnsummon();
1380 }
1381 }
1382 default:
1383 break;
1384 }
1385 }
1386 };
1387
1389 {
1390 return new npc_shu_dailoAI(creature);
1391 }
1392};
1393
1394const Position shuJumpPos1 { 1102.05f, 2882.11f, 94.32f, 0.11f };
1395const Position shuJumpPos2 { 1120.01f, 2883.20f, 96.44f, 4.17f };
1396const Position shuJumpPos3 { 1128.09f, 2859.44f, 97.64f, 2.51f };
1397const Position shuJumpPos4 { 1111.52f, 2849.84f, 94.84f, 1.94f };
1398
1400{
1401public:
1402 npc_shu_pool_of_reflection() : CreatureScript("npc_shu_pool_of_reflection") { }
1403
1405 {
1417 std::vector<Player*> players;
1418
1420
1422 {
1423 events.Reset();
1425 waterSpoutGUID = 0;
1426 running = false;
1427 }
1428
1430 {
1431 players.clear();
1432
1433 std::list<Player*> PlayerList;
1434 me->GetPlayerListInGrid(PlayerList, 20.0f);
1435
1436 for (auto&& player : PlayerList)
1437 if (!player->IsGameMaster() && player->GetQuestStatus(29679) == QUEST_STATUS_INCOMPLETE)
1438 players.push_back(player);
1439 }
1440
1442 {
1443 Player* const player = who->ToPlayer();
1444 if (!player)
1445 return;
1446
1447 if (player->GetQuestStatus(29679) != QUEST_STATUS_INCOMPLETE || running)
1448 return;
1449
1450 if (me->GetAreaId() == 5862) // Pool of Reflection Area
1451 {
1453 if (!players.empty())
1454 {
1455 running = true;
1456 events.ScheduleEvent(EVENT_ROTATE_POSITION, 5000);
1457 }
1458 }
1459 }
1461 {
1462 if (type != POINT_MOTION_TYPE)
1463 return;
1464
1465 switch (id)
1466 {
1467 case 0:
1468 if (running)
1469 {
1470 events.ScheduleEvent(EVENT_ROTATE_POSITION, 5000);
1471 }
1472 return;
1473 default:
1474 break;
1475 }
1476 }
1478 {
1479 events.Update(diff);
1480
1481 switch (events.ExecuteEvent())
1482 {
1484 {
1485 uint8 newPlace = 0;
1486
1487 newPlace = std::rand() % 3;
1488
1489 switch (newPlace)
1490 {
1491 case 0:
1492 {
1493 me->GetMotionMaster()->MoveJump(shuJumpPos1, 10.0f, 10.0f, 1);
1494 break;
1495 }
1496 case 1:
1497 {
1498 me->GetMotionMaster()->MoveJump(shuJumpPos2, 10.0f, 10.0f, 1);
1499 break;
1500 }
1501 case 2:
1502 {
1503 me->GetMotionMaster()->MoveJump(shuJumpPos3, 10.0f, 10.0f, 1);
1504 break;
1505 }
1506 case 3:
1507 {
1508 me->GetMotionMaster()->MoveJump(shuJumpPos4, 10.0f, 10.0f, 1);
1509 break;
1510 }
1511 default:
1512 break;
1513 }
1514
1515 events.ScheduleEvent(EVENT_SUMMON_WATER_SPOUT, 2000);
1516 me->AddAura(116695, me);
1517 stationaryPosition = newPlace;
1518 break;
1519 }
1521 {
1522 float x = 0.0f, y = 0.0f;
1523 GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation() + frand(-M_PI, M_PI), x, y);
1524
1525 if (Creature* waterSpout = me->SummonCreature(60488, x, y, 92.189629f))
1526 {
1527 waterSpoutGUID = waterSpout->GetGUID();
1528 waterSpout->CastSpell(waterSpout, 116695, true);
1529 }
1530
1531 events.ScheduleEvent(EVENT_WATER_SPOUT_BURST, 7000);
1532
1533 break;
1534 }
1536 {
1537 if (Creature* waterSpout = me->GetMap()->GetCreature(waterSpoutGUID))
1538 {
1539 std::list<Player*> playerList;
1540 GetPlayerListInGrid(playerList, waterSpout, 1.0f);
1541
1542 for (auto&& player : playerList)
1543 player->CastSpell(player, 116696, true);
1544
1545 waterSpout->CastSpell(waterSpout, 117057, true);
1546 }
1547 events.ScheduleEvent(EVENT_WATER_SPOUT_DESPAWN, 3000);
1548 break;
1549 }
1551 {
1552 if (Creature* waterSpout = me->GetMap()->GetCreature(waterSpoutGUID))
1553 waterSpout->DespawnOrUnsummon();
1554
1556 if (players.empty())
1557 {
1558 if (Creature* aysa = me->FindNearestCreature(54975, 60.0f, true))
1559 {
1560 std::list<Player*> playerList;
1561 GetPlayerListInGrid(playerList, aysa, 60.0f);
1562
1563 for (auto&& player : playerList)
1564 {
1565 if (player->GetQuestStatus(29679) == QUEST_STATUS_COMPLETE)
1566 {
1567 if (!player->GetAura(128588)) // Aysa gz trigger aura
1568 {
1569 player->CastSpell(player, 128588);
1570 aysa->AI()->Talk(0);
1571 }
1572 }
1573 }
1574 }
1575 running = false;
1576 events.CancelEvent(EVENT_ROTATE_POSITION);
1577 events.CancelEvent(EVENT_SUMMON_WATER_SPOUT);
1578 events.CancelEvent(EVENT_WATER_SPOUT_BURST);
1579 }
1580 else
1581 {
1583 running = true;
1584 events.ScheduleEvent(EVENT_ROTATE_POSITION, 5000);
1585 }
1586 break;
1587 }
1588 }
1589 }
1590 };
1592 {
1593 return new npc_shu_pool_of_reflectionAI(creature);
1594 }
1595};
1596
1597const Position tornadoPos1 = { 922.9829f, 3602.6472f, 198.44557f };
1598const Position tornadoPos2 = { 958.7378f, 3610.3413f, 209.64407f };
1599const Position tornadoPos3 = { 934.45074f, 3609.4578f, 240.62868f };
1600const Position tornadoEndPos = { 920.4496f, 3604.7705f, 253.17314f };
1602{
1603public:
1604 npc_uplift_draft() : CreatureScript("npc_uplift_draft") { }
1605
1607 {
1617 {
1618 events.ScheduleEvent(EVENT_MOVE_POS1, 1000);
1619 }
1620
1622 {
1623 events.Update(diff);
1624
1625 while (uint32 eventId = events.ExecuteEvent())
1626 {
1627 switch (eventId)
1628 {
1629 case EVENT_MOVE_POS1:
1630 {
1631 me->GetMotionMaster()->MovePoint(0, tornadoPos1);
1632 events.ScheduleEvent(EVENT_MOVE_POS2, 1000);
1633 break;
1634 }
1635 case EVENT_MOVE_POS2:
1636 {
1637 me->GetMotionMaster()->MovePoint(1, tornadoPos2);
1638 events.ScheduleEvent(EVENT_MOVE_POS3, 5000);
1639 break;
1640 }
1641 case EVENT_MOVE_POS3:
1642 {
1643 me->GetMotionMaster()->MovePoint(2, tornadoPos3);
1644 events.ScheduleEvent(EVENT_MOVE_END_POS, 5000);
1645 break;
1646 }
1647 case EVENT_MOVE_END_POS:
1648 {
1649 me->GetMotionMaster()->MovePoint(4, tornadoEndPos);
1650 break;
1651 }
1652 }
1653 }
1654 }
1655 };
1657 {
1658 return new npc_uplift_draftAI(creature);
1659 }
1660};
1661
1662#define MASTER_SHANG_XI_TEXT_1 "You have conquered every challenge I put before you, $n. You have found Huo and brought him safely to the temple."
1663#define MASTER_SHANG_XI_TEXT_2 "There is a much larger problem we face now, my students. Shen-zin Su is in pain. If we do not act the very land on which we stand could die, and all of us with it."
1664#define MASTER_SHANG_XI_TEXT_3 "We need to speak to Shen-zin Su and discover how to heal it. And to do that, we need the four elemental spirits returned. Huo was the first."
1665#define MASTER_SHANG_XI_TEXT_4 "Ji, I'd like you to go to the Dai-Lo Farmstead in search of Wugou, the spirit of earth."
1666#define JI_TEXT_1 "On It!"
1667#define MASTER_SHANG_XI_TEXT_5 "Aysa, I want you to go to the Singing Pools to find Shu, the spirit of water."
1668#define AYSA_TEXT_1 "Yes master."
1669#define MASTER_SHANG_XI_TEXT_6 "And $n, you shall be the hand that guides us all. Speak with me for a moment before you join Aysa at the Singing Pools to the east."
1670
1671#define MASTER_SHANG_XI_TEXT_7 "You've returned with the spirits of water and earth. You make an old master proud."
1672#define MASTER_SHANG_XI_TEXT_8 "Wugou and Shu are welcome here. We will care for them well."
1673#define MASTER_SHANG_XI_TEXT_9 "The only remaining spirit is Dafeng, who hides somewhere across the Dawning Span to the west."
1674
1675
1676const Position jiTempleMovePoint_1 = { 966.1493f, 3607.0894f, 196.51373f };
1677const Position jiTempleMovePoint_2 = { 958.9819f, 3594.94f, 196.6083f };
1678const Position jiTempleMovePoint_3 = { 950.7555f, 3588.809f, 196.8154f };
1679
1680const Position aysaTempleMovePoint_1 = { 966.3715f, 3602.764f, 196.47968f };
1681const Position aysaTempleMovePoint_2 = { 943.1327f, 3572.154f, 193.6543f };
1682
1683const Position jiTempleSpawnPos = { 971.5566f, 3607.8015f, 195.71495f };
1684const Position aysaTempleSpawnPos = { 968.2688f, 3602.207f, 196.6442f };
1685const Position masterShangXiPos = { 960.043030f, 3606.050049f, 196.414001f, 0.0f };
1686
1688{
1702public:
1703 npc_master_shang_xi_temple() : CreatureScript("npc_master_shang_xi_temple") { }
1704
1705 bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* quest) OVERRIDE
1706 {
1707 if (quest->GetQuestId() == 29776) // Morning Breeze Village
1708 {
1709 if (Creature* vehicle = player->SummonCreature(55685, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 20000))
1710 {
1711 player->EnterVehicle(vehicle);
1712 }
1713 }
1714 return true;
1715 }
1716
1717 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
1718 {
1719 if (creature->IsQuestGiver())
1720 player->PrepareQuestMenu(creature->GetGUID());
1721
1722 if (player->GetQuestStatus(29776) != QUEST_STATUS_NONE)
1723 player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I would like to go back on the top of the temple", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
1724
1725 player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
1726 return true;
1727 }
1728
1729 bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) OVERRIDE
1730 {
1731 if (action == GOSSIP_ACTION_INFO_DEF + 1)
1732 {
1733 if (Creature* vehicle = player->SummonCreature(55685, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 20000))
1734 {
1735 player->EnterVehicle(vehicle);
1736 }
1737 }
1738
1739 player->PlayerTalkClass->SendCloseGossip();
1740 return true;
1741 }
1742
1744 {
1745 return new npc_master_shang_xi_templeAI(creature);
1746 }
1747
1749 {
1750 std::vector<Player*> players;
1752 bool started = false;
1753
1755
1757 {
1758 started = false;
1759 }
1760
1762 {
1763 Player* const player = who->ToPlayer();
1764 if (!player)
1765 return;
1766
1767 if (player->GetQuestStatus(29423) != QUEST_STATUS_REWARDED || started)
1768 return;
1769
1770 if (me->GetAreaId() == 5820) // Temple of Five Dawns Area
1771 {
1772 started = true;
1773 if (player->GetQuestStatus(29775) == QUEST_STATUS_REWARDED)
1774 {
1775 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_7, 1000);
1776 }
1777 else
1778 {
1779 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_1, 1000);
1780 }
1781 }
1782 }
1783
1785 {
1786 players.clear();
1787
1788 std::list<Player*> PlayerList;
1789 me->GetPlayerListInGrid(PlayerList, 20.0f);
1790
1791 for (auto&& player : PlayerList)
1792 if (!player->IsGameMaster() && player->GetQuestStatus(29423) == QUEST_STATUS_REWARDED)
1793 players.push_back(player);
1794 }
1795
1797 {
1798 events.Update(diff);
1799
1800 while (uint32 eventId = events.ExecuteEvent())
1801 {
1802 switch (eventId)
1803 {
1805 {
1807 for (auto&& player : players)
1808 {
1810 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_2, 10000);
1811 }
1812 break;
1813 }
1815 {
1817 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_3, 10000);
1818 break;
1819 }
1821 {
1823 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_4, 10000);
1824 break;
1825 }
1827 {
1829 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_5, 10000);
1830 if (Creature* ji = me->FindNearestCreature(61127, 20.0f, true))
1831 {
1832 ji->MonsterSay(JI_TEXT_1, Language::LANG_UNIVERSAL, ji);
1833 ji->GetMotionMaster()->MovePoint(1, jiTempleMovePoint_2);
1834 ji->DespawnOrUnsummon(2500);
1835 }
1836 break;
1837 }
1839 {
1841 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_6, 10000);
1842 if (Creature* aysa = me->FindNearestCreature(61126, 20.0f, true))
1843 {
1844 aysa->MonsterSay(AYSA_TEXT_1, Language::LANG_UNIVERSAL, aysa);
1845 aysa->GetMotionMaster()->MovePoint(2, aysaTempleMovePoint_2);
1846 aysa->DespawnOrUnsummon(2500);
1847 }
1848 break;
1849 }
1851 {
1853 for (auto&& player : players)
1854 {
1856 }
1857 break;
1858 }
1860 {
1862 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_8, 10000);
1863 break;
1864 }
1866 {
1868 events.ScheduleEvent(EVENT_MASTER_SHANG_XI_TALK_9, 10000);
1869 break;
1870 }
1872 {
1874 break;
1875 }
1876 }
1877 }
1878 }
1879 };
1880};
1881
1882const Position huoPos = { 955.11584f, 3604.04f, 200.71805f, 0.0f };
1883// at 7835
1885{
1886public:
1888
1889 bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) OVERRIDE
1890 {
1891 if (player->GetQuestStatus(29423) == QUEST_STATUS_INCOMPLETE)
1892 {
1893 if (Creature* huo = player->FindNearestCreature(54958, 15.0f, true)) // Check if Huo is with us.
1894 {
1895 if (Creature* master = player->FindNearestCreature(54786, 25.0f, true))
1896 {
1897 master->MonsterSay("Welcome, Huo. The people have missed your warmth.", Language::LANG_UNIVERSAL, player);
1898 master->SendPlaySound(27788, true);
1900 {
1901 aysa->GetMotionMaster()->MovePoint(0, aysaTempleMovePoint_1);
1902 }
1904 {
1905 ji->GetMotionMaster()->MovePoint(0, jiTempleMovePoint_1);
1906 }
1907 player->KilledMonsterCredit(61128);
1908 huo->GetMotionMaster()->MovePoint(0, huoPos);
1909 huo->DeleteCharmInfo();
1910 huo->DespawnOrUnsummon(60000);
1911 return true;
1912 }
1913 }
1914 }
1915 return false;
1916 }
1917};
1918
1920{
1921public:
1922 npc_huo() : CreatureScript("npc_huo") { }
1923
1924 bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* /*quest*/ ) OVERRIDE
1925 {
1926 player->CastSpell(player, 102630); // blessing of huo
1927 player->CastSpell(player, 128700);
1928 return true;
1929 }
1930
1932 {
1933 return new npc_huoAI(creature);
1934 }
1935 struct npc_huoAI : public ScriptedAI
1936 {
1937 npc_huoAI(Creature* creature) : ScriptedAI(creature) { }
1938 };
1939};
1940
1942{
1944 //SPELL_LI_FEI_VISUAL_GHOST_AURA = 22650,
1945 //SPELL_Aysa_Cave_of_Scrolls_Comp_Timer_Aura = 128598,
1947 //SPELL_GENERIC_QUEST_INVISIBILITY_7 = 85096,
1948 //SPELL_AYSA_BAR = 116421,
1949};
1950
1951
1952/*####
1953# npc_li_fei
1954####*/
1955
1956Position const LiFeiSpawnPos = { 1126.9323f, 3428.6692f, 105.89006f };
1957Position const LiFeiMovePos1 = { 1131.3281f, 3437.5156f, 105.45826f };
1958Position const LiFeiMovePos2 = { 1131.8889f, 3428.2065f, 105.51409f };
1959Position const LiFeiMovePos3 = { 1130.5278f, 3425.5027f, 105.88636f };
1960Position const LiFeiMovePos4 = { 1130.5278f, 3425.5027f, 105.88636f };
1961Position const LiFeiMovePos5 = { 1129.7743f, 3433.302f, 105.531296f };
1962Position const LiFeiMovePos6 = { 1130.5573f, 3436.087f, 105.483864f };
1964{
1976public:
1977 npc_li_fei() : CreatureScript("npc_li_fei") { }
1978
1980 {
1981 return new npc_li_feiAI(creature);
1982 }
1983 struct npc_li_feiAI : public ScriptedAI
1984 {
1986 npc_li_feiAI(Creature* creature) : ScriptedAI(creature)
1987 {
1988 if (me->GetAreaId() == 5848) // Cave of Meditation Area
1989 {
1990 me->SetWalk(true);
1991 me->GetMotionMaster()->MovePoint(0, LiFeiSpawnPos);
1992 }
1993 }
1995 {
1996 if (type != POINT_MOTION_TYPE)
1997 return;
1998
1999 switch (id)
2000 {
2001 case 0:
2002 events.ScheduleEvent(EVENT_LI_FEI_MOVE_POS_1, 10000);
2003 me->GetMotionMaster()->MovePoint(1, LiFeiMovePos1);
2004 return;
2005 default:
2006 break;
2007 }
2008 }
2010 {
2011 events.Update(diff);
2012
2013 while (uint32 eventId = events.ExecuteEvent())
2014 {
2015 switch (eventId)
2016 {
2018 me->GetMotionMaster()->MovePoint(1, LiFeiMovePos1);
2019 events.ScheduleEvent(EVENT_LI_FEI_MOVE_POS_2, 10000);
2020 break;
2022 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
2023 me->MonsterTextEmote("Master Li Fei's voice echoes, \"The way of the Tushui... enlightenment through patience and meditation... the principled life.\"", me, false);
2024 me->GetMotionMaster()->MovePoint(2, LiFeiMovePos2);
2025 events.ScheduleEvent(EVENT_LI_FEI_MOVE_POS_3, 10000);
2026 break;
2028 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
2029 me->MonsterTextEmote("Master Li Fei's voice echoes, \"It is good to see you again, Aysa.You've come with respect, and so I shall give you the answers you seek.\"", me, false);
2030 me->GetMotionMaster()->MovePoint(3, LiFeiMovePos3);
2031 events.ScheduleEvent(EVENT_LI_FEI_MOVE_POS_4, 10000);
2032 break;
2034 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
2035 me->MonsterTextEmote("Master Li Fei's voice echoes, \"Huo, the spirit of fire, is known for his hunger.He wants for tinder to eat.He needs the caress of the wind to rouse him.\"", me, false);
2036 me->GetMotionMaster()->MovePoint(4, LiFeiMovePos4);
2037 events.ScheduleEvent(EVENT_LI_FEI_MOVE_POS_5, 10000);
2038 break;
2040 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
2041 me->MonsterTextEmote("Master Li Fei's voice echoes, \"If you find these things and bring them to his cave, on the far side of Wu - Song Village, you will face a challenge within.\"", me, false);
2042 me->GetMotionMaster()->MovePoint(5, LiFeiMovePos5);
2043 events.ScheduleEvent(EVENT_LI_FEI_MOVE_POS_6, 10000);
2044 break;
2046 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
2047 me->MonsterTextEmote("Master Li Fei's voice echoes, \"Overcome that challenge, and you shall be graced by Huo's presence. Rekindle his flame, and if your spirit is pure, he shall follow you.\"", me, false);
2048 me->GetMotionMaster()->MovePoint(6, LiFeiMovePos6);
2049 events.ScheduleEvent(EVENT_LI_FEI_DESPAWN, 10000);
2050 break;
2052 me->MonsterTextEmote("Master Li Fei's voice echoes, \"Go, children.We shall meet again very soon.\"", me, false);
2053 me->MonsterTextEmote("Master Li Fei fades away.", me, false);
2054 me->DespawnOrUnsummon(1000);
2055 break;
2056 }
2057 }
2058 }
2059 };
2060};
2061
2063{
2064 { 1184.7f, 3448.3f, 102.5f, 0.0f },
2065 { 1186.7f, 3439.8f, 102.5f, 0.0f },
2066};
2067
2069{
2070 { 1145.13f, 3432.88f, 105.268f, 0.0f },
2071 { 1143.36f, 3437.39f, 104.973f, 0.0f },
2072};
2073/*####
2074# npc_aysa_meditation
2075####*/
2077{
2084
2085public:
2086 npc_aysa_meditation() : CreatureScript("npc_aysa_meditation") { }
2087
2089 {
2090 return new npc_aysa_meditationAI(creature);
2091 }
2093 {
2094 npc_aysa_meditationAI(Creature* creature) : ScriptedAI(creature) { }
2095
2098 bool started = false;
2099 std::vector<Player*> playersParticipate;
2100
2102 {
2103 Power = 0;
2104 started = false;
2105 }
2106
2108 {
2109 playersParticipate.clear();
2110
2111 std::list<Player*> PlayerList;
2112 me->GetPlayerListInGrid(PlayerList, 20.0f);
2113
2114 for (auto&& player : PlayerList)
2115 if (!player->IsGameMaster() && player->GetQuestStatus(29414) == QUEST_STATUS_INCOMPLETE)
2116 playersParticipate.push_back(player);
2117 }
2118
2120 {
2121 if (playersParticipate.empty())
2122 {
2124 return;
2125 }
2126 else
2127 {
2128 for (auto&& player : playersParticipate)
2129 {
2130 if (!started && player->GetQuestStatus(29414) == QUEST_STATUS_INCOMPLETE)
2131 {
2132 if (me->GetAreaId() == 5848) // Cave of Meditation Area
2133 {
2134 started = true;
2135 events.ScheduleEvent(EVENT_POWER, 1000);
2136 events.ScheduleEvent(EVENT_ADDS, 1000);
2137 }
2138 }
2139 }
2140 }
2141
2142 events.Update(diff);
2143 while (uint32 eventId = events.ExecuteEvent())
2144 {
2145 switch (eventId)
2146 {
2147 case EVENT_POWER:
2148 {
2149 Power++;
2150
2151 if (Power == 1)
2152 {
2153 Talk(0);
2154 me->CastSpell(me, SPELL_SUMMON_LI_FEI);
2155 }
2156
2157 for (auto&& player : playersParticipate)
2158 {
2159 player->SetPower(POWER_ALTERNATE_POWER, Power);
2160 player->SetMaxPower(POWER_ALTERNATE_POWER, 90);
2161 }
2162
2163 if (Power >= 90)
2164 events.ScheduleEvent(EVENT_FINISHED, 100);
2165
2166 events.ScheduleEvent(EVENT_POWER, 1000);
2167 break;
2168 }
2169 case EVENT_ADDS:
2170 {
2171 for (uint8 i = 0; i < 2; ++i)
2172 {
2173 if (Creature* troublemaker = me->SummonCreature(61801, AddSpawnPos[i], TempSummonType::TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
2174 {
2175 troublemaker->GetMotionMaster()->MovePoint(0, AddPointPos[i]);
2176 }
2177 }
2178 events.ScheduleEvent(EVENT_ADDS, 60000);
2179 break;
2180 }
2181 case EVENT_FINISHED:
2182 {
2183 Talk(1);
2184 events.CancelEvent(EVENT_POWER);
2185 events.CancelEvent(EVENT_ADDS);
2186 for (auto&& player : playersParticipate)
2187 {
2188 player->CastSpell(player, SPELL_SEE_QUEST_INVIS_7);
2189 player->KilledMonsterCredit(54856, 0);
2190 player->RemoveAura(116421);
2191 }
2192 Reset();
2193 break;
2194 }
2195 default:
2196 break;
2197 }
2198 }
2199 }
2200 };
2201};
2202
2203/*####
2204# npc_aysa_cloudsinger
2205####*/
2206Position const AysaSpawnPos = { 1206.31f, 3507.45f, 85.99f };
2207Position const AysaJumpPos1 = { 1196.72f, 3492.85f, 90.9836f, 0 };
2208Position const AysaJumpPos2 = { 1192.29f, 3478.69f, 108.788f, 0 };
2209Position const AysaJumpPos3 = { 1197.99f, 3460.63f, 103.04f, 0 };
2210Position const AysaMovePos4 = { 1176.1909f, 3444.8743f, 103.35291f, 0 };
2211Position const AysaMovePos5 = { 1149.9497f, 3437.1702f, 104.967064f, 0 };
2212
2214{
2224
2225public:
2226 npc_aysa_cloudsinger() : CreatureScript("npc_aysa_cloudsinger") { }
2227
2228 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
2229 {
2230 if (quest->GetQuestId() == 29414)
2231 {
2232 creature->MonsterSay("Meet me up in the cave if you would. friend.", Language::LANG_UNIVERSAL, player);
2233 creature->SendPlaySound(27397, true);
2234 creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
2235 creature->GetMotionMaster()->MovePoint(0, AysaSpawnPos);
2236 return true;
2237 }
2238 return false;
2239 }
2240
2242 {
2243 npc_aysa_cloudsingerAI(Creature* creature) : ScriptedAI(creature) { }
2244
2246
2248 {
2249 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
2250 return;
2251
2252 switch (id)
2253 {
2254 case 0:
2255 events.ScheduleEvent(EVENT_AYSA_JUMP_POS_1, 5000);
2256 return;
2257 default:
2258 break;
2259 }
2260 }
2261
2263 {
2264 events.Update(diff);
2265
2266 while (uint32 eventId = events.ExecuteEvent())
2267 {
2268 switch (eventId)
2269 {
2271 me->GetMotionMaster()->MoveJump(AysaJumpPos1, 15.0f, 15.0f, 1);
2272 events.ScheduleEvent(EVENT_AYSA_JUMP_POS_2, 2000);
2273 break;
2275 me->GetMotionMaster()->MoveJump(AysaJumpPos2, 15.0f, 25.0f, 2);
2276 events.ScheduleEvent(EVENT_AYSA_JUMP_POS_3, 2000);
2277 break;
2279 me->GetMotionMaster()->MoveJump(AysaJumpPos3, 15.0f, 15.0f, 3);
2280 events.ScheduleEvent(EVENT_AYSA_MOVE_POS_4, 2000);
2281 break;
2283 me->GetMotionMaster()->MovePoint(4, AysaMovePos4);
2284 events.ScheduleEvent(EVENT_AYSA_MOVE_POS_5, 2000);
2285 break;
2287 me->GetMotionMaster()->MovePoint(5, AysaMovePos5);
2288 events.ScheduleEvent(EVENT_AYSA_DESPAWN, 4000);
2289 break;
2290 case EVENT_AYSA_DESPAWN:
2291 me->DespawnOrUnsummon(1000);
2292 break;
2293 }
2294 }
2295 }
2296 };
2297
2299 {
2300 return new npc_aysa_cloudsingerAI(creature);
2301 }
2302};
2303
2305{
2306 public:
2307 npc_jaomin_ro() : CreatureScript("npc_jaomin_ro") { }
2308
2310 {
2311 npc_jaomin_roAI(Creature* creature) : ScriptedAI(creature) { }
2312
2324
2326
2328 {
2329 events.ScheduleEvent(EVENT_JAOMIN_JUMP, 2000);
2330 }
2331
2333 {
2334 events.Reset();
2335 }
2336
2338 {
2339 Player * const player = who->ToPlayer();
2340 if (!player)
2341 return;
2342
2343 if (player->GetQuestStatus(29409) != QUEST_STATUS_INCOMPLETE)
2344 return;
2345
2346 if (who->GetDistance(me) < 15.f)
2347 {
2348 if (me->getStandState() != UNIT_STAND_STATE_STAND)
2349 {
2350 Talk(0);
2351 me->SetStandState(UNIT_STAND_STATE_STAND);
2352 }
2353 }
2354 }
2355
2356 void DamageTaken(Unit* attacker, uint32& damage) OVERRIDE
2357 {
2358 if (HealthBelowPct(10))
2359 {
2360 std::list<Player*> playerList;
2361 GetPlayerListInGrid(playerList, me, 10.0f);
2362 for (auto&& player: playerList)
2363 player->KilledMonsterCredit(me->GetEntry(), 0);
2364
2365 me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
2366 Talk(1);
2367
2368 if (damage > me->GetHealth())
2369 damage = 0;
2370
2371 events.CancelEvent(EVENT_JAOMIN_JUMP);
2372 events.CancelEvent(EVENT_JAOMIN_JUMP_DAMAGE);
2373 events.CancelEvent(EVENT_FALCON);
2374 events.CancelEvent(EVENT_FALCON_VEHICLE);
2375 events.CancelEvent(EVENT_FALCON_VEHICLE_EXIT);
2376 events.CancelEvent(EVENT_FALCON_STUN);
2377 events.CancelEvent(EVENT_FALCON_STOP);
2378
2379 events.ScheduleEvent(EVENT_END_OF_COMBAT, 1000);
2380 }
2381
2382 }
2383
2385 {
2386 if (!UpdateVictim())
2387 return;
2388
2389 events.Update(diff);
2390
2391 while (uint32 eventId = events.ExecuteEvent())
2392 {
2393 switch (eventId)
2394 {
2395 case EVENT_JAOMIN_JUMP:
2396 {
2397 me->CastSpell(me->GetVictim(), 108938);
2398 events.ScheduleEvent(EVENT_JAOMIN_JUMP_DAMAGE, 2500);
2399 break;
2400 }
2402 {
2403 me->GetMotionMaster()->MoveJump(me->GetVictim()->GetPositionX(),me->GetVictim()->GetPositionY(),me->GetVictim()->GetPositionZ(), 20.0f, 20.0f);
2404 me->CastSpell(me->GetVictim(), 108937);
2405 std::list<Player*> playerList;
2406 GetPlayerListInGrid(playerList, me, 5.0f);
2407 for (auto&& player : playerList)
2408 {
2409 float horizontalSpeed = 10.0f;
2410 float verticalSpeed = 8.0f;
2411 player->KnockbackFrom(me->GetPositionX(), me->GetPositionY(), horizontalSpeed, verticalSpeed);
2412 }
2413 events.ScheduleEvent(EVENT_FALCON, 10000);
2414 break;
2415 }
2416 case EVENT_FALCON:
2417 {
2418
2419 me->CastSpell(me, 108955);
2420 if (Creature* hawk = me->SummonCreature(57750, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 3000))
2421 {
2422 hawk->SetDisplayId(39796);
2423 me->EnterVehicle(hawk, 0);
2424 }
2425 events.ScheduleEvent(EVENT_FALCON_VEHICLE, 1000);
2426 break;
2427 }
2429 {
2430 if (Creature* hawk = me->FindNearestCreature(57750, 25.0f))
2431 {
2432 float x, y, z;
2433 me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 20.0f);
2434 hawk->GetMotionMaster()->MoveCharge(x,y,z);
2435 }
2436 events.ScheduleEvent(EVENT_FALCON_VEHICLE_EXIT, 1000);
2437 break;
2438 }
2440 {
2441 me->ExitVehicle();
2442 events.ScheduleEvent(EVENT_FALCON_STUN, 1000);
2443 break;
2444 }
2445 case EVENT_FALCON_STUN:
2446 {
2447 me->CastSpell(me->GetVictim(), 108971);
2448 events.ScheduleEvent(EVENT_FALCON_STOP, 2000);
2449 break;
2450 }
2451 case EVENT_FALCON_STOP:
2452 {
2453 me->RemoveAurasByType(SPELL_AURA_PERIODIC_TRIGGER_SPELL);
2454 events.ScheduleEvent(EVENT_JAOMIN_JUMP, 10000);
2455 break;
2456 }
2458 {
2460 break;
2461 }
2462 default:
2463 break;
2464 }
2465 }
2466
2468 }
2469 };
2470
2472 {
2473 return new npc_jaomin_roAI(creature);
2474 }
2475};
2476
#define M_PI
Definition Common.h:192
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:75
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition Object.h:68
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:73
#define PET_FOLLOW_ANGLE
Definition PetDefines.h:58
#define PET_FOLLOW_DIST
Definition PetDefines.h:57
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:92
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
@ QUEST_STATUS_NONE
Definition QuestDef.h:86
@ QUEST_STATUS_COMPLETE
Definition QuestDef.h:87
void GetPlayerListInGrid(std::list< Player * > &list, WorldObject *source, float maxSearchRange)
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive)
void GetPositionWithDistInOrientation(Unit *pUnit, float dist, float orientation, float &x, float &y)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ EMOTE_ONESHOT_KNEEL
@ EMOTE_ONESHOT_SALUTE
@ EMOTE_ONESHOT_TALK
@ POWER_ALTERNATE_POWER
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ UNIT_NPC_FLAG_SPELLCLICK
Definition Unit.h:711
@ UNIT_STAND_STATE_STAND
Definition Unit.h:162
@ MOVE_RUN
Definition Unit.h:556
@ REACT_PASSIVE
Definition Unit.h:1156
@ UNIT_FIELD_NPC_FLAGS
float frand(float min, float max)
Definition Util.cpp:39
bool OnTrigger(Player *player, AreaTriggerEntry const *) OVERRIDE
AreaTriggerScript(const char *name)
CreatureAI(Creature *creature)
Definition CreatureAI.h:69
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:56
virtual void EnterEvadeMode()
CreatureScript(const char *name)
Player * ToPlayer()
Definition Object.h:204
QuestStatus GetQuestStatus(uint32 quest_id) const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
Definition Unit.h:1367
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition Unit.cpp:8234
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
bool IsWithinDist2d(float x, float y, float dist) const
Definition Object.cpp:1720
void MonsterSay(const char *text, Language language, WorldObject const *target)
Definition Object.cpp:2383
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2801
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition Object.cpp:2703
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *, Quest const *) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipSelect(Player *player, Creature *, uint32, uint32 action) OVERRIDE
bool OnQuestAccept(Player *player, Creature *, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
void RandomResizeList(std::list< T > &list, uint32 size)
Definition Containers.h:19
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void MovementInform(uint32 type, uint32 pointId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 type, uint32 id) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void OnSpellClick(Unit *Clicker, bool &) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
void OnSpellClick(Unit *Clicker, bool &) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
npc_huoAI(Creature *creature)
void MoveInLineOfSight(Unit *who) OVERRIDE
void DamageTaken(Unit *attacker, uint32 &damage) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 type, uint32 id) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 type, uint32 id) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
#define MASTER_SHANG_XI_TEXT_1
const Position masterShangXiWoodsPos2
const Position masterShangXiWoodsPos4
#define MASTER_SHANG_XI_TEXT_8
Position const LiFeiMovePos2
const Position balloonPos1
const Position aysaTempleMovePoint_2
const Position shuJumpPos4
const Position balloonPos25
const Position masterShangXiWoodsPos1
const Position balloonPos11
const Position masterShangXiWorthyPos3
const Position balloonPos7
const Position tornadoPos2
const Position shuJumpPos1
const Position jiTempleMovePoint_2
const Position masterShangXiWorthyPos11
const Position shuJumpPos3
const Position aysaChamberMoveEnd
const Position balloonPos16
const Position aysaTempleSpawnPos
const Position jiTempleSpawnPos
#define MASTER_SHANG_XI_TEXT_2
const Position balloonPos8
const Position AddPointPos[2]
@ SPELL_SEE_QUEST_INVIS_7
const Position jiTempleMovePoint_1
const Position huoPos
const Position masterShangXiWorthyPos6
const Position balloonPos10
#define MASTER_SHANG_XI_TEXT_6
Position const AysaJumpPos3
const Position masterShangXiWorthyPos9
const Position shuPos3
const Position balloonPos20
const Position jiTempleMovePoint_3
const Position aysaChamberMovePos2
const Position masterShangXiWorthyPos4
Position const AysaMovePos4
const Position balloonPos15
Position const LiFeiMovePos6
const Position shuJumpPos2
const Position tornadoPos3
#define JI_TEXT_1
const Position balloonPos24
const Position balloonPos4
const Position masterShangXiWorthyPos7
const Position balloonPos6
#define MASTER_SHANG_XI_TEXT_7
Position const AysaJumpPos2
const Position shuPos1
Position const LiFeiMovePos1
const Position masterShangXiPos
void AddSC_wandering_island()
const Position balloonPos19
Position const LiFeiMovePos4
const Position aysaChamberMovePos3
const Position balloonPos12
Position const LiFeiMovePos3
const Position masterShangXiWoodsPos6
Position const AysaJumpPos1
const Position tornadoPos1
const Position balloonPos17
const Position shuPos2
const Position zhaoStunPos
const Position balloonPos3
const Position masterShangXiWorthyEndPos
const Position masterShangXiWorthyPos2
#define MASTER_SHANG_XI_TEXT_4
const Position AddSpawnPos[2]
const Position balloonPos5
const Position masterShangXiWorthyPos10
Position const LiFeiMovePos5
const Position balloonPos9
const Position masterShangXiWorthyPos1
#define MASTER_SHANG_XI_TEXT_3
const Position tornadoEndPos
const Position balloonPos13
Position const AysaSpawnPos
const Position balloonPos21
const Position balloonPos22
Position const LiFeiSpawnPos
#define MASTER_SHANG_XI_TEXT_5
const Position balloonPos14
const Position aysaTempleMovePoint_1
const Position aysaChamberMovePos1
static Position const ZhaoPos[]
const Position balloonPos2
const Position balloonPos18
const Position masterShangXiWoodsPos3
#define MASTER_SHANG_XI_TEXT_9
Position const AysaMovePos5
#define AYSA_TEXT_1
const Position masterShangXiWoodsPos5
const Position balloonPos23
const Position masterShangXiWorthyPos5
const Position masterShangXiWorthyPos8