diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-10-23 18:15:01 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-10-23 18:15:01 +0200 |
commit | 973b5f404f5b7115239a81030ad2f8dff8e165ea (patch) | |
tree | de6db7264bc6fa02652b384b4d89245295ab63d5 /src/server/game/Handlers/HotfixHandler.cpp | |
parent | 1faa603d16cb51e581e43a560e54ec6e3ba8a9a4 (diff) |
Core/DataStores: Don't send hotfix ids in SMSG_AVAILABLE_HOTFIXES that don't have a hotfix blob for client locale
Closes #29378
Diffstat (limited to 'src/server/game/Handlers/HotfixHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/HotfixHandler.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/server/game/Handlers/HotfixHandler.cpp b/src/server/game/Handlers/HotfixHandler.cpp index 03170b014b7..54e70d3884e 100644 --- a/src/server/game/Handlers/HotfixHandler.cpp +++ b/src/server/game/Handlers/HotfixHandler.cpp @@ -60,7 +60,18 @@ void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery) void WorldSession::SendAvailableHotfixes() { - SendPacket(WorldPackets::Hotfix::AvailableHotfixes(realm.Id.GetAddress(), sDB2Manager.GetHotfixData()).Write()); + WorldPackets::Hotfix::AvailableHotfixes availableHotfixes; + availableHotfixes.VirtualRealmAddress = realm.Id.GetAddress(); + + for (auto const& [pushId, push] : sDB2Manager.GetHotfixData()) + { + if (!(push.AvailableLocalesMask & (1 << GetSessionDbcLocale()))) + continue; + + availableHotfixes.Hotfixes.insert(push.Records.front().ID); + } + + SendPacket(availableHotfixes.Write()); } void WorldSession::HandleHotfixRequest(WorldPackets::Hotfix::HotfixRequest& hotfixQuery) @@ -70,13 +81,14 @@ void WorldSession::HandleHotfixRequest(WorldPackets::Hotfix::HotfixRequest& hotf hotfixQueryResponse.Hotfixes.reserve(hotfixQuery.Hotfixes.size()); for (int32 hotfixId : hotfixQuery.Hotfixes) { - if (std::vector<DB2Manager::HotfixRecord> const* hotfixRecords = Trinity::Containers::MapGetValuePtr(hotfixes, hotfixId)) + if (DB2Manager::HotfixPush const* hotfixRecords = Trinity::Containers::MapGetValuePtr(hotfixes, hotfixId)) { - for (DB2Manager::HotfixRecord const& hotfixRecord : *hotfixRecords) + for (DB2Manager::HotfixRecord const& hotfixRecord : hotfixRecords->Records) { - hotfixQueryResponse.Hotfixes.emplace_back(); + if (!(hotfixRecord.AvailableLocalesMask & (1 << GetSessionDbcLocale()))) + continue; - WorldPackets::Hotfix::HotfixConnect::HotfixData& hotfixData = hotfixQueryResponse.Hotfixes.back(); + WorldPackets::Hotfix::HotfixConnect::HotfixData& hotfixData = hotfixQueryResponse.Hotfixes.emplace_back(); hotfixData.Record = hotfixRecord; if (hotfixRecord.HotfixStatus == DB2Manager::HotfixRecord::Status::Valid) { |