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

Member Function Documentation

◆ OnTrigger()

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

Reimplemented from AreaTriggerScript.

1001 {
1002 if (InstanceScript* instance = player->GetInstanceScript())
1003 {
1004 if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
1005 {
1006 if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f))
1007 {
1008 trigger->CastSpell(player, SPELL_EXIT_STOMACH, true);
1009
1010 if (Creature* exittrigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 15.0f))
1011 {
1012 exittrigger->CastSpell(player, SPELL_RUBBLE_ROCKY, true);
1013 }
1014 }
1015
1016 player->m_Events.AddEventAtOffset([player, cthun]()
1017 {
1018 if (player->FindNearestCreature(NPC_EXIT_TRIGGER, 10.0f))
1019 {
1020 player->JumpTo(0.0f, 80.0f, false);
1021
1022 player->m_Events.AddEventAtOffset([player, cthun]()
1023 {
1024 if (cthun)
1025 {
1026 player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6));
1027 }
1028
1029 player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
1030 }, 1s);
1031 }
1032 else
1033 {
1034 player->m_Events.KillAllEvents(false);
1035 }
1036 }, 3s);
1037 }
1038 }
1039
1040 return true;
1041 }
@ 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:35
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:2395
EventProcessor m_Events
Definition: Unit.h:2092
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.