TrinityCore
Loading...
Searching...
No Matches
zone_storm_peaks.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "CombatAI.h"
20#include "DB2Stores.h"
21#include "GameObject.h"
22#include "MotionMaster.h"
23#include "ObjectAccessor.h"
24#include "ObjectMgr.h"
25#include "Player.h"
26#include "ScriptedEscortAI.h"
27#include "ScriptedGossip.h"
28#include "SpellAuraEffects.h"
29#include "SpellScript.h"
30#include "TemporarySummon.h"
31#include "Vehicle.h"
32#include "WorldSession.h"
33
34/*######
35## npc_brunnhildar_prisoner
36######*/
37
46
48{
50 {
51 Initialize();
52 }
53
55 {
56 freed = false;
57 }
58
59 bool freed;
60
61 void Reset() override
62 {
63 Initialize();
65 }
66
67 void JustAppeared() override
68 {
69 Reset();
70 }
71
72 void UpdateAI(uint32 /*diff*/) override
73 {
74 if (!freed)
75 return;
76
77 if (!me->GetVehicle())
79 }
80
81 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
82 {
83 Unit* unitCaster = caster->ToUnit();
84 if (!unitCaster)
85 return;
86
87 if (spellInfo->Id != SPELL_ICE_LANCE)
88 return;
89
90 if (unitCaster->GetVehicleKit()->GetAvailableSeatCount() != 0)
91 {
93 me->CastSpell(unitCaster, SPELL_RIDE_DRAKE, true);
95 freed = true;
96 }
97 }
98};
99
100/*######
101## npc_freed_protodrake
102######*/
103
119
121{
122 npc_freed_protodrake(Creature* creature) : VehicleAI(creature) { }
123
125
126 void Reset() override
127 {
129 }
130
131 void MovementInform(uint32 type, uint32 id) override
132 {
133 if (type != WAYPOINT_MOTION_TYPE)
134 return;
135
136 if (id == 15)
137 // drake reached village
139 }
140
141 void UpdateAI(uint32 diff) override
142 {
144 events.Update(diff);
145
146 switch (events.ExecuteEvent())
147 {
148 case EVENT_CHECK_AREA:
150 {
151 if (Vehicle* vehicle = me->GetVehicleKit())
152 if (Unit* passenger = vehicle->GetPassenger(0))
153 {
154 Talk(TEXT_EMOTE, passenger);
155 me->GetMotionMaster()->MovePath(NPC_DRAKE << 3, false);
156 }
157 }
158 else
160 break;
162 if (Vehicle* vehicle = me->GetVehicleKit())
163 if (Unit* player = vehicle->GetPassenger(0))
164 if (player->GetTypeId() == TYPEID_PLAYER)
165 {
166 // for each prisoner on drake, give credit
167 for (uint8 i = 1; i < 4; ++i)
168 if (Unit* prisoner = me->GetVehicleKit()->GetPassenger(i))
169 {
170 if (prisoner->GetTypeId() != TYPEID_UNIT)
171 return;
172 prisoner->CastSpell(player, SPELL_KILL_CREDIT_PRISONER, true);
173 prisoner->CastSpell(prisoner, SPELL_SUMMON_LIBERATED, true);
174 prisoner->ExitVehicle();
175 }
177 player->ExitVehicle();
178 }
179 break;
180 }
181 }
182};
183
184static constexpr uint32 PATH_ESCORT_ICEFANG = 236818;
185
186struct npc_icefang : public EscortAI
187{
188 npc_icefang(Creature* creature) : EscortAI(creature) { }
189
190 void AttackStart(Unit* /*who*/) override { }
191 void JustEngagedWith(Unit* /*who*/) override { }
192 void EnterEvadeMode(EvadeReason /*why*/) override { }
193
194 void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
195 {
196 if (who->GetTypeId() == TYPEID_PLAYER)
197 {
198 if (apply)
199 {
201 Start(false, who->GetGUID());
202 }
203 }
204 }
205
206 void JustDied(Unit* /*killer*/) override { }
207 void OnCharmed(bool /*isNew*/) override { }
208
209 void UpdateAI(uint32 diff) override
210 {
211 EscortAI::UpdateAI(diff);
212
213 if (!UpdateVictim())
214 return;
215 }
216};
217
219{
222
224{
225public:
227
228 void PassengerBoarded(Unit* who, int8 /*seat*/, bool apply) override
229 {
230 if (apply)
231 return;
232
235 }
236
237 void UpdateAI(uint32 diff) override
238 {
241 Vehicle* _vehicleKit = me->GetVehicleKit();
242 if (_accessoryRespawnTimer && _accessoryRespawnTimer <= diff && _vehicleKit)
243 {
244 _vehicleKit->InstallAllAccessories(true);
246 }
247 else
249 }
250
251private:
253};
254
255/*#####
256# npc_brann_bronzebeard for Quest 13285 "Forging the Keystone"
257#####*/
258
292
294{
296 {
297 objectCounter = 0;
298 }
299
300 void Reset() override
301 {
302 for (ObjectGuid& guid : objectGUID)
303 guid.Clear();
304
307 objectCounter = 0;
308 }
309
310 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
311 {
312 CloseGossipMenuFor(player);
313 playerGUID = player->GetGUID();
315 return false;
316 }
317
318 void UpdateAI(uint32 diff) override
319 {
320 events.Update(diff);
321
322 while (uint32 eventId = events.ExecuteEvent())
323 {
324 switch (eventId)
325 {
326 case EVENT_SCRIPT_1:
328 Talk(SAY_BRANN_1, player);
330 if (Creature* voice = me->SummonCreature(NPC_A_DISTANT_VOICE, 7863.43f, -1396.585f, 1538.076f, 2.949606f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 49s))
331 voiceGUID = voice->GetGUID();
333 break;
334 case EVENT_SCRIPT_2:
335 me->SetWalk(true);
336 me->GetMotionMaster()->MovePoint(0, 7861.488f, -1396.376f, 1534.059f, false);
338 break;
339 case EVENT_SCRIPT_3:
342 break;
343 case EVENT_SCRIPT_4:
346 {
347 voice->CastSpell(voice, SPELL_RESURRECTION);
349 voice->AI()->Talk(SAY_VOICE_1, player);
350 }
351 if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_1, 7860.273f, -1383.622f, 1538.302f, -1.658062f, QuaternionData(0.f, 0.f, -0.737277f, 0.6755905f), 0s))
352 objectGUID[objectCounter++] = go->GetGUID();
354 break;
355 case EVENT_SCRIPT_5:
358 voice->AI()->Talk(SAY_VOICE_2, player);
359 if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_2, 7875.67f, -1387.266f, 1538.323f, -2.373644f, QuaternionData(0.f, 0.f, -0.9271832f, 0.3746083f), 0s))
360 objectGUID[objectCounter++] = go->GetGUID();
362 break;
363 case EVENT_SCRIPT_6:
366 voice->AI()->Talk(SAY_VOICE_3, player);
367 if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_3, 7879.212f, -1401.175f, 1538.279f, 2.967041f, QuaternionData(0.f, 0.f, 0.9961939f, 0.08716504f), 0s))
368 objectGUID[objectCounter++] = go->GetGUID();
370 break;
371 case EVENT_SCRIPT_7:
374 voice->AI()->Talk(SAY_VOICE_4, player);
375 if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_4, 7868.944f, -1411.18f, 1538.213f, 2.111848f, QuaternionData(0.f, 0.f, 0.8703556f, 0.4924237f), 0s))
376 objectGUID[objectCounter++] = go->GetGUID();
378 break;
379 case EVENT_SCRIPT_8:
382 voice->AI()->Talk(SAY_VOICE_5, player);
383 if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_5, 7855.11f, -1406.839f, 1538.42f, 1.151916f, QuaternionData(0.f, 0.f, 0.5446386f, 0.8386708f), 0s))
384 objectGUID[objectCounter] = go->GetGUID();
386 break;
387 case EVENT_SCRIPT_9:
389 voice->CastSpell(voice, SPELL_RESURRECTION);
391 break;
392 case EVENT_SCRIPT_10:
394 {
395 Talk(SAY_BRANN_2, player);
396 player->KilledMonsterCredit(me->GetEntry());
397 }
399 break;
400 case EVENT_SCRIPT_11:
401 me->SetFacingTo(2.932153f);
403 Talk(SAY_BRANN_3, player);
404
405 for (uint8 i = 0; i < 5; ++i)
407 go->Delete();
408
410 break;
411 case EVENT_SCRIPT_12:
413 me->SetWalk(false);
414 me->GetMotionMaster()->MovePoint(0, 7799.908f, -1413.561f, 1534.829f, false);
416 break;
417 case EVENT_SCRIPT_13:
419 break;
420 }
421 }
422 }
423
424private:
430};
431
432/*#####
433# Quest 13003 Thrusting Hodir's Spear
434#####*/
435
490
498
500{
501 npc_wild_wyrm(Creature* creature) : VehicleAI(creature)
502 {
503 Initialize();
504 }
505
511
513 {
515 for (uint8 i = 0; i < ControllableSpellsCount; ++i)
517 }
518
519 void Reset() override
520 {
521 Initialize();
522
525
527
528 me->SetImmuneToPC(false);
529 me->SetCanMelee(true);
530 }
531
532 void DoAction(int32 action) override
533 {
535 if (!player)
536 return;
537
538 switch (action)
539 {
541 Talk(SAY_SWIPE, player);
542 break;
544 Talk(SAY_DODGED, player);
545 break;
547 Talk(SAY_GRIP_WARN, player);
548 break;
549 case ACTION_GRIP_LOST:
552 break;
554 Talk(SAY_STRIKE_MISS, player);
555 break;
556 default:
557 break;
558 }
559 }
560
561 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
562 {
563 if (!_playerGuid.IsEmpty() || spellInfo->Id != SPELL_SPEAR_OF_HODIR)
564 return;
565
566 _playerGuid = caster->GetGUID();
568 me->SetImmuneToPC(true);
569 me->SetCanMelee(false);
570
572 }
573
574 void MovementInform(uint32 type, uint32 id) override
575 {
576 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
577 return;
578
579 switch (id)
580 {
582 {
584 if (!player)
585 return;
586
589 break;
590 }
591 case POINT_FALL:
593 me->KillSelf();
594 break;
595 default:
596 break;
597 }
598 }
599
600 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
601 {
602 if (damage >= me->GetHealth())
603 {
604 damage = me->GetHealth() - 1;
605
606 if (_phase == PHASE_DEAD)
607 return;
608
611 .Async([this]
612 {
614
616 player->VehicleSpellInitialize();
617
620
623
625
627 });
628 }
629 }
630
631 void PassengerBoarded(Unit* passenger, int8 seatId, bool apply) override
632 {
633 if (!apply || passenger->GetGUID() != _playerGuid)
634 return;
635
636 if (seatId != SEAT_INITIAL)
637 return;
638
639 me->CastSpell(nullptr, SPELL_GRIP, CastSpellExtraArgs().AddSpellMod(SPELLVALUE_AURA_STACK, 50));
641
642 _scheduler.Async([this]
643 {
644 me->GetMotionMaster()->MovePath(PATH_WILD_WYRM, true);
645 })
646 .Schedule(Milliseconds(500), [this](TaskContext& context)
647 {
648 if (_phase == PHASE_MOUTH)
649 return;
650
651 if (me->HealthBelowPct(25))
652 {
653 _phase = PHASE_MOUTH;
654 context.Async([this]
655 {
656 InitSpellsForPhase();
657 DoCastAOE(SPELL_LOW_HEALTH_TRIGGER, true);
658 me->RemoveAurasDueToSpell(SPELL_CLAW_SWIPE_PERIODIC);
659 me->RemoveAurasDueToSpell(SPELL_GRIP);
660
661 if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGuid))
662 Talk(SAY_PHASE_2, player);
663
664 DoCastAOE(SPELL_EJECT_PASSENGER_1, true);
665 DoCastAOE(SPELL_JAWS_OF_DEATH_PERIODIC);
666 DoCastAOE(SPELL_FLY_STATE_VISUAL);
667 });
668 return;
669 }
670
671 context.Repeat();
672 });
673 }
674
675 bool EvadeCheck() const
676 {
677 Player* player = ObjectAccessor::GetPlayer(*me, _playerGuid);
678 if (!player)
679 return false;
680
681 switch (_phase)
682 {
683 case PHASE_INITIAL:
684 case PHASE_MOUTH:
685 if (!player->IsAlive())
686 return false;
687 break;
688 case PHASE_DEAD:
689 break;
690 default:
691 ABORT();
692 break;
693 }
694
695 return true;
696 }
697
698 void UpdateAI(uint32 diff) override
699 {
700 if (!_playerGuid)
701 {
702 UpdateVictim();
703 return;
704 }
705
706 if (_playerCheckTimer <= diff)
707 {
708 if (!EvadeCheck())
709 EnterEvadeMode(EvadeReason::NoHostiles);
710
711 _playerCheckTimer = 1 * IN_MILLISECONDS;
712 }
713 else
714 _playerCheckTimer -= diff;
715
716 _scheduler.Update(diff);
717 }
718
719private:
724};
725
726/*#####
727# Quest 13010 Krolmir, Hammer of Storms
728#####*/
729
763
765{
767 {
768 pathEnd = false;
769 }
770
771 void Reset() override
772 {
774 pathEnd = false;
775 }
776
777 void OnCharmed(bool /*apply*/) override { }
778
779 void PassengerBoarded(Unit* who, int8 /*seat*/, bool apply) override
780 {
781 if (apply)
782 {
783 playerGUID = who->GetGUID();
784 Talk(SAY_HOLD_ON, who);
786 me->SetImmuneToNPC(true);
788 }
789 }
790
791 void MovementInform(uint32 type, uint32 id) override
792 {
793 if (type != WAYPOINT_MOTION_TYPE)
794 return;
795
796 if (pathEnd)
797 {
798 if (id == 4)
799 {
800
801 }
802 }
803 else
804 {
805 if (id == 19)
806 {
807 pathEnd = true;
808 me->SetFacingTo(0.418879f);
813
814 }
815 }
816 }
817
818 void UpdateAI(uint32 diff) override
819 {
820 if (!pathEnd)
821 return;
822
823 events.Update(diff);
824
825 while (uint32 eventId = events.ExecuteEvent())
826 {
827 switch (eventId)
828 {
829 case EVENT_KROLMIR_1:
832 break;
833 }
834 }
835 }
836
837private:
841
842};
843
844// 61319 - Jokkum Scriptcast
846{
847 bool Validate(SpellInfo const* /*spellInfo*/) override
848 {
850 }
851
852 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
853 {
854 if (Unit* target = GetTarget())
855 target->CastSpell(target, SPELL_JOKKUM_SUMMON, true);
856 }
857
862};
863
864// 56650 - Player Cast Veranus Summon
866{
867 bool Validate(SpellInfo const* /*spellInfo*/) override
868 {
870 }
871
872 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
873 {
874 if (Unit* target = GetTarget())
875 target->CastSpell(target, SPELL_SUMMON_VERANUS_AND_THORIM, true);
876 }
877
882};
883
885{
886 SPELL_DESPAWN_RIFT = 61665
888
889// 56763 - Close Rift
891{
892 bool Validate(SpellInfo const* /*spell*/) override
893 {
895 }
896
897 void HandlePeriodic(AuraEffect const* /* aurEff */)
898 {
899 if (++_counter == 5)
900 GetTarget()->CastSpell(nullptr, SPELL_DESPAWN_RIFT, true);
901 }
902
907
908private:
910};
911
912// 56689 - Grip
913class spell_grip : public AuraScript
914{
915 void DummyTick(AuraEffect const* /*aurEff*/)
916 {
917 ++_tickNumber;
918
919 // each 15 ticks stack reduction increases by 2 (increases by 1 at each 7th and 15th tick)
920 // except for the first 15 ticks that remove 1 stack each
921 uint32 const period = ((_tickNumber - 1) % 15) + 1;
922 uint32 const sequence = (_tickNumber - 1) / 15;
923
924 uint32 stacksToRemove;
925 if (sequence == 0)
926 stacksToRemove = 1;
927 else
928 {
929 stacksToRemove = sequence * 2;
930 if (period > 7)
931 ++stacksToRemove;
932 }
933
934 // while we could do ModStackAmount(-stacksToRemove), this is how it's done in sniffs :)
935 for (uint32 i = 0; i < stacksToRemove; ++i)
937
938 if (GetStackAmount() < 15 && !_warning)
939 {
940 _warning = true;
942 }
943 else if (GetStackAmount() > 30)
944 _warning = false;
945 }
946
947 void HandleDrop(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
948 {
949 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
950 return;
951
953 }
954
961
962 // tick number in the AuraEffect gets reset each time we stack the aura, so keep track of it locally
964
965 bool _warning = false;
966};
967
968// 60533 - Grab On
970{
971 void HandleScript(SpellEffIndex /*effIndex*/)
972 {
973 if (Aura* grip = GetCaster()->GetAura(SPELL_GRIP, GetCaster()->GetGUID()))
974 grip->ModStackAmount(GetEffectValueAsInt(), AURA_REMOVE_BY_DEFAULT, false);
975 }
976
981};
982
983// 56690 - Thrust Spear
984// 60586 - Mighty Spear Thrust
985template <int8 StacksToLose>
987{
988 void HandleScript(SpellEffIndex /*effIndex*/)
989 {
990 if (Aura* grip = GetCaster()->GetAura(SPELL_GRIP))
991 grip->ModStackAmount(-StacksToLose, AURA_REMOVE_BY_EXPIRE);
992 }
993
998};
999
1000// 60596 - Low Health Trigger
1002{
1003 bool Validate(SpellInfo const* spellInfo) override
1004 {
1005 return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValueAsInt()) });
1006 }
1007
1008 void HandleScript(SpellEffIndex /*effIndex*/)
1009 {
1010 GetHitUnit()->CastSpell(nullptr, GetEffectValueAsInt(), true);
1011 }
1012
1017};
1018
1019// 60776 - Claw Swipe
1020// 60864 - Jaws of Death
1033
1034// 56705 - Claw Swipe
1036{
1037 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1038 {
1040 }
1041
1042 void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
1043 {
1044 if (Vehicle* vehicle = GetTarget()->GetVehicleKit())
1045 {
1046 if (Unit* player = vehicle->GetPassenger(SEAT_INITIAL))
1047 {
1048 if (player->HasAura(SPELL_DODGE_CLAWS))
1049 {
1051 return;
1052 }
1053 }
1054 }
1055
1056 GetTarget()->CastSpell(nullptr, aurEff->GetAmountAsInt(), false);
1057 }
1058
1064};
1065
1066// 60587 - Fatal Strike
1068{
1069 bool Validate(SpellInfo const* /*spellInfo*/) override
1070 {
1072 }
1073
1074 void HandleDummy(SpellEffIndex /*effIndex*/)
1075 {
1076 SpellEffectValue chance = 0;
1077 if (AuraEffect const* aurEff = GetCaster()->GetAuraEffect(SPELL_PRY_JAWS_OPEN, EFFECT_0))
1078 chance = aurEff->GetAmount();
1079
1080 if (!roll_chance(chance))
1081 {
1083 return;
1084 }
1085
1087 }
1088
1093};
1094
1095// 56672 - Player Mount Wyrm
1097{
1098 bool Validate(SpellInfo const* /*spellInfo*/) override
1099 {
1101 }
1102
1103 void HandleDummy(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1104 {
1105 GetTarget()->CastSpell(nullptr, SPELL_FIGHT_WYRM, true);
1106 }
1107
1112};
1113
1114/*######
1115## Quest 12823: A Flawless Plan
1116######*/
1117
1118// 55693 - Remove Collapsing Cave Aura
1136
1137/*######
1138## Quest 12987: Mounting Hodir's Helm
1139######*/
1140
1147
1148// 56278 - Read Pronouncement
1150{
1151 bool Validate(SpellInfo const* /*spellInfo*/) override
1152 {
1153 return sBroadcastTextStore.HasRecord(TEXT_PRONOUNCEMENT_1) &&
1155 sObjectMgr->GetCreatureTemplate(NPC_HODIRS_HELM_KC);
1156 }
1157
1158 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1159 {
1160 if (Player* target = GetTarget()->ToPlayer())
1161 {
1162 target->Unit::Whisper(TEXT_PRONOUNCEMENT_1, target, true);
1163 target->KilledMonsterCredit(NPC_HODIRS_HELM_KC);
1164 target->Unit::Whisper(TEXT_PRONOUNCEMENT_2, target, true);
1165 }
1166 }
1167
1172};
1173
1174/*######
1175## Quest 13011: Jormuttar is Soo Fat...
1176######*/
1177
1184
1185// 56565 - Bear Flank Master
1203
1204// 56569 - Bear Flank Fail
1206{
1207 bool Validate(SpellInfo const* /*spellInfo*/) override
1208 {
1209 return sBroadcastTextStore.HasRecord(TEXT_CARVE_FAIL);
1210 }
1211
1212 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1213 {
1214 if (Player* target = GetTarget()->ToPlayer())
1215 target->Unit::Whisper(TEXT_CARVE_FAIL, target, true);
1216 }
1217
1222};
1223
1224/*######
1225## Quest 12828: Ample Inspiration
1226######*/
1227
1238
1239// 54581 - Mammoth Explosion Spell Spawner
1274
1275// 54892 - Unstable Explosive Detonation
1277{
1278 bool Validate(SpellInfo const* /*spellInfo*/) override
1279 {
1280 return sObjectMgr->GetItemTemplate(ITEM_EXPLOSIVE_DEVICE);
1281 }
1282
1283 void HandleScript(SpellEffIndex /*effIndex*/)
1284 {
1285 if (Player* caster = GetCaster()->ToPlayer())
1286 caster->DestroyItemCount(ITEM_EXPLOSIVE_DEVICE, 1, true);
1287 }
1288
1293};
1294
1295/*######
1296## Quest 12915: Mending Fences
1297######*/
1298
1303
1304// 55512 - Call of Earth
1306{
1307 bool Validate(SpellInfo const* /*spellInfo*/) override
1308 {
1310 }
1311
1312 void HandleScript(SpellEffIndex /*effIndex*/)
1313 {
1314 uint8 count = urand(2, 6);
1315 for (uint8 i = 0; i < count; i++)
1317 }
1318
1323};
1324
@ IN_MILLISECONDS
Definition Common.h:38
@ MINUTE
Definition Common.h:32
DB2Storage< BroadcastTextEntry > sBroadcastTextStore("BroadcastText.db2", &BroadcastTextLoadInfo::Instance)
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
#define ABORT
Definition Errors.h:87
#define ASSERT
Definition Errors.h:80
@ WAYPOINT_MOTION_TYPE
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
@ TYPEID_UNIT
Definition ObjectGuid.h:43
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define sObjectMgr
Definition ObjectMgr.h:1885
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
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define RegisterSpellScriptWithArgs(spell_script, script_name,...)
Definition ScriptMgr.h:1382
void CloseGossipMenuFor(Player *player)
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EMOTE_STATE_WORK_MINING
@ EMOTE_ONESHOT_NONE
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCHOOL_DAMAGE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_DEFAULT
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_NONE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_AURA_STACK
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_NONE
@ UNIT_NPC_FLAG_QUESTGIVER
DamageEffectType
int32 GetAmountAsInt() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
uint8 GetStackAmount() const
HookList< EffectApplyHandler > OnEffectApply
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetCanMelee(bool canMelee, bool fleeFromMelee=false)
void SetImmuneToPC(bool apply) override
Definition Creature.h:184
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:324
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetImmuneToNPC(bool apply) override
Definition Creature.h:187
void DisappearAndDie()
Definition Creature.h:95
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void MoveFall(uint32 id=0, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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={})
bool IsEmpty() const
Definition ObjectGuid.h:362
void Clear()
Definition ObjectGuid.h:329
uint32 GetEntry() const
Definition Object.h:89
Unit * ToUnit()
Definition Object.h:116
int32 CalcValueAsInt(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
void SetEffectValue(SpellEffectValue value)
SpellEffectValue GetEffectValue() const
int32 GetEffectValueAsInt() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< EffectHandler > OnEffectLaunchTarget
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Async(std::function< void()> callable)
virtual void DoAction(int32 param)
Definition UnitAI.h:73
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
Vehicle * GetVehicle() const
Definition Unit.h:1784
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool IsAlive() const
Definition Unit.h:1185
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:998
UnitAI * GetAI() const
Definition Unit.h:668
void SetEmoteState(Emote emote)
Definition Unit.h:865
uint64 GetHealth() const
Definition Unit.h:788
bool SetWalk(bool enable)
Definition Unit.cpp:13343
void SetFacingTo(float const ori, bool force=true)
Definition Unit.cpp:13289
bool HealthBelowPct(float pct) const
Definition Unit.h:792
Vehicle * GetVehicleKit() const
Definition Unit.h:1782
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:936
void ReplaceAllNpcFlags(NPCFlags flags)
Definition Unit.h:999
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
uint8 GetAvailableSeatCount() const
Gets the available seat count.
Definition Vehicle.cpp:712
Unit * GetPassenger(int8 seatId) const
Gets a passenger on specified seat.
Definition Vehicle.cpp:303
void InstallAllAccessories(bool evading)
Definition Vehicle.cpp:97
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1398
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition Object.cpp:1441
uint32 GetAreaId() const
Definition Object.h:333
void PassengerBoarded(Unit *who, int8, bool apply) override
== Fields =======================================
npc_hyldsmeet_protodrake(Creature *creature)
void UpdateAI(uint32 diff) override
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void HandlePeriodic(AuraEffect const *)
void Register() override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
void Register() override
void HandleScript(SpellEffIndex)
void HandleDrop(AuraEffect const *, AuraEffectHandleModes)
void DummyTick(AuraEffect const *)
void Register() override
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *spellInfo) override
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
void HandleDummy(AuraEffect const *, AuraEffectHandleModes)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *spellInfo) override
bool Validate(SpellInfo const *) override
void OnApply(AuraEffect const *, AuraEffectHandleModes)
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
Definition CombatAI.cpp:241
bool OnGossipSelect(Player *player, uint32, uint32) override
void UpdateAI(uint32 diff) override
npc_brann_bronzebeard_keystone(Creature *creature)
npc_brunnhildar_prisoner(Creature *creature)
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
void UpdateAI(uint32) override
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 id) override
npc_freed_protodrake(Creature *creature)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
npc_icefang(Creature *creature)
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *) override
void JustDied(Unit *) override
void PassengerBoarded(Unit *who, int8, bool apply) override
== Fields =======================================
void OnCharmed(bool) override
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 id) override
npc_king_jokkum_vehicle(Creature *creature)
void UpdateAI(uint32 diff) override
void OnCharmed(bool) override
void PassengerBoarded(Unit *who, int8, bool apply) override
== Fields =======================================
bool EvadeCheck() const
void Reset() override
void PassengerBoarded(Unit *passenger, int8 seatId, bool apply) override
== Fields =======================================
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
npc_wild_wyrm(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
TaskScheduler _scheduler
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 id) override
void DoAction(int32 action) override
FreedProtoDrake
@ EVENT_CHECK_AREA
@ AREA_VALLEY_OF_ANCIENT_WINTERS
@ TEXT_EMOTE
@ SPELL_SUMMON_LIBERATED
@ NPC_DRAKE
@ SPELL_KILL_CREDIT_PRISONER
@ SPELL_KILL_CREDIT_DRAKE
@ EVENT_REACHED_HOME
@ SPELL_MAMMOTH_SUMMON_OBJECT_1
@ SPELL_SUMMON_MAIN_MAMMOTH_MEAT
@ ITEM_EXPLOSIVE_DEVICE
@ SPELL_MAMMOTH_SUMMON_OBJECT_2
@ SPELL_QUIET_SUICIDE
@ SPELL_MAMMOTH_SUMMON_OBJECT_3
uint8 const ControllableSpellsCount
BrunnhildarPrisoner
@ SPELL_FREE_PRISONER
@ SPELL_ICE_PRISON
@ SPELL_ICE_LANCE
@ SPELL_SHARD_IMPACT
@ SPELL_RIDE_DRAKE
@ PHASE_INITIAL
@ SEAT_INITIAL
@ POINT_START_FIGHT
@ PHASE_DEAD
@ SAY_DODGED
@ SPELL_MIGHTY_SPEAR_THRUST
@ SPELL_FLY_STATE_VISUAL
@ SPELL_FATAL_STRIKE
@ PHASE_MOUTH
@ SPELL_EJECT_PASSENGER_1
@ PHASE_MAX
@ SAY_STRIKE_MISS
@ SPELL_JAWS_OF_DEATH_PERIODIC
@ ACTION_GRIP_FAILING
@ SPELL_FALLING_DRAGON_FEIGN_DEATH
@ SPELL_CLAW_SWIPE_DAMAGE
@ ACTION_FATAL_STRIKE_MISS
@ SAY_PHASE_2
@ SPELL_GRIP
@ SPELL_DODGE_CLAWS
@ SPELL_CLAW_SWIPE_PERIODIC
@ ACTION_GRIP_LOST
@ ACTION_CLAW_SWIPE_DODGE
@ SPELL_THRUST_SPEAR
@ SAY_GRIP_WARN
@ ACTION_CLAW_SWIPE_WARN
@ SPELL_WYRM_KILL_CREDIT
@ SPELL_PLAYER_MOUNT_WYRM
@ PATH_WILD_WYRM
@ SPELL_SPEAR_OF_HODIR
@ SPELL_LOW_HEALTH_TRIGGER
@ SPELL_FIGHT_WYRM
@ SPELL_EJECT_ALL_PASSENGERS
@ POINT_FALL
@ SAY_SWIPE
@ SPELL_PRY_JAWS_OPEN
@ SPELL_FULL_HEAL_MANA
@ SPELL_FATAL_STRIKE_DAMAGE
@ SPELL_GRAB_ON
@ SEAT_MOUTH
@ SPELL_DESPAWN_RIFT
@ NPC_HYLDSMEET_DRAKERIDER
BrannBronzebeard
@ EVENT_SCRIPT_8
@ EVENT_SCRIPT_7
@ NPC_A_DISTANT_VOICE
@ EVENT_SCRIPT_1
@ SAY_BRANN_3
@ OBJECT_TOL_SIGNAL_1
@ SAY_VOICE_1
@ OBJECT_TOL_SIGNAL_3
@ SPELL_RESURRECTION
@ SAY_VOICE_2
@ EVENT_SCRIPT_9
@ SAY_VOICE_5
@ EVENT_SCRIPT_13
@ EVENT_SCRIPT_5
@ SAY_BRANN_1
@ EVENT_SCRIPT_3
@ SAY_VOICE_3
@ OBJECT_TOL_SIGNAL_2
@ EVENT_SCRIPT_4
@ SAY_VOICE_4
@ EVENT_SCRIPT_10
@ EVENT_SCRIPT_11
@ EVENT_SCRIPT_2
@ EVENT_SCRIPT_6
@ SAY_BRANN_2
@ NPC_BRANN_BRONZEBEARD
@ OBJECT_TOL_SIGNAL_5
@ OBJECT_TOL_SIGNAL_4
@ EVENT_SCRIPT_12
void AddSC_storm_peaks()
uint32 const WyrmControlSpells[PHASE_MAX][ControllableSpellsCount]
@ SPELL_SUMMON_EARTHEN
MountingHodirsHelm
@ TEXT_PRONOUNCEMENT_1
@ TEXT_PRONOUNCEMENT_2
@ NPC_HODIRS_HELM_KC
JokkumScriptcast
@ EVENT_KROLMIR_4
@ SPELL_SUMMON_VERANUS_AND_THORIM
@ EVENT_KROLMIR_2
@ NPC_KINGJOKKUM
@ SAY_JOKKUM_7
@ SAY_JOKKUM_2
@ EVENT_KROLMIR_8
@ EVENT_KROLMIR_7
@ SPELL_JOKKUM_SUMMON
@ SAY_HOLD_ON
@ NPC_THORIM
@ SAY_JOKKUM_8
@ SAY_JOKKUM_3
@ SAY_THORIM_2
@ SPELL_JOKKUM_KILL_CREDIT
@ SPELL_PLAYER_CAST_VERANUS_SUMMON
@ SAY_THORIM_4
@ SAY_THORIM_1
@ EVENT_KROLMIR_5
@ EVENT_KROLMIR_1
@ PATH_JOKKUM_END
@ SAY_THORIM_3
@ SAY_JOKKUM_4
@ EVENT_KROLMIR_3
@ EVENT_KROLMIR_9
@ SAY_JOKKUM_5
@ SAY_JOKKUM_1
@ PATH_JOKKUM
@ SAY_JOKKUM_6
@ EVENT_KROLMIR_6
static constexpr uint32 PATH_ESCORT_ICEFANG
JormuttarIsSooFat
@ SPELL_BEAR_FLANK_FAIL
@ TEXT_CARVE_FAIL
@ SPELL_CREATE_BEAR_FLANK