Core/PacketIO: Updated packet structures to 9.2.7
Port From (https://github.com/TrinityCore/TrinityCore/commit/20f38369f30309e2c0cd53eca9cfe9c49376ed8c)
This commit is contained in:
@@ -400,10 +400,11 @@ namespace Game.Entities
|
||||
public UpdateField<byte> ItemAppearanceModID = new(0, 17);
|
||||
public UpdateField<ItemModList> Modifiers = new(0, 18);
|
||||
public UpdateField<uint> DynamicFlags2 = new(0, 19);
|
||||
public UpdateFieldArray<int> SpellCharges = new(5, 20, 21);
|
||||
public UpdateFieldArray<ItemEnchantment> Enchantment = new(13, 26, 27);
|
||||
public UpdateField<ushort> DEBUGItemLevel = new(0, 20);
|
||||
public UpdateFieldArray<int> SpellCharges = new(5, 21, 22);
|
||||
public UpdateFieldArray<ItemEnchantment> Enchantment = new(13, 27, 28);
|
||||
|
||||
public ItemData() : base(0, TypeId.Item, 40) { }
|
||||
public ItemData() : base(0, TypeId.Item, 41) { }
|
||||
|
||||
public void WriteCreate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Item owner, Player receiver)
|
||||
{
|
||||
@@ -448,6 +449,7 @@ namespace Game.Entities
|
||||
if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag.Owner))
|
||||
{
|
||||
data.WriteUInt32(DynamicFlags2);
|
||||
data.WriteUInt16(DEBUGItemLevel);
|
||||
}
|
||||
for (int i = 0; i < ArtifactPowers.Size(); ++i)
|
||||
{
|
||||
@@ -462,7 +464,7 @@ namespace Game.Entities
|
||||
|
||||
public void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Item owner, Player receiver)
|
||||
{
|
||||
UpdateMask allowedMaskForTarget = new(40, new uint[] { 0xFC04E4FFu, 0x000000FFu });
|
||||
UpdateMask allowedMaskForTarget = new(41, new uint[] { 0xF804E4FFu, 0x000001FFu });
|
||||
AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
|
||||
WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver);
|
||||
}
|
||||
@@ -470,12 +472,12 @@ namespace Game.Entities
|
||||
public void AppendAllowedFieldsMaskForFlag(UpdateMask allowedMaskForTarget, UpdateFieldFlag fieldVisibilityFlags)
|
||||
{
|
||||
if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag.Owner))
|
||||
allowedMaskForTarget.OR(new UpdateMask(40, new uint[] { 0x03FB1B00u, 0x00000000u }));
|
||||
allowedMaskForTarget.OR(new UpdateMask(41, new uint[] { 0x07FB1B00u, 0x00000000u }));
|
||||
}
|
||||
|
||||
public void FilterDisallowedFieldsMaskForFlag(UpdateMask changesMask, UpdateFieldFlag fieldVisibilityFlags)
|
||||
{
|
||||
UpdateMask allowedMaskForTarget = new(40, new[] { 0xFC04E4FFu, 0x000000FFu });
|
||||
UpdateMask allowedMaskForTarget = new(41, new[] { 0xF804E4FFu, 0x000001FFu });
|
||||
AppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags);
|
||||
changesMask.AND(allowedMaskForTarget);
|
||||
}
|
||||
@@ -598,26 +600,30 @@ namespace Game.Entities
|
||||
{
|
||||
data.WriteUInt32(DynamicFlags2);
|
||||
}
|
||||
if (changesMask[20])
|
||||
{
|
||||
data.WriteUInt16(DEBUGItemLevel);
|
||||
}
|
||||
if (changesMask[18])
|
||||
{
|
||||
((ItemModList)Modifiers).WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
|
||||
}
|
||||
}
|
||||
if (changesMask[20])
|
||||
if (changesMask[21])
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
if (changesMask[21 + i])
|
||||
if (changesMask[22 + i])
|
||||
{
|
||||
data.WriteInt32(SpellCharges[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changesMask[26])
|
||||
if (changesMask[27])
|
||||
{
|
||||
for (int i = 0; i < 13; ++i)
|
||||
{
|
||||
if (changesMask[27 + i])
|
||||
if (changesMask[28 + i])
|
||||
{
|
||||
Enchantment[i].WriteUpdate(data, ignoreNestedChangesMask, owner, receiver);
|
||||
}
|
||||
@@ -646,6 +652,7 @@ namespace Game.Entities
|
||||
ClearChangesMask(ItemAppearanceModID);
|
||||
ClearChangesMask(Modifiers);
|
||||
ClearChangesMask(DynamicFlags2);
|
||||
ClearChangesMask(DEBUGItemLevel);
|
||||
ClearChangesMask(SpellCharges);
|
||||
ClearChangesMask(Enchantment);
|
||||
_changesMask.ResetAll();
|
||||
|
||||
@@ -2947,6 +2947,19 @@ namespace Game.Entities
|
||||
uint GetChampioningFaction() { return m_ChampioningFaction; }
|
||||
public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; }
|
||||
|
||||
public static byte GetFactionGroupForRace(Race race)
|
||||
{
|
||||
var rEntry = CliDB.ChrRacesStorage.LookupByKey((uint)race);
|
||||
if (rEntry != null)
|
||||
{
|
||||
var faction = CliDB.FactionTemplateStorage.LookupByKey(rEntry.FactionID);
|
||||
if (faction != null)
|
||||
return faction.FactionGroup;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void SetFactionForRace(Race race)
|
||||
{
|
||||
m_team = TeamForRace(race);
|
||||
@@ -5125,7 +5138,7 @@ namespace Game.Entities
|
||||
// SMSG_WORLD_SERVER_INFO
|
||||
WorldServerInfo worldServerInfo = new();
|
||||
worldServerInfo.InstanceGroupSize = GetMap().GetMapDifficulty().MaxPlayers; // @todo
|
||||
worldServerInfo.IsTournamentRealm = 0; // @todo
|
||||
worldServerInfo.IsTournamentRealm = false; // @todo
|
||||
worldServerInfo.RestrictedAccountMaxLevel = null; // @todo
|
||||
worldServerInfo.RestrictedAccountMaxMoney = null; // @todo
|
||||
worldServerInfo.DifficultyID = (uint)GetMap().GetDifficultyID();
|
||||
|
||||
@@ -107,6 +107,7 @@ namespace Game.Groups
|
||||
|
||||
m_guid = ObjectGuid.Create(HighGuid.Party, Global.GroupMgr.GenerateGroupId());
|
||||
m_leaderGuid = leaderGuid;
|
||||
m_leaderFactionGroup = Player.GetFactionGroupForRace(leader.GetRace());
|
||||
m_leaderName = leader.GetName();
|
||||
leader.SetPlayerFlag(PlayerFlags.GroupLeader);
|
||||
|
||||
@@ -182,9 +183,12 @@ namespace Game.Groups
|
||||
m_leaderGuid = ObjectGuid.Create(HighGuid.Player, field.Read<ulong>(0));
|
||||
|
||||
// group leader not exist
|
||||
if (!Global.CharacterCacheStorage.GetCharacterNameByGuid(m_leaderGuid, out m_leaderName))
|
||||
var leader = Global.CharacterCacheStorage.GetCharacterCacheByGuid(m_leaderGuid);
|
||||
if (leader == null)
|
||||
return;
|
||||
|
||||
m_leaderFactionGroup = Player.GetFactionGroupForRace(leader.RaceId);
|
||||
m_leaderName = leader.Name;
|
||||
m_lootMethod = (LootMethod)field.Read<byte>(1);
|
||||
m_looterGuid = ObjectGuid.Create(HighGuid.Player, field.Read<ulong>(2));
|
||||
m_lootThreshold = (ItemQuality)field.Read<byte>(3);
|
||||
@@ -338,6 +342,7 @@ namespace Game.Groups
|
||||
return false;
|
||||
|
||||
m_leaderGuid = player.GetGUID();
|
||||
m_leaderFactionGroup = Player.GetFactionGroupForRace(player.GetRace());
|
||||
m_leaderName = player.GetName();
|
||||
return true;
|
||||
}
|
||||
@@ -736,6 +741,7 @@ namespace Game.Groups
|
||||
|
||||
newLeader.SetPlayerFlag(PlayerFlags.GroupLeader);
|
||||
m_leaderGuid = newLeader.GetGUID();
|
||||
m_leaderFactionGroup = Player.GetFactionGroupForRace(newLeader.GetRace());
|
||||
m_leaderName = newLeader.GetName();
|
||||
ToggleGroupMemberFlag(slot, GroupMemberFlags.Assistant, false);
|
||||
|
||||
@@ -1455,6 +1461,7 @@ namespace Game.Groups
|
||||
|
||||
partyUpdate.PartyGUID = m_guid;
|
||||
partyUpdate.LeaderGUID = m_leaderGuid;
|
||||
partyUpdate.LeaderFactionGroup = m_leaderFactionGroup;
|
||||
|
||||
partyUpdate.SequenceNum = player.NextGroupUpdateSequenceNumber(m_groupCategory);
|
||||
|
||||
@@ -1474,9 +1481,7 @@ namespace Game.Groups
|
||||
playerInfos.Name = member.name;
|
||||
playerInfos.Class = member._class;
|
||||
|
||||
ChrRacesRecord race = CliDB.ChrRacesStorage.LookupByKey((uint)member.race);
|
||||
FactionTemplateRecord raceFaction = CliDB.FactionTemplateStorage.LookupByKey(race.FactionID);
|
||||
playerInfos.FactionGroup = raceFaction.FactionGroup;
|
||||
playerInfos.FactionGroup = Player.GetFactionGroupForRace(member.race);
|
||||
|
||||
playerInfos.Status = GroupMemberOnlineStatus.Offline;
|
||||
if (memberPlayer && memberPlayer.GetSession() && !memberPlayer.GetSession().PlayerLogout())
|
||||
@@ -2744,6 +2749,7 @@ namespace Game.Groups
|
||||
GroupRefManager m_memberMgr = new();
|
||||
List<Player> m_invitees = new();
|
||||
ObjectGuid m_leaderGuid;
|
||||
byte m_leaderFactionGroup;
|
||||
string m_leaderName;
|
||||
GroupFlags m_groupFlags;
|
||||
GroupCategory m_groupCategory;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user