TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
npc_announcer_toc10 Class Reference

Classes

struct  npc_announcer_toc10AI
 

Public Member Functions

 npc_announcer_toc10 ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32) override
 
CreatureAIGetAI (Creature *creature) const override
 
- Public Member Functions inherited from CreatureScript
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Creature *)
 
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 OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
- Public Member Functions inherited from UnitScript
virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &)
 
- Public Member Functions inherited from ScriptObject
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 UnitScript
 UnitScript (const char *name, bool addToScripts=true)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()
 
virtual ~UpdatableScript ()
 

Constructor & Destructor Documentation

npc_announcer_toc10::npc_announcer_toc10 ( )
inline
110 : CreatureScript("npc_announcer_toc10") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

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

Reimplemented from CreatureScript.

213  {
214  return new npc_announcer_toc10AI(creature);
215  }
bool npc_announcer_toc10::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

129  {
130  InstanceScript* instance = creature->GetInstanceScript();
131  if (!instance)
132  return true;
133 
134  char const* _message = "We are ready!";
135 
136  if (player->IsInCombat() || instance->IsEncounterInProgress())
137  return true;
138 
139  uint8 i = 0;
140  for (; i < NUM_MESSAGES; ++i)
141  {
142  if ((!_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) != DONE)
143  || (_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) == DONE))
144  {
145  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, _message, GOSSIP_SENDER_MAIN, _GossipMessage[i].id);
146  break;
147  }
148  }
149 
150  if (i >= NUM_MESSAGES)
151  return false;
152 
153  player->SEND_GOSSIP_MENU(_GossipMessage[i].msgnum, creature->GetGUID());
154  return true;
155  }
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:52
Definition: trial_of_the_crusader.cpp:104
static _Messages _GossipMessage[]
Definition: trial_of_the_crusader.cpp:92
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
Definition: inflate.h:49
Definition: ScriptedGossip.h:73
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 encounter
Definition: trial_of_the_crusader.cpp:89
Definition: GossipDef.h:59
Definition: InstanceScript.h:141
uint8_t uint8
Definition: Define.h:152
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:227

+ Here is the call graph for this function:

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

Reimplemented from CreatureScript.

158  {
159  player->PlayerTalkClass->ClearMenus();
160  player->CLOSE_GOSSIP_MENU();
161  InstanceScript* instance = creature->GetInstanceScript();
162  if (!instance)
163  return true;
164 
165  if (instance->GetBossState(BOSS_BEASTS) != DONE)
166  {
167  instance->SetData(TYPE_EVENT, 110);
170  }
171  else if (instance->GetBossState(BOSS_JARAXXUS) != DONE)
172  {
173  // if Jaraxxus is spawned, but the raid wiped
174  if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(NPC_JARAXXUS)))
175  {
176  jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS);
177  jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
178  jaraxxus->SetReactState(REACT_DEFENSIVE);
179  jaraxxus->SetInCombatWithZone();
180  }
181  else
182  {
183  instance->SetData(TYPE_EVENT, 1010);
185  }
186  }
187  else if (instance->GetBossState(BOSS_CRUSADERS) != DONE)
188  {
189  if (player->GetTeam() == ALLIANCE)
190  instance->SetData(TYPE_EVENT, 3000);
191  else
192  instance->SetData(TYPE_EVENT, 3001);
194  }
195  else if (instance->GetBossState(BOSS_VALKIRIES) != DONE)
196  {
197  instance->SetData(TYPE_EVENT, 4000);
199  }
200  else if (instance->GetBossState(BOSS_LICH_KING) != DONE)
201  {
202  if (creature->GetMap()->GetPlayers().getFirst()->GetSource()->GetTeam() == ALLIANCE)
203  instance->SetData(TYPE_EVENT, 4020);
204  else
205  instance->SetData(TYPE_EVENT, 4030);
207  }
209  return true;
210  }
Definition: trial_of_the_crusader.h:14
Definition: Unit.h:735
Definition: Unit.h:674
Map * GetMap() const
Definition: Object.h:543
Definition: trial_of_the_crusader.h:25
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
Definition: Unit.h:1130
Definition: trial_of_the_crusader.h:13
Definition: inflate.h:49
Definition: trial_of_the_crusader.h:37
Definition: Creature.h:467
Definition: SharedDefines.h:1000
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
Definition: trial_of_the_crusader.h:15
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
Definition: gnomeregan.h:40
Definition: InstanceScript.h:58
MapReference * getFirst()
Definition: MapRefManager.h:32
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:273
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: UpdateFields.h:109
FROM * GetSource() const
Definition: Reference.h:96
Definition: trial_of_the_crusader.h:198
Definition: InstanceScript.h:141
Definition: UpdateFields.h:135
Definition: trial_of_the_crusader.h:12
Definition: trial_of_the_crusader.h:16
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:227

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: