From 17c04fd4d57f31de016e46c178d5368013063f5f Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 6 Jan 2023 22:57:08 +0100 Subject: [PATCH] feat(packets): add party stat packet --- .../NosSmooth.Packets/Enums/Mates/MateType.cs | 23 ++++++++ .../{StSubPacket.cs => EffectsSubPacket.cs} | 6 +- .../Server/Entities/StPacket.cs | 2 +- .../Server/Groups/PstPacket.cs | 56 +++++++++++++++++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 Packets/NosSmooth.Packets/Enums/Mates/MateType.cs rename Packets/NosSmooth.Packets/Server/Entities/{StSubPacket.cs => EffectsSubPacket.cs} (90%) create mode 100644 Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs diff --git a/Packets/NosSmooth.Packets/Enums/Mates/MateType.cs b/Packets/NosSmooth.Packets/Enums/Mates/MateType.cs new file mode 100644 index 0000000..cac1f3e --- /dev/null +++ b/Packets/NosSmooth.Packets/Enums/Mates/MateType.cs @@ -0,0 +1,23 @@ +// +// MateType.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. + +namespace NosSmooth.Packets.Enums.Mates; + +/// +/// A type of a mate. +/// +public enum MateType +{ + /// + /// The mate is a partner. + /// + Partner = 0, + + /// + /// The mate is a pet. + /// + Pet = 1 +} \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Entities/StSubPacket.cs b/Packets/NosSmooth.Packets/Server/Entities/EffectsSubPacket.cs similarity index 90% rename from Packets/NosSmooth.Packets/Server/Entities/StSubPacket.cs rename to Packets/NosSmooth.Packets/Server/Entities/EffectsSubPacket.cs index 0977a89..84ad65d 100644 --- a/Packets/NosSmooth.Packets/Server/Entities/StSubPacket.cs +++ b/Packets/NosSmooth.Packets/Server/Entities/EffectsSubPacket.cs @@ -1,5 +1,5 @@ // -// StSubPacket.cs +// EffectsSubPacket.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. @@ -15,10 +15,10 @@ namespace NosSmooth.Packets.Server.Entities; /// The buff level. [PacketHeader(null, PacketSource.Server)] [GenerateSerializer(true)] -public record StSubPacket +public record EffectsSubPacket ( [PacketIndex(0)] - short CardId, + long CardId, [PacketIndex(1, IsOptional = true)] short? Level ) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Entities/StPacket.cs b/Packets/NosSmooth.Packets/Server/Entities/StPacket.cs index 5e03ea9..272895b 100644 --- a/Packets/NosSmooth.Packets/Server/Entities/StPacket.cs +++ b/Packets/NosSmooth.Packets/Server/Entities/StPacket.cs @@ -43,5 +43,5 @@ public record StPacket [PacketIndex(7)] long Mp, [PacketListIndex(8, ListSeparator = ' ', InnerSeparator = '.', IsOptional = true)] - IReadOnlyList? BuffVNums + IReadOnlyList? BuffVNums ) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs b/Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs new file mode 100644 index 0000000..0aa48f3 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs @@ -0,0 +1,56 @@ +// +// PstPacket.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.Packets.Enums.Entities; +using NosSmooth.Packets.Enums.Mates; +using NosSmooth.Packets.Enums.Players; +using NosSmooth.Packets.Server.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Groups; + +/// +/// Party status packet. +/// +/// The type of the entity. +/// The position in the group of the entity +/// The hp percentage of the entity. +/// The mp percentage of the entity. +/// The hp of the entity. +/// The mp of the entity. +/// The player class, present for player. +/// The sex of the player, present for player. +/// The player morph vnum, present for player. +/// The effects vnums. +[PacketHeader("pst", PacketSource.Server)] +[GenerateSerializer(true)] +public record PstPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketConditionalIndex(2, "EntityType", false, EntityType.Player)] + byte? GroupPosition, + [PacketConditionalIndex(3, "EntityType", false, EntityType.Npc)] + MateType? MateType, + [PacketIndex(4)] + byte HpPercentage, + [PacketIndex(5)] + byte MpPercentage, + [PacketIndex(6)] + int Hp, + [PacketIndex(7)] + int Mp, + [PacketIndex(8)] + PlayerClass? PlayerClass, + [PacketIndex(9)] + SexType? PlayerSex, + [PacketIndex(10)] + long? PlayerMorphVNum, + [PacketIndex(11, IsOptional = true)] + IReadOnlyList? Effects +) : IPacket; \ No newline at end of file -- 2.49.0