aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Object
diff options
context:
space:
mode:
authorTeleqraph <nyrdeveloper@gmail.com>2022-10-30 22:29:03 +0100
committerShauren <shauren.trinity@gmail.com>2024-10-05 17:06:02 +0200
commit762a32cb65ea7cd9d802f9621e701afce9709303 (patch)
treebc42b06d040fa426ce2db7cc42e33994990b3b43 /src/server/game/Entities/Object
parentb502bc46837f68383b68d8aecc4d4d5d7ff252f5 (diff)
Core/Object: Implement FindNearestCreatureWithAura (#28410)
* Game/Object: Implement NearestCreatureEntryWithLiveStateAndAuraInObjectRangeCheck class and FindNearestCreatureWithAura method * moved arguments (cherry picked from commit 9a3e29d416162a84dd6a11c5e248f5f65e98a604)
Diffstat (limited to 'src/server/game/Entities/Object')
-rw-r--r--src/server/game/Entities/Object/Object.cpp9
-rw-r--r--src/server/game/Entities/Object/Object.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 31ba39d5a23..b944d94a666 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2126,6 +2126,15 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive
return creature;
}
+Creature* WorldObject::FindNearestCreatureWithAura(uint32 entry, uint32 spellId, float range, bool alive) const
+{
+ Creature* creature = nullptr;
+ Trinity::NearestCreatureEntryWithLiveStateAndAuraInObjectRangeCheck checker(*this, entry, spellId, alive, range);
+ Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateAndAuraInObjectRangeCheck> searcher(this, creature, checker);
+ Cell::VisitAllObjects(this, searcher, range);
+ return creature;
+}
+
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range, bool spawnedOnly) const
{
GameObject* go = nullptr;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index b3cd579df89..ac9a4dae5ee 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -426,6 +426,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
+ Creature* FindNearestCreatureWithAura(uint32 entry, uint32 spellId, float range, bool alive = true) const;
GameObject* FindNearestGameObject(uint32 entry, float range, bool spawnedOnly = true) const;
GameObject* FindNearestUnspawnedGameObject(uint32 entry, float range) const;
GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;