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
 

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 ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ at_cthun_stomach_exit()

at_cthun_stomach_exit::at_cthun_stomach_exit ( )
inline
976: 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.

979 {
980 if (InstanceScript* instance = player->GetInstanceScript())
981 {
982 if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
983 {
984 if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f))
985 {
986 trigger->CastSpell(player, SPELL_EXIT_STOMACH, true);
987
988 if (Creature* exittrigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 15.0f))
989 {
990 exittrigger->CastSpell(player, SPELL_RUBBLE_ROCKY, true);
991 }
992 }
993
994 player->m_Events.AddEventAtOffset([player, cthun]()
995 {
996 if (player->FindNearestCreature(NPC_EXIT_TRIGGER, 10.0f))
997 {
998 player->JumpTo(0.0f, 80.0f, false);
999
1000 player->m_Events.AddEventAtOffset([player, cthun]()
1001 {
1002 if (cthun)
1003 {
1004 player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6));
1005 }
1006
1007 player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
1008 }, 1s);
1009 }
1010 else
1011 {
1012 player->m_Events.KillAllEvents(false);
1013 }
1014 }, 3s);
1015 }
1016 }
1017
1018 return true;
1019 }
@ NPC_EXIT_TRIGGER
Definition: boss_cthun.cpp:105
@ NPC_TRIGGER
Definition: boss_cthun.cpp:104
@ SPELL_EXIT_STOMACH
Definition: boss_cthun.cpp:78
@ SPELL_RUBBLE_ROCKY
Definition: boss_cthun.cpp:79
@ 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:108
Definition: Creature.h:46
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2434
EventProcessor m_Events
Definition: Unit.h:2108
Definition: InstanceScript.h:141

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.