mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/PacketIO: Updated packet structures to 8.1.5
This commit is contained in:
@@ -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))
|
||||
for (auto const& tableRecord : *hotfixedRecords)
|
||||
{
|
||||
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))
|
||||
{
|
||||
hotfixData.Data = boost::in_place();
|
||||
hotfixData.Data->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(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user