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

Classes

struct  npc_ulduar_expedition_commanderAI
 

Public Member Functions

 npc_ulduar_expedition_commander ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 uiAction) 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_ulduar_expedition_commander()

npc_ulduar_expedition_commander::npc_ulduar_expedition_commander ( )
inline
637: CreatureScript("npc_ulduar_expedition_commander") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

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

Reimplemented from CreatureScript.

696 {
697 return GetUlduarAI<npc_ulduar_expedition_commanderAI>(creature);
698 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

640 {
641 if (!player || !creature)
642 return true;
643
644 InstanceScript* instance = creature->GetInstanceScript();
645 if (!instance)
646 return true;
647
648 if (instance->GetData(TYPE_RAZORSCALE) == DONE)
649 return true;
650
651 Creature* razorscale = ObjectAccessor::GetCreature(*creature, instance->GetGuidData(TYPE_RAZORSCALE));
652 if (!razorscale || razorscale->IsInCombat())
653 return true;
654
656 SendGossipMenuFor(player, NPC_TEXT_COMMANDER, creature);
657 return true;
658 }
@ DONE
Definition: InstanceScript.h:60
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_MENU_START_ENCOUNTER
Definition: boss_razorscale.cpp:141
@ NPC_TEXT_COMMANDER
Definition: boss_razorscale.cpp:142
@ TYPE_RAZORSCALE
Definition: ulduar.h:34
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
Definition: Creature.h:46
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
bool IsInCombat() const
Definition: Unit.h:820
Definition: InstanceScript.h:142
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:95
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:52

References AddGossipItemFor(), DONE, ObjectAccessor::GetCreature(), ZoneScript::GetData(), InstanceScript::GetGuidData(), WorldObject::GetInstanceScript(), GOSSIP_ACTION_INFO_DEF, GOSSIP_MENU_START_ENCOUNTER, GOSSIP_SENDER_MAIN, Unit::IsInCombat(), NPC_TEXT_COMMANDER, SendGossipMenuFor(), and TYPE_RAZORSCALE.

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

661 {
662 if (!player || !creature)
663 return true;
664
665 if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
666 {
667 InstanceScript* instance = creature->GetInstanceScript();
668 if (!instance || instance->GetData(TYPE_RAZORSCALE) == DONE)
669 return true;
670
671 Creature* razorscale = ObjectAccessor::GetCreature(*creature, instance->GetGuidData(TYPE_RAZORSCALE));
672 if (razorscale && !razorscale->IsInCombat())
673 {
674 // Do not show gossip icon if encounter is in progress
676
677 // reset npcs NPC_HARPOON_FIRE_STATE
678 for (uint8 i = 0; i < 4; ++i)
680 hfs->AI()->SetData(1, 0);
681
682 if (razorscale->AI())
683 {
684 razorscale->AI()->AttackStart(player);
685 razorscale->GetMotionMaster()->MoveIdle();
686 razorscale->GetMotionMaster()->MovePoint(POINT_RAZORSCALE_INIT, 588.0f, -178.0f, 490.0f, false, false);
687 }
688 }
689 }
690
692 return true;
693 }
std::uint8_t uint8
Definition: Define.h:109
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
@ POINT_RAZORSCALE_INIT
Definition: boss_razorscale.cpp:137
@ DATA_HARPOON_FIRE_STATE_1
Definition: ulduar.h:62
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
CreatureAI * AI() const
Definition: Creature.h:143
void SendCloseGossip()
Definition: GossipDef.cpp:239
PlayerMenu * PlayerTalkClass
Definition: Player.h:2219
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:696
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:211
void MoveIdle()
Definition: MotionMaster.cpp:232

References Creature::AI(), UnitAI::AttackStart(), DATA_HARPOON_FIRE_STATE_1, DONE, ObjectAccessor::GetCreature(), ZoneScript::GetData(), InstanceScript::GetGuidData(), WorldObject::GetInstanceScript(), Unit::GetMotionMaster(), GOSSIP_ACTION_INFO_DEF, Unit::IsInCombat(), MotionMaster::MoveIdle(), MotionMaster::MovePoint(), Player::PlayerTalkClass, POINT_RAZORSCALE_INIT, Unit::RemoveNpcFlag(), PlayerMenu::SendCloseGossip(), TYPE_RAZORSCALE, and UNIT_NPC_FLAG_GOSSIP.