mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/DataStores: Updated hotfix packet structures to 9.1.5
This commit is contained in:
@@ -59,3 +59,5 @@ ALTER TABLE `ui_map` MODIFY `System` int(10) unsigned NOT NULL DEFAULT 0 AFTER `
|
||||
ALTER TABLE `ui_map` MODIFY `Type` int(10) unsigned NOT NULL DEFAULT 0 AFTER `System`;
|
||||
|
||||
ALTER TABLE `world_effect` MODIFY `TargetType` tinyint(3) unsigned NOT NULL DEFAULT 0 AFTER `WhenToDisplay`;
|
||||
|
||||
ALTER TABLE `hotfix_data` ADD `UniqueId` int(10) unsigned NOT NULL DEFAULT 0 AFTER `Id`;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "IteratorPair.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Random.h"
|
||||
#include "Regex.h"
|
||||
#include "Timer.h"
|
||||
#include "Util.h"
|
||||
@@ -1560,7 +1561,7 @@ void DB2Manager::LoadHotfixData()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
QueryResult result = HotfixDatabase.Query("SELECT Id, TableHash, RecordId, Status FROM hotfix_data ORDER BY Id");
|
||||
QueryResult result = HotfixDatabase.Query("SELECT Id, UniqueId, TableHash, RecordId, Status FROM hotfix_data ORDER BY Id");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -1577,9 +1578,10 @@ void DB2Manager::LoadHotfixData()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
int32 id = fields[0].GetInt32();
|
||||
uint32 tableHash = fields[1].GetUInt32();
|
||||
int32 recordId = fields[2].GetInt32();
|
||||
HotfixRecord::Status status = static_cast<HotfixRecord::Status>(fields[3].GetUInt8());
|
||||
uint32 uniqueId = fields[1].GetUInt32();
|
||||
uint32 tableHash = fields[2].GetUInt32();
|
||||
int32 recordId = fields[3].GetInt32();
|
||||
HotfixRecord::Status status = static_cast<HotfixRecord::Status>(fields[4].GetUInt8());
|
||||
if (status == HotfixRecord::Status::Valid && _stores.find(tableHash) == _stores.end())
|
||||
{
|
||||
HotfixBlobKey key = std::make_pair(tableHash, recordId);
|
||||
@@ -1594,7 +1596,8 @@ void DB2Manager::LoadHotfixData()
|
||||
HotfixRecord hotfixRecord;
|
||||
hotfixRecord.TableHash = tableHash;
|
||||
hotfixRecord.RecordID = recordId;
|
||||
hotfixRecord.HotfixID = id;
|
||||
hotfixRecord.ID.PushID = id;
|
||||
hotfixRecord.ID.UniqueID = uniqueId;
|
||||
hotfixRecord.HotfixStatus = status;
|
||||
_hotfixData[id].push_back(hotfixRecord);
|
||||
deletedRecords[std::make_pair(tableHash, recordId)] = status == HotfixRecord::Status::RecordRemoved;
|
||||
@@ -1772,8 +1775,9 @@ void DB2Manager::InsertNewHotfix(uint32 tableHash, uint32 recordId)
|
||||
HotfixRecord hotfixRecord;
|
||||
hotfixRecord.TableHash = tableHash;
|
||||
hotfixRecord.RecordID = recordId;
|
||||
hotfixRecord.HotfixID = ++_maxHotfixId;
|
||||
_hotfixData[hotfixRecord.HotfixID].push_back(hotfixRecord);
|
||||
hotfixRecord.ID.PushID = ++_maxHotfixId;
|
||||
hotfixRecord.ID.UniqueID = rand32();
|
||||
_hotfixData[hotfixRecord.ID.PushID].push_back(hotfixRecord);
|
||||
}
|
||||
|
||||
std::vector<uint32> DB2Manager::GetAreasForGroup(uint32 areaGroupId) const
|
||||
|
||||
@@ -297,6 +297,17 @@ public:
|
||||
DEFINE_DB2_SET_COMPARATOR(FriendshipRepReactionEntry)
|
||||
DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry)
|
||||
|
||||
struct HotfixId
|
||||
{
|
||||
int32 PushID = 0;
|
||||
uint32 UniqueID = 0;
|
||||
|
||||
friend bool operator<(HotfixId const& left, HotfixId const& right)
|
||||
{
|
||||
return std::tie(left.PushID, left.UniqueID) < std::tie(right.PushID, right.UniqueID);
|
||||
}
|
||||
};
|
||||
|
||||
struct HotfixRecord
|
||||
{
|
||||
enum class Status : uint8
|
||||
@@ -310,22 +321,22 @@ public:
|
||||
|
||||
uint32 TableHash = 0;
|
||||
int32 RecordID = 0;
|
||||
int32 HotfixID = 0;
|
||||
HotfixId ID;
|
||||
Status HotfixStatus = Status::Invalid;
|
||||
|
||||
friend bool operator<(HotfixRecord const& left, HotfixRecord const& right)
|
||||
{
|
||||
return std::tie(left.HotfixID, left.TableHash, left.RecordID) < std::tie(right.HotfixID, right.TableHash, right.RecordID);
|
||||
return std::tie(left.ID, left.TableHash, left.RecordID) < std::tie(right.ID, right.TableHash, right.RecordID);
|
||||
}
|
||||
};
|
||||
|
||||
struct HotfixOptionalData
|
||||
{
|
||||
uint32 Key;
|
||||
uint32 Key = 0;
|
||||
std::vector<uint8> Data;
|
||||
};
|
||||
|
||||
using HotfixContainer = std::unordered_map<int32, std::vector<HotfixRecord>>;
|
||||
using HotfixContainer = std::map<int32, std::vector<HotfixRecord>>;
|
||||
|
||||
using FriendshipRepReactionSet = std::set<FriendshipRepReactionEntry const*, FriendshipRepReactionEntryComparator>;
|
||||
using ItemBonusList = std::vector<ItemBonusEntry const*>;
|
||||
|
||||
@@ -23,19 +23,33 @@ namespace WorldPackets
|
||||
{
|
||||
namespace Hotfix
|
||||
{
|
||||
ByteBuffer& operator>>(ByteBuffer& data, DB2Manager::HotfixId& hotfixId)
|
||||
{
|
||||
data >> hotfixId.PushID;
|
||||
data >> hotfixId.UniqueID;
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, DB2Manager::HotfixId const& hotfixId)
|
||||
{
|
||||
data << int32(hotfixId.PushID);
|
||||
data << uint32(hotfixId.UniqueID);
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(ByteBuffer& data, DB2Manager::HotfixRecord& hotfixRecord)
|
||||
{
|
||||
data >> hotfixRecord.ID;
|
||||
data >> hotfixRecord.TableHash;
|
||||
data >> hotfixRecord.RecordID;
|
||||
data >> hotfixRecord.HotfixID;
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, DB2Manager::HotfixRecord const& hotfixRecord)
|
||||
{
|
||||
data << hotfixRecord.ID;
|
||||
data << uint32(hotfixRecord.TableHash);
|
||||
data << int32(hotfixRecord.RecordID);
|
||||
data << int32(hotfixRecord.HotfixID);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -67,7 +81,7 @@ WorldPacket const* AvailableHotfixes::Write()
|
||||
_worldPacket << int32(VirtualRealmAddress);
|
||||
_worldPacket << uint32(Hotfixes.size());
|
||||
for (DB2Manager::HotfixContainer::value_type const& hotfixRecord : Hotfixes)
|
||||
_worldPacket << int32(hotfixRecord.first);
|
||||
_worldPacket << hotfixRecord.second.front().ID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user