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

Public Member Functions

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

◆ npcs_ashyen_and_keleth()

npcs_ashyen_and_keleth::npcs_ashyen_and_keleth ( )
inline
69: CreatureScript("npcs_ashyen_and_keleth") { }
Definition: ScriptMgr.h:719

Member Function Documentation

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

72 {
73 if (player->GetReputationRank(942) > REP_NEUTRAL)
74 {
75 if (creature->GetEntry() == NPC_ASHYEN)
77
78 if (creature->GetEntry() == NPC_KELETH)
80 }
81 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
82
83 return true;
84 }
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
#define GOSSIP_ITEM_BLESS_ASH
Definition: zone_zangarmarsh.cpp:45
@ NPC_KELETH
Definition: zone_zangarmarsh.cpp:53
@ NPC_ASHYEN
Definition: zone_zangarmarsh.cpp:52
#define GOSSIP_ITEM_BLESS_KEL
Definition: zone_zangarmarsh.cpp:46
@ REP_NEUTRAL
Definition: SharedDefines.h:155
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:5763
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:405

References AddGossipItemFor(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), Player::GetReputationRank(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, NPC_ASHYEN, NPC_KELETH, REP_NEUTRAL, and SendGossipMenuFor().

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

87 {
88 ClearGossipMenuFor(player);
89 if (action == GOSSIP_ACTION_INFO_DEF + 1)
90 {
91 creature->setPowerType(POWER_MANA);
92 creature->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case
93 creature->SetPower(POWER_MANA, 200);
94
95 if (creature->GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
96 {
97 uint32 spell = 0;
98 switch (player->GetReputationRank(942))
99 {
100 //mark of lore
101 case REP_FRIENDLY:
102 spell = SPELL_BLESS_ASH_FRI;
103 break;
104 case REP_HONORED:
105 spell = SPELL_BLESS_ASH_HON;
106 break;
107 case REP_REVERED:
108 spell = SPELL_BLESS_ASH_REV;
109 break;
110 case REP_EXALTED:
111 spell = SPELL_BLESS_ASH_EXA;
112 break;
113 default:
114 break;
115 }
116
117 if (spell)
118 {
119 creature->CastSpell(player, spell, true);
120 creature->AI()->Talk(GOSSIP_REWARD_BLESS);
121 }
122 }
123
124 if (creature->GetEntry() == NPC_KELETH)
125 {
126 uint32 spell = 0;
127 switch (player->GetReputationRank(942)) //mark of war
128 {
129 case REP_FRIENDLY:
130 spell = SPELL_BLESS_KEL_FRI;
131 break;
132 case REP_HONORED:
133 spell = SPELL_BLESS_KEL_HON;
134 break;
135 case REP_REVERED:
136 spell = SPELL_BLESS_KEL_REV;
137 break;
138 case REP_EXALTED:
139 spell = SPELL_BLESS_KEL_EXA;
140 break;
141 default:
142 break;
143 }
144
145 if (spell)
146 {
147 creature->CastSpell(player, spell, true);
148 creature->AI()->Talk(GOSSIP_REWARD_BLESS);
149 }
150 }
151 CloseGossipMenuFor(player);
152 player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
153 }
154 return true;
155 }
std::uint32_t uint32
Definition: Define.h:108
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ SPELL_BLESS_ASH_HON
Definition: zone_zangarmarsh.cpp:57
@ GOSSIP_REWARD_BLESS
Definition: zone_zangarmarsh.cpp:50
@ SPELL_BLESS_KEL_HON
Definition: zone_zangarmarsh.cpp:62
@ SPELL_BLESS_KEL_REV
Definition: zone_zangarmarsh.cpp:61
@ SPELL_BLESS_KEL_FRI
Definition: zone_zangarmarsh.cpp:63
@ SPELL_BLESS_ASH_FRI
Definition: zone_zangarmarsh.cpp:58
@ SPELL_BLESS_KEL_EXA
Definition: zone_zangarmarsh.cpp:60
@ SPELL_BLESS_ASH_EXA
Definition: zone_zangarmarsh.cpp:55
@ SPELL_BLESS_ASH_REV
Definition: zone_zangarmarsh.cpp:56
@ POWER_MANA
Definition: SharedDefines.h:241
@ REP_EXALTED
Definition: SharedDefines.h:159
@ REP_HONORED
Definition: SharedDefines.h:157
@ REP_REVERED
Definition: SharedDefines.h:158
@ REP_FRIENDLY
Definition: SharedDefines.h:156
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
CreatureAI * AI() const
Definition: Creature.h:135
void TalkedToCreature(uint32 entry, ObjectGuid guid)
Definition: PlayerQuest.cpp:2096
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15458
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:15523
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:1169
void setPowerType(Powers power)
Definition: Unit.cpp:9952

References Creature::AI(), Unit::CastSpell(), ClearGossipMenuFor(), CloseGossipMenuFor(), Object::GetEntry(), Object::GetGUID(), Player::GetReputationRank(), GOSSIP_ACTION_INFO_DEF, GOSSIP_REWARD_BLESS, NPC_ASHYEN, NPC_KELETH, POWER_MANA, REP_EXALTED, REP_FRIENDLY, REP_HONORED, REP_REVERED, Unit::SetMaxPower(), Unit::SetPower(), Unit::setPowerType(), SPELL_BLESS_ASH_EXA, SPELL_BLESS_ASH_FRI, SPELL_BLESS_ASH_HON, SPELL_BLESS_ASH_REV, SPELL_BLESS_KEL_EXA, SPELL_BLESS_KEL_FRI, SPELL_BLESS_KEL_HON, SPELL_BLESS_KEL_REV, CreatureAI::Talk(), and Player::TalkedToCreature().