From 4ce7197c3baaa89bb89a694686ba4867adb800fa Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Tue, 6 Jun 2023 17:06:45 +0300 Subject: [PATCH] Fixed battle Moved more of P3D specific code to the P3D project Disabled Pokemon Validation code for now --- .../Battle/BattleClientDataToClientPacket.cs | 16 ------ .../Events/PlayerTradeOfferedPokemonEvent.cs | 8 --- .../Extensions/ServiceCollectionExtensions.cs | 2 - .../Player/GetMonsterByDataQueryHandler.cs | 6 +- src/P3D.Legacy.Server.Benchmark/Program.cs | 2 +- .../Services/BenchmarkService.cs | 8 +-- .../Services/BenchmarkStatusService.cs | 4 +- .../Data/P3DDatas/BattleClientData.cs | 2 +- .../Data/P3DDatas/BattleEndRoundData.cs | 2 +- .../Data/P3DDatas/BattleHostData.cs | 2 +- .../Data/P3DDatas/BattleOfferData.cs | 2 +- .../Data/P3DDatas/P3DData.cs | 2 +- .../Data/P3DDatas/TradeData.cs | 2 +- .../DataItemStorage.cs | 10 ++-- .../Events/PlayerSentRawP3DPacketEvent.cs | 4 +- .../PlayerTradeOfferedP3DMonsterEvent.cs | 9 +++ .../Extensions/DataItemsExtensions.cs | 2 +- .../Extensions/MonsterExtensions.cs | 2 +- .../Extensions/ServiceCollectionExtensions.cs | 3 + .../Extensions/Vector3Extensions.cs | 2 +- .../Models/Monsters/P3DMonsterEntity.cs} | 10 ++-- .../P3DConnectionContextHandler.Functions.cs | 8 +-- ...DConnectionContextHandler.Notifications.cs | 16 +++--- .../P3DConnectionContextHandler.Packets.cs | 20 ++++--- .../P3DConnectionContextHandler.cs | 2 +- .../P3DProtocol.cs | 2 +- .../BattleClientDataFromClientPacket.cs | 5 +- .../Battle/BattleClientDataToClientPacket.cs | 15 +++++ .../BattleEndRoundDataFromClientPacket.cs | 5 +- .../BattleEndRoundDataToClientPacket.cs | 4 +- .../Battle/BattleHostDataFromClientPacket.cs | 5 +- .../Battle/BattleHostDataToClientPacket.cs | 4 +- .../Packets/Battle/BattleJoinPacket.cs | 4 +- .../Battle/BattleOfferFromClientPacket.cs | 5 +- .../Battle/BattleOfferToClientPacket.cs | 4 +- .../Packets/Battle/BattleQuitPacket.cs | 4 +- .../Packets/Battle/BattleRequestPacket.cs | 4 +- .../Packets/Battle/BattleStartPacket.cs | 4 +- .../Packets/Chat/ChatMessageGlobalPacket.cs | 2 +- .../ChatMessagePrivateFromClientPacket.cs | 2 +- .../Chat/ChatMessagePrivateToClientPacket.cs | 2 +- .../Packets/Client/PingPacket.cs | 2 +- .../Packets/Client/ServerDataRequestPacket.cs | 2 +- .../Packets/Common/GameDataPacket.cs | 4 +- .../Packets/Common/GameStateMessagePacket.cs | 2 +- .../Packets/P3DPacket.Parsing.cs | 6 +- .../Packets/P3DPacket.cs | 4 +- .../Packets/P3DPacketFactory.cs | 14 ++--- .../Packets/P3DPacketType.cs | 2 +- .../Packets/Server/CreatePlayerPacket.cs | 4 +- .../Packets/Server/DestroyPlayerPacket.cs | 4 +- .../Packets/Server/IDPacket.cs | 4 +- .../Packets/Server/KickedPacket.cs | 2 +- .../Packets/Server/ServerClosePacket.cs | 2 +- .../Packets/Server/ServerInfoDataPacket.cs | 2 +- .../Packets/Server/ServerMessagePacket.cs | 2 +- .../Packets/Server/WorldDataPacket.cs | 2 +- .../Packets/Trade/TradeJoinPacket.cs | 4 +- .../Trade/TradeOfferFromClientPacket.cs | 5 +- .../Packets/Trade/TradeOfferToClientPacket.cs | 4 +- .../Packets/Trade/TradeQuitPacket.cs | 4 +- .../Packets/Trade/TradeRequestPacket.cs | 4 +- .../Packets/Trade/TradeStartPacket.cs | 4 +- .../Protocol.cs | 0 .../RawPacketData.cs | 5 +- .../Extensions/ServiceCollectionExtensions.cs | 3 +- .../Monsters/IMonsterRepository.cs | 6 +- .../Monsters/MonsterRepository.cs | 6 +- .../Monsters/NopMonsterRepository.cs | 6 +- .../Monsters/PokeAPIMonsterRepository.cs | 56 +++++++++---------- .../BaseTests.cs | 2 +- .../ChatTests.cs | 6 +- .../JoinTests.cs | 6 +- .../ServerDiscoveryTests.cs | 4 +- .../Client.P3D/P3DPacketSample.cs | 4 +- .../Client.P3D/P3DProtocolTests.cs | 2 +- tests/P3D.Legacy.Tests/DataItemTests.cs | 3 +- tests/P3D.Legacy.Tests/MonsterTests.cs | 7 ++- 78 files changed, 233 insertions(+), 183 deletions(-) delete mode 100644 src/P3D.Legacy.Common/Packets/Battle/BattleClientDataToClientPacket.cs delete mode 100644 src/P3D.Legacy.Server.Abstractions/Events/PlayerTradeOfferedPokemonEvent.cs rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Data/P3DDatas/BattleClientData.cs (90%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Data/P3DDatas/BattleEndRoundData.cs (88%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Data/P3DDatas/BattleHostData.cs (88%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Data/P3DDatas/BattleOfferData.cs (94%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Data/P3DDatas/P3DData.cs (95%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Data/P3DDatas/TradeData.cs (85%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/DataItemStorage.cs (90%) create mode 100644 src/P3D.Legacy.Server.Client.P3D/Events/PlayerTradeOfferedP3DMonsterEvent.cs rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Extensions/DataItemsExtensions.cs (96%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Extensions/MonsterExtensions.cs (99%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Extensions/Vector3Extensions.cs (97%) rename src/{P3D.Legacy.Server.Infrastructure/Models/Monsters/MonsterEntity.cs => P3D.Legacy.Server.Client.P3D/Models/Monsters/P3DMonsterEntity.cs} (92%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleClientDataFromClientPacket.cs (82%) create mode 100644 src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataToClientPacket.cs rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleEndRoundDataFromClientPacket.cs (82%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleEndRoundDataToClientPacket.cs (78%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleHostDataFromClientPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleHostDataToClientPacket.cs (77%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleJoinPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleOfferFromClientPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleOfferToClientPacket.cs (77%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleQuitPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleRequestPacket.cs (82%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Battle/BattleStartPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Chat/ChatMessageGlobalPacket.cs (85%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Chat/ChatMessagePrivateFromClientPacket.cs (90%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Chat/ChatMessagePrivateToClientPacket.cs (90%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Client/PingPacket.cs (56%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Client/ServerDataRequestPacket.cs (63%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Common/GameDataPacket.cs (96%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Common/GameStateMessagePacket.cs (85%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/P3DPacket.Parsing.cs (97%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/P3DPacket.cs (89%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/P3DPacketFactory.cs (92%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/P3DPacketType.cs (96%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/CreatePlayerPacket.cs (80%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/DestroyPlayerPacket.cs (80%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/IDPacket.cs (79%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/KickedPacket.cs (83%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/ServerClosePacket.cs (84%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/ServerInfoDataPacket.cs (95%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/ServerMessagePacket.cs (84%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Server/WorldDataPacket.cs (93%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Trade/TradeJoinPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Trade/TradeOfferFromClientPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Trade/TradeOfferToClientPacket.cs (76%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Trade/TradeQuitPacket.cs (81%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Trade/TradeRequestPacket.cs (82%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Packets/Trade/TradeStartPacket.cs (82%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/Protocol.cs (100%) rename src/{P3D.Legacy.Common => P3D.Legacy.Server.Client.P3D}/RawPacketData.cs (71%) diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleClientDataToClientPacket.cs b/src/P3D.Legacy.Common/Packets/Battle/BattleClientDataToClientPacket.cs deleted file mode 100644 index 7f0236f..0000000 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleClientDataToClientPacket.cs +++ /dev/null @@ -1,16 +0,0 @@ -using P3D.Legacy.Common.Data.P3DDatas; - -namespace P3D.Legacy.Common.Packets.Battle -{ - public sealed record BattleClientDataToClientPacket() : P3DPacket(P3DPacketType.BattleClientData) - { - public Origin DestinationPlayerOrigin { get => DataItemStorage.GetOrigin(0); init => DataItemStorage.Set(0, value); } - public BattleClientData BattleData { get => new(DataItemStorage.Get(1)); init => DataItemStorage.Set(1, value.ToP3DString()); } - - public void Deconstruct(out Origin destinationPlayerOrigin, out BattleClientData battleData) - { - destinationPlayerOrigin = DestinationPlayerOrigin; - battleData = BattleData; - } - } -} \ No newline at end of file diff --git a/src/P3D.Legacy.Server.Abstractions/Events/PlayerTradeOfferedPokemonEvent.cs b/src/P3D.Legacy.Server.Abstractions/Events/PlayerTradeOfferedPokemonEvent.cs deleted file mode 100644 index ae1d820..0000000 --- a/src/P3D.Legacy.Server.Abstractions/Events/PlayerTradeOfferedPokemonEvent.cs +++ /dev/null @@ -1,8 +0,0 @@ -using P3D.Legacy.Common; -using P3D.Legacy.Common.Data.P3DDatas; -using P3D.Legacy.Server.CQERS.Events; - -namespace P3D.Legacy.Server.Abstractions.Events -{ - public sealed record PlayerTradeOfferedPokemonEvent(IPlayer Player, Origin Partner, TradeData Data) : IEvent; -} \ No newline at end of file diff --git a/src/P3D.Legacy.Server.Application/Extensions/ServiceCollectionExtensions.cs b/src/P3D.Legacy.Server.Application/Extensions/ServiceCollectionExtensions.cs index 3ebdfde..401df9f 100644 --- a/src/P3D.Legacy.Server.Application/Extensions/ServiceCollectionExtensions.cs +++ b/src/P3D.Legacy.Server.Application/Extensions/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.DependencyInjection; -using P3D.Legacy.Common.Packets; using P3D.Legacy.Server.Application.CommandHandlers.Administration; using P3D.Legacy.Server.Application.CommandHandlers.Player; using P3D.Legacy.Server.Application.CommandHandlers.Trade; @@ -51,7 +50,6 @@ public static IServiceCollection AddApplication(this IServiceCollection services services.AddQueryHandler(); - services.AddSingleton(); services.AddScoped(); diff --git a/src/P3D.Legacy.Server.Application/QueryHandlers/Player/GetMonsterByDataQueryHandler.cs b/src/P3D.Legacy.Server.Application/QueryHandlers/Player/GetMonsterByDataQueryHandler.cs index 84f8fbd..78bb1a1 100644 --- a/src/P3D.Legacy.Server.Application/QueryHandlers/Player/GetMonsterByDataQueryHandler.cs +++ b/src/P3D.Legacy.Server.Application/QueryHandlers/Player/GetMonsterByDataQueryHandler.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +/* +using Microsoft.Extensions.Logging; using P3D.Legacy.Common.Monsters; using P3D.Legacy.Server.Application.Queries.Player; @@ -31,4 +32,5 @@ public async Task HandleAsync(GetMonsterByDataQuery query, Can return await _monsterRepository.GetByDataAsync(monsterData, ct); } } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/P3D.Legacy.Server.Benchmark/Program.cs b/src/P3D.Legacy.Server.Benchmark/Program.cs index 2ab7d75..97758ac 100644 --- a/src/P3D.Legacy.Server.Benchmark/Program.cs +++ b/src/P3D.Legacy.Server.Benchmark/Program.cs @@ -2,10 +2,10 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using P3D.Legacy.Common.Packets; using P3D.Legacy.Server.Benchmark.Options; using P3D.Legacy.Server.Benchmark.Services; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets; using System.CommandLine.Binding; using System.CommandLine.Builder; diff --git a/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkService.cs b/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkService.cs index edbfccc..9e47289 100644 --- a/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkService.cs +++ b/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkService.cs @@ -6,12 +6,12 @@ using Microsoft.Extensions.Options; using P3D.Legacy.Common; -using P3D.Legacy.Common.Packets; -using P3D.Legacy.Common.Packets.Chat; -using P3D.Legacy.Common.Packets.Common; -using P3D.Legacy.Common.Packets.Server; using P3D.Legacy.Server.Benchmark.Options; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets; +using P3D.Legacy.Server.Client.P3D.Packets.Chat; +using P3D.Legacy.Server.Client.P3D.Packets.Common; +using P3D.Legacy.Server.Client.P3D.Packets.Server; using System; using System.Collections.Generic; diff --git a/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkStatusService.cs b/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkStatusService.cs index 0cf0853..67f7374 100644 --- a/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkStatusService.cs +++ b/src/P3D.Legacy.Server.Benchmark/Services/BenchmarkStatusService.cs @@ -3,10 +3,10 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using P3D.Legacy.Common.Packets.Client; -using P3D.Legacy.Common.Packets.Server; using P3D.Legacy.Server.Benchmark.Options; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets.Client; +using P3D.Legacy.Server.Client.P3D.Packets.Server; using System; using System.Diagnostics; diff --git a/src/P3D.Legacy.Common/Data/P3DDatas/BattleClientData.cs b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleClientData.cs similarity index 90% rename from src/P3D.Legacy.Common/Data/P3DDatas/BattleClientData.cs rename to src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleClientData.cs index 5c2f6ac..22eee7e 100644 --- a/src/P3D.Legacy.Common/Data/P3DDatas/BattleClientData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleClientData.cs @@ -1,6 +1,6 @@ using System; -namespace P3D.Legacy.Common.Data.P3DDatas +namespace P3D.Legacy.Server.Client.P3D.Data.P3DDatas { public sealed record BattleClientData : P3DData { diff --git a/src/P3D.Legacy.Common/Data/P3DDatas/BattleEndRoundData.cs b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleEndRoundData.cs similarity index 88% rename from src/P3D.Legacy.Common/Data/P3DDatas/BattleEndRoundData.cs rename to src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleEndRoundData.cs index 129b1c9..68c9c2b 100644 --- a/src/P3D.Legacy.Common/Data/P3DDatas/BattleEndRoundData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleEndRoundData.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace P3D.Legacy.Common.Data.P3DDatas +namespace P3D.Legacy.Server.Client.P3D.Data.P3DDatas { public sealed record BattleEndRoundData : P3DData { diff --git a/src/P3D.Legacy.Common/Data/P3DDatas/BattleHostData.cs b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleHostData.cs similarity index 88% rename from src/P3D.Legacy.Common/Data/P3DDatas/BattleHostData.cs rename to src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleHostData.cs index f5968d5..ed04ada 100644 --- a/src/P3D.Legacy.Common/Data/P3DDatas/BattleHostData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleHostData.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace P3D.Legacy.Common.Data.P3DDatas +namespace P3D.Legacy.Server.Client.P3D.Data.P3DDatas { public sealed record BattleHostData : P3DData { diff --git a/src/P3D.Legacy.Common/Data/P3DDatas/BattleOfferData.cs b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleOfferData.cs similarity index 94% rename from src/P3D.Legacy.Common/Data/P3DDatas/BattleOfferData.cs rename to src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleOfferData.cs index 1d25e1a..1190842 100644 --- a/src/P3D.Legacy.Common/Data/P3DDatas/BattleOfferData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/BattleOfferData.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Globalization; -namespace P3D.Legacy.Common.Data.P3DDatas +namespace P3D.Legacy.Server.Client.P3D.Data.P3DDatas { // If LeadMonsterIndex is not null, this is a confirmation, else client just gives the monsters for the battle public sealed record BattleOfferData : P3DData diff --git a/src/P3D.Legacy.Common/Data/P3DDatas/P3DData.cs b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/P3DData.cs similarity index 95% rename from src/P3D.Legacy.Common/Data/P3DDatas/P3DData.cs rename to src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/P3DData.cs index 3519ebc..24a4784 100644 --- a/src/P3D.Legacy.Common/Data/P3DDatas/P3DData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/P3DData.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace P3D.Legacy.Common.Data.P3DDatas +namespace P3D.Legacy.Server.Client.P3D.Data.P3DDatas { public abstract record P3DData { diff --git a/src/P3D.Legacy.Common/Data/P3DDatas/TradeData.cs b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/TradeData.cs similarity index 85% rename from src/P3D.Legacy.Common/Data/P3DDatas/TradeData.cs rename to src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/TradeData.cs index 278c6e3..c738463 100644 --- a/src/P3D.Legacy.Common/Data/P3DDatas/TradeData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Data/P3DDatas/TradeData.cs @@ -1,6 +1,6 @@ using System; -namespace P3D.Legacy.Common.Data.P3DDatas +namespace P3D.Legacy.Server.Client.P3D.Data.P3DDatas { public sealed record TradeData : P3DData { diff --git a/src/P3D.Legacy.Common/DataItemStorage.cs b/src/P3D.Legacy.Server.Client.P3D/DataItemStorage.cs similarity index 90% rename from src/P3D.Legacy.Common/DataItemStorage.cs rename to src/P3D.Legacy.Server.Client.P3D/DataItemStorage.cs index b99c97f..d294376 100644 --- a/src/P3D.Legacy.Common/DataItemStorage.cs +++ b/src/P3D.Legacy.Server.Client.P3D/DataItemStorage.cs @@ -1,17 +1,19 @@ -using System; +using P3D.Legacy.Common; + +using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; using System.Linq; -namespace P3D.Legacy.Common +namespace P3D.Legacy.Server.Client.P3D { public sealed record DataItemStorage : IReadOnlyCollection { - private static int BootlegCount(IReadOnlyDictionary dataItems) => dataItems.Count > 0 ? dataItems.LastOrDefault().Key + 1 : 0; + private static int BootlegCount(Dictionary dataItems) => dataItems.Count > 0 ? dataItems.LastOrDefault().Key + 1 : 0; - private static IEnumerable Iterate(IReadOnlyDictionary dataItems) + private static IEnumerable Iterate(Dictionary dataItems) { var min = 0; var max = BootlegCount(dataItems); diff --git a/src/P3D.Legacy.Server.Client.P3D/Events/PlayerSentRawP3DPacketEvent.cs b/src/P3D.Legacy.Server.Client.P3D/Events/PlayerSentRawP3DPacketEvent.cs index 2f5709e..d611168 100644 --- a/src/P3D.Legacy.Server.Client.P3D/Events/PlayerSentRawP3DPacketEvent.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Events/PlayerSentRawP3DPacketEvent.cs @@ -1,5 +1,5 @@ -using P3D.Legacy.Common.Packets; -using P3D.Legacy.Server.Abstractions; +using P3D.Legacy.Server.Abstractions; +using P3D.Legacy.Server.Client.P3D.Packets; using P3D.Legacy.Server.CQERS.Events; namespace P3D.Legacy.Server.Client.P3D.Events diff --git a/src/P3D.Legacy.Server.Client.P3D/Events/PlayerTradeOfferedP3DMonsterEvent.cs b/src/P3D.Legacy.Server.Client.P3D/Events/PlayerTradeOfferedP3DMonsterEvent.cs new file mode 100644 index 0000000..eec05d1 --- /dev/null +++ b/src/P3D.Legacy.Server.Client.P3D/Events/PlayerTradeOfferedP3DMonsterEvent.cs @@ -0,0 +1,9 @@ +using P3D.Legacy.Common; +using P3D.Legacy.Server.Abstractions; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; +using P3D.Legacy.Server.CQERS.Events; + +namespace P3D.Legacy.Server.Client.P3D.Events +{ + public sealed record PlayerTradeOfferedP3DMonsterEvent(IPlayer Player, Origin Partner, TradeData Data) : IEvent; +} \ No newline at end of file diff --git a/src/P3D.Legacy.Common/Extensions/DataItemsExtensions.cs b/src/P3D.Legacy.Server.Client.P3D/Extensions/DataItemsExtensions.cs similarity index 96% rename from src/P3D.Legacy.Common/Extensions/DataItemsExtensions.cs rename to src/P3D.Legacy.Server.Client.P3D/Extensions/DataItemsExtensions.cs index c9c853d..df52aca 100644 --- a/src/P3D.Legacy.Common/Extensions/DataItemsExtensions.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Extensions/DataItemsExtensions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace P3D.Legacy.Common.Extensions +namespace P3D.Legacy.Server.Client.P3D.Extensions { public static class DataItemsExtensions { diff --git a/src/P3D.Legacy.Common/Extensions/MonsterExtensions.cs b/src/P3D.Legacy.Server.Client.P3D/Extensions/MonsterExtensions.cs similarity index 99% rename from src/P3D.Legacy.Common/Extensions/MonsterExtensions.cs rename to src/P3D.Legacy.Server.Client.P3D/Extensions/MonsterExtensions.cs index 1c5367a..a8c3225 100644 --- a/src/P3D.Legacy.Common/Extensions/MonsterExtensions.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Extensions/MonsterExtensions.cs @@ -5,7 +5,7 @@ using System.Globalization; using System.Text; -namespace P3D.Legacy.Common.Extensions +namespace P3D.Legacy.Server.Client.P3D.Extensions { public static class MonsterExtensions { diff --git a/src/P3D.Legacy.Server.Client.P3D/Extensions/ServiceCollectionExtensions.cs b/src/P3D.Legacy.Server.Client.P3D/Extensions/ServiceCollectionExtensions.cs index a6105ff..d100fac 100644 --- a/src/P3D.Legacy.Server.Client.P3D/Extensions/ServiceCollectionExtensions.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Extensions/ServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ using P3D.Legacy.Server.Application.Services; using P3D.Legacy.Server.Client.P3D.EventHandlers; +using P3D.Legacy.Server.Client.P3D.Packets; using P3D.Legacy.Server.Client.P3D.Services; using P3D.Legacy.Server.CQERS.Extensions; @@ -19,6 +20,8 @@ public static IServiceCollection AddClientP3D(this IServiceCollection services) //services.AddTransient(); //services.AddEvents(sp => sp.GetRequiredService()); + services.AddSingleton(); + services.AddHostedService(); services.AddScoped(); diff --git a/src/P3D.Legacy.Common/Extensions/Vector3Extensions.cs b/src/P3D.Legacy.Server.Client.P3D/Extensions/Vector3Extensions.cs similarity index 97% rename from src/P3D.Legacy.Common/Extensions/Vector3Extensions.cs rename to src/P3D.Legacy.Server.Client.P3D/Extensions/Vector3Extensions.cs index 841224b..7cde3a5 100644 --- a/src/P3D.Legacy.Common/Extensions/Vector3Extensions.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Extensions/Vector3Extensions.cs @@ -3,7 +3,7 @@ using System.Numerics; using System.Text; -namespace P3D.Legacy.Common.Extensions +namespace P3D.Legacy.Server.Client.P3D.Extensions { public static class Vector3Extensions { diff --git a/src/P3D.Legacy.Server.Infrastructure/Models/Monsters/MonsterEntity.cs b/src/P3D.Legacy.Server.Client.P3D/Models/Monsters/P3DMonsterEntity.cs similarity index 92% rename from src/P3D.Legacy.Server.Infrastructure/Models/Monsters/MonsterEntity.cs rename to src/P3D.Legacy.Server.Client.P3D/Models/Monsters/P3DMonsterEntity.cs index f0dd6f2..91e9419 100644 --- a/src/P3D.Legacy.Server.Infrastructure/Models/Monsters/MonsterEntity.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Models/Monsters/P3DMonsterEntity.cs @@ -1,13 +1,13 @@ -using P3D.Legacy.Common.Extensions; -using P3D.Legacy.Common.Monsters; +using P3D.Legacy.Common.Monsters; +using P3D.Legacy.Server.Client.P3D.Extensions; using System; using System.Collections.Generic; using System.Globalization; -namespace P3D.Legacy.Server.Infrastructure.Models.Monsters +namespace P3D.Legacy.Server.Client.P3D.Models.Monsters { - public sealed class MonsterEntity : IMonsterInstance + public sealed class P3DMonsterEntity : IMonsterInstance { public IMonsterStaticData StaticData { get; } public CatchInfo CatchInfo { get; } @@ -27,7 +27,7 @@ public sealed class MonsterEntity : IMonsterInstance public IItemInstance? HeldItem { get; } public IDictionary Metadata { get; } = new Dictionary(StringComparer.Ordinal); - public MonsterEntity(in ReadOnlySpan monsterData, IMonsterStaticData monsterStaticData, IReadOnlyList attacks, IItemInstance? heldItem) + public P3DMonsterEntity(in ReadOnlySpan monsterData, IMonsterStaticData monsterStaticData, IReadOnlyList attacks, IItemInstance? heldItem) { StaticData = monsterStaticData; diff --git a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Functions.cs b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Functions.cs index 5b975c1..87385b2 100644 --- a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Functions.cs +++ b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Functions.cs @@ -3,11 +3,11 @@ using OpenTelemetry.Trace; using P3D.Legacy.Common; -using P3D.Legacy.Common.Packets; -using P3D.Legacy.Common.Packets.Chat; -using P3D.Legacy.Common.Packets.Common; -using P3D.Legacy.Common.Packets.Server; using P3D.Legacy.Server.Abstractions; +using P3D.Legacy.Server.Client.P3D.Packets; +using P3D.Legacy.Server.Client.P3D.Packets.Chat; +using P3D.Legacy.Server.Client.P3D.Packets.Common; +using P3D.Legacy.Server.Client.P3D.Packets.Server; using System; using System.Diagnostics; diff --git a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Notifications.cs b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Notifications.cs index f28c985..e6e7160 100644 --- a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Notifications.cs +++ b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Notifications.cs @@ -1,9 +1,4 @@ using P3D.Legacy.Common; -using P3D.Legacy.Common.Extensions; -using P3D.Legacy.Common.Packets.Battle; -using P3D.Legacy.Common.Packets.Chat; -using P3D.Legacy.Common.Packets.Server; -using P3D.Legacy.Common.Packets.Trade; using P3D.Legacy.Common.PlayerEvents; using P3D.Legacy.Server.Abstractions; using P3D.Legacy.Server.Abstractions.Events; @@ -12,6 +7,11 @@ using P3D.Legacy.Server.Application.Queries.Options; using P3D.Legacy.Server.Application.Queries.Player; using P3D.Legacy.Server.Client.P3D.Events; +using P3D.Legacy.Server.Client.P3D.Extensions; +using P3D.Legacy.Server.Client.P3D.Packets.Battle; +using P3D.Legacy.Server.Client.P3D.Packets.Chat; +using P3D.Legacy.Server.Client.P3D.Packets.Server; +using P3D.Legacy.Server.Client.P3D.Packets.Trade; using P3D.Legacy.Server.CQERS.Events; using System; @@ -41,7 +41,7 @@ internal partial class P3DConnectionContextHandler : IEventHandler, IEventHandler, IEventHandler, - IEventHandler, + IEventHandler, IEventHandler, IEventHandler { @@ -274,19 +274,21 @@ public async Task HandleAsync(IReceiveContext context, await SendPacketAsync(new TradeQuitPacket { Origin = player.Origin, DestinationPlayerOrigin = partner }, ct); } - public async Task HandleAsync(IReceiveContext context, CancellationToken ct) + public async Task HandleAsync(IReceiveContext context, CancellationToken ct) { var (player, target, data) = context.Message; if (Origin != target) return; var cancel = false; + /* var serverOptions = await _queryDispatcher.DispatchAsync(new GetServerOptionsQuery(), ct); if (serverOptions.ValidationEnabled) { var monster = await _queryDispatcher.DispatchAsync(new GetMonsterByDataQuery(data.MonsterData), ct); cancel = !monster.IsValidP3D(); } + */ if (cancel) { diff --git a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Packets.cs b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Packets.cs index 4eda51f..2daedee 100644 --- a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Packets.cs +++ b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.Packets.cs @@ -2,14 +2,6 @@ using Microsoft.Extensions.Logging; using P3D.Legacy.Common; -using P3D.Legacy.Common.Extensions; -using P3D.Legacy.Common.Packets; -using P3D.Legacy.Common.Packets.Battle; -using P3D.Legacy.Common.Packets.Chat; -using P3D.Legacy.Common.Packets.Client; -using P3D.Legacy.Common.Packets.Common; -using P3D.Legacy.Common.Packets.Server; -using P3D.Legacy.Common.Packets.Trade; using P3D.Legacy.Common.PlayerEvents; using P3D.Legacy.Server.Abstractions; using P3D.Legacy.Server.Abstractions.Events; @@ -18,6 +10,14 @@ using P3D.Legacy.Server.Application.Queries.Player; using P3D.Legacy.Server.Application.Queries.World; using P3D.Legacy.Server.Client.P3D.Events; +using P3D.Legacy.Server.Client.P3D.Extensions; +using P3D.Legacy.Server.Client.P3D.Packets; +using P3D.Legacy.Server.Client.P3D.Packets.Battle; +using P3D.Legacy.Server.Client.P3D.Packets.Chat; +using P3D.Legacy.Server.Client.P3D.Packets.Client; +using P3D.Legacy.Server.Client.P3D.Packets.Common; +using P3D.Legacy.Server.Client.P3D.Packets.Server; +using P3D.Legacy.Server.Client.P3D.Packets.Trade; using System; using System.Collections.Immutable; @@ -422,7 +422,7 @@ private async Task HandleTradeOfferAsync(TradeOfferFromClientPacket packet, Canc if (State != PlayerState.Initialized) return; - await _eventDispatcher.DispatchAsync(new PlayerTradeOfferedPokemonEvent(this, packet.DestinationPlayerOrigin, packet.TradeData), ct); + await _eventDispatcher.DispatchAsync(new PlayerTradeOfferedP3DMonsterEvent(this, packet.DestinationPlayerOrigin, packet.TradeData), ct); } private async Task HandleTradeStartAsync(TradeStartPacket packet, CancellationToken ct) { @@ -459,6 +459,7 @@ private async Task HandleBattleOfferAsync(BattleOfferFromClientPacket packet, Ca return; var cancel = false; + /* var serverOptions = await _queryDispatcher.DispatchAsync(new GetServerOptionsQuery(), ct); if (serverOptions.ValidationEnabled) { @@ -475,6 +476,7 @@ await foreach (var monster in query) } } } + */ if (cancel) { diff --git a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.cs b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.cs index 738b193..cc5d2d6 100644 --- a/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.cs +++ b/src/P3D.Legacy.Server.Client.P3D/P3DConnectionContextHandler.cs @@ -7,10 +7,10 @@ using OpenTelemetry.Trace; using P3D.Legacy.Common; -using P3D.Legacy.Common.Packets.Client; using P3D.Legacy.Server.Abstractions; using P3D.Legacy.Server.Application.Commands.Player; using P3D.Legacy.Server.Application.Services; +using P3D.Legacy.Server.Client.P3D.Packets.Client; using P3D.Legacy.Server.CQERS.Commands; using P3D.Legacy.Server.CQERS.Events; using P3D.Legacy.Server.CQERS.Queries; diff --git a/src/P3D.Legacy.Server.Client.P3D/P3DProtocol.cs b/src/P3D.Legacy.Server.Client.P3D/P3DProtocol.cs index 1360358..f09b247 100644 --- a/src/P3D.Legacy.Server.Client.P3D/P3DProtocol.cs +++ b/src/P3D.Legacy.Server.Client.P3D/P3DProtocol.cs @@ -3,8 +3,8 @@ using Microsoft.Extensions.Logging; using P3D.Legacy.Common; -using P3D.Legacy.Common.Packets; using P3D.Legacy.Server.Client.P3D.Extensions; +using P3D.Legacy.Server.Client.P3D.Packets; using System; using System.Buffers; diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleClientDataFromClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataFromClientPacket.cs similarity index 82% rename from src/P3D.Legacy.Common/Packets/Battle/BattleClientDataFromClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataFromClientPacket.cs index a88dfc8..2de1c11 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleClientDataFromClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataFromClientPacket.cs @@ -1,6 +1,7 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleClientDataFromClientPacket() : P3DPacket(P3DPacketType.BattleClientData) { diff --git a/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataToClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataToClientPacket.cs new file mode 100644 index 0000000..3ed2f04 --- /dev/null +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleClientDataToClientPacket.cs @@ -0,0 +1,15 @@ +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle +{ + public sealed record BattleClientDataToClientPacket() : P3DPacket(P3DPacketType.BattleClientData) + { + public BattleClientData BattleData { get => new(DataItemStorage.Get(0)); init => DataItemStorage.Set(0, value.ToP3DString()); } + + public void Deconstruct(out BattleClientData battleData) + { + battleData = BattleData; + } + } +} \ No newline at end of file diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleEndRoundDataFromClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleEndRoundDataFromClientPacket.cs similarity index 82% rename from src/P3D.Legacy.Common/Packets/Battle/BattleEndRoundDataFromClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleEndRoundDataFromClientPacket.cs index 4d363d9..d3217f1 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleEndRoundDataFromClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleEndRoundDataFromClientPacket.cs @@ -1,6 +1,7 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleEndRoundDataFromClientPacket() : P3DPacket(P3DPacketType.BattleEndRoundData) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleEndRoundDataToClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleEndRoundDataToClientPacket.cs similarity index 78% rename from src/P3D.Legacy.Common/Packets/Battle/BattleEndRoundDataToClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleEndRoundDataToClientPacket.cs index 8cbba34..34550c6 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleEndRoundDataToClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleEndRoundDataToClientPacket.cs @@ -1,6 +1,6 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleEndRoundDataToClientPacket() : P3DPacket(P3DPacketType.BattleEndRoundData) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleHostDataFromClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleHostDataFromClientPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Battle/BattleHostDataFromClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleHostDataFromClientPacket.cs index 7a9c95b..bb1cb1c 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleHostDataFromClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleHostDataFromClientPacket.cs @@ -1,6 +1,7 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleHostDataFromClientPacket() : P3DPacket(P3DPacketType.BattleHostData) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleHostDataToClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleHostDataToClientPacket.cs similarity index 77% rename from src/P3D.Legacy.Common/Packets/Battle/BattleHostDataToClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleHostDataToClientPacket.cs index 860a667..485151e 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleHostDataToClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleHostDataToClientPacket.cs @@ -1,6 +1,6 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleHostDataToClientPacket() : P3DPacket(P3DPacketType.BattleHostData) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleJoinPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleJoinPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Battle/BattleJoinPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleJoinPacket.cs index 5e4b2fd..f98fc7f 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleJoinPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleJoinPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Battle +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleJoinPacket() : P3DPacket(P3DPacketType.BattleJoin) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleOfferFromClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleOfferFromClientPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Battle/BattleOfferFromClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleOfferFromClientPacket.cs index 5fd94ae..8e16e49 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleOfferFromClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleOfferFromClientPacket.cs @@ -1,6 +1,7 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleOfferFromClientPacket() : P3DPacket(P3DPacketType.BattleOffer) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleOfferToClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleOfferToClientPacket.cs similarity index 77% rename from src/P3D.Legacy.Common/Packets/Battle/BattleOfferToClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleOfferToClientPacket.cs index 1b2f734..6fbedb9 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleOfferToClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleOfferToClientPacket.cs @@ -1,6 +1,6 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Battle +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleOfferToClientPacket() : P3DPacket(P3DPacketType.BattleOffer) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleQuitPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleQuitPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Battle/BattleQuitPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleQuitPacket.cs index 263978d..09655b0 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleQuitPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleQuitPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Battle +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleQuitPacket() : P3DPacket(P3DPacketType.BattleQuit) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleRequestPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleRequestPacket.cs similarity index 82% rename from src/P3D.Legacy.Common/Packets/Battle/BattleRequestPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleRequestPacket.cs index 421aef1..988e514 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleRequestPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleRequestPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Battle +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleRequestPacket() : P3DPacket(P3DPacketType.BattleRequest) { diff --git a/src/P3D.Legacy.Common/Packets/Battle/BattleStartPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleStartPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Battle/BattleStartPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleStartPacket.cs index ca7a3c4..56d8e41 100644 --- a/src/P3D.Legacy.Common/Packets/Battle/BattleStartPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Battle/BattleStartPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Battle +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Battle { public sealed record BattleStartPacket() : P3DPacket(P3DPacketType.BattleStart) { diff --git a/src/P3D.Legacy.Common/Packets/Chat/ChatMessageGlobalPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessageGlobalPacket.cs similarity index 85% rename from src/P3D.Legacy.Common/Packets/Chat/ChatMessageGlobalPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessageGlobalPacket.cs index a1152ce..f38348c 100644 --- a/src/P3D.Legacy.Common/Packets/Chat/ChatMessageGlobalPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessageGlobalPacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Chat +namespace P3D.Legacy.Server.Client.P3D.Packets.Chat { public sealed record ChatMessageGlobalPacket() : P3DPacket(P3DPacketType.ChatMessageGlobal) { diff --git a/src/P3D.Legacy.Common/Packets/Chat/ChatMessagePrivateFromClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessagePrivateFromClientPacket.cs similarity index 90% rename from src/P3D.Legacy.Common/Packets/Chat/ChatMessagePrivateFromClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessagePrivateFromClientPacket.cs index 4f5ed4f..a4b6aaf 100644 --- a/src/P3D.Legacy.Common/Packets/Chat/ChatMessagePrivateFromClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessagePrivateFromClientPacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Chat +namespace P3D.Legacy.Server.Client.P3D.Packets.Chat { public sealed record ChatMessagePrivateFromClientPacket() : P3DPacket(P3DPacketType.ChatMessagePrivate) { diff --git a/src/P3D.Legacy.Common/Packets/Chat/ChatMessagePrivateToClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessagePrivateToClientPacket.cs similarity index 90% rename from src/P3D.Legacy.Common/Packets/Chat/ChatMessagePrivateToClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessagePrivateToClientPacket.cs index 47bf0e3..39a396f 100644 --- a/src/P3D.Legacy.Common/Packets/Chat/ChatMessagePrivateToClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Chat/ChatMessagePrivateToClientPacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Chat +namespace P3D.Legacy.Server.Client.P3D.Packets.Chat { public sealed record ChatMessagePrivateToClientPacket() : P3DPacket(P3DPacketType.ChatMessagePrivate) { diff --git a/src/P3D.Legacy.Common/Packets/Client/PingPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Client/PingPacket.cs similarity index 56% rename from src/P3D.Legacy.Common/Packets/Client/PingPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Client/PingPacket.cs index f512704..ac5989e 100644 --- a/src/P3D.Legacy.Common/Packets/Client/PingPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Client/PingPacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Client +namespace P3D.Legacy.Server.Client.P3D.Packets.Client { public sealed record PingPacket() : P3DPacket(P3DPacketType.Ping); } \ No newline at end of file diff --git a/src/P3D.Legacy.Common/Packets/Client/ServerDataRequestPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Client/ServerDataRequestPacket.cs similarity index 63% rename from src/P3D.Legacy.Common/Packets/Client/ServerDataRequestPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Client/ServerDataRequestPacket.cs index ad7e00b..81217df 100644 --- a/src/P3D.Legacy.Common/Packets/Client/ServerDataRequestPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Client/ServerDataRequestPacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Client +namespace P3D.Legacy.Server.Client.P3D.Packets.Client { public sealed record ServerDataRequestPacket() : P3DPacket(P3DPacketType.ServerDataRequest); } \ No newline at end of file diff --git a/src/P3D.Legacy.Common/Packets/Common/GameDataPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Common/GameDataPacket.cs similarity index 96% rename from src/P3D.Legacy.Common/Packets/Common/GameDataPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Common/GameDataPacket.cs index 4c94431..459086e 100644 --- a/src/P3D.Legacy.Common/Packets/Common/GameDataPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Common/GameDataPacket.cs @@ -1,8 +1,8 @@ -using P3D.Legacy.Common.Extensions; +using P3D.Legacy.Server.Client.P3D.Extensions; using System.Numerics; -namespace P3D.Legacy.Common.Packets.Common +namespace P3D.Legacy.Server.Client.P3D.Packets.Common { public sealed record GameDataPacket() : P3DPacket(P3DPacketType.GameData) { diff --git a/src/P3D.Legacy.Common/Packets/Common/GameStateMessagePacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Common/GameStateMessagePacket.cs similarity index 85% rename from src/P3D.Legacy.Common/Packets/Common/GameStateMessagePacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Common/GameStateMessagePacket.cs index cf789f2..d3705f9 100644 --- a/src/P3D.Legacy.Common/Packets/Common/GameStateMessagePacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Common/GameStateMessagePacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Common +namespace P3D.Legacy.Server.Client.P3D.Packets.Common { public sealed record GameStateMessagePacket() : P3DPacket(P3DPacketType.GameStateMessage) { diff --git a/src/P3D.Legacy.Common/Packets/P3DPacket.Parsing.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacket.Parsing.cs similarity index 97% rename from src/P3D.Legacy.Common/Packets/P3DPacket.Parsing.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacket.Parsing.cs index cb93f1d..c918723 100644 --- a/src/P3D.Legacy.Common/Packets/P3DPacket.Parsing.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacket.Parsing.cs @@ -1,9 +1,11 @@ -using System; +using P3D.Legacy.Common; + +using System; using System.Buffers; using System.Buffers.Text; using System.Text; -namespace P3D.Legacy.Common.Packets +namespace P3D.Legacy.Server.Client.P3D.Packets { public abstract partial record P3DPacket { diff --git a/src/P3D.Legacy.Common/Packets/P3DPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacket.cs similarity index 89% rename from src/P3D.Legacy.Common/Packets/P3DPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacket.cs index 51b049b..f42e958 100644 --- a/src/P3D.Legacy.Common/Packets/P3DPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets { public abstract partial record P3DPacket(P3DPacketType Id) { diff --git a/src/P3D.Legacy.Common/Packets/P3DPacketFactory.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacketFactory.cs similarity index 92% rename from src/P3D.Legacy.Common/Packets/P3DPacketFactory.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacketFactory.cs index 3e11fa0..cb64615 100644 --- a/src/P3D.Legacy.Common/Packets/P3DPacketFactory.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacketFactory.cs @@ -1,11 +1,11 @@ -using P3D.Legacy.Common.Packets.Battle; -using P3D.Legacy.Common.Packets.Chat; -using P3D.Legacy.Common.Packets.Client; -using P3D.Legacy.Common.Packets.Common; -using P3D.Legacy.Common.Packets.Server; -using P3D.Legacy.Common.Packets.Trade; +using P3D.Legacy.Server.Client.P3D.Packets.Battle; +using P3D.Legacy.Server.Client.P3D.Packets.Chat; +using P3D.Legacy.Server.Client.P3D.Packets.Client; +using P3D.Legacy.Server.Client.P3D.Packets.Common; +using P3D.Legacy.Server.Client.P3D.Packets.Server; +using P3D.Legacy.Server.Client.P3D.Packets.Trade; -namespace P3D.Legacy.Common.Packets +namespace P3D.Legacy.Server.Client.P3D.Packets { public interface IP3DPacketFactory { diff --git a/src/P3D.Legacy.Common/Packets/P3DPacketType.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacketType.cs similarity index 96% rename from src/P3D.Legacy.Common/Packets/P3DPacketType.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacketType.cs index 1a39a95..6f48b40 100644 --- a/src/P3D.Legacy.Common/Packets/P3DPacketType.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/P3DPacketType.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets +namespace P3D.Legacy.Server.Client.P3D.Packets { public enum P3DPacketType : byte { diff --git a/src/P3D.Legacy.Common/Packets/Server/CreatePlayerPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/CreatePlayerPacket.cs similarity index 80% rename from src/P3D.Legacy.Common/Packets/Server/CreatePlayerPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/CreatePlayerPacket.cs index 89c071b..18f9051 100644 --- a/src/P3D.Legacy.Common/Packets/Server/CreatePlayerPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/CreatePlayerPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Server +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record CreatePlayerPacket() : P3DPacket(P3DPacketType.CreatePlayer) { diff --git a/src/P3D.Legacy.Common/Packets/Server/DestroyPlayerPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/DestroyPlayerPacket.cs similarity index 80% rename from src/P3D.Legacy.Common/Packets/Server/DestroyPlayerPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/DestroyPlayerPacket.cs index d1c8963..9cbe2dd 100644 --- a/src/P3D.Legacy.Common/Packets/Server/DestroyPlayerPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/DestroyPlayerPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Server +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record DestroyPlayerPacket() : P3DPacket(P3DPacketType.DestroyPlayer) { diff --git a/src/P3D.Legacy.Common/Packets/Server/IDPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/IDPacket.cs similarity index 79% rename from src/P3D.Legacy.Common/Packets/Server/IDPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/IDPacket.cs index 50220b6..57f3801 100644 --- a/src/P3D.Legacy.Common/Packets/Server/IDPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/IDPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Server +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record IdPacket() : P3DPacket(P3DPacketType.Id) { diff --git a/src/P3D.Legacy.Common/Packets/Server/KickedPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/KickedPacket.cs similarity index 83% rename from src/P3D.Legacy.Common/Packets/Server/KickedPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/KickedPacket.cs index 559cef6..e620442 100644 --- a/src/P3D.Legacy.Common/Packets/Server/KickedPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/KickedPacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Server +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record KickedPacket() : P3DPacket(P3DPacketType.Kicked) { diff --git a/src/P3D.Legacy.Common/Packets/Server/ServerClosePacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerClosePacket.cs similarity index 84% rename from src/P3D.Legacy.Common/Packets/Server/ServerClosePacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerClosePacket.cs index 8bd3e5b..274ec20 100644 --- a/src/P3D.Legacy.Common/Packets/Server/ServerClosePacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerClosePacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Server +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record ServerClosePacket() : P3DPacket(P3DPacketType.ServerClose) { diff --git a/src/P3D.Legacy.Common/Packets/Server/ServerInfoDataPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerInfoDataPacket.cs similarity index 95% rename from src/P3D.Legacy.Common/Packets/Server/ServerInfoDataPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerInfoDataPacket.cs index 0d837c3..54fff41 100644 --- a/src/P3D.Legacy.Common/Packets/Server/ServerInfoDataPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerInfoDataPacket.cs @@ -1,7 +1,7 @@ using System.Collections.Immutable; using System.Linq; -namespace P3D.Legacy.Common.Packets.Server +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record ServerInfoDataPacket() : P3DPacket(P3DPacketType.ServerInfoData) { diff --git a/src/P3D.Legacy.Common/Packets/Server/ServerMessagePacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerMessagePacket.cs similarity index 84% rename from src/P3D.Legacy.Common/Packets/Server/ServerMessagePacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerMessagePacket.cs index 0fb8502..6369b48 100644 --- a/src/P3D.Legacy.Common/Packets/Server/ServerMessagePacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/ServerMessagePacket.cs @@ -1,4 +1,4 @@ -namespace P3D.Legacy.Common.Packets.Server +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record ServerMessagePacket() : P3DPacket(P3DPacketType.ServerMessage) { diff --git a/src/P3D.Legacy.Common/Packets/Server/WorldDataPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/WorldDataPacket.cs similarity index 93% rename from src/P3D.Legacy.Common/Packets/Server/WorldDataPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Server/WorldDataPacket.cs index 579f0c1..2aa9129 100644 --- a/src/P3D.Legacy.Common/Packets/Server/WorldDataPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Server/WorldDataPacket.cs @@ -1,6 +1,6 @@ using P3D.Legacy.Common.Data; -namespace P3D.Legacy.Common.Packets.Server +namespace P3D.Legacy.Server.Client.P3D.Packets.Server { public sealed record WorldDataPacket() : P3DPacket(P3DPacketType.WorldData) { diff --git a/src/P3D.Legacy.Common/Packets/Trade/TradeJoinPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeJoinPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Trade/TradeJoinPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeJoinPacket.cs index 9c59578..e797866 100644 --- a/src/P3D.Legacy.Common/Packets/Trade/TradeJoinPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeJoinPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Trade +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Trade { public sealed record TradeJoinPacket() : P3DPacket(P3DPacketType.TradeJoin) { diff --git a/src/P3D.Legacy.Common/Packets/Trade/TradeOfferFromClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeOfferFromClientPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Trade/TradeOfferFromClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeOfferFromClientPacket.cs index cfc2a2a..98c66ed 100644 --- a/src/P3D.Legacy.Common/Packets/Trade/TradeOfferFromClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeOfferFromClientPacket.cs @@ -1,6 +1,7 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Trade +namespace P3D.Legacy.Server.Client.P3D.Packets.Trade { public sealed record TradeOfferFromClientPacket() : P3DPacket(P3DPacketType.TradeOffer) { diff --git a/src/P3D.Legacy.Common/Packets/Trade/TradeOfferToClientPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeOfferToClientPacket.cs similarity index 76% rename from src/P3D.Legacy.Common/Packets/Trade/TradeOfferToClientPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeOfferToClientPacket.cs index 1fc7189..7e7cf20 100644 --- a/src/P3D.Legacy.Common/Packets/Trade/TradeOfferToClientPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeOfferToClientPacket.cs @@ -1,6 +1,6 @@ -using P3D.Legacy.Common.Data.P3DDatas; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; -namespace P3D.Legacy.Common.Packets.Trade +namespace P3D.Legacy.Server.Client.P3D.Packets.Trade { public sealed record TradeOfferToClientPacket() : P3DPacket(P3DPacketType.TradeOffer) { diff --git a/src/P3D.Legacy.Common/Packets/Trade/TradeQuitPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeQuitPacket.cs similarity index 81% rename from src/P3D.Legacy.Common/Packets/Trade/TradeQuitPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeQuitPacket.cs index 20c0e5d..36db82a 100644 --- a/src/P3D.Legacy.Common/Packets/Trade/TradeQuitPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeQuitPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Trade +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Trade { public sealed record TradeQuitPacket() : P3DPacket(P3DPacketType.TradeQuit) { diff --git a/src/P3D.Legacy.Common/Packets/Trade/TradeRequestPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeRequestPacket.cs similarity index 82% rename from src/P3D.Legacy.Common/Packets/Trade/TradeRequestPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeRequestPacket.cs index fb40c4a..5e4ab85 100644 --- a/src/P3D.Legacy.Common/Packets/Trade/TradeRequestPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeRequestPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Trade +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Trade { public sealed record TradeRequestPacket() : P3DPacket(P3DPacketType.TradeRequest) { diff --git a/src/P3D.Legacy.Common/Packets/Trade/TradeStartPacket.cs b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeStartPacket.cs similarity index 82% rename from src/P3D.Legacy.Common/Packets/Trade/TradeStartPacket.cs rename to src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeStartPacket.cs index 5eb8a0a..a134a8b 100644 --- a/src/P3D.Legacy.Common/Packets/Trade/TradeStartPacket.cs +++ b/src/P3D.Legacy.Server.Client.P3D/Packets/Trade/TradeStartPacket.cs @@ -1,4 +1,6 @@ -namespace P3D.Legacy.Common.Packets.Trade +using P3D.Legacy.Common; + +namespace P3D.Legacy.Server.Client.P3D.Packets.Trade { public sealed record TradeStartPacket() : P3DPacket(P3DPacketType.TradeStart) { diff --git a/src/P3D.Legacy.Common/Protocol.cs b/src/P3D.Legacy.Server.Client.P3D/Protocol.cs similarity index 100% rename from src/P3D.Legacy.Common/Protocol.cs rename to src/P3D.Legacy.Server.Client.P3D/Protocol.cs diff --git a/src/P3D.Legacy.Common/RawPacketData.cs b/src/P3D.Legacy.Server.Client.P3D/RawPacketData.cs similarity index 71% rename from src/P3D.Legacy.Common/RawPacketData.cs rename to src/P3D.Legacy.Server.Client.P3D/RawPacketData.cs index 5aa1712..3c31309 100644 --- a/src/P3D.Legacy.Common/RawPacketData.cs +++ b/src/P3D.Legacy.Server.Client.P3D/RawPacketData.cs @@ -1,6 +1,7 @@ -using P3D.Legacy.Common.Packets; +using P3D.Legacy.Common; +using P3D.Legacy.Server.Client.P3D.Packets; -namespace P3D.Legacy.Common +namespace P3D.Legacy.Server.Client.P3D { // PROTOCOL|ID|ORIGIN|DATA ITEM COUNT|0|NTH DATA ITEM POSITION|DATA ITEMS CONCATENATED\r\n diff --git a/src/P3D.Legacy.Server.Infrastructure/Extensions/ServiceCollectionExtensions.cs b/src/P3D.Legacy.Server.Infrastructure/Extensions/ServiceCollectionExtensions.cs index 01dd438..936103c 100644 --- a/src/P3D.Legacy.Server.Infrastructure/Extensions/ServiceCollectionExtensions.cs +++ b/src/P3D.Legacy.Server.Infrastructure/Extensions/ServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ using P3D.Legacy.Server.Infrastructure.Options; using P3D.Legacy.Server.Infrastructure.Repositories.Bans; -using P3D.Legacy.Server.Infrastructure.Repositories.Monsters; using P3D.Legacy.Server.Infrastructure.Repositories.Mutes; using P3D.Legacy.Server.Infrastructure.Repositories.Permissions; using P3D.Legacy.Server.Infrastructure.Repositories.Statistics; @@ -34,9 +33,11 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi services.AddTransient(); services.AddTransient(); + /* services.AddTransient(); services.AddTransient(); services.AddTransient(); + */ services.AddTransient(); services.AddTransient(); diff --git a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/IMonsterRepository.cs b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/IMonsterRepository.cs index e4763c3..6b6cb7f 100644 --- a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/IMonsterRepository.cs +++ b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/IMonsterRepository.cs @@ -1,4 +1,5 @@ -using P3D.Legacy.Common.Monsters; +/* +using P3D.Legacy.Common.Monsters; using System.Threading; using System.Threading.Tasks; @@ -9,4 +10,5 @@ public interface IMonsterRepository { Task GetByDataAsync(string monsterDataStr, CancellationToken ct); } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/MonsterRepository.cs b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/MonsterRepository.cs index 00d6c36..51d4070 100644 --- a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/MonsterRepository.cs +++ b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/MonsterRepository.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Options; +/* +using Microsoft.Extensions.Options; using P3D.Legacy.Common.Monsters; using P3D.Legacy.Server.Abstractions.Options; @@ -25,4 +26,5 @@ public MonsterRepository(IOptions serverOptions, PokeAPIMonsterRe public Task GetByDataAsync(string monsterData, CancellationToken ct) => _implementation.GetByDataAsync(monsterData, ct); } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/NopMonsterRepository.cs b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/NopMonsterRepository.cs index ce9d47a..eab1eaf 100644 --- a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/NopMonsterRepository.cs +++ b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/NopMonsterRepository.cs @@ -1,4 +1,5 @@ -using P3D.Legacy.Common.Monsters; +/* +using P3D.Legacy.Common.Monsters; using System.Collections.Generic; using System.Threading; @@ -26,4 +27,5 @@ private sealed record NopMonsterInstance : IMonsterInstance public Task GetByDataAsync(string monsterData, CancellationToken ct) => Task.FromResult(new NopMonsterInstance()); } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/PokeAPIMonsterRepository.cs b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/PokeAPIMonsterRepository.cs index 93575d7..e1b13bd 100644 --- a/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/PokeAPIMonsterRepository.cs +++ b/src/P3D.Legacy.Server.Infrastructure/Repositories/Monsters/PokeAPIMonsterRepository.cs @@ -1,4 +1,5 @@ -using GraphQL; +/* +using GraphQL; using GraphQL.Client.Http; using GraphQL.Client.Serializer.SystemTextJson; @@ -166,32 +167,30 @@ monsterData.Species.GrowthRate.Name switch var staticData = new AttackStaticDataEntity(move3Id, "", pp3); moves.Add(new AttackEntity(staticData, currentPP3, 0)); } - /* - if (move0.Length != 1 && ushort.TryParse(move0[0], out var move0Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move0Id) is var (_, _, (_, pp0))) - { - var ppUps = (byte) Math.Round((double) (byte.Parse(move0[1]) - pp0) / pp0 / 0.2D); - var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move0Id); - moves.Add(new AttackEntity(staticData, byte.Parse(move0[2]), ppUps)); - } - if (move1.Length != 1 && ushort.TryParse(move1[0], out var move1Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move1Id) is var (_, _, (_, pp1))) - { - var ppUps = (byte) Math.Round((double) (byte.Parse(move1[1]) - pp1) / pp1 / 0.2D); - var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move1Id); - moves.Add(new AttackEntity(staticData, byte.Parse(move1[2]), ppUps)); - } - if (move2.Length != 1 && ushort.TryParse(move2[0], out var move2Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move2Id) is var (_, _, (_, pp2))) - { - var ppUps = (byte) Math.Round((double) (byte.Parse(move2[1]) - pp2) / pp2 / 0.2D); - var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move2Id); - moves.Add(new AttackEntity(staticData, byte.Parse(move2[2]), ppUps)); - } - if (move3.Length != 1 && ushort.TryParse(move3[0], out var move3Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move3Id) is var (_, _, (_, pp3))) - { - var ppUps = (byte) Math.Round((double) (byte.Parse(move3[1]) - pp3) / pp3 / 0.2D); - var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move3Id); - moves.Add(new AttackEntity(staticData, byte.Parse(move3[2]), ppUps)); - } - */ + //if (move0.Length != 1 && ushort.TryParse(move0[0], out var move0Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move0Id) is var (_, _, (_, pp0))) + //{ + // var ppUps = (byte) Math.Round((double) (byte.Parse(move0[1]) - pp0) / pp0 / 0.2D); + // var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move0Id); + // moves.Add(new AttackEntity(staticData, byte.Parse(move0[2]), ppUps)); + //} + //if (move1.Length != 1 && ushort.TryParse(move1[0], out var move1Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move1Id) is var (_, _, (_, pp1))) + //{ + // var ppUps = (byte) Math.Round((double) (byte.Parse(move1[1]) - pp1) / pp1 / 0.2D); + // var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move1Id); + // moves.Add(new AttackEntity(staticData, byte.Parse(move1[2]), ppUps)); + //} + //if (move2.Length != 1 && ushort.TryParse(move2[0], out var move2Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move2Id) is var (_, _, (_, pp2))) + //{ + // var ppUps = (byte) Math.Round((double) (byte.Parse(move2[1]) - pp2) / pp2 / 0.2D); + // var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move2Id); + // moves.Add(new AttackEntity(staticData, byte.Parse(move2[2]), ppUps)); + //} + //if (move3.Length != 1 && ushort.TryParse(move3[0], out var move3Id) && monsterData.Moves.FirstOrDefault(x => x.MoveId == move3Id) is var (_, _, (_, pp3))) + //{ + // var ppUps = (byte) Math.Round((double) (byte.Parse(move3[1]) - pp3) / pp3 / 0.2D); + // var staticData = monsterStaticData.LearnableAttacks.First(x => x.Id == move3Id); + // moves.Add(new AttackEntity(staticData, byte.Parse(move3[2]), ppUps)); + //} var monster = new MonsterEntity(monsterDataStr, monsterStaticData, moves, heldItem); return monster; @@ -282,4 +281,5 @@ private sealed record Response( [property: JsonPropertyName("pokemon_v2_item")] V2Item[] Item ); } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/BaseTests.cs b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/BaseTests.cs index 865e676..d32ff8e 100644 --- a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/BaseTests.cs +++ b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/BaseTests.cs @@ -4,9 +4,9 @@ using OpenTelemetry.Trace; -using P3D.Legacy.Common.Packets; using P3D.Legacy.Server.Application.Services; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets; using P3D.Legacy.Tests.Utils; using System; diff --git a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ChatTests.cs b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ChatTests.cs index 6c1c2b1..987e394 100644 --- a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ChatTests.cs +++ b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ChatTests.cs @@ -7,9 +7,6 @@ using P3D.Legacy.Common; using P3D.Legacy.Common.Data; -using P3D.Legacy.Common.Packets.Chat; -using P3D.Legacy.Common.Packets.Common; -using P3D.Legacy.Common.Packets.Server; using P3D.Legacy.Server.Abstractions; using P3D.Legacy.Server.Abstractions.Events; using P3D.Legacy.Server.Abstractions.Options; @@ -18,6 +15,9 @@ using P3D.Legacy.Server.Application.Queries.Player; using P3D.Legacy.Server.Application.Queries.World; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets.Chat; +using P3D.Legacy.Server.Client.P3D.Packets.Common; +using P3D.Legacy.Server.Client.P3D.Packets.Server; using P3D.Legacy.Server.CQERS.Commands; using P3D.Legacy.Server.CQERS.Events; using P3D.Legacy.Server.CQERS.Queries; diff --git a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/JoinTests.cs b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/JoinTests.cs index e8beb89..bc7d129 100644 --- a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/JoinTests.cs +++ b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/JoinTests.cs @@ -7,9 +7,6 @@ using P3D.Legacy.Common; using P3D.Legacy.Common.Data; -using P3D.Legacy.Common.Packets; -using P3D.Legacy.Common.Packets.Common; -using P3D.Legacy.Common.Packets.Server; using P3D.Legacy.Server.Abstractions; using P3D.Legacy.Server.Abstractions.Events; using P3D.Legacy.Server.Abstractions.Options; @@ -18,6 +15,9 @@ using P3D.Legacy.Server.Application.Queries.Player; using P3D.Legacy.Server.Application.Queries.World; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets; +using P3D.Legacy.Server.Client.P3D.Packets.Common; +using P3D.Legacy.Server.Client.P3D.Packets.Server; using P3D.Legacy.Server.CQERS.Commands; using P3D.Legacy.Server.CQERS.Events; using P3D.Legacy.Server.CQERS.Queries; diff --git a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ServerDiscoveryTests.cs b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ServerDiscoveryTests.cs index 0480610..25631ea 100644 --- a/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ServerDiscoveryTests.cs +++ b/tests/P3D.Legacy.Tests/Client.P3D/P3DConnectionContextHandlerTests/ServerDiscoveryTests.cs @@ -7,13 +7,13 @@ using NUnit.Framework; -using P3D.Legacy.Common.Packets.Client; -using P3D.Legacy.Common.Packets.Server; using P3D.Legacy.Server.Abstractions; using P3D.Legacy.Server.Abstractions.Options; using P3D.Legacy.Server.Application.Queries.Options; using P3D.Legacy.Server.Application.Queries.Player; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets.Client; +using P3D.Legacy.Server.Client.P3D.Packets.Server; using P3D.Legacy.Server.CQERS.Commands; using P3D.Legacy.Server.CQERS.Events; using P3D.Legacy.Server.CQERS.Queries; diff --git a/tests/P3D.Legacy.Tests/Client.P3D/P3DPacketSample.cs b/tests/P3D.Legacy.Tests/Client.P3D/P3DPacketSample.cs index 297cc62..1e4802e 100644 --- a/tests/P3D.Legacy.Tests/Client.P3D/P3DPacketSample.cs +++ b/tests/P3D.Legacy.Tests/Client.P3D/P3DPacketSample.cs @@ -1,5 +1,5 @@ -using P3D.Legacy.Common.Extensions; -using P3D.Legacy.Common.Packets; +using P3D.Legacy.Server.Client.P3D.Extensions; +using P3D.Legacy.Server.Client.P3D.Packets; using System; using System.Numerics; diff --git a/tests/P3D.Legacy.Tests/Client.P3D/P3DProtocolTests.cs b/tests/P3D.Legacy.Tests/Client.P3D/P3DProtocolTests.cs index 93ab3d3..73b8437 100644 --- a/tests/P3D.Legacy.Tests/Client.P3D/P3DProtocolTests.cs +++ b/tests/P3D.Legacy.Tests/Client.P3D/P3DProtocolTests.cs @@ -2,8 +2,8 @@ using NUnit.Framework; -using P3D.Legacy.Common.Packets; using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Packets; using System; using System.Buffers; diff --git a/tests/P3D.Legacy.Tests/DataItemTests.cs b/tests/P3D.Legacy.Tests/DataItemTests.cs index 410fe7b..1fa438c 100644 --- a/tests/P3D.Legacy.Tests/DataItemTests.cs +++ b/tests/P3D.Legacy.Tests/DataItemTests.cs @@ -1,7 +1,8 @@ using NUnit.Framework; using P3D.Legacy.Common; -using P3D.Legacy.Common.Extensions; +using P3D.Legacy.Server.Client.P3D; +using P3D.Legacy.Server.Client.P3D.Extensions; using System.Numerics; diff --git a/tests/P3D.Legacy.Tests/MonsterTests.cs b/tests/P3D.Legacy.Tests/MonsterTests.cs index 568a917..53790df 100644 --- a/tests/P3D.Legacy.Tests/MonsterTests.cs +++ b/tests/P3D.Legacy.Tests/MonsterTests.cs @@ -3,10 +3,9 @@ using NUnit.Framework; -using P3D.Legacy.Common.Data.P3DDatas; -using P3D.Legacy.Common.Extensions; +using P3D.Legacy.Server.Client.P3D.Data.P3DDatas; +using P3D.Legacy.Server.Client.P3D.Extensions; using P3D.Legacy.Server.Infrastructure.Options; -using P3D.Legacy.Server.Infrastructure.Repositories.Monsters; using P3D.Legacy.Tests.Utils; using System; @@ -20,6 +19,7 @@ internal sealed class MonsterTests { private static string[] TestCaseSources() => File.ReadAllLines("./Data/Monsters.txt"); + /* [Test] [TestCaseSource(nameof(TestCaseSources))] public async Task TestMonsterCreationViaPokeAPIAsync(string line) => await TestService.CreateNew() @@ -40,6 +40,7 @@ public async Task TestMonsterCreationViaPokeAPIAsync(string line) => await TestS Assert.AreEqual(line, convertedBack); } }); + */ [Test] [TestCaseSource(nameof(TestCaseSources))]