Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_majordomo_executus.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/* ScriptData
7SDName: Boss_Majordomo_Executus
8SD%Complete: 30
9SDComment: Correct spawning and Event NYI
10SDCategory: Molten Core
11EndScriptData */
12
13#include "ObjectMgr.h"
14#include "ScriptMgr.h"
15#include "ScriptedCreature.h"
16#include "ScriptedGossip.h"
17#include "molten_core.h"
18#include "Player.h"
19
31
41
42#define GOSSIP_HELLO 4995
43#define GOSSIP_SELECT "Tell me more."
44
56
58{
59 public:
60 boss_majordomo() : CreatureScript("boss_majordomo") { }
61
62 struct boss_majordomoAI : public BossAI
63 {
65 {
66 }
67
68 void KilledUnit(Unit* /*victim*/) OVERRIDE
69 {
70 if ((std::rand() % 99) < 25)
72 }
73
75 {
78 events.ScheduleEvent(EVENT_MAGIC_REFLECTION, 30000);
79 events.ScheduleEvent(EVENT_DAMAGE_REFLECTION, 15000);
80 events.ScheduleEvent(EVENT_BLAST_WAVE, 10000);
81 events.ScheduleEvent(EVENT_TELEPORT, 20000);
82 }
83
85 {
86 if (instance && instance->GetBossState(BOSS_MAJORDOMO_EXECUTUS) != DONE)
87 {
88 if (!UpdateVictim())
89 return;
90
91 events.Update(diff);
92
93 if (!me->FindNearestCreature(NPC_FLAMEWAKER_HEALER, 100.0f) && !me->FindNearestCreature(NPC_FLAMEWAKER_ELITE, 100.0f))
94 {
95 instance->UpdateEncounterState(EncounterCreditType::ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
96 me->setFaction(35);
97 me->AI()->EnterEvadeMode();
99 _JustDied();
100 events.ScheduleEvent(EVENT_OUTRO_1, 32000);
101 return;
102 }
103
104 if (me->HasUnitState(UNIT_STATE_CASTING))
105 return;
106
107 if (HealthBelowPct(50))
109
110 while (uint32 eventId = events.ExecuteEvent())
111 {
112 switch (eventId)
113 {
116 events.ScheduleEvent(EVENT_MAGIC_REFLECTION, 30000);
117 break;
120 events.ScheduleEvent(EVENT_DAMAGE_REFLECTION, 30000);
121 break;
122 case EVENT_BLAST_WAVE:
124 events.ScheduleEvent(EVENT_BLAST_WAVE, 10000);
125 break;
126 case EVENT_TELEPORT:
127 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
128 DoCast(target, SPELL_TELEPORT);
129 events.ScheduleEvent(EVENT_TELEPORT, 20000);
130 break;
131 default:
132 break;
133 }
134 }
135
137 }
138 else
139 {
140 events.Update(diff);
141
142 while (uint32 eventId = events.ExecuteEvent())
143 {
144 switch (eventId)
145 {
146 case EVENT_OUTRO_1:
147 me->NearTeleportTo(RagnarosTelePos.GetPositionX(), RagnarosTelePos.GetPositionY(), RagnarosTelePos.GetPositionZ(), RagnarosTelePos.GetOrientation());
149 break;
150 case EVENT_OUTRO_2:
151 if (instance)
152 instance->instance->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos);
153 break;
154 case EVENT_OUTRO_3:
156 break;
157 default:
158 break;
159 }
160 }
161 }
162 }
163
165 {
166 if (action == ACTION_START_RAGNAROS)
167 {
170 events.ScheduleEvent(EVENT_OUTRO_2, 8000);
171 events.ScheduleEvent(EVENT_OUTRO_3, 24000);
172 }
173 else if (action == ACTION_START_RAGNAROS_ALT)
174 {
175 me->setFaction(35);
177 }
178 }
179 };
180
181 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
182 {
184 player->SEND_GOSSIP_MENU(GOSSIP_HELLO, creature->GetGUID());
185 return true;
186 }
187
188 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) OVERRIDE
189 {
190 player->CLOSE_GOSSIP_MENU();
191 creature->AI()->DoAction(ACTION_START_RAGNAROS);
192 return true;
193 }
194
196 {
197 return new boss_majordomoAI(creature);
198 }
199};
200
202{
203 new boss_majordomo();
204}
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ DONE
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_NPC_FLAGS
@ SAY_SLAY
#define SAY_AGGRO
#define GOSSIP_HELLO
#define GOSSIP_SELECT
@ SPELL_DAMAGE_REFLECTION
@ SPELL_SUMMON_RAGNAROS
@ SPELL_AEGIS_OF_RAGNAROS
@ SPELL_MAGIC_REFLECTION
void AddSC_boss_majordomo()
@ EVENT_DAMAGE_REFLECTION
@ EVENT_MAGIC_REFLECTION
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
void EnterCombat(Unit *) OVERRIDE
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32) OVERRIDE
@ ACTION_START_RAGNAROS
Definition molten_core.h:26
@ ACTION_START_RAGNAROS_ALT
Definition molten_core.h:27
@ NPC_RAGNAROS
Definition molten_core.h:44
@ NPC_FLAMEWAKER_ELITE
Definition molten_core.h:46
@ NPC_FLAMEWAKER_HEALER
Definition molten_core.h:45
Position const RagnarosSummonPos
Definition molten_core.h:31
Position const RagnarosTelePos
Definition molten_core.h:30
@ BOSS_MAJORDOMO_EXECUTUS
Definition molten_core.h:19
Creature * me
bool HealthBelowPct(uint32 pct) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================