mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
feat(Core): GetDeadCreatureListInGrid helper added, for aoe loot (#8445)
This commit is contained in:
@@ -714,3 +714,8 @@ void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject*
|
||||
{
|
||||
source->GetGameObjectListWithEntryInGrid(list, entry, maxSearchRange);
|
||||
}
|
||||
|
||||
void GetDeadCreatureListInGrid(std::list<Creature*>& list, WorldObject* source, float maxSearchRange, bool alive /*= false*/)
|
||||
{
|
||||
source->GetDeadCreatureListInGrid(list, maxSearchRange, alive);
|
||||
}
|
||||
|
||||
@@ -505,5 +505,6 @@ Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float m
|
||||
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
void GetDeadCreatureListInGrid(std::list<Creature*>& list, WorldObject* source, float maxSearchRange, bool alive = false);
|
||||
|
||||
#endif // SCRIPTEDCREATURE_H_
|
||||
|
||||
@@ -2503,6 +2503,13 @@ void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureL
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
void WorldObject::GetDeadCreatureListInGrid(std::list<Creature*>& creaturedeadList, float maxSearchRange, bool alive /*= false*/) const
|
||||
{
|
||||
Acore::AllDeadCreaturesInRange check(this, maxSearchRange, alive);
|
||||
Acore::CreatureListSearcher<Acore::AllDeadCreaturesInRange> searcher(this, creaturedeadList, check);
|
||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
||||
}
|
||||
|
||||
/*
|
||||
namespace Acore
|
||||
{
|
||||
|
||||
@@ -1007,6 +1007,7 @@ public:
|
||||
[[nodiscard]] Player* SelectNearestPlayer(float distance = 0) const;
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||
void GetDeadCreatureListInGrid(std::list<Creature*>& lList, float maxSearchRange, bool alive = false) const;
|
||||
|
||||
void DestroyForNearbyPlayers();
|
||||
virtual void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false);
|
||||
|
||||
@@ -1327,6 +1327,30 @@ namespace Acore
|
||||
float m_fRange;
|
||||
};
|
||||
|
||||
class AllDeadCreaturesInRange
|
||||
{
|
||||
public:
|
||||
AllDeadCreaturesInRange(WorldObject const* obj, float range, bool reqAlive = true) : _obj(obj), _range(range), _reqAlive(reqAlive) {}
|
||||
|
||||
bool operator()(Unit* unit) const
|
||||
{
|
||||
if (_reqAlive && unit->IsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!_obj->IsWithinDistInMap(unit, _range))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
WorldObject const* _obj;
|
||||
float _range;
|
||||
bool _reqAlive;
|
||||
};
|
||||
|
||||
class PlayerAtMinimumRangeAway
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user