From d9e813205945be1df45fedad963254f835e5baef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 15 Jan 2023 19:50:04 +0100 Subject: [PATCH] feat(packets): add buff, chat, raid, teleport, mates control packets --- .../Client/Mates/PtctlPacket.cs | 27 +++++++++++ .../Client/Mates/PtctlSubPacket.cs | 27 +++++++++++ .../Client/Mates/SuctlPacket.cs | 34 ++++++++++++++ .../Client/Movement/GuriPacket.cs | 33 +++++++++++++ .../NosSmooth.Packets/Enums/Chat/SpeakType.cs | 25 ++++++++++ .../Server/Battle/CtPacket.cs | 42 +++++++++++++++++ .../Server/Battle/DmPacket.cs | 28 +++++++++++ .../Server/Battle/RcPacket.cs | 31 +++++++++++++ .../Server/Buffs/BfEPacket.cs | 31 +++++++++++++ .../Server/Buffs/BfPacket.cs | 32 +++++++++++++ .../Server/Buffs/BfSubPacket.cs | 27 +++++++++++ .../Server/Buffs/VbPacket.cs | 27 +++++++++++ .../Server/Chat/InfoiPacket.cs | 25 ++++++++++ .../Server/Chat/Msgi2Packet.cs | 33 +++++++++++++ .../Server/Chat/MsgiPacket.cs | 32 +++++++++++++ .../Server/Chat/Sayi2Packet.cs | 36 +++++++++++++++ .../Server/Chat/SayiPacket.cs | 36 +++++++++++++++ .../Server/Chat/SayitemtPacket.cs | 46 +++++++++++++++++++ .../Server/Chat/SaytPacket.cs | 36 +++++++++++++++ .../Server/Chat/SpkPacket.cs | 36 +++++++++++++++ .../Server/Entities/CharScPacket.cs | 28 +++++++++++ .../Server/Entities/DiePacket.cs | 31 +++++++++++++ .../Server/Maps/DropPacket.cs | 2 +- .../Server/Maps/MapclearPacket.cs | 16 +++++++ .../Server/Maps/MapoutPacket.cs | 16 +++++++ .../Server/Maps/ThrowPacket.cs | 42 +++++++++++++++++ .../NosSmooth.Packets/Server/Maps/TpPacket.cs | 35 ++++++++++++++ .../Server/Mates/CtlPacket.cs | 31 +++++++++++++ .../Server/Raids/RaidfHpSubPacket.cs | 25 ++++++++++ .../Server/Raids/RaidfhpPacket.cs | 26 +++++++++++ .../Server/Raids/RaidfmpPacket.cs | 26 +++++++++++ .../Server/UI/DelayPacket.cs | 30 ++++++++++++ .../NosSmooth.Packets/Server/UI/RestPacket.cs | 28 +++++++++++ 33 files changed, 979 insertions(+), 1 deletion(-) create mode 100644 Packets/NosSmooth.Packets/Client/Mates/PtctlPacket.cs create mode 100644 Packets/NosSmooth.Packets/Client/Mates/PtctlSubPacket.cs create mode 100644 Packets/NosSmooth.Packets/Client/Mates/SuctlPacket.cs create mode 100644 Packets/NosSmooth.Packets/Client/Movement/GuriPacket.cs create mode 100644 Packets/NosSmooth.Packets/Enums/Chat/SpeakType.cs create mode 100644 Packets/NosSmooth.Packets/Server/Battle/CtPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Battle/DmPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Battle/RcPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Buffs/BfEPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Buffs/BfPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Buffs/BfSubPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Buffs/VbPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/InfoiPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/Msgi2Packet.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/MsgiPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/Sayi2Packet.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/SayiPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/SayitemtPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/SaytPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Chat/SpkPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Entities/CharScPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Entities/DiePacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Maps/MapclearPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Maps/MapoutPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Maps/ThrowPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Maps/TpPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Mates/CtlPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Raids/RaidfHpSubPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Raids/RaidfhpPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Raids/RaidfmpPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/UI/DelayPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/UI/RestPacket.cs diff --git a/Packets/NosSmooth.Packets/Client/Mates/PtctlPacket.cs b/Packets/NosSmooth.Packets/Client/Mates/PtctlPacket.cs new file mode 100644 index 0000000..4c78315 --- /dev/null +++ b/Packets/NosSmooth.Packets/Client/Mates/PtctlPacket.cs @@ -0,0 +1,27 @@ +// +// PtctlPacket.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.Client.Mates; + +/// +/// A mate move packet, moving multiple mates at a time. +/// +/// The current map id. +/// The count of controls in array. +/// The array containing the mates to move and positions to move them to. +[PacketHeader("ptctl", PacketSource.Server)] +[GenerateSerializer(true)] +public record PtctlPacket +( + [PacketIndex(0)] + short MapId, + [PacketIndex(1)] + uint? ControlsCount, + [PacketContextList(2, "Amount", ListSeparator = ' ')] + IReadOnlyList Controls +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Client/Mates/PtctlSubPacket.cs b/Packets/NosSmooth.Packets/Client/Mates/PtctlSubPacket.cs new file mode 100644 index 0000000..7ddf3af --- /dev/null +++ b/Packets/NosSmooth.Packets/Client/Mates/PtctlSubPacket.cs @@ -0,0 +1,27 @@ +// +// PtctlSubPacket.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.Client.Mates; + +/// +/// A sub packet of . +/// +/// The id of the mate. +/// The x coordinate to move to. +/// The y coordinate to move to. +[PacketHeader(null, PacketSource.Server)] +[GenerateSerializer(true)] +public record PtctlSubPacket +( + [PacketIndex(0)] + long MateTransportId, + [PacketIndex(1)] + short PositionX, + [PacketIndex(2)] + short PositionY +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Client/Mates/SuctlPacket.cs b/Packets/NosSmooth.Packets/Client/Mates/SuctlPacket.cs new file mode 100644 index 0000000..2204e8e --- /dev/null +++ b/Packets/NosSmooth.Packets/Client/Mates/SuctlPacket.cs @@ -0,0 +1,34 @@ +// +// SuctlPacket.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.Client.Mates; + +/// +/// Attack with the given mate. +/// +/// The id of the skill cast. +/// The type of the mate entity. +/// The id of the mate. +/// The entity type of the target. +/// The id of the target. +[PacketHeader("suctl", PacketSource.Server)] +[GenerateSerializer(true)] +public record SuctlPacket +( + [PacketIndex(0)] + int CastId, + [PacketIndex(1)] + EntityType EntityType, + [PacketIndex(2)] + int MateTransportId, + [PacketIndex(3)] + EntityType TargetType, + [PacketIndex(4)] + long TargetId +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Client/Movement/GuriPacket.cs b/Packets/NosSmooth.Packets/Client/Movement/GuriPacket.cs new file mode 100644 index 0000000..dd14e20 --- /dev/null +++ b/Packets/NosSmooth.Packets/Client/Movement/GuriPacket.cs @@ -0,0 +1,33 @@ +// +// GuriPacket.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.Client.Movement; + +/// +/// Dancing packet. +/// +/// The type of the guri packet. +/// The argument. +/// The id of the entity. +/// The data. +/// The value. +[PacketHeader("guri", PacketSource.Client)] +[GenerateSerializer(true)] +public record GuriPacket +( + [PacketIndex(0)] + int Type, + [PacketIndex(1, IsOptional = true)] + int? Argument, + [PacketIndex(2, IsOptional = true)] + long? EntityId, + [PacketIndex(3, IsOptional = true)] + long? Data, + [PacketIndex(4, IsOptional = true)] + string? Value +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Enums/Chat/SpeakType.cs b/Packets/NosSmooth.Packets/Enums/Chat/SpeakType.cs new file mode 100644 index 0000000..d5fdc65 --- /dev/null +++ b/Packets/NosSmooth.Packets/Enums/Chat/SpeakType.cs @@ -0,0 +1,25 @@ +// +// SpeakType.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 System.Diagnostics.CodeAnalysis; +using NosSmooth.Packets.Server.Chat; +#pragma warning disable CS1591 + +namespace NosSmooth.Packets.Enums.Chat; + +/// +/// A type of . +/// +[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Self-explanatory.")] +public enum SpeakType +{ + Normal = 0, + Family = 1, + Group = 3, + Player = 5, + TimeSpace = 7, + GameMaster = 15 +} \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Battle/CtPacket.cs b/Packets/NosSmooth.Packets/Server/Battle/CtPacket.cs new file mode 100644 index 0000000..4b1ad99 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Battle/CtPacket.cs @@ -0,0 +1,42 @@ +// +// CtPacket.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.Battle; + +/// +/// A skill cast animation has begun. +/// or will be sent after +/// the skill is casted. (after cast time.) +/// +/// The type of the caster entity. +/// The entity id of the caster. +/// The type of the target entity. +/// The entity id of the target. +/// The id of the cast animation. +/// The id of teh cast effect. +/// The VNum of the used skill. +[PacketHeader("ct", PacketSource.Server)] +[GenerateSerializer(true)] +public record CtPacket +( + [PacketIndex(0)] + EntityType CasterEntityType, + [PacketIndex(1)] + long CasterEntityId, + [PacketIndex(2)] + EntityType TargetEntityType, + [PacketIndex(3)] + long? TargetEntityId, + [PacketIndex(4)] + short? CastAnimation, + [PacketIndex(5)] + short? CastEffect, + [PacketIndex(6)] + int? SkillVNum +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Battle/DmPacket.cs b/Packets/NosSmooth.Packets/Server/Battle/DmPacket.cs new file mode 100644 index 0000000..f8f2504 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Battle/DmPacket.cs @@ -0,0 +1,28 @@ +// +// DmPacket.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.Battle; + +/// +/// Damage has been dealt. +/// +/// The type of the entity. +/// The id of the entity. +/// The damage dealt. +[PacketHeader("dm", PacketSource.Server)] +[GenerateSerializer(true)] +public record DmPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + int Damage +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Battle/RcPacket.cs b/Packets/NosSmooth.Packets/Server/Battle/RcPacket.cs new file mode 100644 index 0000000..c91a117 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Battle/RcPacket.cs @@ -0,0 +1,31 @@ +// +// RcPacket.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.Battle; + +/// +/// A heal has been issued. +/// +/// The type of the entity. +/// The id of the entity. +/// The heal amount. +/// Unknown TODO. +[PacketHeader("rc", PacketSource.Server)] +[GenerateSerializer(true)] +public record RcPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + int Heal, + [PacketIndex(3)] + short Unknown +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Buffs/BfEPacket.cs b/Packets/NosSmooth.Packets/Server/Buffs/BfEPacket.cs new file mode 100644 index 0000000..f68fb47 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Buffs/BfEPacket.cs @@ -0,0 +1,31 @@ +// +// BfEPacket.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.Buffs; + +/// +/// A const buff effect. +/// +/// The type of the entity. +/// The id of the entity. +/// The buff card id. +/// The duration of the buff. +[PacketHeader("bf_e", PacketSource.Server)] +[GenerateSerializer(true)] +public record BfEPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + short CardId, + [PacketIndex(3)] + int Time +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Buffs/BfPacket.cs b/Packets/NosSmooth.Packets/Server/Buffs/BfPacket.cs new file mode 100644 index 0000000..8ca8dee --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Buffs/BfPacket.cs @@ -0,0 +1,32 @@ +// +// BfPacket.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.Server.Maps; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Buffs; + +/// +/// A buff effect has been added. +/// +/// The type of the entity. +/// The id of the entity. +/// The sub packet containing information about a buff. +/// The level of the caster. +[PacketHeader("bf", PacketSource.Server)] +[GenerateSerializer(true)] +public record BfPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2, InnerSeparator = '.')] + BfSubPacket SubPacket, + [PacketIndex(3)] + short CasterLevel +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Buffs/BfSubPacket.cs b/Packets/NosSmooth.Packets/Server/Buffs/BfSubPacket.cs new file mode 100644 index 0000000..5ba9305 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Buffs/BfSubPacket.cs @@ -0,0 +1,27 @@ +// +// BfSubPacket.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.Buffs; + +/// +/// A sub packet of . +/// +/// Uknown TODO. +/// The buff card id. +/// The duration of the buff. +[PacketHeader(null, PacketSource.Server)] +[GenerateSerializer(true)] +public record BfSubPacket +( + [PacketIndex(0)] + int Charge, + [PacketIndex(1)] + short CardId, + [PacketIndex(2)] + int Time +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Buffs/VbPacket.cs b/Packets/NosSmooth.Packets/Server/Buffs/VbPacket.cs new file mode 100644 index 0000000..733ec6f --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Buffs/VbPacket.cs @@ -0,0 +1,27 @@ +// +// VbPacket.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.Buffs; + +/// +/// A static buff effect. +/// +/// The buff card id. +/// Whether the buff is active. +/// The duration of the buff. +[PacketHeader("vb", PacketSource.Server)] +[GenerateSerializer(true)] +public record VbPacket +( + [PacketIndex(0)] + short CardId, + [PacketIndex(1)] + bool IsActive, + [PacketIndex(2)] + int? Time +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/InfoiPacket.cs b/Packets/NosSmooth.Packets/Server/Chat/InfoiPacket.cs new file mode 100644 index 0000000..5138877 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/InfoiPacket.cs @@ -0,0 +1,25 @@ +// +// InfoiPacket.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; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// An information message. +/// +/// The message. +/// The arguments of the message constant. +[PacketHeader("infoi", PacketSource.Server)] +[GenerateSerializer(true)] +public record InfoiPacket +( + [PacketIndex(0)] + Game18NConstString MessageConst, + [PacketListIndex(1, ListSeparator = ' ')] + IReadOnlyList Arguments +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/Msgi2Packet.cs b/Packets/NosSmooth.Packets/Server/Chat/Msgi2Packet.cs new file mode 100644 index 0000000..ee51714 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/Msgi2Packet.cs @@ -0,0 +1,33 @@ +// +// Msgi2Packet.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; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.Packets.Enums.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// A constant i18n message received. +/// +/// +/// Same as . +/// +/// The type of the message. +/// The message. +/// The arguments of the message constant. +[PacketHeader("msgi2", PacketSource.Server)] +[GenerateSerializer(true)] +public record Msgi2Packet +( + [PacketIndex(0)] + MessageType MessageType, + [PacketIndex(1)] + Game18NConstString MessageConst, + [PacketListIndex(2, ListSeparator = ' ')] + IReadOnlyList Arguments +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/MsgiPacket.cs b/Packets/NosSmooth.Packets/Server/Chat/MsgiPacket.cs new file mode 100644 index 0000000..4bbaa1e --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/MsgiPacket.cs @@ -0,0 +1,32 @@ +// +// MsgiPacket.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; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// A constant i18n message received. +/// +/// +/// Same as . +/// +/// The type of the message. +/// The message. +/// The arguments of the message constant. +[PacketHeader("msgi", PacketSource.Server)] +[GenerateSerializer(true)] +public record MsgiPacket +( + [PacketIndex(0)] + MessageType MessageType, + [PacketIndex(1)] + Game18NConstString MessageConst, + [PacketListIndex(2, ListSeparator = ' ')] + IReadOnlyList Arguments +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/Sayi2Packet.cs b/Packets/NosSmooth.Packets/Server/Chat/Sayi2Packet.cs new file mode 100644 index 0000000..49cec1f --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/Sayi2Packet.cs @@ -0,0 +1,36 @@ +// +// Sayi2Packet.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; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.Packets.Enums.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// A message from an entity in chat. +/// +/// The type of the entity that spoke. +/// The id of the entity that spoke. +/// The say/message color. +/// The message constant. +/// The arguments of the message. +public record Sayi2Packet +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + SayColor Color, + [PacketIndex(3)] + Game18NConstString MessageConst, + [PacketIndex(4)] + short ParametersCount, + [PacketListIndex(5, ListSeparator = ' ')] + IReadOnlyList Parameters +); \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/SayiPacket.cs b/Packets/NosSmooth.Packets/Server/Chat/SayiPacket.cs new file mode 100644 index 0000000..8be757f --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/SayiPacket.cs @@ -0,0 +1,36 @@ +// +// SayiPacket.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; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.Packets.Enums.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// A message from an entity in chat. +/// +/// The type of the entity that spoke. +/// The id of the entity that spoke. +/// The say/message color. +/// The message constant. +/// The arguments of the message. +[PacketHeader("sayi", PacketSource.Server)] +[GenerateSerializer(true)] +public record SayiPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + SayColor Color, + [PacketIndex(3)] + Game18NConstString MessageConst, + [PacketListIndex(4, ListSeparator = ' ')] + IReadOnlyList Arguments +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/SayitemtPacket.cs b/Packets/NosSmooth.Packets/Server/Chat/SayitemtPacket.cs new file mode 100644 index 0000000..bca4fbd --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/SayitemtPacket.cs @@ -0,0 +1,46 @@ +// +// SayitemtPacket.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 System.Runtime.InteropServices; +using NosSmooth.Packets.Enums.Chat; +using NosSmooth.Packets.Enums.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; +using NosSmooth.PacketSerializer.Abstractions.Common; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// Information about an item sent to chat. +/// +/// The type of the entity that spoke. +/// The id of the entity that spoke. +/// The say/message color. +/// The amount. +/// The vnum of the item. +/// The name of the item. +/// The message template. Usully "{%s%}" +/// TODO information about an item, e_info packet. +[PacketHeader("sayitemt", PacketSource.Server)] +[GenerateSerializer(true)] +public record SayitemtPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + SayColor Color, + [PacketIndex(3)] + short Amount, + [PacketIndex(4)] + int ItemVNum, + [PacketIndex(5)] + NameString Name, + [PacketIndex(6)] + string Message, + [PacketGreedyIndex(7)] + string ItemInfo +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/SaytPacket.cs b/Packets/NosSmooth.Packets/Server/Chat/SaytPacket.cs new file mode 100644 index 0000000..2416a62 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/SaytPacket.cs @@ -0,0 +1,36 @@ +// +// SaytPacket.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.Chat; +using NosSmooth.Packets.Enums.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; +using NosSmooth.PacketSerializer.Abstractions.Common; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// A message from an entity in chat. +/// +/// The type of the entity that spoke. +/// The id of the entity that spoke. +/// The say/message color. +/// The name of the entity. +/// The spoken message. +[PacketHeader("sayt", PacketSource.Server)] +[GenerateSerializer(true)] +public record SaytPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + SayColor Color, + [PacketIndex(3)] + NameString Name, + [PacketGreedyIndex(4, IsOptional = true)] + string? Message +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Chat/SpkPacket.cs b/Packets/NosSmooth.Packets/Server/Chat/SpkPacket.cs new file mode 100644 index 0000000..bd70c38 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Chat/SpkPacket.cs @@ -0,0 +1,36 @@ +// +// SpkPacket.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.Chat; +using NosSmooth.Packets.Enums.Entities; +using NosSmooth.PacketSerializer.Abstractions.Attributes; +using NosSmooth.PacketSerializer.Abstractions.Common; + +namespace NosSmooth.Packets.Server.Chat; + +/// +/// An entity speak. +/// +/// The type of the entity that spoke. +/// The id of the entity that spoke. +/// The type of the speak/message. +/// The name of the entity. +/// The spoken message. +[PacketHeader("spk", PacketSource.Server)] +[GenerateSerializer(true)] +public record SpkPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + SpeakType Type, + [PacketIndex(3)] + NameString Name, + [PacketGreedyIndex(4, IsOptional = true)] + string? Message +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Entities/CharScPacket.cs b/Packets/NosSmooth.Packets/Server/Entities/CharScPacket.cs new file mode 100644 index 0000000..b72f986 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Entities/CharScPacket.cs @@ -0,0 +1,28 @@ +// +// CharScPacket.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.Entities; + +/// +/// Size of the given entity has changed size. +/// +/// The type of the entity. +/// The id of the entity. +/// The new size of the entity. +[PacketHeader("char_sc", PacketSource.Server)] +[GenerateSerializer(true)] +public record CharScPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + short Size +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Entities/DiePacket.cs b/Packets/NosSmooth.Packets/Server/Entities/DiePacket.cs new file mode 100644 index 0000000..5d20f05 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Entities/DiePacket.cs @@ -0,0 +1,31 @@ +// +// DiePacket.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.Entities; + +/// +/// An entity has died. +/// +/// The type of the entity. +/// The id of the entity. +/// The type of the entity. +/// The id of the entity. +[PacketHeader("die", PacketSource.Server)] +[GenerateSerializer(true)] +public record DiePacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + EntityType TargetEntityType, + [PacketIndex(3)] + long TargetEntityId +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Maps/DropPacket.cs b/Packets/NosSmooth.Packets/Server/Maps/DropPacket.cs index 2e1fd3b..84cf49e 100644 --- a/Packets/NosSmooth.Packets/Server/Maps/DropPacket.cs +++ b/Packets/NosSmooth.Packets/Server/Maps/DropPacket.cs @@ -31,7 +31,7 @@ public record DropPacket [PacketIndex(3)] short Y, [PacketIndex(4)] - short Amount, + int Amount, [PacketIndex(5)] bool IsQuestRelated, [PacketIndex(6)] diff --git a/Packets/NosSmooth.Packets/Server/Maps/MapclearPacket.cs b/Packets/NosSmooth.Packets/Server/Maps/MapclearPacket.cs new file mode 100644 index 0000000..8b3b12b --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Maps/MapclearPacket.cs @@ -0,0 +1,16 @@ +// +// MapclearPacket.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.Maps; + +/// +/// Entities on the map were cleared. +/// +[PacketHeader("mapclear", PacketSource.Server)] +[GenerateSerializer(true)] +public record MapclearPacket() : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Maps/MapoutPacket.cs b/Packets/NosSmooth.Packets/Server/Maps/MapoutPacket.cs new file mode 100644 index 0000000..fd280bf --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Maps/MapoutPacket.cs @@ -0,0 +1,16 @@ +// +// MapoutPacket.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.Maps; + +/// +/// Teleported out of map. +/// +[PacketHeader("mapout", PacketSource.Server)] +[GenerateSerializer(true)] +public record MapoutPacket() : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Maps/ThrowPacket.cs b/Packets/NosSmooth.Packets/Server/Maps/ThrowPacket.cs new file mode 100644 index 0000000..5d70349 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Maps/ThrowPacket.cs @@ -0,0 +1,42 @@ +// +// ThrowPacket.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.Maps; + +/// +/// An item has been thrown from the given position to target position. +/// +/// +/// Used in raids after boss is killed. +/// +/// The vnum of the dropped item. +/// The id of the item. +/// The source x coordinate the item is thrown from. +/// The source y coordinate the item is thrown from. +/// The target x coordinate the item is thrown to. +/// The target y coordinate the item is thrown to. +/// The amount of items thrown. +[PacketHeader("throw", PacketSource.Server)] +[GenerateSerializer(true)] +public record ThrowPacket +( + [PacketIndex(0)] + int ItemVNum, + [PacketIndex(1)] + long DropId, + [PacketIndex(2)] + short SourceX, + [PacketIndex(3)] + short SourceY, + [PacketIndex(4)] + short TargetX, + [PacketIndex(5)] + short TargetY, + [PacketIndex(6)] + int Amount +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Maps/TpPacket.cs b/Packets/NosSmooth.Packets/Server/Maps/TpPacket.cs new file mode 100644 index 0000000..9eb4ecd --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Maps/TpPacket.cs @@ -0,0 +1,35 @@ +// +// TpPacket.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.Maps; + +/// +/// An entity teleport packet, +/// the entity jumps to the given position instantly. +/// +/// The type of the entity. +/// The id of the entity. +/// The x coordinate the entity teleports to. +/// The y coordinate the entity teleports to. +/// Unknown TODO. +[PacketHeader("tp", PacketSource.Server)] +[GenerateSerializer(true)] +public record TpPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + short PositionX, + [PacketIndex(3)] + short PositionY, + [PacketIndex(4)] + sbyte Unknown +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Mates/CtlPacket.cs b/Packets/NosSmooth.Packets/Server/Mates/CtlPacket.cs new file mode 100644 index 0000000..58734a8 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Mates/CtlPacket.cs @@ -0,0 +1,31 @@ +// +// CtlPacket.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.Mates; + +/// +/// The client may control the given pet now. +/// +/// The type of the mate entity (npc). +/// The id of the mate entity. +/// Unknown TODO. +/// Unknown TODO. +[PacketHeader("ctl", PacketSource.Server)] +[GenerateSerializer(true)] +public record CtlPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + byte Unknown1 = 3, + [PacketIndex(3)] + byte Unknown2 = 0 +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Raids/RaidfHpSubPacket.cs b/Packets/NosSmooth.Packets/Server/Raids/RaidfHpSubPacket.cs new file mode 100644 index 0000000..e925d27 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Raids/RaidfHpSubPacket.cs @@ -0,0 +1,25 @@ +// +// RaidfHpSubPacket.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; + +/// +/// A sub packet of , +/// containing hp or mp of a player. +/// +/// The id of the player. +/// The hp or mp percentage of the player. +[PacketHeader(null, PacketSource.Server)] +[GenerateSerializer(true)] +public record RaidfHpSubPacket +( + [PacketIndex(0)] + long PlayerId, + [PacketIndex(1)] + byte HpPercentage +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Raids/RaidfhpPacket.cs b/Packets/NosSmooth.Packets/Server/Raids/RaidfhpPacket.cs new file mode 100644 index 0000000..be1360b --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Raids/RaidfhpPacket.cs @@ -0,0 +1,26 @@ +// +// RaidfhpPacket.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; + +/// +/// Raid hp packet that is sent for raids using raidf packet. +/// Raids using raid packet contain hp, mp in raid packet itself. +/// +/// The type of the raid packet (3 - player healths) +/// Hp of the players. +[PacketHeader("raidfhp", PacketSource.Server)] +[GenerateSerializer(true)] +public record RaidfhpPacket +( + [PacketIndex(0)] + RaidPacketType Type, + [PacketListIndex(1, ListSeparator = ' ', InnerSeparator = '.')] + IReadOnlyList HpSubPackets +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Raids/RaidfmpPacket.cs b/Packets/NosSmooth.Packets/Server/Raids/RaidfmpPacket.cs new file mode 100644 index 0000000..e2c970a --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Raids/RaidfmpPacket.cs @@ -0,0 +1,26 @@ +// +// RaidfmpPacket.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; + +/// +/// Raid mp packet that is sent for raids using raidf packet. +/// Raids using raid packet contain hp, mp in raid packet itself. +/// +/// The type of the raid packet (3 - player healths) +/// Mp of the players. +[PacketHeader("raidfmp", PacketSource.Server)] +[GenerateSerializer(true)] +public record RaidfmpPacket +( + [PacketIndex(0)] + RaidPacketType Type, + [PacketListIndex(1, ListSeparator = ' ', InnerSeparator = '.')] + IReadOnlyList HpSubPackets +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/UI/DelayPacket.cs b/Packets/NosSmooth.Packets/Server/UI/DelayPacket.cs new file mode 100644 index 0000000..3c71d40 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/UI/DelayPacket.cs @@ -0,0 +1,30 @@ +// +// DelayPacket.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.UI; + +/// +/// The client should wait before doing the given operation, +/// dancing in the process. The character may not move, sit, etc. +/// In case the character moves, sits or does something else, +/// the operation will be cancelled. +/// +/// The time to wait. +/// The type of the delay packet. +/// The argument to send after waited. +[PacketHeader("delay", PacketSource.Server)] +[GenerateSerializer(true)] +public record DelayPacket +( + [PacketIndex(0)] + int Delay, + [PacketIndex(1)] + int Type, + [PacketIndex(2)] + string Argument +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/UI/RestPacket.cs b/Packets/NosSmooth.Packets/Server/UI/RestPacket.cs new file mode 100644 index 0000000..9c21708 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/UI/RestPacket.cs @@ -0,0 +1,28 @@ +// +// RestPacket.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.UI; + +/// +/// The given entity sitting state has been changed. +/// +/// The type of the entity. +/// The id of the entity. +/// Whether the entity is sitting. +[PacketHeader("rest", PacketSource.Server)] +[GenerateSerializer(true)] +public record RestPacket +( + [PacketIndex(0)] + EntityType EntityType, + [PacketIndex(1)] + long EntityId, + [PacketIndex(2)] + bool IsSitting +) : IPacket; \ No newline at end of file -- 2.49.0