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

Public Member Functions

 SlaveRunEvent (Creature &owner)
 
bool Execute (uint64, uint32) 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 ()
 

Private Attributes

Creature_owner
 

Detailed Description

Constructor & Destructor Documentation

◆ SlaveRunEvent()

SlaveRunEvent::SlaveRunEvent ( Creature owner)
inline
1381: _owner(owner) { }
Creature & _owner
Definition: pit_of_saron.cpp:1402

Member Function Documentation

◆ Execute()

bool SlaveRunEvent::Execute ( uint64  ,
uint32   
)
inlineoverridevirtual

Reimplemented from BasicEvent.

1384 {
1385 uint32 pointId = 0;
1386 float minDist = _owner.GetExactDist2dSq(&slaveFreePos[pointId]);
1387 for (uint32 i = 1; i < 4; ++i)
1388 {
1389 float dist = _owner.GetExactDist2dSq(&slaveFreePos[i]);
1390 if (dist < minDist)
1391 {
1392 minDist = dist;
1393 pointId = i;
1394 }
1395 }
1396 if (minDist < 200.0f * 200.0f)
1397 _owner.GetMotionMaster()->MovePoint(0, slaveFreePos[pointId], true, false);
1398 return true;
1399 }
std::uint32_t uint32
Definition: Define.h:108
const Position slaveFreePos[4]
Definition: pit_of_saron.cpp:1370
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:157
MotionMaster * GetMotionMaster()
Definition: Unit.h:2530
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:210

References _owner, Position::GetExactDist2dSq(), Unit::GetMotionMaster(), MotionMaster::MovePoint(), and slaveFreePos.

Member Data Documentation

◆ _owner

Creature& SlaveRunEvent::_owner
private

Referenced by Execute().