Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
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
7
SDName: Boss_Majordomo_Executus
8
SD%Complete: 30
9
SDComment: Correct spawning and Event NYI
10
SDCategory: Molten Core
11
EndScriptData */
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
20
enum
Texts
21
{
22
SAY_AGGRO
= 0,
23
SAY_SPAWN
= 1,
24
SAY_SLAY
= 2,
25
SAY_SPECIAL
= 3,
26
SAY_DEFEAT
= 4,
27
28
SAY_SUMMON_MAJ
= 5,
29
SAY_ARRIVAL2_MAJ
= 6
30
};
31
32
enum
Spells
33
{
34
SPELL_MAGIC_REFLECTION
= 20619,
35
SPELL_DAMAGE_REFLECTION
= 21075,
36
SPELL_BLAST_WAVE
= 20229,
37
SPELL_AEGIS_OF_RAGNAROS
= 20620,
38
SPELL_TELEPORT
= 20618,
39
SPELL_SUMMON_RAGNAROS
= 19774,
40
};
41
42
#define GOSSIP_HELLO 4995
43
#define GOSSIP_SELECT "Tell me more."
44
45
enum
Events
46
{
47
EVENT_MAGIC_REFLECTION
= 1,
48
EVENT_DAMAGE_REFLECTION
= 2,
49
EVENT_BLAST_WAVE
= 3,
50
EVENT_TELEPORT
= 4,
51
52
EVENT_OUTRO_1
= 5,
53
EVENT_OUTRO_2
= 6,
54
EVENT_OUTRO_3
= 7,
55
};
56
57
class
boss_majordomo
:
public
CreatureScript
58
{
59
public
:
60
boss_majordomo
() :
CreatureScript
(
"boss_majordomo"
) { }
61
62
struct
boss_majordomoAI
:
public
BossAI
63
{
64
boss_majordomoAI
(
Creature
* creature) :
BossAI
(creature,
BOSS_MAJORDOMO_EXECUTUS
)
65
{
66
}
67
68
void
KilledUnit
(
Unit
*
/*victim*/
)
OVERRIDE
69
{
70
if
((std::rand() % 99) < 25)
71
Talk
(
SAY_SLAY
);
72
}
73
74
void
EnterCombat
(
Unit
* who)
OVERRIDE
75
{
76
BossAI::EnterCombat
(who);
77
Talk
(
SAY_AGGRO
);
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
84
void
UpdateAI
(
uint32
diff)
OVERRIDE
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();
98
Talk
(
SAY_DEFEAT
);
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))
108
DoCast
(
me
,
SPELL_AEGIS_OF_RAGNAROS
,
true
);
109
110
while
(
uint32
eventId =
events
.ExecuteEvent())
111
{
112
switch
(eventId)
113
{
114
case
EVENT_MAGIC_REFLECTION
:
115
DoCast
(
me
,
SPELL_MAGIC_REFLECTION
);
116
events
.ScheduleEvent(
EVENT_MAGIC_REFLECTION
, 30000);
117
break
;
118
case
EVENT_DAMAGE_REFLECTION
:
119
DoCast
(
me
,
SPELL_DAMAGE_REFLECTION
);
120
events
.ScheduleEvent(
EVENT_DAMAGE_REFLECTION
, 30000);
121
break
;
122
case
EVENT_BLAST_WAVE
:
123
DoCastVictim
(
SPELL_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
136
DoMeleeAttackIfReady
();
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());
148
me
->SetFlag(
UNIT_FIELD_NPC_FLAGS
,
UNIT_NPC_FLAG_GOSSIP
);
149
break
;
150
case
EVENT_OUTRO_2
:
151
if
(
instance
)
152
instance
->instance->SummonCreature(
NPC_RAGNAROS
,
RagnarosSummonPos
);
153
break
;
154
case
EVENT_OUTRO_3
:
155
Talk
(
SAY_ARRIVAL2_MAJ
);
156
break
;
157
default
:
158
break
;
159
}
160
}
161
}
162
}
163
164
void
DoAction
(
int32
action)
OVERRIDE
165
{
166
if
(action ==
ACTION_START_RAGNAROS
)
167
{
168
me
->RemoveFlag(
UNIT_FIELD_NPC_FLAGS
,
UNIT_NPC_FLAG_GOSSIP
);
169
Talk
(
SAY_SUMMON_MAJ
);
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);
176
me
->SetFlag(
UNIT_FIELD_NPC_FLAGS
,
UNIT_NPC_FLAG_GOSSIP
);
177
}
178
}
179
};
180
181
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
182
{
183
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_SELECT
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+1);
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
195
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
196
{
197
return
new
boss_majordomoAI
(creature);
198
}
199
};
200
201
void
AddSC_boss_majordomo
()
202
{
203
new
boss_majordomo
();
204
}
Spells
Spells
Definition
BattlegroundIC.h:645
int32
std::int32_t int32
Definition
Define.h:73
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
GOSSIP_ICON_CHAT
@ GOSSIP_ICON_CHAT
Definition
GossipDef.h:46
DONE
@ DONE
Definition
InstanceScript.h:49
ObjectMgr.h
EncounterCreditType::ENCOUNTER_CREDIT_KILL_CREATURE
@ ENCOUNTER_CREDIT_KILL_CREATURE
Definition
ObjectMgr.h:639
Player.h
ScriptMgr.h
ScriptedCreature.h
ScriptedGossip.h
GOSSIP_SENDER_MAIN
@ GOSSIP_SENDER_MAIN
Definition
ScriptedGossip.h:58
GOSSIP_ACTION_INFO_DEF
@ GOSSIP_ACTION_INFO_DEF
Definition
ScriptedGossip.h:56
UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_GOSSIP
Definition
Unit.h:687
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:527
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_NPC_FLAGS
Definition
UpdateFields.h:107
Events
Events
Definition
alterac_valley.cpp:40
Texts
Texts
Definition
boss_alizabal.cpp:13
SAY_SLAY
@ SAY_SLAY
Definition
boss_alizabal.cpp:20
SAY_AGGRO
#define SAY_AGGRO
Definition
boss_commander_kolurg.cpp:28
GOSSIP_HELLO
#define GOSSIP_HELLO
Definition
boss_majordomo_executus.cpp:42
GOSSIP_SELECT
#define GOSSIP_SELECT
Definition
boss_majordomo_executus.cpp:43
SPELL_TELEPORT
@ SPELL_TELEPORT
Definition
boss_majordomo_executus.cpp:38
SPELL_BLAST_WAVE
@ SPELL_BLAST_WAVE
Definition
boss_majordomo_executus.cpp:36
SPELL_DAMAGE_REFLECTION
@ SPELL_DAMAGE_REFLECTION
Definition
boss_majordomo_executus.cpp:35
SPELL_SUMMON_RAGNAROS
@ SPELL_SUMMON_RAGNAROS
Definition
boss_majordomo_executus.cpp:39
SPELL_AEGIS_OF_RAGNAROS
@ SPELL_AEGIS_OF_RAGNAROS
Definition
boss_majordomo_executus.cpp:37
SPELL_MAGIC_REFLECTION
@ SPELL_MAGIC_REFLECTION
Definition
boss_majordomo_executus.cpp:34
AddSC_boss_majordomo
void AddSC_boss_majordomo()
Definition
boss_majordomo_executus.cpp:201
SAY_ARRIVAL2_MAJ
@ SAY_ARRIVAL2_MAJ
Definition
boss_majordomo_executus.cpp:29
SAY_AGGRO
@ SAY_AGGRO
Definition
boss_majordomo_executus.cpp:22
SAY_SPECIAL
@ SAY_SPECIAL
Definition
boss_majordomo_executus.cpp:25
SAY_SLAY
@ SAY_SLAY
Definition
boss_majordomo_executus.cpp:24
SAY_SPAWN
@ SAY_SPAWN
Definition
boss_majordomo_executus.cpp:23
SAY_SUMMON_MAJ
@ SAY_SUMMON_MAJ
Definition
boss_majordomo_executus.cpp:28
SAY_DEFEAT
@ SAY_DEFEAT
Definition
boss_majordomo_executus.cpp:26
EVENT_OUTRO_2
@ EVENT_OUTRO_2
Definition
boss_majordomo_executus.cpp:53
EVENT_OUTRO_3
@ EVENT_OUTRO_3
Definition
boss_majordomo_executus.cpp:54
EVENT_DAMAGE_REFLECTION
@ EVENT_DAMAGE_REFLECTION
Definition
boss_majordomo_executus.cpp:48
EVENT_TELEPORT
@ EVENT_TELEPORT
Definition
boss_majordomo_executus.cpp:50
EVENT_MAGIC_REFLECTION
@ EVENT_MAGIC_REFLECTION
Definition
boss_majordomo_executus.cpp:47
EVENT_BLAST_WAVE
@ EVENT_BLAST_WAVE
Definition
boss_majordomo_executus.cpp:49
EVENT_OUTRO_1
@ EVENT_OUTRO_1
Definition
boss_majordomo_executus.cpp:52
EVENT_BLAST_WAVE
@ EVENT_BLAST_WAVE
Definition
boss_overlord_wyrmthalak.cpp:20
BossAI::instance
InstanceScript *const instance
Definition
ScriptedCreature.h:383
BossAI::events
EventMap events
Definition
ScriptedCreature.h:439
BossAI::BossAI
BossAI(Creature *creature, uint32 bossId)
Definition
ScriptedCreature.cpp:456
BossAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
ScriptedCreature.h:404
BossAI::_JustDied
void _JustDied()
Definition
ScriptedCreature.cpp:474
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Definition
CreatureAI.cpp:28
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
Player
Definition
Player.h:1289
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::SelectTarget
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition
UnitAI.cpp:66
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
Unit
Definition
Unit.h:1367
boss_majordomo
Definition
boss_majordomo_executus.cpp:58
boss_majordomo::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
boss_majordomo_executus.cpp:181
boss_majordomo::boss_majordomo
boss_majordomo()
Definition
boss_majordomo_executus.cpp:60
boss_majordomo::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
boss_majordomo_executus.cpp:195
boss_majordomo::OnGossipSelect
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32) OVERRIDE
Definition
boss_majordomo_executus.cpp:188
molten_core.h
ACTION_START_RAGNAROS
@ ACTION_START_RAGNAROS
Definition
molten_core.h:26
ACTION_START_RAGNAROS_ALT
@ ACTION_START_RAGNAROS_ALT
Definition
molten_core.h:27
NPC_RAGNAROS
@ NPC_RAGNAROS
Definition
molten_core.h:44
NPC_FLAMEWAKER_ELITE
@ NPC_FLAMEWAKER_ELITE
Definition
molten_core.h:46
NPC_FLAMEWAKER_HEALER
@ NPC_FLAMEWAKER_HEALER
Definition
molten_core.h:45
RagnarosSummonPos
Position const RagnarosSummonPos
Definition
molten_core.h:31
RagnarosTelePos
Position const RagnarosTelePos
Definition
molten_core.h:30
BOSS_MAJORDOMO_EXECUTUS
@ BOSS_MAJORDOMO_EXECUTUS
Definition
molten_core.h:19
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::HealthBelowPct
bool HealthBelowPct(uint32 pct) const
Definition
ScriptedCreature.h:247
boss_majordomo::boss_majordomoAI
Definition
boss_majordomo_executus.cpp:63
boss_majordomo::boss_majordomoAI::DoAction
void DoAction(int32 action) OVERRIDE
Definition
boss_majordomo_executus.cpp:164
boss_majordomo::boss_majordomoAI::EnterCombat
void EnterCombat(Unit *who) OVERRIDE
Definition
boss_majordomo_executus.cpp:74
boss_majordomo::boss_majordomoAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
boss_majordomo_executus.cpp:84
boss_majordomo::boss_majordomoAI::boss_majordomoAI
boss_majordomoAI(Creature *creature)
Definition
boss_majordomo_executus.cpp:64
boss_majordomo::boss_majordomoAI::KilledUnit
void KilledUnit(Unit *) OVERRIDE
Definition
boss_majordomo_executus.cpp:68
src
server
scripts
EasternKingdoms
BlackrockMountain
MoltenCore
boss_majordomo_executus.cpp
Generated on
for Project SkyFire Core by
1.17.0