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

Classes

struct  npc_announcer_toc5AI
 

Public Member Functions

 npc_announcer_toc5 ()
 
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_announcer_toc5()

npc_announcer_toc5::npc_announcer_toc5 ( )
inline
45: CreatureScript("npc_announcer_toc5") {}
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

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

Reimplemented from CreatureScript.

109 {
110 return GetTrialOfTheChampionAI<npc_announcer_toc5AI>(creature);
111 }

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

48 {
49 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
50 return true;
51
52 InstanceScript* pInstance = creature->GetInstanceScript();
53 if (!pInstance)
54 return true;
55
56 uint32 gossipTextId = 0;
57 switch (pInstance->GetData(DATA_INSTANCE_PROGRESS))
58 {
60 if (!player->GetVehicle())
61 {
63 gossipTextId = NPC_TEXT_NOT_MOUNTED_H;
64 else
65 gossipTextId = NPC_TEXT_NOT_MOUNTED_A;
66 }
67 else
68 {
69 gossipTextId = NPC_TEXT_CHALLENGE_1;
72 }
73 break;
75 gossipTextId = NPC_TEXT_CHALLENGE_2;
77 break;
79 gossipTextId = NPC_TEXT_CHALLENGE_3;
81 break;
82 default:
83 return true;
84 }
85 SendGossipMenuFor(player, gossipTextId, creature->GetGUID());
86 return true;
87 }
std::uint32_t uint32
Definition: Define.h:107
@ DATA_INSTANCE_PROGRESS
Definition: trial_of_the_champion.h:33
@ DATA_TEAMID_IN_INSTANCE
Definition: trial_of_the_champion.h:44
@ INSTANCE_PROGRESS_INITIAL
Definition: trial_of_the_champion.h:52
@ INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED
Definition: trial_of_the_champion.h:60
@ INSTANCE_PROGRESS_CHAMPIONS_DEAD
Definition: trial_of_the_champion.h:58
@ GOSSIP_START_EVENT_1B
Definition: trial_of_the_champion.cpp:36
@ GOSSIP_START_EVENT_3
Definition: trial_of_the_champion.cpp:38
@ NPC_TEXT_CHALLENGE_1
Definition: trial_of_the_champion.cpp:29
@ NPC_TEXT_NOT_MOUNTED_H
Definition: trial_of_the_champion.cpp:26
@ GOSSIP_MENU_STAGE
Definition: trial_of_the_champion.cpp:33
@ NPC_TEXT_CHALLENGE_3
Definition: trial_of_the_champion.cpp:31
@ GOSSIP_START_EVENT_2
Definition: trial_of_the_champion.cpp:37
@ NPC_TEXT_NOT_MOUNTED_A
Definition: trial_of_the_champion.cpp:27
@ GOSSIP_START_EVENT_1A
Definition: trial_of_the_champion.cpp:35
@ NPC_TEXT_CHALLENGE_2
Definition: trial_of_the_champion.cpp:30
@ TEAM_HORDE
Definition: SharedDefines.h:761
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
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
Vehicle * GetVehicle() const
Definition: Unit.h:1786
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:725
Definition: InstanceScript.h:142
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51

References AddGossipItemFor(), DATA_INSTANCE_PROGRESS, DATA_TEAMID_IN_INSTANCE, ZoneScript::GetData(), Object::GetGUID(), WorldObject::GetInstanceScript(), Unit::GetVehicle(), GOSSIP_ACTION_INFO_DEF, GOSSIP_MENU_STAGE, GOSSIP_SENDER_MAIN, GOSSIP_START_EVENT_1A, GOSSIP_START_EVENT_1B, GOSSIP_START_EVENT_2, GOSSIP_START_EVENT_3, Unit::HasNpcFlag(), INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED, INSTANCE_PROGRESS_CHAMPIONS_DEAD, INSTANCE_PROGRESS_INITIAL, NPC_TEXT_CHALLENGE_1, NPC_TEXT_CHALLENGE_2, NPC_TEXT_CHALLENGE_3, NPC_TEXT_NOT_MOUNTED_A, NPC_TEXT_NOT_MOUNTED_H, SendGossipMenuFor(), TEAM_HORDE, and UNIT_NPC_FLAG_GOSSIP.

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

90 {
91 if (!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
92 return true;
93
94 InstanceScript* pInstance = creature->GetInstanceScript();
95 if (!pInstance)
96 return true;
97
98 if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 || uiAction == GOSSIP_ACTION_INFO_DEF + 2 || uiAction == GOSSIP_ACTION_INFO_DEF + 3 || uiAction == GOSSIP_ACTION_INFO_DEF + 4)
99 {
100 pInstance->SetData(DATA_ANNOUNCER_GOSSIP_SELECT, (uiAction == GOSSIP_ACTION_INFO_DEF + 2 ? 1 : 0));
102 }
103
104 CloseGossipMenuFor(player);
105 return true;
106 }
@ DATA_ANNOUNCER_GOSSIP_SELECT
Definition: trial_of_the_champion.h:36
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:727
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52

References CloseGossipMenuFor(), DATA_ANNOUNCER_GOSSIP_SELECT, WorldObject::GetInstanceScript(), GOSSIP_ACTION_INFO_DEF, Unit::HasNpcFlag(), Unit::RemoveNpcFlag(), ZoneScript::SetData(), and UNIT_NPC_FLAG_GOSSIP.