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_entrances` contains coordinates for wrong dungeon {}", dungeonId);
247 while (result->NextRow());
262 TC_LOG_ERROR(
"sql.sql",
"Failed to load dungeon {} (Id: {}), cant find areatrigger for map {}", dungeon.
name, dungeon.
id, dungeon.
map);
298 LfgRoleCheckContainer::iterator itRoleCheck = it++;
304 for (LfgRolesMap::const_iterator itRoles = roleCheck.
roles.begin(); itRoles != roleCheck.
roles.end(); ++itRoles)
309 if (guid == roleCheck.
leader)
313 RestoreState(itRoleCheck->first,
"Remove Obsolete RoleCheck");
320 LfgProposalContainer::iterator itRemove = it++;
321 if (itRemove->second.cancelTime < currTime)
328 LfgPlayerBootContainer::iterator itBoot = it++;
333 for (LfgAnswerContainer::const_iterator itVotes = boot.
votes.begin(); itVotes != boot.
votes.end(); ++itVotes)
347 if (
uint8 newProposals = it->second.FindGroups())
348 TC_LOG_DEBUG(
"lfg.update",
"Found {} new groups in queue {}", newProposals, it->first);
355 uint32 proposalId = itProposal->first;
359 for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.
players.begin(); itPlayers != proposal.
players.end(); ++itPlayers)
361 guid = itPlayers->first;
384 it->second.UpdateQueueTimers(it->first, currTime);
401 if (!player || !player->
GetSession() || dungeons.empty())
444 else if (dungeons.empty())
446 else if (player->
HasAura(9454))
454 uint8 memberCount = 0;
457 if (
Player* plrg = itr->GetSource())
465 else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue())
467 else if (plrg->HasAura(9454))
473 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 if (
Player* plrg = itr->GetSource())
579 plrg->GetSession()->SendLfgUpdateStatus(updateData,
true);
584 roleCheck.
roles[pguid] = 0;
585 if (!debugNames.empty())
586 debugNames.append(
", ");
587 debugNames.append(plrg->GetName());
596 rolesMap[guid] = roles;
605 dungeons.insert(rDungeonId);
616 debugNames.append(player->
GetName());
654 for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
679 LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid);
680 if (itPlayer != it->second.players.end())
699 if (guid != gguid && !disconnected)
709 return &itr->second.GetTicket();
727 LfgRoleCheckContainer::iterator itRoleCheck =
RoleChecksStore.find(gguid);
751 roleCheck.
roles[guid] = roles;
754 LfgRolesMap::const_iterator itRoles = roleCheck.
roles.begin();
758 if (itRoles == roleCheck.
roles.end())
761 check_roles = roleCheck.
roles;
773 for (LfgRolesMap::const_iterator it = roleCheck.
roles.begin(); it != roleCheck.
roles.end(); ++it)
781 switch (roleCheck.
state)
791 if (roleCheck.
leader == pguid)
824 std::map<uint32, uint32> lockedDungeons;
825 std::unordered_set<uint32> dungeonsToRemove;
827 for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons->empty(); ++it)
832 for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons->empty(); ++it2)
834 uint32 dungeonId = (it2->first & 0x00FFFFFF);
835 LfgDungeonSet::iterator itDungeon = dungeons->find(dungeonId);
836 if (itDungeon != dungeons->end())
838 bool eraseDungeon =
true;
849 uint32 dungeonInstanceId = playerBind->GetInstanceId();
850 auto itLockedDungeon = lockedDungeons.find(dungeonId);
851 if (itLockedDungeon == lockedDungeons.end() || itLockedDungeon->second == dungeonInstanceId)
852 eraseDungeon =
false;
854 lockedDungeons[dungeonId] = dungeonInstanceId;
859 dungeonsToRemove.insert(dungeonId);
861 (*lockMap)[guid][dungeonId] = it2->second;
862 playersMissingRequirement->push_back(&player->
GetName());
867 for (
uint32 dungeonIdToRemove : dungeonsToRemove)
868 dungeons->erase(dungeonIdToRemove);
870 if (!dungeons->empty())
889 for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
891 uint8 role = it->second & ~PLAYER_ROLE_LEADER;
940 return (tank + healer + damage) ==
uint8(groles.size());
949 GuidList players, tankPlayers, healPlayers, dpsPlayers;
952 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
955 if (guid == proposal.
leader)
956 players.push_back(guid);
961 tankPlayers.push_back(guid);
964 healPlayers.push_back(guid);
967 dpsPlayers.push_back(guid);
970 ABORT_MSG(
"Invalid LFG role %u", it->second.role);
975 playersToTeleport.push_back(guid);
978 players.splice(players.end(), tankPlayers);
979 players.splice(players.end(), healPlayers);
980 players.splice(players.end(), dpsPlayers);
987 for (GuidList::const_iterator it = players.begin(); it != players.end(); ++it)
995 if (group && group != grp)
1007 else if (group != grp)
1014 if (!dungeons.empty())
1016 uint32 rDungeonId = (*dungeons.begin());
1032 for (GuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
1057 LfgProposalContainer::iterator itProposal =
ProposalsStore.find(proposalId);
1064 LfgProposalPlayerContainer::iterator itProposalPlayer = proposal.
players.find(guid);
1065 if (itProposalPlayer == proposal.
players.end())
1071 TC_LOG_DEBUG(
"lfg.proposal.update",
"{}, Proposal {}, Selection: {}", guid.
ToString(), proposalId, accept);
1079 bool allAnswered =
true;
1080 for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.
players.begin(); itPlayers != proposal.
players.end(); ++itPlayers)
1082 allAnswered =
false;
1086 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1098 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1103 int32 waitTime = -1;
1123 role &= ~PLAYER_ROLE_LEADER;
1142 if (
Group* group = player->GetGroup())
1143 PlayersStore[pguid].SetNumberOfPartyMembersAtJoin(group->GetMembersCount());
1149 for (GuidList::const_iterator it = proposal.
queues.begin(); it != proposal.
queues.end(); ++it)
1167 TC_LOG_DEBUG(
"lfg.proposal.remove",
"Proposal {}, state FAILED, UpdateType {}", itProposal->first, type);
1170 for (LfgProposalPlayerContainer::iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1176 for (LfgProposalPlayerContainer::iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1186 toRemove.insert(guid);
1191 for (LfgProposalPlayerContainer::const_iterator it = proposal.
players.begin(); it != proposal.
players.end(); ++it)
1198 if (toRemove.find(gguid) != toRemove.end())
1204 TC_LOG_DEBUG(
"lfg.proposal.remove",
"{} didn't accept. Removing from queue and compatible cache", guid.
ToString());
1209 TC_LOG_DEBUG(
"lfg.proposal.remove",
"{} in same group that someone that didn't accept. Removing from queue and compatible cache", guid.
ToString());
1212 RestoreState(guid,
"Proposal Fail (didn't accepted or in group with someone that didn't accept");
1215 RestoreState(it->second.group,
"Proposal Fail (someone in group didn't accepted)");
1237 for (GuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
1241 proposal.
queues.remove(guid);
1245 for (GuidList::const_iterator it = proposal.
queues.begin(); it != proposal.
queues.end(); ++it)
1275 for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
1285 for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
1301 LfgPlayerBootContainer::iterator itBoot =
BootsStore.find(gguid);
1314 for (LfgAnswerContainer::const_iterator itVotes = boot.
votes.begin(); itVotes != boot.
votes.end(); ++itVotes)
1316 switch (itVotes->second)
1335 for (LfgAnswerContainer::const_iterator itVotes = boot.
votes.begin(); itVotes != boot.
votes.end(); ++itVotes)
1338 if (pguid != boot.
victim)
1369 TC_LOG_DEBUG(
"lfg.teleport",
"Player {} not in group/lfggroup or dungeon not found!",
1377 TC_LOG_DEBUG(
"lfg.teleport",
"Player {} is being teleported out. Current Map {} - Expected Map {}",
1397 else if (player->
HasAura(9454))
1402 float x = dungeon->
x;
1403 float y = dungeon->
y;
1404 float z = dungeon->
z;
1405 float orientation = dungeon->
o;
1412 Player* plrg = itr->GetSource();
1430 if (!player->
TeleportTo(mapid, x, y, z, orientation))
1439 TC_LOG_DEBUG(
"lfg.teleport",
"Player {} is being teleported in to map {} "
1440 "(x: {}, y: {}, z: {}) Result: {}", player->
GetName(), dungeon->
map,
1441 dungeon->
x, dungeon->
y, dungeon->
z, error);
1462 if (std::find(dungeonEncounterIds.begin(), dungeonEncounterIds.end(), dungeonDone->
finalDungeonEncounterId) == dungeonEncounterIds.end())
1477 if (gDungeonId != dungeonId)
1479 TC_LOG_DEBUG(
"lfg.dungeon.finish",
"Group {} finished dungeon {} but queued for {}", gguid.
ToString(), dungeonId, gDungeonId);
1492 for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
1503 if (!dungeons.empty())
1504 rDungeonId = (*dungeons.begin());
1513 TC_LOG_DEBUG(
"lfg.dungeon.finish",
"Group: {}, Player: {} dungeon {} is not random or seasonal", gguid.
ToString(), guid.
ToString(), rDungeonId);
1524 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;
2004 player->GetSession()->SendLfgRoleChosen(pguid, roles);
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_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_TRACE(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
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)
Class used to access individual fields of database query result.
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)
GroupReference * GetFirstMember()
bool Create(Player *leader)
uint32 GetDbStoreId() const
static ObjectGuid const Empty
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
bool HasIgnore(ObjectGuid const &ignoreGuid, ObjectGuid const &ignoreAccountGuid)
PlayerSocial * GetSocial() const
UF::UpdateField< UF::PlayerData, 0, TYPEID_PLAYER > m_playerData
bool GetQuestRewardStatus(uint32 quest_id) const
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={})
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 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(const uint8 index, const 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 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.
time_t GetQueueJoinTime(ObjectGuid guid)
Gets queue join time.
void LoadLFGDungeons(bool reload=false)
Loads dungeons from dbc and adds teleport coords.
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.
LfgDungeonSet GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion, uint32 contentTuningReplacementConditionMask)
Returns all random and seasonal dungeons for given level and expansion.
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
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.
void GetCompatibleDungeons(LfgDungeonSet *dungeons, GuidSet const &players, LfgLockPartyMap *lockMap, std::vector< std::string const * > *playersMissingRequirement, bool isContinue)
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)
void OnDungeonEncounterDone(ObjectGuid gguid, std::array< uint32, 4 > const &dungeonEncounterId, Map const *currMap)
Check dungeon completion on encounter completion.
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 DecreaseKicksLeft(ObjectGuid guid)
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 &)
constexpr std::size_t size()
@ 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 const * > 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)