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

Classes

struct  npc_death_knight_initiateAI
 

Public Member Functions

 npc_death_knight_initiate ()
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 action) override
 
bool OnGossipHello (Player *player, Creature *creature) 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_death_knight_initiate()

npc_death_knight_initiate::npc_death_knight_initiate ( )
inline
209: CreatureScript("npc_death_knight_initiate") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

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

Reimplemented from CreatureScript.

252 {
253 return new npc_death_knight_initiateAI(creature);
254 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

234 {
236 {
237 if (player->HealthBelowPct(10))
238 return true;
239
240 if (player->IsInCombat() || creature->IsInCombat())
241 return true;
242
243 if (!creature->AI()->GetGUID(player->GetGUID().GetCounter()))
245
246 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
247 }
248 return true;
249 }
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
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_DEATH_CHALLENGE
Definition: chapter1.cpp:198
virtual ObjectGuid GetGUID(int32=0) const
Definition: UnitAI.h:216
CreatureAI * AI() const
Definition: Creature.h:143
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
LowType GetCounter() const
Definition: ObjectGuid.h:145
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1424
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404
bool IsFullHealth() const
Definition: Unit.h:872
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:873
bool IsInCombat() const
Definition: Unit.h:820

References AddGossipItemFor(), Creature::AI(), ObjectGuid::GetCounter(), Player::GetGossipTextId(), UnitAI::GetGUID(), Object::GetGUID(), Player::GetQuestStatus(), GOSSIP_ACTION_INFO_DEF, GOSSIP_SENDER_MAIN, Unit::HealthBelowPct(), Unit::IsFullHealth(), Unit::IsInCombat(), QUEST_DEATH_CHALLENGE, QUEST_STATUS_INCOMPLETE, and SendGossipMenuFor().

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

212 {
213 ClearGossipMenuFor(player);
214 if (action == GOSSIP_ACTION_INFO_DEF)
215 {
216 CloseGossipMenuFor(player);
217
218 if (player->IsInCombat() || creature->IsInCombat())
219 return true;
220
221 if (creature->AI()->GetData(DATA_IN_PROGRESS))
222 return true;
223
224 creature->SetImmuneToPC(false);
226
227 player->CastSpell(creature, SPELL_DUEL, false);
228 player->CastSpell(player, SPELL_DUEL_FLAG, true);
229 }
230 return true;
231 }
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ UNIT_FLAG_SWIMMING
Definition: UnitDefines.h:244
@ SPELL_DUEL_FLAG
Definition: chapter1.cpp:194
@ DATA_IN_PROGRESS
Definition: chapter1.cpp:200
@ SPELL_DUEL
Definition: chapter1.cpp:191
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:213
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:1168
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13568
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:684

References Creature::AI(), Unit::CastSpell(), ClearGossipMenuFor(), CloseGossipMenuFor(), DATA_IN_PROGRESS, UnitAI::GetData(), GOSSIP_ACTION_INFO_DEF, Unit::IsInCombat(), Unit::RemoveUnitFlag(), Unit::SetImmuneToPC(), SPELL_DUEL, SPELL_DUEL_FLAG, and UNIT_FLAG_SWIMMING.