AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
RedirectSpellEvent Class Reference

#include "Unit.h"

Inheritance diagram for RedirectSpellEvent:
BasicEvent

Public Member Functions

 RedirectSpellEvent (Unit &self, ObjectGuid auraOwnerGUID, AuraEffect *auraEffect)
 
bool Execute (uint64 e_time, uint32 p_time) override
 
- 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 ()
 

Protected Attributes

Unit_self
 
ObjectGuid _auraOwnerGUID
 
AuraEffect_auraEffect
 

Detailed Description

Constructor & Destructor Documentation

◆ RedirectSpellEvent()

RedirectSpellEvent::RedirectSpellEvent ( Unit self,
ObjectGuid  auraOwnerGUID,
AuraEffect auraEffect 
)
inline
2671: _self(self), _auraOwnerGUID(auraOwnerGUID), _auraEffect(auraEffect) { }
AuraEffect * _auraEffect
Definition: Unit.h:2677
ObjectGuid _auraOwnerGUID
Definition: Unit.h:2676
Unit & _self
Definition: Unit.h:2675

Member Function Documentation

◆ Execute()

bool RedirectSpellEvent::Execute ( uint64  e_time,
uint32  p_time 
)
overridevirtual

Reimplemented from BasicEvent.

10955{
10957 {
10958 // Xinef: already removed
10959 if (!auraOwner->HasAuraType(SPELL_AURA_SPELL_MAGNET))
10960 return true;
10961
10962 Unit::AuraEffectList const& magnetAuras = auraOwner->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET);
10963 for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
10964 if (*itr == _auraEffect)
10965 {
10966 (*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_DEFAULT);
10967 return true;
10968 }
10969 }
10970
10971 return true;
10972}
@ SPELL_AURA_SPELL_MAGNET
Definition: SpellAuraDefines.h:159
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
Definition: Unit.h:1290
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1306

References _auraEffect, _auraOwnerGUID, _self, AURA_REMOVE_BY_DEFAULT, ObjectAccessor::GetUnit(), and SPELL_AURA_SPELL_MAGNET.

Member Data Documentation

◆ _auraEffect

AuraEffect* RedirectSpellEvent::_auraEffect
protected

Referenced by Execute().

◆ _auraOwnerGUID

ObjectGuid RedirectSpellEvent::_auraOwnerGUID
protected

Referenced by Execute().

◆ _self

Unit& RedirectSpellEvent::_self
protected

Referenced by Execute().