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
990: AreaTriggerScript("at_cthun_stomach_exit") { }
Definition: ScriptMgr.h:801

Member Function Documentation

◆ OnTrigger()

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

Reimplemented from AreaTriggerScript.

993 {
994 if (InstanceScript* instance = player->GetInstanceScript())
995 {
996 if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
997 {
998 if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f))
999 {
1000 trigger->CastSpell(player, SPELL_EXIT_STOMACH, true);
1001
1002 if (Creature* exittrigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 15.0f))
1003 {
1004 exittrigger->CastSpell(player, SPELL_RUBBLE_ROCKY, true);
1005 }
1006 }
1007
1008 player->m_Events.AddEventAtOffset([player, cthun]()
1009 {
1010 if (player->FindNearestCreature(NPC_EXIT_TRIGGER, 10.0f))
1011 {
1012 player->JumpTo(0.0f, 80.0f, false);
1013
1014 player->m_Events.AddEventAtOffset([player, cthun]()
1015 {
1016 if (cthun)
1017 {
1018 player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6));
1019 }
1020
1021 player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
1022 }, 1s);
1023 }
1024 else
1025 {
1026 player->m_Events.KillAllEvents(false);
1027 }
1028 }, 3s);
1029 }
1030 }
1031
1032 return true;
1033 }
@ NPC_EXIT_TRIGGER
Definition: boss_cthun.cpp:104
@ NPC_TRIGGER
Definition: boss_cthun.cpp:103
@ SPELL_EXIT_STOMACH
Definition: boss_cthun.cpp:77
@ SPELL_RUBBLE_ROCKY
Definition: boss_cthun.cpp:78
@ 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:109
Definition: Creature.h:46
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2409
EventProcessor m_Events
Definition: Unit.h:2094
Definition: InstanceScript.h:140

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.