feat(Core/Battleground): rework bg queue system (#10817)

This commit is contained in:
Kargatum
2022-03-16 00:36:49 +07:00
committed by GitHub
parent 6c60dc3841
commit 78bdc89881
29 changed files with 1354 additions and 963 deletions
+17
View File
@@ -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);
}
}
+4
View File
@@ -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);