TrinityCore
zone_hellfire_peninsula.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 "CellImpl.h"
20#include "Containers.h"
21#include "GridNotifiersImpl.h"
22#include "Log.h"
23#include "MotionMaster.h"
24#include "ObjectAccessor.h"
25#include "Player.h"
26#include "ScriptedEscortAI.h"
27#include "ScriptedGossip.h"
28#include "SpellScript.h"
29#include "TemporarySummon.h"
30
32{
37
40};
41
43{
52
58};
59
61{
62 { -707.123f, 2751.686f, 101.592f, 4.577416f }, //Barada Waypoint-1 0
63 { -710.731f, 2749.075f, 101.592f, 1.513286f }, //Barada Cast position 1
64 { -710.332f, 2754.394f, 102.948f, 3.207566f }, //Jules 2
65 { -714.261f, 2747.754f, 103.391f, 0.0f }, //Jules Waypoint-1 3
66 { -713.113f, 2750.194f, 103.391f, 0.0f }, //Jules Waypoint-2 4
67 { -710.385f, 2750.896f, 103.391f, 0.0f }, //Jules Waypoint-3 5
68 { -708.309f, 2750.062f, 103.391f, 0.0f }, //Jules Waypoint-4 6
69 { -707.401f, 2747.696f, 103.391f, 0.0f }, //Jules Waypoint-5 7
70 { -708.591f, 2745.266f, 103.391f, 0.0f }, //Jules Waypoint-6 8
71 { -710.597f, 2744.035f, 103.391f, 0.0f }, //Jules Waypoint-7 9
72 { -713.089f, 2745.302f, 103.391f, 0.0f }, //Jules Waypoint-8 10
73};
74
76{
80
82
84
89};
90
92{
95
96 //Colonel Jules
98};
99
100/*######
101## npc_colonel_jules
102######*/
103
105{
106public:
107 npc_colonel_jules() : CreatureScript("npc_colonel_jules") { }
108
110 {
112 {
113 Initialize();
114 }
115
117 {
118 point = 3;
119 wpreached = false;
120 success = false;
121 }
122
123 void Reset() override
124 {
125 events.Reset();
126
128 Initialize();
129 }
130
132
133 void DoAction(int32 action) override
134 {
135 switch (action)
136 {
140
141 me->SetCanFly(true);
142 me->SetSpeedRate(MOVE_RUN, 0.2f);
143
144 me->SetFacingTo(3.207566f);
145 me->GetMotionMaster()->MoveJump(exorcismPos[2], 2.0f, 2.0f);
146
147 success = false;
148
150 break;
153
156
157 wpreached = true;
159 break;
161 wpreached = false;
162 me->SetSpeedRate(MOVE_RUN, 1.0f);
164
166 break;
167 }
168 }
169
170 void JustSummoned(Creature* summon) override
171 {
172 summons.Summon(summon);
173 summon->GetMotionMaster()->MoveRandom(10.0f);
174 }
175
176 void MovementInform(uint32 type, uint32 id) override
177 {
178 if (type != POINT_MOTION_TYPE)
179 return;
180
181 if (id < 10)
182 wpreached = true;
183
184 if (id == 8)
185 {
186 for (uint8 i = 0; i < 2; i++)
188 }
189
190 if (id == 10)
191 {
192 wpreached = true;
193 point = 3;
194 }
195 }
196
197 void UpdateAI(uint32 diff) override
198 {
199 if (wpreached)
200 {
202 point++;
203 wpreached = false;
204 }
205
206 events.Update(diff);
207
208 while (uint32 eventId = events.ExecuteEvent())
209 {
210 switch (eventId)
211 {
213 uint8 summonCount = urand(1, 3);
214
215 for (uint8 i = 0; i < summonCount; i++)
217
219 break;
220 }
221 }
222 }
223
224 bool OnGossipHello(Player* player) override
225 {
226 if (success)
228
229 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
230 return true;
231 }
232
233 private:
236
238
240 };
241
242 CreatureAI* GetAI(Creature* creature) const override
243 {
244 return new npc_colonel_julesAI(creature);
245 }
246};
247
248/*######
249## npc_barada
250######*/
251
253{
254public:
255 npc_barada() : CreatureScript("npc_barada") { }
256
257 struct npc_baradaAI : public ScriptedAI
258 {
259 npc_baradaAI(Creature* creature) : ScriptedAI(creature)
260 {
261 Initialize();
262 }
263
265 {
266 step = 0;
267 }
268
269 void Reset() override
270 {
271 events.Reset();
272 Initialize();
273
277 }
278
279 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
280 {
281 ClearGossipMenuFor(player);
282 switch (gossipListId)
283 {
284 case 1:
285 CloseGossipMenuFor(player);
286 me->AI()->Talk(SAY_BARADA_1);
289 break;
290 default:
291 break;
292 }
293 return false;
294 }
295
296 void DoAction(int32 action) override
297 {
298 if (action == ACTION_START_EVENT)
299 {
300 if (Creature* jules = me->FindNearestCreature(NPC_COLONEL_JULES, 20.0f, true))
301 {
302 julesGUID = jules->GetGUID();
303 jules->AI()->Talk(SAY_JULES_1);
304 }
305
308
310 }
311 }
312
313 void MovementInform(uint32 type, uint32 id) override
314 {
315 if (type != POINT_MOTION_TYPE)
316 return;
317
318 if (id == 0)
320
321 if (id == 1)
323 }
324
325 void JustDied(Unit* /*killer*/) override
326 {
328 {
329 jules->AI()->DoAction(ACTION_JULES_MOVE_HOME);
330 jules->RemoveAllAuras();
331 }
332 }
333
334 void UpdateAI(uint32 diff) override
335 {
336 events.Update(diff);
337
338 while (uint32 eventId = events.ExecuteEvent())
339 {
340 switch (eventId)
341 {
343 switch (step)
344 {
345 case 0:
346 me->SetFacingTo(1.513286f);
347
350 step++;
351 break;
352 case 1:
355 step++;
356 break;
357 case 2:
360 step++;
361 break;
362 case 3:
364 jules->AI()->Talk(SAY_JULES_2);
365
367 step++;
368 break;
369 case 4:
372
374 jules->AI()->DoAction(ACTION_JULES_HOVER);
375
377 step++;
378 break;
379 case 5:
381 jules->AI()->Talk(SAY_JULES_3);
382
384 step++;
385 break;
386 case 6:
389 step++;
390 break;
391 case 7:
393 jules->AI()->Talk(SAY_JULES_3);
394
396 step++;
397 break;
398 case 8:
401 step++;
402 break;
403 case 9:
405 jules->AI()->Talk(SAY_JULES_4);
406
408 step++;
409 break;
410 case 10:
413 step++;
414 break;
415 case 11:
417 jules->AI()->DoAction(ACTION_JULES_FLIGHT);
418
420 step++;
421 break;
422 case 12:
424 jules->AI()->Talk(SAY_JULES_4);
425
427 step++;
428 break;
429 case 13:
432 step++;
433 break;
434 case 14:
436 jules->AI()->Talk(SAY_JULES_4);
437
439 step++;
440 break;
441 case 15:
444 step++;
445 break;
446 case 16:
448 jules->AI()->Talk(SAY_JULES_5);
449
451 step++;
452 break;
453 case 17:
456 step++;
457 break;
458 case 18:
460 jules->AI()->Talk(SAY_JULES_3);
461
463 step++;
464 break;
465 case 19:
468 step++;
469 break;
470 case 20:
472 {
473 jules->AI()->DoAction(ACTION_JULES_MOVE_HOME);
474 jules->RemoveAura(SPELL_JULES_VOMITS_AURA);
475 }
476
478 step++;
479 break;
480 case 21:
481 //End
483 {
484 ENSURE_AI(npc_colonel_jules::npc_colonel_julesAI, jules->AI())->success = true;
485 jules->RemoveAllAuras();
486 }
487
490
495 break;
496 }
497 break;
498 case EVENT_RESET:
500 ENSURE_AI(npc_colonel_jules::npc_colonel_julesAI, jules->AI())->success = false;
501 break;
502 }
503 }
504 }
505
506 private:
511 };
512
513 CreatureAI* GetAI(Creature* creature) const override
514 {
515 return new npc_baradaAI(creature);
516 }
517};
518
520{
529 SPELL_FROSTNOVA = 11831
531
533{
534public:
535 npc_magister_aledis() : CreatureScript("npc_magister_aledis") { }
536
538 {
539 npc_magister_aledisAI(Creature* creature) : ScriptedAI(creature) { }
540
541 void StartFight(Player* player)
542 {
543 me->Dismount();
544 me->SetFacingToObject(player);
546 _playerGUID = player->GetGUID();
548 }
549
550 void Reset() override
551 {
555 me->SetImmuneToPC(true);
556 }
557
558 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
559 {
560 if (damage > me->GetHealth() || me->HealthBelowPctDamaged(20, damage))
561 {
562 damage = 0;
563
564 _events.Reset();
567 me->CombatStop(true);
570 me->SetImmuneToPC(true);
572
574 }
575 }
576
577 void UpdateAI(uint32 diff) override
578 {
579 _events.Update(diff);
580
581 while (uint32 eventId = _events.ExecuteEvent())
582 {
583 switch (eventId)
584 {
585 case EVENT_TALK:
588 break;
589 case EVENT_ATTACK:
590 me->SetImmuneToPC(false);
593 me->EngageWithTarget(player);
596 break;
597 case EVENT_FIREBALL:
600 break;
601 case EVENT_FROSTNOVA:
604 break;
605 case EVENT_EVADE:
607 break;
608 }
609 }
610
611 if (!UpdateVictim())
612 return;
613 }
614
615 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
616 {
617 CloseGossipMenuFor(player);
618 me->StopMoving();
619 StartFight(player);
620 return true;
621 }
622
623 private:
626 };
627
628 CreatureAI* GetAI(Creature* creature) const override
629 {
630 return new npc_magister_aledisAI(creature);
631 }
632};
633
635{
637
641
643
647 SPELL_FEAR = 33815 // Serverside spell
649
651{
653
654 void OnGameEvent(bool start, uint16 eventId) override
655 {
656 if (eventId == GAME_EVENT_HELLFIRE && start)
657 {
658 _events.Reset();
660 }
661 }
662
663 void UpdateAI(uint32 diff) override
664 {
665 _events.Update(diff);
666
667 while (uint32 eventId = _events.ExecuteEvent())
668 {
669 switch (eventId)
670 {
671 case EVENT_START:
672 {
675
676 std::list<Creature*> dummies;
678 {
681 Cell::VisitAllObjects(me, searcher, 500.0f);
682 }
683
684 for (Creature* dummy : dummies)
685 if (dummy->GetCreatureData()->movementType == 0)
686 dummy->AI()->SetData(EVENT_START, 0);
687 break;
688 }
689 }
690 }
691
692 if (!UpdateVictim())
693 return;
694 }
695
696private:
698};
699
701{
703
704 void SetData(uint32 type, uint32 /*data*/) override
705 {
706 if (type != EVENT_START)
707 return;
708
712 }
713
715 {
716 _targets.clear();
717
718 std::vector<Creature*> others;
721 Cell::VisitAllObjects(me, searcher, 500.0f);
722 for (Creature* other : others)
723 if (other->GetCreatureData()->movementType == 2)
724 _targets.push_back(other->GetGUID());
725 }
726
727 void UpdateAI(uint32 diff) override
728 {
729 _events.Update(diff);
730
731 while (uint32 eventId = _events.ExecuteEvent())
732 {
733 switch (eventId)
734 {
735 case EVENT_CAST:
736 {
738 {
741 me->CastSpell(target, SPELL_INFERNAL_RAIN, args);
742 }
743
744 _events.Repeat(1s, 2s);
745 break;
746 }
747 case EVENT_END:
748 _events.Reset();
749 break;
750 }
751 }
752 }
753
754 private:
756 std::vector<ObjectGuid> _targets;
757};
758
760{
761 npc_fear_controller(Creature* creature) : ScriptedAI(creature) { }
762
763 void SetData(uint32 type, uint32 /*data*/) override
764 {
765 if (type != EVENT_START)
766 return;
767
770 }
771
772 void UpdateAI(uint32 diff) override
773 {
774 _events.Update(diff);
775
776 while (uint32 eventId = _events.ExecuteEvent())
777 {
778 switch (eventId)
779 {
780 case EVENT_CAST:
782 _events.Repeat(10s);
783 break;
784 case EVENT_END:
785 _events.Reset();
786 break;
787 }
788 }
789 }
790
791 private:
793};
794
795/*######
796## Quest 10909: Fel Spirits
797######*/
798
800{
804
805// 39190 - Send Vengeance
807{
808 bool Validate(SpellInfo const* /*spellInfo*/) override
809 {
811 }
812
813 void HandleScript(SpellEffIndex /*effIndex*/)
814 {
815 if (TempSummon* target = GetHitUnit()->ToTempSummon())
816 if (Unit* summoner = target->GetSummonerUnit())
817 target->CastSpell(summoner, SPELL_SEND_VENGEANCE_TO_PLAYER, true);
818 }
819
820 void Register() override
821 {
823 }
824};
825
826// 39202 - Send Vengeance to Player
828{
829 bool Validate(SpellInfo const* /*spellInfo*/) override
830 {
832 }
833
834 void HandleScript(SpellEffIndex /*effIndex*/)
835 {
837 }
838
839 void Register() override
840 {
842 }
843};
844
846{
847 new npc_colonel_jules();
848 new npc_barada();
855}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
@ POINT_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void ClearGossipMenuFor(Player *player)
void CloseGossipMenuFor(Player *player)
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ EMOTE_ONESHOT_KNEEL
@ EMOTE_STAND_STATE_NONE
@ EMOTE_ONESHOT_SHOUT
@ SPELL_EFFECT_SCRIPT_EFFECT
@ FACTION_MONSTER_2
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:230
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define ENSURE_AI(a, b)
Definition: UnitAI.h:29
@ MOVE_RUN
Definition: UnitDefines.h:118
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: UnitDefines.h:298
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_FLAG_PACIFIED
Definition: UnitDefines.h:161
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
Creature * DoSummon(uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
Definition: CreatureAI.cpp:464
void EngagementOver()
Definition: CreatureAI.cpp:287
void SetImmuneToPC(bool apply) override
Definition: Creature.h:170
CreatureAI * AI() const
Definition: Creature.h:214
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
void Reset()
Definition: EventMap.cpp:21
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=EVENT_JUMP, bool hasOrientation=false, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_DEFAULT)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
void MoveTargetedHome()
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
void Clear()
Definition: ObjectGuid.h:286
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: Player.cpp:16680
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: Player.cpp:14367
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
void Summon(Creature const *summon)
virtual void DoAction(int32)
Definition: UnitAI.h:72
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition: Unit.cpp:5827
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
void RestoreFaction()
Definition: Unit.cpp:11417
void SetFaction(uint32 faction) override
Definition: Unit.h:859
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void Dismount()
Definition: Unit.cpp:7920
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition: Unit.cpp:12671
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
void StopMoving()
Definition: Unit.cpp:10049
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
bool SetCanFly(bool enable)
Definition: Unit.cpp:12820
uint64 GetHealth() const
Definition: Unit.h:776
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
void EngageWithTarget(Unit *who)
Definition: Unit.cpp:8077
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition: Unit.cpp:8525
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
void RemoveAllAuras()
Definition: Unit.cpp:4242
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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:2025
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:203
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetPositionZ() const
Definition: Position.h:78
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override
void MovementInform(uint32 type, uint32 id) override
void DoAction(int32 action) override
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 id) override
void JustSummoned(Creature *summon) override
void SetData(uint32 type, uint32) override
void UpdateAI(uint32 diff) override
npc_fear_controller(Creature *creature)
npc_infernal_rain_hellfire(Creature *creature)
std::vector< ObjectGuid > _targets
void SetData(uint32 type, uint32) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
bool OnGossipSelect(Player *player, uint32, uint32) override
void OnGameEvent(bool start, uint16 eventId) override
void UpdateAI(uint32 diff) override
npc_watch_commander_leonus(Creature *creature)
@ EVENT_SUMMON_SKULL
@ EVENT_BARADAS_TALK
@ ACTION_JULES_MOVE_HOME
@ ACTION_START_EVENT
@ QUEST_THE_EXORCISM_OF_COLONEL_JULES
@ ACTION_JULES_HOVER
@ NPC_DARKNESS_RELEASED
@ ACTION_JULES_FLIGHT
@ BARADAS_GOSSIP_MESSAGE
@ SPELL_JULES_THREATENS_AURA
@ SPELL_JULES_GOES_PRONE
@ SPELL_BARADA_FALTERS
@ SPELL_JULES_VOMITS_AURA
@ SPELL_BARADAS_COMMAND
@ SPELL_JULES_GOES_UPRIGHT
@ SPELL_SEND_VENGEANCE_TO_PLAYER
@ SPELL_SUMMON_FEL_SPIRIT
Position const exorcismPos[11]
void AddSC_hellfire_peninsula()