Core/Object: Implement FindNearestCreatureWithAura

Port From (https://github.com/TrinityCore/TrinityCore/commit/9a3e29d416162a84dd6a11c5e248f5f65e98a604)
This commit is contained in:
hondacrx
2022-10-31 13:56:14 -04:00
parent 8acc130815
commit 1f774369f2
2 changed files with 42 additions and 0 deletions
@@ -1619,6 +1619,14 @@ namespace Game.Entities
return searcher.GetTarget();
}
public Creature FindNearestCreatureWithAura(uint entry, uint spellId, float range, bool alive = true)
{
var checker = new NearestCreatureEntryWithLiveStateAndAuraInObjectRangeCheck(this, entry, spellId, alive, range);
var searcher = new CreatureLastSearcher(this, checker);
Cell.VisitAllObjects(this, searcher, range);
return searcher.GetTarget();
}
public GameObject FindNearestGameObject(uint entry, float range, bool spawnedOnly = true)
{
var checker = new NearestGameObjectEntryInObjectRangeCheck(this, entry, range, spawnedOnly);