AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_thrall Class Reference
Inheritance diagram for npc_thrall:
CreatureScript ScriptObject UpdatableScript< Creature >

Public Member Functions

 npc_thrall ()
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 action) override
 
bool OnGossipHello (Player *player, Creature *creature) override
 
CreatureAIGetAI (Creature *creature) const override
 
- Public Member Functions inherited from CreatureScript
bool IsDatabaseBound () const override
 
virtual bool OnGossipHello (Player *, Creature *)
 
virtual bool OnGossipSelect (Player *, Creature *, uint32, uint32)
 
virtual bool OnGossipSelectCode (Player *, Creature *, uint32, uint32, const char *)
 
virtual bool OnQuestAccept (Player *, Creature *, Quest const *)
 
virtual bool OnQuestSelect (Player *, Creature *, Quest const *)
 
virtual bool OnQuestComplete (Player *, Creature *, Quest const *)
 
virtual bool OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
virtual void OnFfaPvpStateUpdate (Creature *, bool)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Additional Inherited Members

- Protected Member Functions inherited from CreatureScript
 CreatureScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()=default
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_thrall()

npc_thrall::npc_thrall ( )
inline
131: CreatureScript("npc_thrall") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

CreatureAI * npc_thrall::GetAI ( Creature creature) const
inlineoverridevirtual

Reimplemented from CreatureScript.

187 {
188 if (!creature->GetInstanceScript())
189 return nullptr;
190
191 hyjalAI* ai = new hyjalAI(creature);
192
193 ai->Reset();
194 ai->EnterEvadeMode();
195
197 ai->Spells[0].Cooldown = urand(3000, 8000);
199
201 ai->Spells[1].Cooldown = urand(6000, 41000);
203
204 return ai;
205 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ TARGETTYPE_RANDOM
Definition: hyjalAI.h:104
@ TARGETTYPE_VICTIM
Definition: hyjalAI.h:105
@ SPELL_SUMMON_DIRE_WOLF
Definition: hyjalAI.h:39
#define SPELL_CHAIN_LIGHTNING
Definition: boss_grand_champions.cpp:101
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
Definition: hyjalAI.h:120
struct hyjalAI::Spell Spells[HYJAL_AI_MAX_SPELLS]
void Reset() override
Definition: hyjalAI.cpp:346
void EnterEvadeMode(EvadeReason=EVADE_REASON_OTHER) override
Definition: hyjalAI.cpp:409
uint32 TargetType
Definition: hyjalAI.h:201
uint32 Cooldown
Definition: hyjalAI.h:200
uint32 SpellId
Definition: hyjalAI.h:199

References hyjalAI::Spell::Cooldown, hyjalAI::EnterEvadeMode(), WorldObject::GetInstanceScript(), hyjalAI::Reset(), SPELL_CHAIN_LIGHTNING, SPELL_SUMMON_DIRE_WOLF, hyjalAI::Spell::SpellId, hyjalAI::Spells, hyjalAI::Spell::TargetType, TARGETTYPE_RANDOM, TARGETTYPE_VICTIM, and urand().

◆ OnGossipHello()

bool npc_thrall::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

160 {
161 hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
162 if (ai->EventBegun)
163 return false;
164
165 uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT);
166 // Only let them start the Horde phases if Anetheron is dead.
167 if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT))
168 {
169 uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT);
170 uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
171 if (KazrogalEvent == NOT_STARTED)
173 else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED)
175 else if (AzgalorEvent == DONE)
177 }
178
179 if (player->IsGameMaster())
181
182 SendGossipMenuFor(player, 907, creature->GetGUID());
183 return true;
184 }
std::uint32_t uint32
Definition: Define.h:108
#define CAST_AI(a, b)
Definition: ScriptedCreature.h:28
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const guid)
Definition: ScriptedGossip.cpp:45
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition: ScriptedGossip.cpp:28
@ GOSSIP_SENDER_MAIN
Definition: ScriptedGossip.h:70
@ GOSSIP_ACTION_INFO_DEF
Definition: ScriptedGossip.h:68
@ GOSSIP_ICON_CHAT
Definition: GossipDef.h:60
@ GOSSIP_ICON_TRAINER
Definition: GossipDef.h:63
@ DONE
Definition: InstanceScript.h:60
@ NOT_STARTED
Definition: InstanceScript.h:57
#define GOSSIP_ITEM_RETREAT
Definition: hyjal.cpp:43
#define GOSSIP_ITEM_GM1
Definition: hyjal.cpp:48
#define GOSSIP_ITEM_BEGIN_HORDE
Definition: hyjal.cpp:40
#define GOSSIP_ITEM_AZGALOR
Definition: hyjal.cpp:41
@ DATA_KAZROGALEVENT
Definition: hyjal.h:45
@ DATA_AZGALOREVENT
Definition: hyjal.h:42
@ DATA_ANETHERONEVENT
Definition: hyjal.h:38
@ DATA_ALLIANCE_RETREAT
Definition: hyjal.h:52
CreatureAI * AI() const
Definition: Creature.h:136
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
bool IsGameMaster() const
Definition: Player.h:1148
bool EventBegun
Definition: hyjalAI.h:173
uint32 GetInstanceData(uint32 Event)
Definition: hyjalAI.cpp:599

References AddGossipItemFor(), Creature::AI(), CAST_AI, DATA_ALLIANCE_RETREAT, DATA_ANETHERONEVENT, DATA_AZGALOREVENT, DATA_KAZROGALEVENT, DONE, hyjalAI::EventBegun, Object::GetGUID(), hyjalAI::GetInstanceData(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ICON_CHAT, GOSSIP_ICON_TRAINER, GOSSIP_ITEM_AZGALOR, GOSSIP_ITEM_BEGIN_HORDE, GOSSIP_ITEM_GM1, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, Player::IsGameMaster(), NOT_STARTED, and SendGossipMenuFor().

◆ OnGossipSelect()

bool npc_thrall::OnGossipSelect ( Player player,
Creature creature,
uint32  ,
uint32  action 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

134 {
135 ClearGossipMenuFor(player);
136 hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
137 ai->DeSpawnVeins();//despawn the alliance veins
138 switch (action)
139 {
140 case GOSSIP_ACTION_INFO_DEF + 1:
141 ai->StartEvent(player);
142 break;
143 case GOSSIP_ACTION_INFO_DEF + 2:
144 ai->FirstBossDead = true;
145 ai->WaveCount = 9;
146 ai->StartEvent(player);
147 break;
148 case GOSSIP_ACTION_INFO_DEF + 3:
149 ai->Retreat();
150 break;
152 ai->Debug = !ai->Debug;
153 //LOG_DEBUG("scripts", "HyjalAI - Debug mode has been toggled");
154 break;
155 }
156 return true;
157 }
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
bool Debug
Definition: hyjalAI.h:178
bool FirstBossDead
Definition: hyjalAI.h:174
void StartEvent(Player *player)
Definition: hyjalAI.cpp:576
void DeSpawnVeins()
Definition: hyjalAI.cpp:663
void Retreat()
Definition: hyjalAI.cpp:604
uint32 WaveCount
Definition: hyjalAI.h:167

References Creature::AI(), CAST_AI, ClearGossipMenuFor(), hyjalAI::Debug, hyjalAI::DeSpawnVeins(), hyjalAI::FirstBossDead, GOSSIP_ACTION_INFO_DEF, hyjalAI::Retreat(), hyjalAI::StartEvent(), and hyjalAI::WaveCount.