Check compatibilities between groups. If group is Matched proposal will be created
354 LfgProposal proposal;
367 if (
check.size() > 2)
378 return child_compatibles;
380 check.push_front(frontGuid);
384 uint8 numPlayers = 0;
385 uint8 numLfgGroups = 0;
386 for (GuidList::const_iterator it =
check.begin(); it !=
check.end() && numLfgGroups < 2 && numPlayers <=
MAX_GROUP_SIZE; ++it)
389 LfgQueueDataContainer::iterator itQueue =
QueueDataStore.find(guid);
392 TC_LOG_ERROR(
"lfg.queue.match.compatibility.check",
"Guid: [%s] is not queued but listed as queued!", guid.
ToString().c_str());
398 for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
399 proposalGroups[it2->first] = itQueue->first.IsParty() ? itQueue->first :
ObjectGuid::Empty;
401 numPlayers += itQueue->second.roles.size();
406 proposal.group = guid;
418 data.roles = itQueue->second.roles;
426 if (numLfgGroups > 1)
441 if (
check.size() > 1)
443 for (GuidList::const_iterator it =
check.begin(); it !=
check.end(); ++it)
446 for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
448 LfgRolesMap::const_iterator itPlayer;
449 for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer)
451 if (itRoles->first == itPlayer->first)
452 TC_LOG_ERROR(
"lfg.queue.match.compatibility.check",
"Guids: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str());
453 else if (
sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
456 if (itPlayer == proposalRoles.end())
457 proposalRoles[itRoles->first] = itRoles->second;
461 if (
uint8 playersize = numPlayers - proposalRoles.size())
471 std::ostringstream o;
472 for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it)
480 GuidList::iterator itguid =
check.begin();
482 std::ostringstream o;
484 for (++itguid; itguid !=
check.end(); ++itguid)
489 std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
490 proposalDungeons = temporal;
493 if (proposalDungeons.empty())
504 proposalDungeons = queue.dungeons;
505 proposalRoles = queue.roles;
514 data.roles = proposalRoles;
516 for (GuidList::const_iterator itr =
check.begin(); itr !=
check.end(); ++itr)
524 proposal.queues =
check;
537 proposal.leader.Clear();
541 for (LfgRolesMap::const_iterator itRoles = proposalRoles.begin(); itRoles != proposalRoles.end(); ++itRoles)
546 if (!leader || !proposal.leader ||
urand(0, 1))
547 proposal.leader = itRoles->first;
550 else if (!leader && (!proposal.leader ||
urand(0, 1)))
551 proposal.leader = itRoles->first;
554 LfgProposalPlayer &data = proposal.players[itRoles->first];
555 data.role = itRoles->second;
556 data.group = proposalGroups.find(itRoles->first)->second;
557 if (!proposal.isNew && !data.group.IsEmpty() && data.group == proposal.group)
562 for (GuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue)
569 sLFGMgr->AddProposal(proposal);
Definition: LFGQueue.h:35
LfgCompatibility
Definition: LFGQueue.h:26
static bool CheckGroupRoles(LfgRolesMap &groles)
Checks if given roles match, modifies given roles map with new roles.
Definition: LFGMgr.cpp:814
Definition: LFGQueue.h:34
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
LfgQueueDataContainer QueueDataStore
Queued groups.
Definition: LFGQueue.h:135
C::value_type const & SelectRandomContainerElement(C const &container)
Definition: Containers.h:68
std::string ConcatenateDungeons(LfgDungeonSet const &dungeons)
Definition: LFG.cpp:25
Definition: LFGQueue.h:31
void RemoveFromQueue(ObjectGuid guid)
Definition: LFGQueue.cpp:132
std::map< ObjectGuid, ObjectGuid > LfgGroupsMap
Definition: LFG.h:116
Definition: LFGQueue.h:30
Definition: LFGQueue.h:36
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
std::string GetDetailedMatchRoles(GuidList const &check) const
Definition: LFGQueue.cpp:83
#define MAX_GROUP_SIZE
Definition: Group.h:42
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const &key, LfgRolesMap const &roles)
Definition: LFGQueue.cpp:703
void RemoveFromCurrentQueue(ObjectGuid guid)
Definition: LFGQueue.cpp:174
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
#define sLFGMgr
Definition: LFGMgr.h:481
std::set< uint32 > LfgDungeonSet
Definition: LFG.h:112
std::map< ObjectGuid, uint8 > LfgRolesMap
Definition: LFG.h:115
Definition: LFGQueue.h:29
std::string GetRolesString(uint8 roles)
Definition: LFG.cpp:40
Definition: LFGQueue.h:37
void RemoveFromNewQueue(ObjectGuid guid)
Definition: LFGQueue.cpp:164
void SetCompatibilityData(std::string const &key, LfgCompatibilityData const &compatibles)
Definition: LFGQueue.cpp:252
Definition: LFGQueue.h:33
Definition: LFGQueue.h:32
uint8_t uint8
Definition: Define.h:152
std::string ConcatenateGuids(GuidList const &check)
Definition: LFGQueue.cpp:36
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ObjectGuid.h:189
void SetCompatibles(std::string const &key, LfgCompatibility compatibles)
Definition: LFGQueue.cpp:246
T check(T value)
Definition: format.h:305
Definition: LFGQueue.h:28
LfgCompatibility CheckCompatibility(GuidList check)
Definition: LFGQueue.cpp:351
std::string ToString() const
Definition: ObjectGuid.cpp:99