diff options
author | Treeston <treeston.mmoc@gmail.com> | 2018-08-22 21:31:13 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-10-22 23:17:04 +0200 |
commit | fff5a32a13ae896ecd4288838f6678ce484f7e23 (patch) | |
tree | 428598c311522e0fed47997cfc62a5f39eb50531 /src | |
parent | b6f28a7ebc2684d7514211201a344a6e510b7be5 (diff) |
Core/LFG: Order group members before creating LFG group (leader > tank > healer > dps). Closes #16244.
(cherry picked from commit dd54c8012321ecd40fc82f04cf0c98b201bc580e)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 24 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.h | 72 |
2 files changed, 57 insertions, 39 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index faeee1e4b67..0d35077cebd 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -917,21 +917,39 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles) */ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) { - GuidList players; + GuidList players, tankPlayers, healPlayers, dpsPlayers; GuidList playersToTeleport; for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { ObjectGuid guid = it->first; if (guid == proposal.leader) - players.push_front(guid); - else players.push_back(guid); + else + switch (it->second.role & ~PLAYER_ROLE_LEADER) + { + case PLAYER_ROLE_TANK: + tankPlayers.push_back(guid); + break; + case PLAYER_ROLE_HEALER: + healPlayers.push_back(guid); + break; + case PLAYER_ROLE_DAMAGE: + dpsPlayers.push_back(guid); + break; + default: + ASSERT(false, "Invalid LFG role %u", it->second.role); + break; + } if (proposal.isNew || GetGroup(guid) != proposal.group) playersToTeleport.push_back(guid); } + players.splice(players.end(), tankPlayers); + players.splice(players.end(), healPlayers); + players.splice(players.end(), dpsPlayers); + // Set the dungeon difficulty LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId); ASSERT(dungeon); diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 6174a1c1ec2..b7209f5c18c 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -242,9 +242,9 @@ struct LfgReward struct LfgProposalPlayer { LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group() { } - uint8 role; ///< Proposed role - LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree) - ObjectGuid group; ///< Original group guid. 0 if no original group + uint8 role; /// Proposed role + LfgAnswer accept; /// Accept status (-1 not answer | 0 Not agree | 1 agree) + ObjectGuid group; /// Original group guid. 0 if no original group }; /// Stores group data related to proposal to join @@ -254,38 +254,38 @@ struct LfgProposal group(), leader(), cancelTime(0), encounters(0), isNew(true) { } - uint32 id; ///< Proposal Id - uint32 dungeonId; ///< Dungeon to join - LfgProposalState state; ///< State of the proposal - ObjectGuid group; ///< Proposal group (0 if new) - ObjectGuid leader; ///< Leader guid. - time_t cancelTime; ///< Time when we will cancel this proposal - uint32 encounters; ///< Dungeon Encounters - bool isNew; ///< Determines if it's new group or not - GuidList queues; ///< Queue Ids to remove/readd - GuidList showorder; ///< Show order in update window - LfgProposalPlayerContainer players; ///< Players data + uint32 id; /// Proposal Id + uint32 dungeonId; /// Dungeon to join + LfgProposalState state; /// State of the proposal + ObjectGuid group; /// Proposal group (0 if new) + ObjectGuid leader; /// Leader guid. + time_t cancelTime; /// Time when we will cancel this proposal + uint32 encounters; /// Dungeon Encounters + bool isNew; /// Determines if it's new group or not + GuidList queues; /// Queue Ids to remove/readd + GuidList showorder; /// Show order in update window + LfgProposalPlayerContainer players; /// Players data }; /// Stores all rolecheck info of a group that wants to join struct LfgRoleCheck { - time_t cancelTime; ///< Time when the rolecheck will fail - LfgRolesMap roles; ///< Player selected roles - LfgRoleCheckState state; ///< State of the rolecheck - LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons) - uint32 rDungeonId; ///< Random Dungeon Id. - ObjectGuid leader; ///< Leader of the group + time_t cancelTime; /// Time when the rolecheck will fail + LfgRolesMap roles; /// Player selected roles + LfgRoleCheckState state; /// State of the rolecheck + LfgDungeonSet dungeons; /// Dungeons group is applying for (expanded random dungeons) + uint32 rDungeonId; /// Random Dungeon Id. + ObjectGuid leader; /// Leader of the group }; /// Stores information of a current vote to kick someone from a group struct LfgPlayerBoot { - time_t cancelTime; ///< Time left to vote - bool inProgress; ///< Vote in progress - LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree) - ObjectGuid victim; ///< Player guid to be kicked (can't vote) - std::string reason; ///< kick reason + time_t cancelTime; /// Time left to vote + bool inProgress; /// Vote in progress + LfgAnswerContainer votes; /// Player votes (-1 not answer | 0 Not agree | 1 agree) + ObjectGuid victim; /// Player guid to be kicked (can't vote) + std::string reason; /// kick reason }; struct LFGDungeonData @@ -474,21 +474,21 @@ class TC_GAME_API LFGMgr GuidSet const& GetPlayers(ObjectGuid guid); // General variables - uint32 m_QueueTimer; ///< used to check interval of update - uint32 m_lfgProposalId; ///< used as internal counter for proposals - uint32 m_options; ///< Stores config options + uint32 m_QueueTimer; /// used to check interval of update + uint32 m_lfgProposalId; /// used as internal counter for proposals + uint32 m_options; /// Stores config options - LfgQueueContainer QueuesStore; ///< Queues - LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType + LfgQueueContainer QueuesStore; /// Queues + LfgCachedDungeonContainer CachedDungeonMapStore; /// Stores all dungeons by groupType // Reward System - LfgRewardContainer RewardMapStore; ///< Stores rewards for random dungeons + LfgRewardContainer RewardMapStore; /// Stores rewards for random dungeons LFGDungeonContainer LfgDungeonStore; // Rolecheck - Proposal - Vote Kicks - LfgRoleCheckContainer RoleChecksStore; ///< Current Role checks - LfgProposalContainer ProposalsStore; ///< Current Proposals - LfgPlayerBootContainer BootsStore; ///< Current player kicks - LfgPlayerDataContainer PlayersStore; ///< Player data - LfgGroupDataContainer GroupsStore; ///< Group data + LfgRoleCheckContainer RoleChecksStore; /// Current Role checks + LfgProposalContainer ProposalsStore; /// Current Proposals + LfgPlayerBootContainer BootsStore; /// Current player kicks + LfgPlayerDataContainer PlayersStore; /// Player data + LfgGroupDataContainer GroupsStore; /// Group data }; } // namespace lfg |