diff options
| author | Shauren <shauren.trinity@gmail.com> | 2020-06-08 00:08:37 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2020-06-08 00:08:37 +0200 |
| commit | 5fce3604fc9613299f8780d30abbbe69c0c7e531 (patch) | |
| tree | 531af1ed3b22c3a5041918043a775cc55cd49708 /src/server/game/Handlers/HotfixHandler.cpp | |
| parent | e5a6552abcbf0f179aebb67751527242968522f7 (diff) | |
Core/PacketIO: Fixed receiving and sending db2 hotfix packets
Diffstat (limited to 'src/server/game/Handlers/HotfixHandler.cpp')
| -rw-r--r-- | src/server/game/Handlers/HotfixHandler.cpp | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/server/game/Handlers/HotfixHandler.cpp b/src/server/game/Handlers/HotfixHandler.cpp index 2d6eda261b0..7230bb3e8ec 100644 --- a/src/server/game/Handlers/HotfixHandler.cpp +++ b/src/server/game/Handlers/HotfixHandler.cpp @@ -65,32 +65,27 @@ void WorldSession::HandleHotfixRequest(WorldPackets::Hotfix::HotfixRequest& hotf DB2Manager::HotfixContainer const& hotfixes = sDB2Manager.GetHotfixData(); WorldPackets::Hotfix::HotfixResponse hotfixQueryResponse; hotfixQueryResponse.Hotfixes.reserve(hotfixQuery.Hotfixes.size()); - for (WorldPackets::Hotfix::HotfixRecord const& hotfixRecord : hotfixQuery.Hotfixes) + for (DB2Manager::HotfixRecord const& hotfixRecord : hotfixQuery.Hotfixes) { - if (auto const* hotfixedRecords = Trinity::Containers::MapGetValuePtr(hotfixes, hotfixRecord.HotfixID)) + if (hotfixes.find(hotfixRecord) != hotfixes.end()) { - for (auto const& tableRecord : *hotfixedRecords) - { - uint32 hotfixTableHash = tableRecord.first; - int32 hotfixRecordId = tableRecord.second;; - DB2StorageBase const* storage = sDB2Manager.GetStorage(hotfixTableHash); - - WorldPackets::Hotfix::HotfixResponse::HotfixData hotfixData; - hotfixData.Record = hotfixRecord; - if (storage && storage->HasRecord(hotfixRecordId)) - { - std::size_t pos = hotfixQueryResponse.HotfixContent.size(); - storage->WriteRecord(hotfixRecordId, GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent); - hotfixData.Size = hotfixQueryResponse.HotfixContent.size() - pos; - } - else if (std::vector<uint8> const* blobData = sDB2Manager.GetHotfixBlobData(hotfixTableHash, hotfixRecordId)) - { - hotfixData.Size = blobData->size(); - hotfixQueryResponse.HotfixContent.append(blobData->data(), blobData->size()); - } + DB2StorageBase const* storage = sDB2Manager.GetStorage(hotfixRecord.TableHash); - hotfixQueryResponse.Hotfixes.emplace_back(std::move(hotfixData)); + WorldPackets::Hotfix::HotfixResponse::HotfixData hotfixData; + hotfixData.Record = hotfixRecord; + if (storage && storage->HasRecord(uint32(hotfixRecord.RecordID))) + { + std::size_t pos = hotfixQueryResponse.HotfixContent.size(); + storage->WriteRecord(uint32(hotfixRecord.RecordID), GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent); + hotfixData.Size = hotfixQueryResponse.HotfixContent.size() - pos; } + else if (std::vector<uint8> const* blobData = sDB2Manager.GetHotfixBlobData(hotfixRecord.TableHash, hotfixRecord.RecordID)) + { + hotfixData.Size = blobData->size(); + hotfixQueryResponse.HotfixContent.append(blobData->data(), blobData->size()); + } + + hotfixQueryResponse.Hotfixes.emplace_back(std::move(hotfixData)); } } |
