TrinityCore
Loading...
Searching...
No Matches
zone_orderhall_warrior.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 "Containers.h"
19#include "MotionMaster.h"
20#include "MovementTypedefs.h"
21#include "ObjectAccessor.h"
22#include "PhasingHandler.h"
23#include "Player.h"
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "TemporarySummon.h"
27#include "WaypointDefines.h"
28#include <span>
29
36
38{
39 PHASE_ODYN = 5107,
40 PHASE_DANICA = 5090
41};
42
47
54
63
65{
66 npc_danica_the_reclaimer(Creature* creature) : ScriptedAI(creature) { }
67
74
81
83 {
85 {
86 { 0, 1050.219f, 7232.470f, 100.5846f },
87 { 1, 1046.207f, 7240.372f, 100.5846f },
88 { 2, 1040.963f, 7245.498f, 100.6819f },
89 { 3, 1034.726f, 7250.083f, 100.5846f },
90 { 4, 1027.422f, 7257.835f, 100.5846f },
91 { 5, 1027.542f, 7259.735f, 100.5846f }
92 },
95 };
96
98 {
100 {
101 { 0, 1018.493f, 7247.438f, 100.5846f },
102 { 1, 1013.535f, 7243.327f, 100.5846f },
103 { 2, 1007.063f, 7235.723f, 100.5846f },
104 { 3, 1003.337f, 7229.650f, 100.5846f },
105 { 4, 995.4549f, 7227.286f, 100.5846f },
106 { 5, 984.4410f, 7224.357f, 100.5846f }
107 },
110 };
111
113 {
115 {
116 { 0, 962.5208f, 7223.089f, 100.5846f },
117 { 1, 934.2795f, 7223.116f, 100.5846f },
118 { 2, 911.8507f, 7223.776f, 100.5846f },
119 { 3, 879.0139f, 7224.100f, 100.9079f },
120 { 4, 851.691f, 7224.5490f, 109.5846f }
121 },
124 };
125
126 // Should be the player
127 // Personal spawn ? Demon Creator is the player who accepts the quest, no phasing involved but the quest giver dissapears and gets replaced with a new one
128 void IsSummonedBy(WorldObject* summoner) override
129 {
130 if (summoner->GetTypeId() != TYPEID_PLAYER)
131 return;
132
134 _summonerGuid = summoner->GetGUID();
135 _scheduler.Schedule(2s, [this, summoner](TaskContext const& /*context*/)
136 {
137 me->GetMotionMaster()->MovePath(DanicaPath01, false);
138 Talk(SAY_FIRST_LINE, summoner);
139 });
140 }
141
142 void WaypointPathEnded(uint32 /*pointId*/, uint32 pathId) override
143 {
144 switch (pathId)
145 {
147 _scheduler.Schedule(10s, [this](TaskContext const& /*context*/)
148 {
151 Talk(SAY_SECOND_LINE, player);
152 });
153 break;
155 _scheduler.Schedule(10s, [this](TaskContext const& /*context*/)
156 {
159 Talk(SAY_THIRD_LINE, player);
160
161 if (player)
163 });
164 break;
165 case POINT_ODYN:
167 break;
168 default:
169 break;
170 }
171 }
172
173 void UpdateAI(uint32 diff) override
174 {
175 _scheduler.Update(diff);
176 }
177
178 // Should be some other way to do this...
179 void OnQuestAccept(Player* player, Quest const* /*quest*/) override
180 {
182 }
183
184private:
187};
188
190{
194
196 {
198 };
199
200 void UpdateAI(uint32 diff) override
201 {
202 _scheduler.Update(diff);
203 }
204
205 void Reset() override
206 {
207 _scheduler.Schedule(5s, 30s, [this](TaskContext& context)
208 {
210 if (emoteID == EMOTE_ONESHOT_EAT_NO_SHEATHE)
211 {
213 context.Schedule(1s, [this](TaskContext const& /*context*/)
214 {
215 me->SetVirtualItem(0, 0);
216 if (roll_chance(85))
218 });
219 }
220
221 me->HandleEmoteCommand(emoteID);
222 context.Repeat();
223 });
224
225 _scheduler.Schedule(5min, 20min, [this](TaskContext const& /*context*/)
226 {
227 float direction = me->GetOrientation() + M_PI;
229 });
230 }
231
232 void MovementInform(uint32 /*type*/, uint32 id) override
233 {
234 switch (id)
235 {
236 case POINT_LEAVING:
238 break;
239 default:
240 break;
241 }
242 }
243
244private:
246 std::unordered_set<Emote> _randomEmotes;
247};
248
250{
253
260
261 virtual std::span<WaypointNode const> GetPathToTable() const = 0;
262 virtual std::span<WaypointNode const> GetPathToOdyn() const = 0;
263 virtual std::span<WaypointNode const> GetPathToDespawnPoint() const = 0;
264
269
270 void UpdateAI(uint32 diff) override
271 {
272 _scheduler.Update(diff);
273 }
274
275 void MovementInform(uint32 /*type*/, uint32 id) override
276 {
277 switch (id)
278 {
279 case POINT_TABLE:
280 _scheduler.Schedule(3s, 6s, [this](TaskContext const& /*context*/)
281 {
283 });
284
285 _scheduler.Schedule(7s, 15s, [this](TaskContext const& /*context*/)
286 {
288 });
289 break;
290 case POINT_ODYN:
291 _scheduler.Schedule(1s, 3s, [this](TaskContext& context)
292 {
294 context.Schedule(3s, 10s, [this](TaskContext const& /*context*/)
295 {
297 });
298 });
299 break;
300 case POINT_DESPAWN:
302 break;
303 default:
304 break;
305 }
306 }
307
308private:
310 std::unordered_set<Emote> _randomEmotes;
311};
312
314{
316
318 {
319 { 0, 876.7396f, 7220.805f, 98.91662f },
320 { 1, 870.6129f, 7220.945f, 101.8951f },
321 { 2, 865.0677f, 7220.975f, 103.7846f },
322 { 3, 854.6389f, 7221.030f, 106.7846f },
323 { 4, 851.1597f, 7220.292f, 106.7846f },
324 { 5, 848.0573f, 7216.386f, 106.7846f },
325 { 6, 844.7570f, 7210.920f, 106.7846f },
326 { 7, 841.9844f, 7207.228f, 106.7846f },
327 { 8, 839.2396f, 7203.619f, 107.5846f },
328 { 9, 836.4844f, 7200.202f, 107.5846f },
329 { 10, 834.2430f, 7196.000f, 107.5846f }
330 };
331
333 {
334 { 0, 828.5851f, 7204.096f, 106.7846f },
335 { 1, 819.4636f, 7212.124f, 106.7846f },
336 { 2, 814.2853f, 7215.074f, 106.7846f },
337 { 3, 809.4948f, 7217.543f, 106.7846f },
338 { 4, 806.0313f, 7219.614f, 106.7846f }
339 };
340
342 {
343 { 0, 824.1597f, 7221.822f, 106.7846f },
344 { 1, 831.7500f, 7221.092f, 106.7846f },
345 { 2, 842.4236f, 7222.208f, 106.7846f },
346 { 3, 853.5781f, 7222.473f, 106.7846f },
347 { 4, 863.9618f, 7223.012f, 103.7846f },
348 { 5, 867.9358f, 7223.165f, 103.3735f },
349 { 6, 880.6215f, 7222.569f, 97.78457f },
350 { 7, 887.8438f, 7221.310f, 97.78457f },
351 { 8, 903.7118f, 7215.743f, 97.78458f }
352 };
353
354 std::span<WaypointNode const> GetPathToTable() const override { return IncommingValarjarAspirantPath01; }
355 std::span<WaypointNode const> GetPathToOdyn() const override { return IncommingValarjarAspirantPath02; }
356 std::span<WaypointNode const> GetPathToDespawnPoint() const override { return IncommingValarjarAspirantPath03; }
357};
358
360{
362
364 {
365 { 0, 890.5521f, 7235.710f, 97.78457f },
366 { 1, 883.8073f, 7233.402f, 97.78457f },
367 { 2, 872.1979f, 7234.018f, 101.2886f },
368 { 3, 863.5941f, 7234.594f, 103.7846f },
369 { 4, 855.2899f, 7235.626f, 106.7593f },
370 { 5, 849.8177f, 7236.571f, 106.7846f },
371 { 6, 845.7830f, 7241.082f, 106.7846f },
372 { 7, 841.8489f, 7246.654f, 106.7846f },
373 { 8, 839.7205f, 7250.986f, 106.7846f },
374 { 9, 840.8889f, 7254.773f, 107.5846f },
375 { 10, 841.9254f, 7259.517f, 107.5846f },
376 { 11, 840.6077f, 7266.662f, 107.5846f }
377 };
378
380 {
381 { 0, 838.1493f, 7260.027f, 107.5846f },
382 { 1, 832.2691f, 7253.756f, 106.7846f },
383 { 2, 823.1996f, 7246.677f, 106.7846f },
384 { 3, 821.2500f, 7244.573f, 106.7846f },
385 { 4, 815.8906f, 7241.437f, 106.7846f },
386 { 5, 809.8281f, 7239.580f, 106.7846f }
387 };
388
390 {
391 { 0, 827.4757f, 7236.593f, 106.7846f },
392 { 1, 837.1840f, 7236.047f, 106.7846f },
393 { 2, 847.1684f, 7235.377f, 106.7846f },
394 { 3, 854.7185f, 7235.294f, 106.7846f },
395 { 4, 862.3524f, 7234.287f, 104.4290f },
396 { 5, 882.3489f, 7233.743f, 97.78457f },
397 { 6, 894.3768f, 7233.098f, 97.78457f },
398 { 7, 906.0660f, 7232.520f, 97.78458f },
399 { 8, 915.0070f, 7233.368f, 97.78458f },
400 { 9, 924.6910f, 7233.694f, 97.78458f }
401 };
402
403 std::span<WaypointNode const> GetPathToTable() const override { return IncommingValarjarAspirantPath01; }
404 std::span<WaypointNode const> GetPathToOdyn() const override { return IncommingValarjarAspirantPath02; }
405 std::span<WaypointNode const> GetPathToDespawnPoint() const override { return IncommingValarjarAspirantPath03; }
406};
407
409{
411
413 {
414 { 0, 802.5903f, 7304.605f, 106.7846f },
415 { 1, 809.3333f, 7296.529f, 106.7846f },
416 { 2, 811.8004f, 7293.676f, 106.7846f },
417 { 3, 817.4219f, 7287.498f, 106.7846f },
418 { 4, 821.0313f, 7283.637f, 106.7846f },
419 { 5, 822.1111f, 7275.672f, 106.7846f },
420 { 6, 826.4662f, 7270.601f, 107.5846f },
421 { 7, 830.8212f, 7268.729f, 107.5846f }
422 };
423
425 {
426 { 0, 824.9757f, 7261.047f, 107.5846f },
427 { 1, 822.0989f, 7256.705f, 106.7846f },
428 { 2, 819.0261f, 7253.674f, 106.7846f },
429 { 3, 813.1910f, 7249.034f, 106.7846f },
430 { 4, 809.1493f, 7245.616f, 106.7846f },
431 { 5, 806.3559f, 7243.057f, 106.7846f }
432 };
433
435 {
436 { 0, 825.3177f, 7244.253f, 106.7846f },
437 { 1, 837.5816f, 7243.241f, 106.7846f },
438 { 2, 845.0243f, 7240.063f, 106.7846f },
439 { 3, 853.7274f, 7238.423f, 106.7953f },
440 { 4, 862.9948f, 7238.000f, 103.9737f },
441 { 5, 872.7899f, 7236.939f, 100.8285f },
442 { 6, 882.8333f, 7235.922f, 97.78457f },
443 { 7, 897.2813f, 7235.469f, 97.78457f },
444 { 8, 908.8090f, 7234.836f, 97.78458f },
445 { 9, 919.8750f, 7238.241f, 97.78458f }
446 };
447
448 std::span<WaypointNode const> GetPathToTable() const override { return PathLeavingValarjar01; }
449 std::span<WaypointNode const> GetPathToOdyn() const override { return PathLeavingValarjar02; }
450 std::span<WaypointNode const> GetPathToDespawnPoint() const override { return PathLeavingValarjar03; }
451};
452
454{
456
458 {
459 { 0, 787.2361f, 7155.902f, 107.5846f },
460 { 1, 792.4844f, 7154.038f, 106.7846f },
461 { 2, 798.7830f, 7154.968f, 106.7846f },
462 { 3, 807.8160f, 7162.251f, 106.7846f },
463 { 4, 813.2882f, 7167.856f, 106.7846f },
464 { 5, 816.4913f, 7170.818f, 106.7846f },
465 { 6, 819.8299f, 7166.373f, 107.6281f }
466 };
467
469 {
470 { 0, 818.2708f, 7175.469f, 106.7846f },
471 { 1, 819.5643f, 7185.691f, 106.7846f },
472 { 2, 818.4184f, 7193.082f, 106.7846f },
473 { 3, 818.8750f, 7199.256f, 106.7846f },
474 { 4, 815.2361f, 7203.648f, 106.7846f },
475 { 5, 809.6198f, 7208.319f, 106.7846f },
476 { 6, 804.2743f, 7215.379f, 106.7846f }
477 };
478
480 {
481 { 0, 810.8403f, 7231.531f, 106.7846f },
482 { 1, 807.5087f, 7248.719f, 106.7846f },
483 { 2, 801.2587f, 7254.592f, 106.7846f },
484 { 3, 794.6649f, 7265.814f, 107.5846f },
485 { 4, 792.0191f, 7274.151f, 107.5846f },
486 { 5, 790.1823f, 7282.182f, 107.5846f }
487 };
488
489 std::span<WaypointNode const> GetPathToTable() const override { return PathLeavingValarjar01; }
490 std::span<WaypointNode const> GetPathToOdyn() const override { return PathLeavingValarjar02; }
491 std::span<WaypointNode const> GetPathToDespawnPoint() const override { return PathLeavingValarjar03; }
492};
493
494struct npc_odyn : public ScriptedAI
495{
496 npc_odyn(Creature* creature) : ScriptedAI(creature) { }
497
498 // Should be an better way of doing this...
499 // What about a QuestScript with a hook "OnPlayerChangeArea" ? But The Great Mead Hall does not have a specific area...
500 void MoveInLineOfSight(Unit* who) override
501 {
502 if (Player* player = who->ToPlayer())
503 {
504 if (player->GetQuestStatus(QUEST_ODYN_AND_THE_VALARJAR) == QUEST_STATUS_INCOMPLETE)
505 {
506 if (player->IsInDist(me, 60.0f))
507 {
508 player->KilledMonsterCredit(NPC_KILL_CREDIT_ARRIVED_AT_ODYN); // SPELL_WARRIOR_ORDER_FORMATION_SCENE does not has this credit.
509 player->CastSpell(player, SPELL_WARRIOR_ORDER_FORMATION_SCENE);
510 }
511 }
512 }
513 }
514};
515
517{
520
521 void UpdateAI(uint32 diff) override
522 {
523 _scheduler.Update(diff);
524 }
525
526 void Reset() override
527 {
528 _scheduler.Schedule(5s, 30s, [this](TaskContext& context)
529 {
531 context.Repeat();
532 });
533
534 _scheduler.Schedule(5min, 20min, [this](TaskContext const& /*context*/)
535 {
536 float direction = me->GetOrientation() + M_PI;
537 me->GetMotionMaster()->MovePoint(0, me->GetFirstCollisionPosition(5.0f, direction));
538 });
539 }
540
541 void MovementInform(uint32 /*type*/, uint32 id) override
542 {
543 switch (id)
544 {
545 case 0:
547 break;
548 default:
549 break;
550 }
551 }
552
553private:
555 std::unordered_set<Emote> _randomEmotes;
556};
557
559{
560 npc_valkyr_of_odyn(Creature* creature) : ScriptedAI(creature) { }
561
562 virtual std::span<WaypointNode const> GetPath() const = 0;
563
570
571 void Reset() override
572 {
573 if (me->GetPositionZ() >= 100.0f)
574 {
575 _scheduler.Schedule(3s, [this](TaskContext const& /*context*/)
576 {
577 me->GetMotionMaster()->MovePath({ POINT_JUMP, { GetPath().begin(), GetPath().end() }, WaypointMoveType::Run, WaypointPathFlags::FlyingPath }, false);
578 });
579 }
580 else
582 }
583
584 void UpdateAI(uint32 diff) override
585 {
586 _scheduler.Update(diff);
587 }
588
589 void WaypointPathEnded(uint32 /*pointId*/, uint32 pathId) override
590 {
591 switch (pathId)
592 {
593 case POINT_JUMP:
594 _scheduler.Schedule(250ms, [this](TaskContext const& /*context*/)
595 {
596 me->GetMotionMaster()->MoveJump(POINT_DESPAWN_JUMP, { 1107.84f, 7222.57f, 38.9725f, me->GetOrientation() });
597 });
598 break;
599 case POINT_DESPAWN:
600 me->DespawnOrUnsummon(500ms);
601 break;
602 default:
603 break;
604 }
605 }
606
607 void MovementInform(uint32 type, uint32 id) override
608 {
609 switch (id)
610 {
612 if (type == EFFECT_MOTION_TYPE)
614 break;
615 default:
616 break;
617 }
618 }
619
620private:
622};
623
625{
627
628 static constexpr WaypointNode Path[] =
629 {
630 { 0, 996.5347f, 7321.393f, 124.0931f },
631 { 1, 1009.880f, 7311.655f, 118.0898f },
632 { 2, 1024.688f, 7293.689f, 120.4009f },
633 { 3, 1038.288f, 7266.321f, 122.2708f },
634 { 4, 1049.439f, 7235.418f, 120.1065f },
635 { 5, 1067.825f, 7229.589f, 114.6320f },
636 { 6, 1082.800f, 7223.660f, 98.63562f }
637 };
638
639 std::span<WaypointNode const> GetPath() const override { return Path; }
640};
641
643{
645
646 static constexpr WaypointNode Path[] =
647 {
648 { 0, 1113.635f, 7214.023f, 7.808200f },
649 { 1, 1110.443f, 7213.999f, 17.28479f },
650 { 2, 1108.583f, 7213.984f, 22.80371f },
651 { 3, 1103.488f, 7221.702f, 70.68047f },
652 { 4, 1101.911f, 7222.535f, 82.51234f },
653 { 5, 1098.861f, 7222.271f, 90.03111f },
654 { 6, 1095.129f, 7223.033f, 94.15130f },
655 { 7, 1089.240f, 7223.335f, 97.94925f },
656 { 8, 1077.932f, 7222.822f, 110.2143f },
657 { 9, 1068.802f, 7223.216f, 110.2143f },
658 { 10, 1045.356f, 7224.674f, 114.5371f },
659 { 11, 1023.946f, 7224.304f, 120.0150f },
660 { 12, 1002.535f, 7224.943f, 121.1011f },
661 { 13, 911.7552f, 7227.165f, 121.7384f },
662 { 14, 879.1285f, 7227.272f, 121.7384f },
663 { 15, 830.8785f, 7233.613f, 121.7384f },
664 { 16, 809.5052f, 7267.270f, 121.7384f },
665 { 17, 795.2899f, 7311.849f, 121.7384f }
666 };
667
668 std::span<WaypointNode const> GetPath() const override { return Path; }
669};
670
672{
674
675 static constexpr WaypointNode Path[] =
676 {
677 { 0, 1133.929f, 7223.167f, 38.90330f },
678 { 1, 1124.510f, 7222.310f, 42.15336f },
679 { 2, 1119.903f, 7221.891f, 43.74335f },
680 { 3, 1103.934f, 7227.212f, 69.99904f },
681 { 4, 1097.554f, 7226.132f, 89.09371f },
682 { 5, 1092.602f, 7224.059f, 101.1545f },
683 { 6, 1078.701f, 7228.348f, 109.5599f },
684 { 7, 1068.967f, 7232.247f, 116.7876f },
685 { 8, 1053.540f, 7229.623f, 117.8927f },
686 { 9, 1044.104f, 7242.757f, 118.7891f },
687 { 10, 1031.111f, 7256.717f, 118.7891f },
688 { 11, 1029.684f, 7288.019f, 126.3048f },
689 { 12, 1029.889f, 7325.333f, 126.3061f },
690 { 13, 1039.043f, 7365.176f, 133.2310f }
691 };
692
693 std::span<WaypointNode const> GetPath() const override { return Path; }
694};
695
697{
699
700 static constexpr WaypointNode Path[] =
701 {
702 { 0, 914.8663f, 7204.922f, 128.1687f },
703 { 1, 945.4445f, 7216.170f, 128.1687f },
704 { 2, 987.2483f, 7220.554f, 125.4318f },
705 { 3, 1015.882f, 7222.849f, 126.0546f },
706 { 4, 1053.023f, 7224.076f, 119.6729f },
707 { 5, 1071.891f, 7222.934f, 108.9545f },
708 { 6, 1081.530f, 7224.331f, 98.63076f }
709 };
710
711 std::span<WaypointNode const> GetPath() const override { return Path; }
712};
713
715{
717
718 static constexpr WaypointNode Path[] =
719 {
720 { 0, 1038.141f, 7134.033f, 105.8965f },
721 { 1, 1033.373f, 7134.492f, 105.8965f },
722 { 2, 1027.882f, 7136.373f, 105.8965f },
723 { 3, 1026.943f, 7144.288f, 105.8965f },
724 { 4, 1027.608f, 7167.030f, 108.4167f },
725 { 5, 1027.767f, 7180.922f, 108.4167f },
726 { 6, 1028.484f, 7197.977f, 108.4167f },
727 { 7, 1034.113f, 7207.747f, 108.4167f },
728 { 8, 1041.977f, 7216.452f, 108.4167f },
729 { 9, 1054.269f, 7223.207f, 108.4167f },
730 { 10, 1075.891f, 7224.811f, 101.7954f },
731 { 11, 1082.438f, 7224.540f, 99.12900f }
732 };
733
734 std::span<WaypointNode const> GetPath() const override { return Path; }
735};
736
738{
740
741 static constexpr WaypointNode Path[] =
742 {
743 { 0, 1112.011f, 7233.799f, 45.87240f },
744 { 1, 1107.887f, 7234.073f, 54.97818f },
745 { 2, 1106.264f, 7234.181f, 58.56218f },
746 { 3, 1099.969f, 7236.397f, 75.87664f },
747 { 4, 1096.552f, 7233.196f, 85.53920f },
748 { 5, 1095.531f, 7229.387f, 89.86687f },
749 { 6, 1092.981f, 7225.366f, 97.69602f },
750 { 7, 1082.800f, 7221.249f, 109.4660f },
751 { 8, 1070.983f, 7218.749f, 112.6827f },
752 { 9, 1057.455f, 7216.709f, 112.6827f },
753 { 10, 1051.859f, 7210.338f, 112.6827f },
754 { 11, 1042.427f, 7200.762f, 112.6827f },
755 { 12, 1032.616f, 7183.982f, 112.6827f },
756 { 13, 1027.792f, 7157.764f, 112.6827f },
757 { 14, 1026.870f, 7126.981f, 112.6827f },
758 { 15, 1053.083f, 7102.808f, 125.9283f },
759 { 16, 1055.122f, 7059.807f, 130.4395f }
760 };
761
762 std::span<WaypointNode const> GetPath() const override { return Path; }
763};
764
766{
768
769 static constexpr WaypointNode Path[] =
770 {
771 { 0, 1064.076f, 7305.979f, 117.5428f },
772 { 1, 1058.290f, 7305.543f, 117.5428f },
773 { 2, 1046.578f, 7305.583f, 117.5428f },
774 { 3, 1034.373f, 7295.979f, 117.5428f },
775 { 4, 1026.639f, 7275.582f, 114.1900f },
776 { 5, 1030.729f, 7251.381f, 114.1900f },
777 { 6, 1040.950f, 7237.213f, 114.1900f },
778 { 7, 1057.274f, 7229.228f, 114.1900f },
779 { 8, 1070.297f, 7226.421f, 111.7502f },
780 { 9, 1082.146f, 7225.846f, 101.0798f }
781 };
782
783 std::span<WaypointNode const> GetPath() const override { return Path; }
784};
785
787{
790
791 void UpdateAI(uint32 diff) override
792 {
793 _scheduler.Update(diff);
794 }
795
796 void Reset() override
797 {
798 _scheduler.Schedule(15s, 20s, [this](TaskContext& context)
799 {
800 me->SetAIAnimKitId(0);
801 std::pair<uint32, uint32> weapons = Trinity::Containers::SelectRandomContainerElement(_randomWeapons);
802 me->SetVirtualItem(0, weapons.first);
803 me->SetVirtualItem(1, weapons.second);
804
805 context.Schedule(8s, 10s, [this](TaskContext& context)
806 {
807 me->SetVirtualItem(0, 0);
808 me->SetVirtualItem(1, 0);
809 context.Schedule(10s, [this](TaskContext const& /*context*/)
810 {
811 me->SetAIAnimKitId(1583);
812 });
813 });
814
815 context.Repeat(30s);
816 });
817 }
818
819private:
821 std::unordered_set<std::pair<uint32, uint32>> _randomWeapons;
822};
823
825{
826public:
827 scene_odyn_intro() : SceneScript("scene_odyn_intro") { }
828
829 void OnSceneStart(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
830 {
833 player->SetControlled(true, UNIT_STATE_ROOT);
834 }
835
836 // Called when a scene is canceled
837 void OnSceneCancel(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
838 {
839 Finish(player);
840 }
841
842 // Called when a scene is completed
843 void OnSceneComplete(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
844 {
845 Finish(player);
846 }
847
848 void Finish(Player* player)
849 {
851 player->SetControlled(false, UNIT_STATE_ROOT);
853 }
854};
855
#define M_PI
Definition Common.h:118
uint32_t uint32
Definition Define.h:154
@ EFFECT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
@ EMOTE_ONESHOT_CHEER_NO_SHEATHE
@ EMOTE_ONESHOT_LAUGH_NO_SHEATHE
@ EMOTE_ONESHOT_NO
@ EMOTE_ONESHOT_POINT
@ EMOTE_ONESHOT_LAUGH
@ EMOTE_ONESHOT_ROAR
@ EMOTE_ONESHOT_SALUTE
@ EMOTE_ONESHOT_EAT_NO_SHEATHE
@ EMOTE_ONESHOT_SHOUT
@ EMOTE_ONESHOT_TALK
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_STATE_ROOT
Definition Unit.h:271
Creatures
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
static void AddPhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
static void RemovePhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition Player.cpp:16679
TaskContext & Schedule(TaskScheduler::duration_t time, TaskScheduler::task_handler_t task)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Definition Unit.h:635
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
Definition Unit.cpp:14374
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11545
void PlayOneShotAnimKitId(uint16 animKitId)
Definition Unit.cpp:11160
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:998
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
void SetAIAnimKitId(uint16 animKitId)
Definition Unit.cpp:11174
TempSummon * SummonPersonalClone(Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, Player *privateObjectOwner=nullptr)
Definition Object.cpp:1421
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Position GetFirstCollisionPosition(float dist, float angle)
Definition Object.cpp:2762
void Finish(Player *player)
void OnSceneComplete(Player *player, uint32, SceneTemplate const *) override
void OnSceneCancel(Player *player, uint32, SceneTemplate const *) override
void OnSceneStart(Player *player, uint32, SceneTemplate const *) override
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
void WaypointPathEnded(uint32, uint32 pathId) override
void UpdateAI(uint32 diff) override
void IsSummonedBy(WorldObject *summoner) override
void OnQuestAccept(Player *player, Quest const *) override
npc_danica_the_reclaimer(Creature *creature)
std::unordered_set< Emote > _randomEmotes
void UpdateAI(uint32 diff) override
npc_feasting_valarjar(Creature *creature)
void MovementInform(uint32, uint32 id) override
std::span< WaypointNode const > GetPathToDespawnPoint() const override
static constexpr WaypointNode IncommingValarjarAspirantPath03[]
static constexpr WaypointNode IncommingValarjarAspirantPath01[]
std::span< WaypointNode const > GetPathToOdyn() const override
std::span< WaypointNode const > GetPathToTable() const override
static constexpr WaypointNode IncommingValarjarAspirantPath02[]
static constexpr WaypointNode IncommingValarjarAspirantPath03[]
static constexpr WaypointNode IncommingValarjarAspirantPath02[6]
std::span< WaypointNode const > GetPathToDespawnPoint() const override
std::span< WaypointNode const > GetPathToOdyn() const override
static constexpr WaypointNode IncommingValarjarAspirantPath01[]
std::span< WaypointNode const > GetPathToTable() const override
npc_leaving_valarjar_1(Creature *creature)
std::span< WaypointNode const > GetPathToTable() const override
static constexpr WaypointNode PathLeavingValarjar01[]
std::span< WaypointNode const > GetPathToOdyn() const override
static constexpr WaypointNode PathLeavingValarjar02[]
static constexpr WaypointNode PathLeavingValarjar03[]
std::span< WaypointNode const > GetPathToDespawnPoint() const override
static constexpr WaypointNode PathLeavingValarjar03[]
std::span< WaypointNode const > GetPathToDespawnPoint() const override
npc_leaving_valarjar_2(Creature *creature)
static constexpr WaypointNode PathLeavingValarjar02[]
static constexpr WaypointNode PathLeavingValarjar01[]
std::span< WaypointNode const > GetPathToTable() const override
std::span< WaypointNode const > GetPathToOdyn() const override
void MoveInLineOfSight(Unit *who) override
npc_odyn(Creature *creature)
void UpdateAI(uint32 diff) override
void MovementInform(uint32, uint32 id) override
std::unordered_set< Emote > _randomEmotes
npc_spectating_valarjar(Creature *creature)
virtual std::span< WaypointNode const > GetPathToTable() const =0
virtual std::span< WaypointNode const > GetPathToOdyn() const =0
virtual std::span< WaypointNode const > GetPathToDespawnPoint() const =0
void MovementInform(uint32, uint32 id) override
npc_valkyr_of_odyn_1(Creature *creature)
std::span< WaypointNode const > GetPath() const override
static constexpr WaypointNode Path[]
static constexpr WaypointNode Path[]
std::span< WaypointNode const > GetPath() const override
npc_valkyr_of_odyn_2(Creature *creature)
npc_valkyr_of_odyn_3(Creature *creature)
std::span< WaypointNode const > GetPath() const override
static constexpr WaypointNode Path[]
npc_valkyr_of_odyn_4(Creature *creature)
static constexpr WaypointNode Path[]
std::span< WaypointNode const > GetPath() const override
static constexpr WaypointNode Path[]
npc_valkyr_of_odyn_5(Creature *creature)
std::span< WaypointNode const > GetPath() const override
static constexpr WaypointNode Path[]
std::span< WaypointNode const > GetPath() const override
npc_valkyr_of_odyn_6(Creature *creature)
static constexpr WaypointNode Path[]
std::span< WaypointNode const > GetPath() const override
npc_valkyr_of_odyn_7(Creature *creature)
void UpdateAI(uint32 diff) override
virtual std::span< WaypointNode const > GetPath() const =0
void WaypointPathEnded(uint32, uint32 pathId) override
npc_valkyr_of_odyn(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
std::unordered_set< std::pair< uint32, uint32 > > _randomWeapons
npc_weapon_inspector_valarjar(Creature *creature)
void UpdateAI(uint32 diff) override
@ SPELL_CANCEL_COMPLETE_SCENE_WARRIOR_ORDER_FORMATION
@ SPELL_WARRIOR_ORDER_FORMATION_SCENE
@ NPC_DANICA_THE_RECLAIMER
@ NPC_KILL_CREDIT_FOLLOWED_DANICA
@ NPC_KILL_CREDIT_ARRIVED_AT_ODYN
void AddSC_orderhall_warrior()
@ QUEST_ODYN_AND_THE_VALARJAR
@ ITEM_MONSTER_ITEM_MUTTON_WITH_BITE
@ ITEM_MONSTER_ITEM_TANKARD_WOODEN