diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-09-20 11:05:30 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-09-20 11:05:30 +0200 |
| commit | 8e288dd6731ed608d8285f9f966783ee9b46eebf (patch) | |
| tree | a0dfb3e110f4ba63214ccde1ade6d633294e4746 /src/server/game/DungeonFinding | |
| parent | 7cbaa028cd3192725ed47226c08fb3e6f82f02d3 (diff) | |
| parent | 050d56ac21fff48d260908e72e430f212e1d770d (diff) | |
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Achievements/AchievementMgr.cpp
src/server/game/Battlefield/Battlefield.h
src/server/game/Battlegrounds/ArenaScore.h
src/server/game/Battlegrounds/ArenaTeam.cpp
src/server/game/Battlegrounds/ArenaTeam.h
src/server/game/Battlegrounds/ArenaTeamMgr.cpp
src/server/game/Battlegrounds/BattlegroundMgr.cpp
src/server/game/Battlegrounds/BattlegroundMgr.h
src/server/game/Battlegrounds/BattlegroundQueue.h
src/server/game/Battlegrounds/BattlegroundScore.h
src/server/game/Battlegrounds/Zones/BattlegroundAB.h
src/server/game/Battlegrounds/Zones/BattlegroundAV.h
src/server/game/Battlegrounds/Zones/BattlegroundEY.h
src/server/game/Battlegrounds/Zones/BattlegroundIC.h
src/server/game/Battlegrounds/Zones/BattlegroundSA.h
src/server/game/Battlegrounds/Zones/BattlegroundWS.h
src/server/game/DungeonFinding/LFG.h
src/server/game/DungeonFinding/LFGMgr.cpp
src/server/game/DungeonFinding/LFGMgr.h
src/server/game/DungeonFinding/LFGQueue.cpp
src/server/game/DungeonFinding/LFGQueue.h
src/server/game/Entities/Corpse/Corpse.cpp
src/server/game/Entities/Creature/Creature.cpp
src/server/game/Entities/Creature/GossipDef.cpp
src/server/game/Entities/Creature/GossipDef.h
src/server/game/Entities/Creature/TemporarySummon.cpp
src/server/game/Entities/DynamicObject/DynamicObject.cpp
src/server/game/Entities/Object/Object.cpp
src/server/game/Entities/Object/Object.h
src/server/game/Entities/Object/ObjectDefines.h
src/server/game/Entities/Object/Updates/UpdateData.cpp
src/server/game/Entities/Player/Player.cpp
src/server/game/Entities/Player/Player.h
src/server/game/Entities/Unit/Unit.cpp
src/server/game/Entities/Unit/Unit.h
src/server/game/Globals/ObjectAccessor.cpp
src/server/game/Globals/ObjectAccessor.h
src/server/game/Globals/ObjectMgr.cpp
src/server/game/Groups/Group.cpp
src/server/game/Groups/Group.h
src/server/game/Guilds/Guild.cpp
src/server/game/Guilds/Guild.h
src/server/game/Handlers/AuctionHouseHandler.cpp
src/server/game/Handlers/BattleGroundHandler.cpp
src/server/game/Handlers/CalendarHandler.cpp
src/server/game/Handlers/CharacterHandler.cpp
src/server/game/Handlers/ChatHandler.cpp
src/server/game/Handlers/GroupHandler.cpp
src/server/game/Handlers/GuildHandler.cpp
src/server/game/Handlers/ItemHandler.cpp
src/server/game/Handlers/LFGHandler.cpp
src/server/game/Handlers/MailHandler.cpp
src/server/game/Handlers/MiscHandler.cpp
src/server/game/Handlers/MovementHandler.cpp
src/server/game/Handlers/NPCHandler.cpp
src/server/game/Handlers/PetHandler.cpp
src/server/game/Handlers/QueryHandler.cpp
src/server/game/Handlers/QuestHandler.cpp
src/server/game/Handlers/TradeHandler.cpp
src/server/game/Handlers/VehicleHandler.cpp
src/server/game/Movement/Spline/MoveSplineInit.cpp
src/server/game/Server/WorldSession.cpp
src/server/game/Server/WorldSession.h
src/server/game/Spells/Spell.cpp
src/server/scripts/Commands/cs_debug.cpp
src/server/scripts/Commands/cs_gm.cpp
src/server/scripts/Commands/cs_misc.cpp
src/server/scripts/Commands/cs_modify.cpp
src/server/scripts/Commands/cs_reset.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
src/server/scripts/Kalimdor/zone_azshara.cpp
src/server/scripts/Kalimdor/zone_durotar.cpp
src/server/scripts/Kalimdor/zone_moonglade.cpp
src/server/scripts/Kalimdor/zone_orgrimmar.cpp
src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
src/server/scripts/Spells/spell_dk.cpp
src/server/scripts/Spells/spell_generic.cpp
src/server/shared/Packets/ByteBuffer.h
Diffstat (limited to 'src/server/game/DungeonFinding')
| -rw-r--r-- | src/server/game/DungeonFinding/LFG.h | 9 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGGroupData.cpp | 14 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGGroupData.h | 14 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 312 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.h | 140 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGPlayerData.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGPlayerData.h | 6 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGQueue.cpp | 108 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGQueue.h | 31 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGScripts.cpp | 51 | ||||
| -rw-r--r-- | src/server/game/DungeonFinding/LFGScripts.h | 8 |
11 files changed, 352 insertions, 349 deletions
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index efafd5d3afd..a112eb9c98e 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -19,6 +19,7 @@ #define _LFG_H #include "Common.h" +#include "ObjectGuid.h" namespace lfg { @@ -110,11 +111,9 @@ struct LfgLockInfoData typedef std::set<uint32> LfgDungeonSet; typedef std::map<uint32, LfgLockInfoData> LfgLockMap; -typedef std::map<uint64, LfgLockMap> LfgLockPartyMap; -typedef std::set<uint64> LfgGuidSet; -typedef std::list<uint64> LfgGuidList; -typedef std::map<uint64, uint8> LfgRolesMap; -typedef std::map<uint64, uint64> LfgGroupsMap; +typedef std::map<ObjectGuid, LfgLockMap> LfgLockPartyMap; +typedef std::map<ObjectGuid, uint8> LfgRolesMap; +typedef std::map<ObjectGuid, ObjectGuid> LfgGroupsMap; std::string ConcatenateDungeons(LfgDungeonSet const& dungeons); std::string GetRolesString(uint8 roles); diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp index d7c9efeb70e..81859f4f946 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.cpp +++ b/src/server/game/DungeonFinding/LFGGroupData.cpp @@ -22,7 +22,7 @@ namespace lfg { LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), - m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS) + m_Leader(), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS) { } LfgGroupData::~LfgGroupData() @@ -54,14 +54,14 @@ void LfgGroupData::RestoreState() m_State = m_OldState; } -void LfgGroupData::AddPlayer(uint64 guid) +void LfgGroupData::AddPlayer(ObjectGuid guid) { m_Players.insert(guid); } -uint8 LfgGroupData::RemovePlayer(uint64 guid) +uint8 LfgGroupData::RemovePlayer(ObjectGuid guid) { - LfgGuidSet::iterator it = m_Players.find(guid); + GuidSet::iterator it = m_Players.find(guid); if (it != m_Players.end()) m_Players.erase(it); return uint8(m_Players.size()); @@ -72,7 +72,7 @@ void LfgGroupData::RemoveAllPlayers() m_Players.clear(); } -void LfgGroupData::SetLeader(uint64 guid) +void LfgGroupData::SetLeader(ObjectGuid guid) { m_Leader = guid; } @@ -98,7 +98,7 @@ LfgState LfgGroupData::GetOldState() const return m_OldState; } -LfgGuidSet const& LfgGroupData::GetPlayers() const +GuidSet const& LfgGroupData::GetPlayers() const { return m_Players; } @@ -108,7 +108,7 @@ uint8 LfgGroupData::GetPlayerCount() const return m_Players.size(); } -uint64 LfgGroupData::GetLeader() const +ObjectGuid LfgGroupData::GetLeader() const { return m_Leader; } diff --git a/src/server/game/DungeonFinding/LFGGroupData.h b/src/server/game/DungeonFinding/LFGGroupData.h index b2bffd5a13b..45df76aca2a 100644 --- a/src/server/game/DungeonFinding/LFGGroupData.h +++ b/src/server/game/DungeonFinding/LFGGroupData.h @@ -42,10 +42,10 @@ class LfgGroupData // General void SetState(LfgState state); void RestoreState(); - void AddPlayer(uint64 guid); - uint8 RemovePlayer(uint64 guid); + void AddPlayer(ObjectGuid guid); + uint8 RemovePlayer(ObjectGuid guid); void RemoveAllPlayers(); - void SetLeader(uint64 guid); + void SetLeader(ObjectGuid guid); // Dungeon void SetDungeon(uint32 dungeon); @@ -56,9 +56,9 @@ class LfgGroupData // General LfgState GetState() const; LfgState GetOldState() const; - LfgGuidSet const& GetPlayers() const; + GuidSet const& GetPlayers() const; uint8 GetPlayerCount() const; - uint64 GetLeader() const; + ObjectGuid GetLeader() const; // Dungeon uint32 GetDungeon(bool asId = true) const; @@ -70,8 +70,8 @@ class LfgGroupData // General LfgState m_State; ///< State if group in LFG LfgState m_OldState; ///< Old State - uint64 m_Leader; ///< Leader GUID - LfgGuidSet m_Players; ///< Players in group + ObjectGuid m_Leader; ///< Leader GUID + GuidSet m_Players; ///< Players in group // Dungeon uint32 m_Dungeon; ///< Dungeon entry // Vote Kick diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 0efc7fd6230..4bed997bced 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -50,15 +50,15 @@ LFGMgr::~LFGMgr() delete itr->second; } -void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) +void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid) { if (!fields) return; - if (!IS_GROUP_GUID(guid)) + if (!guid.IsGroup()) return; - SetLeader(guid, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER)); + SetLeader(guid, ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32())); uint32 dungeon = fields[17].GetUInt32(); uint8 state = fields[18].GetUInt8(); @@ -79,9 +79,9 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) } } -void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid) +void LFGMgr::_SaveToDB(ObjectGuid guid, uint32 db_guid) { - if (!IS_GROUP_GUID(guid)) + if (!guid.IsGroup()) return; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); @@ -276,7 +276,7 @@ void LFGMgr::Update(uint32 diff) for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles) { - uint64 guid = itRoles->first; + ObjectGuid guid = itRoles->first; RestoreState(guid, "Remove Obsolete RoleCheck"); SendLfgRoleCheckUpdate(guid, roleCheck); if (guid == roleCheck.leader) @@ -305,7 +305,7 @@ void LFGMgr::Update(uint32 diff) boot.inProgress = false; for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) { - uint64 pguid = itVotes->first; + ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) SendLfgBootProposalUpdate(pguid, boot); SetState(pguid, LFG_STATE_DUNGEON); @@ -329,12 +329,12 @@ void LFGMgr::Update(uint32 diff) uint32 proposalId = itProposal->first; LfgProposal& proposal = ProposalsStore[proposalId]; - uint64 guid = 0; + ObjectGuid guid; for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers) { guid = itPlayers->first; SetState(guid, LFG_STATE_PROPOSAL); - if (uint64 gguid = GetGroup(guid)) + if (ObjectGuid gguid = GetGroup(guid)) { SetState(gguid, LFG_STATE_PROPOSAL); SendLfgUpdateStatus(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)), true); @@ -376,10 +376,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const return; Group* grp = player->GetGroup(); - uint64 guid = player->GetGUID(); - uint64 gguid = grp ? grp->GetGUID() : guid; + ObjectGuid guid = player->GetGUID(); + ObjectGuid gguid = grp ? grp->GetGUID() : guid; LfgJoinResultData joinData; - LfgGuidSet players; + GuidSet players; uint32 rDungeonId = 0; bool isContinue = grp && grp->isLFGGroup() && GetState(gguid) != LFG_STATE_FINISHED_DUNGEON; @@ -491,7 +491,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const if (joinData.result != LFG_JOIN_OK) { TC_LOG_DEBUG("lfg.join", "%u joining with %u members. Result: %u, Dungeons: %s", - GUID_LOPART(guid), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str()); + guid.GetCounter(), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str()); if (!dungeons.empty()) // Only should show lockmap when have no dungeons available joinData.lockmap.clear(); @@ -503,7 +503,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const if (isRaid) { - TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", guid.GetCounter()); return; } @@ -531,7 +531,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const { if (Player* plrg = itr->GetSource()) { - uint64 pguid = plrg->GetGUID(); + ObjectGuid pguid = plrg->GetGUID(); plrg->GetSession()->SendLfgUpdateStatus(updateData, true); SetState(pguid, LFG_STATE_ROLECHECK); if (!isContinue) @@ -569,7 +569,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const debugNames.append(player->GetName()); } - TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", GUID_LOPART(guid), + TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", guid.GetCounter(), grp ? "group" : "player", debugNames.c_str(), uint32(dungeons.size()), ConcatenateDungeons(dungeons).c_str()); } @@ -579,11 +579,11 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const @param[in] guid Player or group guid */ -void LFGMgr::LeaveLfg(uint64 guid) +void LFGMgr::LeaveLfg(ObjectGuid guid) { - uint64 gguid = IS_GROUP_GUID(guid) ? guid : GetGroup(guid); + ObjectGuid gguid = guid.IsGroup() ? guid : GetGroup(guid); - TC_LOG_DEBUG("lfg.leave", "%u left (%s)", GUID_LOPART(guid), guid == gguid ? "group" : "player"); + TC_LOG_DEBUG("lfg.leave", "%u left (%s)", guid.GetCounter(), guid == gguid ? "group" : "player"); LfgState state = GetState(guid); switch (state) @@ -594,8 +594,8 @@ void LFGMgr::LeaveLfg(uint64 guid) LFGQueue& queue = GetQueue(gguid); queue.RemoveFromQueue(gguid); SetState(gguid, LFG_STATE_NONE); - const LfgGuidSet& players = GetPlayers(gguid); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + GuidSet const& players = GetPlayers(gguid); + for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it) { SetState(*it, LFG_STATE_NONE); SendLfgUpdateStatus(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE), true); @@ -617,7 +617,7 @@ void LFGMgr::LeaveLfg(uint64 guid) { // Remove from Proposals LfgProposalContainer::iterator it = ProposalsStore.begin(); - uint64 pguid = gguid == guid ? GetLeader(gguid) : guid; + ObjectGuid pguid = gguid == guid ? GetLeader(gguid) : guid; while (it != ProposalsStore.end()) { LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid); @@ -654,7 +654,7 @@ void LFGMgr::LeaveLfg(uint64 guid) @param[in] guid Player guid (0 = rolecheck failed) @param[in] roles Player selected roles */ -void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* = PLAYER_ROLE_NONE */) +void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::Empty */, uint8 roles /* = PLAYER_ROLE_NONE */) { if (!gguid) return; @@ -701,7 +701,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* LfgJoinResultData joinData = LfgJoinResultData(joinResult, roleCheck.state); for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) { - uint64 pguid = it->first; + ObjectGuid pguid = it->first; if (sendRoleChosen) SendLfgRoleChosen(pguid, guid, roles); @@ -746,12 +746,12 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* @param[in] players Set of players to check their dungeon restrictions @param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty) */ -void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap) +void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap) { lockMap.clear(); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) + for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) { - uint64 guid = (*it); + ObjectGuid guid = (*it); LfgLockMap const& cachedLockMap = GetLockedDungeons(guid); for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2) { @@ -847,12 +847,12 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true */ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) { - LfgGuidList players; - LfgGuidList playersToTeleport; + GuidList players; + GuidList playersToTeleport; for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { - uint64 guid = it->first; + ObjectGuid guid = it->first; if (guid == proposal.leader) players.push_front(guid); else @@ -866,10 +866,10 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId); ASSERT(dungeon); - Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL; - for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it) + Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(proposal.group.GetCounter()) : NULL; + for (GuidList::const_iterator it = players.begin(); it != players.end(); ++it) { - uint64 pguid = (*it); + ObjectGuid pguid = (*it); Player* player = ObjectAccessor::FindPlayer(pguid); if (!player) continue; @@ -883,7 +883,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) grp = new Group(); grp->ConvertToLFG(); grp->Create(player); - uint64 gguid = grp->GetGUID(); + ObjectGuid gguid = grp->GetGUID(); SetState(gguid, LFG_STATE_PROPOSAL); sGroupMgr->AddGroup(grp); } @@ -899,14 +899,14 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) ASSERT(grp); grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty)); - uint64 gguid = grp->GetGUID(); + ObjectGuid gguid = grp->GetGUID(); SetDungeon(gguid, dungeon->Entry()); SetState(gguid, LFG_STATE_DUNGEON); _SaveToDB(gguid, grp->GetDbStoreId()); // Teleport Player - for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it) + for (GuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it) if (Player* player = ObjectAccessor::FindPlayer(*it)) TeleportPlayer(player, false); @@ -928,7 +928,7 @@ uint32 LFGMgr::AddProposal(LfgProposal& proposal) @param[in] guid Player guid to update answer @param[in] accept Player answer */ -void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) +void LFGMgr::UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept) { // Check if the proposal exists LfgProposalContainer::iterator itProposal = ProposalsStore.find(proposalId); @@ -945,7 +945,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) LfgProposalPlayer& player = itProposalPlayer->second; player.accept = LfgAnswer(accept); - TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", GUID_LOPART(guid), proposalId, accept); + TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", guid.GetCounter(), proposalId, accept); if (!accept) { RemoveProposal(itProposal, LFG_UPDATETYPE_PROPOSAL_DECLINED); @@ -974,8 +974,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND); for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { - uint64 pguid = it->first; - uint64 gguid = it->second.group; + ObjectGuid pguid = it->first; + ObjectGuid gguid = it->second.group; uint32 dungeonId = (*GetSelectedDungeons(pguid).begin()); int32 waitTime = -1; if (sendUpdate) @@ -1018,7 +1018,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) } // Remove players/groups from Queue - for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) + for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) queue.RemoveFromQueue(*it); MakeNewGroup(proposal); @@ -1044,13 +1044,13 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate it->second.accept = LFG_ANSWER_DENY; // Mark players/groups to be removed - LfgGuidSet toRemove; + GuidSet toRemove; for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { if (it->second.accept == LFG_ANSWER_AGREE) continue; - uint64 guid = it->second.group ? it->second.group : it->first; + ObjectGuid guid = it->second.group ? it->second.group : it->first; // Player didn't accept or still pending when no secs left if (it->second.accept == LFG_ANSWER_DENY || type == LFG_UPDATETYPE_PROPOSAL_FAILED) { @@ -1062,8 +1062,8 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate // Notify players for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) { - uint64 guid = it->first; - uint64 gguid = it->second.group ? it->second.group : guid; + ObjectGuid guid = it->first; + ObjectGuid gguid = it->second.group ? it->second.group : guid; SendLfgUpdateProposal(guid, proposal); @@ -1073,12 +1073,12 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate if (it->second.accept == LFG_ANSWER_DENY) { updateData.updateType = type; - TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", guid.GetCounter()); } else { updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE; - TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", guid.GetCounter()); } RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept"); @@ -1092,7 +1092,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate } else { - TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", guid.GetCounter()); SetState(guid, LFG_STATE_QUEUED); if (gguid != guid) { @@ -1106,17 +1106,17 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate LFGQueue& queue = GetQueue(proposal.players.begin()->first); // Remove players/groups from queue - for (LfgGuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it) + for (GuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it) { - uint64 guid = *it; + ObjectGuid guid = *it; queue.RemoveFromQueue(guid); proposal.queues.remove(guid); } // Readd to queue - for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) + for (GuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it) { - uint64 guid = *it; + ObjectGuid guid = *it; queue.AddToQueue(guid); } @@ -1131,7 +1131,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate @param[in] victim Victim guid @param[in] reason Kick reason */ -void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason) +void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason) { SetState(gguid, LFG_STATE_BOOT); @@ -1141,12 +1141,12 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co boot.reason = reason; boot.victim = victim; - LfgGuidSet const& players = GetPlayers(gguid); + GuidSet const& players = GetPlayers(gguid); // Set votes - for (LfgGuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - uint64 guid = (*itr); + ObjectGuid guid = (*itr); SetState(guid, LFG_STATE_BOOT); boot.votes[guid] = LFG_ANSWER_PENDING; } @@ -1155,7 +1155,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co boot.votes[kicker] = LFG_ANSWER_AGREE; // Kicker auto vote YES // Notify players - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it) SendLfgBootProposalUpdate(*it, boot); } @@ -1165,9 +1165,9 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co @param[in] guid Player who has answered @param[in] player answer */ -void LFGMgr::UpdateBoot(uint64 guid, bool accept) +void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept) { - uint64 gguid = GetGroup(guid); + ObjectGuid gguid = GetGroup(guid); if (!gguid) return; @@ -1202,7 +1202,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept) boot.inProgress = false; for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) { - uint64 pguid = itVotes->first; + ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) { SetState(pguid, LFG_STATE_DUNGEON); @@ -1213,7 +1213,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept) SetState(gguid, LFG_STATE_DUNGEON); if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player { - if (Group* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(gguid))) + if (Group* group = sGroupMgr->GetGroupByGUID(gguid.GetCounter())) Player::RemoveFromGroup(group, boot.victim, GROUP_REMOVEMETHOD_KICK_LFG); DecreaseKicksLeft(gguid); } @@ -1320,30 +1320,30 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* @param[in] guid Group guid @param[in] dungeonId Dungeonid */ -void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) +void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId) { uint32 gDungeonId = GetDungeon(gguid); if (gDungeonId != dungeonId) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", GUID_LOPART(gguid), dungeonId, gDungeonId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", gguid.GetCounter(), dungeonId, gDungeonId); return; } if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", GUID_LOPART(gguid)); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", gguid.GetCounter()); return; } SetState(gguid, LFG_STATE_FINISHED_DUNGEON); - const LfgGuidSet& players = GetPlayers(gguid); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + GuidSet const& players = GetPlayers(gguid); + for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it) { - uint64 guid = (*it); + ObjectGuid guid = (*it); if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", GUID_LOPART(gguid), GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", gguid.GetCounter(), guid.GetCounter()); continue; } @@ -1359,14 +1359,14 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal)) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", GUID_LOPART(gguid), GUID_LOPART(guid), rDungeonId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", gguid.GetCounter(), guid.GetCounter(), rDungeonId); continue; } Player* player = ObjectAccessor::FindPlayer(guid); if (!player || !player->IsInWorld()) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", GUID_LOPART(gguid), GUID_LOPART(guid)); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", gguid.GetCounter(), guid.GetCounter()); continue; } @@ -1375,7 +1375,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) if (player->GetMapId() != mapId) { - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", GUID_LOPART(gguid), GUID_LOPART(guid), player->GetMapId(), mapId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", gguid.GetCounter(), guid.GetCounter(), player->GetMapId(), mapId); continue; } @@ -1406,7 +1406,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) } // Give rewards - TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", GUID_LOPART(gguid), GUID_LOPART(guid), GetDungeon(gguid), done? " " : " not"); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", gguid.GetCounter(), guid.GetCounter(), GetDungeon(gguid), done? " " : " not"); LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest); player->GetSession()->SendLfgPlayerReward(data); } @@ -1466,48 +1466,48 @@ LfgType LFGMgr::GetDungeonType(uint32 dungeonId) return LfgType(dungeon->type); } -LfgState LFGMgr::GetState(uint64 guid) +LfgState LFGMgr::GetState(ObjectGuid guid) { LfgState state; - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { state = GroupsStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", guid.GetCounter(), state); } else { state = PlayersStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", guid.GetCounter(), state); } return state; } -LfgState LFGMgr::GetOldState(uint64 guid) +LfgState LFGMgr::GetOldState(ObjectGuid guid) { LfgState state; - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { state = GroupsStore[guid].GetOldState(); - TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", guid.GetCounter(), state); } else { state = PlayersStore[guid].GetOldState(); - TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", GUID_LOPART(guid), state); + TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", guid.GetCounter(), state); } return state; } -uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */) +uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */) { uint32 dungeon = GroupsStore[guid].GetDungeon(asId); - TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", GUID_LOPART(guid), asId, dungeon); + TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", guid.GetCounter(), asId, dungeon); return dungeon; } -uint32 LFGMgr::GetDungeonMapId(uint64 guid) +uint32 LFGMgr::GetDungeonMapId(ObjectGuid guid) { uint32 dungeonId = GroupsStore[guid].GetDungeon(true); uint32 mapId = 0; @@ -1515,38 +1515,38 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid) if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId)) mapId = dungeon->map; - TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", GUID_LOPART(guid), mapId, dungeonId); + TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", guid.GetCounter(), mapId, dungeonId); return mapId; } -uint8 LFGMgr::GetRoles(uint64 guid) +uint8 LFGMgr::GetRoles(ObjectGuid guid) { uint8 roles = PlayersStore[guid].GetRoles(); - TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", GUID_LOPART(guid), roles); + TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", guid.GetCounter(), roles); return roles; } -const std::string& LFGMgr::GetComment(uint64 guid) +const std::string& LFGMgr::GetComment(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", GUID_LOPART(guid), PlayersStore[guid].GetComment().c_str()); + TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", guid.GetCounter(), PlayersStore[guid].GetComment().c_str()); return PlayersStore[guid].GetComment(); } -LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid) +LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str()); + TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str()); return PlayersStore[guid].GetSelectedDungeons(); } -LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid) +LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", GUID_LOPART(guid)); + TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", guid.GetCounter()); LfgLockMap lock; Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", GUID_LOPART(guid)); + TC_LOG_WARN("lfg.data.player.dungeons.locked.get", "Player: %u not ingame while retrieving his LockedDungeons.", guid.GetCounter()); return lock; } @@ -1609,20 +1609,20 @@ LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid) return lock; } -uint8 LFGMgr::GetKicksLeft(uint64 guid) +uint8 LFGMgr::GetKicksLeft(ObjectGuid guid) { uint8 kicks = GroupsStore[guid].GetKicksLeft(); - TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", GUID_LOPART(guid), kicks); + TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", guid.GetCounter(), kicks); return kicks; } -void LFGMgr::RestoreState(uint64 guid, char const* debugMsg) +void LFGMgr::RestoreState(ObjectGuid guid, char const* debugMsg) { - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { LfgGroupData& data = GroupsStore[guid]; TC_LOG_TRACE("lfg.data.group.state.restore", "Group: %u (%s), State: %s, Old state: %s", - GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(), + guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.RestoreState(); @@ -1631,20 +1631,20 @@ void LFGMgr::RestoreState(uint64 guid, char const* debugMsg) { LfgPlayerData& data = PlayersStore[guid]; TC_LOG_TRACE("lfg.data.player.state.restore", "Player: %u (%s), State: %s, Old state: %s", - GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(), + guid.GetCounter(), debugMsg, GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.RestoreState(); } } -void LFGMgr::SetState(uint64 guid, LfgState state) +void LFGMgr::SetState(ObjectGuid guid, LfgState state) { - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { LfgGroupData& data = GroupsStore[guid]; TC_LOG_TRACE("lfg.data.group.state.set", "Group: %u, New state: %s, Previous: %s, Old state: %s", - GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), + guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.SetState(state); @@ -1653,64 +1653,64 @@ void LFGMgr::SetState(uint64 guid, LfgState state) { LfgPlayerData& data = PlayersStore[guid]; TC_LOG_TRACE("lfg.data.player.state.set", "Player: %u, New state: %s, Previous: %s, OldState: %s", - GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), + guid.GetCounter(), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), GetStateString(data.GetOldState()).c_str()); data.SetState(state); } } -void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon) +void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon) { - TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", GUID_LOPART(guid), dungeon); + TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", guid.GetCounter(), dungeon); GroupsStore[guid].SetDungeon(dungeon); } -void LFGMgr::SetRoles(uint64 guid, uint8 roles) +void LFGMgr::SetRoles(ObjectGuid guid, uint8 roles) { - TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", GUID_LOPART(guid), roles); + TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", guid.GetCounter(), roles); PlayersStore[guid].SetRoles(roles); } -void LFGMgr::SetComment(uint64 guid, std::string const& comment) +void LFGMgr::SetComment(ObjectGuid guid, std::string const& comment) { - TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", GUID_LOPART(guid), comment.c_str()); + TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", guid.GetCounter(), comment.c_str()); PlayersStore[guid].SetComment(comment); } -void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons) +void LFGMgr::SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons) { - TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(dungeons).c_str()); + TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", guid.GetCounter(), ConcatenateDungeons(dungeons).c_str()); PlayersStore[guid].SetSelectedDungeons(dungeons); } -void LFGMgr::DecreaseKicksLeft(uint64 guid) +void LFGMgr::DecreaseKicksLeft(ObjectGuid guid) { GroupsStore[guid].DecreaseKicksLeft(); - TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", GUID_LOPART(guid), GroupsStore[guid].GetKicksLeft()); + TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", guid.GetCounter(), GroupsStore[guid].GetKicksLeft()); } -void LFGMgr::RemovePlayerData(uint64 guid) +void LFGMgr::RemovePlayerData(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", GUID_LOPART(guid)); + TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", guid.GetCounter()); LfgPlayerDataContainer::iterator it = PlayersStore.find(guid); if (it != PlayersStore.end()) PlayersStore.erase(it); } -void LFGMgr::RemoveGroupData(uint64 guid) +void LFGMgr::RemoveGroupData(ObjectGuid guid) { - TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", GUID_LOPART(guid)); + TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", guid.GetCounter()); LfgGroupDataContainer::iterator it = GroupsStore.find(guid); if (it == GroupsStore.end()) return; LfgState state = GetState(guid); // If group is being formed after proposal success do nothing more - LfgGuidSet const& players = it->second.GetPlayers(); - for (uint64 playerGUID : players) + GuidSet const& players = it->second.GetPlayers(); + for (ObjectGuid playerGUID : players) { - SetGroup(playerGUID, 0); + SetGroup(playerGUID, ObjectGuid::Empty); if (state != LFG_STATE_PROPOSAL) { SetState(playerGUID, LFG_STATE_NONE); @@ -1720,29 +1720,29 @@ void LFGMgr::RemoveGroupData(uint64 guid) GroupsStore.erase(it); } -uint8 LFGMgr::GetTeam(uint64 guid) +uint8 LFGMgr::GetTeam(ObjectGuid guid) { uint8 team = PlayersStore[guid].GetTeam(); - TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", GUID_LOPART(guid), team); + TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", guid.GetCounter(), team); return team; } -uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid) +uint8 LFGMgr::RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid) { return GroupsStore[gguid].RemovePlayer(guid); } -void LFGMgr::AddPlayerToGroup(uint64 gguid, uint64 guid) +void LFGMgr::AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid) { GroupsStore[gguid].AddPlayer(guid); } -void LFGMgr::SetLeader(uint64 gguid, uint64 leader) +void LFGMgr::SetLeader(ObjectGuid gguid, ObjectGuid leader) { GroupsStore[gguid].SetLeader(leader); } -void LFGMgr::SetTeam(uint64 guid, uint8 team) +void LFGMgr::SetTeam(ObjectGuid guid, uint8 team) { if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) team = 0; @@ -1750,93 +1750,91 @@ void LFGMgr::SetTeam(uint64 guid, uint8 team) PlayersStore[guid].SetTeam(team); } -uint64 LFGMgr::GetGroup(uint64 guid) +ObjectGuid LFGMgr::GetGroup(ObjectGuid guid) { return PlayersStore[guid].GetGroup(); } -void LFGMgr::SetGroup(uint64 guid, uint64 group) +void LFGMgr::SetGroup(ObjectGuid guid, ObjectGuid group) { PlayersStore[guid].SetGroup(group); } -LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid) +GuidSet const& LFGMgr::GetPlayers(ObjectGuid guid) { return GroupsStore[guid].GetPlayers(); } -uint8 LFGMgr::GetPlayerCount(uint64 guid) +uint8 LFGMgr::GetPlayerCount(ObjectGuid guid) { return GroupsStore[guid].GetPlayerCount(); } -uint64 LFGMgr::GetLeader(uint64 guid) +ObjectGuid LFGMgr::GetLeader(ObjectGuid guid) { return GroupsStore[guid].GetLeader(); } -bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2) +bool LFGMgr::HasIgnore(ObjectGuid guid1, ObjectGuid guid2) { Player* plr1 = ObjectAccessor::FindPlayer(guid1); Player* plr2 = ObjectAccessor::FindPlayer(guid2); - uint32 low1 = GUID_LOPART(guid1); - uint32 low2 = GUID_LOPART(guid2); - return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(low2) || plr2->GetSocial()->HasIgnore(low1)); + return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(guid2.GetCounter()) || plr2->GetSocial()->HasIgnore(guid1.GetCounter())); } -void LFGMgr::SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles) +void LFGMgr::SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgRoleChosen(pguid, roles); } -void LFGMgr::SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck) +void LFGMgr::SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgRoleCheckUpdate(roleCheck); } -void LFGMgr::SendLfgUpdateStatus(uint64 guid, LfgUpdateData const& data, bool party) +void LFGMgr::SendLfgUpdateStatus(ObjectGuid guid, LfgUpdateData const& data, bool party) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgUpdateStatus(data, party); } -void LFGMgr::SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data) +void LFGMgr::SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgJoinResult(data); } -void LFGMgr::SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot) +void LFGMgr::SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgBootProposalUpdate(boot); } -void LFGMgr::SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal) +void LFGMgr::SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgUpdateProposal(proposal); } -void LFGMgr::SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data) +void LFGMgr::SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data) { if (Player* player = ObjectAccessor::FindPlayer(guid)) player->GetSession()->SendLfgQueueStatus(data); } -bool LFGMgr::IsLfgGroup(uint64 guid) +bool LFGMgr::IsLfgGroup(ObjectGuid guid) { - return guid && IS_GROUP_GUID(guid) && GroupsStore[guid].IsLfgGroup(); + return guid && guid.IsGroup() && GroupsStore[guid].IsLfgGroup(); } -uint8 LFGMgr::GetQueueId(uint64 guid) +uint8 LFGMgr::GetQueueId(ObjectGuid guid) { - if (IS_GROUP_GUID(guid)) + if (guid.IsGroup()) { - LfgGuidSet const& players = GetPlayers(guid); - uint64 pguid = players.empty() ? 0 : (*players.begin()); + GuidSet const& players = GetPlayers(guid); + ObjectGuid pguid = players.empty() ? ObjectGuid::Empty : (*players.begin()); if (pguid) return GetTeam(pguid); } @@ -1844,24 +1842,24 @@ uint8 LFGMgr::GetQueueId(uint64 guid) return GetTeam(guid); } -LFGQueue& LFGMgr::GetQueue(uint64 guid) +LFGQueue& LFGMgr::GetQueue(ObjectGuid guid) { uint8 queueId = GetQueueId(guid); return QueuesStore[queueId]; } -bool LFGMgr::AllQueued(LfgGuidList const& check) +bool LFGMgr::AllQueued(GuidList const& check) { if (check.empty()) return false; - for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it) if (GetState(*it) != LFG_STATE_QUEUED) return false; return true; } -time_t LFGMgr::GetQueueJoinTime(uint64 guid) +time_t LFGMgr::GetQueueJoinTime(ObjectGuid guid) { uint8 queueId = GetQueueId(guid); LfgQueueContainer::const_iterator itr = QueuesStore.find(queueId); @@ -1892,7 +1890,7 @@ void LFGMgr::SetOptions(uint32 options) m_options = options; } -LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid) +LfgUpdateData LFGMgr::GetLfgStatus(ObjectGuid guid) { LfgPlayerData& playerData = PlayersStore[guid]; return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons()); @@ -1930,7 +1928,7 @@ std::string LFGMgr::DumpQueueInfo(bool full) return o.str(); } -void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid) +void LFGMgr::SetupGroupMember(ObjectGuid guid, ObjectGuid gguid) { LfgDungeonSet dungeons; dungeons.insert(GetDungeon(gguid)); @@ -1940,7 +1938,7 @@ void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid) AddPlayerToGroup(gguid, guid); } -bool LFGMgr::selectedRandomLfgDungeon(uint64 guid) +bool LFGMgr::selectedRandomLfgDungeon(ObjectGuid guid) { if (GetState(guid) != LFG_STATE_NONE) { @@ -1956,9 +1954,9 @@ bool LFGMgr::selectedRandomLfgDungeon(uint64 guid) return false; } -bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty) +bool LFGMgr::inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty) { - if (!IS_GROUP_GUID(guid)) + if (!guid.IsGroup()) guid = GetGroup(guid); if (uint32 dungeonId = GetDungeon(guid, true)) diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index b04b4f1a7ab..343705a58ab 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -138,13 +138,13 @@ typedef std::map<uint8, LFGQueue> LfgQueueContainer; typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer; typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds; typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer; -typedef std::map<uint64, LfgAnswer> LfgAnswerContainer; -typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer; +typedef std::map<ObjectGuid, LfgAnswer> LfgAnswerContainer; +typedef std::map<ObjectGuid, LfgRoleCheck> LfgRoleCheckContainer; typedef std::map<uint32, LfgProposal> LfgProposalContainer; -typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer; -typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer; -typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer; -typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer; +typedef std::map<ObjectGuid, LfgProposalPlayer> LfgProposalPlayerContainer; +typedef std::map<ObjectGuid, LfgPlayerBoot> LfgPlayerBootContainer; +typedef std::map<ObjectGuid, LfgGroupData> LfgGroupDataContainer; +typedef std::map<ObjectGuid, LfgPlayerData> LfgPlayerDataContainer; typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer; // Data needed by SMSG_LFG_JOIN_RESULT @@ -218,29 +218,29 @@ struct LfgReward /// Stores player data related to proposal to join struct LfgProposalPlayer { - LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { } + LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group() { } uint8 role; ///< Proposed role LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree) - uint64 group; ///< Original group guid. 0 if no original group + ObjectGuid group; ///< Original group guid. 0 if no original group }; /// Stores group data related to proposal to join struct LfgProposal { LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), - group(0), leader(0), cancelTime(0), encounters(0), isNew(true) + group(), leader(), cancelTime(0), encounters(0), isNew(true) { } uint32 id; ///< Proposal Id uint32 dungeonId; ///< Dungeon to join LfgProposalState state; ///< State of the proposal - uint64 group; ///< Proposal group (0 if new) - uint64 leader; ///< Leader guid. + 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 - LfgGuidList queues; ///< Queue Ids to remove/readd - LfgGuidList showorder; ///< Show order in update window + GuidList queues; ///< Queue Ids to remove/readd + GuidList showorder; ///< Show order in update window LfgProposalPlayerContainer players; ///< Players data }; @@ -252,7 +252,7 @@ struct LfgRoleCheck LfgRoleCheckState state; ///< State of the rolecheck LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons) uint32 rDungeonId; ///< Random Dungeon Id. - uint64 leader; ///< Leader of the group + ObjectGuid leader; ///< Leader of the group }; /// Stores information of a current vote to kick someone from a group @@ -261,7 +261,7 @@ 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) - uint64 victim; ///< Player guid to be kicked (can't vote) + ObjectGuid victim; ///< Player guid to be kicked (can't vote) std::string reason; ///< kick reason }; @@ -313,7 +313,7 @@ class LFGMgr // World.cpp /// Finish the dungeon for the given group. All check are performed using internal lfg data - void FinishDungeon(uint64 gguid, uint32 dungeonId); + void FinishDungeon(ObjectGuid gguid, uint32 dungeonId); /// Loads rewards for random dungeons void LoadRewards(); /// Loads dungeons from dbc and adds teleport coords @@ -321,31 +321,31 @@ class LFGMgr // Multiple files /// Check if given guid applied for random dungeon - bool selectedRandomLfgDungeon(uint64 guid); + bool selectedRandomLfgDungeon(ObjectGuid guid); /// Check if given guid applied for given map and difficulty. Used to know - bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty); + bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty); /// Get selected dungeons - LfgDungeonSet const& GetSelectedDungeons(uint64 guid); + LfgDungeonSet const& GetSelectedDungeons(ObjectGuid guid); /// Get current lfg state - LfgState GetState(uint64 guid); + LfgState GetState(ObjectGuid guid); /// Get current dungeon - uint32 GetDungeon(uint64 guid, bool asId = true); + uint32 GetDungeon(ObjectGuid guid, bool asId = true); /// Get the map id of the current dungeon - uint32 GetDungeonMapId(uint64 guid); + uint32 GetDungeonMapId(ObjectGuid guid); /// Get kicks left in current group - uint8 GetKicksLeft(uint64 gguid); + uint8 GetKicksLeft(ObjectGuid gguid); /// Load Lfg group info from DB - void _LoadFromDB(Field* fields, uint64 guid); + void _LoadFromDB(Field* fields, ObjectGuid guid); /// Initializes player data after loading group data from DB - void SetupGroupMember(uint64 guid, uint64 gguid); + void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid); /// Return Lfg dungeon entry for given dungeon id uint32 GetLFGDungeonEntry(uint32 id); // cs_lfg /// Get current player roles - uint8 GetRoles(uint64 guid); + uint8 GetRoles(ObjectGuid guid); /// Get current player comment (used for LFR) - std::string const& GetComment(uint64 gguid); + std::string const& GetComment(ObjectGuid gguid); /// Gets current lfg options uint32 GetOptions(); /// Sets new lfg options @@ -359,27 +359,27 @@ class LFGMgr // LFGScripts /// Get leader of the group (using internal data) - uint64 GetLeader(uint64 guid); + ObjectGuid GetLeader(ObjectGuid guid); /// Sets player team - void SetTeam(uint64 guid, uint8 team); + void SetTeam(ObjectGuid guid, uint8 team); /// Sets player group - void SetGroup(uint64 guid, uint64 group); + void SetGroup(ObjectGuid guid, ObjectGuid group); /// Gets player group - uint64 GetGroup(uint64 guid); + ObjectGuid GetGroup(ObjectGuid guid); /// Sets the leader of the group - void SetLeader(uint64 gguid, uint64 leader); + void SetLeader(ObjectGuid gguid, ObjectGuid leader); /// Removes saved group data - void RemoveGroupData(uint64 guid); + void RemoveGroupData(ObjectGuid guid); /// Removes a player from a group - uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid); + uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid); /// Adds player to group - void AddPlayerToGroup(uint64 gguid, uint64 guid); + void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid); // LFGHandler /// Get locked dungeons - LfgLockMap const GetLockedDungeons(uint64 guid); + LfgLockMap const GetLockedDungeons(ObjectGuid guid); /// Returns current lfg status - LfgUpdateData GetLfgStatus(uint64 guid); + LfgUpdateData GetLfgStatus(ObjectGuid guid); /// Checks if Seasonal dungeon is active bool IsSeasonActive(uint32 dungeonId); /// Gets the random dungeon reward corresponding to given dungeon and player level @@ -389,55 +389,55 @@ class LFGMgr /// Teleport a player to/from selected dungeon void TeleportPlayer(Player* player, bool out, bool fromOpcode = false); /// Inits new proposal to boot a player - void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason); + void InitBoot(ObjectGuid gguid, ObjectGuid kguid, ObjectGuid vguid, std::string const& reason); /// Updates player boot proposal with new player answer - void UpdateBoot(uint64 guid, bool accept); + void UpdateBoot(ObjectGuid guid, bool accept); /// Updates proposal to join dungeon with player answer - void UpdateProposal(uint32 proposalId, uint64 guid, bool accept); + void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept); /// Updates the role check with player answer - void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE); + void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = ObjectGuid::Empty, uint8 roles = PLAYER_ROLE_NONE); /// Sets player lfg roles - void SetRoles(uint64 guid, uint8 roles); + void SetRoles(ObjectGuid guid, uint8 roles); /// Sets player lfr comment - void SetComment(uint64 guid, std::string const& comment); + void SetComment(ObjectGuid guid, std::string const& comment); /// Join Lfg with selected roles, dungeons and comment void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment); /// Leaves lfg - void LeaveLfg(uint64 guid); + void LeaveLfg(ObjectGuid guid); // LfgQueue /// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON) - LfgState GetOldState(uint64 guid); + LfgState GetOldState(ObjectGuid guid); /// Check if given group guid is lfg - bool IsLfgGroup(uint64 guid); + bool IsLfgGroup(ObjectGuid guid); /// Gets the player count of given group - uint8 GetPlayerCount(uint64 guid); + uint8 GetPlayerCount(ObjectGuid guid); /// Add a new Proposal uint32 AddProposal(LfgProposal& proposal); /// Returns queue id - uint8 GetQueueId(uint64 guid); + uint8 GetQueueId(ObjectGuid guid); /// Checks if all players are queued - bool AllQueued(LfgGuidList const& check); + bool AllQueued(GuidList const& check); /// Gets queue join time - time_t GetQueueJoinTime(uint64 guid); + time_t GetQueueJoinTime(ObjectGuid guid); /// Checks if given roles match, modifies given roles map with new roles static bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true); /// Checks if given players are ignoring each other - static bool HasIgnore(uint64 guid1, uint64 guid2); + static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2); /// Sends queue status to player - static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data); + static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data); private: - uint8 GetTeam(uint64 guid); - void RestoreState(uint64 guid, char const* debugMsg); - void ClearState(uint64 guid, char const* debugMsg); - void SetDungeon(uint64 guid, uint32 dungeon); - void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons); - void DecreaseKicksLeft(uint64 guid); - void SetState(uint64 guid, LfgState state); - void RemovePlayerData(uint64 guid); - void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap); - void _SaveToDB(uint64 guid, uint32 db_guid); + uint8 GetTeam(ObjectGuid guid); + void RestoreState(ObjectGuid guid, char const* debugMsg); + void ClearState(ObjectGuid guid, char const* debugMsg); + void SetDungeon(ObjectGuid guid, uint32 dungeon); + void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons); + void DecreaseKicksLeft(ObjectGuid guid); + void SetState(ObjectGuid guid, LfgState state); + void RemovePlayerData(ObjectGuid guid); + void GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap); + void _SaveToDB(ObjectGuid guid, uint32 db_guid); LFGDungeonData const* GetLFGDungeon(uint32 id); // Proposals @@ -445,19 +445,19 @@ class LFGMgr void MakeNewGroup(LfgProposal const& proposal); // Generic - LFGQueue& GetQueue(uint64 guid); + LFGQueue& GetQueue(ObjectGuid guid); LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon); LfgType GetDungeonType(uint32 dungeon); - void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot); - void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data); - void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles); - void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck); - void SendLfgUpdateStatus(uint64 guid, LfgUpdateData const& data, bool party); - void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal); + void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot); + void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data); + void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles); + void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck); + void SendLfgUpdateStatus(ObjectGuid guid, LfgUpdateData const& data, bool party); + void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal); - LfgGuidSet const& GetPlayers(uint64 guid); + GuidSet const& GetPlayers(ObjectGuid guid); // General variables uint32 m_QueueTimer; ///< used to check interval of update diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index 84b93543d7f..6be50be9b9c 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp @@ -21,7 +21,7 @@ namespace lfg { LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), - m_Team(0), m_Group(0), m_Roles(0), m_Comment("") + m_Team(0), m_Group(), m_Roles(0), m_Comment("") { } LfgPlayerData::~LfgPlayerData() { } @@ -34,7 +34,7 @@ void LfgPlayerData::SetState(LfgState state) case LFG_STATE_FINISHED_DUNGEON: m_Roles = 0; m_SelectedDungeons.clear(); - m_Comment = ""; + m_Comment.clear(); // No break on purpose case LFG_STATE_DUNGEON: m_OldState = state; @@ -59,7 +59,7 @@ void LfgPlayerData::SetTeam(uint8 team) m_Team = team; } -void LfgPlayerData::SetGroup(uint64 group) +void LfgPlayerData::SetGroup(ObjectGuid group) { m_Group = group; } @@ -94,7 +94,7 @@ uint8 LfgPlayerData::GetTeam() const return m_Team; } -uint64 LfgPlayerData::GetGroup() const +ObjectGuid LfgPlayerData::GetGroup() const { return m_Group; } diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h index 996764e7620..160fd221630 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.h +++ b/src/server/game/DungeonFinding/LFGPlayerData.h @@ -36,7 +36,7 @@ class LfgPlayerData void SetState(LfgState state); void RestoreState(); void SetTeam(uint8 team); - void SetGroup(uint64 group); + void SetGroup(ObjectGuid group); // Queue void SetRoles(uint8 roles); @@ -47,7 +47,7 @@ class LfgPlayerData LfgState GetState() const; LfgState GetOldState() const; uint8 GetTeam() const; - uint64 GetGroup() const; + ObjectGuid GetGroup() const; // Queue uint8 GetRoles() const; @@ -60,7 +60,7 @@ class LfgPlayerData LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal // Player uint8 m_Team; ///< Player team - determines the queue to join - uint64 m_Group; ///< Original group of player when joined LFG + ObjectGuid m_Group; ///< Original group of player when joined LFG // Queue uint8 m_Roles; ///< Roles the player selected when joined LFG diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index a44c7780c6b..df08b55a856 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -36,20 +36,20 @@ namespace lfg @param[in] check list of guids @returns Concatenated string */ -std::string ConcatenateGuids(LfgGuidList const& check) +std::string ConcatenateGuids(GuidList const& check) { if (check.empty()) return ""; // need the guids in order to avoid duplicates - LfgGuidSet guids(check.begin(), check.end()); + GuidSet guids(check.begin(), check.end()); std::ostringstream o; - LfgGuidSet::const_iterator it = guids.begin(); - o << (*it); + GuidSet::const_iterator it = guids.begin(); + o << it->GetRawValue(); for (++it; it != guids.end(); ++it) - o << '|' << (*it); + o << '|' << it->GetRawValue(); return o.str(); } @@ -83,26 +83,26 @@ char const* GetCompatibleString(LfgCompatibility compatibles) } } -void LFGQueue::AddToQueue(uint64 guid) +void LFGQueue::AddToQueue(ObjectGuid guid) { LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { - TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [" UI64FMTD "]", guid); + TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [%s]", guid.ToString().c_str()); return; } AddToNewQueue(guid); } -void LFGQueue::RemoveFromQueue(uint64 guid) +void LFGQueue::RemoveFromQueue(ObjectGuid guid) { RemoveFromNewQueue(guid); RemoveFromCurrentQueue(guid); RemoveFromCompatibles(guid); std::ostringstream o; - o << guid; + o << guid.GetRawValue(); std::string sguid = o.str(); LfgQueueDataContainer::iterator itDelete = QueueDataStore.end(); @@ -122,33 +122,33 @@ void LFGQueue::RemoveFromQueue(uint64 guid) QueueDataStore.erase(itDelete); } -void LFGQueue::AddToNewQueue(uint64 guid) +void LFGQueue::AddToNewQueue(ObjectGuid guid) { newToQueueStore.push_back(guid); } -void LFGQueue::RemoveFromNewQueue(uint64 guid) +void LFGQueue::RemoveFromNewQueue(ObjectGuid guid) { newToQueueStore.remove(guid); } -void LFGQueue::AddToCurrentQueue(uint64 guid) +void LFGQueue::AddToCurrentQueue(ObjectGuid guid) { currentQueueStore.push_back(guid); } -void LFGQueue::RemoveFromCurrentQueue(uint64 guid) +void LFGQueue::RemoveFromCurrentQueue(ObjectGuid guid) { currentQueueStore.remove(guid); } -void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap) +void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap) { QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap); AddToQueue(guid); } -void LFGQueue::RemoveQueueData(uint64 guid) +void LFGQueue::RemoveQueueData(ObjectGuid guid) { LfgQueueDataContainer::iterator it = QueueDataStore.find(guid); if (it != QueueDataStore.end()) @@ -188,13 +188,13 @@ void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId) @param[in] guid Guid to remove from compatible cache */ -void LFGQueue::RemoveFromCompatibles(uint64 guid) +void LFGQueue::RemoveFromCompatibles(ObjectGuid guid) { std::stringstream out; - out << guid; + out << guid.GetRawValue(); std::string strGuid = out.str(); - TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing [" UI64FMTD "]", guid); + TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing %s", guid.ToString().c_str()); for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();) { LfgCompatibleContainer::iterator it = itNext++; @@ -247,16 +247,18 @@ LfgCompatibilityData* LFGQueue::GetCompatibilityData(std::string const& key) uint8 LFGQueue::FindGroups() { uint8 proposals = 0; - LfgGuidList firstNew; + GuidList firstNew; while (!newToQueueStore.empty()) { - uint64 frontguid = newToQueueStore.front(); - TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size())); + ObjectGuid frontguid = newToQueueStore.front(); + TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [%s] newToQueue(%u), currentQueue(%u)", frontguid.ToString().c_str(), + uint32(newToQueueStore.size()), uint32(currentQueueStore.size())); + firstNew.clear(); firstNew.push_back(frontguid); RemoveFromNewQueue(frontguid); - LfgGuidList temporalList = currentQueueStore; + GuidList temporalList = currentQueueStore; LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList); if (compatibles == LFG_COMPATIBLES_MATCH) @@ -274,7 +276,7 @@ uint8 LFGQueue::FindGroups() @param[in] all List of all other guids in main queue to match against @return LfgCompatibility type of compatibility between groups */ -LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all) +LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all) { std::string strGuids = ConcatenateGuids(check); LfgCompatibility compatibles = GetCompatibles(strGuids); @@ -312,7 +314,7 @@ LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all) @param[in] check List of guids to check compatibilities @return LfgCompatibility type of compatibility */ -LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) +LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) { std::string strGuids = ConcatenateGuids(check); LfgProposal proposal; @@ -330,7 +332,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Check all-but-new compatiblitity if (check.size() > 2) { - uint64 frontGuid = check.front(); + ObjectGuid frontGuid = check.front(); check.pop_front(); // Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D) @@ -347,20 +349,20 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Check if more than one LFG group and number of players joining uint8 numPlayers = 0; uint8 numLfgGroups = 0; - for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it) { - uint64 guid = (*it); + ObjectGuid guid = *it; LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { - TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [" UI64FMTD "] is not queued but listed as queued!", guid); + TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [%s] is not queued but listed as queued!", guid.ToString().c_str()); RemoveFromQueue(guid); return LFG_COMPATIBILITY_PENDING; } // Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group) for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2) - proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0; + proposalGroups[it2->first] = itQueue->first.IsGroup() ? itQueue->first : ObjectGuid::Empty; numPlayers += itQueue->second.roles.size(); @@ -404,16 +406,16 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining if (check.size() > 1) { - for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it) + for (GuidList::const_iterator it = check.begin(); it != check.end(); ++it) { - const LfgRolesMap &roles = QueueDataStore[(*it)].roles; + LfgRolesMap const& roles = QueueDataStore[(*it)].roles; for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles) { LfgRolesMap::const_iterator itPlayer; for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer) { if (itRoles->first == itPlayer->first) - TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first); + TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str()); else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first)) break; } @@ -434,22 +436,22 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) { std::ostringstream o; for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it) - o << ", " << it->first << ": " << GetRolesString(it->second); + o << ", " << it->first.GetRawValue() << ": " << GetRolesString(it->second); TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str()); SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES); return LFG_INCOMPATIBLES_NO_ROLES; } - LfgGuidList::iterator itguid = check.begin(); + GuidList::iterator itguid = check.begin(); proposalDungeons = QueueDataStore[*itguid].dungeons; std::ostringstream o; - o << ", " << *itguid << ": (" << ConcatenateDungeons(proposalDungeons) << ")"; + o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(proposalDungeons) << ")"; for (++itguid; itguid != check.end(); ++itguid) { LfgDungeonSet temporal; - LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons; - o << ", " << *itguid << ": (" << ConcatenateDungeons(dungeons) << ")"; + LfgDungeonSet& dungeons = QueueDataStore[*itguid].dungeons; + o << ", " << itguid->GetRawValue() << ": (" << ConcatenateDungeons(dungeons) << ")"; std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin())); proposalDungeons = temporal; } @@ -463,7 +465,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) } else { - uint64 gguid = *check.begin(); + ObjectGuid gguid = *check.begin(); const LfgQueueData &queue = QueueDataStore[gguid]; proposalDungeons = queue.dungeons; proposalRoles = queue.roles; @@ -477,14 +479,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); data.roles = proposalRoles; - for (LfgGuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr) + for (GuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr) UpdateBestCompatibleInQueue(QueueDataStore.find(*itr), strGuids, data.roles); SetCompatibilityData(strGuids, data); return LFG_COMPATIBLES_WITH_LESS_PLAYERS; } - uint64 gguid = *check.begin(); + ObjectGuid gguid = *check.begin(); proposal.queues = check; proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(gguid) != LFG_STATE_DUNGEON; @@ -498,7 +500,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Create a new proposal proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL; proposal.state = LFG_PROPOSAL_INITIATING; - proposal.leader = 0; + proposal.leader.Clear(); proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons); bool leader = false; @@ -523,9 +525,9 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) } // Mark proposal members as not queued (but not remove queue data) - for (LfgGuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue) + for (GuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue) { - uint64 guid = (*itQueue); + ObjectGuid guid = (*itQueue); RemoveFromNewQueue(guid); RemoveFromCurrentQueue(guid); } @@ -581,13 +583,13 @@ void LFGQueue::UpdateQueueTimers(uint8 queueId, time_t currTime) LfgQueueStatusData queueData(queueId, dungeonId, queueinfo.joinTime, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps); for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer) { - uint64 pguid = itPlayer->first; + ObjectGuid pguid = itPlayer->first; LFGMgr::SendLfgQueueStatus(pguid, queueData); } } } -time_t LFGQueue::GetJoinTime(uint64 guid) const +time_t LFGQueue::GetJoinTime(ObjectGuid guid) const { LfgQueueDataContainer::const_iterator itr = QueueDataStore.find(guid); if (itr != QueueDataStore.end()) @@ -604,11 +606,11 @@ std::string LFGQueue::DumpQueueInfo() const for (uint8 i = 0; i < 2; ++i) { - LfgGuidList const& queue = i ? newToQueueStore : currentQueueStore; - for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it) + GuidList const& queue = i ? newToQueueStore : currentQueueStore; + for (GuidList::const_iterator it = queue.begin(); it != queue.end(); ++it) { - uint64 guid = *it; - if (IS_GROUP_GUID(guid)) + ObjectGuid guid = *it; + if (guid.IsGroup()) { groups++; playersInGroup += sLFGMgr->GetPlayerCount(guid); @@ -635,9 +637,9 @@ std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue) { - TC_LOG_DEBUG("lfg.queue.compatibles.find", "Guid: " UI64FMTD, itrQueue->first); + TC_LOG_DEBUG("lfg.queue.compatibles.find", "%s", itrQueue->first.ToString().c_str()); std::ostringstream o; - o << itrQueue->first; + o << itrQueue->first.GetRawValue(); std::string sguid = o.str(); for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr) @@ -660,8 +662,8 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu if (size <= storedSize) return; - TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for " UI64FMTD, - queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first); + TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for %s", + queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first.ToString().c_str()); queueData.bestCompatible = key; queueData.tanks = LFG_TANKS_NEEDED; diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h index 0312c926991..333becd6e9d 100644 --- a/src/server/game/DungeonFinding/LFGQueue.h +++ b/src/server/game/DungeonFinding/LFGQueue.h @@ -78,7 +78,7 @@ struct LfgWaitTime typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer; typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer; -typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer; +typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer; /** Stores all data related to queue @@ -88,10 +88,10 @@ class LFGQueue public: // Add/Remove from queue - void AddToQueue(uint64 guid); - void RemoveFromQueue(uint64 guid); - void AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap); - void RemoveQueueData(uint64 guid); + void AddToQueue(ObjectGuid guid); + void RemoveFromQueue(ObjectGuid guid); + void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap); + void RemoveQueueData(ObjectGuid guid); // Update Timers (when proposal success) void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId); @@ -101,7 +101,7 @@ class LFGQueue // Update Queue timers void UpdateQueueTimers(uint8 queueId, time_t currTime); - time_t GetJoinTime(uint64 guid) const; + time_t GetJoinTime(ObjectGuid guid) const; // Find new group uint8 FindGroups(); @@ -112,24 +112,23 @@ class LFGQueue private: void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles); - LfgRolesMap const& RemoveFromQueueUpdateData(uint64 guid); - void AddToNewQueue(uint64 guid); - void AddToCurrentQueue(uint64 guid); - void RemoveFromNewQueue(uint64 guid); - void RemoveFromCurrentQueue(uint64 guid); + void AddToNewQueue(ObjectGuid guid); + void AddToCurrentQueue(ObjectGuid guid); + void RemoveFromNewQueue(ObjectGuid guid); + void RemoveFromCurrentQueue(ObjectGuid guid); void SetCompatibles(std::string const& key, LfgCompatibility compatibles); LfgCompatibility GetCompatibles(std::string const& key); - void RemoveFromCompatibles(uint64 guid); + void RemoveFromCompatibles(ObjectGuid guid); void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles); LfgCompatibilityData* GetCompatibilityData(std::string const& key); void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue); void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles); - LfgCompatibility FindNewGroups(LfgGuidList& check, LfgGuidList& all); - LfgCompatibility CheckCompatibility(LfgGuidList check); + LfgCompatibility FindNewGroups(GuidList& check, GuidList& all); + LfgCompatibility CheckCompatibility(GuidList check); // Queue LfgQueueDataContainer QueueDataStore; ///< Queued groups @@ -139,8 +138,8 @@ class LFGQueue LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps - LfgGuidList currentQueueStore; ///< Ordered list. Used to find groups - LfgGuidList newToQueueStore; ///< New groups to add to queue + GuidList currentQueueStore; ///< Ordered list. Used to find groups + GuidList newToQueueStore; ///< New groups to add to queue }; } // namespace lfg diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 6a38afb398d..bac1949d894 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -52,16 +52,16 @@ void LFGPlayerScript::OnLogin(Player* player, bool /*loginFirst*/) return; // Temporal: Trying to determine when group data and LFG data gets desynched - uint64 guid = player->GetGUID(); - uint64 gguid = sLFGMgr->GetGroup(guid); + ObjectGuid guid = player->GetGUID(); + ObjectGuid gguid = sLFGMgr->GetGroup(guid); if (Group const* group = player->GetGroup()) { - uint64 gguid2 = group->GetGUID(); + ObjectGuid gguid2 = group->GetGUID(); if (gguid != gguid2) { TC_LOG_ERROR("lfg", "%s on group %u but LFG has group %u saved... Fixing.", - player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid)); + player->GetSession()->GetPlayerInfo().c_str(), gguid2.GetCounter(), gguid.GetCounter()); sLFGMgr->SetupGroupMember(guid, group->GetGUID()); } } @@ -104,24 +104,24 @@ void LFGPlayerScript::OnMapChanged(Player* player) LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") { } -void LFGGroupScript::OnAddMember(Group* group, uint64 guid) +void LFGGroupScript::OnAddMember(Group* group, ObjectGuid guid) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - uint64 leader = group->GetLeaderGUID(); + ObjectGuid gguid = group->GetGUID(); + ObjectGuid leader = group->GetLeaderGUID(); if (leader == guid) { - TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader); + TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str()); sLFGMgr->SetLeader(gguid, guid); } else { LfgState gstate = sLFGMgr->GetState(gguid); LfgState state = sLFGMgr->GetState(guid); - TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state); + TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state); if (state == LFG_STATE_QUEUED) sLFGMgr->LeaveLfg(guid); @@ -134,13 +134,14 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid) sLFGMgr->AddPlayerToGroup(gguid, guid); } -void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) +void LFGGroupScript::OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : "")); + ObjectGuid gguid = group->GetGUID(); + TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s", + gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : "")); bool isLFG = group->isLFGGroup(); @@ -160,13 +161,13 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT) { // LfgData: Remove player from group - sLFGMgr->SetGroup(guid, 0); + sLFGMgr->SetGroup(guid, ObjectGuid::Empty); sLFGMgr->RemovePlayerFromGroup(gguid, guid); return; } sLFGMgr->LeaveLfg(guid); - sLFGMgr->SetGroup(guid, 0); + sLFGMgr->SetGroup(guid, ObjectGuid::Empty); uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid); if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -192,31 +193,35 @@ void LFGGroupScript::OnDisband(Group* group) if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid); + ObjectGuid gguid = group->GetGUID(); + TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str()); sLFGMgr->RemoveGroupData(gguid); } -void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) +void LFGGroupScript::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); + ObjectGuid gguid = group->GetGUID(); + + TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]", + gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str()); - TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); sLFGMgr->SetLeader(gguid, newLeaderGuid); } -void LFGGroupScript::OnInviteMember(Group* group, uint64 guid) +void LFGGroupScript::OnInviteMember(Group* group, ObjectGuid guid) { if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - uint64 gguid = group->GetGUID(); - uint64 leader = group->GetLeaderGUID(); - TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader); + ObjectGuid gguid = group->GetGUID(); + ObjectGuid leader = group->GetLeaderGUID(); + TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]", + gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str()); + // No gguid == new group being formed // No leader == after group creation first invite is new leader // leader and no gguid == first invite after leader is added to new group (this is the real invite) diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h index 3f1dcbb218b..b4a626d5607 100644 --- a/src/server/game/DungeonFinding/LFGScripts.h +++ b/src/server/game/DungeonFinding/LFGScripts.h @@ -46,11 +46,11 @@ class LFGGroupScript : public GroupScript LFGGroupScript(); // Group Hooks - void OnAddMember(Group* group, uint64 guid) override; - void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override; + void OnAddMember(Group* group, ObjectGuid guid) override; + void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) override; void OnDisband(Group* group) override; - void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override; - void OnInviteMember(Group* group, uint64 guid) override; + void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override; + void OnInviteMember(Group* group, ObjectGuid guid) override; }; } // namespace lfg |
