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

#include "GridNotifiers.h"

Public Member Functions

 NearestAttackableNoTotemUnitInObjectRangeCheck (WorldObject const *obj, Unit const *owner, float range)
 
bool operator() (Unit *u)
 

Private Attributes

WorldObject const * i_obj
 
Unit const * i_owner
 
float i_range
 

Detailed Description

Constructor & Destructor Documentation

◆ NearestAttackableNoTotemUnitInObjectRangeCheck()

Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::NearestAttackableNoTotemUnitInObjectRangeCheck ( WorldObject const *  obj,
Unit const *  owner,
float  range 
)
inline
907: i_obj(obj), i_owner(owner), i_range(range) {}
Unit const * i_owner
Definition: GridNotifiers.h:950
WorldObject const * i_obj
Definition: GridNotifiers.h:949
float i_range
Definition: GridNotifiers.h:951

Member Function Documentation

◆ operator()()

bool Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator() ( Unit u)
inline
910 {
911 if (!u->IsAlive())
912 {
913 return false;
914 }
915
917 {
918 return false;
919 }
920
921 if (u->IsCreature() && u->ToCreature()->IsTotem())
922 {
923 return false;
924 }
925
926 if (!u->isTargetableForAttack(false, i_owner))
927 {
928 return false;
929 }
930
931 uint32 losChecks = LINEOFSIGHT_ALL_CHECKS;
932 Optional<float> collisionHeight = { };
933 if (i_obj->IsGameObject())
934 {
935 losChecks &= ~LINEOFSIGHT_CHECK_GOBJECT_M2;
936 collisionHeight = i_owner->GetCollisionHeight();
937 }
938
941 {
942 return false;
943 }
944
945 return true;
946 }
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:24
std::uint32_t uint32
Definition: Define.h:107
@ CREATURE_TYPE_NON_COMBAT_PET
Definition: SharedDefines.h:2639
LineOfSightChecks
Definition: Map.h:189
@ LINEOFSIGHT_ALL_CHECKS
Definition: Map.h:196
bool IsGameObject() const
Definition: Object.h:212
bool IsCreature() const
Definition: Object.h:204
Creature * ToCreature()
Definition: Object.h:205
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1358
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1332
float GetCollisionHeight() const override
Return collision height sent to client.
Definition: Unit.cpp:21106
bool IsAlive() const
Definition: Unit.h:1654
uint32 GetCreatureType() const
Definition: Unit.cpp:15182
bool isTargetableForAttack(bool checkFakeDeath=true, Unit const *byWho=nullptr) const
Definition: Unit.cpp:13854
bool IsTotem() const
Definition: Unit.h:756
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13871

References CREATURE_TYPE_NON_COMBAT_PET, Unit::GetCollisionHeight(), Unit::GetCreatureType(), i_obj, i_owner, i_range, Unit::IsAlive(), Object::IsCreature(), Object::IsGameObject(), Unit::isTargetableForAttack(), Unit::IsTotem(), Unit::IsValidAttackTarget(), WorldObject::IsWithinDistInMap(), WorldObject::IsWithinLOSInMap(), LINEOFSIGHT_ALL_CHECKS, VMAP::Nothing, and Object::ToCreature().

Member Data Documentation

◆ i_obj

WorldObject const* Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::i_obj
private

Referenced by operator()().

◆ i_owner

Unit const* Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::i_owner
private

Referenced by operator()().

◆ i_range

float Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::i_range
private

Referenced by operator()().