diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-05-18 22:21:17 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-06-08 17:03:15 +0200 |
commit | 31fda79556e55375962a3c9e46f6dbdbf6e90d18 (patch) | |
tree | 36ee91cb16772fa58e0a1eac973f82b437306af9 /src/server/game/DungeonFinding | |
parent | 9685c9346dfe06ad1d248ff4e128e0d0b8dbfcea (diff) |
Core/PacketIO: Updated packet structures to 8.1.5
Diffstat (limited to 'src/server/game/DungeonFinding')
-rw-r--r-- | src/server/game/DungeonFinding/LFG.h | 2 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 45 | ||||
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.h | 7 |
3 files changed, 33 insertions, 21 deletions
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index 9acd3324c2f..cc12ac71617 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -99,6 +99,8 @@ enum LfgLockStatusType LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE = 4, LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE = 5, LFG_LOCKSTATUS_RAID_LOCKED = 6, + LFG_LOCKSTATUS_NO_SPEC = 14, + LFG_LOCKSTATUS_HAS_RESTRICTION = 15, LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL = 1001, LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL = 1002, LFG_LOCKSTATUS_QUEST_NOT_COMPLETED = 1022, diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index bd8f1f81c1c..77c1bef1900 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -422,7 +422,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons) // Check player or group member restrictions if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_JOIN_DUNGEON_FINDER)) - joinData.result = LFG_JOIN_NO_SLOTS_PLAYER; + joinData.result = LFG_JOIN_NO_SLOTS; else if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue()) joinData.result = LFG_JOIN_CANT_USE_DUNGEONS; else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER)) @@ -430,9 +430,9 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons) else if (player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) joinData.result = LFG_JOIN_RANDOM_COOLDOWN_PLAYER; else if (dungeons.empty()) - joinData.result = LFG_JOIN_NO_SLOTS_PLAYER; + joinData.result = LFG_JOIN_NO_SLOTS; else if (player->HasAura(9454)) // check Freeze debuff - joinData.result = LFG_JOIN_NO_SLOTS_PLAYER; + joinData.result = LFG_JOIN_NO_SLOTS; else if (grp) { if (grp->GetMembersCount() > MAX_GROUP_SIZE) @@ -453,7 +453,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons) else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue()) joinData.result = LFG_JOIN_CANT_USE_DUNGEONS; else if (plrg->HasAura(9454)) // check Freeze debuff - joinData.result = LFG_JOIN_PARTY_NOT_MEET_REQS; + { + joinData.result = LFG_JOIN_NO_SLOTS; + joinData.playersMissingRequirement.push_back(&plrg->GetName()); + } ++memberCount; players.insert(plrg->GetGUID()); } @@ -507,9 +510,9 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons) dungeons = GetDungeonsByRandom(rDungeonId); // if we have lockmap then there are no compatible dungeons - GetCompatibleDungeons(dungeons, players, joinData.lockmap, isContinue); + GetCompatibleDungeons(&dungeons, players, &joinData.lockmap, &joinData.playersMissingRequirement, isContinue); if (dungeons.empty()) - joinData.result = grp ? LFG_JOIN_NO_LFG_OBJECT : LFG_JOIN_NO_SLOTS_PLAYER; + joinData.result = LFG_JOIN_NO_SLOTS; } } @@ -782,22 +785,23 @@ void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid:: @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, GuidSet const& players, LfgLockPartyMap& lockMap, bool isContinue) +void LFGMgr::GetCompatibleDungeons(LfgDungeonSet* dungeons, GuidSet const& players, LfgLockPartyMap* lockMap, std::vector<std::string const*>* playersMissingRequirement, bool isContinue) { - lockMap.clear(); + lockMap->clear(); std::map<uint32, uint32> lockedDungeons; + std::unordered_set<uint32> dungeonsToRemove; - for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) + for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons->empty(); ++it) { ObjectGuid guid = (*it); - LfgLockMap const& cachedLockMap = GetLockedDungeons(guid); + LfgLockMap cachedLockMap = GetLockedDungeons(guid); Player* player = ObjectAccessor::FindConnectedPlayer(guid); - for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2) + for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons->empty(); ++it2) { uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids - LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId); - if (itDungeon != dungeons.end()) + LfgDungeonSet::iterator itDungeon = dungeons->find(dungeonId); + if (itDungeon != dungeons->end()) { bool eraseDungeon = true; @@ -822,14 +826,19 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& playe } if (eraseDungeon) - dungeons.erase(itDungeon); + dungeonsToRemove.insert(dungeonId); - lockMap[guid][dungeonId] = it2->second; + (*lockMap)[guid][dungeonId] = it2->second; + playersMissingRequirement->push_back(&player->GetName()); } } } - if (!dungeons.empty()) - lockMap.clear(); + + for (uint32 dungeonIdToRemove : dungeonsToRemove) + dungeons->erase(dungeonIdToRemove); + + if (!dungeons->empty()) + lockMap->clear(); } /** @@ -1601,7 +1610,7 @@ LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid) return PlayersStore[guid].GetSelectedDungeons(); } -LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid) +LfgLockMap LFGMgr::GetLockedDungeons(ObjectGuid guid) { TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %s, LockedDungeons.", guid.ToString().c_str()); LfgLockMap lock; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 8cb332d3e45..0107d9adcfb 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -112,7 +112,7 @@ enum LfgJoinResult LFG_JOIN_OK = 0x00, // Joined (no client msg) LFG_JOIN_GROUP_FULL = 0x1F, // Your group is already full. LFG_JOIN_NO_LFG_OBJECT = 0x21, // Internal LFG Error. - LFG_JOIN_NO_SLOTS_PLAYER = 0x22, // You do not meet the requirements for the chosen dungeons. + LFG_JOIN_NO_SLOTS = 0x22, // You do not meet the requirements for the chosen dungeons. LFG_JOIN_MISMATCHED_SLOTS = 0x23, // You cannot mix dungeons, raids, and random when picking dungeons. LFG_JOIN_PARTY_PLAYERS_FROM_DIFFERENT_REALMS = 0x24, // The dungeon you chose does not support players from multiple realms. LFG_JOIN_MEMBERS_NOT_PRESENT = 0x25, // One or more group members are pending invites or disconnected. @@ -177,6 +177,7 @@ struct LfgJoinResultData LfgJoinResult result; LfgRoleCheckState state; LfgLockPartyMap lockmap; + std::vector<std::string const*> playersMissingRequirement; }; // Data needed by SMSG_LFG_UPDATE_STATUS @@ -386,7 +387,7 @@ class TC_GAME_API LFGMgr // LFGHandler /// Get locked dungeons - LfgLockMap const GetLockedDungeons(ObjectGuid guid); + LfgLockMap GetLockedDungeons(ObjectGuid guid); /// Returns current lfg status LfgUpdateData GetLfgStatus(ObjectGuid guid); /// Checks if Seasonal dungeon is active @@ -447,7 +448,7 @@ class TC_GAME_API LFGMgr void SetState(ObjectGuid guid, LfgState state); void SetVoteKick(ObjectGuid gguid, bool active); void RemovePlayerData(ObjectGuid guid); - void GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap, bool isContinue); + void GetCompatibleDungeons(LfgDungeonSet* dungeons, GuidSet const& players, LfgLockPartyMap* lockMap, std::vector<std::string const*>* playersMissingRequirement, bool isContinue); void _SaveToDB(ObjectGuid guid, uint32 db_guid); LFGDungeonData const* GetLFGDungeon(uint32 id); |