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

Classes

struct  npc_adventurous_dwarfAI
 

Public Member Functions

 npc_adventurous_dwarf ()
 
CreatureAIGetAI (Creature *creature) const override
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 action) 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_adventurous_dwarf()

npc_adventurous_dwarf::npc_adventurous_dwarf ( )
inline
1053: CreatureScript("npc_adventurous_dwarf") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

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

Reimplemented from CreatureScript.

1064 {
1065 return new npc_adventurous_dwarfAI(creature);
1066 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

1069 {
1071 return false;
1072
1073 if (player->GetItemCount(ITEM_ORANGE) < 1)
1075
1076 if (player->GetItemCount(ITEM_BANANAS) < 2)
1078
1079 if (player->GetItemCount(ITEM_PAPAYA) < 1)
1081
1082 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature);
1083 return true;
1084 }
@ GOSSIP_DWARF_PAPAYA
Definition: zone_sholazar_basin.cpp:1047
@ QUEST_12634
Definition: zone_sholazar_basin.cpp:1030
@ ITEM_ORANGE
Definition: zone_sholazar_basin.cpp:1034
@ GOSSIP_DWARF_ORANGE
Definition: zone_sholazar_basin.cpp:1045
@ ITEM_BANANAS
Definition: zone_sholazar_basin.cpp:1032
@ GOSSIP_DWARF_MENU
Definition: zone_sholazar_basin.cpp:1044
@ ITEM_PAPAYA
Definition: zone_sholazar_basin.cpp:1033
@ GOSSIP_DWARF_BANANA
Definition: zone_sholazar_basin.cpp:1046
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
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
uint32 GetItemCount(uint32 item, bool inBankAlso=false, Item *skipItem=nullptr) const
Definition: PlayerStorage.cpp:327
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1429
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404

References AddGossipItemFor(), Player::GetGossipTextId(), Player::GetItemCount(), Player::GetQuestStatus(), GOSSIP_ACTION_INFO_DEF, GOSSIP_DWARF_BANANA, GOSSIP_DWARF_MENU, GOSSIP_DWARF_ORANGE, GOSSIP_DWARF_PAPAYA, GOSSIP_SENDER_MAIN, ITEM_BANANAS, ITEM_ORANGE, ITEM_PAPAYA, QUEST_12634, QUEST_STATUS_INCOMPLETE, and SendGossipMenuFor().

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

1087 {
1088 ClearGossipMenuFor(player);
1089 uint32 spellId = 0;
1090
1091 switch (action)
1092 {
1093 case GOSSIP_ACTION_INFO_DEF + 1:
1094 spellId = SPELL_ADD_ORANGE;
1095 break;
1096 case GOSSIP_ACTION_INFO_DEF + 2:
1097 spellId = SPELL_ADD_BANANAS;
1098 break;
1099 case GOSSIP_ACTION_INFO_DEF + 3:
1100 spellId = SPELL_ADD_PAPAYA;
1101 break;
1102 }
1103
1104 if (spellId)
1105 player->CastSpell(player, spellId, true);
1106
1107 creature->AI()->Talk(SAY_DWARF_HELP);
1108 creature->DespawnOrUnsummon();
1109 return true;
1110 }
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_ADD_BANANAS
Definition: zone_sholazar_basin.cpp:1037
@ SAY_DWARF_HELP
Definition: zone_sholazar_basin.cpp:1041
@ SPELL_ADD_ORANGE
Definition: zone_sholazar_basin.cpp:1036
@ SPELL_ADD_PAPAYA
Definition: zone_sholazar_basin.cpp:1038
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
Definition: CreatureAI.cpp:50
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2178
CreatureAI * AI() const
Definition: Creature.h:140
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1167

References Creature::AI(), Unit::CastSpell(), ClearGossipMenuFor(), Creature::DespawnOrUnsummon(), GOSSIP_ACTION_INFO_DEF, SAY_DWARF_HELP, SPELL_ADD_BANANAS, SPELL_ADD_ORANGE, SPELL_ADD_PAPAYA, and CreatureAI::Talk().