AzerothCore 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
1342: _owner(owner) { }
Creature & _owner
Definition: pit_of_saron.cpp:1363

Member Function Documentation

◆ Execute()

bool SlaveRunEvent::Execute ( uint64  ,
uint32   
)
inlineoverridevirtual

Reimplemented from BasicEvent.

1345 {
1346 uint32 pointId = 0;
1347 float minDist = _owner.GetExactDist2dSq(&slaveFreePos[pointId]);
1348 for (uint32 i = 1; i < 4; ++i)
1349 {
1350 float dist = _owner.GetExactDist2dSq(&slaveFreePos[i]);
1351 if (dist < minDist)
1352 {
1353 minDist = dist;
1354 pointId = i;
1355 }
1356 }
1357 if (minDist < 200.0f * 200.0f)
1358 _owner.GetMotionMaster()->MovePoint(0, slaveFreePos[pointId], true, false);
1359 return true;
1360 }
std::uint32_t uint32
Definition: Define.h:107
const Position slaveFreePos[4]
Definition: pit_of_saron.cpp:1331
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:157
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:211

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

Member Data Documentation

◆ _owner

Creature& SlaveRunEvent::_owner
private

Referenced by Execute().