~ruther/NosSmooth

17c04fd4d57f31de016e46c178d5368013063f5f — Rutherther 2 years ago 3c40a90
feat(packets): add party stat packet
4 files changed, 83 insertions(+), 4 deletions(-)

A Packets/NosSmooth.Packets/Enums/Mates/MateType.cs
R Packets/NosSmooth.Packets/Server/Entities/{StSubPacket.cs => EffectsSubPacket.cs}
M Packets/NosSmooth.Packets/Server/Entities/StPacket.cs
A Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs
A Packets/NosSmooth.Packets/Enums/Mates/MateType.cs => Packets/NosSmooth.Packets/Enums/Mates/MateType.cs +23 -0
@@ 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;

/// <summary>
/// A type of a mate.
/// </summary>
public enum MateType
{
    /// <summary>
    /// The mate is a partner.
    /// </summary>
    Partner = 0,

    /// <summary>
    /// The mate is a pet.
    /// </summary>
    Pet = 1
}
\ No newline at end of file

R Packets/NosSmooth.Packets/Server/Entities/StSubPacket.cs => Packets/NosSmooth.Packets/Server/Entities/EffectsSubPacket.cs +3 -3
@@ 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;
/// <param name="Level">The buff level.</param>
[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

M Packets/NosSmooth.Packets/Server/Entities/StPacket.cs => Packets/NosSmooth.Packets/Server/Entities/StPacket.cs +1 -1
@@ 43,5 43,5 @@ public record StPacket
    [PacketIndex(7)]
    long Mp,
    [PacketListIndex(8, ListSeparator = ' ', InnerSeparator = '.', IsOptional = true)]
    IReadOnlyList<StSubPacket>? BuffVNums
    IReadOnlyList<EffectsSubPacket>? BuffVNums
) : IPacket;
\ No newline at end of file

A Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs => Packets/NosSmooth.Packets/Server/Groups/PstPacket.cs +56 -0
@@ 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;

/// <summary>
/// Party status packet.
/// </summary>
/// <param name="EntityType">The type of the entity.</param>
/// <param name="GroupPosition">The position in the group of the entity</param>
/// <param name="HpPercentage">The hp percentage of the entity.</param>
/// <param name="MpPercentage">The mp percentage of the entity.</param>
/// <param name="Hp">The hp of the entity.</param>
/// <param name="Mp">The mp of the entity.</param>
/// <param name="PlayerClass">The player class, present for player.</param>
/// <param name="PlayerSex">The sex of the player, present for player.</param>
/// <param name="PlayerMorphVNum">The player morph vnum, present for player.</param>
/// <param name="Effects">The effects vnums.</param>
[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<EffectsSubPacket>? Effects
) : IPacket;
\ No newline at end of file

Do not follow this link