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/Handlers/HotfixHandler.cpp | |
| parent | 9685c9346dfe06ad1d248ff4e128e0d0b8dbfcea (diff) | |
Core/PacketIO: Updated packet structures to 8.1.5
Diffstat (limited to 'src/server/game/Handlers/HotfixHandler.cpp')
| -rw-r--r-- | src/server/game/Handlers/HotfixHandler.cpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/server/game/Handlers/HotfixHandler.cpp b/src/server/game/Handlers/HotfixHandler.cpp index 0ed74be8023..b58b7bedbe1 100644 --- a/src/server/game/Handlers/HotfixHandler.cpp +++ b/src/server/game/Handlers/HotfixHandler.cpp @@ -56,35 +56,38 @@ void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery) void WorldSession::SendAvailableHotfixes(int32 version) { - SendPacket(WorldPackets::Hotfix::AvailableHotfixes(version, sDB2Manager.GetHotfixData()).Write()); + SendPacket(WorldPackets::Hotfix::AvailableHotfixes(version, sDB2Manager.GetHotfixCount(), sDB2Manager.GetHotfixData()).Write()); } void WorldSession::HandleHotfixRequest(WorldPackets::Hotfix::HotfixRequest& hotfixQuery) { - std::map<uint64, int32> const& hotfixes = sDB2Manager.GetHotfixData(); + DB2Manager::HotfixContainer const& hotfixes = sDB2Manager.GetHotfixData(); WorldPackets::Hotfix::HotfixResponse hotfixQueryResponse; hotfixQueryResponse.Hotfixes.reserve(hotfixQuery.Hotfixes.size()); - for (uint64 hotfixId : hotfixQuery.Hotfixes) + for (WorldPackets::Hotfix::HotfixRecord const& hotfixRecord : hotfixQuery.Hotfixes) { - if (int32 const* hotfix = Trinity::Containers::MapGetValuePtr(hotfixes, hotfixId)) + if (auto const* hotfixedRecords = Trinity::Containers::MapGetValuePtr(hotfixes, hotfixRecord.HotfixID)) { - DB2StorageBase const* storage = sDB2Manager.GetStorage(PAIR64_HIPART(hotfixId)); - - WorldPackets::Hotfix::HotfixResponse::HotfixData hotfixData; - hotfixData.ID = hotfixId; - hotfixData.RecordID = *hotfix; - if (storage && storage->HasRecord(hotfixData.RecordID)) - { - hotfixData.Data = boost::in_place(); - storage->WriteRecord(hotfixData.RecordID, GetSessionDbcLocale(), *hotfixData.Data); - } - else if (std::vector<uint8> const* blobData = sDB2Manager.GetHotfixBlobData(PAIR64_HIPART(hotfixId), *hotfix)) + for (auto const& tableRecord : *hotfixedRecords) { - hotfixData.Data = boost::in_place(); - hotfixData.Data->append(blobData->data(), blobData->size()); - } + DB2StorageBase const* storage = sDB2Manager.GetStorage(hotfixRecord.TableHash); + + WorldPackets::Hotfix::HotfixResponse::HotfixData hotfixData; + hotfixData.Record = hotfixRecord; + if (storage && storage->HasRecord(hotfixData.Record.RecordID)) + { + std::size_t pos = hotfixQueryResponse.HotfixContent.size(); + storage->WriteRecord(hotfixData.Record.RecordID, GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent); + hotfixData.Size = hotfixQueryResponse.HotfixContent.size() - pos; + } + else if (std::vector<uint8> const* blobData = sDB2Manager.GetHotfixBlobData(hotfixData.Record.TableHash, hotfixData.Record.RecordID)) + { + hotfixData.Size = blobData->size(); + hotfixQueryResponse.HotfixContent.append(blobData->data(), blobData->size()); + } - hotfixQueryResponse.Hotfixes.emplace_back(std::move(hotfixData)); + hotfixQueryResponse.Hotfixes.emplace_back(std::move(hotfixData)); + } } } |
