Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
chapter1.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 "Vehicle.h"
10#include "ObjectMgr.h"
11#include "ScriptedEscortAI.h"
12#include "CombatAI.h"
13#include "PassiveAI.h"
14#include "Player.h"
15#include "SpellInfo.h"
16#include "SpellScript.h"
17#include "CreatureTextMgr.h"
18
19/*######
20##Quest 12848
21######*/
22
23#define GCD_CAST 1
24
44
53
55{
56 191577,
57 191580,
58 191581,
59 191582,
60 191583,
61 191584,
62 191585,
63 191586,
64 191587,
65 191588,
66 191589,
67 191590
68};
69
71{
72 29519,
73 29520,
74 29565,
75 29566,
76 29567
77};
78
80{
81public:
82 npc_unworthy_initiate() : CreatureScript("npc_unworthy_initiate") { }
83
85 {
86 return new npc_unworthy_initiateAI(creature);
87 }
88
90 {
92 {
93 me->SetReactState(REACT_PASSIVE);
94 if (!me->GetCurrentEquipmentId())
95 me->SetCurrentEquipmentId(me->GetOriginalEquipmentId());
96 }
97
103
105
107 {
108 anchorGUID = 0;
110 events.Reset();
111 me->setFaction(7);
113 me->SetUInt32Value(UNIT_FIELD_ANIM_TIER, 8);
114 me->LoadEquipment(0, true);
115 }
116
117 void EnterCombat(Unit* /*who*/) OVERRIDE
118 {
119 events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST);
120 events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST);
121 events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST);
122 events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST);
123 }
124
126 {
127 if (type != POINT_MOTION_TYPE)
128 return;
129
130 if (id == 1)
131 {
132 wait_timer = 5000;
133 me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true);
134
137
139 }
140 }
141
142 void EventStart(Creature* anchor, Player* target)
143 {
144 wait_timer = 5000;
146
147 me->SetUInt32Value(UNIT_FIELD_ANIM_TIER, 0);
148 me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF);
149 me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN);
150
151 float z;
152 anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f);
153
154 playerGUID = target->GetGUID();
156 }
157
159 {
160 switch (phase)
161 {
162 case PHASE_CHAINED:
163 if (!anchorGUID)
164 {
165 if (Creature* anchor = me->FindNearestCreature(29521, 30))
166 {
167 anchor->AI()->SetGUID(me->GetGUID());
168 anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
169 anchorGUID = anchor->GetGUID();
170 }
171 else
172 SF_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find anchor!");
173
174 float dist = 99.0f;
175 GameObject* prison = NULL;
176
177 for (uint8 i = 0; i < 12; ++i)
178 {
179 if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i], 30))
180 {
181 if (me->IsWithinDist(temp_prison, dist, false))
182 {
183 dist = me->GetDistance2d(temp_prison);
184 prison = temp_prison;
185 }
186 }
187 }
188
189 if (prison)
190 prison->ResetDoorOrButton();
191 else
192 SF_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find prison!");
193 }
194 break;
195 case PHASE_TO_EQUIP:
196 if (wait_timer)
197 {
198 if (wait_timer > diff)
199 wait_timer -= diff;
200 else
201 {
202 me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ());
203 //SF_LOG_DEBUG("scripts", "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ());
205 wait_timer = 0;
206 }
207 }
208 break;
209 case PHASE_TO_ATTACK:
210 if (wait_timer)
211 {
212 if (wait_timer > diff)
213 wait_timer -= diff;
214 else
215 {
216 me->setFaction(14);
219
221 AttackStart(target);
222 wait_timer = 0;
223 }
224 }
225 break;
226 case PHASE_ATTACKING:
227 if (!UpdateVictim())
228 return;
229
230 events.Update(diff);
231
232 while (uint32 eventId = events.ExecuteEvent())
233 {
234 switch (eventId)
235 {
236 case EVENT_ICY_TOUCH:
238 events.DelayEvents(1000, GCD_CAST);
239 events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST);
240 break;
243 events.DelayEvents(1000, GCD_CAST);
244 events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 5000, GCD_CAST);
245 break;
248 events.DelayEvents(1000, GCD_CAST);
249 events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST);
250 break;
251 case EVENT_DEATH_COIL:
253 events.DelayEvents(1000, GCD_CAST);
254 events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST);
255 break;
256 }
257 }
258
260 break;
261 default:
262 break;
263 }
264 }
265 };
266};
267
269{
270public:
271 npc_unworthy_initiate_anchor() : CreatureScript("npc_unworthy_initiate_anchor") { }
272
274 {
275 return new npc_unworthy_initiate_anchorAI(creature);
276 }
277
279 {
281
283
284 void SetGUID(uint64 guid, int32 /*id*/) OVERRIDE
285 {
286 if (!prisonerGUID)
287 prisonerGUID = guid;
288 }
289
291 {
292 return prisonerGUID;
293 }
294 };
295};
296
298{
299public:
300 go_acherus_soul_prison() : GameObjectScript("go_acherus_soul_prison") { }
301
303 {
304 if (Creature* anchor = go->FindNearestCreature(29521, 15))
305 if (uint64 prisonerGUID = anchor->AI()->GetGUID())
306 if (Creature* prisoner = Creature::GetCreature(*player, prisonerGUID))
307 CAST_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, player);
308
309 return false;
310 }
311};
312
313/*######
314## npc_death_knight_initiate
315######*/
316
317#define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!"
318
320{
321 SPELL_DUEL = 52996,
322 //SPELL_DUEL_TRIGGERED = 52990,
325};
326
328{
330};
331
337
339{
340public:
341 npc_death_knight_initiate() : CreatureScript("npc_death_knight_initiate") { }
342
343 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
344 {
345 player->PlayerTalkClass->ClearMenus();
346 if (action == GOSSIP_ACTION_INFO_DEF)
347 {
348 player->CLOSE_GOSSIP_MENU();
349
350 if (player->IsInCombat() || creature->IsInCombat())
351 return true;
352
354 {
355 if (pInitiateAI->m_bIsDuelInProgress)
356 return true;
357 }
358
359 creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
360 creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15);
361
363
364 player->CastSpell(creature, SPELL_DUEL, false);
365 player->CastSpell(player, SPELL_DUEL_FLAG, true);
366 }
367 return true;
368 }
369
370 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
371 {
372 if (player->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && creature->IsFullHealth())
373 {
374 if (player->HealthBelowPct(10))
375 return true;
376
377 if (player->IsInCombat() || creature->IsInCombat())
378 return true;
379
381 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
382 }
383 return true;
384 }
385
387 {
388 return new npc_death_knight_initiateAI(creature);
389 }
390
392 {
394 {
395 m_bIsDuelInProgress = false;
396 }
397
398 bool lose;
402
404 {
405 lose = false;
406 me->RestoreFaction();
408
410
411 m_uiDuelerGUID = 0;
412 m_uiDuelTimer = 5000;
413 m_bIsDuelInProgress = false;
414 }
415
416 void SpellHit(Unit* pCaster, const SpellInfo* pSpell) OVERRIDE
417 {
418 if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)
419 {
420 m_uiDuelerGUID = pCaster->GetGUID();
421 m_bIsDuelInProgress = true;
422 }
423 }
424
425 void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) OVERRIDE
426 {
427 if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer())
428 {
429 if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help
430 uiDamage = 0;
431 else if (uiDamage >= me->GetHealth())
432 {
433 uiDamage = 0;
434
435 if (!lose)
436 {
437 pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true);
438 pDoneBy->AttackStop();
439 me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true);
440 lose = true;
441 me->CastSpell(me, 7267, true);
442 me->RestoreFaction();
443 }
444 }
445 }
446 }
447
449 {
450 if (!UpdateVictim())
451 {
453 {
454 if (m_uiDuelTimer <= uiDiff)
455 {
456 me->setFaction(FACTION_HOSTILE);
457
458 if (Unit* unit = Unit::GetUnit(*me, m_uiDuelerGUID))
459 AttackStart(unit);
460 }
461 else
462 m_uiDuelTimer -= uiDiff;
463 }
464 return;
465 }
466
468 {
469 if (lose)
470 {
471 if (!me->HasAura(7267))
473 return;
474 }
475 else if (me->GetVictim()->GetTypeId() == TypeID::TYPEID_PLAYER && me->GetVictim()->HealthBelowPct(10))
476 {
477 me->GetVictim()->CastSpell(me->GetVictim(), 7267, true); // beg
478 me->GetVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);
480 return;
481 }
482 }
483
485
486 CombatAI::UpdateAI(uiDiff);
487 }
488 };
489};
490
491/*######
492## npc_dark_rider_of_acherus
493######*/
494
500
502{
503 public:
504 npc_dark_rider_of_acherus() : CreatureScript("npc_dark_rider_of_acherus") { }
505
507 {
509
511 {
512 PhaseTimer = 4000;
513 Phase = 0;
514 Intro = false;
515 TargetGUID = 0;
516 }
517
519 {
520 if (!Intro || !TargetGUID)
521 return;
522
523 if (PhaseTimer <= diff)
524 {
525 switch (Phase)
526 {
527 case 0:
529 PhaseTimer = 5000;
530 Phase = 1;
531 break;
532 case 1:
533 if (Unit* target = ObjectAccessor::GetUnit(*me, TargetGUID))
534 DoCast(target, SPELL_DESPAWN_HORSE, true);
535 PhaseTimer = 3000;
536 Phase = 2;
537 break;
538 case 2:
539 me->SetVisible(false);
540 PhaseTimer = 2000;
541 Phase = 3;
542 break;
543 case 3:
544 me->DespawnOrUnsummon();
545 break;
546 default:
547 break;
548 }
549 }
550 else
551 PhaseTimer -= diff;
552 }
553
555 {
556 if (!who)
557 return;
558
559 TargetGUID = who->GetGUID();
560 me->SetWalk(true);
561 me->SetSpeed(MOVE_RUN, 0.4f);
562 me->GetMotionMaster()->MoveChase(who);
563 me->SetTarget(TargetGUID);
564 Intro = true;
565 }
566
567 private:
570 bool Intro;
572 };
573
575 {
576 return new npc_dark_rider_of_acherusAI(creature);
577 }
578};
579
580/*######
581## npc_salanar_the_horseman
582######*/
583
592
594{
595public:
596 npc_salanar_the_horseman() : CreatureScript("npc_salanar_the_horseman") { }
597
599 {
600 return new npc_salanar_the_horsemanAI(creature);
601 }
602
604 {
606
607 void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE
608 {
609 if (spell->Id == SPELL_DELIVER_STOLEN_HORSE)
610 {
611 if (caster->GetTypeId() == TypeID::TYPEID_UNIT && caster->IsVehicle())
612 {
613 if (Unit* charmer = caster->GetCharmer())
614 {
615 if (charmer->HasAura(SPELL_EFFECT_STOLEN_HORSE))
616 {
617 charmer->RemoveAurasDueToSpell(SPELL_EFFECT_STOLEN_HORSE);
619 caster->setFaction(35);
620 DoCast(caster, SPELL_CALL_DARK_RIDER, true);
621 if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15))
622 CAST_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster);
623 }
624 }
625 }
626 }
627 }
628
630 {
632
633 if (who->GetTypeId() == TypeID::TYPEID_UNIT && who->IsVehicle() && me->IsWithinDistInMap(who, 5.0f))
634 {
635 if (Unit* charmer = who->GetCharmer())
636 {
637 if (Player* player = charmer->ToPlayer())
638 {
639 // for quest Into the Realm of Shadows(12687)
640 if (me->GetEntry() == 28788 && player->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE)
641 {
642 player->GroupEventHappens(12687, me);
643 charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE);
644 if (Creature* creature = who->ToCreature())
645 {
646 creature->DespawnOrUnsummon();
647 //creature->Respawn(true);
648 }
649 }
650
651 if (player->HasAura(SPELL_REALM_OF_SHADOWS))
652 player->RemoveAurasDueToSpell(SPELL_REALM_OF_SHADOWS);
653 }
654 }
655 }
656 }
657 };
658};
659
660/*######
661## npc_ros_dark_rider
662######*/
663
665{
666public:
667 npc_ros_dark_rider() : CreatureScript("npc_ros_dark_rider") { }
668
670 {
671 return new npc_ros_dark_riderAI(creature);
672 }
673
675 {
676 npc_ros_dark_riderAI(Creature* creature) : ScriptedAI(creature) { }
677
678 void EnterCombat(Unit* /*who*/) OVERRIDE
679 {
680 me->ExitVehicle();
681 }
682
684 {
685 Creature* deathcharger = me->FindNearestCreature(28782, 30);
686 if (!deathcharger)
687 return;
688
689 deathcharger->RestoreFaction();
692 if (!me->GetVehicle() && deathcharger->IsVehicle() && deathcharger->GetVehicleKit()->HasEmptySeat(0))
693 me->EnterVehicle(deathcharger);
694 }
695
696 void JustDied(Unit* killer) OVERRIDE
697 {
698 Creature* deathcharger = me->FindNearestCreature(28782, 30);
699 if (!deathcharger)
700 return;
701
702 if (killer->GetTypeId() == TypeID::TYPEID_PLAYER && deathcharger->GetTypeId() == TypeID::TYPEID_UNIT && deathcharger->IsVehicle())
703 {
706 deathcharger->setFaction(2096);
707 }
708 }
709 };
710};
711
712// correct way: 52312 52314 52555 ...
714{
715 NPC_GHOULS = 28845,
716 NPC_GHOSTS = 28846,
717};
719{
720public:
721 npc_dkc1_gothik() : CreatureScript("npc_dkc1_gothik") { }
722
724 {
725 return new npc_dkc1_gothikAI(creature);
726 }
727
729 {
730 npc_dkc1_gothikAI(Creature* creature) : ScriptedAI(creature) { }
731
733
734 {
736
737 if (who->GetEntry() == NPC_GHOULS && me->IsWithinDistInMap(who, 10.0f))
738 {
739 if (Unit* owner = who->GetOwner())
740 {
741 if (Player* player = owner->ToPlayer())
742 {
743 Creature* creature = who->ToCreature();
744 if (player->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE)
745 creature->CastSpell(owner, 52517, true);
746
748 // stand next to Gothik and be commanded into the pit
749 // and dig into the ground.
750 creature->DespawnOrUnsummon();
751
752 if (player->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
753 owner->RemoveAllMinionsByEntry(NPC_GHOSTS);
754 }
755 }
756 }
757 }
758 };
759};
760
762{
763public:
764 npc_scarlet_ghoul() : CreatureScript("npc_scarlet_ghoul") { }
765
767 {
768 return new npc_scarlet_ghoulAI(creature);
769 }
770
772 {
774 {
775 // Ghouls should display their Birth Animation
776 // Crawling out of the ground
777 //DoCast(me, 35177, true);
778 //me->MonsterSay("Mommy?", LANG_UNIVERSAL, 0);
779 me->SetReactState(REACT_DEFENSIVE);
780 }
781
782 void FindMinions(Unit* owner)
783 {
784 std::list<Creature*> MinionList;
785 owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS);
786
787 if (!MinionList.empty())
788 {
789 for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr)
790 {
791 if ((*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID())
792 {
793 if ((*itr)->IsInCombat() && (*itr)->getAttackerForHelper())
794 {
795 AttackStart((*itr)->getAttackerForHelper());
796 }
797 }
798 }
799 }
800 }
801
802 void UpdateAI(uint32 /*diff*/) OVERRIDE
803 {
804 if (!me->IsInCombat())
805 {
806 if (Unit* owner = me->GetOwner())
807 {
808 Player* plrOwner = owner->ToPlayer();
809 if (plrOwner && plrOwner->IsInCombat())
810 {
811 if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == NPC_GHOSTS)
813 else
814 FindMinions(owner);
815 }
816 }
817 }
818
819 if (!UpdateVictim())
820 return;
821
822 //ScriptedAI::UpdateAI(diff);
823 //Check if we have a current target
824 if (me->GetVictim()->GetEntry() == NPC_GHOSTS)
825 {
826 if (me->isAttackReady())
827 {
828 //If we are within range melee the target
829 if (me->IsWithinMeleeRange(me->GetVictim()))
830 {
831 me->AttackerStateUpdate(me->GetVictim());
832 me->resetAttackTimer();
833 }
834 }
835 }
836 }
837 };
838};
839
840/*####
841## npc_scarlet_miner_cart
842####*/
843
853
855{
856 public:
857 npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { }
858
860 {
862 {
864 me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
865 }
866
868 {
869 if (summon->GetEntry() == NPC_MINER)
870 {
871 _minerGUID = summon->GetGUID();
872 summon->AI()->SetGUID(_playerGUID);
873 }
874 }
875
877 {
878 if (summon->GetEntry() == NPC_MINER)
879 _minerGUID = 0;
880 }
881
882 void DoAction(int32 /*param*/) OVERRIDE
883 {
885 {
886 me->SetWalk(false);
887
888 // Not 100% correct, but movement is smooth. Sometimes miner walks faster
889 // than normal, this speed is fast enough to keep up at those times.
890 me->SetSpeed(MOVE_RUN, 1.25f);
891
892 me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0);
893 }
894 }
895
896 void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) OVERRIDE
897 {
898 if (apply)
899 {
900 _playerGUID = who->GetGUID();
901 me->CastSpell((Unit*)NULL, SPELL_SUMMON_MINER, true);
902 }
903 else
904 {
905 _playerGUID = 0;
907 miner->DespawnOrUnsummon();
908 }
909 }
910
911 private:
914 };
915
917 {
918 return new npc_scarlet_miner_cartAI(creature);
919 }
920};
921
922/*####
923## npc_scarlet_miner
924####*/
925
931
933{
934 public:
935 npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { }
936
938 {
940 {
941 me->SetReactState(REACT_PASSIVE);
942 }
943
947
949 {
950 carGUID = 0;
951 IntroTimer = 0;
952 IntroPhase = 0;
953 }
954
955 void IsSummonedBy(Unit* summoner) OVERRIDE
956 {
957 carGUID = summoner->GetGUID();
958 }
959
961 {
962 AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000);
963 AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f);
964 AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f);
965 AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f);
966 AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f);
967 AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f);
968 AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f);
969 AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f);
970 AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f);
971 AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f);
972 AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f);
973 AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f);
974
975 if (std::rand() % 1)
976 {
977 AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f);
978 AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f);
979 AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f);
980 AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f);
981 AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000);
982 }
983 else
984 {
985 AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f);
986 AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f);
987 AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f);
988 AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f);
989 AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000);
990 }
991 }
992
993 void SetGUID(uint64 guid, int32 /*id = 0*/) OVERRIDE
994 {
995 InitWaypoint();
996 Start(false, false, guid);
997 SetDespawnAtFar(false);
998 }
999
1001 {
1002 switch (waypointId)
1003 {
1004 case 1:
1006 me->SetFacingToObject(car);
1008 SetRun(true);
1009 IntroTimer = 4000;
1010 IntroPhase = 1;
1011 break;
1012 case 17:
1014 {
1015 me->SetFacingToObject(car);
1016 car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1);
1017 car->StopMoving();
1018 car->RemoveAura(SPELL_CART_DRAG);
1019 }
1021 break;
1022 default:
1023 break;
1024 }
1025 }
1026
1028 {
1029 if (IntroPhase)
1030 {
1031 if (IntroTimer <= diff)
1032 {
1033 if (IntroPhase == 1)
1034 {
1035 if (Creature* car = Unit::GetCreature(*me, carGUID))
1036 DoCast(car, SPELL_CART_DRAG);
1037 IntroTimer = 800;
1038 IntroPhase = 2;
1039 }
1040 else
1041 {
1042 if (Creature* car = Unit::GetCreature(*me, carGUID))
1043 car->AI()->DoAction(0);
1044 IntroPhase = 0;
1045 }
1046 }
1047 else
1048 IntroTimer -= diff;
1049 }
1051 }
1052 };
1053
1055 {
1056 return new npc_scarlet_minerAI(creature);
1057 }
1058};
1059
1078
1080{
1081public:
1082 npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { }
1083
1084 CreatureAI* GetAI(Creature* creature) const override
1085 {
1086 return new npc_eye_of_acherusAI(creature);
1087 }
1088
1090 {
1092 {
1093 creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid1);
1094
1095 if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
1096 me->GetCharmInfo()->InitPossessCreateSpells();
1097
1098 creature->SetReactState(REACT_PASSIVE);
1099 }
1100
1102
1104 {
1105 events.Reset();
1106 events.ScheduleEvent(EVENT_REMOVE_CONTROL, 500);
1107 events.ScheduleEvent(EVENT_SPEAK_1, 4000);
1108 events.ScheduleEvent(EVENT_LAUNCH, 7000);
1109
1112 }
1113
1114 void OnCharmed(bool apply) OVERRIDE
1115 {
1116 if (!apply)
1117 {
1118 me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_THE_EYE_OF_ACHERUS);
1119 me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_EYE_FLIGHT_BOOST);
1120 }
1121 }
1122
1124 {
1125 if (type == POINT_MOTION_TYPE && point == EYE_POINT_DESTINATION_2)
1126 events.ScheduleEvent(EVENT_REGAIN_CONTROL, 1000);
1127 }
1128
1130 {
1131 if (Unit* target = creature->SelectNearbyTarget())
1132 creature->AI()->AttackStart(target);
1133 }
1134
1136 {
1137 events.Update(diff);
1138 switch (events.ExecuteEvent())
1139 {
1142 if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself())
1143 {
1145 player->SetClientControl(me, 0);
1146 }
1147 break;
1148 case EVENT_SPEAK_1:
1149 Talk(EYE_TEXT_LAUNCH, me->GetCharmerOrOwner());
1150 break;
1151 case EVENT_LAUNCH:
1152 {
1153 me->SetSpeed(MOVE_FLIGHT, 5.0f, true);
1154
1155 const Position EYE_DESTINATION_1 = { me->GetPositionX() - 40.0f, me->GetPositionY(), me->GetPositionZ() + 10.0f, 0.0f };
1156 const Position EYE_DESTINATION_2 = { 1768.0f, -5876.0f, 153.0f, 0.0f };
1157
1158 me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_1, EYE_DESTINATION_1);
1159 me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_2, EYE_DESTINATION_2);
1160 break;
1161 }
1163 if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself())
1164 {
1166 me->SetSpeed(MOVE_FLIGHT, 3.3f, true);
1167
1168 me->RemoveAurasDueToSpell(SPELL_EYE_FLIGHT_BOOST);
1169 player->SetClientControl(me, 1);
1170 Talk(EYE_TEXT_CONTROL, player);
1173 }
1174 break;
1175 }
1176 }
1177 };
1178};
1179
1207
1208// npc 28912 quest 17217 boss 29001 mob 29007 go 191092
1209
#define sCreatureTextMgr
@ TEXT_RANGE_NORMAL
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::int8_t int8
Definition Define.h:75
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
#define SPELL_DUEL
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_UNIT
Definition Object.h:54
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
@ QUEST_STATUS_COMPLETE
Definition QuestDef.h:87
#define CAST_AI(a, b)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TEAM_OTHER
#define SpellEffectFn(F, I, N)
@ UNIT_NPC_FLAG_SPELLCLICK
Definition Unit.h:711
@ UNIT_NPC_FLAG_PLAYER_VEHICLE
Definition Unit.h:712
@ MOVE_FLIGHT
Definition Unit.h:561
@ MOVE_RUN
Definition Unit.h:556
@ REACT_DEFENSIVE
Definition Unit.h:1157
@ REACT_PASSIVE
Definition Unit.h:1156
@ UNIT_FLAG_STUNNED
Definition Unit.h:643
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition Unit.h:634
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ UNIT_FLAG_UNK_15
Definition Unit.h:640
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_ANIM_TIER
@ UNIT_FIELD_FLAGS
@ FACTION_HOSTILE
Says_SM
Definition chapter1.cpp:927
@ SAY_SCARLET_MINER_1
Definition chapter1.cpp:929
@ SAY_SCARLET_MINER_0
Definition chapter1.cpp:928
Creatures_SG
Definition chapter1.cpp:714
@ NPC_GHOSTS
Definition chapter1.cpp:716
@ NPC_GHOULS
Definition chapter1.cpp:715
Spells_Salanar
Definition chapter1.cpp:585
@ SPELL_EFFECT_STOLEN_HORSE
Definition chapter1.cpp:587
@ SPELL_REALM_OF_SHADOWS
Definition chapter1.cpp:586
@ SPELL_DELIVER_STOLEN_HORSE
Definition chapter1.cpp:588
@ SPELL_CALL_DARK_RIDER
Definition chapter1.cpp:589
@ SPELL_EFFECT_OVERTAKE
Definition chapter1.cpp:590
Says_VBM
Definition chapter1.cpp:328
@ SAY_DUEL
Definition chapter1.cpp:329
#define GCD_CAST
Definition chapter1.cpp:23
void AddSC_the_scarlet_enclave_c1()
Misc_VBN
Definition chapter1.cpp:333
@ QUEST_DEATH_CHALLENGE
Definition chapter1.cpp:334
@ FACTION_HOSTILE
Definition chapter1.cpp:335
Spells_DKI
Definition chapter1.cpp:320
@ SPELL_DUEL_FLAG
Definition chapter1.cpp:324
@ SPELL_DUEL
Definition chapter1.cpp:321
@ SPELL_DUEL_VICTORY
Definition chapter1.cpp:323
eyeOfAcherus
@ EYE_POINT_DESTINATION_2
@ EYE_TEXT_LAUNCH
@ EVENT_REGAIN_CONTROL
@ SPELL_THE_EYE_OF_ACHERUS
@ SPELL_EYE_FLIGHT
@ EVENT_LAUNCH
@ EYE_POINT_DESTINATION_1
@ EVENT_REMOVE_CONTROL
@ EVENT_SPEAK_1
@ EYE_TEXT_CONTROL
@ SPELL_EYE_VISUAL
@ SPELL_EYE_FLIGHT_BOOST
UnworthyInitiatePhase
Definition chapter1.cpp:46
@ PHASE_TO_ATTACK
Definition chapter1.cpp:50
@ PHASE_EQUIPING
Definition chapter1.cpp:49
@ PHASE_TO_EQUIP
Definition chapter1.cpp:48
@ PHASE_CHAINED
Definition chapter1.cpp:47
@ PHASE_ATTACKING
Definition chapter1.cpp:51
#define GOSSIP_ACCEPT_DUEL
Definition chapter1.cpp:317
uint32 acherus_soul_prison[12]
Definition chapter1.cpp:54
uint32 acherus_unworthy_initiate[5]
Definition chapter1.cpp:70
DarkRiderOfAcherus
Definition chapter1.cpp:496
@ SAY_DARK_RIDER
Definition chapter1.cpp:497
@ SPELL_DESPAWN_HORSE
Definition chapter1.cpp:498
UnworthyInitiate
Definition chapter1.cpp:26
@ SPELL_DEATH_COIL
Definition chapter1.cpp:34
@ SPELL_PLAGUE_STRIKE
Definition chapter1.cpp:32
@ EVENT_PLAGUE_STRIKE
Definition chapter1.cpp:40
@ SPELL_BLOOD_STRIKE
Definition chapter1.cpp:33
@ SAY_EVENT_START
Definition chapter1.cpp:36
@ SAY_EVENT_ATTACK
Definition chapter1.cpp:37
@ SPELL_DK_INITIATE_VISUAL
Definition chapter1.cpp:29
@ EVENT_ICY_TOUCH
Definition chapter1.cpp:39
@ EVENT_BLOOD_STRIKE
Definition chapter1.cpp:41
@ SPELL_ICY_TOUCH
Definition chapter1.cpp:31
@ SPELL_SOUL_PRISON_CHAIN
Definition chapter1.cpp:28
@ SPELL_SOUL_PRISON_CHAIN_SELF
Definition chapter1.cpp:27
@ EVENT_DEATH_COIL
Definition chapter1.cpp:42
ScarletMinerCart
Definition chapter1.cpp:845
@ NPC_MINER
Definition chapter1.cpp:851
@ SPELL_SUMMON_MINER
Definition chapter1.cpp:848
@ SPELL_SUMMON_CART
Definition chapter1.cpp:847
@ SPELL_CART_DRAG
Definition chapter1.cpp:849
@ SPELL_CART_CHECK
Definition chapter1.cpp:846
CombatAI(Creature *c)
Definition CombatAI.h:29
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition CombatAI.cpp:83
void Reset() OVERRIDE
Definition CombatAI.cpp:60
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:56
virtual void EnterEvadeMode()
void SetDisplayId(uint32 modelId) OVERRIDE
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
void SetReactState(ReactStates st)
Definition Creature.h:460
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:524
CreatureScript(const char *name)
void ResetDoorOrButton()
GameObjectScript(const char *name)
NullCreatureAI(Creature *c)
Definition PassiveAI.cpp:12
static Creature * GetCreature(WorldObject const &u, uint64 guid)
static Player * GetPlayer(WorldObject const &, uint64 guid)
static Unit * GetUnit(WorldObject const &, uint64 guid)
uint64 GetGUID() const
Definition Object.h:119
Player * ToPlayer()
Definition Object.h:204
TypeID GetTypeId() const
Definition Object.h:131
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
uint32 GetEntry() const
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:207
PassiveAI(Creature *c)
Definition PassiveAI.cpp:10
HookList< EffectHandler > OnEffectHitTarget
void PreventHitEffect(SpellEffIndex effIndex)
Unit * GetHitUnit()
Unit * GetCaster()
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:16
Definition Unit.h:1367
bool IsVehicle() const
Definition Unit.h:1523
void setFaction(uint32 faction)
Definition Unit.h:1699
Unit * SelectNearbyTarget(Unit *exclude=NULL, float dist=NOMINAL_MELEE_RANGE) const
Definition Unit.cpp:6043
Unit * GetOwner() const
Definition Unit.cpp:2339
void RestoreFaction()
Definition Unit.cpp:7135
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)
Unit * GetCharmer() const
Definition Unit.cpp:2348
Unit * getAttackerForHelper() const
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
Vehicle * GetVehicleKit() const
Definition Unit.h:2739
void GetAllMinionsByEntry(std::list< Creature * > &Minions, uint32 entry)
Definition Unit.cpp:2592
bool IsInCombat() const
Definition Unit.h:1896
bool HasEmptySeat(int8 seatId) const
Checks if vehicle's seat specified by 'seatId' is empty.
Definition Vehicle.cpp:285
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition Object.cpp:3094
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2801
bool OnGossipHello(Player *player, GameObject *go) OVERRIDE
Definition chapter1.cpp:302
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:574
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition chapter1.cpp:343
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition chapter1.cpp:370
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:386
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:723
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:669
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:598
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:766
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:916
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:273
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition chapter1.cpp:84
SpellScript * GetSpellScript() const OVERRIDE
uint32 Modelid1
Definition Creature.h:67
Creature * me
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition chapter1.cpp:518
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
Definition chapter1.cpp:448
void SpellHit(Unit *pCaster, const SpellInfo *pSpell) OVERRIDE
Definition chapter1.cpp:416
void DamageTaken(Unit *pDoneBy, uint32 &uiDamage) OVERRIDE
Definition chapter1.cpp:425
npc_dkc1_gothikAI(Creature *creature)
Definition chapter1.cpp:730
void MoveInLineOfSight(Unit *who) OVERRIDE
Definition chapter1.cpp:732
void SetDespawnAtFar(bool despawn)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetRun(bool on=true)
npc_escortAI(Creature *creature)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
void JustSummoned(Creature *creature) OVERRIDE
void OnCharmed(bool apply) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 type, uint32 point) OVERRIDE
void JustDied(Unit *killer) OVERRIDE
Definition chapter1.cpp:696
void SpellHit(Unit *caster, const SpellInfo *spell) OVERRIDE
Definition chapter1.cpp:607
npc_scarlet_ghoulAI(Creature *creature)
Definition chapter1.cpp:773
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
Definition chapter1.cpp:802
void SetGUID(uint64 guid, int32) OVERRIDE
Definition chapter1.cpp:993
npc_scarlet_minerAI(Creature *creature)
Definition chapter1.cpp:939
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void IsSummonedBy(Unit *summoner) OVERRIDE
Definition chapter1.cpp:955
void SummonedCreatureDespawn(Creature *summon) OVERRIDE
Definition chapter1.cpp:876
void PassengerBoarded(Unit *who, int8, bool apply) OVERRIDE
== Fields =======================================
Definition chapter1.cpp:896
void JustSummoned(Creature *summon) OVERRIDE
Definition chapter1.cpp:867
void EventStart(Creature *anchor, Player *target)
Definition chapter1.cpp:142
void MovementInform(uint32 type, uint32 id) OVERRIDE
Definition chapter1.cpp:125
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition chapter1.cpp:158