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

Classes

struct  npc_oculus_drakegiverAI
 

Public Member Functions

 npc_oculus_drakegiver ()
 
CreatureAIGetAI (Creature *creature) const override
 
bool OnGossipHello (Player *player, Creature *creature) override
 
void StoreEssence (Player *player, uint32 itemId)
 
void RemoveEssence (Player *player, uint32 itemId)
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 uiAction) 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)
 

Public Attributes

std::unordered_map< ObjectGuid, bool > openedMenu
 

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_oculus_drakegiver()

npc_oculus_drakegiver::npc_oculus_drakegiver ( )
inline
80: CreatureScript("npc_oculus_drakegiver") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

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

Reimplemented from CreatureScript.

83 {
84 return GetOculusAI<npc_oculus_drakegiverAI>(creature);
85 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

169 {
170 if (creature->IsQuestGiver())
171 player->PrepareQuestMenu(creature->GetGUID());
172
173 if (creature->GetInstanceScript()->GetData(DATA_DRAKOS) == DONE)
174 {
175 switch (creature->GetEntry())
176 {
177 case NPC_VERDISA:
179 if (player->HasItemCount(ITEM_AMBER_ESSENCE))
180 {
182 }
183 else if (player->HasItemCount(ITEM_RUBY_ESSENCE))
184 {
186 }
187 else if (!player->HasItemCount(ITEM_EMERALD_ESSENCE))
188 {
190 }
193 break;
195 if (HAS_ESSENCE(player))
196 {
197 openedMenu[player->GetGUID()] = true;
198 }
199
200 if (!openedMenu[player->GetGUID()])
201 {
203 SendGossipMenuFor(player, GOSSIP_TEXTID_DRAKES, creature->GetGUID());
204 }
205 else
206 {
208 }
209 break;
210 case NPC_ETERNOS:
213 {
215 }
216 else if (player->HasItemCount(ITEM_RUBY_ESSENCE))
217 {
219 }
220 else if (!player->HasItemCount(ITEM_AMBER_ESSENCE))
221 {
223 }
226 break;
227 }
228 }
229
230 return true;
231 }
@ NPC_ETERNOS
Definition: oculus.h:57
@ NPC_VERDISA
Definition: oculus.h:55
@ NPC_BELGARISTRASZ
Definition: oculus.h:56
@ ITEM_RUBY_ESSENCE
Definition: oculus.h:77
@ ITEM_EMERALD_ESSENCE
Definition: oculus.h:75
@ ITEM_AMBER_ESSENCE
Definition: oculus.h:76
@ DATA_DRAKOS
Definition: oculus.h:34
#define HAS_ESSENCE(a)
Definition: oculus.cpp:73
@ GOSSIP_TEXTID_DRAKES
Definition: oculus.cpp:62
@ GOSSIP_TEXTID_VERDISA1
Definition: oculus.cpp:65
@ GOSSIP_TEXTID_ETERNOS1
Definition: oculus.cpp:68
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
@ DONE
Definition: InstanceScript.h:60
uint32 GetEntry() const
Definition: Object.h:115
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition: PlayerStorage.cpp:655
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
bool IsQuestGiver() const
Definition: Unit.h:762
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
std::unordered_map< ObjectGuid, bool > openedMenu
Definition: oculus.cpp:78
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 uiAction) override
Definition: oculus.cpp:251

References AddGossipItemFor(), DATA_DRAKOS, DONE, ZoneScript::GetData(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetInstanceScript(), GOSSIP_ACTION_INFO_DEF, GOSSIP_SENDER_MAIN, GOSSIP_TEXTID_DRAKES, GOSSIP_TEXTID_ETERNOS1, GOSSIP_TEXTID_VERDISA1, HAS_ESSENCE, Player::HasItemCount(), Unit::IsQuestGiver(), ITEM_AMBER_ESSENCE, ITEM_EMERALD_ESSENCE, ITEM_RUBY_ESSENCE, NPC_BELGARISTRASZ, NPC_ETERNOS, NPC_VERDISA, OnGossipSelect(), openedMenu, Player::PrepareQuestMenu(), and SendGossipMenuFor().

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

252 {
253 ClearGossipMenuFor(player);
254 switch (creature->GetEntry())
255 {
256 case NPC_VERDISA:
257 switch (uiAction)
258 {
261 return true;
262 case GOSSIP_ACTION_INFO_DEF + 4:
264 return true;
265 case GOSSIP_ACTION_INFO_DEF + 1:
267 break;
268 case GOSSIP_ACTION_INFO_DEF + 2:
270 break;
271 }
273 CloseGossipMenuFor(player);
274 break;
276 switch (uiAction)
277 {
279 openedMenu[player->GetGUID()] = true;
280 if (player->HasItemCount(ITEM_AMBER_ESSENCE))
281 {
283 }
284 else if (player->HasItemCount(ITEM_EMERALD_ESSENCE))
285 {
287 }
288 else if (!player->HasItemCount(ITEM_RUBY_ESSENCE))
289 {
291 }
294 return true;
295 case GOSSIP_ACTION_INFO_DEF + 4:
297 return true;
298 case GOSSIP_ACTION_INFO_DEF + 1:
300 break;
301 case GOSSIP_ACTION_INFO_DEF + 2:
303 break;
304 }
306 CloseGossipMenuFor(player);
307 break;
308 case NPC_ETERNOS:
309 switch (uiAction)
310 {
313 return true;
314 case GOSSIP_ACTION_INFO_DEF + 4:
316 return true;
317 case GOSSIP_ACTION_INFO_DEF + 1:
319 break;
320 case GOSSIP_ACTION_INFO_DEF + 2:
322 break;
323 }
325 CloseGossipMenuFor(player);
326 break;
327 }
328
329 return true;
330 }
@ GOSSIP_TEXTID_BELGARISTRASZ2
Definition: oculus.cpp:64
@ GOSSIP_TEXTID_VERDISA2
Definition: oculus.cpp:66
@ GOSSIP_TEXTID_BELGARISTRASZ1
Definition: oculus.cpp:63
@ GOSSIP_TEXTID_ETERNOS2
Definition: oculus.cpp:69
@ GOSSIP_TEXTID_ETERNOS3
Definition: oculus.cpp:70
@ GOSSIP_TEXTID_VERDISA3
Definition: oculus.cpp:67
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
void RemoveEssence(Player *player, uint32 itemId)
Definition: oculus.cpp:246
void StoreEssence(Player *player, uint32 itemId)
Definition: oculus.cpp:233

References AddGossipItemFor(), ClearGossipMenuFor(), CloseGossipMenuFor(), Object::GetEntry(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, GOSSIP_SENDER_MAIN, GOSSIP_TEXTID_BELGARISTRASZ1, GOSSIP_TEXTID_BELGARISTRASZ2, GOSSIP_TEXTID_ETERNOS2, GOSSIP_TEXTID_ETERNOS3, GOSSIP_TEXTID_VERDISA2, GOSSIP_TEXTID_VERDISA3, Player::HasItemCount(), ITEM_AMBER_ESSENCE, ITEM_EMERALD_ESSENCE, ITEM_RUBY_ESSENCE, NPC_BELGARISTRASZ, NPC_ETERNOS, NPC_VERDISA, openedMenu, RemoveEssence(), SendGossipMenuFor(), and StoreEssence().

Referenced by OnGossipHello().

◆ RemoveEssence()

void npc_oculus_drakegiver::RemoveEssence ( Player player,
uint32  itemId 
)
inline
247 {
248 player->DestroyItemCount(itemId, 1, true);
249 }
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: PlayerStorage.cpp:3121

References Player::DestroyItemCount().

Referenced by OnGossipSelect().

◆ StoreEssence()

void npc_oculus_drakegiver::StoreEssence ( Player player,
uint32  itemId 
)
inline
234 {
235 ItemPosCountVec dest;
236 uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1);
237 if (msg == EQUIP_ERR_OK)
238 {
239 if (Item* item = player->StoreNewItem(dest, itemId, true))
240 {
241 player->SendNewItem(item, 1, true, true);
242 }
243 }
244 }
std::uint8_t uint8
Definition: Define.h:109
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:776
@ EQUIP_ERR_OK
Definition: Item.h:47
@ NULL_BAG
Definition: Item.h:40
@ NULL_SLOT
Definition: Item.h:41
Definition: Item.h:220
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition: PlayerStorage.cpp:4751
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition: PlayerStorage.cpp:2524
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.h:1291

References Player::CanStoreNewItem(), EQUIP_ERR_OK, NULL_BAG, NULL_SLOT, Player::SendNewItem(), and Player::StoreNewItem().

Referenced by OnGossipSelect().

Member Data Documentation

◆ openedMenu

std::unordered_map<ObjectGuid, bool> npc_oculus_drakegiver::openedMenu

Referenced by OnGossipHello(), and OnGossipSelect().