aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/HotfixHandler.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-12-20 22:49:53 +0100
committerShauren <shauren.trinity@gmail.com>2020-12-20 22:49:53 +0100
commitfbbf40981cc14523fa181cf6125336b254e8ae4d (patch)
treeec34a15277839c75163b2c9a2ffa84641ce2a662 /src/server/game/Handlers/HotfixHandler.cpp
parent15611810daa19c2fbcccf6a4d8f7ba95d7ff7a06 (diff)
Core/DataStores: Implement optional data in hotfix packets
Closes #25738
Diffstat (limited to 'src/server/game/Handlers/HotfixHandler.cpp')
-rw-r--r--src/server/game/Handlers/HotfixHandler.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/server/game/Handlers/HotfixHandler.cpp b/src/server/game/Handlers/HotfixHandler.cpp
index 85880fd0786..c1a200b616e 100644
--- a/src/server/game/Handlers/HotfixHandler.cpp
+++ b/src/server/game/Handlers/HotfixHandler.cpp
@@ -28,23 +28,26 @@
void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery)
{
DB2StorageBase const* store = sDB2Manager.GetStorage(dbQuery.TableHash);
- if (!store)
- {
- TC_LOG_ERROR("network", "CMSG_DB_QUERY_BULK: %s requested unsupported unknown hotfix type: %u", GetPlayerInfo().c_str(), dbQuery.TableHash);
- return;
- }
-
for (WorldPackets::Hotfix::DBQueryBulk::DBQueryRecord const& record : dbQuery.Queries)
{
WorldPackets::Hotfix::DBReply dbReply;
dbReply.TableHash = dbQuery.TableHash;
dbReply.RecordID = record.RecordID;
- if (store->HasRecord(record.RecordID))
+ if (store && store->HasRecord(record.RecordID))
{
dbReply.Status = 1;
dbReply.Timestamp = GameTime::GetGameTime();
store->WriteRecord(record.RecordID, GetSessionDbcLocale(), dbReply.Data);
+
+ if (std::vector<DB2Manager::HotfixOptionalData> const* optionalDataEntries = sDB2Manager.GetHotfixOptionalData(dbQuery.TableHash, record.RecordID, GetSessionDbcLocale()))
+ {
+ for (DB2Manager::HotfixOptionalData const& optionalData : *optionalDataEntries)
+ {
+ dbReply.Data << uint32(optionalData.Key);
+ dbReply.Data.append(optionalData.Data.data(), optionalData.Data.size());
+ }
+ }
}
else
{
@@ -78,6 +81,16 @@ void WorldSession::HandleHotfixRequest(WorldPackets::Hotfix::HotfixRequest& hotf
{
std::size_t pos = hotfixQueryResponse.HotfixContent.size();
storage->WriteRecord(uint32(hotfixRecord.RecordID), GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent);
+
+ if (std::vector<DB2Manager::HotfixOptionalData> const* optionalDataEntries = sDB2Manager.GetHotfixOptionalData(hotfixRecord.TableHash, hotfixRecord.RecordID, GetSessionDbcLocale()))
+ {
+ for (DB2Manager::HotfixOptionalData const& optionalData : *optionalDataEntries)
+ {
+ hotfixQueryResponse.HotfixContent << uint32(optionalData.Key);
+ hotfixQueryResponse.HotfixContent.append(optionalData.Data.data(), optionalData.Data.size());
+ }
+ }
+
hotfixData.Size = hotfixQueryResponse.HotfixContent.size() - pos;
}
else if (std::vector<uint8> const* blobData = sDB2Manager.GetHotfixBlobData(hotfixRecord.TableHash, hotfixRecord.RecordID, GetSessionDbcLocale()))