AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
at_cthun_stomach_exit Class Reference
Inheritance diagram for at_cthun_stomach_exit:
AreaTriggerScript ScriptObject

Public Member Functions

 at_cthun_stomach_exit ()
 
bool OnTrigger (Player *player, AreaTrigger const *) override
 
- Public Member Functions inherited from AreaTriggerScript
bool IsDatabaseBound () const override
 
virtual bool OnTrigger (Player *, AreaTrigger const *)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Additional Inherited Members

- Protected Member Functions inherited from AreaTriggerScript
 AreaTriggerScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ at_cthun_stomach_exit()

at_cthun_stomach_exit::at_cthun_stomach_exit ( )
inline
868: AreaTriggerScript("at_cthun_stomach_exit") { }
Definition: AreaTriggerScript.h:24

Member Function Documentation

◆ OnTrigger()

bool at_cthun_stomach_exit::OnTrigger ( Player player,
AreaTrigger const *   
)
inlineoverridevirtual

Reimplemented from AreaTriggerScript.

871 {
872 if (InstanceScript* instance = player->GetInstanceScript())
873 {
874 if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
875 {
876 if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f))
877 {
878 trigger->CastSpell(player, SPELL_EXIT_STOMACH, true);
879
880 if (Creature* exittrigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 15.0f))
881 exittrigger->CastSpell(player, SPELL_RUBBLE_ROCKY, true);
882 }
883
884 player->m_Events.AddEventAtOffset([player, cthun]()
885 {
886 if (player->FindNearestCreature(NPC_EXIT_TRIGGER, 10.0f))
887 {
888 player->JumpTo(0.0f, 80.0f, false);
889
890 player->m_Events.AddEventAtOffset([player, cthun]()
891 {
892 if (cthun)
893 player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6));
894
895 player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
896 }, 1s);
897 }
898 else
899 {
900 player->m_Events.KillAllEvents(false);
901 }
902 }, 3s);
903 }
904 }
905
906 return true;
907 }
@ NPC_EXIT_TRIGGER
Definition: boss_cthun.cpp:97
@ NPC_TRIGGER
Definition: boss_cthun.cpp:96
@ SPELL_EXIT_STOMACH
Definition: boss_cthun.cpp:72
@ SPELL_RUBBLE_ROCKY
Definition: boss_cthun.cpp:73
@ DATA_CTHUN
Definition: temple_of_ahnqiraj.h:36
void KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:107
Definition: Creature.h:46
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2446
EventProcessor m_Events
Definition: Unit.h:1792
Definition: InstanceScript.h:142

References EventProcessor::AddEventAtOffset(), DATA_CTHUN, WorldObject::FindNearestCreature(), WorldObject::GetInstanceScript(), EventProcessor::KillAllEvents(), Unit::m_Events, NPC_EXIT_TRIGGER, NPC_TRIGGER, SPELL_EXIT_STOMACH, and SPELL_RUBBLE_ROCKY.