Project SkyFire Core
SkyFire 5.4.8 server core API documentation
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
6SDName: Hyjal
7SD%Complete: 80
8SDComment: gossip text id's unknown
9SDCategory: Caverns of Time, Mount Hyjal
10EndScriptData */
11
12/* ContentData
13npc_jaina_proudmoore
14npc_thrall
15npc_tyrande_whisperwind
16EndContentData */
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
38{
39public:
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 {
49 ai->StartEvent(player);
50 break;
52 ai->FirstBossDead = true;
53 ai->WaveCount = 9;
54 ai->StartEvent(player);
55 break;
57 ai->Retreat();
58 break;
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
74 uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT);
75 if (RageEncounter == NOT_STARTED)
77 else if (RageEncounter == DONE && AnetheronEncounter == NOT_STARTED)
79 else if (RageEncounter == DONE && AnetheronEncounter == DONE)
81
82 if (player->IsGameMaster())
84
85 player->SEND_GOSSIP_MENU(907, creature->GetGUID());
86 return true;
87 }
88
90 {
91 hyjalAI* ai = new hyjalAI(creature);
92
93 ai->Reset();
94 ai->EnterEvadeMode();
95
97 ai->Spells[0].Cooldown = std::rand() % 35000 + 15000;
99
101 ai->Spells[1].Cooldown = std::rand() % 9500 + 5500;
103
105 ai->Spells[2].Cooldown = std::rand() % 45000 + 15000;
107
108 return ai;
109 }
110};
111
113{
114public:
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;
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)
157 else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED)
159 else if (AzgalorEvent == DONE)
161 }
162
163 if (player->IsGameMaster())
165
166 player->SEND_GOSSIP_MENU(907, creature->GetGUID());
167 return true;
168 }
169
171 {
172 hyjalAI* ai = new hyjalAI(creature);
173
174 ai->Reset();
175 ai->EnterEvadeMode();
176
178 ai->Spells[0].Cooldown = std::rand() % 8000 + 3000;
180
182 ai->Spells[1].Cooldown = std::rand() % 41000 + 6000;
184
185 return ai;
186 }
187};
188
190{
191public:
192 npc_tyrande_whisperwind() : CreatureScript("npc_tyrande_whisperwind") { }
193
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))
226 player->SEND_GOSSIP_MENU(907, creature->GetGUID());
227 return true;
228 }
229};
230
232{
234 new npc_thrall();
236}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ GOSSIP_ICON_TRAINER
Definition GossipDef.h:49
@ DONE
@ NOT_STARTED
@ EQUIP_ERR_OK
Definition Item.h:28
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:777
#define CAST_AI(a, b)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ NULL_BAG
Definition Unit.h:336
@ NULL_SLOT
Definition Unit.h:337
@ SPELL_CHAIN_LIGHTNING
CreatureScript(const char *name)
Definition Item.h:202
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition hyjal.cpp:42
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition hyjal.cpp:67
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition hyjal.cpp:89
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition hyjal.cpp:143
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition hyjal.cpp:170
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition hyjal.cpp:117
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition hyjal.cpp:194
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Definition hyjal.cpp:202
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Definition hyjal.cpp:218
#define GOSSIP_ITEM_RETREAT
Definition hyjal.cpp:30
#define GOSSIP_ITEM_ANETHERON
Definition hyjal.cpp:25
void AddSC_hyjal()
Definition hyjal.cpp:231
#define GOSSIP_ITEM_BEGIN_ALLY
Definition hyjal.cpp:24
#define GOSSIP_ITEM_GM1
Definition hyjal.cpp:35
#define ITEM_TEAR_OF_GODDESS
Definition hyjal.cpp:33
#define GOSSIP_ITEM_BEGIN_HORDE
Definition hyjal.cpp:27
#define GOSSIP_ITEM_TYRANDE
Definition hyjal.cpp:32
#define GOSSIP_ITEM_AZGALOR
Definition hyjal.cpp:28
@ DATA_RAGEWINTERCHILLEVENT
Definition hyjal.h:25
@ DATA_KAZROGALEVENT
Definition hyjal.h:23
@ DATA_AZGALOREVENT
Definition hyjal.h:20
@ DATA_ANETHERONEVENT
Definition hyjal.h:16
@ DATA_ALLIANCE_RETREAT
Definition hyjal.h:30
@ TARGETTYPE_RANDOM
Definition hyjalAI.h:90
@ TARGETTYPE_SELF
Definition hyjalAI.h:89
@ TARGETTYPE_VICTIM
Definition hyjalAI.h:91
@ SPELL_SUMMON_ELEMENTALS
Definition hyjalAI.h:23
@ SPELL_SUMMON_DIRE_WOLF
Definition hyjalAI.h:27
uint32 TargetType
Definition hyjalAI.h:187
uint32 Cooldown
Definition hyjalAI.h:186
uint32 SpellId
Definition hyjalAI.h:185
bool Debug
Definition hyjalAI.h:164
bool FirstBossDead
Definition hyjalAI.h:160
void Reset()
Definition hyjalAI.cpp:337
struct hyjalAI::Spell Spells[HYJAL_AI_MAX_SPELLS]
void StartEvent(Player *player)
Definition hyjalAI.cpp:576
void EnterEvadeMode()
Definition hyjalAI.cpp:403
void DeSpawnVeins()
Definition hyjalAI.cpp:668
bool EventBegun
Definition hyjalAI.h:159
void Retreat()
Definition hyjalAI.cpp:608
uint32 GetInstanceData(uint32 Event)
Definition hyjalAI.cpp:599
uint32 WaveCount
Definition hyjalAI.h:153