diff --git a/Benchmarks/ClonerBenchmarks.cs b/Benchmarks/ClonerBenchmarks.cs index 8997b529..fc2f8d03 100644 --- a/Benchmarks/ClonerBenchmarks.cs +++ b/Benchmarks/ClonerBenchmarks.cs @@ -10,11 +10,11 @@ namespace Benchmarks; [MemoryDiagnoser] public class ClonerBenchmarks { - private Templates? _templates; + private ICloner _fastCloner; private ICloner _jsonCloner; private ICloner _reflectionsCloner; - private ICloner _fastCloner; + private Templates? _templates; [GlobalSetup] public void Setup() diff --git a/Libraries/SPTarkov.Common/Extensions/HttpContextExtensions.cs b/Libraries/SPTarkov.Common/Extensions/HttpContextExtensions.cs index e24023a4..26c03736 100644 --- a/Libraries/SPTarkov.Common/Extensions/HttpContextExtensions.cs +++ b/Libraries/SPTarkov.Common/Extensions/HttpContextExtensions.cs @@ -1,18 +1,17 @@ using Microsoft.Extensions.Primitives; -namespace SPTarkov.Common.Extensions -{ - public static class HttpContextExtensions - { - public static StringValues? GetHeaderIfExists(this HttpContext context, string key) - { - context.Request.Headers.TryGetValue(key, out var value); - if (string.IsNullOrEmpty(value)) - { - return null; - } +namespace SPTarkov.Common.Extensions; - return value; +public static class HttpContextExtensions +{ + public static StringValues? GetHeaderIfExists(this HttpContext context, string key) + { + context.Request.Headers.TryGetValue(key, out var value); + if (string.IsNullOrEmpty(value)) + { + return null; } + + return value; } } diff --git a/Libraries/SPTarkov.DI/DependencyInjectionRegistrator.cs b/Libraries/SPTarkov.DI/DependencyInjectionRegistrator.cs index 8014709f..50cc8223 100644 --- a/Libraries/SPTarkov.DI/DependencyInjectionRegistrator.cs +++ b/Libraries/SPTarkov.DI/DependencyInjectionRegistrator.cs @@ -20,8 +20,7 @@ public static class DependencyInjectionRegistrator public static void RegisterComponents(IServiceCollection builderServices, IEnumerable types) { - var groupedTypes = types.SelectMany( - t => + var groupedTypes = types.SelectMany(t => { var attributes = (Injectable[]) Attribute.GetCustomAttributes(t, typeof(Injectable)); var registerableType = t; @@ -74,21 +73,20 @@ public static class DependencyInjectionRegistrator { _allLoadedTypes ??= AppDomain.CurrentDomain.GetAssemblies().SelectMany(t => t.GetTypes()).ToList(); } - catch(ReflectionTypeLoadException ex) + catch (ReflectionTypeLoadException ex) { Console.WriteLine($"COULD NOT LOAD TYPE: {ex}"); } + _allConstructors ??= _allLoadedTypes.SelectMany(t => t.GetConstructors()).ToList(); var typeName = $"{valueTuple.RegistrableInterface.Namespace}.{valueTuple.RegistrableInterface.Name}"; try { - var matchedConstructors = _allConstructors.Where( - c => c.GetParameters() - .Any( - p => p.ParameterType.IsGenericType && - p.ParameterType.GetGenericTypeDefinition().FullName == typeName - ) + var matchedConstructors = _allConstructors.Where(c => c.GetParameters() + .Any(p => p.ParameterType.IsGenericType && + p.ParameterType.GetGenericTypeDefinition().FullName == typeName + ) ); var constructorInfos = matchedConstructors.ToList(); @@ -100,7 +98,7 @@ public static class DependencyInjectionRegistrator foreach (var matchedConstructor in constructorInfos) { var constructorParams = matchedConstructor.GetParameters(); - foreach (var parameterInfo in constructorParams.Where(x => IsMatchingGenericType(x,typeName))) + foreach (var parameterInfo in constructorParams.Where(x => IsMatchingGenericType(x, typeName))) { var parameters = parameterInfo.ParameterType.GetGenericArguments(); var typedGeneric = valueTuple.TypeToRegister.MakeGenericType(parameters); diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/AchievementCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/AchievementCallbacks.cs index c7c8ef6a..d2a5c0c9 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/AchievementCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/AchievementCallbacks.cs @@ -1,7 +1,7 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/BotCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/BotCallbacks.cs index 64986901..c1b9f320 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/BotCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/BotCallbacks.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Bot; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Match; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/BuildsCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/BuildsCallbacks.cs index 7dbdc2a5..4afbd207 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/BuildsCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/BuildsCallbacks.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Builds; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.PresetBuild; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/BundleCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/BundleCallbacks.cs index 7267041f..2bc76b8a 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/BundleCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/BundleCallbacks.cs @@ -1,7 +1,7 @@ -using SPTarkov.Server.Core.Loaders; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Loaders; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; @@ -20,7 +20,7 @@ public class BundleCallbacks( } /// - /// TODO: what does it do + /// TODO: what does it do /// /// public string GetBundle(string url, object info, string sessionID) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/ClientLogCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/ClientLogCallbacks.cs index 46f3ee8e..6f64fd6a 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/ClientLogCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/ClientLogCallbacks.cs @@ -1,12 +1,11 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; +using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Logging; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Server; -using SPTarkov.Common.Annotations; -using SPTarkov.Server.Core.Models.Enums; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/CustomizationCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/CustomizationCallbacks.cs index 5c292781..9f259e10 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/CustomizationCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/CustomizationCallbacks.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Customization; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/DataCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/DataCallbacks.cs index 8f740905..1e4d8b81 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/DataCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/DataCallbacks.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs index 32803afc..5d0f3c44 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs @@ -1,11 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Request; -using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; @@ -73,7 +72,7 @@ public class DialogueCallbacks( /// /// Handle client/mail/dialog/list - /// TODO: request properties are not handled + /// TODO: request properties are not handled /// /// public virtual string GetMailDialogList(string url, GetMailDialogListRequestData request, string sessionID) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs index 6ba4c722..d10ad6fe 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs @@ -1,11 +1,11 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Game; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs index 82b61216..c0f4face 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HealthCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HealthCallbacks.cs index 4c89c838..69f69843 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HealthCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HealthCallbacks.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Health; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs index b19145f3..570ec990 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Hideout; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; @@ -172,7 +172,7 @@ public class HideoutCallbacks( } /// - /// Handle client/game/profile/items/moving - hideoutCustomizationSetMannequinPose + /// Handle client/game/profile/items/moving - hideoutCustomizationSetMannequinPose /// /// public ItemEventRouterResponse HideoutCustomizationSetMannequinPose(PmcData pmcData, HideoutCustomizationSetMannequinPoseRequest request, string sessionId) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs index 14298ee8..1aabb187 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/InraidCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/InraidCallbacks.cs index 3a94eb62..aacc7409 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/InraidCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/InraidCallbacks.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.InRaid; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs index 05834796..84db677d 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs @@ -1,4 +1,5 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Insurance; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs index 5cd0380e..5ceef18f 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/InventoryCallbacks.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Inventory; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Quests; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; @@ -274,7 +274,7 @@ public class InventoryCallbacks( } /// - /// Handle game/profile/items/moving SetFavoriteItems + /// Handle game/profile/items/moving SetFavoriteItems /// /// Players PMC profile /// diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/ItemEventCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/ItemEventCallbacks.cs index 128faf68..ce25c4f4 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/ItemEventCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/ItemEventCallbacks.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/LauncherCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/LauncherCallbacks.cs index 9f7a2483..f0273042 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/LauncherCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/LauncherCallbacks.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/LauncherV2Callbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/LauncherV2Callbacks.cs index 0ea47b69..a1343b1a 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/LauncherV2Callbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/LauncherV2Callbacks.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Models.Spt.Launcher; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/LocationCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/LocationCallbacks.cs index c943b68a..18d953cd 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/LocationCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/LocationCallbacks.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Location; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/MatchCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/MatchCallbacks.cs index b7efc3bd..1066b30b 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/MatchCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/MatchCallbacks.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Match; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using static SPTarkov.Server.Core.Services.MatchLocationService; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/NoteCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/NoteCallbacks.cs index 84faa854..58f93495 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/NoteCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/NoteCallbacks.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Notes; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/NotifierCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/NotifierCallbacks.cs index 86d8b2af..53f5e53b 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/NotifierCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/NotifierCallbacks.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Notifier; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; @@ -17,12 +17,11 @@ public class NotifierCallbacks( HttpServerHelper httpServerHelper ) { - /// - /// If we don't have anything to send, it's ok to not send anything back - /// because notification requests can be long-polling. In fact, we SHOULD wait - /// until we actually have something to send because otherwise we'd spam the client - /// and the client would abort the connection due to spam. + /// If we don't have anything to send, it's ok to not send anything back + /// because notification requests can be long-polling. In fact, we SHOULD wait + /// until we actually have something to send because otherwise we'd spam the client + /// and the client would abort the connection due to spam. /// public void SendNotification(string sessionID, HttpRequest req, HttpResponse resp, object data) { @@ -40,12 +39,11 @@ public class NotifierCallbacks( /// - /// TODO: removed from client? - /// Handle push/notifier/get - /// Handle push/notifier/getwebsocket + /// TODO: removed from client? + /// Handle push/notifier/get + /// Handle push/notifier/getwebsocket /// /// - public string GetNotifier(string url, IRequestData info, string sessionID) { return _httpResponseUtil.EmptyArrayResponse(); diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs index 645aefd4..1768a34f 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/PrestigeCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/PrestigeCallbacks.cs index 150758e9..cbc9ac9e 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/PrestigeCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/PrestigeCallbacks.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Prestige; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/ProfileCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/ProfileCallbacks.cs index 053c436a..e0a831ed 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/ProfileCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/ProfileCallbacks.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; @@ -18,7 +18,7 @@ public class ProfileCallbacks( ) { /// - /// Handle client/game/profile/create + /// Handle client/game/profile/create /// /// public string CreateProfile(string url, ProfileCreateRequestData info, string sessionID) @@ -33,8 +33,8 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/list - /// Get the complete player profile (scav + pmc character) + /// Handle client/game/profile/list + /// Get the complete player profile (scav + pmc character) /// /// public string GetProfileData(string url, EmptyRequestData _, string sessionID) @@ -43,9 +43,9 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/savage/regenerate - /// Handle the creation of a scav profile for player - /// Occurs post-raid and when profile first created immediately after character details are confirmed by player + /// Handle client/game/profile/savage/regenerate + /// Handle the creation of a scav profile for player + /// Occurs post-raid and when profile first created immediately after character details are confirmed by player /// /// public string RegenerateScav(string url, EmptyRequestData _, string sessionID) @@ -59,7 +59,7 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/voice/change event + /// Handle client/game/profile/voice/change event /// /// public string ChangeVoice(string url, ProfileChangeVoiceRequestData info, string sessionID) @@ -69,8 +69,8 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/nickname/change event - /// Client allows player to adjust their profile name + /// Handle client/game/profile/nickname/change event + /// Client allows player to adjust their profile name /// /// public string ChangeNickname(string url, ProfileChangeNicknameRequestData info, string sessionID) @@ -92,7 +92,7 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/nickname/validate + /// Handle client/game/profile/nickname/validate /// /// public string ValidateNickname(string url, ValidateNicknameRequestData info, string sessionID) @@ -113,7 +113,7 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/nickname/reserved + /// Handle client/game/profile/nickname/reserved /// /// public string GetReservedNickname(string url, EmptyRequestData _, string sessionID) @@ -128,8 +128,8 @@ public class ProfileCallbacks( } /// - /// Handle client/profile/status - /// Called when creating a character when choosing a character face/voice + /// Handle client/profile/status + /// Called when creating a character when choosing a character face/voice /// /// public string GetProfileStatus(string url, EmptyRequestData _, string sessionID) @@ -138,8 +138,8 @@ public class ProfileCallbacks( } /// - /// Handle client/profile/view - /// Called when viewing another players profile + /// Handle client/profile/view + /// Called when viewing another players profile /// /// public string GetOtherProfile(string url, GetOtherProfileRequest request, string sessionID) @@ -148,7 +148,7 @@ public class ProfileCallbacks( } /// - /// Handle client/profile/settings + /// Handle client/profile/settings /// /// public string GetProfileSettings(string url, GetProfileSettingsRequest info, string sessionID) @@ -157,7 +157,7 @@ public class ProfileCallbacks( } /// - /// Handle client/game/profile/search + /// Handle client/game/profile/search /// /// public string SearchProfiles(string url, SearchProfilesRequestData info, string sessionID) @@ -166,7 +166,7 @@ public class ProfileCallbacks( } /// - /// Handle launcher/profile/info + /// Handle launcher/profile/info /// /// public string GetMiniProfile(string url, GetMiniProfileRequestData info, string sessionID) @@ -175,7 +175,7 @@ public class ProfileCallbacks( } /// - /// Handle /launcher/profiles + /// Handle /launcher/profiles /// /// public string GetAllMiniProfiles(string url, EmptyRequestData _, string sessionID) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/QuestCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/QuestCallbacks.cs index d2dfa1a8..ca0d7fcd 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/QuestCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/QuestCallbacks.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Quests; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs index ec616cb7..6135a72e 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/RepairCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/RepairCallbacks.cs index 7d971104..387e6480 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/RepairCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/RepairCallbacks.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Repair; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs index fd0f951f..5d077929 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/TradeCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/TradeCallbacks.cs index de2b1a5e..cff28c25 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/TradeCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/TradeCallbacks.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Trade; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs index bcff7eb8..7e1b9ee8 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs @@ -1,10 +1,10 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/WeatherCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/WeatherCallbacks.cs index 8bd3a1d8..b57d5fee 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/WeatherCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/WeatherCallbacks.cs @@ -1,7 +1,7 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/WishlistCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/WishlistCallbacks.cs index 3a4f7bce..3caf10bb 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/WishlistCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/WishlistCallbacks.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Wishlist; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Callbacks; diff --git a/Libraries/SPTarkov.Server.Core/Context/ApplicationContext.cs b/Libraries/SPTarkov.Server.Core/Context/ApplicationContext.cs index c2baefab..822954ab 100644 --- a/Libraries/SPTarkov.Server.Core/Context/ApplicationContext.cs +++ b/Libraries/SPTarkov.Server.Core/Context/ApplicationContext.cs @@ -8,14 +8,14 @@ namespace SPTarkov.Server.Core.Context; public class ApplicationContext { protected const short MaxSavedValues = 10; - protected readonly ConcurrentDictionary> variables = new(); private static ApplicationContext? _applicationContext; private readonly ISptLogger _logger; + protected readonly ConcurrentDictionary> variables = new(); /// - /// When ApplicationContext gets created by the DI container we store the singleton reference so we can provide it - /// statically for harmony patches! + /// When ApplicationContext gets created by the DI container we store the singleton reference so we can provide it + /// statically for harmony patches! /// public ApplicationContext ( diff --git a/Libraries/SPTarkov.Server.Core/Controllers/AchievementController.cs b/Libraries/SPTarkov.Server.Core/Controllers/AchievementController.cs index 5b4fae73..a61d2221 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/AchievementController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/AchievementController.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -17,7 +17,7 @@ public class AchievementController( protected CoreConfig coreConfig = configServer.GetConfig(); /// - /// Get base achievements + /// Get base achievements /// /// Session/player id /// @@ -30,7 +30,7 @@ public class AchievementController( } /// - /// Shows % of 'other' players who've completed each achievement + /// Shows % of 'other' players who've completed each achievement /// /// Session/Player id /// CompletedAchievementsResponse @@ -40,9 +40,11 @@ public class AchievementController( var profiles = profileHelper.GetProfiles(); var achievements = databaseService.GetAchievements(); - foreach (var achievementId in achievements.Select(achievement => achievement.Id).Where(achievementId => !string.IsNullOrEmpty(achievementId))) { + foreach (var achievementId in achievements.Select(achievement => achievement.Id).Where(achievementId => !string.IsNullOrEmpty(achievementId))) + { var percentage = 0; - foreach (var (profileId, profile) in profiles) { + foreach (var (profileId, profile) in profiles) + { if (coreConfig.Features.AchievementProfileIdBlacklist.Contains(profileId)) { continue; @@ -61,10 +63,13 @@ public class AchievementController( percentage++; } - percentage = (percentage / profiles.Count) * 100; + percentage = percentage / profiles.Count * 100; stats.Add(achievementId, percentage); } - return new CompletedAchievementsResponse{ Elements = stats }; + return new CompletedAchievementsResponse + { + Elements = stats + }; } } diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs index 52750ff2..7525b2a7 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; @@ -15,7 +16,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Controllers; @@ -41,13 +41,12 @@ public class BotController( private readonly PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// Return the number of bot load-out varieties to be generated + /// Return the number of bot load-out varieties to be generated /// /// bot Type we want the load-out gen count for /// number of bots to generate public int GetBotPresetGenerationLimit(string type) { - if (!_botConfig.PresetBatch.TryGetValue(type, out var limit)) { _logger.Warning(_localisationService.GetText("bot-bot_preset_count_value_missing", type)); @@ -56,12 +55,11 @@ public class BotController( } return limit; - } /// - /// Handle singleplayer/settings/bot/difficulty - /// Get the core.json difficulty settings from database/bots + /// Handle singleplayer/settings/bot/difficulty + /// Get the core.json difficulty settings from database/bots /// /// public Dictionary GetBotCoreDifficulty() @@ -70,8 +68,8 @@ public class BotController( } /// - /// Get bot difficulty settings - /// Adjust PMC settings to ensure they engage the correct bot types + /// Get bot difficulty settings + /// Adjust PMC settings to ensure they engage the correct bot types /// /// what bot the server is requesting settings for /// difficulty level server requested settings for @@ -100,7 +98,7 @@ public class BotController( } /// - /// Handle singleplayer/settings/bot/difficulties + /// Handle singleplayer/settings/bot/difficulties /// /// public Dictionary> GetAllBotDifficulties() @@ -160,7 +158,7 @@ public class BotController( } /// - /// Generate bots for a wave + /// Generate bots for a wave /// /// Session/Player id /// @@ -173,7 +171,7 @@ public class BotController( } /// - /// Generate bots for passed in wave data + /// Generate bots for passed in wave data /// /// /// Player generating bots @@ -193,17 +191,18 @@ public class BotController( Task.WaitAll((request.Conditions ?? []) .Select(condition => Task.Factory.StartNew(() => - { - var botWaveGenerationDetails = GetBotGenerationDetailsForWave( - condition, - pmcProfile, - allPmcsHaveSameNameAsPlayer, - raidSettings, - Math.Max(GetBotPresetGenerationLimit(condition.Role), condition.Limit), // Choose largest between value passed in from request vs what's in bot.config - _botHelper.IsBotPmc(condition.Role)); + { + var botWaveGenerationDetails = GetBotGenerationDetailsForWave( + condition, + pmcProfile, + allPmcsHaveSameNameAsPlayer, + raidSettings, + Math.Max(GetBotPresetGenerationLimit(condition.Role), + condition.Limit), // Choose largest between value passed in from request vs what's in bot.config + _botHelper.IsBotPmc(condition.Role)); - result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); - })).ToArray()); + result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); + })).ToArray()); stopwatch.Stop(); if (_logger.IsLogEnabled(LogLevel.Debug)) @@ -215,7 +214,7 @@ public class BotController( } /// - /// Generate bots for a single wave request + /// Generate bots for a single wave request /// /// /// @@ -276,7 +275,7 @@ public class BotController( } /// - /// Pull raid settings from Application context + /// Pull raid settings from Application context /// /// GetRaidConfigurationRequestData if it exists protected GetRaidConfigurationRequestData? GetMostRecentRaidSettings() @@ -294,7 +293,7 @@ public class BotController( } /// - /// Get min/max level range values for a specific map + /// Get min/max level range values for a specific map /// /// Map name e.g. factory4_day /// MinMax values @@ -304,7 +303,7 @@ public class BotController( } /// - /// Create a BotGenerationDetails for the bot generator to use + /// Create a BotGenerationDetails for the bot generator to use /// /// Data from client defining bot type and difficulty /// Player who is generating bots @@ -339,8 +338,8 @@ public class BotController( } /// - /// Get the max number of bots allowed on a map - /// Looks up location player is entering when getting cap value + /// Get the max number of bots allowed on a map + /// Looks up location player is entering when getting cap value /// /// The map location cap was requested for /// bot cap for map @@ -350,6 +349,7 @@ public class BotController( { return _botConfig.MaxBotCap["default"]; } + if (location == "default") { _logger.Warning( @@ -361,7 +361,7 @@ public class BotController( } /// - /// Get weights for what each bot type should use as a brain - used by client + /// Get weights for what each bot type should use as a brain - used by client /// /// public AiBotBrainTypes GetAiBotBrainTypes() diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BuildController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BuildController.cs index 8fdf6b19..8fc8a939 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BuildController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BuildController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Builds; using SPTarkov.Server.Core.Models.Eft.PresetBuild; @@ -9,7 +10,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -51,8 +51,7 @@ public class BuildController( .ToList(); // Get players secure container - var playerSecureContainer = profile?.CharacterData?.PmcData?.Inventory?.Items?.FirstOrDefault( - x => x.SlotId == secureContainerSlotId + var playerSecureContainer = profile?.CharacterData?.PmcData?.Inventory?.Items?.FirstOrDefault(x => x.SlotId == secureContainerSlotId ); var firstDefaultItemsSecureContainer = defaultEquipmentPresetsClone? @@ -149,8 +148,7 @@ public class BuildController( Items = request.Items }; - var existingBuild = existingSavedEquipmentBuilds?.FirstOrDefault( - build => build.Name == request.Name || build.Id == request.Id + var existingBuild = existingSavedEquipmentBuilds?.FirstOrDefault(build => build.Name == request.Name || build.Id == request.Id ); if (existingBuild is not null) { @@ -211,8 +209,8 @@ public class BuildController( } /// - /// Handle client/builds/delete - /// Remove build from players profile + /// Handle client/builds/delete + /// Remove build from players profile /// /// /// Session/Player id diff --git a/Libraries/SPTarkov.Server.Core/Controllers/ClientLogController.cs b/Libraries/SPTarkov.Server.Core/Controllers/ClientLogController.cs index 400e90a9..ca1542ec 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/ClientLogController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/ClientLogController.cs @@ -1,7 +1,7 @@ -using SPTarkov.Server.Core.Models.Spt.Logging; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Logging; +using SPTarkov.Server.Core.Models.Spt.Logging; +using SPTarkov.Server.Core.Models.Utils; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Controllers; @@ -35,7 +35,7 @@ public class ClientLogController( _logger.Info(message); break; case LogLevel.Custom: - _logger.LogWithColor(message, color, backgroundColor, null); + _logger.LogWithColor(message, color, backgroundColor); break; case LogLevel.Debug: _logger.Debug(message); diff --git a/Libraries/SPTarkov.Server.Core/Controllers/CustomizationController.cs b/Libraries/SPTarkov.Server.Core/Controllers/CustomizationController.cs index 586cd55b..167dcce5 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/CustomizationController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/CustomizationController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -12,7 +13,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -44,11 +44,10 @@ public class CustomizationController( var suits = _databaseService.GetTrader(traderId).Suits; var matchingSuits = suits?.Where(s => clothing.ContainsKey(s.SuiteId!)).ToList(); - matchingSuits = matchingSuits?.Where( - s => clothing[s.SuiteId ?? string.Empty] - ?.Properties?.Side? - .Contains(pmcData?.Info?.Side ?? string.Empty) ?? - false + matchingSuits = matchingSuits?.Where(s => clothing[s.SuiteId ?? string.Empty] + ?.Properties?.Side? + .Contains(pmcData?.Info?.Side ?? string.Empty) ?? + false ) .ToList(); @@ -121,7 +120,7 @@ public class CustomizationController( } /// - /// Has an outfit been purchased by a player + /// Has an outfit been purchased by a player /// /// clothing id /// Session id of profile to check for clothing in @@ -135,7 +134,7 @@ public class CustomizationController( } /// - /// Get clothing offer from trader by suit id + /// Get clothing offer from trader by suit id /// /// Session/Player id /// @@ -192,7 +191,7 @@ public class CustomizationController( } /// - /// Get all suits from Traders + /// Get all suits from Traders /// /// Session/Player id /// diff --git a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs index fd84db35..cce5aec9 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Helpers.Dialogue; using SPTarkov.Server.Core.Models.Eft.Dialog; @@ -9,7 +10,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -340,7 +340,7 @@ public class DialogueController( } /// - /// Get messages from a specific dialog that have items not expired + /// Get messages from a specific dialog that have items not expired /// /// Session/Player id /// Dialog to get mail attachments from @@ -503,9 +503,8 @@ public class DialogueController( { _mailSendService.SendPlayerMessageToNpc(sessionId, request.DialogId!, request.Text!); - return (_dialogueChatBots.FirstOrDefault( - cb => - cb.GetChatBot().Id == request.DialogId + return (_dialogueChatBots.FirstOrDefault(cb => + cb.GetChatBot().Id == request.DialogId ) ?.HandleMessage(sessionId, request) ?? request.DialogId) ?? @@ -557,7 +556,7 @@ public class DialogueController( } /// - /// Has a dialog message expired + /// Has a dialog message expired /// /// Message to check expiry of /// True = expired @@ -567,7 +566,7 @@ public class DialogueController( } /// - /// Handle client/friend/request/send + /// Handle client/friend/request/send /// /// Session/player id /// Sent friend request @@ -618,7 +617,7 @@ public class DialogueController( } /// - /// Handle client/friend/delete + /// Handle client/friend/delete /// /// Session/player id /// Sent delete friend request diff --git a/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs b/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs index a8f45e44..7924784e 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,6 +6,7 @@ using SPTarkov.Server.Core.Models.Eft.Game; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; +using SPTarkov.Server.Core.Models.Spt.Location; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; @@ -12,10 +14,7 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Json; -using SPTarkov.Server; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; -using SPTarkov.Server.Core.Models.Spt.Location; namespace SPTarkov.Server.Core.Controllers; @@ -458,7 +457,7 @@ public class GameController( } /// - /// Mechanic sends players a measuring tape on profile start for some reason + /// Mechanic sends players a measuring tape on profile start for some reason /// /// protected void SendMechanicGiftsToNewProfile(PmcData pmcProfile) @@ -478,9 +477,8 @@ public class GameController( foreach (var mod in mods) { if ( - fullProfile.SptData.Mods.Any( - m => - m.Author == mod.PackageJson.Author && m.Version == mod.PackageJson.Version && m.Name == mod.PackageJson.Name + fullProfile.SptData.Mods.Any(m => + m.Author == mod.PackageJson.Author && m.Version == mod.PackageJson.Version && m.Name == mod.PackageJson.Name ) ) { diff --git a/Libraries/SPTarkov.Server.Core/Controllers/HealthController.cs b/Libraries/SPTarkov.Server.Core/Controllers/HealthController.cs index 09a9c4d1..5d3eb52e 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/HealthController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/HealthController.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -10,8 +12,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Controllers; @@ -208,7 +208,7 @@ public class HealthController( } /// - /// Apply effects to profile from consumable used + /// Apply effects to profile from consumable used /// /// Hydration/Energy /// Properties of consumed item diff --git a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs index 283bf7ff..20acdcdd 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/HideoutController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; @@ -15,7 +16,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -58,8 +58,8 @@ public class HideoutController( protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); /// - /// Handle HideoutUpgrade event - /// Start a hideout area upgrade + /// Handle HideoutUpgrade event + /// Start a hideout area upgrade /// /// Player profile /// Start upgrade request @@ -67,8 +67,7 @@ public class HideoutController( /// Client response public void StartUpgrade(PmcData pmcData, HideoutUpgradeRequestData request, string sessionID, ItemEventRouterResponse output) { - var items = request.Items.Select( - reqItem => + var items = request.Items.Select(reqItem => { var item = pmcData.Inventory.Items.FirstOrDefault(invItem => invItem.Id == reqItem.Id); return new @@ -141,14 +140,14 @@ public class HideoutController( var timestamp = _timeUtil.GetTimeStamp(); - profileHideoutArea.CompleteTime = (int)Math.Round(timestamp - ctime.Value); + profileHideoutArea.CompleteTime = (int) Math.Round(timestamp - ctime.Value); profileHideoutArea.Constructing = true; } } /// - /// Handle HideoutUpgradeComplete event - /// Complete a hideout area upgrade + /// Handle HideoutUpgradeComplete event + /// Complete a hideout area upgrade /// /// Player profile /// Completed upgrade request @@ -232,7 +231,7 @@ public class HideoutController( } /// - /// Upgrade wall status to visible in profile if medstation/water collector are both level 1 + /// Upgrade wall status to visible in profile if medstation/water collector are both level 1 /// /// Player profile protected void SetWallVisibleIfPrereqsMet(PmcData pmcData) @@ -250,7 +249,7 @@ public class HideoutController( } /// - /// Add a stash upgrade to profile + /// Add a stash upgrade to profile /// /// Client response /// Session/Player id @@ -317,7 +316,7 @@ public class HideoutController( } /// - /// Add an inventory item to profile from a hideout area stage data + /// Add an inventory item to profile from a hideout area stage data /// /// Session/Player id /// Players PMC profile @@ -344,7 +343,7 @@ public class HideoutController( } /// - /// Include container upgrade in client response + /// Include container upgrade in client response /// /// Session/Player id /// Key of hideout area that's been upgraded @@ -366,8 +365,8 @@ public class HideoutController( } /// - /// Handle HideoutPutItemsInAreaSlots - /// Create item in hideout slot item array, remove item from player inventory + /// Handle HideoutPutItemsInAreaSlots + /// Create item in hideout slot item array, remove item from player inventory /// /// Players PMC profile /// request from client to place item in area slot @@ -377,8 +376,7 @@ public class HideoutController( { var output = _eventOutputHolder.GetOutput(sessionID); - var itemsToAdd = addItemToHideoutRequest.Items.Select( - kvp => + var itemsToAdd = addItemToHideoutRequest.Items.Select(kvp => { var item = pmcData.Inventory.Items.FirstOrDefault(invItem => invItem.Id == kvp.Value.Id); return new @@ -421,8 +419,7 @@ public class HideoutController( // Add item to area.slots var destinationLocationIndex = int.Parse(item.slot); - var hideoutSlotIndex = hideoutArea.Slots.FindIndex( - slot => slot.LocationIndex == destinationLocationIndex + var hideoutSlotIndex = hideoutArea.Slots.FindIndex(slot => slot.LocationIndex == destinationLocationIndex ); if (hideoutSlotIndex == -1) { @@ -452,8 +449,8 @@ public class HideoutController( } /// - /// Handle HideoutTakeItemsFromAreaSlots event - /// Remove item from hideout area and place into player inventory + /// Handle HideoutTakeItemsFromAreaSlots event + /// Remove item from hideout area and place into player inventory /// /// Players PMC profile /// Take item out of area request @@ -496,7 +493,7 @@ public class HideoutController( } /// - /// Find resource item in hideout area, add copy to player inventory, remove Item from hideout slot + /// Find resource item in hideout area, add copy to player inventory, remove Item from hideout slot /// /// Session/Player id /// Players PMC profile @@ -549,8 +546,8 @@ public class HideoutController( } /// - /// Handle HideoutToggleArea event - /// Toggle area on/off + /// Handle HideoutToggleArea event + /// Toggle area on/off /// /// Players PMC profile /// Toggle area request @@ -576,7 +573,7 @@ public class HideoutController( } /// - /// Handle HideoutSingleProductionStart event + /// Handle HideoutSingleProductionStart event /// /// Players PMC profile /// @@ -605,8 +602,7 @@ public class HideoutController( foreach (var itemToDelete in itemsToDelete) { var itemToCheck = pmcData.Inventory.Items.FirstOrDefault(i => i.Id == itemToDelete.Id); - var requirement = recipeRequirementsClone.FirstOrDefault( - requirement => requirement.TemplateId == itemToCheck.Template + var requirement = recipeRequirementsClone.FirstOrDefault(requirement => requirement.TemplateId == itemToCheck.Template ); // Handle tools not having a `count`, but always only requiring 1 @@ -629,8 +625,8 @@ public class HideoutController( } /// - /// Handle HideoutScavCaseProductionStart event - /// Handles event after clicking 'start' on the scav case hideout page + /// Handle HideoutScavCaseProductionStart event + /// Handles event after clicking 'start' on the scav case hideout page /// /// Players PMC profile /// @@ -699,7 +695,7 @@ public class HideoutController( } /// - /// Adjust scav case time based on fence standing + /// Adjust scav case time based on fence standing /// /// Players PMC profile /// Time to complete scav case in seconds @@ -716,7 +712,7 @@ public class HideoutController( } /// - /// Add generated scav case rewards to player profile + /// Add generated scav case rewards to player profile /// /// Players PMC profile /// reward items to add to profile @@ -731,7 +727,7 @@ public class HideoutController( } /// - /// Start production of continuously created item + /// Start production of continuously created item /// /// Players PMC profile /// Continuous production request @@ -745,8 +741,8 @@ public class HideoutController( } /// - /// Handle HideoutTakeProduction event - /// Take completed item out of hideout area and place into player inventory + /// Handle HideoutTakeProduction event + /// Take completed item out of hideout area and place into player inventory /// /// Players PMC profile /// Remove production from area request @@ -793,7 +789,7 @@ public class HideoutController( } /// - /// Take recipe-type production out of hideout area and place into player inventory + /// Take recipe-type production out of hideout area and place into player inventory /// /// Session/Player id /// Completed recipe of item @@ -1005,7 +1001,7 @@ public class HideoutController( } /// - /// Ensure non-stackable items are 'unstacked' + /// Ensure non-stackable items are 'unstacked' /// /// /// @@ -1060,7 +1056,6 @@ public class HideoutController( } /// - /// /// /// /// @@ -1069,7 +1064,7 @@ public class HideoutController( var defaultPreset = _presetHelper.GetDefaultPreset(recipe.EndProduct); // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory - List presetAndMods = _itemHelper.ReplaceIDs(_cloner.Clone(defaultPreset.Items)); + var presetAndMods = _itemHelper.ReplaceIDs(_cloner.Clone(defaultPreset.Items)); _itemHelper.RemapRootItemId(presetAndMods); @@ -1078,7 +1073,7 @@ public class HideoutController( } /// - /// Get the "CounterHoursCrafting" TaskConditionCounter from a profile + /// Get the "CounterHoursCrafting" TaskConditionCounter from a profile /// /// Profile to get counter from /// Recipe being crafted @@ -1101,7 +1096,7 @@ public class HideoutController( } /// - /// Handles generating scav case rewards and sending to player inventory + /// Handles generating scav case rewards and sending to player inventory /// /// Session/Player id /// Players PMC profile @@ -1163,8 +1158,8 @@ public class HideoutController( } /// - /// Handle HideoutQuickTimeEvent on client/game/profile/items/moving - /// Called after completing workout at gym + /// Handle HideoutQuickTimeEvent on client/game/profile/items/moving + /// Called after completing workout at gym /// /// Session/Player id /// Players PMC profile @@ -1214,7 +1209,7 @@ public class HideoutController( } /// - /// Apply mild/severe muscle pain after gym use + /// Apply mild/severe muscle pain after gym use /// /// Players PMC profile /// Effect data to apply after completing QTE gym event @@ -1249,7 +1244,7 @@ public class HideoutController( } /// - /// Record a high score from the shooting range into a player profiles `overallcounters` + /// Record a high score from the shooting range into a player profiles `overallcounters` /// /// Session/Player id /// Players PMC profile @@ -1278,7 +1273,7 @@ public class HideoutController( } /// - /// Handle client/game/profile/items/moving - HideoutImproveArea + /// Handle client/game/profile/items/moving - HideoutImproveArea /// /// Session/Player id /// Players PMC profile @@ -1289,8 +1284,7 @@ public class HideoutController( var output = _eventOutputHolder.GetOutput(sessionId); // Create mapping of required item with corresponding item from player inventory - var items = request.Items.Select( - reqItem => + var items = request.Items.Select(reqItem => { var item = pmcData.Inventory.Items.FirstOrDefault(invItem => invItem.Id == reqItem.Id); return new @@ -1369,7 +1363,7 @@ public class HideoutController( } /// - /// Handle client/game/profile/items/moving HideoutCancelProductionCommand + /// Handle client/game/profile/items/moving HideoutCancelProductionCommand /// /// Session/Player id /// Players PMC profile @@ -1402,7 +1396,7 @@ public class HideoutController( } /// - /// Handle HideoutDeleteProductionCommand event + /// Handle HideoutDeleteProductionCommand event /// /// Session/Player id /// Players PMC profile @@ -1419,7 +1413,7 @@ public class HideoutController( } /// - /// Handle HideoutCustomizationApply event + /// Handle HideoutCustomizationApply event /// /// Session/Player id /// Players PMC profile @@ -1445,7 +1439,7 @@ public class HideoutController( } /// - /// Map an internal customisation type to a client hideout customisation type + /// Map an internal customisation type to a client hideout customisation type /// /// /// hideout customisation type @@ -1470,7 +1464,7 @@ public class HideoutController( } /// - /// Add stand1/stand2/stand3 inventory items to profile, depending on passed in hideout stage + /// Add stand1/stand2/stand3 inventory items to profile, depending on passed in hideout stage /// /// Session/Player id /// Current EQUIPMENT_PRESETS_STAND stage data @@ -1485,8 +1479,8 @@ public class HideoutController( foreach (var mannequinSlot in slots) { // Check if we've already added this mannequin - var existingMannequin = pmcData.Inventory.Items.FirstOrDefault( - item => item.ParentId == equipmentPresetHideoutArea.Id && item.SlotId == mannequinSlot.Name + var existingMannequin = pmcData.Inventory.Items.FirstOrDefault(item => + item.ParentId == equipmentPresetHideoutArea.Id && item.SlotId == mannequinSlot.Name ); // No child, add it @@ -1506,8 +1500,7 @@ public class HideoutController( var mannequinPocketItemToAdd = new Item { Id = _hashUtil.Generate(), - Template = pmcData.Inventory.Items.FirstOrDefault( - item => item.SlotId == "Pockets" && item.ParentId == pmcData.Inventory.Equipment + Template = pmcData.Inventory.Items.FirstOrDefault(item => item.SlotId == "Pockets" && item.ParentId == pmcData.Inventory.Equipment ) .Template, // Same pocket tpl as players profile (unheard get bigger, matching pockets etc) ParentId = standId, @@ -1546,8 +1539,8 @@ public class HideoutController( } /// - /// Handle client/hideout/qte/list - /// Get quick time event list for hideout + /// Handle client/hideout/qte/list + /// Get quick time event list for hideout /// /// Session/Player id /// @@ -1557,7 +1550,7 @@ public class HideoutController( } /// - /// Function called every `hideoutConfig.runIntervalSeconds` seconds as part of onUpdate event + /// Function called every `hideoutConfig.runIntervalSeconds` seconds as part of onUpdate event /// public void Update() { diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs index 040c8d11..df416968 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.InRaid; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -57,8 +57,8 @@ public class InRaidController( } /// - /// Handle singleplayer/scav/traitorscavhostile - /// Get a % chance a scav will be hostile to the player when they're also a scav + /// Handle singleplayer/scav/traitorscavhostile + /// Get a % chance a scav will be hostile to the player when they're also a scav /// /// /// Session/Player id @@ -69,7 +69,7 @@ public class InRaidController( } /// - /// Get all boss role types e.g. bossTagilla + /// Get all boss role types e.g. bossTagilla /// /// /// Session/Player id diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs index fee7ee02..f920afd6 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -14,7 +15,6 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; -using SPTarkov.Common.Annotations; using Insurance = SPTarkov.Server.Core.Models.Eft.Profile.Insurance; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -46,7 +46,7 @@ public class InsuranceController( protected InsuranceConfig _insuranceConfig = _configServer.GetConfig(); /// - /// Process insurance items of all profiles prior to being given back to the player through the mail service + /// Process insurance items of all profiles prior to being given back to the player through the mail service /// public void ProcessReturn() { @@ -58,7 +58,7 @@ public class InsuranceController( } /// - /// Process insurance items of a single profile prior to being given back to the player through the mail service + /// Process insurance items of a single profile prior to being given back to the player through the mail service /// /// Player id public void ProcessReturnByProfile(string sessionId) @@ -76,7 +76,7 @@ public class InsuranceController( } /// - /// Get all insured items that are ready to be processed in a specific profile + /// Get all insured items that are ready to be processed in a specific profile /// /// Session/Player id /// The time to check ready status against. Current time by default @@ -99,7 +99,7 @@ public class InsuranceController( } /// - /// This method orchestrates the processing of insured items in a profile + /// This method orchestrates the processing of insured items in a profile /// /// The insured items to process /// session ID that should receive the processed items @@ -142,7 +142,7 @@ public class InsuranceController( } /// - /// Count all items in all insurance packages + /// Count all items in all insurance packages /// /// /// Count of insured items @@ -152,19 +152,18 @@ public class InsuranceController( } /// - /// Remove an insurance package from a profile using the package's system data information. + /// Remove an insurance package from a profile using the package's system data information. /// /// The session ID of the profile to remove the package from. /// The array index of the insurance package to remove. protected void RemoveInsurancePackageFromProfile(string sessionId, Insurance insPackage) { var profile = _saveServer.GetProfile(sessionId); - profile.InsuranceList = profile.InsuranceList.Where( - insurance => - insurance.TraderId != insPackage.TraderId || - insurance.SystemData?.Date != insPackage.SystemData?.Date || - insurance.SystemData?.Time != insPackage.SystemData?.Time || - insurance.SystemData?.Location != insPackage.SystemData?.Location + profile.InsuranceList = profile.InsuranceList.Where(insurance => + insurance.TraderId != insPackage.TraderId || + insurance.SystemData?.Date != insPackage.SystemData?.Date || + insurance.SystemData?.Time != insPackage.SystemData?.Time || + insurance.SystemData?.Location != insPackage.SystemData?.Location ) .ToList(); @@ -175,7 +174,7 @@ public class InsuranceController( } /// - /// Finds the items that should be deleted based on the given Insurance object + /// Finds the items that should be deleted based on the given Insurance object /// /// The ID that should be assigned to all "hideout"/root items /// The insurance object containing the items to evaluate for deletion @@ -190,8 +189,7 @@ public class InsuranceController( var parentAttachmentsMap = PopulateParentAttachmentsMap(rootItemParentId, insured, itemsMap); // Check to see if any regular items are present. - var hasRegularItems = itemsMap.Values.Any( - item => !_itemHelper.IsAttachmentAttached(item) + var hasRegularItems = itemsMap.Values.Any(item => !_itemHelper.IsAttachmentAttached(item) ); // Process all items that are not attached, attachments; those are handled separately, by value. @@ -223,9 +221,9 @@ public class InsuranceController( } /// - /// Initialize a dictionary that holds main-parents to all of their attachments. Note that "main-parent" in this - /// context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, - /// not the backpack that the gun is located in (the gun's parent). + /// Initialize a dictionary that holds main-parents to all of their attachments. Note that "main-parent" in this + /// context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun, + /// not the backpack that the gun is located in (the gun's parent). /// /// The ID that should be assigned to all "hideout"/root items /// The insurance object containing the items to evaluate @@ -318,13 +316,14 @@ public class InsuranceController( } /// - /// Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments - /// remain, the parent is removed from the map as well + /// Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments + /// remain, the parent is removed from the map as well /// /// Dictionary containing parent item IDs to arrays of their attachment items /// Hashset containing parent item IDs to arrays of their attachment items which are not moddable in-raid /// - protected Dictionary> RemoveNonModdableAttachments(Dictionary> parentAttachmentsMap, Dictionary itemsMap) + protected Dictionary> RemoveNonModdableAttachments(Dictionary> parentAttachmentsMap, + Dictionary itemsMap) { var updatedMap = new Dictionary>(); @@ -365,9 +364,9 @@ public class InsuranceController( } /// - /// Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" - /// item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, - /// they (and their attached, attachments, if any) are marked for deletion in the toDelete Dictionary + /// Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular" + /// item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so, + /// they (and their attached, attachments, if any) are marked for deletion in the toDelete Dictionary /// /// Insurance object containing the items to evaluate /// Hashset to keep track of items marked for deletion @@ -414,7 +413,7 @@ public class InsuranceController( } /// - /// Process parent items and their attachments, updating the toDelete Set accordingly + /// Process parent items and their attachments, updating the toDelete Set accordingly /// /// Dictionary containing parent item IDs to arrays of their attachment items /// Dictionary for quick item look-up by item ID @@ -447,10 +446,10 @@ public class InsuranceController( /// - /// Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by - /// their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the - /// number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most - /// valuable attachments first + /// Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by + /// their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the + /// number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most + /// valuable attachments first /// /// Array of attachment items to sort, filter, and roll /// ID of the trader to that has ensured these items @@ -488,7 +487,7 @@ public class InsuranceController( } /// - /// Write out attachments being removed + /// Write out attachments being removed /// /// /// @@ -511,7 +510,7 @@ public class InsuranceController( } /// - /// Get dictionary of items with their corresponding price + /// Get dictionary of items with their corresponding price /// /// Item attachments /// @@ -535,7 +534,7 @@ public class InsuranceController( } /// - /// Get count of items to remove from weapon (take into account trader + price of attachment) + /// Get count of items to remove from weapon (take into account trader + price of attachment) /// /// Dict of item Tpls and their rouble price /// Trader the attachment is insured against @@ -556,7 +555,7 @@ public class InsuranceController( } /// - /// Remove items from the insured items that should not be returned to the player + /// Remove items from the insured items that should not be returned to the player /// /// The insured items to process /// The items that should be deleted @@ -566,7 +565,7 @@ public class InsuranceController( } /// - /// Handle sending the insurance message to the user that potentially contains the valid insurance items + /// Handle sending the insurance message to the user that potentially contains the valid insurance items /// /// Profile that should receive the insurance message /// context of insurance to use @@ -605,7 +604,7 @@ public class InsuranceController( } /// - /// Edge case - labs doesn't allow for insurance returns unless location config is edited + /// Edge case - labs doesn't allow for insurance returns unless location config is edited /// /// The insured items to process /// OPTIONAL - id of labs location @@ -617,7 +616,7 @@ public class InsuranceController( } /// - /// Update IInsurance object with new messageTemplateId and wipe out items array data + /// Update IInsurance object with new messageTemplateId and wipe out items array data /// /// /// @@ -637,7 +636,7 @@ public class InsuranceController( /// - /// Roll for chance of item being 'lost' + /// Roll for chance of item being 'lost' /// /// Trader item was insured with /// Item being rolled on @@ -669,7 +668,7 @@ public class InsuranceController( } /// - /// Handle Insure event, Add insurance to an item + /// Handle Insure event, Add insurance to an item /// /// Players PMC profile /// Insurance request @@ -742,15 +741,14 @@ public class InsuranceController( } /// - /// Ensure soft inserts of Armor that has soft insert slots, Allows armors to come back after being lost correctly + /// Ensure soft inserts of Armor that has soft insert slots, Allows armors to come back after being lost correctly /// /// Armor item to be insured /// Players PMC profile /// Insurance request data public void InsureSoftInserts(Item itemWithSoftInserts, PmcData pmcData, InsureRequestData request) { - var softInsertSlots = pmcData.Inventory.Items.Where( - item => item.ParentId == itemWithSoftInserts.Id && _itemHelper.IsSoftInsertId(item.SlotId.ToLower()) + var softInsertSlots = pmcData.Inventory.Items.Where(item => item.ParentId == itemWithSoftInserts.Id && _itemHelper.IsSoftInsertId(item.SlotId.ToLower()) ); foreach (var softInsertSlot in softInsertSlots) @@ -771,8 +769,8 @@ public class InsuranceController( } /// - /// Handle client/insurance/items/list/cost - /// Calculate insurance cost + /// Handle client/insurance/items/list/cost + /// Calculate insurance cost /// /// request object /// Session/Player id diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs index 8460e9d9..f5eea438 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InventoryController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -12,7 +13,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -42,8 +42,8 @@ public class InventoryController( ) { /// - /// Move Item - change location of item with parentId and slotId, transfers items from one profile to another if fromOwner/toOwner is set in the body. - /// Otherwise, move is contained within the same profile_f + /// Move Item - change location of item with parentId and slotId, transfers items from one profile to another if fromOwner/toOwner is set in the body. + /// Otherwise, move is contained within the same profile_f /// /// Players PMC profile /// Move request data @@ -93,7 +93,8 @@ public class InventoryController( // Item is moving into or out of place of fame dog tag slot if (moveRequest.To?.Container != null && - (moveRequest.To.Container.StartsWith("dogtag", StringComparison.OrdinalIgnoreCase) || originalLocationSlotId.StartsWith("dogtag", StringComparison.OrdinalIgnoreCase))) + (moveRequest.To.Container.StartsWith("dogtag", StringComparison.OrdinalIgnoreCase) || + originalLocationSlotId.StartsWith("dogtag", StringComparison.OrdinalIgnoreCase))) { _hideoutHelper.ApplyPlaceOfFameDogtagBonus(pmcData); } @@ -109,7 +110,7 @@ public class InventoryController( } /// - /// Get an event router response with inventory trader message + /// Get an event router response with inventory trader message /// /// Item event router response protected void AppendTraderExploitErrorResponse(ItemEventRouterResponse output) @@ -122,8 +123,8 @@ public class InventoryController( } /// - /// Handle /client/game/profile/items/moving - PinLock - /// Requires no response to client, only server change + /// Handle /client/game/profile/items/moving - PinLock + /// Requires no response to client, only server change /// /// Players PMC profile /// Pin/Lock request data @@ -147,7 +148,7 @@ public class InventoryController( } /// - /// Handle /client/game/profile/items/moving SetFavoriteItems + /// Handle /client/game/profile/items/moving SetFavoriteItems /// /// Players PMC profile /// @@ -160,7 +161,7 @@ public class InventoryController( } /// - /// Handle /client/game/profile/items/moving RedeemProfileReward + /// Handle /client/game/profile/items/moving RedeemProfileReward /// /// Players PMC profile /// @@ -236,7 +237,7 @@ public class InventoryController( var desiredArea = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == hideoutAreaType); if (desiredArea is not null) { - desiredArea.Level = (int?)newValue; + desiredArea.Level = (int?) newValue; } break; @@ -250,7 +251,7 @@ public class InventoryController( } /// - /// Flag an item as seen in profiles encyclopedia + add inspect xp to profile + /// Flag an item as seen in profiles encyclopedia + add inspect xp to profile /// /// Inspected item tpls /// Profile to add xp to @@ -284,8 +285,8 @@ public class InventoryController( } /// - /// Handle OpenRandomLootContainer event - /// Handle event fired when a container is unpacked (e.g. halloween pumpkin) + /// Handle OpenRandomLootContainer event + /// Handle event fired when a container is unpacked (e.g. halloween pumpkin) /// /// Players PMC profile /// @@ -358,7 +359,7 @@ public class InventoryController( } /// - /// Edit an existing map marker + /// Edit an existing map marker /// /// Players PMC profile /// Edit marker request @@ -374,7 +375,7 @@ public class InventoryController( } /// - /// Delete a map marker + /// Delete a map marker /// /// Players PMC profile /// Delete marker request @@ -399,7 +400,7 @@ public class InventoryController( } /// - /// Add note to a map + /// Add note to a map /// /// Players PMC profile /// Add marker request @@ -434,7 +435,7 @@ public class InventoryController( } /// - /// Flag item as 'seen' by player in profile + /// Flag item as 'seen' by player in profile /// /// Players PMC profile /// @@ -452,7 +453,7 @@ public class InventoryController( } /// - /// Handle examining an item + /// Handle examining an item /// /// Players PMC profile /// Examine item request @@ -501,7 +502,7 @@ public class InventoryController( } /// - /// Get the tplid of an item from the examine request object + /// Get the tplid of an item from the examine request object /// /// /// Session/Player id @@ -583,8 +584,8 @@ public class InventoryController( } /// - /// Unbind an inventory item from quick access menu at bottom of player screen - /// Handle unbind event + /// Unbind an inventory item from quick access menu at bottom of player screen + /// Handle unbind event /// /// Players PMC profile /// @@ -600,8 +601,8 @@ public class InventoryController( } /// - /// Handle bind event - /// Bind an inventory item to the quick access menu at bottom of player screen + /// Handle bind event + /// Bind an inventory item to the quick access menu at bottom of player screen /// /// Players PMC profile /// @@ -621,7 +622,7 @@ public class InventoryController( } /// - /// Add a tag to an inventory item + /// Add a tag to an inventory item /// /// Profile with item to add tag to /// @@ -655,7 +656,7 @@ public class InventoryController( } /// - /// Toggles "Toggleable" items like night vision goggles and face shields. + /// Toggles "Toggleable" items like night vision goggles and face shields. /// /// Players PMC profile /// Toggle request @@ -697,7 +698,7 @@ public class InventoryController( } /// - /// Handles folding of Weapons + /// Handles folding of Weapons /// /// Players PMC profile /// Fold item request @@ -740,9 +741,9 @@ public class InventoryController( } /// - /// Swap Item - /// used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment - /// Also used to swap items using quick selection on character screen + /// Swap Item + /// used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment + /// Also used to swap items using quick selection on character screen /// /// Players PMC profile /// Swap item request @@ -819,9 +820,9 @@ public class InventoryController( } /// - /// TODO: Adds no data to output to send to client, is this by design? - /// Transfer items from one stack into another while keeping original stack - /// Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" + /// TODO: Adds no data to output to send to client, is this by design? + /// Transfer items from one stack into another while keeping original stack + /// Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload" /// /// Players PMC profile /// Transfer item request @@ -882,8 +883,8 @@ public class InventoryController( } /// - /// Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') - /// Deletes item from `body.item` and adding number of stacks into `body.with` + /// Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer') + /// Deletes item from `body.item` and adding number of stacks into `body.with` /// /// Players PMC profile /// Merge stacks request @@ -973,7 +974,7 @@ public class InventoryController( } /// - /// Split Item stack - 1 stack into 2 + /// Split Item stack - 1 stack into 2 /// /// (unused, getOwnerInventoryItems() gets profile) /// Split stack request @@ -1037,8 +1038,8 @@ public class InventoryController( } /// - /// Implements "Discard" functionality from Main menu (Stash etc.) - /// Removes item from PMC Profile + /// Implements "Discard" functionality from Main menu (Stash etc.) + /// Removes item from PMC Profile /// /// Players PMC profile /// Discard item request diff --git a/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs b/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs index 86a49f26..3ae5b431 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -9,8 +11,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using Info = SPTarkov.Server.Core.Models.Eft.Profile.Info; namespace SPTarkov.Server.Core.Controllers; @@ -33,7 +33,7 @@ public class LauncherController( protected CoreConfig _coreConfig = _configServer.GetConfig(); /// - /// Handle launcher connecting to server + /// Handle launcher connecting to server /// /// ConnectResponse public ConnectResponse Connect() @@ -56,7 +56,7 @@ public class LauncherController( } /// - /// Get descriptive text for each of the profile editions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" + /// Get descriptive text for each of the profile editions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness" /// /// Dictionary of profile types with related descriptive text protected Dictionary GetProfileDescriptions() @@ -80,7 +80,6 @@ public class LauncherController( } /// - /// /// /// Session/Player id /// @@ -90,7 +89,6 @@ public class LauncherController( } /// - /// /// /// /// @@ -109,7 +107,6 @@ public class LauncherController( } /// - /// /// /// /// @@ -127,7 +124,6 @@ public class LauncherController( } /// - /// /// /// /// @@ -154,7 +150,6 @@ public class LauncherController( } /// - /// /// /// protected string GenerateProfileId() @@ -165,7 +160,6 @@ public class LauncherController( } /// - /// /// /// /// @@ -179,7 +173,6 @@ public class LauncherController( } /// - /// /// /// /// @@ -196,7 +189,6 @@ public class LauncherController( } /// - /// /// /// /// @@ -213,7 +205,7 @@ public class LauncherController( } /// - /// Handle launcher requesting profile be wiped + /// Handle launcher requesting profile be wiped /// /// Registration data /// Session id @@ -237,7 +229,6 @@ public class LauncherController( } /// - /// /// /// public string GetCompatibleTarkovVersion() @@ -246,7 +237,7 @@ public class LauncherController( } /// - /// Get the mods the server has currently loaded + /// Get the mods the server has currently loaded /// /// Dictionary of mod name and mod details public Dictionary GetLoadedServerMods() @@ -263,7 +254,7 @@ public class LauncherController( } /// - /// Get the mods a profile has ever loaded into game with + /// Get the mods a profile has ever loaded into game with /// /// Session/Player id /// Array of mod details @@ -280,7 +271,6 @@ public class LauncherController( } /// - /// /// /// /// diff --git a/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs b/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs index 9edf0035..e697d746 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs @@ -1,3 +1,6 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; +using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Models.Eft.Profile; @@ -7,9 +10,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; -using SPTarkov.Server.Core.Context; using Info = SPTarkov.Server.Core.Models.Eft.Profile.Info; namespace SPTarkov.Server.Core.Controllers; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/LocationController.cs b/Libraries/SPTarkov.Server.Core/Controllers/LocationController.cs index 7aa30cdf..c69c6b22 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/LocationController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/LocationController.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Location; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs b/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs index 0c802079..5f586729 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Models.Eft.Match; using SPTarkov.Server.Core.Models.Spt.Config; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using static SPTarkov.Server.Core.Services.MatchLocationService; namespace SPTarkov.Server.Core.Controllers; @@ -25,7 +25,7 @@ public class MatchController( protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// Handle client/match/available + /// Handle client/match/available /// /// True if server should be available public bool GetEnabled() diff --git a/Libraries/SPTarkov.Server.Core/Controllers/NoteController.cs b/Libraries/SPTarkov.Server.Core/Controllers/NoteController.cs index 85f83a90..298b868b 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/NoteController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/NoteController.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Notes; using SPTarkov.Server.Core.Routers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/NotifierController.cs b/Libraries/SPTarkov.Server.Core/Controllers/NotifierController.cs index 6ddb9b11..a2b0d04d 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/NotifierController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/NotifierController.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Notifier; using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -25,7 +25,8 @@ public class NotifierController( /// Session/Player id public Task> NotifyAsync(string sessionId) { - return Task.Factory.StartNew(() => { + return Task.Factory.StartNew(() => + { // keep track of our timeout var counter = 0; @@ -67,7 +68,7 @@ public class NotifierController( } /// - /// Get the notifier server url + /// Get the notifier server url /// /// Session/Player id /// Notification server url diff --git a/Libraries/SPTarkov.Server.Core/Controllers/PresetController.cs b/Libraries/SPTarkov.Server.Core/Controllers/PresetController.cs index 38ec201e..ee675383 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/PresetController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/PresetController.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Spt.Presets; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -33,7 +33,10 @@ public class PresetController( // Get root items tpl var tpl = preset.Items.FirstOrDefault()?.Template; - result.TryAdd(tpl, new PresetCacheDetails{PresetIds = [] }); + result.TryAdd(tpl, new PresetCacheDetails + { + PresetIds = [] + }); result.TryGetValue(tpl, out var details); details.PresetIds.Add(presetId); diff --git a/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs b/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs index 16726bc2..c8963704 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs @@ -1,12 +1,11 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; -using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Prestige; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -20,7 +19,7 @@ public class PrestigeController( { /// /// Handle /client/prestige/list - /// Get a collection of all possible prestiges + /// Get a collection of all possible prestiges /// /// Session/Player id /// Prestige diff --git a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs index 347d3994..187a270c 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -11,7 +12,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -38,7 +38,7 @@ public class ProfileController( ) { /// - /// Handle /launcher/profiles + /// Handle /launcher/profiles /// /// public virtual List GetMiniProfiles() @@ -47,7 +47,7 @@ public class ProfileController( } /// - /// Handle launcher/profile/info + /// Handle launcher/profile/info /// /// Session/Player id /// @@ -102,7 +102,7 @@ public class ProfileController( } /// - /// Handle client/game/profile/list + /// Handle client/game/profile/list /// /// Session/Player id /// Return a full profile, scav and pmc profiles + meta data @@ -112,7 +112,7 @@ public class ProfileController( } /// - /// Handle client/game/profile/create + /// Handle client/game/profile/create /// /// Create profile request /// Player id @@ -123,8 +123,8 @@ public class ProfileController( } /// - /// Generate a player scav object - /// PMC profile MUST exist first before player-scav can be generated + /// Generate a player scav object + /// PMC profile MUST exist first before player-scav can be generated /// /// Player id /// PmcData @@ -134,7 +134,7 @@ public class ProfileController( } /// - /// Handle client/game/profile/nickname/validate + /// Handle client/game/profile/nickname/validate /// /// Validate nickname request /// Session/Player id @@ -155,8 +155,8 @@ public class ProfileController( } /// - /// Handle client/game/profile/nickname/change event - /// Client allows player to adjust their profile name + /// Handle client/game/profile/nickname/change event + /// Client allows player to adjust their profile name /// /// Change nickname request /// Player id @@ -183,7 +183,7 @@ public class ProfileController( } /// - /// Handle client/game/profile/voice/change event + /// Handle client/game/profile/voice/change event /// /// Change voice request /// Player id @@ -194,7 +194,7 @@ public class ProfileController( } /// - /// Handle client/game/profile/search + /// Handle client/game/profile/search /// /// Search profiles request /// Player id @@ -221,7 +221,7 @@ public class ProfileController( } /// - /// Handle client/profile/status + /// Handle client/profile/status /// /// Session/Player id /// @@ -258,7 +258,7 @@ public class ProfileController( } /// - /// Handle client/profile/view + /// Handle client/profile/view /// /// Session/Player id /// Get other profile request @@ -345,7 +345,7 @@ public class ProfileController( } /// - /// Handle client/profile/settings + /// Handle client/profile/settings /// /// Session/Player id /// Get profile settings request diff --git a/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs b/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs index 813e9da4..aff6dc00 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -11,7 +12,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -39,13 +39,13 @@ public class QuestController( ICloner _cloner ) { - protected QuestConfig _questConfig = _configServer.GetConfig(); protected static readonly List _questTypes = ["PickUp", "Exploration", "Elimination"]; + protected QuestConfig _questConfig = _configServer.GetConfig(); /// - /// Handle client/quest/list - /// Get all quests visible to player - /// Exclude quests with incomplete preconditions (level/loyalty) + /// Handle client/quest/list + /// Get all quests visible to player + /// Exclude quests with incomplete preconditions (level/loyalty) /// /// Session/Player id /// Collection of Quest @@ -55,10 +55,10 @@ public class QuestController( } /// - /// Handle QuestAccept event - /// Handle the client accepting a quest and starting it - /// Send starting rewards if any to player and - /// Send start notification if any to player + /// Handle QuestAccept event + /// Handle the client accepting a quest and starting it + /// Send starting rewards if any to player and + /// Send start notification if any to player /// /// Players PMC profile /// Quest accepted @@ -131,7 +131,7 @@ public class QuestController( } /// - /// Add a quests condition counters to chosen profile + /// Add a quests condition counters to chosen profile /// /// Conditions to iterate over and possibly add to profile /// Players PMC profile @@ -163,10 +163,10 @@ public class QuestController( } /// - /// TODO: Move this code into RepeatableQuestController - /// Handle the client accepting a repeatable quest and starting it - /// Send starting rewards if any to player and - /// Send start notification if any to player + /// TODO: Move this code into RepeatableQuestController + /// Handle the client accepting a repeatable quest and starting it + /// Send starting rewards if any to player and + /// Send start notification if any to player /// /// Players PMC profile /// Repeatable quest accepted @@ -211,7 +211,7 @@ public class QuestController( } /// - /// Look for an accepted quest inside player profile, return quest that matches + /// Look for an accepted quest inside player profile, return quest that matches /// /// Players PMC profile /// Quest id to return @@ -238,10 +238,10 @@ public class QuestController( } /// - /// Handle QuestComplete event - /// Update completed quest in profile - /// Add newly unlocked quests to profile - /// Also recalculate their level due to exp rewards + /// Handle QuestComplete event + /// Update completed quest in profile + /// Add newly unlocked quests to profile + /// Also recalculate their level due to exp rewards /// /// Players PMC profile /// Complete quest request @@ -253,8 +253,8 @@ public class QuestController( } /// - /// Handle QuestHandover event - /// Player hands over an item to trader to complete/partially complete quest + /// Handle QuestHandover event + /// Player hands over an item to trader to complete/partially complete quest /// /// Players PMC profile /// Handover request @@ -407,7 +407,7 @@ public class QuestController( } /// - /// Show warning to user and write to log that repeatable quest failed a condition check + /// Show warning to user and write to log that repeatable quest failed a condition check /// /// Quest id that failed /// Relevant condition id that failed @@ -419,8 +419,8 @@ public class QuestController( "repeatable-quest_handover_failed_condition_invalid", new { - questId = questId, - conditionId = conditionId + questId, + conditionId } ); _logger.Error(errorMessage); @@ -429,7 +429,7 @@ public class QuestController( } /// - /// Show warning to user and write to log quest item handed over did not match what is required + /// Show warning to user and write to log quest item handed over did not match what is required /// /// Handover request /// Non-matching item found @@ -454,8 +454,8 @@ public class QuestController( } /// - /// Increment a backend counter stored value by an amount - /// Create counter if it does not exist + /// Increment a backend counter stored value by an amount + /// Create counter if it does not exist /// /// Players PMC profile /// Backend counter id to update @@ -480,7 +480,7 @@ public class QuestController( } /// - /// Handle /client/game/profile/items/moving - QuestFail + /// Handle /client/game/profile/items/moving - QuestFail /// /// Players PMC profile /// Fail quest request diff --git a/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs b/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs index 9fb003e5..3640ce7b 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; @@ -14,7 +15,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Controllers; @@ -105,7 +105,7 @@ public class RagfairController } /// - /// Check all profiles and sell player offers / send player money for listing if it sold + /// Check all profiles and sell player offers / send player money for listing if it sold /// public void Update() { @@ -124,7 +124,7 @@ public class RagfairController } /// - /// Handles client/ragfair/find + /// Handles client/ragfair/find /// /// Session/Player id /// Search request data @@ -188,7 +188,7 @@ public class RagfairController } /// - /// Adjust ragfair offer stack count to match same value as traders assort stack count + /// Adjust ragfair offer stack count to match same value as traders assort stack count /// /// Flea offer to adjust stack size of private void SetTraderOfferStackSize(RagfairOffer offer) @@ -217,7 +217,7 @@ public class RagfairController } /// - /// Update a trader flea offer with buy restrictions stored in the traders assort + /// Update a trader flea offer with buy restrictions stored in the traders assort /// /// Flea offer to update /// Players full profile @@ -256,7 +256,7 @@ public class RagfairController } /// - /// Add index to all offers passed in (0-indexed) + /// Add index to all offers passed in (0-indexed) /// /// Offers to add index value to protected void AddIndexValueToOffers(List offers) @@ -270,7 +270,7 @@ public class RagfairController } /// - /// Get categories for the type of search being performed, linked/required/all + /// Get categories for the type of search being performed, linked/required/all /// /// /// Client search request data @@ -307,7 +307,7 @@ public class RagfairController } /// - /// Is the flea search being performed a 'linked' search type + /// Is the flea search being performed a 'linked' search type /// /// Search request /// True = a 'linked' search type @@ -317,7 +317,7 @@ public class RagfairController } /// - /// Is the flea search being performed a 'required' search type + /// Is the flea search being performed a 'required' search type /// /// Search request /// True if it is a 'required' search type @@ -327,7 +327,7 @@ public class RagfairController } /// - /// Get offers for the client based on type of search being performed + /// Get offers for the client based on type of search being performed /// /// Client search request data /// Comes from ragfairHelper.filterCategories() @@ -354,7 +354,7 @@ public class RagfairController } /// - /// Called when creating an offer on flea, fills values in top right corner + /// Called when creating an offer on flea, fills values in top right corner /// /// Client request object /// OPTIONAL - Should trader offers be ignored in the calculation @@ -445,7 +445,7 @@ public class RagfairController } /// - /// List item(s) on flea for sale + /// List item(s) on flea for sale /// /// Players PMC profile /// Flea list creation offer @@ -488,7 +488,7 @@ public class RagfairController } /// - /// Is the item to be listed on the flea valid + /// Is the item to be listed on the flea valid /// /// Client offer request /// Is offer valid @@ -512,7 +512,7 @@ public class RagfairController } /// - /// Given a client request, determine what type of offer is being created single/multi/pack + /// Given a client request, determine what type of offer is being created single/multi/pack /// /// Client request /// FleaOfferType @@ -542,9 +542,9 @@ public class RagfairController } /// - /// Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack - /// e.g. 2 ammo stacks of 30 cartridges each - /// Each item can be purchased individually + /// Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack + /// e.g. 2 ammo stacks of 30 cartridges each + /// Each item can be purchased individually /// /// Session/Player id /// Offer request from client @@ -652,9 +652,9 @@ public class RagfairController } /// - /// Create a flea offer for multiple items, can be single items or items with multiple in the stack - /// e.g. 2 ammo stacks of 30 cartridges each - /// The entire package must be purchased in one go + /// Create a flea offer for multiple items, can be single items or items with multiple in the stack + /// e.g. 2 ammo stacks of 30 cartridges each + /// The entire package must be purchased in one go /// /// Session/Player id /// Offer request from client @@ -762,8 +762,8 @@ public class RagfairController } /// - /// Create a flea offer for a single item - includes an item with > 1 sized stack - /// e.g. 1 ammo stack of 30 cartridges + /// Create a flea offer for a single item - includes an item with > 1 sized stack + /// e.g. 1 ammo stack of 30 cartridges /// /// Session/Player id /// Offer request from client @@ -859,7 +859,7 @@ public class RagfairController } /// - /// Charge player a listing fee for using flea, pulls charge from data previously sent by client + /// Charge player a listing fee for using flea, pulls charge from data previously sent by client /// /// /// Base item being listed (used when client tax cost not found and must be done on server) @@ -913,7 +913,7 @@ public class RagfairController } /// - /// Create a flea offer for a player + /// Create a flea offer for a player /// /// Session/Player id /// @@ -924,8 +924,7 @@ public class RagfairController bool sellInOnePiece) { const int loyalLevel = 1; - var formattedItems = items.Select( - item => + var formattedItems = items.Select(item => { var isChild = items.Any(subItem => subItem.Id == item.ParentId); @@ -940,8 +939,7 @@ public class RagfairController } ); - var formattedRequirements = requirements.Select( - item => new BarterScheme + var formattedRequirements = requirements.Select(item => new BarterScheme { Template = item.Template, Count = item.Count, @@ -955,13 +953,13 @@ public class RagfairController formattedItems.ToList(), formattedRequirements.ToList(), loyalLevel, - (int?)items.FirstOrDefault()?.Upd?.StackObjectsCount ?? 1, + (int?) items.FirstOrDefault()?.Upd?.StackObjectsCount ?? 1, sellInOnePiece ); } /// - /// Get the handbook price in roubles for the items being listed + /// Get the handbook price in roubles for the items being listed /// /// /// Rouble price @@ -982,7 +980,7 @@ public class RagfairController } /// - /// Find items with their children from players inventory + /// Find items with their children from players inventory /// /// Players PMC profile /// Request @@ -1038,8 +1036,8 @@ public class RagfairController } /// - /// Flag an offer as being ready for removal - sets expiry for very near future - /// Will be picked up by update() once expiry time has passed + /// Flag an offer as being ready for removal - sets expiry for very near future + /// Will be picked up by update() once expiry time has passed /// /// Id of offer to remove /// Session id of requesting player @@ -1058,7 +1056,7 @@ public class RagfairController new { profileId = sessionId, - offerId = offerId + offerId } ) ); @@ -1074,7 +1072,7 @@ public class RagfairController "ragfair-offer_not_found_in_profile", new { - offerId = offerId + offerId } ) ); @@ -1098,7 +1096,7 @@ public class RagfairController } /// - /// Extend a flea offers active time + /// Extend a flea offers active time /// /// Extend time request /// Session/Player id @@ -1167,7 +1165,7 @@ public class RagfairController } /// - /// Create a basic trader request object with price and currency type + /// Create a basic trader request object with price and currency type /// /// What currency: RUB, EURO, USD /// Amount of currency @@ -1194,7 +1192,7 @@ public class RagfairController } /// - /// Get prices for all items on flea + /// Get prices for all items on flea /// /// Dictionary of tpl and item price public Dictionary GetAllFleaPrices() diff --git a/Libraries/SPTarkov.Server.Core/Controllers/RepairController.cs b/Libraries/SPTarkov.Server.Core/Controllers/RepairController.cs index c306b585..5a523ffa 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/RepairController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/RepairController.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Repair; using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs b/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs index a9f96a2c..a0630526 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -16,7 +17,6 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Controllers; @@ -44,7 +44,7 @@ public class RepeatableQuestController( protected QuestConfig _questConfig = _configServer.GetConfig(); /// - /// Handle RepeatableQuestChange event + /// Handle RepeatableQuestChange event /// /// Players PMC profile /// Change quest request @@ -77,8 +77,7 @@ public class RepeatableQuestController( var replacedQuestTraderId = questToReplace.TraderId; // Update active quests to exclude the quest we're replacing - repeatablesOfTypeInProfile.ActiveQuests = repeatablesOfTypeInProfile.ActiveQuests.Where( - quest => quest.Id != changeRequest.QuestId + repeatablesOfTypeInProfile.ActiveQuests = repeatablesOfTypeInProfile.ActiveQuests.Where(quest => quest.Id != changeRequest.QuestId ) .ToList(); @@ -91,8 +90,7 @@ public class RepeatableQuestController( repeatablesOfTypeInProfile.ChangeRequirement.Remove(changeRequest.QuestId); // Get config for this repeatable sub-type (daily/weekly/scav) - var repeatableConfig = _questConfig.RepeatableQuests.FirstOrDefault( - config => config.Name == repeatablesOfTypeInProfile.Name + var repeatableConfig = _questConfig.RepeatableQuests.FirstOrDefault(config => config.Name == repeatablesOfTypeInProfile.Name ); // If the configuration dictates to replace with the same quest type, adjust the available quest types @@ -183,9 +181,8 @@ public class RepeatableQuestController( } /// - /// Some accounts have access to free repeatable quest refreshes - /// Track the usage of them inside players profile - /// + /// Some accounts have access to free repeatable quest refreshes + /// Track the usage of them inside players profile /// /// Full player profile /// Can be daily / weekly / scav repeatable @@ -227,7 +224,7 @@ public class RepeatableQuestController( } /// - /// Clean up the repeatables `changeRequirement` dictionary of expired data + /// Clean up the repeatables `changeRequirement` dictionary of expired data /// /// repeatables that have the replaced and new quest /// Id of the replaced quest @@ -248,7 +245,7 @@ public class RepeatableQuestController( } /// - /// Generate a repeatable quest + /// Generate a repeatable quest /// /// Session/Player id /// Players PMC profile @@ -289,7 +286,7 @@ public class RepeatableQuestController( } /// - /// Remove the provided quest from pmc and scav character profiles + /// Remove the provided quest from pmc and scav character profiles /// /// Profile to remove quest from /// Quest id to remove from profile @@ -309,8 +306,7 @@ public class RepeatableQuestController( } /// - /// Find a repeatable (daily/weekly/scav) from a players profile by its id - /// + /// Find a repeatable (daily/weekly/scav) from a players profile by its id /// /// Id of quest to find /// Profile that contains quests to look through @@ -339,25 +335,23 @@ public class RepeatableQuestController( } /// - /// Handle client/repeatalbeQuests/activityPeriods - /// Returns an array of objects in the format of repeatable quests to the client. - /// repeatableQuestObject = { - /// *id: Unique Id, - ///name: "Daily", - ///endTime: the time when the quests expire - ///activeQuests: currently available quests in an array. Each element of quest type format(see assets/ database / templates / repeatableQuests.json). - ///inactiveQuests: the quests which were previously active(required by client to fail them if they are not completed) - /// } - /// - /// The method checks if the player level requirement for repeatable quests(e.g.daily lvl5, weekly lvl15) is met and if the previously active quests - /// are still valid.This ischecked by endTime persisted in profile accordning to the resetTime configured for each repeatable kind(daily, weekly) - /// in QuestCondig.js - /// - /// If the condition is met, new repeatableQuests are created, old quests(which are persisted in the profile.RepeatableQuests[i].activeQuests) are - /// moved to profile.RepeatableQuests[i].inactiveQuests.This memory is required to get rid of old repeatable quest data in the profile, otherwise - /// they'll litter the profile's Quests field. - /// (if the are on "Succeed" but not "Completed" we keep them, to allow the player to complete them and get the rewards) - /// The new quests generated are again persisted in profile.RepeatableQuests + /// Handle client/repeatalbeQuests/activityPeriods + /// Returns an array of objects in the format of repeatable quests to the client. + /// repeatableQuestObject = { + /// *id: Unique Id, + /// name: "Daily", + /// endTime: the time when the quests expire + /// activeQuests: currently available quests in an array. Each element of quest type format(see assets/ database / templates / repeatableQuests.json). + /// inactiveQuests: the quests which were previously active(required by client to fail them if they are not completed) + /// } + /// The method checks if the player level requirement for repeatable quests(e.g.daily lvl5, weekly lvl15) is met and if the previously active quests + /// are still valid.This ischecked by endTime persisted in profile accordning to the resetTime configured for each repeatable kind(daily, weekly) + /// in QuestCondig.js + /// If the condition is met, new repeatableQuests are created, old quests(which are persisted in the profile.RepeatableQuests[i].activeQuests) are + /// moved to profile.RepeatableQuests[i].inactiveQuests.This memory is required to get rid of old repeatable quest data in the profile, otherwise + /// they'll litter the profile's Quests field. + /// (if the are on "Succeed" but not "Completed" we keep them, to allow the player to complete them and get the rewards) + /// The new quests generated are again persisted in profile.RepeatableQuests /// /// Session/Player id /// Array of repeatable quests @@ -491,7 +485,7 @@ public class RepeatableQuestController( } /// - /// Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists + /// Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists /// /// daily/weekly config /// Players PMC profile @@ -500,8 +494,7 @@ public class RepeatableQuestController( PmcData pmcData) { // Get from profile, add if missing - var repeatableQuestDetails = pmcData.RepeatableQuests.FirstOrDefault( - repeatable => repeatable.Name == repeatableConfig.Name + var repeatableQuestDetails = pmcData.RepeatableQuests.FirstOrDefault(repeatable => repeatable.Name == repeatableConfig.Name ); var hasAccess = _profileHelper.HasAccessToRepeatableFreeRefreshSystem(pmcData); @@ -535,7 +528,7 @@ public class RepeatableQuestController( } /// - /// Check if a repeatable quest type (daily/weekly) is active for the given profile + /// Check if a repeatable quest type (daily/weekly) is active for the given profile /// /// Repeatable quest config /// Players PMC profile @@ -563,7 +556,7 @@ public class RepeatableQuestController( } /// - /// Does player have daily pmc quests unlocked + /// Does player have daily pmc quests unlocked /// /// Players PMC profile /// Config of daily type to check @@ -574,7 +567,7 @@ public class RepeatableQuestController( } /// - /// Does player have daily scav quests unlocked + /// Does player have daily scav quests unlocked /// /// Players PMC profile /// True if unlocked @@ -586,7 +579,7 @@ public class RepeatableQuestController( } /// - /// Expire quests and replace expired quests with ready-to-hand-in quests inside generatedRepeatables.activeQuests + /// Expire quests and replace expired quests with ready-to-hand-in quests inside generatedRepeatables.activeQuests /// /// Repeatables to process (daily/weekly) /// Players PMC profile @@ -629,9 +622,9 @@ public class RepeatableQuestController( } /// - /// Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently - /// narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests - /// where you have to e.g. kill scavs in same locations + /// Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently + /// narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests + /// where you have to e.g. kill scavs in same locations /// /// main repeatable quest config /// Players level @@ -680,8 +673,7 @@ public class RepeatableQuestController( var allowedLocations = targetKvP.Key == "Savage" - ? possibleLocations.Where( - location => location != ELocationName.laboratory + ? possibleLocations.Where(location => location != ELocationName.laboratory ) // Exclude labs for Savage targets. : possibleLocations; @@ -696,7 +688,7 @@ public class RepeatableQuestController( } /// - /// Create a pool of quests to generate quests from + /// Create a pool of quests to generate quests from /// /// Main repeatable config /// QuestTypePool @@ -724,7 +716,7 @@ public class RepeatableQuestController( } /// - /// Get a dictionary of map locations the player can access based on their current level + /// Get a dictionary of map locations the player can access based on their current level /// /// /// @@ -754,7 +746,7 @@ public class RepeatableQuestController( } /// - /// Return true if the given pmcLevel is allowed on the given location + /// Return true if the given pmcLevel is allowed on the given location /// /// location name to check /// level of the pmc @@ -792,7 +784,8 @@ public class RepeatableQuestController( } // Add elite bonus to daily quests - if (string.Equals(repeatableConfig.Name, "daily", StringComparison.OrdinalIgnoreCase) && _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, fullProfile.CharacterData.PmcData)) + if (string.Equals(repeatableConfig.Name, "daily", StringComparison.OrdinalIgnoreCase) && + _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, fullProfile.CharacterData.PmcData)) // Elite charisma skill gives extra daily quest(s) { questCount += _databaseService @@ -807,7 +800,7 @@ public class RepeatableQuestController( } // Add any extra repeatable quests the profile has unlocked - questCount += (int)fullProfile.SptData.ExtraRepeatableQuests.GetValueOrDefault(repeatableConfig.Id, 0); + questCount += (int) fullProfile.SptData.ExtraRepeatableQuests.GetValueOrDefault(repeatableConfig.Id, 0); return questCount; } diff --git a/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs b/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs index 92060864..ca02bde3 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -11,7 +12,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Controllers; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/TraderController.cs b/Libraries/SPTarkov.Server.Core/Controllers/TraderController.cs index 4c10831e..a9ce5b55 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/TraderController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/TraderController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -9,7 +10,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; @@ -73,8 +73,8 @@ public class TraderController( } /// - /// Adjust trader item prices based on config value multiplier - /// only applies to items sold for currency + /// Adjust trader item prices based on config value multiplier + /// only applies to items sold for currency /// /// Trader to adjust prices of /// Coef to apply to traders' items' prices diff --git a/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs b/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs index 7433d8d5..fb6b1600 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Weather; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Spt.Weather; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/WishlistController.cs b/Libraries/SPTarkov.Server.Core/Controllers/WishlistController.cs index 25e8782e..641cd96d 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/WishlistController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/WishlistController.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Wishlist; using SPTarkov.Server.Core.Routers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Controllers; diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs index 3898c277..0b526f79 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotEquipmentModGenerator.cs @@ -1,4 +1,5 @@ using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -12,7 +13,6 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -40,7 +40,6 @@ public class BotEquipmentModGenerator( ICloner _cloner ) { - protected BotConfig _botConfig = _configServer.GetConfig(); protected static readonly FrozenSet _modSightIds = ["mod_sight_front", "mod_sight_rear"]; // Slots that hold scopes @@ -63,12 +62,15 @@ public class BotEquipmentModGenerator( // Slots that hold cartridges protected static readonly FrozenSet _cartridgeHolderSlots = - [ - "mod_magazine", - "patron_in_weapon", - "patron_in_weapon_000", - "patron_in_weapon_001", - "cartridges"]; + [ + "mod_magazine", + "patron_in_weapon", + "patron_in_weapon_000", + "patron_in_weapon_001", + "cartridges" + ]; + + protected BotConfig _botConfig = _configServer.GetConfig(); /// /// Check mods are compatible and add to array @@ -272,10 +274,9 @@ public class BotEquipmentModGenerator( } // Get the front/back/side weights based on bots level - var plateSlotWeights = settings.BotEquipmentConfig?.ArmorPlateWeighting.FirstOrDefault( - armorWeight => - settings.BotData.Level >= armorWeight.LevelRange.Min && - settings.BotData.Level <= armorWeight.LevelRange.Max + var plateSlotWeights = settings.BotEquipmentConfig?.ArmorPlateWeighting.FirstOrDefault(armorWeight => + settings.BotData.Level >= armorWeight.LevelRange.Min && + settings.BotData.Level <= armorWeight.LevelRange.Max ); if (plateSlotWeights is null) @@ -390,14 +391,13 @@ public class BotEquipmentModGenerator( } /// - /// Gets the minimum and maximum plate class levels from an array of plates + /// Gets the minimum and maximum plate class levels from an array of plates /// /// Pool of plates to sort by armorClass to get min and max /// MinMax of armorClass from plate pool protected static MinMax GetMinMaxArmorPlateClass(List platePool) { - platePool.Sort( - (x, y) => + platePool.Sort((x, y) => { if (x.Properties.ArmorClass < y.Properties.ArmorClass) { @@ -421,7 +421,7 @@ public class BotEquipmentModGenerator( } /// - /// Get the default plate an armor has in its db item + /// Get the default plate an armor has in its db item /// /// Item to look up default plate /// front/back @@ -434,7 +434,7 @@ public class BotEquipmentModGenerator( } /// - /// Get the matching armor slot from the default preset matching passed in armor tpl + /// Get the matching armor slot from the default preset matching passed in armor tpl /// /// /// @@ -733,7 +733,7 @@ public class BotEquipmentModGenerator( } /// - /// Does the passed in db item lack slot cartridges or chambers + /// Does the passed in db item lack slot cartridges or chambers /// /// Item to check /// True it lacks cartridges/chamber slots @@ -1032,9 +1032,8 @@ public class BotEquipmentModGenerator( if ((request.WeaponStats.HasOptic ?? false) && modPool.Count > 1) { // Attempt to limit modpool to low profile gas blocks when weapon has an optic - var onlyLowProfileGasBlocks = modPool.Where( - tpl => - _botConfig.LowProfileGasBlockTpls.Contains(tpl) + var onlyLowProfileGasBlocks = modPool.Where(tpl => + _botConfig.LowProfileGasBlockTpls.Contains(tpl) ); if (onlyLowProfileGasBlocks.Any()) { @@ -1044,8 +1043,7 @@ public class BotEquipmentModGenerator( else if ((request.WeaponStats.HasRearIronSight ?? false) && modPool.Count > 1) { // Attempt to limit modpool to high profile gas blocks when weapon has rear iron sight + no front iron sight - var onlyHighProfileGasBlocks = modPool.Where( - tpl => !_botConfig.LowProfileGasBlockTpls.Contains(tpl) + var onlyHighProfileGasBlocks = modPool.Where(tpl => !_botConfig.LowProfileGasBlockTpls.Contains(tpl) ); if (onlyHighProfileGasBlocks.Any()) { @@ -1127,8 +1125,7 @@ public class BotEquipmentModGenerator( var weaponTpl = modSpawnRequest.Weapon[0].Template; modSpawnRequest.RandomisationSettings.MinimumMagazineSize.TryGetValue(weaponTpl, out var minMagSizeFromSettings); var minMagazineSize = minMagSizeFromSettings; - var desiredMagazineTpls = modPool.Where( - magTpl => + var desiredMagazineTpls = modPool.Where(magTpl => { var magazineDb = _itemHelper.GetItem(magTpl).Value; return magazineDb.Properties is not null && magazineDb.Properties.Cartridges.FirstOrDefault().MaxCount >= minMagazineSize; @@ -1236,9 +1233,8 @@ public class BotEquipmentModGenerator( } // Check if existing weapon mods are incompatible with chosen item - var existingItemBlockingChoice = weapon.FirstOrDefault( - item => - pickedItemDetails.Value.Properties.ConflictingItems?.Contains(item.Template) ?? false + var existingItemBlockingChoice = weapon.FirstOrDefault(item => + pickedItemDetails.Value.Properties.ConflictingItems?.Contains(item.Template) ?? false ); if (existingItemBlockingChoice is not null) { @@ -1326,7 +1322,7 @@ public class BotEquipmentModGenerator( } /// - /// Get a pool of mods from the default weapon preset for passed in weapon + /// Get a pool of mods from the default weapon preset for passed in weapon /// /// /// @@ -1360,8 +1356,8 @@ public class BotEquipmentModGenerator( // Get an array of items that are allowed in slot from parent item // Check the filter of the slot to ensure a chosen mod fits - var parentSlotCompatibleItems = request.ParentTemplate.Properties.Slots?.FirstOrDefault( - slot => string.Equals(slot.Name.ToLower(), request.ModSlot.ToLower(), StringComparison.Ordinal) + var parentSlotCompatibleItems = request.ParentTemplate.Properties.Slots?.FirstOrDefault(slot => + string.Equals(slot.Name.ToLower(), request.ModSlot.ToLower(), StringComparison.Ordinal) ) ?.Props.Filters?[0].Filter; @@ -1413,7 +1409,7 @@ public class BotEquipmentModGenerator( } /// - /// Get Desired item from preset + /// Get Desired item from preset /// /// /// @@ -1834,20 +1830,17 @@ public class BotEquipmentModGenerator( // Check to see if mount has a scope slot (only include primary slot, ignore the rest like the backup sight slots) // Should only find 1 as there's currently no items with a mod_scope AND a mod_scope_000 HashSet filter = ["mod_scope", "mod_scope_000"]; - var scopeSlot = itemDetails.Properties.Slots.Where( - slot => - filter.Contains(slot.Name) + var scopeSlot = itemDetails.Properties.Slots.Where(slot => + filter.Contains(slot.Name) ); // Mods scope slot found must allow ALL whitelisted scope types OR be a mount - if (scopeSlot?.All( - slot => - slot.Props.Filters[0] - .Filter.All( - tpl => - _itemHelper.IsOfBaseclasses(tpl, whitelistedSightTypes) || - _itemHelper.IsOfBaseclass(tpl, BaseClasses.MOUNT) - ) + if (scopeSlot?.All(slot => + slot.Props.Filters[0] + .Filter.All(tpl => + _itemHelper.IsOfBaseclasses(tpl, whitelistedSightTypes) || + _itemHelper.IsOfBaseclass(tpl, BaseClasses.MOUNT) + ) ) ?? false) // Add mod to allowed list diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs index 999c87a7..b1d5e263 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -10,7 +11,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using BodyPart = SPTarkov.Server.Core.Models.Eft.Common.Tables.BodyPart; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -509,7 +509,7 @@ public class BotGenerator( Health = new CurrentMinMax { Current = _randomUtil.GetDouble(bodyParts.Head.Min, bodyParts.Head.Max), - Maximum = (double) Math.Round(bodyParts.Head.Max) + Maximum = Math.Round(bodyParts.Head.Max) } } }, @@ -519,7 +519,7 @@ public class BotGenerator( Health = new CurrentMinMax { Current = _randomUtil.GetDouble(bodyParts.Chest.Min, bodyParts.Chest.Max), - Maximum = (double) Math.Round(bodyParts.Chest.Max) + Maximum = Math.Round(bodyParts.Chest.Max) } } }, diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs index 78baec81..ac2db192 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs @@ -1,4 +1,5 @@ using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -10,7 +11,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -37,8 +37,6 @@ public class BotInventoryGenerator( ConfigServer _configServer ) { - private readonly BotConfig _botConfig = _configServer.GetConfig(); - // Slots handled individually inside `GenerateAndAddEquipmentToBot` private static readonly FrozenSet _excludedEquipmentSlots = [ @@ -53,6 +51,8 @@ public class BotInventoryGenerator( EquipmentSlots.Earpiece ]; + private readonly BotConfig _botConfig = _configServer.GetConfig(); + private readonly HashSet _slotsToCheck = [EquipmentSlots.Pockets.ToString(), EquipmentSlots.SecuredContainer.ToString()]; /// @@ -386,7 +386,7 @@ public class BotInventoryGenerator( } /// - /// Get RootEquipmentPool id based on game version + /// Get RootEquipmentPool id based on game version /// /// /// diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs index 3a7d166f..3d395dfe 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Bot; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Bots; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators; diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs index 3da889dc..1f385510 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -337,8 +337,7 @@ public class BotLootGenerator( return null; } - var matchingValue = _pmcConfig?.LootItemLimitsRub?.FirstOrDefault( - minMaxValue => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max + var matchingValue = _pmcConfig?.LootItemLimitsRub?.FirstOrDefault(minMaxValue => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max ); return matchingValue; @@ -358,14 +357,13 @@ public class BotLootGenerator( return 0; } - var matchingValue = _pmcConfig.MaxBackpackLootTotalRub.FirstOrDefault( - minMaxValue => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max + var matchingValue = _pmcConfig.MaxBackpackLootTotalRub.FirstOrDefault(minMaxValue => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max ); return matchingValue?.Value; } /// - /// Get an array of the containers a bot has on them (pockets/backpack/vest) + /// Get an array of the containers a bot has on them (pockets/backpack/vest) /// /// Bot to check /// Array of available slots @@ -595,7 +593,7 @@ public class BotLootGenerator( } /// - /// Adds loot to the specified Wallet + /// Adds loot to the specified Wallet /// /// Wallet to add loot to /// Generated list of currency stacks with the wallet as their parent @@ -605,19 +603,19 @@ public class BotLootGenerator( // Choose how many stacks of currency will be added to wallet var itemCount = _randomUtil.GetInt( - (int) _botConfig.WalletLoot.ItemCount.Min, - (int) _botConfig.WalletLoot.ItemCount.Max + _botConfig.WalletLoot.ItemCount.Min, + _botConfig.WalletLoot.ItemCount.Max ); for (var index = 0; index < itemCount; index++) { // Choose the size of the currency stack - default is 5k, 10k, 15k, 20k, 25k - var chosenStackCount = _weightedRandomHelper.GetWeightedValue(_botConfig.WalletLoot.StackSizeWeight); + var chosenStackCount = _weightedRandomHelper.GetWeightedValue(_botConfig.WalletLoot.StackSizeWeight); List items = [ new() { Id = _hashUtil.Generate(), - Template = _weightedRandomHelper.GetWeightedValue(_botConfig.WalletLoot.CurrencyWeight), + Template = _weightedRandomHelper.GetWeightedValue(_botConfig.WalletLoot.CurrencyWeight), ParentId = walletId, Upd = new Upd { @@ -693,8 +691,8 @@ public class BotLootGenerator( ] ); var randomisedWeaponCount = _randomUtil.GetInt( - (int) _pmcConfig.LooseWeaponInBackpackLootMinMax.Min, - (int) _pmcConfig.LooseWeaponInBackpackLootMinMax.Max + _pmcConfig.LooseWeaponInBackpackLootMinMax.Min, + _pmcConfig.LooseWeaponInBackpackLootMinMax.Max ); if (randomisedWeaponCount <= 0) diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotWeaponGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotWeaponGenerator.cs index 3a21f79c..caab5eec 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotWeaponGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotWeaponGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators.WeaponGen; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -10,7 +11,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -200,7 +200,7 @@ public class BotWeaponGenerator( // Add cartridge(s) to gun chamber(s) if (weaponItemTemplate.Properties?.Chambers?.Count > 0 && - weaponItemTemplate.Properties.Chambers[0].Props.Filters[0].Filter.Contains(ammoTpl)) + weaponItemTemplate.Properties.Chambers[0].Props.Filters[0].Filter.Contains(ammoTpl)) { // Guns have variety of possible Chamber ids, patron_in_weapon/patron_in_weapon_000/patron_in_weapon_001 var chamberSlotNames = weaponItemTemplate.Properties.Chambers.Select(chamberSlot => chamberSlot.Name); @@ -363,8 +363,7 @@ public class BotWeaponGenerator( foreach (var modSlotTemplate in modTemplate.Properties.Slots?.Where(slot => slot.Required.GetValueOrDefault(false)) ?? []) { var slotName = modSlotTemplate.Name; - var hasWeaponSlotItem = weaponItemList.Any( - weaponItem => weaponItem.ParentId == mod.Id && weaponItem.SlotId == slotName + var hasWeaponSlotItem = weaponItemList.Any(weaponItem => weaponItem.ParentId == mod.Id && weaponItem.SlotId == slotName ); if (!hasWeaponSlotItem) { @@ -639,7 +638,8 @@ public class BotWeaponGenerator( var magazineCaliberData = _itemHelper.GetItem(compatibleCartridgesInMagazine.FirstOrDefault()).Value.Properties.Caliber; cartridgePoolForWeapon = cartridgePool[magazineCaliberData]; - foreach (var cartridgeKvP in cartridgePoolForWeapon) { + foreach (var cartridgeKvP in cartridgePoolForWeapon) + { if (compatibleCartridgesInMagazine.Contains(cartridgeKvP.Key)) { compatibleCartridges[cartridgeKvP.Key] = cartridgeKvP.Value; @@ -676,12 +676,13 @@ public class BotWeaponGenerator( } /// - /// Get the cartridge ids from a weapon's magazine template that work with the weapon + /// Get the cartridge ids from a weapon's magazine template that work with the weapon /// /// Weapon db template to get magazine cartridges for /// Hashset of cartridge tpls /// Thrown when weaponTemplate is null. - protected HashSet GetCompatibleCartridgesFromMagazineTemplate(TemplateItem weaponTemplate) { + protected HashSet GetCompatibleCartridgesFromMagazineTemplate(TemplateItem weaponTemplate) + { ArgumentNullException.ThrowIfNull(weaponTemplate); // Get the first magazine's template from the weapon @@ -801,8 +802,7 @@ public class BotWeaponGenerator( /// Magazines db template protected void AddOrUpdateMagazinesChildWithAmmo(List weaponWithMods, Item magazine, string chosenAmmoTpl, TemplateItem magazineTemplate) { - var magazineCartridgeChildItem = weaponWithMods.FirstOrDefault( - m => m.ParentId == magazine.Id && m.SlotId == "cartridges" + var magazineCartridgeChildItem = weaponWithMods.FirstOrDefault(m => m.ParentId == magazine.Id && m.SlotId == "cartridges" ); if (magazineCartridgeChildItem is not null) { @@ -824,6 +824,7 @@ public class BotWeaponGenerator( return; } + weaponWithMods.RemoveAt(magazineIndex); // Insert new mag at same index position original was diff --git a/Libraries/SPTarkov.Server.Core/Generators/FenceBaseAssortGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/FenceBaseAssortGenerator.cs index 4a32db6e..1cf7b7fb 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/FenceBaseAssortGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/FenceBaseAssortGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators; @@ -30,7 +30,7 @@ public class FenceBaseAssortGenerator( protected TraderConfig traderConfig = configServer.GetConfig(); /// - /// Create base fence assorts dynamically and store in memory + /// Create base fence assorts dynamically and store in memory /// public void GenerateFenceBaseAssorts() { @@ -201,7 +201,7 @@ public class FenceBaseAssortGenerator( } /// - /// Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit + /// Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit /// /// Ammo box or ammo item from items.db /// True if penetration value is above limit set in config @@ -218,7 +218,7 @@ public class FenceBaseAssortGenerator( } /// - /// Get the penetration power value of an ammo, works with ammo boxes and raw ammos + /// Get the penetration power value of an ammo, works with ammo boxes and raw ammos /// /// Ammo box or ammo item from items.db /// Penetration power of passed in item, undefined if it doesnt have a power @@ -251,7 +251,7 @@ public class FenceBaseAssortGenerator( } /// - /// Add soft inserts + armor plates to an armor + /// Add soft inserts + armor plates to an armor /// /// Armor item array to add mods into /// Armor items db template @@ -337,7 +337,7 @@ public class FenceBaseAssortGenerator( } /// - /// Check if item is valid for being added to fence assorts + /// Check if item is valid for being added to fence assorts /// /// Item to check /// True if valid fence item diff --git a/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs index bf3eab46..edf8f073 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs @@ -1,5 +1,5 @@ -using System.Reflection.Metadata.Ecma335; using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -11,7 +11,6 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -84,8 +83,7 @@ public class LocationLootGenerator( // Remove christmas items from loot data if (!_seasonalEventService.ChristmasEventEnabled()) { - allStaticContainersOnMapClone = allStaticContainersOnMapClone.Where( - item => !_seasonalEventConfig.ChristmasContainerIds.Contains(item.Template.Id) + allStaticContainersOnMapClone = allStaticContainersOnMapClone.Where(item => !_seasonalEventConfig.ChristmasContainerIds.Contains(item.Template.Id) ) .ToList(); } @@ -121,7 +119,7 @@ public class LocationLootGenerator( // Randomisation is turned off globally or just turned off for this map if (!_locationConfig.ContainerRandomisationSettings.Enabled || !_locationConfig.ContainerRandomisationSettings.Maps.ContainsKey(locationId) - ) + ) { if (_logger.IsLogEnabled(LogLevel.Debug)) { @@ -207,8 +205,7 @@ public class LocationLootGenerator( foreach (var chosenContainerId in chosenContainerIds) { // Look up container object from full list of containers on map - var containerObject = staticRandomisableContainersOnMap.FirstOrDefault( - staticContainer => staticContainer.Template.Id == chosenContainerId + var containerObject = staticRandomisableContainersOnMap.FirstOrDefault(staticContainer => staticContainer.Template.Id == chosenContainerId ); if (containerObject is null) { @@ -253,13 +250,12 @@ public class LocationLootGenerator( /// StaticContainerData array protected List GetRandomisableContainersOnMap(List staticContainers) { - return staticContainers.Where( - staticContainer => - staticContainer.Probability != 1 && - !staticContainer.Template.IsAlwaysSpawn.GetValueOrDefault(false) && - !_locationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains( - staticContainer.Template.Items[0].Template - ) + return staticContainers.Where(staticContainer => + staticContainer.Probability != 1 && + !staticContainer.Template.IsAlwaysSpawn.GetValueOrDefault(false) && + !_locationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains( + staticContainer.Template.Items[0].Template + ) ) .ToList(); } @@ -271,13 +267,12 @@ public class LocationLootGenerator( /// IStaticContainerData array protected List GetGuaranteedContainers(List staticContainersOnMap) { - return staticContainersOnMap.Where( - staticContainer => - staticContainer.Probability == 1 || - staticContainer.Template.IsAlwaysSpawn.GetValueOrDefault(false) || - _locationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains( - staticContainer.Template.Items[0].Template - ) + return staticContainersOnMap.Where(staticContainer => + staticContainer.Probability == 1 || + staticContainer.Template.IsAlwaysSpawn.GetValueOrDefault(false) || + _locationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains( + staticContainer.Template.Items[0].Template + ) ) .ToList(); } @@ -519,7 +514,7 @@ public class LocationLootGenerator( } /// - /// Get the height/width of an item including its children + /// Get the height/width of an item including its children /// /// /// @@ -691,12 +686,12 @@ public class LocationLootGenerator( // Remove christmas items from loot data if (!_seasonalEventService.ChristmasEventEnabled()) { - dynamicLootDist.Spawnpoints = dynamicLootDist.Spawnpoints.Where( - point => !point.Template.Id.StartsWith("christmas", StringComparison.OrdinalIgnoreCase) + dynamicLootDist.Spawnpoints = dynamicLootDist.Spawnpoints.Where(point => + !point.Template.Id.StartsWith("christmas", StringComparison.OrdinalIgnoreCase) ) .ToList(); - dynamicLootDist.SpawnpointsForced = dynamicLootDist.SpawnpointsForced.Where( - point => !point.Template.Id.StartsWith("christmas", StringComparison.OrdinalIgnoreCase) + dynamicLootDist.SpawnpointsForced = dynamicLootDist.SpawnpointsForced.Where(point => + !point.Template.Id.StartsWith("christmas", StringComparison.OrdinalIgnoreCase) ) .ToList(); } @@ -809,16 +804,14 @@ public class LocationLootGenerator( } // Ensure no blacklisted lootable items are in pool - spawnPoint.Template.Items = spawnPoint.Template.Items.Where( - item => !_itemFilterService.IsLootableItemBlacklisted(item.Template) + spawnPoint.Template.Items = spawnPoint.Template.Items.Where(item => !_itemFilterService.IsLootableItemBlacklisted(item.Template) ) .ToList(); // Ensure no seasonal items are in pool if not in-season if (!seasonalEventActive) { - spawnPoint.Template.Items = spawnPoint.Template.Items.Where( - item => !seasonalItemTplBlacklist.Contains(item.Template) + spawnPoint.Template.Items = spawnPoint.Template.Items.Where(item => !seasonalItemTplBlacklist.Contains(item.Template) ) .ToList(); } @@ -897,8 +890,7 @@ public class LocationLootGenerator( foreach (var itemTpl in lootToForceSingleAmountOnMap) { // Get all spawn positions for item tpl in forced loot array - var items = forcedSpawnPoints.Where( - forcedSpawnPoint => forcedSpawnPoint.Template.Items[0].Template == itemTpl + var items = forcedSpawnPoints.Where(forcedSpawnPoint => forcedSpawnPoint.Template.Items[0].Template == itemTpl ); if (items is null || !items.Any()) { @@ -975,8 +967,7 @@ public class LocationLootGenerator( forcedLootLocation.Template.Items = createItemResult.Items; // Push forced location into array as long as it doesnt exist already - var existingLocation = lootLocationTemplates.Any( - spawnPoint => spawnPoint.Id == locationTemplateToAdd.Id + var existingLocation = lootLocationTemplates.Any(spawnPoint => spawnPoint.Id == locationTemplateToAdd.Id ); if (!existingLocation) { @@ -993,8 +984,9 @@ public class LocationLootGenerator( } } } + /// - /// Create array of item (with child items) and return + /// Create array of item (with child items) and return /// /// Key we want to look up items for /// Location loot Template diff --git a/Libraries/SPTarkov.Server.Core/Generators/LootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/LootGenerator.cs index 6a1cd9d9..fedcfdc8 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/LootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/LootGenerator.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -10,7 +11,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -50,9 +50,8 @@ public class LootGenerator( { // Get list of all sealed containers from db - they're all the same, just for flavor var itemsDb = _itemHelper.GetItems(); - var sealedWeaponContainerPool = itemsDb.Where( - item => - item.Name.Contains("event_container_airdrop") + var sealedWeaponContainerPool = itemsDb.Where(item => + item.Name.Contains("event_container_airdrop") ); for (var index = 0; index < sealedWeaponCrateCount; index++) @@ -106,9 +105,8 @@ public class LootGenerator( ); if (randomisedWeaponPresetCount > 0) { - var weaponDefaultPresets = globalDefaultPresets.Where( - preset => - _itemHelper.IsOfBaseclass(preset.Encyclopedia, BaseClasses.WEAPON) + var weaponDefaultPresets = globalDefaultPresets.Where(preset => + _itemHelper.IsOfBaseclass(preset.Encyclopedia, BaseClasses.WEAPON) ) .ToList(); @@ -139,13 +137,11 @@ public class LootGenerator( ); if (randomisedArmorPresetCount > 0) { - var armorDefaultPresets = globalDefaultPresets.Where( - preset => - _itemHelper.ArmorItemCanHoldMods(preset.Encyclopedia) + var armorDefaultPresets = globalDefaultPresets.Where(preset => + _itemHelper.ArmorItemCanHoldMods(preset.Encyclopedia) ); - var levelFilteredArmorPresets = armorDefaultPresets.Where( - armor => - IsArmorOfDesiredProtectionLevel(armor, options) + var levelFilteredArmorPresets = armorDefaultPresets.Where(armor => + IsArmorOfDesiredProtectionLevel(armor, options) ) .ToList(); @@ -252,12 +248,11 @@ public class LootGenerator( itemBlacklist.UnionWith(_seasonalEventService.GetInactiveSeasonalEventItems()); } - var items = itemsDb.Where( - item => - !itemBlacklist.Contains(item.Id) && - string.Equals(item.Type, "item", StringComparison.OrdinalIgnoreCase) && - !item.Properties.QuestItem.GetValueOrDefault(false) && - itemTypeWhitelist.Contains(item.Parent) + var items = itemsDb.Where(item => + !itemBlacklist.Contains(item.Id) && + string.Equals(item.Type, "item", StringComparison.OrdinalIgnoreCase) && + !item.Properties.QuestItem.GetValueOrDefault(false) && + itemTypeWhitelist.Contains(item.Parent) ) .ToList(); @@ -487,7 +482,7 @@ public class LootGenerator( List> itemsToReturn = []; // Choose a weapon to give to the player (weighted) - var chosenWeaponTpl = _weightedRandomHelper.GetWeightedValue( + var chosenWeaponTpl = _weightedRandomHelper.GetWeightedValue( containerSettings.WeaponRewardWeight ); @@ -558,8 +553,7 @@ public class LootGenerator( if (rewardKey == BaseClasses.AMMO_BOX) { // Get ammo boxes from db - var ammoBoxesDetails = containerSettings.AmmoBoxWhitelist.Select( - tpl => + var ammoBoxesDetails = containerSettings.AmmoBoxWhitelist.Select(tpl => { var itemDetails = _itemHelper.GetItem(tpl); return itemDetails.Value; @@ -568,9 +562,8 @@ public class LootGenerator( // Need to find boxes that matches weapons caliber var weaponCaliber = weaponDetailsDb.Properties.AmmoCaliber; - var ammoBoxesMatchingCaliber = ammoBoxesDetails.Where( - x => - x.Properties.AmmoCaliber == weaponCaliber + var ammoBoxesMatchingCaliber = ammoBoxesDetails.Where(x => + x.Properties.AmmoCaliber == weaponCaliber ); if (!ammoBoxesMatchingCaliber.Any()) { @@ -602,13 +595,12 @@ public class LootGenerator( // Get all items of the desired type + not quest items + not globally blacklisted var rewardItemPool = _databaseService.GetItems() - .Values.Where( - item => - item.Parent == rewardKey && - string.Equals(item.Type, "item", StringComparison.OrdinalIgnoreCase) && - _itemFilterService.IsItemBlacklisted(item.Id) && - !(containerSettings.AllowBossItems || _itemFilterService.IsBossItem(item.Id)) && - item.Properties.QuestItem is null + .Values.Where(item => + item.Parent == rewardKey && + string.Equals(item.Type, "item", StringComparison.OrdinalIgnoreCase) && + _itemFilterService.IsItemBlacklisted(item.Id) && + !(containerSettings.AllowBossItems || _itemFilterService.IsBossItem(item.Id)) && + item.Properties.QuestItem is null ); if (!rewardItemPool.Any()) @@ -664,8 +656,7 @@ public class LootGenerator( } // Get items that fulfil reward type criteria from items that fit on gun - var relatedItems = linkedItemsToWeapon?.Where( - item => item?.Parent == rewardKey && !_itemFilterService.IsItemBlacklisted(item.Id) + var relatedItems = linkedItemsToWeapon?.Where(item => item?.Parent == rewardKey && !_itemFilterService.IsItemBlacklisted(item.Id) ); if (relatedItems is null || !relatedItems.Any()) { @@ -719,7 +710,7 @@ public class LootGenerator( var preset = _presetHelper.GetDefaultPreset(chosenRewardItemTpl); // Ensure preset has unique ids and is cloned so we don't alter the preset data stored in memory - List presetAndMods = _itemHelper.ReplaceIDs(preset.Items); + var presetAndMods = _itemHelper.ReplaceIDs(preset.Items); _itemHelper.RemapRootItemId(presetAndMods); itemsToReturn.Add(presetAndMods); @@ -755,8 +746,7 @@ public class LootGenerator( return _randomUtil.GetArrayValue( GetItemRewardPool([], rewardContainerDetails.RewardTypePool, true, true, false) - .ItemPool.Select( - item => item.Id + .ItemPool.Select(item => item.Id ) ); } diff --git a/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs index c1c31e14..fe4112a4 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs @@ -1,4 +1,5 @@ using System.Collections.Concurrent; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -6,7 +7,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators; @@ -63,19 +63,19 @@ public class PMCLootGenerator _pocketLootPool = new ConcurrentDictionary(); var items = _databaseService.GetItems(); var pmcPriceOverrides = - _databaseService.GetBots().Types[string.Equals(botRole, "pmcbear", StringComparison.OrdinalIgnoreCase) ? "bear" : "usec"].BotInventory.Items.Pockets; + _databaseService.GetBots().Types[string.Equals(botRole, "pmcbear", StringComparison.OrdinalIgnoreCase) ? "bear" : "usec"].BotInventory.Items + .Pockets; var allowedItemTypeWhitelist = _pmcConfig.PocketLoot.Whitelist; var blacklist = GetLootBlacklist(); - var itemsToAdd = items.Where( - item => - allowedItemTypeWhitelist.Contains(item.Value.Parent) && - _itemHelper.IsValidItem(item.Value.Id) && - !blacklist.Contains(item.Value.Id) && - !blacklist.Contains(item.Value.Parent) && - ItemFitsInto1By2Slot(item.Value) + var itemsToAdd = items.Where(item => + allowedItemTypeWhitelist.Contains(item.Value.Parent) && + _itemHelper.IsValidItem(item.Value.Id) && + !blacklist.Contains(item.Value.Id) && + !blacklist.Contains(item.Value.Parent) && + ItemFitsInto1By2Slot(item.Value) ).Select(x => x.Key); foreach (var tpl in itemsToAdd) @@ -132,19 +132,19 @@ public class PMCLootGenerator _vestLootPool = new ConcurrentDictionary(); var items = _databaseService.GetItems(); var pmcPriceOverrides = - _databaseService.GetBots().Types[string.Equals(botRole, "pmcbear", StringComparison.OrdinalIgnoreCase) ? "bear" : "usec"].BotInventory.Items.TacticalVest; + _databaseService.GetBots().Types[string.Equals(botRole, "pmcbear", StringComparison.OrdinalIgnoreCase) ? "bear" : "usec"].BotInventory.Items + .TacticalVest; var allowedItemTypeWhitelist = _pmcConfig.VestLoot.Whitelist; var blacklist = GetLootBlacklist(); - var itemsToAdd = items.Where( - item => - allowedItemTypeWhitelist.Contains(item.Value.Parent) && - _itemHelper.IsValidItem(item.Value.Id) && - !blacklist.Contains(item.Value.Id) && - !blacklist.Contains(item.Value.Parent) && - ItemFitsInto2By2Slot(item.Value) + var itemsToAdd = items.Where(item => + allowedItemTypeWhitelist.Contains(item.Value.Parent) && + _itemHelper.IsValidItem(item.Value.Id) && + !blacklist.Contains(item.Value.Id) && + !blacklist.Contains(item.Value.Parent) && + ItemFitsInto2By2Slot(item.Value) ).Select(x => x.Key); foreach (var tpl in itemsToAdd) @@ -215,18 +215,18 @@ public class PMCLootGenerator _backpackLootPool = new ConcurrentDictionary(); var items = _databaseService.GetItems(); var pmcPriceOverrides = - _databaseService.GetBots().Types[string.Equals(botRole, "pmcbear", StringComparison.OrdinalIgnoreCase) ? "bear" : "usec"].BotInventory.Items.Backpack; + _databaseService.GetBots().Types[string.Equals(botRole, "pmcbear", StringComparison.OrdinalIgnoreCase) ? "bear" : "usec"].BotInventory.Items + .Backpack; var allowedItemTypeWhitelist = _pmcConfig.BackpackLoot.Whitelist; var blacklist = GetLootBlacklist(); - var itemsToAdd = items.Where( - item => - allowedItemTypeWhitelist.Contains(item.Value.Parent) && - _itemHelper.IsValidItem(item.Value.Id) && - !blacklist.Contains(item.Value.Id) && - !blacklist.Contains(item.Value.Parent) + var itemsToAdd = items.Where(item => + allowedItemTypeWhitelist.Contains(item.Value.Parent) && + _itemHelper.IsValidItem(item.Value.Id) && + !blacklist.Contains(item.Value.Id) && + !blacklist.Contains(item.Value.Parent) ).Select(x => x.Key); foreach (var tpl in itemsToAdd) diff --git a/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs index 186c0e65..11cd35fd 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/PlayerScavGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -10,7 +11,6 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Json; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; diff --git a/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs index 71ac47fd..c64c9e0b 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs @@ -1,81 +1,88 @@ -using SPTarkov.Server.Core.Models.Eft.Common; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -namespace SPTarkov.Server.Core.Generators +namespace SPTarkov.Server.Core.Generators; + +[Injectable] +public class PmcWaveGenerator { - [Injectable] - public class PmcWaveGenerator + protected ConfigServer _configServer; + protected DatabaseService _databaseService; + protected ISptLogger _logger; + protected PmcConfig _pmcConfig; + protected RandomUtil _randomUtil; + + public PmcWaveGenerator( + ISptLogger _logger, + RandomUtil _randomUtil, + DatabaseService _databaseService, + ConfigServer _configServer + ) { - protected ISptLogger _logger; - protected RandomUtil _randomUtil; - protected DatabaseService _databaseService; - protected ConfigServer _configServer; - protected PmcConfig _pmcConfig; + this._logger = _logger; + this._randomUtil = _randomUtil; + this._databaseService = _databaseService; + this._configServer = _configServer; + _pmcConfig = _configServer.GetConfig(); + } - public PmcWaveGenerator( - ISptLogger _logger, - RandomUtil _randomUtil, - DatabaseService _databaseService, - ConfigServer _configServer - ) + /// + /// Add a pmc wave to a map + /// + /// e.g. factory4_day, bigmap + /// Boss wave to add to map + public void AddPmcWaveToLocation(string locationId, BossLocationSpawn waveToAdd) + { + _pmcConfig.CustomPmcWaves[locationId].Add(waveToAdd); + } + + /// + /// Add custom boss and normal waves to all maps found in config/location.json to db + /// + public void ApplyWaveChangesToAllMaps() + { + foreach (var location in _pmcConfig.CustomPmcWaves) { - this._logger = _logger; - this._randomUtil = _randomUtil; - this._databaseService = _databaseService; - this._configServer = _configServer; - _pmcConfig = _configServer.GetConfig(); - } - /// - /// Add a pmc wave to a map - /// - /// e.g. factory4_day, bigmap - /// Boss wave to add to map - public void AddPmcWaveToLocation(string locationId, BossLocationSpawn waveToAdd) - { - _pmcConfig.CustomPmcWaves[locationId].Add(waveToAdd); - } - - /// - /// Add custom boss and normal waves to all maps found in config/location.json to db - /// - public void ApplyWaveChangesToAllMaps() { - foreach (var location in _pmcConfig.CustomPmcWaves) { - ApplyWaveChangesToMapByName(location.Key); - } - } - - /// - /// Add custom boss and normal waves to a map found in config/location.json to db by name - /// - /// e.g. factory4_day, bigmap - public void ApplyWaveChangesToMapByName(string name) { - if (!_pmcConfig.CustomPmcWaves.TryGetValue(name, out var pmcWavesToAdd)) { - return; - } - - var location = _databaseService.GetLocation(name); - if (location is null) { - return; - } - - location.Base.BossLocationSpawn.AddRange(pmcWavesToAdd); - } - /// - /// Add custom boss and normal waves to a map found in config/location.json to db by LocationBase - /// - /// Location Object - public void ApplyWaveChangesToMap(LocationBase location) { - if (!_pmcConfig.CustomPmcWaves.TryGetValue(location.Id.ToLower(), out var pmcWavesToAdd)) - { - return; - } - - location.BossLocationSpawn.AddRange(pmcWavesToAdd); + ApplyWaveChangesToMapByName(location.Key); } } + + /// + /// Add custom boss and normal waves to a map found in config/location.json to db by name + /// + /// e.g. factory4_day, bigmap + public void ApplyWaveChangesToMapByName(string name) + { + if (!_pmcConfig.CustomPmcWaves.TryGetValue(name, out var pmcWavesToAdd)) + { + return; + } + + var location = _databaseService.GetLocation(name); + if (location is null) + { + return; + } + + location.Base.BossLocationSpawn.AddRange(pmcWavesToAdd); + } + + /// + /// Add custom boss and normal waves to a map found in config/location.json to db by LocationBase + /// + /// Location Object + public void ApplyWaveChangesToMap(LocationBase location) + { + if (!_pmcConfig.CustomPmcWaves.TryGetValue(location.Id.ToLower(), out var pmcWavesToAdd)) + { + return; + } + + location.BossLocationSpawn.AddRange(pmcWavesToAdd); + } } diff --git a/Libraries/SPTarkov.Server.Core/Generators/RagfairAssortGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RagfairAssortGenerator.cs index b9c90249..889a7621 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RagfairAssortGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RagfairAssortGenerator.cs @@ -1,4 +1,5 @@ -using SPTarkov.Server.Core.Helpers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators; @@ -36,8 +36,8 @@ public class RagfairAssortGenerator( ]; /// - /// Get a list of lists that can be sold on the flea.
- /// Each sub list contains item + children (if any) + /// Get a list of lists that can be sold on the flea.
+ /// Each sub list contains item + children (if any) ///
/// List with children lists of items public List> GetAssortItems() @@ -51,7 +51,7 @@ public class RagfairAssortGenerator( } /// - /// Check if internal generatedAssortItems list has objects + /// Check if internal generatedAssortItems list has objects /// /// True if array has objects protected bool AssortsAreGenerated() @@ -60,7 +60,7 @@ public class RagfairAssortGenerator( } /// - /// Generate a list of lists (item + children) the flea can sell + /// Generate a list of lists (item + children) the flea can sell /// /// List of lists (item + children) protected List> GenerateRagfairAssortItems() @@ -132,8 +132,8 @@ public class RagfairAssortGenerator( } /// - /// Get presets from globals to add to flea.
- /// ragfairConfig.dynamic.showDefaultPresetsOnly decides if it's all presets or just defaults + /// Get presets from globals to add to flea.
+ /// ragfairConfig.dynamic.showDefaultPresetsOnly decides if it's all presets or just defaults ///
/// List of Preset protected List GetPresetsToAdd() @@ -144,7 +144,7 @@ public class RagfairAssortGenerator( } /// - /// Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + /// Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true /// /// tplid to add to item /// id to add to item diff --git a/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs index f1ecad9e..3d4b2825 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs @@ -1,4 +1,6 @@ using System.Diagnostics; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Ragfair; @@ -10,8 +12,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -44,10 +44,11 @@ public class RagfairOfferGenerator( /// Internal counter to ensure each offer created has a unique value for its intId property protected int offerCounter; + protected RagfairConfig ragfairConfig = configServer.GetConfig(); /// - /// Create a flea offer and store it in the Ragfair server offers array + /// Create a flea offer and store it in the Ragfair server offers array /// /// Owner of the offer /// Time offer is listed at @@ -74,7 +75,7 @@ public class RagfairOfferGenerator( } /// - /// Create an offer object ready to send to ragfairOfferService.addOffer() + /// Create an offer object ready to send to ragfairOfferService.addOffer() /// /// Owner of the offer /// Timestamp offer is listed at @@ -94,8 +95,7 @@ public class RagfairOfferGenerator( bool isPackOffer = false ) { - var offerRequirements = barterScheme.Select( - barter => + var offerRequirements = barterScheme.Select(barter => { var offerRequirement = new OfferRequirement { @@ -155,7 +155,7 @@ public class RagfairOfferGenerator( } /// - /// Create the user object stored inside each flea offer object + /// Create the user object stored inside each flea offer object /// /// User creating the offer /// Is the user creating the offer a trader @@ -206,7 +206,7 @@ public class RagfairOfferGenerator( } /// - /// Calculate the offer price that's listed on the flea listing + /// Calculate the offer price that's listed on the flea listing /// /// barter requirements for offer /// rouble cost of offer @@ -215,16 +215,16 @@ public class RagfairOfferGenerator( var roublePrice = 0d; foreach (var requirement in offerRequirements) { - roublePrice += (paymentHelper.IsMoneyTpl(requirement.Template) + roublePrice += paymentHelper.IsMoneyTpl(requirement.Template) ? Math.Round(CalculateRoublePrice(requirement.Count.Value, requirement.Template)) - : ragfairPriceService.GetFleaPriceForItem(requirement.Template) * requirement.Count.Value); // Get flea price for barter offer items + : ragfairPriceService.GetFleaPriceForItem(requirement.Template) * requirement.Count.Value; // Get flea price for barter offer items } return roublePrice; } /// - /// Get avatar url from trader table in db + /// Get avatar url from trader table in db /// /// Is user we're getting avatar for a trader /// Persons id to get avatar of @@ -240,7 +240,7 @@ public class RagfairOfferGenerator( } /// - /// Convert a count of currency into roubles + /// Convert a count of currency into roubles /// /// Amount of currency to convert into roubles /// Type of currency (euro/dollar/rouble) @@ -256,7 +256,7 @@ public class RagfairOfferGenerator( } /// - /// Check userId, if it's a player, return their pmc _id, otherwise return userId parameter + /// Check userId, if it's a player, return their pmc _id, otherwise return userId parameter /// /// Users ID to check /// Users ID @@ -271,7 +271,7 @@ public class RagfairOfferGenerator( } /// - /// Get a flea trading rating for the passed in user + /// Get a flea trading rating for the passed in user /// /// User to get flea rating of /// Flea rating value @@ -290,11 +290,11 @@ public class RagfairOfferGenerator( } // Generated pmc offer - return randomUtil.GetDouble((double) ragfairConfig.Dynamic.Rating.Min, (double) ragfairConfig.Dynamic.Rating.Max); + return randomUtil.GetDouble(ragfairConfig.Dynamic.Rating.Min, ragfairConfig.Dynamic.Rating.Max); } /// - /// Is the offers user rating growing + /// Is the offers user rating growing /// /// User to check rating of /// True if growing @@ -318,7 +318,7 @@ public class RagfairOfferGenerator( } /// - /// Get number of section until offer should expire + /// Get number of section until offer should expire /// /// ID of the offer owner /// Time the offer is posted in seconds @@ -345,7 +345,7 @@ public class RagfairOfferGenerator( } /// - /// Create multiple offers for items by using a unique list of items we've generated previously + /// Create multiple offers for items by using a unique list of items we've generated previously /// /// Optional, expired offers to regenerate public void GenerateDynamicOffers(List>? expiredOffers = null) @@ -368,8 +368,7 @@ public class RagfairOfferGenerator( foreach (var assortItem in assortItemsToProcess) { tasks.Add( - Task.Factory.StartNew( - () => + Task.Factory.StartNew(() => { CreateOffersFromAssort(assortItem, replacingExpiredOffers, ragfairConfig.Dynamic); } @@ -386,7 +385,7 @@ public class RagfairOfferGenerator( } /// - /// Generates offers from an item and it's children on the flea market + /// Generates offers from an item and it's children on the flea market /// /// Item with its children to process into offers /// Is an expired offer @@ -439,7 +438,7 @@ public class RagfairOfferGenerator( } /// - /// Iterate over an items children and look for plates above desired level and remove them + /// Iterate over an items children and look for plates above desired level and remove them /// /// Preset to check for plates /// Settings @@ -483,7 +482,7 @@ public class RagfairOfferGenerator( } /// - /// Create one flea offer for a specific item + /// Create one flea offer for a specific item /// /// ID of seller /// Item to create offer for @@ -523,9 +522,8 @@ public class RagfairOfferGenerator( var shouldRemovePlates = randomUtil.GetChance100(armorConfig.RemoveRemovablePlateChance); if (shouldRemovePlates && itemHelper.ArmorItemHasRemovablePlateSlots(itemWithChildren[0].Template)) { - var offerItemPlatesToRemove = itemWithChildren.Where( - item => - armorConfig.PlateSlotIdToRemovePool.Contains(item.SlotId?.ToLower()) + var offerItemPlatesToRemove = itemWithChildren.Where(item => + armorConfig.PlateSlotIdToRemovePool.Contains(item.SlotId?.ToLower()) ); // Latest first, to ensure we don't move later items off by 1 each time we remove an item below it @@ -579,7 +577,7 @@ public class RagfairOfferGenerator( } /// - /// Generate trader offers on flea using the traders assort data + /// Generate trader offers on flea using the traders assort data /// /// Trader to generate offers for public void GenerateFleaOffersForTrader(string traderID) @@ -656,7 +654,7 @@ public class RagfairOfferGenerator( var barterSchemeItems = barterScheme[0]; var loyalLevel = assortsClone.LoyalLevelItems[item.Id]; - var offer = CreateAndAddFleaOffer(traderID, time, items, barterSchemeItems, loyalLevel, (int?)item.Upd.StackObjectsCount ?? 1); + var offer = CreateAndAddFleaOffer(traderID, time, items, barterSchemeItems, loyalLevel, (int?) item.Upd.StackObjectsCount ?? 1); // Refresh complete, reset flag to false trader.Base.RefreshTraderRagfairOffers = false; @@ -664,8 +662,8 @@ public class RagfairOfferGenerator( } /// - /// Get array of an item with its mods + condition properties (e.g. durability)
- /// Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition + /// Get array of an item with its mods + condition properties (e.g. durability)
+ /// Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition ///
/// ID of owner of item /// Item and mods, get condition of first item (only first array item is modified) @@ -693,7 +691,7 @@ public class RagfairOfferGenerator( } /// - /// Get the relevant condition id if item tpl matches in ragfair.json/condition + /// Get the relevant condition id if item tpl matches in ragfair.json/condition /// /// Item to look for matching condition object /// Condition ID @@ -713,7 +711,7 @@ public class RagfairOfferGenerator( } /// - /// Alter an items condition based on its item base type + /// Alter an items condition based on its item base type /// /// Also the parentID of item being altered /// Item to adjust condition details of @@ -727,10 +725,10 @@ public class RagfairOfferGenerator( var rootItem = itemWithMods[0]; var itemConditionValues = ragfairConfig.Dynamic.Condition[conditionSettingsId]; - var maxMultiplier = randomUtil.GetDouble((double) itemConditionValues.Max.Min, (double) itemConditionValues.Max.Min); + var maxMultiplier = randomUtil.GetDouble(itemConditionValues.Max.Min, itemConditionValues.Max.Min); var currentMultiplier = randomUtil.GetDouble( - (double) itemConditionValues.Current.Min, - (double) itemConditionValues.Current.Max + itemConditionValues.Current.Min, + itemConditionValues.Current.Max ); // Randomise armor + plates + armor related things @@ -808,8 +806,8 @@ public class RagfairOfferGenerator( } } - /// - /// Adjust an items durability/maxDurability value + /// + /// Adjust an items durability/maxDurability value /// /// Item (weapon/armor) to adjust /// Item details from DB @@ -836,7 +834,7 @@ public class RagfairOfferGenerator( } /// - /// Randomise the durability values for an armors plates and soft inserts + /// Randomise the durability values for an armors plates and soft inserts /// /// Armor item with its child mods /// Chosen multiplier to use for current durability value @@ -871,9 +869,9 @@ public class RagfairOfferGenerator( } /// - /// Add missing conditions to an item if needed.
- /// Durabiltiy for repairable items.
- /// HpResource for medical items. + /// Add missing conditions to an item if needed.
+ /// Durabiltiy for repairable items.
+ /// HpResource for medical items. ///
/// Item to add conditions to protected void AddMissingConditions(Item item) @@ -937,7 +935,7 @@ public class RagfairOfferGenerator( } /// - /// Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + /// Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based /// /// Items for sale in offer /// Barter config from ragfairConfig.Dynamic.barter @@ -967,13 +965,12 @@ public class RagfairOfferGenerator( var offerCostVarianceRoubles = desiredItemCostRouble * barterConfig.PriceRangeVariancePercent / 100; // Dict of items and their flea price (cached on first use) - List itemFleaPrices = GetFleaPricesAsArray(); + var itemFleaPrices = GetFleaPricesAsArray(); // Filter possible barters to items that match the price range + not itself var min = desiredItemCostRouble - offerCostVarianceRoubles; var max = desiredItemCostRouble + offerCostVarianceRoubles; - var itemsInsidePriceBounds = itemFleaPrices.Where( - itemAndPrice => + var itemsInsidePriceBounds = itemFleaPrices.Where(itemAndPrice => itemAndPrice.Price >= min && itemAndPrice.Price <= max && !string.Equals(itemAndPrice.Tpl, offerItems[0].Template, @@ -1001,7 +998,7 @@ public class RagfairOfferGenerator( } /// - /// Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` + /// Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` /// /// List with tpl/price values protected List GetFleaPricesAsArray() @@ -1013,8 +1010,7 @@ public class RagfairOfferGenerator( // Only get prices for items that also exist in items.json var filteredFleaItems = fleaPrices - .Select( - kvTpl => new TplWithFleaPrice + .Select(kvTpl => new TplWithFleaPrice { Tpl = kvTpl.Key, Price = kvTpl.Value @@ -1030,7 +1026,7 @@ public class RagfairOfferGenerator( } /// - /// Create a random currency-based barter scheme for an array of items + /// Create a random currency-based barter scheme for an array of items /// /// Items on offer /// Is the barter scheme being created for a pack offer diff --git a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs index 926d7b1b..c83015b9 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -11,7 +12,6 @@ using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; using SPTarkov.Server.Core.Utils.Json; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators; @@ -236,8 +236,7 @@ public class RepeatableQuestGenerator( .GetDictionary() .Select(x => x.Value) .Where(x => x.Base?.Id != null) - .Select( - x => new + .Select(x => new { x.Base.Id, BossSpawn = x.Base.BossLocationSpawn @@ -245,8 +244,7 @@ public class RepeatableQuestGenerator( ); // filter for the current boss to spawn on map var thisBossSpawns = bossSpawns - .Select( - x => new + .Select(x => new { x.Id, BossSpawn = x.BossSpawn @@ -283,9 +281,8 @@ public class RepeatableQuestGenerator( List weaponTypeBlacklist = ["Shotgun", "Pistol"]; weaponCategoryRequirementConfig = (ProbabilityObjectArray>) weaponCategoryRequirementConfig - .Where( - category => weaponTypeBlacklist - .Contains(category.Key) + .Where(category => weaponTypeBlacklist + .Contains(category.Key) ); } else if (distance < 20) @@ -294,9 +291,8 @@ public class RepeatableQuestGenerator( // Filter out far range weapons from close distance requirement weaponCategoryRequirementConfig = (ProbabilityObjectArray>) weaponCategoryRequirementConfig - .Where( - category => weaponTypeBlacklist - .Contains(category.Key) + .Where(category => weaponTypeBlacklist + .Contains(category.Key) ); } @@ -383,7 +379,7 @@ public class RepeatableQuestGenerator( } /// - /// Get a number of kills needed to complete elimination quest + /// Get a number of kills needed to complete elimination quest /// /// Target type desired e.g. anyPmc/bossBully/Savage /// Config of the target @@ -541,8 +537,7 @@ public class RepeatableQuestGenerator( (double) (_mathUtil.Interp1(pmcLevel, levelsConfig, roublesConfig) * multi) ); roublesBudget = Math.Max(roublesBudget, 5000d); - var itemSelection = possibleItemsToRetrievePool.Where( - x => _itemHelper.GetItemPrice(x.Id) < roublesBudget + var itemSelection = possibleItemsToRetrievePool.Where(x => _itemHelper.GetItemPrice(x.Id) < roublesBudget ) .ToList(); @@ -557,8 +552,7 @@ public class RepeatableQuestGenerator( .Where(p => p.MinPlayerLevel <= pmcLevel) .SelectMany(x => x.ItemIds) .ToHashSet(); //.Aggregate((a, p) => a.Concat(p.ItemIds), []); - itemSelection = itemSelection.Where( - x => + itemSelection = itemSelection.Where(x => { // Whitelist can contain item tpls and item base type ids return itemIdsWhitelisted.Any(v => _itemHelper.IsOfBaseclass(x.Id, v)) || @@ -581,8 +575,7 @@ public class RepeatableQuestGenerator( .SelectMany(x => x.ItemIds) .ToHashSet(); //.Aggregate(List , (a, p) => a.Concat(p.ItemIds) ); - itemSelection = itemSelection.Where( - x => + itemSelection = itemSelection.Where(x => { return itemIdsBlacklisted.All(v => !_itemHelper.IsOfBaseclass(x.Id, v)) || !itemIdsBlacklisted.Contains(x.Id); @@ -831,12 +824,11 @@ public class RepeatableQuestGenerator( var exitPool = mapExits.Where(exit => exit.Chance > 0).ToList(); // Exclude exits with a requirement to leave (e.g. car extracts) - var possibleExits = exitPool.Where( - exit => - exit.PassageRequirement is not null || - repeatableConfig.QuestConfig.Exploration.SpecificExits.PassageRequirementWhitelist.Contains( - "PassageRequirement" - ) + var possibleExits = exitPool.Where(exit => + exit.PassageRequirement is not null || + repeatableConfig.QuestConfig.Exploration.SpecificExits.PassageRequirementWhitelist.Contains( + "PassageRequirement" + ) ) .ToList(); @@ -906,14 +898,12 @@ public class RepeatableQuestGenerator( findCondition.Target = new ListOrT([itemTypeToFetchWithCount.ItemType], null); findCondition.Value = itemCountToFetch; - var counterCreatorCondition = quest.Conditions.AvailableForFinish.FirstOrDefault( - x => x.ConditionType == "CounterCreator" + var counterCreatorCondition = quest.Conditions.AvailableForFinish.FirstOrDefault(x => x.ConditionType == "CounterCreator" ); // var locationCondition = counterCreatorCondition._props.counter.conditions.find(x => x._parent === "Location"); // (locationCondition._props as ILocationConditionProps).target = [...locationTarget]; - var equipmentCondition = counterCreatorCondition.Counter.Conditions.FirstOrDefault( - x => x.ConditionType == "Equipment" + var equipmentCondition = counterCreatorCondition.Counter.Conditions.FirstOrDefault(x => x.ConditionType == "Equipment" ); equipmentCondition.EquipmentInclusive = [[itemTypeToFetchWithCount.ItemType]]; diff --git a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestRewardGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestRewardGenerator.cs index 0b402152..11013e07 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestRewardGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestRewardGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -10,7 +11,6 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators; @@ -35,21 +35,21 @@ public class RepeatableQuestRewardGenerator( protected QuestConfig _questConfig = _configServer.GetConfig(); /// - /// Generate the reward for a mission. A reward can consist of:
- /// - Experience
- /// - Money
- /// - GP coins
- /// - Weapon preset
- /// - Items
- /// - Trader Reputation
- /// - Skill level experience
- ///
- /// The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to
- /// experience / money / items / trader reputation can be defined in QuestConfig.js
- ///
- /// There's also a random variation of the reward the spread of which can be also defined in the config
- ///
- /// Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used + /// Generate the reward for a mission. A reward can consist of:
+ /// - Experience
+ /// - Money
+ /// - GP coins
+ /// - Weapon preset
+ /// - Items
+ /// - Trader Reputation
+ /// - Skill level experience
+ ///
+ /// The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to
+ /// experience / money / items / trader reputation can be defined in QuestConfig.js
+ ///
+ /// There's also a random variation of the reward the spread of which can be also defined in the config
+ ///
+ /// Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used ///
/// Level of player reward is being generated for /// Reward scaling factor from 0.2 to 1 @@ -110,8 +110,7 @@ public class RepeatableQuestRewardGenerator( rewardIndex++; // Add preset weapon to reward if checks pass - var traderWhitelistDetails = repeatableConfig.TraderWhitelist.FirstOrDefault( - traderWhitelist => traderWhitelist.TraderId == traderId + var traderWhitelistDetails = repeatableConfig.TraderWhitelist.FirstOrDefault(traderWhitelist => traderWhitelist.TraderId == traderId ); if (traderWhitelistDetails?.RewardCanBeWeapon ?? (false && _randomUtil.GetChance100(traderWhitelistDetails.WeaponRewardChancePercent ?? 0)) @@ -132,8 +131,7 @@ public class RepeatableQuestRewardGenerator( if (rewardTplBlacklist is not null) { // Filter reward pool of items from blacklist, only use if there's at least 1 item remaining - var filteredRewardItemPool = inBudgetRewardItemPool.Where( - item => !rewardTplBlacklist.Contains(item.Id) + var filteredRewardItemPool = inBudgetRewardItemPool.Where(item => !rewardTplBlacklist.Contains(item.Id) ); if (filteredRewardItemPool.Count() > 0) { @@ -319,7 +317,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Get an array of items + stack size to give to player as reward that fit inside a rouble budget. + /// Get an array of items + stack size to give to player as reward that fit inside a rouble budget. /// /// All possible items to choose rewards from /// Total number of items to reward @@ -405,8 +403,8 @@ public class RepeatableQuestRewardGenerator( } /// - /// Get a count of cartridges that fits the rouble budget amount provided.
- /// e.g. how many M80s for 50,000 roubles. + /// Get a count of cartridges that fits the rouble budget amount provided.
+ /// e.g. how many M80s for 50,000 roubles. ///
/// Cartridge template /// Rouble budget @@ -449,7 +447,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Get a randomised number a reward items stack size should be based on its handbook price + /// Get a randomised number a reward items stack size should be based on its handbook price /// /// Reward item to get stack size for /// Matching stack size for the passed in items price @@ -476,7 +474,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Select a number of items that have a collective value of the passed in parameter + /// Select a number of items that have a collective value of the passed in parameter /// /// Config /// Total value of items to return @@ -518,7 +516,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Filters a list of reward Items within a budget. + /// Filters a list of reward Items within a budget. /// /// List of reward items to filter /// The budget remaining for rewards @@ -527,8 +525,7 @@ public class RepeatableQuestRewardGenerator( protected List FilterRewardPoolWithinBudget(List rewardItems, double roublesBudget, double minPrice) { - return rewardItems.Where( - item => + return rewardItems.Where(item => { var itemPrice = _presetHelper.GetDefaultPresetOrItemPrice(item.Id); return itemPrice < roublesBudget && itemPrice > minPrice; @@ -538,7 +535,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Choose a random Weapon preset that fits inside a rouble amount limit + /// Choose a random Weapon preset that fits inside a rouble amount limit /// /// Budget in roubles /// Index of the reward @@ -581,7 +578,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Helper to create a reward item structured as required by the client + /// Helper to create a reward item structured as required by the client /// /// ItemId of the rewarded item /// Amount of items to give @@ -626,7 +623,7 @@ public class RepeatableQuestRewardGenerator( } /// - /// Helper to create a reward item structured as required by the client + /// Helper to create a reward item structured as required by the client /// /// ItemId of the rewarded item /// Amount of items to give @@ -682,11 +679,11 @@ public class RepeatableQuestRewardGenerator( /// - /// Picks rewardable items from items.json
- /// This means they must:
- /// - Fit into the inventory
- /// - Shouldn't be keys
- /// - Have a price greater than 0 + /// Picks rewardable items from items.json
+ /// This means they must:
+ /// - Fit into the inventory
+ /// - Shouldn't be keys
+ /// - Have a price greater than 0 ///
/// Config /// ID of trader who will give reward to player @@ -700,8 +697,7 @@ public class RepeatableQuestRewardGenerator( // also check if the price is greater than 0; there are some items whose price can not be found // those are not in the game yet (e.g. AGS grenade launcher) return _databaseService.GetItems() - .Values.Where( - itemTemplate => + .Values.Where(itemTemplate => { // Base "Item" item has no parent, ignore it if (itemTemplate.Parent == "") @@ -714,8 +710,7 @@ public class RepeatableQuestRewardGenerator( return false; } - var traderWhitelist = repeatableQuestConfig.TraderWhitelist.FirstOrDefault( - trader => trader.TraderId == traderId + var traderWhitelist = repeatableQuestConfig.TraderWhitelist.FirstOrDefault(trader => trader.TraderId == traderId ); return IsValidRewardItem( @@ -729,8 +724,8 @@ public class RepeatableQuestRewardGenerator( } /// - /// Checks if an id is a valid item. Valid meaning that it's an item that may be a reward - /// or content of bot loot. Items that are tested as valid may be in a player backpack or stash. + /// Checks if an id is a valid item. Valid meaning that it's an item that may be a reward + /// or content of bot loot. Items that are tested as valid may be in a player backpack or stash. /// /// Template id of item to check /// Config diff --git a/Libraries/SPTarkov.Server.Core/Generators/ScavCaseRewardGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/ScavCaseRewardGenerator.cs index 8432e10b..d6de7493 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/ScavCaseRewardGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/ScavCaseRewardGenerator.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -10,8 +12,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Generators; @@ -97,8 +97,7 @@ public class ScavCaseRewardGenerator( if (!_dbItemsCache.Any()) { _dbItemsCache = _databaseService.GetItems() - .Values.Where( - item => + .Values.Where(item => { // Base "Item" item has no parent, ignore it if (item.Parent == "") @@ -157,8 +156,7 @@ public class ScavCaseRewardGenerator( if (!_dbAmmoItemsCache.Any()) { _dbAmmoItemsCache = _databaseService.GetItems() - .Values.Where( - item => + .Values.Where(item => { // Base "Item" item has no parent, ignore it if (item.Parent == "") @@ -301,8 +299,7 @@ public class ScavCaseRewardGenerator( /// random ammo item from items.json protected TemplateItem GetRandomAmmo(string rarity) { - var possibleAmmoPool = _dbAmmoItemsCache.Where( - ammo => + var possibleAmmoPool = _dbAmmoItemsCache.Where(ammo => { // Is ammo handbook price between desired range var handbookPrice = _ragfairPriceService.GetStaticPriceForItem(ammo.Id); @@ -397,8 +394,7 @@ public class ScavCaseRewardGenerator( List dbItems, RewardCountAndPriceDetails itemFilters) { - return dbItems.Where( - item => + return dbItems.Where(item => { var handbookPrice = _ragfairPriceService.GetStaticPriceForItem(item.Id); if (handbookPrice >= itemFilters.MinPriceRub && handbookPrice <= itemFilters.MaxPriceRub) @@ -461,6 +457,7 @@ public class ScavCaseRewardGenerator( _ => 1 }; } + /// /// Randomises the size of ammo stacks /// @@ -473,6 +470,7 @@ public class ScavCaseRewardGenerator( itemToCalculate.Properties.StackMaxSize ?? 0 ); } + /// /// Randomises the size of money stacks /// diff --git a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs index db294349..b82df52b 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators.WeaponGen.Implementations; diff --git a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs index 2bbd5b70..f8f14ca4 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Generators.WeaponGen.Implementations; @@ -158,8 +158,9 @@ public class ExternalInventoryMagGen( } } } + /// - /// Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool + /// Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool /// /// Weapon to get mag for /// Blacklisted magazines @@ -176,8 +177,7 @@ public class ExternalInventoryMagGen( // All possible mags that fit into the weapon excluding blacklisted var magazinePool = magSlot.Props.Filters[0] .Filter.Where(x => !magazineBlacklist.Contains(x)) - .Select( - x => _itemHelper.GetItem(x).Value + .Select(x => _itemHelper.GetItem(x).Value ); if (magazinePool is null) { diff --git a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs index 00e73f36..7f771fc4 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators.WeaponGen.Implementations; diff --git a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs index 0b707e1d..f4833717 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Helpers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators.WeaponGen.Implementations; diff --git a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/InventoryMagGen.cs b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/InventoryMagGen.cs index 4142d6a7..7502adcf 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/InventoryMagGen.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/WeaponGen/InventoryMagGen.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Eft.Common.Tables; -using SPTarkov.Common.Annotations; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Common.Tables; namespace SPTarkov.Server.Core.Generators.WeaponGen; diff --git a/Libraries/SPTarkov.Server.Core/Generators/WeatherGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/WeatherGenerator.cs index afeb3426..4a78467b 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/WeatherGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/WeatherGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Weather; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Generators; @@ -22,7 +22,7 @@ public class WeatherGenerator( protected WeatherConfig _weatherConfig = _configServer.GetConfig(); /// - /// Get current + raid datetime and format into correct BSG format. + /// Get current + raid datetime and format into correct BSG format. /// /// Weather data /// WeatherData @@ -39,8 +39,8 @@ public class WeatherGenerator( } /// - /// Get server uptime seconds multiplied by a multiplier and add to current time as seconds. - /// Formatted to BSGs requirements + /// Get server uptime seconds multiplied by a multiplier and add to current time as seconds. + /// Formatted to BSGs requirements /// /// Formatted time as String protected string GetBsgFormattedInRaidTime() @@ -51,7 +51,7 @@ public class WeatherGenerator( } /// - /// Get current time formatted to fit BSGs requirement + /// Get current time formatted to fit BSGs requirement /// /// Date to format into bsg style /// Time formatted in BSG format @@ -61,7 +61,7 @@ public class WeatherGenerator( } /// - /// Return randomised Weather data with help of config/weather.json + /// Return randomised Weather data with help of config/weather.json /// /// The currently active season /// Optional, what timestamp to generate the weather data at, defaults to now when not supplied @@ -112,7 +112,7 @@ public class WeatherGenerator( } /// - /// Choose a temperature for the raid based on time of day + /// Choose a temperature for the raid based on time of day /// /// What season Tarkov is currently in /// What time is the raid running at @@ -129,7 +129,7 @@ public class WeatherGenerator( } /// - /// Set Weather date/time/timestamp values to now + /// Set Weather date/time/timestamp values to now /// /// Object to update /// Optional, timestamp used diff --git a/Libraries/SPTarkov.Server.Core/Helpers/AssortHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/AssortHelper.cs index ee8e454d..f7b59d21 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/AssortHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/AssortHelper.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; @@ -18,7 +18,7 @@ public class AssortHelper( ) { /// - /// Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) + /// Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest) /// /// /// Traders id the assort belongs to @@ -65,7 +65,7 @@ public class AssortHelper( } /// - /// Get a quest id + the statuses quest can be in to unlock assort + /// Get a quest id + the statuses quest can be in to unlock assort /// /// quest assorts to search for assort id /// Assort to look for linked quest id diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotDifficultyHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotDifficultyHelper.cs index fb54ebc6..9ffb7e29 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotDifficultyHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotDifficultyHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Bots; using SPTarkov.Server.Core.Models.Spt.Config; @@ -6,7 +7,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs index 65eda049..bb25ed63 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs @@ -1,3 +1,5 @@ +using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Match; @@ -8,9 +10,7 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers; @@ -27,11 +27,10 @@ public class BotGeneratorHelper( ConfigServer _configServer ) { - protected BotConfig _botConfig = _configServer.GetConfig(); - protected PmcConfig _pmcConfig = _configServer.GetConfig(); - // Equipment slot ids that do not conflict with other slots protected static readonly FrozenSet _slotsWithNoCompatIssues = ["Scabbard", "Backpack", "SecureContainer", "Holster", "ArmBand"]; + protected BotConfig _botConfig = _configServer.GetConfig(); + protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// /// Adds properties to an item @@ -509,9 +508,9 @@ public class BotGeneratorHelper( protected bool HasBlockingProperty(TemplateItem? item, string blockingPropertyName) { return item?.Properties?.GetType().GetProperties() - .FirstOrDefault(x =>x.PropertyType == typeof(bool) + .FirstOrDefault(x => x.PropertyType == typeof(bool) && x.Name.ToLower() == blockingPropertyName - && (bool)x.GetValue(item.Properties)) is not null; + && (bool) x.GetValue(item.Properties)) is not null; } /// @@ -618,9 +617,8 @@ public class BotGeneratorHelper( } // Get all root items in found container - var existingContainerItems = (inventory.Items ?? []).Where( - item => item.ParentId == container.Id && item.SlotId == slotGrid.Name - ); + var existingContainerItems = (inventory.Items ?? []).Where(item => item.ParentId == container.Id && item.SlotId == slotGrid.Name + ); // Get root items in container we can iterate over to find out what space is free var containerItemsToCheck = existingContainerItems.Where(x => x.SlotId == slotGrid.Name); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs index bd6acb33..a1294e20 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotHelper.cs @@ -1,12 +1,12 @@ using System.Collections.Concurrent; +using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers; @@ -18,9 +18,9 @@ public class BotHelper( ConfigServer _configServer ) { + protected static readonly FrozenSet _pmcTypeIds = ["usec", "bear", "pmc", "pmcbear", "pmcusec"]; protected BotConfig _botConfig = _configServer.GetConfig(); protected PmcConfig _pmcConfig = _configServer.GetConfig(); - protected static readonly FrozenSet _pmcTypeIds = ["usec", "bear", "pmc", "pmcbear", "pmcusec"]; protected ConcurrentDictionary> _pmcNameCache = new(); /// @@ -141,8 +141,7 @@ public class BotHelper( return null; } - return botEquipConfig.Randomisation.FirstOrDefault( - randDetails => botLevel >= randDetails.LevelRange.Min && botLevel <= randDetails.LevelRange.Max + return botEquipConfig.Randomisation.FirstOrDefault(randDetails => botLevel >= randDetails.LevelRange.Min && botLevel <= randDetails.LevelRange.Max ); } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotWeaponGeneratorHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotWeaponGeneratorHelper.cs index 832c4f88..41de2667 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotWeaponGeneratorHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotWeaponGeneratorHelper.cs @@ -1,11 +1,11 @@ +using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/CertificateHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/CertificateHelper.cs index c8629e95..52669dbe 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/CertificateHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/CertificateHelper.cs @@ -1,218 +1,215 @@ using System.Net; -using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -namespace SPTarkov.Server.Core.Helpers +namespace SPTarkov.Server.Core.Helpers; + +[Injectable] +public class CertificateHelper(ISptLogger _logger, FileUtil _fileUtil) { - [Injectable] - public class CertificateHelper(ISptLogger _logger, FileUtil _fileUtil) + private const string certificatePath = "./user/certs/server.crt"; + private const string certificateKeyPath = "./user/certs/server.key"; + private const string certificatePfxPath = "./user/certs/certificate.pfx"; + + //Todo: Finish off to match TS server + /// + /// Currently not in use + /// + /// + /// + public X509Certificate2 LoadOrGenerateCertificate() { - private const string certificatePath = "./user/certs/server.crt"; - private const string certificateKeyPath = "./user/certs/server.key"; - private const string certificatePfxPath = "./user/certs/certificate.pfx"; - - //Todo: Finish off to match TS server - /// - /// Currently not in use - /// - /// - /// - public X509Certificate2 LoadOrGenerateCertificate() + if (!Directory.Exists("./user/certs")) { - if (!Directory.Exists("./user/certs")) - { - Directory.CreateDirectory("./user/certs"); - } + Directory.CreateDirectory("./user/certs"); + } - var certificate = LoadCertificate(); + var certificate = LoadCertificate(); + if (certificate == null) + { + // Generate self-signed certificate + certificate = GenerateSelfSignedCertificate("localhost"); + SaveCertificate(certificate); // Save cert and new key + certificate = LoadCertificate(); if (certificate == null) { - // Generate self-signed certificate - certificate = GenerateSelfSignedCertificate("localhost"); - SaveCertificate(certificate); // Save cert and new key - certificate = LoadCertificate(); - if (certificate == null) - { - // if we are still null here there is a serious problem creating cert - throw new Exception("Certificate could not be loaded for the second time."); - } - - _logger.Success($"Generated and stored self-signed certificate ({certificatePath})"); + // if we are still null here there is a serious problem creating cert + throw new Exception("Certificate could not be loaded for the second time."); } - return certificate; + _logger.Success($"Generated and stored self-signed certificate ({certificatePath})"); } - //Todo: When the above is finished off, remove any method with Pfx in the name - public X509Certificate2 LoadOrGenerateCertificatePfx() - { - if (!Directory.Exists("./user/certs")) - { - Directory.CreateDirectory("./user/certs"); - } + return certificate; + } - if (TryLoadCertificatePfx(out var cert)) - { - _logger.Success($"Loaded self-signed certificate ({certificatePath})"); - return cert; - } - else - { - // shit went wrong, throw a wobbly and close app - _logger.Critical("Certificate pfx could not be loaded. Stopping server..."); - Environment.Exit(1); - return null; - } + //Todo: When the above is finished off, remove any method with Pfx in the name + public X509Certificate2 LoadOrGenerateCertificatePfx() + { + if (!Directory.Exists("./user/certs")) + { + Directory.CreateDirectory("./user/certs"); } - private X509Certificate2? LoadCertificate() + if (TryLoadCertificatePfx(out var cert)) { - try - { - return X509Certificate2.CreateFromPemFile(certificatePath, certificateKeyPath); - } - catch (Exception) - { - return null; - } + _logger.Success($"Loaded self-signed certificate ({certificatePath})"); + return cert; } - /// - /// if the cert exist, try load it, else create one and try load again - /// - /// - private bool TryLoadCertificatePfx(out X509Certificate2? certificate) + // shit went wrong, throw a wobbly and close app + _logger.Critical("Certificate pfx could not be loaded. Stopping server..."); + Environment.Exit(1); + return null; + } + + private X509Certificate2? LoadCertificate() + { + try { - X509Certificate2 cert = null; - if (!File.Exists(certificatePfxPath)) - { - // file doesnt exist so create straight away - cert = GenerateSelfSignedCertificate("localhost"); - SaveCertificatePfx(cert); - _logger.Success($"Generated and stored self-signed certificate ({certificatePath})"); - } + return X509Certificate2.CreateFromPemFile(certificatePath, certificateKeyPath); + } + catch (Exception) + { + return null; + } + } - try - { - //Archangel: For some reason despite this being deprecated this is the only way to load a certificate file - //No idea why, I want to eventually switch over to the other format so it lines up with the TS server - //But for now this works fine - certificate = new X509Certificate2(certificatePfxPath); - } - catch (Exception e) - { - Console.WriteLine(e); - throw; - } - - if (certificate is not null) - { - return true; - } - - return false; + /// + /// if the cert exist, try load it, else create one and try load again + /// + /// + private bool TryLoadCertificatePfx(out X509Certificate2? certificate) + { + X509Certificate2 cert = null; + if (!File.Exists(certificatePfxPath)) + { + // file doesnt exist so create straight away + cert = GenerateSelfSignedCertificate("localhost"); + SaveCertificatePfx(cert); + _logger.Success($"Generated and stored self-signed certificate ({certificatePath})"); } - /// - /// Get a certificate from provided path and return - /// - /// X509Certificate2 - private X509Certificate2? LoadCertificatePfx() + try { - try - { - //Archangel: For some reason despite this being deprecated this is the only way to load a certificate file - //No idea why, I want to eventually switch over to the other format so it lines up with the TS server - //But for now this works fine - return new(certificatePfxPath); - } - catch (Exception) - { - return null; - } + //Archangel: For some reason despite this being deprecated this is the only way to load a certificate file + //No idea why, I want to eventually switch over to the other format so it lines up with the TS server + //But for now this works fine + certificate = new X509Certificate2(certificatePfxPath); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; } - /// - /// Generate and return a self-signed certificate - /// - /// e.g. localhost - /// X509Certificate2 - private X509Certificate2 GenerateSelfSignedCertificate(string subjectName) + if (certificate is not null) { - var sanBuilder = new SubjectAlternativeNameBuilder(); - sanBuilder.AddIpAddress(IPAddress.Loopback); - sanBuilder.AddDnsName("localhost"); - sanBuilder.AddDnsName(Environment.MachineName); - - var distinguishedName = new X500DistinguishedName($"CN={subjectName}"); - - using var rsa = RSA.Create(2048); - var request = new CertificateRequest(distinguishedName, rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - request.CertificateExtensions.Add(sanBuilder.Build()); - - //Todo: Enable when Pfx methods can be removed - //SavePrivateKey(rsa); - - return request.CreateSelfSigned(new DateTimeOffset(DateTime.UtcNow.AddDays(-1)), new DateTimeOffset(DateTime.UtcNow.AddDays(3650))); + return true; } - /// - /// Save a certificate as a file to disk - /// - /// Certificate to save - private void SaveCertificate(X509Certificate2 certificate) + return false; + } + + /// + /// Get a certificate from provided path and return + /// + /// X509Certificate2 + private X509Certificate2? LoadCertificatePfx() + { + try { - try - { - // Save as PEM (ensure the certificate is in PEM format) - var certPem = "-----BEGIN CERTIFICATE-----\n" + - Convert.ToBase64String(certificate.Export(X509ContentType.Cert), Base64FormattingOptions.InsertLineBreaks) + - "\n-----END CERTIFICATE-----"; - _fileUtil.WriteFile(certificatePath, certPem); - } - catch (Exception ex) - { - _logger.Error($"Error saving certificate: {ex.Message}"); - } + //Archangel: For some reason despite this being deprecated this is the only way to load a certificate file + //No idea why, I want to eventually switch over to the other format so it lines up with the TS server + //But for now this works fine + return new X509Certificate2(certificatePfxPath); } - - /// - /// Save a certificate as a file to disk - /// - /// Certificate to save - private void SaveCertificatePfx(X509Certificate2 certificate) + catch (Exception) { - try - { - _fileUtil.WriteFile(certificatePfxPath, certificate.Export(X509ContentType.Pfx)); - } - catch (Exception ex) - { - _logger.Error($"Error saving certificate: {ex.Message}"); - } + return null; } + } - private void SavePrivateKey(RSA privateKey) + /// + /// Generate and return a self-signed certificate + /// + /// e.g. localhost + /// X509Certificate2 + private X509Certificate2 GenerateSelfSignedCertificate(string subjectName) + { + var sanBuilder = new SubjectAlternativeNameBuilder(); + sanBuilder.AddIpAddress(IPAddress.Loopback); + sanBuilder.AddDnsName("localhost"); + sanBuilder.AddDnsName(Environment.MachineName); + + var distinguishedName = new X500DistinguishedName($"CN={subjectName}"); + + using var rsa = RSA.Create(2048); + var request = new CertificateRequest(distinguishedName, rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + request.CertificateExtensions.Add(sanBuilder.Build()); + + //Todo: Enable when Pfx methods can be removed + //SavePrivateKey(rsa); + + return request.CreateSelfSigned(new DateTimeOffset(DateTime.UtcNow.AddDays(-1)), new DateTimeOffset(DateTime.UtcNow.AddDays(3650))); + } + + /// + /// Save a certificate as a file to disk + /// + /// Certificate to save + private void SaveCertificate(X509Certificate2 certificate) + { + try { - try - { - var privateKeyBytes = privateKey.ExportPkcs8PrivateKey(); + // Save as PEM (ensure the certificate is in PEM format) + var certPem = "-----BEGIN CERTIFICATE-----\n" + + Convert.ToBase64String(certificate.Export(X509ContentType.Cert), Base64FormattingOptions.InsertLineBreaks) + + "\n-----END CERTIFICATE-----"; + _fileUtil.WriteFile(certificatePath, certPem); + } + catch (Exception ex) + { + _logger.Error($"Error saving certificate: {ex.Message}"); + } + } - // Convert the private key to PEM format (Base64 encoded) - var privateKeyString = "-----BEGIN PRIVATE KEY-----\n" + - Convert.ToBase64String(privateKeyBytes, Base64FormattingOptions.InsertLineBreaks) + - "\n-----END PRIVATE KEY-----"; + /// + /// Save a certificate as a file to disk + /// + /// Certificate to save + private void SaveCertificatePfx(X509Certificate2 certificate) + { + try + { + _fileUtil.WriteFile(certificatePfxPath, certificate.Export(X509ContentType.Pfx)); + } + catch (Exception ex) + { + _logger.Error($"Error saving certificate: {ex.Message}"); + } + } - _fileUtil.WriteFile(certificateKeyPath, privateKeyString); - } - catch (Exception ex) - { - _logger.Error($"Error saving certificate key: {ex.Message}"); - } + private void SavePrivateKey(RSA privateKey) + { + try + { + var privateKeyBytes = privateKey.ExportPkcs8PrivateKey(); + + // Convert the private key to PEM format (Base64 encoded) + var privateKeyString = "-----BEGIN PRIVATE KEY-----\n" + + Convert.ToBase64String(privateKeyBytes, Base64FormattingOptions.InsertLineBreaks) + + "\n-----END PRIVATE KEY-----"; + + _fileUtil.WriteFile(certificateKeyPath, privateKeyString); + } + catch (Exception ex) + { + _logger.Error($"Error saving certificate key: {ex.Message}"); } } } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs index cc53955f..1fa49714 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs @@ -1,10 +1,10 @@ -using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialog.Commando; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs index 0a0e5715..bc79436e 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs @@ -1,4 +1,6 @@ +using System.Collections.Frozen; using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Dialog; @@ -8,8 +10,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.GiveCommand; @@ -146,16 +146,14 @@ public class GiveSptCommand( var allAllowedItemNames = _itemHelper .GetItems() .Where(IsItemAllowed) - .Select( - i => localizedGlobal - .GetValueOrDefault($"{i.Id} Name", i.Properties.Name) - ?.ToLower() + .Select(i => localizedGlobal + .GetValueOrDefault($"{i.Id} Name", i.Properties.Name) + ?.ToLower() ) .Where(i => !string.IsNullOrEmpty(i)); var closestItemsMatchedByName = allAllowedItemNames - .Select( - i => new + .Select(i => new { Match = StringSimilarity.Match(item, i, 2, true), ItemName = i @@ -296,7 +294,7 @@ public class GiveSptCommand( } /// - /// Return the desired locale, falls back to english if it cannot be found + /// Return the desired locale, falls back to english if it cannot be found /// /// Locale code, e.g. "fr" for french /// diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs index 15cffb20..b7b00123 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs @@ -1,4 +1,5 @@ using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Dialog; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.ProfileCommand; @@ -85,8 +85,7 @@ public class ProfileSptCommand( { var enumSkill = Enum.GetValues() .Cast() - .FirstOrDefault( - t => t?.ToString().ToLower() == skill + .FirstOrDefault(t => t?.ToString().ToLower() == skill ); if (enumSkill == null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs index b37baacf..35438194 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs @@ -1,4 +1,5 @@ using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers.Dialog.Commando.SptCommands; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Dialog; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.TraderCommand; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/CommandoDialogChatBot.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/CommandoDialogChatBot.cs index 6ce9deb6..c007a640 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/CommandoDialogChatBot.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/CommandoDialogChatBot.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers.Dialog.Commando; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs index e708429c..28fb49c9 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs index 3e45d17c..3c9b1ddf 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs index 527ca53b..bb3c85bc 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs index 8fc2ce3a..295972dd 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs index a33c137c..3a88b429 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs index 85a3e89a..a92b31e2 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs index f01d7232..50619b70 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs index 7143dd2c..e522d23c 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs index 3b7e7ec3..003d45e5 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs @@ -1,10 +1,10 @@ +using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs index f885b26e..a13a0903 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs index 23e13dad..41ecd825 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs index 06a73d96..85362359 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs @@ -1,12 +1,12 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; +using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Server.Core.Models.Eft.Dialog; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs index d9285a9b..33af66b5 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs index 3ae08f3c..0845e788 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers.Dialog.Commando; using SPTarkov.Server.Core.Helpers.Dialogue.SPTFriend.Commands; using SPTarkov.Server.Core.Models.Eft.Dialog; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Callbacks; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers.Dialogue; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/DialogueHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/DialogueHelper.cs index cdcc18d3..fae2a26e 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/DialogueHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/DialogueHelper.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; @@ -110,7 +110,7 @@ public class DialogueHelper( } /// - /// Find and return a profiles dialogue by id + /// Find and return a profiles dialogue by id /// /// Profile to look in /// Dialog to return diff --git a/Libraries/SPTarkov.Server.Core/Helpers/DurabilityLimitsHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/DurabilityLimitsHelper.cs index 5f0404fa..0bc5e1b4 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/DurabilityLimitsHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/DurabilityLimitsHelper.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs index a8e7de84..037fdfed 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HandbookHelper.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HealthHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HealthHelper.cs index c1fdc571..495d931d 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HealthHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HealthHelper.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; @@ -5,8 +7,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using BodyPartHealth = SPTarkov.Server.Core.Models.Eft.Common.Tables.BodyPartHealth; using Vitality = SPTarkov.Server.Core.Models.Eft.Profile.Vitality; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs index 2bcef28c..f05fb630 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Hideout; @@ -11,7 +12,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Helpers; @@ -257,7 +257,7 @@ public class HideoutHelper( } /// - /// Does a water collection hideout area have a water filter installed + /// Does a water collection hideout area have a water filter installed /// /// Hideout area to check /// @@ -948,9 +948,8 @@ public class HideoutHelper( protected double GetTotalProductionTimeSeconds(string prodId) { return _databaseService.GetHideout() - .Production.Recipes.FirstOrDefault( - prod => - prod.Id == prodId + .Production.Recipes.FirstOrDefault(prod => + prod.Id == prodId ) ?.ProductionTime ?? 0; @@ -1443,8 +1442,7 @@ public class HideoutHelper( // Get SkillGroupLevelingBoost object var combatBoostBonusDb = fameAreaDb.Stages[fameAreaProfile.Level.ToString()] - .Bonuses.FirstOrDefault( - bonus => bonus.Type.ToString() == "SkillGroupLevelingBoost" + .Bonuses.FirstOrDefault(bonus => bonus.Type.ToString() == "SkillGroupLevelingBoost" ); // Get SkillGroupLevelingBoost object in profile diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs index 6d282c1b..48cfd4eb 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HttpServerHelper.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Models.Spt.Config; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs index c929001c..6e6e9789 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs @@ -1,11 +1,11 @@ -using SPTarkov.Server.Core.Models.Eft.Common; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; +using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Helpers; @@ -18,9 +18,9 @@ public class InRaidHelper( DatabaseService _databaseService ) { + protected static readonly List _pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"]; protected InRaidConfig _inRaidConfig = _configServer.GetConfig(); protected LostOnDeathConfig _lostOnDeathConfig = _configServer.GetConfig(); - protected static readonly List _pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"]; /// /// Deprecated. Reset the skill points earned in a raid to 0, ready for next raid. @@ -98,8 +98,7 @@ public class InRaidHelper( { var dbItems = _databaseService.GetItems(); - var itemsToRemovePropertyFrom = items.Where( - item => + var itemsToRemovePropertyFrom = items.Where(item => { // Has upd object + upd.SpawnedInSession property + not a quest item return (item.Upd?.SpawnedInSession ?? false) && @@ -130,8 +129,7 @@ public class InRaidHelper( foreach (var itemToAdd in itemsToAdd) { // Try to find index of item to determine if we should add or replace - var existingItemIndex = serverInventoryItems.FindIndex( - inventoryItem => inventoryItem.Id == itemToAdd.Id + var existingItemIndex = serverInventoryItems.FindIndex(inventoryItem => inventoryItem.Id == itemToAdd.Id ); if (existingItemIndex == -1) { @@ -212,8 +210,7 @@ public class InRaidHelper( var equipmentRootId = pmcProfile?.Inventory?.Equipment; var questRaidItemContainerId = pmcProfile?.Inventory?.QuestRaidItems; - return inventoryItems.Where( - item => + return inventoryItems.Where(item => { // Keep items flagged as kept after death if (IsItemKeptAfterDeath(pmcProfile, item)) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs index 565c67d3..3b6ab782 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs @@ -1,5 +1,8 @@ +using System.Collections.Frozen; using System.Text.Json; using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Inventory; @@ -13,11 +16,7 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; -using System.Collections.Frozen; -using System; namespace SPTarkov.Server.Core.Helpers; @@ -37,8 +36,8 @@ public class InventoryHelper( ICloner _cloner ) { - protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); private static readonly FrozenSet _variableSizeItemTypes = [BaseClasses.WEAPON, BaseClasses.FUNCTIONAL_MOD]; + protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); /// /// Add multiple items to player stash (assuming they all fit) @@ -907,7 +906,8 @@ public class InventoryHelper( protected bool IsVertical(ItemLocation itemLocation) { var castValue = itemLocation.R.ToString(); - return castValue == "1" || string.Equals(castValue, "vertical", StringComparison.OrdinalIgnoreCase) || string.Equals(itemLocation.Rotation?.ToString(), "vertical", StringComparison.OrdinalIgnoreCase); + return castValue == "1" || string.Equals(castValue, "vertical", StringComparison.OrdinalIgnoreCase) || + string.Equals(itemLocation.Rotation?.ToString(), "vertical", StringComparison.OrdinalIgnoreCase); } protected InventoryItemHash GetInventoryItemHash(List inventoryItems) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs index 52418575..97ceb6a4 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs @@ -1,4 +1,6 @@ +using System.Collections.Frozen; using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -7,9 +9,7 @@ using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Server.Core.Utils.Collections; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers; @@ -94,7 +94,8 @@ public class ItemHelper( "front_plate", "back_plate", "left_side_plate", - "right_side_plate"]; + "right_side_plate" + ]; /** * Does the provided pool of items contain the desired item @@ -458,7 +459,7 @@ public class ItemHelper( } /// - /// Does the passed in slot id match a soft insert id + /// Does the passed in slot id match a soft insert id /// /// Id to check /// @@ -796,7 +797,7 @@ public class ItemHelper( } // Items parentId matches root item AND returned items doesn't contain current child - if (!result.ContainsKey(childItem.Id) && string.Equals(childItem.ParentId,baseItemId, StringComparison.Ordinal)) + if (!result.ContainsKey(childItem.Id) && string.Equals(childItem.ParentId, baseItemId, StringComparison.Ordinal)) { foreach (var item in FindAndReturnChildrenAsItems(items, childItem.Id)) { @@ -970,14 +971,13 @@ public class ItemHelper( public List FindBarterItems(string by, List itemsToSearch, object desiredBarterItemIds) { // Find required items to take after buying (handles multiple items) - List desiredBarterIds = + var desiredBarterIds = desiredBarterItemIds.GetType() == typeof(string) ? [(string) desiredBarterItemIds] : (List) desiredBarterItemIds; List matchingItems = []; foreach (var barterId in desiredBarterIds) { - var filterResult = itemsToSearch.Where( - item => + var filterResult = itemsToSearch.Where(item => { return by == "tpl" ? item.Template.Equals(barterId, StringComparison.OrdinalIgnoreCase) @@ -1082,7 +1082,7 @@ public class ItemHelper( } /// - /// Regenerate all GUIDs with new IDs, except special item types (e.g. quest, sorting table, etc.) + /// Regenerate all GUIDs with new IDs, except special item types (e.g. quest, sorting table, etc.) /// /// /// @@ -1315,10 +1315,9 @@ public class ItemHelper( var isRequiredSlot = false; if (parentTemplate.Key && parentTemplate.Value?.Properties?.Slots != null) { - isRequiredSlot = parentTemplate.Value?.Properties?.Slots?.Any( - slot => - slot?.Name == item?.SlotId && - (slot?.Required ?? false) + isRequiredSlot = parentTemplate.Value?.Properties?.Slots?.Any(slot => + slot?.Name == item?.SlotId && + (slot?.Required ?? false) ) ?? false; } @@ -1357,7 +1356,7 @@ public class ItemHelper( /** * Determines if an item is an attachment that is currently attached to its parent item. - * + * * @param item The item to check. * @returns true if the item is attached attachment, otherwise false. */ @@ -1370,15 +1369,15 @@ public class ItemHelper( /** * Retrieves the equipment parent item for a given item. - * + * * This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment * parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake, * barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped. - * + * * It's important to note that traversal is expensive, so this method requires that you pass it a Dictionary of the items * to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates * some of the performance concerns, as it allows for quick lookups of items by ID. - * + * * @param itemId - The unique identifier of the item for which to find the equipment parent. * @param itemsMap - A Dictionary containing item IDs mapped to their corresponding Item objects for quick lookup. * @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists. @@ -1469,7 +1468,7 @@ public class ItemHelper( } /// - /// Add cartridges to the ammo box with correct max stack sizes + /// Add cartridges to the ammo box with correct max stack sizes /// /// Box to add cartridges to /// Item template from items db @@ -1922,7 +1921,6 @@ public class ItemHelper( // Include conflicting items of newly added mod in pool to be used for next mod choice incompatibleModTpls.UnionWith(modItemDbDetails.Properties.ConflictingItems); - } return result; @@ -2116,7 +2114,6 @@ public class ItemHelper( } return true; - } // Return all tpls from Money enum diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ModHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ModHelper.cs index d4c87864..cd0db5d5 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ModHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ModHelper.cs @@ -1,42 +1,41 @@ using System.Reflection; -using SPTarkov.Server.Core.Utils; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Utils; -namespace SPTarkov.Server.Core.Helpers +namespace SPTarkov.Server.Core.Helpers; + +[Injectable] +public class ModHelper { - [Injectable] - public class ModHelper + private readonly FileUtil _fileUtil; + private readonly JsonUtil _jsonUtil; + + public ModHelper( + FileUtil fileUtil, + JsonUtil jsonUtil) { - private readonly FileUtil _fileUtil; - private readonly JsonUtil _jsonUtil; + _fileUtil = fileUtil; + _jsonUtil = jsonUtil; + } - public ModHelper( - FileUtil fileUtil, - JsonUtil jsonUtil) - { - _fileUtil = fileUtil; - _jsonUtil = jsonUtil; - } + public string GetAbsolutePathToModFolder(Assembly modAssembly) + { + // The full path to the mod folder + return Path.GetDirectoryName(modAssembly.Location); + } - public string GetAbsolutePathToModFolder(Assembly modAssembly) - { - // The full path to the mod folder - return Path.GetDirectoryName(modAssembly.Location); - } + public string GetRawFileData(string pathToFile, string fileName) + { + // Read the content of the config file as a string + return _fileUtil.ReadFile(Path.Combine(pathToFile, fileName)); + } - public string GetRawFileData(string pathToFile, string fileName) - { - // Read the content of the config file as a string - return _fileUtil.ReadFile(Path.Combine(pathToFile, fileName)); - } + public T GetJsonDataFromFile(string pathToFile, string fileName) + { + // Read the content of the config file as a string + var rawContent = _fileUtil.ReadFile(Path.Combine(pathToFile, fileName)); - public T GetJsonDataFromFile(string pathToFile, string fileName) - { - // Read the content of the config file as a string - var rawContent = _fileUtil.ReadFile(Path.Combine(pathToFile, fileName)); - - // Take the string above and deserialise it into a file with a type (defined between the diamond brackets) - return _jsonUtil.Deserialize(rawContent); - } + // Take the string above and deserialise it into a file with a type (defined between the diamond brackets) + return _jsonUtil.Deserialize(rawContent); } } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/NotificationSendHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/NotificationSendHelper.cs index cd61c5b2..da8124ad 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/NotificationSendHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/NotificationSendHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Servers.Ws; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs index 2456826d..6e06f9e4 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Eft.Ws; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/PaymentHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/PaymentHelper.cs index cdd4ce1f..4ae1e86a 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/PaymentHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/PaymentHelper.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/PresetHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/PresetHelper.cs index 5391d8f8..7011629d 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/PresetHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/PresetHelper.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Presets; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; @@ -48,10 +48,9 @@ public class PresetHelper( if (_defaultWeaponPresets is null) { var tempPresets = _databaseService.GetGlobals().ItemPresets; - _defaultWeaponPresets = tempPresets.Where( - p => - p.Value.Encyclopedia != null && - _itemHelper.IsOfBaseclass(p.Value.Encyclopedia, BaseClasses.WEAPON) + _defaultWeaponPresets = tempPresets.Where(p => + p.Value.Encyclopedia != null && + _itemHelper.IsOfBaseclass(p.Value.Encyclopedia, BaseClasses.WEAPON) ) .ToDictionary(); } @@ -68,10 +67,9 @@ public class PresetHelper( if (_defaultEquipmentPresets == null) { var tempPresets = _databaseService.GetGlobals().ItemPresets; - _defaultEquipmentPresets = tempPresets.Where( - p => - p.Value.Encyclopedia != null && - _itemHelper.ArmorItemCanHoldMods(p.Value.Encyclopedia) + _defaultEquipmentPresets = tempPresets.Where(p => + p.Value.Encyclopedia != null && + _itemHelper.ArmorItemCanHoldMods(p.Value.Encyclopedia) ) .ToDictionary(); } @@ -116,14 +114,14 @@ public class PresetHelper( } /// - /// Get a clone of a tpls presets + /// Get a clone of a tpls presets /// /// Tpl to get presets for /// List public List GetPresets(string templateId) { // Try adn get preset ids from cache if they exist - if(!_lookup.TryGetValue(templateId, out var presetDetailsForTpl)) + if (!_lookup.TryGetValue(templateId, out var presetDetailsForTpl)) { // None found, early exit return []; @@ -136,7 +134,7 @@ public class PresetHelper( } /// - /// Get a cloned default preset for passed in item tpl + /// Get a cloned default preset for passed in item tpl /// /// Items tpl to get preset for /// null if no default preset, otherwise Preset @@ -167,7 +165,7 @@ public class PresetHelper( } /// - /// Get the presets root item tpl + /// Get the presets root item tpl /// /// Preset id to look up /// tpl mongoid diff --git a/Libraries/SPTarkov.Server.Core/Helpers/PrestigeHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/PrestigeHelper.cs index 19cfc4e8..b8b0aa82 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/PrestigeHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/PrestigeHelper.cs @@ -1,168 +1,170 @@ using System.Text.Json; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; -namespace SPTarkov.Server.Core.Helpers +namespace SPTarkov.Server.Core.Helpers; + +[Injectable] +public class PrestigeHelper { - [Injectable] - public class PrestigeHelper + protected DatabaseService _databaseService; + protected ISptLogger _logger; + protected MailSendService _mailSendService; + protected ProfileHelper _profileHelper; + protected RewardHelper _rewardHelper; + protected TimeUtil _timeUtil; + + public PrestigeHelper( + ISptLogger logger, + TimeUtil timeUtil, + DatabaseService databaseService, + MailSendService mailSendService, + ProfileHelper profileHelper, + RewardHelper rewardHelper) { - protected ISptLogger _logger; - protected TimeUtil _timeUtil; - protected DatabaseService _databaseService; - protected MailSendService _mailSendService; - protected ProfileHelper _profileHelper; - protected RewardHelper _rewardHelper; + _logger = logger; + _timeUtil = timeUtil; + _databaseService = databaseService; + _mailSendService = mailSendService; + _profileHelper = profileHelper; + _rewardHelper = rewardHelper; + } - public PrestigeHelper( - ISptLogger logger, - TimeUtil timeUtil, - DatabaseService databaseService, - MailSendService mailSendService, - ProfileHelper profileHelper, - RewardHelper rewardHelper) + public void ProcessPendingPrestige(SptProfile oldProfile, SptProfile newProfile, PendingPrestige prestige) + { + var prePrestigePmc = oldProfile.CharacterData.PmcData; + var sessionId = newProfile.ProfileInfo.ProfileId; + + // Skill copy + + if (prePrestigePmc.Skills.Common is not null) { - _logger = logger; - _timeUtil = timeUtil; - _databaseService = databaseService; - _mailSendService = mailSendService; - _profileHelper = profileHelper; - _rewardHelper = rewardHelper; + var commonSKillsToCopy = prePrestigePmc.Skills.Common; + foreach (var skillToCopy in commonSKillsToCopy) + { + // Set progress 5% of what it was + skillToCopy.Progress = skillToCopy.Progress * 0.05; + var existingSkill = newProfile.CharacterData.PmcData.Skills.Common.FirstOrDefault(skill => skill.Id == skillToCopy.Id); + if (existingSkill is not null) + { + existingSkill.Progress = skillToCopy.Progress; + } + else + { + newProfile.CharacterData.PmcData.Skills.Common.Add(skillToCopy); + } + } + + var masteringSkillsToCopy = prePrestigePmc.Skills.Mastering; + foreach (var skillToCopy in masteringSkillsToCopy) + { + // Set progress 5% of what it was + skillToCopy.Progress = skillToCopy.Progress * 0.05; + var existingSkill = newProfile.CharacterData.PmcData.Skills.Mastering.FirstOrDefault(skill => skill.Id == skillToCopy.Id); + if (existingSkill is not null) + { + existingSkill.Progress = skillToCopy.Progress; + } + else + { + newProfile.CharacterData.PmcData.Skills.Mastering.Add(skillToCopy); + } + } } - public void ProcessPendingPrestige(SptProfile oldProfile, SptProfile newProfile, PendingPrestige prestige) + var indexOfPrestigeObtained = Math.Min(prestige.PrestigeLevel.Value - 1, 1); // Index starts at 0 + + // Add "Prestigious" achievement + if (!newProfile.CharacterData.PmcData.Achievements.ContainsKey("676091c0f457869a94017a23")) { - var prePrestigePmc = oldProfile.CharacterData.PmcData; - var sessionId = newProfile.ProfileInfo.ProfileId; + _rewardHelper.AddAchievementToProfile(newProfile, "676091c0f457869a94017a23"); + } - // Skill copy + // Assumes Prestige data is in descending order + var currentPrestigeData = _databaseService.GetTemplates().Prestige.Elements[indexOfPrestigeObtained]; + var prestigeRewards = _databaseService + .GetTemplates() + .Prestige.Elements.Slice(0, indexOfPrestigeObtained + 1) + .SelectMany(prestige => prestige.Rewards); - if (prePrestigePmc.Skills.Common is not null) + AddPrestigeRewardsToProfile(sessionId, newProfile, prestigeRewards); + + // Flag profile as having achieved this prestige level + newProfile.CharacterData.PmcData.Prestige[currentPrestigeData.Id] = _timeUtil.GetTimeStamp(); + + var itemsToTransfer = new List(); + + // Copy transferred items + foreach (var transferRequest in prestige.Items ?? []) + { + var item = prePrestigePmc.Inventory.Items.FirstOrDefault(item => item.Id == transferRequest.Id); + if (item is null) { - var commonSKillsToCopy = prePrestigePmc.Skills.Common; - foreach (var skillToCopy in commonSKillsToCopy) { - // Set progress 5% of what it was - skillToCopy.Progress = skillToCopy.Progress * 0.05; - var existingSkill = newProfile.CharacterData.PmcData.Skills.Common.FirstOrDefault((skill) => skill.Id == skillToCopy.Id); - if (existingSkill is not null) + _logger.Error($"Unable to find item with id: {transferRequest.Id} in profile: {sessionId}, skipping"); + continue; + } + + itemsToTransfer.Add(item); + } + + _mailSendService.SendSystemMessageToPlayer(sessionId, "", itemsToTransfer, 31536000); + + newProfile.CharacterData.PmcData.Info.PrestigeLevel = prestige.PrestigeLevel; + } + + private void AddPrestigeRewardsToProfile(string sessionId, SptProfile newProfile, IEnumerable rewards) + { + var itemsToSend = new List(); + + foreach (var reward in rewards) + { + switch (reward.Type) + { + case RewardType.CustomizationDirect: { - existingSkill.Progress = skillToCopy.Progress; + _profileHelper.AddHideoutCustomisationUnlock(newProfile, reward, CustomisationSource.PRESTIGE); + break; + } + case RewardType.Skill: + if (Enum.TryParse(reward.Target, out SkillTypes result)) + { + _profileHelper.AddSkillPointsToPlayer( + newProfile.CharacterData.PmcData, + result, + ((JsonElement) reward.Value).ToObject() + ); } else { - newProfile.CharacterData.PmcData.Skills.Common.Add(skillToCopy); + _logger.Error($"Unable to parse reward Target to Enum: {reward.Target}"); } - } - var masteringSkillsToCopy = prePrestigePmc.Skills.Mastering; - foreach (var skillToCopy in masteringSkillsToCopy) { - // Set progress 5% of what it was - skillToCopy.Progress = skillToCopy.Progress * 0.05; - var existingSkill = newProfile.CharacterData.PmcData.Skills.Mastering.FirstOrDefault((skill) => skill.Id == skillToCopy.Id); - if (existingSkill is not null) + break; + case RewardType.Item: { - existingSkill.Progress = skillToCopy.Progress; + itemsToSend.AddRange(reward.Items); + break; } - else + case RewardType.ExtraDailyQuest: { - newProfile.CharacterData.PmcData.Skills.Mastering.Add(skillToCopy); + _profileHelper.AddExtraRepeatableQuest(newProfile, reward.Target, (double) reward.Value); + break; } - } + default: + _logger.Error($"Unhandled prestige reward type: {reward.Type}"); + break; } - - var indexOfPrestigeObtained = Math.Min(prestige.PrestigeLevel.Value - 1, 1); // Index starts at 0 - - // Add "Prestigious" achievement - if (!newProfile.CharacterData.PmcData.Achievements.ContainsKey("676091c0f457869a94017a23")) - { - _rewardHelper.AddAchievementToProfile(newProfile, "676091c0f457869a94017a23"); - } - - // Assumes Prestige data is in descending order - var currentPrestigeData = _databaseService.GetTemplates().Prestige.Elements[indexOfPrestigeObtained]; - var prestigeRewards = _databaseService - .GetTemplates() - .Prestige.Elements.Slice(0, indexOfPrestigeObtained + 1) - .SelectMany(prestige => prestige.Rewards); - - AddPrestigeRewardsToProfile(sessionId, newProfile, prestigeRewards); - - // Flag profile as having achieved this prestige level - newProfile.CharacterData.PmcData.Prestige[currentPrestigeData.Id] = _timeUtil.GetTimeStamp(); - - var itemsToTransfer = new List(); - - // Copy transferred items - foreach (var transferRequest in prestige.Items ?? []) { - var item = prePrestigePmc.Inventory.Items.FirstOrDefault((item) => item.Id == transferRequest.Id); - if (item is null) - { - _logger.Error($"Unable to find item with id: {transferRequest.Id} in profile: {sessionId}, skipping"); - continue; - } - - itemsToTransfer.Add(item); - } - - _mailSendService.SendSystemMessageToPlayer(sessionId, "", itemsToTransfer, 31536000); - - newProfile.CharacterData.PmcData.Info.PrestigeLevel = prestige.PrestigeLevel; } - private void AddPrestigeRewardsToProfile(string sessionId, SptProfile newProfile, IEnumerable rewards) + if (itemsToSend.Count > 0) { - var itemsToSend = new List(); - - foreach (var reward in rewards) - { - switch (reward.Type) - { - case RewardType.CustomizationDirect: - { - _profileHelper.AddHideoutCustomisationUnlock(newProfile, reward, CustomisationSource.PRESTIGE); - break; - } - case RewardType.Skill: - if (Enum.TryParse(reward.Target, out SkillTypes result)) - { - _profileHelper.AddSkillPointsToPlayer( - newProfile.CharacterData.PmcData, - result, - ((JsonElement) reward.Value).ToObject() - ); - } - else - { - _logger.Error($"Unable to parse reward Target to Enum: {reward.Target}"); - } - - break; - case RewardType.Item: - { - itemsToSend.AddRange(reward.Items); - break; - } - case RewardType.ExtraDailyQuest: - { - _profileHelper.AddExtraRepeatableQuest(newProfile, reward.Target, (double)reward.Value); - break; - } - default: - _logger.Error($"Unhandled prestige reward type: {reward.Type}"); - break; - } - } - - if (itemsToSend.Count > 0) - { - _mailSendService.SendSystemMessageToPlayer(sessionId, "", itemsToSend, 31536000); - } + _mailSendService.SendSystemMessageToPlayer(sessionId, "", itemsToSend, 31536000); } } } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ProbabilityHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ProbabilityHelper.cs index 3d960dcb..b3d0a539 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ProbabilityHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ProbabilityHelper.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Models.Utils; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs index 4e5d5fb8..c3f41e6c 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs @@ -1,3 +1,5 @@ +using System.Collections.Frozen; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; @@ -8,9 +10,7 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers; @@ -110,11 +110,10 @@ public class ProfileHelper( var allProfiles = _saveServer.GetProfiles().Values; // Find a profile that doesn't have same session id but has same name - return allProfiles.Any( - p => - ProfileHasInfoProperty(p) && - !StringsMatch(p.ProfileInfo.ProfileId, sessionID) && // SessionIds dont match - StringsMatch(p.CharacterData.PmcData.Info.LowerNickname.ToLower(), nicknameRequest.Nickname.ToLower()) + return allProfiles.Any(p => + ProfileHasInfoProperty(p) && + !StringsMatch(p.ProfileInfo.ProfileId, sessionID) && // SessionIds dont match + StringsMatch(p.CharacterData.PmcData.Info.LowerNickname.ToLower(), nicknameRequest.Nickname.ToLower()) ); // Nicknames do } @@ -733,7 +732,7 @@ public class ProfileHelper( } /// - /// Add the given number of extra repeatable quests for the given type of repeatable to the users profile + /// Add the given number of extra repeatable quests for the given type of repeatable to the users profile /// /// Profile to add the extra repeatable to /// The ID of the type of repeatable to increase diff --git a/Libraries/SPTarkov.Server.Core/Helpers/QuestConditionHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/QuestConditionHelper.cs index 31029d13..d90e56fa 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/QuestConditionHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/QuestConditionHelper.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Common.Tables; namespace SPTarkov.Server.Core.Helpers; @@ -39,8 +39,7 @@ public class QuestConditionHelper string questType, Func>? furtherFilter = null) { - var filteredQuests = questConditions.Where( - c => + var filteredQuests = questConditions.Where(c => { if (c.ConditionType == questType) // return true or run the passed in function diff --git a/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs index 74289401..b6c3f7db 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/QuestHelper.cs @@ -1,4 +1,5 @@ -using System.Text.Json; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.ItemEvent; @@ -11,8 +12,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Helpers; @@ -106,8 +105,7 @@ public class QuestHelper( if (knownQuestsIds.Count != 0) { - return after.Where( - q => + return after.Where(q => { return knownQuestsIds.IndexOf(q.Id) == -1; } @@ -343,13 +341,11 @@ public class QuestHelper( // Get quests that var eligibleQuests = GetQuestsFromDb() - .Where( - quest => + .Where(quest => { // Quest is accessible to player when the accepted quest passed into param is started // e.g. Quest A passed in, quest B is looped over and has requirement of A to be started, include it - var acceptedQuestCondition = quest.Conditions.AvailableForStart.FirstOrDefault( - condition => + var acceptedQuestCondition = quest.Conditions.AvailableForStart.FirstOrDefault(condition => { return condition.ConditionType == "Quest" && ((condition.Target?.Item?.Contains(startedQuestId) ?? false) || @@ -523,13 +519,12 @@ public class QuestHelper( var profileQuest = profile.Quests.FirstOrDefault(x => x.QId == failedQuestId); var quests = GetQuestsFromDb() - .Where( - q => + .Where(q => { - var acceptedQuestCondition = q.Conditions.AvailableForStart.FirstOrDefault( - c => c.ConditionType == "Quest" && - (c.Target.IsList ? c.Target.List : [c.Target.Item]).Contains(failedQuestId) && - c.Status[0] == QuestStatusEnum.Fail + var acceptedQuestCondition = q.Conditions.AvailableForStart.FirstOrDefault(c => c.ConditionType == "Quest" && + (c.Target.IsList ? c.Target.List : [c.Target.Item]) + .Contains(failedQuestId) && + c.Status[0] == QuestStatusEnum.Fail ); if (acceptedQuestCondition is null) @@ -687,8 +682,7 @@ public class QuestHelper( public Quest GetQuestWithOnlyLevelRequirementStartCondition(Quest quest) { var updatedQuest = _cloner.Clone(quest); - updatedQuest.Conditions.AvailableForStart = updatedQuest.Conditions.AvailableForStart.Where( - q => q.ConditionType == "Level" + updatedQuest.Conditions.AvailableForStart = updatedQuest.Conditions.AvailableForStart.Where(q => q.ConditionType == "Level" ) .ToList(); @@ -729,8 +723,7 @@ public class QuestHelper( var quest = GetQuestFromDb(failRequest.QuestId, pmcData); // Merge all daily/weekly/scav daily quests into one array and look for the matching quest by id - var matchingRepeatableQuest = pmcData.RepeatableQuests.SelectMany( - repeatableType => repeatableType.ActiveQuests + var matchingRepeatableQuest = pmcData.RepeatableQuests.SelectMany(repeatableType => repeatableType.ActiveQuests ) .FirstOrDefault(activeQuest => activeQuest.Id == failRequest.QuestId); @@ -897,9 +890,9 @@ public class QuestHelper( continue; } - var condition = questInDb.Conditions.AvailableForFinish.FirstOrDefault( - c => c.ConditionType == "FindItem" && - ((c.Target.IsList ? c.Target.List : [c.Target.Item])?.Contains(itemTpl) ?? false) + var condition = questInDb.Conditions.AvailableForFinish.FirstOrDefault(c => c.ConditionType == "FindItem" && + ((c.Target.IsList ? c.Target.List : [c.Target.Item]) + ?.Contains(itemTpl) ?? false) ); if (condition is not null) { @@ -980,8 +973,7 @@ public class QuestHelper( public List GetQuestsFailedByCompletingQuest(string completedQuestId) { var questsInDb = GetQuestsFromDb(); - return questsInDb.Where( - quest => + return questsInDb.Where(quest => { // No fail conditions, exit early if (quest.Conditions.Fail is null || quest.Conditions.Fail.Count == 0) @@ -989,12 +981,11 @@ public class QuestHelper( return false; } - return quest.Conditions.Fail.Any( - condition => - (condition.Target.IsList ? condition.Target.List : [condition.Target.Item])?.Contains( - completedQuestId - ) ?? - false + return quest.Conditions.Fail.Any(condition => + (condition.Target.IsList ? condition.Target.List : [condition.Target.Item])?.Contains( + completedQuestId + ) ?? + false ); } ) @@ -1058,8 +1049,7 @@ public class QuestHelper( // Check if it's a repeatable quest. If so, remove from Quests foreach (var currentRepeatable in pmcData.RepeatableQuests) { - var repeatableQuest = currentRepeatable.ActiveQuests.FirstOrDefault( - activeRepeatable => activeRepeatable.Id == completedQuestId + var repeatableQuest = currentRepeatable.ActiveQuests.FirstOrDefault(activeRepeatable => activeRepeatable.Id == completedQuestId ); if (repeatableQuest is not null) // Need to remove redundant scav quest object as its no longer necessary, is tracked in pmc profile @@ -1258,9 +1248,8 @@ public class QuestHelper( } propsAsDict[rewardType.Key] = ((List) propsAsDict[rewardType.Key]) - .Where( - reward => - _rewardHelper.RewardIsForGameEdition(reward, gameVersion) + .Where(reward => + _rewardHelper.RewardIsForGameEdition(reward, gameVersion) ) .ToList(); } @@ -1277,8 +1266,7 @@ public class QuestHelper( protected List GetQuestsFromProfileFailedByCompletingQuest(string completedQuestId, PmcData pmcProfile) { var questsInDb = GetQuestsFromDb(); - return questsInDb.Where( - quest => + return questsInDb.Where(quest => { // No fail conditions, skip if (quest.Conditions.Fail is null || quest.Conditions.Fail.Count == 0) @@ -1397,8 +1385,8 @@ public class QuestHelper( foreach (var quest in quests) { // If quest has prereq of completed quest + availableAfter value > 0 (quest has wait time) - var nextQuestWaitCondition = quest.Conditions?.AvailableForStart?.FirstOrDefault( - x => ((x.Target?.List?.Contains(completedQuestId) ?? false) || (x.Target?.Item?.Contains(completedQuestId) ?? false)) && x.AvailableAfter > 0 + var nextQuestWaitCondition = quest.Conditions?.AvailableForStart?.FirstOrDefault(x => + ((x.Target?.List?.Contains(completedQuestId) ?? false) || (x.Target?.Item?.Contains(completedQuestId) ?? false)) && x.AvailableAfter > 0 ); // as we have to use the ListOrT type now, check both List and Item for the above checks if (nextQuestWaitCondition is not null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/QuestRewardHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/QuestRewardHelper.cs index 0833c97f..ad5efb84 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/QuestRewardHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/QuestRewardHelper.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.ItemEvent; @@ -8,8 +10,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Helpers; @@ -147,10 +147,9 @@ public class QuestRewardHelper( .FirstOrDefault(p => p.Name == questStatus.ToString()) .GetValue(quest.Rewards) ?? new List(); - var currencyRewards = rewards.Where( - r => - r.Type.ToString() == "Item" && - _paymentHelper.IsMoneyTpl(r.Items.FirstOrDefault().Template) + var currencyRewards = rewards.Where(r => + r.Type.ToString() == "Item" && + _paymentHelper.IsMoneyTpl(r.Items.FirstOrDefault().Template) ); foreach (var reward in currencyRewards) { diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RagfairHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RagfairHelper.cs index edbe0927..9f89cf87 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RagfairHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RagfairHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RagfairOfferHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RagfairOfferHelper.cs index 38aa86e7..90787b78 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RagfairOfferHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RagfairOfferHelper.cs @@ -1,3 +1,6 @@ +using System.Collections.Frozen; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.ItemEvent; @@ -10,9 +13,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; -using System.Collections.Frozen; namespace SPTarkov.Server.Core.Helpers; @@ -41,10 +41,10 @@ public class RagfairOfferHelper( ConfigServer _configServer) { protected const string _goodSoldTemplate = "5bdabfb886f7743e152e867e 0"; // Your {soldItem} {itemCount} items were bought by {buyerNickname}. - protected BotConfig _botConfig = _configServer.GetConfig(); - protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); protected static readonly FrozenSet _currencies = ["all", "RUB", "USD", "EUR"]; + protected BotConfig _botConfig = _configServer.GetConfig(); + protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); /// /// Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see @@ -64,8 +64,7 @@ public class RagfairOfferHelper( var tieredFlea = _ragfairConfig.TieredFlea; var tieredFleaLimitTypes = tieredFlea.UnlocksType; return _ragfairOfferService.GetOffers() - .Where( - offer => + .Where(offer => { if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) { @@ -172,8 +171,7 @@ public class RagfairOfferHelper( var requiredOffers = _ragfairRequiredItemsService.GetRequiredItemsById(searchRequest.NeededSearchId); var tieredFlea = _ragfairConfig.TieredFlea; var tieredFleaLimitTypes = tieredFlea.UnlocksType; - return requiredOffers.Where( - offer => + return requiredOffers.Where(offer => { if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) { @@ -318,8 +316,7 @@ public class RagfairOfferHelper( var lockedOffers = GetLoyaltyLockedOffers(possibleOffers, pmcData); // Exclude locked offers + above loyalty locked offers if at least 1 was found - offersToSort = possibleOffers.Where( - offer => !(offer.Locked.GetValueOrDefault(false) || lockedOffers.Contains(offer.Id)) + offersToSort = possibleOffers.Where(offer => !(offer.Locked.GetValueOrDefault(false) || lockedOffers.Contains(offer.Id)) ) .ToList(); @@ -410,8 +407,7 @@ public class RagfairOfferHelper( if ( !traderAssorts[offer.User.Id] - .Items.Any( - item => + .Items.Any(item => { return item.Id == offer.Root; } @@ -434,8 +430,7 @@ public class RagfairOfferHelper( protected List GetOffersInsideBuyRestrictionLimits(List possibleOffers) { // Check offer has buy limit + is from trader + current buy count is at or over max - return possibleOffers.Where( - offer => + return possibleOffers.Where(offer => { if ( offer.BuyRestrictionMax is null && @@ -505,12 +500,10 @@ public class RagfairOfferHelper( traderAssorts.TryGetValue(offer.User.Id, out var assorts); if (assorts.BarterScheme .Where(x => itemIds.Contains(x.Key)) - .Any( - barterKvP => barterKvP.Value - .Any( - subBarter => subBarter - .Any(subBarter => subBarter.SptQuestLocked.GetValueOrDefault(false)) - ) + .Any(barterKvP => barterKvP.Value + .Any(subBarter => subBarter + .Any(subBarter => subBarter.SptQuestLocked.GetValueOrDefault(false)) + ) )) { return true; @@ -943,7 +936,7 @@ public class RagfairOfferHelper( if (searchRequest.Currency > 0 && _paymentHelper.IsMoneyTpl(offerMoneyTypeTpl)) { // Use 'currencies' as mapping for the money choice dropdown, e.g. 0 = all, 2 = "USD; - if(!_currencies.Contains(_ragfairHelper.GetCurrencyTag(offerMoneyTypeTpl))) + if (!_currencies.Contains(_ragfairHelper.GetCurrencyTag(offerMoneyTypeTpl))) // Don't include item paid in wrong currency { return false; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RagfairSellHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RagfairSellHelper.cs index 44c3d353..081c7383 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RagfairSellHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RagfairSellHelper.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs index a01feb4b..040c3f5e 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; @@ -6,7 +7,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RagfairSortHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RagfairSortHelper.cs index d25b6d45..57d292f4 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RagfairSortHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RagfairSortHelper.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RepairHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RepairHelper.cs index ea84c1c8..2a0c73bb 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RepairHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RepairHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; @@ -6,7 +7,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RepeatableQuestHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RepeatableQuestHelper.cs index 23d44801..3c3741b7 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RepeatableQuestHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RepeatableQuestHelper.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; @@ -17,8 +17,7 @@ public class RepeatableQuestHelper( /// EliminationConfig public EliminationConfig? GetEliminationConfigByPmcLevel(int pmcLevel, RepeatableQuestConfig repeatableConfig) { - return repeatableConfig.QuestConfig.Elimination.FirstOrDefault( - x => pmcLevel >= x.LevelRange.Min && pmcLevel <= x.LevelRange.Max + return repeatableConfig.QuestConfig.Elimination.FirstOrDefault(x => pmcLevel >= x.LevelRange.Min && pmcLevel <= x.LevelRange.Max ); } } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RewardHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RewardHelper.cs index 9822d510..4d5b4b75 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RewardHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RewardHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Hideout; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; @@ -215,15 +215,13 @@ public class RewardHelper( // Area that will be used to craft unlocked item var desiredHideoutAreaType = (HideoutAreas) int.Parse(craftUnlockReward.TraderId.ToString()); - var matchingProductions = craftingRecipes.Where( - prod => - prod.AreaType == desiredHideoutAreaType && - //prod.requirements.some((requirement) => requirement.questId == questId) && // BSG don't store the quest id in requirement any more! - prod.Requirements.Any(requirement => requirement.Type == "QuestComplete") && - prod.Requirements.Any( - requirement => requirement.RequiredLevel == craftUnlockReward.LoyaltyLevel - ) && - prod.EndProduct == craftUnlockReward.Items.FirstOrDefault().Template + var matchingProductions = craftingRecipes.Where(prod => + prod.AreaType == desiredHideoutAreaType && + //prod.requirements.some((requirement) => requirement.questId == questId) && // BSG don't store the quest id in requirement any more! + prod.Requirements.Any(requirement => requirement.Type == "QuestComplete") && + prod.Requirements.Any(requirement => requirement.RequiredLevel == craftUnlockReward.LoyaltyLevel + ) && + prod.EndProduct == craftUnlockReward.Items.FirstOrDefault().Template ) .ToList(); @@ -231,9 +229,8 @@ public class RewardHelper( if (matchingProductions.Count != 1) // Multiple matches were found, last ditch attempt to match by questid (value we add manually to production.json via `gen:productionquests` command) { - matchingProductions = matchingProductions.Where( - prod => - prod.Requirements.Any(requirement => requirement.QuestId == questId) + matchingProductions = matchingProductions.Where(prod => + prod.Requirements.Any(requirement => requirement.QuestId == questId) ) .ToList(); } @@ -250,11 +247,10 @@ public class RewardHelper( protected List GetRewardItems(List rewards, string gameVersion) { // Iterate over all rewards with the desired status, flatten out items that have a type of Item - var rewardItems = rewards.SelectMany( - reward => - reward.Type == RewardType.Item && RewardIsForGameEdition(reward, gameVersion) - ? ProcessReward(reward) - : [] + var rewardItems = rewards.SelectMany(reward => + reward.Type == RewardType.Item && RewardIsForGameEdition(reward, gameVersion) + ? ProcessReward(reward) + : [] ); return rewardItems.ToList(); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/SecureContainerHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/SecureContainerHelper.cs index c01aebff..f5cd0417 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/SecureContainerHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/SecureContainerHelper.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Common.Tables; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs index 16f09b1d..7c365fe0 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs @@ -1,18 +1,16 @@ using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Inventory; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Trade; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Helpers; @@ -321,8 +319,7 @@ public class TradeHelper( ) { const string circulateQuestId = "6663149f1d3ec95634095e75"; - var activeCirculateQuest = profileToReceiveMoney.Quests.FirstOrDefault( - quest => quest.QId == circulateQuestId && quest.Status == QuestStatusEnum.Started + var activeCirculateQuest = profileToReceiveMoney.Quests.FirstOrDefault(quest => quest.QId == circulateQuestId && quest.Status == QuestStatusEnum.Started ); // Player not on Circulate quest ,exit @@ -332,8 +329,8 @@ public class TradeHelper( } // Find related task condition - var taskCondition = profileToReceiveMoney.TaskConditionCounters.Values.FirstOrDefault( - condition => condition.SourceId == circulateQuestId && condition.Type == "SellItemToTrader" + var taskCondition = profileToReceiveMoney.TaskConditionCounters.Values.FirstOrDefault(condition => + condition.SourceId == circulateQuestId && condition.Type == "SellItemToTrader" ); // No relevant condtion in profile, nothing to increment @@ -355,8 +352,7 @@ public class TradeHelper( // Get sellToTrader condition from quest var sellItemToTraderCondition = circulateQuestDb[circulateQuestId] - .Conditions.AvailableForFinish.FirstOrDefault( - condition => condition.ConditionType == "SellItemToTrader" + .Conditions.AvailableForFinish.FirstOrDefault(condition => condition.ConditionType == "SellItemToTrader" ); // Quest doesnt have a sellItemToTrader condition, nothing to do @@ -372,8 +368,7 @@ public class TradeHelper( foreach (var itemSoldToTrader in sellRequest.Items) { // Get sold items' details from profile - var itemDetails = profileWithItemsToSell.Inventory.Items.FirstOrDefault( - inventoryItem => inventoryItem.Id == itemSoldToTrader.Id + var itemDetails = profileWithItemsToSell.Inventory.Items.FirstOrDefault(inventoryItem => inventoryItem.Id == itemSoldToTrader.Id ); if (itemDetails is null) { diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TraderAssortHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TraderAssortHelper.cs index 40cfb70a..3fb1267e 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TraderAssortHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TraderAssortHelper.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Helpers; @@ -132,9 +132,8 @@ public class TraderAssortHelper( /// Item TPLs the assort should not have protected void RemoveItemsFromAssort(TraderAssort assortToFilter, HashSet itemsTplsToRemove) { - assortToFilter.Items = assortToFilter.Items.Where( - item => - item.ParentId == "hideout" && itemsTplsToRemove.Contains(item.Template) + assortToFilter.Items = assortToFilter.Items.Where(item => + item.ParentId == "hideout" && itemsTplsToRemove.Contains(item.Template) ) .ToList(); } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs index e2a3917b..8b7152e8 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TraderHelper.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -8,8 +10,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -238,7 +238,7 @@ public class TraderHelper( foreach (var suitId in clothingIds) { - if (!fullProfile.CustomisationUnlocks.Exists((customisation) => customisation.Id == suitId)) + if (!fullProfile.CustomisationUnlocks.Exists(customisation => customisation.Id == suitId)) { // Clothing item doesn't exist in profile, add it fullProfile.CustomisationUnlocks.Add(new CustomisationStorage @@ -403,7 +403,7 @@ public class TraderHelper( return null; } - return _randomUtil.GetInt((int) traderDetails.Seconds.Min, (int) traderDetails.Seconds.Max); + return _randomUtil.GetInt(traderDetails.Seconds.Min, traderDetails.Seconds.Max); } public TraderLoyaltyLevel GetLoyaltyLevel(string traderID, PmcData pmcData) @@ -629,7 +629,8 @@ public class TraderHelper( public string GetValidTraderIdByEnumValue(string traderEnumValue) { var traderId = _databaseService.GetTraders(); - var id = traderId.FirstOrDefault(x => x.Value.Base.Id == traderEnumValue || string.Equals(x.Value.Base.Nickname, traderEnumValue, StringComparison.OrdinalIgnoreCase)).Key; + var id = traderId.FirstOrDefault(x => + x.Value.Base.Id == traderEnumValue || string.Equals(x.Value.Base.Nickname, traderEnumValue, StringComparison.OrdinalIgnoreCase)).Key; return id; } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs index 8c869a45..6121feaa 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Models.Enums; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/WeightedRandomHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/WeightedRandomHelper.cs index 397bcd6a..c95f68f7 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/WeightedRandomHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/WeightedRandomHelper.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Spt.Helper; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Helpers; diff --git a/Libraries/SPTarkov.Server.Core/Loaders/BundleLoader.cs b/Libraries/SPTarkov.Server.Core/Loaders/BundleLoader.cs index 74b46715..9eb63616 100644 --- a/Libraries/SPTarkov.Server.Core/Loaders/BundleLoader.cs +++ b/Libraries/SPTarkov.Server.Core/Loaders/BundleLoader.cs @@ -1,181 +1,182 @@ using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -namespace SPTarkov.Server.Core.Loaders +namespace SPTarkov.Server.Core.Loaders; + +/* { - /* + "ModPath" : "/user/mods/Mod3", + "FileName" : "assets/content/weapons/usable_items/item_bottle/textures/client_assets.bundle", + "Bundle" : { + "key" : "assets/content/weapons/usable_items/item_bottle/textures/client_assets.bundle", + "dependencyKeys" : [ ] + }, + "Crc" : 1030040371, + "Dependencies" : [ ] +} */ +public class BundleInfo +{ + public BundleInfo() { - "ModPath" : "/user/mods/Mod3", - "FileName" : "assets/content/weapons/usable_items/item_bottle/textures/client_assets.bundle", - "Bundle" : { - "key" : "assets/content/weapons/usable_items/item_bottle/textures/client_assets.bundle", - "dependencyKeys" : [ ] - }, - "Crc" : 1030040371, - "Dependencies" : [ ] - } */ - public class BundleInfo - { - public string? ModPath - { - get; - set; - } - - public string FileName - { - get; - set; - } - - public BundleManifestEntry Bundle - { - get; - set; - } - - public uint Crc - { - get; - set; - } - - public List Dependencies - { - get; - set; - } - - public BundleInfo() {} - - public BundleInfo( - string modPath, - BundleManifestEntry bundle, - uint bundleHash) - { - ModPath = modPath; - FileName = bundle.Key; - Bundle = bundle; - Crc = bundleHash; - Dependencies = bundle?.DependencyKeys ?? []; - } } - [Injectable(InjectionType.Singleton)] - public class BundleLoader + public BundleInfo( + string modPath, + BundleManifestEntry bundle, + uint bundleHash) { - private readonly ISptLogger _logger; - private readonly HashUtil _hashUtil; - private readonly JsonUtil _jsonUtil; - private readonly FileUtil _fileUtil; - private readonly BundleHashCacheService _bundleHashCacheService; - private readonly InMemoryCacheService _inMemoryCacheService; - private readonly ICloner _cloner; - private readonly Dictionary _bundles = new Dictionary(); + ModPath = modPath; + FileName = bundle.Key; + Bundle = bundle; + Crc = bundleHash; + Dependencies = bundle?.DependencyKeys ?? []; + } - public BundleLoader( - ISptLogger logger, - HashUtil hashUtil, - JsonUtil jsonUtil, - FileUtil fileUtil, - BundleHashCacheService bundleHashCacheService, - InMemoryCacheService inMemoryCacheService, - ICloner cloner) + public string? ModPath + { + get; + set; + } + + public string FileName + { + get; + set; + } + + public BundleManifestEntry Bundle + { + get; + set; + } + + public uint Crc + { + get; + set; + } + + public List Dependencies + { + get; + set; + } +} + +[Injectable(InjectionType.Singleton)] +public class BundleLoader +{ + private readonly BundleHashCacheService _bundleHashCacheService; + private readonly Dictionary _bundles = new(); + private readonly ICloner _cloner; + private readonly FileUtil _fileUtil; + private readonly HashUtil _hashUtil; + private readonly InMemoryCacheService _inMemoryCacheService; + private readonly JsonUtil _jsonUtil; + private readonly ISptLogger _logger; + + public BundleLoader( + ISptLogger logger, + HashUtil hashUtil, + JsonUtil jsonUtil, + FileUtil fileUtil, + BundleHashCacheService bundleHashCacheService, + InMemoryCacheService inMemoryCacheService, + ICloner cloner) + { + _logger = logger; + _hashUtil = hashUtil; + _jsonUtil = jsonUtil; + _fileUtil = fileUtil; + _bundleHashCacheService = bundleHashCacheService; + _inMemoryCacheService = inMemoryCacheService; + _cloner = cloner; + } + + /// + /// Handle singleplayer/bundles + /// + /// List of loaded bundles. + public List GetBundles() + { + var result = new List(); + + foreach (var bundle in _bundles) { - _logger = logger; - _hashUtil = hashUtil; - _jsonUtil = jsonUtil; - _fileUtil = fileUtil; - _bundleHashCacheService = bundleHashCacheService; - _inMemoryCacheService = inMemoryCacheService; - _cloner = cloner; - } - /// - /// Handle singleplayer/bundles - /// - /// List of loaded bundles. - public List GetBundles() - { - var result = new List(); - - foreach (var bundle in _bundles) { - result.Add(bundle.Value); - } - - return result; + result.Add(bundle.Value); } - public BundleInfo? GetBundle(string bundleKey) + return result; + } + + public BundleInfo? GetBundle(string bundleKey) + { + return _cloner.Clone(_bundles.GetValueOrDefault(bundleKey)); + } + + public void AddBundles(string modPath) + { + // modPath should be relative to the server exe - ./user/mods/Mod3 + // TODO: make sure the mod is passing a path that is relative from the server exe + + var modBundlesJson = _fileUtil.ReadFile(Path.Join(Directory.GetCurrentDirectory(), modPath, "bundles.json")); + var modBundles = _jsonUtil.Deserialize(modBundlesJson); + var bundleManifestArr = modBundles?.Manifest; + + foreach (var bundleManifest in bundleManifestArr) { - return _cloner.Clone(_bundles.GetValueOrDefault(bundleKey)); - } + var relativeModPath = modPath.Replace('\\', '/'); - public void AddBundles(string modPath) - { - // modPath should be relative to the server exe - ./user/mods/Mod3 - // TODO: make sure the mod is passing a path that is relative from the server exe + var bundleLocalPath = Path.Join(relativeModPath, "bundles", bundleManifest.Key).Replace('\\', '/'); - var modBundlesJson = _fileUtil.ReadFile(Path.Join(Directory.GetCurrentDirectory(), modPath, "bundles.json")); - var modBundles = _jsonUtil.Deserialize(modBundlesJson); - var bundleManifestArr = modBundles?.Manifest; - - foreach (var bundleManifest in bundleManifestArr) + if (!_bundleHashCacheService.CalculateAndMatchHash(bundleLocalPath)) { - var relativeModPath = modPath.Replace('\\', '/'); - - var bundleLocalPath = Path.Join(relativeModPath, "bundles", bundleManifest.Key).Replace('\\', '/'); - - if (!_bundleHashCacheService.CalculateAndMatchHash(bundleLocalPath)) - { - _bundleHashCacheService.CalculateAndStoreHash(bundleLocalPath); - } - - var bundleHash = _bundleHashCacheService.GetStoredValue(bundleLocalPath); - - AddBundle(bundleManifest.Key, new BundleInfo(relativeModPath, bundleManifest, bundleHash)); + _bundleHashCacheService.CalculateAndStoreHash(bundleLocalPath); } - } - public void AddBundle(string key, BundleInfo bundle) - { - var success = _bundles.TryAdd(key, bundle); - if (!success) - { - _logger.Error($"Unable to add bundle: {key}"); - } + var bundleHash = _bundleHashCacheService.GetStoredValue(bundleLocalPath); + + AddBundle(bundleManifest.Key, new BundleInfo(relativeModPath, bundleManifest, bundleHash)); } } - public record BundleManifest + public void AddBundle(string key, BundleInfo bundle) { - [JsonPropertyName("manifest")] - public List Manifest + var success = _bundles.TryAdd(key, bundle); + if (!success) { - get; set; - } - } - - public record BundleManifestEntry - { - [JsonPropertyName("key")] - public string Key - { - get; - set; - } - - [JsonPropertyName("dependencyKeys")] - public List? DependencyKeys - { - get; - set; + _logger.Error($"Unable to add bundle: {key}"); } } } +public record BundleManifest +{ + [JsonPropertyName("manifest")] + public List Manifest + { + get; + set; + } +} +public record BundleManifestEntry +{ + [JsonPropertyName("key")] + public string Key + { + get; + set; + } + [JsonPropertyName("dependencyKeys")] + public List? DependencyKeys + { + get; + set; + } +} diff --git a/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs b/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs index 999937c9..fcc8f0b4 100644 --- a/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs +++ b/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.External; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Loaders; diff --git a/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs b/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs index 7d88b03a..4161e19a 100644 --- a/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs +++ b/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.DI; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.External; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Loaders; diff --git a/Libraries/SPTarkov.Server.Core/Models/Common/IdWithCount.cs b/Libraries/SPTarkov.Server.Core/Models/Common/IdWithCount.cs index 78e6bf6e..400c8e84 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Common/IdWithCount.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Common/IdWithCount.cs @@ -5,7 +5,7 @@ namespace SPTarkov.Server.Core.Models.Common; public record IdWithCount { /// - /// ID of stack to take money from + /// ID of stack to take money from /// [JsonPropertyName("id")] public string? Id @@ -15,7 +15,7 @@ public record IdWithCount } /// - /// Amount of money to take off player for treatment + /// Amount of money to take off player for treatment /// [JsonPropertyName("count")] public double? Count diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs index e2b6b92a..9ddc27a8 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs @@ -9651,7 +9651,7 @@ public record Preset } /// - /// Default presets have this property + /// Default presets have this property /// [JsonPropertyName("_encyclopedia")] public string? Encyclopedia diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Location.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Location.cs index ff5e2f4f..3f00420d 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Location.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Location.cs @@ -7,7 +7,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Common; public record Location { /// - /// Map meta-data + /// Map meta-data /// [JsonPropertyName("base")] public LocationBase? Base @@ -17,7 +17,7 @@ public record Location } /// - /// Loose loot positions and item weights + /// Loose loot positions and item weights /// [JsonPropertyName("looseLoot")] public LazyLoad? LooseLoot @@ -27,7 +27,7 @@ public record Location } /// - /// Static loot item weights + /// Static loot item weights /// [JsonPropertyName("staticLoot")] public LazyLoad>? StaticLoot @@ -37,7 +37,7 @@ public record Location } /// - /// Static container positions and item weights + /// Static container positions and item weights /// [JsonPropertyName("staticContainers")] public LazyLoad? StaticContainers @@ -54,7 +54,7 @@ public record Location } /// - /// All possible static containers on map + their assign groupings + /// All possible static containers on map + their assign groupings /// [JsonPropertyName("statics")] public StaticContainer? Statics @@ -64,7 +64,7 @@ public record Location } /// - /// All possible map extracts + /// All possible map extracts /// [JsonPropertyName("allExtracts")] public Exit[] AllExtracts diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LocationBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LocationBase.cs index 1469fa3f..58f73ba6 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LocationBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LocationBase.cs @@ -107,7 +107,7 @@ public record LocationBase } /// - /// Weighting on how likely a bot will be Easy difficulty + /// Weighting on how likely a bot will be Easy difficulty /// [JsonPropertyName("BotEasy")] public int? BotEasy @@ -117,7 +117,7 @@ public record LocationBase } /// - /// Weighting on how likely a bot will be Hard difficulty + /// Weighting on how likely a bot will be Hard difficulty /// [JsonPropertyName("BotHard")] public int? BotHard @@ -127,7 +127,7 @@ public record LocationBase } /// - /// Weighting on how likely a bot will be Impossible difficulty + /// Weighting on how likely a bot will be Impossible difficulty /// [JsonPropertyName("BotImpossible")] public int? BotImpossible @@ -151,7 +151,7 @@ public record LocationBase } /// - /// Maximum Number of bots that are currently alive/loading/delayed + /// Maximum Number of bots that are currently alive/loading/delayed /// [JsonPropertyName("BotMax")] public int? BotMax @@ -161,7 +161,7 @@ public record LocationBase } /// - /// Is not used in 33420 TODO: still needed? + /// Is not used in 33420 TODO: still needed? /// [JsonPropertyName("BotMaxPlayer")] public int? BotMaxPlayer @@ -171,7 +171,7 @@ public record LocationBase } /// - /// Is not used in 33420 TODO: still needed? + /// Is not used in 33420 TODO: still needed? /// [JsonPropertyName("BotMaxTimePlayer")] public int? BotMaxTimePlayer @@ -181,7 +181,7 @@ public record LocationBase } /// - /// Does not even exist in the client in 33420 TODO: still needed? + /// Does not even exist in the client in 33420 TODO: still needed? /// [JsonPropertyName("BotMaxPvE")] public int? BotMaxPvE @@ -191,7 +191,7 @@ public record LocationBase } /// - /// Weighting on how likely a bot will be Normal difficulty + /// Weighting on how likely a bot will be Normal difficulty /// [JsonPropertyName("BotNormal")] public int? BotNormal @@ -201,7 +201,7 @@ public record LocationBase } /// - /// How many bot slots that need to be open before trying to spawn new bots. + /// How many bot slots that need to be open before trying to spawn new bots. /// [JsonPropertyName("BotSpawnCountStep")] public int? BotSpawnCountStep @@ -211,7 +211,7 @@ public record LocationBase } /// - /// How often to check if bots are spawn-able. In seconds + /// How often to check if bots are spawn-able. In seconds /// [JsonPropertyName("BotSpawnPeriodCheck")] public int? BotSpawnPeriodCheck @@ -221,7 +221,7 @@ public record LocationBase } /// - /// The bot spawn will toggle on and off in intervals of Off(Min/Max) and On(Min/Max) + /// The bot spawn will toggle on and off in intervals of Off(Min/Max) and On(Min/Max) /// [JsonPropertyName("BotSpawnTimeOffMax")] public int? BotSpawnTimeOffMax @@ -252,7 +252,7 @@ public record LocationBase } /// - /// How soon bots will be allowed to spawn + /// How soon bots will be allowed to spawn /// [JsonPropertyName("BotStart")] public int? BotStart @@ -262,7 +262,7 @@ public record LocationBase } /// - /// After this long bots will no longer spawn + /// After this long bots will no longer spawn /// [JsonPropertyName("BotStop")] public int? BotStop @@ -1729,7 +1729,7 @@ public record ColliderProps public record Exit { /// - /// % Chance out of 100 exit will appear in raid + /// % Chance out of 100 exit will appear in raid /// [JsonPropertyName("Chance")] public double? Chance @@ -2013,7 +2013,7 @@ public record Wave } /// - /// OPTIONAL - Needs to be unique - Used by custom wave service to ensure same wave isnt added multiple times + /// OPTIONAL - Needs to be unique - Used by custom wave service to ensure same wave isnt added multiple times /// [JsonPropertyName("sptId")] public string? SptId @@ -2030,7 +2030,7 @@ public record Wave } /// - /// 'pve' and/or 'regular' + /// 'pve' and/or 'regular' /// [JsonPropertyName("SpawnMode")] public List? SpawnMode diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LooseLoot.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LooseLoot.cs index bfd2f4ec..83996d3c 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LooseLoot.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/LooseLoot.cs @@ -222,6 +222,7 @@ public record LooseLootItemDistribution public record ComposedKey { private string? _key; + [JsonPropertyName("key")] public string? Key { diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs index 5118d7b3..ee22fd8e 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs @@ -41,7 +41,7 @@ public record PostRaidStats } /// - /// Only found in profile we get from client post raid + /// Only found in profile we get from client post raid /// [JsonPropertyName("Arena")] public EftStats? Arena diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs index 1e7a5411..ced49d93 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs @@ -25,7 +25,7 @@ public record BotBase } /// - /// SPT property - use to store player id - TODO - move to AID ( account id as guid of choice) + /// SPT property - use to store player id - TODO - move to AID ( account id as guid of choice) /// [JsonPropertyName("sessionId")] public string? SessionId @@ -150,7 +150,7 @@ public record BotBase } /// - /// Achievement id and timestamp + /// Achievement id and timestamp /// [JsonPropertyName("Achievements")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] @@ -219,7 +219,7 @@ public record BotBase } /// - /// SPT specific property used during bot generation in raid + /// SPT specific property used during bot generation in raid /// [JsonPropertyName("sptIsPmc")] public bool? IsPmc @@ -233,7 +233,7 @@ public record MoneyTransferLimits { // Resets every 24 hours in live /// - /// TODO: Implement + /// TODO: Implement /// [JsonPropertyName("nextResetTime")] public double? NextResetTime @@ -286,8 +286,9 @@ public record TaskConditionCounter get; set; } + /// - /// Quest id + /// Quest id /// [JsonPropertyName("sourceId")] public string? SourceId @@ -857,7 +858,7 @@ public record BotBaseInventory } /// - /// Key is hideout area enum numeric as string e.g. "24", value is area _id + /// Key is hideout area enum numeric as string e.g. "24", value is area _id /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("hideoutAreaStashes")] @@ -1563,7 +1564,7 @@ public record BackendCounter public record InsuredItem { /// - /// Trader ID item was insured by + /// Trader ID item was insured by /// [JsonPropertyName("tid")] public string? TId @@ -1608,7 +1609,7 @@ public record Hideout } /// - /// 32 char hex value + /// 32 char hex value /// public string? Seed { @@ -1693,7 +1694,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Seconds passed of production + /// Seconds passed of production /// public double? Progress { @@ -1702,7 +1703,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Is craft in some state of being worked on by client (crafting/ready to pick up) + /// Is craft in some state of being worked on by client (crafting/ready to pick up) /// [JsonPropertyName("inProgress")] public bool? InProgress @@ -1724,7 +1725,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Seconds needed to fully craft + /// Seconds needed to fully craft /// public double? ProductionTime { @@ -1763,7 +1764,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Used in hideout production.json + /// Used in hideout production.json /// public bool? needFuelForAllProductionTime { @@ -1772,7 +1773,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Used when sending data to client + /// Used when sending data to client /// public bool? NeedFuelForAllProductionTime { @@ -1788,7 +1789,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Some crafts are always inProgress, but need to be reset, e.g. water collector + /// Some crafts are always inProgress, but need to be reset, e.g. water collector /// [JsonPropertyName("sptIsComplete")] public bool? SptIsComplete @@ -1798,7 +1799,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Is the craft a Continuous, e.g. bitcoins/water collector + /// Is the craft a Continuous, e.g. bitcoins/water collector /// [JsonPropertyName("sptIsContinuous")] public bool? SptIsContinuous @@ -1808,7 +1809,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done + /// Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done /// [JsonPropertyName("sptRequiredTools")] public List? SptRequiredTools @@ -1818,7 +1819,7 @@ public record Production // use this instead of productive and scavcase } /// - /// Craft is cultist circle sacrifice + /// Craft is cultist circle sacrifice /// [JsonPropertyName("sptIsCultistCircle")] public bool? SptIsCultistCircle @@ -1865,7 +1866,7 @@ public record BotHideoutArea } /// - /// Must be integer + /// Must be integer /// [JsonPropertyName("completeTime")] public int? CompleteTime @@ -1976,7 +1977,7 @@ public record Quests } /// - /// Property does not exist in live profile data, but is used by ProfileChanges.questsStatus when sent to client + /// Property does not exist in live profile data, but is used by ProfileChanges.questsStatus when sent to client /// [JsonPropertyName("completedConditions")] public List? CompletedConditions diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotType.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotType.cs index a18a4e1c..0b707f0a 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotType.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotType.cs @@ -436,7 +436,7 @@ public record DifficultyCategories public record Experience { /// - /// key = bot difficulty + /// key = bot difficulty /// [JsonPropertyName("aggressorBonus")] public Dictionary? AggressorBonus @@ -453,7 +453,7 @@ public record Experience } /// - /// key = bot difficulty + /// key = bot difficulty /// [JsonPropertyName("reward")] public Dictionary>? Reward @@ -463,7 +463,7 @@ public record Experience } /// - /// key = bot difficulty + /// key = bot difficulty /// [JsonPropertyName("standingForKill")] public Dictionary? StandingForKill @@ -493,7 +493,7 @@ public record Generation public record GenerationData { /// - /// key: number of items, value: weighting + /// key: number of items, value: weighting /// [JsonPropertyName("weights")] public Dictionary? Weights @@ -503,7 +503,7 @@ public record GenerationData } /// - /// Array of item tpls + /// Array of item tpls /// [JsonPropertyName("whitelist")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs index b421fe65..19a04dce 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs @@ -93,7 +93,7 @@ public record Item public record HideoutItem { /// - /// Hideout inventory id that was used by improvement action + /// Hideout inventory id that was used by improvement action /// [JsonPropertyName("_id")] public string? _Id @@ -183,7 +183,7 @@ public record ItemLocation } /// - /// SPT property? + /// SPT property? /// [JsonPropertyName("rotation")] public object? Rotation @@ -226,7 +226,7 @@ public record Upd } /// - /// SPT specific property, not made by BSG + /// SPT specific property, not made by BSG /// [JsonPropertyName("sptPresetId")] public string? SptPresetId diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/ProfileTemplate.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/ProfileTemplate.cs index b05c43d4..106ae991 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/ProfileTemplate.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/ProfileTemplate.cs @@ -190,7 +190,7 @@ public record ProfileTraderTemplate } /// - /// How many days is usage of the flea blocked for upon profile creation + /// How many days is usage of the flea blocked for upon profile creation /// [JsonPropertyName("fleaBlockedDays")] public int? FleaBlockedDays @@ -200,7 +200,7 @@ public record ProfileTraderTemplate } /// - /// What traders default to being locked on profile creation + /// What traders default to being locked on profile creation /// [JsonPropertyName("lockedByDefaultOverride")] public List? LockedByDefaultOverride @@ -210,7 +210,7 @@ public record ProfileTraderTemplate } /// - /// What traders should have their clothing unlocked/purchased on creation + /// What traders should have their clothing unlocked/purchased on creation /// [JsonPropertyName("purchaseAllClothingByDefaultForTrader")] public List? PurchaseAllClothingByDefaultForTrader diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs index 3f7ba023..6ccbbc4e 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs @@ -1,4 +1,3 @@ -using System.Text.Json; using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Utils.Json; diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/RepeatableQuests.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/RepeatableQuests.cs index caeb35d3..dc66508f 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/RepeatableQuests.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/RepeatableQuests.cs @@ -220,7 +220,7 @@ public record PmcDataRepeatableQuest } /// - /// What it costs to reset: QuestId, ChangeRequirement. Redundant to change requirements within RepeatableQuest + /// What it costs to reset: QuestId, ChangeRequirement. Redundant to change requirements within RepeatableQuest /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("changeRequirement")] @@ -265,7 +265,7 @@ public record ChangeRequirement public record ChangeCost { /// - /// What item it will take to reset daily + /// What item it will take to reset daily /// [JsonPropertyName("templateId")] public string? TemplateId @@ -275,7 +275,7 @@ public record ChangeCost } /// - /// Amount of item needed to reset + /// Amount of item needed to reset /// [JsonPropertyName("count")] public int? Count diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Reward.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Reward.cs index a1634eb2..83ae82ec 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Reward.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Reward.cs @@ -56,7 +56,7 @@ public record Reward } /// - /// Hideout area id + /// Hideout area id /// [JsonPropertyName("traderId")] public object? TraderId @@ -94,7 +94,7 @@ public record Reward } /// - /// Game editions whitelisted to get reward + /// Game editions whitelisted to get reward /// [JsonPropertyName("availableInGameEditions")] public HashSet? AvailableInGameEditions @@ -104,7 +104,7 @@ public record Reward } /// - /// Game editions blacklisted from getting reward + /// Game editions blacklisted from getting reward /// [JsonPropertyName("notAvailableInGameEditions")] public HashSet? NotAvailableInGameEditions diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs index 1cb4cc5f..82a16edc 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs @@ -1,5 +1,3 @@ -using System.Security.Cryptography; -using System.Text; using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Utils.Json.Converters; @@ -14,6 +12,8 @@ public record TemplateItem private string? _parent; + private string _prototype; + private string? _type; [JsonPropertyName("_id")] @@ -75,7 +75,6 @@ public record TemplateItem set; } - private string _prototype; [JsonPropertyName("_proto")] public string? Prototype { @@ -92,6 +91,9 @@ public record TemplateItem public record Props { + private string _backgroundColor; + + private string _itemSound; private string? _metascoreGroup; private string? _rarityPvE; @@ -161,7 +163,6 @@ public record Props set; } - private string _backgroundColor; [JsonPropertyName("BackgroundColor")] public string? BackgroundColor { @@ -221,7 +222,6 @@ public record Props set; } - private string _itemSound; [JsonPropertyName("ItemSound")] public string? ItemSound { diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Trader.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Trader.cs index 83ce5e3f..9c69b49f 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Trader.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Trader.cs @@ -422,8 +422,9 @@ public record TraderRepair get; set; } + /// - /// Doesn't exist in client object + /// Doesn't exist in client object /// [JsonPropertyName("excluded_id_list")] public List? ExcludedIdList diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Dialog/ChatServer.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Dialog/ChatServer.cs index aed655b6..77e2ad5a 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Dialog/ChatServer.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Dialog/ChatServer.cs @@ -61,7 +61,7 @@ public record ChatServer } /// - /// Possibly removed + /// Possibly removed /// [JsonPropertyName("IsDeveloper")] public bool? IsDeveloper diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Game/GameConfigResponse.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Game/GameConfigResponse.cs index 4cc80109..5c9ec5d0 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Game/GameConfigResponse.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Game/GameConfigResponse.cs @@ -68,7 +68,7 @@ public record GameConfigResponse } /// - /// Total in game time + /// Total in game time /// [JsonPropertyName("totalInGame")] public double? TotalInGame diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Health/HealthTreatmentRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Health/HealthTreatmentRequestData.cs index 8d5f8f7a..29af252b 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Health/HealthTreatmentRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Health/HealthTreatmentRequestData.cs @@ -14,8 +14,8 @@ public record HealthTreatmentRequestData : InventoryBaseActionRequestData } /// - /// Id of stack to take money from
- /// Amount of money to take off player for treatment + /// Id of stack to take money from
+ /// Amount of money to take off player for treatment ///
[JsonPropertyName("items")] public List? Items @@ -124,7 +124,7 @@ public record BodyPartEffects } /// - /// Effects in array to be removed + /// Effects in array to be removed /// public List Effects { diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs index 332f277d..479e5497 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs @@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Hideout; public record HandleQTEEventRequestData : InventoryBaseActionRequestData { /// - /// true if QTE was successful, otherwise false + /// true if QTE was successful, otherwise false /// [JsonPropertyName("results")] public List? Results @@ -16,7 +16,7 @@ public record HandleQTEEventRequestData : InventoryBaseActionRequestData } /// - /// Id of the QTE object used from db/hideout/qte.json + /// Id of the QTE object used from db/hideout/qte.json /// [JsonPropertyName("id")] public string? Id diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutArea.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutArea.cs index cc7ba41a..fdd1e838 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutArea.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutArea.cs @@ -132,7 +132,7 @@ public record Stage } /// - /// Containers inventory tpl + /// Containers inventory tpl /// [JsonPropertyName("container")] public string? Container diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs index 0556887a..5edbddd0 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs @@ -8,7 +8,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Hideout; public record HideoutImproveAreaRequestData : InventoryBaseActionRequestData { /// - /// Hideout area id from areas.json + /// Hideout area id from areas.json /// [JsonPropertyName("id")] public string? AreaId diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutProduction.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutProduction.cs index 0fb5e73e..59ad946f 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutProduction.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Hideout/HideoutProduction.cs @@ -59,7 +59,7 @@ public record HideoutProduction } /// - /// Tpl of item being crafted + /// Tpl of item being crafted /// [JsonPropertyName("endProduct")] public string? EndProduct diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemRequestData.cs index ad38660e..55f320ce 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemRequestData.cs @@ -5,7 +5,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Inventory; public record AddItemRequestData { /// - /// Trader id + /// Trader id /// [JsonPropertyName("tid")] public string? TraderId diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemTempObject.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemTempObject.cs index 2acab7f1..706963d7 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemTempObject.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemTempObject.cs @@ -34,7 +34,7 @@ public record AddItemTempObject } /// - /// Container item will be placed in - stash or sorting table + /// Container item will be placed in - stash or sorting table /// [JsonPropertyName("containerId")] public string? ContainerIdentifier diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemsDirectRequest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemsDirectRequest.cs index f67b11ac..90a8360f 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemsDirectRequest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/AddItemsDirectRequest.cs @@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Inventory; public record AddItemsDirectRequest { /// - /// Item and child mods to add to player inventory + /// Item and child mods to add to player inventory /// [JsonPropertyName("itemsWithModsToAdd")] public List>? ItemsWithModsToAdd @@ -21,8 +21,9 @@ public record AddItemsDirectRequest get; set; } + /// - /// Runs after EACH item with children is added + /// Runs after EACH item with children is added /// [JsonPropertyName("callback")] public Action? Callback @@ -30,8 +31,9 @@ public record AddItemsDirectRequest get; set; } + /// - /// Should sorting table be used when no space found in stash + /// Should sorting table be used when no space found in stash /// [JsonPropertyName("useSortingTable")] public bool? UseSortingTable diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/InventorySplitRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/InventorySplitRequestData.cs index 326bbb81..9bdf1451 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/InventorySplitRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/InventorySplitRequestData.cs @@ -5,7 +5,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Inventory; public record InventorySplitRequestData : InventoryBaseActionRequestData { /// - /// Id of item to split + /// Id of item to split /// [JsonPropertyName("splitItem")] public string? SplitItem @@ -15,7 +15,7 @@ public record InventorySplitRequestData : InventoryBaseActionRequestData } /// - /// Id of new item stack + /// Id of new item stack /// [JsonPropertyName("newItem")] public string? NewItem @@ -25,7 +25,7 @@ public record InventorySplitRequestData : InventoryBaseActionRequestData } /// - /// Destination new item will be placed in + /// Destination new item will be placed in /// [JsonPropertyName("container")] public Container? Container diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/PinOrLockItemRequest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/PinOrLockItemRequest.cs index 9f1dae03..76eb25aa 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/PinOrLockItemRequest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Inventory/PinOrLockItemRequest.cs @@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Inventory; public record PinOrLockItemRequest : InventoryBaseActionRequestData { /// - /// Id of item being pinned + /// Id of item being pinned /// [JsonPropertyName("Item")] public string? Item @@ -16,7 +16,7 @@ public record PinOrLockItemRequest : InventoryBaseActionRequestData } /// - /// "Pinned"/"Locked"/"Free" + /// "Pinned"/"Locked"/"Free" /// [JsonPropertyName("State")] [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs index 976b5e4d..8ffded38 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs @@ -114,7 +114,7 @@ public record ProfileChange } /// - /// Hideout area improvement id + /// Hideout area improvement id /// [JsonPropertyName("improvements")] public Dictionary? Improvements @@ -307,7 +307,7 @@ public record ItemChanges } /// -/// Related to TraderInfo +/// Related to TraderInfo /// public record TraderData { diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterResponse.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterResponse.cs index 2963ae0c..d174f6f7 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterResponse.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/ItemEvent/ItemEventRouterResponse.cs @@ -1,6 +1,7 @@ namespace SPTarkov.Server.Core.Models.Eft.ItemEvent; + /// -/// An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync +/// An object sent back to the game client that contains alterations the client must make to ensure server/client are in sync /// public record ItemEventRouterResponse : ItemEventRouterBase { diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Location/GetAirdropLootResponse.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Location/GetAirdropLootResponse.cs index a423236f..7d0f48be 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Location/GetAirdropLootResponse.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Location/GetAirdropLootResponse.cs @@ -7,7 +7,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Location; public record GetAirdropLootResponse { /// - /// The type of airdrop + /// The type of airdrop /// [JsonPropertyName("icon")] public AirdropTypeEnum? Icon diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Match/StartLocalRaidRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Match/StartLocalRaidRequestData.cs index fc09bdd9..5d1a8165 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Match/StartLocalRaidRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Match/StartLocalRaidRequestData.cs @@ -56,7 +56,7 @@ public record StartLocalRaidRequestData : IRequestData } /// - /// Should loot generation be skipped, default false + /// Should loot generation be skipped, default false /// [JsonPropertyName("sptSkipLootGeneration")] public bool? ShouldSkipLootGeneration diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs index f399c9dd..a8b255f8 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs @@ -21,7 +21,7 @@ public record PresetBuildActionRequestData : IRequestData } /// - /// name of preset given by player + /// name of preset given by player /// [JsonPropertyName("Name")] public string? Name diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs index ceaa522c..9a12fbd9 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs @@ -24,7 +24,7 @@ public record SptProfile } /// - /// No longer used as of 4.0.0 + /// No longer used as of 4.0.0 /// [Obsolete("Replaced with CustomisationUnlocks")] [JsonPropertyName("suits")] @@ -77,7 +77,7 @@ public record SptProfile } /// - /// Assort purchases made by player since last trader refresh + /// Assort purchases made by player since last trader refresh /// [JsonPropertyName("traderPurchases")] public Dictionary?>? TraderPurchases @@ -87,7 +87,7 @@ public record SptProfile } /// - /// List of friend profile IDs + /// List of friend profile IDs /// [JsonPropertyName("friends")] public List? FriendProfileIds @@ -97,7 +97,7 @@ public record SptProfile } /// - /// Stores profile-related customisation, e.g. clothing / hideout walls / floors + /// Stores profile-related customisation, e.g. clothing / hideout walls / floors /// [JsonPropertyName("customisationUnlocks")] public List? CustomisationUnlocks @@ -127,7 +127,7 @@ public record TraderPurchaseData public record Info { /// - /// main profile id + /// main profile id /// [JsonPropertyName("id")] public string? ProfileId @@ -197,7 +197,7 @@ public record Characters } /// -/// used by profile.userbuilds +/// used by profile.userbuilds /// public record UserBuilds { @@ -331,7 +331,7 @@ public record MagazineTemplateAmmoItem } /// -/// Used by defaultEquipmentPresets.json +/// Used by defaultEquipmentPresets.json /// public record DefaultEquipmentPreset : EquipmentBuild { @@ -704,7 +704,7 @@ public record UpdatableChatMember public record Spt { /// - /// What version of SPT was this profile made with + /// What version of SPT was this profile made with /// [JsonPropertyName("version")] public string? Version @@ -714,7 +714,7 @@ public record Spt } /// - /// What mods has this profile loaded at any point in time + /// What mods has this profile loaded at any point in time /// [JsonPropertyName("mods")] public List? Mods @@ -724,7 +724,7 @@ public record Spt } /// - /// What gifts has this profile received and how many + /// What gifts has this profile received and how many /// [JsonPropertyName("receivedGifts")] public List? ReceivedGifts @@ -734,7 +734,7 @@ public record Spt } /// - /// item TPLs blacklisted from being sold on flea for this profile + /// item TPLs blacklisted from being sold on flea for this profile /// [JsonPropertyName("blacklistedItemTpls")] public HashSet? BlacklistedItemTemplates @@ -744,7 +744,7 @@ public record Spt } /// - /// key: daily type + /// key: daily type /// [JsonPropertyName("freeRepeatableRefreshUsedCount")] public Dictionary? FreeRepeatableRefreshUsedCount @@ -754,7 +754,7 @@ public record Spt } /// - /// When was a profile migrated, value is timestamp + /// When was a profile migrated, value is timestamp /// [JsonPropertyName("migrations")] public Dictionary? Migrations @@ -764,7 +764,7 @@ public record Spt } /// - /// Cultist circle rewards received that are one time use, key (md5) is a combination of sacrificed + reward items + /// Cultist circle rewards received that are one time use, key (md5) is a combination of sacrificed + reward items /// [JsonPropertyName("cultistRewards")] public Dictionary? CultistRewards diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Quests/CompleteQuestRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Quests/CompleteQuestRequestData.cs index c7de6c3a..69acb336 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Quests/CompleteQuestRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Quests/CompleteQuestRequestData.cs @@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Models.Eft.Quests; public record CompleteQuestRequestData : InventoryBaseActionRequestData { /// - /// Quest Id + /// Quest Id /// [JsonPropertyName("qid")] public string? QuestId diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs index 94ab081a..e9c1ebb6 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs @@ -65,7 +65,7 @@ public record RagfairOffer } /// - /// Handbook price + /// Handbook price /// [JsonPropertyName("itemsCost")] public double? ItemsCost @@ -75,7 +75,7 @@ public record RagfairOffer } /// - /// Rouble price per item + /// Rouble price per item /// [JsonPropertyName("requirementsCost")] public double? RequirementsCost @@ -99,7 +99,7 @@ public record RagfairOffer } /// - /// True when offer is sold as pack + /// True when offer is sold as pack /// [JsonPropertyName("sellInOnePiece")] public bool? SellInOnePiece @@ -109,7 +109,7 @@ public record RagfairOffer } /// - /// Rouble price - same as requirementsCost + /// Rouble price - same as requirementsCost /// [JsonPropertyName("summaryCost")] public double? SummaryCost @@ -126,7 +126,7 @@ public record RagfairOffer } /// - /// Trader only + /// Trader only /// [JsonPropertyName("unlimitedCount")] public bool? UnlimitedCount @@ -165,7 +165,7 @@ public record RagfairOffer } /// - /// Tightly bound to offer.items[0].upd.stackObjectsCount + /// Tightly bound to offer.items[0].upd.stackObjectsCount /// [JsonPropertyName("quantity")] public int? Quantity diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Repair/RepairActionDataRequest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Repair/RepairActionDataRequest.cs index 68ddab30..ad3e62f6 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Repair/RepairActionDataRequest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Repair/RepairActionDataRequest.cs @@ -13,7 +13,7 @@ public record RepairActionDataRequest : InventoryBaseActionRequestData } /// - /// item to repair + /// item to repair /// [JsonPropertyName("target")] public string? Target @@ -26,7 +26,7 @@ public record RepairActionDataRequest : InventoryBaseActionRequestData public record RepairKitsInfo { /// - /// id of repair kit to use + /// id of repair kit to use /// [JsonPropertyName("_id")] public string? Id @@ -36,7 +36,7 @@ public record RepairKitsInfo } /// - /// amount of units to reduce kit by + /// amount of units to reduce kit by /// [JsonPropertyName("count")] public float? Count diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs index 937101ad..56f9c9de 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs @@ -27,7 +27,7 @@ public record ProcessBuyTradeRequestData : ProcessBaseTradeRequestData } /// - /// Id of stack to take money from, is money tpl when Action is `SptInsure` + /// Id of stack to take money from, is money tpl when Action is `SptInsure` /// [JsonPropertyName("scheme_items")] public List? SchemeItems diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Weather/WeatherData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Weather/WeatherData.cs index 792328c7..4faccd92 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Weather/WeatherData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Weather/WeatherData.cs @@ -72,7 +72,7 @@ public record Weather } /// - /// 1 - 3 light rain, 3+ 'rain' + /// 1 - 3 light rain, 3+ 'rain' /// [JsonPropertyName("rain")] public double? Rain @@ -103,7 +103,7 @@ public record Weather } /// - /// < -0.4 = clear day + /// < -0.4 = clear day /// [JsonPropertyName("cloud")] public double? Cloud diff --git a/Libraries/SPTarkov.Server.Core/Models/Enums/BodyPartColliderType.cs b/Libraries/SPTarkov.Server.Core/Models/Enums/BodyPartColliderType.cs index e93b9e22..00b081a0 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Enums/BodyPartColliderType.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Enums/BodyPartColliderType.cs @@ -1,33 +1,32 @@ -namespace SPTarkov.Server.Core.Models.Enums +namespace SPTarkov.Server.Core.Models.Enums; + +public enum BodyPartColliderType { - public enum BodyPartColliderType - { - None = -1, - HeadCommon, - RibcageUp, - Pelvis = 3, - LeftUpperArm, - LeftForearm, - RightUpperArm, - RightForearm, - LeftThigh, - LeftCalf, - RightThigh, - RightCalf, - ParietalHead, - BackHead, - Ears, - Eyes, - Jaw, - NeckFront, - NeckBack, - RightSideChestUp, - LeftSideChestUp, - SpineTop, - SpineDown, - PelvisBack, - RightSideChestDown, - LeftSideChestDown, - RibcageLow - } + None = -1, + HeadCommon, + RibcageUp, + Pelvis = 3, + LeftUpperArm, + LeftForearm, + RightUpperArm, + RightForearm, + LeftThigh, + LeftCalf, + RightThigh, + RightCalf, + ParietalHead, + BackHead, + Ears, + Eyes, + Jaw, + NeckFront, + NeckBack, + RightSideChestUp, + LeftSideChestUp, + SpineTop, + SpineDown, + PelvisBack, + RightSideChestDown, + LeftSideChestDown, + RibcageLow } diff --git a/Libraries/SPTarkov.Server.Core/Models/Enums/DamageType.cs b/Libraries/SPTarkov.Server.Core/Models/Enums/DamageType.cs index c7f4fa1b..4b48b160 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Enums/DamageType.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Enums/DamageType.cs @@ -1,31 +1,30 @@ -namespace SPTarkov.Server.Core.Models.Enums +namespace SPTarkov.Server.Core.Models.Enums; + +public enum DamageType { - public enum DamageType - { - Undefined = 1, - Fall = 2, - Explosion = 4, - Barbed = 8, - Flame = 16, - GrenadeFragment = 32, - Impact = 64, - Existence = 128, - Medicine = 256, - Bullet = 512, - Melee = 1024, - Landmine = 2048, - Sniper = 4096, - Blunt = 8192, - LightBleeding = 16384, - HeavyBleeding = 32768, - Dehydration = 65536, - Exhaustion = 131072, - RadExposure = 262144, - Stimulator = 524288, - Poison = 1048576, - LethalToxin = 2097152, - Btr = 4194304, - Artillery = 8388608, - Environment = 16777216 - } + Undefined = 1, + Fall = 2, + Explosion = 4, + Barbed = 8, + Flame = 16, + GrenadeFragment = 32, + Impact = 64, + Existence = 128, + Medicine = 256, + Bullet = 512, + Melee = 1024, + Landmine = 2048, + Sniper = 4096, + Blunt = 8192, + LightBleeding = 16384, + HeavyBleeding = 32768, + Dehydration = 65536, + Exhaustion = 131072, + RadExposure = 262144, + Stimulator = 524288, + Poison = 1048576, + LethalToxin = 2097152, + Btr = 4194304, + Artillery = 8388608, + Environment = 16777216 } diff --git a/Libraries/SPTarkov.Server.Core/Models/Enums/ItemTpl.cs b/Libraries/SPTarkov.Server.Core/Models/Enums/ItemTpl.cs index 7f4663d3..c90cfe57 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Enums/ItemTpl.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Enums/ItemTpl.cs @@ -1,4 +1,5 @@ // This is an auto generated file, do not modify. Re-generate by running ItemTplGenerator.exe + public static class ItemTpl { public const string AMMO_127X108_B32 = "5cde8864d7f00c0010373be1"; diff --git a/Libraries/SPTarkov.Server.Core/Models/Enums/PlayerSide.cs b/Libraries/SPTarkov.Server.Core/Models/Enums/PlayerSide.cs index ab51afd3..6a450a93 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Enums/PlayerSide.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Enums/PlayerSide.cs @@ -1,9 +1,8 @@ -namespace SPTarkov.Server.Core.Models.Enums +namespace SPTarkov.Server.Core.Models.Enums; + +public enum PlayerSide { - public enum PlayerSide - { - Usec = 1, - Bear = 2, - Savage = 4 - } + Usec = 1, + Bear = 2, + Savage = 4 } diff --git a/Libraries/SPTarkov.Server.Core/Models/Enums/Weapons.cs b/Libraries/SPTarkov.Server.Core/Models/Enums/Weapons.cs index 2952a87d..f7384764 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Enums/Weapons.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Enums/Weapons.cs @@ -1,4 +1,5 @@ // This is an auto generated file, do not modify. Re-generate by running ItemTplGenerator.exe + public static class Weapons { public const string ASSAULTCARBINE_762X39_OP_SKS = "587e02ff24597743df3deaeb"; diff --git a/Libraries/SPTarkov.Server.Core/Models/Logging/LogTextColor.cs b/Libraries/SPTarkov.Server.Core/Models/Logging/LogTextColor.cs index 1a1783f5..9b8df4ec 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Logging/LogTextColor.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Logging/LogTextColor.cs @@ -10,5 +10,5 @@ public enum LogTextColor Magenta = 35, Cyan = 36, White = 37, - Gray = 90, + Gray = 90 } diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Bots/GenerateWeaponRequest.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Bots/GenerateWeaponRequest.cs index 374a9b43..5a12d24a 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Bots/GenerateWeaponRequest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Bots/GenerateWeaponRequest.cs @@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Models.Spt.Bots; public record GenerateWeaponRequest { /// - /// Weapon to add mods to / result that is returned + /// Weapon to add mods to / result that is returned /// [JsonPropertyName("weapon")] public List? Weapon @@ -16,7 +16,7 @@ public record GenerateWeaponRequest } /// - /// Pool of compatible mods to attach to weapon + /// Pool of compatible mods to attach to weapon /// [JsonPropertyName("modPool")] public GlobalMods? ModPool @@ -26,7 +26,7 @@ public record GenerateWeaponRequest } /// - /// ParentId of weapon + /// ParentId of weapon /// [JsonPropertyName("weaponId")] public string? WeaponId @@ -36,7 +36,7 @@ public record GenerateWeaponRequest } /// - /// Weapon which mods will be generated on + /// Weapon which mods will be generated on /// [JsonPropertyName("parentTemplate")] public TemplateItem? ParentTemplate @@ -46,7 +46,7 @@ public record GenerateWeaponRequest } /// - /// Chance values mod will be added + /// Chance values mod will be added /// [JsonPropertyName("modSpawnChances")] public Dictionary? ModSpawnChances @@ -56,7 +56,7 @@ public record GenerateWeaponRequest } /// - /// Ammo tpl to use when generating magazines/cartridges + /// Ammo tpl to use when generating magazines/cartridges /// [JsonPropertyName("ammoTpl")] public string? AmmoTpl @@ -66,7 +66,7 @@ public record GenerateWeaponRequest } /// - /// Bot-specific properties + /// Bot-specific properties /// [JsonPropertyName("botData")] public BotData? BotData @@ -76,7 +76,7 @@ public record GenerateWeaponRequest } /// - /// limits placed on certain mod types per gun + /// limits placed on certain mod types per gun /// [JsonPropertyName("modLimits")] public BotModLimits? ModLimits @@ -86,7 +86,7 @@ public record GenerateWeaponRequest } /// - /// Info related to the weapon being generated + /// Info related to the weapon being generated /// [JsonPropertyName("weaponStats")] public WeaponStats? WeaponStats @@ -96,7 +96,7 @@ public record GenerateWeaponRequest } /// - /// Array of item tpls the weapon does not support + /// Array of item tpls the weapon does not support /// [JsonPropertyName("conflictingItemTpls")] public HashSet? ConflictingItemTpls @@ -109,7 +109,7 @@ public record GenerateWeaponRequest public record BotData { /// - /// Role of bot weapon is generated for + /// Role of bot weapon is generated for /// [JsonPropertyName("role")] public string? Role @@ -119,7 +119,7 @@ public record BotData } /// - /// Level of the bot weapon is being generated for + /// Level of the bot weapon is being generated for /// [JsonPropertyName("level")] public int? Level @@ -129,7 +129,7 @@ public record BotData } /// - /// role of bot when accessing bot.json equipment config settings + /// role of bot when accessing bot.json equipment config settings /// [JsonPropertyName("equipmentRole")] public string? EquipmentRole diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs index a31f00ca..217fa40d 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs @@ -15,7 +15,7 @@ public record BotConfig : BaseConfig } = "spt-bot"; /// - /// How many variants of each bot should be generated on raid start + /// How many variants of each bot should be generated on raid start /// [JsonPropertyName("presetBatch")] public Dictionary? PresetBatch @@ -25,7 +25,7 @@ public record BotConfig : BaseConfig } /// - /// Bot roles that should not have PMC types (pmcBEAR/pmcUSEC) added as enemies to + /// Bot roles that should not have PMC types (pmcBEAR/pmcUSEC) added as enemies to /// [JsonPropertyName("botsToNotAddPMCsAsEnemiesTo")] public List BotsToNotAddPMCsAsEnemiesTo @@ -35,7 +35,7 @@ public record BotConfig : BaseConfig } /// - /// What bot types should be classified as bosses + /// What bot types should be classified as bosses /// [JsonPropertyName("bosses")] public List Bosses @@ -45,7 +45,7 @@ public record BotConfig : BaseConfig } /// - /// Control weapon/armor durability min/max values for each bot type + /// Control weapon/armor durability min/max values for each bot type /// [JsonPropertyName("durability")] public BotDurability Durability @@ -55,7 +55,7 @@ public record BotConfig : BaseConfig } /// - /// Controls the percentage values of randomization item resources + /// Controls the percentage values of randomization item resources /// [JsonPropertyName("lootItemResourceRandomization")] public Dictionary LootItemResourceRandomization @@ -65,8 +65,8 @@ public record BotConfig : BaseConfig } /// - /// Control what bots are added to a bots revenge list
- /// key: bottype, value: bottypes to revenge on seeing their death + /// Control what bots are added to a bots revenge list
+ /// key: bottype, value: bottypes to revenge on seeing their death ///
[JsonPropertyName("revenge")] public Dictionary> Revenge @@ -76,9 +76,9 @@ public record BotConfig : BaseConfig } /// - /// Control how many items are allowed to spawn on a bot
- /// key: bottype, value:
- /// key: itemTpl: value: max item count> + /// Control how many items are allowed to spawn on a bot
+ /// key: bottype, value:
+ /// key: itemTpl: value: max item count> ///
[JsonPropertyName("itemSpawnLimits")] public Dictionary> ItemSpawnLimits @@ -88,7 +88,7 @@ public record BotConfig : BaseConfig } /// - /// Blacklist/whitelist items on a bot + /// Blacklist/whitelist items on a bot /// [JsonPropertyName("equipment")] public Dictionary Equipment @@ -98,7 +98,7 @@ public record BotConfig : BaseConfig } /// - /// Show a bots botType value after their name + /// Show a bots botType value after their name /// [JsonPropertyName("showTypeInNickname")] public bool ShowTypeInNickname @@ -108,7 +108,7 @@ public record BotConfig : BaseConfig } /// - /// What ai brain should a normal scav use per map + /// What ai brain should a normal scav use per map /// [JsonPropertyName("assaultBrainType")] public Dictionary> AssaultBrainType @@ -118,7 +118,7 @@ public record BotConfig : BaseConfig } /// - /// What ai brain should a player scav use per map + /// What ai brain should a player scav use per map /// [JsonPropertyName("playerScavBrainType")] public Dictionary> PlayerScavBrainType @@ -128,7 +128,7 @@ public record BotConfig : BaseConfig } /// - /// Max number of bots that can be spawned in a raid at any one time + /// Max number of bots that can be spawned in a raid at any one time /// [JsonPropertyName("maxBotCap")] public Dictionary MaxBotCap @@ -138,7 +138,7 @@ public record BotConfig : BaseConfig } /// - /// Chance scav has fake pscav name e.g. Scav name (player name) + /// Chance scav has fake pscav name e.g. Scav name (player name) /// [JsonPropertyName("chanceAssaultScavHasPlayerScavName")] public int ChanceAssaultScavHasPlayerScavName @@ -148,7 +148,7 @@ public record BotConfig : BaseConfig } /// - /// How many stacks of secret ammo should a bot have in its bot secure container + /// How many stacks of secret ammo should a bot have in its bot secure container /// [JsonPropertyName("secureContainerAmmoStackCount")] public int SecureContainerAmmoStackCount @@ -158,7 +158,7 @@ public record BotConfig : BaseConfig } /// - /// Bot roles in this array will be given a dog tag on generation + /// Bot roles in this array will be given a dog tag on generation /// [JsonPropertyName("botRolesWithDogTags")] public HashSet BotRolesWithDogTags @@ -168,7 +168,7 @@ public record BotConfig : BaseConfig } /// - /// Settings to control the items that get added into wallets on bots + /// Settings to control the items that get added into wallets on bots /// [JsonPropertyName("walletLoot")] public WalletLootSettings WalletLoot @@ -178,7 +178,7 @@ public record BotConfig : BaseConfig } /// - /// Currency weights, Keyed by botrole / currency + /// Currency weights, Keyed by botrole / currency /// [JsonPropertyName("currencyStackSize")] public Dictionary>> CurrencyStackSize @@ -188,7 +188,7 @@ public record BotConfig : BaseConfig } /// - /// Tpls for low profile gas blocks + /// Tpls for low profile gas blocks /// [JsonPropertyName("lowProfileGasBlockTpls")] public HashSet LowProfileGasBlockTpls @@ -198,7 +198,7 @@ public record BotConfig : BaseConfig } /// - /// What bottypes should be excluded from having loot generated on them (backpack/pocket/vest) does not disable food/drink/special/ + /// What bottypes should be excluded from having loot generated on them (backpack/pocket/vest) does not disable food/drink/special/ /// [JsonPropertyName("disableLootOnBotTypes")] public HashSet DisableLootOnBotTypes @@ -208,7 +208,7 @@ public record BotConfig : BaseConfig } /// - /// Max length a bots name can be + /// Max length a bots name can be /// [JsonPropertyName("botNameLengthLimit")] public int BotNameLengthLimit @@ -218,7 +218,7 @@ public record BotConfig : BaseConfig } /// - /// Bot roles that must have a unique name when generated vs other bots in raid + /// Bot roles that must have a unique name when generated vs other bots in raid /// [JsonPropertyName("botRolesThatMustHaveUniqueName")] public HashSet BotRolesThatMustHaveUniqueName @@ -229,7 +229,7 @@ public record BotConfig : BaseConfig } /// -/// Number of bots to generate and store in cache on raid start per bot type +/// Number of bots to generate and store in cache on raid start per bot type /// public record PresetBatch { diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotDurability.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotDurability.cs index 18fc4750..8898bf14 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotDurability.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotDurability.cs @@ -27,7 +27,7 @@ public record BotDurability } /// -/// Durability values to be used when a more specific bot type can't be found +/// Durability values to be used when a more specific bot type can't be found /// public record DefaultDurability { diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs index 0016033f..bc0b02db 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs @@ -97,7 +97,7 @@ public record CoreConfig : BaseConfig } /// - /// Commit hash build server was created from + /// Commit hash build server was created from /// [JsonPropertyName("commit")] public string? Commit @@ -107,7 +107,7 @@ public record CoreConfig : BaseConfig } /// - /// Timestamp of server build + /// Timestamp of server build /// [JsonPropertyName("buildTime")] public string? BuildTime @@ -117,7 +117,7 @@ public record CoreConfig : BaseConfig } /// - /// Server locale keys that will be added to the bottom of the startup watermark + /// Server locale keys that will be added to the bottom of the startup watermark /// [JsonPropertyName("customWatermarkLocaleKeys")] public List? CustomWatermarkLocaleKeys @@ -130,16 +130,16 @@ public record CoreConfig : BaseConfig public record BsgLogging { /// - /// verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals.
- /// complain to them about it! In all cases, better exceptions will be logged.
- /// WARNING: trace-info logging will quickly create log files in the megabytes.
- /// 0 - trace
- /// 1 - debug
- /// 2 - info
- /// 3 - warn
- /// 4 - error
- /// 5 - fatal
- /// 6 - off + /// verbosity of what to log, yes I know this is backwards, but its how nlog deals with ordinals.
+ /// complain to them about it! In all cases, better exceptions will be logged.
+ /// WARNING: trace-info logging will quickly create log files in the megabytes.
+ /// 0 - trace
+ /// 1 - debug
+ /// 2 - info
+ /// 3 - warn
+ /// 4 - error
+ /// 5 - fatal
+ /// 6 - off ///
[JsonPropertyName("verbosity")] public int Verbosity @@ -149,7 +149,7 @@ public record BsgLogging } /// - /// Should we send the logging to the server + /// Should we send the logging to the server /// [JsonPropertyName("sendToServer")] public bool SendToServer @@ -162,7 +162,7 @@ public record BsgLogging public record Release { /// - /// Disclaimer outlining the intended usage of bleeding edge + /// Disclaimer outlining the intended usage of bleeding edge /// [JsonPropertyName("betaDisclaimerText")] public string? BetaDisclaimerText @@ -172,7 +172,7 @@ public record Release } /// - /// Text logged when users agreed to terms + /// Text logged when users agreed to terms /// [JsonPropertyName("betaDisclaimerAcceptText")] public string BetaDisclaimerAcceptText @@ -182,7 +182,7 @@ public record Release } /// - /// Server mods loaded message + /// Server mods loaded message /// [JsonPropertyName("serverModsLoadedText")] public string ServerModsLoadedText @@ -192,7 +192,7 @@ public record Release } /// - /// Server mods loaded debug message text + /// Server mods loaded debug message text /// [JsonPropertyName("serverModsLoadedDebugText")] public string ServerModsLoadedDebugText @@ -202,7 +202,7 @@ public record Release } /// - /// Client mods loaded message + /// Client mods loaded message /// [JsonPropertyName("clientModsLoadedText")] public string ClientModsLoadedText @@ -212,7 +212,7 @@ public record Release } /// - /// Client mods loaded debug message text + /// Client mods loaded debug message text /// [JsonPropertyName("clientModsLoadedDebugText")] public string ClientModsLoadedDebugText @@ -220,8 +220,9 @@ public record Release get; set; } + /// - /// Illegal plugins log message + /// Illegal plugins log message /// [JsonPropertyName("illegalPluginsLoadedText")] public string IllegalPluginsLoadedText @@ -231,7 +232,7 @@ public record Release } /// - /// Illegal plugins exception + /// Illegal plugins exception /// [JsonPropertyName("illegalPluginsExceptionText")] public string IllegalPluginsExceptionText @@ -241,7 +242,7 @@ public record Release } /// - /// Summary of release changes + /// Summary of release changes /// [JsonPropertyName("releaseSummaryText")] public string? ReleaseSummaryText @@ -251,7 +252,7 @@ public record Release } /// - /// Enables the cool watermark in-game + /// Enables the cool watermark in-game /// [JsonPropertyName("isBeta")] public bool? IsBeta @@ -261,7 +262,7 @@ public record Release } /// - /// Whether mods are enabled + /// Whether mods are enabled /// [JsonPropertyName("isModdable")] public bool? IsModdable @@ -271,7 +272,7 @@ public record Release } /// - /// Are mods loaded on the server? + /// Are mods loaded on the server? /// [JsonPropertyName("isModded")] public bool IsModded @@ -281,7 +282,7 @@ public record Release } /// - /// How long before the messagebox times out and closes the game + /// How long before the messagebox times out and closes the game /// [JsonPropertyName("betaDisclaimerTimeoutDelay")] public int BetaDisclaimerTimeoutDelay @@ -294,7 +295,7 @@ public record Release public record GameFixes { /// - /// Shotguns use a different value than normal guns causing huge pellet dispersion + /// Shotguns use a different value than normal guns causing huge pellet dispersion /// [JsonPropertyName("fixShotgunDispersion")] public bool FixShotgunDispersion @@ -304,7 +305,7 @@ public record GameFixes } /// - /// Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load + /// Remove items added by mods when the mod no longer exists - can fix dead profiles stuck at game load /// [JsonPropertyName("removeModItemsFromProfile")] public bool RemoveModItemsFromProfile @@ -314,7 +315,7 @@ public record GameFixes } /// - /// Remove invalid traders from profile - trader data can be leftover when player removes trader mod + /// Remove invalid traders from profile - trader data can be leftover when player removes trader mod /// [JsonPropertyName("removeInvalidTradersFromProfile")] public bool RemoveInvalidTradersFromProfile @@ -324,7 +325,7 @@ public record GameFixes } /// - /// Fix issues that cause the game to not start due to inventory item issues + /// Fix issues that cause the game to not start due to inventory item issues /// [JsonPropertyName("fixProfileBreakingInventoryItemIssues")] public bool FixProfileBreakingInventoryItemIssues @@ -337,7 +338,7 @@ public record GameFixes public record ServerFeatures { /// - /// Controls whether the server attempts to download mod dependencies not included in the server's executable + /// Controls whether the server attempts to download mod dependencies not included in the server's executable /// [JsonPropertyName("autoInstallModDependencies")] public bool AutoInstallModDependencies @@ -361,7 +362,7 @@ public record ServerFeatures } /// - /// Keyed to profile type e.g. "Standard" or "SPT Developer" + /// Keyed to profile type e.g. "Standard" or "SPT Developer" /// [JsonPropertyName("createNewProfileTypesBlacklist")] public HashSet CreateNewProfileTypesBlacklist @@ -371,7 +372,7 @@ public record ServerFeatures } /// - /// Profile ids to ignore when calculating achievement stats + /// Profile ids to ignore when calculating achievement stats /// [JsonPropertyName("achievementProfileIdBlacklist")] public HashSet? AchievementProfileIdBlacklist @@ -405,7 +406,7 @@ public record ChatbotFeatures } /// - /// Human readable id to guid for each bot + /// Human readable id to guid for each bot /// [JsonPropertyName("ids")] public Dictionary Ids @@ -415,7 +416,7 @@ public record ChatbotFeatures } /// - /// Bot Ids player is allowed to interact with + /// Bot Ids player is allowed to interact with /// [JsonPropertyName("enabledBots")] public Dictionary EnabledBots diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/HideoutConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/HideoutConfig.cs index 01692a22..3290b1e5 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/HideoutConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/HideoutConfig.cs @@ -89,7 +89,7 @@ public record HideoutConfig : BaseConfig public record HideoutCraftToAdd { /// - /// The new mongoId for the craft to use + /// The new mongoId for the craft to use /// [JsonPropertyName("newId")] public string NewId @@ -97,6 +97,7 @@ public record HideoutCraftToAdd get; set; } + [JsonPropertyName("requirements")] public List Requirements { diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InRaidConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InRaidConfig.cs index d693ad5c..cfa47c87 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InRaidConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InRaidConfig.cs @@ -12,7 +12,7 @@ public record InRaidConfig : BaseConfig } = "spt-inraid"; /// - /// Overrides to apply to the pre-raid settings screen + /// Overrides to apply to the pre-raid settings screen /// [JsonPropertyName("raidMenuSettings")] public RaidMenuSettings RaidMenuSettings @@ -22,7 +22,7 @@ public record InRaidConfig : BaseConfig } /// - /// What effects should be saved post-raid + /// What effects should be saved post-raid /// [JsonPropertyName("save")] public RaidSave Save @@ -32,7 +32,7 @@ public record InRaidConfig : BaseConfig } /// - /// Names of car extracts + /// Names of car extracts /// [JsonPropertyName("carExtracts")] public List CarExtracts @@ -42,7 +42,7 @@ public record InRaidConfig : BaseConfig } /// - /// Names of coop extracts + /// Names of coop extracts /// [JsonPropertyName("coopExtracts")] public List CoopExtracts @@ -52,7 +52,7 @@ public record InRaidConfig : BaseConfig } /// - /// Fence rep gain from a single car extract + /// Fence rep gain from a single car extract /// [JsonPropertyName("carExtractBaseStandingGain")] public double CarExtractBaseStandingGain @@ -62,7 +62,7 @@ public record InRaidConfig : BaseConfig } /// - /// Fence rep gain from a single coop extract + /// Fence rep gain from a single coop extract /// [JsonPropertyName("coopExtractBaseStandingGain")] public double CoopExtractBaseStandingGain @@ -72,7 +72,7 @@ public record InRaidConfig : BaseConfig } /// - /// Fence rep gain when successfully extracting as pscav + /// Fence rep gain when successfully extracting as pscav /// [JsonPropertyName("scavExtractStandingGain")] public double ScavExtractStandingGain @@ -82,7 +82,7 @@ public record InRaidConfig : BaseConfig } /// - /// The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. + /// The likelihood of PMC eliminating a minimum of 2 scavs while you engage them as a pscav. /// [JsonPropertyName("pmcKillProbabilityForScavGain")] public double PmcKillProbabilityForScavGain @@ -92,7 +92,7 @@ public record InRaidConfig : BaseConfig } /// - /// On death should items in your secure keep their Find in raid status regardless of how you finished the raid + /// On death should items in your secure keep their Find in raid status regardless of how you finished the raid /// [JsonPropertyName("keepFiRSecureContainerOnDeath")] public bool KeepFiRSecureContainerOnDeath @@ -102,7 +102,7 @@ public record InRaidConfig : BaseConfig } /// - /// If enabled always keep found in raid status on items + /// If enabled always keep found in raid status on items /// [JsonPropertyName("alwaysKeepFoundInRaidOnRaidEnd")] public bool AlwaysKeepFoundInRaidOnRaidEnd @@ -112,7 +112,7 @@ public record InRaidConfig : BaseConfig } /// - /// Percentage chance a player scav hot is hostile to the player when scavving + /// Percentage chance a player scav hot is hostile to the player when scavving /// [JsonPropertyName("playerScavHostileChancePercent")] public double PlayerScavHostileChancePercent @@ -184,7 +184,7 @@ public record RaidMenuSettings public record RaidSave { /// - /// Should loot gained from raid be saved + /// Should loot gained from raid be saved /// [JsonPropertyName("loot")] public bool Loot diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InsuranceConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InsuranceConfig.cs index 6e911a56..a95b8145 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InsuranceConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InsuranceConfig.cs @@ -72,7 +72,7 @@ public record InsuranceConfig : BaseConfig } /// - /// Lowest rouble price for an attachment to be allowed to be taken + /// Lowest rouble price for an attachment to be allowed to be taken /// [JsonPropertyName("minAttachmentRoublePriceToBeTaken")] public double MinAttachmentRoublePriceToBeTaken @@ -82,7 +82,7 @@ public record InsuranceConfig : BaseConfig } /// - /// Chance out of 100% no attachments from a parent are taken + /// Chance out of 100% no attachments from a parent are taken /// [JsonPropertyName("chanceNoAttachmentsTakenPercent")] public double ChanceNoAttachmentsTakenPercent diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InventoryConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InventoryConfig.cs index b1822d44..cd52e6ef 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InventoryConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/InventoryConfig.cs @@ -13,7 +13,7 @@ public record InventoryConfig : BaseConfig } = "spt-inventory"; /// - /// Should new items purchased by flagged as found in raid + /// Should new items purchased by flagged as found in raid /// [JsonPropertyName("newItemsMarkedFound")] public bool NewItemsMarkedFound @@ -37,7 +37,7 @@ public record InventoryConfig : BaseConfig } /// - /// Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars + /// Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars /// [JsonPropertyName("customMoneyTpls")] public List CustomMoneyTpls @@ -47,7 +47,7 @@ public record InventoryConfig : BaseConfig } /// - /// Multipliers for skill gain when inside menus, NOT in-game + /// Multipliers for skill gain when inside menus, NOT in-game /// [JsonPropertyName("skillGainMultiplers")] public Dictionary SkillGainMultipliers @@ -57,7 +57,7 @@ public record InventoryConfig : BaseConfig } /// - /// Container Tpls that should be deprioritised when choosing where to take money from for payments + /// Container Tpls that should be deprioritised when choosing where to take money from for payments /// [JsonPropertyName("deprioritisedMoneyContainers")] public HashSet DeprioritisedMoneyContainers @@ -122,7 +122,7 @@ public record SealedAirdropContainerSettings } /// - /// Should contents be flagged as found in raid when opened + /// Should contents be flagged as found in raid when opened /// [JsonPropertyName("foundInRaid")] public bool FoundInRaid diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/ItemConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/ItemConfig.cs index 4792ee98..f40e95b9 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/ItemConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/ItemConfig.cs @@ -13,7 +13,7 @@ public record ItemConfig : BaseConfig } = "spt-item"; /// - /// Items that should be globally blacklisted + /// Items that should be globally blacklisted /// [JsonPropertyName("blacklist")] public HashSet Blacklist @@ -23,7 +23,7 @@ public record ItemConfig : BaseConfig } /// - /// Items that should not be lootable from any location + /// Items that should not be lootable from any location /// [JsonPropertyName("lootableItemBlacklist")] public HashSet LootableItemBlacklist @@ -33,7 +33,7 @@ public record ItemConfig : BaseConfig } /// - /// items that should not be given as rewards + /// items that should not be given as rewards /// [JsonPropertyName("rewardItemBlacklist")] public HashSet RewardItemBlacklist @@ -43,7 +43,7 @@ public record ItemConfig : BaseConfig } /// - /// Item base types that should not be given as rewards + /// Item base types that should not be given as rewards /// [JsonPropertyName("rewardItemTypeBlacklist")] public HashSet RewardItemTypeBlacklist @@ -53,7 +53,7 @@ public record ItemConfig : BaseConfig } /// - /// Items that can only be found on bosses + /// Items that can only be found on bosses /// [JsonPropertyName("bossItems")] public HashSet BossItems @@ -70,7 +70,7 @@ public record ItemConfig : BaseConfig } /// - /// Presets to add to the globals.json `ItemPresets` dictionary on server start + /// Presets to add to the globals.json `ItemPresets` dictionary on server start /// [JsonPropertyName("customItemGlobalPresets")] public List CustomItemGlobalPresets @@ -83,7 +83,7 @@ public record ItemConfig : BaseConfig public record HandbookPriceOverride { /// - /// Price in roubles + /// Price in roubles /// [JsonPropertyName("price")] public double Price @@ -93,7 +93,7 @@ public record HandbookPriceOverride } /// - /// NOT parentId from items.json, but handbook.json + /// NOT parentId from items.json, but handbook.json /// [JsonPropertyName("parentId")] public string ParentId diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocaleConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocaleConfig.cs index cf693861..0e850361 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocaleConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocaleConfig.cs @@ -12,7 +12,7 @@ public record LocaleConfig : BaseConfig } = "spt-locale"; /// - /// e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting + /// e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting /// [JsonPropertyName("gameLocale")] public string GameLocale @@ -22,7 +22,7 @@ public record LocaleConfig : BaseConfig } /// - /// e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting + /// e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting /// [JsonPropertyName("serverLocale")] public string ServerLocale @@ -32,7 +32,7 @@ public record LocaleConfig : BaseConfig } /// - /// Languages server can be translated into + /// Languages server can be translated into /// [JsonPropertyName("serverSupportedLocales")] public List ServerSupportedLocales diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocationConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocationConfig.cs index f127f7ec..30c59d8d 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocationConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LocationConfig.cs @@ -255,7 +255,7 @@ public record ReserveRaiderSpawnChanceOverrides public record EquipmentLootSettings { /// - /// Percentage chance item will be added to equipment + /// Percentage chance item will be added to equipment /// [JsonPropertyName("modSpawnChancePercent")] public Dictionary ModSpawnChancePercent @@ -326,7 +326,7 @@ public record SplitWaveSettings public record CustomWaves { /// - /// Bosses spawn on raid start + /// Bosses spawn on raid start /// [JsonPropertyName("boss")] public Dictionary> Boss @@ -354,7 +354,7 @@ public record BotTypeLimit : MinMax } /// -/// Multiplier to apply to the loot count for a given map +/// Multiplier to apply to the loot count for a given map /// public record LootMultiplier { @@ -495,7 +495,7 @@ public record ContainerRandomisationSettings } /// - /// What maps can use the container randomisation feature + /// What maps can use the container randomisation feature /// [JsonPropertyName("maps")] public Dictionary Maps @@ -505,7 +505,7 @@ public record ContainerRandomisationSettings } /// - /// Some container types don't work when randomised + /// Some container types don't work when randomised /// [JsonPropertyName("containerTypesToNotRandomise")] public HashSet ContainerTypesToNotRandomise @@ -558,9 +558,8 @@ public record ScavRaidTimeConfigSettings public record ScavRaidTimeLocationSettings { - /// - /// Should loot be reduced by same percent length of raid is reduced by + /// Should loot be reduced by same percent length of raid is reduced by /// [JsonPropertyName("reduceLootByPercent")] public bool ReduceLootByPercent @@ -570,7 +569,7 @@ public record ScavRaidTimeLocationSettings } /// - /// Smallest % of container loot that should be spawned + /// Smallest % of container loot that should be spawned /// [JsonPropertyName("minStaticLootPercent")] public double MinStaticLootPercent @@ -580,7 +579,7 @@ public record ScavRaidTimeLocationSettings } /// - /// Smallest % of loose loot that should be spawned + /// Smallest % of loose loot that should be spawned /// [JsonPropertyName("minDynamicLootPercent")] public double MinDynamicLootPercent @@ -590,7 +589,7 @@ public record ScavRaidTimeLocationSettings } /// - /// Chance raid time is reduced + /// Chance raid time is reduced /// [JsonPropertyName("reducedChancePercent")] public double ReducedChancePercent @@ -600,7 +599,7 @@ public record ScavRaidTimeLocationSettings } /// - /// How much should raid time be reduced - weighted + /// How much should raid time be reduced - weighted /// [JsonPropertyName("reductionPercentWeights")] public Dictionary ReductionPercentWeights @@ -610,7 +609,7 @@ public record ScavRaidTimeLocationSettings } /// - /// Should bot waves be removed / spawn times be adjusted + /// Should bot waves be removed / spawn times be adjusted /// [JsonPropertyName("adjustWaves")] public bool AdjustWaves diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LootConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LootConfig.cs index 18b7c87f..53722abc 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LootConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LootConfig.cs @@ -13,7 +13,7 @@ public record LootConfig : BaseConfig } = "spt-loot"; /// - /// Spawn positions to add into a map, key=mapid + /// Spawn positions to add into a map, key=mapid /// [JsonPropertyName("looseLoot")] public Dictionary LooseLoot @@ -23,7 +23,7 @@ public record LootConfig : BaseConfig } /// - /// Loose loot probability adjustments to apply on game start + /// Loose loot probability adjustments to apply on game start /// [JsonPropertyName("looseLootSpawnPointAdjustments")] public Dictionary>? LooseLootSpawnPointAdjustments diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LostOnDeathConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LostOnDeathConfig.cs index ced78ebd..6414ae82 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LostOnDeathConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/LostOnDeathConfig.cs @@ -12,7 +12,7 @@ public record LostOnDeathConfig : BaseConfig } = "spt-lostondeath"; /// - /// What equipment in each slot should be lost on death + /// What equipment in each slot should be lost on death /// [JsonPropertyName("equipment")] public LostEquipment Equipment @@ -22,7 +22,7 @@ public record LostOnDeathConfig : BaseConfig } /// - /// Should special slot items be removed from quest inventory on death e.g. wifi camera/markers + /// Should special slot items be removed from quest inventory on death e.g. wifi camera/markers /// [JsonPropertyName("specialSlotItems")] public bool SpecialSlotItems @@ -32,7 +32,7 @@ public record LostOnDeathConfig : BaseConfig } /// - /// Should quest items be removed from quest inventory on death + /// Should quest items be removed from quest inventory on death /// [JsonPropertyName("questItems")] public bool QuestItems diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs index dd52b3aa..138ca637 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs @@ -15,7 +15,7 @@ public record PmcConfig : BaseConfig } = "spt-pmc"; /// - /// What game version should the PMC have + /// What game version should the PMC have /// [JsonPropertyName("gameVersionWeight")] public Dictionary GameVersionWeight @@ -25,7 +25,7 @@ public record PmcConfig : BaseConfig } /// - /// What account type should the PMC have + /// What account type should the PMC have /// [JsonPropertyName("accountTypeWeight")] public Dictionary AccountTypeWeight @@ -35,7 +35,7 @@ public record PmcConfig : BaseConfig } /// - /// Global whitelist/blacklist of vest loot for PMCs + /// Global whitelist/blacklist of vest loot for PMCs /// [JsonPropertyName("vestLoot")] public SlotLootSettings VestLoot @@ -45,7 +45,7 @@ public record PmcConfig : BaseConfig } /// - /// Global whitelist/blacklist of pocket loot for PMCs + /// Global whitelist/blacklist of pocket loot for PMCs /// [JsonPropertyName("pocketLoot")] public SlotLootSettings PocketLoot @@ -55,7 +55,7 @@ public record PmcConfig : BaseConfig } /// - /// Global whitelist/blacklist of backpack loot for PMCs + /// Global whitelist/blacklist of backpack loot for PMCs /// [JsonPropertyName("backpackLoot")] public SlotLootSettings BackpackLoot @@ -72,7 +72,7 @@ public record PmcConfig : BaseConfig } /// - /// Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value + /// Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value /// [JsonPropertyName("useDifficultyOverride")] public bool UseDifficultyOverride @@ -82,7 +82,7 @@ public record PmcConfig : BaseConfig } /// - /// Difficulty override e.g. "AsOnline/Hard" + /// Difficulty override e.g. "AsOnline/Hard" /// [JsonPropertyName("difficulty")] public string Difficulty @@ -92,7 +92,7 @@ public record PmcConfig : BaseConfig } /// - /// Chance out of 100 to have a complete gun in backpack + /// Chance out of 100 to have a complete gun in backpack /// [JsonPropertyName("looseWeaponInBackpackChancePercent")] public double LooseWeaponInBackpackChancePercent @@ -102,7 +102,7 @@ public record PmcConfig : BaseConfig } /// - /// Chance out of 100 to have an enhancement applied to PMC weapon + /// Chance out of 100 to have an enhancement applied to PMC weapon /// [JsonPropertyName("weaponHasEnhancementChancePercent")] public double WeaponHasEnhancementChancePercent @@ -112,7 +112,7 @@ public record PmcConfig : BaseConfig } /// - /// MinMax count of weapons to have in backpack + /// MinMax count of weapons to have in backpack /// [JsonPropertyName("looseWeaponInBackpackLootMinMax")] public MinMax LooseWeaponInBackpackLootMinMax @@ -129,7 +129,7 @@ public record PmcConfig : BaseConfig } /// - /// Percentage chance PMC will be USEC + /// Percentage chance PMC will be USEC /// [JsonPropertyName("isUsec")] public double IsUsec @@ -139,7 +139,7 @@ public record PmcConfig : BaseConfig } /// - /// WildSpawnType enum value USEC PMCs use + /// WildSpawnType enum value USEC PMCs use /// [JsonPropertyName("usecType")] public string UsecType @@ -149,7 +149,7 @@ public record PmcConfig : BaseConfig } /// - /// WildSpawnType enum value BEAR PMCs use + /// WildSpawnType enum value BEAR PMCs use /// [JsonPropertyName("bearType")] public string BearType @@ -166,7 +166,7 @@ public record PmcConfig : BaseConfig } /// - /// What 'brain' does a PMC use, keyed by map and side (USEC/BEAR) key: map location, value: type for usec/bear + /// What 'brain' does a PMC use, keyed by map and side (USEC/BEAR) key: map location, value: type for usec/bear /// [JsonPropertyName("pmcType")] public Dictionary>> PmcType @@ -197,7 +197,7 @@ public record PmcConfig : BaseConfig } /// - /// How many levels above player level can a PMC be + /// How many levels above player level can a PMC be /// [JsonPropertyName("botRelativeLevelDeltaMax")] public int BotRelativeLevelDeltaMax @@ -207,7 +207,7 @@ public record PmcConfig : BaseConfig } /// - /// How many levels below player level can a PMC be + /// How many levels below player level can a PMC be /// [JsonPropertyName("botRelativeLevelDeltaMin")] public int BotRelativeLevelDeltaMin @@ -217,7 +217,7 @@ public record PmcConfig : BaseConfig } /// - /// Force a number of healing items into PMCs secure container to ensure they can heal + /// Force a number of healing items into PMCs secure container to ensure they can heal /// [JsonPropertyName("forceHealingItemsIntoSecure")] public bool ForceHealingItemsIntoSecure @@ -248,7 +248,7 @@ public record PmcConfig : BaseConfig } /// - /// Should secure container loot from usec.json/bear.json be added to pmc bots secure + /// Should secure container loot from usec.json/bear.json be added to pmc bots secure /// [JsonPropertyName("addSecureContainerLootFromBotConfig")] public bool AddSecureContainerLootFromBotConfig @@ -289,7 +289,7 @@ public record PmcConfig : BaseConfig public record HostilitySettings { /// - /// Bot roles that are 100% an enemy + /// Bot roles that are 100% an enemy /// [JsonPropertyName("additionalEnemyTypes")] public List? AdditionalEnemyTypes @@ -299,7 +299,7 @@ public record HostilitySettings } /// - /// Objects that determine the % chance another bot type is an enemy + /// Objects that determine the % chance another bot type is an enemy /// [JsonPropertyName("chancedEnemies")] public List? ChancedEnemies @@ -330,7 +330,7 @@ public record HostilitySettings } /// - /// Bot roles that are 100% a friendly + /// Bot roles that are 100% a friendly /// [JsonPropertyName("additionalFriendlyTypes")] public List? AdditionalFriendlyTypes @@ -367,7 +367,7 @@ public record PmcTypes public record SlotLootSettings { /// - /// Item Type whitelist + /// Item Type whitelist /// [JsonPropertyName("whitelist")] public HashSet Whitelist @@ -377,7 +377,7 @@ public record SlotLootSettings } /// - /// Item tpl blacklist + /// Item tpl blacklist /// [JsonPropertyName("blacklist")] public HashSet Blacklist diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs index 48fd5efe..d4f6ddec 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs @@ -16,7 +16,7 @@ public record QuestConfig : BaseConfig } = "spt-quest"; /// - /// Hours to get/redeem items from quest mail keyed by profile type + /// Hours to get/redeem items from quest mail keyed by profile type /// [JsonPropertyName("mailRedeemTimeHours")] public Dictionary? MailRedeemTimeHours @@ -33,7 +33,7 @@ public record QuestConfig : BaseConfig } /// - /// Show non-seasonal quests be shown to player + /// Show non-seasonal quests be shown to player /// [JsonPropertyName("showNonSeasonalEventQuests")] public bool? ShowNonSeasonalEventQuests @@ -78,7 +78,7 @@ public record QuestConfig : BaseConfig } /// - /// Quests that the keyed game version do not see/access + /// Quests that the keyed game version do not see/access /// [JsonPropertyName("profileBlacklist")] public Dictionary>? ProfileBlacklist @@ -88,7 +88,7 @@ public record QuestConfig : BaseConfig } /// - /// key=questid, gameversions that can see/access quest + /// key=questid, gameversions that can see/access quest /// [JsonPropertyName("profileWhitelist")] public Dictionary>? ProfileWhitelist @@ -265,7 +265,7 @@ public record RepeatableQuestConfig } /// - /// Item base types to block when generating rewards + /// Item base types to block when generating rewards /// [JsonPropertyName("rewardBaseTypeBlacklist")] public HashSet? RewardBaseTypeBlacklist @@ -275,7 +275,7 @@ public record RepeatableQuestConfig } /// - /// Item tplIds to ignore when generating rewards + /// Item tplIds to ignore when generating rewards /// [JsonPropertyName("rewardBlacklist")] public HashSet? RewardBlacklist @@ -313,7 +313,7 @@ public record RepeatableQuestConfig } /// - /// Reputation standing price for replacing a repeatable + /// Reputation standing price for replacing a repeatable /// [JsonPropertyName("standingChangeCost")] public IList? StandingChangeCost @@ -558,7 +558,7 @@ public record Completion : BaseQuestConfig } /// - /// Should supplied items be required FiR + /// Should supplied items be required FiR /// [JsonPropertyName("requiredItemsAreFiR")] public bool? RequiredItemsAreFiR @@ -568,7 +568,7 @@ public record Completion : BaseQuestConfig } /// - /// Should supplied items be required FiR + /// Should supplied items be required FiR /// [JsonPropertyName("requiredItemMinDurabilityMinMax")] public MinMax? RequiredItemMinDurabilityMinMax diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs index 1e9de8fa..7ea80c54 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RagfairConfig.cs @@ -13,7 +13,7 @@ public record RagfairConfig : BaseConfig } = "spt-ragfair"; /// - /// How many seconds should pass before expired offers and processed + player offers checked if sold + /// How many seconds should pass before expired offers and processed + player offers checked if sold /// [JsonPropertyName("runIntervalSeconds")] public int RunIntervalSeconds @@ -23,7 +23,7 @@ public record RagfairConfig : BaseConfig } /// - /// Default values used to hydrate `runIntervalSeconds` with + /// Default values used to hydrate `runIntervalSeconds` with /// [JsonPropertyName("runIntervalValues")] public RunIntervalValues RunIntervalValues @@ -33,7 +33,7 @@ public record RagfairConfig : BaseConfig } /// - /// Player listing settings + /// Player listing settings /// [JsonPropertyName("sell")] public Sell Sell @@ -43,7 +43,7 @@ public record RagfairConfig : BaseConfig } /// - /// Trader ids + should their assorts be listed on flea + /// Trader ids + should their assorts be listed on flea /// [JsonPropertyName("traders")] public Dictionary Traders @@ -70,7 +70,7 @@ public record RagfairConfig : BaseConfig public record Sell { /// - /// Should a fee be deducted from player when listing an item for sale + /// Should a fee be deducted from player when listing an item for sale /// [JsonPropertyName("fees")] public bool Fees @@ -80,7 +80,7 @@ public record Sell } /// - /// Settings to control chances of offer being sold + /// Settings to control chances of offer being sold /// [JsonPropertyName("chance")] public Chance Chance @@ -90,7 +90,7 @@ public record Sell } /// - /// Settings to control how long it takes for a player offer to sell + /// Settings to control how long it takes for a player offer to sell /// [JsonPropertyName("time")] public MinMax Time @@ -100,7 +100,7 @@ public record Sell } /// - /// Seconds from clicking remove to remove offer from market + /// Seconds from clicking remove to remove offer from market /// [JsonPropertyName("expireSeconds")] public int ExpireSeconds @@ -113,7 +113,7 @@ public record Sell public record Chance { /// - /// Base chance percent to sell an item + /// Base chance percent to sell an item /// [JsonPropertyName("base")] public int Base @@ -123,7 +123,7 @@ public record Chance } /// - /// Value to multiply the sell chance by + /// Value to multiply the sell chance by /// [JsonPropertyName("sellMultiplier")] public double SellMultiplier @@ -133,7 +133,7 @@ public record Chance } /// - /// Max possible sell chance % for a player listed offer + /// Max possible sell chance % for a player listed offer /// [JsonPropertyName("maxSellChancePercent")] public int MaxSellChancePercent @@ -143,7 +143,7 @@ public record Chance } /// - /// Min possible sell chance % for a player listed offer + /// Min possible sell chance % for a player listed offer /// [JsonPropertyName("minSellChancePercent")] public int MinSellChancePercent @@ -156,7 +156,7 @@ public record Chance public record Dynamic { /// - /// Should a purchased dynamic offers items be flagged as found in raid + /// Should a purchased dynamic offers items be flagged as found in raid /// [JsonPropertyName("purchasesAreFoundInRaid")] public bool PurchasesAreFoundInRaid @@ -166,7 +166,7 @@ public record Dynamic } /// - /// Use the highest trader price for an offer if its greater than the price in templates/prices.json + /// Use the highest trader price for an offer if its greater than the price in templates/prices.json /// [JsonPropertyName("useTraderPriceForOffersIfHigher")] public bool UseTraderPriceForOffersIfHigher @@ -176,7 +176,7 @@ public record Dynamic } /// - /// Barter offer specific settings + /// Barter offer specific settings /// [JsonPropertyName("barter")] public BarterDetails Barter @@ -193,7 +193,7 @@ public record Dynamic } /// - /// Dynamic offer price below handbook adjustment values + /// Dynamic offer price below handbook adjustment values /// [JsonPropertyName("offerAdjustment")] public OfferAdjustment OfferAdjustment @@ -203,7 +203,7 @@ public record Dynamic } /// - /// How many offers should expire before an offer regeneration occurs + /// How many offers should expire before an offer regeneration occurs /// [JsonPropertyName("expiredOfferThreshold")] public int ExpiredOfferThreshold @@ -213,7 +213,7 @@ public record Dynamic } /// - /// How many offers should be listed + /// How many offers should be listed /// [JsonPropertyName("offerItemCount")] public MinMax OfferItemCount @@ -223,7 +223,7 @@ public record Dynamic } /// - /// How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) + /// How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) /// [JsonPropertyName("priceRanges")] public PriceRanges PriceRanges @@ -233,7 +233,7 @@ public record Dynamic } /// - /// Should default presets to listed only or should non-standard presets found in globals.json be listed too + /// Should default presets to listed only or should non-standard presets found in globals.json be listed too /// [JsonPropertyName("showDefaultPresetsOnly")] public bool ShowDefaultPresetsOnly @@ -243,7 +243,7 @@ public record Dynamic } /// - /// Tpls that should not use the variable price system when their quality is less than 100% (lower dura/uses = lower price) + /// Tpls that should not use the variable price system when their quality is less than 100% (lower dura/uses = lower price) /// [JsonPropertyName("ignoreQualityPriceVarianceBlacklist")] public HashSet IgnoreQualityPriceVarianceBlacklist @@ -260,7 +260,7 @@ public record Dynamic } /// - /// Settings to control the durability range of item items listed on flea + /// Settings to control the durability range of item items listed on flea /// [JsonPropertyName("condition")] public Dictionary Condition @@ -270,7 +270,7 @@ public record Dynamic } /// - /// Size stackable items should be listed for in percent of max stack size + /// Size stackable items should be listed for in percent of max stack size /// [JsonPropertyName("stackablePercent")] public MinMax StackablePercent @@ -280,7 +280,7 @@ public record Dynamic } /// - /// Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed + /// Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed /// [JsonPropertyName("nonStackableCount")] public MinMax NonStackableCount @@ -290,7 +290,7 @@ public record Dynamic } /// - /// Range of rating offers for items being listed + /// Range of rating offers for items being listed /// [JsonPropertyName("rating")] public MinMax Rating @@ -300,7 +300,7 @@ public record Dynamic } /// - /// Armor specific flea settings + /// Armor specific flea settings /// [JsonPropertyName("armor")] public ArmorSettings Armor @@ -310,7 +310,7 @@ public record Dynamic } /// - /// A multipler to apply to individual tpls price just prior to item quality adjustment + /// A multipler to apply to individual tpls price just prior to item quality adjustment /// [JsonPropertyName("itemPriceMultiplier")] public Dictionary? ItemPriceMultiplier @@ -327,7 +327,7 @@ public record Dynamic } /// - /// Percentages to sell offers in each currency + /// Percentages to sell offers in each currency /// [JsonPropertyName("currencies")] public Dictionary Currencies @@ -337,7 +337,7 @@ public record Dynamic } /// - /// Item tpls that should be forced to sell as a single item + /// Item tpls that should be forced to sell as a single item /// [JsonPropertyName("showAsSingleStack")] public HashSet ShowAsSingleStack @@ -347,7 +347,7 @@ public record Dynamic } /// - /// Should christmas/halloween items be removed from flea when not within the seasonal bounds + /// Should christmas/halloween items be removed from flea when not within the seasonal bounds /// [JsonPropertyName("removeSeasonalItemsWhenNotInEvent")] public bool RemoveSeasonalItemsWhenNotInEvent @@ -357,7 +357,7 @@ public record Dynamic } /// - /// Flea blacklist settings + /// Flea blacklist settings /// [JsonPropertyName("blacklist")] public RagfairBlacklist Blacklist @@ -367,7 +367,7 @@ public record Dynamic } /// - /// Dict of price limits keyed by item type + /// Dict of price limits keyed by item type /// [JsonPropertyName("unreasonableModPrices")] public Dictionary UnreasonableModPrices @@ -377,7 +377,7 @@ public record Dynamic } /// - /// Custom rouble prices for items to override values from prices.json + /// Custom rouble prices for items to override values from prices.json /// [JsonPropertyName("itemPriceOverrideRouble")] public Dictionary ItemPriceOverrideRouble @@ -414,7 +414,7 @@ public record PriceRanges public record BarterDetails { /// - /// Percentage change an offer is listed as a barter + /// Percentage change an offer is listed as a barter /// [JsonPropertyName("chancePercent")] public double ChancePercent @@ -424,7 +424,7 @@ public record BarterDetails } /// - /// Min number of required items for a barter requirement + /// Min number of required items for a barter requirement /// [JsonPropertyName("itemCountMin")] public int ItemCountMin @@ -434,7 +434,7 @@ public record BarterDetails } /// - /// Max number of required items for a barter requirement + /// Max number of required items for a barter requirement /// [JsonPropertyName("itemCountMax")] public int ItemCountMax @@ -444,7 +444,7 @@ public record BarterDetails } /// - /// How much can the total price of requested items vary from the item offered + /// How much can the total price of requested items vary from the item offered /// [JsonPropertyName("priceRangeVariancePercent")] public double PriceRangeVariancePercent @@ -454,7 +454,7 @@ public record BarterDetails } /// - /// Min rouble price for an offer to be considered for turning into a barter + /// Min rouble price for an offer to be considered for turning into a barter /// [JsonPropertyName("minRoubleCostToBecomeBarter")] public double MinRoubleCostToBecomeBarter @@ -464,7 +464,7 @@ public record BarterDetails } /// - /// Should barter offers only single stack + /// Should barter offers only single stack /// [JsonPropertyName("makeSingleStackOnly")] public bool MakeSingleStackOnly @@ -474,7 +474,7 @@ public record BarterDetails } /// - /// Item Tpls to never be turned into a barter + /// Item Tpls to never be turned into a barter /// [JsonPropertyName("itemTypeBlacklist")] public HashSet ItemTypeBlacklist @@ -487,7 +487,7 @@ public record BarterDetails public record PackDetails { /// - /// Percentage change an offer is listed as a pack + /// Percentage change an offer is listed as a pack /// [JsonPropertyName("chancePercent")] public double ChancePercent @@ -497,7 +497,7 @@ public record PackDetails } /// - /// Min number of required items for a pack + /// Min number of required items for a pack /// [JsonPropertyName("itemCountMin")] public int ItemCountMin @@ -507,7 +507,7 @@ public record PackDetails } /// - /// Max number of required items for a pack + /// Max number of required items for a pack /// [JsonPropertyName("itemCountMax")] public int ItemCountMax @@ -517,7 +517,7 @@ public record PackDetails } /// - /// item types to allow being a pack + /// item types to allow being a pack /// [JsonPropertyName("itemTypeWhitelist")] public HashSet ItemTypeWhitelist diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs index 5ae2862a..d224262e 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/RepairConfig.cs @@ -1,6 +1,5 @@ using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Common; -using SPTarkov.Server.Core.Models.Eft.Common.Tables; namespace SPTarkov.Server.Core.Models.Spt.Config; @@ -42,7 +41,7 @@ public record RepairConfig : BaseConfig } /// - /// INT gain multiplier per repaired item type + /// INT gain multiplier per repaired item type /// [JsonPropertyName("repairKitIntellectGainMultiplier")] public IntellectGainValues RepairKitIntellectGainMultiplier @@ -52,7 +51,7 @@ public record RepairConfig : BaseConfig } /// - /// How much INT can be given to player per repair action + /// How much INT can be given to player per repair action /// [JsonPropertyName("maxIntellectGainPerRepair")] public MaxIntellectGainValues MaxIntellectGainPerRepair @@ -113,7 +112,7 @@ public record MaxIntellectGainValues public record WeaponTreatmentRepairValues { /// - /// The chance to gain more weapon maintenance skill + /// The chance to gain more weapon maintenance skill /// [JsonPropertyName("critSuccessChance")] public double CritSuccessChance @@ -130,7 +129,7 @@ public record WeaponTreatmentRepairValues } /// - /// The chance to gain less weapon maintenance skill + /// The chance to gain less weapon maintenance skill /// [JsonPropertyName("critFailureChance")] public double CritFailureChance @@ -147,7 +146,7 @@ public record WeaponTreatmentRepairValues } /// - /// The multiplier used for calculating weapon maintenance XP + /// The multiplier used for calculating weapon maintenance XP /// [JsonPropertyName("pointGainMultiplier")] public double PointGainMultiplier @@ -229,7 +228,7 @@ public record BonusValues } /// - /// What dura is buff active between (min max of current max) + /// What dura is buff active between (min max of current max) /// [JsonPropertyName("activeDurabilityPercentMinMax")] public MinMax ActiveDurabilityPercentMinMax diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs index 094dbb00..3aa616d4 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs @@ -22,7 +22,7 @@ public record SeasonalEventConfig : BaseConfig } /// - /// event / botType / equipSlot / itemid + /// event / botType / equipSlot / itemid /// [JsonPropertyName("eventGear")] public Dictionary>>> EventGear @@ -32,7 +32,7 @@ public record SeasonalEventConfig : BaseConfig } /// - /// event / bot type / equipSlot / itemid + /// event / bot type / equipSlot / itemid /// [JsonPropertyName("eventLoot")] public Dictionary>>> EventLoot @@ -77,7 +77,7 @@ public record SeasonalEventConfig : BaseConfig } /// - /// key = event, second key = map name + /// key = event, second key = map name /// [JsonPropertyName("hostilitySettingsForEvent")] public Dictionary>> HostilitySettingsForEvent @@ -87,7 +87,7 @@ public record SeasonalEventConfig : BaseConfig } /// - /// Ids of containers on locations that only have Christmas loot + /// Ids of containers on locations that only have Christmas loot /// [JsonPropertyName("christmasContainerIds")] public List ChristmasContainerIds @@ -97,7 +97,7 @@ public record SeasonalEventConfig : BaseConfig } /// - /// Season - botType - location (body/feet/hands/head) + /// Season - botType - location (body/feet/hands/head) /// [JsonPropertyName("botAppearanceChanges")] public Dictionary>>> BotAppearanceChanges diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/TraderConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/TraderConfig.cs index 95def618..a51783b5 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/TraderConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/TraderConfig.cs @@ -35,7 +35,7 @@ public record TraderConfig : BaseConfig } /// - /// Should trader reset times be set based on server start time (false = bsg time - on the hour) + /// Should trader reset times be set based on server start time (false = bsg time - on the hour) /// [JsonPropertyName("tradersResetFromServerStart")] public bool TradersResetFromServerStart @@ -83,7 +83,7 @@ public record UpdateTime } /// - /// Seconds between trader resets + /// Seconds between trader resets /// [JsonPropertyName("seconds")] public MinMax Seconds @@ -166,7 +166,7 @@ public record FenceConfig } /// - /// Keyed to plate protection level + /// Keyed to plate protection level /// [JsonPropertyName("chancePlateExistsInArmorPercent")] public Dictionary ChancePlateExistsInArmorPercent @@ -176,7 +176,7 @@ public record FenceConfig } /// - /// Key: item tpl + /// Key: item tpl /// [JsonPropertyName("itemStackSizeOverrideMinMax")] public Dictionary?> ItemStackSizeOverrideMinMax @@ -193,7 +193,7 @@ public record FenceConfig } /// - /// Prevent duplicate offers of items of specific categories by parentId + /// Prevent duplicate offers of items of specific categories by parentId /// [JsonPropertyName("preventDuplicateOffersOfCategory")] public List PreventDuplicateOffersOfCategory @@ -210,7 +210,7 @@ public record FenceConfig } /// - /// Max rouble price before item is not listed on flea + /// Max rouble price before item is not listed on flea /// [JsonPropertyName("itemCategoryRoublePriceLimit")] public Dictionary ItemCategoryRoublePriceLimit @@ -220,7 +220,7 @@ public record FenceConfig } /// - /// Each slotid with % to be removed prior to listing on fence + /// Each slotid with % to be removed prior to listing on fence /// [JsonPropertyName("presetSlotsToRemoveChancePercent")] public Dictionary PresetSlotsToRemoveChancePercent @@ -230,7 +230,7 @@ public record FenceConfig } /// - /// Block seasonal items from appearing when season is inactive + /// Block seasonal items from appearing when season is inactive /// [JsonPropertyName("blacklistSeasonalItems")] public bool BlacklistSeasonalItems @@ -240,7 +240,7 @@ public record FenceConfig } /// - /// Max pen value allowed to be listed on flea - affects ammo + ammo boxes + /// Max pen value allowed to be listed on flea - affects ammo + ammo boxes /// [JsonPropertyName("ammoMaxPenLimit")] public double AmmoMaxPenLimit @@ -271,7 +271,7 @@ public record FenceConfig } /// - /// Smallest value player rep with fence can fall to + /// Smallest value player rep with fence can fall to /// [JsonPropertyName("playerRepMin")] public double PlayerRepMin @@ -281,7 +281,7 @@ public record FenceConfig } /// - /// Highest value player rep with fence can climb to + /// Highest value player rep with fence can climb to /// [JsonPropertyName("playerRepMax")] public double PlayerRepMax @@ -378,12 +378,12 @@ public record DiscountOptions } /// -/// Custom trader data needed client side for things such as the clothing service +/// Custom trader data needed client side for things such as the clothing service /// public record ModdedTraders { /// - /// Trader Ids to enable the clothing service for + /// Trader Ids to enable the clothing service for /// [JsonPropertyName("clothingService")] public List ClothingService diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/WeatherConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/WeatherConfig.cs index 2b41df1d..e6c5b877 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/WeatherConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/WeatherConfig.cs @@ -102,7 +102,7 @@ public record WeatherValues } /// - /// How many hours to generate weather data into the future + /// How many hours to generate weather data into the future /// [JsonPropertyName("generateWeatherAmountHours")] public int? GenerateWeatherAmountHours @@ -112,7 +112,7 @@ public record WeatherValues } /// - /// Length of each weather period + /// Length of each weather period /// [JsonPropertyName("timePeriod")] public WeatherSettings? TimePeriod diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs index 8f997ee1..b416f4e2 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Dialog/SendMessageDetails.cs @@ -128,7 +128,7 @@ public record SendMessageDetails } /// - /// Optional - the MongoID of the dialogue message to reply to + /// Optional - the MongoID of the dialogue message to reply to /// [JsonPropertyName("replyTo")] public string? ReplyTo diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Hideout/Hideout.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Hideout/Hideout.cs index 8a9c8870..95432bbc 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Hideout/Hideout.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Hideout/Hideout.cs @@ -11,6 +11,7 @@ public record Hideout get; set; } + [JsonPropertyName("customAreas")] public List? CustomAreas { diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Inventory/OwnerInventoryItems.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Inventory/OwnerInventoryItems.cs index 286b6ddc..e7a1f7da 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Inventory/OwnerInventoryItems.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Inventory/OwnerInventoryItems.cs @@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Models.Spt.Inventory; public record OwnerInventoryItems { /// - /// Inventory items from source + /// Inventory items from source /// [JsonPropertyName("from")] public List? From @@ -16,7 +16,7 @@ public record OwnerInventoryItems } /// - /// Inventory items at destination + /// Inventory items at destination /// [JsonPropertyName("to")] public List? To diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Location/RaidChanges.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Location/RaidChanges.cs index c15eb913..2cfbb6d7 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Location/RaidChanges.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Location/RaidChanges.cs @@ -5,7 +5,7 @@ namespace SPTarkov.Server.Core.Models.Spt.Location; public record RaidChanges { /// - /// What percentage of dynamic loot should the map contain + /// What percentage of dynamic loot should the map contain /// [JsonPropertyName("dynamicLootPercent")] public double? DynamicLootPercent @@ -15,7 +15,7 @@ public record RaidChanges } /// - /// What percentage of static loot should the map contain + /// What percentage of static loot should the map contain /// [JsonPropertyName("staticLootPercent")] public double? StaticLootPercent @@ -25,7 +25,7 @@ public record RaidChanges } /// - /// How many seconds into the raid is the player simulated to spawn in at + /// How many seconds into the raid is the player simulated to spawn in at /// [JsonPropertyName("simulatedRaidStartSeconds")] public double? SimulatedRaidStartSeconds @@ -35,7 +35,7 @@ public record RaidChanges } /// - /// How many minutes are in the raid total + /// How many minutes are in the raid total /// [JsonPropertyName("raidTimeMinutes")] public double? RaidTimeMinutes @@ -45,7 +45,7 @@ public record RaidChanges } /// - /// The new number of seconds required to avoid a run through + /// The new number of seconds required to avoid a run through /// [JsonPropertyName("newSurviveTimeSeconds")] public double? NewSurviveTimeSeconds @@ -55,7 +55,7 @@ public record RaidChanges } /// - /// The original number of seconds required to avoid a run through + /// The original number of seconds required to avoid a run through /// [JsonPropertyName("originalSurvivalTimeSeconds")] public double? OriginalSurvivalTimeSeconds @@ -65,7 +65,7 @@ public record RaidChanges } /// - /// Any changes required to the extract list + /// Any changes required to the extract list /// [JsonPropertyName("exitChanges")] public List? ExitChanges diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Mod/NewItemDetails.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Mod/NewItemDetails.cs index ca2269c7..9f83567f 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Mod/NewItemDetails.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Mod/NewItemDetails.cs @@ -16,7 +16,7 @@ public record NewItemDetails : NewItemDetailsBase public record NewItemFromCloneDetails : NewItemDetailsBase { /// - /// Id of the item to copy and use as a base + /// Id of the item to copy and use as a base /// [JsonPropertyName("itemTplToClone")] public string? ItemTplToClone @@ -26,7 +26,7 @@ public record NewItemFromCloneDetails : NewItemDetailsBase } /// - /// Item properties that should be applied over the top of the cloned base + /// Item properties that should be applied over the top of the cloned base /// [JsonPropertyName("overrideProperties")] public Props? OverrideProperties @@ -36,7 +36,7 @@ public record NewItemFromCloneDetails : NewItemDetailsBase } /// - /// ParentId for the new item (item type) + /// ParentId for the new item (item type) /// [JsonPropertyName("parentId")] public string? ParentId @@ -46,8 +46,8 @@ public record NewItemFromCloneDetails : NewItemDetailsBase } /// - /// the id the new item should have, leave blank to have one generated for you. - /// This is often known as the TplId, or TemplateId + /// the id the new item should have, leave blank to have one generated for you. + /// This is often known as the TplId, or TemplateId /// [JsonPropertyName("newId")] public string? NewId diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Presets/PresetCacheDetails.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Presets/PresetCacheDetails.cs index 4745c1e7..20ecef9c 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Presets/PresetCacheDetails.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Presets/PresetCacheDetails.cs @@ -1,19 +1,18 @@ -namespace SPTarkov.Server.Core.Models.Spt.Presets -{ - public record PresetCacheDetails - { - // Preset Ids related to the tpl - public HashSet PresetIds - { - get; - set; - } +namespace SPTarkov.Server.Core.Models.Spt.Presets; - // Id of the default preset for this tpl - public string? DefaultId - { - get; - set; - } +public record PresetCacheDetails +{ + // Preset Ids related to the tpl + public HashSet PresetIds + { + get; + set; + } + + // Id of the default preset for this tpl + public string? DefaultId + { + get; + set; } } diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs index 53539941..7a8266de 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Ragfair/TplWithFleaPrice.cs @@ -12,7 +12,7 @@ public record TplWithFleaPrice } /// - /// Roubles + /// Roubles /// [JsonPropertyName("price")] public double? Price diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Server/Locations.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Server/Locations.cs index 6145faf2..0ea64eb0 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Server/Locations.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Server/Locations.cs @@ -189,7 +189,7 @@ public record Locations } /// - /// Holds a mapping of the linkages between locations on the UI + /// Holds a mapping of the linkages between locations on the UI /// [JsonPropertyName("base")] public LocationsBase? Base @@ -226,6 +226,7 @@ public record Locations { var classProps = typeof(Locations).GetProperties().Where(p => p.PropertyType == typeof(Eft.Common.Location) && p.Name != "Item"); _locationDictionaryCache = classProps - .ToDictionary(propertyInfo => propertyInfo.Name, propertyInfo => propertyInfo.GetValue(this, null) as Eft.Common.Location, StringComparer.OrdinalIgnoreCase); + .ToDictionary(propertyInfo => propertyInfo.Name, propertyInfo => propertyInfo.GetValue(this, null) as Eft.Common.Location, + StringComparer.OrdinalIgnoreCase); } } diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Server/SettingsBase.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Server/SettingsBase.cs index 8102dab9..2eddd37c 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Server/SettingsBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Server/SettingsBase.cs @@ -445,49 +445,57 @@ public record EnvironmentSettings [JsonPropertyName("AutumnLateSettings")] public SeasonEnvironmentSettings AutumnLateSettings { - get; set; + get; + set; } [JsonPropertyName("AutumnSettings")] public SeasonEnvironmentSettings AutumnSettings { - get; set; + get; + set; } [JsonPropertyName("SpringEarlySettings")] public SeasonEnvironmentSettings SpringEarlySettings { - get; set; + get; + set; } [JsonPropertyName("SpringSettings")] public SeasonEnvironmentSettings SpringSettings { - get; set; + get; + set; } [JsonPropertyName("StormSettings")] public SeasonEnvironmentSettings StormSettings { - get; set; + get; + set; } [JsonPropertyName("SummerSettings")] public SeasonEnvironmentSettings SummerSettings { - get; set; + get; + set; } [JsonPropertyName("WinterSettings")] public SeasonEnvironmentSettings WinterSettings { - get; set; + get; + set; } [JsonPropertyName("SurfaceMultipliers")] public List? SurfaceMultipliers { - get; set; + get; + set; } } @@ -496,19 +504,22 @@ public record SeasonEnvironmentSettings [JsonPropertyName("RainSettings")] public List RainSettings { - get; set; + get; + set; } [JsonPropertyName("StepsVolumeMultiplier")] public double StepsVolumeMultiplier { - get; set; + get; + set; } [JsonPropertyName("WindMultipliers")] public List WindMultipliers { - get; set; + get; + set; } } @@ -532,13 +543,15 @@ public record WindMultiplier [JsonPropertyName("VolumeMult")] public double VolumeMult { - get; set; + get; + set; } [JsonPropertyName("WindSpeed")] public string WindSpeed { - get; set; + get; + set; } } @@ -547,19 +560,22 @@ public record RainSetting [JsonPropertyName("IndoorVolumeMult")] public int IndoorVolumeMult { - get; set; + get; + set; } [JsonPropertyName("OutdoorVolumeMult")] public double OutdoorVolumeMult { - get; set; + get; + set; } [JsonPropertyName("RainIntensity")] public string RainIntensity { - get; set; + get; + set; } } @@ -583,6 +599,7 @@ public record HeadphoneSettings set; } } + public record MetaXRAudioPluginSettings { public bool? EnabledPluginErrorChecker diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Services/LootRequest.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Services/LootRequest.cs index d42dfe6a..e7431d53 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Services/LootRequest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Services/LootRequest.cs @@ -134,7 +134,7 @@ public record LootRequest } /// - /// Should seasonal items appear when it's not the season for them + /// Should seasonal items appear when it's not the season for them /// [JsonPropertyName("blockSeasonalItemsOutOfSeason")] public bool? BlockSeasonalItemsOutOfSeason diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Templates/Templates.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Templates/Templates.cs index c122f481..ab0442df 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Templates/Templates.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Templates/Templates.cs @@ -63,7 +63,7 @@ public record Templates } /// - /// The profile templates listed in the launcher on profile creation, split by account type (e.g. Standard) then side (e.g. bear/usec) + /// The profile templates listed in the launcher on profile creation, split by account type (e.g. Standard) then side (e.g. bear/usec) /// [JsonPropertyName("profiles")] public ProfileTemplates? Profiles @@ -73,7 +73,7 @@ public record Templates } /// - /// Flea prices of items - gathered from online flea market dump + /// Flea prices of items - gathered from online flea market dump /// [JsonPropertyName("prices")] public Dictionary? Prices @@ -83,7 +83,7 @@ public record Templates } /// - /// Default equipment loadouts that show on main inventory screen + /// Default equipment loadouts that show on main inventory screen /// [JsonPropertyName("defaultEquipmentPresets")] public List? DefaultEquipmentPresets @@ -93,7 +93,7 @@ public record Templates } /// - /// Achievements + /// Achievements /// [JsonPropertyName("achievements")] public List? Achievements @@ -103,7 +103,7 @@ public record Templates } /// - /// Achievements + /// Achievements /// [JsonPropertyName("customAchievements")] public List? CustomAchievements @@ -113,7 +113,7 @@ public record Templates } /// - /// Location services data + /// Location services data /// [JsonPropertyName("locationServices")] public LocationServices? LocationServices diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BotDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BotDynamicRouter.cs index 9b949df8..ee4f3385 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BotDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BotDynamicRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BundleDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BundleDynamicRouter.cs index 5caca9a1..371c3d68 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BundleDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/BundleDynamicRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/CustomizationDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/CustomizationDynamicRouter.cs index fca2888e..b2c6211c 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/CustomizationDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/CustomizationDynamicRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/DataDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/DataDynamicRouter.cs index bdddeae1..da418496 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/DataDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/DataDynamicRouter.cs @@ -1,15 +1,14 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; [Injectable(InjectableTypeOverride = typeof(DynamicRouter))] public class DataDynamicRouter : DynamicRouter { - public DataDynamicRouter( JsonUtil jsonUtil, DataCallbacks dataCallbacks diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/HttpDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/HttpDynamicRouter.cs index 7f25a725..bff02f89 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/HttpDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/HttpDynamicRouter.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/InraidDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/InraidDynamicRouter.cs index 976b03a9..677d83e0 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/InraidDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/InraidDynamicRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.InRaid; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/LocationDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/LocationDynamicRouter.cs index a1386796..f443235a 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/LocationDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/LocationDynamicRouter.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.DI; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/NotifierDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/NotifierDynamicRouter.cs index 128c5cbe..22134abf 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/NotifierDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/NotifierDynamicRouter.cs @@ -1,7 +1,7 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/TraderDynamicRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/TraderDynamicRouter.cs index c7defd5c..75ecd50e 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Dynamic/TraderDynamicRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Dynamic/TraderDynamicRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Dynamic; diff --git a/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs b/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs index d4087c76..b9713596 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers; @@ -96,8 +96,9 @@ public class EventOutputHolder } ); } + /// - /// Update output object with most recent values from player profile + /// Update output object with most recent values from player profile /// /// Session id public void UpdateOutputProperties(string sessionId) @@ -126,7 +127,7 @@ public class EventOutputHolder } /// - /// Required as continuous productions don't reset and stay at 100% completion but client thinks it hasn't started + /// Required as continuous productions don't reset and stay at 100% completion but client thinks it hasn't started /// /// Productions in a profile private void CleanUpCompleteCraftsInProfile(Dictionary? productions) @@ -149,7 +150,7 @@ public class EventOutputHolder } /// - /// Return all hideout Improvements from player profile, adjust completed Improvements' completed property to be true + /// Return all hideout Improvements from player profile, adjust completed Improvements' completed property to be true /// /// Player profile /// Dictionary of hideout improvements @@ -175,7 +176,7 @@ public class EventOutputHolder } /// - /// Return productions from player profile except those completed crafts the client has already seen + /// Return productions from player profile except those completed crafts the client has already seen /// /// Productions from player profile /// Player session ID @@ -239,7 +240,7 @@ public class EventOutputHolder } /// - /// Convert the internal trader data object into an object we can send to the client + /// Convert the internal trader data object into an object we can send to the client /// /// Server data for traders /// Dict of trader id + TraderData diff --git a/Libraries/SPTarkov.Server.Core/Routers/HttpRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/HttpRouter.cs index c6e9d5f5..a1e78173 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/HttpRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/HttpRouter.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.DI; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.DI; namespace SPTarkov.Server.Core.Routers; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ImageRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ImageRouter.cs index 68b9b42c..7cf28c13 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ImageRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ImageRouter.cs @@ -1,17 +1,17 @@ -using SPTarkov.Server.Core.Services.Image; -using SPTarkov.Server.Core.Utils; using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; +using SPTarkov.Server.Core.Services.Image; +using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Routers; [Injectable] public class ImageRouter { + private readonly ISptLogger _logger; protected FileUtil _fileUtil; protected HttpFileUtil _httpFileUtil; protected ImageRouterService _imageRouterService; - ISptLogger _logger; public ImageRouter( FileUtil fileUtil, diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEventRouter.cs index 6117f3e4..30593387 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.ItemEvent; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Routers; @@ -44,7 +44,7 @@ public class ItemEventRouter } /// - /// Handles ItemEventRouter Requests and processes them. + /// Handles ItemEventRouter Requests and processes them. /// /// Event request /// Session ID diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/CustomizationItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/CustomizationItemEventRouter.cs index 8720d13a..445a2935 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/CustomizationItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/CustomizationItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -6,7 +7,6 @@ using SPTarkov.Server.Core.Models.Eft.Customization; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HealthItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HealthItemEventRouter.cs index eed5c245..869676f5 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HealthItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HealthItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Health; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HideoutItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HideoutItemEventRouter.cs index a2622b4b..32f077e8 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HideoutItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/HideoutItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Hideout; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InsuranceItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InsuranceItemEventRouter.cs index 959ac53b..074c1a5b 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InsuranceItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InsuranceItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Insurance; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs index 7ae3b685..992b8d42 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/InventoryItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Eft.Inventory; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Quests; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/NoteItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/NoteItemEventRouter.cs index 02666802..911cd773 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/NoteItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/NoteItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Notes; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/QuestItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/QuestItemEventRouter.cs index 3b326d83..4f652e6a 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/QuestItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/QuestItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Quests; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs index 8fd4f067..b75f22ff 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RepairItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RepairItemEventRouter.cs index 62d3a459..aff0917a 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RepairItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RepairItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Repair; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/TradeItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/TradeItemEventRouter.cs index a2e49cf3..ee75ad29 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/TradeItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/TradeItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Trade; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/WishlistItemEventRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/WishlistItemEventRouter.cs index fc46e2d8..fd584f52 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/WishlistItemEventRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/WishlistItemEventRouter.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Eft.Wishlist; using SPTarkov.Server.Core.Models.Enums; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.ItemEvents; diff --git a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/HealthSaveLoadRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/HealthSaveLoadRouter.cs index c188bd03..6c4e6900 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/HealthSaveLoadRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/HealthSaveLoadRouter.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.SaveLoad; diff --git a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InraidSaveLoadRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InraidSaveLoadRouter.cs index adf0d783..e1ad15d5 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InraidSaveLoadRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InraidSaveLoadRouter.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Profile; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.SaveLoad; diff --git a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs index 501c1b92..0f84b2b8 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Profile; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.SaveLoad; diff --git a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs index 861c9e76..9fb9c261 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.SaveLoad; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Serializers/BundleSerializer.cs b/Libraries/SPTarkov.Server.Core/Routers/Serializers/BundleSerializer.cs index dd8cb8cc..e4dcc7ca 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Serializers/BundleSerializer.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Serializers/BundleSerializer.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.DI; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Loaders; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Serializers; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Serializers/ImageSerializer.cs b/Libraries/SPTarkov.Server.Core/Routers/Serializers/ImageSerializer.cs index ef910ceb..f6819d88 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Serializers/ImageSerializer.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Serializers/ImageSerializer.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.DI; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.DI; namespace SPTarkov.Server.Core.Routers.Serializers; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Serializers/NotifySerializer.cs b/Libraries/SPTarkov.Server.Core/Routers/Serializers/NotifySerializer.cs index 6a0e33b9..96a2c73a 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Serializers/NotifySerializer.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Serializers/NotifySerializer.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Controllers; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Serializers; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/AchievementStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/AchievementStaticRouter.cs index 66751986..2a435e96 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/AchievementStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/AchievementStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/BotStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/BotStaticRouter.cs index d9092db8..a2fc4073 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/BotStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/BotStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Bot; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/BuildStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/BuildStaticRouter.cs index f7ccc51c..c04fde8c 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/BuildStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/BuildStaticRouter.cs @@ -1,10 +1,10 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Builds; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.PresetBuild; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/BundleStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/BundleStaticRouter.cs index 6c93e18c..fed43264 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/BundleStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/BundleStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/ClientLogStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/ClientLogStaticRouter.cs index cb45fcc5..39f85870 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/ClientLogStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/ClientLogStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Spt.Logging; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/CustomizationStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/CustomizationStaticRouter.cs index 0a1bc1b4..0f8e635a 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/CustomizationStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/CustomizationStaticRouter.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/DataStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/DataStaticRouter.cs index 4309917a..a6714e18 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/DataStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/DataStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/DialogStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/DialogStaticRouter.cs index 10f346c1..f461c0bc 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/DialogStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/DialogStaticRouter.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Dialog; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/GameStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/GameStaticRouter.cs index a446eb5a..296f377d 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/GameStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/GameStaticRouter.cs @@ -1,10 +1,10 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Models.Eft.Game; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/HealthStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/HealthStaticRouter.cs index d7bd6d0a..543005ef 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/HealthStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/HealthStaticRouter.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Health; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/InraidStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/InraidStaticRouter.cs index c88b710b..ddff2c91 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/InraidStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/InraidStaticRouter.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.InRaid; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/InsuranceStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/InsuranceStaticRouter.cs index 1e3f2712..2109540b 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/InsuranceStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/InsuranceStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Insurance; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/ItemEventStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/ItemEventStaticRouter.cs index b318ff59..c8393f8d 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/ItemEventStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/ItemEventStaticRouter.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherStaticRouter.cs index 44b45bc5..064ad519 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherStaticRouter.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherV2StaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherV2StaticRouter.cs index 72608460..987990d5 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherV2StaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/LauncherV2StaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/LocationStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/LocationStaticRouter.cs index 6cef9fc7..13e448e5 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/LocationStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/LocationStaticRouter.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Location; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/MatchStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/MatchStaticRouter.cs index 55684193..f36fcb9b 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/MatchStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/MatchStaticRouter.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Match; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using static SPTarkov.Server.Core.Services.MatchLocationService; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/NotifierStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/NotifierStaticRouter.cs index 85e6759b..22a42ad1 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/NotifierStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/NotifierStaticRouter.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Request; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/PrestigeStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/PrestigeStaticRouter.cs index 87432880..945937da 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/PrestigeStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/PrestigeStaticRouter.cs @@ -1,9 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Prestige; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/ProfileStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/ProfileStaticRouter.cs index 199ad625..82dff1d8 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/ProfileStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/ProfileStaticRouter.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/QuestStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/QuestStaticRouter.cs index 4010e6c5..ee282cb3 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/QuestStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/QuestStaticRouter.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Quests; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/RagfairStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/RagfairStaticRouter.cs index cd05974b..c3d49e3b 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/RagfairStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/RagfairStaticRouter.cs @@ -1,9 +1,9 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/TraderStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/TraderStaticRouter.cs index a650fb85..eb790275 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/TraderStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/TraderStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Routers/Static/WeatherStaticRouter.cs b/Libraries/SPTarkov.Server.Core/Routers/Static/WeatherStaticRouter.cs index 438b8532..03e2860f 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/Static/WeatherStaticRouter.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/Static/WeatherStaticRouter.cs @@ -1,8 +1,8 @@ -using SPTarkov.Server.Core.Callbacks; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Routers.Static; diff --git a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs index 29d88a04..888c5b38 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Servers; diff --git a/Libraries/SPTarkov.Server.Core/Servers/DatabaseServer.cs b/Libraries/SPTarkov.Server.Core/Servers/DatabaseServer.cs index 09c0faba..84b1ca43 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/DatabaseServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/DatabaseServer.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Spt.Server; -using SPTarkov.Common.Annotations; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Spt.Server; namespace SPTarkov.Server.Core.Servers; diff --git a/Libraries/SPTarkov.Server.Core/Servers/Http/SptHttpListener.cs b/Libraries/SPTarkov.Server.Core/Servers/Http/SptHttpListener.cs index d28e0ddd..65b6ca36 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/Http/SptHttpListener.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/Http/SptHttpListener.cs @@ -1,14 +1,13 @@ using System.Collections.Immutable; using System.IO.Compression; using System.Text; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Server; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Servers.Http; @@ -131,7 +130,7 @@ public class SptHttpListener : IHttpListener } /// - /// Send HTTP response back to sender + /// Send HTTP response back to sender /// /// Player id making request /// Incoming request @@ -182,7 +181,7 @@ public class SptHttpListener : IHttpListener } /// - /// Is request flagged as debug enabled + /// Is request flagged as debug enabled /// /// Incoming request /// True if request is flagged as debug @@ -192,7 +191,7 @@ public class SptHttpListener : IHttpListener } /// - /// Log request if enabled + /// Log request if enabled /// /// Log request if enabled /// Output string diff --git a/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs b/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs index b8ac4823..5bf36d92 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs @@ -1,15 +1,15 @@ using System.Net; using System.Security.Authentication; +using Microsoft.AspNetCore.Server.Kestrel.Https; +using Microsoft.Extensions.Primitives; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers.Http; using SPTarkov.Server.Core.Services; -using Microsoft.AspNetCore.Server.Kestrel.Https; -using Microsoft.Extensions.Primitives; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Servers; @@ -28,7 +28,7 @@ public class HttpServer( private bool _started; /// - /// Handle server loading event + /// Handle server loading event /// /// Server builder /// Throws Exception when WebApplicationBuiler or WebApplication are null @@ -39,19 +39,18 @@ public class HttpServer( throw new Exception("WebApplicationBuilder is null in HttpServer.Load()"); } - builder.WebHost.ConfigureKestrel( - options => + builder.WebHost.ConfigureKestrel(options => + { + options.Listen(IPAddress.Parse(_httpConfig.Ip), _httpConfig.Port, listenOptions => { - options.Listen(IPAddress.Parse(_httpConfig.Ip), _httpConfig.Port, listenOptions => + listenOptions.UseHttps(opts => { - listenOptions.UseHttps(opts => - { - opts.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13; - opts.ServerCertificate = _certificateHelper.LoadOrGenerateCertificatePfx(); - opts.ClientCertificateMode = ClientCertificateMode.NoCertificate; - }); + opts.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13; + opts.ServerCertificate = _certificateHelper.LoadOrGenerateCertificatePfx(); + opts.ClientCertificateMode = ClientCertificateMode.NoCertificate; }); }); + }); var app = builder.Build(); @@ -67,8 +66,7 @@ public class HttpServer( KeepAliveInterval = TimeSpan.FromSeconds(60) }); - app?.Use( - (HttpContext req, RequestDelegate _) => + app?.Use((HttpContext req, RequestDelegate _) => { return Task.Factory.StartNew(async () => await HandleFallback(req)); } @@ -116,7 +114,7 @@ public class HttpServer( } /// - /// Log request - handle differently if request is local + /// Log request - handle differently if request is local /// /// HttpContext of request /// Ip of requester @@ -150,12 +148,12 @@ public class HttpServer( var forwardedFor = context.GetHeaderIfExists("x-forwarded-for"); return forwardedFor.HasValue - ? forwardedFor.Value.First()!.Split(",")[0].Trim() - : context.Connection.RemoteIpAddress!.ToString().Split(":").Last(); + ? forwardedFor.Value.First()!.Split(",")[0].Trim() + : context.Connection.RemoteIpAddress!.ToString().Split(":").Last(); } /// - /// Check against hardcoded values that determine it's from a local address + /// Check against hardcoded values that determine it's from a local address /// /// Address to check /// True if its local diff --git a/Libraries/SPTarkov.Server.Core/Servers/RagfairServer.cs b/Libraries/SPTarkov.Server.Core/Servers/RagfairServer.cs index ed3dc070..672db1d6 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/RagfairServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/RagfairServer.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Servers; @@ -67,7 +67,7 @@ public class RagfairServer( } /// - /// Get traders who need to be periodically refreshed + /// Get traders who need to be periodically refreshed /// /// List of traders public List GetUpdateableTraders() @@ -85,7 +85,7 @@ public class RagfairServer( } /// - /// Disable/Hide an offer from flea + /// Disable/Hide an offer from flea /// /// OfferID to hide public void HideOffer(string offerId) diff --git a/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs b/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs index 8a9b248a..70d7341f 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs @@ -1,6 +1,6 @@ using System.Collections.Concurrent; -using System.Collections.Generic; using System.Diagnostics; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Profile; @@ -8,7 +8,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Servers; @@ -33,7 +32,7 @@ public class SaveServer( protected ConcurrentDictionary saveMd5 = new(); /// - /// Add callback to occur prior to saving profile changes + /// Add callback to occur prior to saving profile changes /// /// ID for the save callback /// Callback to execute prior to running SaveServer.saveProfile() @@ -43,7 +42,7 @@ public class SaveServer( } /// - /// Remove a callback from being executed prior to saving profile in SaveServer.saveProfile() + /// Remove a callback from being executed prior to saving profile in SaveServer.saveProfile() /// /// ID of Callback to remove public void RemoveBeforeSaveCallback(string id) @@ -55,7 +54,7 @@ public class SaveServer( } /// - /// Load all profiles in /user/profiles folder into memory (this.profiles) + /// Load all profiles in /user/profiles folder into memory (this.profiles) /// public void Load() { @@ -82,7 +81,7 @@ public class SaveServer( } /// - /// Save changes for each profile from memory into user/profiles json + /// Save changes for each profile from memory into user/profiles json /// public void Save() { @@ -100,7 +99,7 @@ public class SaveServer( } /// - /// Get a player profile from memory + /// Get a player profile from memory /// /// Session ID /// SptProfile of the player @@ -131,7 +130,7 @@ public class SaveServer( } /// - /// Gets all profiles from memory + /// Gets all profiles from memory /// /// Dictionary of Profiles with their ID as Keys. public Dictionary GetProfiles() @@ -140,7 +139,7 @@ public class SaveServer( } /// - /// Delete a profile by id (Does not remove the profile file!) + /// Delete a profile by id (Does not remove the profile file!) /// /// ID of profile to remove /// True when deleted, false when profile not found @@ -158,7 +157,7 @@ public class SaveServer( } /// - /// Create a new profile in memory with empty pmc/scav objects + /// Create a new profile in memory with empty pmc/scav objects /// /// Basic profile data /// Thrown when profile already exists @@ -184,7 +183,7 @@ public class SaveServer( } /// - /// Add full profile in memory by key (info.id) + /// Add full profile in memory by key (info.id) /// /// Profile to save public void AddProfile(SptProfile profileDetails) @@ -193,8 +192,8 @@ public class SaveServer( } /// - /// Look up profile json in user/profiles by id and store in memory.
- /// Execute saveLoadRouters callbacks after being loaded into memory. + /// Look up profile json in user/profiles by id and store in memory.
+ /// Execute saveLoadRouters callbacks after being loaded into memory. ///
/// ID of profile to store in memory public void LoadProfile(string sessionID) @@ -202,7 +201,7 @@ public class SaveServer( var filename = $"{sessionID}.json"; var filePath = $"{profileFilepath}{filename}"; if (_fileUtil.FileExists(filePath)) - // File found, store in profiles[] + // File found, store in profiles[] { profiles[sessionID] = _jsonUtil.DeserializeFromFile(filePath); } @@ -216,8 +215,8 @@ public class SaveServer( } /// - /// Save changes from in-memory profile to user/profiles json - /// Execute onBeforeSaveCallbacks callbacks prior to being saved to json + /// Save changes from in-memory profile to user/profiles json + /// Execute onBeforeSaveCallbacks callbacks prior to being saved to json /// /// Profile id (user/profiles/id.json) /// Time taken to save the profile in seconds @@ -264,7 +263,7 @@ public class SaveServer( } /// - /// Remove a physical profile json from user/profiles + /// Remove a physical profile json from user/profiles /// /// Profile ID to remove /// True if successful diff --git a/Libraries/SPTarkov.Server.Core/Servers/WebSocketServer.cs b/Libraries/SPTarkov.Server.Core/Servers/WebSocketServer.cs index ef30aa8c..abda551d 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/WebSocketServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/WebSocketServer.cs @@ -1,7 +1,7 @@ using System.Net.WebSockets; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers.Ws; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Servers; diff --git a/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs index 548a0566..f35145c7 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs @@ -1,7 +1,7 @@ using System.Net.WebSockets; using System.Text; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Utils; namespace SPTarkov.Server.Core.Servers.Ws.Message; diff --git a/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs b/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs index 07b76e80..7cc7ec4f 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs @@ -1,13 +1,13 @@ using System.Collections.Concurrent; using System.Net.WebSockets; using System.Text; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers.Ws.Message; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Servers.Ws; diff --git a/Libraries/SPTarkov.Server.Core/Services/AirdropService.cs b/Libraries/SPTarkov.Server.Core/Services/AirdropService.cs index 6ff1c524..5d85185c 100644 --- a/Libraries/SPTarkov.Server.Core/Services/AirdropService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/AirdropService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Services; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; diff --git a/Libraries/SPTarkov.Server.Core/Services/BackupService.cs b/Libraries/SPTarkov.Server.Core/Services/BackupService.cs index f0f88c21..2981e088 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BackupService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BackupService.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -45,7 +45,7 @@ public class BackupService } /// - /// Start the backup interval if enabled in config. + /// Start the backup interval if enabled in config. /// public void StartBackupSystem() { @@ -76,9 +76,9 @@ public class BackupService } /// - /// Initializes the backup process.
- /// This method orchestrates the profile backup service. Handles copying profiles to a backup directory and cleaning - /// up old backups if the number exceeds the configured maximum. + /// Initializes the backup process.
+ /// This method orchestrates the profile backup service. Handles copying profiles to a backup directory and cleaning + /// up old backups if the number exceeds the configured maximum. ///
public void Init() { @@ -144,7 +144,7 @@ public class BackupService } /// - /// Check to see if the backup service is enabled via the config. + /// Check to see if the backup service is enabled via the config. /// /// True if enabled, false otherwise. protected bool IsEnabled() @@ -163,8 +163,8 @@ public class BackupService } /// - /// Generates the target directory path for the backup. The directory path is constructed using the `directory` from - /// the configuration and the current backup date. + /// Generates the target directory path for the backup. The directory path is constructed using the `directory` from + /// the configuration and the current backup date. /// /// The target directory path for the backup. protected string GenerateBackupTargetDir() @@ -174,7 +174,7 @@ public class BackupService } /// - /// Generates a formatted backup date string in the format `YYYY-MM-DD_hh-mm-ss`. + /// Generates a formatted backup date string in the format `YYYY-MM-DD_hh-mm-ss`. /// /// The formatted backup date string. protected string GenerateBackupDate() @@ -185,9 +185,9 @@ public class BackupService } /// - /// Cleans up old backups in the backup directory.
- /// This method reads the backup directory, and sorts backups by modification time. If the number of backups exceeds - /// the configured maximum, it deletes the oldest backups. + /// Cleans up old backups in the backup directory.
+ /// This method reads the backup directory, and sorts backups by modification time. If the number of backups exceeds + /// the configured maximum, it deletes the oldest backups. ///
protected void CleanBackups() { @@ -222,7 +222,7 @@ public class BackupService } /// - /// Retrieves and sorts the backup file paths from the specified directory. + /// Retrieves and sorts the backup file paths from the specified directory. /// /// The directory to search for backup files. /// List of sorted backup file paths. @@ -235,7 +235,7 @@ public class BackupService } /// - /// Compares two backup folder names based on their extracted dates. + /// Compares two backup folder names based on their extracted dates. /// /// The name of the first backup folder. /// The name of the second backup folder. @@ -254,7 +254,7 @@ public class BackupService } /// - /// Extracts a date from a folder name string formatted as `YYYY-MM-DD_hh-mm-ss`. + /// Extracts a date from a folder name string formatted as `YYYY-MM-DD_hh-mm-ss`. /// /// The name of the folder from which to extract the date. /// A DateTime object if the folder name is in the correct format, otherwise null. @@ -279,7 +279,7 @@ public class BackupService } /// - /// Removes excess backups from the backup directory. + /// Removes excess backups from the backup directory. /// /// List of backup file names to be removed. /// A promise that resolves when all specified backups have been removed. @@ -298,7 +298,7 @@ public class BackupService } /// - /// Get a List of active server mod details. + /// Get a List of active server mod details. /// /// A List of mod names. protected List GetActiveServerMods() @@ -308,6 +308,7 @@ public class BackupService { return []; } + List result = []; foreach (var mod in mods) diff --git a/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs b/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs index 49cd9f64..9ac3b698 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -5,8 +7,6 @@ using SPTarkov.Server.Core.Models.Spt.Bots; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -164,8 +164,8 @@ public class BotEquipmentFilterService { var blacklistDetailsForBot = _botEquipmentConfig.GetValueOrDefault(botRole, null); - return (blacklistDetailsForBot?.Blacklist ?? []).FirstOrDefault( - equipmentFilter => playerLevel >= equipmentFilter.LevelRange.Min && playerLevel <= equipmentFilter.LevelRange.Max + return (blacklistDetailsForBot?.Blacklist ?? []).FirstOrDefault(equipmentFilter => + playerLevel >= equipmentFilter.LevelRange.Min && playerLevel <= equipmentFilter.LevelRange.Max ); } @@ -179,8 +179,8 @@ public class BotEquipmentFilterService { var whitelistDetailsForBot = _botEquipmentConfig.GetValueOrDefault(botRole, null); - return (whitelistDetailsForBot?.Whitelist ?? []).FirstOrDefault( - equipmentFilter => playerLevel >= equipmentFilter.LevelRange.Min && playerLevel <= equipmentFilter.LevelRange.Max + return (whitelistDetailsForBot?.Whitelist ?? []).FirstOrDefault(equipmentFilter => + playerLevel >= equipmentFilter.LevelRange.Min && playerLevel <= equipmentFilter.LevelRange.Max ); } @@ -194,8 +194,7 @@ public class BotEquipmentFilterService { var weightingDetailsForBot = _botEquipmentConfig.GetValueOrDefault(botRole, null); - return (weightingDetailsForBot?.WeightingAdjustmentsByBotLevel ?? []).FirstOrDefault( - x => botLevel >= x.LevelRange.Min && botLevel <= x.LevelRange.Max + return (weightingDetailsForBot?.WeightingAdjustmentsByBotLevel ?? []).FirstOrDefault(x => botLevel >= x.LevelRange.Min && botLevel <= x.LevelRange.Max ); } @@ -209,8 +208,8 @@ public class BotEquipmentFilterService { var weightingDetailsForBot = _botEquipmentConfig.GetValueOrDefault(botRole, null); - return (weightingDetailsForBot?.WeightingAdjustmentsByBotLevel ?? []).FirstOrDefault( - x => playerlevel >= x.LevelRange.Min && playerlevel <= x.LevelRange.Max + return (weightingDetailsForBot?.WeightingAdjustmentsByBotLevel ?? []).FirstOrDefault(x => + playerlevel >= x.LevelRange.Min && playerlevel <= x.LevelRange.Max ); } diff --git a/Libraries/SPTarkov.Server.Core/Services/BotEquipmentModPoolService.cs b/Libraries/SPTarkov.Server.Core/Services/BotEquipmentModPoolService.cs index fd910b0f..9e6cb9ec 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotEquipmentModPoolService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotEquipmentModPoolService.cs @@ -1,11 +1,11 @@ using System.Collections.Concurrent; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -45,7 +45,7 @@ public class BotEquipmentModPoolService } /// - /// Store dictionary of mods for each item passed in + /// Store dictionary of mods for each item passed in /// /// Items to find related mods and store in modPool /// Mod pool to choose from e.g. "weapon" for weaponModPool @@ -145,7 +145,7 @@ public class BotEquipmentModPoolService } /// - /// Empty the mod pool + /// Empty the mod pool /// public void ResetPool() { @@ -153,7 +153,7 @@ public class BotEquipmentModPoolService } /// - /// Get array of compatible mods for an items mod slot (generate pool if it doesn't exist already) + /// Get array of compatible mods for an items mod slot (generate pool if it doesn't exist already) /// /// Item to look up /// Slot to get compatible mods for @@ -170,7 +170,7 @@ public class BotEquipmentModPoolService } /// - /// Get mods for a piece of gear by its tpl + /// Get mods for a piece of gear by its tpl /// /// Items tpl to look up mods for /// Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value @@ -187,7 +187,7 @@ public class BotEquipmentModPoolService } /// - /// Get mods for a weapon by its tpl + /// Get mods for a weapon by its tpl /// /// Weapons tpl to look up mods for /// Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value @@ -202,7 +202,7 @@ public class BotEquipmentModPoolService } /// - /// Get required mods for a weapon by its tpl + /// Get required mods for a weapon by its tpl /// /// Weapons tpl to look up mods for /// Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value @@ -232,13 +232,12 @@ public class BotEquipmentModPoolService } /// - /// Create weapon mod pool and set generated flag to true + /// Create weapon mod pool and set generated flag to true /// protected void GenerateWeaponPool() { var weapons = _databaseService.GetItems() - .Values.Where( - item => string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase) && _itemHelper.IsOfBaseclass(item.Id, BaseClasses.WEAPON) + .Values.Where(item => string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase) && _itemHelper.IsOfBaseclass(item.Id, BaseClasses.WEAPON) ); GeneratePool(weapons, "weapon"); @@ -247,22 +246,21 @@ public class BotEquipmentModPoolService } /// - /// Create gear mod pool and set generated flag to true + /// Create gear mod pool and set generated flag to true /// protected void GenerateGearPool() { var gear = _databaseService.GetItems() - .Values.Where( - item => string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase) && - _itemHelper.IsOfBaseclasses( - item.Id, - [ - BaseClasses.ARMORED_EQUIPMENT, - BaseClasses.VEST, - BaseClasses.ARMOR, - BaseClasses.HEADWEAR - ] - ) + .Values.Where(item => string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase) && + _itemHelper.IsOfBaseclasses( + item.Id, + [ + BaseClasses.ARMORED_EQUIPMENT, + BaseClasses.VEST, + BaseClasses.ARMOR, + BaseClasses.HEADWEAR + ] + ) ); GeneratePool(gear, "gear"); diff --git a/Libraries/SPTarkov.Server.Core/Services/BotGenerationCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/BotGenerationCacheService.cs index 14eb95be..66875b34 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotGenerationCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotGenerationCacheService.cs @@ -1,8 +1,8 @@ using System.Collections.Concurrent; -using SPTarkov.Server.Core.Models.Eft.Common.Tables; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Common.Annotations; using SPTarkov.Common.Extensions; +using SPTarkov.Server.Core.Models.Eft.Common.Tables; +using SPTarkov.Server.Core.Models.Utils; namespace SPTarkov.Server.Core.Services; @@ -17,7 +17,7 @@ public class BotGenerationCacheService( /// - /// Store list of bots in cache, shuffle results before storage + /// Store list of bots in cache, shuffle results before storage /// /// Role bot is stored as (assault/bossTagilla etc.) /// Bots we want to store in the cache @@ -33,8 +33,8 @@ public class BotGenerationCacheService( } /// - /// Find and return a bot based on its role.
- /// Remove bot from internal list so it can't be retrieved again. + /// Find and return a bot based on its role.
+ /// Remove bot from internal list so it can't be retrieved again. ///
/// role to retrieve (assault/bossTagilla etc) /// BotBase object @@ -64,7 +64,7 @@ public class BotGenerationCacheService( } /// - /// Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav + /// Cache a bot that has been sent to the client in memory for later use post-raid to determine if player killed a traitor scav /// /// Bot object to store public void StoreUsedBot(BotBase botToStore) @@ -73,8 +73,8 @@ public class BotGenerationCacheService( } /// - /// Get a bot by its profileId that has been generated and sent to client for current raid.
- /// Cache is wiped post-raid in client/match/offline/end endOfflineRaid() + /// Get a bot by its profileId that has been generated and sent to client for current raid.
+ /// Cache is wiped post-raid in client/match/offline/end endOfflineRaid() ///
/// ID of bot to get /// BotBase object @@ -84,7 +84,7 @@ public class BotGenerationCacheService( } /// - /// Remove all cached bot profiles from memory + /// Remove all cached bot profiles from memory /// public void ClearStoredBots() { @@ -93,7 +93,7 @@ public class BotGenerationCacheService( } /// - /// Does cache have a bot with requested key + /// Does cache have a bot with requested key /// /// False if empty public bool CacheHasBotWithKey(string key, int size = 0) diff --git a/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs index 0ec5b49d..c7e33407 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs @@ -1,4 +1,5 @@ using System.Collections.Concurrent; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Bots; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -21,7 +21,7 @@ public class BotLootCacheService( ICloner _cloner ) { - protected ConcurrentDictionary _lootCache = new ConcurrentDictionary(); + protected ConcurrentDictionary _lootCache = new(); /// /// Remove cached bot loot data diff --git a/Libraries/SPTarkov.Server.Core/Services/BotNameService.cs b/Libraries/SPTarkov.Server.Core/Services/BotNameService.cs index ab5f6dc5..c7c76025 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotNameService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotNameService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Bots; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -20,8 +20,8 @@ public class BotNameService( ConfigServer _configServer ) { - protected BotConfig _botConfig = _configServer.GetConfig(); protected readonly Lock _lockObject = new(); + protected BotConfig _botConfig = _configServer.GetConfig(); protected HashSet _usedNameCache = new(); /// diff --git a/Libraries/SPTarkov.Server.Core/Services/BotWeaponModLimitService.cs b/Libraries/SPTarkov.Server.Core/Services/BotWeaponModLimitService.cs index 97679c02..c088a86d 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotWeaponModLimitService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotWeaponModLimitService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Spt.Bots; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -56,10 +56,10 @@ public class BotWeaponModLimitService( } /// - /// Check if weapon mod item is on limited list + has surpassed the limit set for it
- /// Exception: Always allow ncstar backup mount
- /// Exception: Always allow scopes with a scope for a parent
- /// Exception: Always disallow mounts that hold only scopes once scope limit reached
+ /// Check if weapon mod item is on limited list + has surpassed the limit set for it
+ /// Exception: Always allow ncstar backup mount
+ /// Exception: Always allow scopes with a scope for a parent
+ /// Exception: Always disallow mounts that hold only scopes once scope limit reached
/// Exception: Always disallow mounts that hold only flashlights once flashlight limit reached ///
/// role the bot has e.g. assault @@ -79,16 +79,15 @@ public class BotWeaponModLimitService( if (modsParent.Id == ItemTpl.MOUNT_NCSTAR_MPR45_BACKUP || modTemplate.Id == ItemTpl.MOUNT_NCSTAR_MPR45_BACKUP) { // If weapon already has a longer ranged scope on it, allow ncstar to be spawned - if (weapon.Any( - item => - _itemHelper.IsOfBaseclasses( - item.Template, - [ - BaseClasses.ASSAULT_SCOPE, - BaseClasses.OPTIC_SCOPE, - BaseClasses.SPECIAL_SCOPE - ] - ) + if (weapon.Any(item => + _itemHelper.IsOfBaseclasses( + item.Template, + [ + BaseClasses.ASSAULT_SCOPE, + BaseClasses.OPTIC_SCOPE, + BaseClasses.SPECIAL_SCOPE + ] + ) )) { return false; diff --git a/Libraries/SPTarkov.Server.Core/Services/BundleHashCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/BundleHashCacheService.cs index 8af8b7f5..a2f21b60 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BundleHashCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BundleHashCacheService.cs @@ -1,75 +1,74 @@ -using SPTarkov.Server.Core.Models.Utils; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -namespace SPTarkov.Server.Core.Services +namespace SPTarkov.Server.Core.Services; + +[Injectable(InjectionType.Singleton)] +public class BundleHashCacheService { - [Injectable(InjectionType.Singleton)] - public class BundleHashCacheService + protected const string _bundleHashCachePath = "./user/cache/"; + protected const string _cacheName = "bundleHashCache.json"; + protected readonly Dictionary _bundleHashes = new(); + private readonly FileUtil _fileUtil; + private readonly HashUtil _hashUtil; + private readonly JsonUtil _jsonUtil; + private readonly ISptLogger _logger; + + public BundleHashCacheService( + ISptLogger logger, + JsonUtil jsonUtil, + HashUtil hashUtil, + FileUtil fileUtil) { - private readonly ISptLogger _logger; - private readonly JsonUtil _jsonUtil; - private readonly HashUtil _hashUtil; - private readonly FileUtil _fileUtil; - protected readonly Dictionary _bundleHashes = new Dictionary(); - protected const string _bundleHashCachePath = "./user/cache/"; - protected const string _cacheName = "bundleHashCache.json"; + _logger = logger; + _jsonUtil = jsonUtil; + _hashUtil = hashUtil; + _fileUtil = fileUtil; + } - public BundleHashCacheService( - ISptLogger logger, - JsonUtil jsonUtil, - HashUtil hashUtil, - FileUtil fileUtil) + public uint GetStoredValue(string key) + { + if (!_bundleHashes.TryGetValue(key, out var value)) { - _logger = logger; - _jsonUtil = jsonUtil; - _hashUtil = hashUtil; - _fileUtil = fileUtil; + return 0; } - public uint GetStoredValue(string key) - { - if (!_bundleHashes.TryGetValue(key, out var value)) - { - return 0; - } + return value; + } - return value; + public void StoreValue(string bundlePath, uint hash) + { + _bundleHashes.Add(bundlePath, hash); + + if (!Directory.Exists(_bundleHashCachePath)) + { + Directory.CreateDirectory(_bundleHashCachePath); } - public void StoreValue(string bundlePath, uint hash) - { - _bundleHashes.Add(bundlePath, hash); + _fileUtil.WriteFile(Path.Join(_bundleHashCachePath, _cacheName), _jsonUtil.Serialize(_bundleHashes)); - if (!Directory.Exists(_bundleHashCachePath)) - { - Directory.CreateDirectory(_bundleHashCachePath); - } + _logger.Debug($"Bundle: {bundlePath} hash stored in: ${_bundleHashCachePath}"); + } - _fileUtil.WriteFile(Path.Join(_bundleHashCachePath, _cacheName), _jsonUtil.Serialize(_bundleHashes)); + public bool CalculateAndMatchHash(string BundlePath) + { + return MatchWithStoredHash(BundlePath, CalculateHash(BundlePath)); + } - _logger.Debug($"Bundle: {bundlePath} hash stored in: ${_bundleHashCachePath}"); - } + public void CalculateAndStoreHash(string BundlePath) + { + StoreValue(BundlePath, CalculateHash(BundlePath)); + } - public bool CalculateAndMatchHash(string BundlePath) - { - return MatchWithStoredHash(BundlePath, CalculateHash(BundlePath)); - } + public uint CalculateHash(string BundlePath) + { + var fileData = _fileUtil.ReadFile(BundlePath); + return _hashUtil.GenerateCrc32ForData(fileData); + } - public void CalculateAndStoreHash(string BundlePath) - { - StoreValue(BundlePath, CalculateHash(BundlePath)); - } - - public uint CalculateHash(string BundlePath) - { - var fileData = _fileUtil.ReadFile(BundlePath); - return _hashUtil.GenerateCrc32ForData(fileData); - } - - public bool MatchWithStoredHash(string BundlePath, uint hash) - { - return GetStoredValue(BundlePath) == hash; - } + public bool MatchWithStoredHash(string BundlePath, uint hash) + { + return GetStoredValue(BundlePath) == hash; } } diff --git a/Libraries/SPTarkov.Server.Core/Services/Cache/BundleHashCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/Cache/BundleHashCacheService.cs index eba45a9d..68c62cc0 100644 --- a/Libraries/SPTarkov.Server.Core/Services/Cache/BundleHashCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/Cache/BundleHashCacheService.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services.Cache; diff --git a/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs index e5c8e969..0393b15c 100644 --- a/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services.Cache; diff --git a/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs b/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs index 2ab9e620..118f7c48 100644 --- a/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -13,8 +15,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using Hideout = SPTarkov.Server.Core.Models.Spt.Hideout.Hideout; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -123,8 +123,9 @@ public class CircleOfCultistService( return output; } + /// - /// Get the reward amount multiple value based on players hideout management skill + configs rewardPriceMultiplerMinMax values + /// Get the reward amount multiple value based on players hideout management skill + configs rewardPriceMultiplerMinMax values /// /// Player profile /// Circle config settings @@ -133,8 +134,8 @@ public class CircleOfCultistService( { // Get a randomised value to multiply the sacrificed rouble cost by var rewardAmountMultiplier = _randomUtil.GetDouble( - (double) cultistCircleSettings.RewardPriceMultiplierMinMax.Min, - (double) cultistCircleSettings.RewardPriceMultiplierMinMax.Max + cultistCircleSettings.RewardPriceMultiplierMinMax.Min, + cultistCircleSettings.RewardPriceMultiplierMinMax.Max ); // Adjust value generated by the players hideout management skill @@ -240,8 +241,8 @@ public class CircleOfCultistService( double rewardAmountRoubles ) { - var matchingThreshold = thresholds.FirstOrDefault( - craftThreshold => craftThreshold.Min <= rewardAmountRoubles && craftThreshold.Max >= rewardAmountRoubles + var matchingThreshold = thresholds.FirstOrDefault(craftThreshold => + craftThreshold.Min <= rewardAmountRoubles && craftThreshold.Max >= rewardAmountRoubles ); // No matching threshold, make one @@ -275,8 +276,7 @@ public class CircleOfCultistService( protected List GetSacrificedItems(PmcData pmcData) { // Get root items that are in the cultist sacrifice window - var inventoryRootItemsInCultistGrid = pmcData.Inventory.Items.Where( - item => item.SlotId == CircleOfCultistSlotId + var inventoryRootItemsInCultistGrid = pmcData.Inventory.Items.Where(item => item.SlotId == CircleOfCultistSlotId ); // Get rootitem + its children @@ -567,7 +567,7 @@ public class CircleOfCultistService( return 1; } - return _randomUtil.GetInt((int) settings.Min, (int) settings.Max); + return _randomUtil.GetInt(settings.Min, settings.Max); } /// @@ -718,8 +718,7 @@ public class CircleOfCultistService( foreach (var task in activeTasks) { var questData = _questHelper.GetQuestFromDb(task.QId, pmcData); - var handoverConditions = questData.Conditions.AvailableForFinish.Where( - condition => condition.ConditionType == "HandoverItem" + var handoverConditions = questData.Conditions.AvailableForFinish.Where(condition => condition.ConditionType == "HandoverItem" ); foreach (var condition in handoverConditions) foreach (var neededItem in condition.Target.List) @@ -794,8 +793,7 @@ public class CircleOfCultistService( /// Active area array protected List GetPlayerAccessibleHideoutAreas(List areas) { - return areas.Where( - area => + return areas.Where(area => { if (area.Type == HideoutAreas.CHRISTMAS_TREE && !_seasonalEventService.ChristmasEventEnabled()) // Christmas tree area and not Christmas, skip diff --git a/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs b/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs index 9752fa38..bab01c8d 100644 --- a/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs @@ -1,4 +1,6 @@ using System.Security.Cryptography; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -11,8 +13,6 @@ using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using Vitality = SPTarkov.Server.Core.Models.Eft.Profile.Vitality; @@ -135,8 +135,9 @@ public class CreateProfileService( var achievementsDb = _databaseService.GetTemplates().Achievements; var achievementRewardItemsToSend = new List(); - foreach (var (achievementId, achievement) in profileDetails.CharacterData.PmcData.Achievements) { - var rewards = achievementsDb.FirstOrDefault((achievementDb) => achievementDb.Id == achievementId)?.Rewards; + foreach (var (achievementId, achievement) in profileDetails.CharacterData.PmcData.Achievements) + { + var rewards = achievementsDb.FirstOrDefault(achievementDb => achievementDb.Id == achievementId)?.Rewards; if (rewards is null) { @@ -144,11 +145,11 @@ public class CreateProfileService( } achievementRewardItemsToSend.AddRange(_rewardHelper.ApplyRewards( - rewards, - CustomisationSource.ACHIEVEMENT, - profileDetails, - profileDetails.CharacterData.PmcData, - achievementId)); + rewards, + CustomisationSource.ACHIEVEMENT, + profileDetails, + profileDetails.CharacterData.PmcData, + achievementId)); } if (achievementRewardItemsToSend.Count > 0) @@ -217,7 +218,7 @@ public class CreateProfileService( } /// - /// Delete a profile + /// Delete a profile /// /// ID of profile to delete protected void DeleteProfileBySessionId(string sessionID) @@ -235,7 +236,7 @@ public class CreateProfileService( } /// - /// Make profiles pmcData.Inventory.equipment unique + /// Make profiles pmcData.Inventory.equipment unique /// /// Profile to update protected void UpdateInventoryEquipmentId(PmcData pmcData) @@ -259,7 +260,7 @@ public class CreateProfileService( } /// - /// For each trader reset their state to what a level 1 player would see + /// For each trader reset their state to what a level 1 player would see /// /// Session ID of profile to reset protected void ResetAllTradersInProfile(string sessionId) @@ -271,8 +272,8 @@ public class CreateProfileService( } /// - /// Ensure a profile has the necessary internal containers e.g. questRaidItems / sortingTable
- /// DOES NOT check that stash exists + /// Ensure a profile has the necessary internal containers e.g. questRaidItems / sortingTable
+ /// DOES NOT check that stash exists ///
/// Profile to check protected void AddMissingInternalContainersToProfile(PmcData pmcData) @@ -464,7 +465,7 @@ public class CreateProfileService( } /// - /// Get the game edition of a profile chosen on creation in Launcher + /// Get the game edition of a profile chosen on creation in Launcher /// private string? GetGameEdition(SptProfile profile) { @@ -488,8 +489,8 @@ public class CreateProfileService( } /// - /// Iterate over all quests in player profile, inspect rewards for the quests current state (accepted/completed) - /// and send rewards to them in mail + /// Iterate over all quests in player profile, inspect rewards for the quests current state (accepted/completed) + /// and send rewards to them in mail /// /// Player profile /// Session ID diff --git a/Libraries/SPTarkov.Server.Core/Services/CustomLocationWaveService.cs b/Libraries/SPTarkov.Server.Core/Services/CustomLocationWaveService.cs index 90555d13..fda3e9d8 100644 --- a/Libraries/SPTarkov.Server.Core/Services/CustomLocationWaveService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/CustomLocationWaveService.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; diff --git a/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs b/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs index bc337c84..27596461 100644 --- a/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs @@ -1,4 +1,6 @@ using System.Diagnostics; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Bots; @@ -7,8 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Templates; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using Hideout = SPTarkov.Server.Core.Models.Spt.Hideout.Hideout; using Locations = SPTarkov.Server.Core.Models.Spt.Server.Locations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -98,7 +98,7 @@ public class DatabaseService( } /// - /// Get specific location by its ID + /// Get specific location by its ID /// /// Desired location ID /// assets/database/locations/ @@ -290,7 +290,7 @@ public class DatabaseService( } /// - /// Get specific trader by their ID + /// Get specific trader by their ID /// /// Desired trader ID /// assets/database/traders/ @@ -317,7 +317,7 @@ public class DatabaseService( } /// - /// Validates that the database doesn't contain invalid ID data + /// Validates that the database doesn't contain invalid ID data /// public void ValidateDatabase() { @@ -342,7 +342,7 @@ public class DatabaseService( } /// - /// Validate that the given table only contains valid MongoIDs + /// Validate that the given table only contains valid MongoIDs /// /// Table to validate for MongoIDs /// The type of table, used in output message @@ -362,7 +362,7 @@ public class DatabaseService( } /// - /// Check if the database is valid + /// Check if the database is valid /// /// True if the database contains valid data, false otherwise public bool IsDatabaseValid() diff --git a/Libraries/SPTarkov.Server.Core/Services/FenceService.cs b/Libraries/SPTarkov.Server.Core/Services/FenceService.cs index 48d6701e..bb336ca6 100644 --- a/Libraries/SPTarkov.Server.Core/Services/FenceService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/FenceService.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -9,8 +11,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Services; @@ -29,17 +29,17 @@ public class FenceService( ) { /// - /// Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() + /// Desired baseline counts - Hydrated on initial assort generation as part of generateFenceAssorts() /// protected FenceAssortGenerationValues desiredAssortCounts; /// - /// Main assorts you see at all rep levels + /// Main assorts you see at all rep levels /// protected TraderAssort? fenceAssort; /// - /// Assorts shown on a separate tab when you max out fence rep + /// Assorts shown on a separate tab when you max out fence rep /// protected TraderAssort? fenceDiscountAssort; @@ -57,7 +57,7 @@ public class FenceService( ]; /// - /// Time when some items in assort will be replaced + /// Time when some items in assort will be replaced /// protected long nextPartialRefreshTimestamp; @@ -65,7 +65,7 @@ public class FenceService( /// - /// Replace main fence assort with new assort + /// Replace main fence assort with new assort /// /// New assorts to replace old with public void SetFenceAssort(TraderAssort assort) @@ -74,7 +74,7 @@ public class FenceService( } /// - /// Replace discount fence assort with new assort + /// Replace discount fence assort with new assort /// /// New assorts to replace old with public void SetFenceDiscountAssort(TraderAssort discountAssort) @@ -83,7 +83,7 @@ public class FenceService( } /// - /// Get main fence assort + /// Get main fence assort /// /// TraderAssort public TraderAssort? GetMainFenceAssort() @@ -92,7 +92,7 @@ public class FenceService( } /// - /// Get discount fence assort + /// Get discount fence assort /// /// TraderAssort /// @return ITraderAssort @@ -102,8 +102,8 @@ public class FenceService( } /// - /// Get assorts player can purchase
- /// Adjust prices based on fence level of player + /// Get assorts player can purchase
+ /// Adjust prices based on fence level of player ///
/// Player profile /// TraderAssort @@ -137,7 +137,7 @@ public class FenceService( } /// - /// Adds to fence assort a single item (with its children) + /// Adds to fence assort a single item (with its children) /// /// The items to add with all its children /// The most parent item of the array @@ -187,7 +187,7 @@ public class FenceService( } /// - /// Calculates the overall price for an item (with all its children) + /// Calculates the overall price for an item (with all its children) /// /// The item tpl to calculate the fence price for /// The items (with its children) to calculate fence price for @@ -200,8 +200,8 @@ public class FenceService( } /// - /// Calculate the overall price for an ammo box, where only one item is - /// the ammo box itself and every other items are the bullets in that box + /// Calculate the overall price for an ammo box, where only one item is + /// the ammo box itself and every other items are the bullets in that box /// /// The ammo box (and all its children ammo items) /// The price of the ammo box @@ -220,7 +220,7 @@ public class FenceService( } /// - /// Adjust all items contained inside an assort by a multiplier + /// Adjust all items contained inside an assort by a multiplier /// /// (clone) Assort that contains items with prices to adjust /// Multiplier to use on items @@ -239,7 +239,7 @@ public class FenceService( } /// - /// Merge two trader assort files together + /// Merge two trader assort files together /// /// Assort #1 /// Assort #2 @@ -266,7 +266,7 @@ public class FenceService( } /// - /// Adjust assorts price by a modifier + /// Adjust assorts price by a modifier /// /// Assort item details /// Assort to be modified @@ -309,7 +309,7 @@ public class FenceService( } /// - /// Get fence assorts with no price adjustments based on fence rep + /// Get fence assorts with no price adjustments based on fence rep /// /// TraderAssort public TraderAssort GetRawFenceAssorts() @@ -318,7 +318,7 @@ public class FenceService( } /// - /// Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json + /// Does fence need to perform a partial refresh because its passed the refresh timer defined in trader.json /// /// True if it needs a partial refresh public bool NeedsPartialRefresh() @@ -327,7 +327,7 @@ public class FenceService( } /// - /// Replace a percentage of fence assorts with freshly generated items + /// Replace a percentage of fence assorts with freshly generated items /// public void PerformPartialRefresh() { @@ -387,7 +387,7 @@ public class FenceService( } /// - /// Handle the process of folding new assorts into existing assorts, when a new assort exists already, increment its StackObjectsCount instead + /// Handle the process of folding new assorts into existing assorts, when a new assort exists already, increment its StackObjectsCount instead /// /// Assorts to fold into existing fence assorts /// Current fence assorts, new assorts will be added to @@ -410,8 +410,7 @@ public class FenceService( } // Find a matching root item with same tpl in existing assort - var existingRootItem = existingFenceAssorts.Items.FirstOrDefault( - item => item.Template == newRootItem.Template && item.SlotId == "hideout" + var existingRootItem = existingFenceAssorts.Items.FirstOrDefault(item => item.Template == newRootItem.Template && item.SlotId == "hideout" ); // Check if same type of item exists + its on list of item types to always stack @@ -439,7 +438,7 @@ public class FenceService( // if the Upd doesnt exist just initialize it if (newRootItem.Upd == null) { - newRootItem.Upd = new Upd() + newRootItem.Upd = new Upd { StackObjectsCount = 1 }; @@ -453,7 +452,7 @@ public class FenceService( } /// - /// Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config + /// Increment fence next refresh timestamp by current timestamp + partialRefreshTimeSeconds from config /// protected void IncrementPartialRefreshTime() { @@ -461,7 +460,7 @@ public class FenceService( } /// - /// Get values that will hydrate the passed in assorts back to the desired counts + /// Get values that will hydrate the passed in assorts back to the desired counts /// /// Current assorts after items have been removed /// Base counts assorts should be adjusted to @@ -506,7 +505,7 @@ public class FenceService( } /// - /// Delete desired number of items from assort (including children) + /// Delete desired number of items from assort (including children) /// /// Number of items to replace /// Assort to adjust @@ -523,7 +522,7 @@ public class FenceService( } /// - /// Choose an item at random and remove it + mods from assorts + /// Choose an item at random and remove it + mods from assorts /// /// Trader assort to remove item from /// Pool of root items to pick from to remove @@ -572,7 +571,7 @@ public class FenceService( } /// - /// Get an integer rounded count of items to replace based on percentage from traderConfig value + /// Get an integer rounded count of items to replace based on percentage from traderConfig value /// /// Total item count /// Rounded int of items to replace @@ -582,7 +581,7 @@ public class FenceService( } /// - /// Get the count of items fence offers + /// Get the count of items fence offers /// /// Number public int GetOfferCount() @@ -596,8 +595,8 @@ public class FenceService( } /// - /// Create trader assorts for fence and store in fenceService cache - /// Uses fence base cache generation server start as a base + /// Create trader assorts for fence and store in fenceService cache + /// Uses fence base cache generation server start as a base /// public void GenerateFenceAssorts() { @@ -621,7 +620,7 @@ public class FenceService( } /// - /// Convert the intermediary assort data generated into format client can process + /// Convert the intermediary assort data generated into format client can process /// /// Generated assorts that will be converted /// TraderAssort in the correct data format for Fence @@ -640,8 +639,8 @@ public class FenceService( } /// - /// Create object that contains calculated fence assort item values to make based on config. - /// Stored in desiredAssortCounts + /// Create object that contains calculated fence assort item values to make based on config. + /// Stored in desiredAssortCounts /// protected void CreateInitialFenceAssortGenerationValues() { @@ -664,32 +663,32 @@ public class FenceService( result.Normal.Item = traderConfig.Fence.AssortSize; result.Normal.WeaponPreset = randomUtil.GetInt( - (int) traderConfig.Fence.WeaponPresetMinMax.Min, - (int) traderConfig.Fence.WeaponPresetMinMax.Max + traderConfig.Fence.WeaponPresetMinMax.Min, + traderConfig.Fence.WeaponPresetMinMax.Max ); result.Normal.EquipmentPreset = randomUtil.GetInt( - (int) traderConfig.Fence.EquipmentPresetMinMax.Min, - (int) traderConfig.Fence.EquipmentPresetMinMax.Max + traderConfig.Fence.EquipmentPresetMinMax.Min, + traderConfig.Fence.EquipmentPresetMinMax.Max ); result.Discount.Item = traderConfig.Fence.DiscountOptions.AssortSize; result.Discount.WeaponPreset = randomUtil.GetInt( - (int) traderConfig.Fence.DiscountOptions.WeaponPresetMinMax.Min, - (int) traderConfig.Fence.DiscountOptions.WeaponPresetMinMax.Max + traderConfig.Fence.DiscountOptions.WeaponPresetMinMax.Min, + traderConfig.Fence.DiscountOptions.WeaponPresetMinMax.Max ); result.Discount.EquipmentPreset = randomUtil.GetInt( - (int) traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Min, - (int) traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Max + traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Min, + traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Max ); desiredAssortCounts = result; } /// - /// Create skeleton to hold assort items + /// Create skeleton to hold assort items /// /// TraderAssort object protected TraderAssort CreateFenceAssortSkeleton() @@ -704,7 +703,7 @@ public class FenceService( } /// - /// Hydrate assorts parameter object with generated assorts + /// Hydrate assorts parameter object with generated assorts /// /// Number of items to generate per type (Item, WeaponPreset, EquipmentPreset) /// Loyalty level to set new item to @@ -742,7 +741,7 @@ public class FenceService( } /// - /// Add item assorts to existing assort data + /// Add item assorts to existing assort data /// /// Number to add /// Data to add to @@ -868,8 +867,8 @@ public class FenceService( } /// - /// Find an assort item that matches the first parameter, also matches based on Upd properties - /// e.g. salewa hp resource units left + /// Find an assort item that matches the first parameter, also matches based on Upd properties + /// e.g. salewa hp resource units left /// /// item to look for a match against /// DB details of matching item @@ -883,12 +882,10 @@ public class FenceService( { // Get matching root items var matchingItems = itemsWithChildren - .Where( - itemWithChildren => itemWithChildren.FirstOrDefault( - item => item.Template == rootItemBeingAdded.Template && - string.Equals(item.ParentId, "hideout", StringComparison.OrdinalIgnoreCase) - ) != - null + .Where(itemWithChildren => itemWithChildren.FirstOrDefault(item => item.Template == rootItemBeingAdded.Template && + string.Equals(item.ParentId, "hideout", StringComparison.OrdinalIgnoreCase) + ) != + null ) .SelectMany(i => i) .ToList(); @@ -946,7 +943,7 @@ public class FenceService( } /// - /// Should this item be forced into only 1 stack on fence + /// Should this item be forced into only 1 stack on fence /// /// Existing item from fence assort /// Item we want to add DB details @@ -975,7 +972,7 @@ public class FenceService( } /// - /// Adjust price of item based on what is left to buy (resource/uses left) + /// Adjust price of item based on what is left to buy (resource/uses left) /// /// All barter scheme for item having price adjusted /// Root item having price adjusted @@ -1033,7 +1030,7 @@ public class FenceService( } /// - /// Find presets in base fence assort and add desired number to 'assorts' parameter + /// Find presets in base fence assort and add desired number to 'assorts' parameter /// /// How many WeaponPresets to add /// How many WeaponPresets to add @@ -1051,8 +1048,8 @@ public class FenceService( var weaponPresetsAddedCount = 0; if (desiredWeaponPresetsCount > 0) { - var weaponPresetRootItems = baseFenceAssort.Items.Where( - item => item.Upd?.SptPresetId != null && itemHelper.IsOfBaseclass(item.Template, BaseClasses.WEAPON) + var weaponPresetRootItems = baseFenceAssort.Items.Where(item => + item.Upd?.SptPresetId != null && itemHelper.IsOfBaseclass(item.Template, BaseClasses.WEAPON) ); while (weaponPresetsAddedCount < desiredWeaponPresetsCount) { @@ -1117,8 +1114,7 @@ public class FenceService( return; } - var equipmentPresetRootItems = baseFenceAssort.Items.Where( - item => item.Upd?.SptPresetId != null && itemHelper.ArmorItemCanHoldMods(item.Template) + var equipmentPresetRootItems = baseFenceAssort.Items.Where(item => item.Upd?.SptPresetId != null && itemHelper.ArmorItemCanHoldMods(item.Template) ); while (equipmentPresetsAddedCount < desiredEquipmentPresetsCount) { @@ -1179,7 +1175,7 @@ public class FenceService( } /// - /// Adjust plate / soft insert durability values + /// Adjust plate / soft insert durability values /// /// Armor item array to add mods into /// Armor items db template @@ -1208,7 +1204,7 @@ public class FenceService( } /// - /// Randomise the durability values of items on armor with a passed in slot + /// Randomise the durability values of items on armor with a passed in slot /// /// Slots of items to randomise /// Array of armor + inserts to get items from @@ -1265,8 +1261,8 @@ public class FenceService( } /// - /// Randomise the durability values of plate items in armor
- /// Has chance to remove plate + /// Randomise the durability values of plate items in armor
+ /// Has chance to remove plate ///
/// Slots of items to randomise /// Array of armor + inserts to get items from @@ -1302,8 +1298,7 @@ public class FenceService( ); // Find items mod to apply durability changes to - var modItemToAdjust = armorWithMods.FirstOrDefault( - mod => string.Equals( + var modItemToAdjust = armorWithMods.FirstOrDefault(mod => string.Equals( mod.SlotId, plateSlot.Name, StringComparison.OrdinalIgnoreCase @@ -1335,7 +1330,7 @@ public class FenceService( } /// - /// Get stack size of a singular item (no mods) + /// Get stack size of a singular item (no mods) /// /// Item being added to fence /// Stack size @@ -1347,7 +1342,7 @@ public class FenceService( overrideValues = traderConfig.Fence.ItemStackSizeOverrideMinMax[itemDbDetails.Parent]; if (overrideValues != null) { - return randomUtil.GetInt((int) overrideValues.Min, (int) overrideValues.Max); + return randomUtil.GetInt(overrideValues.Min, overrideValues.Max); } // No override, use stack max size from item db @@ -1362,20 +1357,20 @@ public class FenceService( // Check for override in config, use values if exists if (traderConfig.Fence.ItemStackSizeOverrideMinMax.TryGetValue(itemDbDetails.Id, out overrideValues)) { - return randomUtil.GetInt((int) overrideValues.Min, (int) overrideValues.Max); + return randomUtil.GetInt(overrideValues.Min, overrideValues.Max); } // Check for parent override if (traderConfig.Fence.ItemStackSizeOverrideMinMax.TryGetValue(itemDbDetails.Parent, out overrideValues)) { - return randomUtil.GetInt((int) overrideValues.Min, (int) overrideValues.Max); + return randomUtil.GetInt(overrideValues.Min, overrideValues.Max); } return 1; } /// - /// Remove parts of a weapon prior to being listed on flea + /// Remove parts of a weapon prior to being listed on flea /// /// Weapon to remove parts from protected void RemoveRandomModsOfItem(List itemAndMods) @@ -1411,7 +1406,7 @@ public class FenceService( } /// - /// Roll % chance check to see if item should be removed + /// Roll % chance check to see if item should be removed /// /// Weapon mod being checked /// Current list of items on weapon being deleted @@ -1431,7 +1426,7 @@ public class FenceService( } /// - /// Randomise items' Upd properties e.g. med packs/weapons/armor + /// Randomise items' Upd properties e.g. med packs/weapons/armor /// /// Item being randomised /// Item being edited @@ -1536,7 +1531,7 @@ public class FenceService( } /// - /// Generate a randomised current and max durability value for an armor item + /// Generate a randomised current and max durability value for an armor item /// /// Item to create values for /// Max durability percent min/max values @@ -1565,7 +1560,7 @@ public class FenceService( } /// - /// Construct item limit record to hold max and current item count + /// Construct item limit record to hold max and current item count /// /// Limits as defined in config /// Record, key: item tplId, value: current/max item count allowed @@ -1582,7 +1577,7 @@ public class FenceService( } /// - /// Get the next Update timestamp for fence + /// Get the next Update timestamp for fence /// /// Future timestamp public long GetNextFenceUpdateTimestamp() @@ -1593,18 +1588,18 @@ public class FenceService( } /// - /// Get fence refresh time in seconds + /// Get fence refresh time in seconds /// /// Refresh time in seconds protected int GetFenceRefreshTime() { var fence = traderConfig.UpdateTime.FirstOrDefault(x => x.TraderId == Traders.FENCE).Seconds; - return randomUtil.GetInt((int) fence.Min, (int) fence.Max); + return randomUtil.GetInt(fence.Min, fence.Max); } /// - /// Get fence level the passed in profile has + /// Get fence level the passed in profile has /// /// Player profile /// FenceLevel object @@ -1637,7 +1632,7 @@ public class FenceService( } /// - /// Remove or lower stack size of an assort from fence by id + /// Remove or lower stack size of an assort from fence by id /// /// Assort ID to adjust /// `Count of items bought diff --git a/Libraries/SPTarkov.Server.Core/Services/GiftService.cs b/Libraries/SPTarkov.Server.Core/Services/GiftService.cs index a0a77ab5..9b968bf5 100644 --- a/Libraries/SPTarkov.Server.Core/Services/GiftService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/GiftService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Enums; @@ -6,7 +7,6 @@ using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -24,7 +24,7 @@ public class GiftService( protected GiftsConfig _giftConfig = _configServer.GetConfig(); /// - /// Does a gift with a specific ID exist in db + /// Does a gift with a specific ID exist in db /// /// Gift id to check for /// True if it exists in db @@ -41,7 +41,7 @@ public class GiftService( } /// - /// Get dictionary of all gifts + /// Get dictionary of all gifts /// /// Dict keyed by gift id public Dictionary GetGifts() @@ -50,7 +50,7 @@ public class GiftService( } /// - /// Get an array of all gift ids + /// Get an array of all gift ids /// /// String list of gift ids public List GetGiftIds() @@ -59,7 +59,7 @@ public class GiftService( } /// - /// Send player a gift from a range of sources + /// Send player a gift from a range of sources /// /// Player to send gift to / sessionID /// ID of gift in configs/gifts.json to send player @@ -183,7 +183,7 @@ public class GiftService( } /// - /// Get sender id based on gifts sender type enum + /// Get sender id based on gifts sender type enum /// /// Gift to send player /// trader/user/system id @@ -203,7 +203,7 @@ public class GiftService( } /// - /// Convert GiftSenderType into a dialog MessageType + /// Convert GiftSenderType into a dialog MessageType /// /// Gift to send player /// MessageType enum value @@ -224,7 +224,7 @@ public class GiftService( } /// - /// Prapor sends gifts to player for first week after profile creation + /// Prapor sends gifts to player for first week after profile creation /// /// Player ID /// What day to give gift for @@ -247,7 +247,7 @@ public class GiftService( } /// - /// Send player a gift with silent received check + /// Send player a gift with silent received check /// /// ID of gift to send /// Session ID of player to send to diff --git a/Libraries/SPTarkov.Server.Core/Services/I18nService.cs b/Libraries/SPTarkov.Server.Core/Services/I18nService.cs index f49ad083..fc662858 100644 --- a/Libraries/SPTarkov.Server.Core/Services/I18nService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/I18nService.cs @@ -1,6 +1,6 @@ +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Json; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Services; @@ -11,9 +11,9 @@ public class I18nService private readonly Dictionary _fallbacks; private readonly FileUtil _fileUtil; private readonly JsonUtil _jsonUtil; - private readonly LocaleService _localeService; private readonly Dictionary>> _loadedLocales = new(); + private readonly LocaleService _localeService; private HashSet _locales; private string? _setLocale; @@ -50,9 +50,8 @@ public class I18nService { _loadedLocales.Add( _fileUtil.StripExtension(file), - new LazyLoad>( - () => _jsonUtil.DeserializeFromFile>(file) ?? - new Dictionary() + new LazyLoad>(() => _jsonUtil.DeserializeFromFile>(file) ?? + new Dictionary() ) ); } diff --git a/Libraries/SPTarkov.Server.Core/Services/InMemoryCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/InMemoryCacheService.cs index 429cf3eb..e7dd4246 100644 --- a/Libraries/SPTarkov.Server.Core/Services/InMemoryCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/InMemoryCacheService.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Utils.Cloners; namespace SPTarkov.Server.Core.Services; @@ -11,7 +11,7 @@ public class InMemoryCacheService( protected Dictionary _cacheData = new(); /// - /// Store data into an in-memory object + /// Store data into an in-memory object /// /// Key to store data against /// Data to store in cache @@ -21,7 +21,7 @@ public class InMemoryCacheService( } /// - /// Retrieve data stored by a key + /// Retrieve data stored by a key /// /// key /// Stored data @@ -36,7 +36,7 @@ public class InMemoryCacheService( } /// - /// Does data exist against the provided key + /// Does data exist against the provided key /// /// Key to check for data against /// True if exists @@ -46,7 +46,7 @@ public class InMemoryCacheService( } /// - /// Remove data stored against key + /// Remove data stored against key /// /// Key to remove data against public void ClearDataStoredByKey(string key) @@ -55,7 +55,7 @@ public class InMemoryCacheService( } /// - /// Remove all data stored + /// Remove all data stored /// public void ClearCache() { diff --git a/Libraries/SPTarkov.Server.Core/Services/InsuranceService.cs b/Libraries/SPTarkov.Server.Core/Services/InsuranceService.cs index 7098321c..4e685129 100644 --- a/Libraries/SPTarkov.Server.Core/Services/InsuranceService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/InsuranceService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -9,7 +10,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using Insurance = SPTarkov.Server.Core.Models.Eft.Profile.Insurance; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; @@ -299,8 +299,7 @@ public class InsuranceService( AddInsuranceItemToArray(sessionId, traderId, itemToReturnToPlayer); // Remove item from insured items array as its been processed - pmcData.InsuredItems = pmcData.InsuredItems.Where( - item => + pmcData.InsuredItems = pmcData.InsuredItems.Where(item => { return item.ItemId != itemToReturnToPlayer.Id; } diff --git a/Libraries/SPTarkov.Server.Core/Services/ItemBaseClassService.cs b/Libraries/SPTarkov.Server.Core/Services/ItemBaseClassService.cs index 0b256e09..64177a3a 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ItemBaseClassService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ItemBaseClassService.cs @@ -1,12 +1,12 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; /// -/// Cache the baseids for each item in the items db inside a dictionary +/// Cache the baseids for each item in the items db inside a dictionary /// [Injectable(InjectionType.Singleton)] public class ItemBaseClassService( @@ -19,8 +19,8 @@ public class ItemBaseClassService( private Dictionary> _itemBaseClassesCache; /// - /// Create cache and store inside ItemBaseClassService
- /// Store a dict of an items tpl to the base classes it and its parents have + /// Create cache and store inside ItemBaseClassService
+ /// Store a dict of an items tpl to the base classes it and its parents have ///
public void HydrateItemBaseClassCache() { @@ -28,7 +28,7 @@ public class ItemBaseClassService( _itemBaseClassesCache = new Dictionary>(); var items = _databaseService.GetItems(); - var filteredDbItems = items.Where(x => string.Equals(x.Value.Type,"Item", StringComparison.OrdinalIgnoreCase)); + var filteredDbItems = items.Where(x => string.Equals(x.Value.Type, "Item", StringComparison.OrdinalIgnoreCase)); foreach (var item in filteredDbItems) { var itemIdToUpdate = item.Value.Id; @@ -44,7 +44,7 @@ public class ItemBaseClassService( } /// - /// Helper method, recursively iterate through items parent items, finding and adding ids to dictionary + /// Helper method, recursively iterate through items parent items, finding and adding ids to dictionary /// /// Item tpl to store base ids against in dictionary /// Item being checked @@ -60,7 +60,7 @@ public class ItemBaseClassService( } /// - /// Does item tpl inherit from the requested base class + /// Does item tpl inherit from the requested base class /// /// ItemTpl item to check base classes of /// BaseClass base class to check for @@ -111,17 +111,17 @@ public class ItemBaseClassService( } /// - /// Check if cached item template is of type Item + /// Check if cached item template is of type Item /// /// ItemTemplateId item to check /// True if item is of type Item private bool CachedItemIsOfItemType(string itemTemplateId) { - return string.Equals(_databaseService.GetItems()[itemTemplateId]?.Type,"Item", StringComparison.OrdinalIgnoreCase); + return string.Equals(_databaseService.GetItems()[itemTemplateId]?.Type, "Item", StringComparison.OrdinalIgnoreCase); } /// - /// Get base classes item inherits from + /// Get base classes item inherits from /// /// ItemTpl item to get base classes for /// array of base classes diff --git a/Libraries/SPTarkov.Server.Core/Services/ItemFilterService.cs b/Libraries/SPTarkov.Server.Core/Services/ItemFilterService.cs index e3c9024c..f45b5c62 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ItemFilterService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ItemFilterService.cs @@ -1,12 +1,13 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; + /// -/// Centralise the handling of blacklisting items, uses blacklist found in config/item.json, stores items that should not be used by players / broken items +/// Centralise the handling of blacklisting items, uses blacklist found in config/item.json, stores items that should not be used by players / broken items /// [Injectable(InjectionType.Singleton)] public class ItemFilterService( @@ -21,7 +22,7 @@ public class ItemFilterService( protected HashSet? _lootableItemBlacklistCache = []; /// - /// Check if the provided template id is blacklisted in config/item.json/blacklist + /// Check if the provided template id is blacklisted in config/item.json/blacklist /// /// Template id /// True if blacklisted @@ -36,7 +37,7 @@ public class ItemFilterService( } /// - /// Check if item is blacklisted from being a reward for player + /// Check if item is blacklisted from being a reward for player /// /// Item tpl to check is on blacklist /// True when blacklisted @@ -46,7 +47,7 @@ public class ItemFilterService( } /// - /// Get an HashSet of items that should never be given as a reward to player + /// Get an HashSet of items that should never be given as a reward to player /// /// HashSet of item tpls public HashSet GetItemRewardBlacklist() @@ -55,7 +56,7 @@ public class ItemFilterService( } /// - /// Get an HashSet of item types that should never be given as a reward to player + /// Get an HashSet of item types that should never be given as a reward to player /// /// HashSet of item base ids public HashSet GetItemRewardBaseTypeBlacklist() @@ -64,7 +65,7 @@ public class ItemFilterService( } /// - /// Return every template id blacklisted in config/item.json + /// Return every template id blacklisted in config/item.json /// /// HashSet of blacklisted template ids public HashSet GetBlacklistedItems() @@ -73,7 +74,7 @@ public class ItemFilterService( } /// - /// Return every template id blacklisted in config/item.json/lootableItemBlacklist + /// Return every template id blacklisted in config/item.json/lootableItemBlacklist /// /// HashSet of blacklisted template ids public HashSet GetBlacklistedLootableItems() @@ -82,7 +83,7 @@ public class ItemFilterService( } /// - /// Check if the provided template id is boss item in config/item.json + /// Check if the provided template id is boss item in config/item.json /// /// template id /// True if boss item @@ -92,7 +93,7 @@ public class ItemFilterService( } /// - /// Return boss items in config/item.json + /// Return boss items in config/item.json /// /// HashSet of boss item template ids public HashSet GetBossItems() @@ -101,7 +102,7 @@ public class ItemFilterService( } /// - /// Check if the provided template id is blacklisted in config/item.json/lootableItemBlacklist + /// Check if the provided template id is blacklisted in config/item.json/lootableItemBlacklist /// /// Template id /// True if blacklisted @@ -142,7 +143,7 @@ public class ItemFilterService( } /// - /// Check if the provided template id is boss item in config/item.json + /// Check if the provided template id is boss item in config/item.json /// /// Template id /// True if boss item @@ -152,7 +153,7 @@ public class ItemFilterService( } /// - /// Check if item is blacklisted from being a reward for player + /// Check if item is blacklisted from being a reward for player /// /// Item tpl to check is on blacklist /// true when blacklisted diff --git a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs index 878b64d4..0f32472d 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs @@ -1,9 +1,8 @@ using System.Globalization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; -using SPTarkov.Server.Core.Utils.Json; namespace SPTarkov.Server.Core.Services; @@ -16,11 +15,11 @@ public class LocaleService( { // we have to LazyLoad the data from the database and then combine it with the custom data before returning it protected LocaleConfig _localeConfig = _configServer.GetConfig(); - protected Dictionary> customClientLocales = new Dictionary>(); + protected Dictionary> customClientLocales = new(); /// - /// Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' - /// This will contain Custom locales added by mods + /// Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + /// This will contain Custom locales added by mods /// /// Dictionary of locales for desired language - en/fr/cn public Dictionary GetLocaleDb(string? language = null) @@ -40,7 +39,7 @@ public class LocaleService( } /// - /// Attempts to retrieve the locale database for the specified language key, including custom locales if available. + /// Attempts to retrieve the locale database for the specified language key, including custom locales if available. /// /// The language key for which the locale database should be retrieved. /// The resulting locale database as a dictionary, or null if the operation fails. @@ -66,9 +65,8 @@ public class LocaleService( /// - /// Combines the provided database locales with custom locales, ensuring that all entries are merged into a single dictionary. - /// Custom locale entries will overwrite existing keys from the database locales if conflicts occur. - /// + /// Combines the provided database locales with custom locales, ensuring that all entries are merged into a single dictionary. + /// Custom locale entries will overwrite existing keys from the database locales if conflicts occur. /// /// The dictionary containing locale entries from the database. /// The dictionary containing custom locale entries to be merged. @@ -79,8 +77,8 @@ public class LocaleService( } /// - /// Gets the game locale key from the locale.json file, - /// if value is 'system' get system locale + /// Gets the game locale key from the locale.json file, + /// if value is 'system' get system locale /// /// Locale e.g en/ge/cz/cn public string GetDesiredGameLocale() @@ -94,8 +92,8 @@ public class LocaleService( } /// - /// Gets the game locale key from the locale.json file, - /// if value is 'system' get system locale + /// Gets the game locale key from the locale.json file, + /// if value is 'system' get system locale /// /// Locale e.g en/ge/cz/cn public string GetDesiredServerLocale() @@ -109,7 +107,7 @@ public class LocaleService( } /// - /// Get array of languages supported for localisation + /// Get array of languages supported for localisation /// /// List of locales e.g. en/fr/cn public List GetServerSupportedLocales() @@ -118,7 +116,7 @@ public class LocaleService( } /// - /// Get array of languages supported for localisation + /// Get array of languages supported for localisation /// /// Dictionary of locales e.g. en/fr/cn public Dictionary GetLocaleFallbacks() @@ -127,7 +125,7 @@ public class LocaleService( } /// - /// Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt + /// Get the full locale of the computer running the server lowercased e.g. en-gb / pt-pt /// /// System locale as String public string GetPlatformForServerLocale() @@ -170,7 +168,7 @@ public class LocaleService( } /// - /// Get the locale of the computer running the server + /// Get the locale of the computer running the server /// /// Language part of locale e.g. 'en' part of 'en-US' protected string GetPlatformForClientLocale() @@ -212,7 +210,7 @@ public class LocaleService( } /// - /// This is in a function so we can overwrite it during testing + /// This is in a function so we can overwrite it during testing /// /// The current platform locale protected CultureInfo GetPlatformLocale() @@ -248,7 +246,7 @@ public class LocaleService( } /// - /// Blank out the "test" mail message from prapor + /// Blank out the "test" mail message from prapor /// protected Dictionary RemovePraporTestMessage(Dictionary dbLocales) { diff --git a/Libraries/SPTarkov.Server.Core/Services/LocalisationService.cs b/Libraries/SPTarkov.Server.Core/Services/LocalisationService.cs index 681114f6..1fd2d5ff 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocalisationService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocalisationService.cs @@ -1,12 +1,12 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; /// -/// Handles translating server text into different langauges +/// Handles translating server text into different langauges /// [Injectable(InjectionType.Singleton)] public class LocalisationService @@ -43,8 +43,9 @@ public class LocalisationService ); _i18nService.SetLocaleByKey(localeService.GetDesiredServerLocale()); } + /// - /// Get a localised value using the passed in key + /// Get a localised value using the passed in key /// /// Key to look up locale for /// optional arguments @@ -57,7 +58,7 @@ public class LocalisationService } /// - /// Get a localised value using the passed in key + /// Get a localised value using the passed in key /// /// Key to look up locale for /// Value to localize @@ -68,7 +69,7 @@ public class LocalisationService } /// - /// Get all locale keys + /// Get all locale keys /// /// Generic collection of keys public ICollection GetKeys() @@ -77,7 +78,7 @@ public class LocalisationService } /// - /// From the provided partial key, find all keys that start with text and choose a random match + /// From the provided partial key, find all keys that start with text and choose a random match /// /// Key to match locale keys on /// Locale text diff --git a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs index 240300f1..370afe22 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; @@ -13,7 +14,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -43,8 +43,8 @@ public class LocationLifecycleService protected MatchBotDetailsCacheService _matchBotDetailsCacheService; protected PlayerScavGenerator _playerScavGenerator; protected PmcChatResponseService _pmcChatResponseService; - protected PmcWaveGenerator _pmcWaveGenerator; protected PmcConfig _pmcConfig; + protected PmcWaveGenerator _pmcWaveGenerator; protected ProfileHelper _profileHelper; protected QuestHelper _questHelper; protected RagfairConfig _ragfairConfig; @@ -125,7 +125,7 @@ public class LocationLifecycleService } /// - /// Handle client/match/local/start + /// Handle client/match/local/start /// public virtual StartLocalRaidResponseData StartLocalRaid(string sessionId, StartLocalRaidRequestData request) { @@ -202,7 +202,7 @@ public class LocationLifecycleService } /// - /// Replace map exits with scav exits when player is scavving + /// Replace map exits with scav exits when player is scavving /// /// Players side (savage/usec/bear) /// ID of map being loaded @@ -234,7 +234,7 @@ public class LocationLifecycleService } /// - /// Adjust the bot hostility values prior to entering a raid + /// Adjust the bot hostility values prior to entering a raid /// /// Map to adjust values of protected void AdjustBotHostilitySettings(LocationBase location) @@ -242,8 +242,8 @@ public class LocationLifecycleService foreach (var botId in _pmcConfig.HostilitySettings) { var configHostilityChanges = _pmcConfig.HostilitySettings[botId.Key]; - var locationBotHostilityDetails = location.BotLocationModifier.AdditionalHostilitySettings.FirstOrDefault( - botSettings => string.Equals(botSettings.BotRole, botId.Key, StringComparison.OrdinalIgnoreCase) + var locationBotHostilityDetails = location.BotLocationModifier.AdditionalHostilitySettings.FirstOrDefault(botSettings => + string.Equals(botSettings.BotRole, botId.Key, StringComparison.OrdinalIgnoreCase) ); // No matching bot in config, skip @@ -272,8 +272,7 @@ public class LocationLifecycleService locationBotHostilityDetails.ChancedEnemies = []; foreach (var chanceDetailsToApply in configHostilityChanges.ChancedEnemies) { - var locationBotDetails = locationBotHostilityDetails.ChancedEnemies.FirstOrDefault( - botChance => botChance.Role == chanceDetailsToApply.Role + var locationBotDetails = locationBotHostilityDetails.ChancedEnemies.FirstOrDefault(botChance => botChance.Role == chanceDetailsToApply.Role ); if (locationBotDetails is not null) // Existing @@ -328,7 +327,7 @@ public class LocationLifecycleService } /// - /// Generate a maps base location (cloned) and loot + /// Generate a maps base location (cloned) and loot /// /// Map name /// OPTIONAL - Should loot be generated for the map before being returned @@ -413,7 +412,7 @@ public class LocationLifecycleService } /// - /// Handle client/match/local/end + /// Handle client/match/local/end /// public virtual void EndLocalRaid(string sessionId, EndLocalRaidRequestData request) { @@ -522,7 +521,7 @@ public class LocationLifecycleService } /// - /// Was extract by car + /// Was extract by car /// /// Name of extract /// True if extract was by car @@ -543,7 +542,7 @@ public class LocationLifecycleService } /// - /// Handle when a player extracts using a car - Add rep to fence + /// Handle when a player extracts using a car - Add rep to fence /// /// Name of the extract used /// Player profile @@ -577,7 +576,7 @@ public class LocationLifecycleService } /// - /// Handle when a player extracts using a coop extract - add rep to fence + /// Handle when a player extracts using a coop extract - add rep to fence /// /// Session/player id /// Player profile @@ -610,7 +609,7 @@ public class LocationLifecycleService } /// - /// Get the fence rep gain from using a car or coop extract + /// Get the fence rep gain from using a car or coop extract /// /// Profile /// Amount gained for the first extract @@ -632,7 +631,7 @@ public class LocationLifecycleService } /// - /// Did player take a COOP extract + /// Did player take a COOP extract /// /// Name of extract player took /// True if coop extract @@ -718,7 +717,7 @@ public class LocationLifecycleService } /// - /// Scav quest progress isn't transferred automatically from scav to pmc, we do this manually + /// Scav quest progress isn't transferred automatically from scav to pmc, we do this manually /// /// Scav profile with quest progress post-raid /// Server pmc profile to copy scav quest progress into @@ -739,8 +738,7 @@ public class LocationLifecycleService } // Get counters related to scav quest - var matchingCounters = scavProfile.TaskConditionCounters.Where( - counter => counter.Value.SourceId == scavQuest.QId + var matchingCounters = scavProfile.TaskConditionCounters.Where(counter => counter.Value.SourceId == scavQuest.QId ); if (matchingCounters is null) @@ -762,7 +760,7 @@ public class LocationLifecycleService } /// - /// Does the provided profile contain any condition counters + /// Does the provided profile contain any condition counters /// /// Profile to check for condition counters /// Profile has condition counters @@ -777,7 +775,7 @@ public class LocationLifecycleService } /// - /// Handles PMC Profile after the raid + /// Handles PMC Profile after the raid /// /// Player id /// Pmc profile @@ -880,8 +878,7 @@ public class LocationLifecycleService "pmcusec" }; - var victims = postRaidProfile.Stats.Eft.Victims.Where( - victim => roles.Contains(victim.Role.ToLower()) + var victims = postRaidProfile.Stats.Eft.Victims.Where(victim => roles.Contains(victim.Role.ToLower()) ) .ToList(); if (victims?.Count > 0) @@ -892,8 +889,8 @@ public class LocationLifecycleService } /// - /// On death Quest items are lost, the client does not clean up completed conditions for picking up those quest items, - /// If the completed conditions remain in the profile the player is unable to pick the item up again + /// On death Quest items are lost, the client does not clean up completed conditions for picking up those quest items, + /// If the completed conditions remain in the profile the player is unable to pick the item up again /// /// Session ID /// Quest items lost on player death @@ -911,23 +908,21 @@ public class LocationLifecycleService // Get db details of quests we found above var questDb = _databaseService.GetQuests() - .Values.Where( - quest => - activeQuestIdsInProfile.Contains(quest.Id) + .Values.Where(quest => + activeQuestIdsInProfile.Contains(quest.Id) ); foreach (var lostItem in lostQuestItems) { var matchingConditionId = string.Empty; // Find a quest that has a FindItem condition that has the list items tpl as a target - var matchingQuests = questDb.Where( - quest => + var matchingQuests = questDb.Where(quest => { - var matchingCondition = quest.Conditions.AvailableForFinish.FirstOrDefault( - questCondition => questCondition.ConditionType == "FindItem" && - (questCondition.Target.IsList - ? questCondition.Target.List - : [questCondition.Target.Item]).Contains(lostItem.Template) + var matchingCondition = quest.Conditions.AvailableForFinish.FirstOrDefault(questCondition => + questCondition.ConditionType == "FindItem" && + (questCondition.Target.IsList + ? questCondition.Target.List + : [questCondition.Target.Item]).Contains(lostItem.Template) ); if (matchingCondition is null) // Quest doesnt have a matching condition @@ -960,8 +955,7 @@ public class LocationLifecycleService } // Filter out the matching condition we found - profileQuestToUpdate.CompletedConditions = profileQuestToUpdate.CompletedConditions.Where( - conditionId => conditionId != matchingConditionId + profileQuestToUpdate.CompletedConditions = profileQuestToUpdate.CompletedConditions.Where(conditionId => conditionId != matchingConditionId ) .ToList(); } @@ -969,9 +963,9 @@ public class LocationLifecycleService /// - /// In 0.15 Lightkeeper quests do not give rewards in PvE, this issue also occurs in spt. - /// We check for newly completed Lk quests and run them through the servers `CompleteQuest` process. - /// This rewards players with items + craft unlocks + new trader assorts. + /// In 0.15 Lightkeeper quests do not give rewards in PvE, this issue also occurs in spt. + /// We check for newly completed Lk quests and run them through the servers `CompleteQuest` process. + /// This rewards players with items + craft unlocks + new trader assorts. /// /// Session ID /// Quest statuses post-raid @@ -986,16 +980,14 @@ public class LocationLifecycleService { // LK quests that were not completed before raid but now are var newlyCompletedLightkeeperQuests = postRaidQuests - .Where( - postRaidQuest => - postRaidQuest.Status == QuestStatusEnum.Success && // Quest is complete - preRaidQuests.Any( - preRaidQuest => - preRaidQuest.QId == postRaidQuest.QId && // Get matching pre-raid quest - preRaidQuest.Status != QuestStatusEnum.Success - ) && // Completed quest was not completed before raid started - _databaseService.GetQuests().TryGetValue(postRaidQuest.QId, out var quest) && - quest?.TraderId == Traders.LIGHTHOUSEKEEPER + .Where(postRaidQuest => + postRaidQuest.Status == QuestStatusEnum.Success && // Quest is complete + preRaidQuests.Any(preRaidQuest => + preRaidQuest.QId == postRaidQuest.QId && // Get matching pre-raid quest + preRaidQuest.Status != QuestStatusEnum.Success + ) && // Completed quest was not completed before raid started + _databaseService.GetQuests().TryGetValue(postRaidQuest.QId, out var quest) && + quest?.TraderId == Traders.LIGHTHOUSEKEEPER ) // Quest is from LK .ToList(); @@ -1017,8 +1009,8 @@ public class LocationLifecycleService } /// - /// Convert post-raid quests into correct format. - /// Quest status comes back as a string version of the enum `Success`, not the expected value of 1. + /// Convert post-raid quests into correct format. + /// Quest status comes back as a string version of the enum `Success`, not the expected value of 1. /// /// Quests data from client /// List of adjusted QuestStatus post-raid @@ -1043,7 +1035,7 @@ public class LocationLifecycleService } /// - /// Adjust server trader settings if they differ from data sent by client + /// Adjust server trader settings if they differ from data sent by client /// /// Server /// Client @@ -1070,7 +1062,7 @@ public class LocationLifecycleService } /// - /// Check if player used BTR or transit item sending service and send items to player via mail if found + /// Check if player used BTR or transit item sending service and send items to player via mail if found /// /// Session ID /// End raid request from client @@ -1129,8 +1121,7 @@ public class LocationLifecycleService // Remove any items that were returned by the item delivery, but also insured, from the player's insurance list // This is to stop items being duplicated by being returned from both item delivery and insurance var deliveredItemIds = items.Select(item => item.Id); - pmcData.InsuredItems = pmcData.InsuredItems.Where( - insuredItem => !deliveredItemIds.Contains(insuredItem.ItemId) + pmcData.InsuredItems = pmcData.InsuredItems.Where(insuredItem => !deliveredItemIds.Contains(insuredItem.ItemId) ) .ToList(); @@ -1173,7 +1164,7 @@ public class LocationLifecycleService } /// - /// Checks to see if player survives. run through will return false + /// Checks to see if player survives. run through will return false /// /// Post raid request /// True if survived @@ -1183,7 +1174,7 @@ public class LocationLifecycleService } /// - /// Is the player dead after a raid - dead = anything other than "survived" / "runner" + /// Is the player dead after a raid - dead = anything other than "survived" / "runner" /// /// Post raid request /// True if dead @@ -1199,7 +1190,7 @@ public class LocationLifecycleService } /// - /// Has the player moved from one map to another + /// Has the player moved from one map to another /// /// Post raid request /// True if players transferred @@ -1209,7 +1200,7 @@ public class LocationLifecycleService } /// - /// Reset the skill points earned in a raid to 0, ready for next raid + /// Reset the skill points earned in a raid to 0, ready for next raid /// /// Profile common skills to update protected void ResetSkillPointsEarnedDuringRaid(List commonSkills) @@ -1221,8 +1212,8 @@ public class LocationLifecycleService } /// - /// Merge two dictionaries together. - /// Prioritise pair that has true as a value + /// Merge two dictionaries together. + /// Prioritise pair that has true as a value /// /// Main dictionary /// Secondary dictionary @@ -1240,7 +1231,7 @@ public class LocationLifecycleService } /// - /// Check for and add any rewards found via the gained achievements this raid + /// Check for and add any rewards found via the gained achievements this raid /// /// Profile to add customisations to /// All profile achievements at the end of a raid @@ -1250,17 +1241,15 @@ public class LocationLifecycleService var pmcProfile = fullProfile.CharacterData.PmcData; var preRaidAchievementIds = fullProfile.CharacterData.PmcData.Achievements; var postRaidAchievementIds = postRaidAchievements; - var achievementIdsAcquiredThisRaid = postRaidAchievementIds.Where( - id => !preRaidAchievementIds.Contains(id) + var achievementIdsAcquiredThisRaid = postRaidAchievementIds.Where(id => !preRaidAchievementIds.Contains(id) ); // Get achievement data from db var achievementsDb = _databaseService.GetTemplates().Achievements; // Map the achievement ids player obtained in raid with matching achievement data from db - var achievements = achievementIdsAcquiredThisRaid.Select( - achievementId => - achievementsDb.FirstOrDefault(achievementDb => achievementDb.Id == achievementId.Key) + var achievements = achievementIdsAcquiredThisRaid.Select(achievementId => + achievementsDb.FirstOrDefault(achievementDb => achievementDb.Id == achievementId.Key) ); if (achievements is null) // No achievements found diff --git a/Libraries/SPTarkov.Server.Core/Services/MailSendService.cs b/Libraries/SPTarkov.Server.Core/Services/MailSendService.cs index 7adf447b..1ff7dc98 100644 --- a/Libraries/SPTarkov.Server.Core/Services/MailSendService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/MailSendService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Profile; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -33,7 +33,7 @@ public class MailSendService( protected HashSet _slotNames = ["hideout", "main"]; /// - /// Send a message from an NPC (e.g. prapor) to the player with or without items using direct message text, do not look up any locale + /// Send a message from an NPC (e.g. prapor) to the player with or without items using direct message text, do not look up any locale /// /// The session ID to send the message to /// The trader sending the message @@ -101,7 +101,7 @@ public class MailSendService( } /// - /// Send a message from an NPC (e.g. prapor) to the player with or without items + /// Send a message from an NPC (e.g. prapor) to the player with or without items /// /// The session ID to send the message to /// The trader sending the message @@ -177,7 +177,7 @@ public class MailSendService( } /// - /// Send a message from SYSTEM to the player with or without items + /// Send a message from SYSTEM to the player with or without items /// /// The session ID to send the message to /// The text to send to player @@ -215,8 +215,9 @@ public class MailSendService( SendMessageToPlayer(details); } + /// - /// Send a message from SYSTEM to the player with or without items with localised text + /// Send a message from SYSTEM to the player with or without items with localised text /// /// The session ID to send the message to /// Id of key from locale file to send to player @@ -255,7 +256,7 @@ public class MailSendService( } /// - /// Send a USER message to a player with or without items + /// Send a USER message to a player with or without items /// /// The session ID to send the message to /// Who is sending the message @@ -290,8 +291,8 @@ public class MailSendService( } /// - /// Large function to send messages to players from a variety of sources (SYSTEM/NPC/USER). - /// Helper functions in this class are available to simplify common actions + /// Large function to send messages to players from a variety of sources (SYSTEM/NPC/USER). + /// Helper functions in this class are available to simplify common actions /// /// Details needed to send a message to the player public void SendMessageToPlayer(SendMessageDetails messageDetails) @@ -346,7 +347,7 @@ public class MailSendService( } /// - /// Send a message from the player to an NPC + /// Send a message from the player to an NPC /// /// Session ID /// NPC message is sent to @@ -376,7 +377,7 @@ public class MailSendService( } /// - /// Create a message for storage inside a dialog in the player profile + /// Create a message for storage inside a dialog in the player profile /// /// ID of dialog that will hold the message /// Various details on what the message must contain/do @@ -411,7 +412,7 @@ public class MailSendService( } /// - /// Finds the Message to reply to using the ID of the recipient, message and the dialogue. + /// Finds the Message to reply to using the ID of the recipient, message and the dialogue. /// /// The ID of the recipient /// The ID of the message to reply to @@ -444,7 +445,7 @@ public class MailSendService( } /// - /// Add items to message and adjust various properties to reflect the items being added + /// Add items to message and adjust various properties to reflect the items being added /// /// Message to add items to /// Items to add to message @@ -461,7 +462,7 @@ public class MailSendService( } /// - /// Perform various sanitising actions on the items before they're considered ready for insertion into message + /// Perform various sanitising actions on the items before they're considered ready for insertion into message /// /// The type of the dialog that will hold the reward items being processed /// Details fo the message e.g. Text, items it has etc. @@ -577,7 +578,7 @@ public class MailSendService( } /// - /// Try to find the most correct item to be the 'primary' item in a reward mail + /// Try to find the most correct item to be the 'primary' item in a reward mail /// /// Possible items to choose from /// Chosen 'primary' item @@ -609,8 +610,8 @@ public class MailSendService( } /// - /// Get a dialog with a specified entity (user/trader). - /// Create and store empty dialog if none exists in profile. + /// Get a dialog with a specified entity (user/trader). + /// Create and store empty dialog if none exists in profile. /// /// Data on what message should do /// Relevant Dialogue object @@ -644,7 +645,7 @@ public class MailSendService( } /// - /// Get the appropriate sender id by the sender enum type + /// Get the appropriate sender id by the sender enum type /// /// Data of the message /// Gets an id of the individual sending it diff --git a/Libraries/SPTarkov.Server.Core/Services/MapMarkerService.cs b/Libraries/SPTarkov.Server.Core/Services/MapMarkerService.cs index 2c950407..10b27137 100644 --- a/Libraries/SPTarkov.Server.Core/Services/MapMarkerService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/MapMarkerService.cs @@ -1,9 +1,9 @@ using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Inventory; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -49,8 +49,7 @@ public class MapMarkerService( var mapItem = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item); // remove marker - var markers = mapItem.Upd.Map.Markers.Where( - marker => + var markers = mapItem.Upd.Map.Markers.Where(marker => { return marker.X != request.X && marker.Y != request.Y; } diff --git a/Libraries/SPTarkov.Server.Core/Services/MatchBotDetailsCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/MatchBotDetailsCacheService.cs index b6255164..23a61cd6 100644 --- a/Libraries/SPTarkov.Server.Core/Services/MatchBotDetailsCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/MatchBotDetailsCacheService.cs @@ -1,12 +1,12 @@ using System.Collections.Concurrent; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; /// -/// Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name +/// Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name /// [Injectable(InjectionType.Singleton)] public class MatchBotDetailsCacheService( @@ -17,7 +17,7 @@ public class MatchBotDetailsCacheService( protected ConcurrentDictionary _botDetailsCache = new(); /// - /// Store a bot in the cache, keyed by its name. + /// Store a bot in the cache, keyed by its name. /// /// Bot details to cache public void CacheBot(BotBase botToCache) @@ -37,7 +37,7 @@ public class MatchBotDetailsCacheService( } /// - /// Clean the cache of all bot details. + /// Clean the cache of all bot details. /// public void ClearCache() { @@ -45,7 +45,7 @@ public class MatchBotDetailsCacheService( } /// - /// Find a bot in the cache by its name and side. + /// Find a bot in the cache by its name and side. /// /// Name of bot to find /// Side of the bot diff --git a/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs b/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs index a9943d17..81d36ce4 100644 --- a/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs @@ -1,12 +1,12 @@ -using SPTarkov.Server.Core.Helpers; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; +using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Services.Mod; @@ -22,12 +22,12 @@ public class CustomItemService( ) { /// - /// Create a new item from a cloned item base
- /// WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start
- /// Add to the items db
- /// Add to the flea market
- /// Add to the handbook
- /// Add to the locales + /// Create a new item from a cloned item base
+ /// WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start
+ /// Add to the items db
+ /// Add to the flea market
+ /// Add to the handbook
+ /// Add to the locales ///
/// Item details for the new item to be created /// tplId of the new item created @@ -80,11 +80,11 @@ public class CustomItemService( } /// - /// Create a new item without using an existing item as a template
- /// Add to the items db
- /// Add to the flea market
- /// Add to the handbook
- /// Add to the locales
+ /// Create a new item without using an existing item as a template
+ /// Add to the items db
+ /// Add to the flea market
+ /// Add to the handbook
+ /// Add to the locales
///
/// Details on what the item to be created /// CreateItemResult containing the completed items ID @@ -124,7 +124,7 @@ public class CustomItemService( } /// - /// If the ID provided is an empty string, return a randomly generated guid, otherwise return the newId parameter + /// If the ID provided is an empty string, return a randomly generated guid, otherwise return the newId parameter /// /// ID supplied to code /// ItemID @@ -134,8 +134,8 @@ public class CustomItemService( } /// - /// Iterates through supplied properties and updates the cloned items properties with them - /// Complex objects cannot have overrides, they must be fully hydrated with values if they are to be used + /// Iterates through supplied properties and updates the cloned items properties with them + /// Complex objects cannot have overrides, they must be fully hydrated with values if they are to be used /// /// New properties to apply /// Item to update @@ -153,7 +153,7 @@ public class CustomItemService( } /// - /// Add a new item object to the in-memory representation of items.json + /// Add a new item object to the in-memory representation of items.json /// /// ID of the item to add to items.json /// Item to add against the new id @@ -166,7 +166,7 @@ public class CustomItemService( } /// - /// Add a handbook price for an item + /// Add a handbook price for an item /// /// ID of the item being added /// Parent ID of the item being added @@ -187,13 +187,13 @@ public class CustomItemService( } /// - /// Iterate through the passed in locale data and add to each locale in turn
- /// If data is not provided for each language EFT uses, the first object will be used in its place
- /// e.g.
- /// en[0]
- /// fr[1]
- ///
- /// No jp provided, so english will be used as a substitute + /// Iterate through the passed in locale data and add to each locale in turn
+ /// If data is not provided for each language EFT uses, the first object will be used in its place
+ /// e.g.
+ /// en[0]
+ /// fr[1]
+ ///
+ /// No jp provided, so english will be used as a substitute ///
/// key is language, value are the new locale details /// ID of the item being created @@ -214,7 +214,7 @@ public class CustomItemService( } /// - /// Add a price to the in-memory representation of prices.json, used to inform the flea of an items price on the market + /// Add a price to the in-memory representation of prices.json, used to inform the flea of an items price on the market /// /// ID of the new item /// Price of the new item @@ -224,7 +224,7 @@ public class CustomItemService( } /// - /// Add a weapon to the hideout weapon shelf whitelist + /// Add a weapon to the hideout weapon shelf whitelist /// /// Weapon ID to add protected void AddToWeaponShelf(string newItemId) @@ -247,7 +247,7 @@ public class CustomItemService( } /// - /// Add a custom weapon to PMCs loadout + /// Add a custom weapon to PMCs loadout /// /// Custom weapon tpl to add to PMCs /// The weighting for the weapon to be picked vs other weapons diff --git a/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs b/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs index 5cb74485..07f09ddc 100644 --- a/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs @@ -26,7 +26,9 @@ public class ProfileDataService(ISptLogger logger, FileUtil value = jsonUtil.Deserialize(fileUtil.ReadFile($"{ProfileDataFilepath}{profileId}/{modKey}.json")); if (value != null) { - while (!_profileDataCache.TryAdd(profileDataKey, value)) { } + while (!_profileDataCache.TryAdd(profileDataKey, value)) + { + } } } else @@ -34,6 +36,7 @@ public class ProfileDataService(ISptLogger logger, FileUtil value = null; } } + return (T?) value; } @@ -43,12 +46,17 @@ public class ProfileDataService(ISptLogger logger, FileUtil { throw new ArgumentNullException(nameof(profileData)); } + var data = jsonUtil.Serialize(profileData, profileData.GetType()); if (data == null) { throw new Exception("The profile data when serialized resulted in a null value"); } - while(!_profileDataCache.TryAdd($"{profileId}:{modKey}", data)) { } + + while (!_profileDataCache.TryAdd($"{profileId}:{modKey}", data)) + { + } + fileUtil.WriteFile($"{ProfileDataFilepath}{profileId}/{modKey}.json", data); } } diff --git a/Libraries/SPTarkov.Server.Core/Services/NotificationService.cs b/Libraries/SPTarkov.Server.Core/Services/NotificationService.cs index e3c1bfaf..873adf20 100644 --- a/Libraries/SPTarkov.Server.Core/Services/NotificationService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/NotificationService.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Ws; namespace SPTarkov.Server.Core.Services; diff --git a/Libraries/SPTarkov.Server.Core/Services/OpenZoneService.cs b/Libraries/SPTarkov.Server.Core/Services/OpenZoneService.cs index 884d6d2b..93052b82 100644 --- a/Libraries/SPTarkov.Server.Core/Services/OpenZoneService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/OpenZoneService.cs @@ -1,12 +1,12 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; /// -/// Service for adding new zones to a maps OpenZones property. +/// Service for adding new zones to a maps OpenZones property. /// [Injectable(InjectionType.Singleton)] public class OpenZoneService( diff --git a/Libraries/SPTarkov.Server.Core/Services/PaymentService.cs b/Libraries/SPTarkov.Server.Core/Services/PaymentService.cs index c413f9ff..71cc491f 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PaymentService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PaymentService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -9,7 +10,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -32,7 +32,7 @@ public class PaymentService( protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); /// - /// Take money and insert items into return to server request + /// Take money and insert items into return to server request /// /// PMC Profile /// Buy item request @@ -45,7 +45,7 @@ public class PaymentService( var payToTrader = _traderHelper.TraderEnumHasValue(request.TransactionId); // Track the amounts of each type of currency involved in the trade. - Dictionary currencyAmounts = new Dictionary(); + var currencyAmounts = new Dictionary(); // Delete barter items and track currencies foreach (var itemRequest in request.SchemeItems) @@ -143,7 +143,7 @@ public class PaymentService( } /// - /// Get the item price of a specific traders assort + /// Get the item price of a specific traders assort /// /// ID of the assort to look up /// ID of trader with assort @@ -168,7 +168,7 @@ public class PaymentService( } /// - /// Receive money back after selling + /// Receive money back after selling /// /// PMC Profile /// Money to send back @@ -244,7 +244,7 @@ public class PaymentService( Template = currencyTpl, Upd = new Upd { - StackObjectsCount = Math.Round((double) calcAmount) + StackObjectsCount = Math.Round(calcAmount) } }; @@ -271,7 +271,7 @@ public class PaymentService( } /// - /// Remove currency from player stash/inventory and update client object with changes + /// Remove currency from player stash/inventory and update client object with changes /// /// Player profile to find and remove currency from /// Type of currency to pay @@ -352,7 +352,7 @@ public class PaymentService( } /// - /// Get all money stacks in inventory and prioritise items in stash + /// Get all money stacks in inventory and prioritise items in stash /// /// Player profile /// Currency to find @@ -374,8 +374,8 @@ public class PaymentService( } /// - /// Prioritise player stash first over player inventory. - /// Post-raid healing would often take money out of the players pockets/secure container. + /// Prioritise player stash first over player inventory. + /// Post-raid healing would often take money out of the players pockets/secure container. /// /// First money stack item /// Second money stack item @@ -448,7 +448,7 @@ public class PaymentService( } /// - /// Recursively check items parents to see if it is inside the players inventory, not stash + /// Recursively check items parents to see if it is inside the players inventory, not stash /// /// Item ID to check /// Player inventory diff --git a/Libraries/SPTarkov.Server.Core/Services/PlayerService.cs b/Libraries/SPTarkov.Server.Core/Services/PlayerService.cs index 80348d8e..48b25f3e 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PlayerService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PlayerService.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Common; namespace SPTarkov.Server.Core.Services; @@ -9,13 +9,15 @@ public class PlayerService( ) { /// - /// Calculates the current level of a player based on their accumulated experience points. - /// This method iterates through an experience table to determine the highest level achieved - /// by comparing the player's experience against cumulative thresholds. + /// Calculates the current level of a player based on their accumulated experience points. + /// This method iterates through an experience table to determine the highest level achieved + /// by comparing the player's experience against cumulative thresholds. /// /// Player profile - /// The calculated level of the player as an integer, or null if the level cannot be determined. - /// This value is also assigned to within the provided profile. + /// + /// The calculated level of the player as an integer, or null if the level cannot be determined. + /// This value is also assigned to within the provided profile. + /// public int? CalculateLevel(PmcData pmcData) { var accExp = 0; diff --git a/Libraries/SPTarkov.Server.Core/Services/PmcChatResponseService.cs b/Libraries/SPTarkov.Server.Core/Services/PmcChatResponseService.cs index fbffde4d..24f4b364 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PmcChatResponseService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PmcChatResponseService.cs @@ -1,4 +1,5 @@ using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -30,7 +30,7 @@ public class PmcChatResponseService( protected PmcChatResponse _pmcResponsesConfig = _configServer.GetConfig(); /// - /// For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative + /// For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative /// /// Session ID /// List of bots killed by player @@ -66,7 +66,7 @@ public class PmcChatResponseService( } /// - /// Not fully implemented yet, needs method of acquiring killers details after raid + /// Not fully implemented yet, needs method of acquiring killers details after raid /// /// Session id /// Players profile @@ -129,7 +129,7 @@ public class PmcChatResponseService( } /// - /// Choose a localised message to send the player (different if sender was killed or killed player) + /// Choose a localised message to send the player (different if sender was killed or killed player) /// /// Is the message coming from a bot killed by the player /// Player profile @@ -190,8 +190,8 @@ public class PmcChatResponseService( } /// - /// use map key to get a localised location name - /// e.g. factory4_day becomes "Factory" + /// use map key to get a localised location name + /// e.g. factory4_day becomes "Factory" /// /// Location key to localise /// Localised location name @@ -201,7 +201,7 @@ public class PmcChatResponseService( } /// - /// Should capitalisation be stripped from the message response before sending + /// Should capitalisation be stripped from the message response before sending /// /// Was responder a victim of player /// True = should be stripped @@ -215,7 +215,7 @@ public class PmcChatResponseService( } /// - /// Should capitalisation be stripped from the message response before sending + /// Should capitalisation be stripped from the message response before sending /// /// Was responder a victim of player /// True = should be stripped @@ -229,7 +229,7 @@ public class PmcChatResponseService( } /// - /// Should a suffix be appended to the end of the message being sent to player + /// Should a suffix be appended to the end of the message being sent to player /// /// Was responder a victim of player /// True = should be appended @@ -243,7 +243,7 @@ public class PmcChatResponseService( } /// - /// Choose a type of response based on the weightings in pmc response config + /// Choose a type of response based on the weightings in pmc response config /// /// Was responder killed by player /// Response type (positive/negative) @@ -257,7 +257,7 @@ public class PmcChatResponseService( } /// - /// Get locale keys related to the type of response to send (victim/killer) + /// Get locale keys related to the type of response to send (victim/killer) /// /// Positive/negative /// Was responder killed by player @@ -271,7 +271,7 @@ public class PmcChatResponseService( } /// - /// Get all locale keys that start with `pmcresponse-suffix` + /// Get all locale keys that start with `pmcresponse-suffix` /// /// List of keys protected List GetResponseSuffixLocaleKeys() @@ -282,7 +282,7 @@ public class PmcChatResponseService( } /// - /// Randomly draw a victim of the list and return their details + /// Randomly draw a victim of the list and return their details /// /// Possible victims to choose from /// UserDialogInfo object @@ -295,7 +295,7 @@ public class PmcChatResponseService( } /// - /// Convert a victim object into a IUserDialogInfo object + /// Convert a victim object into a IUserDialogInfo object /// /// Victim to convert /// UserDialogInfo object diff --git a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs index cb5c93f6..4b601303 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -29,8 +29,8 @@ public class PostDbLoadService( protected ItemConfig _itemConfig = _configServer.GetConfig(); protected LocationConfig _locationConfig = _configServer.GetConfig(); protected LootConfig _lootConfig = _configServer.GetConfig(); - protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); protected PmcConfig _pmcConfig = _configServer.GetConfig(); + protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); public void PerformPostDbLoadActions() { @@ -143,13 +143,14 @@ public class PostDbLoadService( } /// - /// Merge custom achievements into achievement db table + /// Merge custom achievements into achievement db table /// protected void MergeCustomAchievements() { var achievements = _databaseService.GetAchievements(); - foreach (var customAchievement in _databaseService.GetCustomAchievements()) { - if (achievements.Exists((a) => a.Id == customAchievement.Id)) + foreach (var customAchievement in _databaseService.GetCustomAchievements()) + { + if (achievements.Exists(a => a.Id == customAchievement.Id)) { _logger.Warning($"Unable to add custom achievement as id: {customAchievement.Id} already exists"); continue; @@ -256,8 +257,7 @@ public class PostDbLoadService( foreach (var positionToAdd in positionsToAdd) { // Exists already, add new items to existing positions pool - var existingLootPosition = mapLooseLoot.Spawnpoints.FirstOrDefault( - x => x.Template.Id == positionToAdd.Template.Id + var existingLootPosition = mapLooseLoot.Spawnpoints.FirstOrDefault(x => x.Template.Id == positionToAdd.Template.Id ); if (existingLootPosition is not null) @@ -298,7 +298,11 @@ public class PostDbLoadService( { var locations = _databaseService.GetLocations().GetDictionary(); - var pmcTypes = new HashSet { "pmcUSEC", "pmcBEAR" }; + var pmcTypes = new HashSet + { + "pmcUSEC", + "pmcBEAR" + }; foreach (var locationkvP in locations) { if (locationkvP.Value?.Base?.BossLocationSpawn is null) @@ -306,13 +310,13 @@ public class PostDbLoadService( continue; } - locationkvP.Value.Base.BossLocationSpawn = locationkvP.Value.Base.BossLocationSpawn.Where( - (bossSpawn) => !pmcTypes.Contains(bossSpawn.BossName)).ToList(); + locationkvP.Value.Base.BossLocationSpawn = + locationkvP.Value.Base.BossLocationSpawn.Where(bossSpawn => !pmcTypes.Contains(bossSpawn.BossName)).ToList(); } } /// - /// Apply custom limits on bot types as defined in configs/location.json/botTypeLimits + /// Apply custom limits on bot types as defined in configs/location.json/botTypeLimits /// protected void AdjustMapBotLimits() { @@ -379,8 +383,7 @@ public class PostDbLoadService( foreach (var (lootKey, newChanceValue) in mapAdjustments) { - var lootPostionToAdjust = mapLooseLootData.Spawnpoints.FirstOrDefault( - spawnPoint => spawnPoint.Template.Id == lootKey + var lootPostionToAdjust = mapLooseLootData.Spawnpoints.FirstOrDefault(spawnPoint => spawnPoint.Template.Id == lootKey ); if (lootPostionToAdjust is null) { @@ -425,7 +428,7 @@ public class PostDbLoadService( } /// - /// Make Rogues spawn later to allow for scavs to spawn first instead of rogues filling up all spawn positions + /// Make Rogues spawn later to allow for scavs to spawn first instead of rogues filling up all spawn positions /// protected void FixRoguesSpawningInstantlyOnLighthouse() { @@ -447,15 +450,14 @@ public class PostDbLoadService( } /// - /// Make non-trigger-spawned raiders spawn earlier + always + /// Make non-trigger-spawned raiders spawn earlier + always /// protected void AdjustLabsRaiderSpawnRate() { var labsBase = _databaseService.GetLocations().Laboratory.Base; // Find spawns with empty string for triggerId/TriggerName - var nonTriggerLabsBossSpawns = labsBase.BossLocationSpawn.Where( - bossSpawn => bossSpawn.TriggerId is null && bossSpawn.TriggerName is null + var nonTriggerLabsBossSpawns = labsBase.BossLocationSpawn.Where(bossSpawn => bossSpawn.TriggerId is null && bossSpawn.TriggerName is null ); foreach (var boss in nonTriggerLabsBossSpawns) @@ -480,7 +482,7 @@ public class PostDbLoadService( } /// - /// Adjust all hideout craft times to be no higher than the override + /// Adjust all hideout craft times to be no higher than the override /// /// Time in seconds protected void AdjustHideoutBuildTimes(int overrideSeconds) @@ -518,7 +520,7 @@ public class PostDbLoadService( } /// - /// Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json + /// Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json /// protected void ValidateQuestAssortUnlocksExist() { @@ -563,10 +565,9 @@ public class PostDbLoadService( protected void SetAllDbItemsAsSellableOnFlea() { var dbItems = _databaseService.GetItems().Values.ToList(); - foreach (var item in dbItems.Where( - item => string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase) && - !item.Properties.CanSellOnRagfair.GetValueOrDefault(false) && - !_ragfairConfig.Dynamic.Blacklist.Custom.Contains(item.Id) + foreach (var item in dbItems.Where(item => string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase) && + !item.Properties.CanSellOnRagfair.GetValueOrDefault(false) && + !_ragfairConfig.Dynamic.Blacklist.Custom.Contains(item.Id) )) { item.Properties.CanSellOnRagfair = true; diff --git a/Libraries/SPTarkov.Server.Core/Services/ProfileActivityService.cs b/Libraries/SPTarkov.Server.Core/Services/ProfileActivityService.cs index 0073e4d3..c92238a8 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ProfileActivityService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ProfileActivityService.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Services; @@ -11,7 +11,7 @@ public class ProfileActivityService( private readonly Dictionary profileActivityTimestamps = new(); /// - /// Was the requested profile active in the last requested minutes + /// Was the requested profile active in the last requested minutes /// /// Profile to check /// Minutes to check for activity in @@ -28,7 +28,7 @@ public class ProfileActivityService( } /// - /// Get a list of profile ids that were active in the last x minutes + /// Get a list of profile ids that were active in the last x minutes /// /// How many minutes from now to search for profiles /// List of profile ids @@ -56,7 +56,7 @@ public class ProfileActivityService( } /// - /// Update the timestamp a profile was last observed active + /// Update the timestamp a profile was last observed active /// /// Profile to update public void SetActivityTimestamp(string sessionId) diff --git a/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs b/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs index 21aae322..63a94019 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs @@ -1,4 +1,5 @@ using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -246,14 +246,11 @@ public class ProfileFixerService( { if (pmcProfile.RepeatableQuests is not null && activeRepeatableQuests.Count > 0) { - var existsInActiveRepeatableQuests = activeRepeatableQuests.Any( - quest => quest.Id == TaskConditionCounterKvP.Value.SourceId + var existsInActiveRepeatableQuests = activeRepeatableQuests.Any(quest => quest.Id == TaskConditionCounterKvP.Value.SourceId ); - var existsInQuests = pmcProfile.Quests.Any( - quest => quest.QId == TaskConditionCounterKvP.Value.SourceId + var existsInQuests = pmcProfile.Quests.Any(quest => quest.QId == TaskConditionCounterKvP.Value.SourceId ); - var isAchievementTracker = achievements.Any( - quest => quest.Id == TaskConditionCounterKvP.Value.SourceId + var isAchievementTracker = achievements.Any(quest => quest.Id == TaskConditionCounterKvP.Value.SourceId ); // If task conditions id is neither in activeQuests, quests or achievements - it's stale and should be cleaned up @@ -328,8 +325,7 @@ public class ProfileFixerService( // For started or successful quests, check for unlocks in the `Started` rewards if (profileQuest.Status is QuestStatusEnum.Started or QuestStatusEnum.Success) { - var productionRewards = quest.Rewards.Started?.Where( - reward => reward.Type == RewardType.ProductionScheme + var productionRewards = quest.Rewards.Started?.Where(reward => reward.Type == RewardType.ProductionScheme ); if (productionRewards is not null) @@ -344,8 +340,7 @@ public class ProfileFixerService( // For successful quests, check for unlocks in the `Success` rewards if (profileQuest.Status is QuestStatusEnum.Success) { - var productionRewards = quest.Rewards.Success?.Where( - reward => reward.Type == RewardType.ProductionScheme + var productionRewards = quest.Rewards.Success?.Where(reward => reward.Type == RewardType.ProductionScheme ); if (productionRewards is not null) @@ -402,12 +397,12 @@ public class ProfileFixerService( } /// - /// Remove any entries from `pmcProfile.InsuredItems` that do not have a corresponding - /// `pmcProfile.Inventory.items` entry + /// Remove any entries from `pmcProfile.InsuredItems` that do not have a corresponding + /// `pmcProfile.Inventory.items` entry /// /// PMC Profile to fix - protected void FixOrphanedInsurance(PmcData pmcProfile) { - + protected void FixOrphanedInsurance(PmcData pmcProfile) + { // Check if the player inventory contains this item pmcProfile.InsuredItems = pmcProfile.InsuredItems .Where(insuredItem => pmcProfile.Inventory.Items.Any(item => item.Id == insuredItem.ItemId)) @@ -527,7 +522,7 @@ public class ProfileFixerService( } /// - /// Check for and cap profile skills at 5100. + /// Check for and cap profile skills at 5100. /// /// Profile to check and fix protected void CheckForSkillsOverMaxLevel(PmcData pmcProfile) @@ -541,7 +536,7 @@ public class ProfileFixerService( } /// - /// Checks profile inventory for items that do not exist inside the items DB + /// Checks profile inventory for items that do not exist inside the items DB /// /// Session ID /// Profile to check inventory of @@ -578,8 +573,7 @@ public class ProfileFixerService( // Remove invalid builds from weapon, equipment and magazine build lists var weaponBuilds = fullProfile.UserBuildData?.WeaponBuilds ?? new List(); fullProfile.UserBuildData.WeaponBuilds = - weaponBuilds.Where( - build => + weaponBuilds.Where(build => { return !ShouldRemoveWeaponEquipmentBuild("weapon", build, itemsDb); } @@ -588,8 +582,7 @@ public class ProfileFixerService( var equipmentBuilds = fullProfile.UserBuildData.EquipmentBuilds ?? new List(); fullProfile.UserBuildData.EquipmentBuilds = - equipmentBuilds.Where( - build => + equipmentBuilds.Where(build => { return !ShouldRemoveWeaponEquipmentBuild("equipment", build, itemsDb); } @@ -597,8 +590,7 @@ public class ProfileFixerService( .ToList(); var magazineBuild = fullProfile.UserBuildData.MagazineBuilds ?? new List(); - fullProfile.UserBuildData.MagazineBuilds = magazineBuild.Where( - build => + fullProfile.UserBuildData.MagazineBuilds = magazineBuild.Where(build => { return !ShouldRemoveMagazineBuild(build, itemsDb); } @@ -721,7 +713,7 @@ public class ProfileFixerService( } /// - /// Check whether a weapon build should be removed from the equipment list. + /// Check whether a weapon build should be removed from the equipment list. /// /// The type of build, used for logging only /// The build to check for invalid items @@ -775,7 +767,7 @@ public class ProfileFixerService( } /// - /// Checks whether magazine build shou8ld be removed form the build list. + /// Checks whether magazine build shou8ld be removed form the build list. /// /// The magazine build to check for validity /// The items database to use for item lookup @@ -812,8 +804,8 @@ public class ProfileFixerService( } /// - /// REQUIRED for dev profiles
- /// Iterate over players hideout areas and find what's built, look for missing bonuses those areas give and add them if missing + /// REQUIRED for dev profiles
+ /// Iterate over players hideout areas and find what's built, look for missing bonuses those areas give and add them if missing ///
/// Profile to update public void AddMissingHideoutBonusesToProfile(PmcData pmcProfile) @@ -872,7 +864,7 @@ public class ProfileFixerService( } /// - /// Finds a bonus in a profile + /// Finds a bonus in a profile /// /// Bonuses from profile /// Bonus to find @@ -887,11 +879,10 @@ public class ProfileFixerService( return bonus.Type switch { - BonusType.StashSize => profileBonuses?.FirstOrDefault( - x => x.Type == bonus.Type && x.TemplateId == bonus.TemplateId + BonusType.StashSize => profileBonuses?.FirstOrDefault(x => x.Type == bonus.Type && x.TemplateId == bonus.TemplateId ), - BonusType.AdditionalSlots => profileBonuses?.FirstOrDefault( - x => x.Type == bonus.Type && x?.Value == bonus?.Value && x?.IsVisible == bonus?.IsVisible + BonusType.AdditionalSlots => profileBonuses?.FirstOrDefault(x => + x.Type == bonus.Type && x?.Value == bonus?.Value && x?.IsVisible == bonus?.IsVisible ), _ => profileBonuses?.FirstOrDefault(x => x.Type == bonus.Type && x.Value == bonus.Value) }; diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairCategoriesService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairCategoriesService.cs index 82640ce2..d23b0a41 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairCategoriesService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairCategoriesService.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -26,8 +26,7 @@ public class RagfairCategoriesService( { // Get offers valid for search request, then reduce them down to just the counts return offers - .Where( - offer => + .Where(offer => { var isTraderOffer = offer.User.MemberType == MemberCategory.Trader; diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairLinkedItemService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairLinkedItemService.cs index 2eba3de8..d4aa6dea 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairLinkedItemService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairLinkedItemService.cs @@ -1,8 +1,8 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -28,7 +28,7 @@ public class RagfairLinkedItemService( } /// - /// Use ragfair linked item service to get an list of items that can fit on or in designated itemtpl + /// Use ragfair linked item service to get an list of items that can fit on or in designated itemtpl /// /// Item to get sub-items for /// TemplateItem list @@ -55,7 +55,7 @@ public class RagfairLinkedItemService( } /// - /// Create Dictionary of every item and the items associated with it + /// Create Dictionary of every item and the items associated with it /// protected void BuildLinkedItemTable() { @@ -93,7 +93,7 @@ public class RagfairLinkedItemService( } /// - /// Add ammo to revolvers linked item dictionary + /// Add ammo to revolvers linked item dictionary /// /// Revolvers cylinder /// Set to add to diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs index 56aade59..a865b4ad 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Ragfair; @@ -6,8 +8,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Services; @@ -31,7 +31,7 @@ public class RagfairOfferService( protected RagfairConfig _ragfairConfig = configServer.GetConfig(); /// - /// Get all offers + /// Get all offers /// /// List of RagfairOffers public List GetOffers() @@ -55,7 +55,7 @@ public class RagfairOfferService( } /// - /// Does the offer exist on the ragfair + /// Does the offer exist on the ragfair /// /// Offer id to check for /// True when offer exists @@ -65,7 +65,7 @@ public class RagfairOfferService( } /// - /// Remove an offer from ragfair by offer id + /// Remove an offer from ragfair by offer id /// /// Offer id to remove public void RemoveOfferById(string offerId) @@ -74,7 +74,7 @@ public class RagfairOfferService( } /// - /// Reduce size of an offer stack by specified amount + /// Reduce size of an offer stack by specified amount /// /// Offer to adjust stack size of /// How much to deduct from offers stack size @@ -100,7 +100,7 @@ public class RagfairOfferService( } /// - /// Do the trader offers on flea need to be refreshed + /// Do the trader offers on flea need to be refreshed /// /// Trader to check /// True if they do @@ -143,7 +143,7 @@ public class RagfairOfferService( } /// - /// Process the expired ids and remove offers + /// Process the expired ids and remove offers /// public void RemoveExpiredOffers() { @@ -154,7 +154,7 @@ public class RagfairOfferService( } /// - /// Remove stale offer from flea + /// Remove stale offer from flea /// /// Stale offer to process protected void ProcessStaleOffer(RagfairOffer staleOffer) @@ -243,9 +243,9 @@ public class RagfairOfferService( } /// - /// Flea offer items are stacked up often beyond the StackMaxSize limit. - /// Unstack the items into an array of root items and their children. - /// Will create new items equal to the stack. + /// Flea offer items are stacked up often beyond the StackMaxSize limit. + /// Unstack the items into an array of root items and their children. + /// Will create new items equal to the stack. /// /// Offer items to unstack /// Unstacked array of items diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs index d6bf5026..8634f9b0 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -7,13 +8,12 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; /// -/// Stores flea prices for items as well as methods to interact with them. +/// Stores flea prices for items as well as methods to interact with them. /// [Injectable(InjectionType.Singleton)] public class RagfairPriceService( @@ -116,7 +116,7 @@ public class RagfairPriceService( } /// - /// Get the dynamic (flea) price for an item + /// Get the dynamic (flea) price for an item /// /// Item template id to look up /// Price in roubles @@ -445,9 +445,8 @@ public class RagfairPriceService( if (newOrReplacedModsInPresetVsDefault.Any()) { // Add up cost of mods replaced - var modsReplacedByNewMods = newOrReplacedModsInPresetVsDefault.Where( - x => - presetResult.Preset.Items.Any(y => y.SlotId == x.SlotId) + var modsReplacedByNewMods = newOrReplacedModsInPresetVsDefault.Where(x => + presetResult.Preset.Items.Any(y => y.SlotId == x.SlotId) ); // Add up replaced mods price diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairRequiredItemsService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairRequiredItemsService.cs index 94b59881..2a19400b 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairRequiredItemsService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairRequiredItemsService.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Ragfair; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs index bb5adb04..dd7dfaec 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -5,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Ragfair; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils.Cloners; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Services; @@ -38,8 +38,8 @@ public class RagfairTaxService( } /// - /// This method, along with CalculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". - /// It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. + /// This method, along with CalculateItemWorth, is trying to mirror the client-side code found in the method "CalculateTaxPrice". + /// It's structured to resemble the client-side code as closely as possible - avoid making any big structure changes if it's not necessary. /// /// Item being sold on flea /// Player profile @@ -128,8 +128,8 @@ public class RagfairTaxService( } /// - /// This method is trying to replicate the item worth calculation method found in the client code. - /// Any inefficiencies or style issues are intentional and should not be fixed, to preserve the client-side code mirroring. + /// This method is trying to replicate the item worth calculation method found in the client code. + /// Any inefficiencies or style issues are intentional and should not be fixed, to preserve the client-side code mirroring. /// /// /// diff --git a/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs b/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs index 9b4239a7..2e847d4a 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -8,7 +9,6 @@ using SPTarkov.Server.Core.Models.Spt.Location; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -44,6 +44,7 @@ public class RaidTimeAdjustmentService( { AdjustLootMultipliers(_locationConfig.LooseLootMultiplier, raidAdjustments.DynamicLootPercent); } + if (raidAdjustments.StaticLootPercent < 100) { AdjustLootMultipliers(_locationConfig.StaticLootMultiplier, raidAdjustments.StaticLootPercent); @@ -58,7 +59,7 @@ public class RaidTimeAdjustmentService( var exitToChange = mapBase.Exits.FirstOrDefault(exit => exit.Name == exitChange.Name); if (exitToChange is null) { - _logger.Debug($"Exit with Id: { exitChange.Name} not found, skipping"); + _logger.Debug($"Exit with Id: {exitChange.Name} not found, skipping"); return; } diff --git a/Libraries/SPTarkov.Server.Core/Services/RaidWeatherService.cs b/Libraries/SPTarkov.Server.Core/Services/RaidWeatherService.cs index 9d8c5805..9991609b 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RaidWeatherService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RaidWeatherService.cs @@ -1,11 +1,11 @@ -using SPTarkov.Server.Core.Generators; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Weather; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; diff --git a/Libraries/SPTarkov.Server.Core/Services/RepairService.cs b/Libraries/SPTarkov.Server.Core/Services/RepairService.cs index a67adafa..45c16507 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RepairService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RepairService.cs @@ -1,4 +1,6 @@ using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; @@ -11,8 +13,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using BonusSettings = SPTarkov.Server.Core.Models.Spt.Config.BonusSettings; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; diff --git a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs index 2a18365d..28fa04a5 100644 --- a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -6,8 +8,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; namespace SPTarkov.Server.Core.Services; @@ -57,6 +57,10 @@ public class SeasonalEventService( ]; private List _currentlyActiveEvents = []; + + protected HashSet _equipmentSlotsToFilter = + [EquipmentSlots.FaceCover, EquipmentSlots.Headwear, EquipmentSlots.Backpack, EquipmentSlots.TacticalVest]; + private bool _halloweenEventActive; protected HashSet _halloweenEventItems = @@ -76,13 +80,11 @@ public class SeasonalEventService( protected HttpConfig _httpConfig = _configServer.GetConfig(); protected LocationConfig _locationConfig = _configServer.GetConfig(); + protected HashSet _lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"]; protected QuestConfig _questConfig = _configServer.GetConfig(); protected SeasonalEventConfig _seasonalEventConfig = _configServer.GetConfig(); protected WeatherConfig _weatherConfig = _configServer.GetConfig(); - protected HashSet _equipmentSlotsToFilter = [EquipmentSlots.FaceCover, EquipmentSlots.Headwear, EquipmentSlots.Backpack, EquipmentSlots.TacticalVest]; - protected HashSet _lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"]; - /// /// Get an array of christmas items found in bots inventories as loot /// @@ -437,14 +439,16 @@ public class SeasonalEventService( EnableHalloweenSummonEvent(); AddPumpkinsToScavBackpacks(); RenameBitcoin(); - if (eventType.Settings is not null && eventType.Settings.ReplaceBotHostility.GetValueOrDefault(false)) { + if (eventType.Settings is not null && eventType.Settings.ReplaceBotHostility.GetValueOrDefault(false)) + { if (_seasonalEventConfig.HostilitySettingsForEvent.TryGetValue("AprilFools", out var botData)) { ReplaceBotHostility(botData); } } - if (eventType.Settings?.ForceSeason != null) { + if (eventType.Settings?.ForceSeason != null) + { _weatherConfig.OverrideSeason = eventType.Settings.ForceSeason; } @@ -612,7 +616,8 @@ public class SeasonalEventService( } } - foreach (var settings in newHostilitySettings) { + foreach (var settings in newHostilitySettings) + { var matchingBaseSettings = location.Base.BotLocationModifier.AdditionalHostilitySettings.FirstOrDefault(x => x.BotRole == settings.BotRole); if (matchingBaseSettings is null) { @@ -790,8 +795,7 @@ public class SeasonalEventService( var result = new HashSet(); // Get only the locations with an infection above 0 - var infectionKeys = locationInfections.Where( - location => locationInfections[location.Key] > 0 + var infectionKeys = locationInfections.Where(location => locationInfections[location.Key] > 0 ); // Convert the infected location id into its generic location id diff --git a/Libraries/SPTarkov.Server.Core/Services/TraderPurchasePersisterService.cs b/Libraries/SPTarkov.Server.Core/Services/TraderPurchasePersisterService.cs index cf97cf3e..2e4c12e2 100644 --- a/Libraries/SPTarkov.Server.Core/Services/TraderPurchasePersisterService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/TraderPurchasePersisterService.cs @@ -1,10 +1,10 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Services; @@ -21,7 +21,7 @@ public class TraderPurchasePersisterService( protected TraderConfig _traderConfig = _configServer.GetConfig(); /// - /// Get the purchases made from a trader for this profile before the last trader reset + /// Get the purchases made from a trader for this profile before the last trader reset /// /// Session id /// Trader to loop up purchases for @@ -44,7 +44,7 @@ public class TraderPurchasePersisterService( } /// - /// Get a purchase made from a trader for requested profile before the last trader reset + /// Get a purchase made from a trader for requested profile before the last trader reset /// /// Session ID /// Trader to loop up purchases for @@ -78,7 +78,7 @@ public class TraderPurchasePersisterService( } /// - /// Remove all trader purchase records from all profiles that exist + /// Remove all trader purchase records from all profiles that exist /// /// Traders ID public void ResetTraderPurchasesStoredInProfile(string traderId) @@ -106,7 +106,7 @@ public class TraderPurchasePersisterService( } /// - /// Iterate over all server profiles and remove specific trader purchase data that has passed the trader refresh time + /// Iterate over all server profiles and remove specific trader purchase data that has passed the trader refresh time /// /// Trader ID public void RemoveStalePurchasesFromProfiles(string traderId) diff --git a/Libraries/SPTarkov.Server.Core/Utils/App.cs b/Libraries/SPTarkov.Server.Core/Utils/App.cs index 94a3d326..5e39f81e 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/App.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/App.cs @@ -1,10 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Server; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Utils; diff --git a/Libraries/SPTarkov.Server.Core/Utils/Callbacks/TimeoutCallback.cs b/Libraries/SPTarkov.Server.Core/Utils/Callbacks/TimeoutCallback.cs index 7d92de93..8c09e45a 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Callbacks/TimeoutCallback.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Callbacks/TimeoutCallback.cs @@ -4,8 +4,7 @@ public static class TimeoutCallback { public static Task RunInTimespan(Action action, TimeSpan timeSpan) { - return Task.Factory.StartNew( - () => + return Task.Factory.StartNew(() => { Thread.Sleep(timeSpan); action(); diff --git a/Libraries/SPTarkov.Server.Core/Utils/Cloners/JsonCloner.cs b/Libraries/SPTarkov.Server.Core/Utils/Cloners/JsonCloner.cs index 3e82948e..629a99e7 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Cloners/JsonCloner.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Cloners/JsonCloner.cs @@ -1,7 +1,7 @@ namespace SPTarkov.Server.Core.Utils.Cloners; /// -/// Disabled as FastCloner library is 15% faster and consumes less memory than Json serialization +/// Disabled as FastCloner library is 15% faster and consumes less memory than Json serialization /// public class JsonCloner : ICloner { diff --git a/Libraries/SPTarkov.Server.Core/Utils/Cloners/ReflectionsCloner.cs b/Libraries/SPTarkov.Server.Core/Utils/Cloners/ReflectionsCloner.cs index e158e0a0..49691464 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Cloners/ReflectionsCloner.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Cloners/ReflectionsCloner.cs @@ -8,13 +8,16 @@ using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Utils.Cloners; /// -/// Not in use at the moment +/// Not in use at the moment /// /// public class ReflectionsCloner(ISptLogger logger) : ICloner { - private static Dictionary MemberInfoCache = new(); - private static Dictionary AddMethodInfoCache = new(); + private static readonly Dictionary MemberInfoCache = new(); + private static readonly Dictionary AddMethodInfoCache = new(); + + private static readonly ConcurrentDictionary _itemPropertyInfoCache = new(); + private static readonly ConcurrentDictionary _listPropertyInfoCache = new(); public T? Clone(T? obj) { @@ -68,7 +71,10 @@ public class ReflectionsCloner(ISptLogger logger) : ICloner if (!AddMethodInfoCache.TryGetValue(objectType, out var addMethodInfo)) { addMethodInfo = objectType.GetMethod("Add", BindingFlags.Instance | BindingFlags.Public); - while (!AddMethodInfoCache.TryAdd(objectType, addMethodInfo)) ; + while (!AddMethodInfoCache.TryAdd(objectType, addMethodInfo)) + { + ; + } } var toCloneEnumerable = (IEnumerable) obj; @@ -92,7 +98,10 @@ public class ReflectionsCloner(ISptLogger logger) : ICloner if (!MemberInfoCache.TryGetValue(objectType, out var memberInfos)) { memberInfos = objectType.GetMembers(BindingFlags.Public | BindingFlags.Instance); - while (!MemberInfoCache.TryAdd(objectType, memberInfos)) ; + while (!MemberInfoCache.TryAdd(objectType, memberInfos)) + { + ; + } } foreach (var member in memberInfos) @@ -138,15 +147,14 @@ public class ReflectionsCloner(ISptLogger logger) : ICloner else { if (logger.IsLogEnabled(LogLevel.Debug)) + { logger.Debug($"Clone of type {objectType} is not supported"); + } } return result; } - private static ConcurrentDictionary _itemPropertyInfoCache = new(); - private static ConcurrentDictionary _listPropertyInfoCache = new(); - private async Task HandleSpecialClones(object obj, Type objectType) { if (objectType.IsGenericType && objectType.GetGenericTypeDefinition() == typeof(ListOrT<>)) @@ -156,13 +164,19 @@ public class ReflectionsCloner(ISptLogger logger) : ICloner if (!_itemPropertyInfoCache.TryGetValue(type, out var item)) { item = objectType.GetProperty("Item", BindingFlags.Public | BindingFlags.Instance); - while (!_itemPropertyInfoCache.TryAdd(type, item)) ; + while (!_itemPropertyInfoCache.TryAdd(type, item)) + { + ; + } } if (!_listPropertyInfoCache.TryGetValue(type, out var list)) { list = objectType.GetProperty("List", BindingFlags.Public | BindingFlags.Instance); - while (!_listPropertyInfoCache.TryAdd(type, list)) ; + while (!_listPropertyInfoCache.TryAdd(type, list)) + { + ; + } } item.GetSetMethod(true).Invoke(clone, [await Clone(item.GetValue(obj), item.PropertyType)]); diff --git a/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs b/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs index b9387000..6372c294 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs @@ -122,11 +122,11 @@ public class ProbabilityObjectArray : List> /** * Get the maximum relative probability out of a ProbabilityObjectArray - * + * * Example: * po = new ProbabilityObjectArray(new ProbabilityObject("a", 5), new ProbabilityObject("b", 1)) * po.maxProbability() // returns 5 - * + * * @return {number} the maximum value of all relative probabilities in this ProbabilityObjectArray */ public double MaxProbability() diff --git a/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs b/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs index ac52d55c..3c20419b 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Config; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Routers; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Utils; @@ -168,14 +168,12 @@ public class DatabaseImporter : IOnLoad var validation = valid == ValidationResult.FAILED || valid == ValidationResult.NOT_FOUND ? "." : ""; _logger.Info($"{_localisationService.GetText("importing_database_finish")}{validation}"); - this._logger.Debug($"Database import took {timer.ElapsedMilliseconds}ms"); + _logger.Debug($"Database import took {timer.ElapsedMilliseconds}ms"); _databaseServer.SetTables(dataToImport); } protected void OnReadValidate(string fileWithPath) { - - // Validate files //if (ProgramStatics.COMPILED && hashedFile && !ValidateFile(fileWithPath, data)) { // this.valid = ValidationResult.FAILED; diff --git a/Libraries/SPTarkov.Server.Core/Utils/FileUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/FileUtil.cs index 938de3c6..d2c78772 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/FileUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/FileUtil.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Utils; namespace SPTarkov.Server.Core.Utils; diff --git a/Libraries/SPTarkov.Server.Core/Utils/HashUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/HashUtil.cs index 7340a019..f94a5734 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/HashUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/HashUtil.cs @@ -10,7 +10,7 @@ namespace SPTarkov.Server.Core.Utils; public partial class HashUtil(RandomUtil _randomUtil) { /// - /// Create a 24 character MongoId + /// Create a 24 character MongoId /// /// 24 character objectId public string Generate() diff --git a/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs index d2c5b314..5442c515 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/HttpFileUtil.cs @@ -1,5 +1,5 @@ -using SPTarkov.Server.Core.Helpers; using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Helpers; namespace SPTarkov.Server.Core.Utils; diff --git a/Libraries/SPTarkov.Server.Core/Utils/HttpResponseUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/HttpResponseUtil.cs index 63e0e11c..a5b27754 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/HttpResponseUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/HttpResponseUtil.cs @@ -1,10 +1,10 @@ using System.Collections.Immutable; using System.Text.RegularExpressions; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Eft.HttpResponse; using SPTarkov.Server.Core.Models.Eft.ItemEvent; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Utils; diff --git a/Libraries/SPTarkov.Server.Core/Utils/ImporterUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/ImporterUtil.cs index a8faeb11..7f868504 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/ImporterUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/ImporterUtil.cs @@ -1,15 +1,16 @@ using System.Collections.Concurrent; using System.Linq.Expressions; using System.Reflection; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils.Json; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Utils; [Injectable(InjectionType.Singleton)] public class ImporterUtil { + protected readonly ConcurrentDictionary lazyLoadDeserializationCache = []; protected FileUtil _fileUtil; protected JsonUtil _jsonUtil; protected ISptLogger _logger; @@ -17,8 +18,6 @@ public class ImporterUtil protected HashSet filesToIgnore = ["bearsuits.json", "usecsuits.json", "archivedquests.json"]; - protected readonly ConcurrentDictionary lazyLoadDeserializationCache = []; - public ImporterUtil(ISptLogger logger, FileUtil fileUtil, JsonUtil jsonUtil) { _logger = logger; @@ -37,7 +36,7 @@ public class ImporterUtil } /// - /// Load files into objects recursively (asynchronous) + /// Load files into objects recursively (asynchronous) /// /// Path to folder with files /// @@ -120,7 +119,7 @@ public class ImporterUtil result, isDictionary ? [_fileUtil.StripExtension(file), fileDeserialized] - : new object[] { fileDeserialized } + : new[] { fileDeserialized } ); } } @@ -151,7 +150,7 @@ public class ImporterUtil lock (dictionaryLock) { - setMethod.Invoke(result, isDictionary ? [directory, loadedData] : new object[] { loadedData }); + setMethod.Invoke(result, isDictionary ? [directory, loadedData] : new[] { loadedData }); } } catch (Exception ex) @@ -175,12 +174,12 @@ public class ImporterUtil var genericArgument = propertyType.GetGenericArguments()[0]; var deserializeCall = Expression.Call( - Expression.Constant(_jsonUtil), - "DeserializeFromFile", - Type.EmptyTypes, - Expression.Constant(file), - Expression.Constant(genericArgument) - ); + Expression.Constant(_jsonUtil), + "DeserializeFromFile", + Type.EmptyTypes, + Expression.Constant(file), + Expression.Constant(genericArgument) + ); var typeAsExpression = Expression.TypeAs(deserializeCall, genericArgument); @@ -208,13 +207,12 @@ public class ImporterUtil else { var matchedProperty = type.GetProperties() - .FirstOrDefault( - prop => - string.Equals( - prop.Name.ToLower(), - _fileUtil.StripExtension(propertyName).ToLower(), - StringComparison.Ordinal - ) + .FirstOrDefault(prop => + string.Equals( + prop.Name.ToLower(), + _fileUtil.StripExtension(propertyName).ToLower(), + StringComparison.Ordinal + ) ); if (matchedProperty == null) diff --git a/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs index 1c68ef02..0ff79460 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs @@ -1,15 +1,15 @@ using System.Text.Encodings.Web; using System.Text.Json; using System.Text.Json.Serialization; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Ws; using SPTarkov.Server.Core.Models.Enums; +using SPTarkov.Server.Core.Models.Logging; using SPTarkov.Server.Core.Models.Spt.Dialog; using SPTarkov.Server.Core.Utils.Json.Converters; -using SPTarkov.Common.Annotations; -using SPTarkov.Server.Core.Models.Eft.Common; -using SPTarkov.Server.Core.Models.Logging; +using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Utils; @@ -55,7 +55,7 @@ public class JsonUtil new EftEnumConverter(), new EftEnumConverter(), - new EftEnumConverter(), + new EftEnumConverter(), new EftEnumConverter(), new EftEnumConverter(), diff --git a/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs b/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs index cbb02968..73ab1588 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.cs @@ -10,7 +10,7 @@ public static partial class ProgramStatics public static void Initialize() { - var _entryType = ProgramStatics.BuildType ?? EntryType.LOCAL; + var _entryType = BuildType ?? EntryType.LOCAL; switch (_entryType) { diff --git a/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs b/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs index 47c0ff3c..8f683905 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs @@ -1,4 +1,5 @@ using System.Collections.Concurrent; +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Ragfair; @@ -6,8 +7,6 @@ using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Common.Annotations; -using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Utils; @@ -21,17 +20,17 @@ public class RagfairOfferHolder( ConfigServer _configServer ) { + protected readonly Lock _expiredOfferIdsLock = new(); + protected readonly Lock _ragfairOperationLock = new(); + + protected HashSet _expiredOfferIds = []; protected int _maxOffersPerTemplate = _configServer.GetConfig().Dynamic.OfferItemCount.Max; protected ConcurrentDictionary _offersById = new(); protected ConcurrentDictionary> _offersByTemplate = new(); // key = tplId, value = list of offerIds protected ConcurrentDictionary> _offersByTrader = new(); // key = traderId, value = list of offerIds - protected HashSet _expiredOfferIds = []; - protected readonly Lock _expiredOfferIdsLock = new Lock(); - protected readonly Lock _ragfairOperationLock = new Lock(); - /// - /// Get a ragfair offer by its id + /// Get a ragfair offer by its id /// /// Ragfair offer id /// RagfairOffer @@ -41,7 +40,7 @@ public class RagfairOfferHolder( } /// - /// Get ragfair offers that match the passed in tpl + /// Get ragfair offers that match the passed in tpl /// /// Tpl to get offers for /// RagfairOffer list @@ -62,7 +61,7 @@ public class RagfairOfferHolder( } /// - /// Get all offers being sold by a trader + /// Get all offers being sold by a trader /// /// Id of trader to get offers for /// RagfairOffer list @@ -80,7 +79,7 @@ public class RagfairOfferHolder( } /// - /// Get all ragfair offers + /// Get all ragfair offers /// /// RagfairOffer list public List GetOffers() @@ -94,7 +93,7 @@ public class RagfairOfferHolder( } /// - /// Add a collection of offers to ragfair + /// Add a collection of offers to ragfair /// /// Offers to add public void AddOffers(List offers) @@ -106,7 +105,7 @@ public class RagfairOfferHolder( } /// - /// Add single offer to ragfair + /// Add single offer to ragfair /// /// Offer to add public void AddOffer(RagfairOffer offer) @@ -149,7 +148,7 @@ public class RagfairOfferHolder( } /// - /// Remove an offer from ragfair by id + /// Remove an offer from ragfair by id /// /// Offer id to remove /// OPTIONAL - Should trader offers be checked for offer id @@ -190,7 +189,7 @@ public class RagfairOfferHolder( } /// - /// Remove all offers a trader has + /// Remove all offers a trader has /// /// Trader id to remove offers from public void RemoveAllOffersByTrader(string traderId) @@ -211,7 +210,7 @@ public class RagfairOfferHolder( } /// - /// Add offer to offersByTemplate cache + /// Add offer to offersByTemplate cache /// /// Tpl to store offer against /// Offer to store against tpl @@ -230,7 +229,7 @@ public class RagfairOfferHolder( } /// - /// Cache an offer inside `offersByTrader` by trader id + /// Cache an offer inside `offersByTrader` by trader id /// /// Trader id to store offer against /// Offer to store against @@ -249,7 +248,7 @@ public class RagfairOfferHolder( } /// - /// Is the passed in offer stale - end time > passed in time + /// Is the passed in offer stale - end time > passed in time /// /// Offer to check /// Time to check offer against @@ -280,7 +279,7 @@ public class RagfairOfferHolder( } /// - /// Get total count of current expired offers + /// Get total count of current expired offers /// /// Number of expired offers public int GetExpiredOfferCount() @@ -292,7 +291,7 @@ public class RagfairOfferHolder( } /// - /// Get an array of arrays of expired offer items + children + /// Get an array of arrays of expired offer items + children /// /// Expired offer assorts public List> GetExpiredOfferItems() @@ -324,7 +323,7 @@ public class RagfairOfferHolder( } /// - /// Clear out internal expiredOffers dictionary of all items + /// Clear out internal expiredOffers dictionary of all items /// public void ResetExpiredOfferIds() { @@ -335,7 +334,7 @@ public class RagfairOfferHolder( } /// - /// Flag offers with an expiry before the passed in timestamp + /// Flag offers with an expiry before the passed in timestamp /// /// Timestamp at point offer is 'expired' public void FlagExpiredOffersAfterDate(long timestamp) @@ -362,7 +361,7 @@ public class RagfairOfferHolder( } /// - /// Remove all offers flagged as stale/expired + /// Remove all offers flagged as stale/expired /// public void RemoveExpiredOffers() { diff --git a/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs index c240308f..b4282db1 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs @@ -1,8 +1,7 @@ -using System; -using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Server.Core.Utils.Cloners; using SPTarkov.Common.Annotations; using SPTarkov.Common.Extensions; +using SPTarkov.Server.Core.Models.Utils; +using SPTarkov.Server.Core.Utils.Cloners; namespace SPTarkov.Server.Core.Utils; @@ -312,18 +311,18 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) /// A biased random number within the specified range. public double GetBiasedRandomNumber(double min, double max, double shift, double n) { - // This function generates a random number based on a gaussian distribution with an option to add a bias via shifting. + // This function generates a random number based on a gaussian distribution with an option to add a bias via shifting. - // Here's an example graph of how the probabilities can be distributed: - // https://www.boost.org/doc/libs/1_49_0/libs/math/doc/sf_and_dist/graphs/normal_pdf.png + // Here's an example graph of how the probabilities can be distributed: + // https://www.boost.org/doc/libs/1_49_0/libs/math/doc/sf_and_dist/graphs/normal_pdf.png - // Our parameter 'n' is sort of like σ (sigma) in the example graph. + // Our parameter 'n' is sort of like σ (sigma) in the example graph. - // An 'n' of 1 means all values are equally likely. Increasing 'n' causes numbers near the edge to become less likely. - // By setting 'shift' to whatever 'max' is, we can make values near 'min' very likely, while values near 'max' become extremely unlikely. + // An 'n' of 1 means all values are equally likely. Increasing 'n' causes numbers near the edge to become less likely. + // By setting 'shift' to whatever 'max' is, we can make values near 'min' very likely, while values near 'max' become extremely unlikely. - // Here's a place where you can play around with the 'n' and 'shift' values to see how the distribution changes: - // http://jsfiddle.net/e08cumyx/ + // Here's a place where you can play around with the 'n' and 'shift' values to see how the distribution changes: + // http://jsfiddle.net/e08cumyx/ if (max < min) { @@ -344,10 +343,10 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) if (shift > max - min) { - // If a rolled number is out of bounds (due to bias being applied), we roll it again. - // As the shifting increases, the chance of rolling a number within bounds decreases. - // A shift that is equal to the available range only has a 50% chance of rolling correctly, theoretically halving performance. - // Shifting even further drops the success chance very rapidly - so we want to warn against that + // If a rolled number is out of bounds (due to bias being applied), we roll it again. + // As the shifting increases, the chance of rolling a number within bounds decreases. + // A shift that is equal to the available range only has a 50% chance of rolling correctly, theoretically halving performance. + // Shifting even further drops the success chance very rapidly - so we want to warn against that _logger.Warning( "Bias shift for random number generation is greater than the range of available numbers. This will have a severe performance impact" diff --git a/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs b/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs index 30483ba8..bcea536d 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs @@ -1,10 +1,9 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Logging; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; -using SPTarkov.Server; -using SPTarkov.Common.Annotations; namespace SPTarkov.Server.Core.Utils; @@ -125,7 +124,7 @@ public class Watermark } /// - /// Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) + /// Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx)) /// /// Include the eft version this spt version was made for /// @@ -144,8 +143,8 @@ public class Watermark } /// - /// Handle singleplayer/settings/version - /// Get text shown in game on screen, can't be translated as it breaks BSGs client when certain characters are used + /// Handle singleplayer/settings/version + /// Get text shown in game on screen, can't be translated as it breaks BSGs client when certain characters are used /// /// label text public string GetInGameVersionLabel() @@ -159,7 +158,7 @@ public class Watermark } /// - /// Set window title + /// Set window title /// protected void SetTitle() { @@ -167,7 +166,7 @@ public class Watermark } /// - /// Draw watermark on screen + /// Draw watermark on screen /// protected void Draw() { diff --git a/SPTarkov.Server/Logger/WebApplicationLogger.cs b/SPTarkov.Server/Logger/WebApplicationLogger.cs index 2ec7aff2..bc6265e1 100644 --- a/SPTarkov.Server/Logger/WebApplicationLogger.cs +++ b/SPTarkov.Server/Logger/WebApplicationLogger.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Logging; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils.Logger; -using SPTarkov.Common.Annotations; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Logger; @@ -9,9 +9,9 @@ namespace SPTarkov.Server.Logger; [Injectable] public class SptWebApplicationLogger : ISptLogger { + private static ILogger? _fileLogger; private readonly ILogger _logger; - private static ILogger? _fileLogger; public SptWebApplicationLogger(ILoggerFactory provider) { diff --git a/SPTarkov.Server/Modding/ModDllLoader.cs b/SPTarkov.Server/Modding/ModDllLoader.cs index 12a37895..efd49ab7 100644 --- a/SPTarkov.Server/Modding/ModDllLoader.cs +++ b/SPTarkov.Server/Modding/ModDllLoader.cs @@ -1,4 +1,3 @@ -using System.Reflection; using System.Runtime.Loader; using System.Text.Json; using SPTarkov.Server.Core.Models.Spt.Mod; @@ -49,7 +48,7 @@ public class ModDllLoader } /// - /// Check the provided directory path for a dll and .json file, load into memory + /// Check the provided directory path for a dll and .json file, load into memory /// /// Directory path that contains mod files /// SptMod diff --git a/SPTarkov.Server/Modding/ModLoadOrder.cs b/SPTarkov.Server/Modding/ModLoadOrder.cs index 51040520..76089d15 100644 --- a/SPTarkov.Server/Modding/ModLoadOrder.cs +++ b/SPTarkov.Server/Modding/ModLoadOrder.cs @@ -5,9 +5,9 @@ namespace SPTarkov.Server.Modding; public class ModLoadOrder(ICloner cloner) { + protected Dictionary loadOrder = new(); protected Dictionary mods = new(); protected Dictionary modsAvailable = new(); - protected Dictionary loadOrder = new(); public Dictionary SetModList(Dictionary mods) { diff --git a/SPTarkov.Server/Modding/ModValidator.cs b/SPTarkov.Server/Modding/ModValidator.cs index e77cb38f..17cb1555 100644 --- a/SPTarkov.Server/Modding/ModValidator.cs +++ b/SPTarkov.Server/Modding/ModValidator.cs @@ -1,10 +1,10 @@ -using SPTarkov.Server.Core.Models.Spt.Config; +using SPTarkov.Common.Semver; +using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Semver; using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Modding; @@ -20,8 +20,8 @@ public class ModValidator( { protected readonly string basepath = "user/mods/"; protected readonly string modOrderPath = "user/mods/order.json"; - protected Dictionary order = []; protected Dictionary imported = []; + protected Dictionary order = []; protected HashSet skippedMods = []; protected CoreConfig sptConfig = configServer.GetConfig(); @@ -147,7 +147,10 @@ public class ModValidator( { if (ShouldSkipMod(mod.PackageJson)) { - logger.Warning(localisationService.GetText("modloader-skipped_mod", new { mod })); + logger.Warning(localisationService.GetText("modloader-skipped_mod", new + { + mod + })); continue; } @@ -174,7 +177,7 @@ public class ModValidator( } /// - /// Check for duplicate mods loaded, show error if any + /// Check for duplicate mods loaded, show error if any /// /// Dictionary of mod package.json data protected void CheckForDuplicateMods(Dictionary modPackageData) @@ -184,7 +187,7 @@ public class ModValidator( foreach (var mod in modPackageData.Values) { var name = $"{mod.Author}-{mod.Name}"; - groupedMods.Add(name, [..(groupedMods.GetValueOrDefault(name) ?? []), mod]); + groupedMods.Add(name, [..groupedMods.GetValueOrDefault(name) ?? [], mod]); // if there's more than one entry for a given mod it means there's at least 2 mods with the same author and name trying to load. if (groupedMods[name].Count > 1 && !skippedMods.Contains(name)) @@ -201,7 +204,7 @@ public class ModValidator( } /// - /// Returns an array of valid mods + /// Returns an array of valid mods /// /// mods to validate /// array of mod folder names @@ -212,7 +215,7 @@ public class ModValidator( /// - /// Is the passed in mod compatible with the running server version + /// Is the passed in mod compatible with the running server version /// /// Mod to check compatibility with SPT /// True if compatible @@ -234,9 +237,9 @@ public class ModValidator( logger.Error( localisationService.GetText("modloader-outdated_sptversion_field", new { - modName = modName, + modName, modVersion = mod.Version, - desiredSptVersion = mod.SptVersion, + desiredSptVersion = mod.SptVersion }) ); @@ -247,7 +250,7 @@ public class ModValidator( } /// - /// Read loadorder.json (create if doesnt exist) and return sorted list of mods + /// Read loadorder.json (create if doesnt exist) and return sorted list of mods /// /// string array of sorted mod names public List SortModsLoadOrder() @@ -263,7 +266,7 @@ public class ModValidator( } /// - /// Compile mod and add into class property "imported" + /// Compile mod and add into class property "imported" /// /// Name of mod to compile/add protected void AddMod(SptMod mod) @@ -275,13 +278,13 @@ public class ModValidator( { name = mod.PackageJson.Name, version = mod.PackageJson.Version, - author = mod.PackageJson.Author, + author = mod.PackageJson.Author }) ); } /// - /// Checks if a given mod should be loaded or skipped + /// Checks if a given mod should be loaded or skipped /// /// mod package.json data /// @@ -309,7 +312,7 @@ public class ModValidator( localisationService.GetText("modloader-missing_dependency", new { mod = modName, - modDependency = modDependency + modDependency }) ); return false; @@ -321,9 +324,9 @@ public class ModValidator( localisationService.GetText("modloader-outdated_dependency", new { mod = modName, - modDependency = modDependency, + modDependency, currentVersion = loadedMods[modDependency].Version, - requiredVersion = requiredVersion + requiredVersion }) ); return false; @@ -351,7 +354,7 @@ public class ModValidator( { author = mod.Author, name = mod.Name, - incompatibleModName = incompatibleModName + incompatibleModName }) ); return false; @@ -362,7 +365,7 @@ public class ModValidator( } /// - /// Validate a mod passes a number of checks + /// Validate a mod passes a number of checks /// /// name of mod in /mods/ to validate /// true if valid diff --git a/SPTarkov.Server/Program.cs b/SPTarkov.Server/Program.cs index 24ad31c9..abafbbac 100644 --- a/SPTarkov.Server/Program.cs +++ b/SPTarkov.Server/Program.cs @@ -1,17 +1,17 @@ using System.Runtime; +using Serilog; +using Serilog.Exceptions; +using SPTarkov.Common.Semver; +using SPTarkov.Common.Semver.Implementations; +using SPTarkov.DI; using SPTarkov.Server.Core.Context; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.External; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; -using Serilog; -using Serilog.Exceptions; -using SPTarkov.Common.Semver; -using SPTarkov.Common.Semver.Implementations; using SPTarkov.Server.Logger; using SPTarkov.Server.Modding; -using SPTarkov.DI; namespace SPTarkov.Server; diff --git a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs index 711f19cd..dfcc126e 100644 --- a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs +++ b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs @@ -1,3 +1,4 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common.Tables; @@ -7,7 +8,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; using Path = System.IO.Path; namespace HideoutCraftQuestIdGenerator; @@ -137,8 +137,8 @@ public class HideoutCraftQuestIdGenerator( } // Try to find the quest that matches this production - var questProductionOutputs = _questProductionOutputList.Where( - output => output.ItemTemplate == production.EndProduct && output.Quantity == production.Count + var questProductionOutputs = _questProductionOutputList.Where(output => + output.ItemTemplate == production.EndProduct && output.Quantity == production.Count ) .ToList(); diff --git a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGeneratorLauncher.cs b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGeneratorLauncher.cs index af289818..d33e2da0 100644 --- a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGeneratorLauncher.cs +++ b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGeneratorLauncher.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Utils; using Microsoft.Extensions.DependencyInjection; using SPTarkov.DI; +using SPTarkov.Server.Core.Utils; namespace HideoutCraftQuestIdGenerator; diff --git a/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs b/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs index 5a53f0d9..a49385ba 100644 --- a/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs +++ b/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs @@ -1,7 +1,7 @@ +using SPTarkov.Common.Annotations; using SPTarkov.Server.Core.Models.Logging; using SPTarkov.Server.Core.Models.Spt.Logging; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace HideoutCraftQuestIdGenerator; diff --git a/Tools/ItemTplGenerator/ItemTplGenerator.cs b/Tools/ItemTplGenerator/ItemTplGenerator.cs index 0842064c..2917e13d 100644 --- a/Tools/ItemTplGenerator/ItemTplGenerator.cs +++ b/Tools/ItemTplGenerator/ItemTplGenerator.cs @@ -1,3 +1,5 @@ +using SPTarkov.Common.Annotations; +using SPTarkov.Common.Extensions; using SPTarkov.Server.Core.Callbacks; using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Helpers; @@ -7,8 +9,6 @@ using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; -using SPTarkov.Common.Annotations; -using SPTarkov.Common.Extensions; using Path = System.IO.Path; namespace ItemTplGenerator; @@ -77,7 +77,7 @@ public class ItemTplGenerator( } /// - /// Return an object containing all items in the game with a generated name + /// Return an object containing all items in the game with a generated name /// /// An object containing a generated item name to item ID association private Dictionary GenerateItemsObject() @@ -227,7 +227,7 @@ public class ItemTplGenerator( } /// - /// Clear any non-alpha numeric characters, and fix multiple underscores + /// Clear any non-alpha numeric characters, and fix multiple underscores /// /// The enum key to sanitize /// The sanitized enum key @@ -320,7 +320,7 @@ public class ItemTplGenerator( } /// - /// Generate a prefix for the passed in item + /// Generate a prefix for the passed in item /// /// The item to generate the prefix for /// The prefix of the given item @@ -419,7 +419,7 @@ public class ItemTplGenerator( } /// - /// Return the name of the passed in item, formatted for use in an enum + /// Return the name of the passed in item, formatted for use in an enum /// /// The item to generate the name for /// The name of the given item diff --git a/Tools/ItemTplGenerator/ItemTplGeneratorLauncher.cs b/Tools/ItemTplGenerator/ItemTplGeneratorLauncher.cs index 9d9ce0c9..74f5b967 100644 --- a/Tools/ItemTplGenerator/ItemTplGeneratorLauncher.cs +++ b/Tools/ItemTplGenerator/ItemTplGeneratorLauncher.cs @@ -1,6 +1,6 @@ -using SPTarkov.Server.Core.Utils; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using SPTarkov.DI; +using SPTarkov.Server.Core.Utils; namespace ItemTplGenerator; diff --git a/Tools/ItemTplGenerator/SptBasicLogger.cs b/Tools/ItemTplGenerator/SptBasicLogger.cs index 346ec495..774a8947 100644 --- a/Tools/ItemTplGenerator/SptBasicLogger.cs +++ b/Tools/ItemTplGenerator/SptBasicLogger.cs @@ -1,7 +1,7 @@ -using SPTarkov.Server.Core.Models.Logging; +using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Logging; using SPTarkov.Server.Core.Models.Spt.Logging; using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Common.Annotations; namespace ItemTplGenerator; diff --git a/UnitTests/Tests/Utils/ClonerTest.cs b/UnitTests/Tests/Utils/ClonerTest.cs index b09e6858..4c5479bd 100644 --- a/UnitTests/Tests/Utils/ClonerTest.cs +++ b/UnitTests/Tests/Utils/ClonerTest.cs @@ -8,13 +8,13 @@ namespace UnitTests.Tests.Utils; [TestClass] public class ClonerTest { - private Templates? _templates; - - private ICloner _jsonCloner; - private ICloner _reflectionsCloner; private ICloner _fastCloner; + private ICloner _jsonCloner; + private JsonUtil _jsonUtil; + private ICloner _reflectionsCloner; + private Templates? _templates; [TestInitialize] public void Setup()