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

Classes

struct  npc_hor_leaderAI
 

Public Member Functions

 npc_hor_leader ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 uiAction) 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
 
uint16 GetTotalAvailableHooks ()
 
- 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, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_hor_leader()

npc_hor_leader::npc_hor_leader ( )
inline
138: CreatureScript("npc_hor_leader") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

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

Reimplemented from CreatureScript.

211 {
212 return GetHallsOfReflectionAI<npc_hor_leaderAI>(creature);
213 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

141 {
142 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
143 return true;
144
145 if (creature->IsQuestGiver())
146 player->PrepareQuestMenu(creature->GetGUID());
147
148 bool canStart = true;
149 if (InstanceScript* instance = creature->GetInstanceScript())
150 if (uint32 bhd = instance->GetData(DATA_BATTERED_HILT))
151 if ((bhd & BHSF_FINISHED) == 0)
152 canStart = false;
153
154 if (canStart)
155 {
157 if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
158 {
160 }
161
162 // once last quest is completed, she offers this shortcut of the starting event
164 if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
165 {
167 }
168 }
169
170 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
171
172 return true;
173 }
std::uint32_t uint32
Definition: Define.h:107
QuestStatus
Definition: QuestDef.h:99
@ QUEST_STATUS_REWARDED
Definition: QuestDef.h:106
@ QUEST_STATUS_COMPLETE
Definition: QuestDef.h:101
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
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
@ NPC_SYLVANAS_PART1
Definition: forge_of_souls.h:40
@ BHSF_FINISHED
Definition: halls_of_reflection.h:114
@ QUEST_WRATH_OF_THE_LICH_KING_H2
Definition: halls_of_reflection.h:253
@ QUEST_DELIVRANCE_FROM_THE_PIT_H2
Definition: halls_of_reflection.h:251
@ QUEST_WRATH_OF_THE_LICH_KING_A2
Definition: halls_of_reflection.h:252
@ QUEST_DELIVRANCE_FROM_THE_PIT_A2
Definition: halls_of_reflection.h:250
@ DATA_BATTERED_HILT
Definition: halls_of_reflection.h:36
@ GOSSIP_OPTION_START
Definition: halls_of_reflection.cpp:119
@ GOSSIP_OPTION_START_SKIP
Definition: halls_of_reflection.cpp:120
@ GOSSIP_MENU_SYLVANAS
Definition: halls_of_reflection.cpp:116
@ GOSISP_MENU_JAINA
Definition: halls_of_reflection.cpp:117
uint32 GetEntry() const
Definition: Object.h:112
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1424
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404
bool IsQuestGiver() const
Definition: Unit.h:718
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:694
Definition: InstanceScript.h:142

References AddGossipItemFor(), BHSF_FINISHED, DATA_BATTERED_HILT, Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), WorldObject::GetInstanceScript(), Player::GetQuestStatus(), GOSISP_MENU_JAINA, GOSSIP_ACTION_INFO_DEF, GOSSIP_MENU_SYLVANAS, GOSSIP_OPTION_START, GOSSIP_OPTION_START_SKIP, GOSSIP_SENDER_MAIN, Unit::HasNpcFlag(), Unit::IsQuestGiver(), NPC_SYLVANAS_PART1, Player::PrepareQuestMenu(), QUEST_DELIVRANCE_FROM_THE_PIT_A2, QUEST_DELIVRANCE_FROM_THE_PIT_H2, QUEST_STATUS_COMPLETE, QUEST_STATUS_REWARDED, QUEST_WRATH_OF_THE_LICH_KING_A2, QUEST_WRATH_OF_THE_LICH_KING_H2, SendGossipMenuFor(), and UNIT_NPC_FLAG_GOSSIP.

◆ OnGossipSelect()

bool npc_hor_leader::OnGossipSelect ( Player player,
Creature creature,
uint32  ,
uint32  uiAction 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

176 {
177 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
178 return true;
179
180 InstanceScript* instance = creature->GetInstanceScript();
181 if (!instance)
182 return true;
183
184 if (uint32 bhd = instance->GetData(DATA_BATTERED_HILT))
185 if ((bhd & BHSF_FINISHED) == 0)
186 return true;
187
188 instance->SetData(DATA_BATTERED_HILT, 1);
189
190 ClearGossipMenuFor(player);
191 switch (uiAction)
192 {
194 CloseGossipMenuFor(player);
195 if (creature->AI())
196 creature->AI()->DoAction(ACTION_START_INTRO);
198 break;
200 CloseGossipMenuFor(player);
201 if (creature->AI())
202 creature->AI()->DoAction(ACTION_SKIP_INTRO);
204 break;
205 }
206
207 return true;
208 }
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: UnitDefines.h:295
@ ACTION_SKIP_INTRO
Definition: halls_of_reflection.h:244
@ ACTION_START_INTRO
Definition: boss_nightbane.cpp:57
virtual void DoAction(int32)
Definition: UnitAI.h:212
CreatureAI * AI() const
Definition: Creature.h:143
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:696
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:52
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53

References ACTION_SKIP_INTRO, ACTION_START_INTRO, Creature::AI(), BHSF_FINISHED, ClearGossipMenuFor(), CloseGossipMenuFor(), DATA_BATTERED_HILT, UnitAI::DoAction(), ZoneScript::GetData(), WorldObject::GetInstanceScript(), GOSSIP_ACTION_INFO_DEF, Unit::HasNpcFlag(), Unit::RemoveNpcFlag(), ZoneScript::SetData(), UNIT_NPC_FLAG_GOSSIP, and UNIT_NPC_FLAG_QUESTGIVER.