46 difficulty(
DIFFICULTY_NONE), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0), finalDungeonEncounterId(0)
52 contentTuningId(
uint32(dbc->ContentTuningID)), difficulty(
Difficulty(dbc->DifficultyID)),
53 seasonal((dbc->Flags[0] &
LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f),
54 requiredItemLevel(0), finalDungeonEncounterId(0)
79 SetLeader(guid, ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64()));
84 if (!dungeon || !state)
130 QueryResult result =
WorldDatabase.Query(
"SELECT dungeonId, maxLevel, firstQuestId, otherQuestId FROM lfg_dungeon_rewards ORDER BY dungeonId, maxLevel ASC");
134 TC_LOG_INFO(
"server.loading",
">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
140 Field* fields =
nullptr;
143 fields = result->Fetch();
151 TC_LOG_ERROR(
"sql.sql",
"Dungeon {} specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
157 TC_LOG_ERROR(
"sql.sql",
"Level {} specified for dungeon {} in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
161 if (!firstQuestId || !
sObjectMgr->GetQuestTemplate(firstQuestId))
163 TC_LOG_ERROR(
"sql.sql",
"First quest {} specified for dungeon {} in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
167 if (otherQuestId && !
sObjectMgr->GetQuestTemplate(otherQuestId))
169 TC_LOG_ERROR(
"sql.sql",
"Other quest {} specified for dungeon {} in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
173 RewardMapStore.insert(LfgRewardContainer::value_type(dungeonId,
new LfgReward(maxLevel, firstQuestId, otherQuestId)));
176 while (result->NextRow());
185 return &(itr->second);
218 QueryResult result =
WorldDatabase.Query(
"SELECT dungeonId, position_x, position_y, position_z, orientation, requiredItemLevel FROM lfg_dungeon_template");
221 TC_LOG_INFO(
"server.loading",
">> Loaded 0 lfg dungeon templates. DB table `lfg_dungeon_template` is empty!");
229 Field* fields = result->Fetch();
231 LFGDungeonContainer::iterator dungeonItr =
LfgDungeonStore.find(dungeonId);
234 TC_LOG_ERROR(
"sql.sql",
"table `lfg_dungeon_template` contains coordinates for wrong dungeon {}", dungeonId);
247 while (result->NextRow());
264 TC_LOG_ERROR(
"sql.sql",
"Failed to load dungeon {} (Id: {}), cant find areatrigger for map {}", dungeon.
name, dungeon.
id, dungeon.
map);
297 LfgRoleCheckContainer::iterator itRoleCheck = it++;
303 for (LfgRolesMap::const_iterator itRoles = roleCheck.
roles.begin(); itRoles != roleCheck.
roles.end(); ++itRoles)
308 if (guid == roleCheck.
leader)
312 RestoreState(itRoleCheck->first,
"Remove Obsolete RoleCheck");
319 LfgProposalContainer::iterator itRemove = it++;
320 if (itRemove->second.cancelTime < currTime)
327 LfgPlayerBootContainer::iterator itBoot = it++;
332 for (LfgAnswerContainer::const_iterator itVotes = boot.
votes.begin(); itVotes != boot.
votes.end(); ++itVotes)
346 if (
uint8 newProposals = it->second.FindGroups())
347 TC_LOG_DEBUG(
"lfg.update",
"Found {} new groups in queue {}", newProposals, it->first);
354 uint32 proposalId = itProposal->first;
358 for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.
players.begin(); itPlayers != proposal.
players.end(); ++itPlayers)
360 guid = itPlayers->first;
383 it->second.UpdateQueueTimers(it->first, currTime);
400 if (!player || !player->
GetSession() || dungeons.empty())
443 else if (dungeons.empty())
445 else if (player->
HasAura(9454))
453 uint8 memberCount = 0;
456 Player* plrg = itr.GetSource();
471 players.insert(plrg->
GetGUID());
482 players.insert(player->
GetGUID());
488 bool isDungeon =
false;
489 for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end() && joinData.
result ==
LFG_JOIN_OK; ++it)
495 if (dungeons.size() > 1)
498 rDungeonId = (*dungeons.begin());
526 if (dungeons.empty())
534 TC_LOG_DEBUG(
"lfg.join",
"{} joining with {} members. Result: {}, Dungeons: {}",
537 if (!dungeons.empty())
554 std::string debugNames =
"";
568 dungeons.insert(rDungeonId);
576 Player* plrg = itr.GetSource();
583 roleCheck.
roles[pguid] = 0;
584 if (!debugNames.empty())
585 debugNames.append(
", ");
586 debugNames.append(plrg->
GetName());
594 rolesMap[guid] = roles;
603 dungeons.insert(rDungeonId);
614 debugNames.append(player->
GetName());
652 for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
677 LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid);
678 if (itPlayer != it->second.players.end())
697 if (guid != gguid && !disconnected)
707 return &itr->second.GetTicket();
725 LfgRoleCheckContainer::iterator itRoleCheck =
RoleChecksStore.find(gguid);
749 roleCheck.
roles[guid] = roles;
752 LfgRolesMap::const_iterator itRoles = roleCheck.
roles.begin();
756 if (itRoles == roleCheck.
roles.end())
759 check_roles = roleCheck.
roles;
771 for (LfgRolesMap::const_iterator it = roleCheck.
roles.begin(); it != roleCheck.
roles.end(); ++it)
779 switch (roleCheck.
state)
789 if (roleCheck.
leader == pguid)
822 std::map<uint32, uint32> lockedDungeons;
823 std::unordered_set<uint32> dungeonsToRemove;
825 for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons->empty(); ++it)
830 for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons->empty(); ++it2)
832 uint32 dungeonId = (it2->first & 0x00FFFFFF);
833 LfgDungeonSet::iterator itDungeon = dungeons->find(dungeonId);
834 if (itDungeon != dungeons->end())
836 bool eraseDungeon =
true;
847 uint32 dungeonInstanceId = playerBind->GetInstanceId();
848 auto itLockedDungeon = lockedDungeons.find(dungeonId);
849 if (itLockedDungeon == lockedDungeons.end() || itLockedDungeon->second == dungeonInstanceId)
850 eraseDungeon =
false;
852 lockedDungeons[dungeonId] = dungeonInstanceId;
857 dungeonsToRemove.insert(dungeonId);
859 (*lockMap)[guid][dungeonId] = it2->second;
860 playersMissingRequirement->push_back(player->
GetName());
865 for (
uint32 dungeonIdToRemove : dungeonsToRemove)
866 dungeons->erase(dungeonIdToRemove);
868 if (!dungeons->empty())
887 for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
889 uint8 role = it->second & ~PLAYER_ROLE_LEADER;
938 return (tank + healer + damage) ==
uint8(groles.size());
947 GuidList players, tankPlayers, healPlayers, dpsPlayers;
950 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
953 if (guid == proposal.
leader)
954 players.push_back(guid);
959 tankPlayers.push_back(guid);
962 healPlayers.push_back(guid);
965 dpsPlayers.push_back(guid);
968 ABORT_MSG(
"Invalid LFG role %u", it->second.role);
973 playersToTeleport.push_back(guid);
976 players.splice(players.end(), tankPlayers);
977 players.splice(players.end(), healPlayers);
978 players.splice(players.end(), dpsPlayers);
985 for (GuidList::const_iterator it = players.begin(); it != players.end(); ++it)
993 if (group && group != grp)
1005 else if (group != grp)
1012 if (!dungeons.empty())
1014 uint32 rDungeonId = (*dungeons.begin());
1030 for (GuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
1055 LfgProposalContainer::iterator itProposal =
ProposalsStore.find(proposalId);
1062 LfgProposalPlayerContainer::iterator itProposalPlayer = proposal.
players.find(guid);
1063 if (itProposalPlayer == proposal.
players.end())
1069 TC_LOG_DEBUG(
"lfg.proposal.update",
"{}, Proposal {}, Selection: {}", guid.
ToString(), proposalId, accept);
1077 bool allAnswered =
true;
1078 for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.
players.begin(); itPlayers != proposal.
players.end(); ++itPlayers)
1080 allAnswered =
false;
1084 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1096 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1101 int32 waitTime = -1;
1121 role &= ~PLAYER_ROLE_LEADER;
1140 if (
Group* group = player->GetGroup())
1141 PlayersStore[pguid].SetNumberOfPartyMembersAtJoin(group->GetMembersCount());
1147 for (GuidList::const_iterator it = proposal.
queues.begin(); it != proposal.
queues.end(); ++it)
1165 TC_LOG_DEBUG(
"lfg.proposal.remove",
"Proposal {}, state FAILED, UpdateType {}", itProposal->first, type);
1168 for (LfgProposalPlayerContainer::iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1174 for (LfgProposalPlayerContainer::iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1184 toRemove.insert(guid);
1189 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1196 if (toRemove.find(gguid) != toRemove.end())
1202 TC_LOG_DEBUG(
"lfg.proposal.remove",
"{} didn't accept. Removing from queue and compatible cache", guid.
ToString());
1207 TC_LOG_DEBUG(
"lfg.proposal.remove",
"{} in same group that someone that didn't accept. Removing from queue and compatible cache", guid.
ToString());
1210 RestoreState(guid,
"Proposal Fail (didn't accepted or in group with someone that didn't accept");
1213 RestoreState(it->second.group,
"Proposal Fail (someone in group didn't accepted)");
1235 for (GuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
1239 proposal.
queues.remove(guid);
1243 for (GuidList::const_iterator it = proposal.
queues.begin(); it != proposal.
queues.end(); ++it)
1273 for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
1283 for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
1299 LfgPlayerBootContainer::iterator itBoot =
BootsStore.find(gguid);
1312 for (LfgAnswerContainer::const_iterator itVotes = boot.
votes.begin(); itVotes != boot.
votes.end(); ++itVotes)
1314 switch (itVotes->second)
1333 for (LfgAnswerContainer::const_iterator itVotes = boot.
votes.begin(); itVotes != boot.
votes.end(); ++itVotes)
1336 if (pguid != boot.
victim)
1367 TC_LOG_DEBUG(
"lfg.teleport",
"Player {} not in group/lfggroup or dungeon not found!",
1375 TC_LOG_DEBUG(
"lfg.teleport",
"Player {} is being teleported out. Current Map {} - Expected Map {}",
1395 else if (player->
HasAura(9454))
1400 float x = dungeon->
x;
1401 float y = dungeon->
y;
1402 float z = dungeon->
z;
1403 float orientation = dungeon->
o;
1410 Player* plrg = itr.GetSource();
1428 if (!player->
TeleportTo({ .Location = WorldLocation(mapid, x, y, z, orientation), .LfgDungeonsId = dungeon->id }))
1437 TC_LOG_DEBUG(
"lfg.teleport",
"Player {} is being teleported in to map {} "
1438 "(x: {}, y: {}, z: {}) Result: {}", player->
GetName(), dungeon->
map,
1439 dungeon->
x, dungeon->
y, dungeon->
z, error);
1475 if (gDungeonId != dungeonId)
1477 TC_LOG_DEBUG(
"lfg.dungeon.finish",
"Group {} finished dungeon {} but queued for {}", gguid.
ToString(), dungeonId, gDungeonId);
1490 for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
1501 if (!dungeons.empty())
1502 rDungeonId = (*dungeons.begin());
1511 TC_LOG_DEBUG(
"lfg.dungeon.finish",
"Group: {}, Player: {} dungeon {} is not random or seasonal", gguid.
ToString(), guid.
ToString(), rDungeonId);
1522 if (player->
FindMap() != currMap)
1544 uint8 lfdRandomPlayers = 0;
1546 lfdRandomPlayers = 5 - numParty;
1548 lfdRandomPlayers = 4;
1609 for (LfgRewardContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
1613 if (itr->second->maxLevel >= level)
1658 TC_LOG_TRACE(
"lfg.data.group.oldstate.get",
"Group: {}, Old state: {}", guid.
ToString(), state);
1663 TC_LOG_TRACE(
"lfg.data.player.oldstate.get",
"Player: {}, Old state: {}", guid.
ToString(), state);
1673 bool active =
GroupsStore[gguid].IsVoteKickActive();
1674 TC_LOG_TRACE(
"lfg.data.group.votekick.get",
"Group: {}, Active: {}", gguid.
ToString(), active);
1682 TC_LOG_TRACE(
"lfg.data.group.dungeon.get",
"Group: {}, asId: {}, Dungeon: {}", guid.
ToString(), asId, dungeon);
1692 mapId = dungeon->map;
1694 TC_LOG_TRACE(
"lfg.data.group.dungeon.map",
"Group: {}, MapId: {} (DungeonId: {})", guid.
ToString(), mapId, dungeonId);
1717 if (!dungeons.empty())
1721 return *dungeons.begin();
1730 TC_LOG_TRACE(
"lfg.data.player.dungeons.locked.get",
"Player: {}, LockedDungeons.", guid.
ToString());
1735 TC_LOG_WARN(
"lfg.data.player.dungeons.locked.get",
"Player: {} not ingame while retrieving his LockedDungeons.", guid.
ToString());
1744 for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it)
1760 if (
sInstanceLockMgr.FindActiveInstanceLock(guid, { dungeon->map, Difficulty(dungeon->difficulty) }))
1764 if (levels->MinLevel > level)
1766 if (levels->MaxLevel < level)
1775 if (ar->achievement && !player->
HasAchieved(ar->achievement))
1787 else if (ar->item2 && !player->
HasItemCount(ar->item2))
1809 TC_LOG_TRACE(
"lfg.data.group.kickleft.get",
"Group: {}, Kicks left: {}", guid.
ToString(), kicks);
1818 TC_LOG_TRACE(
"lfg.data.group.state.restore",
"Group: {} ({}), State: {}, Old state: {}",
1827 TC_LOG_TRACE(
"lfg.data.player.state.restore",
"Player: {} ({}), State: {}, Old state: {}",
1840 TC_LOG_TRACE(
"lfg.data.group.state.set",
"Group: {}, New state: {}, Previous: {}, Old state: {}",
1849 TC_LOG_TRACE(
"lfg.data.player.state.set",
"Player: {}, New state: {}, Previous: {}, OldState: {}",
1862 TC_LOG_TRACE(
"lfg.data.group.votekick.set",
"Group: {}, New state: {}, Previous: {}",
1870 TC_LOG_TRACE(
"lfg.data.group.dungeon.set",
"Group: {}, Dungeon: {}", guid.
ToString(), dungeon);
1900 LfgPlayerDataContainer::iterator it =
PlayersStore.find(guid);
1908 LfgGroupDataContainer::iterator it =
GroupsStore.find(guid);
1914 GuidSet const& players = it->second.GetPlayers();
1939 allowedRoles |= 1 << (specialization->Role + 1);
1941 return roles & allowedRoles;
2010 player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
2016 player->GetSession()->SendLfgUpdateStatus(data, party);
2022 player->GetSession()->SendLfgJoinResult(data);
2028 player->GetSession()->SendLfgBootProposalUpdate(boot);
2034 player->GetSession()->SendLfgUpdateProposal(proposal);
2040 player->GetSession()->SendLfgQueueStatus(data);
2072 for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it)
2078 TC_LOG_DEBUG(
"lfg.allqueued",
"Unexpected state found while trying to form new group. Guid: {}, State: {}", (*it).ToString(),
GetStateString(state));
2089 LfgQueueContainer::const_iterator itr =
QueuesStore.find(queueId);
2091 return itr->second.GetJoinTime(guid);
2142 std::ostringstream o;
2144 o <<
"Number of Queues: " << size <<
"\n";
2147 std::string
const& queued = itr->second.DumpQueueInfo();
2148 std::string
const& compatibles = itr->second.DumpCompatibleInfo(full);
2149 o << queued << compatibles;
2170 if (!dungeons.empty())
2188 if (
uint32(dungeon->map) == map && dungeon->difficulty == difficulty)
2198 return dungeon->Entry();
2216 if (levels->MinLevel > level || level > levels->MaxLevel)
2219 randomDungeons.insert(dungeon.
Entry());
2221 return randomDungeons;
DB2Storage< LFGDungeonsEntry > sLFGDungeonsStore("LFGDungeons.db2", &LfgDungeonsLoadInfo::Instance)
DB2Storage< JournalEncounterEntry > sJournalEncounterStore("JournalEncounter.db2", &JournalEncounterLoadInfo::Instance)
@ CompletedLFGDungeonWithStrangers
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
bool IsHolidayActive(HolidayIds id)
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
#define TC_LOG_WARN(filterType__, message__,...)
#define TC_LOG_TRACE(filterType__, message__,...)
std::list< ObjectGuid > GuidList
std::set< ObjectGuid > GuidSet
std::optional< T > Optional
Optional helper class to wrap optional values within.
Role Based Access Control related classes definition.
#define MAX_SPECIALIZATIONS
@ HOLIDAY_LOVE_IS_IN_THE_AIR
@ HOLIDAY_MIDSUMMER_FIRE_FESTIVAL
@ GROUP_REMOVEMETHOD_KICK_LFG
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
ObjectGuid const & GetGUID() const
Class used to access individual fields of database query result.
float GetFloat() const noexcept
uint32 GetUInt32() const noexcept
uint16 GetUInt16() const noexcept
uint8 GetUInt8() const noexcept
bool AddMember(Player *player)
void SetDungeonDifficultyID(Difficulty difficulty)
ObjectGuid GetGUID() const
uint32 GetMembersCount() const
void SetLfgRoles(ObjectGuid guid, uint8 roles)
bool RemoveMember(ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, const char *reason=nullptr)
GroupRefManager & GetMembers()
bool Create(Player *leader)
uint32 GetDbStoreId() const
static ObjectGuid const Empty
std::string ToString() const
bool HasIgnore(ObjectGuid const &ignoreGuid, ObjectGuid const &ignoreAccountGuid)
UF::UpdateField< UF::PlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_PLAYER > m_playerData
PlayerSocial * GetSocial() const
bool GetQuestRewardStatus(uint32 quest_id) const
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
void SetBattlegroundEntryPoint()
bool InBattleground() const
bool CanRewardQuest(Quest const *quest, bool msg) const
bool HasAchieved(uint32 achievementId) const
bool InBattlegroundQueue(bool ignoreArena=false) const
WorldSession * GetSession() const
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={}, uint32 teleportSpellId=0)
bool TeleportToBGEntryPoint()
bool IsMirrorTimerActive(MirrorTimerType type) const
float GetAverageItemLevel() const
static void RemoveFromGroup(Group *group, ObjectGuid guid, RemoveMethod method=GROUP_REMOVEMETHOD_DEFAULT, ObjectGuid kicker=ObjectGuid::Empty, char const *reason=nullptr)
Group * GetGroup(Optional< uint8 > partyIndex)
void RewardQuest(Quest const *quest, LootItemType rewardType, uint32 rewardId, Object *questGiver, bool announce=true)
void setUInt32(uint8 index, uint32 value)
Vehicle * GetVehicle() const
ObjectGuid GetCharmedGUID() const
bool HasUnitState(const uint32 f) const
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
constexpr uint32 GetMapId() const
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
std::string const & GetName() const
void SendLfgJoinResult(lfg::LfgJoinResultData const &joinData)
void SendLfgTeleportError(lfg::LfgTeleportResult err)
ObjectGuid GetAccountGUID() const
void SendLfgPlayerReward(lfg::LfgPlayerRewardData const &lfgPlayerRewardData)
bool HasPermission(uint32 permissionId)
uint8 GetExpansion() const
void SendLfgRoleChosen(ObjectGuid guid, uint8 roles)
void SendLfgUpdateStatus(lfg::LfgUpdateData const &updateData, bool party)
uint8 GetKicksLeft(ObjectGuid gguid)
Get kicks left in current group.
uint32 GetSelectedRandomDungeon(ObjectGuid guid)
Get selected random dungeon.
void _LoadFromDB(Field *fields, ObjectGuid guid)
Load Lfg group info from DB.
void InitBoot(ObjectGuid gguid, ObjectGuid kguid, ObjectGuid vguid, std::string const &reason)
Inits new proposal to boot a player.
uint32 GetLFGDungeonEntry(uint32 id)
Return Lfg dungeon entry for given dungeon id.
void OnDungeonEncounterDone(ObjectGuid gguid, std::span< uint32 const > dungeonEncounters, Map const *currMap)
Check dungeon completion on encounter completion.
time_t GetQueueJoinTime(ObjectGuid guid)
Gets queue join time.
LfgProposalContainer ProposalsStore
Current Role checks.
uint8 GetPlayerCount(ObjectGuid guid)
Gets the player count of given group.
void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const &dungeons)
ObjectGuid GetLeader(ObjectGuid guid)
Get leader of the group (using internal data)
void FinishDungeon(ObjectGuid gguid, uint32 dungeonId, Map const *currMap)
Finish the dungeon for the given group. All check are performed using internal lfg data.
void TeleportPlayer(Player *player, bool out, bool fromOpcode=false)
Teleport a player to/from selected dungeon.
void SendLfgUpdateStatus(ObjectGuid guid, LfgUpdateData const &data, bool party)
LfgState GetOldState(ObjectGuid guid)
Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid)
Adds player to group.
void SetGroup(ObjectGuid guid, ObjectGuid group)
Sets player group.
LFGDungeonContainer LfgDungeonStore
Stores rewards for random dungeons.
void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const &boot)
void SetDungeon(ObjectGuid guid, uint32 dungeon)
LfgPlayerBootContainer BootsStore
Current Proposals.
uint8 GetTeam(ObjectGuid guid)
void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid)
Initializes player data after loading group data from DB.
static LFGMgr * instance()
void SetTicket(ObjectGuid guid, WorldPackets::LFG::RideTicket const &ticket)
void RestoreState(ObjectGuid guid, char const *debugMsg)
std::string DumpQueueInfo(bool full=false)
Dumps the state of the queue - Only for internal testing.
void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const &roleCheck)
GuidSet const & GetPlayers(ObjectGuid guid)
uint32 GetOptions()
Gets current lfg options.
LfgDungeonSet const & GetDungeonsByRandom(uint32 randomdungeon)
void LeaveLfg(ObjectGuid guid, bool disconnected=false)
Leaves lfg.
void UpdateBoot(ObjectGuid guid, bool accept)
Updates player boot proposal with new player answer.
void LoadRewards()
Loads rewards for random dungeons.
WorldPackets::LFG::RideTicket const * GetTicket(ObjectGuid guid) const
Gets unique join queue data.
LfgLockMap GetLockedDungeons(ObjectGuid guid)
Get locked dungeons.
void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const &data)
LfgCachedDungeonContainer CachedDungeonMapStore
Queues.
bool isOptionEnabled(uint32 option)
Checks if given lfg option is enabled.
void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid=ObjectGuid::Empty, uint8 roles=PLAYER_ROLE_NONE)
Updates the role check with player answer.
void Clean()
Clears queue - Only for internal testing.
bool IsVoteKickActive(ObjectGuid gguid)
Get current vote kick state.
LfgRoleCheckContainer RoleChecksStore
LfgDungeonSet GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion, std::span< uint32 const > contentTuningReplacementConditionMask)
Returns all random and seasonal dungeons for given level and expansion.
void SetOptions(uint32 options)
Sets new lfg options.
uint32 m_lfgProposalId
used to check interval of update
uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid)
Removes a player from a group.
LFGDungeonData const * GetLFGDungeon(uint32 id)
uint32 GetDungeonMapId(ObjectGuid guid)
Get the map id of the current dungeon.
void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type)
void RemovePlayerData(ObjectGuid guid)
LfgRewardContainer RewardMapStore
Stores all dungeons by groupType.
void SetState(ObjectGuid guid, LfgState state)
void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles)
bool selectedRandomLfgDungeon(ObjectGuid guid)
Check if given guid applied for random dungeon.
bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty)
Check if given guid applied for given map and difficulty. Used to know.
void SetLeader(ObjectGuid gguid, ObjectGuid leader)
Sets the leader of the group.
LfgGroupDataContainer GroupsStore
Player data.
void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept)
Updates proposal to join dungeon with player answer.
LfgState GetState(ObjectGuid guid)
Get current lfg state.
LFGQueue & GetQueue(ObjectGuid guid)
bool IsLfgGroup(ObjectGuid guid)
Check if given group guid is lfg.
void SetRoles(ObjectGuid guid, uint8 roles)
Sets player lfg roles.
uint8 GetQueueId(ObjectGuid guid)
Returns queue id.
uint32 m_options
used as internal counter for proposals
void RemoveGroupData(ObjectGuid guid)
Removes saved group data.
void _SaveToDB(ObjectGuid guid, uint32 db_guid)
static bool CheckGroupRoles(LfgRolesMap &groles)
Checks if given roles match, modifies given roles map with new roles.
uint32 GetDungeon(ObjectGuid guid, bool asId=true)
Get current dungeon.
uint8 FilterClassRoles(Player *player, uint8 roles)
LfgPlayerDataContainer PlayersStore
Current player kicks.
LfgQueueContainer QueuesStore
Stores config options.
uint32 AddProposal(LfgProposal &proposal)
Add a new Proposal.
uint8 GetRoles(ObjectGuid guid)
Get current player roles.
void SetVoteKick(ObjectGuid gguid, bool active)
bool IsSeasonActive(uint32 dungeonId)
Checks if Seasonal dungeon is active.
bool AllQueued(GuidList const &check)
Checks if all players are queued.
LfgType GetDungeonType(uint32 dungeon)
void GetCompatibleDungeons(LfgDungeonSet *dungeons, GuidSet const &players, LfgLockPartyMap *lockMap, std::vector< std::string_view > *playersMissingRequirement, bool isContinue)
void DecreaseKicksLeft(ObjectGuid guid)
void LoadLFGDungeons()
Loads dungeons from dbc and adds teleport coords.
LfgDungeonSet const & GetSelectedDungeons(ObjectGuid guid)
Get selected dungeons.
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2)
Checks if given players are ignoring each other.
static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const &data)
Sends queue status to player.
ObjectGuid GetGroup(ObjectGuid guid)
Gets player group.
void SetTeam(ObjectGuid guid, uint8 team)
Sets player team.
LfgReward const * GetRandomDungeonReward(uint32 dungeon, uint8 level)
Gets the random dungeon reward corresponding to given dungeon and player level.
void MakeNewGroup(LfgProposal const &proposal)
void JoinLfg(Player *player, uint8 roles, LfgDungeonSet &dungeons)
Join Lfg with selected roles, dungeons and comment.
void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const &proposal)
LfgUpdateData GetLfgStatus(ObjectGuid guid)
Returns current lfg status.
void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const &dungeons, LfgRolesMap const &rolesMap)
time_t GetJoinTime(ObjectGuid guid) const
void AddToQueue(ObjectGuid guid, bool reAdd=false)
void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId)
void RemoveFromQueue(ObjectGuid guid)
void UpdateWaitTimeHealer(int32 waitTime, uint32 dungeonId)
void UpdateWaitTimeTank(int32 waitTime, uint32 dungeonId)
void UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId)
bool IsVoteKickActive() const
void SetVoteKick(bool active)
LfgState GetState() const
void SetState(LfgState state)
LfgState GetOldState() const
LfgState GetOldState() const
void SetState(LfgState state)
LfgState GetState() const
LfgDungeonSet const & GetSelectedDungeons() const
@ CONFIG_MAX_PLAYER_LEVEL
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const *ref, uint8 flags)
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
struct advstd::ranges::Contains contains
@ LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION
@ LFG_LOCKSTATUS_TOO_LOW_LEVEL
@ LFG_LOCKSTATUS_RAID_LOCKED
@ LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE
@ LFG_LOCKSTATUS_MISSING_ITEM
@ LFG_LOCKSTATUS_TOO_HIGH_LEVEL
@ LFG_LOCKSTATUS_MISSING_ACHIEVEMENT
@ LFG_LOCKSTATUS_NOT_IN_SEASON
@ LFG_LOCKSTATUS_QUEST_NOT_COMPLETED
@ LFG_OPTION_ENABLE_DUNGEON_FINDER
@ LFG_OPTION_ENABLE_RAID_BROWSER
std::map< ObjectGuid, uint8 > LfgRolesMap
@ LFG_UPDATETYPE_ROLECHECK_FAILED
@ LFG_UPDATETYPE_GROUP_FOUND
@ LFG_UPDATETYPE_ADDED_TO_QUEUE
@ LFG_UPDATETYPE_UPDATE_STATUS
@ LFG_UPDATETYPE_PROPOSAL_FAILED
@ LFG_UPDATETYPE_PROPOSAL_DECLINED
@ LFG_UPDATETYPE_REMOVED_FROM_QUEUE
@ LFG_UPDATETYPE_PROPOSAL_BEGIN
@ LFG_UPDATETYPE_JOIN_QUEUE
@ LFG_UPDATETYPE_JOIN_QUEUE_INITIAL
@ LFG_SPELL_DUNGEON_COOLDOWN
@ LFG_GROUP_KICK_VOTES_NEEDED
@ LFG_QUEUEUPDATE_INTERVAL
@ LFG_SPELL_DUNGEON_DESERTER
LfgType
Determines the type of instance.
LfgAnswer
Answer state (Also used to check compatibilites)
std::string GetStateString(LfgState state)
LfgTeleportResult
Teleport errors.
@ LFG_TELEPORT_RESULT_EXHAUSTION
@ LFG_TELEPORT_RESULT_FALLING
@ LFG_TELEPORT_RESULT_NO_RETURN_LOCATION
@ LFG_TELEPORT_RESULT_ON_TRANSPORT
@ LFG_TELEPORT_RESULT_IMMUNE_TO_SUMMONS
@ LFG_TELEPORT_RESULT_NONE
@ LFG_TELEPORT_RESULT_DEAD
std::set< uint32 > LfgDungeonSet
@ LFG_ROLECHECK_WRONG_ROLES
@ LFG_ROLECHECK_MISSING_ROLE
@ LFG_ROLECHECK_INITIALITING
std::string ConcatenateDungeons(LfgDungeonSet const &dungeons)
std::pair< LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator > LfgRewardContainerBounds
std::map< ObjectGuid, LfgLockMap > LfgLockPartyMap
@ LFG_STATE_FINISHED_DUNGEON
std::map< uint32, LfgLockInfoData > LfgLockMap
@ LFG_JOIN_RANDOM_COOLDOWN_PLAYER
@ LFG_JOIN_MEMBERS_NOT_PRESENT
@ LFG_JOIN_ROLE_CHECK_FAILED
@ LFG_JOIN_RANDOM_COOLDOWN_PARTY
@ LFG_JOIN_TOO_MANY_MEMBERS
@ LFG_JOIN_CANT_USE_DUNGEONS
@ LFG_JOIN_MISMATCHED_SLOTS
@ LFG_JOIN_DESERTER_PLAYER
@ LFG_JOIN_DESERTER_PARTY
@ RBAC_PERM_JOIN_DUNGEON_FINDER
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr float GetOrientation() const
constexpr float GetPositionZ() const
uint32 finalDungeonEncounterId
std::vector< std::string_view > playersMissingRequirement
Stores information of a current vote to kick someone from a group.
std::string reason
Player guid to be kicked (can't vote)
LfgAnswerContainer votes
Vote in progress.
bool inProgress
Time left to vote.
ObjectGuid victim
Player votes (-1 not answer | 0 Not agree | 1 agree)
Stores player data related to proposal to join.
LfgAnswer accept
Proposed role.
Stores group data related to proposal to join.
ObjectGuid leader
Proposal group (0 if new)
uint32 dungeonId
Proposal Id.
GuidList queues
Determines if it's new group or not.
LfgProposalPlayerContainer players
Show order in update window.
bool isNew
Dungeon Encounters.
LfgProposalState state
Dungeon to join.
ObjectGuid group
State of the proposal.
Stores all rolecheck info of a group that wants to join.
LfgDungeonSet dungeons
State of the rolecheck.
LfgRolesMap roles
Time when the rolecheck will fail.
LfgRoleCheckState state
Player selected roles.
ObjectGuid leader
Random Dungeon Id.
uint32 rDungeonId
Dungeons group is applying for (expanded random dungeons)