Core/Misc: Add new function for selection nearest player in given distance
This commit is contained in:
@@ -1817,6 +1817,17 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const
|
||||
return target;
|
||||
}
|
||||
|
||||
Player* Creature::SelectNearestPlayer(float distance) const
|
||||
{
|
||||
Player* target = NULL;
|
||||
|
||||
Trinity::NearestPlayerInObjectRangeCheck checker(this, distance);
|
||||
Trinity::PlayerLastSearcher<Trinity::NearestPlayerInObjectRangeCheck> searcher(this, target, checker);
|
||||
VisitNearbyObject(distance, searcher);
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
void Creature::SendAIReaction(AiReaction reactionType)
|
||||
{
|
||||
WorldPacket data(SMSG_AI_REACTION, 12);
|
||||
|
||||
@@ -584,6 +584,7 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
|
||||
Unit* SelectNearestTarget(float dist = 0) const;
|
||||
Unit* SelectNearestTargetInAttackDistance(float dist = 0) const;
|
||||
Player* SelectNearestPlayer(float distance = 0) const;
|
||||
|
||||
void DoFleeToGetAssistance();
|
||||
void CallForHelp(float fRadius);
|
||||
|
||||
Reference in New Issue
Block a user