From c1d6e2d53f0489121517d207d2b5e31707633dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Fri, 10 Nov 2023 21:30:14 +0100 Subject: [PATCH] Add and apply stylecop rules --- .editorconfig | 11 + Lib/Core.Data/Database.cs | 19 +- Lib/Core.Data/EntityGuid.cs | 11 +- Lib/Shared.Common/DateTimeExtensions.cs | 8 +- Lib/Shared.Common/LocationProvider.cs | 6 +- Lib/Shared.Common/SerilogTheme.cs | 4 +- Lib/Shared.Udp/Deserializer.cs | 174 ++--- Lib/Shared.Udp/ExistsPrefixAttribute.cs | 6 +- Lib/Shared.Udp/LengthPrefixedAttribute.cs | 4 +- Lib/Shared.Udp/Packet.cs | 11 +- Lib/Shared.Udp/PacketServer.cs | 68 +- Lib/Shared.Udp/Packets/BasePacketView.cs | 21 +- Lib/Shared.Udp/Packets/BitEndianness.cs | 10 + Lib/Shared.Udp/Packets/ViewFactory.cs | 10 +- Lib/Shared.Udp/Serializer.cs | 2 + Lib/Shared.Web/BaseWebServer.cs | 28 +- PIN.targets | 8 + UdpHosts/GameServer/Channel.cs | 93 ++- UdpHosts/GameServer/ChannelType.cs | 10 + UdpHosts/GameServer/Controllers/Base.cs | 6 +- .../Controllers/Character/BaseController.cs | 38 +- .../Controllers/Character/CombatController.cs | 75 +- UdpHosts/GameServer/Controllers/Factory.cs | 4 +- UdpHosts/GameServer/Controllers/Generic.cs | 6 +- .../Controllers/Vehicle/BaseController.cs | 2 - .../Controllers/Vehicle/CombatController.cs | 1 - UdpHosts/GameServer/Data/Character.cs | 18 - UdpHosts/GameServer/Data/CharacterGender.cs | 7 + UdpHosts/GameServer/Data/CharacterRace.cs | 8 + UdpHosts/GameServer/Data/ChassisVisuals.cs | 4 +- UdpHosts/GameServer/Data/CommonVisuals.cs | 5 +- UdpHosts/GameServer/Data/Loadout.cs | 15 +- .../Entities/Character/Character.cs | 3 +- .../Character/MovementStateContainer.cs | 108 ++- UdpHosts/GameServer/Enums.cs | 638 ------------------ .../GameServer/Enums/ControlPacketType.cs | 11 + .../Enums/GSS/AreaVisualData/Events.cs | 10 + .../Enums/GSS/Character/Commands.cs | 174 +++++ .../GameServer/Enums/GSS/Character/Events.cs | 121 ++++ UdpHosts/GameServer/Enums/GSS/Controllers.cs | 59 ++ .../GameServer/Enums/GSS/Deployable/Events.cs | 10 + .../GameServer/Enums/GSS/Generic/Commands.cs | 20 + .../GameServer/Enums/GSS/Generic/Events.cs | 96 +++ .../Enums/GSS/LootStoreExtensions/Events.cs | 8 + .../GameServer/Enums/GSS/Turret/Commands.cs | 10 + .../GameServer/Enums/GSS/Turret/Events.cs | 8 + .../GameServer/Enums/GSS/Vehicle/Commands.cs | 13 + .../GameServer/Enums/GSS/Vehicle/Events.cs | 16 + UdpHosts/GameServer/Enums/MatrixPacketType.cs | 57 ++ .../GameServer/Enums/Visuals/PaletteType.cs | 11 + UdpHosts/GameServer/Extensions/GamePacket.cs | 3 +- UdpHosts/GameServer/Extensions/IAero.cs | 4 +- UdpHosts/GameServer/GameServer.cs | 34 +- UdpHosts/GameServer/GameServer.csproj | 2 +- UdpHosts/GameServer/INetworkClient.cs | 4 +- UdpHosts/GameServer/IPlayer.cs | 4 +- UdpHosts/GameServer/IShard.cs | 6 +- UdpHosts/GameServer/NetworkClient.cs | 29 +- UdpHosts/GameServer/NetworkPlayer.cs | 16 +- UdpHosts/GameServer/Packets/Common/Vector.cs | 4 +- .../GameServer/Packets/Control/MTUProbe.cs | 4 +- .../Packets/Control/TimeSyncRequest.cs | 4 +- .../Packets/Control/TimeSyncResponse.cs | 4 +- .../Packets/ControlMessageAttribute.cs | 4 +- .../Packets/GSS/ArcCompletionHistoryUpdate.cs | 6 +- .../MissionAndMarkerController/KeyFrame.cs | 4 +- UdpHosts/GameServer/Packets/GamePacket.cs | 21 +- .../GameServer/Packets/GamePacketHeader.cs | 10 +- .../Packets/MatrixMessageAttribute.cs | 4 +- UdpHosts/GameServer/PhysicsEngine.cs | 2 +- UdpHosts/GameServer/Program.cs | 12 +- UdpHosts/GameServer/ReflectionUtils.cs | 4 +- UdpHosts/GameServer/Shard.cs | 20 +- UdpHosts/GameServer/Test/DataUtils.cs | 4 +- UdpHosts/MatrixServer/MatrixServer.cs | 6 +- .../MatrixServer/Packets/MatrixPacketAbrt.cs | 4 +- .../MatrixServer/Packets/MatrixPacketBase.cs | 4 +- .../MatrixServer/Packets/MatrixPacketHehe.cs | 4 +- .../MatrixServer/Packets/MatrixPacketHugg.cs | 4 +- .../MatrixServer/Packets/MatrixPacketKiss.cs | 4 +- .../MatrixServer/Packets/MatrixPacketPoke.cs | 4 +- UdpHosts/MatrixServer/Program.cs | 12 +- WebHosts/WebHost.CatchAll/WebServer.cs | 14 +- WebHosts/WebHost.Chat/WebServer.cs | 14 +- .../Accounts/AccountsController.cs | 53 +- .../Armies/ArmiesController.cs | 31 +- .../WebHost.ClientApi/Armies/Models/Army.cs | 2 +- .../Characters/CharactersController.cs | 25 +- .../ClientEvent/ClientEventController.cs | 4 +- .../Login/LoginController.cs | 9 +- .../WebHost.ClientApi/Mail/MailController.cs | 5 +- .../Oracle/OracleController.cs | 7 +- .../Server/ServerController.cs | 8 +- WebHosts/WebHost.ClientApi/WebServer.cs | 9 +- .../WebHost.ClientApi/Zones/Models/Zone.cs | 31 + .../Zones/Models/ZoneSettings.cs | 32 +- .../Zones/ZonesController.cs | 4 +- .../Controllers/CharactersData.cs | 219 +++--- .../Controllers/LoginAlertsController.cs | 7 +- .../Controllers/PanelManagerController.cs | 7 +- .../Controllers/SocialDataController.cs | 11 +- WebHosts/WebHost.InGameApi/WebServer.cs | 14 +- .../Controllers/MarketController.cs | 6 +- WebHosts/WebHost.Market/WebServer.cs | 14 +- .../Controllers/CapabilityController.cs | 4 +- WebHosts/WebHost.OperatorApi/WebServer.cs | 9 +- WebHosts/WebHost.Replay/WebServer.cs | 14 +- WebHosts/WebHost.Store/WebServer.cs | 14 +- WebHosts/WebHost.WebAsset/WebServer.cs | 18 +- WebHosts/WebHostManager/Program.cs | 12 +- stylecop.ruleset | 217 ++++++ 111 files changed, 1753 insertions(+), 1378 deletions(-) create mode 100644 Lib/Shared.Udp/Packets/BitEndianness.cs create mode 100644 UdpHosts/GameServer/ChannelType.cs create mode 100644 UdpHosts/GameServer/Data/CharacterGender.cs create mode 100644 UdpHosts/GameServer/Data/CharacterRace.cs delete mode 100644 UdpHosts/GameServer/Enums.cs create mode 100644 UdpHosts/GameServer/Enums/ControlPacketType.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/AreaVisualData/Events.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Character/Commands.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Character/Events.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Controllers.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Deployable/Events.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Generic/Commands.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Generic/Events.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/LootStoreExtensions/Events.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Turret/Commands.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Turret/Events.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Vehicle/Commands.cs create mode 100644 UdpHosts/GameServer/Enums/GSS/Vehicle/Events.cs create mode 100644 UdpHosts/GameServer/Enums/MatrixPacketType.cs create mode 100644 UdpHosts/GameServer/Enums/Visuals/PaletteType.cs create mode 100644 WebHosts/WebHost.ClientApi/Zones/Models/Zone.cs create mode 100644 stylecop.ruleset diff --git a/.editorconfig b/.editorconfig index 48597589..0f423e38 100644 --- a/.editorconfig +++ b/.editorconfig @@ -210,3 +210,14 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case # ReSharper properties resharper_place_accessorholder_attribute_on_same_line = false + +[*Packet*.cs] +dotnet_diagnostic.SA1201.severity = none + +[BinaryWriter.cs] +dotnet_diagnostic.CS0675.severity = none +dotnet_diagnostic.CS0414.severity = none + +[BinaryReader.cs] +dotnet_diagnostic.CS0169.severity = none +dotnet_diagnostic.CS0414.severity = none \ No newline at end of file diff --git a/Lib/Core.Data/Database.cs b/Lib/Core.Data/Database.cs index 12acee1a..cddd0704 100644 --- a/Lib/Core.Data/Database.cs +++ b/Lib/Core.Data/Database.cs @@ -18,13 +18,13 @@ protected Database(string name, string dbName, string connString) DbName = dbName; ConnectionString = connString; } + + public string Name { get; } + public string DbName { get; } protected DbTransaction CurrentTransaction { get; private set; } protected DbConnection Connection { get; private set; } private string ConnectionString { get; } - public string Name { get; } - public string DbName { get; } - public async Task OpenConnection() { @@ -113,13 +113,12 @@ public async Task ExecuteScalar(string sql, IEnumerable pa return ret == DBNull.Value ? default : (T)ret; } - - public string DelimDatabase(string val) { return Delim(val, DelimType.Database); } - public string DelimSchema(string val) { return Delim(val, DelimType.Schema); } - public string DelimTable(string val) { return Delim(val, DelimType.Table); } - public string DelimColumn(string val) { return Delim(val, DelimType.Column); } - public string DelimParameter(string val) { return Delim(val, DelimType.Parameter); } - public string DelimString(string val) { return Delim(val, DelimType.String); } + public string DelimDatabase(string val) => Delim(val, DelimType.Database); + public string DelimSchema(string val) => Delim(val, DelimType.Schema); + public string DelimTable(string val) => Delim(val, DelimType.Table); + public string DelimColumn(string val) => Delim(val, DelimType.Column); + public string DelimParameter(string val) => Delim(val, DelimType.Parameter); + public string DelimString(string val) => Delim(val, DelimType.String); public abstract string Delim(string val, DelimType dt); public void Dispose() diff --git a/Lib/Core.Data/EntityGuid.cs b/Lib/Core.Data/EntityGuid.cs index 4892d17c..13b1f669 100644 --- a/Lib/Core.Data/EntityGuid.cs +++ b/Lib/Core.Data/EntityGuid.cs @@ -8,12 +8,6 @@ public readonly struct EntityGuid { public readonly ulong Full; - public byte ServerId { get; private init; } - public uint Timestamp { get; private init; } - public uint Counter { get; private init; } - public byte Type { get; private init; } - - public EntityGuid(byte serverId, uint timestamp, uint counter, byte type) { ServerId = serverId; @@ -26,6 +20,11 @@ public EntityGuid(byte serverId, uint timestamp, uint counter, byte type) Type; } + public byte ServerId { get; private init; } + public uint Timestamp { get; private init; } + public uint Counter { get; private init; } + public byte Type { get; private init; } + public static EntityGuid Parse(ulong guid) { EntityGuid entityGuid = new() { ServerId = (byte)(guid >> 56), Timestamp = (uint)(((guid >> 32) & 0x00FFFFFF) << 8), Counter = (uint)((guid & 0xFFFFFF00) >> 8), Type = (byte)(guid & 0xFF) }; diff --git a/Lib/Shared.Common/DateTimeExtensions.cs b/Lib/Shared.Common/DateTimeExtensions.cs index 1b0edb9b..f63157b9 100644 --- a/Lib/Shared.Common/DateTimeExtensions.cs +++ b/Lib/Shared.Common/DateTimeExtensions.cs @@ -6,6 +6,10 @@ public static class DateTimeExtensions { private static DateTime? _epoch; + public static DateTime Epoch => CheckedEpochUtc.ToLocalTime(); + + public static DateTime EpochUtc => CheckedEpochUtc; + private static DateTime CheckedEpochUtc { get @@ -16,10 +20,6 @@ private static DateTime CheckedEpochUtc } } - public static DateTime Epoch => CheckedEpochUtc.ToLocalTime(); - - public static DateTime EpochUtc => CheckedEpochUtc; - public static double UnixTimestamp(this DateTime dateTime) { return (dateTime - CheckedEpochUtc.ToLocalTime()).TotalSeconds; diff --git a/Lib/Shared.Common/LocationProvider.cs b/Lib/Shared.Common/LocationProvider.cs index aa5da7c8..64e743ee 100644 --- a/Lib/Shared.Common/LocationProvider.cs +++ b/Lib/Shared.Common/LocationProvider.cs @@ -1,7 +1,7 @@ -using Microsoft.Win32; -using System; +using System; using System.IO; using System.Text.RegularExpressions; +using Microsoft.Win32; namespace Shared.Common; @@ -51,7 +51,7 @@ private static string FindFirefallByShellCommand() } using var shellKey = Registry.ClassesRoot.OpenSubKey("firefall\\shell\\open\\command"); - var firefallLaunchCommand = (string)shellKey?.GetValue(""); + var firefallLaunchCommand = (string)shellKey?.GetValue(string.Empty); if (firefallLaunchCommand == null) { return null; diff --git a/Lib/Shared.Common/SerilogTheme.cs b/Lib/Shared.Common/SerilogTheme.cs index 2be4d5ac..3a7ac1fc 100644 --- a/Lib/Shared.Common/SerilogTheme.cs +++ b/Lib/Shared.Common/SerilogTheme.cs @@ -1,6 +1,6 @@ -using Serilog.Sinks.SystemConsole.Themes; -using System; +using System; using System.Collections.Generic; +using Serilog.Sinks.SystemConsole.Themes; namespace Shared.Common; diff --git a/Lib/Shared.Udp/Deserializer.cs b/Lib/Shared.Udp/Deserializer.cs index cd2d62b1..73a33597 100644 --- a/Lib/Shared.Udp/Deserializer.cs +++ b/Lib/Shared.Udp/Deserializer.cs @@ -46,6 +46,90 @@ public static T Read(ref ReadOnlyMemory data) return (T)Read(ref data, typeof(T)); } + public static object ReadPrimitive(ref ReadOnlyMemory data, Type type) + { + ReadOnlySpan span; + + if (typeof(byte) == type) + { + span = data[..1].Span; + data = data[1..]; + return span[0]; + } + + if (typeof(char) == type) + { + span = data[..1].Span; + data = data[1..]; + return Encoding.ASCII.GetChars(span.ToArray())[0]; + } + + if (typeof(short) == type) + { + span = data[..2].Span; + data = data[2..]; + return BinaryPrimitives.ReadInt16LittleEndian(span); + } + + if (typeof(ushort) == type) + { + span = data[..2].Span; + data = data[2..]; + return BinaryPrimitives.ReadUInt16LittleEndian(span); + } + + if (typeof(int) == type) + { + span = data[..4].Span; + data = data[4..]; + return BinaryPrimitives.ReadInt32LittleEndian(span); + } + + if (typeof(uint) == type) + { + span = data[..4].Span; + data = data[4..]; + return BinaryPrimitives.ReadUInt32LittleEndian(span); + } + + if (typeof(long) == type) + { + span = data[..8].Span; + data = data[8..]; + return BinaryPrimitives.ReadInt64LittleEndian(span); + } + + if (typeof(ulong) == type) + { + span = data[..8].Span; + data = data[8..]; + return BinaryPrimitives.ReadUInt64LittleEndian(span); + } + + if (typeof(Half) == type) + { + span = data[..2].Span; + data = data[2..]; + return BinaryPrimitives.ReadUInt16LittleEndian(span); + } + + if (typeof(float) == type) + { + span = data[..4].Span; + data = data[4..]; + return MemoryMarshal.Cast(span)[0]; + } + + if (typeof(double) == type) + { + span = data[..8].Span; + data = data[8..]; + return MemoryMarshal.Cast(span)[0]; + } + + throw new Exception(); + } + private static unsafe object Read(ref ReadOnlyMemory data, Type type, IEnumerable attributes = null) { attributes = attributes?.ToList() ?? type.GetCustomAttributes(); @@ -69,7 +153,7 @@ private static unsafe object Read(ref ReadOnlyMemory data, Type type, IEnu return null; } - data = data[Marshal.SizeOf(exists.ExistsType)..]; + data = data[Marshal.SizeOf(exists.ExistsType) ..]; } if (typeof(IEnumerable).IsAssignableFrom(type) && type.GenericTypeArguments is { Length: > 0 }) @@ -78,7 +162,7 @@ private static unsafe object Read(ref ReadOnlyMemory data, Type type, IEnu if (prefixLength != null) { l = (int)Convert.ChangeType(Read(ref data, prefixLength.LengthType), typeof(int)); - data = data[Marshal.SizeOf(prefixLength.LengthType)..]; + data = data[Marshal.SizeOf(prefixLength.LengthType) ..]; } else if (length != null) { @@ -108,7 +192,7 @@ private static unsafe object Read(ref ReadOnlyMemory data, Type type, IEnu l++; // null terminator - ret = Encoding.ASCII.GetString(data[..(l - 1)].Span.ToArray()); + ret = Encoding.ASCII.GetString(data[.. (l - 1)].Span.ToArray()); data = data[l..]; } else if (type.IsClass) @@ -137,90 +221,6 @@ private static unsafe object Read(ref ReadOnlyMemory data, Type type, IEnu return ret; } - public static object ReadPrimitive(ref ReadOnlyMemory data, Type type) - { - ReadOnlySpan span; - - if (typeof(byte) == type) - { - span = data[..1].Span; - data = data[1..]; - return span[0]; - } - - if (typeof(char) == type) - { - span = data[..1].Span; - data = data[1..]; - return Encoding.ASCII.GetChars(span.ToArray())[0]; - } - - if (typeof(short) == type) - { - span = data[..2].Span; - data = data[2..]; - return BinaryPrimitives.ReadInt16LittleEndian(span); - } - - if (typeof(ushort) == type) - { - span = data[..2].Span; - data = data[2..]; - return BinaryPrimitives.ReadUInt16LittleEndian(span); - } - - if (typeof(int) == type) - { - span = data[..4].Span; - data = data[4..]; - return BinaryPrimitives.ReadInt32LittleEndian(span); - } - - if (typeof(uint) == type) - { - span = data[..4].Span; - data = data[4..]; - return BinaryPrimitives.ReadUInt32LittleEndian(span); - } - - if (typeof(long) == type) - { - span = data[..8].Span; - data = data[8..]; - return BinaryPrimitives.ReadInt64LittleEndian(span); - } - - if (typeof(ulong) == type) - { - span = data[..8].Span; - data = data[8..]; - return BinaryPrimitives.ReadUInt64LittleEndian(span); - } - - if (typeof(Half) == type) - { - span = data[..2].Span; - data = data[2..]; - return BinaryPrimitives.ReadUInt16LittleEndian(span); - } - - if (typeof(float) == type) - { - span = data[..4].Span; - data = data[4..]; - return MemoryMarshal.Cast(span)[0]; - } - - if (typeof(double) == type) - { - span = data[..8].Span; - data = data[8..]; - return MemoryMarshal.Cast(span)[0]; - } - - throw new Exception(); - } - private static object ReadClass(ref ReadOnlyMemory data, Type type) { var properties = from property in type.GetFields() diff --git a/Lib/Shared.Udp/ExistsPrefixAttribute.cs b/Lib/Shared.Udp/ExistsPrefixAttribute.cs index 6ce3e9b4..b6752818 100644 --- a/Lib/Shared.Udp/ExistsPrefixAttribute.cs +++ b/Lib/Shared.Udp/ExistsPrefixAttribute.cs @@ -4,12 +4,12 @@ namespace Shared.Udp; public class ExistsPrefixAttribute : Attribute { - public readonly Type ExistsType; - public readonly object TrueValue; - public ExistsPrefixAttribute(Type t, object trueVal) { ExistsType = t; TrueValue = trueVal; } + + public Type ExistsType { get; } + public object TrueValue { get; } } \ No newline at end of file diff --git a/Lib/Shared.Udp/LengthPrefixedAttribute.cs b/Lib/Shared.Udp/LengthPrefixedAttribute.cs index efa5373a..46d8987d 100644 --- a/Lib/Shared.Udp/LengthPrefixedAttribute.cs +++ b/Lib/Shared.Udp/LengthPrefixedAttribute.cs @@ -4,10 +4,10 @@ namespace Shared.Udp; public sealed class LengthPrefixedAttribute : Attribute { - public readonly Type LengthType; - public LengthPrefixedAttribute(Type t) { LengthType = t; } + + public Type LengthType { get; } } \ No newline at end of file diff --git a/Lib/Shared.Udp/Packet.cs b/Lib/Shared.Udp/Packet.cs index 3ab68c41..844c9a43 100644 --- a/Lib/Shared.Udp/Packet.cs +++ b/Lib/Shared.Udp/Packet.cs @@ -7,11 +7,7 @@ public struct Packet { public readonly IPEndPoint RemoteEndpoint; public readonly ReadOnlyMemory PacketData; - public int CurrentPosition { get; private set; } - public int TotalBytes => PacketData.Length; - public int BytesRemaining => TotalBytes - CurrentPosition; - public DateTime Received { get; set; } - + public Packet(IPEndPoint ep, ReadOnlyMemory data, DateTime? received = null) { RemoteEndpoint = ep; @@ -19,6 +15,11 @@ public Packet(IPEndPoint ep, ReadOnlyMemory data, DateTime? received = nul CurrentPosition = 0; this.Received = received ?? DateTime.Now; } + + public int CurrentPosition { get; private set; } + public int TotalBytes => PacketData.Length; + public int BytesRemaining => TotalBytes - CurrentPosition; + public DateTime Received { get; set; } /*public T ReadBE() where T : struct { var len = Unsafe.SizeOf(); diff --git a/Lib/Shared.Udp/PacketServer.cs b/Lib/Shared.Udp/PacketServer.cs index 2265f47d..c9fcc9e4 100644 --- a/Lib/Shared.Udp/PacketServer.cs +++ b/Lib/Shared.Udp/PacketServer.cs @@ -1,11 +1,10 @@ -using Serilog; -using Serilog.Core; -using System; +using System; using System.Net; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; +using Serilog; namespace Shared.Udp; @@ -21,8 +20,7 @@ public abstract class PacketServer : IPacketSender protected BufferBlock OutgoingPackets; protected CancellationTokenSource Source; - protected PacketServer(ushort port, - ILogger logger) + protected PacketServer(ushort port, ILogger logger) { Logger = logger; ListenEndpoint = new IPEndPoint(IPAddress.Any, port); @@ -31,34 +29,6 @@ protected PacketServer(ushort port, public bool IsRunning { get; protected set; } - public async Task SendAsync(Memory packet, IPEndPoint endPoint) - { - return await OutgoingPackets.SendAsync(new Packet(endPoint, packet)); - } - - protected virtual void HandleCommand(string line) - { - if (line.Trim().StartsWith("exit")) - { - IsRunning = false; - Source.Cancel(); - } - } - - protected abstract void HandlePacket(Packet p, CancellationToken ct); - protected virtual void Startup(CancellationToken ct) { } - - protected virtual async void ServerRunThreadAsync(CancellationToken ct) - { - Packet? p; - while ((p = await IncomingPackets.ReceiveAsync(ct)) != null) - { - HandlePacket(p.Value, ct); - } - } - - protected virtual void Shutdown(CancellationToken ct) { } - // TODO: Move to separate thread? add console/rcon handling here? // FIXME: Move timing to GameServer public void Run() @@ -92,6 +62,38 @@ public void Run() Shutdown(ct); } + public async Task SendAsync(Memory packet, IPEndPoint endPoint) + { + return await OutgoingPackets.SendAsync(new Packet(endPoint, packet)); + } + + protected virtual void HandleCommand(string line) + { + if (line.Trim().StartsWith("exit")) + { + IsRunning = false; + Source.Cancel(); + } + } + + protected abstract void HandlePacket(Packet p, CancellationToken ct); + protected virtual void Startup(CancellationToken ct) + { + } + + protected virtual async void ServerRunThreadAsync(CancellationToken ct) + { + Packet? p; + while ((p = await IncomingPackets.ReceiveAsync(ct)) != null) + { + HandlePacket(p.Value, ct); + } + } + + protected virtual void Shutdown(CancellationToken ct) + { + } + private async void ListenThreadAsync(CancellationToken ct) { ServerSocket.Blocking = true; diff --git a/Lib/Shared.Udp/Packets/BasePacketView.cs b/Lib/Shared.Udp/Packets/BasePacketView.cs index 5e75d80e..a436eb9e 100644 --- a/Lib/Shared.Udp/Packets/BasePacketView.cs +++ b/Lib/Shared.Udp/Packets/BasePacketView.cs @@ -3,18 +3,9 @@ namespace Shared.Udp.Packets; -public enum BitEndianness -{ - Unknown = 0, - LittleEndian, - LittleBigEndian, - BigLittleEndian, - BigEndian -} - public class BasePacketView : IPacketView { - protected ConcurrentDictionary Fields; + protected ConcurrentDictionary _fields; public BasePacketView(BitEndianness e) { @@ -28,11 +19,6 @@ public BasePacketView(BitEndianness e) public BitEndianness Endianness { get; } - protected void SetupFields() - { - Fields = new ConcurrentDictionary(); - } - public T Get(Memory data, string name) { return default; @@ -42,4 +28,9 @@ public T Get(Memory data, int offset, int length = -1) { return default; } + + protected void SetupFields() + { + _fields = new ConcurrentDictionary(); + } } \ No newline at end of file diff --git a/Lib/Shared.Udp/Packets/BitEndianness.cs b/Lib/Shared.Udp/Packets/BitEndianness.cs new file mode 100644 index 00000000..e4a5457e --- /dev/null +++ b/Lib/Shared.Udp/Packets/BitEndianness.cs @@ -0,0 +1,10 @@ +namespace Shared.Udp.Packets; + +public enum BitEndianness +{ + Unknown = 0, + LittleEndian, + LittleBigEndian, + BigLittleEndian, + BigEndian +} \ No newline at end of file diff --git a/Lib/Shared.Udp/Packets/ViewFactory.cs b/Lib/Shared.Udp/Packets/ViewFactory.cs index f843e88e..95d248ad 100644 --- a/Lib/Shared.Udp/Packets/ViewFactory.cs +++ b/Lib/Shared.Udp/Packets/ViewFactory.cs @@ -19,11 +19,6 @@ public static void Init() } } - private static void AddPacketView(Type t) - { - // TODO: Runtime generation of BasePacketView subclasses that implement user defined Interfaces - } - public static T Get() where T : IPacketView { @@ -34,4 +29,9 @@ public static IPacketView Get(Type t) { return _instances[t]; } + + private static void AddPacketView(Type t) + { + // TODO: Runtime generation of BasePacketView subclasses that implement user defined Interfaces + } } \ No newline at end of file diff --git a/Lib/Shared.Udp/Serializer.cs b/Lib/Shared.Udp/Serializer.cs index fe9fbdd2..0d92b21c 100644 --- a/Lib/Shared.Udp/Serializer.cs +++ b/Lib/Shared.Udp/Serializer.cs @@ -109,6 +109,7 @@ private static Memory Write(object obj, Type type, IEnumerable break; } + case IList list: { if (prefixLength != null) @@ -119,6 +120,7 @@ private static Memory Write(object obj, Type type, IEnumerable memoryList.Add(WriteList(list, length)); break; } + case string str: memoryList.Add(Encoding.ASCII.GetBytes(str)); memoryList.Add(new byte[1].AsMemory()); diff --git a/Lib/Shared.Web/BaseWebServer.cs b/Lib/Shared.Web/BaseWebServer.cs index a9e7cceb..78924886 100644 --- a/Lib/Shared.Web/BaseWebServer.cs +++ b/Lib/Shared.Web/BaseWebServer.cs @@ -1,4 +1,9 @@ -using Microsoft.AspNetCore.Builder; +using System; +using System.IO; +using System.Net; +using System.Security.Authentication; +using System.Text; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; @@ -8,11 +13,6 @@ using Serilog; using Shared.Common; using Shared.Web.Config; -using System; -using System.IO; -using System.Net; -using System.Security.Authentication; -using System.Text; namespace Shared.Web; @@ -51,7 +51,7 @@ public static IHost Build(Type serverType, IConfiguration configuration) .UseStartup(serverType) .UseUrls(configuration.GetSection("Firefall") .Get() - .WebHosts[serverType.FullName.Replace(".WebServer", "")] + .WebHosts[serverType.FullName.Replace(".WebServer", string.Empty)] .Urls.Split(";")); }) .ConfigureHostConfiguration(hostConfigurationBuilder => @@ -87,11 +87,6 @@ public void ConfigureServices(IServiceCollection services) ConfigureChildServices(services); } - protected virtual void ConfigureChildServices(IServiceCollection services) - { - services.AddSwaggerGen(); - } - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseSwagger(); @@ -129,5 +124,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ConfigureChild(app, env); } - protected virtual void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected virtual void ConfigureChildServices(IServiceCollection services) + { + services.AddSwaggerGen(); + } + + protected virtual void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/PIN.targets b/PIN.targets index 00da5858..26e13453 100644 --- a/PIN.targets +++ b/PIN.targets @@ -2,6 +2,7 @@ net6.0 latest + ..\..\stylecop.ruleset 1.2.0 @@ -9,4 +10,11 @@ Copyright © 2019-2023 by The Melding Wars Pirate Intelligence Network + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + \ No newline at end of file diff --git a/UdpHosts/GameServer/Channel.cs b/UdpHosts/GameServer/Channel.cs index 08ccf1a9..65ea37da 100644 --- a/UdpHosts/GameServer/Channel.cs +++ b/UdpHosts/GameServer/Channel.cs @@ -1,31 +1,21 @@ #nullable enable -using Aero.Gen; -using Aero.Gen.Attributes; -using GameServer.Extensions; -using GameServer.Packets; -using Serilog; -using Shared.Udp; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Threading; +using Aero.Gen; +using Aero.Gen.Attributes; +using GameServer.Extensions; +using GameServer.Packets; +using Serilog; +using Shared.Udp; namespace GameServer; -public enum ChannelType : byte -{ - Control = 0, - Matrix = 1, - ReliableGss = 2, - UnreliableGss = 3 -} - public class Channel { - public delegate void PacketAvailableDelegate(GamePacket packet); - private const int ProtocolHeaderSize = 80; // UDP + IP private const int GameSocketHeaderSize = 4; private const int TotalHeaderSize = ProtocolHeaderSize + GameSocketHeaderSize; @@ -54,6 +44,10 @@ private Channel(ChannelType channelType, bool isSequenced, bool isReliable, INet _outgoingPackets = new ConcurrentQueue>(); } + public delegate void PacketAvailableDelegate(GamePacket packet); + + public event PacketAvailableDelegate? PacketAvailable; + private ChannelType Type { get; } private bool IsSequenced { get; } private bool IsReliable { get; } @@ -72,8 +66,6 @@ public static Dictionary GetChannels(INetworkClient client }; } - public event PacketAvailableDelegate? PacketAvailable; - public void HandlePacket(GamePacket packet) { _incomingPackets.Enqueue(packet); @@ -89,15 +81,15 @@ public void Process(CancellationToken ct) while (_incomingPackets.TryDequeue(out var packet)) { - //Console.Write("> " + string.Concat(BitConverter.GetBytes(packet.Header.PacketHeader).ToArray().Select(b => b.ToString("X2")).ToArray())); - //Console.WriteLine(" "+string.Concat(packet.PacketData.ToArray().Select(b => b.ToString("X2")).ToArray())); + // Console.Write("> " + string.Concat(BitConverter.GetBytes(packet.Header.PacketHeader).ToArray().Select(b => b.ToString("X2")).ToArray())); + // Console.WriteLine(" "+string.Concat(packet.PacketData.ToArray().Select(b => b.ToString("X2")).ToArray())); ushort sequenceNumber = 0; if (IsSequenced) { sequenceNumber = Utils.SimpleFixEndianness(packet.Read()); } + // TODO: Implement SequencedPacketQueue - if (packet.Header.ResendCount > 0) { // de-xor data @@ -117,7 +109,8 @@ public void Process(CancellationToken ct) dataTemp = MemoryMarshal.Cast(uSpan).ToArray(); // override old size } - for (var i = 0; i < dataTemp.Length; i++) // copy back + // copy back + for (var i = 0; i < dataTemp.Length; i++) { data[i] = dataTemp[i]; } @@ -127,9 +120,8 @@ public void Process(CancellationToken ct) data[i] ^= XorByte[packet.Header.ResendCount]; } - //for( int i = 0; i < data.Length; i++ ) - // data[i] ^= xorByte[packet.Header.ResendCount]; - + // for( int i = 0; i < data.Length; i++ ) + // data[i] ^= xorByte[packet.Header.ResendCount]; packet = new GamePacket(packet.Header, new ReadOnlyMemory(data)); _logger.Fatal("---> Resent packet!!! C:{0}: {1} bytes", Type, packet.TotalBytes); } @@ -286,8 +278,12 @@ public bool SendGSS(T packet, ulong entityId, Enums.GSS.Controllers? controll } else { - _logger.Verbose("<-- {0}: Controller = {1} Entity = 0x{2:X16} MsgID = {3} (0x{4:X2})", Type, controllerId ?? gssMessageAttribute.ControllerID, entityId, - Enum.Parse(messageEnumType, Enum.GetName(messageEnumType, messageId) ?? string.Empty), messageId); + _logger.Verbose("<-- {0}: Controller = {1} Entity = 0x{2:X16} MsgID = {3} (0x{4:X2})", + Type, + controllerId ?? gssMessageAttribute.ControllerID, + entityId, + Enum.Parse(messageEnumType, Enum.GetName(messageEnumType, messageId) ?? string.Empty), + messageId); } } else @@ -328,7 +324,6 @@ public bool SendGSSClass(TPacket packet, ulong entityId, Enums.GSS.Cont var messageId = gssMessageAttribute.MsgID; - var controllerId = controllerIdParameter ?? gssMessageAttribute.ControllerID ?? @@ -344,8 +339,7 @@ public bool SendGSSClass(TPacket packet, ulong entityId, Enums.GSS.Cont packetToSend = Serializer.WriteClass(packet); } - //Console.WriteLine( string.Concat( packetData.ToArray().Select( b => b.ToString( "X2" ) ).ToArray() ) ); - + // Console.WriteLine( string.Concat( packetData.ToArray().Select( b => b.ToString( "X2" ) ).ToArray() ) ); return SendPacketMemory(entityId, messageId, controllerId, ref packetToSend, messageEnumType); } @@ -359,7 +353,8 @@ public bool SendGSSClass(TPacket packet, ulong entityId, Enums.GSS.Cont /// Optionally, the enum type containing the message id may be specified for enhanced verbose-level logging /// true if the operation succeeded, false in all other cases /// - public bool SendIAero(TPacket packet, ulong entityId = 0, byte messageIdOverride = 0, Type? messageEnumType = null) where TPacket : class, IAero + public bool SendIAero(TPacket packet, ulong entityId = 0, byte messageIdOverride = 0, Type? messageEnumType = null) + where TPacket : class, IAero { if (typeof(TPacket).GetCustomAttributes(typeof(AeroMessageIdAttribute), false).FirstOrDefault() is not AeroMessageIdAttribute aeroMessageIdAttribute) { @@ -382,16 +377,19 @@ public bool SendIAero(TPacket packet, ulong entityId = 0, byte messageI case AeroMessageIdAttribute.MsgType.GSS: { var controllerId = (Enums.GSS.Controllers)aeroMessageIdAttribute.ControllerId; - //Program.Logger.Information($"SendIAero type {type}, controller {controllerId} and msgid {messageId}"); + + // Program.Logger.Information($"SendIAero type {type}, controller {controllerId} and msgid {messageId}"); return SendPacketMemory(entityId, messageId, controllerId, ref packetMemory, messageEnumType); } + case AeroMessageIdAttribute.MsgType.Control: default: throw new ArgumentException("Message type not implemented"); } } - public bool SendIAeroControllerKeyframe(TPacket packet, ulong entityId, ulong playerId) where TPacket : class, IAero + public bool SendIAeroControllerKeyframe(TPacket packet, ulong entityId, ulong playerId) + where TPacket : class, IAero { if (typeof(TPacket).GetCustomAttributes(typeof(AeroMessageIdAttribute), false).FirstOrDefault() is not AeroMessageIdAttribute aeroMsgAttr) { @@ -406,7 +404,8 @@ public bool SendIAeroControllerKeyframe(TPacket packet, ulong entityId, return SendPacketMemory(entityId, 4, controllerId, ref messageData); } - public bool SendIAeroChanges(TPacket packet, ulong entityId) where TPacket : class, IAeroViewInterface + public bool SendIAeroChanges(TPacket packet, ulong entityId) + where TPacket : class, IAeroViewInterface { if (typeof(TPacket).GetCustomAttributes(typeof(AeroMessageIdAttribute), false).FirstOrDefault() is not AeroMessageIdAttribute aeroMsgAttr) { @@ -420,7 +419,6 @@ public bool SendIAeroChanges(TPacket packet, ulong entityId) where TPac return SendPacketMemory(entityId, 1, typeCode, ref packetMemory); } - /// /// Send serialized data of a gss channel packet to the client /// @@ -432,7 +430,8 @@ public bool SendIAeroChanges(TPacket packet, ulong entityId) where TPac /// true if the operation succeeded, false in all other cases /// If is not null and does not contain an element with a value equal to private bool SendPacketMemory(ulong entityId, - byte messageId, Enums.GSS.Controllers controllerId, + byte messageId, + Enums.GSS.Controllers controllerId, ref Memory packetToSend, Type? msgEnumType = null) { @@ -447,7 +446,6 @@ private bool SendPacketMemory(ulong entityId, Serializer.WritePrimitive((byte)controllerId).CopyTo(serializedData); Serializer.WritePrimitive(messageId).CopyTo(serializedData[8..]); - if (msgEnumType == null) { _logger.Verbose("<-- {0}: Controller = {1} Entity = 0x{2:X16} MsgID = 0x{3:X2}", @@ -463,17 +461,14 @@ private bool SendPacketMemory(ulong entityId, controllerId, entityId, Enum.Parse(msgEnumType, - Enum.GetName(msgEnumType, messageId) ?? - throw new InvalidOperationException($"Message enum type {msgEnumType.FullName} has no element with a value of {messageId}")), + Enum.GetName(msgEnumType, messageId) ?? throw new InvalidOperationException($"Message enum type {msgEnumType.FullName} has no element with a value of {messageId}")), messageId); } - //Program.Logger.Verbose( "<--- Sending {0} bytes", packetData.Length ); - + // Program.Logger.Verbose( "<--- Sending {0} bytes", packetData.Length ); return Send(serializedData); } - /// /// Send serialized data of a matrix channel packet to the client /// @@ -509,7 +504,7 @@ private bool Send(Memory packetData) var length = Math.Min(packetData.Length + headerLength, MaxPacketSize); var t = new Memory(new byte[length]); - packetData[..(length - headerLength)].CopyTo(t[headerLength..]); + packetData[.. (length - headerLength)].CopyTo(t[headerLength..]); if (IsSequenced) { @@ -519,19 +514,21 @@ private bool Send(Memory packetData) } Serializer.WritePrimitive(Utils.SimpleFixEndianness(CurrentSequenceNumber)).CopyTo(t.Slice(2, 2)); - unchecked { CurrentSequenceNumber++; } + unchecked + { + CurrentSequenceNumber++; + } } var header = new GamePacketHeader(Type, 0, packetData.Length + headerLength > MaxPacketSize, (ushort)t.Length); var headerData = Serializer.WritePrimitive(Utils.SimpleFixEndianness(header.PacketHeader)); headerData.CopyTo(t); - //Console.Write("< "+string.Concat(BitConverter.GetBytes(Utils.SimpleFixEndianness(hdr.PacketHeader)).ToArray().Select(b => b.ToString("X2")).ToArray())); - //Console.WriteLine( " "+string.Concat( t.Slice(2).ToArray().Select( b => b.ToString( "X2" ) ).ToArray() ) ) - + // Console.Write("< "+string.Concat(BitConverter.GetBytes(Utils.SimpleFixEndianness(hdr.PacketHeader)).ToArray().Select(b => b.ToString("X2")).ToArray())); + // Console.WriteLine( " "+string.Concat( t.Slice(2).ToArray().Select( b => b.ToString( "X2" ) ).ToArray() ) ) _outgoingPackets.Enqueue(t); - packetData = packetData[(length - headerLength)..]; + packetData = packetData[(length - headerLength) ..]; } return true; diff --git a/UdpHosts/GameServer/ChannelType.cs b/UdpHosts/GameServer/ChannelType.cs new file mode 100644 index 00000000..c2190dae --- /dev/null +++ b/UdpHosts/GameServer/ChannelType.cs @@ -0,0 +1,10 @@ +#nullable enable +namespace GameServer; + +public enum ChannelType : byte +{ + Control = 0, + Matrix = 1, + ReliableGss = 2, + UnreliableGss = 3 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Controllers/Base.cs b/UdpHosts/GameServer/Controllers/Base.cs index ca675192..4cda12d5 100644 --- a/UdpHosts/GameServer/Controllers/Base.cs +++ b/UdpHosts/GameServer/Controllers/Base.cs @@ -1,8 +1,8 @@ -using GameServer.Extensions; +using System; +using System.Linq; +using GameServer.Extensions; using GameServer.Packets; using Serilog; -using System; -using System.Linq; namespace GameServer.Controllers; diff --git a/UdpHosts/GameServer/Controllers/Character/BaseController.cs b/UdpHosts/GameServer/Controllers/Character/BaseController.cs index 665d1b9f..54beb5ec 100644 --- a/UdpHosts/GameServer/Controllers/Character/BaseController.cs +++ b/UdpHosts/GameServer/Controllers/Character/BaseController.cs @@ -1,4 +1,7 @@ -using AeroMessages.Common; +using System; +using System.Collections.Generic; +using System.Numerics; +using AeroMessages.Common; using AeroMessages.GSS.V66; using AeroMessages.GSS.V66.Character; using AeroMessages.GSS.V66.Character.Command; @@ -6,15 +9,12 @@ using AeroMessages.GSS.V66.Character.Event; using AeroMessages.GSS.V66.Character.View; using AeroMessages.GSS.V66.Vehicle; -using VController = AeroMessages.GSS.V66.Vehicle.Controller; using GameServer.Entities.Character; using GameServer.Enums.GSS.Character; using GameServer.Extensions; using GameServer.Packets; using Serilog; -using System; -using System.Collections.Generic; -using System.Numerics; +using VController = AeroMessages.GSS.V66.Vehicle.Controller; namespace GameServer.Controllers.Character; @@ -434,7 +434,8 @@ public override void Init(INetworkClient client, IPlayer player, IShard shard, I | PermissionFlagsData.CharacterPermissionFlags.unk_25 | PermissionFlagsData.CharacterPermissionFlags.unk_26 | PermissionFlagsData.CharacterPermissionFlags.self_revive - //| PermissionFlagsData.CharacterPermissionFlags.respawn_input + + // | PermissionFlagsData.CharacterPermissionFlags.respawn_input | PermissionFlagsData.CharacterPermissionFlags.battleframe_abilities | PermissionFlagsData.CharacterPermissionFlags.unk_31 }, @@ -644,7 +645,6 @@ public void PlayerReady(INetworkClient client, IPlayer player, ulong entityId, G public void MovementInput(INetworkClient client, IPlayer player, ulong entityId, GamePacket packet) { // ToDo: This currently only handles PosRotState inputs, logic needs to be added for the other MovementDataTypes - if (packet.BytesRemaining < 64) { return; @@ -677,8 +677,7 @@ public void MovementInput(INetworkClient client, IPlayer player, ulong entityId, player.CharacterEntity.TimeSinceLastJump ??= timeSinceLastJumpValue >= 0 ? Convert.ToUInt16(timeSinceLastJumpValue) : throw new ArgumentOutOfRangeException($"{nameof(poseData.TimeSinceLastJump)} is <0, but we're only allowing >=0. This is bad!"); - //_logger.Warning( "Movement Unknown1: {0:X4} {1:X4} {2:X4} {3:X4} {4:X4}", pkt.UnkUShort1, pkt.UnkUShort2, pkt.UnkUShort3, pkt.UnkUShort4, pkt.LastJumpTimer ); - + // _logger.Warning( "Movement Unknown1: {0:X4} {1:X4} {2:X4} {3:X4} {4:X4}", pkt.UnkUShort1, pkt.UnkUShort2, pkt.UnkUShort3, pkt.UnkUShort4, pkt.LastJumpTimer ); var resp = new ConfirmedPoseUpdate { PoseData = new MovementPoseData @@ -703,7 +702,6 @@ public void MovementInput(INetworkClient client, IPlayer player, ulong entityId, // ToDo: Set "Aim" property of response if the input had the respective flag // ToDo: Handle JetPackEnergy changes / add to CharacterEntity class - client.NetChannels[ChannelType.UnreliableGss].SendIAero(resp, entityId, 0, typeof(Events)); if (player.CharacterEntity.TimeSinceLastJump.HasValue && poseData.TimeSinceLastJump > player.CharacterEntity.TimeSinceLastJump.Value) @@ -738,9 +736,10 @@ public void SetSteamUserId(INetworkClient client, IPlayer player, ulong entityId var setSteamIdPacket = packet.Unpack(); player.SteamUserId = setSteamIdPacket.SteamUserId; _logger.Verbose("Entity {0:x8} Steam user id (Aero): {1}", entityId, player.SteamUserId); - //var conventional = packet.Read(); - //_logger.Verbose("Packet Data: {0}", BitConverter.ToString(packet.PacketData.ToArray()).Replace("-", " ")); - //_logger.Verbose("Entity {0:x8} Steam user id (conventional): {1}", entityId, conventional.SteamId); + + // var conventional = packet.Read(); + // _logger.Verbose("Packet Data: {0}", BitConverter.ToString(packet.PacketData.ToArray()).Replace("-", " ")); + // _logger.Verbose("Entity {0:x8} Steam user id (conventional): {1}", entityId, conventional.SteamId); } [MessageID((byte)Commands.VehicleCalldownRequest)] @@ -750,7 +749,10 @@ public void VehicleCalldownRequest(INetworkClient client, IPlayer player, ulong var vehicleCalldownRequest = packet.Unpack(); - if (vehicleCalldownRequest == null) { return; } + if (vehicleCalldownRequest == null) + { + return; + } var vehicleBaseController = new VController.BaseController { @@ -760,7 +762,7 @@ public void VehicleCalldownRequest(INetworkClient client, IPlayer player, ulong EngineStateProp = 0, PathStateProp = 1, OwnerIdProp = new EntityId { Backing = vehicleEntityGuid.Full, ControllerId = Controller.Vehicle, Id = player.PlayerId }, - OwnerNameProp = "", + OwnerNameProp = string.Empty, OwnerLocalStringProp = 0, OccupantIds_0Prop = new EntityId { Backing = 0, ControllerId = 0, Id = 0 }, OccupantIds_1Prop = new EntityId { Backing = 0, ControllerId = 0, Id = 0 }, @@ -983,7 +985,7 @@ public void FriendsListRequest(INetworkClient client, IPlayer player, ulong enti { Unk1 = 9162788533740412926, Unk2 = "TestUser1", - Unk3 = "", + Unk3 = string.Empty, Unk4 = 1, Unk5 = 1427570048, Unk6 = 1 @@ -992,7 +994,7 @@ public void FriendsListRequest(INetworkClient client, IPlayer player, ulong enti { Unk1 = 9153042507174448638, Unk2 = "TestUser2", - Unk3 = "", + Unk3 = string.Empty, Unk4 = 1, Unk5 = 1471686583, Unk6 = 1 @@ -1010,7 +1012,7 @@ public void MapOpened(INetworkClient client, IPlayer player, ulong entityId, Gam var mapOpened = new GeographicalReportResponse { Unk1 = 0, - Unk2 = new Vector3 { X = 0, Y = 0, Z = 0}, + Unk2 = new Vector3 { X = 0, Y = 0, Z = 0 }, Unk3 = 0x00, Data = new GeoReportData[] { } }; diff --git a/UdpHosts/GameServer/Controllers/Character/CombatController.cs b/UdpHosts/GameServer/Controllers/Character/CombatController.cs index bb9e1aa5..09e84e7c 100644 --- a/UdpHosts/GameServer/Controllers/Character/CombatController.cs +++ b/UdpHosts/GameServer/Controllers/Character/CombatController.cs @@ -1,19 +1,15 @@ -using AeroMessages.Common; -using AeroMessages.GSS.V66.Character; -using AeroMessages.GSS.V66.Character.Command; +using AeroMessages.GSS.V66.Character.Command; using AeroMessages.GSS.V66.Character.Event; using GameServer.Enums.GSS.Character; using GameServer.Extensions; using GameServer.Packets; using Serilog; -using System; namespace GameServer.Controllers.Character; [ControllerID(Enums.GSS.Controllers.Character_CombatController)] public class CombatController : Base { - ILogger _logger; public override void Init(INetworkClient client, IPlayer player, IShard shard, ILogger logger) { // TODO: Implement @@ -35,9 +31,7 @@ public void FireBurst(INetworkClient client, IPlayer player, ulong entityId, Gam public void FireWeaponProjectile(INetworkClient client, IPlayer player, ulong entityId, GamePacket packet) { var fireWeaponProjectile = packet.Unpack(); - /* - * - */ + var weaponProjectileFired = new WeaponProjectileFired { ShortTime = (ushort)fireWeaponProjectile.Time, @@ -79,26 +73,67 @@ public void ReloadWeapon(INetworkClient client, IPlayer player, ulong entityId, // TODO: Implement } - [MessageID((byte)Commands.ActivateAbility)] public void ActivateAbility(INetworkClient client, IPlayer player, ulong entityId, GamePacket packet) { var activateAbility = packet.Unpack(); - if (activateAbility == null) { return; } + if (activateAbility == null) + { + return; + } var abilitySlot = activateAbility.AbilitySlotIndex; - if (abilitySlot == 0) { } // Ability1 - Default button 1 - if (abilitySlot == 1) { } // Ability2 - Default button 2 - if (abilitySlot == 2) { } // Ability3 - Default button 3 - if (abilitySlot == 3) { } // AbilityHKM - Default button 4 - if (abilitySlot == 4) { } // AbilityInteract - Default button E - if (abilitySlot == 5) { } // Auxiliary - Default button G - if (abilitySlot == 6) { } // AbilityMedical - Default button Q - if (abilitySlot == 13) { } // AbilitySIN - Default button F - if (abilitySlot == 16) { } // Vehicle - Default button V - if (abilitySlot == 17) { } // Auxiliary - Default button T + // Ability1 - Default button 1 + if (abilitySlot == 0) + { + } + + // Ability2 - Default button 2 + if (abilitySlot == 1) + { + } + + // Ability3 - Default button 3 + if (abilitySlot == 2) + { + } + + // AbilityHKM - Default button 4 + if (abilitySlot == 3) + { + } + + // AbilityInteract - Default button E + if (abilitySlot == 4) + { + } + + // Auxiliary - Default button G + if (abilitySlot == 5) + { + } + + // AbilityMedical - Default button Q + if (abilitySlot == 6) + { + } + + // AbilitySIN - Default button F + if (abilitySlot == 13) + { + } + + // Vehicle - Default button V + if (abilitySlot == 16) + { + } + + // Auxiliary - Default button T + if (abilitySlot == 17) + { + } /*var resp = new AbilityActivated { diff --git a/UdpHosts/GameServer/Controllers/Factory.cs b/UdpHosts/GameServer/Controllers/Factory.cs index 3ba3a678..e43a93b6 100644 --- a/UdpHosts/GameServer/Controllers/Factory.cs +++ b/UdpHosts/GameServer/Controllers/Factory.cs @@ -1,7 +1,7 @@ -using GameServer.Extensions; -using System; +using System; using System.Collections.Concurrent; using System.Linq; +using GameServer.Extensions; namespace GameServer.Controllers; diff --git a/UdpHosts/GameServer/Controllers/Generic.cs b/UdpHosts/GameServer/Controllers/Generic.cs index 89110c0d..0fca09c5 100644 --- a/UdpHosts/GameServer/Controllers/Generic.cs +++ b/UdpHosts/GameServer/Controllers/Generic.cs @@ -1,11 +1,11 @@ -using AeroMessages.GSS.V66.Generic; +using System; +using AeroMessages.GSS.V66.Generic; using GameServer.Enums; using GameServer.Enums.GSS.Generic; using GameServer.Extensions; using GameServer.Packets; using GameServer.Packets.Control; using Serilog; -using System; namespace GameServer.Controllers; @@ -30,7 +30,7 @@ public void ScheduleUpdateRequest(INetworkClient client, IPlayer player, ulong e player.Respawn(); } - //Program.Logger.Error( "Update scheduled" ); + // Program.Logger.Error( "Update scheduled" ); } [MessageID((byte)Commands.RequestLogout)] diff --git a/UdpHosts/GameServer/Controllers/Vehicle/BaseController.cs b/UdpHosts/GameServer/Controllers/Vehicle/BaseController.cs index e32d5a1f..4b93b84d 100644 --- a/UdpHosts/GameServer/Controllers/Vehicle/BaseController.cs +++ b/UdpHosts/GameServer/Controllers/Vehicle/BaseController.cs @@ -9,8 +9,6 @@ namespace GameServer.Controllers.Vehicle; [ControllerID(Enums.GSS.Controllers.Vehicle_BaseController)] public class BaseController : Base { - private ILogger _logger; - public override void Init(INetworkClient client, IPlayer player, IShard shard, ILogger logger) { // TODO: Implement diff --git a/UdpHosts/GameServer/Controllers/Vehicle/CombatController.cs b/UdpHosts/GameServer/Controllers/Vehicle/CombatController.cs index 5f8e1581..438c87cc 100644 --- a/UdpHosts/GameServer/Controllers/Vehicle/CombatController.cs +++ b/UdpHosts/GameServer/Controllers/Vehicle/CombatController.cs @@ -5,7 +5,6 @@ namespace GameServer.Controllers.Vehicle; [ControllerID(Enums.GSS.Controllers.Vehicle_CombatController)] public class CombatController : Base { - ILogger _logger; public override void Init(INetworkClient client, IPlayer player, IShard shard, ILogger logger) { // TODO: Implement diff --git a/UdpHosts/GameServer/Data/Character.cs b/UdpHosts/GameServer/Data/Character.cs index ac77f1d0..b55a4410 100644 --- a/UdpHosts/GameServer/Data/Character.cs +++ b/UdpHosts/GameServer/Data/Character.cs @@ -2,20 +2,6 @@ public class Character { - public enum CharacterGender : byte - { - Male = 0, - Female = 1 - } - - public enum CharacterRace : byte - { - Human = 0, - Unknown = 1, - DarkOne = 2 - } - - // TODO: Stats and Visuals protected Character() { @@ -62,21 +48,17 @@ protected Character() public float JumpJetRecharge { get; set; } public uint MaxHealth { get; set; } - // Looks / Voice - public uint VoiceSet { get; set; } public ushort TitleID { get; set; } public CharacterVisuals CharVisuals { get; protected set; } public ChassisVisuals ChassisVisuals { get; protected set; } - // Inventory public uint MaxInventorySlots { get; set; } public uint LoadoutGUID { get; set; } public Loadout Loadout { get; set; } - // Extras / Other public byte FactionID { get; set; } public Faction Faction { get; set; } diff --git a/UdpHosts/GameServer/Data/CharacterGender.cs b/UdpHosts/GameServer/Data/CharacterGender.cs new file mode 100644 index 00000000..dcaec5ad --- /dev/null +++ b/UdpHosts/GameServer/Data/CharacterGender.cs @@ -0,0 +1,7 @@ +namespace GameServer.Data; + +public enum CharacterGender : byte +{ + Male = 0, + Female = 1 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Data/CharacterRace.cs b/UdpHosts/GameServer/Data/CharacterRace.cs new file mode 100644 index 00000000..f6db2aba --- /dev/null +++ b/UdpHosts/GameServer/Data/CharacterRace.cs @@ -0,0 +1,8 @@ +namespace GameServer.Data; + +public enum CharacterRace : byte +{ + Human = 0, + Unknown = 1, + DarkOne = 2 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Data/ChassisVisuals.cs b/UdpHosts/GameServer/Data/ChassisVisuals.cs index 19531f61..25783d56 100644 --- a/UdpHosts/GameServer/Data/ChassisVisuals.cs +++ b/UdpHosts/GameServer/Data/ChassisVisuals.cs @@ -1,5 +1,5 @@ -using GameServer.Enums.Visuals; -using System; +using System; +using GameServer.Enums.Visuals; namespace GameServer.Data; diff --git a/UdpHosts/GameServer/Data/CommonVisuals.cs b/UdpHosts/GameServer/Data/CommonVisuals.cs index 7f8b3510..8c893665 100644 --- a/UdpHosts/GameServer/Data/CommonVisuals.cs +++ b/UdpHosts/GameServer/Data/CommonVisuals.cs @@ -1,6 +1,6 @@ -using GameServer.Enums.Visuals; -using System; +using System; using System.Collections.Generic; +using GameServer.Enums.Visuals; namespace GameServer.Data; @@ -51,7 +51,6 @@ public static implicit operator KeyFrame.Visuals(CommonVisuals p) } */ - public class Palette { public PaletteType Type; diff --git a/UdpHosts/GameServer/Data/Loadout.cs b/UdpHosts/GameServer/Data/Loadout.cs index d121f72c..2f0fb462 100644 --- a/UdpHosts/GameServer/Data/Loadout.cs +++ b/UdpHosts/GameServer/Data/Loadout.cs @@ -1,6 +1,6 @@ -using GameServer.Enums.Visuals; -using System; +using System; using System.Collections.Generic; +using GameServer.Enums.Visuals; namespace GameServer.Data; @@ -43,9 +43,8 @@ public Loadout() BackpackModules.Add(AbilityModule.Load(129458, 5)); BackpackModules.Add(AbilityModule.Load(129056, 6)); - //PrimaryWeaponModules = new List(); - //PrimaryWeaponModules.Add(new WeaponModule(118581)); - + // PrimaryWeaponModules = new List(); + // PrimaryWeaponModules.Add(new WeaponModule(118581)); PrimaryWeaponVisuals = new CommonVisuals(); PrimaryWeaponVisuals.Colors.Add(0x21040000u); PrimaryWeaponVisuals.Colors.Add(0x4a4910a2u); @@ -58,7 +57,7 @@ public Loadout() PrimaryWeaponVisuals.OrnamentGroups.Add(10283); PrimaryWeaponVisuals.OrnamentGroups.Add(10339); - //SecondaryWeaponModules = new List(); + // SecondaryWeaponModules = new List(); SecondaryWeaponVisuals = new CommonVisuals(); SecondaryWeaponVisuals.Colors.Add(0x96070000u); @@ -83,10 +82,10 @@ public Loadout() public IList BackpackModules { get; protected set; } - //public IList PrimaryWeaponModules { get; protected set; } + // public IList PrimaryWeaponModules { get; protected set; } public CommonVisuals PrimaryWeaponVisuals { get; protected set; } - //public IList SecondaryWeaponModules { get; protected set; } + // public IList SecondaryWeaponModules { get; protected set; } public CommonVisuals SecondaryWeaponVisuals { get; protected set; } public static Loadout Load(uint guid) diff --git a/UdpHosts/GameServer/Entities/Character/Character.cs b/UdpHosts/GameServer/Entities/Character/Character.cs index c0479258..8f9f75f7 100644 --- a/UdpHosts/GameServer/Entities/Character/Character.cs +++ b/UdpHosts/GameServer/Entities/Character/Character.cs @@ -4,7 +4,8 @@ namespace GameServer.Entities.Character; public class Character : BaseEntity { - public Character(IShard owner, ulong eid) : base(owner, eid) + public Character(IShard owner, ulong eid) + : base(owner, eid) { Position = new Vector3(); Rotation = Quaternion.Identity; diff --git a/UdpHosts/GameServer/Entities/Character/MovementStateContainer.cs b/UdpHosts/GameServer/Entities/Character/MovementStateContainer.cs index 48f57e6e..a9bc8dd4 100644 --- a/UdpHosts/GameServer/Entities/Character/MovementStateContainer.cs +++ b/UdpHosts/GameServer/Entities/Character/MovementStateContainer.cs @@ -22,60 +22,6 @@ internal class MovementStateContainer public CharMovementState ValidFlags => MovementState & Enum.GetValues() .Aggregate((accumulate, currentValue) => accumulate | currentValue); - /// - /// Get a flag - /// - /// - /// - private bool GetValue(CharMovementState state) - { - return (MovementState & state) == state; - } - - /// - /// Set or unset the flag, depending on the value - /// - /// - /// if true the specified flag will be set, else it will be unset - private void SetValue(CharMovementState state, bool value) - { - if (value) - { - MovementState |= state; - } - else - { - MovementState ^= state; - } - } - - /// - /// Get a binary-number string representation of the passed value - /// - /// - /// - private static string GetBinaryString(CharMovementState state) - { - return Convert.ToString((short)state, 2).PadLeft(16, '0'); - } - - /// - /// Print the currently set valid and invalid flags - /// - /// - public override string ToString() - { - return $"MovementState value: {MovementState,5} | {GetBinaryString(MovementState)}\n" + - $"Valid flags: {ValidFlags,5:D} | {GetBinaryString(ValidFlags)}\n" + - $" [{ValidFlags:F}]\n" + - $"Invalid flags: {InvalidFlags,5} | {GetBinaryString(InvalidFlags)}\n" + - "Flag overview:\n" + - $" {string.Join("\n ", Enum.GetValues().Where(state => state != CharMovementState.None).Select(state => $"{Enum.GetName(typeof(CharMovementState), state) + ":",-13} {GetValue(state)}"))}"; - } - - - #region Accessors - /// /// Corresponds to the flag /// @@ -94,7 +40,6 @@ public bool MovementKeys set => SetValue(CharMovementState.MovementKeys, value); } - /// /// Corresponds to the flag /// @@ -104,7 +49,6 @@ public bool Sprint set => SetValue(CharMovementState.Sprint, value); } - /// /// Corresponds to the flag /// @@ -114,7 +58,6 @@ public bool TryingToMove set => SetValue(CharMovementState.TryingToMove, value); } - /// /// Corresponds to the flag /// @@ -133,5 +76,54 @@ public bool Unk set => SetValue(CharMovementState.Unk, value); } - #endregion + /// + /// Print the currently set valid and invalid flags + /// + /// + public override string ToString() + { + return $"MovementState value: {MovementState,5} | {GetBinaryString(MovementState)}\n" + + $"Valid flags: {ValidFlags,5:D} | {GetBinaryString(ValidFlags)}\n" + + $" [{ValidFlags:F}]\n" + + $"Invalid flags: {InvalidFlags,5} | {GetBinaryString(InvalidFlags)}\n" + + "Flag overview:\n" + + $" {string.Join("\n ", Enum.GetValues().Where(state => state != CharMovementState.None).Select(state => $"{Enum.GetName(typeof(CharMovementState), state) + ":",-13} {GetValue(state)}"))}"; + } + + /// + /// Get a binary-number string representation of the passed value + /// + /// + /// + private static string GetBinaryString(CharMovementState state) + { + return Convert.ToString((short)state, 2).PadLeft(16, '0'); + } + + /// + /// Get a flag + /// + /// + /// + private bool GetValue(CharMovementState state) + { + return (MovementState & state) == state; + } + + /// + /// Set or unset the flag, depending on the value + /// + /// + /// if true the specified flag will be set, else it will be unset + private void SetValue(CharMovementState state, bool value) + { + if (value) + { + MovementState |= state; + } + else + { + MovementState ^= state; + } + } } \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums.cs b/UdpHosts/GameServer/Enums.cs deleted file mode 100644 index dbf6ef34..00000000 --- a/UdpHosts/GameServer/Enums.cs +++ /dev/null @@ -1,638 +0,0 @@ -namespace GameServer.Enums -{ - namespace Visuals - { - public enum PaletteType : byte - { - FullBody = 0x0, - WeaponA = 0x4, - WeaponB = 0x5, - UnkType7 = 0x07, // Biscuit uses these - UnkType8 = 0x08, // Biscuit uses these - UnkType9 = 0x09 // Biscuit uses these - } - } - - public enum ControlPacketType : byte - { - CloseConnection = 0, - MatrixAck = 2, - ReliableGSSAck = 3, - TimeSyncRequest = 4, - TimeSyncResponse = 5, - MTUProbe = 6 - } - - public enum MatrixPacketType : byte - { - Login = 17, - EnterZoneAck = 18, - ExitZoneAck = 19, - KeyframeRequest = 20, - DEV_ExecuteCommand = 21, - Referee_ExecuteCommand = 22, - RequestPause = 23, - RequestResume = 24, - ClientStatus = 25, - ClientPreferences = 26, - SynchronizationResponse = 27, - SuperPing = 28, - StressTestMasterObject = 29, - ServerProfiler_RequestNames = 30, - LogInstrumentation = 31, - RequestSigscan = 32, - SendEmergencyChat = 33, - SigscanData = 34, - WelcomeToTheMatrix = 35, - Announce = 36, - EnterZone = 37, - UpdateZoneTimeSync = 38, - HotfixLevelChanged = 39, - ExitZone = 40, - MatrixStatus = 41, - MatchQueueResponse = 42, - MatchQueueUpdate = 43, - FoundMatchUpdate = 44, - ChallengeJoinResponse = 45, - ChallengeInvitation = 46, - ChallengeInvitationSquadInfoAck = 47, - ChallengeInvitationCancel = 48, - ChallengeInvitationResponse = 49, - ChallengeKicked = 50, - ChallengeLeave = 51, - ChallengeRosterUpdate = 52, - ChallengeReadyCheck = 53, - ChallengeMatchParametersUpdate = 54, - ChallengeMatchStarting = 55, - ForceUnqueue = 56, - SynchronizationRequest = 57, - GamePaused = 58, - SuperPong = 59, - ServerProfiler_SendNames = 60, - ServerProfiler_SendFrame = 61, - ZoneQueueUpdate = 62, - DebugLagSampleSim = 63, - DebugLagSampleClient = 64, - LFGMatchFound = 65, - LFGLeaderChange = 66, - ReceiveEmergencyChat = 67, - UpdateDevZoneInfo = 68 - } - - namespace GSS - { - public enum Controllers : byte - { - Generic = 0, - Character = 1, - Character_BaseController = 2, - Character_NPCController = 3, - Character_MissionAndMarkerController = 4, - Character_CombatController = 5, - Character_LocalEffectsController = 6, - Character_SpectatorController = 7, - Character_ObserverView = 8, - Character_EquipmentView = 9, - Character_AIObserverView = 10, - Character_CombatView = 11, - Character_MovementView = 12, - Character_TinyObjectView = 13, - Character_DynamicProjectileView = 14, - Melding = 15, - Melding_ObserverView = 16, - MeldingBubble = 17, - MeldingBubble_ObserverView = 18, - AreaVisualData = 19, - AreaVisualData_ObserverView = 20, - AreaVisualData_ParticleEffectsView = 21, - AreaVisualData_MapMarkerView = 22, - AreaVisualData_TinyObjectView = 23, - AreaVisualData_LootObjectView = 24, - AreaVisualData_ForceShieldView = 25, - Vehicle = 26, - Vehicle_BaseController = 27, - Vehicle_CombatController = 28, - Vehicle_ObserverView = 29, - Vehicle_CombatView = 30, - Vehicle_MovementView = 31, - Anchor = 32, - Anchor_AIObserverView = 33, - Deployable = 34, - Deployable_ObserverView = 35, - Deployable_NPCObserverView = 36, - Deployable_HardpointView = 37, - Turret = 38, - Turret_BaseController = 39, - Turret_ObserverView = 40, - - Outpost = 44, - Outpost_ObserverView = 45, - - ResourceNode = 47, - ResourceNode_ObserverView = 48, - - CarryableObject = 50, - CarryableObject_ObserverView = 51, - - LootStoreExtension_LootObjectView = 53, - - Generic2 = 251 - } - - namespace Generic - { - public enum Events : byte - { - EncounterToUIMessage = 32, - VotekickInitiated = 33, - VotekickResponded = 34, - ScoreBoardEnable = 35, - ScoreBoardInit = 36, - ScoreBoardSetWinner = 37, - ScoreBoardClear = 38, - ScoreBoardAddPlayer = 39, - ScoreBoardRemovePlayer = 40, - ScoreBoardUpdatePlayerStats = 41, - ScoreBoardUpdatePlayerStatsFromStat = 42, - ScoreBoardUpdatePlayerStatus = 43, - MatchLoadingState = 44, - MatchEndAck = 45, - ServerProfiler_SendNames = 46, - ServerProfiler_SendFrame = 47, - TempConsoleMessage = 48, - ReloadStaticData = 49, - EncDebugChatMessage = 50, - SendRadioMessage = 51, - NpcBehaviorInfo = 52, - NpcMonitoringLog = 53, - NpcNavigationInfo = 54, - NpcHostilityDebugInfo = 55, - NpcPositionalDebugInfo = 56, - NpcShapeDebugInfo = 57, - NpcVoxelInfo = 58, - DebugDrawInfo = 59, - NpcDevCmdResponse = 60, - DevRequestObjectPositions = 61, - DevRequestSpawnTables = 62, - DevRequestResourceNodeDebug = 63, - MissionObjectiveUpdated = 64, - MissionStatusChanged = 65, - MissionReturnToChanged = 66, - MissionsAvailable = 67, - MissionActivationAck = 68, - BountyStatusChanged = 69, - BountyAbortAck = 70, - BountyActivationAck = 71, - BountyListActiveAck = 72, - BountyListActiveDetailsAck = 73, - BountyListAvailableAck = 74, - BountyClearAck = 75, - BountyClearPreviousAck = 76, - BountyListPreviousAck = 77, - BountyRerollResponse = 78, - DisplayUiTrackBounty = 79, - Achievements = 80, - AchievementUnlocked = 81, - TotalAchievementPoints = 82, - MissionCompletionCounts = 83, - ContentUnlocked = 84, - ClientUIAction = 85, - ArcCompletionHistoryUpdate = 86, - JobLedgerEntriesUpdate = 87, - TrackRecipe = 88, - ClearTrackedRecipe = 89, - SlotTech = 90, - InteractableStatusChanged = 91, - SendTipMessage = 92, - DebugEventSample = 93, - DebugLagPlayerSample = 94, - DebugLagSimulationSample = 95, - DebugLagRaiaSample = 96, - DebugEncounterVolumes = 97, - Trail = 98, - EncounterDebugNotification = 99, - EncounterUIScopeIn = 100, - EncounterUIUpdate = 101, - EncounterUIScopeOut = 102, - DisplayUiNotification = 103, - DisplayMoneyBombBanner = 104, - SetPreloadPosition = 105, - PlaySoundId = 106, - PlaySoundIdAtLocation = 107, - PlayDialogScriptMessage = 108, - StopDialogScriptMessage = 109, - PingMap = 110, - PingMapMarker = 111, - EncounterPublicInfo = 112, - RequestActiveEncounters_Response = 113, - ShoppingListInit = 114, - SetClientDailyInfo = 115, - GlobalCounterUpdate = 116, - GlobalCounterMilestoneInfo = 117, - ChatMessageList = 118, - CurrentLoadoutResponse = 119, - VendorProductsResponse = 120, - VendorPurchaseResponse = 121, - ConductorGlobalAnnouncement = 122 - } - - public enum Commands : byte - { - UIToEncounterMessage = 17, - ServerProfiler_RequestNames = 18, - ScheduleUpdateRequest = 19, - LocalProximityAbilitySuccess = 20, - RemoteProximityAbilitySuccess = 21, - TrailRequest = 22, - RequestLeaveZone = 23, - RequestLogout = 24, - RequestEncounterInfo = 25, - RequestActiveEncounters = 26, - VotekickRequest = 27, - VotekickResponse = 28, - GlobalCounterRequest = 29, - CurrentLoadoutRequest = 30, - VendorProductRequest = 31 - } - } - - namespace Character - { - internal enum Events - { - PartialUpdate = 1, - KeyFrame = 4, - MarketRequestComplete = 83, - ReceiveWeaponTweaks = 84, - TookDebugWeaponHitPublic = 85, - TookDebugWeaponHit = 86, - DebugWeaponStats = 87, - RewardInfo = 88, - ProgressionXpRefresh = 89, - ReceivedDeferredXP = 90, - PublicCombatLog = 91, - PrivateCombatLog = 92, - AnimationUpdated = 93, - RaiaNPCDebugging = 94, - WeaponProjectileFired = 95, - AbilityProjectileFired = 96, - ProjectileHitReported = 97, - Stumble = 98, - QuickChat = 99, - ProximityTextChat = 100, - JumpActioned = 101, - JumpRolled = 102, - Respawned = 103, - CalledForHelp = 104, - TookHit = 105, - AlmostHit = 106, - DealtHit = 107, - Killed = 108, - WarnLockTargeted = 109, - CurrentPoseUpdate = 110, - ConfirmedPoseUpdate = 111, - PublicDebugMovementUpdate = 112, - ForcedMovement = 113, - ForcedMovementCancelled = 114, - GrappleClimbPermission = 115, - AbilityActivated = 116, - AbilityFailed = 117, - AbilityCooldowns = 118, - NPCInteraction = 119, - OpenMovieDialog = 120, - PrivateDialog = 121, - PublicDialog = 122, - AddOrUpdateInteractives = 123, - RemoveInteractives = 124, - InteractionProgressed = 125, - InteractionCompleted = 126, - InteractedWithProgressed = 127, - InteractedWithCompleted = 128, - InventoryUpdate = 129, - UnlocksUpdate = 130, - WorkbenchUpdate = 131, - SimulateLootPickup = 132, - DisplayRewards = 133, - TrackerEvent = 134, - TrackerPulse = 135, - PriorityTargetSet = 136, - ResourceNodeCompletedEvent = 137, - FoundResourceAreas = 138, - GeographicalReportResponse = 139, - ResourceLocationInfosRespons = 140, - UiNamedVariableUpdate = 141, - DuelNotification = 142, - NewUiQuery = 143, - UiQueryCancelled = 144, - FetchQueueInfo_Response = 145, - MatchQueueResponse = 146, - ChallengeCreateResponse = 147, - CharacterLoaded = 148, - VendorTokenMachineResponse = 149, - SalvageResponse = 150, - RepairResponse = 151, - SlotModuleResponse = 152, - UnslotAllModulesResponse = 153, - SlotGearResponse = 154, - SlotVisualResponse = 155, - SlotVisualMultiResponse = 156, - TinkeringPlanResponse = 157, - UnlockContentSuccess = 158, - PushBehavior = 159, - PopBehavior = 160, - SelfReviveResponse = 161, - ApplyCameraShake = 162, - ReceivedWebUIMessage = 163, - ExitingAttachment = 164, - LootDistributionStartEvt = 165, - LootDistributionUpdateEvt = 166, - LootDistributionCompletionEvt = 167, - ForcedWeaponSwap = 168, - ChatPartyUpdate = 169, - BagInventoryUpdate = 170, - LevelUpEvent = 171, - FactionReputationUpdate = 172, - TutorialStateInitializeEvt = 173, - TutorialStateUpdateEvt = 174, - DailyLoginRewardsUpdateEvt = 175, - Fabrication_FetchAllInstances_Response = 176, - Fabrication_FetchAllRecipes_Response = 177, - Fabrication_FetchInstance_Response = 178, - Fabrication_Start_Response = 179, - Fabrication_ApplyAction_Response = 180, - Fabrication_GenerateResult_Response = 181, - Fabrication_Finalize_Response = 182, - Fabrication_Claim_Response = 183, - PostStatEvent = 184, - BountyRerollProductInfoUpdateEvt = 185, - EliteLevels_InitAllFrames = 186, - EliteLevels_InitFrame = 187, - EliteLevels_UpgradesChanged = 188, - EliteLevels_UnusedPointsChanged = 189, - EliteLevels_IncreaseXp = 190, - EliteLevels_IncreaseLevel = 191, - EliteLevels_RerollCompleted = 192, - EliteLevels_Initialized_Info = 193, - FriendsListChanged = 194, - FriendsListResponse = 195, - PerkRespecTimerReset = 196 - } - - internal enum Commands : byte - { - UiQueryResponse = 59, - ListItemForSale = 83, - SendMailToPlayer = 84, - FillBuyOrder = 85, - ToggleMarketplace = 86, - JoinGroupLeader = 87, - PlayerReady = 88, - FetchQueueInfo = 89, - MatchQueue = 90, - ClearSavedMatchQueue = 91, - MatchmakerSetPenalties = 92, - MatchAccept = 93, - ChallengeCreate = 94, - ChallengeLeave = 95, - ChallengeInvitation = 96, - ChallengeInvitationResponse = 97, - ChallengeInvitationSquadInfo = 98, - ChallengeKick = 99, - ChallengeSetReady = 100, - ChallengeReadyCheck = 101, - ChallengeSwapTeam = 102, - ChallengeSetRoleAndTeam = 103, - ChallengeSetMatchParameters = 104, - ChallengeSetPowerPrivilege = 105, - ChallengeStartMatch = 106, - LFGCheckin = 107, - LFGLeave = 108, - MapOpened = 109, - BattleframePurchased = 110, - CollectLoot = 111, - TempSlotAbilities = 112, - SinAcquire_Source = 113, - BroadcastWeaponTweaks = 114, - MovementInput = 115, - MovementInputFake = 116, - FireInputIgnored = 117, - FireBurst = 118, - FireEnd = 119, - FireCancel = 120, - FireWeaponProjectile = 121, - ReportProjectileHit = 122, - SelectFireMode = 123, - UseScope = 124, - SelectWeapon = 125, - ReloadWeapon = 126, - CancelReload = 127, - AcquireWeaponTarget = 128, - LoseWeaponTarget = 129, - NPCApplyEffect = 130, - NPCRemoveEffect = 131, - DockToPlayer = 132, - ChangeLookAtTarget = 133, - ActivateAbility = 134, - NPCInteractWithTarget = 135, - TargetAbility = 136, - DeactivateAbility = 137, - ActivateConsumable = 138, - SetNoSpreadFlag = 139, - ExitAttachmentRequest = 140, - NPCSetInteractionType = 141, - PerformEmote = 142, - NotifyDialogScriptComplete = 143, - PerformQuickChatCommand = 144, - PerformTextChat = 145, - PerformDialog = 146, - SetDialogTag = 147, - SetEffectsFlag = 148, - AnimationUpdate = 149, - SelectLoadout = 150, - CallForHelp = 151, - AbortCampaignMission = 152, - TryResumeTutorialChain = 153, - DebugMission = 154, - AssignBounties = 155, - AbortBounty = 156, - ActivateBounty = 157, - ListActiveBounties = 158, - ListActiveBountyDetails = 159, - ListAvailableBounties = 160, - ClearBounties = 161, - ClearPreviousBounties = 162, - ListPreviousBounties = 163, - RequestRerollBounties = 164, - TrackBounty = 165, - SetBountyVar = 166, - RefreshBounties = 167, - ListAchievements = 168, - RequestAchievementStatus = 169, - RequestAllAchievements = 170, - RequestMissionAvailability = 171, - RequestNewActivity = 172, - RequestPushMission = 173, - LogDirectActivityRequest = 174, - LogActivityPush = 175, - LogLongTimeWithoutPush = 176, - CameraPoseUpdate = 177, - QueueUnstuck = 178, - VehicleCalldownRequest = 179, - DeployableCalldownRequest = 180, - DeployableHardpointSelection = 181, - ResourceNodeBeaconCalldownRequest = 182, - FindNearbyResourceAreas = 183, - GeographicalReportRequest = 184, - UpdateChatPartyMembers = 185, - ClientQueryInteractionStatus = 186, - ResourceLocationInfosRequest = 187, - DuelRequest = 188, - PickupCarryableObjectByProximity = 189, - DropCarryableObject = 190, - AiError = 191, - AiSignal = 192, - NonDevDebugCommand = 193, - UpdateShoppingList = 194, - FindServiceProvider = 195, - ClientUIEvent = 196, - SetMovementSimulation = 197, - RequestRespawn = 198, - RequestTransfer = 199, - VendorTokenMachineRequest = 200, - TimedDailyRewardRequest = 201, - SalvageRequest = 202, - RepairRequest = 203, - SlotModuleRequest = 204, - UnslotAllModulesRequest = 205, - SlotGearRequest = 206, - SlotVisualRequest = 207, - SlotVisualMultiRequest = 208, - RequestSelfRevive = 209, - RequestTeleport = 210, - RequestFrameLevelReset = 211, - LeaveEncounterParty = 212, - JoinSquadLeadersAr = 213, - LeaveArc = 214, - JobLedgerOperation = 215, - SeatChangeRequest = 216, - RequestTrackerUpdate = 217, - LootDistributionSetState = 218, - LootDistributionSetVotes = 219, - ResetTutorialId = 220, - DismissTutorialId = 221, - ClaimDailyRewardItem = 222, - ClaimDailyRewardStreak = 223, - BuyBackPreviousDay = 224, - AcceptRewards = 225, - FlushRewards = 226, - RerollEliteLevelsAwardList = 227, - RevertAllEliteLevelsUpgrade = 228, - SelectEliteLevelsAward = 229, - ResetAllEliteLevelsUpgrades_Debug = 230, - FlushCharacterCache = 231, - RunTeamManagerCommand = 232, - NPCCombatUpdate = 233, - BagInventorySettings = 234, - SetSteamUserId = 235, - EquipExperimentalLoadout = 236, - ExecuteTinkeringPlan = 237, - VendorPurchaseRequest = 238, - TutorialEventTriggeredCmd = 239, - Fabrication_FetchAllInstances = 240, - Fabrication_FetchAllRecipes = 241, - Fabrication_FetchInstance = 242, - Fabrication_Start = 243, - Fabrication_ApplyAction = 244, - Fabrication_GenerateResult = 245, - Fabrication_Finalize = 246, - Fabrication_Claim = 247, - FriendsListRequest = 248, - UpdateFriendStatus = 249, - ClaimBountyRewards = 250 - } - } - - namespace AreaVisualData - { - internal enum Events - { - PartialUpdate = 1, - KeyFrame = 4, - LootObjectCollected = 83, - AudioEmitterSpawned = 84, - ParticleEffectSpawned = 85 - } - } - - namespace Vehicle - { - internal enum Commands - { - MovementInput = 83, - MovementInputFake = 84, - SinAcquire_Source = 85, - ReceiveCollisionDamage = 86, - ActivateAbility = 87, - DeactivateAbility = 88, - SetWaterLevelAndDesc = 89, - SetEffectsFlag = 90 - } - - internal enum Events - { - PartialUpdate = 1, - KeyFrame = 4, - AbilityActivated = 83, - AbilityFailed = 84, - PublicCombatLog = 85, - CurrentPoseUpdate = 86, - TookDebugWeaponHitPublic = 87, - ForcedMovement = 88, - ForcedMovementCancelled = 89, - FlipPunch = 90, - DebugMovementUpdate = 91 - } - } - - namespace Deployable - { - internal enum Events - { - PartialUpdate = 1, - KeyFrame = 4, - TookHit = 83, - AbilityProjectileFired = 84, - PublicCombatLog = 85 - } - } - - namespace Turret - { - internal enum Events - { - PartialUpdate = 1, - KeyFrame = 4, - WeaponProjectileFired = 83 - } - - internal enum Commands - { - PoseUpdate = 83, - FireBurst = 84, - FireEnd = 85, - FireWeaponProjectile = 86, - ReportProjectileHit = 87 - } - } - - namespace LootStoreExtensions - { - internal enum Events - { - PartialUpdate = 1, - KeyFrame = 4, - LootObjectCollected = 83 - } - } - } -} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/ControlPacketType.cs b/UdpHosts/GameServer/Enums/ControlPacketType.cs new file mode 100644 index 00000000..16b29e32 --- /dev/null +++ b/UdpHosts/GameServer/Enums/ControlPacketType.cs @@ -0,0 +1,11 @@ +namespace GameServer.Enums; + +public enum ControlPacketType : byte +{ + CloseConnection = 0, + MatrixAck = 2, + ReliableGSSAck = 3, + TimeSyncRequest = 4, + TimeSyncResponse = 5, + MTUProbe = 6 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/AreaVisualData/Events.cs b/UdpHosts/GameServer/Enums/GSS/AreaVisualData/Events.cs new file mode 100644 index 00000000..58679565 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/AreaVisualData/Events.cs @@ -0,0 +1,10 @@ +namespace GameServer.Enums.GSS.AreaVisualData; + +internal enum Events +{ + PartialUpdate = 1, + KeyFrame = 4, + LootObjectCollected = 83, + AudioEmitterSpawned = 84, + ParticleEffectSpawned = 85 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Character/Commands.cs b/UdpHosts/GameServer/Enums/GSS/Character/Commands.cs new file mode 100644 index 00000000..70c98c57 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Character/Commands.cs @@ -0,0 +1,174 @@ +namespace GameServer.Enums.GSS.Character; + +internal enum Commands : byte +{ + UiQueryResponse = 59, + ListItemForSale = 83, + SendMailToPlayer = 84, + FillBuyOrder = 85, + ToggleMarketplace = 86, + JoinGroupLeader = 87, + PlayerReady = 88, + FetchQueueInfo = 89, + MatchQueue = 90, + ClearSavedMatchQueue = 91, + MatchmakerSetPenalties = 92, + MatchAccept = 93, + ChallengeCreate = 94, + ChallengeLeave = 95, + ChallengeInvitation = 96, + ChallengeInvitationResponse = 97, + ChallengeInvitationSquadInfo = 98, + ChallengeKick = 99, + ChallengeSetReady = 100, + ChallengeReadyCheck = 101, + ChallengeSwapTeam = 102, + ChallengeSetRoleAndTeam = 103, + ChallengeSetMatchParameters = 104, + ChallengeSetPowerPrivilege = 105, + ChallengeStartMatch = 106, + LFGCheckin = 107, + LFGLeave = 108, + MapOpened = 109, + BattleframePurchased = 110, + CollectLoot = 111, + TempSlotAbilities = 112, + SinAcquire_Source = 113, + BroadcastWeaponTweaks = 114, + MovementInput = 115, + MovementInputFake = 116, + FireInputIgnored = 117, + FireBurst = 118, + FireEnd = 119, + FireCancel = 120, + FireWeaponProjectile = 121, + ReportProjectileHit = 122, + SelectFireMode = 123, + UseScope = 124, + SelectWeapon = 125, + ReloadWeapon = 126, + CancelReload = 127, + AcquireWeaponTarget = 128, + LoseWeaponTarget = 129, + NPCApplyEffect = 130, + NPCRemoveEffect = 131, + DockToPlayer = 132, + ChangeLookAtTarget = 133, + ActivateAbility = 134, + NPCInteractWithTarget = 135, + TargetAbility = 136, + DeactivateAbility = 137, + ActivateConsumable = 138, + SetNoSpreadFlag = 139, + ExitAttachmentRequest = 140, + NPCSetInteractionType = 141, + PerformEmote = 142, + NotifyDialogScriptComplete = 143, + PerformQuickChatCommand = 144, + PerformTextChat = 145, + PerformDialog = 146, + SetDialogTag = 147, + SetEffectsFlag = 148, + AnimationUpdate = 149, + SelectLoadout = 150, + CallForHelp = 151, + AbortCampaignMission = 152, + TryResumeTutorialChain = 153, + DebugMission = 154, + AssignBounties = 155, + AbortBounty = 156, + ActivateBounty = 157, + ListActiveBounties = 158, + ListActiveBountyDetails = 159, + ListAvailableBounties = 160, + ClearBounties = 161, + ClearPreviousBounties = 162, + ListPreviousBounties = 163, + RequestRerollBounties = 164, + TrackBounty = 165, + SetBountyVar = 166, + RefreshBounties = 167, + ListAchievements = 168, + RequestAchievementStatus = 169, + RequestAllAchievements = 170, + RequestMissionAvailability = 171, + RequestNewActivity = 172, + RequestPushMission = 173, + LogDirectActivityRequest = 174, + LogActivityPush = 175, + LogLongTimeWithoutPush = 176, + CameraPoseUpdate = 177, + QueueUnstuck = 178, + VehicleCalldownRequest = 179, + DeployableCalldownRequest = 180, + DeployableHardpointSelection = 181, + ResourceNodeBeaconCalldownRequest = 182, + FindNearbyResourceAreas = 183, + GeographicalReportRequest = 184, + UpdateChatPartyMembers = 185, + ClientQueryInteractionStatus = 186, + ResourceLocationInfosRequest = 187, + DuelRequest = 188, + PickupCarryableObjectByProximity = 189, + DropCarryableObject = 190, + AiError = 191, + AiSignal = 192, + NonDevDebugCommand = 193, + UpdateShoppingList = 194, + FindServiceProvider = 195, + ClientUIEvent = 196, + SetMovementSimulation = 197, + RequestRespawn = 198, + RequestTransfer = 199, + VendorTokenMachineRequest = 200, + TimedDailyRewardRequest = 201, + SalvageRequest = 202, + RepairRequest = 203, + SlotModuleRequest = 204, + UnslotAllModulesRequest = 205, + SlotGearRequest = 206, + SlotVisualRequest = 207, + SlotVisualMultiRequest = 208, + RequestSelfRevive = 209, + RequestTeleport = 210, + RequestFrameLevelReset = 211, + LeaveEncounterParty = 212, + JoinSquadLeadersAr = 213, + LeaveArc = 214, + JobLedgerOperation = 215, + SeatChangeRequest = 216, + RequestTrackerUpdate = 217, + LootDistributionSetState = 218, + LootDistributionSetVotes = 219, + ResetTutorialId = 220, + DismissTutorialId = 221, + ClaimDailyRewardItem = 222, + ClaimDailyRewardStreak = 223, + BuyBackPreviousDay = 224, + AcceptRewards = 225, + FlushRewards = 226, + RerollEliteLevelsAwardList = 227, + RevertAllEliteLevelsUpgrade = 228, + SelectEliteLevelsAward = 229, + ResetAllEliteLevelsUpgrades_Debug = 230, + FlushCharacterCache = 231, + RunTeamManagerCommand = 232, + NPCCombatUpdate = 233, + BagInventorySettings = 234, + SetSteamUserId = 235, + EquipExperimentalLoadout = 236, + ExecuteTinkeringPlan = 237, + VendorPurchaseRequest = 238, + TutorialEventTriggeredCmd = 239, + Fabrication_FetchAllInstances = 240, + Fabrication_FetchAllRecipes = 241, + Fabrication_FetchInstance = 242, + Fabrication_Start = 243, + Fabrication_ApplyAction = 244, + Fabrication_GenerateResult = 245, + Fabrication_Finalize = 246, + Fabrication_Claim = 247, + FriendsListRequest = 248, + UpdateFriendStatus = 249, + ClaimBountyRewards = 250 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Character/Events.cs b/UdpHosts/GameServer/Enums/GSS/Character/Events.cs new file mode 100644 index 00000000..04837c0e --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Character/Events.cs @@ -0,0 +1,121 @@ +namespace GameServer.Enums.GSS.Character; + +internal enum Events +{ + PartialUpdate = 1, + KeyFrame = 4, + MarketRequestComplete = 83, + ReceiveWeaponTweaks = 84, + TookDebugWeaponHitPublic = 85, + TookDebugWeaponHit = 86, + DebugWeaponStats = 87, + RewardInfo = 88, + ProgressionXpRefresh = 89, + ReceivedDeferredXP = 90, + PublicCombatLog = 91, + PrivateCombatLog = 92, + AnimationUpdated = 93, + RaiaNPCDebugging = 94, + WeaponProjectileFired = 95, + AbilityProjectileFired = 96, + ProjectileHitReported = 97, + Stumble = 98, + QuickChat = 99, + ProximityTextChat = 100, + JumpActioned = 101, + JumpRolled = 102, + Respawned = 103, + CalledForHelp = 104, + TookHit = 105, + AlmostHit = 106, + DealtHit = 107, + Killed = 108, + WarnLockTargeted = 109, + CurrentPoseUpdate = 110, + ConfirmedPoseUpdate = 111, + PublicDebugMovementUpdate = 112, + ForcedMovement = 113, + ForcedMovementCancelled = 114, + GrappleClimbPermission = 115, + AbilityActivated = 116, + AbilityFailed = 117, + AbilityCooldowns = 118, + NPCInteraction = 119, + OpenMovieDialog = 120, + PrivateDialog = 121, + PublicDialog = 122, + AddOrUpdateInteractives = 123, + RemoveInteractives = 124, + InteractionProgressed = 125, + InteractionCompleted = 126, + InteractedWithProgressed = 127, + InteractedWithCompleted = 128, + InventoryUpdate = 129, + UnlocksUpdate = 130, + WorkbenchUpdate = 131, + SimulateLootPickup = 132, + DisplayRewards = 133, + TrackerEvent = 134, + TrackerPulse = 135, + PriorityTargetSet = 136, + ResourceNodeCompletedEvent = 137, + FoundResourceAreas = 138, + GeographicalReportResponse = 139, + ResourceLocationInfosRespons = 140, + UiNamedVariableUpdate = 141, + DuelNotification = 142, + NewUiQuery = 143, + UiQueryCancelled = 144, + FetchQueueInfo_Response = 145, + MatchQueueResponse = 146, + ChallengeCreateResponse = 147, + CharacterLoaded = 148, + VendorTokenMachineResponse = 149, + SalvageResponse = 150, + RepairResponse = 151, + SlotModuleResponse = 152, + UnslotAllModulesResponse = 153, + SlotGearResponse = 154, + SlotVisualResponse = 155, + SlotVisualMultiResponse = 156, + TinkeringPlanResponse = 157, + UnlockContentSuccess = 158, + PushBehavior = 159, + PopBehavior = 160, + SelfReviveResponse = 161, + ApplyCameraShake = 162, + ReceivedWebUIMessage = 163, + ExitingAttachment = 164, + LootDistributionStartEvt = 165, + LootDistributionUpdateEvt = 166, + LootDistributionCompletionEvt = 167, + ForcedWeaponSwap = 168, + ChatPartyUpdate = 169, + BagInventoryUpdate = 170, + LevelUpEvent = 171, + FactionReputationUpdate = 172, + TutorialStateInitializeEvt = 173, + TutorialStateUpdateEvt = 174, + DailyLoginRewardsUpdateEvt = 175, + Fabrication_FetchAllInstances_Response = 176, + Fabrication_FetchAllRecipes_Response = 177, + Fabrication_FetchInstance_Response = 178, + Fabrication_Start_Response = 179, + Fabrication_ApplyAction_Response = 180, + Fabrication_GenerateResult_Response = 181, + Fabrication_Finalize_Response = 182, + Fabrication_Claim_Response = 183, + PostStatEvent = 184, + BountyRerollProductInfoUpdateEvt = 185, + EliteLevels_InitAllFrames = 186, + EliteLevels_InitFrame = 187, + EliteLevels_UpgradesChanged = 188, + EliteLevels_UnusedPointsChanged = 189, + EliteLevels_IncreaseXp = 190, + EliteLevels_IncreaseLevel = 191, + EliteLevels_RerollCompleted = 192, + EliteLevels_Initialized_Info = 193, + FriendsListChanged = 194, + FriendsListResponse = 195, + PerkRespecTimerReset = 196 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Controllers.cs b/UdpHosts/GameServer/Enums/GSS/Controllers.cs new file mode 100644 index 00000000..2236c325 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Controllers.cs @@ -0,0 +1,59 @@ +namespace GameServer.Enums.GSS; + +public enum Controllers : byte +{ + Generic = 0, + Character = 1, + Character_BaseController = 2, + Character_NPCController = 3, + Character_MissionAndMarkerController = 4, + Character_CombatController = 5, + Character_LocalEffectsController = 6, + Character_SpectatorController = 7, + Character_ObserverView = 8, + Character_EquipmentView = 9, + Character_AIObserverView = 10, + Character_CombatView = 11, + Character_MovementView = 12, + Character_TinyObjectView = 13, + Character_DynamicProjectileView = 14, + Melding = 15, + Melding_ObserverView = 16, + MeldingBubble = 17, + MeldingBubble_ObserverView = 18, + AreaVisualData = 19, + AreaVisualData_ObserverView = 20, + AreaVisualData_ParticleEffectsView = 21, + AreaVisualData_MapMarkerView = 22, + AreaVisualData_TinyObjectView = 23, + AreaVisualData_LootObjectView = 24, + AreaVisualData_ForceShieldView = 25, + Vehicle = 26, + Vehicle_BaseController = 27, + Vehicle_CombatController = 28, + Vehicle_ObserverView = 29, + Vehicle_CombatView = 30, + Vehicle_MovementView = 31, + Anchor = 32, + Anchor_AIObserverView = 33, + Deployable = 34, + Deployable_ObserverView = 35, + Deployable_NPCObserverView = 36, + Deployable_HardpointView = 37, + Turret = 38, + Turret_BaseController = 39, + Turret_ObserverView = 40, + + Outpost = 44, + Outpost_ObserverView = 45, + + ResourceNode = 47, + ResourceNode_ObserverView = 48, + + CarryableObject = 50, + CarryableObject_ObserverView = 51, + + LootStoreExtension_LootObjectView = 53, + + Generic2 = 251 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Deployable/Events.cs b/UdpHosts/GameServer/Enums/GSS/Deployable/Events.cs new file mode 100644 index 00000000..42ea94a9 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Deployable/Events.cs @@ -0,0 +1,10 @@ +namespace GameServer.Enums.GSS.Deployable; + +internal enum Events +{ + PartialUpdate = 1, + KeyFrame = 4, + TookHit = 83, + AbilityProjectileFired = 84, + PublicCombatLog = 85 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Generic/Commands.cs b/UdpHosts/GameServer/Enums/GSS/Generic/Commands.cs new file mode 100644 index 00000000..7343fe7a --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Generic/Commands.cs @@ -0,0 +1,20 @@ +namespace GameServer.Enums.GSS.Generic; + +public enum Commands : byte +{ + UIToEncounterMessage = 17, + ServerProfiler_RequestNames = 18, + ScheduleUpdateRequest = 19, + LocalProximityAbilitySuccess = 20, + RemoteProximityAbilitySuccess = 21, + TrailRequest = 22, + RequestLeaveZone = 23, + RequestLogout = 24, + RequestEncounterInfo = 25, + RequestActiveEncounters = 26, + VotekickRequest = 27, + VotekickResponse = 28, + GlobalCounterRequest = 29, + CurrentLoadoutRequest = 30, + VendorProductRequest = 31 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Generic/Events.cs b/UdpHosts/GameServer/Enums/GSS/Generic/Events.cs new file mode 100644 index 00000000..1ebbcf2b --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Generic/Events.cs @@ -0,0 +1,96 @@ +namespace GameServer.Enums.GSS.Generic; + +public enum Events : byte +{ + EncounterToUIMessage = 32, + VotekickInitiated = 33, + VotekickResponded = 34, + ScoreBoardEnable = 35, + ScoreBoardInit = 36, + ScoreBoardSetWinner = 37, + ScoreBoardClear = 38, + ScoreBoardAddPlayer = 39, + ScoreBoardRemovePlayer = 40, + ScoreBoardUpdatePlayerStats = 41, + ScoreBoardUpdatePlayerStatsFromStat = 42, + ScoreBoardUpdatePlayerStatus = 43, + MatchLoadingState = 44, + MatchEndAck = 45, + ServerProfiler_SendNames = 46, + ServerProfiler_SendFrame = 47, + TempConsoleMessage = 48, + ReloadStaticData = 49, + EncDebugChatMessage = 50, + SendRadioMessage = 51, + NpcBehaviorInfo = 52, + NpcMonitoringLog = 53, + NpcNavigationInfo = 54, + NpcHostilityDebugInfo = 55, + NpcPositionalDebugInfo = 56, + NpcShapeDebugInfo = 57, + NpcVoxelInfo = 58, + DebugDrawInfo = 59, + NpcDevCmdResponse = 60, + DevRequestObjectPositions = 61, + DevRequestSpawnTables = 62, + DevRequestResourceNodeDebug = 63, + MissionObjectiveUpdated = 64, + MissionStatusChanged = 65, + MissionReturnToChanged = 66, + MissionsAvailable = 67, + MissionActivationAck = 68, + BountyStatusChanged = 69, + BountyAbortAck = 70, + BountyActivationAck = 71, + BountyListActiveAck = 72, + BountyListActiveDetailsAck = 73, + BountyListAvailableAck = 74, + BountyClearAck = 75, + BountyClearPreviousAck = 76, + BountyListPreviousAck = 77, + BountyRerollResponse = 78, + DisplayUiTrackBounty = 79, + Achievements = 80, + AchievementUnlocked = 81, + TotalAchievementPoints = 82, + MissionCompletionCounts = 83, + ContentUnlocked = 84, + ClientUIAction = 85, + ArcCompletionHistoryUpdate = 86, + JobLedgerEntriesUpdate = 87, + TrackRecipe = 88, + ClearTrackedRecipe = 89, + SlotTech = 90, + InteractableStatusChanged = 91, + SendTipMessage = 92, + DebugEventSample = 93, + DebugLagPlayerSample = 94, + DebugLagSimulationSample = 95, + DebugLagRaiaSample = 96, + DebugEncounterVolumes = 97, + Trail = 98, + EncounterDebugNotification = 99, + EncounterUIScopeIn = 100, + EncounterUIUpdate = 101, + EncounterUIScopeOut = 102, + DisplayUiNotification = 103, + DisplayMoneyBombBanner = 104, + SetPreloadPosition = 105, + PlaySoundId = 106, + PlaySoundIdAtLocation = 107, + PlayDialogScriptMessage = 108, + StopDialogScriptMessage = 109, + PingMap = 110, + PingMapMarker = 111, + EncounterPublicInfo = 112, + RequestActiveEncounters_Response = 113, + ShoppingListInit = 114, + SetClientDailyInfo = 115, + GlobalCounterUpdate = 116, + GlobalCounterMilestoneInfo = 117, + ChatMessageList = 118, + CurrentLoadoutResponse = 119, + VendorProductsResponse = 120, + VendorPurchaseResponse = 121, + ConductorGlobalAnnouncement = 122 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/LootStoreExtensions/Events.cs b/UdpHosts/GameServer/Enums/GSS/LootStoreExtensions/Events.cs new file mode 100644 index 00000000..ef67be60 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/LootStoreExtensions/Events.cs @@ -0,0 +1,8 @@ +namespace GameServer.Enums.GSS.LootStoreExtensions; + +internal enum Events +{ + PartialUpdate = 1, + KeyFrame = 4, + LootObjectCollected = 83 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Turret/Commands.cs b/UdpHosts/GameServer/Enums/GSS/Turret/Commands.cs new file mode 100644 index 00000000..cbca35d9 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Turret/Commands.cs @@ -0,0 +1,10 @@ +namespace GameServer.Enums.GSS.Turret; + +internal enum Commands +{ + PoseUpdate = 83, + FireBurst = 84, + FireEnd = 85, + FireWeaponProjectile = 86, + ReportProjectileHit = 87 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Turret/Events.cs b/UdpHosts/GameServer/Enums/GSS/Turret/Events.cs new file mode 100644 index 00000000..ac9906e6 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Turret/Events.cs @@ -0,0 +1,8 @@ +namespace GameServer.Enums.GSS.Turret; + +internal enum Events +{ + PartialUpdate = 1, + KeyFrame = 4, + WeaponProjectileFired = 83 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Vehicle/Commands.cs b/UdpHosts/GameServer/Enums/GSS/Vehicle/Commands.cs new file mode 100644 index 00000000..98d8e34c --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Vehicle/Commands.cs @@ -0,0 +1,13 @@ +namespace GameServer.Enums.GSS.Vehicle; + +internal enum Commands +{ + MovementInput = 83, + MovementInputFake = 84, + SinAcquire_Source = 85, + ReceiveCollisionDamage = 86, + ActivateAbility = 87, + DeactivateAbility = 88, + SetWaterLevelAndDesc = 89, + SetEffectsFlag = 90 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/GSS/Vehicle/Events.cs b/UdpHosts/GameServer/Enums/GSS/Vehicle/Events.cs new file mode 100644 index 00000000..4c4a9190 --- /dev/null +++ b/UdpHosts/GameServer/Enums/GSS/Vehicle/Events.cs @@ -0,0 +1,16 @@ +namespace GameServer.Enums.GSS.Vehicle; + +internal enum Events +{ + PartialUpdate = 1, + KeyFrame = 4, + AbilityActivated = 83, + AbilityFailed = 84, + PublicCombatLog = 85, + CurrentPoseUpdate = 86, + TookDebugWeaponHitPublic = 87, + ForcedMovement = 88, + ForcedMovementCancelled = 89, + FlipPunch = 90, + DebugMovementUpdate = 91 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/MatrixPacketType.cs b/UdpHosts/GameServer/Enums/MatrixPacketType.cs new file mode 100644 index 00000000..68b4044c --- /dev/null +++ b/UdpHosts/GameServer/Enums/MatrixPacketType.cs @@ -0,0 +1,57 @@ +namespace GameServer.Enums; + +public enum MatrixPacketType : byte +{ + Login = 17, + EnterZoneAck = 18, + ExitZoneAck = 19, + KeyframeRequest = 20, + DEV_ExecuteCommand = 21, + Referee_ExecuteCommand = 22, + RequestPause = 23, + RequestResume = 24, + ClientStatus = 25, + ClientPreferences = 26, + SynchronizationResponse = 27, + SuperPing = 28, + StressTestMasterObject = 29, + ServerProfiler_RequestNames = 30, + LogInstrumentation = 31, + RequestSigscan = 32, + SendEmergencyChat = 33, + SigscanData = 34, + WelcomeToTheMatrix = 35, + Announce = 36, + EnterZone = 37, + UpdateZoneTimeSync = 38, + HotfixLevelChanged = 39, + ExitZone = 40, + MatrixStatus = 41, + MatchQueueResponse = 42, + MatchQueueUpdate = 43, + FoundMatchUpdate = 44, + ChallengeJoinResponse = 45, + ChallengeInvitation = 46, + ChallengeInvitationSquadInfoAck = 47, + ChallengeInvitationCancel = 48, + ChallengeInvitationResponse = 49, + ChallengeKicked = 50, + ChallengeLeave = 51, + ChallengeRosterUpdate = 52, + ChallengeReadyCheck = 53, + ChallengeMatchParametersUpdate = 54, + ChallengeMatchStarting = 55, + ForceUnqueue = 56, + SynchronizationRequest = 57, + GamePaused = 58, + SuperPong = 59, + ServerProfiler_SendNames = 60, + ServerProfiler_SendFrame = 61, + ZoneQueueUpdate = 62, + DebugLagSampleSim = 63, + DebugLagSampleClient = 64, + LFGMatchFound = 65, + LFGLeaderChange = 66, + ReceiveEmergencyChat = 67, + UpdateDevZoneInfo = 68 +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Enums/Visuals/PaletteType.cs b/UdpHosts/GameServer/Enums/Visuals/PaletteType.cs new file mode 100644 index 00000000..779f8442 --- /dev/null +++ b/UdpHosts/GameServer/Enums/Visuals/PaletteType.cs @@ -0,0 +1,11 @@ +namespace GameServer.Enums.Visuals; + +public enum PaletteType : byte +{ + FullBody = 0x0, + WeaponA = 0x4, + WeaponB = 0x5, + UnkType7 = 0x07, // Biscuit uses these + UnkType8 = 0x08, // Biscuit uses these + UnkType9 = 0x09 // Biscuit uses these +} \ No newline at end of file diff --git a/UdpHosts/GameServer/Extensions/GamePacket.cs b/UdpHosts/GameServer/Extensions/GamePacket.cs index dead2e59..b027d3fb 100644 --- a/UdpHosts/GameServer/Extensions/GamePacket.cs +++ b/UdpHosts/GameServer/Extensions/GamePacket.cs @@ -12,7 +12,8 @@ internal static class GamePacketExtensions /// /// /// Do not call after other reading operations during endpoint execution! Relies heavily on to work correctly - internal static T Unpack(this GamePacket packet) where T : class, IAero, new() + internal static T Unpack(this GamePacket packet) + where T : class, IAero, new() { var ret = new T(); ret.Unpack(packet.PacketData.Span[packet.CurrentPosition..]); diff --git a/UdpHosts/GameServer/Extensions/IAero.cs b/UdpHosts/GameServer/Extensions/IAero.cs index a7b4af4b..3040f9b5 100644 --- a/UdpHosts/GameServer/Extensions/IAero.cs +++ b/UdpHosts/GameServer/Extensions/IAero.cs @@ -1,5 +1,5 @@ -using Aero.Gen; -using System; +using System; +using Aero.Gen; namespace GameServer.Extensions; diff --git a/UdpHosts/GameServer/GameServer.cs b/UdpHosts/GameServer/GameServer.cs index 99963515..396c5130 100644 --- a/UdpHosts/GameServer/GameServer.cs +++ b/UdpHosts/GameServer/GameServer.cs @@ -1,13 +1,13 @@ -using GameServer.Controllers; -using GameServer.Test; -using Serilog; -using Shared.Udp; -using System; +using System; using System.Buffers.Binary; using System.Collections.Concurrent; using System.Linq; using System.Threading; using System.Threading.Tasks.Dataflow; +using GameServer.Controllers; +using GameServer.Test; +using Serilog; +using Shared.Udp; namespace GameServer; @@ -59,6 +59,18 @@ protected override void HandlePacket(Packet packet, CancellationToken ct) client.HandlePacket(packet.PacketData[4..], packet); } + /// + /// Generate the Server Id + /// TODO: Incorporate the Sql Node Number as per https://gist.github.com/SilentCLD/881839a9f45578f1618db012fc789a71 + /// + /// + private static ulong GenerateServerId() + { + Span ranSpan = stackalloc byte[8]; + new Random().NextBytes(ranSpan.Slice(2, 6)); + return BinaryPrimitives.ReadUInt64LittleEndian(ranSpan); + } + private INetworkClient RetrieveClient(Packet packet, CancellationToken ct) { var socketId = Utils.SimpleFixEndianness(packet.Read()); @@ -101,16 +113,4 @@ private IShard NewShard(CancellationToken ct) return shard; } - - /// - /// Generate the Server Id - /// TODO: Incorporate the Sql Node Number as per https://gist.github.com/SilentCLD/881839a9f45578f1618db012fc789a71 - /// - /// - private static ulong GenerateServerId() - { - Span ranSpan = stackalloc byte[8]; - new Random().NextBytes(ranSpan.Slice(2, 6)); - return BinaryPrimitives.ReadUInt64LittleEndian(ranSpan); - } } \ No newline at end of file diff --git a/UdpHosts/GameServer/GameServer.csproj b/UdpHosts/GameServer/GameServer.csproj index bccd6bcf..f3061356 100644 --- a/UdpHosts/GameServer/GameServer.csproj +++ b/UdpHosts/GameServer/GameServer.csproj @@ -34,7 +34,7 @@ - + diff --git a/UdpHosts/GameServer/INetworkClient.cs b/UdpHosts/GameServer/INetworkClient.cs index 7e7bdb52..80819684 100644 --- a/UdpHosts/GameServer/INetworkClient.cs +++ b/UdpHosts/GameServer/INetworkClient.cs @@ -1,8 +1,8 @@ -using Shared.Udp; -using System; +using System; using System.Collections.Immutable; using System.Net; using System.Threading; +using Shared.Udp; namespace GameServer; diff --git a/UdpHosts/GameServer/IPlayer.cs b/UdpHosts/GameServer/IPlayer.cs index b5956050..d9bdf607 100644 --- a/UdpHosts/GameServer/IPlayer.cs +++ b/UdpHosts/GameServer/IPlayer.cs @@ -1,5 +1,5 @@ -using GameServer.Data; -using System.Threading; +using System.Threading; +using GameServer.Data; using Character = GameServer.Entities.Character.Character; namespace GameServer; diff --git a/UdpHosts/GameServer/IShard.cs b/UdpHosts/GameServer/IShard.cs index 36bac033..13b736d3 100644 --- a/UdpHosts/GameServer/IShard.cs +++ b/UdpHosts/GameServer/IShard.cs @@ -1,8 +1,8 @@ -using GameServer.Entities; -using Shared.Udp; -using System; +using System; using System.Collections.Generic; using System.Threading; +using GameServer.Entities; +using Shared.Udp; namespace GameServer; diff --git a/UdpHosts/GameServer/NetworkClient.cs b/UdpHosts/GameServer/NetworkClient.cs index c9d0a7d6..20b52040 100644 --- a/UdpHosts/GameServer/NetworkClient.cs +++ b/UdpHosts/GameServer/NetworkClient.cs @@ -1,4 +1,10 @@ -using AeroMessages.Matrix.V25; +using System; +using System.Collections.Immutable; +using System.Linq; +using System.Net; +using System.Runtime.CompilerServices; +using System.Threading; +using AeroMessages.Matrix.V25; using GameServer.Controllers; using GameServer.Controllers.Character; using GameServer.Enums; @@ -7,12 +13,6 @@ using GameServer.Packets.Control; using Serilog; using Shared.Udp; -using System; -using System.Collections.Immutable; -using System.Linq; -using System.Net; -using System.Runtime.CompilerServices; -using System.Threading; namespace GameServer; @@ -29,9 +29,6 @@ protected NetworkClient(IPEndPoint endPoint, uint socketId, ILogger logger) NetLastActive = DateTime.Now; } - protected IPacketSender Sender { get; private set; } - protected IPlayer Player { get; private set; } - public Status NetClientStatus { get; private set; } public uint SocketId { get; } public IPEndPoint RemoteEndpoint { get; } @@ -39,6 +36,9 @@ protected NetworkClient(IPEndPoint endPoint, uint socketId, ILogger logger) public ImmutableDictionary NetChannels { get; private set; } public IShard AssignedShard { get; private set; } + protected IPacketSender Sender { get; private set; } + protected IPlayer Player { get; private set; } + public void Init(IPlayer player, IShard shard, IPacketSender sender) { Player = player; @@ -78,8 +78,7 @@ public void HandlePacket(ReadOnlyMemory data, Packet packet) var gamePacket = new GamePacket(header, data.Slice(index + headerSize, header.Length - headerSize), packet.Received); - //Program.Logger.Verbose("-> {0} = R:{1} S:{2} L:{3}", hdr.Channel, hdr.ResendCount, hdr.IsSplit, hdr.Length); - + // Program.Logger.Verbose("-> {0} = R:{1} S:{2} L:{3}", hdr.Channel, hdr.ResendCount, hdr.IsSplit, hdr.Length); NetChannels[header.Channel].HandlePacket(gamePacket); index += header.Length; @@ -107,7 +106,6 @@ public void Send(Memory packet) Sender.SendAsync(t, RemoteEndpoint); } - public void SendAck(ChannelType forChannel, ushort forSequenceNumber, DateTime? received = null) { if (received != null) @@ -169,6 +167,7 @@ private void Matrix_PacketAvailable(GamePacket packet) break; case MatrixPacketType.KeyframeRequest: packet.Unpack(); + // TODO: Send checksums/keyframes in return. break; case MatrixPacketType.ClientStatus: @@ -203,16 +202,19 @@ private void Control_PacketAvailable(GamePacket packet) { case ControlPacketType.CloseConnection: packet.Read(); + // TODO: Cleanly dispose of client break; case ControlPacketType.MatrixAck: var matrixAckPackage = packet.Read(); Logger.Verbose("--> {0} Ack for {1} on {2}.", ChannelType.Control, Utils.SimpleFixEndianness(matrixAckPackage.AckFor), ChannelType.Matrix); + // TODO: Track reliable packets break; case ControlPacketType.ReliableGSSAck: var reliableGssAckPackage = packet.Read(); Logger.Verbose("--> {0} Ack for {1} on {2}.", ChannelType.Control, Utils.SimpleFixEndianness(reliableGssAckPackage.AckFor), ChannelType.ReliableGss); + // TODO: Track reliable packets break; case ControlPacketType.TimeSyncRequest: @@ -222,6 +224,7 @@ private void Control_PacketAvailable(GamePacket packet) break; case ControlPacketType.MTUProbe: packet.Read(); + // TODO: ??? break; default: diff --git a/UdpHosts/GameServer/NetworkPlayer.cs b/UdpHosts/GameServer/NetworkPlayer.cs index 1fd18e6c..4ccb3803 100644 --- a/UdpHosts/GameServer/NetworkPlayer.cs +++ b/UdpHosts/GameServer/NetworkPlayer.cs @@ -1,4 +1,8 @@ -using AeroMessages.Common; +using System; +using System.Net; +using System.Numerics; +using System.Threading; +using AeroMessages.Common; using AeroMessages.GSS.V66; using AeroMessages.GSS.V66.Character; using AeroMessages.GSS.V66.Character.Controller; @@ -7,11 +11,6 @@ using GameServer.Data; using GameServer.Test; using Serilog; -using System; -using System.Net; -using System.Numerics; -using System.Threading; - using Character = GameServer.Entities.Character.Character; using Loadout = AeroMessages.GSS.V66.Character.Event.Loadout; @@ -111,7 +110,6 @@ public void Respawn() }; NetChannels[ChannelType.ReliableGss].SendIAeroChanges(combatController, CharacterEntity.EntityId); - // InventoryUpdate var inventoryUpdate = new InventoryUpdate { @@ -255,7 +253,7 @@ public void Ready() public void Jump() { - //NetChannels[ChannelType.UnreliableGss].SendGSSClass( new JumpActioned { JumpTime = AssignedShard.CurrentShortTime }, CharacterEntity.EntityID, Enums.GSS.Controllers.Character_BaseController ); + // NetChannels[ChannelType.UnreliableGss].SendGSSClass( new JumpActioned { JumpTime = AssignedShard.CurrentShortTime }, CharacterEntity.EntityID, Enums.GSS.Controllers.Character_BaseController ); CharacterEntity.TimeSinceLastJump = AssignedShard.CurrentShortTime; } @@ -273,7 +271,7 @@ public void Tick(double deltaTime, ulong currentTime, CancellationToken ct) { if (AssignedShard.CurrentTime - _lastKeyFrame > 0.5) { - //NetChannels[ChannelType.ReliableGss].SendGSSClass(Test.GSS.Character.BaseController.KeyFrame.Test(this, this), this.InstanceID, msgEnumType: typeof(Enums.GSS.Character.Events)); + // NetChannels[ChannelType.ReliableGss].SendGSSClass(Test.GSS.Character.BaseController.KeyFrame.Test(this, this), this.InstanceID, msgEnumType: typeof(Enums.GSS.Character.Events)); } break; diff --git a/UdpHosts/GameServer/Packets/Common/Vector.cs b/UdpHosts/GameServer/Packets/Common/Vector.cs index e193ce57..2f192932 100644 --- a/UdpHosts/GameServer/Packets/Common/Vector.cs +++ b/UdpHosts/GameServer/Packets/Common/Vector.cs @@ -1,5 +1,5 @@ -using Shared.Udp; -using System.Numerics; +using System.Numerics; +using Shared.Udp; namespace GameServer.Packets.Common; diff --git a/UdpHosts/GameServer/Packets/Control/MTUProbe.cs b/UdpHosts/GameServer/Packets/Control/MTUProbe.cs index 0b9aa1b5..cddcb24b 100644 --- a/UdpHosts/GameServer/Packets/Control/MTUProbe.cs +++ b/UdpHosts/GameServer/Packets/Control/MTUProbe.cs @@ -1,5 +1,5 @@ -using GameServer.Enums; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; +using GameServer.Enums; namespace GameServer.Packets.Control; diff --git a/UdpHosts/GameServer/Packets/Control/TimeSyncRequest.cs b/UdpHosts/GameServer/Packets/Control/TimeSyncRequest.cs index d85008e5..3187e3db 100644 --- a/UdpHosts/GameServer/Packets/Control/TimeSyncRequest.cs +++ b/UdpHosts/GameServer/Packets/Control/TimeSyncRequest.cs @@ -1,5 +1,5 @@ -using GameServer.Enums; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; +using GameServer.Enums; namespace GameServer.Packets.Control; diff --git a/UdpHosts/GameServer/Packets/Control/TimeSyncResponse.cs b/UdpHosts/GameServer/Packets/Control/TimeSyncResponse.cs index 6f5d0c85..a831df01 100644 --- a/UdpHosts/GameServer/Packets/Control/TimeSyncResponse.cs +++ b/UdpHosts/GameServer/Packets/Control/TimeSyncResponse.cs @@ -1,5 +1,5 @@ -using GameServer.Enums; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; +using GameServer.Enums; namespace GameServer.Packets.Control; diff --git a/UdpHosts/GameServer/Packets/ControlMessageAttribute.cs b/UdpHosts/GameServer/Packets/ControlMessageAttribute.cs index 2c24bf19..3ce2e884 100644 --- a/UdpHosts/GameServer/Packets/ControlMessageAttribute.cs +++ b/UdpHosts/GameServer/Packets/ControlMessageAttribute.cs @@ -1,5 +1,5 @@ -using GameServer.Enums; -using System; +using System; +using GameServer.Enums; namespace GameServer.Packets; diff --git a/UdpHosts/GameServer/Packets/GSS/ArcCompletionHistoryUpdate.cs b/UdpHosts/GameServer/Packets/GSS/ArcCompletionHistoryUpdate.cs index 8eb10d77..2a5f37fd 100644 --- a/UdpHosts/GameServer/Packets/GSS/ArcCompletionHistoryUpdate.cs +++ b/UdpHosts/GameServer/Packets/GSS/ArcCompletionHistoryUpdate.cs @@ -1,7 +1,7 @@ -using GameServer.Enums.GSS.Generic; -using Shared.Udp; -using System.Collections.Generic; +using System.Collections.Generic; using System.Runtime.InteropServices; +using GameServer.Enums.GSS.Generic; +using Shared.Udp; namespace GameServer.Packets.GSS; diff --git a/UdpHosts/GameServer/Packets/GSS/Character/MissionAndMarkerController/KeyFrame.cs b/UdpHosts/GameServer/Packets/GSS/Character/MissionAndMarkerController/KeyFrame.cs index 89db689d..6fb11a7c 100644 --- a/UdpHosts/GameServer/Packets/GSS/Character/MissionAndMarkerController/KeyFrame.cs +++ b/UdpHosts/GameServer/Packets/GSS/Character/MissionAndMarkerController/KeyFrame.cs @@ -1,6 +1,6 @@ -using GameServer.Enums.GSS.Character; +using System.Collections.Generic; +using GameServer.Enums.GSS.Character; using Shared.Udp; -using System.Collections.Generic; namespace GameServer.Packets.GSS.Character.MissionAndMarkerController; diff --git a/UdpHosts/GameServer/Packets/GamePacket.cs b/UdpHosts/GameServer/Packets/GamePacket.cs index 436b07af..5973a0ef 100644 --- a/UdpHosts/GameServer/Packets/GamePacket.cs +++ b/UdpHosts/GameServer/Packets/GamePacket.cs @@ -1,6 +1,5 @@ -using Shared.Udp; -using System; -using AeroMessages; +using System; +using Shared.Udp; namespace GameServer.Packets; public struct GamePacket @@ -12,6 +11,14 @@ public struct GamePacket /// public readonly ReadOnlyMemory PacketData; + public GamePacket(GamePacketHeader hdr, ReadOnlyMemory data, DateTime? received = null) + { + Header = hdr; + PacketData = data; + CurrentPosition = 0; + Received = received ?? DateTime.Now; + } + /// /// The position of the first unread byte within the packet data /// @@ -32,14 +39,6 @@ public struct GamePacket /// public DateTime Received { get; set; } - public GamePacket(GamePacketHeader hdr, ReadOnlyMemory data, DateTime? received = null) - { - Header = hdr; - PacketData = data; - CurrentPosition = 0; - Received = received ?? DateTime.Now; - } - public T Read() { var buf = PacketData[CurrentPosition..]; diff --git a/UdpHosts/GameServer/Packets/GamePacketHeader.cs b/UdpHosts/GameServer/Packets/GamePacketHeader.cs index 205ccfdd..901c41f1 100644 --- a/UdpHosts/GameServer/Packets/GamePacketHeader.cs +++ b/UdpHosts/GameServer/Packets/GamePacketHeader.cs @@ -7,11 +7,6 @@ public readonly struct GamePacketHeader { public readonly ushort PacketHeader; - public ChannelType Channel => (ChannelType)(byte)(PacketHeader >> 14); - public byte ResendCount => (byte)((PacketHeader >> 12) & 0b11); - public bool IsSplit => ((PacketHeader >> 11) & 0b1) == 1; - public ushort Length => (ushort)(PacketHeader & 0x7ff); - public GamePacketHeader(ChannelType channel, byte resendCount, bool isSplit, ushort len) { PacketHeader = (ushort)((((byte)channel & 0b11) << 14) | @@ -19,4 +14,9 @@ public GamePacketHeader(ChannelType channel, byte resendCount, bool isSplit, ush ((isSplit ? 1 : 0) << 11) | (len & 0x07FF)); } + + public ChannelType Channel => (ChannelType)(byte)(PacketHeader >> 14); + public byte ResendCount => (byte)((PacketHeader >> 12) & 0b11); + public bool IsSplit => ((PacketHeader >> 11) & 0b1) == 1; + public ushort Length => (ushort)(PacketHeader & 0x7ff); } \ No newline at end of file diff --git a/UdpHosts/GameServer/Packets/MatrixMessageAttribute.cs b/UdpHosts/GameServer/Packets/MatrixMessageAttribute.cs index 488896d0..4fd42bb7 100644 --- a/UdpHosts/GameServer/Packets/MatrixMessageAttribute.cs +++ b/UdpHosts/GameServer/Packets/MatrixMessageAttribute.cs @@ -1,5 +1,5 @@ -using GameServer.Enums; -using System; +using System; +using GameServer.Enums; namespace GameServer.Packets; diff --git a/UdpHosts/GameServer/PhysicsEngine.cs b/UdpHosts/GameServer/PhysicsEngine.cs index fdaed9d7..0b669547 100644 --- a/UdpHosts/GameServer/PhysicsEngine.cs +++ b/UdpHosts/GameServer/PhysicsEngine.cs @@ -21,7 +21,7 @@ public void Tick(double deltaTime, ulong currentTime, CancellationToken ct) while (!ct.IsCancellationRequested && Accumulator >= DeltaTime) { - Integrate( /*state*/null, SimulatedTime, DeltaTime); + Integrate(/*state*/null, SimulatedTime, DeltaTime); Accumulator -= DeltaTime; SimulatedTime += DeltaTime; } diff --git a/UdpHosts/GameServer/Program.cs b/UdpHosts/GameServer/Program.cs index fea8617a..5ec1ca15 100644 --- a/UdpHosts/GameServer/Program.cs +++ b/UdpHosts/GameServer/Program.cs @@ -1,8 +1,8 @@ -using Autofac; +using System; +using System.Collections.Generic; +using Autofac; using CommandLine; using CommandLine.Text; -using System; -using System.Collections.Generic; namespace GameServer; @@ -68,11 +68,13 @@ private static void ApplyCliOptions(CliOptions options, GameServerSettings setti /// Parser result private static void DisplayHelpText(ParserResult result) { - var helpText = HelpText.AutoBuild(result, h => + var helpText = HelpText.AutoBuild(result, + h => { h.AdditionalNewLineAfterOption = false; return HelpText.DefaultParsingErrorsHandler(result, h); - }, e => e); + }, + e => e); Console.WriteLine(helpText); } } \ No newline at end of file diff --git a/UdpHosts/GameServer/ReflectionUtils.cs b/UdpHosts/GameServer/ReflectionUtils.cs index 656f4526..c421ceb9 100644 --- a/UdpHosts/GameServer/ReflectionUtils.cs +++ b/UdpHosts/GameServer/ReflectionUtils.cs @@ -1,8 +1,8 @@ -using GameServer.Extensions; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; +using GameServer.Extensions; namespace GameServer; diff --git a/UdpHosts/GameServer/Shard.cs b/UdpHosts/GameServer/Shard.cs index 55842867..7bc18a24 100644 --- a/UdpHosts/GameServer/Shard.cs +++ b/UdpHosts/GameServer/Shard.cs @@ -1,13 +1,13 @@ -using GameServer.Entities; -using Shared.Common; -using Shared.Udp; -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Threading; using System.Threading.Tasks; +using GameServer.Entities; +using Shared.Common; +using Shared.Udp; namespace GameServer; @@ -33,14 +33,13 @@ public Shard(double gameTickRate, ulong instanceId, IPacketSender sender) public DateTime StartTime => DateTimeExtensions.Epoch.AddSeconds(_startTime); public IDictionary Entities { get; protected set; } - private IPacketSender Sender { get; } - public IDictionary Clients { get; } public PhysicsEngine Physics { get; } public AIEngine AI { get; } public ulong InstanceId { get; } public ulong CurrentTimeLong { get; private set; } public IDictionary> EntityRefMap { get; } + private IPacketSender Sender { get; } public void Run(CancellationToken ct) { @@ -66,7 +65,10 @@ public bool Tick(double deltaTime, ulong currentTime, CancellationToken ct) return true; } - public bool MigrateOut(INetworkPlayer player) { return false; } + public bool MigrateOut(INetworkPlayer player) + { + return false; + } public bool MigrateIn(INetworkPlayer player) { @@ -78,8 +80,8 @@ public bool MigrateIn(INetworkPlayer player) player.Init(this); Clients.Add(player.SocketId, player); - //Entities.Add(player.CharacterEntity.EntityID, player.CharacterEntity); - + + // Entities.Add(player.CharacterEntity.EntityID, player.CharacterEntity); return true; } diff --git a/UdpHosts/GameServer/Test/DataUtils.cs b/UdpHosts/GameServer/Test/DataUtils.cs index 7085a26a..43e47388 100644 --- a/UdpHosts/GameServer/Test/DataUtils.cs +++ b/UdpHosts/GameServer/Test/DataUtils.cs @@ -1,6 +1,6 @@ -using GameServer.Data; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Numerics; +using GameServer.Data; namespace GameServer.Test; diff --git a/UdpHosts/MatrixServer/MatrixServer.cs b/UdpHosts/MatrixServer/MatrixServer.cs index f2e28305..535def2f 100644 --- a/UdpHosts/MatrixServer/MatrixServer.cs +++ b/UdpHosts/MatrixServer/MatrixServer.cs @@ -1,8 +1,8 @@ -using MatrixServer.Packets; +using System; +using System.Threading; +using MatrixServer.Packets; using Serilog; using Shared.Udp; -using System; -using System.Threading; namespace MatrixServer; diff --git a/UdpHosts/MatrixServer/Packets/MatrixPacketAbrt.cs b/UdpHosts/MatrixServer/Packets/MatrixPacketAbrt.cs index 16d3f6fb..71be8488 100644 --- a/UdpHosts/MatrixServer/Packets/MatrixPacketAbrt.cs +++ b/UdpHosts/MatrixServer/Packets/MatrixPacketAbrt.cs @@ -1,6 +1,6 @@ -using Shared.Udp; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; +using Shared.Udp; namespace MatrixServer.Packets; diff --git a/UdpHosts/MatrixServer/Packets/MatrixPacketBase.cs b/UdpHosts/MatrixServer/Packets/MatrixPacketBase.cs index 274c6220..37f43293 100644 --- a/UdpHosts/MatrixServer/Packets/MatrixPacketBase.cs +++ b/UdpHosts/MatrixServer/Packets/MatrixPacketBase.cs @@ -1,6 +1,6 @@ -using Shared.Udp; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; +using Shared.Udp; namespace MatrixServer.Packets; diff --git a/UdpHosts/MatrixServer/Packets/MatrixPacketHehe.cs b/UdpHosts/MatrixServer/Packets/MatrixPacketHehe.cs index 75ea4a95..1da5b2d7 100644 --- a/UdpHosts/MatrixServer/Packets/MatrixPacketHehe.cs +++ b/UdpHosts/MatrixServer/Packets/MatrixPacketHehe.cs @@ -1,6 +1,6 @@ -using Shared.Udp; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; +using Shared.Udp; namespace MatrixServer.Packets; diff --git a/UdpHosts/MatrixServer/Packets/MatrixPacketHugg.cs b/UdpHosts/MatrixServer/Packets/MatrixPacketHugg.cs index 7e28b21b..6709b045 100644 --- a/UdpHosts/MatrixServer/Packets/MatrixPacketHugg.cs +++ b/UdpHosts/MatrixServer/Packets/MatrixPacketHugg.cs @@ -1,6 +1,6 @@ -using Shared.Udp; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; +using Shared.Udp; namespace MatrixServer.Packets; diff --git a/UdpHosts/MatrixServer/Packets/MatrixPacketKiss.cs b/UdpHosts/MatrixServer/Packets/MatrixPacketKiss.cs index 636ca42c..1bac99db 100644 --- a/UdpHosts/MatrixServer/Packets/MatrixPacketKiss.cs +++ b/UdpHosts/MatrixServer/Packets/MatrixPacketKiss.cs @@ -1,6 +1,6 @@ -using Shared.Udp; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; +using Shared.Udp; namespace MatrixServer.Packets; diff --git a/UdpHosts/MatrixServer/Packets/MatrixPacketPoke.cs b/UdpHosts/MatrixServer/Packets/MatrixPacketPoke.cs index 9a4001ad..f444bde7 100644 --- a/UdpHosts/MatrixServer/Packets/MatrixPacketPoke.cs +++ b/UdpHosts/MatrixServer/Packets/MatrixPacketPoke.cs @@ -1,6 +1,6 @@ -using Shared.Udp; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.Text; +using Shared.Udp; namespace MatrixServer.Packets; diff --git a/UdpHosts/MatrixServer/Program.cs b/UdpHosts/MatrixServer/Program.cs index 5719e026..7532f366 100644 --- a/UdpHosts/MatrixServer/Program.cs +++ b/UdpHosts/MatrixServer/Program.cs @@ -1,8 +1,8 @@ -using Autofac; +using System; +using System.Collections.Generic; +using Autofac; using CommandLine; using CommandLine.Text; -using System; -using System.Collections.Generic; namespace MatrixServer; @@ -68,11 +68,13 @@ private static void ApplyCliOptions(CliOptions options, MatrixServerSettings set /// Parser result private static void DisplayHelpText(ParserResult result) { - var helpText = HelpText.AutoBuild(result, h => + var helpText = HelpText.AutoBuild(result, + h => { h.AdditionalNewLineAfterOption = false; return HelpText.DefaultParsingErrorsHandler(result, h); - }, e => e); + }, + e => e); Console.WriteLine(helpText); } } \ No newline at end of file diff --git a/WebHosts/WebHost.CatchAll/WebServer.cs b/WebHosts/WebHost.CatchAll/WebServer.cs index d0bcdb02..020e2ddb 100644 --- a/WebHosts/WebHost.CatchAll/WebServer.cs +++ b/WebHosts/WebHost.CatchAll/WebServer.cs @@ -8,8 +8,16 @@ namespace WebHost.CatchAll; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } + + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.Chat/WebServer.cs b/WebHosts/WebHost.Chat/WebServer.cs index ec7023c6..ad7c0947 100644 --- a/WebHosts/WebHost.Chat/WebServer.cs +++ b/WebHosts/WebHost.Chat/WebServer.cs @@ -8,8 +8,16 @@ namespace WebHost.Chat; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } + + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.ClientApi/Accounts/AccountsController.cs b/WebHosts/WebHost.ClientApi/Accounts/AccountsController.cs index 9894fb12..7eb1c925 100644 --- a/WebHosts/WebHost.ClientApi/Accounts/AccountsController.cs +++ b/WebHosts/WebHost.ClientApi/Accounts/AccountsController.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Mvc; -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc; using WebHost.ClientApi.Accounts.Models; using WebHost.ClientApi.Characters.Models; @@ -74,23 +74,26 @@ public object CharacterSlots() [HttpGet] public object CharacterTitles(string characterId) { - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } var characterTitles = new object[] { - new Titles {Id = 117, Name = "Founder" }, - new Titles {Id = 128, Name = "Beta Commando" }, - new Titles {Id = 133, Name = "Beta Vanguard" }, - new Titles {Id = 135, Name = "Commander" }, - new Titles {Id = 136, Name = "Lieutenant" }, - new Titles {Id = 137, Name = "Ensign" }, - new Titles {Id = 144, Name = "Master Blaster" }, - new Titles {Id = 149, Name = "The Gun Show" }, - new Titles {Id = 150, Name = "Arc Runner" }, - new Titles {Id = 152, Name = "Pyromaniac" }, - new Titles {Id = 156, Name = "Barricade" }, - new Titles {Id = 158, Name = "Herald of Decay" }, - new Titles {Id = 171, Name = "Beta Trooper" } + new Titles { Id = 117, Name = "Founder" }, + new Titles { Id = 128, Name = "Beta Commando" }, + new Titles { Id = 133, Name = "Beta Vanguard" }, + new Titles { Id = 135, Name = "Commander" }, + new Titles { Id = 136, Name = "Lieutenant" }, + new Titles { Id = 137, Name = "Ensign" }, + new Titles { Id = 144, Name = "Master Blaster" }, + new Titles { Id = 149, Name = "The Gun Show" }, + new Titles { Id = 150, Name = "Arc Runner" }, + new Titles { Id = 152, Name = "Pyromaniac" }, + new Titles { Id = 156, Name = "Barricade" }, + new Titles { Id = 158, Name = "Herald of Decay" }, + new Titles { Id = 171, Name = "Beta Trooper" } }; return characterTitles; @@ -101,11 +104,14 @@ public object CharacterTitles(string characterId) [Produces("application/json")] public object GarageSlots(string characterId) { - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } _garageSlots = new ConcurrentDictionary(); - var CraftingStation = new GarageSlots + var craftingStation = new GarageSlots { Id = 123987212, Name = "Crafting Station", @@ -122,9 +128,9 @@ public object GarageSlots(string characterId) Unlocked = true, ExpiresInSecs = 0 }; - _garageSlots.AddOrUpdate(CraftingStation.Id, CraftingStation, (k, nc) => nc); + _garageSlots.AddOrUpdate(craftingStation.Id, craftingStation, (k, nc) => nc); - var Firecat = new GarageSlots + var firecat = new GarageSlots { Id = 184534131, Name = "Astrek \"Firecat\"", @@ -144,7 +150,7 @@ public object GarageSlots(string characterId) Unlocked = true, ExpiresInSecs = 0 }; - _garageSlots.AddOrUpdate(Firecat.Id, Firecat, (k, nc) => nc); + _garageSlots.AddOrUpdate(firecat.Id, firecat, (k, nc) => nc); return _garageSlots.Values; } @@ -154,7 +160,10 @@ public object GarageSlots(string characterId) [Produces("application/json")] public object GarageSlotPerks(string characterId, string frameId) { - if (string.IsNullOrEmpty(characterId) || string.IsNullOrEmpty(frameId)) { return new { }; } + if (string.IsNullOrEmpty(characterId) || string.IsNullOrEmpty(frameId)) + { + return new { }; + } var framePerks = new GarageSlotPerks() { diff --git a/WebHosts/WebHost.ClientApi/Armies/ArmiesController.cs b/WebHosts/WebHost.ClientApi/Armies/ArmiesController.cs index 918f5dd7..efa6db41 100644 --- a/WebHosts/WebHost.ClientApi/Armies/ArmiesController.cs +++ b/WebHosts/WebHost.ClientApi/Armies/ArmiesController.cs @@ -48,7 +48,10 @@ public object GetArmies() [HttpGet] public object GetArmy(string armyId) { - if (string.IsNullOrEmpty(armyId)) { return new { }; } + if (string.IsNullOrEmpty(armyId)) + { + return new { }; + } var army = new Army { @@ -94,9 +97,12 @@ public object GetArmy(string armyId) public object GetArmyMembers(string armyId) { // Querystring page=1&per_page=100 - if (string.IsNullOrEmpty(armyId)) { return new { }; } + if (string.IsNullOrEmpty(armyId)) + { + return new { }; + } - var PageResults = new PageResults + var pageResults = new PageResults { Page = 1, TotalCount = 3, @@ -165,14 +171,17 @@ public object GetArmyMembers(string armyId) } }; - return PageResults; + return pageResults; } [Route("api/v3/armies/{armyId}/applications")] [HttpGet] public object GetArmyMemberApplications(string armyId) { - if (string.IsNullOrEmpty(armyId)) { return new { }; } + if (string.IsNullOrEmpty(armyId)) + { + return new { }; + } ArmyApplication[] armyApplications = { @@ -181,7 +190,7 @@ public object GetArmyMemberApplications(string armyId) Id = 15063821, ArmyId = null, CharacterGuid = 2329448601048208126, - Message = "", + Message = string.Empty, Direction = "apply", CreatedAt = null, UpdatedAt = null, @@ -215,7 +224,10 @@ public object GetArmyMemberApplications(string armyId) [HttpGet] public object GetArmyRanks(string armyId) { - if (string.IsNullOrEmpty(armyId)) { return new { }; } + if (string.IsNullOrEmpty(armyId)) + { + return new { }; + } ArmyRank[] armyRanks = { @@ -285,7 +297,10 @@ public object GetArmyRanks(string armyId) [HttpGet] public object GetArmyRankAccess(string armyId, string rankId) { - if (string.IsNullOrEmpty(armyId) || string.IsNullOrEmpty(rankId)) { return new { }; } + if (string.IsNullOrEmpty(armyId) || string.IsNullOrEmpty(rankId)) + { + return new { }; + } var armyRank = new ArmyRank { diff --git a/WebHosts/WebHost.ClientApi/Armies/Models/Army.cs b/WebHosts/WebHost.ClientApi/Armies/Models/Army.cs index 5680f98a..dee2d5c3 100644 --- a/WebHosts/WebHost.ClientApi/Armies/Models/Army.cs +++ b/WebHosts/WebHost.ClientApi/Armies/Models/Army.cs @@ -19,7 +19,7 @@ public class Army public ulong? CommanderGuid { get; set; } public string TagPosition { get; set; } public uint? MinSize { get; set; } - public uint? MaxSize { get; set;} + public uint? MaxSize { get; set; } public bool? Disbanded { get; set; } public string Website { get; set; } public bool? MassEmail { get; set; } diff --git a/WebHosts/WebHost.ClientApi/Characters/CharactersController.cs b/WebHosts/WebHost.ClientApi/Characters/CharactersController.cs index 551d0ae5..40952dcc 100644 --- a/WebHosts/WebHost.ClientApi/Characters/CharactersController.cs +++ b/WebHosts/WebHost.ClientApi/Characters/CharactersController.cs @@ -1,5 +1,5 @@ -using Microsoft.AspNetCore.Mvc; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc; using WebHost.ClientApi.Characters.Models; namespace WebHost.ClientApi.Characters; @@ -26,7 +26,10 @@ public CharactersList GetCharactersList() [Produces("application/json")] public object CharacterData(string characterId) { - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } var data = new CharacterData { @@ -43,7 +46,10 @@ public object CharacterData(string characterId) [Produces("application/json")] public object InventoriesBag(string characterId) { - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } var bag = new InventoriesBag { @@ -105,7 +111,10 @@ public object InventoriesBag(string characterId) [Produces("application/json")] public object InventoriesGearItems(string characterId) { - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } var temp = new object[] { @@ -154,7 +163,11 @@ public object InventoriesGearItems(string characterId) [Produces("application/json")] public object ValidateCharacterName([FromBody] CharacterName characterName) { - if (string.IsNullOrEmpty(characterName.Name) || characterName.Name.Length < 4) return new { valid = false }; + if (string.IsNullOrEmpty(characterName.Name) || characterName.Name.Length < 4) + { + return new { valid = false }; + } + return new { valid = true }; } diff --git a/WebHosts/WebHost.ClientApi/ClientEvent/ClientEventController.cs b/WebHosts/WebHost.ClientApi/ClientEvent/ClientEventController.cs index 8706414b..a6426576 100644 --- a/WebHosts/WebHost.ClientApi/ClientEvent/ClientEventController.cs +++ b/WebHosts/WebHost.ClientApi/ClientEvent/ClientEventController.cs @@ -1,6 +1,6 @@ -using Microsoft.AspNetCore.Mvc; +using System.Text.Json; +using Microsoft.AspNetCore.Mvc; using Serilog; -using System.Text.Json; namespace WebHost.ClientApi.ClientEvent; diff --git a/WebHosts/WebHost.ClientApi/Login/LoginController.cs b/WebHosts/WebHost.ClientApi/Login/LoginController.cs index ffa8af50..1fea7282 100644 --- a/WebHosts/WebHost.ClientApi/Login/LoginController.cs +++ b/WebHosts/WebHost.ClientApi/Login/LoginController.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Mvc; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Net.Http; using System.Text; +using Microsoft.AspNetCore.Mvc; using WebHost.ClientApi.Login.Models; namespace WebHost.ClientApi.Login; @@ -31,7 +31,10 @@ The Pirate Intelligence Network is here to serve you all the content you'd want [HttpGet] public object GetLoginStreak(string characterId) { - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } var loginStreak = new LoginStreak { diff --git a/WebHosts/WebHost.ClientApi/Mail/MailController.cs b/WebHosts/WebHost.ClientApi/Mail/MailController.cs index f874513b..2d8a6440 100644 --- a/WebHosts/WebHost.ClientApi/Mail/MailController.cs +++ b/WebHosts/WebHost.ClientApi/Mail/MailController.cs @@ -13,7 +13,10 @@ public object GetMail(string characterId) /* Querystring page=1 is default * Collect only x email per page */ - if (string.IsNullOrEmpty(characterId)) { return new { }; } + if (string.IsNullOrEmpty(characterId)) + { + return new { }; + } var mail = new Models.Mail { diff --git a/WebHosts/WebHost.ClientApi/Oracle/OracleController.cs b/WebHosts/WebHost.ClientApi/Oracle/OracleController.cs index b9172084..2d480ddb 100644 --- a/WebHosts/WebHost.ClientApi/Oracle/OracleController.cs +++ b/WebHosts/WebHost.ClientApi/Oracle/OracleController.cs @@ -1,5 +1,5 @@ -using Microsoft.AspNetCore.Mvc; -using System; +using System; +using Microsoft.AspNetCore.Mvc; using WebHost.ClientApi.Oracle.Models; namespace WebHost.ClientApi.Oracle; @@ -14,7 +14,8 @@ public OracleTicket GetOracleTicket() return new OracleTicket { MatrixUrl = "localhost:25000", - //Ticket = "UjX52MMObRnEtgZe1pjrRFS6iRz3t7aR69fgLdzwxJQumRt7mhpNqPkejXFT\nBf3H2a5bZI/zQhO4CvKj+Z5Jctk4yMU4mgPzHiN+FJb+CiKvcQGhjNqAskD3\nalZQkZ/N+v1dSC25DLGR0Ky/3V1fsw0Y2bh+xsAgoKg1BkIJHiltTW3spuVT\nUd8fo9oLG0UzhCWP/NNIfcGX+Ur/e7UYxoUCiwHhRH3673Q1TtCoociHwvpj\np4QExjp3Cd2LTolR00l8zYAvodMBPJyOuMf/BB8KDkoP8hnpNh8ZIpmxeWXr\ndZ2R5r8hSAIht3uNMZd/Wa3ewQgqwj/womRSCqhSOpdPFebbgI2TVnth7IA0\nZq4EvvI436cBOc1P1wVfvFW6EUebqCzfIxn63UYQWXc1+KnCjLh9r4l60xm3\n6Yes+7zJwS2r02UslF+QgpUuXJw4I4h7OK+YRrHnOFtiKOUnC3hJMUbY6yZA\nR6/ZdfvBLt9XlA==\n", + + // Ticket = "UjX52MMObRnEtgZe1pjrRFS6iRz3t7aR69fgLdzwxJQumRt7mhpNqPkejXFT\nBf3H2a5bZI/zQhO4CvKj+Z5Jctk4yMU4mgPzHiN+FJb+CiKvcQGhjNqAskD3\nalZQkZ/N+v1dSC25DLGR0Ky/3V1fsw0Y2bh+xsAgoKg1BkIJHiltTW3spuVT\nUd8fo9oLG0UzhCWP/NNIfcGX+Ur/e7UYxoUCiwHhRH3673Q1TtCoociHwvpj\np4QExjp3Cd2LTolR00l8zYAvodMBPJyOuMf/BB8KDkoP8hnpNh8ZIpmxeWXr\ndZ2R5r8hSAIht3uNMZd/Wa3ewQgqwj/womRSCqhSOpdPFebbgI2TVnth7IA0\nZq4EvvI436cBOc1P1wVfvFW6EUebqCzfIxn63UYQWXc1+KnCjLh9r4l60xm3\n6Yes+7zJwS2r02UslF+QgpUuXJw4I4h7OK+YRrHnOFtiKOUnC3hJMUbY6yZA\nR6/ZdfvBLt9XlA==\n", Ticket = "UjX52MMObRnEtgZe1pjrRFS6iRz3t7aR69fgLdzwxJQumRt7mhpNqPkejXFTBf3H2a5bZI/zQhO4CvKj+Z5Jctk4yMU4mgPzHiN+FJb+CiKvcQGhjNqAskD3alZQkZ/N+v1dSC25DLGR0Ky/3V1fsw0Y2bh+xsAgoKg1BkIJHiltTW3spuVTUd8fo9oLG0UzhCWP/NNIfcGX+Ur/e7UYxoUCiwHhRH3673Q1TtCoociHwvpjp4QExjp3Cd2LTolR00l8zYAvodMBPJyOuMf/BB8KDkoP8hnpNh8ZIpmxeWXrdZ2R5r8hSAIht3uNMZd/Wa3ewQgqwj/womRSCqhSOpdPFebbgI2TVnth7IA0Zq4EvvI436cBOc1P1wVfvFW6EUebqCzfIxn63UYQWXc1+KnCjLh9r4l60xm36Yes+7zJwS2r02UslF+QgpUuXJw4I4h7OK+YRrHnOFtiKOUnC3hJMUbY6yZAR6/ZdfvBLt9XlA==", Datacenter = "localhost", OperatorOverride = new OperatorOverride { IngameHost = "https://localhost:44303", ClientapiHost = "https://localhost:44302" }, diff --git a/WebHosts/WebHost.ClientApi/Server/ServerController.cs b/WebHosts/WebHost.ClientApi/Server/ServerController.cs index 986b198a..960cea67 100644 --- a/WebHosts/WebHost.ClientApi/Server/ServerController.cs +++ b/WebHosts/WebHost.ClientApi/Server/ServerController.cs @@ -1,5 +1,5 @@ -using Microsoft.AspNetCore.Mvc; -using System; +using System; +using Microsoft.AspNetCore.Mvc; using WebHost.ClientApi.Server.Models; namespace WebHost.ClientApi.Server; @@ -12,8 +12,8 @@ public class ServerController : ControllerBase [Produces("application/json")] public ServerList GetServerList() { - var ServerList = new ServerList { ZoneList = Array.Empty() }; + var serverList = new ServerList { ZoneList = Array.Empty() }; - return ServerList; + return serverList; } } \ No newline at end of file diff --git a/WebHosts/WebHost.ClientApi/WebServer.cs b/WebHosts/WebHost.ClientApi/WebServer.cs index 29df096d..e7f4274d 100644 --- a/WebHosts/WebHost.ClientApi/WebServer.cs +++ b/WebHosts/WebHost.ClientApi/WebServer.cs @@ -9,12 +9,17 @@ namespace WebHost.ClientApi; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } protected override void ConfigureChildServices(IServiceCollection services) { services.AddScoped(); } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.ClientApi/Zones/Models/Zone.cs b/WebHosts/WebHost.ClientApi/Zones/Models/Zone.cs new file mode 100644 index 00000000..6bc2713c --- /dev/null +++ b/WebHosts/WebHost.ClientApi/Zones/Models/Zone.cs @@ -0,0 +1,31 @@ +namespace WebHost.ClientApi.Zones.Models; + +public static class Zone +{ + public enum GameType + { + INTRO, + CAMPAIGN, + MISSION, + MELDINGFRAGMENT, + RAID + } + + public enum InstancePoolType + { + PVE, + PVP + } + + public enum DifficultyKey + { + NORMAL_MODE, + HARD_MODE + } + + public enum UIString + { + INSTANCE_DIFFICULTY_NORMAL, + INSTANCE_DIFFICULTY_HARD + } +} \ No newline at end of file diff --git a/WebHosts/WebHost.ClientApi/Zones/Models/ZoneSettings.cs b/WebHosts/WebHost.ClientApi/Zones/Models/ZoneSettings.cs index a3eae79e..f56546ba 100644 --- a/WebHosts/WebHost.ClientApi/Zones/Models/ZoneSettings.cs +++ b/WebHosts/WebHost.ClientApi/Zones/Models/ZoneSettings.cs @@ -2,37 +2,7 @@ namespace WebHost.ClientApi.Zones.Models; -static class Zone -{ - public enum GameType - { - INTRO, - CAMPAIGN, - MISSION, - MELDINGFRAGMENT, - RAID - } - - public enum InstancePoolType - { - PVE, - PVP - } - - public enum DifficultyKey - { - NORMAL_MODE, - HARD_MODE - } - - public enum UIString - { - INSTANCE_DIFFICULTY_NORMAL, - INSTANCE_DIFFICULTY_HARD - } -} - -class ZoneSettings +public class ZoneSettings { public uint Id { get; set; } public string Description { get; set; } diff --git a/WebHosts/WebHost.ClientApi/Zones/ZonesController.cs b/WebHosts/WebHost.ClientApi/Zones/ZonesController.cs index b9f2afb8..8fa5fccd 100644 --- a/WebHosts/WebHost.ClientApi/Zones/ZonesController.cs +++ b/WebHosts/WebHost.ClientApi/Zones/ZonesController.cs @@ -1,6 +1,6 @@ -using Microsoft.AspNetCore.Mvc; -using System; +using System; using System.Collections.Concurrent; +using Microsoft.AspNetCore.Mvc; using WebHost.ClientApi.Zones.Models; namespace WebHost.ClientApi.Zones; diff --git a/WebHosts/WebHost.InGameApi/Controllers/CharactersData.cs b/WebHosts/WebHost.InGameApi/Controllers/CharactersData.cs index a46b75e0..a9160d79 100644 --- a/WebHosts/WebHost.InGameApi/Controllers/CharactersData.cs +++ b/WebHosts/WebHost.InGameApi/Controllers/CharactersData.cs @@ -5,23 +5,22 @@ namespace WebHost.InGameApi.Controllers; [ApiController] public class CharactersData { - [Route("character/data")] [Route("api/v1/character/data")] [HttpGet] [Produces("application/json")] public static object Data() { - Data data = new Data() - { - CharacterGuid = 0x99aabbccddee0000 + 448, - Name = "Sleepwalker", - Redbux = 1094, - Crystite = 4104594, - Gender = 0, - UniqueName = "SLEEPWALKER", - Race = 0, - }; + var data = new Data + { + CharacterGuid = 0x99aabbccddee0000 + 448, + Name = "Sleepwalker", + Redbux = 1094, + Crystite = 4104594, + Gender = 0, + UniqueName = "SLEEPWALKER", + Race = 0 + }; return data; } @@ -31,50 +30,55 @@ public static object Data() [Produces("application/json")] public object CharacterSheet() { - CharacterSheet sheet = new CharacterSheet() { - Battleframe = new Battleframe() - { - ItemSdbId = 76332, - Name = "Astrek \"Rhino\"", - WebIcon = "Rhino", - Constraints = new Constraints() { - Mass = new MassPowerCpu() { - Level = new LevelValue() { - Total = 10, - Current = 4 - }, - Value = new LevelValue() { - Total = 1160, - Current = 0 - } - }, - Power = new MassPowerCpu() { - Level = new LevelValue() { - Total = 10, - Current = 4 - }, - Value = new LevelValue() { - Total = 580, - Current = 0 - } - }, - Cpu = new MassPowerCpu() { - Level = new LevelValue() { - Total = 10, - Current = 4 - }, - Value = new LevelValue() { - Total = 12, - Current = 0 - } - } - }, - Xp = new Xp() { - CurrentXp = 477962, - LifetimeXp = 731962 - } - } - }; + var sheet = new CharacterSheet + { + Battleframe = new Battleframe + { + ItemSdbId = 76332, + Name = "Astrek \"Rhino\"", + WebIcon = "Rhino", + Constraints = new Constraints + { + Mass = new MassPowerCpu + { + Level = new LevelValue + { + Total = 10, Current = 4 + }, + Value = new LevelValue + { + Total = 1160, Current = 0 + } + }, + Power = new MassPowerCpu + { + Level = new LevelValue + { + Total = 10, Current = 4 + }, + Value = new LevelValue + { + Total = 580, Current = 0 + } + }, + Cpu = new MassPowerCpu + { + Level = new LevelValue + { + Total = 10, Current = 4 + }, + Value = new LevelValue + { + Total = 12, Current = 0 + } + } + }, + Xp = new Xp + { + CurrentXp = 477962, LifetimeXp = 731962 + } + } + }; return sheet; } @@ -84,64 +88,53 @@ public object CharacterSheet() [Produces("application/json")] public object EquippedItems() { - Equipped equipped = new Equipped() - { - Primary = new Item { - ItemId = "", - DefaultItemSdbId = 78324, - IsUnlocked = true - }, - Secondary = new Item { - ItemId = "", - DefaultItemSdbId = 78043, - IsUnlocked = true - }, - Ability1 = new Item { - ItemId = "", - DefaultItemSdbId = 78326, - IsUnlocked = true - }, - Ability2 = new Item { - ItemId = "", - DefaultItemSdbId = 78328, - IsUnlocked = true - }, - Ability3 = new Item { - ItemId = "", - DefaultItemSdbId = 78330, - IsUnlocked = true - }, - Hkm = new Item { - ItemId = "9186949129711219709", - DefaultItemSdbId = 0, - IsUnlocked = true - }, - Passive = new Item { - ItemId = "9190664271895347709", - DefaultItemSdbId = 78334, - IsUnlocked = true - }, - Jumpjets = new Item { - ItemId = "", - DefaultItemSdbId = 78070, - IsUnlocked = true - }, - Servos = new Item { - ItemId = "", - DefaultItemSdbId = 78068, - IsUnlocked = true - }, - Backpack = new Item { - ItemId = "", - DefaultItemSdbId = 76018, - IsUnlocked = true - }, - Plating = new Item { - ItemId = "", - DefaultItemSdbId = 85203, - IsUnlocked = true - } - }; + var equipped = new Equipped + { + Primary = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78324, IsUnlocked = true + }, + Secondary = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78043, IsUnlocked = true + }, + Ability1 = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78326, IsUnlocked = true + }, + Ability2 = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78328, IsUnlocked = true + }, + Ability3 = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78330, IsUnlocked = true + }, + Hkm = new Item + { + ItemId = "9186949129711219709", DefaultItemSdbId = 0, IsUnlocked = true + }, + Passive = new Item + { + ItemId = "9190664271895347709", DefaultItemSdbId = 78334, IsUnlocked = true + }, + Jumpjets = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78070, IsUnlocked = true + }, + Servos = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 78068, IsUnlocked = true + }, + Backpack = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 76018, IsUnlocked = true + }, + Plating = new Item + { + ItemId = string.Empty, DefaultItemSdbId = 85203, IsUnlocked = true + } + }; return equipped; } diff --git a/WebHosts/WebHost.InGameApi/Controllers/LoginAlertsController.cs b/WebHosts/WebHost.InGameApi/Controllers/LoginAlertsController.cs index 20006e37..decc80be 100644 --- a/WebHosts/WebHost.InGameApi/Controllers/LoginAlertsController.cs +++ b/WebHosts/WebHost.InGameApi/Controllers/LoginAlertsController.cs @@ -1,6 +1,6 @@ -using Microsoft.AspNetCore.Mvc; -using System.Net.Http; +using System.Net.Http; using System.Text; +using Microsoft.AspNetCore.Mvc; namespace WebHost.InGameApi.Controllers; @@ -27,7 +27,8 @@ public HttpResponseMessage GetLoginAlerts() -", Encoding.UTF8, "text/html") +", Encoding.UTF8, + "text/html") }; } } \ No newline at end of file diff --git a/WebHosts/WebHost.InGameApi/Controllers/PanelManagerController.cs b/WebHosts/WebHost.InGameApi/Controllers/PanelManagerController.cs index 606d7aa1..43aa8afc 100644 --- a/WebHosts/WebHost.InGameApi/Controllers/PanelManagerController.cs +++ b/WebHosts/WebHost.InGameApi/Controllers/PanelManagerController.cs @@ -1,6 +1,6 @@ -using Microsoft.AspNetCore.Mvc; -using System.Net.Http; +using System.Net.Http; using System.Text; +using Microsoft.AspNetCore.Mvc; namespace WebHost.InGameApi.Controllers; @@ -27,7 +27,8 @@ public HttpResponseMessage GetPanelManager() Hello World -", Encoding.UTF8, "text/html") +", Encoding.UTF8, + "text/html") }; } } \ No newline at end of file diff --git a/WebHosts/WebHost.InGameApi/Controllers/SocialDataController.cs b/WebHosts/WebHost.InGameApi/Controllers/SocialDataController.cs index 3c1540e3..9f18781f 100644 --- a/WebHosts/WebHost.InGameApi/Controllers/SocialDataController.cs +++ b/WebHosts/WebHost.InGameApi/Controllers/SocialDataController.cs @@ -1,5 +1,5 @@ -using Microsoft.AspNetCore.Mvc; -using System; +using System; +using Microsoft.AspNetCore.Mvc; namespace WebHost.InGameApi.Controllers; @@ -12,23 +12,28 @@ public class SocialDataController : ControllerBase [Produces("application/json")] public object StaticData() { - StaticData zones = new StaticData() { + StaticData zones = new StaticData() + { Zones = new object[] { new Zone { ZoneId = 12, Title = "Nothing" }, new Zone { ZoneId = 162, Title = "Diamond Head" }, + // new Zone { ZoneId = 204, Title = "REMOVED: Sargasso Sea" }, new Zone { ZoneId = 448, Title = "New Eden" }, new Zone { ZoneId = 803, Title = "M15_Mission_15_Agrievan" }, new Zone { ZoneId = 805, Title = "Epicenter Melding Tornado Pocket" }, new Zone { ZoneId = 833, Title = "M20EMission_20_Razors_Edge" }, + // new Zone { ZoneId = 843, Title = "REMOVED: Antarctica" }, new Zone { ZoneId = 844, Title = "Omnidyne-M Prototype Stadium" }, + // new Zone { ZoneId = 861, Title = "REMOVED: Research Station" }, // new Zone { ZoneId = 863, Title = "REMOVED: Cliff's Edge" }, new Zone { ZoneId = 864, Title = "M16EMission_16_Unearthed" }, new Zone { ZoneId = 865, Title = "Abyss - Melding Tornado Pocket" }, new Zone { ZoneId = 868, Title = "Cinerarium" }, + // new Zone { ZoneId = 878, Title = "REMOVED: Copacabana" }, new Zone { ZoneId = 1003, Title = "M03EMission_03_Crash_Down" }, new Zone { ZoneId = 1007, Title = "M18EMission_18_Vagrant_Dawn" }, diff --git a/WebHosts/WebHost.InGameApi/WebServer.cs b/WebHosts/WebHost.InGameApi/WebServer.cs index 0bfe0044..6bff1f5b 100644 --- a/WebHosts/WebHost.InGameApi/WebServer.cs +++ b/WebHosts/WebHost.InGameApi/WebServer.cs @@ -8,8 +8,16 @@ namespace WebHost.InGameApi; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } + + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.Market/Controllers/MarketController.cs b/WebHosts/WebHost.Market/Controllers/MarketController.cs index 76076cf3..e69dca2b 100644 --- a/WebHosts/WebHost.Market/Controllers/MarketController.cs +++ b/WebHosts/WebHost.Market/Controllers/MarketController.cs @@ -1,9 +1,9 @@ -using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.Text.Json; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Shared.Common; using Shared.Web; -using System.Collections.Generic; -using System.Text.Json; using WebHost.Market.Models; namespace WebHost.Market.Controllers; diff --git a/WebHosts/WebHost.Market/WebServer.cs b/WebHosts/WebHost.Market/WebServer.cs index 9dceb006..b048e048 100644 --- a/WebHosts/WebHost.Market/WebServer.cs +++ b/WebHosts/WebHost.Market/WebServer.cs @@ -8,8 +8,16 @@ namespace WebHost.Market; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } + + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.OperatorApi/Controllers/CapabilityController.cs b/WebHosts/WebHost.OperatorApi/Controllers/CapabilityController.cs index 9227ea42..40fc1742 100644 --- a/WebHosts/WebHost.OperatorApi/Controllers/CapabilityController.cs +++ b/WebHosts/WebHost.OperatorApi/Controllers/CapabilityController.cs @@ -1,6 +1,6 @@ -using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using System.Threading.Tasks; using WebHost.OperatorApi.Capability; namespace WebHost.OperatorApi.Controllers; diff --git a/WebHosts/WebHost.OperatorApi/WebServer.cs b/WebHosts/WebHost.OperatorApi/WebServer.cs index 31225e0d..15cbda1b 100644 --- a/WebHosts/WebHost.OperatorApi/WebServer.cs +++ b/WebHosts/WebHost.OperatorApi/WebServer.cs @@ -9,12 +9,17 @@ namespace WebHost.OperatorApi; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } protected override void ConfigureChildServices(IServiceCollection services) { services.AddScoped(); } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.Replay/WebServer.cs b/WebHosts/WebHost.Replay/WebServer.cs index 5b1e703c..18502525 100644 --- a/WebHosts/WebHost.Replay/WebServer.cs +++ b/WebHosts/WebHost.Replay/WebServer.cs @@ -8,8 +8,16 @@ namespace WebHost.Replay; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } + + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.Store/WebServer.cs b/WebHosts/WebHost.Store/WebServer.cs index 2fcfeb16..26170e76 100644 --- a/WebHosts/WebHost.Store/WebServer.cs +++ b/WebHosts/WebHost.Store/WebServer.cs @@ -8,8 +8,16 @@ namespace WebHost.Store; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } - protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } + + protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) + { + } } \ No newline at end of file diff --git a/WebHosts/WebHost.WebAsset/WebServer.cs b/WebHosts/WebHost.WebAsset/WebServer.cs index 35e3c2c7..d9dc0b1e 100644 --- a/WebHosts/WebHost.WebAsset/WebServer.cs +++ b/WebHosts/WebHost.WebAsset/WebServer.cs @@ -1,21 +1,29 @@ -using Microsoft.AspNetCore.Builder; +using System.IO; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Shared.Web; -using System.IO; namespace WebHost.WebAsset; public class WebServer : BaseWebServer { - public WebServer(IConfiguration configuration) : base(configuration) { } + public WebServer(IConfiguration configuration) + : base(configuration) + { + } - protected override void ConfigureChildServices(IServiceCollection services) { } + protected override void ConfigureChildServices(IServiceCollection services) + { + } protected override void ConfigureChild(IApplicationBuilder app, IWebHostEnvironment env) { - app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Assets")), RequestPath = string.Empty }); + app.UseStaticFiles(new StaticFileOptions + { + FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Assets")), RequestPath = string.Empty + }); } } \ No newline at end of file diff --git a/WebHosts/WebHostManager/Program.cs b/WebHosts/WebHostManager/Program.cs index 7baa01e8..d953e3c3 100644 --- a/WebHosts/WebHostManager/Program.cs +++ b/WebHosts/WebHostManager/Program.cs @@ -1,13 +1,13 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Serilog; -using Shared.Web; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Serilog; +using Shared.Web; using WebHost.Chat; namespace WebHostManager; @@ -36,7 +36,7 @@ private static void Main(string[] args) try { Log.Information("Starting Web Hosts"); - var ct = new CancellationToken(); + var ct = CancellationToken.None; var hostsTasks = StartHosts(ct); diff --git a/stylecop.ruleset b/stylecop.ruleset new file mode 100644 index 00000000..ed4c9db7 --- /dev/null +++ b/stylecop.ruleset @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file