Core/PacketIO: Updated packet structures to 9.2.7

Port From (https://github.com/TrinityCore/TrinityCore/commit/20f38369f30309e2c0cd53eca9cfe9c49376ed8c)
This commit is contained in:
hondacrx
2022-08-17 14:37:34 -04:00
parent 6efbe4b00e
commit cacfc06088
66 changed files with 6038 additions and 23 deletions
@@ -303,6 +303,7 @@ namespace Game.Networking.Packets
{
public ObjectGuid Auctioneer;
public uint AuctionID;
public int ItemID;
public AddOnInfo? TaintedBy;
public AuctionRemoveItem(WorldPacket packet) : base(packet) { }
@@ -311,6 +312,7 @@ namespace Game.Networking.Packets
{
Auctioneer = _worldPacket.ReadPackedGuid();
AuctionID = _worldPacket.ReadUInt32();
ItemID = _worldPacket.ReadInt32();
if (_worldPacket.HasBit())
{
@@ -525,6 +527,7 @@ namespace Game.Networking.Packets
class AuctionHelloResponse : ServerPacket
{
public ObjectGuid Guid;
public uint DeliveryDelay;
public bool OpenForBusiness = true;
public AuctionHelloResponse() : base(ServerOpcodes.AuctionHelloResponse) { }
@@ -532,6 +535,7 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteUInt32(DeliveryDelay);
_worldPacket.WriteBit(OpenForBusiness);
_worldPacket.FlushBits();
}
@@ -17,13 +17,13 @@
using Framework.Constants;
using Framework.Cryptography;
using Framework.Dynamic;
using Framework.Cryptography.Ed25519;
using Framework.IO;
using Game.DataStorage;
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Linq;
using System.Security.Cryptography;
namespace Game.Networking.Packets
{
@@ -365,8 +365,23 @@ namespace Game.Networking.Packets
{
byte[] EncryptionKey;
bool Enabled;
static byte[] expandedPrivateKey;
static byte[] EnableEncryptionSeed = { 0x90, 0x9C, 0xD0, 0x50, 0x5A, 0x2C, 0x14, 0xDD, 0x5C, 0x2C, 0xC0, 0x64, 0x14, 0xF3, 0xFE, 0xC9 };
static byte[] EnableEncryptionContext = { 0xA7, 0x1F, 0xB6, 0x9B, 0xC9, 0x7C, 0xDD, 0x96, 0xE9, 0xBB, 0xB8, 0x21, 0x39, 0x8D, 0x5A, 0xD4 };
static byte[] EnterEncryptedModePrivateKey =
{
0x08, 0xBD, 0xC7, 0xA3, 0xCC, 0xC3, 0x4F, 0x3F,
0x6A, 0x0B, 0xFF, 0xCF, 0x31, 0xC1, 0xB6, 0x97,
0x69, 0x1E, 0x72, 0x9A, 0x0A, 0xAB, 0x2C, 0x77,
0xC3, 0x6F, 0x8A, 0xE7, 0x5A, 0x9A, 0xA7, 0xC9
};
static EnterEncryptedMode()
{
expandedPrivateKey = Ed25519.ExpandedPrivateKeyFromSeed(EnterEncryptedModePrivateKey);
}
public EnterEncryptedMode(byte[] encryptionKey, bool enabled) : base(ServerOpcodes.EnterEncryptedMode)
{
@@ -376,11 +391,11 @@ namespace Game.Networking.Packets
public override void Write()
{
HmacSha256 hash = new(EncryptionKey);
hash.Process(BitConverter.GetBytes(Enabled), 1);
hash.Finish(EnableEncryptionSeed, 16);
HmacSha256 toSign = new(EncryptionKey);
toSign.Process(BitConverter.GetBytes(Enabled), 1);
toSign.Finish(EnableEncryptionSeed, 16);
_worldPacket.WriteBytes(RsaCrypt.RSA.SignHash(hash.Digest, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1).Reverse().ToArray());
_worldPacket.WriteBytes(Ed25519.Sign(toSign.Digest, expandedPrivateKey, 0, EnableEncryptionContext));
_worldPacket.WriteBit(Enabled);
_worldPacket.FlushBits();
}
@@ -367,7 +367,7 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WriteUInt32(DifficultyID);
_worldPacket.WriteUInt8(IsTournamentRealm);
_worldPacket.WriteBit(IsTournamentRealm);
_worldPacket.WriteBit(XRealmPvpAlert);
_worldPacket.WriteBit(BlockExitingLoadingScreen);
_worldPacket.WriteBit(RestrictedAccountMaxLevel.HasValue);
@@ -386,7 +386,7 @@ namespace Game.Networking.Packets
}
public uint DifficultyID;
public byte IsTournamentRealm;
public bool IsTournamentRealm;
public bool XRealmPvpAlert;
public bool BlockExitingLoadingScreen; // when set to true, sending SMSG_UPDATE_OBJECT with CreateObject Self bit = true will not hide loading screen
// instead it will be done after this packet is sent again with false in this bit and SMSG_UPDATE_OBJECT Values for player
@@ -745,6 +745,7 @@ namespace Game.Networking.Packets
_worldPacket.WritePackedGuid(PartyGUID);
_worldPacket.WriteInt32(SequenceNum);
_worldPacket.WritePackedGuid(LeaderGUID);
_worldPacket.WriteUInt8(LeaderFactionGroup);
_worldPacket.WriteInt32(PlayerList.Count);
_worldPacket.WriteBit(LfgInfos.HasValue);
_worldPacket.WriteBit(LootSettings.HasValue);
@@ -770,6 +771,7 @@ namespace Game.Networking.Packets
public ObjectGuid PartyGUID;
public ObjectGuid LeaderGUID;
public byte LeaderFactionGroup;
public int MyIndex;
public int SequenceNum;
@@ -1350,6 +1350,7 @@ namespace Game.Networking.Packets
data.WriteUInt32((uint)Flags);
data.WriteUInt32(PlayerContentTuningID);
data.WriteUInt32(TargetContentTuningID);
data.WriteInt32(Unused927);
data.WriteBits(TuningType, 4);
data.FlushBits();
}
@@ -1365,6 +1366,7 @@ namespace Game.Networking.Packets
public ContentTuningFlags Flags = ContentTuningFlags.NoLevelScaling | ContentTuningFlags.NoItemLevelScaling;
public uint PlayerContentTuningID;
public uint TargetContentTuningID;
public int Unused927;
public enum ContentTuningType
{
@@ -57,6 +57,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteInt32(GameRuleValues.Count);
_worldPacket.WriteInt16(MaxPlayerNameQueriesPerPacket);
_worldPacket.WriteInt16(PlayerNameQueryTelemetryInterval);
foreach (GameRuleValuePair gameRuleValue in GameRuleValues)
gameRuleValue.Write(_worldPacket);
@@ -162,6 +163,7 @@ namespace Game.Networking.Packets
public uint KioskSessionMinutes;
public int ActiveSeason; // Currently active Classic season
public short MaxPlayerNameQueriesPerPacket = 50;
public short PlayerNameQueryTelemetryInterval = 600;
public bool ItemRestorationButtonEnabled;
public bool CharUndeleteEnabled; // Implemented
public bool BpayStoreDisabledByParentalControls;
@@ -291,6 +293,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteInt32(ActiveSeason);
_worldPacket.WriteInt32(GameRuleValues.Count);
_worldPacket.WriteInt16(MaxPlayerNameQueriesPerPacket);
_worldPacket.WriteInt16(PlayerNameQueryTelemetryInterval);
if (LaunchETA.HasValue)
_worldPacket.WriteInt32(LaunchETA.Value);
@@ -333,6 +336,7 @@ namespace Game.Networking.Packets
public int ActiveSeason; // Currently active Classic season
public List<GameRuleValuePair> GameRuleValues = new();
public short MaxPlayerNameQueriesPerPacket = 50;
public short PlayerNameQueryTelemetryInterval = 600;
public int? LaunchETA;
}