Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
hyjal.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
/* ScriptData
6
SDName: Hyjal
7
SD%Complete: 80
8
SDComment: gossip text id's unknown
9
SDCategory: Caverns of Time, Mount Hyjal
10
EndScriptData */
11
12
/* ContentData
13
npc_jaina_proudmoore
14
npc_thrall
15
npc_tyrande_whisperwind
16
EndContentData */
17
18
#include "
ScriptMgr.h
"
19
#include "
ScriptedCreature.h
"
20
#include "
ScriptedGossip.h
"
21
#include "
hyjalAI.h
"
22
#include "
Player.h
"
23
24
#define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore."
25
#define GOSSIP_ITEM_ANETHERON "We are ready for whatever Archimonde might send our way, Lady Proudmoore."
26
27
#define GOSSIP_ITEM_BEGIN_HORDE "I am with you, Thrall."
28
#define GOSSIP_ITEM_AZGALOR "We have nothing to fear."
29
30
#define GOSSIP_ITEM_RETREAT "We can't keep this up. Let's retreat!"
31
32
#define GOSSIP_ITEM_TYRANDE "Aid us in defending Nordrassil"
33
#define ITEM_TEAR_OF_GODDESS 24494
34
35
#define GOSSIP_ITEM_GM1 "[GM] Toggle Debug Timers"
36
37
class
npc_jaina_proudmoore
:
public
CreatureScript
38
{
39
public
:
40
npc_jaina_proudmoore
() :
CreatureScript
(
"npc_jaina_proudmoore"
) { }
41
42
bool
OnGossipSelect
(
Player
* player,
Creature
* creature,
uint32
/*sender*/
,
uint32
action)
OVERRIDE
43
{
44
player->PlayerTalkClass->ClearMenus();
45
hyjalAI
* ai =
CAST_AI
(
hyjalAI
, creature->AI());
46
switch
(action)
47
{
48
case
GOSSIP_ACTION_INFO_DEF
+ 1:
49
ai->
StartEvent
(player);
50
break
;
51
case
GOSSIP_ACTION_INFO_DEF
+ 2:
52
ai->
FirstBossDead
=
true
;
53
ai->
WaveCount
= 9;
54
ai->
StartEvent
(player);
55
break
;
56
case
GOSSIP_ACTION_INFO_DEF
+ 3:
57
ai->
Retreat
();
58
break
;
59
case
GOSSIP_ACTION_INFO_DEF
:
60
ai->
Debug
= !ai->
Debug
;
61
SF_LOG_DEBUG
(
"scripts"
,
"HyjalAI - Debug mode has been toggled"
);
62
break
;
63
}
64
return
true
;
65
}
66
67
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
68
{
69
hyjalAI
* ai =
CAST_AI
(
hyjalAI
, creature->AI());
70
if
(ai->
EventBegun
)
71
return
false
;
72
73
uint32
RageEncounter = ai->
GetInstanceData
(
DATA_RAGEWINTERCHILLEVENT
);
74
uint32
AnetheronEncounter = ai->
GetInstanceData
(
DATA_ANETHERONEVENT
);
75
if
(RageEncounter ==
NOT_STARTED
)
76
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_BEGIN_ALLY
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 1);
77
else
if
(RageEncounter ==
DONE
&& AnetheronEncounter ==
NOT_STARTED
)
78
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_ANETHERON
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 2);
79
else
if
(RageEncounter ==
DONE
&& AnetheronEncounter ==
DONE
)
80
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_RETREAT
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 3);
81
82
if
(player->IsGameMaster())
83
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_TRAINER
,
GOSSIP_ITEM_GM1
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
);
84
85
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
86
return
true
;
87
}
88
89
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
90
{
91
hyjalAI
* ai =
new
hyjalAI
(creature);
92
93
ai->
Reset
();
94
ai->
EnterEvadeMode
();
95
96
ai->
Spells
[0].
SpellId
=
SPELL_BLIZZARD
;
97
ai->
Spells
[0].
Cooldown
= std::rand() % 35000 + 15000;
98
ai->
Spells
[0].
TargetType
=
TARGETTYPE_RANDOM
;
99
100
ai->
Spells
[1].
SpellId
=
SPELL_PYROBLAST
;
101
ai->
Spells
[1].
Cooldown
= std::rand() % 9500 + 5500;
102
ai->
Spells
[1].
TargetType
=
TARGETTYPE_RANDOM
;
103
104
ai->
Spells
[2].
SpellId
=
SPELL_SUMMON_ELEMENTALS
;
105
ai->
Spells
[2].
Cooldown
= std::rand() % 45000 + 15000;
106
ai->
Spells
[2].
TargetType
=
TARGETTYPE_SELF
;
107
108
return
ai;
109
}
110
};
111
112
class
npc_thrall
:
public
CreatureScript
113
{
114
public
:
115
npc_thrall
() :
CreatureScript
(
"npc_thrall"
) { }
116
117
bool
OnGossipSelect
(
Player
* player,
Creature
* creature,
uint32
/*sender*/
,
uint32
action)
OVERRIDE
118
{
119
player->PlayerTalkClass->ClearMenus();
120
hyjalAI
* ai =
CAST_AI
(
hyjalAI
, creature->AI());
121
ai->
DeSpawnVeins
();
//despawn the alliance veins
122
switch
(action)
123
{
124
case
GOSSIP_ACTION_INFO_DEF
+ 1:
125
ai->
StartEvent
(player);
126
break
;
127
case
GOSSIP_ACTION_INFO_DEF
+ 2:
128
ai->
FirstBossDead
=
true
;
129
ai->
WaveCount
= 9;
130
ai->
StartEvent
(player);
131
break
;
132
case
GOSSIP_ACTION_INFO_DEF
+ 3:
133
ai->
Retreat
();
134
break
;
135
case
GOSSIP_ACTION_INFO_DEF
:
136
ai->
Debug
= !ai->
Debug
;
137
SF_LOG_DEBUG
(
"scripts"
,
"HyjalAI - Debug mode has been toggled"
);
138
break
;
139
}
140
return
true
;
141
}
142
143
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
144
{
145
hyjalAI
* ai =
CAST_AI
(
hyjalAI
, creature->AI());
146
if
(ai->
EventBegun
)
147
return
false
;
148
149
uint32
AnetheronEvent = ai->
GetInstanceData
(
DATA_ANETHERONEVENT
);
150
// Only let them start the Horde phases if Anetheron is dead.
151
if
(AnetheronEvent ==
DONE
&& ai->
GetInstanceData
(
DATA_ALLIANCE_RETREAT
))
152
{
153
uint32
KazrogalEvent = ai->
GetInstanceData
(
DATA_KAZROGALEVENT
);
154
uint32
AzgalorEvent = ai->
GetInstanceData
(
DATA_AZGALOREVENT
);
155
if
(KazrogalEvent ==
NOT_STARTED
)
156
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_BEGIN_HORDE
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 1);
157
else
if
(KazrogalEvent ==
DONE
&& AzgalorEvent ==
NOT_STARTED
)
158
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_AZGALOR
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 2);
159
else
if
(AzgalorEvent ==
DONE
)
160
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_RETREAT
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
+ 3);
161
}
162
163
if
(player->IsGameMaster())
164
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_TRAINER
,
GOSSIP_ITEM_GM1
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
);
165
166
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
167
return
true
;
168
}
169
170
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
171
{
172
hyjalAI
* ai =
new
hyjalAI
(creature);
173
174
ai->
Reset
();
175
ai->
EnterEvadeMode
();
176
177
ai->
Spells
[0].
SpellId
=
SPELL_CHAIN_LIGHTNING
;
178
ai->
Spells
[0].
Cooldown
= std::rand() % 8000 + 3000;
179
ai->
Spells
[0].
TargetType
=
TARGETTYPE_VICTIM
;
180
181
ai->
Spells
[1].
SpellId
=
SPELL_SUMMON_DIRE_WOLF
;
182
ai->
Spells
[1].
Cooldown
= std::rand() % 41000 + 6000;
183
ai->
Spells
[1].
TargetType
=
TARGETTYPE_RANDOM
;
184
185
return
ai;
186
}
187
};
188
189
class
npc_tyrande_whisperwind
:
public
CreatureScript
190
{
191
public
:
192
npc_tyrande_whisperwind
() :
CreatureScript
(
"npc_tyrande_whisperwind"
) { }
193
194
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
195
{
196
hyjalAI
* ai =
new
hyjalAI
(creature);
197
ai->
Reset
();
198
ai->
EnterEvadeMode
();
199
return
ai;
200
}
201
202
bool
OnGossipSelect
(
Player
* player,
Creature
* creature,
uint32
/*sender*/
,
uint32
action)
OVERRIDE
203
{
204
player->PlayerTalkClass->ClearMenus();
205
if
(action ==
GOSSIP_ACTION_INFO_DEF
)
206
{
207
ItemPosCountVec
dest;
208
uint8
msg = player->CanStoreNewItem(
NULL_BAG
,
NULL_SLOT
, dest,
ITEM_TEAR_OF_GODDESS
, 1);
209
if
(msg ==
EQUIP_ERR_OK
)
210
if
(
Item
* item = player->StoreNewItem(dest,
ITEM_TEAR_OF_GODDESS
,
true
))
211
player->SendNewItem(item, 1,
true
,
false
,
true
);
212
213
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
214
}
215
return
true
;
216
}
217
218
bool
OnGossipHello
(
Player
* player,
Creature
* creature)
OVERRIDE
219
{
220
hyjalAI
* ai =
CAST_AI
(
hyjalAI
, creature->AI());
221
uint32
AzgalorEvent = ai->
GetInstanceData
(
DATA_AZGALOREVENT
);
222
223
// Only let them get item if Azgalor is dead.
224
if
(AzgalorEvent ==
DONE
&& !player->HasItemCount(
ITEM_TEAR_OF_GODDESS
))
225
player->ADD_GOSSIP_ITEM(
GOSSIP_ICON_CHAT
,
GOSSIP_ITEM_TYRANDE
,
GOSSIP_SENDER_MAIN
,
GOSSIP_ACTION_INFO_DEF
);
226
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
227
return
true
;
228
}
229
};
230
231
void
AddSC_hyjal
()
232
{
233
new
npc_jaina_proudmoore
();
234
new
npc_thrall
();
235
new
npc_tyrande_whisperwind
();
236
}
uint8
std::uint8_t uint8
Definition
Define.h:79
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
GOSSIP_ICON_TRAINER
@ GOSSIP_ICON_TRAINER
Definition
GossipDef.h:49
DONE
@ DONE
Definition
InstanceScript.h:49
NOT_STARTED
@ NOT_STARTED
Definition
InstanceScript.h:46
EQUIP_ERR_OK
@ EQUIP_ERR_OK
Definition
Item.h:28
SF_LOG_DEBUG
#define SF_LOG_DEBUG(filterType__,...)
Definition
Log.h:134
Player.h
ItemPosCountVec
std::vector< ItemPosCount > ItemPosCountVec
Definition
Player.h:777
ScriptMgr.h
ScriptedCreature.h
CAST_AI
#define CAST_AI(a, b)
Definition
ScriptedCreature.h:14
ScriptedGossip.h
GOSSIP_SENDER_MAIN
@ GOSSIP_SENDER_MAIN
Definition
ScriptedGossip.h:58
GOSSIP_ACTION_INFO_DEF
@ GOSSIP_ACTION_INFO_DEF
Definition
ScriptedGossip.h:56
NULL_BAG
@ NULL_BAG
Definition
Unit.h:336
NULL_SLOT
@ NULL_SLOT
Definition
Unit.h:337
SPELL_BLIZZARD
@ SPELL_BLIZZARD
Definition
boss_priestess_delrissa.cpp:736
SPELL_PYROBLAST
@ SPELL_PYROBLAST
Definition
boss_pyroguard_emberseer.cpp:32
SPELL_CHAIN_LIGHTNING
@ SPELL_CHAIN_LIGHTNING
Definition
bosses_opera.cpp:73
CreatureAI
Definition
CreatureAI.h:54
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
Item
Definition
Item.h:202
Player
Definition
Player.h:1289
npc_jaina_proudmoore
Definition
hyjal.cpp:38
npc_jaina_proudmoore::npc_jaina_proudmoore
npc_jaina_proudmoore()
Definition
hyjal.cpp:40
npc_jaina_proudmoore::OnGossipSelect
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition
hyjal.cpp:42
npc_jaina_proudmoore::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
hyjal.cpp:67
npc_jaina_proudmoore::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
hyjal.cpp:89
npc_thrall
Definition
hyjal.cpp:113
npc_thrall::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
hyjal.cpp:143
npc_thrall::npc_thrall
npc_thrall()
Definition
hyjal.cpp:115
npc_thrall::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
hyjal.cpp:170
npc_thrall::OnGossipSelect
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition
hyjal.cpp:117
npc_tyrande_whisperwind
Definition
hyjal.cpp:190
npc_tyrande_whisperwind::npc_tyrande_whisperwind
npc_tyrande_whisperwind()
Definition
hyjal.cpp:192
npc_tyrande_whisperwind::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
hyjal.cpp:194
npc_tyrande_whisperwind::OnGossipSelect
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition
hyjal.cpp:202
npc_tyrande_whisperwind::OnGossipHello
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition
hyjal.cpp:218
GOSSIP_ITEM_RETREAT
#define GOSSIP_ITEM_RETREAT
Definition
hyjal.cpp:30
GOSSIP_ITEM_ANETHERON
#define GOSSIP_ITEM_ANETHERON
Definition
hyjal.cpp:25
AddSC_hyjal
void AddSC_hyjal()
Definition
hyjal.cpp:231
GOSSIP_ITEM_BEGIN_ALLY
#define GOSSIP_ITEM_BEGIN_ALLY
Definition
hyjal.cpp:24
GOSSIP_ITEM_GM1
#define GOSSIP_ITEM_GM1
Definition
hyjal.cpp:35
ITEM_TEAR_OF_GODDESS
#define ITEM_TEAR_OF_GODDESS
Definition
hyjal.cpp:33
GOSSIP_ITEM_BEGIN_HORDE
#define GOSSIP_ITEM_BEGIN_HORDE
Definition
hyjal.cpp:27
GOSSIP_ITEM_TYRANDE
#define GOSSIP_ITEM_TYRANDE
Definition
hyjal.cpp:32
GOSSIP_ITEM_AZGALOR
#define GOSSIP_ITEM_AZGALOR
Definition
hyjal.cpp:28
DATA_RAGEWINTERCHILLEVENT
@ DATA_RAGEWINTERCHILLEVENT
Definition
hyjal.h:25
DATA_KAZROGALEVENT
@ DATA_KAZROGALEVENT
Definition
hyjal.h:23
DATA_AZGALOREVENT
@ DATA_AZGALOREVENT
Definition
hyjal.h:20
DATA_ANETHERONEVENT
@ DATA_ANETHERONEVENT
Definition
hyjal.h:16
DATA_ALLIANCE_RETREAT
@ DATA_ALLIANCE_RETREAT
Definition
hyjal.h:30
hyjalAI.h
TARGETTYPE_RANDOM
@ TARGETTYPE_RANDOM
Definition
hyjalAI.h:90
TARGETTYPE_SELF
@ TARGETTYPE_SELF
Definition
hyjalAI.h:89
TARGETTYPE_VICTIM
@ TARGETTYPE_VICTIM
Definition
hyjalAI.h:91
SPELL_SUMMON_ELEMENTALS
@ SPELL_SUMMON_ELEMENTALS
Definition
hyjalAI.h:23
SPELL_SUMMON_DIRE_WOLF
@ SPELL_SUMMON_DIRE_WOLF
Definition
hyjalAI.h:27
hyjalAI::Spell::TargetType
uint32 TargetType
Definition
hyjalAI.h:187
hyjalAI::Spell::Cooldown
uint32 Cooldown
Definition
hyjalAI.h:186
hyjalAI::Spell::SpellId
uint32 SpellId
Definition
hyjalAI.h:185
hyjalAI
Definition
hyjalAI.h:106
hyjalAI::Debug
bool Debug
Definition
hyjalAI.h:164
hyjalAI::FirstBossDead
bool FirstBossDead
Definition
hyjalAI.h:160
hyjalAI::Reset
void Reset()
Definition
hyjalAI.cpp:337
hyjalAI::Spells
struct hyjalAI::Spell Spells[HYJAL_AI_MAX_SPELLS]
hyjalAI::StartEvent
void StartEvent(Player *player)
Definition
hyjalAI.cpp:576
hyjalAI::EnterEvadeMode
void EnterEvadeMode()
Definition
hyjalAI.cpp:403
hyjalAI::DeSpawnVeins
void DeSpawnVeins()
Definition
hyjalAI.cpp:668
hyjalAI::EventBegun
bool EventBegun
Definition
hyjalAI.h:159
hyjalAI::Retreat
void Retreat()
Definition
hyjalAI.cpp:608
hyjalAI::GetInstanceData
uint32 GetInstanceData(uint32 Event)
Definition
hyjalAI.cpp:599
hyjalAI::WaveCount
uint32 WaveCount
Definition
hyjalAI.h:153
src
server
scripts
Kalimdor
CavernsOfTime
BattleForMountHyjal
hyjal.cpp
Generated on
for Project SkyFire Core by
1.17.0