M Core/NosSmooth.Game/PacketHandlers/Relations/FriendInitResponder.cs => Core/NosSmooth.Game/PacketHandlers/Relations/FriendInitResponder.cs +4 -3
@@ 40,10 40,11 @@ public class FriendInitResponder : IPacketResponder<FInfoPacket>, IPacketRespond
.Select(
x =>
{
- if (x.PlayerId == packet.PlayerId)
+ var subPacket = packet.FriendSubPackets.FirstOrDefault(y => x.PlayerId == y.PlayerId);
+ if (subPacket is not null)
{
- x.IsConnected = packet.IsConnected;
- x.CharacterName = packet.Name;
+ x.IsConnected = subPacket.IsConnected;
+ x.CharacterName = subPacket.Name;
}
return x;
M Packets/NosSmooth.Packets/Server/Groups/PinitMateSubPacket.cs => Packets/NosSmooth.Packets/Server/Groups/PinitMateSubPacket.cs +2 -0
@@ 20,6 20,8 @@ namespace NosSmooth.Packets.Server.Groups;
/// <param name="Name">The name of the mate.</param>
/// <param name="Unknown">Unknown TODO.</param>
/// <param name="VNum">The VNum of the mate entity.</param>
+[PacketHeader(null, PacketSource.Server)]
+[GenerateSerializer(true)]
public record PinitMateSubPacket
(
[PacketIndex(0)]
M Packets/NosSmooth.Packets/Server/Relations/FInfoPacket.cs => Packets/NosSmooth.Packets/Server/Relations/FInfoPacket.cs +4 -9
@@ 12,16 12,11 @@ namespace NosSmooth.Packets.Server.Relations;
/// <summary>
/// Information update of friend of a character.
/// </summary>
-/// <param name="PlayerId">The id of the friend.</param>
-/// <param name="IsConnected">Whether the friend is connected.</param>
-/// <param name="Name">The name of the friend.</param>[PacketHeader("finfo", PacketSource.Server)]
+/// <param name="FriendSubPackets"></param>
+[PacketHeader("finfo", PacketSource.Server)]
[GenerateSerializer(true)]
public record FInfoPacket
(
- [PacketIndex(0)]
- long PlayerId,
- [PacketIndex(1)]
- bool IsConnected,
- [PacketIndex(2)]
- NameString Name
+ [PacketListIndex(0, InnerSeparator = '.', ListSeparator = ' ')]
+ IReadOnlyList<FInfoSubPacket> FriendSubPackets
) : IPacket;=
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Relations/FInfoSubPacket.cs => Packets/NosSmooth.Packets/Server/Relations/FInfoSubPacket.cs +29 -0
@@ 0,0 1,29 @@
+//
+// FInfoSubPacket.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.PacketSerializer.Abstractions.Attributes;
+using NosSmooth.PacketSerializer.Abstractions.Common;
+
+namespace NosSmooth.Packets.Server.Relations;
+
+/// <summary>
+/// A sub packet of <see cref="FInfoPacket"/>
+/// containing information about a friend.
+/// </summary>
+/// <param name="PlayerId">The id of the player.</param>
+/// <param name="IsConnected">Whether the player is connected.</param>
+/// <param name="Name">The name of the player.</param>
+[PacketHeader(null, PacketSource.Server)]
+[GenerateSerializer(true)]
+public record FInfoSubPacket
+(
+ [PacketIndex(0)]
+ long PlayerId,
+ [PacketIndex(1)]
+ bool IsConnected,
+ [PacketIndex(2)]
+ NameString Name
+);<
\ No newline at end of file