feat(Core/Battleground): rework bg queue system (#10817)
This commit is contained in:
@@ -2189,6 +2189,11 @@ ObjectGuid Group::GetLeaderGUID() const
|
||||
return m_leaderGuid;
|
||||
}
|
||||
|
||||
Player* Group::GetLeader()
|
||||
{
|
||||
return ObjectAccessor::FindConnectedPlayer(m_leaderGuid);
|
||||
}
|
||||
|
||||
ObjectGuid Group::GetGUID() const
|
||||
{
|
||||
return m_guid;
|
||||
@@ -2425,3 +2430,15 @@ void Group::SetDifficultyChangePrevention(DifficultyPreventionChangeType type)
|
||||
_difficultyChangePreventionTime = GameTime::GetGameTime().count() + MINUTE;
|
||||
_difficultyChangePreventionType = type;
|
||||
}
|
||||
|
||||
void Group::DoForAllMembers(std::function<void(Player*)> const& worker)
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* member = itr->GetSource();
|
||||
if (!member)
|
||||
continue;
|
||||
|
||||
worker(member);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "LootMgr.h"
|
||||
#include "QueryResult.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <functional>
|
||||
|
||||
class Battlefield;
|
||||
class Battleground;
|
||||
@@ -214,6 +215,7 @@ public:
|
||||
bool isBGGroup() const;
|
||||
bool IsCreated() const;
|
||||
ObjectGuid GetLeaderGUID() const;
|
||||
Player* GetLeader();
|
||||
ObjectGuid GetGUID() const;
|
||||
const char* GetLeaderName() const;
|
||||
LootMethod GetLootMethod() const;
|
||||
@@ -313,6 +315,8 @@ public:
|
||||
DifficultyPreventionChangeType GetDifficultyChangePreventionReason() const { return _difficultyChangePreventionType; }
|
||||
void SetDifficultyChangePrevention(DifficultyPreventionChangeType type);
|
||||
|
||||
void DoForAllMembers(std::function<void(Player*)> const& worker);
|
||||
|
||||
protected:
|
||||
void _homebindIfInstance(Player* player);
|
||||
void _cancelHomebindIfInstance(Player* player);
|
||||
|
||||
Reference in New Issue
Block a user