mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +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);
|
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);
|
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange);
|
||||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, 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 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_
|
#endif // SCRIPTEDCREATURE_H_
|
||||||
|
|||||||
@@ -2503,6 +2503,13 @@ void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureL
|
|||||||
Cell::VisitGridObjects(this, searcher, maxSearchRange);
|
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
|
namespace Acore
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1007,6 +1007,7 @@ public:
|
|||||||
[[nodiscard]] Player* SelectNearestPlayer(float distance = 0) const;
|
[[nodiscard]] Player* SelectNearestPlayer(float distance = 0) const;
|
||||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& 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();
|
void DestroyForNearbyPlayers();
|
||||||
virtual void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false);
|
virtual void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false);
|
||||||
|
|||||||
@@ -1327,6 +1327,30 @@ namespace Acore
|
|||||||
float m_fRange;
|
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
|
class PlayerAtMinimumRangeAway
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user