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

Public Member Functions

 at_kelthuzad_center ()
 
bool OnTrigger (Player *player, const AreaTriggerEntry *, bool) override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Additional Inherited Members

- Protected Member Functions inherited from AreaTriggerScript
 AreaTriggerScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

at_kelthuzad_center::at_kelthuzad_center ( )
inline
631 : AreaTriggerScript("at_kelthuzad_center") { }
AreaTriggerScript(const char *name)
Definition: ScriptMgr.cpp:1598

Member Function Documentation

bool at_kelthuzad_center::OnTrigger ( Player player,
const AreaTriggerEntry ,
bool   
)
inlineoverridevirtual

Reimplemented from AreaTriggerScript.

634  {
635  if (player->IsGameMaster())
636  return false;
637 
638  InstanceScript* instance = player->GetInstanceScript();
639  if (!instance || instance->IsEncounterInProgress() || instance->GetBossState(BOSS_KELTHUZAD) == DONE)
640  return false;
641 
642  Creature* pKelthuzad = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_KELTHUZAD));
643  if (!pKelthuzad)
644  return false;
645 
647  if (!pKelthuzadAI)
648  return false;
649 
650  pKelthuzadAI->AttackStart(player);
652  {
653  if (trigger->getLootState() == GO_READY)
654  trigger->UseDoorOrButton();
655 
656  // Note: summon must be done by trigger and not by KT.
657  // Otherwise, they attack immediately as KT is in combat.
658  for (uint8 i = 0; i < MAX_ABOMINATIONS; ++i)
659  {
660  if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i]))
661  {
662  pKelthuzadAI->spawns.Summon(sum);
663  sum->GetMotionMaster()->MoveRandom(9.0f);
664  sum->SetReactState(REACT_DEFENSIVE);
665  }
666  }
667  for (uint8 i = 0; i < MAX_WASTES; ++i)
668  {
669  if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i]))
670  {
671  pKelthuzadAI->spawns.Summon(sum);
672  sum->GetMotionMaster()->MoveRandom(5.0f);
673  sum->SetReactState(REACT_DEFENSIVE);
674  }
675  }
676  for (uint8 i = 0; i < MAX_WEAVERS; ++i)
677  {
678  if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i]))
679  {
680  pKelthuzadAI->spawns.Summon(sum);
681  sum->GetMotionMaster()->MoveRandom(9.0f);
682  sum->SetReactState(REACT_DEFENSIVE);
683  }
684  }
685  }
686 
687  return true;
688  }
SummonList spawns
Definition: boss_kelthuzad.cpp:293
Position const PosWastes[MAX_WASTES]
Definition: boss_kelthuzad.cpp:187
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:52
Definition: naxxramas.h:78
Definition: boss_kelthuzad.cpp:136
Definition: boss_kelthuzad.cpp:269
#define MAX_ABOMINATIONS
Definition: boss_kelthuzad.cpp:159
Definition: Unit.h:1130
Definition: inflate.h:49
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:92
Definition: Creature.h:467
#define MAX_WEAVERS
Definition: boss_kelthuzad.cpp:241
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
#define CAST_AI(a, b)
Definition: ScriptedCreature.h:28
CreatureAI * AI() const
Definition: Creature.h:525
Definition: boss_kelthuzad.cpp:135
Definition: boss_kelthuzad.cpp:137
Definition: GameObject.h:880
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
Position const PosWeavers[MAX_WEAVERS]
Definition: boss_kelthuzad.cpp:242
Position const PosAbominations[MAX_ABOMINATIONS]
Definition: boss_kelthuzad.cpp:160
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:117
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:143
Definition: InstanceScript.h:141
uint8_t uint8
Definition: Define.h:152
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:227
Definition: GameObject.h:869
Definition: naxxramas.h:41
#define MAX_WASTES
Definition: boss_kelthuzad.cpp:186
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
Definition: naxxramas.h:83

+ Here is the call graph for this function:


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