A Packets/NosSmooth.Packets/Enums/Raids/RaidLeaveType.cs => Packets/NosSmooth.Packets/Enums/Raids/RaidLeaveType.cs +26 -0
@@ 0,0 1,26 @@
+//
+// RaidLeaveType.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.Server.Raids;
+
+namespace NosSmooth.Packets.Enums.Raids;
+
+/// <summary>
+/// A sub type of <see cref="RaidPacket"/>
+/// in case the type of the packet is Leave.
+/// </summary>
+public enum RaidLeaveType
+{
+ /// <summary>
+ /// The player has left the raid by himself.
+ /// </summary>
+ PlayerLeft = 0,
+
+ /// <summary>
+ /// The raid is finished.
+ /// </summary>
+ RaidFinished = 1
+}<
\ No newline at end of file
A Packets/NosSmooth.Packets/Enums/Raids/RaidPacketType.cs => Packets/NosSmooth.Packets/Enums/Raids/RaidPacketType.cs +45 -0
@@ 0,0 1,45 @@
+//
+// RaidPacketType.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.Server.Raids;
+
+namespace NosSmooth.Packets.Enums.Raids;
+
+/// <summary>
+/// A type of <see cref="RaidPacket"/>.
+/// </summary>
+public enum RaidPacketType
+{
+ /// <summary>
+ /// A list of member ids follows.
+ /// </summary>
+ ListMembers = 0,
+
+ /// <summary>
+ /// Character left or the raid is finished.
+ /// </summary>
+ Leave = 1,
+
+ /// <summary>
+ /// Leader id follows (or -1 in case of leave).
+ /// </summary>
+ Leader = 2,
+
+ /// <summary>
+ /// Hp, mp stats of players follow.
+ /// </summary>
+ PlayerHealths = 3,
+
+ /// <summary>
+ /// Sent after raid start, but before refresh members.
+ /// </summary>
+ AfterStartBeforeRefreshMembers = 4,
+
+ /// <summary>
+ /// Raid has just started.
+ /// </summary>
+ Start = 5
+}<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RaidBfPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RaidBfPacket.cs +27 -0
@@ 0,0 1,27 @@
+//
+// RaidBfPacket.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;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// Raid ui packet. Unknown function.
+/// </summary>
+/// <param name="Type">Unknown TODO.</param>
+/// <param name="WindowType">Unknown TODO.</param>
+/// <param name="Unknown">Unknown TODO.</param>
+[PacketHeader("raidbf", PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RaidBfPacket
+(
+ [PacketIndex(0)]
+ byte Type,
+ [PacketIndex(1)]
+ byte WindowType,
+ [PacketIndex(2)]
+ byte Unknown
+);<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RaidMbfPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RaidMbfPacket.cs +36 -0
@@ 0,0 1,36 @@
+//
+// RaidMbfPacket.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;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// Raid state of lives, lockers.
+/// </summary>
+/// <param name="MonsterLockerInitial"></param>
+/// <param name="MonsterLockerCurrent"></param>
+/// <param name="ButtonLockerInitial"></param>
+/// <param name="ButtonLockerCurrent"></param>
+/// <param name="CurrentLives"></param>
+/// <param name="InitialLives"></param>
+[PacketHeader("raidmbf", PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RaidMbfPacket
+(
+ [PacketIndex(0)]
+ short MonsterLockerInitial,
+ [PacketIndex(1)]
+ short MonsterLockerCurrent,
+ [PacketIndex(2)]
+ short ButtonLockerInitial,
+ [PacketIndex(3)]
+ short ButtonLockerCurrent,
+ [PacketIndex(4)]
+ short CurrentLives,
+ [PacketIndex(5)]
+ short InitialLives
+) : IPacket;<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RaidPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RaidPacket.cs +39 -0
@@ 0,0 1,39 @@
+//
+// RaidPacket.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.Raids;
+using NosSmooth.PacketSerializer.Abstractions.Attributes;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// Raid status packet. Sent for various raid operations.
+/// </summary>
+/// <remarks>
+/// For every type the rest of the packet is different.
+/// Fields start with the type they are present for.
+/// </remarks>
+/// <param name="Type">The status type.</param>
+/// <param name="LeaderId">The id of the leader, null if leaving. Present only for Leader type.</param>
+/// <param name="LeaveType">The type of the leave type. Present only for Leave type.</param>
+/// <param name="ListMembersPlayerIds">The ids of players in the raid. Present only for ListMembers.</param>
+/// <param name="PlayerHealths">Health of the players. Present only for PlayerHealths.</param>
+[PacketHeader("raid", PacketSource.Server)]
+[PacketHeader("raidf", PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RaidPacket
+(
+ [PacketIndex(0)]
+ RaidPacketType Type,
+ [PacketConditionalIndex(1, "Type", false, RaidPacketType.Leader, IsOptional = true)]
+ long? LeaderId,
+ [PacketConditionalIndex(2, "Type", false, RaidPacketType.Leave, IsOptional = true)]
+ RaidLeaveType? LeaveType,
+ [PacketConditionalListIndex(3, "Type", false, RaidPacketType.ListMembers, ListSeparator = ' ', IsOptional = true)]
+ IReadOnlyList<long>? ListMembersPlayerIds,
+ [PacketConditionalListIndex(4, "Type", false, RaidPacketType.PlayerHealths, InnerSeparator = '.', ListSeparator = ' ', IsOptional = true)]
+ IReadOnlyList<RaidPlayerHealthsSubPacket>? PlayerHealths
+) : IPacket;<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RaidPlayerHealthsSubPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RaidPlayerHealthsSubPacket.cs +29 -0
@@ 0,0 1,29 @@
+//
+// RaidPlayerHealthsSubPacket.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;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// A sub packet of <see cref="RaidPacket"/>
+/// present for PlayerHealths. Contains
+/// information about player healths.
+/// </summary>
+/// <param name="PlayerId">The id of the player.</param>
+/// <param name="HpPercentage">The hp percentage of the player.</param>
+/// <param name="MpPercentage">The mp percentage of the player.</param>
+[PacketHeader(null, PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RaidPlayerHealthsSubPacket
+(
+ [PacketIndex(0)]
+ long PlayerId,
+ [PacketIndex(1)]
+ byte HpPercentage,
+ [PacketIndex(2)]
+ byte MpPercentage
+) : IPacket;<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RbossPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RbossPacket.cs +34 -0
@@ 0,0 1,34 @@
+//
+// RbossPacket.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.PacketSerializer.Abstractions.Attributes;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// Raid boss information.
+/// </summary>
+/// <remarks>
+/// EntityType and EntityId will be null in case of no boss.
+/// </remarks>
+/// <param name="EntityType">The boss entity type.</param>
+/// <param name="EntityId">The boss entity id.</param>
+/// <param name="MaxHp">The max hp of the boss.</param>
+/// <param name="VNum">The vnum of the boss entity.</param>
+[PacketHeader("rboss", PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RbossPacket
+(
+ [PacketIndex(0)]
+ EntityType? EntityType,
+ [PacketIndex(1)]
+ long? EntityId,
+ [PacketIndex(2)]
+ int MaxHp,
+ [PacketIndex(3)]
+ int VNum
+) : IPacket;<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RdlstPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RdlstPacket.cs +31 -0
@@ 0,0 1,31 @@
+//
+// RdlstPacket.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;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// A packet containing information about raid members.
+/// </summary>
+/// <param name="MinimumLevel">The minimum needed level for the raid treasure.</param>
+/// <param name="MaximumLevel">The maximum needed level for the raid treasure.</param>
+/// <param name="RaidType">Unknown TODO.</param>
+/// <param name="Players">Information about members in the raid.</param>
+[PacketHeader("rdlst", PacketSource.Server)]
+[PacketHeader("rdlstf", PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RdlstPacket
+(
+ [PacketIndex(0)]
+ byte MinimumLevel,
+ [PacketIndex(1)]
+ byte MaximumLevel,
+ [PacketIndex(2)]
+ byte RaidType,
+ [PacketIndex(3)]
+ IReadOnlyList<RdlstSubPacket> Players
+) : IPacket;<
\ No newline at end of file
A Packets/NosSmooth.Packets/Server/Raids/RdlstSubPacket.cs => Packets/NosSmooth.Packets/Server/Raids/RdlstSubPacket.cs +45 -0
@@ 0,0 1,45 @@
+//
+// RdlstSubPacket.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.Players;
+using NosSmooth.PacketSerializer.Abstractions.Attributes;
+using NosSmooth.PacketSerializer.Abstractions.Common;
+
+namespace NosSmooth.Packets.Server.Raids;
+
+/// <summary>
+/// A sub packet of <see cref="RdlstPacket"/>.
+/// Information about a member of the raid.
+/// </summary>
+/// <param name="Level">The level of the player.</param>
+/// <param name="MorphVNum">The morph vnum of the player.</param>
+/// <param name="Class">The class of the player.</param>
+/// <param name="Deaths">The current number of deaths in the raid.</param>
+/// <param name="Name">The name of the player.</param>
+/// <param name="Sex">The sex of the player.</param>
+/// <param name="Id">The id of the player entity.</param>
+/// <param name="HeroLevel">The hero level of the player.</param>
+[PacketHeader(null, PacketSource.Server)]
+[GenerateSerializer(true)]
+public record RdlstSubPacket
+(
+ [PacketIndex(0)]
+ byte Level,
+ [PacketIndex(1)]
+ int? MorphVNum,
+ [PacketIndex(2)]
+ PlayerClass Class,
+ [PacketIndex(3)]
+ byte Deaths,
+ [PacketIndex(4)]
+ NameString Name,
+ [PacketIndex(5)]
+ SexType Sex,
+ [PacketIndex(6)]
+ long Id,
+ [PacketIndex(7)]
+ short? HeroLevel
+);<
\ No newline at end of file