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

Classes

struct  npc_elder_clearwaterAI
 

Public Member Functions

 npc_elder_clearwater ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnQuestReward (Player *player, Creature *creature, Quest const *quest, uint32) override
 
CreatureAIGetAI (Creature *pCreature) 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_elder_clearwater()

npc_elder_clearwater::npc_elder_clearwater ( )
inline
61: CreatureScript("npc_elder_clearwater") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

CreatureAI * npc_elder_clearwater::GetAI ( Creature pCreature) const
inlineoverridevirtual

Reimplemented from CreatureScript.

184 {
185 return new npc_elder_clearwaterAI (pCreature);
186 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

134 {
135 QuestRelationBounds pObjectQR;
136 QuestRelationBounds pObjectQIR;
137
138 // pets also can have quests
139 if (creature)
140 {
141 pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
142 pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
143 }
144 else
145 return true;
146
147 QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
148 qm.ClearMenu();
149
150 for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i)
151 {
152 uint32 quest_id = i->second;
153 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
154 if (!quest)
155 continue;
156
157 if (!creature->AI()->GetData(DATA_DERBY_FINISHED))
158 {
159 if (quest_id == QUEST_FISHING_DERBY)
160 player->PlayerTalkClass->SendQuestGiverRequestItems(quest, creature->GetGUID(), player->CanRewardQuest(quest, false), true);
161 }
162 else
163 {
164 if (quest_id != QUEST_FISHING_DERBY)
165 player->PlayerTalkClass->SendQuestGiverRequestItems(quest, creature->GetGUID(), player->CanRewardQuest(quest, false), true);
166 }
167 }
168
169 return true;
170 }
std::uint32_t uint32
Definition: Define.h:108
std::pair< QuestRelations::const_iterator, QuestRelations::const_iterator > QuestRelationBounds
Definition: ObjectMgr.h:519
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ QUEST_FISHING_DERBY
Definition: npcs_special.cpp:53
@ DATA_DERBY_FINISHED
Definition: npcs_special.cpp:55
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:202
CreatureAI * AI() const
Definition: Creature.h:136
Definition: GossipDef.h:228
void ClearMenu()
Definition: GossipDef.cpp:312
QuestMenu & GetQuestMenu()
Definition: GossipDef.h:264
void SendQuestGiverRequestItems(Quest const *quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
Definition: GossipDef.cpp:752
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
bool CanRewardQuest(Quest const *quest, bool msg)
Definition: PlayerQuest.cpp:384
PlayerMenu * PlayerTalkClass
Definition: Player.h:2201
Definition: QuestDef.h:207

References Creature::AI(), Player::CanRewardQuest(), QuestMenu::ClearMenu(), DATA_DERBY_FINISHED, UnitAI::GetData(), Object::GetEntry(), Object::GetGUID(), PlayerMenu::GetQuestMenu(), Player::PlayerTalkClass, QUEST_FISHING_DERBY, PlayerMenu::SendQuestGiverRequestItems(), and sObjectMgr.

◆ OnQuestReward()

bool npc_elder_clearwater::OnQuestReward ( Player player,
Creature creature,
Quest const *  quest,
uint32   
)
inlineoverridevirtual

Reimplemented from CreatureScript.

173 {
174 if (!creature->AI()->GetData(DATA_DERBY_FINISHED) && quest->GetQuestId() == QUEST_FISHING_DERBY)
175 {
176 creature->AI()->DoAction(DATA_DERBY_FINISHED);
178 }
179
180 return true;
181 }
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:119
@ TEXT_RANGE_MAP
Definition: CreatureTextMgr.h:33
@ CLEARWATER_SAY_WINNER
Definition: npcs_special.cpp:50
@ CHAT_MSG_MONSTER_YELL
Definition: SharedDefines.h:3166
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
virtual void DoAction(int32)
Definition: UnitAI.h:201

References Creature::AI(), CHAT_MSG_MONSTER_YELL, CLEARWATER_SAY_WINNER, DATA_DERBY_FINISHED, UnitAI::DoAction(), UnitAI::GetData(), Quest::GetQuestId(), LANG_UNIVERSAL, QUEST_FISHING_DERBY, sCreatureTextMgr, and TEXT_RANGE_MAP.