Core/PacketIO: Updated packet structures to 8.1.5

Port TrinityCore Commit: https://github.com/TrinityCore/TrinityCore/commit/31fda79556e55375962a3c9e46f6dbdbf6e90d18
This commit is contained in:
hondacrx
2019-06-22 18:42:45 -04:00
parent d500b65ad9
commit e4d500f4b5
54 changed files with 1179 additions and 1077 deletions
+25 -22
View File
@@ -59,41 +59,44 @@ namespace Game
void SendAvailableHotfixes(int version)
{
SendPacket(new AvailableHotfixes(version, Global.DB2Mgr.GetHotfixData()));
SendPacket(new AvailableHotfixes(version, Global.DB2Mgr.GetHotfixCount(), Global.DB2Mgr.GetHotfixData()));
}
[WorldPacketHandler(ClientOpcodes.HotfixRequest, Status = SessionStatus.Authed)]
void HandleHotfixRequest(HotfixRequest hotfixQuery)
{
Dictionary<ulong, int> hotfixes = Global.DB2Mgr.GetHotfixData();
var hotfixes = Global.DB2Mgr.GetHotfixData();
HotfixResponse hotfixQueryResponse = new HotfixResponse();
foreach (ulong hotfixId in hotfixQuery.Hotfixes)
foreach (HotfixRecord hotfixRecord in hotfixQuery.Hotfixes)
{
int hotfix = hotfixes.LookupByKey(hotfixId);
if (hotfix != 0)
var hotfixedRecords = hotfixes.LookupByKey(hotfixRecord.HotfixID);
if (!hotfixedRecords.Empty())
{
var storage = Global.DB2Mgr.GetStorage(MathFunctions.Pair64_HiPart(hotfixId));
foreach (var tableRecord in hotfixedRecords)
{
var storage = Global.DB2Mgr.GetStorage(hotfixRecord.TableHash);
HotfixResponse.HotfixData hotfixData = new HotfixResponse.HotfixData();
hotfixData.ID = hotfixId;
hotfixData.RecordID = hotfix;
if (storage != null && storage.HasRecord((uint)hotfixData.RecordID))
{
hotfixData.Data.HasValue = true;
storage.WriteRecord((uint)hotfixData.RecordID, GetSessionDbcLocale(), hotfixData.Data.Value);
}
else
{
byte[] blobData = Global.DB2Mgr.GetHotfixBlobData(MathFunctions.Pair64_HiPart(hotfixId), hotfix);
if (blobData != null)
HotfixResponse.HotfixData hotfixData = new HotfixResponse.HotfixData();
hotfixData.Record = hotfixRecord;
if (storage != null && storage.HasRecord((uint)hotfixData.Record.RecordID))
{
hotfixData.Data.HasValue = true;
hotfixData.Data.Value.WriteBytes(blobData);
uint pos = hotfixQueryResponse.HotfixContent.GetSize();
storage.WriteRecord((uint)hotfixData.Record.RecordID, GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent);
hotfixData.Size.Set(hotfixQueryResponse.HotfixContent.GetSize() - pos);
}
else
{
byte[] blobData = Global.DB2Mgr.GetHotfixBlobData(hotfixData.Record.TableHash, hotfixData.Record.RecordID);
if (blobData != null)
{
hotfixData.Size.Set((uint)blobData.Length);
hotfixQueryResponse.HotfixContent.WriteBytes(blobData);
}
}
}
hotfixQueryResponse.Hotfixes.Add(hotfixData);
hotfixQueryResponse.Hotfixes.Add(hotfixData);
}
}
}