diff --git a/Pal.Client/packages.lock.json b/Pal.Client/packages.lock.json index e940a12..a68a4b3 100644 --- a/Pal.Client/packages.lock.json +++ b/Pal.Client/packages.lock.json @@ -73,6 +73,11 @@ "resolved": "2.14.1", "contentHash": "lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw==" }, + "MessagePack.Annotations": { + "type": "Transitive", + "resolved": "2.5.140", + "contentHash": "JE3vwluOrsJ4t3hnfXzIxJUh6lhx6M/KR8Sark/HOUw1DJ5UKu5JsAnnuaQngg6poFkRx1lzHSLTkxHNJO7+uQ==" + }, "Microsoft.Data.Sqlite.Core": { "type": "Transitive", "resolved": "7.0.13", @@ -273,7 +278,10 @@ "type": "Project" }, "pal.common": { - "type": "Project" + "type": "Project", + "dependencies": { + "MessagePack.Annotations": "[2.5.140, )" + } } }, "net7.0-windows7.0/win-x64": { diff --git a/Pal.Common/Net/Models/CreateAccountError.cs b/Pal.Common/Net/Models/Account/CreateAccountError.cs similarity index 80% rename from Pal.Common/Net/Models/CreateAccountError.cs rename to Pal.Common/Net/Models/Account/CreateAccountError.cs index 5b8dea5..1f77c0d 100644 --- a/Pal.Common/Net/Models/CreateAccountError.cs +++ b/Pal.Common/Net/Models/Account/CreateAccountError.cs @@ -1,4 +1,4 @@ -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class CreateAccountError { diff --git a/Pal.Common/Net/Models/CreateAccountReply.cs b/Pal.Common/Net/Models/Account/CreateAccountReply.cs similarity index 68% rename from Pal.Common/Net/Models/CreateAccountReply.cs rename to Pal.Common/Net/Models/Account/CreateAccountReply.cs index 950bd90..3779fa2 100644 --- a/Pal.Common/Net/Models/CreateAccountReply.cs +++ b/Pal.Common/Net/Models/Account/CreateAccountReply.cs @@ -1,4 +1,4 @@ -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class CreateAccountReply { diff --git a/Pal.Common/Net/Models/CreateAccountRequest.cs b/Pal.Common/Net/Models/Account/CreateAccountRequest.cs similarity index 78% rename from Pal.Common/Net/Models/CreateAccountRequest.cs rename to Pal.Common/Net/Models/Account/CreateAccountRequest.cs index 8855611..7299fdd 100644 --- a/Pal.Common/Net/Models/CreateAccountRequest.cs +++ b/Pal.Common/Net/Models/Account/CreateAccountRequest.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class CreateAccountRequest { diff --git a/Pal.Common/Net/Models/LoginError.cs b/Pal.Common/Net/Models/Account/LoginError.cs similarity index 79% rename from Pal.Common/Net/Models/LoginError.cs rename to Pal.Common/Net/Models/Account/LoginError.cs index 537e8aa..6db14f6 100644 --- a/Pal.Common/Net/Models/LoginError.cs +++ b/Pal.Common/Net/Models/Account/LoginError.cs @@ -1,4 +1,4 @@ -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class LoginError { diff --git a/Pal.Common/Net/Models/LoginReply.cs b/Pal.Common/Net/Models/Account/LoginReply.cs similarity index 66% rename from Pal.Common/Net/Models/LoginReply.cs rename to Pal.Common/Net/Models/Account/LoginReply.cs index 2d258cd..a3a11ed 100644 --- a/Pal.Common/Net/Models/LoginReply.cs +++ b/Pal.Common/Net/Models/Account/LoginReply.cs @@ -1,4 +1,4 @@ -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class LoginReply { diff --git a/Pal.Common/Net/Models/LoginRequest.cs b/Pal.Common/Net/Models/Account/LoginRequest.cs similarity index 83% rename from Pal.Common/Net/Models/LoginRequest.cs rename to Pal.Common/Net/Models/Account/LoginRequest.cs index 7aabcb0..db11635 100644 --- a/Pal.Common/Net/Models/LoginRequest.cs +++ b/Pal.Common/Net/Models/Account/LoginRequest.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class LoginRequest { diff --git a/Pal.Common/Net/Models/Version.cs b/Pal.Common/Net/Models/Account/Version.cs similarity index 70% rename from Pal.Common/Net/Models/Version.cs rename to Pal.Common/Net/Models/Account/Version.cs index 6475bfa..f98ef3f 100644 --- a/Pal.Common/Net/Models/Version.cs +++ b/Pal.Common/Net/Models/Account/Version.cs @@ -1,4 +1,4 @@ -namespace Pal.Common.Net.Models; +namespace Pal.Common.Net.Models.Account; public sealed class Version { diff --git a/Pal.Common/Net/Models/Export/ExportFloor.cs b/Pal.Common/Net/Models/Export/ExportFloor.cs new file mode 100644 index 0000000..328b332 --- /dev/null +++ b/Pal.Common/Net/Models/Export/ExportFloor.cs @@ -0,0 +1,13 @@ +using MessagePack; + +namespace Pal.Common.Net.Models.Export; + +[MessagePackObject] +public sealed class ExportFloor +{ + [Key(0)] + public required ETerritoryType TerritoryType { get; init; } + + [Key(1)] + public required List Objects { get; init; } +} diff --git a/Pal.Common/Net/Models/Export/ExportObject.cs b/Pal.Common/Net/Models/Export/ExportObject.cs new file mode 100644 index 0000000..792ca95 --- /dev/null +++ b/Pal.Common/Net/Models/Export/ExportObject.cs @@ -0,0 +1,20 @@ +using MessagePack; +using Pal.Common.Net.Models.Palace; + +namespace Pal.Common.Net.Models.Export; + +[MessagePackObject] +public sealed class ExportObject +{ + [Key(0)] + public required EObjectType Type { get; init; } + + [Key(1)] + public required float X { get; set; } + + [Key(2)] + public required float Y { get; set; } + + [Key(3)] + public required float Z { get; set; } +} diff --git a/Pal.Common/Net/Models/Export/ExportRequest.cs b/Pal.Common/Net/Models/Export/ExportRequest.cs new file mode 100644 index 0000000..8acf14d --- /dev/null +++ b/Pal.Common/Net/Models/Export/ExportRequest.cs @@ -0,0 +1,6 @@ +namespace Pal.Common.Net.Models.Export; + +public sealed class ExportRequest +{ + public required string ServerUrl { get; init; } +} diff --git a/Pal.Common/Net/Models/Export/ExportRoot.cs b/Pal.Common/Net/Models/Export/ExportRoot.cs new file mode 100644 index 0000000..7f8d08c --- /dev/null +++ b/Pal.Common/Net/Models/Export/ExportRoot.cs @@ -0,0 +1,22 @@ +using MessagePack; + +namespace Pal.Common.Net.Models.Export; + +[MessagePackObject] +public sealed class ExportRoot +{ + [Key(0)] + public required Guid ExportId { get; init; } + + [Key(1)] + public required int ExportVersion { get; init; } + + [Key(2)] + public required string ServerUrl { get; init; } + + [Key(3)] + public required DateTime CreatedAt { get; init; } + + [Key(4)] + public required List Floors { get; init; } +} diff --git a/Pal.Common/Net/Models/Palace/DownloadFloorsError.cs b/Pal.Common/Net/Models/Palace/DownloadFloorsError.cs new file mode 100644 index 0000000..65a8b17 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/DownloadFloorsError.cs @@ -0,0 +1,6 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class DownloadFloorsError +{ + +} diff --git a/Pal.Common/Net/Models/Palace/DownloadFloorsReply.cs b/Pal.Common/Net/Models/Palace/DownloadFloorsReply.cs new file mode 100644 index 0000000..e2f9860 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/DownloadFloorsReply.cs @@ -0,0 +1,7 @@ + +namespace Pal.Common.Net.Models.Palace; + +public sealed class DownloadFloorsReply +{ + public required List Objects { get; init; } +} diff --git a/Pal.Common/Net/Models/Palace/EObjectType.cs b/Pal.Common/Net/Models/Palace/EObjectType.cs new file mode 100644 index 0000000..b2710f1 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/EObjectType.cs @@ -0,0 +1,10 @@ +namespace Pal.Common.Net.Models.Palace; + +public enum EObjectType : int +{ + Unknown = 0, + Trap = 1, + Hoard = 2, + + Debug_NotSynchronized = 3, +} diff --git a/Pal.Common/Net/Models/Palace/MarkObjectsSeenError.cs b/Pal.Common/Net/Models/Palace/MarkObjectsSeenError.cs new file mode 100644 index 0000000..7631b1f --- /dev/null +++ b/Pal.Common/Net/Models/Palace/MarkObjectsSeenError.cs @@ -0,0 +1,6 @@ + +namespace Pal.Common.Net.Models.Palace; + +public sealed class MarkObjectsSeenError +{ +} diff --git a/Pal.Common/Net/Models/Palace/MarkObjectsSeenReply.cs b/Pal.Common/Net/Models/Palace/MarkObjectsSeenReply.cs new file mode 100644 index 0000000..68f8155 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/MarkObjectsSeenReply.cs @@ -0,0 +1,5 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class MarkObjectsSeenReply +{ +} diff --git a/Pal.Common/Net/Models/Palace/MarkObjectsSeenRequest.cs b/Pal.Common/Net/Models/Palace/MarkObjectsSeenRequest.cs new file mode 100644 index 0000000..38fa605 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/MarkObjectsSeenRequest.cs @@ -0,0 +1,7 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class MarkObjectsSeenRequest +{ + public required ETerritoryType TerritoryType { get; init; } + public required List NetworkIds { get; init; } +} diff --git a/Pal.Common/Net/Models/Palace/PalaceObject.cs b/Pal.Common/Net/Models/Palace/PalaceObject.cs new file mode 100644 index 0000000..79a960d --- /dev/null +++ b/Pal.Common/Net/Models/Palace/PalaceObject.cs @@ -0,0 +1,12 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class PalaceObject +{ + public required EObjectType Type { get; init; } + + public required float X { get; init; } + public required float Y { get; init; } + public required float Z { get; init; } + + public Guid NetworkId { get; init; } +} diff --git a/Pal.Common/Net/Models/Palace/StatisticsError.cs b/Pal.Common/Net/Models/Palace/StatisticsError.cs new file mode 100644 index 0000000..029745a --- /dev/null +++ b/Pal.Common/Net/Models/Palace/StatisticsError.cs @@ -0,0 +1,5 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class StatisticsError +{ +} diff --git a/Pal.Common/Net/Models/Palace/StatisticsReply.cs b/Pal.Common/Net/Models/Palace/StatisticsReply.cs new file mode 100644 index 0000000..159f23e --- /dev/null +++ b/Pal.Common/Net/Models/Palace/StatisticsReply.cs @@ -0,0 +1,13 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class StatisticsReply +{ + public required List Floors { get; init; } + + public sealed class FloorStatistics + { + public required ETerritoryType TerritoryType { get; init; } + public required uint TrapCount { get; init; } + public required uint HoardCount { get; init; } + } +} diff --git a/Pal.Common/Net/Models/Palace/UploadFloorsError.cs b/Pal.Common/Net/Models/Palace/UploadFloorsError.cs new file mode 100644 index 0000000..2e210f9 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/UploadFloorsError.cs @@ -0,0 +1,5 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class UploadFloorsError +{ +} diff --git a/Pal.Common/Net/Models/Palace/UploadFloorsReply.cs b/Pal.Common/Net/Models/Palace/UploadFloorsReply.cs new file mode 100644 index 0000000..a06c2d5 --- /dev/null +++ b/Pal.Common/Net/Models/Palace/UploadFloorsReply.cs @@ -0,0 +1,6 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class UploadFloorsReply +{ + public required List Objects { get; init; } +} diff --git a/Pal.Common/Net/Models/Palace/UploadFloorsRequest.cs b/Pal.Common/Net/Models/Palace/UploadFloorsRequest.cs new file mode 100644 index 0000000..993189a --- /dev/null +++ b/Pal.Common/Net/Models/Palace/UploadFloorsRequest.cs @@ -0,0 +1,7 @@ +namespace Pal.Common.Net.Models.Palace; + +public sealed class UploadFloorsRequest +{ + public required ETerritoryType TerritoryType { get; init; } + public required List Objects { get; init; } +} diff --git a/Pal.Common/Pal.Common.csproj b/Pal.Common/Pal.Common.csproj index 51b73c8..5e07ee5 100644 --- a/Pal.Common/Pal.Common.csproj +++ b/Pal.Common/Pal.Common.csproj @@ -9,4 +9,8 @@ $(SolutionDir)=X:\ true + + + + diff --git a/Pal.Common/Protos/export.proto b/Pal.Common/Protos/export.proto deleted file mode 100644 index 11ec6fd..0000000 --- a/Pal.Common/Protos/export.proto +++ /dev/null @@ -1,58 +0,0 @@ -syntax = "proto3"; - -package export; - -import "google/protobuf/timestamp.proto"; - -service ExportService { - rpc Export(ExportRequest) returns (ExportReply); -} - -message ExportRequest { - string serverUrl = 1; -} - - -message ExportReply { - bool success = 1; - ExportRoot data = 2; - ExportError error = 3; -} - -enum ExportError { - EXPORT_ERROR_NONE = 0; - EXPORT_ERROR_UNKNOWN = 1; -} - -message ExportRoot { - string exportId = 1; - - // Only increases if the export format changes, in case of backwards-incompatible changes. - int32 exportVersion = 2; - - string serverUrl = 3; - - // Server MAY decide not to send any markers older than this. - google.protobuf.Timestamp createdAt = 4; - - repeated ExportFloor floors = 5; -} - -message ExportFloor { - uint32 territoryType = 1; - repeated ExportObject objects = 2; -} - -message ExportObject { - ExportObjectType type = 1; - float x = 2; - float y = 3; - float z = 4; - //string networkId = 5; -} - -enum ExportObjectType { - EXPORT_OBJECT_TYPE_UNKNOWN = 0; - EXPORT_OBJECT_TYPE_TRAP = 1; - EXPORT_OBJECT_TYPE_HOARD = 2; -} diff --git a/Pal.Common/Protos/palace.proto b/Pal.Common/Protos/palace.proto deleted file mode 100644 index e77c207..0000000 --- a/Pal.Common/Protos/palace.proto +++ /dev/null @@ -1,72 +0,0 @@ -syntax = "proto3"; - -package palace; - -service PalaceService { - rpc DownloadFloors(DownloadFloorsRequest) returns (DownloadFloorsReply); - rpc UploadFloors(UploadFloorsRequest) returns (UploadFloorsReply); - rpc MarkObjectsSeen(MarkObjectsSeenRequest) returns (MarkObjectsSeenReply); - rpc FetchStatistics(StatisticsRequest) returns (StatisticsReply); -} - -message DownloadFloorsRequest { - uint32 territoryType = 1; -} - -message DownloadFloorsReply { - bool success = 1; - repeated PalaceObject objects = 2; -} - -message UploadFloorsRequest { - uint32 territoryType = 1; - repeated PalaceObject objects = 2; -} - -message UploadFloorsReply { - bool success = 1; - repeated PalaceObject objects = 2; -} - -message StatisticsRequest { -} - -message StatisticsReply { - bool success = 1; - repeated FloorStatistics floorStatistics = 2; -} - -message FloorStatistics { - uint32 territoryType = 1; - uint32 trapCount = 2; - uint32 hoardCount = 3; -} - -message PalaceObject { - ObjectType type = 1; - float x = 2; - float y = 3; - float z = 4; - - // Ignored for uploaded markers. - string networkId = 5; -} - -message MarkObjectsSeenRequest { - uint32 territoryType = 1; - repeated string networkIds = 2; -} - -message MarkObjectsSeenReply { - bool success = 1; -} - -enum ObjectType { - OBJECT_TYPE_UNKNOWN = 0; - OBJECT_TYPE_TRAP = 1; - OBJECT_TYPE_HOARD = 2; - - // Objects only really used for debugging, may not return any objects at any point in time. - // Semi-Permanent: Not saved locally, but saved on the server. - reserved 3; -} diff --git a/Pal.Common/packages.lock.json b/Pal.Common/packages.lock.json index 2712a54..e585b80 100644 --- a/Pal.Common/packages.lock.json +++ b/Pal.Common/packages.lock.json @@ -1,6 +1,13 @@ { "version": 1, "dependencies": { - "net7.0": {} + "net7.0": { + "MessagePack.Annotations": { + "type": "Direct", + "requested": "[2.5.140, )", + "resolved": "2.5.140", + "contentHash": "JE3vwluOrsJ4t3hnfXzIxJUh6lhx6M/KR8Sark/HOUw1DJ5UKu5JsAnnuaQngg6poFkRx1lzHSLTkxHNJO7+uQ==" + } + } } } \ No newline at end of file diff --git a/Server b/Server index ad12f4f..7b05132 160000 --- a/Server +++ b/Server @@ -1 +1 @@ -Subproject commit ad12f4fa2b89fbdd8bab4c10e379a6557c644873 +Subproject commit 7b0513278b97a7a45113ef33c74e84e92fedf900