Core/PacketIO: Updated packet structures to 9.2.0

Port From (https://github.com/TrinityCore/TrinityCore/commit/9f30afe3528441571f89cb2e1775c756774fa0cd)
This commit is contained in:
hondacrx
2022-05-09 23:14:38 -04:00
parent 1ca851db26
commit 0bbabbd667
32 changed files with 1309 additions and 1023 deletions
@@ -30,18 +30,20 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WriteInt32(MythicPlusSeasonID);
_worldPacket.WriteInt32(CurrentSeason);
_worldPacket.WriteInt32(PreviousSeason);
_worldPacket.WriteInt32(MythicPlusDisplaySeasonID);
_worldPacket.WriteInt32(MythicPlusMilestoneSeasonID);
_worldPacket.WriteInt32(CurrentArenaSeason);
_worldPacket.WriteInt32(PreviousArenaSeason);
_worldPacket.WriteInt32(ConquestWeeklyProgressCurrencyID);
_worldPacket.WriteInt32(PvpSeasonID);
_worldPacket.WriteBit(WeeklyRewardChestsEnabled);
_worldPacket.FlushBits();
}
public int MythicPlusSeasonID;
public int PreviousSeason;
public int CurrentSeason;
public int MythicPlusDisplaySeasonID;
public int MythicPlusMilestoneSeasonID;
public int PreviousArenaSeason;
public int CurrentArenaSeason;
public int PvpSeasonID;
public int ConquestWeeklyProgressCurrencyID;
public bool WeeklyRewardChestsEnabled;
@@ -159,6 +161,7 @@ namespace Game.Networking.Packets
Hdr.Write(_worldPacket);
_worldPacket.WriteUInt32(AverageWaitTime);
_worldPacket.WriteUInt32(WaitTime);
_worldPacket.WriteInt32(Unused920);
_worldPacket.WriteBit(AsGroup);
_worldPacket.WriteBit(EligibleForMatchmaking);
_worldPacket.WriteBit(SuspendedQueue);
@@ -171,6 +174,7 @@ namespace Game.Networking.Packets
public bool SuspendedQueue;
public bool EligibleForMatchmaking;
public uint WaitTime;
public int Unused920;
}
public class BattlefieldStatusFailed : ServerPacket
@@ -503,6 +507,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteUInt8(Winner);
_worldPacket.WriteInt32(Duration);
_worldPacket.WriteBit(LogData != null);
_worldPacket.WriteBits(SoloShuffleStatus, 2);
_worldPacket.FlushBits();
if (LogData != null)
@@ -512,6 +517,7 @@ namespace Game.Networking.Packets
public byte Winner;
public int Duration;
public PVPMatchStatistics LogData;
public uint SoloShuffleStatus;
}
//Structs
@@ -631,6 +637,7 @@ namespace Game.Networking.Packets
data.WriteInt32(PlayerClass);
data.WriteInt32(CreatureID);
data.WriteInt32(HonorLevel);
data.WriteInt32(Role);
foreach (var pvpStat in Stats)
pvpStat.Write(data);
@@ -678,6 +685,7 @@ namespace Game.Networking.Packets
public int PlayerClass;
public int CreatureID;
public int HonorLevel;
public int Role;
}
public void Write(WorldPacket data)
@@ -281,7 +281,8 @@ namespace Game.Networking.Packets
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteUInt32(EmoteID);
_worldPacket.WriteInt32(SpellVisualKitIDs.Count);
_worldPacket.WriteInt32(SequenceVariation);
foreach (var id in SpellVisualKitIDs)
_worldPacket.WriteUInt32(id);
}
@@ -289,6 +290,7 @@ namespace Game.Networking.Packets
public ObjectGuid Guid;
public uint EmoteID;
public List<uint> SpellVisualKitIDs = new();
public int SequenceVariation;
}
public class CTextEmote : ClientPacket
@@ -302,6 +304,7 @@ namespace Game.Networking.Packets
SoundIndex = _worldPacket.ReadInt32();
SpellVisualKitIDs = new uint[_worldPacket.ReadUInt32()];
SequenceVariation = _worldPacket.ReadInt32();
for (var i = 0; i < SpellVisualKitIDs.Length; ++i)
SpellVisualKitIDs[i] = _worldPacket.ReadUInt32();
}
@@ -310,6 +313,7 @@ namespace Game.Networking.Packets
public int EmoteID;
public int SoundIndex;
public uint[] SpellVisualKitIDs;
public int SequenceVariation;
}
public class STextEmote : ServerPacket
@@ -144,10 +144,12 @@ namespace Game.Networking.Packets
{
_worldPacket.WritePackedGuid(ObjectGUID);
_worldPacket.WriteInt32(UILink);
_worldPacket.WriteInt32(UIItemInteractionID);
}
public ObjectGuid ObjectGUID;
public int UILink;
public int UIItemInteractionID;
}
class GameObjectPlaySpellVisual : ServerPacket
@@ -44,7 +44,6 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WritePackedGuid(GuildGUID);
_worldPacket.WritePackedGuid(PlayerGuid);
_worldPacket.WriteBit(HasGuildInfo);
_worldPacket.FlushBits();
@@ -76,7 +75,6 @@ namespace Game.Networking.Packets
}
public ObjectGuid GuildGUID;
public ObjectGuid PlayerGuid;
public GuildInfo Info = new();
public bool HasGuildInfo;
@@ -1181,11 +1181,13 @@ namespace Game.Networking.Packets
public override void Read()
{
SpellVisualKitIDs = new int[_worldPacket.ReadUInt32()];
SequenceVariation = _worldPacket.ReadInt32();
for (var i = 0; i < SpellVisualKitIDs.Length; ++i)
SpellVisualKitIDs[i] = _worldPacket.ReadInt32();
}
public int[] SpellVisualKitIDs;
public int SequenceVariation;
}
class SpecialMountAnim : ServerPacket
@@ -1196,12 +1198,14 @@ namespace Game.Networking.Packets
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WriteInt32(SpellVisualKitIDs.Count);
_worldPacket.WriteInt32(SequenceVariation);
foreach (var id in SpellVisualKitIDs)
_worldPacket.WriteInt32(id);
}
public ObjectGuid UnitGUID;
public List<int> SpellVisualKitIDs = new();
public int SequenceVariation;
}
class CrossedInebriationThreshold : ServerPacket
@@ -75,6 +75,9 @@ namespace Game.Networking.Packets
{
var movementInfo = new MovementInfo();
movementInfo.Guid = data.ReadPackedGuid();
movementInfo.SetMovementFlags((MovementFlag)data.ReadUInt32());
movementInfo.SetMovementFlags2((MovementFlag2)data.ReadUInt32());
movementInfo.SetExtraMovementFlags2((MovementFlags3)data.ReadUInt32());
movementInfo.Time = data.ReadUInt32();
float x = data.ReadFloat();
float y = data.ReadFloat();
@@ -96,19 +99,27 @@ namespace Game.Networking.Packets
// ResetBitReader
movementInfo.SetMovementFlags((MovementFlag)data.ReadBits<uint>(30));
movementInfo.SetMovementFlags2((MovementFlag2)data.ReadBits<uint>(18));
bool hasTransport = data.HasBit();
bool hasFall = data.HasBit();
bool hasSpline = data.HasBit(); // todo 6.x read this infos
data.ReadBit(); // HeightChangeFailed
data.ReadBit(); // RemoteTimeValid
bool hasInertia = data.HasBit();
if (hasTransport)
ReadTransportInfo(data, ref movementInfo.transport);
if (hasInertia)
{
MovementInfo.Inertia inertia = new();
inertia.guid = data.ReadPackedGuid();
inertia.force = data.ReadPosition();
inertia.lifetime = data.ReadUInt32();
movementInfo.inertia = inertia;
}
if (hasFall)
{
movementInfo.jump.fallTime = data.ReadUInt32();
@@ -134,8 +145,12 @@ namespace Game.Networking.Packets
bool hasFallDirection = movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar);
bool hasFallData = hasFallDirection || movementInfo.jump.fallTime != 0;
bool hasSpline = false; // todo 6.x send this infos
bool hasInertia = movementInfo.inertia.HasValue;
data.WritePackedGuid(movementInfo.Guid);
data.WriteUInt32((uint)movementInfo.GetMovementFlags());
data.WriteUInt32((uint)movementInfo.GetMovementFlags2());
data.WriteUInt32((uint)movementInfo.GetExtraMovementFlags2());
data.WriteUInt32(movementInfo.Time);
data.WriteFloat(movementInfo.Pos.GetPositionX());
data.WriteFloat(movementInfo.Pos.GetPositionY());
@@ -147,27 +162,32 @@ namespace Game.Networking.Packets
uint removeMovementForcesCount = 0;
data.WriteUInt32(removeMovementForcesCount);
uint int168 = 0;
data.WriteUInt32(int168);
uint moveIndex = 0;
data.WriteUInt32(moveIndex);
/*for (public uint i = 0; i < removeMovementForcesCount; ++i)
{
_worldPacket << ObjectGuid;
}*/
data.WriteBits((uint)movementInfo.GetMovementFlags(), 30);
data.WriteBits((uint)movementInfo.GetMovementFlags2(), 18);
data.WriteBit(hasTransportData);
data.WriteBit(hasFallData);
data.WriteBit(hasSpline);
data.WriteBit(false); // HeightChangeFailed
data.WriteBit(false); // RemoteTimeValid
data.WriteBit(hasInertia);
data.FlushBits();
if (hasTransportData)
WriteTransportInfo(data, movementInfo.transport);
if (hasInertia)
{
data.WritePackedGuid(movementInfo.inertia.Value.guid);
data.WriteXYZ(movementInfo.inertia.Value.force);
data.WriteUInt32(movementInfo.inertia.Value.lifetime);
}
if (hasFallData)
{
data.WriteUInt32(movementInfo.jump.fallTime);
@@ -1168,13 +1188,13 @@ namespace Game.Networking.Packets
data.WriteBit(CollisionHeight.HasValue);
data.WriteBit(@MovementForce != null);
data.WriteBit(MovementForceGUID.HasValue);
data.WriteBit(MovementInertiaGUID.HasValue);
data.WriteBit(MovementInertiaLifetimeMs.HasValue);
data.FlushBits();
if (@MovementForce != null)
@MovementForce.Write(data);
if (Speed.HasValue)
data.WriteFloat(Speed.Value);
@@ -1198,6 +1218,12 @@ namespace Game.Networking.Packets
if (MovementForceGUID.HasValue)
data.WritePackedGuid(MovementForceGUID.Value);
if (MovementInertiaGUID.HasValue)
data.WritePackedGuid(MovementInertiaGUID.Value);
if (MovementInertiaLifetimeMs.HasValue)
data.WriteUInt32(MovementInertiaLifetimeMs.Value);
}
public ServerOpcodes MessageID;
@@ -1208,6 +1234,8 @@ namespace Game.Networking.Packets
public CollisionHeightInfo? CollisionHeight;
public MovementForce MovementForce;
public ObjectGuid? MovementForceGUID;
public ObjectGuid? MovementInertiaGUID;
public uint? MovementInertiaLifetimeMs;
}
}
@@ -42,11 +42,13 @@ namespace Game.Networking.Packets
public class DungeonScoreSummary
{
public float CurrentSeasonScore;
public float LifetimeBestSeasonScore;
public List<DungeonScoreMapSummary> Runs = new();
public void Write(WorldPacket data)
{
data.WriteFloat(CurrentSeasonScore);
data.WriteFloat(LifetimeBestSeasonScore);
data.WriteInt32(Runs.Count);
foreach (var dungeonScoreMapSummary in Runs)
dungeonScoreMapSummary.Write(data);
@@ -61,7 +63,7 @@ namespace Game.Networking.Packets
public ObjectGuid GuildGUID;
public uint NativeRealmAddress;
public uint VirtualRealmAddress;
public short ChrSpecializationID;
public int ChrSpecializationID;
public short RaceID;
public int ItemLevel;
public int CovenantID;
@@ -75,7 +77,7 @@ namespace Game.Networking.Packets
data.WritePackedGuid(GuildGUID);
data.WriteUInt32(NativeRealmAddress);
data.WriteUInt32(VirtualRealmAddress);
data.WriteInt16(ChrSpecializationID);
data.WriteInt32(ChrSpecializationID);
data.WriteInt16(RaceID);
data.WriteInt32(ItemLevel);
data.WriteInt32(CovenantID);
@@ -157,7 +159,13 @@ namespace Game.Networking.Packets
{
data.WriteInt32(Season);
data.WriteInt32(Maps.Count);
data.WriteUInt32(0);
data.WriteFloat(SeasonScore);
data.WriteFloat(0);
foreach (var map in Maps)
map.Write(data);
foreach (var map in Maps)
map.Write(data);
}
+9 -1
View File
@@ -63,6 +63,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteUInt8(options.OptionNPC);
_worldPacket.WriteUInt8(options.OptionFlags);
_worldPacket.WriteInt32(options.OptionCost);
_worldPacket.WriteUInt32(options.OptionLanguage);
_worldPacket.WriteBits(options.Text.GetByteCount(), 12);
_worldPacket.WriteBits(options.Confirm.GetByteCount(), 12);
@@ -113,9 +114,15 @@ namespace Game.Networking.Packets
public class GossipComplete : ServerPacket
{
public bool SuppressSound;
public GossipComplete() : base(ServerOpcodes.GossipComplete) { }
public override void Write() { }
public override void Write()
{
_worldPacket.WriteBit(SuppressSound);
_worldPacket.FlushBits();
}
}
public class VendorInventory : ServerPacket
@@ -341,6 +348,7 @@ namespace Game.Networking.Packets
public byte OptionNPC;
public byte OptionFlags;
public int OptionCost;
public uint OptionLanguage;
public GossipOptionStatus Status;
public string Text;
public string Confirm;
+50 -15
View File
@@ -33,31 +33,26 @@ namespace Game.Networking.Packets
public override void Read()
{
Player = _worldPacket.ReadPackedGuid();
Players = new ObjectGuid[_worldPacket.ReadInt32()];
for (var i = 0; i < Players.Length; ++i)
Players[i] = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Player;
public ObjectGuid[] Players;
}
public class QueryPlayerNameResponse : ServerPacket
{
public QueryPlayerNameResponse() : base(ServerOpcodes.QueryPlayerNameResponse)
{
Data = new PlayerGuidLookupData();
}
public List<NameCacheLookupResult> Players = new();
public QueryPlayerNameResponse() : base(ServerOpcodes.QueryPlayerNameResponse) { }
public override void Write()
{
_worldPacket.WriteInt8((sbyte)Result);
_worldPacket.WritePackedGuid(Player);
if (Result == ResponseCodes.Success)
Data.Write(_worldPacket);
_worldPacket.WriteInt32(Players.Count);
foreach (NameCacheLookupResult lookupResult in Players)
lookupResult.Write(_worldPacket);
}
public ObjectGuid Player;
public ResponseCodes Result; // 0 - full packet, != 0 - only guid
public PlayerGuidLookupData Data;
}
public class QueryCreature : ClientPacket
@@ -685,6 +680,46 @@ namespace Game.Networking.Packets
public DeclinedName DeclinedNames = new();
}
public struct NameCacheUnused920
{
public uint Unused1;
public ObjectGuid Unused2;
public string Unused3 = "";
public void Write(WorldPacket data)
{
data.WriteUInt32(Unused1);
data.WritePackedGuid(Unused2);
data.WriteBits(Unused3.GetByteCount(), 7);
data.FlushBits();
data.WriteString(Unused3);
}
}
public struct NameCacheLookupResult
{
public ObjectGuid Player;
public byte Result = 0; // 0 - full packet, != 0 - only guid
public PlayerGuidLookupData Data;
public NameCacheUnused920? Unused920;
public void Write(WorldPacket data)
{
data.WriteUInt8(Result);
data.WritePackedGuid(Player);
data.WriteBit(Data != null);
data.WriteBit(Unused920.HasValue);
data.FlushBits();
if (Data != null)
Data.Write(data);
if (Unused920.HasValue)
Unused920.Value.Write(data);
}
}
public class CreatureXDisplay
{
public CreatureXDisplay(uint creatureDisplayID, float displayScale, float probability)
+18 -4
View File
@@ -850,8 +850,11 @@ namespace Game.Networking.Packets
_worldPacket.WritePackedGuid(SenderGUID);
_worldPacket.WriteInt32(UiTextureKitID);
_worldPacket.WriteUInt32(SoundKitID);
_worldPacket.WriteUInt32(CloseUISoundKitID);
_worldPacket.WriteUInt8(NumRerolls);
_worldPacket.WriteInt64(Duration);
_worldPacket.WriteBits(Question.GetByteCount(), 8);
_worldPacket.WriteBits(PendingChoiceText.GetByteCount(), 8);
_worldPacket.WriteBit(CloseChoiceFrame);
_worldPacket.WriteBit(HideWarboardHeader);
_worldPacket.WriteBit(KeepOpenAfterChoice);
@@ -861,14 +864,18 @@ namespace Game.Networking.Packets
response.Write(_worldPacket);
_worldPacket.WriteString(Question);
_worldPacket.WriteString(PendingChoiceText);
}
public ObjectGuid SenderGUID;
public int ChoiceID;
public int UiTextureKitID;
public uint SoundKitID;
public uint CloseUISoundKitID;
public byte NumRerolls;
public long Duration;
public string Question;
public string PendingChoiceText;
public List<PlayerChoiceResponse> Responses = new();
public bool CloseChoiceFrame;
public bool HideWarboardHeader;
@@ -1278,8 +1285,8 @@ namespace Game.Networking.Packets
{
public int Unused901_1;
public int TypeArtFileID;
public int Rarity;
public uint RarityColor;
public int? Rarity;
public uint? RarityColor;
public int Unused901_2;
public int SpellID;
public int MaxStacks;
@@ -1288,11 +1295,18 @@ namespace Game.Networking.Packets
{
data.WriteInt32(Unused901_1);
data.WriteInt32(TypeArtFileID);
data.WriteInt32(Rarity);
data.WriteUInt32(RarityColor);
data.WriteInt32(Unused901_2);
data.WriteInt32(SpellID);
data.WriteInt32(MaxStacks);
data.WriteBit(Rarity.HasValue);
data.WriteBit(RarityColor.HasValue);
data.FlushBits();
if (Rarity.HasValue)
data.WriteInt32(Rarity.Value);
if (RarityColor.HasValue)
data.WriteUInt32(RarityColor.Value);
}
}
@@ -53,6 +53,14 @@ namespace Game.Networking.Packets
_worldPacket.WriteUInt32(ClubsPresenceUpdateTimer);
_worldPacket.WriteUInt32(HiddenUIClubsPresenceUpdateTimer);
_worldPacket.WriteInt32(GameRuleUnknown1);
_worldPacket.WriteInt32(GameRuleValues.Count);
_worldPacket.WriteInt16(MaxPlayerNameQueriesPerPacket);
foreach (GameRuleValuePair gameRuleValue in GameRuleValues)
gameRuleValue.Write(_worldPacket);
_worldPacket.WriteBit(VoiceEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.HasValue);
_worldPacket.WriteBit(ScrollOfResurrectionEnabled);
@@ -152,6 +160,8 @@ namespace Game.Networking.Packets
public uint ClubsPresenceUpdateTimer;
public uint HiddenUIClubsPresenceUpdateTimer; // Timer for updating club presence when communities ui frame is hidden
public uint KioskSessionMinutes;
public int GameRuleUnknown1;
public short MaxPlayerNameQueriesPerPacket = 50;
public bool ItemRestorationButtonEnabled;
public bool CharUndeleteEnabled; // Implemented
public bool BpayStoreDisabledByParentalControls;
@@ -184,6 +194,7 @@ namespace Game.Networking.Packets
public SocialQueueConfig QuickJoinConfig;
public SquelchInfo Squelch;
public RafSystemFeatureInfo RAFSystem;
public List<GameRuleValuePair> GameRuleValues = new();
public struct SessionAlertConfig
{
@@ -276,10 +287,15 @@ namespace Game.Networking.Packets
_worldPacket.WriteInt32(ActiveClassTrialBoostType);
_worldPacket.WriteInt32(MinimumExpansionLevel);
_worldPacket.WriteInt32(MaximumExpansionLevel);
_worldPacket.WriteInt32(GameRuleUnknown1);
_worldPacket.WriteInt32(GameRuleValues.Count);
_worldPacket.WriteInt16(MaxPlayerNameQueriesPerPacket);
foreach (var sourceRegion in LiveRegionCharacterCopySourceRegions)
_worldPacket.WriteInt32(sourceRegion);
foreach (GameRuleValuePair gameRuleValue in GameRuleValues)
gameRuleValue.Write(_worldPacket);
}
public bool BpayStoreAvailable; // NYI
@@ -310,6 +326,9 @@ namespace Game.Networking.Packets
public int MinimumExpansionLevel;
public int MaximumExpansionLevel;
public uint KioskSessionMinutes;
public int GameRuleUnknown1;
public List<GameRuleValuePair> GameRuleValues = new();
public short MaxPlayerNameQueriesPerPacket = 50;
}
public class MOTD : ServerPacket
@@ -383,4 +402,16 @@ namespace Game.Networking.Packets
ThrottleState.Write(data);
}
}
public struct GameRuleValuePair
{
public int Rule;
public int Value;
public void Write(WorldPacket data)
{
data.WriteInt32(Rule);
data.WriteInt32(Value);
}
}
}