Core/PacketIO: Updated to 11.0.0
Port From (https://github.com/TrinityCore/TrinityCore/commit/e59eef5432c7b70679d33f4911c88d0f7d75fd39)
This commit is contained in:
@@ -27,17 +27,21 @@ namespace Game.Networking.Packets
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteBit(Success);
|
||||
_worldPacket.WriteBit(Realmless);
|
||||
_worldPacket.WriteBit(IsDeletedCharacters);
|
||||
_worldPacket.WriteBit(IsNewPlayerRestrictionSkipped);
|
||||
_worldPacket.WriteBit(IsNewPlayerRestricted);
|
||||
_worldPacket.WriteBit(IsNewPlayer);
|
||||
_worldPacket.WriteBit(IsTrialAccountRestricted);
|
||||
_worldPacket.WriteBit(DisabledClassesMask.HasValue);
|
||||
_worldPacket.WriteBit(DontCreateCharacterDisplays);
|
||||
_worldPacket.WriteInt32(Characters.Count);
|
||||
_worldPacket.WriteInt32(RegionwideCharacters.Count);
|
||||
_worldPacket.WriteInt32(MaxCharacterLevel);
|
||||
_worldPacket.WriteInt32(RaceUnlockData.Count);
|
||||
_worldPacket.WriteInt32(UnlockedConditionalAppearances.Count);
|
||||
_worldPacket.WriteInt32(RaceLimitDisables.Count);
|
||||
_worldPacket.WriteInt32(WarbandGroups.Count);
|
||||
|
||||
if (DisabledClassesMask.HasValue)
|
||||
_worldPacket.WriteUInt32(DisabledClassesMask.Value);
|
||||
@@ -48,7 +52,13 @@ namespace Game.Networking.Packets
|
||||
foreach (RaceLimitDisableInfo raceLimitDisableInfo in RaceLimitDisables)
|
||||
raceLimitDisableInfo.Write(_worldPacket);
|
||||
|
||||
foreach (CharacterInfo charInfo in Characters)
|
||||
foreach (WarbandGroup warbandGroup in WarbandGroups)
|
||||
warbandGroup.Write(_worldPacket);
|
||||
|
||||
foreach (CharacterInfoBasic charInfo in Characters)
|
||||
charInfo.Write(_worldPacket);
|
||||
|
||||
foreach (RegionwideCharacterListEntry charInfo in RegionwideCharacters)
|
||||
charInfo.Write(_worldPacket);
|
||||
|
||||
foreach (RaceUnlock raceUnlock in RaceUnlockData)
|
||||
@@ -56,25 +66,30 @@ namespace Game.Networking.Packets
|
||||
}
|
||||
|
||||
public bool Success;
|
||||
public bool Realmless;
|
||||
public bool IsDeletedCharacters; // used for character undelete list
|
||||
public bool IsNewPlayerRestrictionSkipped; // allows client to skip new player restrictions
|
||||
public bool IsNewPlayerRestricted; // forbids using level boost and class trials
|
||||
public bool IsNewPlayer; // forbids hero classes and allied races
|
||||
public bool IsTrialAccountRestricted;
|
||||
public bool DontCreateCharacterDisplays;
|
||||
|
||||
public int MaxCharacterLevel = 1;
|
||||
public uint? DisabledClassesMask = new();
|
||||
|
||||
public List<CharacterInfo> Characters = new(); // all characters on the list
|
||||
public List<RaceUnlock> RaceUnlockData = new(); //
|
||||
public List<CharacterInfoBasic> Characters = new(); // all characters on the list
|
||||
public List<RegionwideCharacterListEntry> RegionwideCharacters = new();
|
||||
public List<RaceUnlock> RaceUnlockData = new();
|
||||
public List<UnlockedConditionalAppearance> UnlockedConditionalAppearances = new();
|
||||
public List<RaceLimitDisableInfo> RaceLimitDisables = new();
|
||||
public List<WarbandGroup> WarbandGroups = new();
|
||||
|
||||
public class CharacterInfo
|
||||
public class CharacterInfoBasic
|
||||
{
|
||||
public CharacterInfo(SQLFields fields)
|
||||
public CharacterInfoBasic(SQLFields fields)
|
||||
{
|
||||
Guid = ObjectGuid.Create(HighGuid.Player, fields.Read<ulong>(0));
|
||||
VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
Name = fields.Read<string>(1);
|
||||
RaceId = fields.Read<byte>(2);
|
||||
ClassId = (Class)fields.Read<byte>(3);
|
||||
@@ -116,8 +131,6 @@ namespace Game.Networking.Packets
|
||||
else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeRace))
|
||||
Flags2 = CharacterCustomizeFlags.Race;
|
||||
|
||||
Flags3 = 0;
|
||||
Flags4 = 0;
|
||||
FirstLogin = atLoginFlags.HasAnyFlag(AtLoginFlags.FirstLogin);
|
||||
|
||||
// show pet at selection character in character list only for non-ghost character
|
||||
@@ -132,7 +145,6 @@ namespace Game.Networking.Packets
|
||||
}
|
||||
}
|
||||
|
||||
BoostInProgress = false;
|
||||
ProfessionIds[0] = 0;
|
||||
ProfessionIds[1] = 0;
|
||||
|
||||
@@ -168,41 +180,42 @@ namespace Game.Networking.Packets
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WritePackedGuid(Guid);
|
||||
data.WriteUInt64(GuildClubMemberID);
|
||||
data.WriteUInt32(VirtualRealmAddress);
|
||||
data.WriteUInt8(ListPosition);
|
||||
data.WriteUInt8(RaceId);
|
||||
data.WriteUInt8((byte)ClassId);
|
||||
data.WriteUInt8(SexId);
|
||||
data.WriteUInt8((byte)ClassId);
|
||||
data.WriteInt16(SpecID);
|
||||
data.WriteInt32(Customizations.Count);
|
||||
|
||||
data.WriteUInt8(ExperienceLevel);
|
||||
data.WriteUInt32(ZoneId);
|
||||
data.WriteUInt32(MapId);
|
||||
data.WriteUInt32(ZoneId);
|
||||
data.WriteVector3(PreloadPos);
|
||||
data.WriteUInt64(GuildClubMemberID);
|
||||
data.WritePackedGuid(GuildGuid);
|
||||
data.WriteUInt32((uint)Flags);
|
||||
data.WriteUInt32((uint)Flags2);
|
||||
data.WriteUInt32(Flags3);
|
||||
data.WriteUInt8(unkWod61x);
|
||||
|
||||
data.WriteUInt32(PetCreatureDisplayId);
|
||||
data.WriteUInt32(PetExperienceLevel);
|
||||
data.WriteUInt32(PetCreatureFamilyId);
|
||||
|
||||
data.WriteUInt32(ProfessionIds[0]);
|
||||
data.WriteUInt32(ProfessionIds[1]);
|
||||
|
||||
foreach (var visualItem in VisualItems)
|
||||
visualItem.Write(data);
|
||||
|
||||
data.WriteInt64(LastPlayedTime);
|
||||
data.WriteInt16(SpecID);
|
||||
data.WriteInt32(Unknown703);
|
||||
data.WriteInt64(LastPlayedTime);
|
||||
data.WriteInt32(LastLoginVersion);
|
||||
data.WriteUInt32(Flags4);
|
||||
data.WriteInt32(MailSenders.Count);
|
||||
data.WriteInt32(MailSenderTypes.Count);
|
||||
data.WriteUInt32(OverrideSelectScreenFileDataID);
|
||||
PersonalTabard.Write(data);
|
||||
|
||||
data.WriteUInt32(ProfessionIds[0]);
|
||||
data.WriteUInt32(ProfessionIds[1]);
|
||||
|
||||
data.WriteInt32(TimerunningSeasonID);
|
||||
data.WriteUInt32(OverrideSelectScreenFileDataID);
|
||||
|
||||
foreach (ChrCustomizationChoice customization in Customizations)
|
||||
{
|
||||
@@ -210,29 +223,15 @@ namespace Game.Networking.Packets
|
||||
data.WriteUInt32(customization.ChrCustomizationChoiceID);
|
||||
}
|
||||
|
||||
foreach (var mailSenderType in MailSenderTypes)
|
||||
data.WriteUInt32(mailSenderType);
|
||||
|
||||
data.WriteBits(Name.GetByteCount(), 6);
|
||||
data.WriteBit(FirstLogin);
|
||||
data.WriteBit(BoostInProgress);
|
||||
data.WriteBits(unkWod61x, 5);
|
||||
data.WriteBit(RpeResetAvailable);
|
||||
data.WriteBit(RpeResetQuestClearAvailable);
|
||||
|
||||
foreach (string str in MailSenders)
|
||||
data.WriteBits(str.GetByteCount() + 1, 6);
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
foreach (string str in MailSenders)
|
||||
if (!str.IsEmpty())
|
||||
data.WriteCString(str);
|
||||
|
||||
data.WriteString(Name);
|
||||
}
|
||||
|
||||
public ObjectGuid Guid;
|
||||
public uint VirtualRealmAddress;
|
||||
public ulong GuildClubMemberID; // same as bgs.protocol.club.v1.MemberId.unique_id, guessed basing on SMSG_QUERY_PLAYER_NAME_RESPONSE (that one is known)
|
||||
public string Name;
|
||||
public byte ListPosition; // Order of the characters in list
|
||||
@@ -248,7 +247,6 @@ namespace Game.Networking.Packets
|
||||
public CharacterFlags Flags; // Character flag @see enum CharacterFlags
|
||||
public CharacterCustomizeFlags Flags2; // Character customization flags @see enum CharacterCustomizeFlags
|
||||
public uint Flags3; // Character flags 3 @todo research
|
||||
public uint Flags4;
|
||||
public bool FirstLogin;
|
||||
public byte unkWod61x;
|
||||
public long LastPlayedTime;
|
||||
@@ -260,24 +258,20 @@ namespace Game.Networking.Packets
|
||||
public uint PetCreatureDisplayId;
|
||||
public uint PetExperienceLevel;
|
||||
public uint PetCreatureFamilyId;
|
||||
public bool BoostInProgress; // @todo
|
||||
public uint[] ProfessionIds = new uint[2]; // @todo
|
||||
public VisualItemInfo[] VisualItems = new VisualItemInfo[19];
|
||||
public List<string> MailSenders = new();
|
||||
public List<uint> MailSenderTypes = new();
|
||||
public bool RpeResetAvailable = false;
|
||||
public bool RpeResetQuestClearAvailable = false;
|
||||
public CustomTabardInfo PersonalTabard = new();
|
||||
public CustomTabardInfo PersonalTabard;
|
||||
|
||||
public struct VisualItemInfo
|
||||
{
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteUInt32(DisplayId);
|
||||
data.WriteUInt32(DisplayEnchantId);
|
||||
data.WriteUInt32(SecondaryItemModifiedAppearanceID);
|
||||
data.WriteUInt8(InvType);
|
||||
data.WriteUInt32(DisplayEnchantId);
|
||||
data.WriteUInt8(Subclass);
|
||||
data.WriteUInt32(SecondaryItemModifiedAppearanceID);
|
||||
data.WriteUInt32(ItemID);
|
||||
}
|
||||
|
||||
public uint DisplayId;
|
||||
@@ -285,6 +279,7 @@ namespace Game.Networking.Packets
|
||||
public uint SecondaryItemModifiedAppearanceID; // also -1 is some special value
|
||||
public byte InvType;
|
||||
public byte Subclass;
|
||||
public uint ItemID;
|
||||
}
|
||||
|
||||
public struct PetInfo
|
||||
@@ -295,6 +290,85 @@ namespace Game.Networking.Packets
|
||||
}
|
||||
}
|
||||
|
||||
public class CharacterRestrictionAndMailData
|
||||
{
|
||||
public bool BoostInProgress; ///< @todo
|
||||
public uint Flags4;
|
||||
public List<string> MailSenders = new();
|
||||
public List<uint> MailSenderTypes = new();
|
||||
public bool RpeResetAvailable;
|
||||
public bool RpeResetQuestClearAvailable;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
Cypher.Assert(MailSenders.Count == MailSenderTypes.Count);
|
||||
|
||||
data.WriteBit(BoostInProgress);
|
||||
data.WriteBit(RpeResetAvailable);
|
||||
data.WriteBit(RpeResetQuestClearAvailable);
|
||||
data.FlushBits();
|
||||
|
||||
data.WriteUInt32(Flags4);
|
||||
data.WriteInt32(MailSenders.Count);
|
||||
data.WriteInt32(MailSenderTypes.Count);
|
||||
|
||||
if (!MailSenderTypes.Empty())
|
||||
foreach (var type in MailSenderTypes)
|
||||
data.WriteUInt32(type);
|
||||
|
||||
foreach (string str in MailSenders)
|
||||
data.WriteBits(str.GetByteCount() + 1, 6);
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
foreach (string str in MailSenders)
|
||||
if (!str.IsEmpty())
|
||||
data.WriteCString(str);
|
||||
}
|
||||
}
|
||||
|
||||
public struct CharacterInfo
|
||||
{
|
||||
public CharacterInfoBasic Basic;
|
||||
public CharacterRestrictionAndMailData RestrictionsAndMails;
|
||||
|
||||
public CharacterInfo(SQLFields fields)
|
||||
{
|
||||
Basic = new(fields);
|
||||
}
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
Basic.Write(data);
|
||||
RestrictionsAndMails.Write(data);
|
||||
}
|
||||
}
|
||||
|
||||
public struct RegionwideCharacterListEntry
|
||||
{
|
||||
public CharacterInfoBasic Basic;
|
||||
public ulong Money;
|
||||
public float CurrentSeasonMythicPlusOverallScore;
|
||||
public uint CurrentSeasonBestPvpRating;
|
||||
public sbyte PvpRatingBracket;
|
||||
public short PvpRatingAssociatedSpecID;
|
||||
|
||||
public RegionwideCharacterListEntry(SQLFields fields)
|
||||
{
|
||||
Basic = new(fields);
|
||||
}
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
Basic.Write(data);
|
||||
data.WriteUInt64(Money);
|
||||
data.WriteFloat(CurrentSeasonMythicPlusOverallScore);
|
||||
data.WriteUInt32(CurrentSeasonBestPvpRating);
|
||||
data.WriteInt8(PvpRatingBracket);
|
||||
data.WriteInt16(PvpRatingAssociatedSpecID);
|
||||
}
|
||||
}
|
||||
|
||||
public struct RaceUnlock
|
||||
{
|
||||
public void Write(WorldPacket data)
|
||||
@@ -883,6 +957,7 @@ namespace Game.Networking.Packets
|
||||
NewSex = _worldPacket.ReadUInt8();
|
||||
CustomizedRace = _worldPacket.ReadInt32();
|
||||
CustomizedChrModelID = _worldPacket.ReadInt32();
|
||||
UnalteredVisualRaceID = _worldPacket.ReadInt32();
|
||||
|
||||
for (var i = 0; i < customizationCount; ++i)
|
||||
{
|
||||
@@ -900,6 +975,7 @@ namespace Game.Networking.Packets
|
||||
public Array<ChrCustomizationChoice> Customizations = new(250);
|
||||
public int CustomizedRace;
|
||||
public int CustomizedChrModelID;
|
||||
public int UnalteredVisualRaceID;
|
||||
}
|
||||
|
||||
public class BarberShopResult : ServerPacket
|
||||
@@ -1211,4 +1287,38 @@ namespace Game.Networking.Packets
|
||||
BackgroundColor = data.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
public struct WarbandGroupMember
|
||||
{
|
||||
public int WarbandScenePlacementID;
|
||||
public int Type;
|
||||
public ObjectGuid Guid;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteInt32(WarbandScenePlacementID);
|
||||
data.WriteInt32(Type);
|
||||
if (Type == 0)
|
||||
data.WritePackedGuid(Guid);
|
||||
}
|
||||
}
|
||||
|
||||
public class WarbandGroup
|
||||
{
|
||||
public ulong GroupID;
|
||||
public byte Unknown_1100;
|
||||
public int Flags; ///< enum WarbandGroupFlags { Collapsed = 1 }
|
||||
public List<WarbandGroupMember> Members = new();
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteUInt64(GroupID);
|
||||
data.WriteUInt8(Unknown_1100);
|
||||
data.WriteInt32(Flags);
|
||||
data.WriteInt32(Members.Count);
|
||||
|
||||
foreach (WarbandGroupMember member in Members)
|
||||
member.Write(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user