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
207: 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.

250 {
251 return new npc_death_knight_initiateAI(creature);
252 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

232 {
234 {
235 if (player->HealthBelowPct(10))
236 return true;
237
238 if (player->IsInCombat() || creature->IsInCombat())
239 return true;
240
241 if (!creature->AI()->GetGUID(player->GetGUID().GetCounter()))
243
244 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
245 }
246 return true;
247 }
@ QUEST_DEATH_CHALLENGE
Definition: chapter1.cpp:196
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
virtual ObjectGuid GetGUID(int32=0) const
Definition: UnitAI.h:216
CreatureAI * AI() const
Definition: Creature.h:140
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
LowType GetCounter() const
Definition: ObjectGuid.h:145
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1429
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404
bool IsFullHealth() const
Definition: Unit.h:1035
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1037
bool IsInCombat() const
Definition: Unit.h:884

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.

210 {
211 ClearGossipMenuFor(player);
212 if (action == GOSSIP_ACTION_INFO_DEF)
213 {
214 CloseGossipMenuFor(player);
215
216 if (player->IsInCombat() || creature->IsInCombat())
217 return true;
218
219 if (creature->AI()->GetData(DATA_IN_PROGRESS))
220 return true;
221
222 creature->SetImmuneToPC(false);
224
225 player->CastSpell(creature, SPELL_DUEL, false);
226 player->CastSpell(player, SPELL_DUEL_FLAG, true);
227 }
228 return true;
229 }
@ SPELL_DUEL_FLAG
Definition: chapter1.cpp:192
@ DATA_IN_PROGRESS
Definition: chapter1.cpp:198
@ SPELL_DUEL
Definition: chapter1.cpp:189
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ UNIT_FLAG_SWIMMING
Definition: UnitDefines.h:244
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:1167
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13611
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:714

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.