AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ValithriaDespawner Class Reference
Inheritance diagram for ValithriaDespawner:
BasicEvent

Public Member Functions

 ValithriaDespawner (Creature *creature)
 
bool Execute (uint64, uint32) override
 
void operator() (Creature *creature) const
 
- Public Member Functions inherited from BasicEvent
 BasicEvent ()=default
 
virtual ~BasicEvent ()=default
 
virtual bool Execute (uint64, uint32)
 
virtual bool IsDeletable () const
 
virtual void Abort (uint64)
 
void ScheduleAbort ()
 

Private Attributes

Creature_creature
 

Detailed Description

Constructor & Destructor Documentation

◆ ValithriaDespawner()

ValithriaDespawner::ValithriaDespawner ( Creature creature)
inlineexplicit
220 : _creature(creature)
221 {
222 }
Creature * _creature
Definition: boss_valithria_dreamwalker.cpp:285

Member Function Documentation

◆ Execute()

bool ValithriaDespawner::Execute ( uint64  ,
uint32   
)
inlineoverridevirtual

Reimplemented from BasicEvent.

225 {
227 Cell::VisitGridObjects(_creature, worker, 333.0f);
228 _creature->AI()->Reset();
229 _creature->setActive(false);
230 return true;
231 }
virtual void Reset()
Definition: UnitAI.h:206
CreatureAI * AI() const
Definition: Creature.h:140
void setActive(bool isActiveObject)
Definition: Object.cpp:1094
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:178
Definition: GridNotifiers.h:489

References _creature, Creature::AI(), UnitAI::Reset(), WorldObject::setActive(), and Cell::VisitGridObjects().

◆ operator()()

void ValithriaDespawner::operator() ( Creature creature) const
inline
234 {
235 switch (creature->GetEntry())
236 {
238 if (InstanceScript* instance = creature->GetInstanceScript())
239 instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, creature);
240 break;
242 if (creature->IsAlive())
243 creature->AI()->Reset();
244 return;
246 case NPC_SUPPRESSER:
249 case NPC_MANA_VOID:
251 case NPC_ROT_WORM:
252 creature->DespawnOrUnsummon();
253 return;
255 if (!creature->GetSpawnId())
256 {
257 creature->DespawnOrUnsummon();
258 return;
259 }
260 break;
261 default:
262 return;
263 }
264
265 uint32 corpseDelay = creature->GetCorpseDelay();
266 uint32 respawnDelay = creature->GetRespawnDelay();
267 creature->SetCorpseDelay(1);
268 creature->SetRespawnDelay(10);
269
270 if (CreatureData const* data = creature->GetCreatureData())
271 creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation);
272 if (!creature->IsAlive())
273 {
274 creature->RemoveCorpse(false);
275 creature->SetRespawnTime(11);
276 }
277 else
278 creature->DespawnOrUnsummon();
279
280 creature->SetCorpseDelay(corpseDelay);
281 creature->SetRespawnDelay(respawnDelay);
282 }
std::uint32_t uint32
Definition: Define.h:107
@ NPC_THE_LICH_KING_VALITHRIA
Definition: icecrown_citadel.h:318
@ NPC_MANA_VOID
Definition: icecrown_citadel.h:315
@ NPC_RISEN_ARCHMAGE
Definition: icecrown_citadel.h:310
@ NPC_VALITHRIA_DREAMWALKER
Definition: icecrown_citadel.h:308
@ NPC_SUPPRESSER
Definition: icecrown_citadel.h:312
@ NPC_BLAZING_SKELETON
Definition: icecrown_citadel.h:311
@ NPC_ROT_WORM
Definition: icecrown_citadel.h:317
@ NPC_GLUTTONOUS_ABOMINATION
Definition: icecrown_citadel.h:314
@ NPC_COLUMN_OF_FROST
Definition: icecrown_citadel.h:316
@ NPC_BLISTERING_ZOMBIE
Definition: icecrown_citadel.h:313
@ ENCOUNTER_FRAME_DISENGAGE
Definition: InstanceScript.h:46
void SetRespawnTime(uint32 respawn)
Definition: Creature.cpp:3775
void SetRespawnDelay(uint32 delay)
Definition: Creature.h:292
void RemoveCorpse(bool setSpawnTime=true, bool skipVisibility=false)
Definition: Creature.cpp:400
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3154
CreatureData const * GetCreatureData() const
Definition: Creature.h:206
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:65
uint32 GetRespawnDelay() const
Definition: Creature.h:291
void SetCorpseDelay(uint32 delay)
Definition: Creature.h:70
uint32 GetCorpseDelay() const
Definition: Creature.h:72
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2178
Definition: CreatureData.h:370
uint32 GetEntry() const
Definition: Object.h:115
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
bool IsAlive() const
Definition: Unit.h:1654
Definition: InstanceScript.h:142

References Creature::AI(), Creature::DespawnOrUnsummon(), ENCOUNTER_FRAME_DISENGAGE, Creature::GetCorpseDelay(), Creature::GetCreatureData(), Object::GetEntry(), WorldObject::GetInstanceScript(), Creature::GetRespawnDelay(), Creature::GetSpawnId(), Unit::IsAlive(), NPC_BLAZING_SKELETON, NPC_BLISTERING_ZOMBIE, NPC_COLUMN_OF_FROST, NPC_GLUTTONOUS_ABOMINATION, NPC_MANA_VOID, NPC_RISEN_ARCHMAGE, NPC_ROT_WORM, NPC_SUPPRESSER, NPC_THE_LICH_KING_VALITHRIA, NPC_VALITHRIA_DREAMWALKER, Creature::RemoveCorpse(), UnitAI::Reset(), Creature::SetCorpseDelay(), Creature::SetPosition(), Creature::SetRespawnDelay(), and Creature::SetRespawnTime().

Member Data Documentation

◆ _creature

Creature* ValithriaDespawner::_creature
private

Referenced by Execute().