From ea0cb9d3a0715061be29328566579c2cb7b4d6f4 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 12 Feb 2022 17:21:03 +0100 Subject: [PATCH] feat(packets): add miniland info and objects packets --- .../NosSmooth.Packets/Enums/MinilandState.cs | 28 +++++++++++ .../Server/Miniland/MlInfoBrPacket.cs | 37 ++++++++++++++ .../Server/Miniland/MlInfoPacket.cs | 47 ++++++++++++++++++ .../Server/Miniland/MlObjLstPacket.cs | 21 ++++++++ .../Server/Miniland/MlObjPacket.cs | 48 +++++++++++++++++++ .../Server/Miniland/MltObjPacket.cs | 24 ++++++++++ .../Server/Miniland/MltObjSubPacket.cs | 30 ++++++++++++ 7 files changed, 235 insertions(+) create mode 100644 Packets/NosSmooth.Packets/Enums/MinilandState.cs create mode 100644 Packets/NosSmooth.Packets/Server/Miniland/MlInfoBrPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Miniland/MlInfoPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Miniland/MlObjLstPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Miniland/MlObjPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Miniland/MltObjPacket.cs create mode 100644 Packets/NosSmooth.Packets/Server/Miniland/MltObjSubPacket.cs diff --git a/Packets/NosSmooth.Packets/Enums/MinilandState.cs b/Packets/NosSmooth.Packets/Enums/MinilandState.cs new file mode 100644 index 0000000..cc02aac --- /dev/null +++ b/Packets/NosSmooth.Packets/Enums/MinilandState.cs @@ -0,0 +1,28 @@ +// +// MinilandState.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; + +/// +/// State of a miniland. +/// +public enum MinilandState +{ + /// + /// The miniland is open for anybody. + /// + Open, + + /// + /// The miniland is closed, cannot be accessed by anyone. + /// + Private, + + /// + /// The miniland is locked, cannot be accessed and objects can be built. + /// + Lock, +} \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Miniland/MlInfoBrPacket.cs b/Packets/NosSmooth.Packets/Server/Miniland/MlInfoBrPacket.cs new file mode 100644 index 0000000..a69cfa0 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Miniland/MlInfoBrPacket.cs @@ -0,0 +1,37 @@ +// +// MlInfoBrPacket.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.Miniland; + +/// +/// Miniland info packet. For minilands not owned by the playing character. +/// +/// The id of the music. 3800 by default. +/// The name of the owner. +/// The number of daily visits. +/// The number of total visits. +/// Unknown TODO. +/// The welcome message. +[PacketHeader("mlinfobr", PacketSource.Server)] +[GenerateSerializer(true)] +public record MlInfoBrPacket +( + [PacketIndex(0)] + short MinilandMusicId, + [PacketIndex(1)] + NameString OwnerName, + [PacketIndex(2)] + int DailyVisitCount, + [PacketIndex(3)] + int VisitCount, + [PacketIndex(4)] + byte Unknown, + [PacketGreedyIndex(5)] + string MinilandMessage +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Miniland/MlInfoPacket.cs b/Packets/NosSmooth.Packets/Server/Miniland/MlInfoPacket.cs new file mode 100644 index 0000000..0d7a7f0 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Miniland/MlInfoPacket.cs @@ -0,0 +1,47 @@ +// +// MlInfoPacket.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; +using NosSmooth.PacketSerializer.Abstractions.Common; + +namespace NosSmooth.Packets.Server.Miniland; + +/// +/// Miniland info packet. For miniland owned by the playing character. +/// +/// The id of the music. 3800 by default. +/// The points of the miniland. +/// Unknown TODO. +/// The number of daily visits. +/// The number of total visits. +/// Unknown TODO. +/// The state of the miniland. +/// The name of the miniland music. +/// The welcome message. +[PacketHeader("mlinfo", PacketSource.Server)] +[GenerateSerializer(true)] +public record MlInfoPacket +( + [PacketIndex(0)] + short MinilandMusicId, + [PacketIndex(1)] + long MinilandPoints, + [PacketIndex(2)] + byte Unknown, + [PacketIndex(3)] + int DailyVisitCount, + [PacketIndex(4)] + int VisitCount, + [PacketIndex(5)] + byte Unknown1, + [PacketIndex(6)] + MinilandState MinilandState, + [PacketIndex(7)] + NameString MinilandMusicName, + [PacketGreedyIndex(8)] + string MinilandMessage +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Miniland/MlObjLstPacket.cs b/Packets/NosSmooth.Packets/Server/Miniland/MlObjLstPacket.cs new file mode 100644 index 0000000..9ac563e --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Miniland/MlObjLstPacket.cs @@ -0,0 +1,21 @@ +// +// MlObjLstPacket.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.Miniland; + +/// +/// Miniland object list packet. +/// +/// The objects in the miniland or inventory. +[PacketHeader("mlobjlst", PacketSource.Server)] +[GenerateSerializer(true)] +public record MlObjLstPacket +( + [PacketListIndex(0, ListSeparator = ' ', InnerSeparator = '.')] + IReadOnlyList Objects +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Miniland/MlObjPacket.cs b/Packets/NosSmooth.Packets/Server/Miniland/MlObjPacket.cs new file mode 100644 index 0000000..12c936e --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Miniland/MlObjPacket.cs @@ -0,0 +1,48 @@ +// +// MlObjPacket.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.Miniland; + +/// +/// Miniland object packet. +/// +/// The slot in the inventory. +/// Whether the item is placed in the miniland. +/// The x coordinate, if in use. +/// The y coordinate, if in use. +/// The width of the object. +/// The height of the object. +/// Unknown TODO. +/// The durability points of a minigame. +/// Unknown TODO. +/// Unknown TODO. +[PacketHeader("mlobj", PacketSource.Server)] +[GenerateSerializer(true)] +public record MlObjPacket +( + [PacketIndex(0)] + short Slot, + [PacketIndex(1)] + bool InUse, + [PacketIndex(2)] + short X, + [PacketIndex(3)] + short Y, + [PacketIndex(4)] + byte Width, + [PacketIndex(5)] + byte Height, + [PacketIndex(6)] + byte Unknown, + [PacketIndex(7)] + int DurabilityPoints, + [PacketIndex(8)] + bool Unknown1, + [PacketIndex(9)] + bool Unknown2 +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Miniland/MltObjPacket.cs b/Packets/NosSmooth.Packets/Server/Miniland/MltObjPacket.cs new file mode 100644 index 0000000..de00384 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Miniland/MltObjPacket.cs @@ -0,0 +1,24 @@ +// +// MltObjPacket.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.Miniland; + +/// +/// Miniland objects list packet. +/// +/// +/// Used for minilands of different owners. +/// +/// The miniland objects. +[PacketHeader("mltobj", PacketSource.Server)] +[GenerateSerializer(true)] +public record MltObjPacket +( + [PacketIndex(0)] + IReadOnlyList Objects +) : IPacket; \ No newline at end of file diff --git a/Packets/NosSmooth.Packets/Server/Miniland/MltObjSubPacket.cs b/Packets/NosSmooth.Packets/Server/Miniland/MltObjSubPacket.cs new file mode 100644 index 0000000..b1a5173 --- /dev/null +++ b/Packets/NosSmooth.Packets/Server/Miniland/MltObjSubPacket.cs @@ -0,0 +1,30 @@ +// +// MltObjSubPacket.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.Miniland; + +/// +/// Sub packet of . +/// +/// The vnum of the item. +/// The slot. +/// The x coordinate. +/// The y coordinate. +[PacketHeader("mltobjsub", PacketSource.Server)] +[GenerateSerializer(true)] +public record MltObjSubPacket +( + [PacketIndex(0)] + int VNum, + [PacketIndex(1)] + int Slot, + [PacketIndex(2)] + short X, + [PacketIndex(3)] + short Y +) : IPacket; \ No newline at end of file -- 2.49.0