AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::AnyAoETargetUnitInObjectRangeCheck Class Reference

#include "GridNotifiers.h"

Public Member Functions

 AnyAoETargetUnitInObjectRangeCheck (WorldObject const *obj, Unit const *funit, float range)
 
bool operator() (Unit *u)
 

Private Attributes

bool i_targetForPlayer
 
WorldObject const * i_obj
 
Unit const * i_funit
 
SpellInfo const * _spellInfo
 
float i_range
 

Detailed Description

Constructor & Destructor Documentation

◆ AnyAoETargetUnitInObjectRangeCheck()

Acore::AnyAoETargetUnitInObjectRangeCheck::AnyAoETargetUnitInObjectRangeCheck ( WorldObject const *  obj,
Unit const *  funit,
float  range 
)
inline
1104 : i_obj(obj), i_funit(funit), _spellInfo(nullptr), i_range(range)
1105 {
1106 Unit const* check = i_funit;
1107 Unit const* owner = i_funit->GetOwner();
1108 if (owner)
1109 check = owner;
1110 i_targetForPlayer = (check->IsPlayer());
1111 if (i_obj->IsDynamicObject())
1112 _spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId());
1113 }
#define sSpellMgr
Definition SpellMgr.h:847
SpellInfo const * _spellInfo
Definition GridNotifiers.h:1140
Unit const * i_funit
Definition GridNotifiers.h:1139
WorldObject const * i_obj
Definition GridNotifiers.h:1138
float i_range
Definition GridNotifiers.h:1141
bool i_targetForPlayer
Definition GridNotifiers.h:1137
Definition DynamicObject.h:35
bool IsPlayer() const
Definition Object.h:201
bool IsDynamicObject() const
Definition Object.h:221
Definition Unit.h:664
Unit * GetOwner() const
Definition Unit.cpp:7717

References _spellInfo, Unit::GetOwner(), i_funit, i_obj, i_targetForPlayer, Object::IsDynamicObject(), Object::IsPlayer(), and sSpellMgr.

Member Function Documentation

◆ operator()()

bool Acore::AnyAoETargetUnitInObjectRangeCheck::operator() ( Unit u)
inline
1115 {
1116 // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
1117 if (Creature* creature = u->ToCreature())
1118 {
1119 if (creature->IsTotem())
1120 {
1121 return false;
1122 }
1123
1124 if (creature->IsAvoidingAOE())
1125 {
1126 return false;
1127 }
1128 }
1129
1130 if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false, true))
1131
1132 return true;
1133
1134 return false;
1135 }
Definition Creature.h:47
Creature * ToCreature()
Definition Object.h:206
bool _IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
Definition Unit.cpp:10767

References Unit::_IsValidAttackTarget(), _spellInfo, i_funit, i_obj, i_range, Object::IsDynamicObject(), WorldObject::IsWithinDistInMap(), and Object::ToCreature().

Member Data Documentation

◆ _spellInfo

SpellInfo const* Acore::AnyAoETargetUnitInObjectRangeCheck::_spellInfo
private

◆ i_funit

Unit const* Acore::AnyAoETargetUnitInObjectRangeCheck::i_funit
private

◆ i_obj

WorldObject const* Acore::AnyAoETargetUnitInObjectRangeCheck::i_obj
private

◆ i_range

float Acore::AnyAoETargetUnitInObjectRangeCheck::i_range
private

Referenced by operator()().

◆ i_targetForPlayer

bool Acore::AnyAoETargetUnitInObjectRangeCheck::i_targetForPlayer
private

The documentation for this class was generated from the following file: