diff --git a/ExampleMods/ExampleMods.csproj b/ExampleMods/ExampleMods.csproj index 807c933a..d2c59028 100644 --- a/ExampleMods/ExampleMods.csproj +++ b/ExampleMods/ExampleMods.csproj @@ -1,29 +1,29 @@  - - Exe - net9.0 - enable - enable - Library - + + Exe + net9.0 + enable + enable + Library + - - - false - false - false - - - false - false - false - - - false - false - false - - + + + false + false + false + + + false + false + false + + + false + false + false + + diff --git a/ExampleMods/Mods/EditConfigs.cs b/ExampleMods/Mods/EditConfigs.cs index df52229b..6464daab 100644 --- a/ExampleMods/Mods/EditConfigs.cs +++ b/ExampleMods/Mods/EditConfigs.cs @@ -1,25 +1,25 @@ -using SptCommon.Annotations; using Core.Models.Enums; using Core.Models.External; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; +using SptCommon.Annotations; namespace ExampleMods.Mods; [Injectable] public class EditConfigs : IPostDBLoadMod { - private readonly ConfigServer _configServer; - private readonly BotConfig _botConfig; - private readonly HideoutConfig _hideoutConfig; - private readonly WeatherConfig _weatherConfig; private readonly AirdropConfig _airdropConfig; - private readonly PmcChatResponse _pmcChatResponseConfig; - private readonly QuestConfig _questConfig; - private readonly PmcConfig _pmcConfig; + private readonly BotConfig _botConfig; + private readonly ConfigServer _configServer; + private readonly HideoutConfig _hideoutConfig; private readonly ISptLogger _logger; + private readonly PmcChatResponse _pmcChatResponseConfig; + private readonly PmcConfig _pmcConfig; + private readonly QuestConfig _questConfig; + private readonly WeatherConfig _weatherConfig; // We access configs via ConfigServer public EditConfigs( @@ -39,7 +39,7 @@ public class EditConfigs : IPostDBLoadMod _questConfig = _configServer.GetConfig(); _pmcConfig = _configServer.GetConfig(); } - + public void PostDBLoad() { // Let's edit the weather config to make the season winter @@ -76,7 +76,7 @@ public class EditConfigs : IPostDBLoadMod var assaultConversionSettings = factory4DayConversionSettings["assault"]; assaultConversionSettings.Min = 100; assaultConversionSettings.Max = 100; - + _logger.Success("Finished Editing Configs"); } } diff --git a/ExampleMods/Mods/EditDatabaseValues.cs b/ExampleMods/Mods/EditDatabaseValues.cs index 40a6a732..6d6832a4 100644 --- a/ExampleMods/Mods/EditDatabaseValues.cs +++ b/ExampleMods/Mods/EditDatabaseValues.cs @@ -1,9 +1,8 @@ -using SptCommon.Annotations; -using Core.Models.Eft.Hideout; using Core.Models.Enums; using Core.Models.External; using Core.Models.Utils; using Core.Services; +using SptCommon.Annotations; namespace ExampleMods.Mods; @@ -12,7 +11,7 @@ public class EditDatabaseValues : IPostDBLoadMod { private readonly DatabaseService _databaseService; private readonly ISptLogger _logger; - + public EditDatabaseValues( DatabaseService databaseService, ISptLogger logger @@ -41,7 +40,7 @@ public class EditDatabaseValues : IPostDBLoadMod // Lets edit Customs EditCustoms(); - + _logger.Success("Finished Editing Database"); } @@ -64,7 +63,10 @@ public class EditDatabaseValues : IPostDBLoadMod // The max is stored in a list, different flea ratings give different offer amounts // We loop over all the settings, setting all of them to be 20 - foreach (var offerCountSettings in ragfairSettings.MaxActiveOfferCount) offerCountSettings.Count = 20; + foreach (var offerCountSettings in ragfairSettings.MaxActiveOfferCount) + { + offerCountSettings.Count = 20; + } } private void EditBtr() diff --git a/ExampleMods/Mods/Logging.cs b/ExampleMods/Mods/Logging.cs index 4875d277..d0abdf80 100644 --- a/ExampleMods/Mods/Logging.cs +++ b/ExampleMods/Mods/Logging.cs @@ -1,12 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Core.Models.External; -using SptCommon.Annotations; using Core.Models.Logging; using Core.Models.Utils; +using SptCommon.Annotations; namespace ExampleMods.Mods; @@ -23,7 +18,7 @@ public class Logging : IPostSptLoadMod // Save the logger we're injecting into a private variable that is scoped to this class (only this class has access to it) _logger = logger; } - + public void PostSptLoad() { // We can access the logger to assigned in the constructor here diff --git a/ExampleMods/Mods/WatermarkOverride.cs b/ExampleMods/Mods/WatermarkOverride.cs index 05c8a7df..afafb8bc 100644 --- a/ExampleMods/Mods/WatermarkOverride.cs +++ b/ExampleMods/Mods/WatermarkOverride.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace ExampleMods.Mods.Override; diff --git a/Libraries/Core/Callbacks/AchievementCallbacks.cs b/Libraries/Core/Callbacks/AchievementCallbacks.cs index e03226dd..572c9c94 100644 --- a/Libraries/Core/Callbacks/AchievementCallbacks.cs +++ b/Libraries/Core/Callbacks/AchievementCallbacks.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -12,7 +12,7 @@ public class AchievementCallbacks( ) { /// - /// Handle client/achievement/list + /// Handle client/achievement/list /// /// /// @@ -24,7 +24,7 @@ public class AchievementCallbacks( } /// - /// Handle client/achievement/statistic + /// Handle client/achievement/statistic /// /// /// diff --git a/Libraries/Core/Callbacks/BotCallbacks.cs b/Libraries/Core/Callbacks/BotCallbacks.cs index d4e13670..8d605c29 100644 --- a/Libraries/Core/Callbacks/BotCallbacks.cs +++ b/Libraries/Core/Callbacks/BotCallbacks.cs @@ -16,8 +16,8 @@ public class BotCallbacks( ) { /// - /// Handle singleplayer/settings/bot/limit - /// Is called by client to define each bot roles wave limit + /// Handle singleplayer/settings/bot/limit + /// Is called by client to define each bot roles wave limit /// /// /// @@ -31,7 +31,7 @@ public class BotCallbacks( } /// - /// Handle singleplayer/settings/bot/difficulty + /// Handle singleplayer/settings/bot/difficulty /// /// /// @@ -43,7 +43,9 @@ public class BotCallbacks( var type = splitUrl[^2].ToLower(); var difficulty = splitUrl[^1]; if (difficulty == "core") + { return _httpResponseUtil.NoBody(_botController.GetBotCoreDifficulty()); + } var raidConfig = _applicationContext.GetLatestValue(ContextVariableType.RAID_CONFIGURATION) ?.GetValue(); @@ -52,7 +54,7 @@ public class BotCallbacks( } /// - /// Handle singleplayer/settings/bot/difficulties + /// Handle singleplayer/settings/bot/difficulties /// /// /// @@ -64,7 +66,7 @@ public class BotCallbacks( } /// - /// Handle client/game/bot/generate + /// Handle client/game/bot/generate /// /// /// @@ -76,7 +78,7 @@ public class BotCallbacks( } /// - /// Handle singleplayer/settings/bot/maxCap + /// Handle singleplayer/settings/bot/maxCap /// /// public string GetBotCap(string url, EmptyRequestData info, string sessionID) @@ -87,7 +89,7 @@ public class BotCallbacks( } /// - /// Handle singleplayer/settings/bot/getBotBehaviours + /// Handle singleplayer/settings/bot/getBotBehaviours /// /// public string GetBotBehaviours() diff --git a/Libraries/Core/Callbacks/BuildsCallbacks.cs b/Libraries/Core/Callbacks/BuildsCallbacks.cs index cfd8f64e..379d8629 100644 --- a/Libraries/Core/Callbacks/BuildsCallbacks.cs +++ b/Libraries/Core/Callbacks/BuildsCallbacks.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Builds; using Core.Models.Eft.Common; using Core.Models.Eft.PresetBuild; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -14,7 +14,7 @@ public class BuildsCallbacks( ) { /// - /// Handle client/builds/list + /// Handle client/builds/list /// /// /// @@ -26,7 +26,7 @@ public class BuildsCallbacks( } /// - /// Handle client/builds/magazine/save + /// Handle client/builds/magazine/save /// /// /// @@ -39,7 +39,7 @@ public class BuildsCallbacks( } /// - /// Handle client/builds/weapon/save + /// Handle client/builds/weapon/save /// /// /// @@ -52,7 +52,7 @@ public class BuildsCallbacks( } /// - /// Handle client/builds/equipment/save + /// Handle client/builds/equipment/save /// /// /// @@ -65,7 +65,7 @@ public class BuildsCallbacks( } /// - /// Handle client/builds/delete + /// Handle client/builds/delete /// /// /// diff --git a/Libraries/Core/Callbacks/BundleCallbacks.cs b/Libraries/Core/Callbacks/BundleCallbacks.cs index fa0b4549..2affebda 100644 --- a/Libraries/Core/Callbacks/BundleCallbacks.cs +++ b/Libraries/Core/Callbacks/BundleCallbacks.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Models.Eft.Common; +using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -11,7 +11,7 @@ public class BundleCallbacks( ) { /// - /// Handle singleplayer/bundles + /// Handle singleplayer/bundles /// /// /// diff --git a/Libraries/Core/Callbacks/ClientLogCallbacks.cs b/Libraries/Core/Callbacks/ClientLogCallbacks.cs index 32310496..9086fc4f 100644 --- a/Libraries/Core/Callbacks/ClientLogCallbacks.cs +++ b/Libraries/Core/Callbacks/ClientLogCallbacks.cs @@ -1,11 +1,11 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Spt.Config; using Core.Models.Spt.Logging; using Core.Servers; using Core.Services; using Core.Utils; using Server; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -19,7 +19,7 @@ public class ClientLogCallbacks( ) { /// - /// Handle /singleplayer/log + /// Handle /singleplayer/log /// /// /// @@ -32,7 +32,7 @@ public class ClientLogCallbacks( } /// - /// Handle /singleplayer/release + /// Handle /singleplayer/release /// /// public string ReleaseNotes() @@ -59,7 +59,7 @@ public class ClientLogCallbacks( } /// - /// Handle /singleplayer/enableBSGlogging + /// Handle /singleplayer/enableBSGlogging /// /// public string BsgLogging() diff --git a/Libraries/Core/Callbacks/CustomizationCallbacks.cs b/Libraries/Core/Callbacks/CustomizationCallbacks.cs index e64ee31e..f45942e0 100644 --- a/Libraries/Core/Callbacks/CustomizationCallbacks.cs +++ b/Libraries/Core/Callbacks/CustomizationCallbacks.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.Customization; using Core.Models.Eft.ItemEvent; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -16,7 +16,7 @@ public class CustomizationCallbacks( ) { /// - /// Handle client/trading/customization/storage + /// Handle client/trading/customization/storage /// /// /// @@ -28,7 +28,7 @@ public class CustomizationCallbacks( } /// - /// Handle client/trading/customization + /// Handle client/trading/customization /// /// /// @@ -43,7 +43,7 @@ public class CustomizationCallbacks( } /// - /// Handle CustomizationBuy event + /// Handle CustomizationBuy event /// /// /// @@ -55,7 +55,7 @@ public class CustomizationCallbacks( } /// - /// Handle client/hideout/customization/offer/list + /// Handle client/hideout/customization/offer/list /// /// /// @@ -67,7 +67,7 @@ public class CustomizationCallbacks( } /// - /// Handle client/customization/storage + /// Handle client/customization/storage /// /// /// @@ -79,7 +79,7 @@ public class CustomizationCallbacks( } /// - /// Handle CustomizationSet + /// Handle CustomizationSet /// /// /// diff --git a/Libraries/Core/Callbacks/DataCallbacks.cs b/Libraries/Core/Callbacks/DataCallbacks.cs index 9426e8f6..388bb347 100644 --- a/Libraries/Core/Callbacks/DataCallbacks.cs +++ b/Libraries/Core/Callbacks/DataCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -15,7 +15,7 @@ public class DataCallbacks( ) { /// - /// Handle client/settings + /// Handle client/settings /// /// /// @@ -28,7 +28,7 @@ public class DataCallbacks( } /// - /// Handle client/globals + /// Handle client/globals /// /// /// @@ -43,7 +43,7 @@ public class DataCallbacks( } /// - /// Handle client/items + /// Handle client/items /// /// /// @@ -55,7 +55,7 @@ public class DataCallbacks( } /// - /// Handle client/handbook/templates + /// Handle client/handbook/templates /// /// /// @@ -67,7 +67,7 @@ public class DataCallbacks( } /// - /// Handle client/customization + /// Handle client/customization /// /// /// @@ -79,7 +79,7 @@ public class DataCallbacks( } /// - /// Handle client/account/customization + /// Handle client/account/customization /// /// /// @@ -91,7 +91,7 @@ public class DataCallbacks( } /// - /// Handle client/hideout/settings + /// Handle client/hideout/settings /// /// /// @@ -103,7 +103,7 @@ public class DataCallbacks( } /// - /// Handle client/hideout/areas + /// Handle client/hideout/areas /// /// /// @@ -115,7 +115,7 @@ public class DataCallbacks( } /// - /// Handle client/hideout/production/recipes + /// Handle client/hideout/production/recipes /// /// /// @@ -127,7 +127,7 @@ public class DataCallbacks( } /// - /// Handle client/languages + /// Handle client/languages /// /// /// @@ -139,7 +139,7 @@ public class DataCallbacks( } /// - /// Handle client/menu/locale + /// Handle client/menu/locale /// /// /// @@ -151,13 +151,16 @@ public class DataCallbacks( var locales = _databaseService.GetLocales(); var result = locales.Menu?[localeId] ?? locales.Menu?.FirstOrDefault(m => m.Key == "en").Value; - if (result == null) throw new Exception($"Unable to determine locale for request with {localeId}"); + if (result == null) + { + throw new Exception($"Unable to determine locale for request with {localeId}"); + } return _httpResponseUtil.GetBody(result); } /// - /// Handle client/locale + /// Handle client/locale /// /// /// @@ -173,7 +176,7 @@ public class DataCallbacks( } /// - /// Handle client/hideout/qte/list + /// Handle client/hideout/qte/list /// /// /// @@ -185,7 +188,7 @@ public class DataCallbacks( } /// - /// Handle client/items/prices/ + /// Handle client/items/prices/ /// /// /// diff --git a/Libraries/Core/Callbacks/DialogueCallbacks.cs b/Libraries/Core/Callbacks/DialogueCallbacks.cs index 95476264..e5394838 100644 --- a/Libraries/Core/Callbacks/DialogueCallbacks.cs +++ b/Libraries/Core/Callbacks/DialogueCallbacks.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Request; using Core.Models.Eft.Dialog; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -18,8 +18,19 @@ public class DialogueCallbacks( ) : OnUpdate { + public bool OnUpdate(long timeSinceLastRun) + { + _dialogueController.Update(); + return true; + } + + public string GetRoute() + { + return "spt-dialogue"; + } + /// - /// Handle client/friend/list + /// Handle client/friend/list /// /// /// @@ -31,7 +42,7 @@ public class DialogueCallbacks( } /// - /// Handle client/chatServer/list + /// Handle client/chatServer/list /// /// /// @@ -51,7 +62,14 @@ public class DialogueCallbacks( VersionId = "bgkidft87ddd", Ip = "", Port = 0, - Chats = [new Chat { Id = "0", Members = 0 }] + Chats = + [ + new Chat + { + Id = "0", + Members = 0 + } + ] } }; @@ -59,7 +77,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/list + /// Handle client/mail/dialog/list /// /// /// @@ -71,7 +89,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/view + /// Handle client/mail/dialog/view /// /// /// @@ -83,7 +101,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/info + /// Handle client/mail/dialog/info /// /// /// @@ -95,7 +113,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/remove + /// Handle client/mail/dialog/remove /// /// /// @@ -108,7 +126,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/pin + /// Handle client/mail/dialog/pin /// /// /// @@ -121,7 +139,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/unpin + /// Handle client/mail/dialog/unpin /// /// /// @@ -134,7 +152,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/read + /// Handle client/mail/dialog/read /// /// /// @@ -147,7 +165,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/dialog/getAllAttachments + /// Handle client/mail/dialog/getAllAttachments /// /// /// @@ -159,7 +177,7 @@ public class DialogueCallbacks( } /// - /// Handle client/mail/msg/send + /// Handle client/mail/msg/send /// /// /// @@ -171,7 +189,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/list/outbox + /// Handle client/friend/request/list/outbox /// /// /// @@ -183,7 +201,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/list/inbox + /// Handle client/friend/request/list/inbox /// /// /// @@ -195,7 +213,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/send + /// Handle client/friend/request/send /// /// /// @@ -207,7 +225,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/accept-all + /// Handle client/friend/request/accept-all /// /// /// @@ -219,7 +237,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/accept + /// Handle client/friend/request/accept /// /// /// @@ -231,7 +249,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/decline + /// Handle client/friend/request/decline /// /// /// @@ -243,7 +261,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/request/cancel + /// Handle client/friend/request/cancel /// /// /// @@ -255,7 +273,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/delete + /// Handle client/friend/delete /// /// /// @@ -268,7 +286,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/ignore/set + /// Handle client/friend/ignore/set /// /// /// @@ -280,7 +298,7 @@ public class DialogueCallbacks( } /// - /// Handle client/friend/ignore/remove + /// Handle client/friend/ignore/remove /// /// /// @@ -315,15 +333,4 @@ public class DialogueCallbacks( { return "Not Implemented!"; // Not implemented in Node } - - public bool OnUpdate(long timeSinceLastRun) - { - _dialogueController.Update(); - return true; - } - - public string GetRoute() - { - return "spt-dialogue"; - } } diff --git a/Libraries/Core/Callbacks/GameCallbacks.cs b/Libraries/Core/Callbacks/GameCallbacks.cs index 1d514791..0150d466 100644 --- a/Libraries/Core/Callbacks/GameCallbacks.cs +++ b/Libraries/Core/Callbacks/GameCallbacks.cs @@ -1,11 +1,11 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Request; using Core.Models.Eft.Game; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -31,7 +31,7 @@ public class GameCallbacks( } /// - /// Handle client/game/version/validate + /// Handle client/game/version/validate /// /// /// @@ -43,7 +43,7 @@ public class GameCallbacks( } /// - /// Handle client/game/start + /// Handle client/game/start /// /// /// @@ -53,12 +53,17 @@ public class GameCallbacks( { var startTimestampSec = _timeUtil.GetTimeStamp(); _gameController.GameStart(url, info, sessionID, startTimestampSec); - return _httpResponseUtil.GetBody(new GameStartResponse() { UtcTime = startTimestampSec }); + return _httpResponseUtil.GetBody( + new GameStartResponse + { + UtcTime = startTimestampSec + } + ); } /// - /// Handle client/game/logout - /// Save profiles on game close + /// Handle client/game/logout + /// Save profiles on game close /// /// /// @@ -67,11 +72,16 @@ public class GameCallbacks( public string GameLogout(string url, EmptyRequestData info, string sessionID) { _saveServer.Save(); - return _httpResponseUtil.GetBody(new GameLogoutResponseData() { Status = "ok" }); + return _httpResponseUtil.GetBody( + new GameLogoutResponseData + { + Status = "ok" + } + ); } /// - /// Handle client/game/config + /// Handle client/game/config /// /// /// @@ -83,7 +93,7 @@ public class GameCallbacks( } /// - /// Handle client/game/mode + /// Handle client/game/mode /// /// /// @@ -95,7 +105,7 @@ public class GameCallbacks( } /// - /// Handle client/server/list + /// Handle client/server/list /// /// /// @@ -107,7 +117,7 @@ public class GameCallbacks( } /// - /// Handle client/match/group/current + /// Handle client/match/group/current /// /// /// @@ -119,7 +129,7 @@ public class GameCallbacks( } /// - /// Handle client/checkVersion + /// Handle client/checkVersion /// /// /// @@ -131,7 +141,7 @@ public class GameCallbacks( } /// - /// Handle client/game/keepalive + /// Handle client/game/keepalive /// /// /// @@ -143,7 +153,7 @@ public class GameCallbacks( } /// - /// Handle singleplayer/settings/version + /// Handle singleplayer/settings/version /// /// /// @@ -152,11 +162,16 @@ public class GameCallbacks( public string GetVersion(string url, EmptyRequestData info, string sessionID) { // change to be a proper type - return _httpResponseUtil.NoBody(new { Version = _watermark.GetInGameVersionLabel() }); + return _httpResponseUtil.NoBody( + new + { + Version = _watermark.GetInGameVersionLabel() + } + ); } /// - /// Handle /client/report/send & /client/reports/lobby/send + /// Handle /client/report/send & /client/reports/lobby/send /// /// /// @@ -168,7 +183,7 @@ public class GameCallbacks( } /// - /// Handle singleplayer/settings/getRaidTime + /// Handle singleplayer/settings/getRaidTime /// /// /// @@ -180,7 +195,7 @@ public class GameCallbacks( } /// - /// Handle /client/survey + /// Handle /client/survey /// /// /// @@ -192,7 +207,7 @@ public class GameCallbacks( } /// - /// Handle client/survey/view + /// Handle client/survey/view /// /// /// @@ -204,7 +219,7 @@ public class GameCallbacks( } /// - /// Handle client/survey/opinion + /// Handle client/survey/opinion /// /// /// diff --git a/Libraries/Core/Callbacks/HandbookCallbacks.cs b/Libraries/Core/Callbacks/HandbookCallbacks.cs index d5e5a1cf..bcabda1a 100644 --- a/Libraries/Core/Callbacks/HandbookCallbacks.cs +++ b/Libraries/Core/Callbacks/HandbookCallbacks.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.DI; +using SptCommon.Annotations; namespace Core.Callbacks; diff --git a/Libraries/Core/Callbacks/HealthCallbacks.cs b/Libraries/Core/Callbacks/HealthCallbacks.cs index 79249f90..275f5f63 100644 --- a/Libraries/Core/Callbacks/HealthCallbacks.cs +++ b/Libraries/Core/Callbacks/HealthCallbacks.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Health; using Core.Models.Eft.ItemEvent; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -16,7 +16,7 @@ public class HealthCallbacks( ) { /// - /// Custom spt server request found in modules/QTEPatch.cs + /// Custom spt server request found in modules/QTEPatch.cs /// /// /// HealthListener.Instance.CurrentHealth class @@ -29,7 +29,7 @@ public class HealthCallbacks( } /// - /// Handle Eat + /// Handle Eat /// /// /// @@ -41,7 +41,7 @@ public class HealthCallbacks( } /// - /// Handle Heal + /// Handle Heal /// /// /// @@ -53,7 +53,7 @@ public class HealthCallbacks( } /// - /// Handle RestoreHealth + /// Handle RestoreHealth /// /// /// diff --git a/Libraries/Core/Callbacks/HideoutCallbacks.cs b/Libraries/Core/Callbacks/HideoutCallbacks.cs index 11e19ac3..21dc69cc 100644 --- a/Libraries/Core/Callbacks/HideoutCallbacks.cs +++ b/Libraries/Core/Callbacks/HideoutCallbacks.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Hideout; using Core.Models.Eft.ItemEvent; using Core.Models.Spt.Config; using Core.Servers; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -18,151 +18,6 @@ public class HideoutCallbacks( { private readonly HideoutConfig _hideoutConfig = _configServer.GetConfig(); - /// - /// Handle HideoutUpgrade event - /// - public ItemEventRouterResponse Upgrade(PmcData pmcData, HideoutUpgradeRequestData request, string sessionID, ItemEventRouterResponse output) - { - _hideoutController.StartUpgrade(pmcData, request, sessionID, output); - - return output; - } - - /// - /// Handle HideoutUpgradeComplete event - /// - public ItemEventRouterResponse UpgradeComplete(PmcData pmcData, HideoutUpgradeCompleteRequestData request, string sessionID, ItemEventRouterResponse output) - { - _hideoutController.UpgradeComplete(pmcData, request, sessionID, output); - - return output; - } - - /// - /// Handle HideoutPutItemsInAreaSlots - /// - public ItemEventRouterResponse PutItemsInAreaSlots(PmcData pmcData, HideoutPutItemInRequestData request, string sessionID) - { - return _hideoutController.PutItemsInAreaSlots(pmcData, request, sessionID); - } - - /// - /// Handle HideoutTakeItemsFromAreaSlots event - /// - public ItemEventRouterResponse TakeItemsFromAreaSlots(PmcData pmcData, HideoutTakeItemOutRequestData request, string sessionID) - { - return _hideoutController.TakeItemsFromAreaSlots(pmcData, request, sessionID); - } - - /// - /// Handle HideoutToggleArea event - /// - public ItemEventRouterResponse ToggleArea(PmcData pmcData, HideoutToggleAreaRequestData request, string sessionID) - { - return _hideoutController.ToggleArea(pmcData, request, sessionID); - } - - /// - /// Handle HideoutSingleProductionStart event - /// - public ItemEventRouterResponse SingleProductionStart(PmcData pmcData, HideoutSingleProductionStartRequestData request, string sessionID) - { - return _hideoutController.SingleProductionStart(pmcData, request, sessionID); - } - - /// - /// Handle HideoutScavCaseProductionStart event - /// - public ItemEventRouterResponse ScavCaseProductionStart(PmcData pmcData, HideoutScavCaseStartRequestData request, string sessionID) - { - return _hideoutController.ScavCaseProductionStart(pmcData, request, sessionID); - } - - /// - /// Handle HideoutContinuousProductionStart - /// - public ItemEventRouterResponse ContinuousProductionStart(PmcData pmcData, HideoutContinuousProductionStartRequestData request, string sessionID) - { - return _hideoutController.ContinuousProductionStart(pmcData, request, sessionID); - } - - /// - /// Handle HideoutTakeProduction event - /// - public ItemEventRouterResponse TakeProduction(PmcData pmcData, HideoutTakeProductionRequestData request, string sessionID) - { - return _hideoutController.TakeProduction(pmcData, request, sessionID); - } - - /// - /// Handle HideoutQuickTimeEvent - /// - public ItemEventRouterResponse HandleQTEEvent(PmcData pmcData, HandleQTEEventRequestData request, string sessionID, ItemEventRouterResponse output) - { - _hideoutController.HandleQTEEventOutcome(sessionID, pmcData, request, output); - - return output; - } - - /// - /// Handle client/game/profile/items/moving - RecordShootingRangePoints - /// - public ItemEventRouterResponse RecordShootingRangePoints(PmcData pmcData, RecordShootingRangePoints request, string sessionID, - ItemEventRouterResponse output) - { - _hideoutController.RecordShootingRangePoints(sessionID, pmcData, request); - - return output; - } - - /// - /// Handle client/game/profile/items/moving - RecordShootingRangePoints - /// - public ItemEventRouterResponse ImproveArea(PmcData pmcData, HideoutImproveAreaRequestData request, string sessionID) - { - return _hideoutController.ImproveArea(sessionID, pmcData, request); - } - - /// - /// Handle client/game/profile/items/moving - HideoutCancelProductionCommand - /// - public ItemEventRouterResponse CancelProduction(PmcData pmcData, HideoutCancelProductionRequestData request, string sessionID) - { - return _hideoutController.CancelProduction(sessionID, pmcData, request); - } - - /// - /// Handle client/game/profile/items/moving - HideoutCircleOfCultistProductionStart - /// - public ItemEventRouterResponse CicleOfCultistProductionStart(PmcData pmcData, HideoutCircleOfCultistProductionStartRequestData request, string sessionID) - { - return _hideoutController.CicleOfCultistProductionStart(sessionID, pmcData, request); - } - - /// - /// Handle client/game/profile/items/moving - HideoutDeleteProductionCommand - /// - public ItemEventRouterResponse HideoutDeleteProductionCommand(PmcData pmcData, HideoutDeleteProductionRequestData request, string sessionID) - { - return _hideoutController.HideoutDeleteProductionCommand(sessionID, pmcData, request); - } - - /// - /// Handle client/game/profile/items/moving - HideoutCustomizationApply - /// - public ItemEventRouterResponse HideoutCustomizationApplyCommand(PmcData pmcData, HideoutCustomizationApplyRequestData request, string sessionID) - { - return _hideoutController.HideoutCustomizationApply(sessionID, pmcData, request); - } - - /** - * Handle client/game/profile/items/moving - hideoutCustomizationSetMannequinPose - */ - public ItemEventRouterResponse HideoutCustomizationSetMannequinPose(PmcData pmcData, HideoutCustomizationSetMannequinPoseRequest request, string sessionId) - { - return _hideoutController.HideoutCustomizationSetMannequinPose(sessionId, pmcData, request); - } - public bool OnUpdate(long timeSinceLastRun) { if (timeSinceLastRun > _hideoutConfig.RunIntervalSeconds) @@ -178,4 +33,149 @@ public class HideoutCallbacks( { return "spt-hideout"; } + + /// + /// Handle HideoutUpgrade event + /// + public ItemEventRouterResponse Upgrade(PmcData pmcData, HideoutUpgradeRequestData request, string sessionID, ItemEventRouterResponse output) + { + _hideoutController.StartUpgrade(pmcData, request, sessionID, output); + + return output; + } + + /// + /// Handle HideoutUpgradeComplete event + /// + public ItemEventRouterResponse UpgradeComplete(PmcData pmcData, HideoutUpgradeCompleteRequestData request, string sessionID, ItemEventRouterResponse output) + { + _hideoutController.UpgradeComplete(pmcData, request, sessionID, output); + + return output; + } + + /// + /// Handle HideoutPutItemsInAreaSlots + /// + public ItemEventRouterResponse PutItemsInAreaSlots(PmcData pmcData, HideoutPutItemInRequestData request, string sessionID) + { + return _hideoutController.PutItemsInAreaSlots(pmcData, request, sessionID); + } + + /// + /// Handle HideoutTakeItemsFromAreaSlots event + /// + public ItemEventRouterResponse TakeItemsFromAreaSlots(PmcData pmcData, HideoutTakeItemOutRequestData request, string sessionID) + { + return _hideoutController.TakeItemsFromAreaSlots(pmcData, request, sessionID); + } + + /// + /// Handle HideoutToggleArea event + /// + public ItemEventRouterResponse ToggleArea(PmcData pmcData, HideoutToggleAreaRequestData request, string sessionID) + { + return _hideoutController.ToggleArea(pmcData, request, sessionID); + } + + /// + /// Handle HideoutSingleProductionStart event + /// + public ItemEventRouterResponse SingleProductionStart(PmcData pmcData, HideoutSingleProductionStartRequestData request, string sessionID) + { + return _hideoutController.SingleProductionStart(pmcData, request, sessionID); + } + + /// + /// Handle HideoutScavCaseProductionStart event + /// + public ItemEventRouterResponse ScavCaseProductionStart(PmcData pmcData, HideoutScavCaseStartRequestData request, string sessionID) + { + return _hideoutController.ScavCaseProductionStart(pmcData, request, sessionID); + } + + /// + /// Handle HideoutContinuousProductionStart + /// + public ItemEventRouterResponse ContinuousProductionStart(PmcData pmcData, HideoutContinuousProductionStartRequestData request, string sessionID) + { + return _hideoutController.ContinuousProductionStart(pmcData, request, sessionID); + } + + /// + /// Handle HideoutTakeProduction event + /// + public ItemEventRouterResponse TakeProduction(PmcData pmcData, HideoutTakeProductionRequestData request, string sessionID) + { + return _hideoutController.TakeProduction(pmcData, request, sessionID); + } + + /// + /// Handle HideoutQuickTimeEvent + /// + public ItemEventRouterResponse HandleQTEEvent(PmcData pmcData, HandleQTEEventRequestData request, string sessionID, ItemEventRouterResponse output) + { + _hideoutController.HandleQTEEventOutcome(sessionID, pmcData, request, output); + + return output; + } + + /// + /// Handle client/game/profile/items/moving - RecordShootingRangePoints + /// + public ItemEventRouterResponse RecordShootingRangePoints(PmcData pmcData, RecordShootingRangePoints request, string sessionID, + ItemEventRouterResponse output) + { + _hideoutController.RecordShootingRangePoints(sessionID, pmcData, request); + + return output; + } + + /// + /// Handle client/game/profile/items/moving - RecordShootingRangePoints + /// + public ItemEventRouterResponse ImproveArea(PmcData pmcData, HideoutImproveAreaRequestData request, string sessionID) + { + return _hideoutController.ImproveArea(sessionID, pmcData, request); + } + + /// + /// Handle client/game/profile/items/moving - HideoutCancelProductionCommand + /// + public ItemEventRouterResponse CancelProduction(PmcData pmcData, HideoutCancelProductionRequestData request, string sessionID) + { + return _hideoutController.CancelProduction(sessionID, pmcData, request); + } + + /// + /// Handle client/game/profile/items/moving - HideoutCircleOfCultistProductionStart + /// + public ItemEventRouterResponse CicleOfCultistProductionStart(PmcData pmcData, HideoutCircleOfCultistProductionStartRequestData request, string sessionID) + { + return _hideoutController.CicleOfCultistProductionStart(sessionID, pmcData, request); + } + + /// + /// Handle client/game/profile/items/moving - HideoutDeleteProductionCommand + /// + public ItemEventRouterResponse HideoutDeleteProductionCommand(PmcData pmcData, HideoutDeleteProductionRequestData request, string sessionID) + { + return _hideoutController.HideoutDeleteProductionCommand(sessionID, pmcData, request); + } + + /// + /// Handle client/game/profile/items/moving - HideoutCustomizationApply + /// + public ItemEventRouterResponse HideoutCustomizationApplyCommand(PmcData pmcData, HideoutCustomizationApplyRequestData request, string sessionID) + { + return _hideoutController.HideoutCustomizationApply(sessionID, pmcData, request); + } + + /** + * Handle client/game/profile/items/moving - hideoutCustomizationSetMannequinPose + */ + public ItemEventRouterResponse HideoutCustomizationSetMannequinPose(PmcData pmcData, HideoutCustomizationSetMannequinPoseRequest request, string sessionId) + { + return _hideoutController.HideoutCustomizationSetMannequinPose(sessionId, pmcData, request); + } } diff --git a/Libraries/Core/Callbacks/HttpCallbacks.cs b/Libraries/Core/Callbacks/HttpCallbacks.cs index 9e82d047..43e1f7be 100644 --- a/Libraries/Core/Callbacks/HttpCallbacks.cs +++ b/Libraries/Core/Callbacks/HttpCallbacks.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; using Core.Context; using Core.DI; using Core.Servers; +using SptCommon.Annotations; namespace Core.Callbacks; diff --git a/Libraries/Core/Callbacks/InraidCallbacks.cs b/Libraries/Core/Callbacks/InraidCallbacks.cs index c7e77b38..89c016af 100644 --- a/Libraries/Core/Callbacks/InraidCallbacks.cs +++ b/Libraries/Core/Callbacks/InraidCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.InRaid; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -13,8 +13,8 @@ public class InraidCallbacks( ) { /// - /// Handle client/location/getLocalloot - /// Store active map in profile + applicationContext + /// Handle client/location/getLocalloot + /// Store active map in profile + applicationContext /// /// /// register player request @@ -27,7 +27,7 @@ public class InraidCallbacks( } /// - /// Handle raid/profile/scavsave + /// Handle raid/profile/scavsave /// /// /// Save progress request @@ -40,7 +40,7 @@ public class InraidCallbacks( } /// - /// Handle singleplayer/settings/raid/menu + /// Handle singleplayer/settings/raid/menu /// /// JSON as string public string GetRaidMenuSettings() diff --git a/Libraries/Core/Callbacks/InsuranceCallbacks.cs b/Libraries/Core/Callbacks/InsuranceCallbacks.cs index af39be6b..546e4ba2 100644 --- a/Libraries/Core/Callbacks/InsuranceCallbacks.cs +++ b/Libraries/Core/Callbacks/InsuranceCallbacks.cs @@ -1,5 +1,4 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Insurance; @@ -8,6 +7,7 @@ using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -21,10 +21,26 @@ public class InsuranceCallbacks( ) : OnUpdate { - private InsuranceConfig _insuranceConfig = _configServer.GetConfig(); + private readonly InsuranceConfig _insuranceConfig = _configServer.GetConfig(); + + public bool OnUpdate(long timeSinceLastRun) + { + if (timeSinceLastRun > Math.Max(_insuranceConfig.RunIntervalSeconds, 1)) + { + _insuranceController.ProcessReturn(); + return true; + } + + return false; + } + + public string GetRoute() + { + return "spt-insurance"; + } /// - /// Handle client/insurance/items/list/cost + /// Handle client/insurance/items/list/cost /// /// /// @@ -36,7 +52,7 @@ public class InsuranceCallbacks( } /// - /// Handle Insure event + /// Handle Insure event /// /// /// @@ -46,18 +62,4 @@ public class InsuranceCallbacks( { return _insuranceController.Insure(pmcData, info, sessionID); } - - public bool OnUpdate(long timeSinceLastRun) - { - if (timeSinceLastRun > Math.Max(_insuranceConfig.RunIntervalSeconds, 1)) - _insuranceController.ProcessReturn(); - return true; - - return false; - } - - public string GetRoute() - { - return "spt-insurance"; - } } diff --git a/Libraries/Core/Callbacks/InventoryCallbacks.cs b/Libraries/Core/Callbacks/InventoryCallbacks.cs index cd5eb169..9effcc91 100644 --- a/Libraries/Core/Callbacks/InventoryCallbacks.cs +++ b/Libraries/Core/Callbacks/InventoryCallbacks.cs @@ -1,5 +1,4 @@ using Core.Controllers; -using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Inventory; using Core.Models.Eft.ItemEvent; diff --git a/Libraries/Core/Callbacks/ItemEventCallbacks.cs b/Libraries/Core/Callbacks/ItemEventCallbacks.cs index d43f40e5..0a2a8cd4 100644 --- a/Libraries/Core/Callbacks/ItemEventCallbacks.cs +++ b/Libraries/Core/Callbacks/ItemEventCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Eft.ItemEvent; using Core.Models.Enums; using Core.Routers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -20,21 +20,29 @@ public class ItemEventCallbacks(HttpResponseUtil _httpResponseUtil, ItemEventRou } /// - /// Return true if the passed in list of warnings contains critical issues + /// Return true if the passed in list of warnings contains critical issues /// /// The list of warnings to check for critical errors /// public bool IsCriticalError(List? warnings) { - if (warnings is null) return false; + if (warnings is null) + { + return false; + } // List of non-critical error codes, we return true if any error NOT included is passed in - var nonCriticalErrorCodes = new List { BackendErrorCodes.NotEnoughSpace }; + var nonCriticalErrorCodes = new List + { + BackendErrorCodes.NotEnoughSpace + }; foreach (var warning in warnings) { if (!nonCriticalErrorCodes.Contains(warning.Code ?? BackendErrorCodes.None)) + { return true; + } } return false; @@ -44,6 +52,5 @@ public class ItemEventCallbacks(HttpResponseUtil _httpResponseUtil, ItemEventRou { // Cast int to string to get the error code of 220 for Unknown Error. return warnings.FirstOrDefault()?.Code is null ? BackendErrorCodes.UnknownError : warnings.FirstOrDefault()?.Code ?? BackendErrorCodes.UnknownError; - } } diff --git a/Libraries/Core/Callbacks/LauncherCallbacks.cs b/Libraries/Core/Callbacks/LauncherCallbacks.cs index 37c30082..2b9fc0d0 100644 --- a/Libraries/Core/Callbacks/LauncherCallbacks.cs +++ b/Libraries/Core/Callbacks/LauncherCallbacks.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.Launcher; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; diff --git a/Libraries/Core/Callbacks/LauncherV2Callbacks.cs b/Libraries/Core/Callbacks/LauncherV2Callbacks.cs index cfb8fff8..f27e04e9 100644 --- a/Libraries/Core/Callbacks/LauncherV2Callbacks.cs +++ b/Libraries/Core/Callbacks/LauncherV2Callbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Launcher; using Core.Models.Spt.Launcher; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; diff --git a/Libraries/Core/Callbacks/LocationCallbacks.cs b/Libraries/Core/Callbacks/LocationCallbacks.cs index e9a76430..2b14a456 100644 --- a/Libraries/Core/Callbacks/LocationCallbacks.cs +++ b/Libraries/Core/Callbacks/LocationCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.Location; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -13,7 +13,7 @@ public class LocationCallbacks( ) { /// - /// Handle client/locations + /// Handle client/locations /// /// /// @@ -25,7 +25,7 @@ public class LocationCallbacks( } /// - /// Handle client/airdrop/loot + /// Handle client/airdrop/loot /// /// /// diff --git a/Libraries/Core/Callbacks/MatchCallbacks.cs b/Libraries/Core/Callbacks/MatchCallbacks.cs index 7494bbb9..00fbe392 100644 --- a/Libraries/Core/Callbacks/MatchCallbacks.cs +++ b/Libraries/Core/Callbacks/MatchCallbacks.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.Match; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using static Core.Services.MatchLocationService; namespace Core.Callbacks; @@ -16,7 +16,7 @@ public class MatchCallbacks( ) { /// - /// Handle client/match/updatePing + /// Handle client/match/updatePing /// /// /// @@ -28,7 +28,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/exit + /// Handle client/match/exit /// /// /// @@ -40,7 +40,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/exit_from_menu + /// Handle client/match/group/exit_from_menu /// /// /// @@ -52,7 +52,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/current + /// Handle client/match/group/current /// /// /// @@ -60,11 +60,16 @@ public class MatchCallbacks( /// public string GroupCurrent(string url, EmptyRequestData info, string sessionID) { - return _httpResponseUtil.GetBody(new MatchGroupCurrentResponse { Squad = [] }); + return _httpResponseUtil.GetBody( + new MatchGroupCurrentResponse + { + Squad = [] + } + ); } /// - /// Handle client/match/group/looking/start + /// Handle client/match/group/looking/start /// /// /// @@ -76,7 +81,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/looking/stop + /// Handle client/match/group/looking/stop /// /// /// @@ -88,7 +93,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/invite/send + /// Handle client/match/group/invite/send /// /// /// @@ -100,7 +105,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/invite/accept + /// Handle client/match/group/invite/accept /// /// /// @@ -108,11 +113,16 @@ public class MatchCallbacks( /// public string AcceptGroupInvite(string url, RequestIdRequest info, string sessionID) { - return _httpResponseUtil.GetBody(new List() { new() }); + return _httpResponseUtil.GetBody( + new List + { + new() + } + ); } /// - /// Handle client/match/group/invite/decline + /// Handle client/match/group/invite/decline /// /// /// @@ -124,7 +134,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/invite/cancel + /// Handle client/match/group/invite/cancel /// /// /// @@ -136,7 +146,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/transfer + /// Handle client/match/group/transfer /// /// /// @@ -148,7 +158,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/invite/cancel-all + /// Handle client/match/group/invite/cancel-all /// /// /// @@ -160,7 +170,7 @@ public class MatchCallbacks( } /// - /// Handle client/putMetrics + /// Handle client/putMetrics /// /// /// @@ -172,7 +182,7 @@ public class MatchCallbacks( } /// - /// Handle client/analytics/event-disconnect + /// Handle client/analytics/event-disconnect /// /// /// @@ -184,7 +194,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/available + /// Handle client/match/available /// /// /// @@ -196,7 +206,7 @@ public class MatchCallbacks( } /// - /// Handle match/group/start_game + /// Handle match/group/start_game /// /// /// @@ -208,7 +218,7 @@ public class MatchCallbacks( } /// - /// Handle client/getMetricsConfig + /// Handle client/getMetricsConfig /// /// /// @@ -220,8 +230,8 @@ public class MatchCallbacks( } /// - /// Called periodically while in a group - /// Handle client/match/group/status + /// Called periodically while in a group + /// Handle client/match/group/status /// /// /// @@ -233,7 +243,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/delete + /// Handle client/match/group/delete /// /// /// @@ -246,7 +256,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/leave + /// Handle client/match/group/leave /// /// /// @@ -258,7 +268,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/player/remove + /// Handle client/match/group/player/remove /// /// /// @@ -270,7 +280,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/local/start + /// Handle client/match/local/start /// /// /// @@ -282,7 +292,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/local/end + /// Handle client/match/local/end /// /// /// @@ -295,7 +305,7 @@ public class MatchCallbacks( } /// - /// Handle client/raid/configuration + /// Handle client/raid/configuration /// /// /// @@ -308,7 +318,7 @@ public class MatchCallbacks( } /// - /// Handle client/raid/configuration-by-profile + /// Handle client/raid/configuration-by-profile /// /// /// @@ -320,7 +330,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/raid/ready + /// Handle client/match/group/raid/ready /// /// /// @@ -332,7 +342,7 @@ public class MatchCallbacks( } /// - /// Handle client/match/group/raid/not-ready + /// Handle client/match/group/raid/not-ready /// /// /// diff --git a/Libraries/Core/Callbacks/NoteCallbacks.cs b/Libraries/Core/Callbacks/NoteCallbacks.cs index c5ebbf6d..76e29c6f 100644 --- a/Libraries/Core/Callbacks/NoteCallbacks.cs +++ b/Libraries/Core/Callbacks/NoteCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Notes; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -10,7 +10,7 @@ namespace Core.Callbacks; public class NoteCallbacks(NoteController _noteController) { /// - /// Handle AddNote event + /// Handle AddNote event /// /// /// @@ -22,7 +22,7 @@ public class NoteCallbacks(NoteController _noteController) } /// - /// Handle EditNote event + /// Handle EditNote event /// /// /// @@ -34,7 +34,7 @@ public class NoteCallbacks(NoteController _noteController) } /// - /// Handle DeleteNote event + /// Handle DeleteNote event /// /// /// diff --git a/Libraries/Core/Callbacks/NotifierCallbacks.cs b/Libraries/Core/Callbacks/NotifierCallbacks.cs index 97adf5f6..2818916b 100644 --- a/Libraries/Core/Callbacks/NotifierCallbacks.cs +++ b/Libraries/Core/Callbacks/NotifierCallbacks.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Request; using Core.Models.Eft.Notifier; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -14,7 +14,7 @@ public class NotifierCallbacks( ) { /// - /// Handle client/notifier/channel/create + /// Handle client/notifier/channel/create /// /// /// @@ -26,7 +26,7 @@ public class NotifierCallbacks( } /// - /// Handle client/game/profile/select + /// Handle client/game/profile/select /// /// /// @@ -34,11 +34,15 @@ public class NotifierCallbacks( /// public string SelectProfile(string url, UIDRequestData info, string sessionID) { - return _httpResponseUtil.GetBody(new SelectProfileResponse { Status = "ok" }); + return _httpResponseUtil.GetBody( + new SelectProfileResponse + { + Status = "ok" + } + ); } /// - /// /// /// /// diff --git a/Libraries/Core/Callbacks/PresetCallbacks.cs b/Libraries/Core/Callbacks/PresetCallbacks.cs index 96209026..641d122a 100644 --- a/Libraries/Core/Callbacks/PresetCallbacks.cs +++ b/Libraries/Core/Callbacks/PresetCallbacks.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.DI; +using SptCommon.Annotations; namespace Core.Callbacks; diff --git a/Libraries/Core/Callbacks/PrestigeCallbacks.cs b/Libraries/Core/Callbacks/PrestigeCallbacks.cs index b6000b6b..5ae586b4 100644 --- a/Libraries/Core/Callbacks/PrestigeCallbacks.cs +++ b/Libraries/Core/Callbacks/PrestigeCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.Prestige; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -13,7 +13,7 @@ public class PrestigeCallbacks( ) { /// - /// Handle client/prestige/list + /// Handle client/prestige/list /// /// /// @@ -25,7 +25,7 @@ public class PrestigeCallbacks( } /// - /// Handle client/prestige/obtain + /// Handle client/prestige/obtain /// /// /// diff --git a/Libraries/Core/Callbacks/ProfileCallbacks.cs b/Libraries/Core/Callbacks/ProfileCallbacks.cs index 5844ce89..9b575892 100644 --- a/Libraries/Core/Callbacks/ProfileCallbacks.cs +++ b/Libraries/Core/Callbacks/ProfileCallbacks.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Helpers; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Launcher; using Core.Models.Eft.Profile; using Core.Models.Enums; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -23,7 +23,12 @@ public class ProfileCallbacks( public string CreateProfile(string url, ProfileCreateRequestData info, string sessionID) { var id = _profileController.CreateProfile(info, sessionID); - return _httpResponse.GetBody(new CreateProfileResponse { UserId = id }); + return _httpResponse.GetBody( + new CreateProfileResponse + { + UserId = id + } + ); } /** @@ -46,7 +51,12 @@ public class ProfileCallbacks( */ public string RegenerateScav(string url, EmptyRequestData info, string sessionID) { - return _httpResponse.GetBody(new List { _profileController.GeneratePlayerScav(sessionID) }); + return _httpResponse.GetBody( + new List + { + _profileController.GeneratePlayerScav(sessionID) + } + ); } /** @@ -70,7 +80,13 @@ public class ProfileCallbacks( { "taken" => _httpResponse.GetBody(null, BackendErrorCodes.NicknameNotUnique, "The nickname is already in use"), "tooshort" => _httpResponse.GetBody(null, BackendErrorCodes.NicknameNotValid, "The nickname is too short"), - _ => _httpResponse.GetBody(new { status = 0, nicknamechangedate = _timeUtil.GetTimeStamp() }) + _ => _httpResponse.GetBody( + new + { + status = 0, + nicknamechangedate = _timeUtil.GetTimeStamp() + } + ) }; } @@ -85,7 +101,12 @@ public class ProfileCallbacks( { "taken" => _httpResponse.GetBody(null, BackendErrorCodes.NicknameNotUnique, "The nickname is already in use"), "tooshort" => _httpResponse.GetBody(null, BackendErrorCodes.NicknameNotValid, "The nickname is too short"), - _ => _httpResponse.GetBody(new { status = "ok" }) + _ => _httpResponse.GetBody( + new + { + status = "ok" + } + ) }; } @@ -95,7 +116,10 @@ public class ProfileCallbacks( public string GetReservedNickname(string url, EmptyRequestData info, string sessionID) { var fullProfile = _profileHelper.GetFullProfile(sessionID); - if (fullProfile?.ProfileInfo?.Username is not null) return _httpResponse.GetBody(fullProfile?.ProfileInfo?.Username); + if (fullProfile?.ProfileInfo?.Username is not null) + { + return _httpResponse.GetBody(fullProfile?.ProfileInfo?.Username); + } return _httpResponse.GetBody("SPTarkov"); } diff --git a/Libraries/Core/Callbacks/QuestCallbacks.cs b/Libraries/Core/Callbacks/QuestCallbacks.cs index b64b72f9..784734d7 100644 --- a/Libraries/Core/Callbacks/QuestCallbacks.cs +++ b/Libraries/Core/Callbacks/QuestCallbacks.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Quests; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -15,7 +15,7 @@ public class QuestCallbacks( ) { /// - /// Handle RepeatableQuestChange event + /// Handle RepeatableQuestChange event /// /// /// @@ -27,7 +27,7 @@ public class QuestCallbacks( } /// - /// Handle QuestAccept event + /// Handle QuestAccept event /// /// /// @@ -36,13 +36,15 @@ public class QuestCallbacks( public ItemEventRouterResponse AcceptQuest(PmcData pmcData, AcceptQuestRequestData info, string sessionID) { if (info.Type == "repeatable") + { return _questController.AcceptRepeatableQuest(pmcData, info, sessionID); + } return _questController.AcceptQuest(pmcData, info, sessionID); } /// - /// Handle QuestComplete event + /// Handle QuestComplete event /// /// /// @@ -54,7 +56,7 @@ public class QuestCallbacks( } /// - /// Handle QuestHandover event + /// Handle QuestHandover event /// /// /// @@ -66,7 +68,7 @@ public class QuestCallbacks( } /// - /// Handle client/quest/list + /// Handle client/quest/list /// /// /// @@ -78,7 +80,7 @@ public class QuestCallbacks( } /// - /// Handle client/repeatalbeQuests/activityPeriods + /// Handle client/repeatalbeQuests/activityPeriods /// /// /// diff --git a/Libraries/Core/Callbacks/RagfairCallbacks.cs b/Libraries/Core/Callbacks/RagfairCallbacks.cs index 8875b0a4..7e0532e2 100644 --- a/Libraries/Core/Callbacks/RagfairCallbacks.cs +++ b/Libraries/Core/Callbacks/RagfairCallbacks.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Controllers; using Core.DI; using Core.Models.Eft.Common; @@ -8,6 +7,7 @@ using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -23,7 +23,7 @@ public class RagfairCallbacks( ConfigServer _configServer ) : OnLoad, OnUpdate { - private RagfairConfig _ragfairConfig = _configServer.GetConfig(); + private readonly RagfairConfig _ragfairConfig = _configServer.GetConfig(); public Task OnLoad() { @@ -57,8 +57,8 @@ public class RagfairCallbacks( } /// - /// Handle client/ragfair/search - /// Handle client/ragfair/find + /// Handle client/ragfair/search + /// Handle client/ragfair/find /// /// /// @@ -70,7 +70,7 @@ public class RagfairCallbacks( } /// - /// Handle client/ragfair/itemMarketPrice + /// Handle client/ragfair/itemMarketPrice /// /// /// @@ -82,7 +82,7 @@ public class RagfairCallbacks( } /// - /// Handle RagFairAddOffer event + /// Handle RagFairAddOffer event /// /// /// @@ -94,7 +94,7 @@ public class RagfairCallbacks( } /// - /// Handle RagFairRemoveOffer event + /// Handle RagFairRemoveOffer event /// /// /// @@ -106,7 +106,7 @@ public class RagfairCallbacks( } /// - /// Handle RagFairRenewOffer event + /// Handle RagFairRenewOffer event /// /// /// @@ -118,8 +118,8 @@ public class RagfairCallbacks( } /// - /// Handle /client/items/prices - /// Called when clicking an item to list on flea + /// Handle /client/items/prices + /// Called when clicking an item to list on flea /// /// /// @@ -131,7 +131,7 @@ public class RagfairCallbacks( } /// - /// Handle client/reports/ragfair/send + /// Handle client/reports/ragfair/send /// /// /// @@ -149,7 +149,7 @@ public class RagfairCallbacks( } /// - /// Handle client/ragfair/offer/findbyid + /// Handle client/ragfair/offer/findbyid /// /// /// diff --git a/Libraries/Core/Callbacks/RepairCallbacks.cs b/Libraries/Core/Callbacks/RepairCallbacks.cs index 9082c99c..4ac608b2 100644 --- a/Libraries/Core/Callbacks/RepairCallbacks.cs +++ b/Libraries/Core/Callbacks/RepairCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Repair; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -10,8 +10,8 @@ namespace Core.Callbacks; public class RepairCallbacks(RepairController _repairController) { /// - /// Handle TraderRepair event - /// use trader to repair item + /// Handle TraderRepair event + /// use trader to repair item /// /// /// @@ -23,8 +23,8 @@ public class RepairCallbacks(RepairController _repairController) } /// - /// Handle Repair event - /// Use repair kit to repair item + /// Handle Repair event + /// Use repair kit to repair item /// /// /// diff --git a/Libraries/Core/Callbacks/SaveCallbacks.cs b/Libraries/Core/Callbacks/SaveCallbacks.cs index 43fab8e1..346d4693 100644 --- a/Libraries/Core/Callbacks/SaveCallbacks.cs +++ b/Libraries/Core/Callbacks/SaveCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.Spt.Config; using Core.Servers; using Core.Services; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -23,6 +23,11 @@ public class SaveCallbacks( _saveServer.Load(); } + public string GetRoute() + { + return "spt-save"; + } + public bool OnUpdate(long secondsSinceLastRun) { if (secondsSinceLastRun > _coreConfig.ProfileSaveIntervalInSeconds) @@ -33,9 +38,4 @@ public class SaveCallbacks( return false; } - - public string GetRoute() - { - return "spt-save"; - } } diff --git a/Libraries/Core/Callbacks/TradeCallbacks.cs b/Libraries/Core/Callbacks/TradeCallbacks.cs index a063338e..1cb6bbd3 100644 --- a/Libraries/Core/Callbacks/TradeCallbacks.cs +++ b/Libraries/Core/Callbacks/TradeCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Trade; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -10,7 +10,7 @@ namespace Core.Callbacks; public class TradeCallbacks(TradeController _tradeController) { /// - /// Handle client/game/profile/items/moving TradingConfirm event + /// Handle client/game/profile/items/moving TradingConfirm event /// /// /// @@ -22,7 +22,7 @@ public class TradeCallbacks(TradeController _tradeController) } /// - /// Handle RagFairBuyOffer event + /// Handle RagFairBuyOffer event /// /// /// @@ -34,7 +34,7 @@ public class TradeCallbacks(TradeController _tradeController) } /// - /// Handle SellAllFromSavage event + /// Handle SellAllFromSavage event /// /// /// diff --git a/Libraries/Core/Callbacks/TraderCallbacks.cs b/Libraries/Core/Callbacks/TraderCallbacks.cs index 8379df49..14a4a72b 100644 --- a/Libraries/Core/Callbacks/TraderCallbacks.cs +++ b/Libraries/Core/Callbacks/TraderCallbacks.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Spt.Config; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -25,18 +25,18 @@ public class TraderCallbacks( return Task.CompletedTask; } - public bool OnUpdate(long _) - { - return _traderController.Update(); - } - public string GetRoute() { return "spt-traders"; } + public bool OnUpdate(long _) + { + return _traderController.Update(); + } + /// - /// Handle client/trading/api/traderSettings + /// Handle client/trading/api/traderSettings /// /// /// @@ -48,7 +48,7 @@ public class TraderCallbacks( } /// - /// Handle client/trading/api/getTrader + /// Handle client/trading/api/getTrader /// /// /// @@ -61,7 +61,7 @@ public class TraderCallbacks( } /// - /// Handle client/trading/api/getTraderAssort + /// Handle client/trading/api/getTraderAssort /// /// /// @@ -74,7 +74,7 @@ public class TraderCallbacks( } /// - /// Handle /singleplayer/moddedTraders + /// Handle /singleplayer/moddedTraders /// /// /// diff --git a/Libraries/Core/Callbacks/WeatherCallbacks.cs b/Libraries/Core/Callbacks/WeatherCallbacks.cs index f7ba10cc..e216abdb 100644 --- a/Libraries/Core/Callbacks/WeatherCallbacks.cs +++ b/Libraries/Core/Callbacks/WeatherCallbacks.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -12,7 +12,7 @@ public class WeatherCallbacks( ) { /// - /// Handle client/weather + /// Handle client/weather /// /// /// @@ -24,7 +24,7 @@ public class WeatherCallbacks( } /// - /// Handle client/localGame/weather + /// Handle client/localGame/weather /// /// /// diff --git a/Libraries/Core/Callbacks/WishlistCallbacks.cs b/Libraries/Core/Callbacks/WishlistCallbacks.cs index 843ad9ae..86a0026e 100644 --- a/Libraries/Core/Callbacks/WishlistCallbacks.cs +++ b/Libraries/Core/Callbacks/WishlistCallbacks.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Controllers; +using Core.Controllers; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Wishlist; +using SptCommon.Annotations; namespace Core.Callbacks; @@ -10,7 +10,7 @@ namespace Core.Callbacks; public class WishlistCallbacks(WishlistController _wishlistController) { /// - /// Handle AddToWishList event + /// Handle AddToWishList event /// /// /// @@ -22,7 +22,7 @@ public class WishlistCallbacks(WishlistController _wishlistController) } /// - /// Handle RemoveFromWishList event + /// Handle RemoveFromWishList event /// /// /// @@ -34,7 +34,7 @@ public class WishlistCallbacks(WishlistController _wishlistController) } /// - /// Handle ChangeWishlistItemCategory + /// Handle ChangeWishlistItemCategory /// /// /// diff --git a/Libraries/Core/Context/ApplicationContext.cs b/Libraries/Core/Context/ApplicationContext.cs index 9f5785c4..cfc6c979 100644 --- a/Libraries/Core/Context/ApplicationContext.cs +++ b/Libraries/Core/Context/ApplicationContext.cs @@ -14,7 +14,9 @@ public class ApplicationContext lock (variablesLock) { if (variables.TryGetValue(type, out var savedValues)) + { return savedValues.Last!.Value; + } } return null; @@ -25,7 +27,10 @@ public class ApplicationContext lock (variablesLock) { var values = new List(); - if (variables.TryGetValue(type, out var savedValues)) values.AddRange(savedValues); + if (variables.TryGetValue(type, out var savedValues)) + { + values.AddRange(savedValues); + } return values; } @@ -42,7 +47,9 @@ public class ApplicationContext } if (savedValues.Count >= MaxSavedValues) + { savedValues.RemoveFirst(); + } savedValues.AddLast(new ContextVariable(value, type)); } diff --git a/Libraries/Core/Context/ContextVariable.cs b/Libraries/Core/Context/ContextVariable.cs index 46a3ef35..45765de4 100644 --- a/Libraries/Core/Context/ContextVariable.cs +++ b/Libraries/Core/Context/ContextVariable.cs @@ -6,7 +6,7 @@ public class ContextVariable(object value, ContextVariableType contextVariableIn public T GetValue() { - return (T)value; + return (T) value; } public DateTime GetTimestamp() diff --git a/Libraries/Core/Context/ContextVariableType.cs b/Libraries/Core/Context/ContextVariableType.cs index 3221f1fc..b57f38e1 100644 --- a/Libraries/Core/Context/ContextVariableType.cs +++ b/Libraries/Core/Context/ContextVariableType.cs @@ -2,20 +2,30 @@ public enum ContextVariableType { - /** Logged in users session id */ + /** + * Logged in users session id + */ SESSION_ID = 0, - /** Currently acive raid information */ + /** + * Currently acive raid information + */ RAID_CONFIGURATION = 1, - /** SessionID + Timestamp when client first connected, has _ between values */ + /** + * SessionID + Timestamp when client first connected, has _ between values + */ CLIENT_START_TIMESTAMP = 2, - /** When player is loading into map and loot is requested */ + /** + * When player is loading into map and loot is requested + */ REGISTER_PLAYER_REQUEST = 3, RAID_ADJUSTMENTS = 4, - /** Data returned from client request object from endLocalRaid() */ + /** + * Data returned from client request object from endLocalRaid() + */ TRANSIT_INFO = 5, APP_BUILDER = 6, LOADED_MOD_ASSEMBLIES = 7, diff --git a/Libraries/Core/Controllers/AchievementController.cs b/Libraries/Core/Controllers/AchievementController.cs index bdeb3771..c449bfa6 100644 --- a/Libraries/Core/Controllers/AchievementController.cs +++ b/Libraries/Core/Controllers/AchievementController.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Eft.Profile; using Core.Services; +using SptCommon.Annotations; namespace Core.Controllers; @@ -23,8 +23,12 @@ public class AchievementController( var stats = new Dictionary(); foreach (var achievement in achievements) + { if (achievement.Id != null) + { stats.Add(achievement.Id, 0); + } + } return new CompletedAchievementsResponse { diff --git a/Libraries/Core/Controllers/BotController.cs b/Libraries/Core/Controllers/BotController.cs index 93d8c027..dae9d175 100644 --- a/Libraries/Core/Controllers/BotController.cs +++ b/Libraries/Core/Controllers/BotController.cs @@ -1,4 +1,5 @@ -using SptCommon.Annotations; +using System.Diagnostics; +using System.Text.Json.Serialization; using Core.Context; using Core.Generators; using Core.Helpers; @@ -14,11 +15,9 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; using LogLevel = Core.Models.Spt.Logging.LogLevel; -using System.Diagnostics; -using System.Text.Json.Serialization; -using Microsoft.Extensions.Logging; namespace Core.Controllers; @@ -48,11 +47,14 @@ public class BotController( public int? GetBotPresetGenerationLimit(string type) { var typeInLower = type.ToLower(); - var value = (int?)typeof(PresetBatch).GetProperties() + var value = (int?) typeof(PresetBatch).GetProperties() .First(p => p.Name.ToLower() == (typeInLower == "assaultgroup" ? "assault" : typeInLower)) .GetValue(_botConfig.PresetBatch); - if (value != null) return value; + if (value != null) + { + return value; + } _logger.Warning(_localisationService.GetText("bot-bot_preset_count_value_missing", type)); return 30; @@ -67,12 +69,18 @@ public class BotController( { var difficulty = diffLevel.ToLower(); - if (!(raidConfig != null || ignoreRaidSettings)) _logger.Error(_localisationService.GetText("bot-missing_application_context", "RAID_CONFIGURATION")); + if (!(raidConfig != null || ignoreRaidSettings)) + { + _logger.Error(_localisationService.GetText("bot-missing_application_context", "RAID_CONFIGURATION")); + } // Check value chosen in pre-raid difficulty dropdown // If value is not 'asonline', change requested difficulty to be what was chosen in dropdown var botDifficultyDropDownValue = raidConfig?.WavesSettings?.BotDifficulty?.ToString().ToLower() ?? "asonline"; - if (botDifficultyDropDownValue != "asonline") difficulty = _botDifficultyHelper.ConvertBotDifficultyDropdownToBotDifficulty(botDifficultyDropDownValue); + if (botDifficultyDropDownValue != "asonline") + { + difficulty = _botDifficultyHelper.ConvertBotDifficultyDropdownToBotDifficulty(botDifficultyDropDownValue); + } var botDb = _databaseService.GetBots(); return _botDifficultyHelper.GetBotDifficultySettings(type, difficulty, botDb); @@ -87,7 +95,10 @@ public class BotController( var botTypes = Enum.GetValues().Select(item => item.ToString()).ToList(); foreach (var botType in botTypes) { - if (botTypesDb is null) continue; + if (botTypesDb is null) + { + continue; + } // If bot is usec/bear, swap to different name var botTypeLower = _botHelper.IsBotPmc(botType) @@ -101,7 +112,11 @@ public class BotController( { // No bot of this type found, copy details from assault result[botTypeLower] = result["assault"]; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Unable to find bot: {botTypeLower} in db, copying 'assault'"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Unable to find bot: {botTypeLower} in db, copying 'assault'"); + } + continue; } @@ -116,7 +131,10 @@ public class BotController( foreach (var (difficultyName, _) in botDetails.BotDifficulty) { // Bot doesn't exist in result, add - if (!result.ContainsKey(botNameKey)) result.TryAdd(botNameKey, new Dictionary()); + if (!result.ContainsKey(botNameKey)) + { + result.TryAdd(botNameKey, new Dictionary()); + } // Store all difficulty values in dict keyed by difficulty type e.g. easy/normal/impossible result[botNameKey].Add(difficultyName, GetBotDifficulty(botNameKey, difficultyName, null, true)); @@ -148,6 +166,7 @@ public class BotController( var tasks = new List(); // Map conditions to promises for bot generation foreach (var condition in request.Conditions ?? []) + { tasks.Add( Task.Factory.StartNew( () => @@ -166,10 +185,14 @@ public class BotController( } ) ); + } Task.WaitAll(tasks.ToArray()); stopwatch.Stop(); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to GenerateMultipleBotsAndCache"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to GenerateMultipleBotsAndCache"); + } return []; } @@ -197,7 +220,11 @@ public class BotController( if (botCacheCount >= botGenerationDetails.BotCountToGenerate) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Cache already has sufficient {cacheKey} bots: {botCacheCount}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Cache already has sufficient {cacheKey} bots: {botCacheCount}"); + } + return; } @@ -205,9 +232,13 @@ public class BotController( var botsToGenerate = botGenerationDetails.BotCountToGenerate - botCacheCount; var progressWriter = new ProgressWriter(botGenerationDetails.BotCountToGenerate.GetValueOrDefault(30)); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Generating {botsToGenerate} bots for cacheKey: {cacheKey}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Generating {botsToGenerate} bots for cacheKey: {cacheKey}"); + } for (var i = 0; i < botsToGenerate; i++) + { try { var detailsClone = _cloner.Clone(botGenerationDetails); @@ -218,12 +249,15 @@ public class BotController( { _logger.Error($"Failed to generate bot: {botGenerationDetails.Role} #{i + 1}: {e.Message}"); } + } if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Generated {botGenerationDetails.BotCountToGenerate} {botGenerationDetails.Role}" + $"({botGenerationDetails.EventRole ?? botGenerationDetails.Role ?? ""}) {botGenerationDetails.BotDifficulty}bots" ); + } } private List ReturnSingleBotFromCache(string sessionId, GenerateBotsRequestData request) @@ -289,8 +323,12 @@ public class BotController( var bossConvertPercent = bossConvertMinMax.GetByJsonProp(requestedBot?.Role?.ToLower() ?? string.Empty); if (bossConvertPercent is not null) // Roll a percentage check if we should convert scav to boss + { if (_randomUtil.GetChance100(_randomUtil.GetDouble(bossConvertPercent.Min!.Value, bossConvertPercent.Max!.Value))) + { UpdateBotGenerationDetailsToRandomBoss(botGenerationDetails, bossesToConvertToWeights); + } + } } // Create a compound key to store bots in cache against @@ -306,10 +344,12 @@ public class BotController( GenerateSingleBotAndStoreInCache(botGenerationDetails, sessionId, cacheKey); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Generated {botGenerationDetails.BotCountToGenerate} " + $"{botGenerationDetails.Role} ({botGenerationDetails.EventRole ?? ""}) {botGenerationDetails.BotDifficulty} bots" ); + } } var desiredBot = _botGenerationCacheService.GetBot(cacheKey); @@ -361,7 +401,10 @@ public class BotController( .GetLatestValue(ContextVariableType.RAID_CONFIGURATION) ?.GetValue(); - if (raidSettings is null) _logger.Warning(_localisationService.GetText("bot-unable_to_load_raid_settings_from_appcontext")); + if (raidSettings is null) + { + _logger.Warning(_localisationService.GetText("bot-unable_to_load_raid_settings_from_appcontext")); + } return raidSettings; } @@ -400,9 +443,11 @@ public class BotController( { var botCap = _botConfig.MaxBotCap.FirstOrDefault(x => x.Key.ToLower() == location.ToLower()); if (location == "default") + { _logger.Warning( _localisationService.GetText("bot-no_bot_cap_found_for_location", location.ToLower()) ); + } return botCap.Value; } @@ -421,11 +466,23 @@ public class BotController( public record AiBotBrainTypes { [JsonPropertyName("pmc")] - public Dictionary>> PmcType { get; set; } + public Dictionary>> PmcType + { + get; + set; + } [JsonPropertyName("assault")] - public Dictionary> Assault { get; set; } + public Dictionary> Assault + { + get; + set; + } [JsonPropertyName("playerScav")] - public Dictionary> PlayerScav { get; set; } + public Dictionary> PlayerScav + { + get; + set; + } } diff --git a/Libraries/Core/Controllers/BuildController.cs b/Libraries/Core/Controllers/BuildController.cs index 39884f89..11346266 100644 --- a/Libraries/Core/Controllers/BuildController.cs +++ b/Libraries/Core/Controllers/BuildController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Builds; using Core.Models.Eft.PresetBuild; @@ -10,6 +9,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Controllers; @@ -27,7 +27,7 @@ public class BuildController( ) { /// - /// Handle client/handbook/builds/my/list + /// Handle client/handbook/builds/my/list /// /// /// @@ -37,7 +37,14 @@ public class BuildController( var profile = _profileHelper.GetFullProfile(sessionID); if (profile?.UserBuildData is null) - profile.UserBuildData = new UserBuilds { EquipmentBuilds = [], WeaponBuilds = [], MagazineBuilds = [] }; + { + profile.UserBuildData = new UserBuilds + { + EquipmentBuilds = [], + WeaponBuilds = [], + MagazineBuilds = [] + }; + } // Ensure the secure container in the default presets match what the player has equipped var defaultEquipmentPresetsClone = _cloner.Clone(_databaseService.GetTemplates().DefaultEquipmentPresets) @@ -49,17 +56,23 @@ public class BuildController( ); var firstDefaultItemsSecureContainer = defaultEquipmentPresetsClone? - .FirstOrDefault()?.Items? + .FirstOrDefault() + ?.Items? .FirstOrDefault(x => x.SlotId == secureContainerSlotId); if (playerSecureContainer is not null && playerSecureContainer.Template != firstDefaultItemsSecureContainer?.Template) // Default equipment presets' secure container tpl doesn't match players secure container tpl + { foreach (var defaultPreset in defaultEquipmentPresetsClone) { // Find presets secure container var secureContainer = defaultPreset.Items?.FirstOrDefault(item => item.SlotId == secureContainerSlotId); - if (secureContainer is not null) secureContainer.Template = playerSecureContainer.Template; + if (secureContainer is not null) + { + secureContainer.Template = playerSecureContainer.Template; + } } + } // Clone player build data from profile and append the above defaults onto end var userBuildsClone = _cloner.Clone(profile?.UserBuildData); @@ -71,7 +84,7 @@ public class BuildController( } /// - /// Handle client/builds/weapon/save + /// Handle client/builds/weapon/save /// /// /// @@ -85,7 +98,13 @@ public class BuildController( body.Root = body.Items.FirstOrDefault().Id; // Create new object ready to save into profile userbuilds.weaponBuilds - var newBuild = new WeaponBuild { Id = body.Id, Name = body.Name, Root = body.Root, Items = body.Items }; + var newBuild = new WeaponBuild + { + Id = body.Id, + Name = body.Name, + Root = body.Root, + Items = body.Items + }; var profile = _profileHelper.GetFullProfile(sessionId); @@ -105,7 +124,7 @@ public class BuildController( } /// - /// Handle client/builds/equipment/save event + /// Handle client/builds/equipment/save event /// /// /// @@ -148,18 +167,20 @@ public class BuildController( } /// - /// Handle client/builds/delete + /// Handle client/builds/delete /// /// /// public void RemoveBuild(string sessionId, RemoveBuildRequestData request) { if (request.Id is not null) + { RemovePlayerBuild(request.Id, sessionId); + } } /// - /// Handle client/builds/magazine/save + /// Handle client/builds/magazine/save /// /// /// @@ -179,7 +200,7 @@ public class BuildController( profile.UserBuildData.MagazineBuilds ??= []; - var existingArrayId = profile.UserBuildData.MagazineBuilds.FirstOrDefault((item) => item.Name == request.Name); + var existingArrayId = profile.UserBuildData.MagazineBuilds.FirstOrDefault(item => item.Name == request.Name); if (existingArrayId is not null) { { @@ -192,7 +213,6 @@ public class BuildController( } /// - /// /// /// /// diff --git a/Libraries/Core/Controllers/ClientLogController.cs b/Libraries/Core/Controllers/ClientLogController.cs index 1073d749..7073c2bf 100644 --- a/Libraries/Core/Controllers/ClientLogController.cs +++ b/Libraries/Core/Controllers/ClientLogController.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Spt.Logging; using Core.Models.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Controllers; @@ -11,7 +11,7 @@ public class ClientLogController( ) { /// - /// Handle /singleplayer/log + /// Handle /singleplayer/log /// /// public void ClientLog(ClientLogRequest logRequest) diff --git a/Libraries/Core/Controllers/CustomizationController.cs b/Libraries/Core/Controllers/CustomizationController.cs index 7ee551cd..21b042cf 100644 --- a/Libraries/Core/Controllers/CustomizationController.cs +++ b/Libraries/Core/Controllers/CustomizationController.cs @@ -52,7 +52,10 @@ public class CustomizationController( ) .ToList(); - if (matchingSuits == null) throw new Exception(_localisationService.GetText("customisation-unable_to_get_trader_suits", traderId)); + if (matchingSuits == null) + { + throw new Exception(_localisationService.GetText("customisation-unable_to_get_trader_suits", traderId)); + } return matchingSuits; } @@ -121,14 +124,21 @@ public class CustomizationController( { var suits = _saveServer.GetProfile(sessionId).Suits; - if (suits is null || suits.Count == 0) return false; + if (suits is null || suits.Count == 0) + { + return false; + } + return suits.Contains(suitId); } private Suit? GetTraderClothingOffer(string sessionId, string? offerId) { var foundSuit = GetAllTraderSuits(sessionId).FirstOrDefault(s => s.Id == offerId); - if (foundSuit is null) _logger.Error(_localisationService.GetText("customisation-unable_to_find_suit_with_id", offerId)); + if (foundSuit is null) + { + _logger.Error(_localisationService.GetText("customisation-unable_to_find_suit_with_id", offerId)); + } return foundSuit; } @@ -144,13 +154,23 @@ public class CustomizationController( List? itemsToPayForClothingWith, ItemEventRouterResponse output) { - if (itemsToPayForClothingWith is null || itemsToPayForClothingWith.Count == 0) return; + if (itemsToPayForClothingWith is null || itemsToPayForClothingWith.Count == 0) + { + return; + } foreach (var inventoryItemToProcess in itemsToPayForClothingWith) { var options = new ProcessBuyTradeRequestData { - SchemeItems = [new IdWithCount { Count = inventoryItemToProcess.Count.Value, Id = inventoryItemToProcess.Id }], + SchemeItems = + [ + new IdWithCount + { + Count = inventoryItemToProcess.Count.Value, + Id = inventoryItemToProcess.Id + } + ], TransactionId = Traders.RAGMAN, Action = "BuyCustomization", Type = "", @@ -173,8 +193,12 @@ public class CustomizationController( var result = new List(); foreach (var trader in traders) + { if (trader.Value.Base?.CustomizationSeller is not null && trader.Value.Base.CustomizationSeller.Value) + { result.AddRange(GetTraderSuits(trader.Key, sessionId)); + } + } return result; } @@ -203,7 +227,10 @@ public class CustomizationController( var customisationResultsClone = _cloner.Clone(_databaseService.GetTemplates().CustomisationStorage); var profile = _profileHelper.GetFullProfile(sessionId); - if (profile is null) return customisationResultsClone!; + if (profile is null) + { + return customisationResultsClone!; + } customisationResultsClone!.AddRange(profile.CustomisationUnlocks ?? []); @@ -220,6 +247,7 @@ public class CustomizationController( public ItemEventRouterResponse SetCustomisation(string sessionId, CustomizationSetRequest request, PmcData pmcData) { foreach (var customisation in request.Customizations) + { switch (customisation.Type) { case "dogTag": @@ -232,6 +260,7 @@ public class CustomizationController( _logger.Error($"Unhandled customisation type: {customisation.Type}"); break; } + } return _eventOutputHolder.GetOutput(sessionId); } @@ -263,6 +292,9 @@ public class CustomizationController( } // Feet - if (dbSuit.Parent == _lowerParentClothingId) pmcData.Customization.Feet = dbSuit.Properties.Feet; + if (dbSuit.Parent == _lowerParentClothingId) + { + pmcData.Customization.Feet = dbSuit.Properties.Feet; + } } } diff --git a/Libraries/Core/Controllers/DialogueController.cs b/Libraries/Core/Controllers/DialogueController.cs index 5b5dcb74..0b43bded 100644 --- a/Libraries/Core/Controllers/DialogueController.cs +++ b/Libraries/Core/Controllers/DialogueController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Helpers.Dialogue; using Core.Models.Eft.Dialog; @@ -10,6 +9,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Controllers; @@ -31,29 +31,33 @@ public class DialogueController( protected List _dialogueChatBots = dialogueChatBots.ToList(); /// - /// /// /// public void RegisterChatBot(IDialogueChatBot chatBot) // TODO: this is in with the helper types { if (_dialogueChatBots.Any(cb => cb.GetChatBot().Id == chatBot.GetChatBot().Id)) + { _logger.Error(_localisationService.GetText("dialog-chatbot_id_already_exists", chatBot.GetChatBot().Id)); + } _dialogueChatBots.Add(chatBot); } /// - /// Handle onUpdate spt event + /// Handle onUpdate spt event /// public void Update() { var profiles = _saveServer.GetProfiles(); - foreach (var kvp in profiles) RemoveExpiredItemsFromMessages(kvp.Key); + foreach (var kvp in profiles) + { + RemoveExpiredItemsFromMessages(kvp.Key); + } } /// - /// Handle client/friend/list + /// Handle client/friend/list /// /// session id /// GetFriendListDataResponse @@ -65,10 +69,12 @@ public class DialogueController( // Add any friends the user has after the chatbots var profile = _profileHelper.GetFullProfile(sessionId); if (profile?.FriendProfileIds is not null) + { foreach (var friendId in profile.FriendProfileIds) { var friendProfile = _profileHelper.GetChatRoomMemberFromSessionId(friendId); if (friendProfile is not null) + { friends.Add( new UserDialogInfo { @@ -77,7 +83,9 @@ public class DialogueController( Info = friendProfile.Info } ); + } } + } return new GetFriendListDataResponse { @@ -96,29 +104,35 @@ public class DialogueController( foreach (var bot in _dialogueChatBots) { var botData = bot.GetChatBot(); - if (chatBotConfig.EnabledBots.ContainsKey(botData.Id!)) activeBots.Add(botData); + if (chatBotConfig.EnabledBots.ContainsKey(botData.Id!)) + { + activeBots.Add(botData); + } } return activeBots; } /// - /// Handle client/mail/dialog/list - /// Create array holding trader dialogs and mail interactions with player - /// Set the content of the dialogue on the list tab. + /// Handle client/mail/dialog/list + /// Create array holding trader dialogs and mail interactions with player + /// Set the content of the dialogue on the list tab. /// /// Session Id /// list of dialogs public List GenerateDialogueList(string sessionId) { var data = new List(); - foreach (var dialogueId in _dialogueHelper.GetDialogsForProfile(sessionId)) data.Add(GetDialogueInfo(dialogueId.Key, sessionId)); + foreach (var dialogueId in _dialogueHelper.GetDialogsForProfile(sessionId)) + { + data.Add(GetDialogueInfo(dialogueId.Key, sessionId)); + } return data; } /// - /// Get the content of a dialogue + /// Get the content of a dialogue /// /// Dialog id /// Session Id @@ -145,7 +159,7 @@ public class DialogueController( } /// - /// Get the users involved in a dialog (player + other party) + /// Get the users involved in a dialog (player + other party) /// /// The dialog to check for users /// What type of message is being sent @@ -162,6 +176,7 @@ public class DialogueController( if (messageType == MessageType.USER_MESSAGE && dialog?.Users is not null && dialog.Users.All(userDialog => userDialog.Id != profile.CharacterData?.PmcData?.SessionId)) + { dialog.Users.Add( new UserDialogInfo { @@ -177,15 +192,16 @@ public class DialogueController( } } ); + } return dialog?.Users!; } /// - /// Handle client/mail/dialog/view - /// Handle player clicking 'messenger' and seeing all the messages they've received - /// Set the content of the dialogue on the details panel, showing all the messages - /// for the specified dialogue. + /// Handle client/mail/dialog/view + /// Handle player clicking 'messenger' and seeing all the messages they've received + /// Set the content of the dialogue on the details panel, showing all the messages + /// for the specified dialogue. /// /// Get dialog request /// Session id @@ -213,7 +229,7 @@ public class DialogueController( } /// - /// Get dialog from player profile, create if doesn't exist + /// Get dialog from player profile, create if doesn't exist /// /// Player profile /// get dialog request @@ -223,7 +239,9 @@ public class DialogueController( GetMailDialogViewRequestData request) { if (profile.DialogueRecords is null || profile.DialogueRecords.ContainsKey(request.DialogId!)) + { return profile.DialogueRecords?[request.DialogId!] ?? throw new NullReferenceException(); + } profile.DialogueRecords[request.DialogId!] = new Dialogue { @@ -235,13 +253,19 @@ public class DialogueController( Type = request.Type }; - if (request.Type != MessageType.USER_MESSAGE) return profile.DialogueRecords[request.DialogId!]; + if (request.Type != MessageType.USER_MESSAGE) + { + return profile.DialogueRecords[request.DialogId!]; + } var dialogue = profile.DialogueRecords[request.DialogId!]; dialogue.Users = []; var chatBot = _dialogueChatBots.FirstOrDefault(cb => cb.GetChatBot().Id == request.DialogId); - if (chatBot is null) return profile.DialogueRecords[request.DialogId!]; + if (chatBot is null) + { + return profile.DialogueRecords[request.DialogId!]; + } dialogue.Users ??= []; dialogue.Users.Add(chatBot.GetChatBot()); @@ -250,7 +274,7 @@ public class DialogueController( } /// - /// Get the users involved in a mail between two entities + /// Get the users involved in a mail between two entities /// /// Player profile /// The participants of the mail @@ -260,11 +284,16 @@ public class DialogueController( List result = []; if (userDialogs is null) // Nothing to add + { return result; + } result.AddRange(userDialogs); - if (result.Any(userDialog => userDialog.Id == fullProfile.ProfileInfo?.ProfileId)) return result; + if (result.Any(userDialog => userDialog.Id == fullProfile.ProfileInfo?.ProfileId)) + { + return result; + } // Player doesn't exist, add them in before returning var pmcProfile = fullProfile.CharacterData?.PmcData; @@ -288,7 +317,7 @@ public class DialogueController( } /// - /// Get a count of messages with attachments from a particular dialog + /// Get a count of messages with attachments from a particular dialog /// /// Session id /// Dialog id @@ -300,8 +329,12 @@ public class DialogueController( var newAttachmentCount = 0; var activeMessages = GetActiveMessagesFromDialog(sessionId, dialogueId); foreach (var message in activeMessages) + { if (message.HasRewards.GetValueOrDefault(false) && !message.RewardCollected.GetValueOrDefault(false)) + { newAttachmentCount++; + } + } return newAttachmentCount; } @@ -321,7 +354,7 @@ public class DialogueController( } /// - /// Does list have messages with uncollected rewards (includes expired rewards) + /// Does list have messages with uncollected rewards (includes expired rewards) /// /// Messages to check /// true if uncollected rewards found @@ -331,8 +364,8 @@ public class DialogueController( } /// - /// Handle client/mail/dialog/remove - /// Remove an entire dialog with an entity (trader/user) + /// Handle client/mail/dialog/remove + /// Remove an entire dialog with an entity (trader/user) /// /// id of the dialog to remove /// Player id @@ -362,7 +395,7 @@ public class DialogueController( } /// - /// Handle client/mail/dialog/pin && Handle client/mail/dialog/unpin + /// Handle client/mail/dialog/pin && Handle client/mail/dialog/unpin /// /// /// @@ -390,8 +423,8 @@ public class DialogueController( } /// - /// Handle client/mail/dialog/read - /// Set a dialog to be read (no number alert/attachment alert) + /// Handle client/mail/dialog/read + /// Set a dialog to be read (no number alert/attachment alert) /// /// Dialog ids to set as read /// Player profile id @@ -421,8 +454,8 @@ public class DialogueController( } /// - /// Handle client/mail/dialog/getAllAttachments - /// Get all uncollected items attached to mail in a particular dialog + /// Handle client/mail/dialog/getAllAttachments + /// Get all uncollected items attached to mail in a particular dialog /// /// Dialog to get mail attachments from /// Session id @@ -455,7 +488,7 @@ public class DialogueController( } /// - /// handle client/mail/msg/send + /// handle client/mail/msg/send /// /// /// @@ -476,7 +509,7 @@ public class DialogueController( } /// - /// Return list of messages with uncollected items (includes expired) + /// Return list of messages with uncollected items (includes expired) /// /// Messages to parse /// messages with items to collect @@ -486,27 +519,37 @@ public class DialogueController( } /// - /// Delete expired items from all messages in player profile. triggers when updating traders. + /// Delete expired items from all messages in player profile. triggers when updating traders. /// /// Session id private void RemoveExpiredItemsFromMessages(string sessionId) { - foreach (var dialogueId in _dialogueHelper.GetDialogsForProfile(sessionId)) RemoveExpiredItemsFromMessage(sessionId, dialogueId.Key); + foreach (var dialogueId in _dialogueHelper.GetDialogsForProfile(sessionId)) + { + RemoveExpiredItemsFromMessage(sessionId, dialogueId.Key); + } } /// - /// Removes expired items from a message in player profile + /// Removes expired items from a message in player profile /// /// Session id /// Dialog id private void RemoveExpiredItemsFromMessage(string sessionId, string dialogueId) { var dialogs = _dialogueHelper.GetDialogsForProfile(sessionId); - if (!dialogs.TryGetValue(dialogueId, out var dialog)) return; + if (!dialogs.TryGetValue(dialogueId, out var dialog)) + { + return; + } foreach (var message in dialog.Messages ?? []) + { if (MessageHasExpired(message)) + { message.Items = new MessageItems(); + } + } } /** @@ -524,16 +567,21 @@ public class DialogueController( // To avoid needing to jump between profiles, auto-accept all friend requests var friendProfile = _profileHelper.GetFullProfile(request.To); if (friendProfile?.CharacterData?.PmcData is null) + { return new FriendRequestSendResponse { Status = BackendErrorCodes.PlayerProfileNotFound, RequestId = "", // Unused in an error state RetryAfter = 600 }; + } // Only add the profile to the friends list if it doesn't already exist var profile = _saveServer.GetProfile(sessionID); - if (!profile.FriendProfileIds.Contains(request.To)) profile.FriendProfileIds.Add(request.To); + if (!profile.FriendProfileIds.Contains(request.To)) + { + profile.FriendProfileIds.Add(request.To); + } // We need to delay this so that the friend request gets properly added to the clientside list before we accept it _ = new Timer( @@ -563,6 +611,9 @@ public class DialogueController( { var profile = _saveServer.GetProfile(sessionID); var friendIndex = profile.FriendProfileIds.IndexOf(request.FriendId); - if (friendIndex != -1) profile.FriendProfileIds.RemoveAt(friendIndex); + if (friendIndex != -1) + { + profile.FriendProfileIds.RemoveAt(friendIndex); + } } } diff --git a/Libraries/Core/Controllers/GameController.cs b/Libraries/Core/Controllers/GameController.cs index 849b4dd7..fd12b2b3 100644 --- a/Libraries/Core/Controllers/GameController.cs +++ b/Libraries/Core/Controllers/GameController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Context; using Core.Helpers; using Core.Models.Eft.Common; @@ -13,6 +12,7 @@ using Core.Utils; using Core.Utils.Cloners; using Core.Utils.Json; using Server; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -44,15 +44,15 @@ public class GameController( ICloner _cloner ) { + protected BotConfig _botConfig = _configServer.GetConfig(); protected CoreConfig _coreConfig = _configServer.GetConfig(); + protected double _deviation = 0.0001; + protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); protected HttpConfig _httpConfig = _configServer.GetConfig(); protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); - protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); - protected BotConfig _botConfig = _configServer.GetConfig(); - protected double _deviation = 0.0001; /// - /// Handle client/game/start + /// Handle client/game/start /// /// /// @@ -83,24 +83,42 @@ public class GameController( return; } - fullProfile.SptData ??= new Spt { Version = "Replace_me" }; + fullProfile.SptData ??= new Spt + { + Version = "Replace_me" + }; fullProfile.SptData.Migrations ??= new Dictionary(); fullProfile.FriendProfileIds ??= []; - if (fullProfile.ProfileInfo?.IsWiped is not null && fullProfile.ProfileInfo.IsWiped.Value) return; + if (fullProfile.ProfileInfo?.IsWiped is not null && fullProfile.ProfileInfo.IsWiped.Value) + { + return; + } fullProfile.CharacterData!.PmcData!.WishList ??= new DictionaryOrList(new Dictionary(), []); fullProfile.CharacterData.ScavData!.WishList ??= new DictionaryOrList(new Dictionary(), []); - if (fullProfile.DialogueRecords is not null) _profileFixerService.CheckForAndFixDialogueAttachments(fullProfile); + if (fullProfile.DialogueRecords is not null) + { + _profileFixerService.CheckForAndFixDialogueAttachments(fullProfile); + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Started game with session {sessionId} {fullProfile.ProfileInfo?.Username}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Started game with session {sessionId} {fullProfile.ProfileInfo?.Username}"); + } var pmcProfile = fullProfile.CharacterData.PmcData; - if (_coreConfig.Fixes.FixProfileBreakingInventoryItemIssues) _profileFixerService.FixProfileBreakingInventoryItemIssues(pmcProfile); + if (_coreConfig.Fixes.FixProfileBreakingInventoryItemIssues) + { + _profileFixerService.FixProfileBreakingInventoryItemIssues(pmcProfile); + } - if (pmcProfile.Health is not null) UpdateProfileHealthValues(pmcProfile); + if (pmcProfile.Health is not null) + { + UpdateProfileHealthValues(pmcProfile); + } if (pmcProfile.Inventory is not null) { @@ -128,13 +146,16 @@ public class GameController( CheckForAndRemoveUndefinedDialogues(fullProfile); } - if (pmcProfile.Skills?.Common is not null) WarnOnActiveBotReloadSkill(pmcProfile); + if (pmcProfile.Skills?.Common is not null) + { + WarnOnActiveBotReloadSkill(pmcProfile); + } _seasonalEventService.GivePlayerSeasonalGifts(sessionId); } /// - /// Handle client/game/config + /// Handle client/game/config /// /// /// @@ -180,7 +201,7 @@ public class GameController( } /// - /// Handle client/game/mode + /// Handle client/game/mode /// /// /// @@ -197,7 +218,7 @@ public class GameController( } /// - /// Handle client/server/list + /// Handle client/server/list /// /// /// @@ -214,7 +235,7 @@ public class GameController( } /// - /// Handle client/match/group/current + /// Handle client/match/group/current /// /// /// @@ -228,7 +249,7 @@ public class GameController( /// - /// Handle client/checkVersion + /// Handle client/checkVersion /// /// /// @@ -242,18 +263,22 @@ public class GameController( } /// - /// Handle client/game/keepalive + /// Handle client/game/keepalive /// /// /// public GameKeepAliveResponse GetKeepAlive(string sessionId) { _profileActivityService.SetActivityTimestamp(sessionId); - return new GameKeepAliveResponse { Message = "OK", UtcTime = _timeUtil.GetTimeStamp() }; + return new GameKeepAliveResponse + { + Message = "OK", + UtcTime = _timeUtil.GetTimeStamp() + }; } /// - /// Handle singleplayer/settings/getRaidTime + /// Handle singleplayer/settings/getRaidTime /// /// /// @@ -269,7 +294,6 @@ public class GameController( } /// - /// /// /// /// @@ -279,17 +303,20 @@ public class GameController( } /// - /// Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it + /// Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it /// /// Player profile private void WarnOnActiveBotReloadSkill(PmcData pmcProfile) { var botReloadSkill = _profileHelper.GetSkillFromProfile(pmcProfile, SkillTypes.BotReload); - if (botReloadSkill?.Progress > 0) _logger.Warning(_localisationService.GetText("server_start_player_active_botreload_skill")); + if (botReloadSkill?.Progress > 0) + { + _logger.Warning(_localisationService.GetText("server_start_player_active_botreload_skill")); + } } /// - /// When player logs in, iterate over all active effects and reduce timer + /// When player logs in, iterate over all active effects and reduce timer /// /// Profile to adjust values for private void UpdateProfileHealthValues(PmcData pmcProfile) @@ -351,7 +378,7 @@ public class GameController( } /// - /// Check for and update any timers on effect found on body parts + /// Check for and update any timers on effect found on body parts /// /// Player /// @@ -385,7 +412,10 @@ public class GameController( if (effectKvP.Value.Time < 1) { // More than 30 minutes has passed - if (diffSeconds > 1800) bodyPart.Effects.Remove(effectKvP.Key); + if (diffSeconds > 1800) + { + bodyPart.Effects.Remove(effectKvP.Key); + } continue; } @@ -394,13 +424,15 @@ public class GameController( effectKvP.Value.Time -= diffSeconds; if (effectKvP.Value.Time < 1) // Effect time was sub 1, set floor it can be + { effectKvP.Value.Time = 1; + } } } } /// - /// Send starting gifts to profile after x days + /// Send starting gifts to profile after x days /// /// Profile to add gifts to private void SendPraporGiftsToNewProfiles(PmcData pmcProfile) @@ -410,10 +442,16 @@ public class GameController( var currentTimeStamp = _timeUtil.GetTimeStamp(); // One day post-profile creation - if (currentTimeStamp > timeStampProfileCreated + oneDaySeconds) _giftService.SendPraporStartingGift(pmcProfile.SessionId!, 1); + if (currentTimeStamp > timeStampProfileCreated + oneDaySeconds) + { + _giftService.SendPraporStartingGift(pmcProfile.SessionId!, 1); + } // Two day post-profile creation - if (currentTimeStamp > timeStampProfileCreated + oneDaySeconds * 2) _giftService.SendPraporStartingGift(pmcProfile.SessionId!, 2); + if (currentTimeStamp > timeStampProfileCreated + oneDaySeconds * 2) + { + _giftService.SendPraporStartingGift(pmcProfile.SessionId!, 2); + } } /** @@ -426,7 +464,7 @@ public class GameController( } /// - /// Get a list of installed mods and save their details to the profile being used + /// Get a list of installed mods and save their details to the profile being used /// /// Profile to add mod details to private void SaveActiveModsToProfile(SptProfile fullProfile) @@ -467,7 +505,7 @@ public class GameController( } /// - /// Add the logged in players name to PMC name pool + /// Add the logged in players name to PMC name pool /// /// Profile of player to get name from private void AddPlayerToPmcNames(PmcData pmcProfile) @@ -478,30 +516,43 @@ public class GameController( var bots = _databaseService.GetBots().Types; // Official names can only be 15 chars in length - if (playerName.Length > _botConfig.BotNameLengthLimit) return; + if (playerName.Length > _botConfig.BotNameLengthLimit) + { + return; + } // Skip if player name exists already if (bots!.TryGetValue("bear", out var bearBot)) + { if (bearBot is not null && bearBot.FirstNames!.Any(x => x == playerName)) + { bearBot.FirstNames!.Add(playerName); + } + } if (bots.TryGetValue("bear", out var usecBot)) + { if (usecBot is not null && usecBot.FirstNames!.Any(x => x == playerName)) + { usecBot.FirstNames!.Add(playerName); + } + } } } /// - /// Check for a dialog with the key 'undefined', and remove it + /// Check for a dialog with the key 'undefined', and remove it /// /// Profile to check for dialog in private void CheckForAndRemoveUndefinedDialogues(SptProfile fullProfile) { - if (fullProfile.DialogueRecords!.TryGetValue("undefined", out _)) fullProfile.DialogueRecords.Remove("undefined"); + if (fullProfile.DialogueRecords!.TryGetValue("undefined", out _)) + { + fullProfile.DialogueRecords.Remove("undefined"); + } } /// - /// /// /// private void LogProfileDetails(SptProfile fullProfile) diff --git a/Libraries/Core/Controllers/HandBookController.cs b/Libraries/Core/Controllers/HandBookController.cs index e3e4a12b..6189c34f 100644 --- a/Libraries/Core/Controllers/HandBookController.cs +++ b/Libraries/Core/Controllers/HandBookController.cs @@ -8,6 +8,5 @@ public class HandBookController public void Load() { // leaving as this is how node is RN - return; } } diff --git a/Libraries/Core/Controllers/HealthController.cs b/Libraries/Core/Controllers/HealthController.cs index e8a2bb0c..c365f2d4 100644 --- a/Libraries/Core/Controllers/HealthController.cs +++ b/Libraries/Core/Controllers/HealthController.cs @@ -12,7 +12,6 @@ using Core.Utils; using Core.Utils.Cloners; using SptCommon.Annotations; using SptCommon.Extensions; -using BodyPartHealth = Core.Models.Eft.Common.Tables.BodyPartHealth; namespace Core.Controllers; @@ -63,18 +62,24 @@ public class HealthController( { // Get max healing from db var maxhp = _itemHelper.GetItem(healingItemToUse.Template).Value.Properties.MaxHpResource; - healingItemToUse.Upd.MedKit = new UpdMedKit { HpResource = maxhp - request.Count }; // Subtract amout used from max + healingItemToUse.Upd.MedKit = new UpdMedKit + { + HpResource = maxhp - request.Count + }; // Subtract amout used from max // request.count appears to take into account healing effects removed, e.g. bleeds // Salewa heals limb for 20 and fixes light bleed = (20+45 = 65) } // Resource in medkit is spent, delete it - if (healingItemToUse.Upd.MedKit.HpResource <= 0) _inventoryHelper.RemoveItem(pmcData, request.Item, sessionID, output); + if (healingItemToUse.Upd.MedKit.HpResource <= 0) + { + _inventoryHelper.RemoveItem(pmcData, request.Item, sessionID, output); + } var healingItemDbDetails = _itemHelper.GetItem(healingItemToUse.Template); var healItemEffectDetails = healingItemDbDetails.Value.Properties.EffectsDamage; - var bodyPartToHeal = pmcData.Health.BodyParts.GetValueOrDefault(request.Part.ToString()); + var bodyPartToHeal = pmcData.Health.BodyParts.GetValueOrDefault(request.Part); if (bodyPartToHeal is null) { _logger.Warning($"Player: {sessionID} Tried to heal a non-existent body part: {request.Part}"); @@ -96,10 +101,12 @@ public class HealthController( // Check if healing item removes the effect on limb if (!healItemEffectDetails.TryGetValue(Enum.Parse(effectKey), out var matchingEffectFromHealingItem)) // Healing item doesn't have matching effect, it doesn't remove the effect + { continue; + } // Adjust limb heal amount based on if its fixing an effect (request.count is TOTAL cost of hp resource on heal item, NOT amount to heal limb) - amountToHealLimb -= (int)(matchingEffectFromHealingItem.Cost ?? 0); + amountToHealLimb -= (int) (matchingEffectFromHealingItem.Cost ?? 0); bodyPartToHeal.Effects.Remove(effectKey); } } @@ -108,7 +115,10 @@ public class HealthController( bodyPartToHeal.Health.Current += amountToHealLimb; // Ensure we've not healed beyond the limbs max hp - if (bodyPartToHeal.Health.Current > bodyPartToHeal.Health.Maximum) bodyPartToHeal.Health.Current = bodyPartToHeal.Health.Maximum; + if (bodyPartToHeal.Health.Current > bodyPartToHeal.Health.Maximum) + { + bodyPartToHeal.Health.Current = bodyPartToHeal.Health.Maximum; + } return output; } @@ -132,10 +142,12 @@ public class HealthController( var itemToConsume = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item); if (itemToConsume is null) // Item not found, very bad + { return _httpResponseUtil.AppendErrorToOutput( output, _localisationService.GetText("health-unable_to_find_item_to_consume", request.Item) ); + } var consumedItemMaxResource = _itemHelper.GetItem(itemToConsume.Template).Value.Properties.MaxResource; if (consumedItemMaxResource > 1) @@ -144,15 +156,25 @@ public class HealthController( _itemHelper.AddUpdObjectToItem(itemToConsume); if (itemToConsume.Upd.FoodDrink is null) - itemToConsume.Upd.FoodDrink = new UpdFoodDrink { HpPercent = consumedItemMaxResource - request.Count }; + { + itemToConsume.Upd.FoodDrink = new UpdFoodDrink + { + HpPercent = consumedItemMaxResource - request.Count + }; + } else + { itemToConsume.Upd.FoodDrink.HpPercent -= request.Count; + } resourceLeft = itemToConsume.Upd.FoodDrink.HpPercent.Value; } // Remove item from inventory if resource has dropped below threshold - if (consumedItemMaxResource == 1 || resourceLeft < 1) _inventoryHelper.RemoveItem(pmcData, request.Item, sessionID, output); + if (consumedItemMaxResource == 1 || resourceLeft < 1) + { + _inventoryHelper.RemoveItem(pmcData, request.Item, sessionID, output); + } // Check what effect eating item has and handle var foodItemDbDetails = _itemHelper.GetItem(itemToConsume.Template).Value; @@ -160,6 +182,7 @@ public class HealthController( var foodIsSingleUse = foodItemDbDetails.Properties.MaxResource == 1; foreach (var (key, effectProps) in foodItemEffectDetails) + { switch (key) { case HealthFactor.Hydration: @@ -173,6 +196,7 @@ public class HealthController( _logger.Warning($"Unhandled effect after consuming: {itemToConsume.Template}, {key}"); break; } + } return output; } @@ -182,9 +206,13 @@ public class HealthController( { if (foodIsSingleUse) // Apply whole value from passed in parameter + { bodyValue.Current += consumptionDetails.Value; + } else + { bodyValue.Current += request.Count; + } // Ensure current never goes over max if (bodyValue.Current > bodyValue.Maximum) @@ -195,7 +223,10 @@ public class HealthController( } // Same as above but for the lower bound - if (bodyValue.Current < 0) bodyValue.Current = 0; + if (bodyValue.Current < 0) + { + bodyValue.Current = 0; + } } /// @@ -224,27 +255,38 @@ public class HealthController( }; _paymentService.PayMoney(pmcData, payMoneyRequest, sessionID, output); - if (output.Warnings.Count > 0) return output; + if (output.Warnings.Count > 0) + { + return output; + } foreach (var bodyPartKvP in healthTreatmentRequest.Difference.BodyParts.GetAllPropsAsDict()) { // Get body part from request + from pmc profile - var partRequest = (BodyPartEffects)bodyPartKvP.Value; + var partRequest = (BodyPartEffects) bodyPartKvP.Value; var profilePart = pmcData.Health.BodyParts[bodyPartKvP.Key]; // Bodypart healing is chosen when part request hp is above 0 if (partRequest.Health > 0) // Heal bodypart + { profilePart.Health.Current = profilePart.Health.Maximum; + } // Check for effects to remove if (partRequest.Effects?.Count > 0) { // Found some, loop over them and remove from pmc profile - foreach (var effect in partRequest.Effects) pmcData.Health.BodyParts[bodyPartKvP.Key].Effects.Remove(effect); + foreach (var effect in partRequest.Effects) + { + pmcData.Health.BodyParts[bodyPartKvP.Key].Effects.Remove(effect); + } // Remove empty effect object - if (pmcData.Health.BodyParts[bodyPartKvP.Key].Effects.Count == 0) pmcData.Health.BodyParts[bodyPartKvP.Key].Effects = null; + if (pmcData.Health.BodyParts[bodyPartKvP.Key].Effects.Count == 0) + { + pmcData.Health.BodyParts[bodyPartKvP.Key].Effects = null; + } } } diff --git a/Libraries/Core/Controllers/HideoutController.cs b/Libraries/Core/Controllers/HideoutController.cs index 63c85f88..b37ad7bc 100644 --- a/Libraries/Core/Controllers/HideoutController.cs +++ b/Libraries/Core/Controllers/HideoutController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Common; @@ -16,7 +15,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; - +using SptCommon.Annotations; namespace Core.Controllers; @@ -46,7 +45,6 @@ public class HideoutController( ConfigServer _configServer ) { - protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); public const string NameTaskConditionCountersCraftingId = "673f5d6fdd6ed700c703afdc"; protected List _hideoutAreas = @@ -57,13 +55,19 @@ public class HideoutController( HideoutAreas.BITCOIN_FARM ]; + protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); + public void StartUpgrade(PmcData pmcData, HideoutUpgradeRequestData request, string sessionID, ItemEventRouterResponse output) { var items = request.Items.Select( reqItem => { var item = pmcData.Inventory.Items.FirstOrDefault(invItem => invItem.Id == reqItem.Id); - return new { inventoryItem = item, requestedItem = reqItem }; + return new + { + inventoryItem = item, + requestedItem = reqItem + }; } ) .ToList(); @@ -87,9 +91,13 @@ public class HideoutController( item.inventoryItem.Upd.StackObjectsCount is not null && item.inventoryItem.Upd.StackObjectsCount > item.requestedItem.Count ) + { item.inventoryItem.Upd.StackObjectsCount -= item.requestedItem.Count; + } else + { _inventoryHelper.RemoveItem(pmcData, item.inventoryItem.Id, sessionID, output); + } } // Construction time management @@ -118,11 +126,14 @@ public class HideoutController( var ctime = hideoutDataDb.Stages[(profileHideoutArea.Level + 1).ToString()].ConstructionTime; if (ctime > 0) { - if (_profileHelper.IsDeveloperAccount(sessionID)) ctime = 40; + if (_profileHelper.IsDeveloperAccount(sessionID)) + { + ctime = 40; + } var timestamp = _timeUtil.GetTimeStamp(); - profileHideoutArea.CompleteTime = Math.Round((double)(timestamp - ctime)); + profileHideoutArea.CompleteTime = Math.Round((double) (timestamp - ctime)); profileHideoutArea.Constructing = true; } } @@ -161,11 +172,16 @@ public class HideoutController( var hideoutStage = hideoutData.Stages[profileHideoutArea.Level.ToString()]; var bonuses = hideoutStage.Bonuses; if (bonuses?.Count > 0) + { foreach (var bonus in bonuses) + { _hideoutHelper.ApplyPlayerUpgradesBonuses(pmcData, bonus); + } + } // Upgrade includes a container improvement/addition if (!string.IsNullOrEmpty(hideoutStage?.Container)) + { AddContainerImprovementToProfile( output, sessionID, @@ -174,17 +190,22 @@ public class HideoutController( hideoutData, hideoutStage ); + } // Upgrading water collector / med station if ( profileHideoutArea.Type == HideoutAreas.WATER_COLLECTOR || profileHideoutArea.Type == HideoutAreas.MEDSTATION ) + { SetWallVisibleIfPrereqsMet(pmcData); + } // Cleanup temporary buffs/debuffs from wall if complete if (profileHideoutArea.Type == HideoutAreas.EMERGENCY_WALL && profileHideoutArea.Level == 6) + { _hideoutHelper.RemoveHideoutWallBuffsAndDebuffs(hideoutData, pmcData); + } // Add Skill Points Per Area Upgrade _profileHelper.AddSkillPointsToPlayer( @@ -196,12 +217,15 @@ public class HideoutController( private void SetWallVisibleIfPrereqsMet(PmcData pmcData) { - var medStation = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.MEDSTATION); - var waterCollector = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.WATER_COLLECTOR); + var medStation = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.MEDSTATION); + var waterCollector = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.WATER_COLLECTOR); if (medStation?.Level >= 1 && waterCollector?.Level >= 1) { - var wall = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.EMERGENCY_WALL); - if (wall?.Level == 0) wall.Level = 3; + var wall = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.EMERGENCY_WALL); + if (wall?.Level == 0) + { + wall.Level = 3; + } } } @@ -210,7 +234,9 @@ public class HideoutController( { // Add key/value to `hideoutAreaStashes` dictionary - used to link hideout area to inventory stash by its id if (!pmcData.Inventory.HideoutAreaStashes.ContainsKey(dbHideoutArea.Type.ToString())) + { pmcData.Inventory.HideoutAreaStashes[dbHideoutArea.Type.ToString()] = dbHideoutArea.Id; + } // Add/upgrade stash item in player inventory AddUpdateInventoryItemToProfile(sessionID, pmcData, dbHideoutArea, hideoutStage); @@ -218,13 +244,17 @@ public class HideoutController( // Edge case, add/update `stand1/stand2/stand3` children if (dbHideoutArea.Type == HideoutAreas.EQUIPMENT_PRESETS_STAND) // Can have multiple 'standx' children depending on upgrade level + { AddMissingPresetStandItemsToProfile(sessionID, hideoutStage, pmcData, dbHideoutArea, output); + } // Dont inform client when upgraded area is hall of fame or equipment stand, BSG doesn't inform client this specifc upgrade has occurred // will break client if sent List check = [HideoutAreas.PLACE_OF_FAME]; if (!check.Contains(dbHideoutArea.Type ?? HideoutAreas.NOTSET)) + { AddContainerUpgradeToClientOutput(sessionID, dbHideoutArea.Type, dbHideoutArea, hideoutStage, output); + } // Some hideout areas (Gun stand) have child areas linked to it var childDbArea = _databaseService @@ -234,11 +264,13 @@ public class HideoutController( { // Add key/value to `hideoutAreaStashes` dictionary - used to link hideout area to inventory stash by its id if (pmcData.Inventory.HideoutAreaStashes.GetValueOrDefault(childDbArea.Type.ToString()) is null) + { pmcData.Inventory.HideoutAreaStashes[childDbArea.Type.ToString()] = childDbArea.Id; + } // Set child area level to same as parent area - pmcData.Hideout.Areas.FirstOrDefault((hideoutArea) => hideoutArea.Type == childDbArea.Type).Level = - pmcData.Hideout.Areas.FirstOrDefault((x) => x.Type == profileParentHideoutArea.Type).Level; + pmcData.Hideout.Areas.FirstOrDefault(hideoutArea => hideoutArea.Type == childDbArea.Type).Level = + pmcData.Hideout.Areas.FirstOrDefault(x => x.Type == profileParentHideoutArea.Type).Level; // Add/upgrade stash item in player inventory var childDbAreaStage = childDbArea.Stages[profileParentHideoutArea.Level.ToString()]; @@ -261,7 +293,11 @@ public class HideoutController( } // Add new item as none exists (don't inform client of newContainerItem, will be done in `profileChanges.changedHideoutStashes`) - var newContainerItem = new Item { Id = dbHideoutArea.Id, Template = hideoutStage.Container }; + var newContainerItem = new Item + { + Id = dbHideoutArea.Id, + Template = hideoutStage.Container + }; pmcData.Inventory.Items.Add(newContainerItem); } @@ -269,7 +305,9 @@ public class HideoutController( ItemEventRouterResponse output) { if (output.ProfileChanges[sessionID].ChangedHideoutStashes is null) + { output.ProfileChanges[sessionID].ChangedHideoutStashes = new Dictionary(); + } // Inform client of changes output.ProfileChanges[sessionID].ChangedHideoutStashes[areaType.ToString()] = new HideoutStashItem @@ -286,8 +324,13 @@ public class HideoutController( var itemsToAdd = addItemToHideoutRequest.Items.Select( kvp => { - var item = pmcData.Inventory.Items.FirstOrDefault((invItem) => invItem.Id == kvp.Value.Id); - return new { inventoryItem = item, requestedItem = kvp.Value, slot = kvp.Key }; + var item = pmcData.Inventory.Items.FirstOrDefault(invItem => invItem.Id == kvp.Value.Id); + return new + { + inventoryItem = item, + requestedItem = kvp.Value, + slot = kvp.Key + }; } ); @@ -323,7 +366,7 @@ public class HideoutController( // Add item to area.slots var destinationLocationIndex = int.Parse(item.slot); var hideoutSlotIndex = hideoutArea.Slots.FindIndex( - (slot) => slot.LocationIndex == destinationLocationIndex + slot => slot.LocationIndex == destinationLocationIndex ); if (hideoutSlotIndex == -1) { @@ -356,7 +399,7 @@ public class HideoutController( { var output = _eventOutputHolder.GetOutput(sessionID); - var hideoutArea = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == request.AreaType); + var hideoutArea = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == request.AreaType); if (hideoutArea is null) { _logger.Error(_localisationService.GetText("hideout-unable_to_find_area", request.AreaType)); @@ -421,10 +464,12 @@ public class HideoutController( _inventoryHelper.AddItemToStash(sessionID, request, pmcData, output); if (output.Warnings?.Count > 0) // Adding to stash failed, drop out - don't remove item from hideout area slot + { return output; + } // Remove items from slot, locationIndex remains - var hideoutSlotIndex = hideoutArea.Slots.FindIndex((slot) => slot.LocationIndex == slotIndexToRemove); + var hideoutSlotIndex = hideoutArea.Slots.FindIndex(slot => slot.LocationIndex == slotIndexToRemove); hideoutArea.Slots[hideoutSlotIndex].Items = null; return output; @@ -437,7 +482,7 @@ public class HideoutController( // Force a production update (occur before area is toggled as it could be generator and doing it after generator enabled would cause incorrect calculaton of production progress) _hideoutHelper.UpdatePlayerHideout(sessionID); - var hideoutArea = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == request.AreaType); + var hideoutArea = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == request.AreaType); if (hideoutArea is null) { _logger.Error(_localisationService.GetText("hideout-unable_to_find_area", request.AreaType)); @@ -461,7 +506,7 @@ public class HideoutController( // Find the actual amount of items we need to remove because body can send weird data var recipeRequirementsClone = _cloner.Clone( - recipe.Requirements.Where((r) => r.Type == "Item" || r.Type == "Tool") + recipe.Requirements.Where(r => r.Type == "Item" || r.Type == "Tool") ); List itemsToDelete = []; @@ -478,14 +523,17 @@ public class HideoutController( // Handle tools not having a `count`, but always only requiring 1 var requiredCount = requirement.Count ?? 1; - if (requiredCount <= 0) continue; + if (requiredCount <= 0) + { + continue; + } _inventoryHelper.RemoveItemByCount(pmcData, itemToDelete.Id, requiredCount, sessionID, output); // Tools don't have a count if (requirement.Type != "Tool") { - requirement.Count -= (int)itemToDelete.Count; + requirement.Count -= (int) itemToDelete.Count; } } @@ -511,9 +559,13 @@ public class HideoutController( } if (inventoryItem.Upd?.StackObjectsCount is not null && inventoryItem.Upd.StackObjectsCount > requestedItem.Count) + { inventoryItem.Upd.StackObjectsCount -= requestedItem.Count; + } else + { _inventoryHelper.RemoveItem(pmcData, requestedItem.Id, sessionID, output); + } } var recipe = _databaseService.GetHideout().Production?.ScavRecipes?.FirstOrDefault(r => r.Id == body.RecipeId); @@ -542,7 +594,7 @@ public class HideoutController( pmcData.Hideout.Production[body.RecipeId] = _hideoutHelper.InitProduction( body.RecipeId, - (int)(_profileHelper.IsDeveloperAccount(sessionID) ? 40 : modifiedScavCaseTime), + (int) (_profileHelper.IsDeveloperAccount(sessionID) ? 40 : modifiedScavCaseTime), false ); pmcData.Hideout.Production[body.RecipeId].SptIsScavCase = true; @@ -553,14 +605,21 @@ public class HideoutController( private double? GetScavCaseTime(PmcData pmcData, double? productionTime) { var fenceLevel = _fenceService.GetFenceInfo(pmcData); - if (fenceLevel is null) return productionTime; + if (fenceLevel is null) + { + return productionTime; + } return productionTime * fenceLevel.ScavCaseTimeModifier; } public void AddScavCaseRewardsToProfile(PmcData pmcData, List rewards, string recipeId) { - pmcData.Hideout.Production[$"ScavCase{recipeId}"] = new Production { Products = rewards, RecipeId = recipeId }; + pmcData.Hideout.Production[$"ScavCase{recipeId}"] = new Production + { + Products = rewards, + RecipeId = recipeId + }; } public ItemEventRouterResponse ContinuousProductionStart(PmcData pmcData, HideoutContinuousProductionStartRequestData request, string sessionID) @@ -619,7 +678,10 @@ public class HideoutController( foreach (var production in productionDict) { // Skip undefined production objects - if (production.Value is null) continue; + if (production.Value is null) + { + continue; + } // Production or ScavCase if (production.Value.RecipeId == request.RecipeId) @@ -670,25 +732,36 @@ public class HideoutController( // Recipe has an `isEncoded` requirement for reward(s), Add `RecodableComponent` property if (recipe.IsEncoded ?? false) + { foreach (var reward in itemAndChildrenToSendToPlayer) { _itemHelper.AddUpdObjectToItem(reward.FirstOrDefault()); - reward.FirstOrDefault().Upd.RecodableComponent = new UpdRecodableComponent { IsEncoded = true }; + reward.FirstOrDefault().Upd.RecodableComponent = new UpdRecodableComponent + { + IsEncoded = true + }; } + } // Build an array of the tools that need to be returned to the player List> toolsToSendToPlayer = []; var hideoutProduction = pmcData.Hideout.Production[prodId]; if (hideoutProduction.SptRequiredTools?.Count > 0) + { foreach (var tool in hideoutProduction.SptRequiredTools) + { toolsToSendToPlayer.Add([tool]); + } + } // Check if the recipe is the same as the last one - get bonus when crafting same thing multiple times var area = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == recipe.AreaType); if (area is not null && request.RecipeId != area.LastRecipe) // 1 point per craft upon the end of production for alternating between 2 different crafting recipes in the same module + { craftingExpAmount += _hideoutConfig.ExpCraftAmount; // Default is 10 + } // Update variable with time spent crafting item(s) // 1 point per 8 hours of crafting @@ -697,7 +770,7 @@ public class HideoutController( { // Spent enough time crafting to get a bonus xp multiplier var multiplierCrafting = Math.Floor(hoursCrafting.Value / _hideoutConfig.HoursForSkillCrafting); - craftingExpAmount += (int)(1 * multiplierCrafting); + craftingExpAmount += (int) (1 * multiplierCrafting); hoursCrafting -= _hideoutConfig.HoursForSkillCrafting * multiplierCrafting; } @@ -729,7 +802,10 @@ public class HideoutController( }; _inventoryHelper.AddItemsToStash(sessionID, addToolsRequest, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } } // Add the crafting result to the stash, marked as FiR @@ -741,7 +817,10 @@ public class HideoutController( Callback = null }; _inventoryHelper.AddItemsToStash(sessionID, addItemsRequest, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } // - increment skill point for crafting // - delete the production in profile Hideout.Production @@ -760,8 +839,11 @@ public class HideoutController( { _profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Crafting, craftingExpAmount); - var intellectAmountToGive = 0.5 * Math.Round((double)(craftingExpAmount / 15)); - if (intellectAmountToGive > 0) _profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Intellect, intellectAmountToGive); + var intellectAmountToGive = 0.5 * Math.Round((double) (craftingExpAmount / 15)); + if (intellectAmountToGive > 0) + { + _profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Intellect, intellectAmountToGive); + } } area.LastRecipe = request.RecipeId; @@ -776,11 +858,13 @@ public class HideoutController( // Continuous recipes need the craft time refreshed as it gets created once on initial craft and stays the same regardless of what // production.json is set to if (recipe.Continuous.GetValueOrDefault(false)) + { hideoutProduction.ProductionTime = _hideoutHelper.GetAdjustedCraftTimeWithSkills( pmcData, recipe.Id, true ); + } // Flag normal (not continuous) crafts as complete if (!recipe.Continuous ?? false) @@ -799,7 +883,10 @@ public class HideoutController( { Id = _hashUtil.Generate(), Template = recipe.EndProduct, - Upd = new Upd { StackObjectsCount = recipe.Count } + Upd = new Upd + { + StackObjectsCount = recipe.Count + } }; // Split item into separate items with acceptable stack sizes @@ -814,7 +901,15 @@ public class HideoutController( // Add the first reward item to array when not a preset (first preset added above earlier) if (!rewardIsPreset) { - itemAndChildrenToSendToPlayer.Add([new Item { Id = _hashUtil.Generate(), Template = recipe.EndProduct }]); + itemAndChildrenToSendToPlayer.Add( + [ + new Item + { + Id = _hashUtil.Generate(), + Template = recipe.EndProduct + } + ] + ); } // Add multiple of item if recipe requests it @@ -844,6 +939,7 @@ public class HideoutController( { if (!pmcData.TaskConditionCounters.TryGetValue(NameTaskConditionCountersCraftingId, out _)) // Doesn't exist, create + { pmcData.TaskConditionCounters[NameTaskConditionCountersCraftingId] = new TaskConditionCounter { Id = recipe.Id, @@ -851,6 +947,7 @@ public class HideoutController( SourceId = "CounterCrafting", Value = 0 }; + } return pmcData.TaskConditionCounters[NameTaskConditionCountersCraftingId]; } @@ -861,11 +958,13 @@ public class HideoutController( string? prodId = null; foreach (var production in ongoingProductions) // Production or ScavCase + { if (production.Value.RecipeId == request.RecipeId) { prodId = production.Key; // Set to objects key break; } + } if (prodId == null) { @@ -893,7 +992,10 @@ public class HideoutController( }; _inventoryHelper.AddItemsToStash(sessionID, addItemsRequest, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } // Remove the old production from output object before its sent to client output.ProfileChanges[sessionID].Production.Remove(request.RecipeId); @@ -920,6 +1022,7 @@ public class HideoutController( var qteDb = _databaseService.GetHideout().Qte; var relevantQte = qteDb.FirstOrDefault(qte => qte.Id == request.Id); foreach (var outcome in request.Results) + { if (outcome) { // Success @@ -932,10 +1035,17 @@ public class HideoutController( pmcData.Health.Energy.Current += relevantQte.Results[QteEffectType.singleFailEffect].Energy; pmcData.Health.Hydration.Current += relevantQte.Results[QteEffectType.singleFailEffect].Hydration; } + } - if (pmcData.Health.Energy.Current < 1) pmcData.Health.Energy.Current = 1; + if (pmcData.Health.Energy.Current < 1) + { + pmcData.Health.Energy.Current = 1; + } - if (pmcData.Health.Hydration.Current < 1) pmcData.Health.Hydration.Current = 1; + if (pmcData.Health.Hydration.Current < 1) + { + pmcData.Health.Hydration.Current = 1; + } HandleMusclePain(pmcData, relevantQte.Results[QteEffectType.finishEffect]); } @@ -976,12 +1086,18 @@ public class HideoutController( var overallCounterItems = pmcData.Stats.Eft.OverallCounters.Items; // Find counter by key - var shootingRangeHighScore = overallCounterItems.FirstOrDefault((counter) => counter.Key.Contains(shootingRangeKey)); + var shootingRangeHighScore = overallCounterItems.FirstOrDefault(counter => counter.Key.Contains(shootingRangeKey)); if (shootingRangeHighScore is null) { // Counter not found, add blank one - overallCounterItems.Add(new CounterKeyValue { Key = [shootingRangeKey], Value = 0 }); - shootingRangeHighScore = overallCounterItems.FirstOrDefault((counter) => counter.Key.Contains(shootingRangeKey)); + overallCounterItems.Add( + new CounterKeyValue + { + Key = [shootingRangeKey], + Value = 0 + } + ); + shootingRangeHighScore = overallCounterItems.FirstOrDefault(counter => counter.Key.Contains(shootingRangeKey)); } shootingRangeHighScore.Value = request.Points; @@ -993,10 +1109,14 @@ public class HideoutController( // Create mapping of required item with corrisponding item from player inventory var items = request.Items.Select( - (reqItem) => + reqItem => { var item = pmcData.Inventory.Items.FirstOrDefault(invItem => invItem.Id == reqItem.Id); - return new { inventoryItem = item, requestedItem = reqItem }; + return new + { + inventoryItem = item, + requestedItem = reqItem + }; } ); @@ -1017,9 +1137,13 @@ public class HideoutController( item.inventoryItem.Upd.StackObjectsCount is not null && item.inventoryItem.Upd.StackObjectsCount > item.requestedItem.Count ) + { item.inventoryItem.Upd.StackObjectsCount -= item.requestedItem.Count; + } else + { _inventoryHelper.RemoveItem(pmcData, item.inventoryItem.Id, sessionId, output); + } } var profileHideoutArea = pmcData.Hideout.Areas.FirstOrDefault(x => x.Type == request.AreaType); @@ -1029,7 +1153,7 @@ public class HideoutController( return _httpResponseUtil.AppendErrorToOutput(output); } - var hideoutDbData = _databaseService.GetHideout().Areas.FirstOrDefault((area) => area.Type == request.AreaType); + var hideoutDbData = _databaseService.GetHideout().Areas.FirstOrDefault(area => area.Type == request.AreaType); if (hideoutDbData is null) { _logger.Error( @@ -1042,14 +1166,17 @@ public class HideoutController( var improvements = hideoutDbData.Stages[profileHideoutArea.Level.ToString()].Improvements; var timestamp = _timeUtil.GetTimeStamp(); - if (output.ProfileChanges[sessionId].Improvements is null) output.ProfileChanges[sessionId].Improvements = new Dictionary(); + if (output.ProfileChanges[sessionId].Improvements is null) + { + output.ProfileChanges[sessionId].Improvements = new Dictionary(); + } foreach (var improvement in improvements) { var improvementDetails = new HideoutImprovement { Completed = false, - ImproveCompleteTimestamp = (long)(timestamp + improvement.ImprovementTime) + ImproveCompleteTimestamp = (long) (timestamp + improvement.ImprovementTime) }; output.ProfileChanges[sessionId].Improvements[improvement.Id] = improvementDetails; @@ -1102,7 +1229,7 @@ public class HideoutController( var itemDetails = _databaseService .GetHideout() - .Customisation.Globals.FirstOrDefault((cust) => cust.Id == request.OfferId); + .Customisation.Globals.FirstOrDefault(cust => cust.Id == request.OfferId); if (itemDetails is null) { _logger.Error($"Unable to find customisation: {request.OfferId} in db, cannot apply to hideout"); @@ -1144,7 +1271,7 @@ public class HideoutController( { // Check if we've already added this mannequin var existingMannequin = pmcData.Inventory.Items.FirstOrDefault( - (item) => item.ParentId == equipmentPresetHideoutArea.Id && item.SlotId == mannequinSlot.Name + item => item.ParentId == equipmentPresetHideoutArea.Id && item.SlotId == mannequinSlot.Name ); // No child, add it @@ -1179,7 +1306,7 @@ public class HideoutController( } /// - /// Handle HideoutCustomizationSetMannequinPose event + /// Handle HideoutCustomizationSetMannequinPose event /// /// Session id /// Player profile @@ -1214,12 +1341,16 @@ public class HideoutController( public void Update() { foreach (var sessionID in _saveServer.GetProfiles()) + { if (sessionID.Value.CharacterData.PmcData.Hideout is not null && _profileActivityService.ActiveWithinLastMinutes( sessionID.Key, _hideoutConfig.UpdateProfileHideoutWhenActiveWithinMinutes ) ) + { _hideoutHelper.UpdatePlayerHideout(sessionID.Key); + } + } } } diff --git a/Libraries/Core/Controllers/InRaidController.cs b/Libraries/Core/Controllers/InRaidController.cs index 6642dd54..29089a2c 100644 --- a/Libraries/Core/Controllers/InRaidController.cs +++ b/Libraries/Core/Controllers/InRaidController.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Context; using Core.Helpers; using Core.Models.Eft.InRaid; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; +using SptCommon.Annotations; namespace Core.Controllers; @@ -16,11 +16,11 @@ public class InRaidController( ConfigServer _configServer ) { - protected InRaidConfig _inRaidConfig = _configServer.GetConfig(); protected BotConfig _botConfig = _configServer.GetConfig(); + protected InRaidConfig _inRaidConfig = _configServer.GetConfig(); /// - /// Save locationId to active profiles in-raid object AND app context + /// Save locationId to active profiles in-raid object AND app context /// /// Session id /// Register player request @@ -30,9 +30,9 @@ public class InRaidController( } /// - /// Handle raid/profile/scavsave - /// Save profile state to disk - /// Handles pmc/pscav + /// Handle raid/profile/scavsave + /// Save profile state to disk + /// Handles pmc/pscav /// /// /// @@ -43,11 +43,13 @@ public class InRaidController( // If equipment match overwrite existing data from update to date raid data for scavenger screen to work correctly. // otherwise Scav inventory will be overwritten and break scav regeneration, breaking profile. if (serverScavProfile.Inventory.Equipment == offRaidProfileData.Inventory.Equipment) + { serverScavProfile.Inventory.Items = offRaidProfileData.Inventory.Items; + } } /// - /// Get the inraid config from configs/inraid.json + /// Get the inraid config from configs/inraid.json /// public InRaidConfig GetInRaidConfig() { @@ -55,7 +57,6 @@ public class InRaidController( } /// - /// /// /// /// @@ -66,7 +67,6 @@ public class InRaidController( } /// - /// /// /// /// diff --git a/Libraries/Core/Controllers/InsuranceController.cs b/Libraries/Core/Controllers/InsuranceController.cs index 56872242..fe18e117 100644 --- a/Libraries/Core/Controllers/InsuranceController.cs +++ b/Libraries/Core/Controllers/InsuranceController.cs @@ -47,18 +47,21 @@ public class InsuranceController( /** * Process insurance items of all profiles prior to being given back to the player through the mail service. - * + * * @returns void */ public void ProcessReturn() { // Process each installed profile. - foreach (var sessionId in _saveServer.GetProfiles()) ProcessReturnByProfile(sessionId.Key); + foreach (var sessionId in _saveServer.GetProfiles()) + { + ProcessReturnByProfile(sessionId.Key); + } } /** * Process insurance items of a single profile prior to being given back to the player through the mail service. - * + * * @returns void */ public void ProcessReturnByProfile(string sessionId) @@ -67,14 +70,17 @@ public class InsuranceController( var insuranceDetails = FilterInsuredItems(sessionId); // Skip profile if no insured items to process - if (insuranceDetails.Count == 0) return; + if (insuranceDetails.Count == 0) + { + return; + } ProcessInsuredItems(insuranceDetails, sessionId); } /** * Get all insured items that are ready to be processed in a specific profile. - * + * * @param sessionID Session ID of the profile to check. * @param time The time to check ready status against. Current time by default. * @returns All insured items that are ready to be processed. @@ -86,15 +92,19 @@ public class InsuranceController( var profileInsuranceDetails = _saveServer.GetProfile(sessionId).InsuranceList; if (profileInsuranceDetails.Count > 0) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Found {profileInsuranceDetails.Count} insurance packages in profile {sessionId}"); + } + } return profileInsuranceDetails.Where(insured => insuranceTime >= insured.ScheduledTime).ToList(); } /** * This method orchestrates the processing of insured items in a profile. - * + * * @param insuranceDetails The insured items to process. * @param sessionID The session ID that should receive the processed items. * @returns void @@ -102,9 +112,11 @@ public class InsuranceController( protected void ProcessInsuredItems(List insuranceDetails, string sessionId) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Processing {insuranceDetails.Count} insurance packages, which includes a total of: {CountAllInsuranceItems(insuranceDetails)} items, in profile: {sessionId}" ); + } // Iterate over each of the insurance packages. foreach (var insured in insuranceDetails) @@ -147,7 +159,7 @@ public class InsuranceController( /** * Remove an insurance package from a profile using the package's system data information. - * + * * @param sessionID The session ID of the profile to remove the package from. * @param index The array index of the insurance package to remove. * @returns void @@ -164,12 +176,15 @@ public class InsuranceController( ) .ToList(); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Removed processed insurance package. Remaining packages: {profile.InsuranceList.Count}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Removed processed insurance package. Remaining packages: {profile.InsuranceList.Count}"); + } } /** * Finds the items that should be deleted based on the given Insurance object. - * + * * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. @@ -189,7 +204,10 @@ public class InsuranceController( ); // Process all items that are not attached, attachments; those are handled separately, by value. - if (hasRegularItems) ProcessRegularItems(insured, toDelete, parentAttachmentsMap); + if (hasRegularItems) + { + ProcessRegularItems(insured, toDelete, parentAttachmentsMap); + } // Process attached, attachments, by value, only if there are any. if (parentAttachmentsMap.Count > 0) @@ -203,8 +221,12 @@ public class InsuranceController( // Log the number of items marked for deletion, if any if (!toDelete.Any()) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Marked {toDelete.Count} items for deletion from insurance."); + } + } return toDelete; } @@ -213,7 +235,7 @@ public class InsuranceController( * Initialize a Map object 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). - * + * * @param rootItemParentID - The ID that should be assigned to all "hideout"/root items. * @param insured - The insurance object containing the items to evaluate. * @param itemsMap - A Map object for quick item look-up by item ID. @@ -291,7 +313,10 @@ public class InsuranceController( // Update (or add to) the main-parent to attachments map. if (mainParentToAttachmentsMap.ContainsKey(mainParent.Id)) { - if (mainParentToAttachmentsMap.TryGetValue(mainParent.Id, out var parent)) parent.Add(insuredItem); + if (mainParentToAttachmentsMap.TryGetValue(mainParent.Id, out var parent)) + { + parent.Add(insuredItem); + } } else { @@ -305,7 +330,7 @@ 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. - * + * * @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. @@ -327,14 +352,24 @@ public class InsuranceController( // attachment on the main-parent. For example, if the attachment is a stock, we need to check to see if // it's moddable in the upper receiver (attachment/parent), which is attached to the gun (main-parent). if (attachment.ParentId is not null) + { if (itemsMap.TryGetValue(attachment.ParentId, out var directParentItem)) + { attachmentParentItem = directParentItem; + } + } - if (_itemHelper.IsRaidModdable(attachment, attachmentParentItem) ?? false) moddableAttachments.Add(attachment); + if (_itemHelper.IsRaidModdable(attachment, attachmentParentItem) ?? false) + { + moddableAttachments.Add(attachment); + } } // If any moddable attachments remain, add them to the updated map. - if (moddableAttachments.Count > 0) updatedMap.TryAdd(map.Key, moddableAttachments); + if (moddableAttachments.Count > 0) + { + updatedMap.TryAdd(map.Key, moddableAttachments); + } } return updatedMap; @@ -344,7 +379,7 @@ 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 Set. - * + * * @param insured The insurance object containing the items to evaluate. * @param toDelete A Set to keep track of items marked for deletion. * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. @@ -355,7 +390,10 @@ public class InsuranceController( foreach (var insuredItem in insured.Items) { // Skip if the item is an attachment. These are handled separately. - if (_itemHelper.IsAttachmentAttached(insuredItem)) continue; + if (_itemHelper.IsAttachmentAttached(insuredItem)) + { + continue; + } // Roll for item deletion var itemRoll = RollForDelete(insured.TraderId, insuredItem); @@ -371,7 +409,10 @@ public class InsuranceController( insured.Items, insuredItem.Id ); - foreach (var item in itemAndChildren) toDelete.Add(item.Id); + foreach (var item in itemAndChildren) + { + toDelete.Add(item.Id); + } // Remove the parent (and its children) from the parentAttachmentsMap. parentAttachmentsMap.Remove(insuredItem.Id); @@ -387,7 +428,7 @@ public class InsuranceController( /** * Process parent items and their attachments, updating the toDelete Set accordingly. - * + * * @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @param itemsMap A Map object for quick item look-up by item ID. * @param traderId The trader ID from the Insurance object. @@ -400,12 +441,18 @@ public class InsuranceController( { // Skip processing if parentId is already marked for deletion, as all attachments for that parent will // already be marked for deletion as well. - if (toDelete.Contains(parentObj.Key)) continue; + if (toDelete.Contains(parentObj.Key)) + { + continue; + } // Log the parent item's name. itemsMap.TryGetValue(parentObj.Key, out var parentItem); var parentName = _itemHelper.GetItemName(parentItem.Template); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Processing attachments of parent {parentName}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Processing attachments of parent {parentName}"); + } // Process the attachments for this individual parent item. ProcessAttachmentByParent(parentObj.Value, insuredTraderId, toDelete); @@ -417,7 +464,7 @@ public class InsuranceController( * 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. - * + * * @param attachments The array of attachment items to sort, filter, and roll. * @param traderId The ID of the trader to that has ensured these items. * @param toDelete The array that accumulates the IDs of the items to be deleted. @@ -434,17 +481,25 @@ public class InsuranceController( // Create prob array and add all attachments with rouble price as the weight var attachmentsProbabilityArray = new ProbabilityObjectArray(_mathUtil, _cloner); foreach (var attachmentTpl in weightedAttachmentByPrice) + { attachmentsProbabilityArray.Add( new ProbabilityObject(attachmentTpl.Key, attachmentTpl.Value, null) ); + } // Draw x attachments from weighted array to remove from parent, remove from pool after being picked - var attachmentIdsToRemove = attachmentsProbabilityArray.Draw((int)countOfAttachmentsToRemove, false); - foreach (var attachmentId in attachmentIdsToRemove) toDelete.Add(attachmentId); + var attachmentIdsToRemove = attachmentsProbabilityArray.Draw((int) countOfAttachmentsToRemove, false); + foreach (var attachmentId in attachmentIdsToRemove) + { + toDelete.Add(attachmentId); + } LogAttachmentsBeingRemoved(attachmentIdsToRemove, attachments, weightedAttachmentByPrice); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Number of attachments to be deleted: {attachmentIdsToRemove.Count}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Number of attachments to be deleted: {attachmentIdsToRemove.Count}"); + } } private void LogAttachmentsBeingRemoved(List attachmentIdsToRemove, List attachments, Dictionary attachmentPrices) @@ -453,10 +508,13 @@ public class InsuranceController( foreach (var attachmentId in attachmentIdsToRemove) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( - $"Attachment {index} Id: {attachmentId} Tpl: {attachments.FirstOrDefault((x) => x.Id == attachmentId)?.Template} - " + + $"Attachment {index} Id: {attachmentId} Tpl: {attachments.FirstOrDefault(x => x.Id == attachmentId)?.Template} - " + $"Price: {attachmentPrices[attachmentId]}" ); + } + index++; } } @@ -469,7 +527,10 @@ public class InsuranceController( foreach (var attachment in attachments) { var price = _ragfairPriceService.GetDynamicItemPrice(attachment.Template, Money.ROUBLES); - if (price is not null) result[attachment.Id] = Math.Round(price ?? 0); + if (price is not null) + { + result[attachment.Id] = Math.Round(price ?? 0); + } } _weightedRandomHelper.ReduceWeightValues(result); @@ -481,7 +542,10 @@ public class InsuranceController( { var removeCount = 0; - if (_randomUtil.GetChance100(_insuranceConfig.ChanceNoAttachmentsTakenPercent)) return removeCount; + if (_randomUtil.GetChance100(_insuranceConfig.ChanceNoAttachmentsTakenPercent)) + { + return removeCount; + } // Get attachments count above or equal to price set in config return weightedAttachmentByPrice @@ -496,7 +560,7 @@ public class InsuranceController( /** * Handle sending the insurance message to the user that potentially contains the valid insurance items. - * + * * @param sessionID The session ID that should receive the insurance message. * @param insurance The context of insurance to use. * @returns void @@ -511,11 +575,17 @@ public class InsuranceController( if (IsMapLabsAndInsuranceDisabled(insurance)) // Trader has labs-specific messages // Wipe out returnable items + { HandleLabsInsurance(traderDialogMessages, insurance); + } else if (insurance.Items?.Count == 0) // Not labs and no items to return + { if (traderDialogMessages.TryGetValue("insuranceFailed", out var insuranceFailedTemplates)) + { insurance.MessageTemplateId = _randomUtil.GetArrayValue(insuranceFailedTemplates); + } + } // Send the insurance message _mailSendService.SendLocalisedNpcMessageToPlayer( @@ -556,7 +626,10 @@ public class InsuranceController( private bool? RollForDelete(string traderId, Item? insuredItem = null) { var trader = _traderHelper.GetTraderById(traderId); - if (trader is null) return null; + if (trader is null) + { + return null; + } const int maxRoll = 9999; const int conversionFactor = 100; @@ -569,7 +642,9 @@ public class InsuranceController( var itemName = insuredItem is not null ? $"{_itemHelper.GetItemName(insuredItem.Template)}" : ""; var status = roll ? "Delete" : "Keep"; if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Rolling {itemName} with {trader} - Return {traderReturnChance}% - Roll: {returnChance} - Status: {status}"); + } return roll; } @@ -577,7 +652,7 @@ public class InsuranceController( /** * Handle Insure event * Add insurance to an item - * + * * @param pmcData Player profile * @param body Insurance request * @param sessionID Session id @@ -594,6 +669,7 @@ public class InsuranceController( // Get price of all items being insured, add to 'itemsToPay' foreach (var key in body.Items) + { itemsToPay.Add( new IdWithCount { @@ -605,6 +681,7 @@ public class InsuranceController( ) } ); + } var options = new ProcessBuyTradeRequestData { @@ -619,15 +696,27 @@ public class InsuranceController( // pay for the item insurance _paymentService.PayMoney(pmcData, options, sessionId, output); - if (output.Warnings?.Count > 0) return output; + if (output.Warnings?.Count > 0) + { + return output; + } // add items to InsuredItems list once money has been paid pmcData.InsuredItems ??= []; foreach (var key in body.Items) { - pmcData.InsuredItems.Add(new InsuredItem { TId = body.TransactionId, ItemId = inventoryItemsHash[key].Id }); + pmcData.InsuredItems.Add( + new InsuredItem + { + TId = body.TransactionId, + ItemId = inventoryItemsHash[key].Id + } + ); // If Item is Helmet or Body Armour -> Handle insurance of soft inserts - if (_itemHelper.ArmorItemHasRemovableOrSoftInsertSlots(inventoryItemsHash[key].Template)) InsureSoftInserts(inventoryItemsHash[key], pmcData, body); + if (_itemHelper.ArmorItemHasRemovableOrSoftInsertSlots(inventoryItemsHash[key].Template)) + { + InsureSoftInserts(inventoryItemsHash[key], pmcData, body); + } } _profileHelper.AddSkillPointsToPlayer(pmcData, SkillTypes.Charisma, itemsToInsureCount * 0.01); @@ -651,16 +740,25 @@ public class InsuranceController( foreach (var softInsertSlot in softInsertSlots) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"SoftInsertSlots: {softInsertSlot.SlotId}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"SoftInsertSlots: {softInsertSlot.SlotId}"); + } - pmcData.InsuredItems.Add(new InsuredItem { TId = body.TransactionId, ItemId = softInsertSlot.Id }); + pmcData.InsuredItems.Add( + new InsuredItem + { + TId = body.TransactionId, + ItemId = softInsertSlot.Id + } + ); } } /** * Handle client/insurance/items/list/cost * Calculate insurance cost - * + * * @param request request object * @param sessionID session id * @returns IGetInsuranceCostResponseData object to send to client @@ -683,7 +781,11 @@ public class InsuranceController( // Ensure hash has item in it if (!inventoryItemsHash.ContainsKey(itemId)) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Item with id: {itemId} missing from player inventory, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Item with id: {itemId} missing from player inventory, skipping"); + } + continue; } diff --git a/Libraries/Core/Controllers/InventoryController.cs b/Libraries/Core/Controllers/InventoryController.cs index 69664b58..0e356215 100644 --- a/Libraries/Core/Controllers/InventoryController.cs +++ b/Libraries/Core/Controllers/InventoryController.cs @@ -1,18 +1,18 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Inventory; using Core.Models.Eft.ItemEvent; +using Core.Models.Eft.Profile; using Core.Models.Enums; +using Core.Models.Spt.Dialog; using Core.Models.Utils; using Core.Routers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; -using Core.Models.Eft.Profile; -using Core.Models.Spt.Dialog; +using SptCommon.Annotations; namespace Core.Controllers; @@ -44,7 +44,10 @@ public class InventoryController( public void MoveItem(PmcData pmcData, InventoryMoveRequestData moveRequest, string sessionId, ItemEventRouterResponse output) { - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } // Changes made to result apply to character inventory var ownerInventoryItems = _inventoryHelper.GetOwnerInventoryItems(moveRequest, moveRequest.Item, sessionId); @@ -83,7 +86,9 @@ 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") || originalLocationSlotId.StartsWith("dogtag"))) + { _hideoutHelper.ApplyPlaceOfFameDogtagBonus(pmcData); + } } else { @@ -100,7 +105,7 @@ public class InventoryController( _httpResponseUtil.AppendErrorToOutput( output, _localisationService.GetText("inventory-edit_trader_item"), - (BackendErrorCodes)228 + (BackendErrorCodes) 228 ); } @@ -153,32 +158,32 @@ public class InventoryController( _logger.Success($"Set trader {mailEvent.Entity}: Standing to: {mailEvent.Value}"); break; case ProfileChangeEventType.ProfileLevel: - pmcData.Info.Experience = (int)mailEvent.Value.Value; + pmcData.Info.Experience = (int) mailEvent.Value.Value; // Will calculate level below _traderHelper.ValidateTraderStandingsAndPlayerLevelForProfile(sessionId); _logger.Success($"Set profile xp to: {mailEvent.Value}"); break; case ProfileChangeEventType.SkillPoints: - { - var profileSkill = pmcData.Skills.Common.FirstOrDefault(x => x.Id == mailEvent.Entity); - if (profileSkill is null) { - _logger.Warning($"Unable to find skill with name: {mailEvent.Entity}"); - continue; + var profileSkill = pmcData.Skills.Common.FirstOrDefault(x => x.Id == mailEvent.Entity); + if (profileSkill is null) + { + _logger.Warning($"Unable to find skill with name: {mailEvent.Entity}"); + continue; + } + + profileSkill.Progress = mailEvent.Value; + _logger.Success($"Set profile skill: {mailEvent.Entity} to: {mailEvent.Value}"); + break; } - - profileSkill.Progress = mailEvent.Value; - _logger.Success($"Set profile skill: {mailEvent.Entity} to: {mailEvent.Value}"); - break; - } case ProfileChangeEventType.ExamineAllItems: - { - var itemsToInspect = _itemHelper.GetItems().Where(x => x.Type != "Node"); - FlagItemsAsInspectedAndRewardXp(itemsToInspect.Select(x => x.Id), fullProfile); - _logger.Success($"Flagged {itemsToInspect.Count()} items as examined"); + { + var itemsToInspect = _itemHelper.GetItems().Where(x => x.Type != "Node"); + FlagItemsAsInspectedAndRewardXp(itemsToInspect.Select(x => x.Id), fullProfile); + _logger.Success($"Flagged {itemsToInspect.Count()} items as examined"); - break; - } + break; + } case ProfileChangeEventType.UnlockTrader: pmcData.TradersInfo[mailEvent.Entity].Unlocked = true; _logger.Success($"Trader {mailEvent.Entity} Unlocked"); @@ -191,16 +196,19 @@ public class InventoryController( break; case ProfileChangeEventType.HideoutAreaLevel: - { - var areaName = mailEvent.Entity; - var newValue = mailEvent.Value; - var hideoutAreaType = Enum.Parse(areaName ?? "NOTSET"); + { + var areaName = mailEvent.Entity; + var newValue = mailEvent.Value; + var hideoutAreaType = Enum.Parse(areaName ?? "NOTSET"); - var desiredArea = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == hideoutAreaType); - if (desiredArea is not null) desiredArea.Level = newValue; + var desiredArea = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == hideoutAreaType); + if (desiredArea is not null) + { + desiredArea.Level = newValue; + } - break; - } + break; + } default: _logger.Warning($"Unhandled profile reward event: {mailEvent.Type}"); @@ -265,7 +273,10 @@ public class InventoryController( var containerSettings = _inventoryHelper.GetInventoryConfig().SealedAirdropContainer; rewards.AddRange(_lootGenerator.GetSealedWeaponCaseLoot(containerSettings)); - if (containerSettings.FoundInRaid) foundInRaid = containerSettings.FoundInRaid; + if (containerSettings.FoundInRaid) + { + foundInRaid = containerSettings.FoundInRaid; + } } else { @@ -278,7 +289,10 @@ public class InventoryController( { rewards.AddRange(_lootGenerator.GetRandomLootContainerLoot(rewardContainerDetails)); - if (rewardContainerDetails.FoundInRaid) foundInRaid = rewardContainerDetails.FoundInRaid; + if (rewardContainerDetails.FoundInRaid) + { + foundInRaid = rewardContainerDetails.FoundInRaid; + } } } @@ -293,7 +307,10 @@ public class InventoryController( UseSortingTable = true }; _inventoryHelper.AddItemsToStash(sessionId, addItemsRequest, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } } // Find and delete opened container item from player inventory @@ -345,16 +362,23 @@ public class InventoryController( inventoryItem.ParentId = change.ParentId; inventoryItem.SlotId = change.SlotId; if (change.Location is not null) + { inventoryItem.Location = change.Location; + } else + { inventoryItem.Location = null; + } } } public ItemEventRouterResponse ReadEncyclopedia(PmcData pmcData, InventoryReadEncyclopediaRequestData body, string sessionId) { - foreach (var id in body.Ids) pmcData.Encyclopedia[id] = true; + foreach (var id in body.Ids) + { + pmcData.Encyclopedia[id] = true; + } return _eventOutputHolder.GetOutput(sessionId); } @@ -364,6 +388,7 @@ public class InventoryController( { string? itemId = null; if (request.FromOwner is not null) + { try { itemId = GetExaminedItemTpl(request, sessionId); @@ -372,17 +397,25 @@ public class InventoryController( { _logger.Error(_localisationService.GetText("inventory-examine_item_does_not_exist", request.Item)); } + } if (itemId is null) // item template + { if (_databaseService.GetItems().ContainsKey(request.Item)) + { itemId = request.Item; + } + } if (itemId is null) { // Player inventory var target = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item); - if (target is not null) itemId = target.Template; + if (target is not null) + { + itemId = target.Template; + } } if (itemId is not null) @@ -394,25 +427,35 @@ public class InventoryController( protected string? GetExaminedItemTpl(InventoryExamineRequestData request, string? sessionId) { - if (_presetHelper.IsPreset(request.Item)) return _presetHelper.GetBaseItemTpl(request.Item); + if (_presetHelper.IsPreset(request.Item)) + { + return _presetHelper.GetBaseItemTpl(request.Item); + } if (request.FromOwner.Id == Traders.FENCE) // Get tpl from fence assorts + { return _fenceService.GetRawFenceAssorts().Items.FirstOrDefault(x => x.Id == request.Item)?.Template; + } if (request.FromOwner.Type == "Trader") // Not fence // get tpl from trader assort + { return _databaseService .GetTrader(request.FromOwner.Id) .Assort.Items.FirstOrDefault(item => item.Id == request.Item) ?.Template; + } if (request.FromOwner.Type == "RagFair") { // Try to get tplId from items.json first var item = _itemHelper.GetItem(request.Item); - if (item.Key) return item.Value.Id; + if (item.Key) + { + return item.Value.Id; + } // Try alternate way of getting offer if first approach fails var offer = _ragfairOfferService.GetOfferByOfferId(request.Item) ?? @@ -420,14 +463,20 @@ public class InventoryController( // Try find examine item inside offer items array var matchingItem = offer.Items.FirstOrDefault(offerItem => offerItem.Id == request.Item); - if (matchingItem is not null) return matchingItem.Template; + if (matchingItem is not null) + { + return matchingItem.Template; + } // Unable to find item in database or ragfair _logger.Warning(_localisationService.GetText("inventory-unable_to_find_item", request.Item)); } // get hideout item - if (request.FromOwner.Type == "HideoutProduction") return request.Item; + if (request.FromOwner.Type == "HideoutProduction") + { + return request.Item; + } if (request.FromOwner.Type == "Mail") { @@ -441,7 +490,10 @@ public class InventoryController( // get the Id given and get the Template ID from that var item = message.Items.Data.FirstOrDefault(item => item.Id == request.Item); - if (item is not null) return item.Template; + if (item is not null) + { + return item.Template; + } } _logger.Error($"Unable to get item with id: {request.Item}"); @@ -481,13 +533,20 @@ public class InventoryController( $"Unable to tag item: {request.Item} as it cannot be found in player {sessionId} inventory" ); - return new ItemEventRouterResponse { Warnings = [], ProfileChanges = { } }; + return new ItemEventRouterResponse + { + Warnings = [] + }; } // Null guard itemToTag.Upd ??= new Upd(); - itemToTag.Upd.Tag = new UpdTag { Color = request.TagColor, Name = request.TagName }; + itemToTag.Upd.Tag = new UpdTag + { + Color = request.TagColor, + Name = request.TagName + }; return _eventOutputHolder.GetOutput(sessionId); } @@ -499,7 +558,9 @@ public class InventoryController( // Fix for toggling items while on they're in the Scav inventory if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id) + { playerData = _profileHelper.GetScavProfile(sessionId); + } var itemToToggle = playerData.Inventory.Items.FirstOrDefault(x => x.Id == request.Item); if (itemToToggle is not null) @@ -509,14 +570,20 @@ public class InventoryController( _localisationService.GetText("inventory-item_to_toggle_missing_upd", itemToToggle.Id) ); - itemToToggle.Upd.Togglable = new UpdTogglable() { On = request.Value }; + itemToToggle.Upd.Togglable = new UpdTogglable + { + On = request.Value + }; return _eventOutputHolder.GetOutput(sessionId); } _logger.Warning(_localisationService.GetText("inventory-unable_to_toggle_item_not_found", request.Item)); - return new ItemEventRouterResponse { Warnings = [], ProfileChanges = { } }; + return new ItemEventRouterResponse + { + Warnings = [] + }; } public ItemEventRouterResponse FoldItem(PmcData pmcData, InventoryFoldRequestData request, string sessionId) @@ -525,7 +592,10 @@ public class InventoryController( var playerData = pmcData; // We may be folding data on scav profile, get that profile instead - if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id) playerData = _profileHelper.GetScavProfile(sessionId); + if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id) + { + playerData = _profileHelper.GetScavProfile(sessionId); + } var itemToFold = playerData.Inventory.Items.FirstOrDefault(item => item?.Id == request.Item); if (itemToFold is null) @@ -535,13 +605,19 @@ public class InventoryController( _localisationService.GetText("inventory-unable_to_fold_item_not_found_in_inventory", request.Item) ); - return new ItemEventRouterResponse { Warnings = [], ProfileChanges = { } }; + return new ItemEventRouterResponse + { + Warnings = [] + }; } // Item may not have upd object _itemHelper.AddUpdObjectToItem(itemToFold); - itemToFold.Upd.Foldable = new UpdFoldable { Folded = request.Value }; + itemToFold.Upd.Foldable = new UpdFoldable + { + Folded = request.Value + }; return _eventOutputHolder.GetOutput(sessionId); } @@ -555,10 +631,14 @@ public class InventoryController( { // During post-raid scav transfer, the swap may be in the scav inventory var playerData = pmcData; - if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id) playerData = _profileHelper.GetScavProfile(sessionId); + if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id) + { + playerData = _profileHelper.GetScavProfile(sessionId); + } var itemOne = playerData.Inventory.Items.FirstOrDefault(x => x.Id == request.Item); if (itemOne is null) + { _logger.Error( _localisationService.GetText( "inventory-unable_to_find_item_to_swap", @@ -569,9 +649,11 @@ public class InventoryController( } ) ); + } var itemTwo = playerData.Inventory.Items.FirstOrDefault(x => x.Id == request.Item2); if (itemTwo is null) + { _logger.Error( _localisationService.GetText( "inventory-unable_to_find_item_to_swap", @@ -582,6 +664,7 @@ public class InventoryController( } ) ); + } // to.id is the parentid itemOne.ParentId = request.To.Id; @@ -591,16 +674,24 @@ public class InventoryController( // Request object has location data, add it in, otherwise remove existing location from object if (request.To.Location is not null) + { itemOne.Location = request.To.Location; + } else + { itemOne.Location = null; + } itemTwo.ParentId = request.To2.Id; itemTwo.SlotId = request.To2.Container; if (request.To2.Location is not null) + { itemTwo.Location = request.To2.Location; + } else + { itemTwo.Location = null; + } // Client already informed of inventory locations, nothing for us to do return _eventOutputHolder.GetOutput(sessionId); @@ -644,17 +735,27 @@ public class InventoryController( return; } - sourceItem.Upd ??= new Upd { StackObjectsCount = 1 }; + sourceItem.Upd ??= new Upd + { + StackObjectsCount = 1 + }; var sourceStackCount = sourceItem.Upd.StackObjectsCount; if (sourceStackCount > request.Count) // Source items stack count greater than new desired count + { sourceItem.Upd.StackObjectsCount = sourceStackCount - request.Count; + } else // Moving a full stack onto a smaller stack + { sourceItem.Upd.StackObjectsCount = sourceStackCount - 1; + } - destinationItem.Upd ??= new Upd { StackObjectsCount = 1 }; + destinationItem.Upd ??= new Upd + { + StackObjectsCount = 1 + }; var destinationStackCount = destinationItem.Upd.StackObjectsCount; destinationItem.Upd.StackObjectsCount = destinationStackCount + request.Count; @@ -667,7 +768,7 @@ public class InventoryController( var inventoryItems = _inventoryHelper.GetOwnerInventoryItems(body, body.Item, sessionID); // Get source item (can be from player or trader or mail) - var sourceItem = inventoryItems.From.FirstOrDefault((x) => x.Id == body.Item); + var sourceItem = inventoryItems.From.FirstOrDefault(x => x.Id == body.Item); if (sourceItem is null) { var errorMessage = $"Unable to merge stacks as source item: {body.With} cannot be found"; @@ -679,7 +780,7 @@ public class InventoryController( } // Get item being merged into - var destinationItem = inventoryItems.To.FirstOrDefault((x) => x.Id == body.With); + var destinationItem = inventoryItems.To.FirstOrDefault(x => x.Id == body.With); if (destinationItem is null) { var errorMessage = $"Unable to merge stacks as destination item: {body.With} cannot be found"; @@ -692,25 +793,44 @@ public class InventoryController( if (destinationItem.Upd?.StackObjectsCount is null) // No stackcount on destination, add one - destinationItem.Upd = new Upd { StackObjectsCount = 1 }; + { + destinationItem.Upd = new Upd + { + StackObjectsCount = 1 + }; + } if (sourceItem.Upd is null) - sourceItem.Upd = new Upd { StackObjectsCount = 1 }; + { + sourceItem.Upd = new Upd + { + StackObjectsCount = 1 + }; + } else if (sourceItem.Upd.StackObjectsCount is null) // Items pulled out of raid can have no stack count if the stack should be 1 + { sourceItem.Upd.StackObjectsCount = 1; + } // Remove FiR status from destination stack when source stack has no FiR but destination does if (!sourceItem.Upd.SpawnedInSession.GetValueOrDefault(false) && destinationItem.Upd.SpawnedInSession.GetValueOrDefault(false)) + { destinationItem.Upd.SpawnedInSession = false; + } destinationItem.Upd.StackObjectsCount += sourceItem.Upd.StackObjectsCount; // Add source stackcount to destination output.ProfileChanges[sessionID] - .Items.DeletedItems.Add(new Item { Id = sourceItem.Id }); // Inform client source item being deleted + .Items.DeletedItems.Add( + new Item + { + Id = sourceItem.Id + } + ); // Inform client source item being deleted - var indexOfItemToRemove = inventoryItems.From.FindIndex((x) => x.Id == sourceItem.Id); + var indexOfItemToRemove = inventoryItems.From.FindIndex(x => x.Id == sourceItem.Id); if (indexOfItemToRemove == -1) { var errorMessage = $"Unable to find item: {sourceItem.Id} to remove from sender inventory"; @@ -733,12 +853,12 @@ public class InventoryController( // Handle cartridge edge-case if (request.Container.Location is null && request.Container.ContainerName == "cartridges") { - var matchingItems = inventoryItems.To.Where((x) => x.ParentId == request.Container.Id); + var matchingItems = inventoryItems.To.Where(x => x.ParentId == request.Container.Id); request.Container.Location = matchingItems.Count(); // Wrong location for first cartridge } // The item being merged has three possible sources: pmc, scav or mail, getOwnerInventoryItems() handles getting correct one - var itemToSplit = inventoryItems.From.FirstOrDefault((x) => x.Id == request.SplitItem); + var itemToSplit = inventoryItems.From.FirstOrDefault(x => x.Id == request.SplitItem); if (itemToSplit is null) { var errorMessage = $"Unable to split stack as source item: {request.SplitItem} cannot be found"; diff --git a/Libraries/Core/Controllers/LauncherController.cs b/Libraries/Core/Controllers/LauncherController.cs index d29b6296..69de49bd 100644 --- a/Libraries/Core/Controllers/LauncherController.cs +++ b/Libraries/Core/Controllers/LauncherController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Launcher; @@ -9,6 +8,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; using Info = Core.Models.Eft.Profile.Info; @@ -40,7 +40,7 @@ public class LauncherController( .Where(profileName => !_coreConfig.Features.CreateNewProfileTypesBlacklist.Contains(profileName)) .ToList(); - return new ConnectResponse() + return new ConnectResponse { BackendUrl = _httpServerHelper.GetBackendUrl(), Name = _coreConfig.ServerName, @@ -83,7 +83,10 @@ public class LauncherController( foreach (var kvp in _saveServer.GetProfiles()) { var account = _saveServer.GetProfile(kvp.Key).ProfileInfo; - if (info?.Username == account?.Username) return kvp.Key; + if (info?.Username == account?.Username) + { + return kvp.Key; + } } return null; @@ -92,8 +95,12 @@ public class LauncherController( public string Register(RegisterData info) { foreach (var kvp in _saveServer.GetProfiles()) + { if (info.Username == _saveServer.GetProfile(kvp.Key).ProfileInfo?.Username) + { return ""; + } + } return CreateAccount(info); } @@ -139,7 +146,10 @@ public class LauncherController( { var sessionID = Login(info); - if (!string.IsNullOrEmpty(sessionID)) _saveServer.GetProfile(sessionID).ProfileInfo!.Username = info.Change; + if (!string.IsNullOrEmpty(sessionID)) + { + _saveServer.GetProfile(sessionID).ProfileInfo!.Username = info.Change; + } return sessionID; } @@ -148,7 +158,10 @@ public class LauncherController( { var sessionID = Login(info); - if (!string.IsNullOrEmpty(sessionID)) _saveServer.GetProfile(sessionID).ProfileInfo!.Password = info.Change; + if (!string.IsNullOrEmpty(sessionID)) + { + _saveServer.GetProfile(sessionID).ProfileInfo!.Password = info.Change; + } return sessionID; } @@ -160,7 +173,10 @@ public class LauncherController( */ public string? Wipe(RegisterData info) { - if (!_coreConfig.AllowProfileWipe) return null; + if (!_coreConfig.AllowProfileWipe) + { + return null; + } var sessionID = Login(info); diff --git a/Libraries/Core/Controllers/LauncherV2Controller.cs b/Libraries/Core/Controllers/LauncherV2Controller.cs index e4afb813..bed8aca3 100644 --- a/Libraries/Core/Controllers/LauncherV2Controller.cs +++ b/Libraries/Core/Controllers/LauncherV2Controller.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Launcher; using Core.Models.Spt.Config; @@ -7,6 +6,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; using Info = Core.Models.Eft.Profile.Info; @@ -28,7 +28,7 @@ public class LauncherV2Controller( protected CoreConfig _coreConfig = _configServer.GetConfig(); /// - /// Returns a simple string of Pong! + /// Returns a simple string of Pong! /// /// public string Ping() @@ -37,8 +37,8 @@ public class LauncherV2Controller( } /// - /// Returns all available profile types and descriptions for creation. - /// - This is also localised. + /// Returns all available profile types and descriptions for creation. + /// - This is also localised. /// /// public Dictionary Types() @@ -63,7 +63,7 @@ public class LauncherV2Controller( } /// - /// Checks if login details were correct. + /// Checks if login details were correct. /// /// /// @@ -75,22 +75,26 @@ public class LauncherV2Controller( } /// - /// Register a new profile. + /// Register a new profile. /// /// /// public bool Register(RegisterData info) { foreach (var session in _saveServer.GetProfiles()) + { if (info.Username == _saveServer.GetProfile(session.Key).ProfileInfo!.Username) + { return false; + } + } CreateAccount(info); return true; } /// - /// Make a password change. + /// Make a password change. /// /// /// @@ -99,14 +103,16 @@ public class LauncherV2Controller( var sessionId = GetSessionId(info); if (sessionId is null) + { return false; + } _saveServer.GetProfile(sessionId).ProfileInfo!.Password = info.Password; return true; } /// - /// Remove profile from server. + /// Remove profile from server. /// /// /// @@ -118,8 +124,8 @@ public class LauncherV2Controller( } /// - /// Gets the Servers SPT Version. - /// - "4.0.0" + /// Gets the Servers SPT Version. + /// - "4.0.0" /// /// public string SptVersion() @@ -128,8 +134,8 @@ public class LauncherV2Controller( } /// - /// Gets the compatible EFT Version. - /// - "0.14.9.31124" + /// Gets the compatible EFT Version. + /// - "0.14.9.31124" /// /// public string EftVersion() @@ -138,7 +144,7 @@ public class LauncherV2Controller( } /// - /// Gets the Servers loaded mods. + /// Gets the Servers loaded mods. /// /// public Dictionary LoadedMods() @@ -147,7 +153,7 @@ public class LauncherV2Controller( } /// - /// Creates the account from provided details. + /// Creates the account from provided details. /// /// /// @@ -192,8 +198,12 @@ public class LauncherV2Controller( protected string? GetSessionId(LoginRequestData info) { foreach (var profile in _saveServer.GetProfiles()) + { if (info.Username == profile.Value.ProfileInfo!.Username && info.Password == profile.Value.ProfileInfo.Password) + { return profile.Key; + } + } return null; } diff --git a/Libraries/Core/Controllers/LocationController.cs b/Libraries/Core/Controllers/LocationController.cs index 5198e812..1f0530cf 100644 --- a/Libraries/Core/Controllers/LocationController.cs +++ b/Libraries/Core/Controllers/LocationController.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Location; using Core.Models.Utils; using Core.Services; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -19,8 +19,8 @@ public class LocationController( ) { /// - /// Handle client/locations - /// Get all maps base location properties without loot data + /// Handle client/locations + /// Get all maps base location properties without loot data /// /// Players Id /// LocationsGenerateAllResponse @@ -37,7 +37,11 @@ public class LocationController( var mapBase = kvp.Value.Base; if (mapBase == null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Map: {kvp} has no base json file, skipping generation"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Map: {kvp} has no base json file, skipping generation"); + } + continue; } @@ -55,13 +59,16 @@ public class LocationController( } /// - /// Handle client/airdrop/loot + /// Handle client/airdrop/loot /// /// /// public GetAirdropLootResponse GetAirDropLoot(GetAirdropLootRequest? request) { - if (request?.ContainerId is not null) return _airdropService.GenerateCustomAirdropLoot(request); + if (request?.ContainerId is not null) + { + return _airdropService.GenerateCustomAirdropLoot(request); + } return _airdropService.GenerateAirdropLoot(); } diff --git a/Libraries/Core/Controllers/MatchController.cs b/Libraries/Core/Controllers/MatchController.cs index a7fe9111..51fcf70e 100644 --- a/Libraries/Core/Controllers/MatchController.cs +++ b/Libraries/Core/Controllers/MatchController.cs @@ -1,11 +1,11 @@ using Core.Context; -using SptCommon.Annotations; using Core.Models.Eft.Match; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils.Cloners; +using SptCommon.Annotations; using static Core.Services.MatchLocationService; namespace Core.Controllers; @@ -25,7 +25,6 @@ public class MatchController( protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// /// /// public bool GetEnabled() @@ -34,7 +33,7 @@ public class MatchController( } /// - /// Handle client/match/group/delete + /// Handle client/match/group/delete /// /// public void DeleteGroup(DeleteGroupRequest info) // TODO: info is `any` in the node server @@ -43,7 +42,7 @@ public class MatchController( } /// - /// Handle match/group/start_game + /// Handle match/group/start_game /// /// /// @@ -78,13 +77,13 @@ public class MatchController( } /// - /// Handle client/match/group/status + /// Handle client/match/group/status /// /// /// public MatchGroupStatusResponse GetGroupStatus(MatchGroupStatusRequest info) { - return new MatchGroupStatusResponse() + return new MatchGroupStatusResponse { Players = [], MaxPveCountExceeded = false @@ -92,7 +91,7 @@ public class MatchController( } /// - /// Handle /client/raid/configuration + /// Handle /client/raid/configuration /// /// /// @@ -105,26 +104,31 @@ public class MatchController( // Set pmcs to difficulty set in pre-raid screen if override in bot config isnt enabled if (!_pmcConfig.UseDifficultyOverride) + { _pmcConfig.Difficulty = ConvertDifficultyDropdownIntoBotDifficulty( request.WavesSettings.BotDifficulty.ToString() ); + } } /// - /// Convert a difficulty value from pre-raid screen to a bot difficulty + /// Convert a difficulty value from pre-raid screen to a bot difficulty /// /// dropdown difficulty value /// bot difficulty private string ConvertDifficultyDropdownIntoBotDifficulty(string botDifficulty) { // Edge case medium - must be altered - if (botDifficulty.ToLower() == "medium") return "normal"; + if (botDifficulty.ToLower() == "medium") + { + return "normal"; + } return botDifficulty; } /// - /// Handle client/match/local/start + /// Handle client/match/local/start /// /// /// @@ -135,7 +139,7 @@ public class MatchController( } /// - /// Handle client/match/local/end + /// Handle client/match/local/end /// /// /// diff --git a/Libraries/Core/Controllers/NoteController.cs b/Libraries/Core/Controllers/NoteController.cs index 8a923d03..621ecd4b 100644 --- a/Libraries/Core/Controllers/NoteController.cs +++ b/Libraries/Core/Controllers/NoteController.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Notes; using Core.Routers; +using SptCommon.Annotations; namespace Core.Controllers; @@ -12,7 +12,6 @@ public class NoteController( ) { /// - /// /// /// /// @@ -23,14 +22,17 @@ public class NoteController( NoteActionData body, string sessionId) { - var newNote = new Note { Time = body.Note.Time, Text = body.Note.Text }; + var newNote = new Note + { + Time = body.Note.Time, + Text = body.Note.Text + }; pmcData.Notes.DataNotes.Add(newNote); return _eventOutputHolder.GetOutput(sessionId); } /// - /// /// /// /// @@ -49,7 +51,6 @@ public class NoteController( } /// - /// /// /// /// diff --git a/Libraries/Core/Controllers/NotifierController.cs b/Libraries/Core/Controllers/NotifierController.cs index fb913630..c0c74c73 100644 --- a/Libraries/Core/Controllers/NotifierController.cs +++ b/Libraries/Core/Controllers/NotifierController.cs @@ -1,9 +1,6 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Notifier; -using static System.Runtime.InteropServices.JavaScript.JSType; -using Core.Services; -using System.Diagnostics.Tracing; +using SptCommon.Annotations; namespace Core.Controllers; @@ -14,11 +11,10 @@ public class NotifierController( ) { /// - /// Resolve an array of session notifications. - /// - /// If no notifications are currently queued then intermittently check for new notifications until either - /// one or more appear or when a timeout expires. - /// If no notifications are available after the timeout, use a default message. + /// Resolve an array of session notifications. + /// If no notifications are currently queued then intermittently check for new notifications until either + /// one or more appear or when a timeout expires. + /// If no notifications are available after the timeout, use a default message. /// /// public async Task NotifyAsync(string sessionId) @@ -67,7 +63,7 @@ public class NotifierController( } /// - /// Handle client/notifier/channel/create + /// Handle client/notifier/channel/create /// /// /// @@ -84,7 +80,6 @@ public class NotifierController( } /// - /// /// /// /// diff --git a/Libraries/Core/Controllers/PresetController.cs b/Libraries/Core/Controllers/PresetController.cs index 7c18d72f..9064e64e 100644 --- a/Libraries/Core/Controllers/PresetController.cs +++ b/Libraries/Core/Controllers/PresetController.cs @@ -1,8 +1,7 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Utils; using Core.Services; - +using SptCommon.Annotations; namespace Core.Controllers; @@ -14,7 +13,7 @@ public class PresetController( ) { /// - /// Keyed by item tpl, value = collection of preset ids + /// Keyed by item tpl, value = collection of preset ids /// public void Initialize() { diff --git a/Libraries/Core/Controllers/PrestigeController.cs b/Libraries/Core/Controllers/PrestigeController.cs index 353ba8ed..a9f7f850 100644 --- a/Libraries/Core/Controllers/PrestigeController.cs +++ b/Libraries/Core/Controllers/PrestigeController.cs @@ -1,5 +1,4 @@ using System.Text.Json; -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -13,9 +12,9 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; - namespace Core.Controllers; [Injectable] @@ -32,9 +31,9 @@ public class PrestigeController( ) { protected double _prestigePercentage = 0.05; - + /// - /// Handle /client/prestige/list + /// Handle /client/prestige/list /// /// /// @@ -47,33 +46,33 @@ public class PrestigeController( } /// - /// Handle /client/prestige/obtain - /// Going to Prestige 1 grants the below - /// - /// 5% of skills should be transfered over - /// 5% of mastering should be transfered over - /// Earned achievements should be transfered over - /// Profile stats should be transfered over - /// Prestige progress should be transfered over - /// Items and rewards for Prestige 1 - /// - /// Going to Prestige 2 grants the below - /// - /// 10% of skills should be transfered over - /// 10% of mastering should be transfered over - /// Earned achievements should be transfered over - /// Profile stats should be transfered over - /// Prestige progress should be transfered over - /// Items and rewards for Prestige 2 - /// - /// Each time reseting the below - /// - /// Trader standing - /// Task progress - /// Character level - /// Stash - /// Hideout progress - /// + /// Handle /client/prestige/obtain + /// Going to Prestige 1 grants the below + /// + /// 5% of skills should be transfered over + /// 5% of mastering should be transfered over + /// Earned achievements should be transfered over + /// Profile stats should be transfered over + /// Prestige progress should be transfered over + /// Items and rewards for Prestige 1 + /// + /// Going to Prestige 2 grants the below + /// + /// 10% of skills should be transfered over + /// 10% of mastering should be transfered over + /// Earned achievements should be transfered over + /// Profile stats should be transfered over + /// Prestige progress should be transfered over + /// Items and rewards for Prestige 2 + /// + /// Each time reseting the below + /// + /// Trader standing + /// Task progress + /// Character level + /// Stash + /// Hideout progress + /// /// /// public void ObtainPrestige( @@ -90,7 +89,7 @@ public class PrestigeController( HeadId = prePrestigePmc.Customization.Head, VoiceId = _databaseService.GetTemplates() .Customization.FirstOrDefault( - (customisation) => customisation.Value.Name == prePrestigePmc.Info.Voice + customisation => customisation.Value.Name == prePrestigePmc.Info.Voice ) .Value.Id }; @@ -100,22 +99,26 @@ public class PrestigeController( // Get freshly reset profile ready for editing var newProfile = _profileHelper.GetFullProfile(sessionId); - + // set this here so we can use the prestigeLevel for further calcs newProfile.CharacterData.PmcData.Info.PrestigeLevel = prePrestigePmc.Info.PrestigeLevel ?? 0; newProfile.CharacterData.PmcData.Info.PrestigeLevel++; - + // Copy skills to new profile var commonSkillsToCopy = prePrestigePmc.Skills.Common; foreach (var skillToCopy in commonSkillsToCopy) { // Set progress 5% of what it was * prestige level to get 5% or 10% for prestige 1 or 2 respectivly - skillToCopy.Progress = (skillToCopy.Progress.Value * _prestigePercentage) * newProfile.CharacterData.PmcData.Info.PrestigeLevel; - var existingSkill = newProfile.CharacterData.PmcData.Skills.Common.FirstOrDefault((skill) => skill.Id == skillToCopy.Id); + skillToCopy.Progress = skillToCopy.Progress.Value * _prestigePercentage * newProfile.CharacterData.PmcData.Info.PrestigeLevel; + 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); + } } // Copy mastering to new profile @@ -123,14 +126,18 @@ public class PrestigeController( foreach (var skillToCopy in masteringSkillsToCopy) { // Set progress 5% of what it was * prestige level to get 5% or 10% for prestige 1 or 2 respectivly - skillToCopy.Progress = (skillToCopy.Progress.Value * _prestigePercentage) * newProfile.CharacterData.PmcData.Info.PrestigeLevel; + skillToCopy.Progress = skillToCopy.Progress.Value * _prestigePercentage * newProfile.CharacterData.PmcData.Info.PrestigeLevel; var existingSkill = newProfile.CharacterData.PmcData.Skills.Mastering.FirstOrDefault( - (skill) => skill.Id == skillToCopy.Id + skill => skill.Id == skillToCopy.Id ); if (existingSkill is not null) + { existingSkill.Progress = skillToCopy.Progress; + } else + { newProfile.CharacterData.PmcData.Skills.Mastering.Add(skillToCopy); + } } // Add existing completed achievements and new one for prestige @@ -138,7 +145,9 @@ public class PrestigeController( // Add "Prestigious" achievement if (!newProfile.CharacterData.PmcData.Achievements.ContainsKey("676091c0f457869a94017a23")) + { newProfile.CharacterData.PmcData.Achievements.Add("676091c0f457869a94017a23", _timeUtil.GetTimeStamp()); + } // TODO: is there one for second prestige // Add existing Stats to profile @@ -153,12 +162,13 @@ public class PrestigeController( // Flag profile as having achieved this prestige level newProfile.CharacterData.PmcData.Prestige[currentPrestigeData.Id] = _timeUtil.GetTimeStamp(); - + if (request is not null) // Copy transferred items + { foreach (var transferRequest in request) { - var item = prePrestigePmc.Inventory.Items.FirstOrDefault((item) => item.Id == transferRequest.Id); + var item = prePrestigePmc.Inventory.Items.FirstOrDefault(item => item.Id == transferRequest.Id); var addItemRequest = new AddItemDirectRequest { ItemWithModsToAdd = [item], @@ -173,6 +183,7 @@ public class PrestigeController( _eventOutputHolder.GetOutput(sessionId) ); } + } // Force save of above changes to disk _saveServer.SaveProfile(sessionId); @@ -181,48 +192,55 @@ public class PrestigeController( private void AddPrestigeRewardsToProfile(string sessionId, SptProfile newProfile, IEnumerable rewards) { foreach (var reward in rewards) + { switch (reward.Type) { case RewardType.CustomizationDirect: - { - _profileHelper.AddHideoutCustomisationUnlock(newProfile, reward, CustomisationSource.PRESTIGE); - break; - } + { + _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() + ((JsonElement) reward.Value).ToObject() ); + } else + { _logger.Error($"Unable to parse reward Target to Enum: {reward.Target}"); + } + break; case RewardType.Item: - { - var addItemRequest = new AddItemDirectRequest { - ItemWithModsToAdd = reward.Items, - FoundInRaid = reward.Items.FirstOrDefault()?.Upd?.SpawnedInSession, - UseSortingTable = false, - Callback = null - }; - _inventoryHelper.AddItemToStash( - sessionId, - addItemRequest, - newProfile.CharacterData.PmcData, - _eventOutputHolder.GetOutput(sessionId) - ); - break; - } - case RewardType.ExtraDailyQuest: - { - _logger.Info("additional quests will be added when generating repeatables"); - break; - } + var addItemRequest = new AddItemDirectRequest + { + ItemWithModsToAdd = reward.Items, + FoundInRaid = reward.Items.FirstOrDefault()?.Upd?.SpawnedInSession, + UseSortingTable = false, + Callback = null + }; + _inventoryHelper.AddItemToStash( + sessionId, + addItemRequest, + newProfile.CharacterData.PmcData, + _eventOutputHolder.GetOutput(sessionId) + ); + break; + } + case RewardType.ExtraDailyQuest: + { + _logger.Info("additional quests will be added when generating repeatables"); + break; + } default: _logger.Error($"Unhandled prestige reward type: {reward.Type}"); break; } + } } } diff --git a/Libraries/Core/Controllers/ProfileController.cs b/Libraries/Core/Controllers/ProfileController.cs index 176b48a7..ac992713 100644 --- a/Libraries/Core/Controllers/ProfileController.cs +++ b/Libraries/Core/Controllers/ProfileController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Eft.Common; @@ -12,6 +11,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Controllers; @@ -51,7 +51,10 @@ public class ProfileController( public MiniProfile GetMiniProfile(string sessionID) { var profile = _saveServer.GetProfile(sessionID); - if (profile?.CharacterData == null) throw new Exception($"Unable to find character data for id: {sessionID}. Profile may be corrupt"); + if (profile?.CharacterData == null) + { + throw new Exception($"Unable to find character data for id: {sessionID}. Profile may be corrupt"); + } var pmc = profile.CharacterData.PmcData; var maxLvl = _profileHelper.GetMaxLevel(); @@ -60,6 +63,7 @@ public class ProfileController( var currlvl = pmc?.Info?.Level.GetValueOrDefault(1); var xpToNextLevel = _profileHelper.GetExperience((currlvl ?? 1) + 1); if (pmc?.Info?.Level == null) + { return new MiniProfile { Username = profile.ProfileInfo?.Username ?? "", @@ -75,6 +79,7 @@ public class ProfileController( ProfileId = profile.ProfileInfo?.ProfileId ?? "", SptData = _profileHelper.GetDefaultSptDataObject() }; + } return new MiniProfile { @@ -128,9 +133,15 @@ public class ProfileController( */ public string ValidateNickname(ValidateNicknameRequestData info, string sessionID) { - if (info.Nickname.Length < 3) return "tooshort"; + if (info.Nickname.Length < 3) + { + return "tooshort"; + } - if (_profileHelper.IsNicknameTaken(info, sessionID)) return "taken"; + if (_profileHelper.IsNicknameTaken(info, sessionID)) + { + return "taken"; + } return "OK"; } @@ -141,7 +152,13 @@ public class ProfileController( */ public string ChangeNickname(ProfileChangeNicknameRequestData info, string sessionID) { - var output = ValidateNickname(new ValidateNicknameRequestData() { Nickname = info.Nickname }, sessionID); + var output = ValidateNickname( + new ValidateNicknameRequestData + { + Nickname = info.Nickname + }, + sessionID + ); if (output == "OK") { @@ -177,7 +194,10 @@ public class ProfileController( { var pmcProfile = profile?.CharacterData?.PmcData; - if (!pmcProfile?.Info?.LowerNickname?.Contains(info.Nickname.ToLower()) ?? false) continue; + if (!pmcProfile?.Info?.LowerNickname?.Contains(info.Nickname.ToLower()) ?? false) + { + continue; + } result.Add(_profileHelper.GetChatRoomMemberFromPmcProfile(pmcProfile)); } @@ -191,13 +211,29 @@ public class ProfileController( public GetProfileStatusResponseData GetProfileStatus(string sessionId) { var account = _saveServer.GetProfile(sessionId).ProfileInfo; - var response = new GetProfileStatusResponseData() + var response = new GetProfileStatusResponseData { MaxPveCountExceeded = false, Profiles = [ - new ProfileStatusData { ProfileId = account.ScavengerId, ProfileToken = null, Status = "Free", Sid = "", Ip = "", Port = 0 }, - new ProfileStatusData { ProfileId = account.ProfileId, ProfileToken = null, Status = "Free", Sid = "", Ip = "", Port = 0 } + new ProfileStatusData + { + ProfileId = account.ScavengerId, + ProfileToken = null, + Status = "Free", + Sid = "", + Ip = "", + Port = 0 + }, + new ProfileStatusData + { + ProfileId = account.ProfileId, + ProfileToken = null, + Status = "Free", + Sid = "", + Ip = "", + Port = 0 + } ] }; @@ -243,7 +279,7 @@ public class ProfileController( { Nickname = profileToViewPmc.Info.Nickname, Side = profileToViewPmc.Info.Side, - Experience = profileToViewPmc.Info.Experience as int?, + Experience = profileToViewPmc.Info.Experience, MemberCategory = profileToViewPmc.Info.MemberCategory as int?, BannedState = profileToViewPmc.Info.BannedState, BannedUntil = profileToViewPmc.Info.BannedUntil, @@ -294,11 +330,20 @@ public class ProfileController( public bool SetChosenProfileIcon(string sessionId, GetProfileSettingsRequest request) { var profileToUpdate = _profileHelper.GetPmcProfile(sessionId); - if (profileToUpdate == null) return false; + if (profileToUpdate == null) + { + return false; + } - if (request.MemberCategory != null) profileToUpdate.Info.SelectedMemberCategory = request.MemberCategory as MemberCategory?; + if (request.MemberCategory != null) + { + profileToUpdate.Info.SelectedMemberCategory = request.MemberCategory as MemberCategory?; + } - if (request.SquadInviteRestriction != null) profileToUpdate.Info.SquadInviteRestriction = request.SquadInviteRestriction; + if (request.SquadInviteRestriction != null) + { + profileToUpdate.Info.SquadInviteRestriction = request.SquadInviteRestriction; + } return true; } diff --git a/Libraries/Core/Controllers/QuestController.cs b/Libraries/Core/Controllers/QuestController.cs index cada27dc..93ec446e 100644 --- a/Libraries/Core/Controllers/QuestController.cs +++ b/Libraries/Core/Controllers/QuestController.cs @@ -1,5 +1,3 @@ -using System.Text.Json; -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -13,7 +11,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; -using SptCommon.Extensions; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -55,7 +53,7 @@ public class QuestController( // Does quest exist in profile // Restarting a failed quest can mean quest exists in profile - var existingQuestStatus = pmcData.Quests.FirstOrDefault((x) => x.QId == acceptedQuest.QuestId); + var existingQuestStatus = pmcData.Quests.FirstOrDefault(x => x.QId == acceptedQuest.QuestId); if (existingQuestStatus is not null) { // Update existing @@ -99,7 +97,7 @@ public class QuestController( MessageType.QUEST_START, messageId, startedQuestRewardItems.ToList(), - _timeUtil.GetHoursAsSeconds((int)_questHelper.GetMailItemRedeemTimeHoursForProfile(pmcData)) + _timeUtil.GetHoursAsSeconds((int) _questHelper.GetMailItemRedeemTimeHoursForProfile(pmcData)) ); // Having accepted new quest, look for newly unlocked quests and inform client of them @@ -107,7 +105,10 @@ public class QuestController( acceptedQuest.QuestId, sessionID ); - if (newlyAccessibleQuests.Count > 0) acceptQuestResponse.ProfileChanges[sessionID].Quests.AddRange(newlyAccessibleQuests); + if (newlyAccessibleQuests.Count > 0) + { + acceptQuestResponse.ProfileChanges[sessionID].Quests.AddRange(newlyAccessibleQuests); + } return acceptQuestResponse; } @@ -117,9 +118,11 @@ public class QuestController( foreach (var condition in questConditions) { if (pmcData.TaskConditionCounters.TryGetValue(condition.Id, out var counter)) + { _logger.Error( $"Unable to add new task condition counter: {condition.ConditionType} for qeust: {questId} to profile: {pmcData.SessionId} as it already exists:" ); + } switch (condition.ConditionType) { @@ -181,7 +184,11 @@ public class QuestController( var matchingQuest = repeatableQuest.ActiveQuests.FirstOrDefault(x => x.Id == acceptedQuest.QuestId); if (matchingQuest is not null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Accepted repeatable quest {acceptedQuest.QuestId} from {repeatableQuest.Name}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Accepted repeatable quest {acceptedQuest.QuestId} from {repeatableQuest.Name}"); + } + matchingQuest.SptRepatableGroupName = repeatableQuest.Name; return matchingQuest; @@ -222,7 +229,7 @@ public class QuestController( if (pmcData.TaskConditionCounters.TryGetValue("ConditionId", out var counter)) { - handedInCount -= (int)(counter.Value ?? 0); + handedInCount -= (int) (counter.Value ?? 0); if (handedInCount <= 0) { @@ -257,23 +264,25 @@ public class QuestController( var matchingItemInProfile = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == itemHandover.Id); if (!(matchingItemInProfile is not null && handoverRequirements.Target.List.Contains(matchingItemInProfile.Template))) // Item handed in by player doesn't match what was requested + { return ShowQuestItemHandoverMatchError( handoverQuestRequest, matchingItemInProfile, handoverRequirements, output ); + } // Remove the right quantity of given items var itemCountToRemove = Math.Min(itemHandover.Count ?? 0, handedInCount - totalItemCountToRemove); totalItemCountToRemove += itemCountToRemove; - if ((itemHandover.Count - itemCountToRemove) > 0) + if (itemHandover.Count - itemCountToRemove > 0) { // Remove single item with no children _questHelper.ChangeItemStack( pmcData, itemHandover.Id, - (int)(itemHandover.Count - itemCountToRemove), + (int) (itemHandover.Count - itemCountToRemove), sessionID, output ); @@ -301,6 +310,7 @@ public class QuestController( // Important: loop backward when removing items from the array we're looping on while (index-- > 0) + { if (toRemove.Contains(pmcData.Inventory.Items[index].Id)) { var removedItem = _cloner.Clone(pmcData.Inventory.Items[index]); @@ -318,11 +328,15 @@ public class QuestController( childItems.RemoveAt(0); // Remove the parent // Sort by the current `location` and update - childItems.Sort((a, b) => (int)a.Location > (int)b.Location ? 1 : -1); + childItems.Sort((a, b) => (int) a.Location > (int) b.Location ? 1 : -1); - for (var i = 0; i < childItems.Count; i++) childItems[i].Location = i; + for (var i = 0; i < childItems.Count; i++) + { + childItems[i].Location = i; + } } } + } } } diff --git a/Libraries/Core/Controllers/RagfairController.cs b/Libraries/Core/Controllers/RagfairController.cs index a79b9038..96b2be38 100644 --- a/Libraries/Core/Controllers/RagfairController.cs +++ b/Libraries/Core/Controllers/RagfairController.cs @@ -22,32 +22,32 @@ namespace Core.Controllers; [Injectable] public class RagfairController { - private readonly ISptLogger _logger; - private readonly TimeUtil _timeUtil; - private readonly JsonUtil _jsonUtil; - private readonly HttpResponseUtil _httpResponseUtil; - private readonly EventOutputHolder _eventOutputHolder; - private readonly RagfairServer _ragfairServer; - private readonly ItemHelper _itemHelper; - private readonly InventoryHelper _inventoryHelper; - private readonly RagfairSellHelper _ragfairSellHelper; - private readonly HandbookHelper _handbookHelper; - private readonly ProfileHelper _profileHelper; - private readonly PaymentHelper _paymentHelper; - private readonly RagfairHelper _ragfairHelper; - private readonly RagfairSortHelper _ragfairSortHelper; - private readonly RagfairOfferHelper _ragfairOfferHelper; - private readonly TraderHelper _traderHelper; - private readonly DatabaseService _databaseService; - private readonly LocalisationService _localisationService; - private readonly RagfairTaxService _ragfairTaxService; - private readonly RagfairOfferService _ragfairOfferService; - private readonly PaymentService _paymentService; - private readonly RagfairPriceService _ragfairPriceService; - private readonly RagfairOfferGenerator _ragfairOfferGenerator; private readonly ConfigServer _configServer; + private readonly DatabaseService _databaseService; + private readonly EventOutputHolder _eventOutputHolder; + private readonly HandbookHelper _handbookHelper; + private readonly HttpResponseUtil _httpResponseUtil; + private readonly InventoryHelper _inventoryHelper; + private readonly ItemHelper _itemHelper; + private readonly JsonUtil _jsonUtil; + private readonly LocalisationService _localisationService; + private readonly ISptLogger _logger; + private readonly PaymentHelper _paymentHelper; + private readonly PaymentService _paymentService; + private readonly ProfileHelper _profileHelper; private readonly RagfairConfig _ragfairConfig; + private readonly RagfairHelper _ragfairHelper; + private readonly RagfairOfferGenerator _ragfairOfferGenerator; + private readonly RagfairOfferHelper _ragfairOfferHelper; + private readonly RagfairOfferService _ragfairOfferService; + private readonly RagfairPriceService _ragfairPriceService; + private readonly RagfairSellHelper _ragfairSellHelper; + private readonly RagfairServer _ragfairServer; + private readonly RagfairSortHelper _ragfairSortHelper; + private readonly RagfairTaxService _ragfairTaxService; + private readonly TimeUtil _timeUtil; + private readonly TraderHelper _traderHelper; public RagfairController( ISptLogger logger, @@ -252,7 +252,7 @@ public class RagfairController // Get specific assort purchase data and set current purchase buy value traderPurchases.TryGetValue(assortId, out var assortTraderPurchaseData); - offer.BuyRestrictionCurrent = (int?)assortTraderPurchaseData?.PurchaseCount ?? 0; + offer.BuyRestrictionCurrent = (int?) assortTraderPurchaseData?.PurchaseCount ?? 0; offer.BuyRestrictionMax = offerRootItem.Upd.BuyRestrictionMax; } @@ -374,7 +374,12 @@ public class RagfairController // Get the average offer price, excluding barter offers var average = GetAveragePriceFromOffers(offers, minMax, ignoreTraderOffers); - return new GetItemPriceResult { Avg = Math.Round(average), Min = minMax.Min, Max = minMax.Max }; + return new GetItemPriceResult + { + Avg = Math.Round(average), + Min = minMax.Min, + Max = minMax.Max + }; } // No offers listed, get price from live ragfair price list prices.json @@ -385,7 +390,12 @@ public class RagfairController tplPrice = _handbookHelper.GetTemplatePrice(getPriceRequest.TemplateId); } - return new GetItemPriceResult { Avg = tplPrice, Min = tplPrice, Max = tplPrice }; + return new GetItemPriceResult + { + Avg = tplPrice, + Min = tplPrice, + Max = tplPrice + }; } private double GetAveragePriceFromOffers(List offers, MinMax minMax, bool ignoreTraderOffers) @@ -582,7 +592,12 @@ public class RagfairController // Average offer price for single item (or whole weapon) var averages = - GetItemMinAvgMaxFleaPriceValues(new GetMarketPriceRequestData { TemplateId = offer.Items[0].Template }); + GetItemMinAvgMaxFleaPriceValues( + new GetMarketPriceRequestData + { + TemplateId = offer.Items[0].Template + } + ); var averageOfferPrice = averages.Avg; // Check for and apply item price modifer if it exists in config @@ -608,7 +623,7 @@ public class RagfairController ); // Create array of sell times for items listed - offer.SellResults = _ragfairSellHelper.RollForSale(sellChancePercent, (int)stackCountTotal); + offer.SellResults = _ragfairSellHelper.RollForSale(sellChancePercent, (int) stackCountTotal); // Subtract flea market fee from stash if (_ragfairConfig.Sell.Fees) @@ -618,7 +633,7 @@ public class RagfairController newRootOfferItem, pmcData, playerListedPriceInRub, - (int)stackCountTotal, + (int) stackCountTotal, offerRequest, output ); @@ -688,7 +703,10 @@ public class RagfairController // Single price for an item var averages = GetItemMinAvgMaxFleaPriceValues( - new GetMarketPriceRequestData { TemplateId = firstListingAndChidren[0].Template } + new GetMarketPriceRequestData + { + TemplateId = firstListingAndChidren[0].Template + } ); var singleItemPrice = averages.Avg; @@ -715,7 +733,7 @@ public class RagfairController ); // Create array of sell times for items listed + sell all at once as its a pack - offer.SellResults = _ragfairSellHelper.RollForSale(sellChancePercent, (int)stackCountTotal, true); + offer.SellResults = _ragfairSellHelper.RollForSale(sellChancePercent, (int) stackCountTotal, true); // Subtract flea market fee from stash if (_ragfairConfig.Sell.Fees) @@ -725,7 +743,7 @@ public class RagfairController newRootOfferItem, pmcData, playerListedPriceInRub, - (int)stackCountTotal, + (int) stackCountTotal, offerRequest, output ); @@ -789,7 +807,12 @@ public class RagfairController // Average offer price for single item (or whole weapon) var averages = - GetItemMinAvgMaxFleaPriceValues(new GetMarketPriceRequestData { TemplateId = rootItem.Template }); + GetItemMinAvgMaxFleaPriceValues( + new GetMarketPriceRequestData + { + TemplateId = rootItem.Template + } + ); var averageOfferPriceSingleItem = averages.Avg; // Check for and apply item price modifer if it exists in config @@ -807,7 +830,7 @@ public class RagfairController playerListedPriceInRub, qualityMultiplier ); - offer.SellResults = _ragfairSellHelper.RollForSale(sellChancePercent, (int)stackCountTotal); + offer.SellResults = _ragfairSellHelper.RollForSale(sellChancePercent, (int) stackCountTotal); // Subtract flea market fee from stash if (_ragfairConfig.Sell.Fees) @@ -817,7 +840,7 @@ public class RagfairController rootItem, pmcData, playerListedPriceInRub, - (int)stackCountTotal, + (int) stackCountTotal, offerRequest, output ); @@ -972,12 +995,18 @@ public class RagfairController { errorMessage = _localisationService.GetText( "ragfair-unable_to_find_item_in_inventory", - new { id = itemId } + new + { + id = itemId + } ); _logger.Error(errorMessage); return new GetItemsToListOnFleaFromInventoryResult - { Items = itemsToReturn, ErrorMessage = errorMessage }; + { + Items = itemsToReturn, + ErrorMessage = errorMessage + }; } item = _itemHelper.FixItemStackCount(item); @@ -989,16 +1018,17 @@ public class RagfairController errorMessage = _localisationService.GetText("ragfair-unable_to_find_requested_items_in_inventory"); _logger.Error(errorMessage); - return new GetItemsToListOnFleaFromInventoryResult { ErrorMessage = errorMessage }; + return new GetItemsToListOnFleaFromInventoryResult + { + ErrorMessage = errorMessage + }; } - return new GetItemsToListOnFleaFromInventoryResult { Items = itemsToReturn, ErrorMessage = errorMessage }; - } - - public record GetItemsToListOnFleaFromInventoryResult - { - public List>? Items { get; set; } - public string? ErrorMessage { get; set; } + return new GetItemsToListOnFleaFromInventoryResult + { + Items = itemsToReturn, + ErrorMessage = errorMessage + }; } public ItemEventRouterResponse RemoveOffer(RemoveOfferRequestData removeRequest, string sessionId) @@ -1046,7 +1076,7 @@ public class RagfairController { // `expireSeconds` Default is 71 seconds var newEndTime = _ragfairConfig.Sell.ExpireSeconds + _timeUtil.GetTimeStamp(); - playerProfileOffers[playerOfferIndex].EndTime = (long?)Math.Round((double)newEndTime); + playerProfileOffers[playerOfferIndex].EndTime = (long?) Math.Round((double) newEndTime); } return output; @@ -1087,7 +1117,7 @@ public class RagfairController var sellInOncePiece = playerOffer.SellInOnePiece.GetValueOrDefault(false); if (!sellInOncePiece) { - count = (int)playerOffer.Items.Sum(offerItem => offerItem.Upd?.StackObjectsCount ?? 0); + count = (int) playerOffer.Items.Sum(offerItem => offerItem.Upd?.StackObjectsCount ?? 0); } var tax = _ragfairTaxService.CalculateTax( @@ -1110,7 +1140,7 @@ public class RagfairController } // Add extra time to offer - playerOffers[playerOfferIndex].EndTime += (long?)Math.Round((decimal)secondsToAdd); + playerOffers[playerOfferIndex].EndTime += (long?) Math.Round((decimal) secondsToAdd); return output; } @@ -1127,7 +1157,14 @@ public class RagfairController { TransactionId = "ragfair", Action = "TradingConfirm", - SchemeItems = [new IdWithCount { Id = _paymentHelper.GetCurrency(currency), Count = Math.Round(value) }], + SchemeItems = + [ + new IdWithCount + { + Id = _paymentHelper.GetCurrency(currency), + Count = Math.Round(value) + } + ], Type = "", ItemId = "", Count = 0, @@ -1152,4 +1189,19 @@ public class RagfairController return offerToReturn; } + + public record GetItemsToListOnFleaFromInventoryResult + { + public List>? Items + { + get; + set; + } + + public string? ErrorMessage + { + get; + set; + } + } } diff --git a/Libraries/Core/Controllers/RepairController.cs b/Libraries/Core/Controllers/RepairController.cs index eabb8e2d..cef7b881 100644 --- a/Libraries/Core/Controllers/RepairController.cs +++ b/Libraries/Core/Controllers/RepairController.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Repair; using Core.Routers; using Core.Services; +using SptCommon.Annotations; namespace Core.Controllers; @@ -14,8 +14,8 @@ public class RepairController( ) { /// - /// Handle TraderRepair event - /// Repair with trader + /// Handle TraderRepair event + /// Repair with trader /// /// session id /// endpoint request data @@ -42,7 +42,10 @@ public class RepairController( output ); - if (output.Warnings?.Count > 0) return output; + if (output.Warnings?.Count > 0) + { + return output; + } // Add repaired item to output object output.ProfileChanges[sessionID].Items.ChangedItems.Add(repairDetails.RepairedItem); @@ -55,8 +58,8 @@ public class RepairController( } /// - /// Handle Repair event - /// Repair with repair kit + /// Handle Repair event + /// Repair with repair kit /// /// session id /// endpoint request data diff --git a/Libraries/Core/Controllers/RepeatableQuestController.cs b/Libraries/Core/Controllers/RepeatableQuestController.cs index 33288aaf..c2966a3e 100644 --- a/Libraries/Core/Controllers/RepeatableQuestController.cs +++ b/Libraries/Core/Controllers/RepeatableQuestController.cs @@ -89,7 +89,10 @@ public class RepeatableQuestController( ); // If the configuration dictates to replace with the same quest type, adjust the available quest types - if (repeatableConfig?.KeepDailyQuestTypeOnReplacement is not null) repeatableConfig.Types = [questToReplace.Type.ToString()]; + if (repeatableConfig?.KeepDailyQuestTypeOnReplacement is not null) + { + repeatableConfig.Types = [questToReplace.Type.ToString()]; + } // Generate meta-data for what type/levelrange of quests can be generated for player var allowedQuestTypes = GenerateQuestPool(repeatableConfig, pmcData.Info.Level); @@ -114,9 +117,11 @@ public class RepeatableQuestController( repeatablesOfTypeInProfile.ActiveQuests.Add(newRepeatableQuest); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Removing: {repeatableConfig.Name} quest: {questToReplace.Id} from trader: {questToReplace.TraderId} as its been replaced" ); + } RemoveQuestFromProfile(fullProfile, questToReplace.Id); @@ -146,9 +151,12 @@ public class RepeatableQuestController( foreach (var cost in previousChangeRequirement.ChangeCost) { // Not free, Charge player + appy charisma bonus to cost of replacement - cost.Count = (int)Math.Truncate(cost.Count.Value * (1 - Math.Truncate(charismaBonus / 100) * 0.001)); + cost.Count = (int) Math.Truncate(cost.Count.Value * (1 - Math.Truncate(charismaBonus / 100) * 0.001)); _paymentService.AddPaymentToOutput(pmcData, cost.TemplateId, cost.Count.Value, sessionID, output); - if (output.Warnings.Count > 0) return output; + if (output.Warnings.Count > 0) + { + return output; + } } } @@ -221,10 +229,14 @@ public class RepeatableQuestController( if (repeatablesOfTypeInProfile.ActiveQuests.Count == 1) // Only one repeatable quest being replaced (e.g. scav_daily), remove everything ready for new quest requirement to be added // Will assist in cleanup of existing profiles data + { repeatablesOfTypeInProfile.ChangeRequirement.Clear(); + } else // Multiple active quests of this type (e.g. daily or weekly) are active, just remove the single replaced quest + { repeatablesOfTypeInProfile.ChangeRequirement.Remove(replacedQuestId); + } } private RepeatableQuest? AttemptToGenerateRepeatableQuest(string sessionId, PmcData pmcData, @@ -245,12 +257,17 @@ public class RepeatableQuestController( if (newRepeatableQuest is not null) // Successfully generated a quest, exit loop + { break; + } attempts++; } - if (attempts > maxAttempts) _logger.Error("We were stuck in repeatable quest generation. This should never happen. Please report"); + if (attempts > maxAttempts) + { + _logger.Error("We were stuck in repeatable quest generation. This should never happen. Please report"); + } return newRepeatableQuest; } @@ -262,10 +279,12 @@ public class RepeatableQuestController( // Find quest we're replacing in scav profile quests array and remove it if (fullProfile.CharacterData.ScavData is not null) + { _questHelper.FindAndRemoveQuestFromArrayIfExists( questToReplaceId, fullProfile.CharacterData.ScavData.Quests ); + } } /** @@ -283,9 +302,15 @@ public class RepeatableQuestController( repeatablesInProfile.ActiveQuests.FirstOrDefault(repeatable => repeatable.Id == questId); if (questToReplace is null) // Not found, skip to next repeatable sub-type + { continue; + } - return new GetRepeatableByIdResult { Quest = questToReplace, RepeatableType = repeatablesInProfile }; + return new GetRepeatableByIdResult + { + Quest = questToReplace, + RepeatableType = repeatablesInProfile + }; } return null; @@ -308,14 +333,19 @@ public class RepeatableQuestController( var canAccessRepeatables = CanProfileAccessRepeatableQuests(repeatableConfig, pmcData); if (!canAccessRepeatables) // Don't send any repeatables, even existing ones + { continue; + } // Existing repeatables are still valid, add to return data and move to next sub-type if (currentTime < generatedRepeatables.EndTime - 1) { returnData.Add(generatedRepeatables); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"[Quest Check] {repeatableTypeLower} quests are still valid."); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"[Quest Check] {repeatableTypeLower} quests are still valid."); + } continue; } @@ -325,7 +355,10 @@ public class RepeatableQuestController( // Set endtime to be now + new duration generatedRepeatables.EndTime = currentTime + repeatableConfig.ResetTime; generatedRepeatables.InactiveQuests = []; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Generating new {repeatableTypeLower}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Generating new {repeatableTypeLower}"); + } // Put old quests to inactive (this is required since only then the client makes them fail due to non-completion) // Also need to push them to the "inactiveQuests" list since we need to remove them from offraidData.profile.Quests @@ -362,7 +395,10 @@ public class RepeatableQuestController( } // check if there are no more quest types available - if (questTypePool.Types.Count == 0) break; + if (questTypePool.Types.Count == 0) + { + break; + } quest.Side = repeatableConfig.Side; generatedRepeatables.ActiveQuests.Add(quest); @@ -370,13 +406,14 @@ public class RepeatableQuestController( // Nullguard fullProfile.SptData.FreeRepeatableRefreshUsedCount ??= new Dictionary(); - + // Reset players free quest count for this repeatable sub-type as we're generating new repeatables for this group (daily/weekly) fullProfile.SptData.FreeRepeatableRefreshUsedCount[repeatableTypeLower] = 0; // Create stupid redundant change requirements from quest data generatedRepeatables.ChangeRequirement = new Dictionary(); foreach (var quest in generatedRepeatables.ActiveQuests) + { generatedRepeatables.ChangeRequirement.TryAdd( quest.Id, new ChangeRequirement @@ -385,6 +422,7 @@ public class RepeatableQuestController( ChangeStandingCost = _randomUtil.GetArrayValue([0, 0.01]) // Randomise standing loss to replace } ); + } // Reset free repeatable values in player profile to defaults generatedRepeatables.FreeChanges = repeatableConfig.FreeChanges; @@ -440,12 +478,18 @@ public class RepeatableQuestController( private bool CanProfileAccessRepeatableQuests(RepeatableQuestConfig repeatableConfig, PmcData pmcData) { // PMC and daily quests not unlocked yet - if (repeatableConfig.Side == "Pmc" && !PlayerHasDailyPmcQuestsUnlocked(pmcData, repeatableConfig)) return false; + if (repeatableConfig.Side == "Pmc" && !PlayerHasDailyPmcQuestsUnlocked(pmcData, repeatableConfig)) + { + return false; + } // Scav and daily quests not unlocked yet if (repeatableConfig.Side == "Scav" && !PlayerHasDailyScavQuestsUnlocked(pmcData)) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Daily scav quests still locked, Intel center not built"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Daily scav quests still locked, Intel center not built"); + } return false; } @@ -482,16 +526,21 @@ public class RepeatableQuestController( foreach (var activeQuest in generatedRepeatables.ActiveQuests) { var questStatusInProfile = pmcData.Quests.FirstOrDefault(quest => quest.QId == activeQuest.Id); - if (questStatusInProfile is null) continue; + if (questStatusInProfile is null) + { + continue; + } // Keep finished quests in list so player can hand in if (questStatusInProfile.Status == QuestStatusEnum.AvailableForFinish) { questsToKeep.Add(activeQuest); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( // TODO: this shouldnt happen, doesnt on live $"Keeping repeatable quest: {activeQuest.Id} in activeQuests since it is available to hand in" ); + } continue; } @@ -518,11 +567,13 @@ public class RepeatableQuestController( // Populate Exploration and Pickup quest locations foreach (var (location, value) in locations) + { if (location != ELocationName.any) { questPool.Pool.Exploration.Locations[location] = value; questPool.Pool.Pickup.Locations[location] = value; } + } // Add "any" to pickup quest pool questPool.Pool.Pickup.Locations[ELocationName.any] = ["any"]; @@ -533,9 +584,16 @@ public class RepeatableQuestController( // Populate Elimination quest targets and their locations foreach (var targetKvP in targetsConfig) // Target is boss + { if (targetKvP.Data.IsBoss.GetValueOrDefault(false)) { - questPool.Pool.Elimination.Targets.Add(targetKvP.Key, new TargetLocation { Locations = ["any"] }); + questPool.Pool.Elimination.Targets.Add( + targetKvP.Key, + new TargetLocation + { + Locations = ["any"] + } + ); } else { @@ -550,8 +608,11 @@ public class RepeatableQuestController( : possibleLocations; questPool.Pool.Elimination.Targets[targetKvP.Key] = new TargetLocation - { Locations = allowedLocations.Select(x => x.ToString()).ToList() }; + { + Locations = allowedLocations.Select(x => x.ToString()).ToList() + }; } + } return questPool; } @@ -588,10 +649,17 @@ public class RepeatableQuestController( { var locationNames = new List(); foreach (var locationName in value) + { if (IsPmcLevelAllowedOnLocation(locationName, pmcLevel)) + { locationNames.Add(locationName); + } + } - if (locationNames.Count > 0) allowedLocation[location] = locationNames; + if (locationNames.Count > 0) + { + allowedLocation[location] = locationNames; + } } return allowedLocation; @@ -606,10 +674,16 @@ public class RepeatableQuestController( protected bool IsPmcLevelAllowedOnLocation(string location, int pmcLevel) { // All PMC levels are allowed for 'any' location requirement - if (location == ELocationName.any.ToString()) return true; + if (location == ELocationName.any.ToString()) + { + return true; + } var locationBase = _databaseService.GetLocation(location.ToLower())?.Base; - if (locationBase is null) return true; + if (locationBase is null) + { + return true; + } return pmcLevel <= locationBase.RequiredPlayerLevelMax && pmcLevel >= locationBase.RequiredPlayerLevelMin; } @@ -623,11 +697,15 @@ public class RepeatableQuestController( private int GetQuestCount(RepeatableQuestConfig repeatableConfig, PmcData pmcData) { var questCount = repeatableConfig.NumQuests.GetValueOrDefault(0); - if (questCount == 0) _logger.Warning($"Repeatable {repeatableConfig.Name} quests have a count of 0"); + if (questCount == 0) + { + _logger.Warning($"Repeatable {repeatableConfig.Name} quests have a count of 0"); + } // Add elite bonus to daily quests if (repeatableConfig.Name.ToLower() == "daily" && _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, pmcData)) // Elite charisma skill gives extra daily quest(s) + { questCount += _databaseService .GetGlobals() .Configuration @@ -637,13 +715,16 @@ public class RepeatableQuestController( .EliteBonusSettings .RepeatableQuestExtraCount .GetValueOrDefault(0); - + } + // Prestige level 2 gives additional daily and weekly // do the logic for all other than "daily_savage" // use bigger than or equal incase modders add more if (repeatableConfig.Name.ToLower() != "daily_savage" && pmcData.Info.PrestigeLevel >= 2) + { questCount++; - + } + return questCount; } } diff --git a/Libraries/Core/Controllers/TradeController.cs b/Libraries/Core/Controllers/TradeController.cs index 3932bcd1..e24fd7d3 100644 --- a/Libraries/Core/Controllers/TradeController.cs +++ b/Libraries/Core/Controllers/TradeController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -12,6 +11,7 @@ using Core.Routers; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Controllers; @@ -41,7 +41,7 @@ public class TradeController( protected TraderConfig _traderConfig = _configServer.GetConfig(); /// - /// Handle TradingConfirm event + /// Handle TradingConfirm event /// /// /// @@ -58,7 +58,7 @@ public class TradeController( if (request.Type == "buy_from_trader") { var foundInRaid = _traderConfig.PurchasesAreFoundInRaid; - var buyData = (ProcessBuyTradeRequestData)request; + var buyData = (ProcessBuyTradeRequestData) request; _tradeHelper.buyItem(pmcData, buyData, sessionID, foundInRaid, output); return output; @@ -67,7 +67,7 @@ public class TradeController( // Selling if (request.Type == "sell_to_trader") { - var sellData = (ProcessSellTradeRequestData)request; + var sellData = (ProcessSellTradeRequestData) request; _tradeHelper.sellItem(pmcData, pmcData, sellData, sessionID, output); return output; @@ -80,7 +80,7 @@ public class TradeController( } /// - /// Handle RagFairBuyOffer event + /// Handle RagFairBuyOffer event /// /// /// @@ -97,11 +97,13 @@ public class TradeController( { var fleaOffer = _ragfairServer.GetOffer(offer.Id); if (fleaOffer is null) + { return _httpResponseUtil.AppendErrorToOutput( output, $"Offer with ID {offer.Id} not found", BackendErrorCodes.OfferNotFound ); + } if (offer.Count == 0) { @@ -113,19 +115,26 @@ public class TradeController( } if (_ragfairOfferHelper.OfferIsFromTrader(fleaOffer)) + { BuyTraderItemFromRagfair(sessionID, pmcData, fleaOffer, offer, output); + } else + { BuyPmcItemFromRagfair(sessionID, pmcData, fleaOffer, offer, output); + } // Exit loop early if problem found - if (output.Warnings?.Count > 0) return output; + if (output.Warnings?.Count > 0) + { + return output; + } } return output; } /// - /// Buy an item off the flea sold by a trader + /// Buy an item off the flea sold by a trader /// /// Session id /// Player profile @@ -143,7 +152,10 @@ public class TradeController( if (PlayerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer, pmcData)) { var errorMessage = $"Unable to buy item: {fleaOffer.Items[0].Template} from trader: {fleaOffer.User.Id} as loyalty level too low, skipping"; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug(errorMessage); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug(errorMessage); + } _httpResponseUtil.AppendErrorToOutput(output, errorMessage, BackendErrorCodes.RagfairUnavailable); @@ -165,7 +177,7 @@ public class TradeController( } /// - /// Buy an item off the flea sold by a PMC + /// Buy an item off the flea sold by a PMC /// /// Session id /// Player profile @@ -192,7 +204,10 @@ public class TradeController( // buyItem() must occur prior to removing the offer stack, otherwise item inside offer doesn't exist for confirmTrading() to use _tradeHelper.buyItem(pmcData, buyData, sessionId, _ragfairConfig.Dynamic.PurchasesAreFoundInRaid, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } // resolve when a profile buy another profile's offer var offerOwnerId = fleaOffer.User?.Id; @@ -212,7 +227,7 @@ public class TradeController( } /// - /// Is the provided offerid and ownerid from a player made offer + /// Is the provided offerid and ownerid from a player made offer /// /// id of the offer /// Owner id @@ -222,19 +237,24 @@ public class TradeController( string? offerOwnerId) { // No ownerid, not player offer - if (offerOwnerId is null) return false; + if (offerOwnerId is null) + { + return false; + } var offerCreatorProfile = _profileHelper.GetPmcProfile(offerOwnerId); if (offerCreatorProfile is null || offerCreatorProfile.RagfairInfo.Offers?.Count == 0) // No profile or no offers + { return false; + } // Does offer id exist in profile return offerCreatorProfile.RagfairInfo.Offers.Any(offer => offer.Id == offerId); } /// - /// Does Player have necessary trader loyalty to purchase flea offer + /// Does Player have necessary trader loyalty to purchase flea offer /// /// Flea offer being bought /// Player profile @@ -247,7 +267,7 @@ public class TradeController( } /// - /// Handle SellAllFromSavage event + /// Handle SellAllFromSavage event /// /// /// @@ -260,13 +280,13 @@ public class TradeController( { var output = _eventOutputHolder.GetOutput(sessionId); - MailMoneyToPlayer(sessionId, (int)request.TotalValue, Traders.FENCE); + MailMoneyToPlayer(sessionId, (int) request.TotalValue, Traders.FENCE); return output; } /// - /// Send the specified rouble total to player as mail + /// Send the specified rouble total to player as mail /// /// Session id /// amount of roubles to send @@ -276,14 +296,20 @@ public class TradeController( int roublesToSend, string trader) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Selling scav items to fence for {roublesToSend} roubles"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Selling scav items to fence for {roublesToSend} roubles"); + } // Create single currency item with all currency on it var rootCurrencyReward = new Item { Id = _hashUtil.Generate(), Template = Money.ROUBLES, - Upd = new Upd { StackObjectsCount = roublesToSend } + Upd = new Upd + { + StackObjectsCount = roublesToSend + } }; // Ensure money is properly split to follow its max stack size limit @@ -301,7 +327,7 @@ public class TradeController( } /// - /// Looks up an items children and gets total handbook price for them + /// Looks up an items children and gets total handbook price for them /// /// parent item that has children we want to sum price of /// All items (parent + children) @@ -322,10 +348,12 @@ public class TradeController( var itemDetails = _itemHelper.GetItem(itemToSell.Template); if (!(itemDetails.Key && _itemHelper.IsOfBaseclasses(itemDetails.Value.Id, traderDetails.ItemsBuy.Category))) // Skip if tpl isn't item OR item doesn't fulfil match traders buy categories + { continue; + } // Get price of item multiplied by how many are in stack - totalPrice += (int)((handbookPrices[itemToSell.Template] ?? 0) * (itemToSell.Upd?.StackObjectsCount ?? 1)); + totalPrice += (int) ((handbookPrices[itemToSell.Template] ?? 0) * (itemToSell.Upd?.StackObjectsCount ?? 1)); } return totalPrice; diff --git a/Libraries/Core/Controllers/TraderController.cs b/Libraries/Core/Controllers/TraderController.cs index 2428e2ca..43cbdad0 100644 --- a/Libraries/Core/Controllers/TraderController.cs +++ b/Libraries/Core/Controllers/TraderController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Eft.Common.Tables; @@ -10,7 +9,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; - +using SptCommon.Annotations; namespace Core.Controllers; @@ -35,9 +34,9 @@ public class TraderController( protected TraderConfig _traderConfig = _configServer.GetConfig(); /// - /// Runs when onLoad event is fired - /// Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService - /// Store timestamp of next assort refresh in nextResupply property of traders .base object + /// Runs when onLoad event is fired + /// Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService + /// Store timestamp of next assort refresh in nextResupply property of traders .base object /// public void Load() { @@ -77,7 +76,7 @@ public class TraderController( // Set to next hour on clock or current time + 60 minutes trader.Base.NextResupply = - traderResetStartsWithServer ? (int)_traderHelper.GetNextUpdateTimestamp(trader.Base.Id) : (int)nextHourTimestamp; + traderResetStartsWithServer ? (int) _traderHelper.GetNextUpdateTimestamp(trader.Base.Id) : (int) nextHourTimestamp; } } @@ -97,9 +96,9 @@ public class TraderController( } /// - /// Runs when onUpdate is fired - /// If current time is > nextResupply(expire) time of trader, refresh traders assorts and - /// Fence is handled slightly differently + /// Runs when onUpdate is fired + /// If current time is > nextResupply(expire) time of trader, refresh traders assorts and + /// Fence is handled slightly differently /// /// public bool Update() @@ -111,10 +110,14 @@ public class TraderController( case Traders.LIGHTHOUSEKEEPER: continue; case Traders.FENCE: - { - if (_fenceService.NeedsPartialRefresh()) _fenceService.GenerateFenceAssorts(); - continue; - } + { + if (_fenceService.NeedsPartialRefresh()) + { + _fenceService.GenerateFenceAssorts(); + } + + continue; + } } // Trader needs to be refreshed @@ -131,7 +134,7 @@ public class TraderController( } /// - /// Handle client/trading/api/traderSettings + /// Handle client/trading/api/traderSettings /// /// session id /// Return a list of all traders @@ -143,7 +146,10 @@ public class TraderController( { traders.Add(_traderHelper.GetTrader(traderId, sessionId)); - if (pmcData?.Info != null) _traderHelper.LevelUp(traderId, pmcData); + if (pmcData?.Info != null) + { + _traderHelper.LevelUp(traderId, pmcData); + } } traders.Sort(SortByTraderId); @@ -151,7 +157,7 @@ public class TraderController( } /// - /// Order traders by their traderId (Ttid) + /// Order traders by their traderId (Ttid) /// /// First trader to compare /// Second trader to compare @@ -162,7 +168,7 @@ public class TraderController( } /// - /// Handle client/trading/api/getTrader + /// Handle client/trading/api/getTrader /// /// /// @@ -173,7 +179,7 @@ public class TraderController( } /// - /// Handle client/trading/api/getTraderAssort + /// Handle client/trading/api/getTraderAssort /// /// /// @@ -184,7 +190,7 @@ public class TraderController( } /// - /// Handle client/items/prices/TRADERID + /// Handle client/items/prices/TRADERID /// /// public GetItemPricesResponse GetItemPrices(string sessionId, string traderId) @@ -195,7 +201,7 @@ public class TraderController( { SupplyNextTime = _traderHelper.GetNextUpdateTimestamp(traderId), Prices = handbookPrices, - CurrencyCourses = new Dictionary() + CurrencyCourses = new Dictionary { { "5449016a4bdc2d6f028b456f", handbookPrices[Money.ROUBLES] }, { "569668774bdc2da2298b4568", handbookPrices[Money.EUROS] }, diff --git a/Libraries/Core/Controllers/WeatherController.cs b/Libraries/Core/Controllers/WeatherController.cs index 24aaa952..637dd972 100644 --- a/Libraries/Core/Controllers/WeatherController.cs +++ b/Libraries/Core/Controllers/WeatherController.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Eft.Weather; @@ -8,7 +7,7 @@ using Core.Models.Spt.Weather; using Core.Models.Utils; using Core.Servers; using Core.Services; - +using SptCommon.Annotations; namespace Core.Controllers; @@ -26,7 +25,7 @@ public class WeatherController( /// - /// Handle client/weather + /// Handle client/weather /// /// public WeatherData Generate() @@ -47,7 +46,7 @@ public class WeatherController( } /// - /// Handle client/localGame/weather + /// Handle client/localGame/weather /// /// /// diff --git a/Libraries/Core/Controllers/WishlistController.cs b/Libraries/Core/Controllers/WishlistController.cs index 935093e5..5e98bb4e 100644 --- a/Libraries/Core/Controllers/WishlistController.cs +++ b/Libraries/Core/Controllers/WishlistController.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Wishlist; using Core.Routers; +using SptCommon.Annotations; namespace Core.Controllers; @@ -12,7 +12,7 @@ public class WishlistController( ) { /// - /// Handle AddToWishList + /// Handle AddToWishList /// /// /// @@ -23,13 +23,16 @@ public class WishlistController( AddToWishlistRequest request, string sessionId) { - foreach (var item in request.Items) pmcData.WishList.Dictionary.Add(item.Key, item.Value); + foreach (var item in request.Items) + { + pmcData.WishList.Dictionary.Add(item.Key, item.Value); + } return _eventOutputHolder.GetOutput(sessionId); } /// - /// Handle RemoveFromWishList event + /// Handle RemoveFromWishList event /// /// /// @@ -40,13 +43,16 @@ public class WishlistController( RemoveFromWishlistRequest request, string sessionId) { - foreach (var itemId in request.Items) pmcData.WishList.Dictionary.Remove(itemId); + foreach (var itemId in request.Items) + { + pmcData.WishList.Dictionary.Remove(itemId); + } return _eventOutputHolder.GetOutput(sessionId); } /// - /// Handle changeWishlistItemCategory event + /// Handle changeWishlistItemCategory event /// /// /// diff --git a/Libraries/Core/Core.csproj b/Libraries/Core/Core.csproj index f23d1684..af618654 100644 --- a/Libraries/Core/Core.csproj +++ b/Libraries/Core/Core.csproj @@ -1,14 +1,14 @@  - - net9.0 - enable - enable - Library - + + net9.0 + enable + enable + Library + - - - + + + diff --git a/Libraries/Core/DI/Router.cs b/Libraries/Core/DI/Router.cs index 8f0eecf3..98cda1a5 100644 --- a/Libraries/Core/DI/Router.cs +++ b/Libraries/Core/DI/Router.cs @@ -20,7 +20,10 @@ public abstract class Router protected List GetInternalHandledRoutes() { - if (handledRoutes.Count == 0) handledRoutes = GetHandledRoutes(); + if (handledRoutes.Count == 0) + { + handledRoutes = GetHandledRoutes(); + } return handledRoutes; } @@ -28,13 +31,15 @@ public abstract class Router public bool CanHandle(string url, bool partialMatch = false) { if (partialMatch) + { return GetInternalHandledRoutes() - .Where((r) => r.dynamic) - .Any((r) => url.Contains(r.route)); + .Where(r => r.dynamic) + .Any(r => url.Contains(r.route)); + } return GetInternalHandledRoutes() - .Where((r) => !r.dynamic) - .Any((r) => r.route == url); + .Where(r => !r.dynamic) + .Any(r => r.route == url); } } @@ -43,7 +48,7 @@ public abstract class StaticRouter : Router private readonly List _actions; private readonly JsonUtil _jsonUtil; - public StaticRouter(JsonUtil jsonUtil, List routes) : base() + public StaticRouter(JsonUtil jsonUtil, List routes) { _actions = routes; _jsonUtil = jsonUtil; @@ -54,22 +59,26 @@ public abstract class StaticRouter : Router var action = _actions.Single(route => route.url == url); var type = action.bodyType; IRequestData? info = null; - if (type != null && !string.IsNullOrEmpty(body)) info = (IRequestData?)_jsonUtil.Deserialize(body, type); + if (type != null && !string.IsNullOrEmpty(body)) + { + info = (IRequestData?) _jsonUtil.Deserialize(body, type); + } + return action.action(url, info, sessionID, output); } protected override List GetHandledRoutes() { - return _actions.Select((route) => new HandledRoute(route.url, false)).ToList(); + return _actions.Select(route => new HandledRoute(route.url, false)).ToList(); } } public abstract class DynamicRouter : Router { - private readonly List actions; private readonly JsonUtil _jsonUtil; + private readonly List actions; - public DynamicRouter(JsonUtil jsonUtil, List routes) : base() + public DynamicRouter(JsonUtil jsonUtil, List routes) { actions = routes; _jsonUtil = jsonUtil; @@ -80,13 +89,17 @@ public abstract class DynamicRouter : Router var action = actions.First(r => url.Contains(r.url)); var type = action.bodyType; IRequestData? info = null; - if (type != null && !string.IsNullOrEmpty(body)) info = (IRequestData?)_jsonUtil.Deserialize(body, type); + if (type != null && !string.IsNullOrEmpty(body)) + { + info = (IRequestData?) _jsonUtil.Deserialize(body, type); + } + return action.action(url, info, sessionID, output); } protected override List GetHandledRoutes() { - return actions.Select((route) => new HandledRoute(route.url, true)).ToList(); + return actions.Select(route => new HandledRoute(route.url, true)).ToList(); } } diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index 55c7c3ca..34c8f9eb 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -1,17 +1,17 @@ -using SptCommon.Annotations; +using Core.Helpers; +using Core.Models.Common; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Bots; using Core.Models.Spt.Config; using Core.Models.Utils; -using Core.Helpers; -using Core.Models.Common; using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; using Core.Utils.Collections; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Generators; @@ -42,7 +42,7 @@ public class BotEquipmentModGenerator( protected BotConfig _botConfig = _configServer.GetConfig(); /// - /// Check mods are compatible and add to array + /// Check mods are compatible and add to array /// /// Equipment item to add mods to /// Mod list to choose from @@ -58,7 +58,9 @@ public class BotEquipmentModGenerator( // Get mod pool for the desired item if (!settings.ModPool.TryGetValue(parentTemplate.Id, out var compatibleModsPool)) + { _logger.Warning($"bot: {settings.BotData.Role} lacks a mod slot pool for item: {parentTemplate.Id} {parentTemplate.Name}"); + } // Iterate over mod pool and choose mods to add to item foreach (var (modSlotName, modPool) in compatibleModsPool ?? []) @@ -91,10 +93,16 @@ public class BotEquipmentModGenerator( ); // Rolled to skip mod and it shouldn't be force-spawned - if (modSpawnResult == ModSpawn.SKIP && !forceSpawn) continue; + if (modSpawnResult == ModSpawn.SKIP && !forceSpawn) + { + continue; + } // Ensure submods for nvgs all spawn together - if (modSlotName == "mod_nvg") forceSpawn = true; + if (modSlotName == "mod_nvg") + { + forceSpawn = true; + } // Get pool of items we can add for this slot var modPoolToChooseFrom = modPool; @@ -103,7 +111,9 @@ public class BotEquipmentModGenerator( var filteredModPool = FilterModsByBlacklist(modPoolToChooseFrom, specificBlacklist, modSlotName); if (filteredModPool.Count > 0) // use filtered pool as it has items in it + { modPoolToChooseFrom = filteredModPool; + } // Slot can hold armor plates + we are filtering possible items by bot level, handle if ( @@ -121,9 +131,11 @@ public class BotEquipmentModGenerator( { case Result.UNKNOWN_FAILURE or Result.NO_DEFAULT_FILTER: if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Plate slot: {modSlotName} selection for armor: {parentTemplate.Id} failed: {plateSlotFilteringOutcome.Result}, skipping" ); + } continue; case Result.LACKS_PLATE_WEIGHTS: @@ -160,7 +172,10 @@ public class BotEquipmentModGenerator( } // Compatible item not found + not required - skip - if (!(found || itemSlotTemplate.Required.GetValueOrDefault(false))) continue; + if (!(found || itemSlotTemplate.Required.GetValueOrDefault(false))) + { + continue; + } // Get chosen mods db template and check it fits into slot var modTemplate = _itemHelper.GetItem(modTpl); @@ -173,7 +188,9 @@ public class BotEquipmentModGenerator( settings.BotData.Role ) ) + { continue; + } // Generate new id to ensure all items are unique on bot var modId = _hashUtil.Generate(); @@ -184,6 +201,7 @@ public class BotEquipmentModGenerator( // Does item being added exist in mod pool - has its own mod pool if (settings.ModPool.ContainsKey(modTpl)) // Call self again with mod being added as item to add child mods to + { GenerateModsForEquipment( equipment, modId, @@ -192,13 +210,14 @@ public class BotEquipmentModGenerator( specificBlacklist, forceSpawn ); + } } return equipment; } /// - /// Filter a bots plate pool based on its current level + /// Filter a bots plate pool based on its current level /// /// Bot equipment generation settings /// Armor slot being filtered @@ -225,7 +244,7 @@ public class BotEquipmentModGenerator( // Get the front/back/side weights based on bots level var plateSlotWeights = settings.BotEquipmentConfig?.ArmorPlateWeighting.FirstOrDefault( - (armorWeight) => + armorWeight => settings.BotData.Level >= armorWeight.LevelRange.Min && settings.BotData.Level <= armorWeight.LevelRange.Max ); @@ -253,15 +272,15 @@ public class BotEquipmentModGenerator( var chosenArmorPlateLevelString = _weightedRandomHelper.GetWeightedValue(plateWeights); // Convert the array of ids into database items - var platesFromDb = existingPlateTplPool.Select((plateTpl) => _itemHelper.GetItem(plateTpl).Value); + var platesFromDb = existingPlateTplPool.Select(plateTpl => _itemHelper.GetItem(plateTpl).Value); // Filter plates to the chosen level based on its armorClass property - var platesOfDesiredLevel = platesFromDb.Where((item) => item.Properties.ArmorClass.Value == double.Parse(chosenArmorPlateLevelString)); + var platesOfDesiredLevel = platesFromDb.Where(item => item.Properties.ArmorClass.Value == double.Parse(chosenArmorPlateLevelString)); if (platesOfDesiredLevel.Any()) { // Plates found result.Result = Result.SUCCESS; - result.PlateModTemplates = platesOfDesiredLevel.Select((item) => item.Id).ToHashSet(); + result.PlateModTemplates = platesOfDesiredLevel.Select(item => item.Id).ToHashSet(); return result; } @@ -280,21 +299,29 @@ public class BotEquipmentModGenerator( chosenArmorPlateLevelString = chosenArmorPlateLevelDouble.ToString(); // New chosen plate class is higher than max, then set to min and check if valid - if (chosenArmorPlateLevelDouble > minMaxArmorPlateClass.Max) chosenArmorPlateLevelString = minMaxArmorPlateClass.Min.ToString(); + if (chosenArmorPlateLevelDouble > minMaxArmorPlateClass.Max) + { + chosenArmorPlateLevelString = minMaxArmorPlateClass.Min.ToString(); + } findCompatiblePlateAttempts++; - platesOfDesiredLevel = platesFromDb.Where((item) => item.Properties.ArmorClass == chosenArmorPlateLevelDouble); + platesOfDesiredLevel = platesFromDb.Where(item => item.Properties.ArmorClass == chosenArmorPlateLevelDouble); // Valid plates found, exit - if (platesOfDesiredLevel.Any()) break; + if (platesOfDesiredLevel.Any()) + { + break; + } // No valid plate class found in 3 tries, attempt default plates if (findCompatiblePlateAttempts >= maxAttempts) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Plate filter too restrictive for armor: {armorItem.Name} {armorItem.Id}, unable to find plates of level: {chosenArmorPlateLevelString}, using items default plate" ); + } var defaultPlate = GetDefaultPlateTpl(armorItem, modSlot); if (defaultPlate is not null) @@ -338,9 +365,15 @@ public class BotEquipmentModGenerator( platePool.Sort( (x, y) => { - if (x.Properties.ArmorClass < y.Properties.ArmorClass) return -1; + if (x.Properties.ArmorClass < y.Properties.ArmorClass) + { + return -1; + } - if (x.Properties.ArmorClass > y.Properties.ArmorClass) return 1; + if (x.Properties.ArmorClass > y.Properties.ArmorClass) + { + return 1; + } return 0; } @@ -376,12 +409,12 @@ public class BotEquipmentModGenerator( { var defaultPreset = _presetHelper.GetDefaultPreset(armorItemTpl); - return defaultPreset?.Items?.FirstOrDefault((item) => item.SlotId?.ToLower() == modSlot); + return defaultPreset?.Items?.FirstOrDefault(item => item.SlotId?.ToLower() == modSlot); } /// - /// Add mods to a weapon using the provided mod pool + /// Add mods to a weapon using the provided mod pool /// /// Session id /// Data used to generate the weapon @@ -433,7 +466,7 @@ public class BotEquipmentModGenerator( "bot-weapon_missing_mod_slot", new { - modSlot = modSlot, + modSlot, weaponId = request.ParentTemplate.Id, weaponName = request.ParentTemplate.Name, botRole = request.BotData.Role @@ -451,7 +484,10 @@ public class BotEquipmentModGenerator( request.ModSpawnChances, botEquipConfig ); - if (modSpawnResult == ModSpawn.SKIP) continue; + if (modSpawnResult == ModSpawn.SKIP) + { + continue; + } var isRandomisableSlot = randomisationSettings?.RandomisedWeaponModSlots?.Contains(modSlot) ?? false; ModToSpawnRequest modToSpawnRequest = new() @@ -473,9 +509,15 @@ public class BotEquipmentModGenerator( var modToAdd = ChooseModToPutIntoSlot(modToSpawnRequest); // Compatible mod not found - if (modToAdd is null) continue; + if (modToAdd is null) + { + continue; + } - if (!IsModValidForSlot(modToAdd, modsParentSlot, modSlot, request.ParentTemplate, request.BotData.Role)) continue; + if (!IsModValidForSlot(modToAdd, modsParentSlot, modSlot, request.ParentTemplate, request.BotData.Role)) + { + continue; + } var modToAddTemplate = modToAdd.Value; // Skip adding mod to weapon if type limit reached @@ -488,7 +530,9 @@ public class BotEquipmentModGenerator( request.Weapon ) ) + { continue; + } // If item is a mount for scopes, set scope chance to 100%, this helps fix empty mounts appearing on weapons if (ModSlotCanHoldScope(modSlot, modToAddTemplate.Value.Parent)) @@ -500,12 +544,14 @@ public class BotEquipmentModGenerator( // Hydrate pool of mods that fit into mount as its a randomisable slot if (isRandomisableSlot) // Add scope mods to modPool dictionary to ensure the mount has a scope in the pool to pick + { AddCompatibleModsForProvidedMod( "mod_scope", modToAddTemplate.Value, request.ModPool, botEquipBlacklist ); + } } // If picked item is muzzle adapter that can hold a child, adjust spawn chance @@ -527,11 +573,13 @@ public class BotEquipmentModGenerator( // Force spawn chance to be 100% to ensure it gets added if ( modSlot == "mod_handguard" && - modToAddTemplate.Value.Properties.Slots.Any((slot) => slot.Name == "mod_handguard") && - !request.Weapon.Any((item) => item.SlotId == "mod_launcher") + modToAddTemplate.Value.Properties.Slots.Any(slot => slot.Name == "mod_handguard") && + !request.Weapon.Any(item => item.SlotId == "mod_launcher") ) // Needed for handguards with lower + { request.ModSpawnChances["mod_handguard"] = 100; + } // If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure sub-stock gets added // Or if bot has stock force enabled @@ -546,8 +594,13 @@ public class BotEquipmentModGenerator( if (_itemHelper.IsOfBaseclass(modToAddTemplate.Value.Id, BaseClasses.IRON_SIGHT)) { if (modSlot == "mod_sight_front") + { request.WeaponStats.HasFrontIronSight = true; - else if (modSlot == "mod_sight_rear") request.WeaponStats.HasRearIronSight = true; + } + else if (modSlot == "mod_sight_rear") + { + request.WeaponStats.HasRearIronSight = true; + } } else if (!(request.WeaponStats.HasOptic ?? false) && _itemHelper.IsOfBaseclass(modToAddTemplate.Value.Id, BaseClasses.SIGHTS)) { @@ -567,7 +620,10 @@ public class BotEquipmentModGenerator( ); // Update conflicting item list now item has been chosen - foreach (var conflictingItem in modToAddTemplate.Value.Properties.ConflictingItems) request.ConflictingItemTpls.Add(conflictingItem); + foreach (var conflictingItem in modToAddTemplate.Value.Properties.ConflictingItems) + { + request.ConflictingItemTpls.Add(conflictingItem); + } // I first thought we could use the recursive generateModsForItems as previously for cylinder magazines. // However, the recursion doesn't go over the slots of the parent mod but over the modPool which is given by the bot config @@ -642,7 +698,7 @@ public class BotEquipmentModGenerator( } /// - /// Should the provided bot have its stock chance values altered to 100% + /// Should the provided bot have its stock chance values altered to 100% /// /// Slot to check /// Bots equipment config/chance values @@ -660,7 +716,7 @@ public class BotEquipmentModGenerator( } /// - /// Is this modslot a front or rear sight + /// Is this modslot a front or rear sight /// /// Slot to check /// @@ -670,13 +726,15 @@ public class BotEquipmentModGenerator( // Gas block /w front sight is special case, deem it a 'front sight' too if (modSlot == "mod_gas_block" && tpl == "5ae30e795acfc408fb139a0b") // M4A1 front sight with gas block + { return true; + } return ((string[]) ["mod_sight_front", "mod_sight_rear"]).Contains(modSlot); } /// - /// Does the provided mod details show the mod can hold a scope + /// Does the provided mod details show the mod can hold a scope /// /// e.g. mod_scope, mod_mount /// Parent id of mod item @@ -697,7 +755,7 @@ public class BotEquipmentModGenerator( } /// - /// Set mod spawn chances to defined amount + /// Set mod spawn chances to defined amount /// /// Chance dictionary to update /// @@ -718,11 +776,14 @@ public class BotEquipmentModGenerator( return; } - foreach (var modName in modSlotsToAdjust) modSpawnChances[modName] = newChancePercent; + foreach (var modName in modSlotsToAdjust) + { + modSpawnChances[modName] = newChancePercent; + } } /// - /// Does the provided modSlot allow muzzle-related items + /// Does the provided modSlot allow muzzle-related items /// /// Slot id to check /// OPTIONAL: parent id of modslot being checked @@ -733,7 +794,7 @@ public class BotEquipmentModGenerator( } /// - /// Sort mod slots into an ordering that maximises chance of a successful weapon generation + /// Sort mod slots into an ordering that maximises chance of a successful weapon generation /// /// Array of mod slot strings to sort /// The Tpl of the item with mod keys being sorted @@ -741,7 +802,10 @@ public class BotEquipmentModGenerator( public List SortModKeys(List unsortedSlotKeys, string itemTplWithKeysToSort) { // No need to sort with only 1 item in array - if (unsortedSlotKeys.Count <= 1) return unsortedSlotKeys; + if (unsortedSlotKeys.Count <= 1) + { + return unsortedSlotKeys; + } var isMount = _itemHelper.IsOfBaseclass(itemTplWithKeysToSort, BaseClasses.MOUNT); @@ -841,7 +905,7 @@ public class BotEquipmentModGenerator( } /// - /// Get a Slot property for an item (chamber/cartridge/slot) + /// Get a Slot property for an item (chamber/cartridge/slot) /// /// e.g patron_in_weapon /// item template @@ -854,16 +918,16 @@ public class BotEquipmentModGenerator( case "patron_in_weapon": case "patron_in_weapon_000": case "patron_in_weapon_001": - return parentTemplate?.Properties?.Chambers?.FirstOrDefault((chamber) => chamber.Name.Contains(modSlotLower)); + return parentTemplate?.Properties?.Chambers?.FirstOrDefault(chamber => chamber.Name.Contains(modSlotLower)); case "cartridges": - return parentTemplate?.Properties?.Cartridges?.FirstOrDefault((c) => c.Name?.ToLower() == modSlotLower); + return parentTemplate?.Properties?.Cartridges?.FirstOrDefault(c => c.Name?.ToLower() == modSlotLower); default: - return parentTemplate?.Properties?.Slots?.FirstOrDefault((s) => s.Name?.ToLower() == modSlotLower); + return parentTemplate?.Properties?.Slots?.FirstOrDefault(s => s.Name?.ToLower() == modSlotLower); } } /// - /// Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot + /// Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot /// /// slot the item sits in from db /// Name of slot the mod sits in @@ -875,29 +939,36 @@ public class BotEquipmentModGenerator( var slotRequired = itemSlot.Required; if (GetAmmoContainers().Contains(modSlotName)) // Always force mags/cartridges in weapon to spawn + { return ModSpawn.SPAWN; + } var spawnMod = _probabilityHelper.RollChance(modSpawnChances.GetValueOrDefault(modSlotName.ToLower())); if (!spawnMod && (slotRequired.GetValueOrDefault(false) || (botEquipConfig.WeaponSlotIdsToMakeRequired?.Contains(modSlotName) ?? false))) // Edge case: Mod is required but spawn chance roll failed, choose default mod spawn for slot + { return ModSpawn.DEFAULT_MOD; + } return spawnMod ? ModSpawn.SPAWN : ModSpawn.SKIP; } /// - /// Choose a mod to fit into the desired slot + /// Choose a mod to fit into the desired slot /// /// Data used to choose an appropriate mod with /// itemHelper.getItem() result public KeyValuePair? ChooseModToPutIntoSlot(ModToSpawnRequest request) { /** Slot mod will fill */ - var parentSlot = request.ParentTemplate.Properties.Slots?.FirstOrDefault((i) => i.Name == request.ModSlot); + var parentSlot = request.ParentTemplate.Properties.Slots?.FirstOrDefault(i => i.Name == request.ModSlot); var weaponTemplate = _itemHelper.GetItem(request.Weapon[0].Template).Value; // It's ammo, use predefined ammo parameter - if (GetAmmoContainers().Contains(request.ModSlot) && request.ModSlot != "mod_magazine") return _itemHelper.GetItem(request.AmmoTpl); + if (GetAmmoContainers().Contains(request.ModSlot) && request.ModSlot != "mod_magazine") + { + return _itemHelper.GetItem(request.AmmoTpl); + } // Ensure there's a pool of mods to pick from var modPool = GetModPoolForSlot(request, weaponTemplate); @@ -905,7 +976,9 @@ public class BotEquipmentModGenerator( { // Nothing in mod pool + item not required if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Mod pool for optional slot: {request.ModSlot} on item: {request.ParentTemplate.Name} was empty, skipping mod"); + } return null; } @@ -913,8 +986,12 @@ public class BotEquipmentModGenerator( // Filter out non-whitelisted scopes, use full modpool if filtered pool would have no elements if (request.ModSlot.Contains("mod_scope") && request.BotWeaponSightWhitelist is not null) // scope pool has more than one scope + { if (modPool.Count > 1) + { modPool = FilterSightsByWeaponType(request.Weapon[0], modPool, request.BotWeaponSightWhitelist); + } + } if (request.ModSlot == "mod_gas_block") { @@ -922,18 +999,24 @@ public class BotEquipmentModGenerator( { // Attempt to limit modpool to low profile gas blocks when weapon has an optic var onlyLowProfileGasBlocks = modPool.Where( - (tpl) => + tpl => _botConfig.LowProfileGasBlockTpls.Contains(tpl) ); - if (onlyLowProfileGasBlocks.Count() > 0) modPool = onlyLowProfileGasBlocks.ToHashSet(); + if (onlyLowProfileGasBlocks.Count() > 0) + { + modPool = onlyLowProfileGasBlocks.ToHashSet(); + } } 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) + tpl => !_botConfig.LowProfileGasBlockTpls.Contains(tpl) ); - if (onlyHighProfileGasBlocks.Count() > 0) modPool = onlyHighProfileGasBlocks.ToHashSet(); + if (onlyHighProfileGasBlocks.Count() > 0) + { + modPool = onlyHighProfileGasBlocks.ToHashSet(); + } } } @@ -943,7 +1026,9 @@ public class BotEquipmentModGenerator( (request?.IsRandomisableSlot ?? false) && request.RandomisationSettings.MinimumMagazineSize is not null ) + { modPool = GetFilterdMagazinePoolByCapacity(request, modPool).ToHashSet(); + } // Pick random mod that's compatible var chosenModResult = GetCompatibleWeaponModTplForSlotFromPool( @@ -956,12 +1041,18 @@ public class BotEquipmentModGenerator( ); if (chosenModResult.SlotBlocked.GetValueOrDefault(false) && !parentSlot.Required.GetValueOrDefault(false)) // Don't bother trying to fit mod, slot is completely blocked + { return null; + } // Log if mod chosen was incompatible if (chosenModResult.Incompatible.GetValueOrDefault(false) && !parentSlot.Required.GetValueOrDefault(false)) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Unable to find compatible mod of type: {parentSlot.Name}, in slot: {request.ModSlot} reason: {chosenModResult.Reason}"); + } + } // Get random mod to attach from items db for required slots if none found above if (!(chosenModResult.Found ?? false) && parentSlot != null && (parentSlot.Required ?? false)) @@ -971,14 +1062,19 @@ public class BotEquipmentModGenerator( } // Compatible item not found + not required - if (!chosenModResult.Found.GetValueOrDefault(false) && parentSlot is not null && !parentSlot.Required.GetValueOrDefault(false)) return null; + if (!chosenModResult.Found.GetValueOrDefault(false) && parentSlot is not null && !parentSlot.Required.GetValueOrDefault(false)) + { + return null; + } if (!(chosenModResult.Found ?? false) && parentSlot is not null) { if (parentSlot.Required.GetValueOrDefault(false)) + { _logger.Warning( $"Required slot unable to be filled, {request.ModSlot} on {request.ParentTemplate.Name} {request.ParentTemplate.Id} for weapon: {request.Weapon[0].Template}" ); + } return null; } @@ -987,7 +1083,7 @@ public class BotEquipmentModGenerator( } /// - /// Given the passed in array of magaizne tpls, look up the min size set in config and return only those that have that size or larger + /// Given the passed in array of magaizne tpls, look up the min size set in config and return only those that have that size or larger /// /// Request data /// Pool of magazine tpls to filter @@ -998,7 +1094,7 @@ public class BotEquipmentModGenerator( modSpawnRequest.RandomisationSettings.MinimumMagazineSize.TryGetValue(weaponTpl, out var minMagSizeFromSettings); var minMagazineSize = minMagSizeFromSettings; var desiredMagazineTpls = modPool.Where( - (magTpl) => + magTpl => { var magazineDb = _itemHelper.GetItem(magTpl).Value; return magazineDb.Properties is not null && magazineDb.Properties.Cartridges.FirstOrDefault().MaxCount >= minMagazineSize; @@ -1016,8 +1112,8 @@ public class BotEquipmentModGenerator( } /// - /// Choose a weapon mod tpl for a given slot from a pool of choices - /// Checks chosen tpl is compatible with all existing weapon items + /// Choose a weapon mod tpl for a given slot from a pool of choices + /// Checks chosen tpl is compatible with all existing weapon items /// /// /// Pool of mods that can be picked from @@ -1032,23 +1128,31 @@ public class BotEquipmentModGenerator( // Filter out incompatible mods from pool var preFilteredModPool = GetFilteredModPool(modPool, request.ConflictingItemTpls); if (preFilteredModPool.Count == 0) + { return new ChooseRandomCompatibleModResult { Incompatible = true, Found = false, Reason = $"Unable to add mod to {choiceTypeEnum.ToString()} slot: {modSlotName}. All: {modPool.Count()} had conflicts" }; + } // Filter mod pool to only items that appear in parents allowed list - preFilteredModPool = preFilteredModPool.Where((tpl) => parentSlot.Props.Filters[0].Filter.Contains(tpl)).ToList(); + preFilteredModPool = preFilteredModPool.Where(tpl => parentSlot.Props.Filters[0].Filter.Contains(tpl)).ToList(); if (preFilteredModPool.Count == 0) - return new ChooseRandomCompatibleModResult { Incompatible = true, Found = false, Reason = "No mods found in parents allowed list" }; + { + return new ChooseRandomCompatibleModResult + { + Incompatible = true, + Found = false, + Reason = "No mods found in parents allowed list" + }; + } return GetCompatibleModFromPool(preFilteredModPool, choiceTypeEnum, weapon); } /// - /// /// /// Pool of item Tpls to choose from /// How should the slot choice be handled - forced/normal etc @@ -1077,11 +1181,15 @@ public class BotEquipmentModGenerator( var pickedItemDetails = _itemHelper.GetItem(chosenTpl); if (!pickedItemDetails.Key) // Not valid item, try again + { continue; + } if (pickedItemDetails.Value.Properties is null) // no props data, try again + { continue; + } // Success - Default wanted + only 1 item in pool if (modSpawnType == ModSpawn.DEFAULT_MOD && modPool.Count == 1) @@ -1095,7 +1203,7 @@ public class BotEquipmentModGenerator( // Check if existing weapon mods are incompatible with chosen item var existingItemBlockingChoice = weapon.FirstOrDefault( - (item) => + item => pickedItemDetails.Value.Properties.ConflictingItems?.Contains(item.Template) ?? false ); if (existingItemBlockingChoice is not null) @@ -1142,21 +1250,21 @@ public class BotEquipmentModGenerator( } /// - /// Get a list of mod tpls that are compatible with the current weapon + /// Get a list of mod tpls that are compatible with the current weapon /// /// /// Tpls that are incompatible and should not be used /// string array of compatible mod tpls with weapon public List GetFilteredModPool(HashSet modPool, HashSet tplBlacklist) { - return modPool.Where((tpl) => !tplBlacklist.Contains(tpl)).ToList(); + return modPool.Where(tpl => !tplBlacklist.Contains(tpl)).ToList(); } /// - /// Filter mod pool down based on various criteria: - /// Is slot flagged as randomisable - /// Is slot required - /// Is slot flagged as default mod only + /// Filter mod pool down based on various criteria: + /// Is slot flagged as randomisable + /// Is slot required + /// Is slot flagged as default mod only /// /// /// Mods root parent (weapon/equipment) @@ -1164,10 +1272,15 @@ public class BotEquipmentModGenerator( public HashSet GetModPoolForSlot(ModToSpawnRequest request, TemplateItem weaponTemplate) { // Mod is flagged as being default only, try and find it in globals - if (request.ModSpawnResult == ModSpawn.DEFAULT_MOD) return GetModPoolForDefaultSlot(request, weaponTemplate); + if (request.ModSpawnResult == ModSpawn.DEFAULT_MOD) + { + return GetModPoolForDefaultSlot(request, weaponTemplate); + } if (request.IsRandomisableSlot.GetValueOrDefault(false)) + { return GetDynamicModPool(request.ParentTemplate.Id, request.ModSlot, request.BotEquipBlacklist); + } // Required mod is not default or randomisable, use existing pool return request.ItemModPool[request.ModSlot]; @@ -1179,8 +1292,12 @@ public class BotEquipmentModGenerator( if (matchingModFromPreset is null) { if (request.ItemModPool[request.ModSlot]?.Count > 1) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"{request.BotData.Role} No default: {request.ModSlot} mod found for: {weaponTemplate.Name}, using existing pool"); + } + } // Couldn't find default in globals, use existing mod pool data return request.ItemModPool[request.ModSlot]; @@ -1192,12 +1309,14 @@ public class BotEquipmentModGenerator( // Mod is in existing mod pool if (request.ItemModPool[request.ModSlot].Contains(matchingModFromPreset.Template)) // Found mod on preset + it already exists in mod pool + { return [matchingModFromPreset.Template]; + } // 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) + slot => string.Equals(slot.Name.ToLower(), request.ModSlot.ToLower(), StringComparison.Ordinal) ) ?.Props.Filters?[0].Filter; @@ -1208,26 +1327,36 @@ public class BotEquipmentModGenerator( ) { // Chosen mod has no conflicts + no children + is in parent compat list - if (!request.ConflictingItemTpls.Contains(matchingModFromPreset.Template)) return [matchingModFromPreset.Template]; + if (!request.ConflictingItemTpls.Contains(matchingModFromPreset.Template)) + { + return [matchingModFromPreset.Template]; + } // Above chosen mod had conflicts with existing weapon mods if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"{request.BotData.Role} Chosen default: {request.ModSlot} mod found for: {weaponTemplate.Name} weapon conflicts with item on weapon, cannot use default" ); + } var existingModPool = request.ItemModPool[request.ModSlot]; if (existingModPool.Count == 1) { // The only item in pool isn't compatible if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"{request.BotData.Role} {request.ModSlot} Mod pool for: {weaponTemplate.Name} weapon has only incompatible items, using parent list instead" ); + } // Last ditch, use full pool of items minus conflicts - var newListOfModsForSlot = parentSlotCompatibleItems.Where((tpl) => !request.ConflictingItemTpls.Contains(tpl)); - if (newListOfModsForSlot.Count() > 0) return newListOfModsForSlot.ToHashSet(); + var newListOfModsForSlot = parentSlotCompatibleItems.Where(tpl => !request.ConflictingItemTpls.Contains(tpl)); + if (newListOfModsForSlot.Count() > 0) + { + return newListOfModsForSlot.ToHashSet(); + } } // Return full mod pool @@ -1241,11 +1370,11 @@ public class BotEquipmentModGenerator( public Item? GetMatchingModFromPreset(ModToSpawnRequest request, TemplateItem weaponTemplate) { var matchingPreset = GetMatchingPreset(weaponTemplate, request.ParentTemplate.Id); - return matchingPreset?.Items?.FirstOrDefault((item) => item?.SlotId?.ToLower() == request.ModSlot.ToLower()); + return matchingPreset?.Items?.FirstOrDefault(item => item?.SlotId?.ToLower() == request.ModSlot.ToLower()); } /// - /// Get default preset for weapon OR get specific weapon presets for edge cases (mp5/silenced dvl) + /// Get default preset for weapon OR get specific weapon presets for edge cases (mp5/silenced dvl) /// /// Weapons db template /// Tpl of the parent item @@ -1254,17 +1383,23 @@ public class BotEquipmentModGenerator( { // Edge case - using mp5sd reciever means default mp5 handguard doesn't fit var isMp5sd = parentItemTpl == "5926f2e086f7745aae644231"; - if (isMp5sd) return _presetHelper.GetPreset("59411abb86f77478f702b5d2"); + if (isMp5sd) + { + return _presetHelper.GetPreset("59411abb86f77478f702b5d2"); + } // Edge case - dvl 500mm is the silenced barrel and has specific muzzle mods var isDvl500mmSilencedBarrel = parentItemTpl == "5888945a2459774bf43ba385"; - if (isDvl500mmSilencedBarrel) return _presetHelper.GetPreset("59e8d2b386f77445830dd299"); + if (isDvl500mmSilencedBarrel) + { + return _presetHelper.GetPreset("59e8d2b386f77445830dd299"); + } return _presetHelper.GetDefaultPreset(weaponTemplate.Id); } /// - /// Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible + /// Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible /// /// Array of items that make up a weapon /// Mod to check compatibility with weapon @@ -1272,13 +1407,16 @@ public class BotEquipmentModGenerator( public bool WeaponModComboIsIncompatible(List weapon, string modTpl) { // STM-9 + AR-15 Lone Star Ion Lite handguard - if (weapon[0].Template == "60339954d62c9b14ed777c06" && modTpl == "5d4405f0a4b9361e6a4e6bd9") return true; + if (weapon[0].Template == "60339954d62c9b14ed777c06" && modTpl == "5d4405f0a4b9361e6a4e6bd9") + { + return true; + } return false; } /// - /// Create a mod item with provided parameters as properties + add upd property + /// Create a mod item with provided parameters as properties + add upd property /// /// _id /// _tpl @@ -1300,8 +1438,8 @@ public class BotEquipmentModGenerator( } /// - /// Get a list of containers that hold ammo - /// e.g. mod_magazine / patron_in_weapon_000 + /// Get a list of containers that hold ammo + /// e.g. mod_magazine / patron_in_weapon_000 /// /// string array public List GetAmmoContainers() @@ -1310,7 +1448,7 @@ public class BotEquipmentModGenerator( } /// - /// Get a random mod from an items compatible mods Filter array + /// Get a random mod from an items compatible mods Filter array /// /// Default value to return if parentSlot Filter is empty /// Item mod will go into, used to get compatible items @@ -1328,7 +1466,10 @@ public class BotEquipmentModGenerator( while (exhaustableModPool.HasValues()) { tmpModTpl = exhaustableModPool.GetRandomValue(); - if (!_botGeneratorHelper.IsItemIncompatibleWithCurrentItems(items, tmpModTpl, modSlot).Incompatible.GetValueOrDefault(false)) return tmpModTpl; + if (!_botGeneratorHelper.IsItemIncompatibleWithCurrentItems(items, tmpModTpl, modSlot).Incompatible.GetValueOrDefault(false)) + { + return tmpModTpl; + } } // No mod found @@ -1336,7 +1477,7 @@ public class BotEquipmentModGenerator( } /// - /// Check if mod exists in db + is for a required slot + /// Check if mod exists in db + is for a required slot /// /// Db template of mod to check /// Slot object the item will be placed as child into @@ -1358,11 +1499,14 @@ public class BotEquipmentModGenerator( new { modId = modBeingAddedDbTemplate.Value?.Id ?? "UNKNOWN", - modSlot = modSlot + modSlot } ) ); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Item -> {parentTemplate?.Id}; Slot -> {modSlot}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Item -> {parentTemplate?.Id}; Slot -> {modSlot}"); + } return false; } @@ -1372,6 +1516,7 @@ public class BotEquipmentModGenerator( { // Parent slot must be filled but db object is invalid, show warning and return false if (slotAddedToTemplate.Required ?? false) + { _logger.Warning( _localisationService.GetText( "bot-unable_to_add_mod_item_invalid", @@ -1380,10 +1525,11 @@ public class BotEquipmentModGenerator( itemName = modBeingAddedDbTemplate.Value?.Name ?? "UNKNOWN", iodSlot = modSlot, parentItemName = parentTemplate.Name, - botRole = botRole + botRole } ) ); + } return false; } @@ -1393,7 +1539,7 @@ public class BotEquipmentModGenerator( } /// - /// Find mod tpls of a provided type and add to its modPool + /// Find mod tpls of a provided type and add to its modPool /// /// Slot to look up and add we are adding tpls for (e.g mod_scope) /// db object for modItem we get compatible mods from @@ -1403,15 +1549,22 @@ public class BotEquipmentModGenerator( Dictionary>> modPool, EquipmentFilterDetails botEquipBlacklist) { - var desiredSlotObject = modTemplate.Properties.Slots?.FirstOrDefault((slot) => slot.Name.Contains(desiredSlotName)); - if (desiredSlotObject is null) return; + var desiredSlotObject = modTemplate.Properties.Slots?.FirstOrDefault(slot => slot.Name.Contains(desiredSlotName)); + if (desiredSlotObject is null) + { + return; + } var supportedSubMods = desiredSlotObject.Props.Filters[0].Filter; - if (supportedSubMods is null) return; + if (supportedSubMods is null) + { + return; + } // Filter mods var filteredMods = FilterModsByBlacklist(supportedSubMods.ToHashSet(), botEquipBlacklist, desiredSlotName); if (!filteredMods.Any()) + { _logger.Warning( _localisationService .GetText( @@ -1423,6 +1576,7 @@ public class BotEquipmentModGenerator( } ) ); + } modPool.TryAdd(modTemplate.Id, new Dictionary>()); @@ -1430,7 +1584,7 @@ public class BotEquipmentModGenerator( } /// - /// Get the possible items that fit a slot + /// Get the possible items that fit a slot /// /// item tpl to get compatible items for /// Slot item should fit in @@ -1454,7 +1608,7 @@ public class BotEquipmentModGenerator( } /// - /// Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist + /// Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist /// /// Base mods to filter /// Equipment blacklist @@ -1463,23 +1617,26 @@ public class BotEquipmentModGenerator( public HashSet FilterModsByBlacklist(HashSet allowedMods, EquipmentFilterDetails? botEquipBlacklist, string modSlot) { // No blacklist, nothing to filter out - if (botEquipBlacklist is null) return allowedMods; + if (botEquipBlacklist is null) + { + return allowedMods; + } var result = new HashSet(); // Get item blacklist and mod equipment blacklist as one array botEquipBlacklist.Equipment.TryGetValue(modSlot, out var equipmentBlacklistValues); var blacklist = _itemFilterService.GetBlacklistedItems().Concat(equipmentBlacklistValues ?? []); - result = allowedMods.Where((tpl) => !blacklist.Contains(tpl)).ToHashSet(); + result = allowedMods.Where(tpl => !blacklist.Contains(tpl)).ToHashSet(); return result; } /// - /// With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. - /// Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. - /// Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. - /// This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" + /// With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines. + /// Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0. + /// Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots. + /// This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine" /// /// The items where the CylinderMagazine's camora are appended to /// ModPool which should include available cartridges @@ -1500,11 +1657,14 @@ public class BotEquipmentModGenerator( } ) ); - var camoraSlots = cylinderMagTemplate.Properties.Slots.Where((slot) => slot.Name.StartsWith("camora")); + var camoraSlots = cylinderMagTemplate.Properties.Slots.Where(slot => slot.Name.StartsWith("camora")); // Attempt to generate camora slots for item modPool[cylinderMagTemplate.Id] = new Dictionary>(); - foreach (var camora in camoraSlots) modPool[cylinderMagTemplate.Id][camora.Name] = camora.Props.Filters?[0].Filter.ToHashSet(); + foreach (var camora in camoraSlots) + { + modPool[cylinderMagTemplate.Id][camora.Name] = camora.Props.Filters?[0].Filter.ToHashSet(); + } itemModPool = modPool[cylinderMagTemplate.Id]; } @@ -1564,7 +1724,7 @@ public class BotEquipmentModGenerator( } /// - /// Take a record of camoras and merge the compatible shells into one array + /// Take a record of camoras and merge the compatible shells into one array /// /// Dictionary of camoras we want to merge into one array /// String array of shells for multiple camora sources @@ -1577,9 +1737,9 @@ public class BotEquipmentModGenerator( } /// - /// Filter out non-whitelisted weapon scopes - /// Controlled by bot.json weaponSightWhitelist - /// e.g. filter out rifle scopes from SMGs + /// Filter out non-whitelisted weapon scopes + /// Controlled by bot.json weaponSightWhitelist + /// e.g. filter out rifle scopes from SMGs /// /// Weapon scopes will be added to /// Full scope pool @@ -1593,9 +1753,11 @@ public class BotEquipmentModGenerator( if (!botWeaponSightWhitelist.TryGetValue(weaponDetails.Value.Parent, out var whitelistedSightTypes)) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to find whitelist for weapon type: {weaponDetails.Value.Parent} {weaponDetails.Value.Name}, skipping sight filtering" ); + } return scopes; } @@ -1621,23 +1783,25 @@ public class BotEquipmentModGenerator( // Should only find 1 as there's currently no items with a mod_scope AND a mod_scope_000 List filter = ["mod_scope", "mod_scope_000"]; var scopeSlot = itemDetails.Properties.Slots.Where( - (slot) => + slot => filter.Contains(slot.Name) ); // Mods scope slot found must allow ALL whitelisted scope types OR be a mount if (scopeSlot?.All( - (slot) => + slot => slot.Props.Filters[0] .Filter.All( - (tpl) => + tpl => _itemHelper.IsOfBaseclasses(tpl, whitelistedSightTypes) || _itemHelper.IsOfBaseclass(tpl, BaseClasses.MOUNT) ) ) ?? false) // Add mod to allowed list + { filteredScopesAndMods.Add(item); + } } } @@ -1645,7 +1809,9 @@ public class BotEquipmentModGenerator( if (filteredScopesAndMods is null || filteredScopesAndMods.Count() == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Scope whitelist too restrictive for: {weapon.Template} {weaponDetails.Value.Name}, skipping filter"); + } return scopes; } diff --git a/Libraries/Core/Generators/BotGenerator.cs b/Libraries/Core/Generators/BotGenerator.cs index 76de71c9..c35af6da 100644 --- a/Libraries/Core/Generators/BotGenerator.cs +++ b/Libraries/Core/Generators/BotGenerator.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Common; using Core.Models.Eft.Common; @@ -11,6 +10,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using BodyPart = Core.Models.Eft.Common.Tables.BodyPart; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -42,7 +42,7 @@ public class BotGenerator( protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// Generate a player scav bot object + /// Generate a player scav bot object /// /// Session id /// e.g. assault / pmcbot @@ -110,7 +110,7 @@ public class BotGenerator( } /// - /// Create 1 bot of the type/side/difficulty defined in botGenerationDetails + /// Create 1 bot of the type/side/difficulty defined in botGenerationDetails /// /// Session id /// details on how to generate bots @@ -128,13 +128,16 @@ public class BotGenerator( ? preparedBotBase.Info.Side // Use side to get usec.json or bear.json when bot will be PMC : botGenerationDetails.Role; var botJsonTemplateClone = _cloner.Clone(_botHelper.GetBotTemplate(botRole)); - if (botJsonTemplateClone is null) _logger.Error($"Unable to retrieve: {botRole} bot template, cannot generate bot of this type"); + if (botJsonTemplateClone is null) + { + _logger.Error($"Unable to retrieve: {botRole} bot template, cannot generate bot of this type"); + } return GenerateBot(sessionId, preparedBotBase, botJsonTemplateClone, botGenerationDetails); } /// - /// Get a clone of the default bot base object and adjust its role/side/difficulty values + /// Get a clone of the default bot base object and adjust its role/side/difficulty values /// /// Role bot should have /// Side bot should have @@ -151,7 +154,7 @@ public class BotGenerator( } /// - /// Get a clone of the database\bots\base.json file + /// Get a clone of the database\bots\base.json file /// /// BotBase object public BotBase GetCloneOfBotBase() @@ -160,7 +163,7 @@ public class BotGenerator( } /// - /// Create a IBotBase object with equipment/loot/exp etc + /// Create a IBotBase object with equipment/loot/exp etc /// /// Session id /// Bots base file @@ -182,12 +185,14 @@ public class BotGenerator( // Only filter bot equipment, never players if (!botGenerationDetails.IsPlayerScav.GetValueOrDefault(false)) + { _botEquipmentFilterService.FilterBotEquipment( sessionId, botJsonTemplate, botLevel.Level.Value, botGenerationDetails ); + } bot.Info.Nickname = _botNameService.GenerateUniqueBotNickname( botJsonTemplate, @@ -210,20 +215,27 @@ public class BotGenerator( if (!_seasonalEventService.ChristmasEventEnabled()) // Process all bots EXCEPT gifter, he needs christmas items + { if (botGenerationDetails.Role != "gifter") + { _seasonalEventService.RemoveChristmasItemsFromBotInventory( botJsonTemplate.BotInventory, botGenerationDetails.Role ); + } + } RemoveBlacklistedLootFromBotTemplate(botJsonTemplate.BotInventory); // Remove hideout data if bot is not a PMC or pscav - match what live sends - if (!(botGenerationDetails.IsPmc.GetValueOrDefault(false) || botGenerationDetails.IsPlayerScav.GetValueOrDefault(false))) bot.Hideout = null; + if (!(botGenerationDetails.IsPmc.GetValueOrDefault(false) || botGenerationDetails.IsPlayerScav.GetValueOrDefault(false))) + { + bot.Hideout = null; + } bot.Info.Experience = botLevel.Exp; bot.Info.Level = botLevel.Level; - bot.Info.Settings.Experience = (int)GetExperienceRewardForKillByDifficulty( + bot.Info.Settings.Experience = (int) GetExperienceRewardForKillByDifficulty( botJsonTemplate.BotExperience.Reward, botGenerationDetails.BotDifficulty, botGenerationDetails.Role @@ -248,7 +260,10 @@ public class BotGenerator( { bot.Info.IsStreamerModeAvailable = true; // Set to true so client patches can pick it up later - client sometimes alters botrole to assaultGroup SetRandomisedGameVersionAndCategory(bot.Info); - if (bot.Info.GameVersion == GameEditions.UNHEARD) AddAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate); + if (bot.Info.GameVersion == GameEditions.UNHEARD) + { + AddAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate); + } } // Add drip @@ -266,7 +281,10 @@ public class BotGenerator( bot.Info.GameVersion ); - if (_botConfig.BotRolesWithDogTags.Contains(botRoleLowercase)) AddDogtagToBot(bot); + if (_botConfig.BotRolesWithDogTags.Contains(botRoleLowercase)) + { + AddDogtagToBot(bot); + } // Generate new bot ID AddIdsToBot(bot, botGenerationDetails); @@ -275,13 +293,16 @@ public class BotGenerator( GenerateInventoryId(bot); // Set role back to originally requested now its been generated - if (botGenerationDetails.EventRole is not null) bot.Info.Settings.Role = botGenerationDetails.EventRole; + if (botGenerationDetails.EventRole is not null) + { + bot.Info.Settings.Role = botGenerationDetails.EventRole; + } return bot; } /// - /// Should this bot have a name like "name (Pmc Name)" and be altered by client patch to be hostile to player + /// Should this bot have a name like "name (Pmc Name)" and be altered by client patch to be hostile to player /// /// Role bot has /// True if name should be simulated pscav @@ -291,7 +312,7 @@ public class BotGenerator( } /// - /// Get exp for kill by bot difficulty + /// Get exp for kill by bot difficulty /// /// Dict of difficulties and experience /// the killed bots difficulty @@ -301,7 +322,10 @@ public class BotGenerator( { if (!experiences.TryGetValue(botDifficulty.ToLower(), out var result)) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Unable to find experience: {botDifficulty} for {role} bot, falling back to `normal`"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Unable to find experience: {botDifficulty} for {role} bot, falling back to `normal`"); + } return _randomUtil.GetDouble(experiences["normal"].Min.Value, experiences["normal"].Max.Value); } @@ -310,7 +334,7 @@ public class BotGenerator( } /// - /// Get the standing value change when player kills a bot + /// Get the standing value change when player kills a bot /// /// Dictionary of standing values keyed by bot difficulty /// Difficulty of bot to look up @@ -329,7 +353,7 @@ public class BotGenerator( } /// - /// Get the agressor bonus value when player kills a bot + /// Get the agressor bonus value when player kills a bot /// /// Dictionary of standing values keyed by bot difficulty /// Difficulty of bot to look up @@ -348,7 +372,7 @@ public class BotGenerator( } /// - /// Set weighting of flagged equipment to 0 + /// Set weighting of flagged equipment to 0 /// /// Bot data to adjust /// Generation details of bot @@ -361,7 +385,9 @@ public class BotGenerator( if (blacklist?.Gear is null) // Nothing to filter by + { return; + } foreach (var (equipmentSlot, blacklistedTpls) in blacklist.Gear) { @@ -369,12 +395,14 @@ public class BotGenerator( foreach (var blacklistedTpl in blacklistedTpls) // Set weighting to 0, will never be picked + { equipmentDict[blacklistedTpl] = 0; + } } } /// - /// TODO: Complete Summary + /// TODO: Complete Summary /// /// Bot data to adjust public void AddAdditionalPocketLootWeightsForUnheardBot(BotType botJsonTemplate) @@ -386,7 +414,7 @@ public class BotGenerator( } /// - /// Remove items from item.json/lootableItemBlacklist from bots inventory + /// Remove items from item.json/lootableItemBlacklist from bots inventory /// /// Bot to filter public void RemoveBlacklistedLootFromBotTemplate(BotTypeInventory botInventory) @@ -398,24 +426,34 @@ public class BotGenerator( foreach (var lootContainerKey in lootContainersToFilter) { var prop = props.FirstOrDefault(x => string.Equals(x.Name, lootContainerKey, StringComparison.CurrentCultureIgnoreCase)); - var propValue = (Dictionary)prop.GetValue(botInventory.Items); + var propValue = (Dictionary) prop.GetValue(botInventory.Items); // No container, skip - if (propValue?.Count == 0) continue; + if (propValue?.Count == 0) + { + continue; + } List tplsToRemove = []; foreach (var (key, _) in propValue) + { if (_itemFilterService.IsLootableItemBlacklisted(key)) + { tplsToRemove.Add(key); + } + } - foreach (var blacklistedTplToRemove in tplsToRemove) propValue.Remove(blacklistedTplToRemove); + foreach (var blacklistedTplToRemove in tplsToRemove) + { + propValue.Remove(blacklistedTplToRemove); + } prop.SetValue(botInventory.Items, propValue); } } /// - /// Choose various appearance settings for a bot using weights: head/body/feet/hands + /// Choose various appearance settings for a bot using weights: head/body/feet/hands /// /// Bot to adjust /// Appearance settings to choose from @@ -438,17 +476,26 @@ public class BotGenerator( } /// - /// Log the number of PMCs generated to the debug console + /// Log the number of PMCs generated to the debug console /// /// Generated bot array, ready to send to client public void LogPmcGeneratedCount(List output) { - var pmcCount = output.Aggregate(0, (acc, cur) => { return cur.Info.Side is "Bear" or "Usec" ? acc + 1 : acc; }); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Generated {output.Count} total bots. Replaced {pmcCount} with PMCs"); + var pmcCount = output.Aggregate( + 0, + (acc, cur) => + { + return cur.Info.Side is "Bear" or "Usec" ? acc + 1 : acc; + } + ); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Generated {output.Count} total bots. Replaced {pmcCount} with PMCs"); + } } /// - /// Converts health object to the required format + /// Converts health object to the required format /// /// health object from bot json /// Is a pscav bot being generated @@ -557,14 +604,16 @@ public class BotGenerator( } /// - /// Sum up body parts max hp values, return the bodyPart collection with lowest value + /// Sum up body parts max hp values, return the bodyPart collection with lowest value /// /// Body parts to sum up /// Lowest hp collection public BodyPart? GetLowestHpBody(List bodies) { if (bodies.Count == 0) + { return null; + } BodyPart result = new(); var props = result.GetType().GetProperties(); @@ -575,7 +624,7 @@ public class BotGenerator( foreach (var prop in props) { - var value = (MinMax)prop.GetValue(bodyPart); + var value = (MinMax) prop.GetValue(bodyPart); hpTotal += value.Max; } @@ -591,7 +640,7 @@ public class BotGenerator( } /// - /// Get a bots skills with randomsied progress value between the min and max values + /// Get a bots skills with randomsied progress value between the min and max values /// /// Skills that should have their progress value randomised /// Skills @@ -608,7 +657,7 @@ public class BotGenerator( } /// - /// Randomise the progress value of passed in skills based on the min/max value + /// Randomise the progress value of passed in skills based on the min/max value /// /// Skills to randomise /// Are the skills 'common' skills @@ -616,14 +665,19 @@ public class BotGenerator( public List GetSkillsWithRandomisedProgressValue(Dictionary? skills, bool isCommonSkills) { if (skills is null) + { return []; + } return skills.Select( kvp => { // Get skill from dict, skip if not found var skill = kvp.Value; - if (skill == null) return null; + if (skill == null) + { + return null; + } // All skills have id and progress props var skillToAdd = new BaseSkill @@ -647,7 +701,7 @@ public class BotGenerator( } /// - /// Generate an id+aid for a bot and apply + /// Generate an id+aid for a bot and apply /// /// bot to update /// @@ -661,8 +715,8 @@ public class BotGenerator( } /// - /// Update a profiles profile.Inventory.equipment value with a freshly generated one. - /// Update all inventory items that make use of this value too. + /// Update a profiles profile.Inventory.equipment value with a freshly generated one. + /// Update all inventory items that make use of this value too. /// /// Profile to update public void GenerateInventoryId(BotBase profile) @@ -681,10 +735,16 @@ public class BotGenerator( // Optimisation - skip items without a parentId // They are never linked to root inventory item + we already handled root item above - if (item.ParentId is null) continue; + if (item.ParentId is null) + { + continue; + } // Item is a child of root inventory item, update its parentId value to newly generated id - if (item.ParentId == profile.Inventory.Equipment) item.ParentId = newInventoryItemId; + if (item.ParentId == profile.Inventory.Equipment) + { + item.ParentId = newInventoryItemId; + } } // Update inventory equipment id to new one we generated @@ -692,9 +752,9 @@ public class BotGenerator( } /// - /// Randomise a bots game version and account category. - /// Chooses from all the game versions (standard, eod etc). - /// Chooses account type (default, Sherpa, etc). + /// Randomise a bots game version and account category. + /// Chooses from all the game versions (standard, eod etc). + /// Chooses account type (default, Sherpa, etc). /// /// bot info object to update /// Chosen game version @@ -734,7 +794,7 @@ public class BotGenerator( } /// - /// Add a side-specific (usec/bear) dogtag item to a bots inventory + /// Add a side-specific (usec/bear) dogtag item to a bots inventory /// /// bot to add dogtag to /// @@ -756,7 +816,7 @@ public class BotGenerator( } /// - /// Get a dogtag tpl that matches the bots game version and side + /// Get a dogtag tpl that matches the bots game version and side /// /// Usec/Bear /// edge_of_darkness / standard @@ -764,6 +824,7 @@ public class BotGenerator( public string GetDogtagTplByGameVersionAndSide(string side, string gameVersion) { if (side.ToLower() == "usec") + { switch (gameVersion) { case GameEditions.EDGE_OF_DARKNESS: @@ -773,6 +834,7 @@ public class BotGenerator( default: return ItemTpl.BARTER_DOGTAG_USEC; } + } switch (gameVersion) { @@ -786,14 +848,14 @@ public class BotGenerator( } /// - /// Adjust a PMCs pocket tpl to UHD if necessary, otherwise do nothing + /// Adjust a PMCs pocket tpl to UHD if necessary, otherwise do nothing /// /// Pmc object to adjust public void SetPmcPocketsByGameVersion(BotBase bot) { if (bot.Info.GameVersion == GameEditions.UNHEARD) { - var pockets = bot.Inventory.Items.FirstOrDefault((item) => item.SlotId == "Pockets"); + var pockets = bot.Inventory.Items.FirstOrDefault(item => item.SlotId == "Pockets"); pockets.Template = ItemTpl.POCKETS_1X4_TUE; } } diff --git a/Libraries/Core/Generators/BotInventoryGenerator.cs b/Libraries/Core/Generators/BotInventoryGenerator.cs index 14c77e97..1d3bfe20 100644 --- a/Libraries/Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/Core/Generators/BotInventoryGenerator.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Context; using Core.Helpers; using Core.Models.Eft.Common.Tables; @@ -10,6 +9,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -37,10 +37,10 @@ public class BotInventoryGenerator( ConfigServer _configServer ) { - private BotConfig _botConfig = _configServer.GetConfig(); + private readonly BotConfig _botConfig = _configServer.GetConfig(); // Slots handled individually inside `GenerateAndAddEquipmentToBot` - private List _excludedEquipmentSlots = + private readonly List _excludedEquipmentSlots = [ EquipmentSlots.Pockets, EquipmentSlots.FirstPrimaryWeapon, @@ -54,7 +54,7 @@ public class BotInventoryGenerator( ]; /// - /// Add equipment/weapons/loot to bot + /// Add equipment/weapons/loot to bot /// /// Session id /// Base json db file for the bot having its loot generated @@ -107,7 +107,7 @@ public class BotInventoryGenerator( } /// - /// Create a pmcInventory object with all the base/generic items needed + /// Create a pmcInventory object with all the base/generic items needed /// /// PmcInventory object public BotBaseInventory GenerateInventoryBase() @@ -123,12 +123,36 @@ public class BotInventoryGenerator( { Items = [ - new Item { Id = equipmentId, Template = ItemTpl.INVENTORY_DEFAULT }, - new Item { Id = stashId, Template = ItemTpl.STASH_STANDARD_STASH_10X30 }, - new Item { Id = questRaidItemsId, Template = ItemTpl.STASH_QUESTRAID }, - new Item { Id = questStashItemsId, Template = ItemTpl.STASH_QUESTOFFLINE }, - new Item { Id = sortingTableId, Template = ItemTpl.SORTINGTABLE_SORTING_TABLE }, - new Item { Id = hideoutCustomizationStashId, Template = ItemTpl.HIDEOUTAREACONTAINER_CUSTOMIZATION } + new Item + { + Id = equipmentId, + Template = ItemTpl.INVENTORY_DEFAULT + }, + new Item + { + Id = stashId, + Template = ItemTpl.STASH_STANDARD_STASH_10X30 + }, + new Item + { + Id = questRaidItemsId, + Template = ItemTpl.STASH_QUESTRAID + }, + new Item + { + Id = questStashItemsId, + Template = ItemTpl.STASH_QUESTOFFLINE + }, + new Item + { + Id = sortingTableId, + Template = ItemTpl.SORTINGTABLE_SORTING_TABLE + }, + new Item + { + Id = hideoutCustomizationStashId, + Template = ItemTpl.HIDEOUTAREACONTAINER_CUSTOMIZATION + } ], Equipment = equipmentId, Stash = stashId, @@ -143,7 +167,7 @@ public class BotInventoryGenerator( } /// - /// Add equipment to a bot + /// Add equipment to a bot /// /// Session id /// bot/x.json data from db @@ -165,12 +189,16 @@ public class BotInventoryGenerator( raidConfig is not null && _weatherHelper.IsNightTime(raidConfig.TimeVariant) ) + { foreach (var equipmentSlotKvP in randomistionDetails.NighttimeChanges.EquipmentModsModifiers) // Never let mod chance go outside of 0 - 100 + { randomistionDetails.EquipmentMods[equipmentSlotKvP.Key] = Math.Min( Math.Max(randomistionDetails.EquipmentMods[equipmentSlotKvP.Key] + equipmentSlotKvP.Value, 0), 100 ); + } + } // Get profile of player generating bots, we use their level later on var pmcProfile = _profileHelper.GetPmcProfile(sessionId); @@ -184,7 +212,10 @@ public class BotInventoryGenerator( { // Skip some slots as they need to be done in a specific order + with specific parameter values // e.g. Weapons - if (_excludedEquipmentSlots.Contains(equipmentSlot)) continue; + if (_excludedEquipmentSlots.Contains(equipmentSlot)) + { + continue; + } GenerateEquipment( new GenerateEquipmentProperties @@ -193,7 +224,12 @@ public class BotInventoryGenerator( RootEquipmentPool = value, ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -211,7 +247,12 @@ public class BotInventoryGenerator( RootEquipmentPool = GetPocketPoolByGameEdition(chosenGameVersion, templateInventory), ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -227,7 +268,12 @@ public class BotInventoryGenerator( RootEquipmentPool = templateInventory.Equipment[EquipmentSlots.FaceCover], ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -242,7 +288,12 @@ public class BotInventoryGenerator( RootEquipmentPool = templateInventory.Equipment[EquipmentSlots.Headwear], ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -257,7 +308,12 @@ public class BotInventoryGenerator( RootEquipmentPool = templateInventory.Equipment[EquipmentSlots.Earpiece], ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -272,7 +328,12 @@ public class BotInventoryGenerator( RootEquipmentPool = templateInventory.Equipment[EquipmentSlots.ArmorVest], ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -283,15 +344,22 @@ public class BotInventoryGenerator( // Bot has no armor vest and flagged to be forced to wear armored rig in this event if (botEquipConfig.ForceOnlyArmoredRigWhenNoArmor.GetValueOrDefault(false) && !hasArmorVest) // Filter rigs down to only those with armor + { FilterRigsToThoseWithProtection(templateInventory.Equipment, botRole); + } // Optimisation - Remove armored rigs from pool if (hasArmorVest) // Filter rigs down to only those with armor + { FilterRigsToThoseWithoutProtection(templateInventory.Equipment, botRole); + } // Bot is flagged as always needing a vest - if (botEquipConfig.ForceRigWhenNoVest.GetValueOrDefault(false) && !hasArmorVest) wornItemChances.EquipmentChances["TacticalVest"] = 100; + if (botEquipConfig.ForceRigWhenNoVest.GetValueOrDefault(false) && !hasArmorVest) + { + wornItemChances.EquipmentChances["TacticalVest"] = 100; + } GenerateEquipment( new GenerateEquipmentProperties @@ -300,7 +368,12 @@ public class BotInventoryGenerator( RootEquipmentPool = templateInventory.Equipment[EquipmentSlots.TacticalVest], ModPool = templateInventory.Mods, SpawnChances = wornItemChances, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, @@ -312,12 +385,15 @@ public class BotInventoryGenerator( protected Dictionary GetPocketPoolByGameEdition(string chosenGameVersion, BotTypeInventory templateInventory) { return chosenGameVersion == GameEditions.UNHEARD - ? new Dictionary { [ItemTpl.POCKETS_1X4_TUE] = 1 } + ? new Dictionary + { + [ItemTpl.POCKETS_1X4_TUE] = 1 + } : templateInventory.Equipment.GetValueOrDefault(EquipmentSlots.Pockets); } /// - /// Remove non-armored rigs from parameter data + /// Remove non-armored rigs from parameter data /// /// Equipment to filter TacticalVest of /// Role of bot vests are being filtered for @@ -329,7 +405,10 @@ public class BotInventoryGenerator( if (!tacVestsWithArmor.Any()) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Unable to filter to only armored rigs as bot: {botRole} has none in pool"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Unable to filter to only armored rigs as bot: {botRole} has none in pool"); + } return; } @@ -338,7 +417,7 @@ public class BotInventoryGenerator( } /// - /// Remove armored rigs from parameter data + /// Remove armored rigs from parameter data /// /// Equipment to filter TacticalVest by /// Role of bot vests are being filtered for @@ -352,7 +431,10 @@ public class BotInventoryGenerator( if (!allowEmptyResult && !tacVestsWithoutArmor.Any()) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Unable to filter to only unarmored rigs as bot: {botRole} has none in pool"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Unable to filter to only unarmored rigs as bot: {botRole} has none in pool"); + } return; } @@ -361,7 +443,7 @@ public class BotInventoryGenerator( } /// - /// Add a piece of equipment with mods to inventory from the provided pools + /// Add a piece of equipment with mods to inventory from the provided pools /// /// Values to adjust how item is chosen and added to bot /// true when item added @@ -396,7 +478,10 @@ public class BotInventoryGenerator( var attempts = 0; while (!found) { - if (!settings.RootEquipmentPool.Any()) return false; + if (!settings.RootEquipmentPool.Any()) + { + return false; + } var chosenItemTpl = _weightedRandomHelper.GetWeightedValue(settings.RootEquipmentPool); var dbResult = _itemHelper.GetItem(chosenItemTpl); @@ -404,7 +489,10 @@ public class BotInventoryGenerator( if (!dbResult.Key) { _logger.Error(_localisationService.GetText("bot-missing_item_template", chosenItemTpl)); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"EquipmentSlot-> {settings.RootEquipmentSlot}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"EquipmentSlot-> {settings.RootEquipmentSlot}"); + } // Remove picked item settings.RootEquipmentPool.Remove(chosenItemTpl); @@ -423,7 +511,10 @@ public class BotInventoryGenerator( if (compatibilityResult.Incompatible ?? false) { // Tried x different items that failed, stop - if (attempts > maxAttempts) return false; + if (attempts > maxAttempts) + { + return false; + } // Remove picked item from pool settings.RootEquipmentPool.Remove(chosenItemTpl); @@ -460,10 +551,13 @@ public class BotInventoryGenerator( settings.RandomisationDetails?.RandomisedArmorSlots != null && settings.RandomisationDetails.RandomisedArmorSlots.Contains(settings.RootEquipmentSlot.ToString())) // Filter out mods from relevant blacklist + { settings.ModPool[pickedItemDb.Id] = GetFilteredDynamicModsForItem( pickedItemDb.Id, botEquipBlacklist.Equipment ); + } + var itemIsOnGenerateModBlacklist = settings.GenerateModsBlacklist != null && settings.GenerateModsBlacklist.Contains(pickedItemDb.Id); // Does item have slots for sub-mods to be inserted into if (pickedItemDb.Properties?.Slots?.Count > 0 && !itemIsOnGenerateModBlacklist) @@ -490,7 +584,7 @@ public class BotInventoryGenerator( } /// - /// Get all possible mods for item and filter down based on equipment blacklist from bot.json config + /// Get all possible mods for item and filter down based on equipment blacklist from bot.json config /// /// Item mod pool is being retrieved and filtered /// Blacklist to filter mod pool with @@ -501,11 +595,15 @@ public class BotInventoryGenerator( foreach (var modSlot in modPool) { // Get blacklist - if (!equipmentBlacklist.TryGetValue(modSlot.Key, out var blacklistedMods)) blacklistedMods = []; + if (!equipmentBlacklist.TryGetValue(modSlot.Key, out var blacklistedMods)) + { + blacklistedMods = []; + } + ; // Get mods not on blacklist - var filteredMods = modPool[modSlot.Key].Where((slotName) => !blacklistedMods.Contains(slotName)); + var filteredMods = modPool[modSlot.Key].Where(slotName => !blacklistedMods.Contains(slotName)); if (!filteredMods.Any()) { _logger.Warning($"Filtering {modSlot.Key} pool resulting in 0 items, skipping filter"); @@ -519,7 +617,7 @@ public class BotInventoryGenerator( } /// - /// Work out what weapons bot should have equipped and add them to bot inventory + /// Work out what weapons bot should have equipped and add them to bot inventory /// /// bot/x.json data from db /// Chances bot can have equipment equipped @@ -535,7 +633,9 @@ public class BotInventoryGenerator( var weaponSlotsToFill = GetDesiredWeaponsForBot(equipmentChances); foreach (var desiredWeapons in weaponSlotsToFill) // Add weapon to bot if true and bot json has something to put into the slot + { if (desiredWeapons.ShouldSpawn && templateInventory.Equipment[desiredWeapons.Slot].Any()) + { AddWeaponAndMagazinesToInventory( sessionId, desiredWeapons, @@ -547,10 +647,12 @@ public class BotInventoryGenerator( itemGenerationLimitsMinMax, botLevel ); + } + } } /// - /// Calculate if the bot should have weapons in Primary/Secondary/Holster slots + /// Calculate if the bot should have weapons in Primary/Secondary/Holster slots /// /// Chances bot has certain equipment /// What slots bot should have weapons generated for @@ -561,7 +663,8 @@ public class BotInventoryGenerator( [ new DesiredWeapons { - Slot = EquipmentSlots.FirstPrimaryWeapon, ShouldSpawn = shouldSpawnPrimary + Slot = EquipmentSlots.FirstPrimaryWeapon, + ShouldSpawn = shouldSpawnPrimary }, new DesiredWeapons { @@ -577,7 +680,7 @@ public class BotInventoryGenerator( } /// - /// Add weapon + spare mags/ammo to bots inventory + /// Add weapon + spare mags/ammo to bots inventory /// /// Session id /// Weapon slot being generated @@ -616,7 +719,15 @@ public class BotInventoryGenerator( public class DesiredWeapons { - public EquipmentSlots Slot { get; set; } + public EquipmentSlots Slot + { + get; + set; + } - public bool ShouldSpawn { get; set; } + public bool ShouldSpawn + { + get; + set; + } } diff --git a/Libraries/Core/Generators/BotLevelGenerator.cs b/Libraries/Core/Generators/BotLevelGenerator.cs index fab74e45..04c0d4af 100644 --- a/Libraries/Core/Generators/BotLevelGenerator.cs +++ b/Libraries/Core/Generators/BotLevelGenerator.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Common; using Core.Models.Eft.Bot; using Core.Models.Eft.Common.Tables; @@ -6,7 +5,7 @@ using Core.Models.Spt.Bots; using Core.Models.Utils; using Core.Services; using Core.Utils; - +using SptCommon.Annotations; namespace Core.Generators; @@ -19,7 +18,7 @@ public class BotLevelGenerator( ) { /// - /// Return a randomised bot level and exp value + /// Return a randomised bot level and exp value /// /// Min and max of level for bot /// Details to help generate a bot @@ -27,7 +26,14 @@ public class BotLevelGenerator( /// IRandomisedBotLevelResult object public RandomisedBotLevelResult GenerateBotLevel(MinMax levelDetails, BotGenerationDetails botGenerationDetails, BotBase bot) { - if (!botGenerationDetails.IsPmc.GetValueOrDefault(false)) return new RandomisedBotLevelResult { Exp = 0, Level = 1 }; + if (!botGenerationDetails.IsPmc.GetValueOrDefault(false)) + { + return new RandomisedBotLevelResult + { + Exp = 0, + Level = 1 + }; + } var expTable = _databaseService.GetGlobals().Configuration.Exp.Level.ExperienceTable; var botLevelRange = GetRelativePmcBotLevelRange(botGenerationDetails, levelDetails, expTable.Length); @@ -38,12 +44,22 @@ public class BotLevelGenerator( ChooseBotLevel(botLevelRange.Min.Value, botLevelRange.Max.Value, 1, 1.15) .ToString() ); // TODO - nasty double to string to int conversion - for (var i = 0; i < level; i++) exp += expTable[i].Experience.Value; + for (var i = 0; i < level; i++) + { + exp += expTable[i].Experience.Value; + } // Sprinkle in some random exp within the level, unless we are at max level. - if (level < expTable.Length - 1) exp += _randomUtil.GetInt(0, expTable[level].Experience.Value - 1); + if (level < expTable.Length - 1) + { + exp += _randomUtil.GetInt(0, expTable[level].Experience.Value - 1); + } - return new RandomisedBotLevelResult { Level = level, Exp = exp }; + return new RandomisedBotLevelResult + { + Level = level, + Exp = exp + }; } public double ChooseBotLevel(double min, double max, int shift, double number) @@ -52,7 +68,7 @@ public class BotLevelGenerator( } /// - /// Return the min and max level a PMC can be + /// Return the min and max level a PMC can be /// /// Details to help generate a bot /// diff --git a/Libraries/Core/Generators/BotLootGenerator.cs b/Libraries/Core/Generators/BotLootGenerator.cs index 49b09a23..91abbc21 100644 --- a/Libraries/Core/Generators/BotLootGenerator.cs +++ b/Libraries/Core/Generators/BotLootGenerator.cs @@ -1,14 +1,14 @@ -using SptCommon.Annotations; +using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Bots; using Core.Models.Spt.Config; -using Core.Utils; -using Core.Helpers; using Core.Models.Utils; -using Core.Services; using Core.Servers; +using Core.Services; +using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Generators; @@ -36,7 +36,6 @@ public class BotLootGenerator( protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// /// /// /// @@ -47,7 +46,10 @@ public class BotLootGenerator( // Clone limits and set all values to 0 to use as a running total var limitsForBotDict = _cloner.Clone(limits); // Init current count of items we want to limit - foreach (var limit in limitsForBotDict) limitsForBotDict[limit.Key] = 0; + foreach (var limit in limitsForBotDict) + { + limitsForBotDict[limit.Key] = 0; + } return new ItemSpawnLimitSettings { @@ -57,7 +59,7 @@ public class BotLootGenerator( } /// - /// Add loot to bots containers + /// Add loot to bots containers /// /// Session id /// Base json db file for the bot having its loot generated @@ -110,7 +112,10 @@ public class BotLootGenerator( } // Forced pmc healing loot into secure container - if (isPmc && _pmcConfig.ForceHealingItemsIntoSecure) AddForcedMedicalItemsToPmcSecure(botInventory, botRole); + if (isPmc && _pmcConfig.ForceHealingItemsIntoSecure) + { + AddForcedMedicalItemsToPmcSecure(botInventory, botRole); + } var botItemLimits = GetItemSpawnLimitsForBot(botRole); @@ -229,6 +234,7 @@ public class BotLootGenerator( { // Add randomly generated weapon to PMC backpacks if (isPmc && _randomUtil.GetChance100(_pmcConfig.LooseWeaponInBackpackChancePercent)) + { AddLooseWeaponsToInventorySlot( sessionId, botInventory, @@ -240,6 +246,7 @@ public class BotLootGenerator( botLevel, filledContainerIds ); + } var backpackLootRoubleTotal = GetBackpackRoubleTotalByLevel(botLevel, isPmc); AddLootFromPool( @@ -264,6 +271,7 @@ public class BotLootGenerator( // TacticalVest - generate loot if they have one if (containersBotHasAvailable.Contains(EquipmentSlots.TacticalVest)) // Vest + { AddLootFromPool( _botLootCacheService.GetLootFromCache( botRole, @@ -281,6 +289,7 @@ public class BotLootGenerator( isPmc, filledContainerIds ); + } // Pockets AddLootFromPool( @@ -305,6 +314,7 @@ public class BotLootGenerator( // only add if not a pmc or is pmc and flag is true if (!isPmc || (isPmc && _pmcConfig.AddSecureContainerLootFromBotConfig)) + { AddLootFromPool( _botLootCacheService.GetLootFromCache(botRole, isPmc, LootCacheType.Secure, botJsonTemplate), [EquipmentSlots.SecuredContainer], @@ -316,12 +326,16 @@ public class BotLootGenerator( isPmc, filledContainerIds ); + } } private MinMaxLootItemValue? GetSingleItemLootPriceLimits(int botLevel, bool isPmc) { // TODO - extend to other bot types - if (!isPmc) return null; + if (!isPmc) + { + return null; + } var matchingValue = _pmcConfig?.LootItemLimitsRub?.FirstOrDefault( minMaxValue => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max @@ -331,24 +345,26 @@ public class BotLootGenerator( } /// - /// Gets the rouble cost total for loot in a bots backpack by the bots levl - /// Will return 0 for non PMCs + /// Gets the rouble cost total for loot in a bots backpack by the bots levl + /// Will return 0 for non PMCs /// /// Bots level /// Is the bot a PMC /// int private double? GetBackpackRoubleTotalByLevel(int botLevel, bool isPmc) { - if (!isPmc) return 0; + if (!isPmc) + { + return 0; + } var matchingValue = _pmcConfig.MaxBackpackLootTotalRub.FirstOrDefault( - (minMaxValue) => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max + minMaxValue => botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max ); return matchingValue?.Value; } /// - /// /// /// /// @@ -356,15 +372,21 @@ public class BotLootGenerator( { List result = [EquipmentSlots.Pockets]; - if ((botInventory.Items ?? []).Any((item) => item.SlotId == EquipmentSlots.TacticalVest.ToString())) result.Add(EquipmentSlots.TacticalVest); + if ((botInventory.Items ?? []).Any(item => item.SlotId == EquipmentSlots.TacticalVest.ToString())) + { + result.Add(EquipmentSlots.TacticalVest); + } - if ((botInventory.Items ?? []).Any((item) => item.SlotId == EquipmentSlots.Backpack.ToString())) result.Add(EquipmentSlots.Backpack); + if ((botInventory.Items ?? []).Any(item => item.SlotId == EquipmentSlots.Backpack.ToString())) + { + result.Add(EquipmentSlots.Backpack); + } return result; } /// - /// Force healing items onto bot to ensure they can heal in-raid + /// Force healing items onto bot to ensure they can heal in-raid /// /// Inventory to add items to /// Role of bot (pmcBEAR/pmcUSEC) @@ -372,7 +394,10 @@ public class BotLootGenerator( { // surv12 AddLootFromPool( - new Dictionary { { "5d02797c86f774203f38e30a", 1 } }, + new Dictionary + { + { "5d02797c86f774203f38e30a", 1 } + }, [EquipmentSlots.SecuredContainer], 1, botInventory, @@ -384,7 +409,10 @@ public class BotLootGenerator( // AFAK AddLootFromPool( - new Dictionary { { "60098ad7c2240c0fe85c570a", 1 } }, + new Dictionary + { + { "60098ad7c2240c0fe85c570a", 1 } + }, [EquipmentSlots.SecuredContainer], 10, botInventory, @@ -396,7 +424,7 @@ public class BotLootGenerator( } /// - /// Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached + /// Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached /// /// Pool of items to pick from with weight /// What equipment slot will the loot items be added to @@ -423,7 +451,10 @@ public class BotLootGenerator( // Loot pool has items var poolSize = pool.Count; - if (poolSize <= 0) return; + if (poolSize <= 0) + { + return; + } double currentTotalRub = 0; @@ -431,7 +462,10 @@ public class BotLootGenerator( for (var i = 0; i < totalItemCount; i++) { // Pool can become empty if item spawn limits keep removing items - if (pool.Count == 0) return; + if (pool.Count == 0) + { + return; + } var weightedItemTpl = _weightedRandomHelper.GetWeightedValue(pool); var (key, itemToAddTemplate) = _itemHelper.GetItem(weightedItemTpl); @@ -484,12 +518,14 @@ public class BotLootGenerator( { // Add each currency to wallet foreach (var itemToAdd in itemsToAdd) + { _inventoryHelper.PlaceItemInContainer( containerGrid, itemToAdd, itemWithChildrenToAdd[0].Id, "main" ); + } itemWithChildrenToAdd.AddRange(itemsToAdd.SelectMany(x => x)); } @@ -516,7 +552,10 @@ public class BotLootGenerator( { // Bot has no container to put item in, exit if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Unable to add: {totalItemCount} items to bot as it lacks a container to include them"); + } + break; } @@ -524,11 +563,13 @@ public class BotLootGenerator( if (fitItemIntoContainerAttempts >= 4) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Failed placing item: {itemToAddTemplate.Id} - {itemToAddTemplate.Name}: {i} of: {totalItemCount} items into: {botRole} " + $"containers: {string.Join(",", equipmentSlots)}. Tried: {fitItemIntoContainerAttempts} " + $"times, reason: {itemAddedResult}, skipping" ); + } break; } @@ -544,13 +585,15 @@ public class BotLootGenerator( if (totalValueLimitRub > 0) { currentTotalRub += _handbookHelper.GetTemplatePrice(itemToAddTemplate.Id); - if (currentTotalRub > totalValueLimitRub) break; + if (currentTotalRub > totalValueLimitRub) + { + break; + } } } } /// - /// /// /// /// @@ -560,8 +603,8 @@ 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 + (int) _botConfig.WalletLoot.ItemCount.Min, + (int) _botConfig.WalletLoot.ItemCount.Max ); for (var index = 0; index < itemCount; index++) { @@ -587,7 +630,7 @@ public class BotLootGenerator( } /// - /// Some items need child items to function, add them to the itemToAddChildrenTo array + /// Some items need child items to function, add them to the itemToAddChildrenTo array /// /// Db template of item to check /// Item to add children to @@ -597,19 +640,28 @@ public class BotLootGenerator( { // Fill ammo box if (_itemHelper.IsOfBaseclass(itemToAddTemplate.Id, BaseClasses.AMMO_BOX)) + { _itemHelper.AddCartridgesToAmmoBox(itemToAddChildrenTo, itemToAddTemplate); + } // Make money a stack else if (_itemHelper.IsOfBaseclass(itemToAddTemplate.Id, BaseClasses.MONEY)) + { RandomiseMoneyStackSize(botRole, itemToAddTemplate, itemToAddChildrenTo[0]); + } // Make ammo a stack else if (_itemHelper.IsOfBaseclass(itemToAddTemplate.Id, BaseClasses.AMMO)) + { RandomiseAmmoStackSize(isPmc, itemToAddTemplate, itemToAddChildrenTo[0]); + } // Must add soft inserts/plates - else if (_itemHelper.ItemRequiresSoftInserts(itemToAddTemplate.Id)) _itemHelper.AddChildSlotItems(itemToAddChildrenTo, itemToAddTemplate, null, false); + else if (_itemHelper.ItemRequiresSoftInserts(itemToAddTemplate.Id)) + { + _itemHelper.AddChildSlotItems(itemToAddChildrenTo, itemToAddTemplate); + } } /// - /// Add generated weapons to inventory as loot + /// Add generated weapons to inventory as loot /// /// /// Inventory to add preset to @@ -639,11 +691,14 @@ public class BotLootGenerator( ] ); var randomisedWeaponCount = _randomUtil.GetInt( - (int)_pmcConfig.LooseWeaponInBackpackLootMinMax.Min, - (int)_pmcConfig.LooseWeaponInBackpackLootMinMax.Max + (int) _pmcConfig.LooseWeaponInBackpackLootMinMax.Min, + (int) _pmcConfig.LooseWeaponInBackpackLootMinMax.Max ); - if (randomisedWeaponCount <= 0) return; + if (randomisedWeaponCount <= 0) + { + return; + } for (var i = 0; i < randomisedWeaponCount; i++) { @@ -667,13 +722,17 @@ public class BotLootGenerator( ); if (result != ItemAddedResult.SUCCESS) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Failed to add additional weapon {generatedWeapon.Weapon[0].Id} to bot backpack, reason: {result.ToString()}"); + } + } } } /// - /// Check if an item has reached its bot-specific spawn limit + /// Check if an item has reached its bot-specific spawn limit /// /// Item we check to see if its reached spawn limit /// Bot type @@ -684,22 +743,31 @@ public class BotLootGenerator( // PMCs and scavs have different sections of bot config for spawn limits if (itemSpawnLimits is not null && itemSpawnLimits.GlobalLimits?.Count == 0) // No items found in spawn limit, drop out + { return false; + } // No spawn limits, skipping - if (itemSpawnLimits is null) return false; + if (itemSpawnLimits is null) + { + return false; + } var idToCheckFor = GetMatchingIdFromSpawnLimits(itemTemplate, itemSpawnLimits.GlobalLimits); if (idToCheckFor is null) // ParentId or tplid not found in spawnLimits, not a spawn limited item, skip + { return false; + } // Use tryAdd to see if it exists, and automatically add 1 if (!itemSpawnLimits.CurrentLimits.TryAdd(idToCheckFor, 1)) // if it does exist, come in here and increment // Increment item count with this bot type + { itemSpawnLimits.CurrentLimits[idToCheckFor]++; + } // Check if over limit @@ -710,17 +778,19 @@ public class BotLootGenerator( if (currentLimitCount > currentLimitCount * 10) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( _localisationService.GetText( "bot-item_spawn_limit_reached_skipping_item", new { - botRole = botRole, + botRole, itemName = itemTemplate.Name, attempts = currentLimitCount } ) ); + } return false; } @@ -732,7 +802,7 @@ public class BotLootGenerator( } /// - /// Randomise the stack size of a money object, uses different values for pmc or scavs + /// Randomise the stack size of a money object, uses different values for pmc or scavs /// /// Role bot has that has money stack /// item details from db @@ -740,7 +810,10 @@ public class BotLootGenerator( public void RandomiseMoneyStackSize(string botRole, TemplateItem itemTemplate, Item moneyItem) { // Get all currency weights for this bot type - if (!_botConfig.CurrencyStackSize.TryGetValue(botRole, out var currencyWeights)) currencyWeights = _botConfig.CurrencyStackSize["default"]; + if (!_botConfig.CurrencyStackSize.TryGetValue(botRole, out var currencyWeights)) + { + currencyWeights = _botConfig.CurrencyStackSize["default"]; + } var currencyWeight = currencyWeights[moneyItem.Template]; @@ -750,7 +823,7 @@ public class BotLootGenerator( } /// - /// Randomise the size of an ammo stack + /// Randomise the size of an ammo stack /// /// Is ammo on a PMC bot /// item details from db @@ -764,16 +837,22 @@ public class BotLootGenerator( } /// - /// Get spawn limits for a specific bot type from bot.json config - /// If no limit found for a non pmc bot, fall back to defaults + /// Get spawn limits for a specific bot type from bot.json config + /// If no limit found for a non pmc bot, fall back to defaults /// /// what role does the bot have /// Dictionary of tplIds and limit public Dictionary GetItemSpawnLimitsForBotType(string botRole) { - if (_botHelper.IsBotPmc(botRole)) return _botConfig.ItemSpawnLimits["pmc"]; + if (_botHelper.IsBotPmc(botRole)) + { + return _botConfig.ItemSpawnLimits["pmc"]; + } - if (_botConfig.ItemSpawnLimits.ContainsKey(botRole.ToLower())) return _botConfig.ItemSpawnLimits[botRole.ToLower()]; + if (_botConfig.ItemSpawnLimits.ContainsKey(botRole.ToLower())) + { + return _botConfig.ItemSpawnLimits[botRole.ToLower()]; + } _logger.Warning(_localisationService.GetText("bot-unable_to_find_spawn_limits_fallback_to_defaults", botRole)); @@ -781,17 +860,23 @@ public class BotLootGenerator( } /// - /// Get the parentId or tplId of item inside spawnLimits object if it exists + /// Get the parentId or tplId of item inside spawnLimits object if it exists /// /// item we want to look for in spawn limits /// Limits to check for item /// id as string, otherwise undefined public string? GetMatchingIdFromSpawnLimits(TemplateItem itemTemplate, Dictionary spawnLimits) { - if (spawnLimits.ContainsKey(itemTemplate.Id)) return itemTemplate.Id; + if (spawnLimits.ContainsKey(itemTemplate.Id)) + { + return itemTemplate.Id; + } // tplId not found in spawnLimits, check if parentId is - if (spawnLimits.ContainsKey(itemTemplate.Parent)) return itemTemplate.Parent; + if (spawnLimits.ContainsKey(itemTemplate.Parent)) + { + return itemTemplate.Parent; + } // parentId and tplId not found return null; diff --git a/Libraries/Core/Generators/BotWeaponGenerator.cs b/Libraries/Core/Generators/BotWeaponGenerator.cs index df3fb936..09fa85ad 100644 --- a/Libraries/Core/Generators/BotWeaponGenerator.cs +++ b/Libraries/Core/Generators/BotWeaponGenerator.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators.WeaponGen; using Core.Helpers; using Core.Models.Eft.Common; @@ -11,6 +10,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Generators; @@ -34,11 +34,11 @@ public class BotWeaponGenerator( IEnumerable inventoryMagGenComponents ) { - protected IEnumerable _inventoryMagGenComponents = MagGenSetUp(inventoryMagGenComponents); + protected const string _modMagazineSlotId = "mod_magazine"; protected BotConfig _botConfig = _configServer.GetConfig(); + protected IEnumerable _inventoryMagGenComponents = MagGenSetUp(inventoryMagGenComponents); protected PmcConfig _pmcConfig = _configServer.GetConfig(); protected RepairConfig _repairConfig = _configServer.GetConfig(); - protected const string _modMagazineSlotId = "mod_magazine"; private static List MagGenSetUp(IEnumerable components) { @@ -48,7 +48,7 @@ public class BotWeaponGenerator( } /// - /// Pick a random weapon based on weightings and generate a functional weapon + /// Pick a random weapon based on weightings and generate a functional weapon /// /// Session identifier /// Primary/secondary/holster @@ -77,7 +77,7 @@ public class BotWeaponGenerator( } /// - /// Gets a random weighted weapon from a bot's pool of weapons. + /// Gets a random weighted weapon from a bot's pool of weapons. /// /// Primary/secondary/holster /// e.g. assault.json @@ -86,14 +86,16 @@ public class BotWeaponGenerator( { EquipmentSlots key; if (!EquipmentSlots.TryParse(equipmentSlot, out key)) + { _logger.Error($"Unable to parse equipment slot '{equipmentSlot}'"); + } var weaponPool = botTemplateInventory.Equipment[key]; return _weightedRandomHelper.GetWeightedValue(weaponPool); } /// - /// Generates a weapon based on the supplied weapon template. + /// Generates a weapon based on the supplied weapon template. /// /// The session identifier. /// Weapon template to generate (use pickWeightedWeaponTplFromPool()). @@ -140,7 +142,9 @@ public class BotWeaponGenerator( // Chance to add randomised weapon enhancement if (isPmc && _randomUtil.GetChance100(_pmcConfig.WeaponHasEnhancementChancePercent)) // Add buff to weapon root + { _repairService.AddBuff(_repairConfig.RepairKit.Weapon, weaponWithModsArray[0]); + } // Add mods to weapon base if (modPool.Keys.Contains(weaponTpl)) @@ -159,7 +163,12 @@ public class BotWeaponGenerator( ParentTemplate = weaponItemTemplate, ModSpawnChances = modChances, AmmoTpl = ammoTpl, - BotData = new BotData { Role = botRole, Level = botLevel, EquipmentRole = botEquipmentRole }, + BotData = new BotData + { + Role = botRole, + Level = botLevel, + EquipmentRole = botEquipmentRole + }, ModLimits = modLimits, WeaponStats = new WeaponStats(), ConflictingItemTpls = new HashSet() @@ -173,6 +182,7 @@ public class BotWeaponGenerator( // Use weapon preset from globals.json if weapon isn't valid if (!IsWeaponValid(weaponWithModsArray, botRole)) // Weapon is bad, fall back to weapons preset + { weaponWithModsArray = GetPresetWeaponMods( weaponTpl, slotName, @@ -180,10 +190,14 @@ public class BotWeaponGenerator( weaponItemTemplate, botRole ); + } - var tempList = _cloner.Clone(weaponWithModsArray.Where((item) => item.SlotId == _modMagazineSlotId)); + var tempList = _cloner.Clone(weaponWithModsArray.Where(item => item.SlotId == _modMagazineSlotId)); // Fill existing magazines to full and sync ammo type - foreach (var magazine in tempList) FillExistingMagazines(weaponWithModsArray, magazine, ammoTpl); + foreach (var magazine in tempList) + { + FillExistingMagazines(weaponWithModsArray, magazine, ammoTpl); + } // Add cartridge(s) to gun chamber(s) if (weaponItemTemplate.Properties.Chambers?.Any() ?? @@ -191,12 +205,12 @@ public class BotWeaponGenerator( 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); + var chamberSlotNames = weaponItemTemplate.Properties.Chambers.Select(chamberSlot => chamberSlot.Name); AddCartridgeToChamber(weaponWithModsArray, ammoTpl, chamberSlotNames.ToList()); } // Fill UBGL if found - var ubglMod = weaponWithModsArray.FirstOrDefault((x) => x.SlotId == "mod_launcher"); + var ubglMod = weaponWithModsArray.FirstOrDefault(x => x.SlotId == "mod_launcher"); string? ubglAmmoTpl = null; if (ubglMod is not null) { @@ -216,8 +230,8 @@ public class BotWeaponGenerator( } /// - /// Insert cartridge(s) into a weapon - /// Handles all chambers - patron_in_weapon, patron_in_weapon_000 etc + /// Insert cartridge(s) into a weapon + /// Handles all chambers - patron_in_weapon, patron_in_weapon_000 etc /// /// Weapon and mods /// Cartridge to add to weapon @@ -226,7 +240,7 @@ public class BotWeaponGenerator( { foreach (var slotId in chamberSlotIds) { - var existingItemWithSlot = weaponWithModsList.FirstOrDefault((x) => x.SlotId == slotId); + var existingItemWithSlot = weaponWithModsList.FirstOrDefault(x => x.SlotId == slotId); if (existingItemWithSlot is null) { // Not found, add new slot to weapon @@ -237,7 +251,10 @@ public class BotWeaponGenerator( Template = ammoTemplate, ParentId = weaponWithModsList[0].Id, SlotId = slotId, - Upd = new Upd { StackObjectsCount = 1 } + Upd = new Upd + { + StackObjectsCount = 1 + } } ); } @@ -245,14 +262,17 @@ public class BotWeaponGenerator( { // Already exists, update values existingItemWithSlot.Template = ammoTemplate; - existingItemWithSlot.Upd = new Upd { StackObjectsCount = 1 }; + existingItemWithSlot.Upd = new Upd + { + StackObjectsCount = 1 + }; } } } /// - /// Create a list with weapon base as the only element and - /// add additional properties based on weapon type + /// Create a list with weapon base as the only element and + /// add additional properties based on weapon type /// /// Weapon template to create item with /// Weapons parent id @@ -277,7 +297,7 @@ public class BotWeaponGenerator( } /// - /// Get the mods necessary to kit out a weapon to its preset level + /// Get the mods necessary to kit out a weapon to its preset level /// /// Weapon to find preset for /// The slot the weapon will be placed in @@ -294,12 +314,14 @@ public class BotWeaponGenerator( // TODO: Preset weapons trigger a lot of warnings regarding missing ammo in magazines & such Preset preset = null; foreach (var (_, itemPreset) in _databaseService.GetGlobals().ItemPresets) + { if (itemPreset.Items[0].Template == weaponTemplate) { preset = _cloner.Clone(itemPreset); break; } + } if (preset is not null) { @@ -319,7 +341,7 @@ public class BotWeaponGenerator( } /// - /// Checks if all required slots are occupied on a weapon and all its mods. + /// Checks if all required slots are occupied on a weapon and all its mods. /// /// Weapon + mods /// Role of bot weapon is for @@ -329,14 +351,17 @@ public class BotWeaponGenerator( foreach (var mod in weaponItemList) { var modTemplate = _itemHelper.GetItem(mod.Template).Value; - if (!modTemplate.Properties.Slots?.Any() ?? false) continue; + if (!modTemplate.Properties.Slots?.Any() ?? false) + { + continue; + } // Iterate over required slots in db item, check mod exists for that slot - foreach (var modSlotTemplate in modTemplate.Properties.Slots?.Where((slot) => slot.Required.GetValueOrDefault(false)) ?? []) + 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 + weaponItem => weaponItem.ParentId == mod.Id && weaponItem.SlotId == slotName ); if (!hasWeaponSlotItem) { @@ -348,7 +373,7 @@ public class BotWeaponGenerator( modSlot = modSlotTemplate.Name, modName = modTemplate.Name, slotId = mod.SlotId, - botRole = botRole + botRole } ) ); @@ -362,8 +387,8 @@ public class BotWeaponGenerator( } /// - /// Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. - /// Additionally, adds extra bullets to SecuredContainer + /// Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets. + /// Additionally, adds extra bullets to SecuredContainer /// /// Object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl) /// Magazine weights for count to add to inventory @@ -395,7 +420,10 @@ public class BotWeaponGenerator( } // Has an UBGL - if (generatedWeaponResult.ChosenUbglAmmoTemplate is not null) AddUbglGrenadesToBotInventory(weaponAndMods, generatedWeaponResult, inventory); + if (generatedWeaponResult.ChosenUbglAmmoTemplate is not null) + { + AddUbglGrenadesToBotInventory(weaponAndMods, generatedWeaponResult, inventory); + } var inventoryMagGenModel = new InventoryMagGen( magWeights, @@ -405,7 +433,7 @@ public class BotWeaponGenerator( inventory ); - _inventoryMagGenComponents.FirstOrDefault((v) => v.CanHandleInventoryMagGen(inventoryMagGenModel)) + _inventoryMagGenComponents.FirstOrDefault(v => v.CanHandleInventoryMagGen(inventoryMagGenModel)) .Process(inventoryMagGenModel); // Add x stacks of bullets to SecuredContainer (bots use a magic mag packing skill to reload instantly) @@ -418,7 +446,7 @@ public class BotWeaponGenerator( } /// - /// Add Grenades for UBGL to bot's vest and secure container + /// Add Grenades for UBGL to bot's vest and secure container /// /// Weapon list with mods /// Result of weapon generation @@ -426,13 +454,17 @@ public class BotWeaponGenerator( protected void AddUbglGrenadesToBotInventory(List weaponMods, GenerateWeaponResult generatedWeaponResult, BotBaseInventory inventory) { // Find ubgl mod item + get details of it from db - var ubglMod = weaponMods.FirstOrDefault((x) => x.SlotId == "mod_launcher"); + var ubglMod = weaponMods.FirstOrDefault(x => x.SlotId == "mod_launcher"); var ubglDbTemplate = _itemHelper.GetItem(ubglMod.Template).Value; // Define min/max of how many grenades bot will have GenerationData ubglMinMax = new() { - Weights = new Dictionary { { 1, 1 }, { 2, 1 } }, + Weights = new Dictionary + { + { 1, 1 }, + { 2, 1 } + }, Whitelist = new Dictionary() }; @@ -448,7 +480,7 @@ public class BotWeaponGenerator( inventory ); _inventoryMagGenComponents - .FirstOrDefault((v) => v.CanHandleInventoryMagGen(ubglAmmoGenModel)) + .FirstOrDefault(v => v.CanHandleInventoryMagGen(ubglAmmoGenModel)) .Process(ubglAmmoGenModel); // Store extra grenades in secure container @@ -456,7 +488,7 @@ public class BotWeaponGenerator( } /// - /// Add ammo to the secure container. + /// Add ammo to the secure container. /// /// How many stacks of ammo to add. /// Ammo type to add. @@ -468,12 +500,23 @@ public class BotWeaponGenerator( { var id = _hashUtil.Generate(); _botGeneratorHelper.AddItemWithChildrenToEquipmentSlot( - new List { EquipmentSlots.SecuredContainer }, + new List + { + EquipmentSlots.SecuredContainer + }, id, ammoTemplate, new List { - new() { Id = id, Template = ammoTemplate, Upd = new Upd { StackObjectsCount = stackSize } } + new() + { + Id = id, + Template = ammoTemplate, + Upd = new Upd + { + StackObjectsCount = stackSize + } + } }, inventory ); @@ -481,7 +524,7 @@ public class BotWeaponGenerator( } /// - /// Get a weapons magazine template from a weapon template. + /// Get a weapons magazine template from a weapon template. /// /// Mods from a weapon template. /// Weapon to get magazine template for. @@ -489,32 +532,39 @@ public class BotWeaponGenerator( /// Magazine template string. protected string GetMagazineTemplateFromWeaponTemplate(List weaponMods, TemplateItem weaponTemplate, string botRole) { - var magazine = weaponMods.FirstOrDefault((m) => m.SlotId == _modMagazineSlotId); + var magazine = weaponMods.FirstOrDefault(m => m.SlotId == _modMagazineSlotId); if (magazine is null) { // Edge case - magazineless chamber loaded weapons dont have magazines, e.g. mp18 // return default mag tpl - if (weaponTemplate.Properties.ReloadMode == ReloadMode.OnlyBarrel) return _botWeaponGeneratorHelper.GetWeaponsDefaultMagazineTpl(weaponTemplate); + if (weaponTemplate.Properties.ReloadMode == ReloadMode.OnlyBarrel) + { + return _botWeaponGeneratorHelper.GetWeaponsDefaultMagazineTpl(weaponTemplate); + } // log error if no magazine AND not a chamber loaded weapon (e.g. shotgun revolver) if (!weaponTemplate.Properties.IsChamberLoad ?? false) // Shouldn't happen + { _logger.Warning( _localisationService.GetText( "bot-weapon_missing_magazine_or_chamber", new { weaponId = weaponTemplate.Id, - botRole = botRole + botRole } ) ); + } var defaultMagTplId = _botWeaponGeneratorHelper.GetWeaponsDefaultMagazineTpl(weaponTemplate); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"[{botRole}] Unable to find magazine for weapon: {weaponTemplate.Id} {weaponTemplate.Name}, using mag template default: {defaultMagTplId}." ); + } return defaultMagTplId; } @@ -523,7 +573,7 @@ public class BotWeaponGenerator( } /// - /// Finds and returns a compatible ammo template based on the bots ammo weightings (x.json/inventory/equipment/ammo) + /// Finds and returns a compatible ammo template based on the bots ammo weightings (x.json/inventory/equipment/ammo) /// /// Dictionary of all cartridges keyed by type e.g. Caliber556x45NATO /// Weapon details from database we want to pick ammo for @@ -534,6 +584,7 @@ public class BotWeaponGenerator( if (!cartridgePool.TryGetValue(desiredCaliber, out var cartridgePoolForWeapon) || cartridgePoolForWeapon?.Keys.Count == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( _localisationService.GetText( "bot-no_caliber_data_for_weapon_falling_back_to_default", @@ -545,6 +596,7 @@ public class BotWeaponGenerator( } ) ); + } // Immediately returns, default ammo is guaranteed to be compatible return weaponTemplate.Properties.DefAmmo; @@ -554,30 +606,42 @@ public class BotWeaponGenerator( var compatibleCartridgesInTemplate = GetCompatibleCartridgesFromWeaponTemplate(weaponTemplate); if (compatibleCartridgesInTemplate is null) // No chamber data found in weapon, send default + { return weaponTemplate.Properties.DefAmmo; + } // Inner join the weapons allowed + passed in cartridge pool to get compatible cartridges Dictionary compatibleCartridges = new(); foreach (var cartridge in cartridgePoolForWeapon) + { if (compatibleCartridgesInTemplate.Contains(cartridge.Key)) + { compatibleCartridges[cartridge.Key] = cartridgePoolForWeapon[cartridge.Key]; + } + } if (!compatibleCartridges.Any()) // No compatible cartridges, use default + { return weaponTemplate.Properties.DefAmmo; + } return _weightedRandomHelper.GetWeightedValue(compatibleCartridges); } /// - /// Get the cartridge ids from a weapon template that work with the weapon + /// Get the cartridge ids from a weapon template that work with the weapon /// /// Weapon db template to get cartridges for /// List of cartridge tpls protected List? GetCompatibleCartridgesFromWeaponTemplate(TemplateItem weaponTemplate) { var cartridges = weaponTemplate.Properties?.Chambers.FirstOrDefault()?.Props?.Filters?[0].Filter; - if (cartridges is not null) return cartridges; + if (cartridges is not null) + { + return cartridges; + } + // Fallback to the magazine if possible, e.g. for revolvers // Grab the magazines template var firstMagazine = weaponTemplate.Properties.Slots.FirstOrDefault(slot => slot.Name == "mod_magazine"); @@ -589,32 +653,42 @@ public class BotWeaponGenerator( if (cartridges is null) // Normal magazines // None found, try the cartridges array + { cartridges = magProperties.Cartridges.FirstOrDefault()?.Props.Filters[0].Filter; + } return cartridges; } /// - /// Get a weapons compatible cartridge caliber + /// Get a weapons compatible cartridge caliber /// /// Weapon to look up caliber of /// Caliber as string protected string? GetWeaponCaliber(TemplateItem weaponTemplate) { - if (weaponTemplate.Properties.Caliber is not null) return weaponTemplate.Properties.Caliber; + if (weaponTemplate.Properties.Caliber is not null) + { + return weaponTemplate.Properties.Caliber; + } if (weaponTemplate.Properties.AmmoCaliber is not null) // 9x18pmm has a typo, should be Caliber9x18PM + { return weaponTemplate.Properties.AmmoCaliber == "Caliber9x18PMM" ? "Caliber9x18PM" : weaponTemplate.Properties.AmmoCaliber; + } if (weaponTemplate.Properties.LinkedWeapon is not null) { var ammoInChamber = _itemHelper.GetItem( weaponTemplate.Properties.Chambers[0].Props.Filters[0].Filter[0] ); - if (!ammoInChamber.Key) return null; + if (!ammoInChamber.Key) + { + return null; + } return ammoInChamber.Value.Properties.Caliber; } @@ -623,7 +697,7 @@ public class BotWeaponGenerator( } /// - /// Fill existing magazines to full, while replacing their contents with specified ammo + /// Fill existing magazines to full, while replacing their contents with specified ammo /// /// Weapon with children /// Magazine item @@ -645,13 +719,17 @@ public class BotWeaponGenerator( // Exchange of the camora ammo is not necessary we could also just check for stackSize > 0 here // and remove the else if (_botWeaponGeneratorHelper.MagazineIsCylinderRelated(parentItem.Name)) + { FillCamorasWithAmmo(weaponMods, magazine.Id, cartridgeTemplate); + } else + { AddOrUpdateMagazinesChildWithAmmo(weaponMods, magazine, cartridgeTemplate, magazineTemplate); + } } /// - /// Add desired ammo template as item to weapon modifications list, placed as child to UBGL. + /// Add desired ammo template as item to weapon modifications list, placed as child to UBGL. /// /// Weapon with children. /// UBGL item. @@ -665,13 +743,16 @@ public class BotWeaponGenerator( Template = ubglAmmoTpl, ParentId = ubglMod.Id, SlotId = "patron_in_weapon", - Upd = new Upd { StackObjectsCount = 1 } + Upd = new Upd + { + StackObjectsCount = 1 + } } ); } /// - /// Add cartridge item to weapon item list, if it already exists, update + /// Add cartridge item to weapon item list, if it already exists, update /// /// Weapon items list to amend /// Magazine item details we're adding cartridges to @@ -680,11 +761,13 @@ public class BotWeaponGenerator( protected void AddOrUpdateMagazinesChildWithAmmo(List weaponWithMods, Item magazine, string chosenAmmoTpl, TemplateItem magazineTemplate) { var magazineCartridgeChildItem = weaponWithMods.FirstOrDefault( - (m) => m.ParentId == magazine.Id && m.SlotId == "cartridges" + m => m.ParentId == magazine.Id && m.SlotId == "cartridges" ); if (magazineCartridgeChildItem is not null) // Delete the existing cartridge object and create fresh below + { weaponWithMods.Remove(magazineCartridgeChildItem); + } // Create array with just magazine List magazineWithCartridges = [magazine]; @@ -699,7 +782,7 @@ public class BotWeaponGenerator( } /// - /// Fill each Camora with a bullet + /// Fill each Camora with a bullet /// /// Weapon mods to find and update camora mod(s) from /// Magazine id to find and add to @@ -709,14 +792,21 @@ public class BotWeaponGenerator( // for CylinderMagazine we exchange the ammo in the "camoras". // This might not be necessary since we already filled the camoras with a random whitelisted and compatible ammo type, // but I'm not sure whether this is also used elsewhere - var camoras = weaponMods.Where((x) => x.ParentId == magazineId && x.SlotId.StartsWith("camora")); + var camoras = weaponMods.Where(x => x.ParentId == magazineId && x.SlotId.StartsWith("camora")); foreach (var camora in camoras) { camora.Template = ammoTpl; if (camora.Upd is not null) + { camora.Upd.StackObjectsCount = 1; + } else - camora.Upd = new Upd { StackObjectsCount = 1 }; + { + camora.Upd = new Upd + { + StackObjectsCount = 1 + }; + } } } } diff --git a/Libraries/Core/Generators/FenceBaseAssortGenerator.cs b/Libraries/Core/Generators/FenceBaseAssortGenerator.cs index e1136aff..e8e1acdc 100644 --- a/Libraries/Core/Generators/FenceBaseAssortGenerator.cs +++ b/Libraries/Core/Generators/FenceBaseAssortGenerator.cs @@ -1,5 +1,4 @@ using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Config; @@ -8,6 +7,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Generators; @@ -40,29 +40,47 @@ public class FenceBaseAssortGenerator( foreach (var rootItemDb in itemHelper.GetItems().Where(IsValidFenceItem)) { // Skip blacklisted items - if (itemFilterService.IsItemBlacklisted(rootItemDb.Id)) continue; + if (itemFilterService.IsItemBlacklisted(rootItemDb.Id)) + { + continue; + } // Skip reward item blacklist - if (itemFilterService.IsItemRewardBlacklisted(rootItemDb.Id)) continue; + if (itemFilterService.IsItemRewardBlacklisted(rootItemDb.Id)) + { + continue; + } // Invalid - if (!itemHelper.IsValidItem(rootItemDb.Id)) continue; + if (!itemHelper.IsValidItem(rootItemDb.Id)) + { + continue; + } // Item base type blacklisted if (traderConfig.Fence.Blacklist.Count > 0) + { if (traderConfig.Fence.Blacklist.Contains(rootItemDb.Id) || itemHelper.IsOfBaseclasses(rootItemDb.Id, traderConfig.Fence.Blacklist) ) + { continue; + } + } // Only allow rigs with no slots (carrier rigs) if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.VEST) && (rootItemDb.Properties?.Slots?.Count ?? 0) > 0 ) + { continue; + } // Skip seasonal event items when not in seasonal event - if (traderConfig.Fence.BlacklistSeasonalItems && blockedSeasonalItems.Contains(rootItemDb.Id)) continue; + if (traderConfig.Fence.BlacklistSeasonalItems && blockedSeasonalItems.Contains(rootItemDb.Id)) + { + continue; + } // Create item object in array var itemWithChildrenToAdd = new List @@ -73,19 +91,30 @@ public class FenceBaseAssortGenerator( Template = rootItemDb.Id, ParentId = "hideout", SlotId = "hideout", - Upd = new Upd { StackObjectsCount = 9999999 } + Upd = new Upd + { + StackObjectsCount = 9999999 + } } }; // Ensure ammo is not above penetration limit value if (itemHelper.IsOfBaseclasses(rootItemDb.Id, [BaseClasses.AMMO_BOX, BaseClasses.AMMO])) + { if (IsAmmoAbovePenetrationLimit(rootItemDb)) + { continue; + } + } if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.AMMO_BOX)) // Only add cartridges to box if box has no children + { if (itemWithChildrenToAdd.Count == 1) + { itemHelper.AddCartridgesToAmmoBox(itemWithChildrenToAdd, rootItemDb); + } + } // Ensure IDs are unique itemHelper.RemapRootItemId(itemWithChildrenToAdd); @@ -96,9 +125,9 @@ public class FenceBaseAssortGenerator( } // Create barter scheme (price) - var barterSchemeToAdd = new BarterScheme() + var barterSchemeToAdd = new BarterScheme { - Count = Math.Round((double)fenceService.GetItemPrice(rootItemDb.Id, itemWithChildrenToAdd)), + Count = Math.Round((double) fenceService.GetItemPrice(rootItemDb.Id, itemWithChildrenToAdd)), Template = Money.ROUBLES }; @@ -117,7 +146,10 @@ public class FenceBaseAssortGenerator( foreach (var defaultPreset in defaultPresets) { // Skip presets we've already added - if (baseFenceAssort.Items.Any((item) => item.Upd != null && item.Upd.SptPresetId == defaultPreset.Id)) continue; + if (baseFenceAssort.Items.Any(item => item.Upd != null && item.Upd.SptPresetId == defaultPreset.Id)) + { + continue; + } // Construct preset + mods var itemAndChildren = itemHelper.ReplaceIDs(_cloner.Clone(defaultPreset.Items)); @@ -132,7 +164,7 @@ public class FenceBaseAssortGenerator( { mod.ParentId = "hideout"; mod.SlotId = "hideout"; - mod.Upd = new Upd() + mod.Upd = new Upd { StackObjectsCount = 1, SptPresetId = @@ -209,7 +241,10 @@ public class FenceBaseAssortGenerator( } // Plain old ammo, get its pen property - if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.AMMO)) return rootItemDb.Properties.PenetrationPower; + if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.AMMO)) + { + return rootItemDb.Properties.PenetrationPower; + } // Not an ammobox or ammo return null; @@ -224,12 +259,16 @@ public class FenceBaseAssortGenerator( { // Armor has no mods, make no additions var hasMods = itemDbDetails.Properties.Slots.Count > 0; - if (!hasMods) return; + if (!hasMods) + { + return; + } // Check for and add required soft inserts to armors - var requiredSlots = itemDbDetails.Properties.Slots.Where((slot) => slot.Required ?? false).ToList(); + var requiredSlots = itemDbDetails.Properties.Slots.Where(slot => slot.Required ?? false).ToList(); var hasRequiredSlots = requiredSlots.Count > 0; if (hasRequiredSlots) + { foreach (var requiredSlot in requiredSlots) { var modItemDbDetails = itemHelper.GetItem(requiredSlot.Props.Filters[0].Plate).Value; @@ -237,7 +276,9 @@ public class FenceBaseAssortGenerator( requiredSlot.Props.Filters[0].Plate; // `Plate` property appears to be the 'default' item for slot if (string.IsNullOrEmpty(plateTpl)) // Some bsg plate properties are empty, skip mod + { continue; + } var mod = new Item { @@ -257,21 +298,25 @@ public class FenceBaseAssortGenerator( armor.Add(mod); } + } // Check for and add plate items - var plateSlots = itemDbDetails.Properties.Slots.Where((slot) => itemHelper.IsRemovablePlateSlot(slot.Name)) + var plateSlots = itemDbDetails.Properties.Slots.Where(slot => itemHelper.IsRemovablePlateSlot(slot.Name)) .ToList(); if (plateSlots.Count > 0) + { foreach (var plateSlot in plateSlots) { var plateTpl = plateSlot.Props.Filters[0].Plate; if (string.IsNullOrEmpty(plateTpl)) // Bsg data lacks a default plate, skip adding mod + { continue; + } var modItemDbDetails = itemHelper.GetItem(plateTpl).Value; armor.Add( - new Item() + new Item { Id = hashUtil.Generate(), Template = plateSlot.Props.Filters[0].Plate, // `Plate` property appears to be the 'default' item for slot @@ -288,6 +333,7 @@ public class FenceBaseAssortGenerator( } ); } + } } /** diff --git a/Libraries/Core/Generators/LocationLootGenerator.cs b/Libraries/Core/Generators/LocationLootGenerator.cs index 7ceae842..9e631a50 100644 --- a/Libraries/Core/Generators/LocationLootGenerator.cs +++ b/Libraries/Core/Generators/LocationLootGenerator.cs @@ -51,35 +51,43 @@ public class LocationLootGenerator( var staticWeaponsOnMapClone = _cloner.Clone(mapData.StaticContainers.Value.StaticWeapons); if (staticWeaponsOnMapClone is null) + { _logger.Error( _localisationService.GetText("location-unable_to_find_static_weapon_for_map", locationBase.Name) ); + } // Add mounted weapons to output loot result.AddRange(staticWeaponsOnMapClone); var allStaticContainersOnMapClone = _cloner.Clone(mapData.StaticContainers.Value.StaticContainers); if (allStaticContainersOnMapClone is null) + { _logger.Error( _localisationService.GetText("location-unable_to_find_static_container_for_map", locationBase.Name) ); + } // Containers that MUST be added to map (e.g. quest containers) var staticForcedOnMapClone = _cloner.Clone(mapData.StaticContainers.Value.StaticForced); if (staticForcedOnMapClone is null) + { _logger.Error( _localisationService.GetText( "location-unable_to_find_forced_static_data_for_map", locationBase.Name ) ); + } // Remove christmas items from loot data if (!_seasonalEventService.ChristmasEventEnabled()) + { allStaticContainersOnMapClone = allStaticContainersOnMapClone.Where( item => !_seasonalEventConfig.ChristmasContainerIds.Contains(item.Template.Id) ) .ToList(); + } var staticRandomisableContainersOnMap = GetRandomisableContainersOnMap(allStaticContainersOnMapClone); @@ -106,7 +114,10 @@ public class LocationLootGenerator( staticLootItemCount += containerWithLoot.Template.Items.Count; } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Added {guaranteedContainers.Count} guaranteed containers"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Added {guaranteedContainers.Count} guaranteed containers"); + } // Randomisation is turned off globally or just turned off for this map if ( @@ -117,9 +128,12 @@ public class LocationLootGenerator( ) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Container randomisation disabled, Adding {staticRandomisableContainersOnMap.Count} containers to {locationBase.Name}" ); + } + foreach (var container in staticRandomisableContainersOnMap) { var containerWithLoot = AddLootToContainer( @@ -153,11 +167,17 @@ public class LocationLootGenerator( foreach (var (key, data) in mapping) { // Count chosen was 0, skip - if (data.ChosenCount == 0) continue; + if (data.ChosenCount == 0) + { + continue; + } if (data.ContainerIdsWithProbability.Count == 0) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Group: {key} has no containers with < 100 % spawn chance to choose from, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Group: {key} has no containers with < 100 % spawn chance to choose from, skipping"); + } continue; } @@ -169,14 +189,21 @@ public class LocationLootGenerator( // Roll each containers probability, if it passes, it gets added data.ContainerIdsWithProbability = new Dictionary(); foreach (var containerId in containerIdsCopy) + { if (_randomUtil.GetChance100(containerIdsCopy[containerId.Key] * 100)) + { data.ContainerIdsWithProbability[containerId.Key] = containerIdsCopy[containerId.Key]; + } + } // Set desired count to size of array (we want all containers chosen) data.ChosenCount = data.ContainerIdsWithProbability.Count; // EDGE CASE: chosen container count could be 0 - if (data.ChosenCount == 0) continue; + if (data.ChosenCount == 0) + { + continue; + } } // Pass possible containers into function to choose some @@ -190,9 +217,12 @@ public class LocationLootGenerator( if (containerObject is null) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Container: {chosenContainerId} not found in staticRandomisableContainersOnMap, this is bad" ); + } + continue; } @@ -271,9 +301,12 @@ public class LocationLootGenerator( if (containerData.ChosenCount > containerIds.Count) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Group: {groupId} wants {containerData.ChosenCount} containers but pool only has {containerIds.Count}, add what's available" ); + } + return containerIds; } @@ -286,7 +319,7 @@ public class LocationLootGenerator( containerDistribution.Add(new ProbabilityObject(x, value, value)); } - chosenContainerIds.AddRange(containerDistribution.Draw((int)containerData.ChosenCount)); + chosenContainerIds.AddRange(containerDistribution.Draw((int) containerData.ChosenCount)); return chosenContainerIds; } @@ -303,25 +336,33 @@ public class LocationLootGenerator( // Create dictionary of all group ids and choose a count of containers the map will spawn of that group var mapping = new Dictionary(); foreach (var groupKvP in staticContainerGroupData.ContainersGroups) + { if (staticContainerGroupData.ContainersGroups.TryGetValue(groupKvP.Key, out var groupData)) + { mapping[groupKvP.Key] = new ContainerGroupCount { ContainerIdsWithProbability = new Dictionary(), ChosenCount = _randomUtil.GetInt( - (int)Math.Round( + (int) Math.Round( groupData.MinContainers.Value * _locationConfig.ContainerRandomisationSettings.ContainerGroupMinSizeMultiplier ), - (int)Math.Round( + (int) Math.Round( groupData.MaxContainers.Value * _locationConfig.ContainerRandomisationSettings.ContainerGroupMaxSizeMultiplier ) ) }; + } + } // Add an empty group for containers without a group id but still have a < 100% chance to spawn // Likely bad BSG data, will be fixed...eventually, example of the groupids: `NEED_TO_BE_FIXED1`,`NEED_TO_BE_FIXED_SE02`, `NEED_TO_BE_FIXED_NW_01` - mapping[""] = new ContainerGroupCount { ContainerIdsWithProbability = new Dictionary(), ChosenCount = -1 }; + mapping[""] = new ContainerGroupCount + { + ContainerIdsWithProbability = new Dictionary(), + ChosenCount = -1 + }; // Iterate over all containers and add to group keyed by groupId // Containers without a group go into a group with empty key "" @@ -342,9 +383,11 @@ public class LocationLootGenerator( if (container.Probability >= 1) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Container {container.Template.Id} with group: {groupData.GroupId} had 100 % chance to spawn was picked as random container, skipping" ); + } continue; } @@ -397,8 +440,8 @@ public class LocationLootGenerator( // Some containers need to have items forced into it (quest keys etc) var tplsForced = staticForced - .Where((forcedStaticProp) => forcedStaticProp.ContainerId == containerClone.Template.Id) - .Select((x) => x.ItemTpl); + .Where(forcedStaticProp => forcedStaticProp.ContainerId == containerClone.Template.Id) + .Select(x => x.ItemTpl); // Draw random loot // Allow money to spawn more than once in container @@ -409,14 +452,17 @@ public class LocationLootGenerator( // Filter out items picked that're already in the above `tplsForced` array var chosenTpls = containerLootPool .Draw(itemCountToAdd, _locationConfig.AllowDuplicateItemsInStaticContainers, locklist) - .Where((tpl) => !tplsForced.Contains(tpl)); + .Where(tpl => !tplsForced.Contains(tpl)); // Add forced loot to chosen item pool var tplsToAddToContainer = tplsForced.Concat(chosenTpls); foreach (var tplToAdd in tplsToAddToContainer) { var chosenItemWithChildren = CreateStaticLootItem(tplToAdd, staticAmmoDist, parentId); - if (chosenItemWithChildren is null) continue; + if (chosenItemWithChildren is null) + { + continue; + } var items = _locationConfig.TplsToStripChildItemsFrom.Contains(tplToAdd) ? [chosenItemWithChildren.Items[0]] // Strip children from parent @@ -431,7 +477,9 @@ public class LocationLootGenerator( { if (failedToFitCount > _locationConfig.FitLootIntoContainerAttempts) // x attempts to fit an item, container is probably full, stop trying to add more + { break; + } // Can't fit item, skip failedToFitCount++; @@ -451,7 +499,12 @@ public class LocationLootGenerator( var rotation = result.Rotation.GetValueOrDefault(false) ? 1 : 0; items[0].SlotId = "main"; - items[0].Location = new ItemLocation { X = result.X, Y = result.Y, R = rotation }; + items[0].Location = new ItemLocation + { + X = result.X, + Y = result.Y, + R = rotation + }; // Add loot to container before returning containerClone.Template.Items.AddRange(items); @@ -528,7 +581,8 @@ public class LocationLootGenerator( "location-unable_to_find_count_distribution_for_container", new { - containerId = containerTypeId, locationName + containerId = containerTypeId, + locationName } ) ); @@ -538,6 +592,7 @@ public class LocationLootGenerator( foreach (var itemCountDistribution in countDistribution) // Add each count of items into array + { itemCountArray.Add( new ProbabilityObject( itemCountDistribution.Count.Value, @@ -545,8 +600,9 @@ public class LocationLootGenerator( null ) ); + } - return (int)Math.Round(GetStaticLootMultiplierForLocation(locationName) * itemCountArray.Draw()[0]); + return (int) Math.Round(GetStaticLootMultiplierForLocation(locationName) * itemCountArray.Draw()[0]); } /// @@ -578,10 +634,15 @@ public class LocationLootGenerator( { if (!seasonalEventActive && seasonalItemTplBlacklist.Contains(icd.Tpl)) // Skip seasonal event items if they're not enabled + { continue; + } // Ensure no blacklisted lootable items are in pool - if (_itemFilterService.IsLootableItemBlacklisted(icd.Tpl)) continue; + if (_itemFilterService.IsLootableItemBlacklisted(icd.Tpl)) + { + continue; + } itemDistribution.Add(new ProbabilityObject(icd.Tpl, icd.RelativeProbability.Value, null)); } @@ -617,18 +678,18 @@ public class LocationLootGenerator( if (!_seasonalEventService.ChristmasEventEnabled()) { dynamicLootDist.Spawnpoints = dynamicLootDist.Spawnpoints.Where( - (point) => !point.Template.Id.StartsWith("christmas") + point => !point.Template.Id.StartsWith("christmas") ) .ToList(); dynamicLootDist.SpawnpointsForced = dynamicLootDist.SpawnpointsForced.Where( - (point) => !point.Template.Id.StartsWith("christmas") + point => !point.Template.Id.StartsWith("christmas") ) .ToList(); } // Build the list of forced loot from both `spawnpointsForced` and any point marked `IsAlwaysSpawn` dynamicForcedSpawnPoints.AddRange(dynamicLootDist.SpawnpointsForced); - dynamicForcedSpawnPoints.AddRange(dynamicLootDist.Spawnpoints.Where((point) => point.Template.IsAlwaysSpawn ?? false)); + dynamicForcedSpawnPoints.AddRange(dynamicLootDist.Spawnpoints.Where(point => point.Template.IsAlwaysSpawn ?? false)); // Add forced loot AddForcedLoot(loot, dynamicForcedSpawnPoints, locationName, staticAmmoDist); @@ -639,8 +700,8 @@ public class LocationLootGenerator( var desiredSpawnpointCount = Math.Round( GetLooseLootMultiplerForLocation(locationName) * _randomUtil.GetNormallyDistributedRandomNumber( - (double)dynamicLootDist.SpawnpointCount.Mean, - (double)dynamicLootDist.SpawnpointCount.Std + (double) dynamicLootDist.SpawnpointCount.Mean, + (double) dynamicLootDist.SpawnpointCount.Std ) ); @@ -655,12 +716,19 @@ public class LocationLootGenerator( // Point is blacklisted, skip if (blacklistedSpawnpoints?.Contains(spawnpoint.Template.Id) ?? false) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Ignoring loose loot location: {spawnpoint.Template.Id}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Ignoring loose loot location: {spawnpoint.Template.Id}"); + } + continue; } // We've handled IsAlwaysSpawn above, so skip them - if (spawnpoint.Template.IsAlwaysSpawn ?? false) continue; + if (spawnpoint.Template.IsAlwaysSpawn ?? false) + { + continue; + } // 100%, add it to guaranteed if (spawnpoint.Probability == 1) @@ -681,8 +749,12 @@ public class LocationLootGenerator( // Only draw random spawn points if needed if (randomSpawnpointCount > 0 && spawnpointArray.Count > 0) // Add randomly chosen spawn points - foreach (var si in spawnpointArray.Draw((int)randomSpawnpointCount, false)) + { + foreach (var si in spawnpointArray.Draw((int) randomSpawnpointCount, false)) + { chosenSpawnpoints.Add(spawnpointArray.Data(si)); + } + } // Filter out duplicate locationIds // prob can be done better chosenSpawnpoints = chosenSpawnpoints.GroupBy(spawnpoint => spawnpoint.LocationId).Select(group => group.First()).ToList(); @@ -690,7 +762,9 @@ public class LocationLootGenerator( // Do we have enough items in pool to fulfill requirement var tooManySpawnPointsRequested = desiredSpawnpointCount - chosenSpawnpoints.Count > 0; if (tooManySpawnPointsRequested) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( _localisationService.GetText( "location-spawn_point_count_requested_vs_found", @@ -702,6 +776,8 @@ public class LocationLootGenerator( } ) ); + } + } // Iterate over spawnpoints var seasonalEventActive = _seasonalEventService.SeasonalEventEnabled(); @@ -720,36 +796,43 @@ public class LocationLootGenerator( // Ensure no blacklisted lootable items are in pool spawnPoint.Template.Items = spawnPoint.Template.Items.Where( - (item) => !_itemFilterService.IsLootableItemBlacklisted(item.Template) + 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) + item => !seasonalItemTplBlacklist.Contains(item.Template) ) .ToList(); + } // Spawn point has no items after filtering, skip if (spawnPoint.Template.Items is null || spawnPoint.Template.Items.Count == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( _localisationService.GetText("location-spawnpoint_missing_items", spawnPoint.Template.Id) ); + } continue; } // Get an array of allowed IDs after above filtering has occured - var validItemIds = spawnPoint.Template.Items.Select((item) => item.Id).ToList(); + var validItemIds = spawnPoint.Template.Items.Select(item => item.Id).ToList(); // Construct container to hold above filtered items, letting us pick an item for the spot var itemArray = new ProbabilityObjectArray(_mathUtil, _cloner); foreach (var itemDist in spawnPoint.ItemDistribution) { - if (!validItemIds.Contains(itemDist.ComposedKey.Key)) continue; + if (!validItemIds.Contains(itemDist.ComposedKey.Key)) + { + continue; + } itemArray.Add(new ProbabilityObject(itemDist.ComposedKey.Key, itemDist.RelativeProbability ?? 0, null)); } @@ -764,7 +847,7 @@ public class LocationLootGenerator( } // Draw a random item from spawn points possible items - var chosenComposedKey = itemArray.Draw(1).FirstOrDefault(); + var chosenComposedKey = itemArray.Draw().FirstOrDefault(); var createItemResult = CreateDynamicLootItem( chosenComposedKey, spawnPoint.Template.Items, @@ -796,16 +879,20 @@ public class LocationLootGenerator( var lootToForceSingleAmountOnMap = _locationConfig.ForcedLootSingleSpawnById.GetValueOrDefault(locationName); if (lootToForceSingleAmountOnMap is not null) // Process loot items defined as requiring only 1 spawn position as they appear in multiple positions on the map + { 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 + forcedSpawnPoint => forcedSpawnPoint.Template.Items[0].Template == itemTpl ); if (items is null || !items.Any()) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Unable to adjust loot item {itemTpl} as it does not exist inside {locationName} forced loot."); + } + continue; } @@ -813,12 +900,14 @@ public class LocationLootGenerator( var spawnpointArray = new ProbabilityObjectArray(_mathUtil, _cloner); foreach (var si in items) // use locationId as template.Id is the same across all items + { spawnpointArray.Add(new ProbabilityObject(si.LocationId, si.Probability ?? 0, si)); + } // Choose 1 out of all found spawn positions for spawn id and add to loot array foreach (var spawnPointLocationId in spawnpointArray.Draw(1, false)) { - var itemToAdd = items.FirstOrDefault((item) => item.LocationId == spawnPointLocationId); + var itemToAdd = items.FirstOrDefault(item => item.LocationId == spawnPointLocationId); var lootItem = itemToAdd?.Template; if (lootItem is null) { @@ -838,6 +927,7 @@ public class LocationLootGenerator( lootLocationTemplates.Add(lootItem); } } + } var seasonalEventActive = _seasonalEventService.SeasonalEventEnabled(); var seasonalItemTplBlacklist = _seasonalEventService.GetInactiveSeasonalEventItems(); @@ -848,10 +938,16 @@ public class LocationLootGenerator( var firstLootItemTpl = forcedLootLocation.Template.Items.FirstOrDefault().Template; // Skip spawn positions processed already - if (lootToForceSingleAmountOnMap?.Contains(firstLootItemTpl) ?? false) continue; + if (lootToForceSingleAmountOnMap?.Contains(firstLootItemTpl) ?? false) + { + continue; + } // Skip adding seasonal items when seasonal event is not active - if (!seasonalEventActive && seasonalItemTplBlacklist.Contains(firstLootItemTpl)) continue; + if (!seasonalEventActive && seasonalItemTplBlacklist.Contains(firstLootItemTpl)) + { + continue; + } var locationTemplateToAdd = forcedLootLocation.Template; var createItemResult = CreateDynamicLootItem( @@ -866,7 +962,7 @@ public class LocationLootGenerator( // Push forced location into array as long as it doesnt exist already var existingLocation = lootLocationTemplates.Any( - (spawnPoint) => spawnPoint.Id == locationTemplateToAdd.Id + spawnPoint => spawnPoint.Id == locationTemplateToAdd.Id ); if (!existingLocation) { @@ -875,20 +971,29 @@ public class LocationLootGenerator( else { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Attempted to add a forced loot location with Id: {locationTemplateToAdd.Id} to map {locationName} that already has that id in use, skipping" ); + } } } } private ContainerItem CreateDynamicLootItem(string? chosenComposedKey, List items, Dictionary> staticAmmoDist) { - var chosenItem = items.FirstOrDefault((item) => item.Id == chosenComposedKey); + var chosenItem = items.FirstOrDefault(item => item.Id == chosenComposedKey); var chosenTpl = chosenItem?.Template; - if (chosenTpl is null) throw new Exception($"Item for tpl {chosenComposedKey} was not found in the spawn point"); + if (chosenTpl is null) + { + throw new Exception($"Item for tpl {chosenComposedKey} was not found in the spawn point"); + } + var itemTemplate = _itemHelper.GetItem(chosenTpl).Value; - if (itemTemplate is null) _logger.Error($"Item tpl: {chosenTpl} cannot be found in database"); + if (itemTemplate is null) + { + _logger.Error($"Item tpl: {chosenTpl} cannot be found in database"); + } // Item array to return List itemWithMods = []; @@ -906,24 +1011,42 @@ public class LocationLootGenerator( { Id = _hashUtil.Generate(), Template = chosenTpl, - Upd = new Upd { StackObjectsCount = stackCount } + Upd = new Upd + { + StackObjectsCount = stackCount + } } ); } else if (_itemHelper.IsOfBaseclass(chosenTpl, BaseClasses.AMMO_BOX)) { // Fill with cartridges - List ammoBoxItem = [new() { Id = _hashUtil.Generate(), Template = chosenTpl }]; + List ammoBoxItem = + [ + new() + { + Id = _hashUtil.Generate(), + Template = chosenTpl + } + ]; _itemHelper.AddCartridgesToAmmoBox(ammoBoxItem, itemTemplate); itemWithMods.AddRange(ammoBoxItem); } else if (_itemHelper.IsOfBaseclass(chosenTpl, BaseClasses.MAGAZINE)) { // Create array with just magazine - List magazineItem = [new() { Id = _hashUtil.Generate(), Template = chosenTpl }]; + List magazineItem = + [ + new() + { + Id = _hashUtil.Generate(), + Template = chosenTpl + } + ]; if (_randomUtil.GetChance100(_locationConfig.StaticMagazineLootHasAmmoChancePercent)) // Add randomised amount of cartridges + { _itemHelper.FillMagazineWithRandomCartridge( magazineItem, itemTemplate, // Magazine template @@ -931,6 +1054,7 @@ public class LocationLootGenerator( null, _locationConfig.MinFillLooseMagazinePercent / 100 ); + } itemWithMods.AddRange(magazineItem); } @@ -945,7 +1069,9 @@ public class LocationLootGenerator( if (_locationConfig.TplsToStripChildItemsFrom.Contains(chosenItem.Template)) // Strip children from parent before adding + { itemWithChildren = [itemWithChildren[0]]; + } itemWithMods.AddRange(itemWithChildren); } @@ -953,7 +1079,12 @@ public class LocationLootGenerator( // Get inventory size of item var size = _itemHelper.GetItemSize(itemWithMods, itemWithMods[0].Id); - return new ContainerItem { Items = itemWithMods, Width = size.Width, Height = size.Height }; + return new ContainerItem + { + Items = itemWithMods, + Width = size.Width, + Height = size.Height + }; } private double GetLooseLootMultiplerForLocation(string location) @@ -983,11 +1114,21 @@ public class LocationLootGenerator( var width = itemTemplate.Properties.Width; var height = itemTemplate.Properties.Height; - List items = [new() { Id = _hashUtil.Generate(), Template = chosenTpl }]; + List items = + [ + new() + { + Id = _hashUtil.Generate(), + Template = chosenTpl + } + ]; var rootItem = items.FirstOrDefault(); // Use passed in parentId as override for new item - if (!string.IsNullOrEmpty(parentId)) rootItem.ParentId = parentId; + if (!string.IsNullOrEmpty(parentId)) + { + rootItem.ParentId = parentId; + } if ( _itemHelper.IsOfBaseclass(chosenTpl, BaseClasses.MONEY) || @@ -999,7 +1140,10 @@ public class LocationLootGenerator( ? 1 : _randomUtil.GetInt(itemTemplate.Properties.StackMinRandom.Value, itemTemplate.Properties.StackMaxRandom.Value); - rootItem.Upd = new Upd { StackObjectsCount = stackCount }; + rootItem.Upd = new Upd + { + StackObjectsCount = stackCount + }; } // No spawn point, use default template else if (_itemHelper.IsOfBaseclass(chosenTpl, BaseClasses.WEAPON)) @@ -1028,7 +1172,12 @@ public class LocationLootGenerator( items = GetArmorItems(chosenTpl, rootItem, items, itemTemplate); } - return new ContainerItem { Items = items, Width = width, Height = height }; + return new ContainerItem + { + Items = items, + Width = width, + Height = height + }; } private List GetArmorItems(string chosenTpl, Item? rootItem, List items, TemplateItem armorDbTemplate) @@ -1047,11 +1196,13 @@ public class LocationLootGenerator( { // We make base item in calling method, no need to do it here if ((armorDbTemplate.Properties.Slots?.Count ?? 0) > 0) + { items = _itemHelper.AddChildSlotItems( items, armorDbTemplate, _locationConfig.EquipmentLootSettings.ModSpawnChancePercent ); + } } return items; @@ -1092,7 +1243,10 @@ public class LocationLootGenerator( else { // RSP30 (62178be9d0050232da3485d9/624c0b3340357b5f566e8766/6217726288ed9f0845317459) doesn't have any default presets and kills this code below as it has no chidren to reparent - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"createStaticLootItem() No preset found for weapon: {chosenTpl}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"createStaticLootItem() No preset found for weapon: {chosenTpl}"); + } } rootItem = items[0]; @@ -1114,7 +1268,10 @@ public class LocationLootGenerator( try { - if (children?.Count > 0) items = _itemHelper.ReparentItemAndChildren(rootItem, children); + if (children?.Count > 0) + { + items = _itemHelper.ReparentItemAndChildren(rootItem, children); + } } catch (Exception e) { @@ -1124,7 +1281,7 @@ public class LocationLootGenerator( new { tpl = chosenTpl, - parentId = parentId + parentId } ) ); @@ -1185,20 +1342,40 @@ public class LocationLootGenerator( public class ContainerGroupCount { [JsonPropertyName("containerIdsWithProbability")] - public Dictionary? ContainerIdsWithProbability { get; set; } + public Dictionary? ContainerIdsWithProbability + { + get; + set; + } [JsonPropertyName("chosenCount")] - public double? ChosenCount { get; set; } + public double? ChosenCount + { + get; + set; + } } public class ContainerItem { [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("width")] - public double? Width { get; set; } + public double? Width + { + get; + set; + } [JsonPropertyName("height")] - public double? Height { get; set; } + public double? Height + { + get; + set; + } } diff --git a/Libraries/Core/Generators/LootGenerator.cs b/Libraries/Core/Generators/LootGenerator.cs index ab022e0d..549cf383 100644 --- a/Libraries/Core/Generators/LootGenerator.cs +++ b/Libraries/Core/Generators/LootGenerator.cs @@ -1,6 +1,5 @@ using System.Text.Json.Serialization; using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Common; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -11,6 +10,7 @@ using Core.Models.Utils; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Generators; @@ -31,7 +31,7 @@ public class LootGenerator( ) { /// - /// Generate a list of items based on configuration options parameter + /// Generate a list of items based on configuration options parameter /// /// parameters to adjust how loot is generated /// An array of loot items @@ -50,7 +50,7 @@ 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 => item.Name.Contains("event_container_airdrop") ); @@ -86,9 +86,13 @@ public class LootGenerator( { var randomisedItemCount = _randomUtil.GetDouble(options.ItemCount.Min.Value, options.ItemCount.Max.Value); for (var index = 0; index < randomisedItemCount; index++) + { if (!FindAndAddRandomItemToLoot(rewardPoolResults.ItemPool, itemTypeCounts, options, result)) // Failed to add, reduce index so we get another attempt + { index--; + } + } } var globalDefaultPresets = _presetHelper.GetDefaultPresets().Values; @@ -101,13 +105,15 @@ public class LootGenerator( if (randomisedWeaponPresetCount > 0) { var weaponDefaultPresets = globalDefaultPresets.Where( - (preset) => + preset => _itemHelper.IsOfBaseclass(preset.Encyclopedia, BaseClasses.WEAPON) ) .ToList(); if (weaponDefaultPresets.Any()) + { for (var index = 0; index < randomisedWeaponPresetCount; index++) + { if ( !FindAndAddRandomPresetToLoot( weaponDefaultPresets, @@ -117,7 +123,11 @@ public class LootGenerator( ) ) // Failed to add, reduce index so we get another attempt + { index--; + } + } + } } // Filter default presets to just armors and then filter again by protection level @@ -128,18 +138,20 @@ public class LootGenerator( if (randomisedArmorPresetCount > 0) { var armorDefaultPresets = globalDefaultPresets.Where( - (preset) => + preset => _itemHelper.ArmorItemCanHoldMods(preset.Encyclopedia) ); var levelFilteredArmorPresets = armorDefaultPresets.Where( - (armor) => + armor => IsArmorOfDesiredProtectionLevel(armor, options) ) .ToList(); // Add some armors to rewards if (levelFilteredArmorPresets.Any()) + { for (var index = 0; index < randomisedArmorPresetCount; index++) + { if ( !FindAndAddRandomPresetToLoot( levelFilteredArmorPresets, @@ -149,15 +161,19 @@ public class LootGenerator( ) ) // Failed to add, reduce index so we get another attempt + { index--; + } + } + } } return result; } /// - /// Generate An array of items - /// TODO - handle weapon presets/ammo packs + /// Generate An array of items + /// TODO - handle weapon presets/ammo packs /// /// Dictionary of item tpls with minmax values /// Array of Item @@ -192,7 +208,7 @@ public class LootGenerator( } /// - /// Get pool of items from item db that fit passed in param criteria + /// Get pool of items from item db that fit passed in param criteria /// /// Prevent these items /// Only allow these items @@ -215,8 +231,8 @@ public class LootGenerator( // Get all items that match the blacklisted types and fold into item blacklist var itemTypeBlacklist = _itemFilterService.GetItemRewardBaseTypeBlacklist(); var itemsMatchingTypeBlacklist = itemsDb - .Where((templateItem) => _itemHelper.IsOfBaseclasses(templateItem.Parent, itemTypeBlacklist)) - .Select((templateItem) => templateItem.Id); + .Where(templateItem => _itemHelper.IsOfBaseclasses(templateItem.Parent, itemTypeBlacklist)) + .Select(templateItem => templateItem.Id); // Clear out blacklist itemBlacklist = []; @@ -226,11 +242,15 @@ public class LootGenerator( } if (!allowBossItems) + { foreach (var bossItem in _itemFilterService.GetBossItems()) + { itemBlacklist.Add(bossItem); + } + } var items = itemsDb.Where( - (item) => + item => !itemBlacklist.Contains(item.Id) && item.Type.ToLower() == "item" && !item.Properties.QuestItem.GetValueOrDefault(false) && @@ -238,17 +258,15 @@ public class LootGenerator( ) .ToList(); - return new ItemRewardPoolResults { ItemPool = items, Blacklist = itemBlacklist }; - } - - public record ItemRewardPoolResults - { - public List ItemPool { get; set; } - public HashSet Blacklist { get; set; } + return new ItemRewardPoolResults + { + ItemPool = items, + Blacklist = itemBlacklist + }; } /// - /// Filter armor items by their front plates protection level - top if it's a helmet + /// Filter armor items by their front plates protection level - top if it's a helmet /// /// Armor preset to check /// Loot request options - armor level etc @@ -258,8 +276,11 @@ public class LootGenerator( string[] relevantSlots = ["front_plate", "helmet_top", "soft_armor_front"]; foreach (var slotId in relevantSlots) { - var armorItem = armor.Items.FirstOrDefault((item) => item?.SlotId?.ToLower() == slotId); - if (armorItem is null) continue; + var armorItem = armor.Items.FirstOrDefault(item => item?.SlotId?.ToLower() == slotId); + if (armorItem is null) + { + continue; + } var armorDetails = _itemHelper.GetItem(armorItem.Template).Value; var armorClass = armorDetails.Properties.ArmorClass; @@ -271,20 +292,27 @@ public class LootGenerator( } /// - /// Construct item limit record to hold max and current item count for each item type + /// Construct item limit record to hold max and current item count for each item type /// /// limits as defined in config /// record, key: item tplId, value: current/max item count allowed private Dictionary InitItemLimitCounter(Dictionary limits) { var itemTypeCounts = new Dictionary(); - foreach (var itemTypeId in limits) itemTypeCounts[itemTypeId.Key] = new ItemLimit() { Current = 0, Max = limits[itemTypeId.Key] }; + foreach (var itemTypeId in limits) + { + itemTypeCounts[itemTypeId.Key] = new ItemLimit + { + Current = 0, + Max = limits[itemTypeId.Key] + }; + } return itemTypeCounts; } /// - /// Find a random item in items.json and add to result array + /// Find a random item in items.json and add to result array /// /// items to choose from /// item limit counts @@ -298,10 +326,16 @@ public class LootGenerator( var randomItem = _randomUtil.GetArrayValue(items); var itemLimitCount = itemTypeCounts.TryGetValue(randomItem.Parent, out var randomItemLimitCount); - if (!itemLimitCount && randomItemLimitCount?.Current > randomItemLimitCount?.Max) return false; + if (!itemLimitCount && randomItemLimitCount?.Current > randomItemLimitCount?.Max) + { + return false; + } // Skip armors as they need to come from presets - if (_itemHelper.ArmorItemCanHoldMods(randomItem.Id)) return false; + if (_itemHelper.ArmorItemCanHoldMods(randomItem.Id)) + { + return false; + } var newLootItem = new Item { @@ -315,21 +349,26 @@ public class LootGenerator( }; // Special case - handle items that need a stackcount > 1 - if (randomItem.Properties.StackMaxSize > 1) newLootItem.Upd.StackObjectsCount = GetRandomisedStackCount(randomItem, options); + if (randomItem.Properties.StackMaxSize > 1) + { + newLootItem.Upd.StackObjectsCount = GetRandomisedStackCount(randomItem, options); + } newLootItem.Template = randomItem.Id; result.Add(newLootItem); if (randomItemLimitCount is not null) // Increment item count as it's in limit array + { randomItemLimitCount.Current++; + } // Item added okay return true; } /// - /// Get a randomised stack count for an item between its StackMinRandom and StackMaxSize values + /// Get a randomised stack count for an item between its StackMinRandom and StackMaxSize values /// /// item to get stack count of /// loot options @@ -341,15 +380,15 @@ public class LootGenerator( if (options.ItemStackLimits.TryGetValue(item.Id, out var itemLimits)) { - min = (int?)itemLimits.Min; - max = (int?)itemLimits.Max; + min = (int?) itemLimits.Min; + max = (int?) itemLimits.Max; } - return _randomUtil.GetInt((min ?? 1), max ?? 1); + return _randomUtil.GetInt(min ?? 1, max ?? 1); } /// - /// Find a random item in items.json and add to result list + /// Find a random item in items.json and add to result list /// /// Presets to choose from /// Item limit counts @@ -373,7 +412,10 @@ public class LootGenerator( // No `_encyclopedia` property, not possible to reliably get root item tpl if (chosenPreset.Encyclopedia is null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Preset with id: {chosenPreset?.Id} lacks encyclopedia property, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Preset with id: {chosenPreset?.Id} lacks encyclopedia property, skipping"); + } return false; } @@ -382,13 +424,19 @@ public class LootGenerator( var itemDbDetails = _itemHelper.GetItem(chosenPreset.Encyclopedia); if (!itemDbDetails.Key) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"$Unable to find preset with tpl: {chosenPreset.Encyclopedia}, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"$Unable to find preset with tpl: {chosenPreset.Encyclopedia}, skipping"); + } return false; } // Skip preset if root item is blacklisted - if (itemBlacklist.Contains(chosenPreset.Items[0].Template)) return false; + if (itemBlacklist.Contains(chosenPreset.Items[0].Template)) + { + return false; + } // Some custom mod items lack a parent property if (itemDbDetails.Value.Parent is null) @@ -400,23 +448,31 @@ public class LootGenerator( // Check chosen preset hasn't exceeded spawn limit var hasItemLimitCount = itemTypeCounts.TryGetValue(itemDbDetails.Value.Parent, out var itemLimitCount); - if (!hasItemLimitCount && itemLimitCount?.Current > itemLimitCount?.Max) return false; + if (!hasItemLimitCount && itemLimitCount?.Current > itemLimitCount?.Max) + { + return false; + } var presetAndMods = _itemHelper.ReplaceIDs(_cloner.Clone(chosenPreset.Items)); _itemHelper.RemapRootItemId(presetAndMods); // Add chosen preset tpl to result array - foreach (var item in presetAndMods) result.Add(item); + foreach (var item in presetAndMods) + { + result.Add(item); + } if (itemLimitCount is not null) // Increment item count as item has been chosen and its inside itemLimitCount dictionary + { itemLimitCount.Current++; + } // Item added okay return true; } /// - /// Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) + /// Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds) /// /// sealed weapon container settings /// List of items with children lists @@ -474,7 +530,7 @@ public class LootGenerator( } /// - /// Get non-weapon mod rewards for a sealed container + /// Get non-weapon mod rewards for a sealed container /// /// Sealed weapon container settings /// Details for the weapon to reward player @@ -488,14 +544,17 @@ public class LootGenerator( { var rewardCount = _randomUtil.GetDouble(settings.Min.Value, settings.Max.Value); - if (rewardCount == 0) continue; + if (rewardCount == 0) + { + continue; + } // Edge case - ammo boxes if (rewardKey == BaseClasses.AMMO_BOX) { // Get ammoboxes from db var ammoBoxesDetails = containerSettings.AmmoBoxWhitelist.Select( - (tpl) => + tpl => { var itemDetails = _itemHelper.GetItem(tpl); return itemDetails.Value; @@ -505,12 +564,15 @@ public class LootGenerator( // Need to find boxes that matches weapons caliber var weaponCaliber = weaponDetailsDb.Properties.AmmoCaliber; var ammoBoxesMatchingCaliber = ammoBoxesDetails.Where( - (x) => + x => x.Properties.AmmoCaliber == weaponCaliber ); if (!ammoBoxesMatchingCaliber.Any()) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"No ammo box with caliber {weaponCaliber} found, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"No ammo box with caliber {weaponCaliber} found, skipping"); + } continue; } @@ -518,7 +580,14 @@ public class LootGenerator( for (var index = 0; index < rewardCount; index++) { var chosenAmmoBox = _randomUtil.GetArrayValue(ammoBoxesMatchingCaliber); - var ammoBoxReward = new List { new() { Id = _hashUtil.Generate(), Template = chosenAmmoBox.Id } }; + var ammoBoxReward = new List + { + new() + { + Id = _hashUtil.Generate(), + Template = chosenAmmoBox.Id + } + }; _itemHelper.AddCartridgesToAmmoBox(ammoBoxReward, chosenAmmoBox); rewards.Add(ammoBoxReward); } @@ -529,7 +598,7 @@ public class LootGenerator( // Get all items of the desired type + not quest items + not globally blacklisted var rewardItemPool = _databaseService.GetItems() .Values.Where( - (item) => + item => item.Parent == rewardKey && item.Type.ToLower() == "item" && _itemFilterService.IsItemBlacklisted(item.Id) && @@ -539,7 +608,10 @@ public class LootGenerator( if (rewardItemPool.Count() == 0) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"No items with base type of {rewardKey} found, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"No items with base type of {rewardKey} found, skipping"); + } continue; } @@ -548,7 +620,14 @@ public class LootGenerator( { // Choose a random item from pool var chosenRewardItem = _randomUtil.GetArrayValue(rewardItemPool); - var rewardItem = new List { new() { Id = _hashUtil.Generate(), Template = chosenRewardItem.Id } }; + var rewardItem = new List + { + new() + { + Id = _hashUtil.Generate(), + Template = chosenRewardItem.Id + } + }; rewards.Add(rewardItem); } @@ -558,7 +637,7 @@ public class LootGenerator( } /// - /// Iterate over the container weaponModRewardLimits settings and create a list of weapon mods to reward player + /// Iterate over the container weaponModRewardLimits settings and create a list of weapon mods to reward player /// /// Sealed weapon container settings /// All items that can be attached/inserted into weapon @@ -574,18 +653,24 @@ public class LootGenerator( var rewardCount = _randomUtil.GetDouble(settings.Min.Value, settings.Max.Value); // Nothing to add, skip reward type - if (rewardCount == 0) continue; + if (rewardCount == 0) + { + continue; + } // 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) + item => item?.Parent == rewardKey && !_itemFilterService.IsItemBlacklisted(item.Id) ); if (relatedItems is null || relatedItems.Count() == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"No items found to fulfil reward type: {rewardKey} for weapon: {chosenWeaponPreset.Name}, skipping type" ); + } + continue; } @@ -593,7 +678,14 @@ public class LootGenerator( for (var index = 0; index < rewardCount; index++) { var chosenItem = _randomUtil.DrawRandomFromList(relatedItems.ToList()); - var reward = new List { new() { Id = _hashUtil.Generate(), Template = chosenItem[0].Id } }; + var reward = new List + { + new() + { + Id = _hashUtil.Generate(), + Template = chosenItem[0].Id + } + }; modRewards.Add(reward); } @@ -603,7 +695,7 @@ public class LootGenerator( } /// - /// Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards + /// Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards /// /// /// List of item with children lists @@ -630,7 +722,14 @@ public class LootGenerator( continue; } - List rewardItem = [new() { Id = _hashUtil.Generate(), Template = chosenRewardItemTpl }]; + List rewardItem = + [ + new() + { + Id = _hashUtil.Generate(), + Template = chosenRewardItemTpl + } + ]; itemsToReturn.Add(rewardItem); } @@ -638,29 +737,54 @@ public class LootGenerator( } /// - /// Pick a reward item based on the reward details data + /// Pick a reward item based on the reward details data /// /// /// Single tpl protected string PickRewardItem(RewardDetails rewardContainerDetails) { if (rewardContainerDetails.RewardTplPool is not null && rewardContainerDetails.RewardTplPool.Count > 0) + { return _weightedRandomHelper.GetWeightedValue(rewardContainerDetails.RewardTplPool); + } return _randomUtil.GetArrayValue( GetItemRewardPool([], rewardContainerDetails.RewardTypePool, true, true) .ItemPool.Select( - (item) => item.Id + item => item.Id ) ); } + + public record ItemRewardPoolResults + { + public List ItemPool + { + get; + set; + } + + public HashSet Blacklist + { + get; + set; + } + } } public class ItemLimit { [JsonPropertyName("current")] - public double Current { get; set; } + public double Current + { + get; + set; + } [JsonPropertyName("max")] - public double Max { get; set; } + public double Max + { + get; + set; + } } diff --git a/Libraries/Core/Generators/PMCLootGenerator.cs b/Libraries/Core/Generators/PMCLootGenerator.cs index 61c1aa2a..233a3673 100644 --- a/Libraries/Core/Generators/PMCLootGenerator.cs +++ b/Libraries/Core/Generators/PMCLootGenerator.cs @@ -1,30 +1,30 @@ -using SptCommon.Annotations; +using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; -using Core.Models.Utils; -using Core.Helpers; -using Core.Services; -using Core.Servers; using Core.Models.Spt.Config; +using Core.Models.Utils; +using Core.Servers; +using Core.Services; +using SptCommon.Annotations; namespace Core.Generators; [Injectable] public class PMCLootGenerator { - private readonly ISptLogger _logger; + private readonly ConfigServer _configServer; private readonly DatabaseService _databaseService; - private readonly ItemHelper _itemHelper; private readonly ItemFilterService _itemFilterService; + private readonly ItemHelper _itemHelper; + private readonly ISptLogger _logger; + private readonly PmcConfig _pmcConfig; private readonly RagfairPriceService _ragfairPriceService; private readonly SeasonalEventService _seasonalEventService; private readonly WeightedRandomHelper _weightedRandomHelper; - private readonly ConfigServer _configServer; private Dictionary? _backpackLootPool; private Dictionary? _pocketLootPool; private Dictionary? _vestLootPool; - private readonly PmcConfig _pmcConfig; public PMCLootGenerator( ISptLogger logger, @@ -50,7 +50,7 @@ public class PMCLootGenerator } /// - /// Create a List of loot items a PMC can have in their pockets + /// Create a List of loot items a PMC can have in their pockets /// /// /// Dictionary of string and number @@ -69,7 +69,7 @@ public class PMCLootGenerator var blacklist = GetLootBlacklist(); var itemsToAdd = items.Where( - (item) => + item => allowedItemTypeWhitelist.Contains(item.Value.Parent) && _itemHelper.IsValidItem(item.Value.Id) && !blacklist.Contains(item.Value.Id) && @@ -79,6 +79,7 @@ public class PMCLootGenerator foreach (var (tpl, template) in itemsToAdd) // If pmc has price override, use that. Otherwise, use flea price + { if (pmcPriceOverrides.ContainsKey(tpl)) { _pocketLootPool[tpl] = pmcPriceOverrides[tpl]; @@ -89,12 +90,15 @@ public class PMCLootGenerator var price = _ragfairPriceService.GetDynamicItemPrice(tpl, Money.ROUBLES); _pocketLootPool[tpl] = price ?? 0; } + } var highestPrice = _pocketLootPool.Max(price => price.Value); foreach (var (key, _) in _pocketLootPool) // Invert price so cheapest has a larger weight // Times by highest price so most expensive item has weight of 1 + { _pocketLootPool[key] = Math.Round(1 / _pocketLootPool[key] * highestPrice); + } _weightedRandomHelper.ReduceWeightValues(_pocketLootPool); } @@ -105,16 +109,31 @@ public class PMCLootGenerator private HashSet GetLootBlacklist() { var blacklist = new HashSet(); - foreach (var blacklistedItem in _pmcConfig.PocketLoot.Blacklist) blacklist.Add(blacklistedItem); - foreach (var blacklistedItem in _pmcConfig.GlobalLootBlacklist) blacklist.Add(blacklistedItem); - foreach (var blacklistedItem in _itemFilterService.GetBlacklistedItems()) blacklist.Add(blacklistedItem); - foreach (var blacklistedItem in _seasonalEventService.GetInactiveSeasonalEventItems()) blacklist.Add(blacklistedItem); + foreach (var blacklistedItem in _pmcConfig.PocketLoot.Blacklist) + { + blacklist.Add(blacklistedItem); + } + + foreach (var blacklistedItem in _pmcConfig.GlobalLootBlacklist) + { + blacklist.Add(blacklistedItem); + } + + foreach (var blacklistedItem in _itemFilterService.GetBlacklistedItems()) + { + blacklist.Add(blacklistedItem); + } + + foreach (var blacklistedItem in _seasonalEventService.GetInactiveSeasonalEventItems()) + { + blacklist.Add(blacklistedItem); + } return blacklist; } /// - /// Create a List of loot items a PMC can have in their vests + /// Create a List of loot items a PMC can have in their vests /// /// /// Dictionary of string and number @@ -133,7 +152,7 @@ public class PMCLootGenerator var blacklist = GetLootBlacklist(); var itemsToAdd = items.Where( - (item) => + item => allowedItemTypeWhitelist.Contains(item.Value.Parent) && _itemHelper.IsValidItem(item.Value.Id) && !blacklist.Contains(item.Value.Id) && @@ -143,6 +162,7 @@ public class PMCLootGenerator foreach (var (tpl, template) in itemsToAdd) // If pmc has price override, use that. Otherwise, use flea price + { if (pmcPriceOverrides.ContainsKey(tpl)) { _vestLootPool[tpl] = pmcPriceOverrides[tpl]; @@ -153,12 +173,15 @@ public class PMCLootGenerator var price = _ragfairPriceService.GetDynamicItemPrice(tpl, Money.ROUBLES); _vestLootPool[tpl] = price ?? 0; } + } var highestPrice = _vestLootPool.Max(price => price.Value); foreach (var (key, _) in _vestLootPool) // Invert price so cheapest has a larger weight // Times by highest price so most expensive item has weight of 1 + { _vestLootPool[key] = Math.Round(1 / _vestLootPool[key] * highestPrice); + } _weightedRandomHelper.ReduceWeightValues(_vestLootPool); } @@ -167,8 +190,8 @@ public class PMCLootGenerator } /// - /// Check if item has a width/height that lets it fit into a 2x2 slot - /// 1x1 / 1x2 / 2x1 / 2x2 + /// Check if item has a width/height that lets it fit into a 2x2 slot + /// 1x1 / 1x2 / 2x1 / 2x2 /// /// Item to check size of /// true if it fits @@ -178,8 +201,8 @@ public class PMCLootGenerator } /// - /// Check if item has a width/height that lets it fit into a 1x2 slot - /// 1x1 / 1x2 / 2x1 + /// Check if item has a width/height that lets it fit into a 1x2 slot + /// 1x1 / 1x2 / 2x1 /// /// Item to check size of /// true if it fits @@ -193,7 +216,7 @@ public class PMCLootGenerator } /// - /// Create a List of loot items a PMC can have in their backpack + /// Create a List of loot items a PMC can have in their backpack /// /// /// Dictionary of string and number @@ -212,7 +235,7 @@ public class PMCLootGenerator var blacklist = GetLootBlacklist(); var itemsToAdd = items.Where( - (item) => + item => allowedItemTypeWhitelist.Contains(item.Value.Parent) && _itemHelper.IsValidItem(item.Value.Id) && !blacklist.Contains(item.Value.Id) && @@ -221,6 +244,7 @@ public class PMCLootGenerator foreach (var (tpl, template) in itemsToAdd) // If pmc has price override, use that. Otherwise, use flea price + { if (pmcPriceOverrides.ContainsKey(tpl)) { _backpackLootPool[tpl] = pmcPriceOverrides[tpl]; @@ -231,12 +255,15 @@ public class PMCLootGenerator var price = _ragfairPriceService.GetDynamicItemPrice(tpl, Money.ROUBLES); _backpackLootPool[tpl] = price ?? 0; } + } var highestPrice = _backpackLootPool.Max(price => price.Value); foreach (var (key, _) in _backpackLootPool) // Invert price so cheapest has a larger weight // Times by highest price so most expensive item has weight of 1 + { _backpackLootPool[key] = Math.Round(1 / _backpackLootPool[key] * highestPrice); + } _weightedRandomHelper.ReduceWeightValues(_backpackLootPool); } diff --git a/Libraries/Core/Generators/PlayerScavGenerator.cs b/Libraries/Core/Generators/PlayerScavGenerator.cs index c4fb2028..a95d3cac 100644 --- a/Libraries/Core/Generators/PlayerScavGenerator.cs +++ b/Libraries/Core/Generators/PlayerScavGenerator.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -11,6 +10,7 @@ using Core.Services; using Core.Utils; using Core.Utils.Cloners; using Core.Utils.Json; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -39,7 +39,7 @@ public class PlayerScavGenerator( protected PlayerScavConfig _playerScavConfig = _configServer.GetConfig(); /// - /// Update a player profile to include a new player scav profile + /// Update a player profile to include a new player scav profile /// /// session id to specify what profile is updated /// profile object @@ -55,9 +55,14 @@ public class PlayerScavGenerator( // use karma level to get correct karmaSettings if (!_playerScavConfig.KarmaLevel.TryGetValue(scavKarmaLevel.ToString(), out var playerScavKarmaSettings)) + { _logger.Error(_localisationService.GetText("scav-missing_karma_settings", scavKarmaLevel)); + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Generated player scav loadout with karma level {scavKarmaLevel}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Generated player scav loadout with karma level {scavKarmaLevel}"); + } // Edit baseBotNode values var baseBotNode = ConstructBotBaseTemplate(playerScavKarmaSettings.BotTypeForLoot); @@ -96,7 +101,11 @@ public class PlayerScavGenerator( scavData.Info.Experience = GetScavExperience(existingScavDataClone); scavData.Quests = existingScavDataClone.Quests ?? []; scavData.TaskConditionCounters = existingScavDataClone.TaskConditionCounters ?? new Dictionary(); - scavData.Notes = existingScavDataClone.Notes ?? new Notes { DataNotes = new List() }; + scavData.Notes = existingScavDataClone.Notes ?? + new Notes + { + DataNotes = new List() + }; scavData.WishList = existingScavDataClone.WishList ?? new DictionaryOrList(new Dictionary(), new List()); scavData.Encyclopedia = pmcDataClone.Encyclopedia ?? new Dictionary(); @@ -124,7 +133,7 @@ public class PlayerScavGenerator( } /// - /// Add items picked from `playerscav.lootItemsToAddChancePercent` + /// Add items picked from `playerscav.lootItemsToAddChancePercent` /// /// dict of tpl + % chance to be added /// @@ -136,7 +145,9 @@ public class PlayerScavGenerator( { var shouldAdd = _randomUtil.GetChance100(tpl.Value); if (!shouldAdd) + { continue; + } var itemResult = _itemHelper.GetItem(tpl.Key); if (!itemResult.Key) @@ -146,7 +157,7 @@ public class PlayerScavGenerator( } var itemTemplate = itemResult.Value; - var itemsToAdd = new List() + var itemsToAdd = new List { new() { @@ -165,14 +176,18 @@ public class PlayerScavGenerator( ); if (result != ItemAddedResult.SUCCESS) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Unable to add keycard to bot. Reason: {result.ToString()}"); + } + } } } /// - /// Get the scav karama level for a profile - /// Is also the fence trader rep level + /// Get the scav karama level for a profile + /// Is also the fence trader rep level /// /// pmc profile /// karma level @@ -186,14 +201,16 @@ public class PlayerScavGenerator( } if (fenceInfo.Standing > 6) + { return 6; + } return Math.Floor(fenceInfo.Standing ?? 0); } /// - /// Get a baseBot template - /// If the parameter doesnt match "assault", take parts from the loot type and apply to the return bot template + /// Get a baseBot template + /// If the parameter doesnt match "assault", take parts from the loot type and apply to the return bot template /// /// bot type to use for inventory/chances /// IBotType object @@ -204,7 +221,9 @@ public class PlayerScavGenerator( // Loot bot is same as base bot, return base with no modification if (botTypeForLoot == baseScavType) + { return asssaultBase; + } var lootBase = _cloner.Clone(_botHelper.GetBotTemplate(botTypeForLoot)); asssaultBase.BotInventory = lootBase.BotInventory; @@ -215,7 +234,7 @@ public class PlayerScavGenerator( } /// - /// Adjust equipment/mod/item generation values based on scav karma levels + /// Adjust equipment/mod/item generation values based on scav karma levels /// /// Values to modify the bot template with /// bot template to modify according to karama level settings @@ -225,12 +244,17 @@ public class PlayerScavGenerator( foreach (var equipmentKvP in karmaSettings.Modifiers.Equipment) { // Adjustment value zero, nothing to do - if (equipmentKvP.Value == 0) continue; + if (equipmentKvP.Value == 0) + { + continue; + } // Try add new key with value if (!baseBotNode.BotChances.EquipmentChances.TryAdd(equipmentKvP.Key, equipmentKvP.Value)) // Unable to add new, update existing + { baseBotNode.BotChances.EquipmentChances[equipmentKvP.Key] += equipmentKvP.Value; + } } // Adjust mod chance values @@ -238,7 +262,10 @@ public class PlayerScavGenerator( { // Adjustment value zero, nothing to do if (modKvP.Value == 0) + { continue; + } + if (karmaSettings.Modifiers.Mod.TryGetValue(modKvP.Key, out var value)) { baseBotNode.BotChances.WeaponModsChances.TryAdd(modKvP.Key, 0); @@ -260,14 +287,19 @@ public class PlayerScavGenerator( foreach (var equipmentBlacklistKvP in karmaSettings.EquipmentBlacklist) { baseBotNode.BotInventory.Equipment.TryGetValue(equipmentBlacklistKvP.Key, out var equipmentDict); - foreach (var itemToRemove in equipmentBlacklistKvP.Value) equipmentDict.Remove(itemToRemove); + foreach (var itemToRemove in equipmentBlacklistKvP.Value) + { + equipmentDict.Remove(itemToRemove); + } } } protected Skills GetScavSkills(PmcData scavProfile) { if (scavProfile?.Skills != null) + { return scavProfile.Skills; + } return GetDefaultScavSkills(); } @@ -285,7 +317,9 @@ public class PlayerScavGenerator( protected Stats GetScavStats(PmcData scavProfile) { if (scavProfile?.Stats != null) + { return scavProfile.Stats; + } return _profileHelper.GetDefaultCounters(); } @@ -294,7 +328,9 @@ public class PlayerScavGenerator( { // Info can be null on initial account creation if (scavProfile?.Info?.Level == null) + { return 1; + } return scavProfile?.Info?.Level ?? 1; } @@ -303,14 +339,16 @@ public class PlayerScavGenerator( { // Info can be null on initial account creation if (scavProfile?.Info?.Experience == null) + { return 0; + } return scavProfile?.Info?.Experience ?? 0; } /// - /// Set cooldown till scav is playable - /// take into account scav cooldown bonus + /// Set cooldown till scav is playable + /// take into account scav cooldown bonus /// /// scav profile /// pmc profile @@ -323,21 +361,29 @@ public class PlayerScavGenerator( var modifier = 1; foreach (var bonus in pmcData.Bonuses) + { if (bonus.Type == BonusType.ScavCooldownTimer) // Value is negative, so add. // Also note that for scav cooldown, multiple bonuses stack additively. - modifier += (int)(bonus?.Value ?? 1) / 100; + { + modifier += (int) (bonus?.Value ?? 1) / 100; + } + } var fenceInfo = _fenceService.GetFenceInfo(pmcData); - modifier *= (int)(fenceInfo.SavageCooldownModifier ?? 1); + modifier *= (int) (fenceInfo.SavageCooldownModifier ?? 1); scavLockDuration *= modifier; var fullProfile = _profileHelper.GetFullProfile(pmcData?.SessionId); if (fullProfile?.ProfileInfo?.Edition.ToLower().StartsWith(AccountTypes.SPT_DEVELOPER) ?? false) + { scavLockDuration = 10; + } if (scavData?.Info != null) - scavData.Info.SavageLockTime = Math.Round((double)(_timeUtil.GetTimeStamp() / 1000 + scavLockDuration ?? 0)); + { + scavData.Info.SavageLockTime = Math.Round((double) (_timeUtil.GetTimeStamp() / 1000 + scavLockDuration ?? 0)); + } return scavData; } diff --git a/Libraries/Core/Generators/RagfairAssortGenerator.cs b/Libraries/Core/Generators/RagfairAssortGenerator.cs index ba4bfed6..14da9a3c 100644 --- a/Libraries/Core/Generators/RagfairAssortGenerator.cs +++ b/Libraries/Core/Generators/RagfairAssortGenerator.cs @@ -1,5 +1,4 @@ using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; @@ -8,6 +7,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Generators; @@ -42,7 +42,10 @@ public class RagfairAssortGenerator( */ public List> GetAssortItems() { - if (!AssortsAreGenerated()) generatedAssortItems = GenerateRagfairAssortItems(); + if (!AssortsAreGenerated()) + { + generatedAssortItems = GenerateRagfairAssortItems(); + } return generatedAssortItems; } @@ -65,7 +68,7 @@ public class RagfairAssortGenerator( List> results = []; /** Get cloned items from db */ - var dbItemsClone = itemHelper.GetItems().Where((item) => item.Type != "Node"); + var dbItemsClone = itemHelper.GetItems().Where(item => item.Type != "Node"); /** Store processed preset tpls so we dont add them when procesing non-preset items */ List processedArmorItems = []; @@ -84,15 +87,22 @@ public class RagfairAssortGenerator( presetAndMods[0].ParentId = "hideout"; presetAndMods[0].SlotId = "hideout"; - presetAndMods[0].Upd = new Upd() - { StackObjectsCount = 99999999, UnlimitedCount = true, SptPresetId = preset.Id }; + presetAndMods[0].Upd = new Upd + { + StackObjectsCount = 99999999, + UnlimitedCount = true, + SptPresetId = preset.Id + }; results.Add(presetAndMods); } foreach (var item in dbItemsClone) { - if (!itemHelper.IsValidItem(item.Id, ragfairItemInvalidBaseTypes)) continue; + if (!itemHelper.IsValidItem(item.Id, ragfairItemInvalidBaseTypes)) + { + continue; + } // Skip seasonal items when not in-season if ( @@ -100,11 +110,15 @@ public class RagfairAssortGenerator( !seasonalEventActive && seasonalItemTplBlacklist.Contains(item.Id) ) + { continue; + } if (processedArmorItems.Contains(item.Id)) // Already processed + { continue; + } var ragfairAssort = CreateRagfairAssortRootItem( item.Id, @@ -138,14 +152,21 @@ public class RagfairAssortGenerator( protected Item CreateRagfairAssortRootItem(string tplId, string? id = null) { if (string.IsNullOrEmpty(id)) + { id = hashUtil.Generate(); - return new Item() + } + + return new Item { Id = id, Template = tplId, ParentId = "hideout", SlotId = "hideout", - Upd = new Upd() { StackObjectsCount = 99999999, UnlimitedCount = true } + Upd = new Upd + { + StackObjectsCount = 99999999, + UnlimitedCount = true + } }; } } diff --git a/Libraries/Core/Generators/RagfairOfferGenerator.cs b/Libraries/Core/Generators/RagfairOfferGenerator.cs index a9999746..f4f54950 100644 --- a/Libraries/Core/Generators/RagfairOfferGenerator.cs +++ b/Libraries/Core/Generators/RagfairOfferGenerator.cs @@ -1,7 +1,5 @@ using System.Diagnostics; -using System.Runtime.InteropServices.JavaScript; using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Ragfair; using Core.Models.Enums; @@ -12,9 +10,8 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; -using Server; +using SptCommon.Annotations; using SptCommon.Extensions; -using Core.Models.Eft.Player; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Generators; @@ -43,13 +40,16 @@ public class RagfairOfferGenerator( ICloner cloner ) { + protected List? allowedFleaPriceItemsForBarter; + protected BotConfig botConfig = configServer.GetConfig(); + + /** + * Internal counter to ensure each offer created has a unique value for its intId property + */ + protected int offerCounter; + protected RagfairConfig ragfairConfig = configServer.GetConfig(); protected TraderConfig traderConfig = configServer.GetConfig(); - protected BotConfig botConfig = configServer.GetConfig(); - protected List? allowedFleaPriceItemsForBarter; - - /** Internal counter to ensure each offer created has a unique value for its intId property */ - protected int offerCounter = 0; /** * Create a flea offer and store it in the Ragfair server offers array @@ -98,12 +98,12 @@ public class RagfairOfferGenerator( var isTrader = ragfairServerHelper.IsTrader(userID); var offerRequirements = barterScheme.Select( - (barter) => + barter => { var offerRequirement = new OfferRequirement { Template = barter.Template, - Count = Math.Round((double)barter.Count, 2), + Count = Math.Round((double) barter.Count, 2), OnlyFunctional = barter.OnlyFunctional ?? false }; @@ -126,9 +126,11 @@ public class RagfairOfferGenerator( // Hydrate ammo boxes with cartridges + ensure only 1 item is present (ammo box) // On offer refresh don't re-add cartridges to ammo box that already has cartridges if (itemHelper.IsOfBaseclass(itemsClone[0].Template, BaseClasses.AMMO_BOX) && itemsClone.Count == 1) + { itemHelper.AddCartridgesToAmmoBox(itemsClone, itemHelper.GetItem(items[0].Template).Value); + } - var roubleListingPrice = Math.Round((double)ConvertOfferRequirementsIntoRoubles(offerRequirements)); + var roubleListingPrice = Math.Round((double) ConvertOfferRequirementsIntoRoubles(offerRequirements)); var singleItemListingPrice = isPackOffer ? roubleListingPrice / itemStackCount : roubleListingPrice; var offer = new RagfairOffer @@ -164,11 +166,13 @@ public class RagfairOfferGenerator( { // Trader offer if (isTrader) - return new RagfairOfferUser() + { + return new RagfairOfferUser { Id = userID, MemberType = MemberCategory.Trader }; + } var isPlayerOffer = profileHelper.IsPlayer(userID); if (isPlayerOffer) @@ -188,14 +192,14 @@ public class RagfairOfferGenerator( } // Fake pmc offer - return new RagfairOfferUser() + return new RagfairOfferUser { Id = userID, MemberType = MemberCategory.Default, Nickname = botHelper.GetPmcNicknameOfMaxLength(botConfig.BotNameLengthLimit), Rating = randomUtil.GetDouble( - (double)ragfairConfig.Dynamic.Rating.Min, - (double)ragfairConfig.Dynamic.Rating.Max + (double) ragfairConfig.Dynamic.Rating.Min, + (double) ragfairConfig.Dynamic.Rating.Max ), IsRatingGrowing = randomUtil.GetBool(), Avatar = null, @@ -212,9 +216,11 @@ public class RagfairOfferGenerator( { var roublePrice = 0; foreach (var requirement in offerRequirements) - roublePrice += (int)(paymentHelper.IsMoneyTpl(requirement.Template) - ? Math.Round((double)CalculateRoublePrice((int)requirement.Count, requirement.Template)) + { + roublePrice += (int) (paymentHelper.IsMoneyTpl(requirement.Template) + ? Math.Round((double) CalculateRoublePrice((int) requirement.Count, requirement.Template)) : ragfairPriceService.GetFleaPriceForItem(requirement.Template) * requirement.Count); // get flea price for barter offer items + } return roublePrice; } @@ -227,7 +233,10 @@ public class RagfairOfferGenerator( */ protected string GetAvatarUrl(bool isTrader, string userId) { - if (isTrader) return databaseService.GetTrader(userId).Base.Avatar; + if (isTrader) + { + return databaseService.GetTrader(userId).Base.Avatar; + } return "/files/trader/avatar/unknown.jpg"; } @@ -240,7 +249,10 @@ public class RagfairOfferGenerator( */ protected int CalculateRoublePrice(int currencyCount, string currencyType) { - if (currencyType == Money.ROUBLES) return currencyCount; + if (currencyType == Money.ROUBLES) + { + return currencyCount; + } return handbookHelper.InRUB(currencyCount, currencyType); } @@ -252,7 +264,10 @@ public class RagfairOfferGenerator( */ protected string GetTraderId(string userId) { - if (profileHelper.IsPlayer(userId)) return saveServer.GetProfile(userId).CharacterData.PmcData.Id; + if (profileHelper.IsPlayer(userId)) + { + return saveServer.GetProfile(userId).CharacterData.PmcData.Id; + } return userId; } @@ -266,14 +281,18 @@ public class RagfairOfferGenerator( { if (profileHelper.IsPlayer(userId)) // Player offer + { return saveServer.GetProfile(userId).CharacterData?.PmcData?.RagfairInfo?.Rating; + } if (ragfairServerHelper.IsTrader(userId)) // Trader offer + { return 1; + } // Generated pmc offer - return randomUtil.GetDouble((double)ragfairConfig.Dynamic.Rating.Min, (double)ragfairConfig.Dynamic.Rating.Max); + return randomUtil.GetDouble((double) ragfairConfig.Dynamic.Rating.Min, (double) ragfairConfig.Dynamic.Rating.Max); } /** @@ -285,11 +304,15 @@ public class RagfairOfferGenerator( { if (profileHelper.IsPlayer(userID)) // player offer + { return saveServer.GetProfile(userID).CharacterData?.PmcData?.RagfairInfo?.IsRatingGrowing ?? false; + } if (ragfairServerHelper.IsTrader(userID)) // trader offer + { return true; + } // generated offer // 50/50 growing/falling @@ -308,15 +331,18 @@ public class RagfairOfferGenerator( { // Player offer = current time + offerDurationTimeInHour; var offerDurationTimeHours = databaseService.GetGlobals().Configuration.RagFair.OfferDurationTimeInHour; - return (long)(timeUtil.GetTimeStamp() + Math.Round((double)offerDurationTimeHours * TimeUtil.OneHourAsSeconds)); + return (long) (timeUtil.GetTimeStamp() + Math.Round((double) offerDurationTimeHours * TimeUtil.OneHourAsSeconds)); } if (ragfairServerHelper.IsTrader(userID)) // Trader offer - return (long)databaseService.GetTrader(userID).Base.NextResupply; + { + return (long) databaseService.GetTrader(userID).Base.NextResupply; + } // Generated fake-player offer - return (long)Math.Round(time + randomUtil.GetDouble(ragfairConfig.Dynamic.EndTimeSeconds.Min.Value, ragfairConfig.Dynamic.EndTimeSeconds.Max.Value) + return (long) Math.Round( + time + randomUtil.GetDouble(ragfairConfig.Dynamic.EndTimeSeconds.Min.Value, ragfairConfig.Dynamic.EndTimeSeconds.Max.Value) ); } @@ -334,18 +360,31 @@ public class RagfairOfferGenerator( ? expiredOffers ?? [] : ragfairAssortGenerator.GetAssortItems(); stopwatch.Stop(); - if (logger.IsLogEnabled(LogLevel.Debug)) logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to GetRagfairAssorts"); + if (logger.IsLogEnabled(LogLevel.Debug)) + { + logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to GetRagfairAssorts"); + } + stopwatch.Restart(); var tasks = new List(); foreach (var assortItem in assortItemsToProcess) + { tasks.Add( Task.Factory.StartNew( - () => { CreateOffersFromAssort(assortItem, replacingExpiredOffers, ragfairConfig.Dynamic); } + () => + { + CreateOffersFromAssort(assortItem, replacingExpiredOffers, ragfairConfig.Dynamic); + } ) ); + } + Task.WaitAll(tasks.ToArray()); stopwatch.Stop(); - if (logger.IsLogEnabled(LogLevel.Debug)) logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to CreateOffersFromAssort"); + if (logger.IsLogEnabled(LogLevel.Debug)) + { + logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to CreateOffersFromAssort"); + } } /** @@ -363,11 +402,16 @@ public class RagfairOfferGenerator( var isPreset = presetHelper.IsPreset(assortItemWithChildren[0].Upd.SptPresetId); // Only perform checks on newly generated items, skip expired items being refreshed - if (!(isExpiredOffer || ragfairServerHelper.IsItemValidRagfairItem(itemToSellDetails))) return; + if (!(isExpiredOffer || ragfairServerHelper.IsItemValidRagfairItem(itemToSellDetails))) + { + return; + } // Armor presets can hold plates above the allowed flea level, remove if necessary if (isPreset && ragfairConfig.Dynamic.Blacklist.EnableBsgList) + { RemoveBannedPlatesFromPreset(assortItemWithChildren, ragfairConfig.Dynamic.Blacklist.ArmorPlate); + } // Get number of offers to create // Limit to 1 offer when processing expired - like-for-like replacement @@ -408,18 +452,25 @@ public class RagfairOfferGenerator( { if (!itemHelper.ArmorItemCanHoldMods(presetWithChildren[0].Template)) // Cant hold armor inserts, skip + { return false; + } - var plateSlots = presetWithChildren.Where((item) => itemHelper.GetRemovablePlateSlotIds().Contains(item.SlotId?.ToLower())).ToList(); + var plateSlots = presetWithChildren.Where(item => itemHelper.GetRemovablePlateSlotIds().Contains(item.SlotId?.ToLower())).ToList(); if (plateSlots.Count == 0) // Has no plate slots e.g. "front_plate", exit + { return false; + } var removedPlate = false; foreach (var plateSlot in plateSlots) { var plateDetails = itemHelper.GetItem(plateSlot.Template).Value; - if (plateSettings.IgnoreSlots.Contains(plateSlot.SlotId.ToLower())) continue; + if (plateSettings.IgnoreSlots.Contains(plateSlot.SlotId.ToLower())) + { + continue; + } var plateArmorLevel = plateDetails.Properties.ArmorClass ?? 0; if (plateArmorLevel > plateSettings.MaxProtectionLevel) @@ -472,14 +523,17 @@ public class RagfairOfferGenerator( if (shouldRemovePlates && itemHelper.ArmorItemHasRemovablePlateSlots(itemWithChildren[0].Template)) { var offerItemPlatesToRemove = itemWithChildren.Where( - (item) => + 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 var indexesToRemove = offerItemPlatesToRemove.Select(plateItem => itemWithChildren.IndexOf(plateItem)) .ToList(); - foreach (var index in indexesToRemove.OrderByDescending(x => x)) itemWithChildren.RemoveAt(index); + foreach (var index in indexesToRemove.OrderByDescending(x => x)) + { + itemWithChildren.RemoveAt(index); + } } } @@ -501,7 +555,10 @@ public class RagfairOfferGenerator( // Apply randomised properties RandomiseOfferItemUpdProperties(sellerId, itemWithChildren, itemToSellDetails); barterScheme = CreateBarterBarterScheme(itemWithChildren, ragfairConfig.Dynamic.Barter); - if (ragfairConfig.Dynamic.Barter.MakeSingleStackOnly) itemWithChildren[0].Upd.StackObjectsCount = 1; + if (ragfairConfig.Dynamic.Barter.MakeSingleStackOnly) + { + itemWithChildren[0].Upd.StackObjectsCount = 1; + } } else { @@ -551,7 +608,9 @@ public class RagfairOfferGenerator( // We only want to process 'base/root' items, no children if (item.SlotId != "hideout") // skip mod items + { continue; + } // Run blacklist check on trader offers if (blacklist.TraderItems) @@ -564,7 +623,10 @@ public class RagfairOfferGenerator( } // Don't include items that BSG has blacklisted from flea - if (blacklist.EnableBsgList && !(itemDetails.Value?.Properties?.CanSellOnRagfair ?? false)) continue; + if (blacklist.EnableBsgList && !(itemDetails.Value?.Properties?.CanSellOnRagfair ?? false)) + { + continue; + } } var isPreset = presetHelper.IsPreset(item.Id); @@ -577,7 +639,12 @@ public class RagfairOfferGenerator( logger.Warning( localisationService.GetText( "ragfair-missing_barter_scheme", - new { itemId = item.Id, tpl = item.Template, name = trader.Base.Nickname } + new + { + itemId = item.Id, + tpl = item.Template, + name = trader.Base.Nickname + } ) ); continue; @@ -586,7 +653,7 @@ public class RagfairOfferGenerator( var barterSchemeItems = assortsClone.BarterScheme[item.Id][0]; var loyalLevel = assortsClone.LoyalLevelItems[item.Id]; - var offer = CreateAndAddFleaOffer(traderID, time, items, barterSchemeItems, loyalLevel, false); + var offer = CreateAndAddFleaOffer(traderID, time, items, barterSchemeItems, loyalLevel); // Refresh complete, reset flag to false trader.Base.RefreshTraderRagfairOffers = false; @@ -610,11 +677,15 @@ public class RagfairOfferGenerator( var parentId = GetDynamicConditionIdForTpl(itemDetails.Id); if (string.IsNullOrEmpty(parentId)) // No condition details found, don't proceed with modifying item conditions + { return; + } // Roll random chance to randomise item condition if (randomUtil.GetChance100(ragfairConfig.Dynamic.Condition[parentId].ConditionChance * 100)) + { RandomiseItemCondition(parentId, itemWithMods, itemDetails); + } } } @@ -628,8 +699,12 @@ public class RagfairOfferGenerator( // Get keys from condition config dictionary var configConditions = ragfairConfig.Dynamic.Condition.Keys; foreach (var baseClass in configConditions) + { if (itemHelper.IsOfBaseclass(tpl, baseClass)) + { return baseClass; + } + } return null; } @@ -649,10 +724,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((double) itemConditionValues.Max.Min, (double) itemConditionValues.Max.Min); var currentMultiplier = randomUtil.GetDouble( - (double)itemConditionValues.Current.Min, - (double)itemConditionValues.Current.Max + (double) itemConditionValues.Current.Min, + (double) itemConditionValues.Current.Max ); // Randomise armor + plates + armor related things @@ -663,12 +738,15 @@ public class RagfairOfferGenerator( RandomiseArmorDurabilityValues(itemWithMods, currentMultiplier, maxMultiplier); // Add hits to visor - var visorMod = itemWithMods.FirstOrDefault((item) => item.ParentId == BaseClasses.ARMORED_EQUIPMENT && item.SlotId == "mod_equipment_000"); + var visorMod = itemWithMods.FirstOrDefault(item => item.ParentId == BaseClasses.ARMORED_EQUIPMENT && item.SlotId == "mod_equipment_000"); if (randomUtil.GetChance100(25) && visorMod != null) { itemHelper.AddUpdObjectToItem(visorMod); - visorMod.Upd.FaceShield = new UpdFaceShield() { Hits = randomUtil.GetInt(1, 3) }; + visorMod.Upd.FaceShield = new UpdFaceShield + { + Hits = randomUtil.GetInt(1, 3) + }; } return; @@ -685,7 +763,7 @@ public class RagfairOfferGenerator( if (rootItem.Upd?.MedKit != null) { // Randomize health - var hpResource = Math.Round((double)rootItem.Upd.MedKit.HpResource * maxMultiplier); + var hpResource = Math.Round((double) rootItem.Upd.MedKit.HpResource * maxMultiplier); rootItem.Upd.MedKit.HpResource = hpResource == 0D ? 1D : hpResource; return; } @@ -693,14 +771,14 @@ public class RagfairOfferGenerator( if (rootItem.Upd?.Key != null && itemDetails.Properties.MaximumNumberOfUsage > 1) { // Randomize key uses - rootItem.Upd.Key.NumberOfUsages = (int?)Math.Round(itemDetails.Properties.MaximumNumberOfUsage.Value * (1 - maxMultiplier)); + rootItem.Upd.Key.NumberOfUsages = (int?) Math.Round(itemDetails.Properties.MaximumNumberOfUsage.Value * (1 - maxMultiplier)); return; } if (rootItem.Upd?.FoodDrink != null) { // randomize food/drink value - var hpPercent = Math.Round((double)itemDetails.Properties.MaxResource * maxMultiplier); + var hpPercent = Math.Round((double) itemDetails.Properties.MaxResource * maxMultiplier); rootItem.Upd.FoodDrink.HpPercent = hpPercent == 0D ? 1D : hpPercent; return; @@ -709,7 +787,7 @@ public class RagfairOfferGenerator( if (rootItem.Upd?.RepairKit != null) { // randomize repair kit (armor/weapon) uses - var resource = Math.Round((double)itemDetails.Properties.MaxRepairResource * maxMultiplier); + var resource = Math.Round((double) itemDetails.Properties.MaxRepairResource * maxMultiplier); rootItem.Upd.RepairKit.Resource = resource == 0D ? 1D : resource; return; @@ -718,9 +796,12 @@ public class RagfairOfferGenerator( if (itemHelper.IsOfBaseclass(itemDetails.Id, BaseClasses.FUEL)) { var totalCapacity = itemDetails.Properties.MaxResource; - var remainingFuel = Math.Round((double)totalCapacity * maxMultiplier); - rootItem.Upd.Resource = new UpdResource() - { UnitsConsumed = totalCapacity - remainingFuel, Value = remainingFuel }; + var remainingFuel = Math.Round((double) totalCapacity * maxMultiplier); + rootItem.Upd.Resource = new UpdResource + { + UnitsConsumed = totalCapacity - remainingFuel, + Value = remainingFuel + }; } } @@ -741,7 +822,7 @@ public class RagfairOfferGenerator( // Max var baseMaxDurability = itemDbDetails.Properties.MaxDurability; var lowestMaxDurability = randomUtil.GetDouble(maxMultiplier, 1) * baseMaxDurability; - var chosenMaxDurability = Math.Round(randomUtil.GetDouble((double)lowestMaxDurability, (double)baseMaxDurability)); + var chosenMaxDurability = Math.Round(randomUtil.GetDouble((double) lowestMaxDurability, (double) baseMaxDurability)); // Current var lowestCurrentDurability = randomUtil.GetDouble(currentMultiplier, 1) * chosenMaxDurability; @@ -772,12 +853,12 @@ public class RagfairOfferGenerator( var baseMaxDurability = itemDbDetails.Properties.MaxDurability; var lowestMaxDurability = randomUtil.GetDouble(maxMultiplier, 1) * baseMaxDurability; - var chosenMaxDurability = Math.Round(randomUtil.GetDouble((double)lowestMaxDurability, (double)baseMaxDurability)); + var chosenMaxDurability = Math.Round(randomUtil.GetDouble((double) lowestMaxDurability, (double) baseMaxDurability)); var lowestCurrentDurability = randomUtil.GetDouble(currentMultiplier, 1) * chosenMaxDurability; var chosenCurrentDurability = Math.Round(randomUtil.GetDouble(lowestCurrentDurability, chosenMaxDurability)); - armorItem.Upd.Repairable = new UpdRepairable() + armorItem.Upd.Repairable = new UpdRepairable { Durability = chosenCurrentDurability == 0D ? 1D : chosenCurrentDurability, // Never var value become 0 MaxDurability = chosenMaxDurability @@ -803,22 +884,31 @@ public class RagfairOfferGenerator( if (isRepairable && props.Durability > 0) { - item.Upd.Repairable = new UpdRepairable() - { Durability = props.Durability, MaxDurability = props.Durability }; + item.Upd.Repairable = new UpdRepairable + { + Durability = props.Durability, + MaxDurability = props.Durability + }; return; } if (isMedkit && props.MaxHpResource > 0) { - item.Upd.MedKit = new UpdMedKit() { HpResource = props.MaxHpResource }; + item.Upd.MedKit = new UpdMedKit + { + HpResource = props.MaxHpResource + }; return; } if (isKey) { - item.Upd.Key = new UpdKey() { NumberOfUsages = 0 }; + item.Upd.Key = new UpdKey + { + NumberOfUsages = 0 + }; return; } @@ -826,12 +916,21 @@ public class RagfairOfferGenerator( // Food/drink if (isConsumable) { - item.Upd.FoodDrink = new UpdFoodDrink() { HpPercent = props.MaxResource }; + item.Upd.FoodDrink = new UpdFoodDrink + { + HpPercent = props.MaxResource + }; return; } - if (isRepairKit) item.Upd.RepairKit = new UpdRepairKit() { Resource = props.MaxRepairResource }; + if (isRepairKit) + { + item.Upd.RepairKit = new UpdRepairKit + { + Resource = props.MaxRepairResource + }; + } } /** @@ -850,7 +949,10 @@ public class RagfairOfferGenerator( ); // Dont make items under a designated rouble value into barter offers - if (priceOfOfferItem < barterConfig.MinRoubleCostToBecomeBarter) return CreateCurrencyBarterScheme(offerItems, false); + if (priceOfOfferItem < barterConfig.MinRoubleCostToBecomeBarter) + { + return CreateCurrencyBarterScheme(offerItems, false); + } // Get a randomised number of barter items to list offer for var barterItemCount = randomUtil.GetInt(barterConfig.ItemCountMin, barterConfig.ItemCountMax); @@ -874,12 +976,22 @@ public class RagfairOfferGenerator( .ToList(); // No items on flea have a matching price, fall back to currency - if (itemsInsidePriceBounds.Count == 0) return CreateCurrencyBarterScheme(offerItems, false); + if (itemsInsidePriceBounds.Count == 0) + { + return CreateCurrencyBarterScheme(offerItems, false); + } // Choose random item from price-filtered flea items var randomItem = randomUtil.GetArrayValue(itemsInsidePriceBounds); - return [new BarterScheme() { Count = barterItemCount, Template = randomItem.Tpl }]; + return + [ + new BarterScheme + { + Count = barterItemCount, + Template = randomItem.Tpl + } + ]; } /** @@ -895,7 +1007,13 @@ public class RagfairOfferGenerator( // Only get prices for items that also exist in items.json var filteredFleaItems = fleaPrices - .Select(kvTpl => new TplWithFleaPrice { Tpl = kvTpl.Key, Price = kvTpl.Value }) + .Select( + kvTpl => new TplWithFleaPrice + { + Tpl = kvTpl.Key, + Price = kvTpl.Value + } + ) .Where(item => itemHelper.GetItem(item.Tpl).Key); var itemTypeBlacklist = ragfairConfig.Dynamic.Barter.ItemTypeBlacklist; @@ -921,6 +1039,13 @@ public class RagfairOfferGenerator( var currency = ragfairServerHelper.GetDynamicOfferCurrency(); var price = ragfairPriceService.GetDynamicOfferPriceForOffer(offerWithChildren, currency, isPackOffer) * multipler; - return [new BarterScheme() { Count = price, Template = currency }]; + return + [ + new BarterScheme + { + Count = price, + Template = currency + } + ]; } } diff --git a/Libraries/Core/Generators/RepeatableQuestGenerator.cs b/Libraries/Core/Generators/RepeatableQuestGenerator.cs index 377b2a0a..fc3728d0 100644 --- a/Libraries/Core/Generators/RepeatableQuestGenerator.cs +++ b/Libraries/Core/Generators/RepeatableQuestGenerator.cs @@ -12,7 +12,6 @@ using Core.Utils.Cloners; using Core.Utils.Collections; using Core.Utils.Json; using SptCommon.Annotations; -using SptCommon.Extensions; namespace Core.Generators; @@ -31,8 +30,8 @@ public class RepeatableQuestGenerator( ICloner _cloner ) { - protected QuestConfig _questConfig = _configServer.GetConfig(); protected int _maxRandomNumberAttempts = 6; + protected QuestConfig _questConfig = _configServer.GetConfig(); /// /// This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see @@ -186,7 +185,8 @@ public class RepeatableQuestGenerator( // Filter locations bot can be killed on to just those not chosen by key possibleLocationPool.Locations = possibleLocationPool.Locations - .Where(location => location != locationKey).ToList(); + .Where(location => location != locationKey) + .ToList(); // None left after filtering if (possibleLocationPool.Locations.Count == 0) @@ -195,7 +195,6 @@ public class RepeatableQuestGenerator( // Remove chosen bot to eliminate from pool questTypePool.Pool.Elimination.Targets.Remove(botTypeToEliminate); } - } else { @@ -237,7 +236,13 @@ public class RepeatableQuestGenerator( .GetDictionary() .Select(x => x.Value) .Where(x => x.Base?.Id != null) - .Select(x => new { x.Base.Id, BossSpawn = x.Base.BossLocationSpawn }); + .Select( + x => new + { + x.Base.Id, + BossSpawn = x.Base.BossLocationSpawn + } + ); // filter for the current boss to spawn on map var thisBossSpawns = bossSpawns .Select( @@ -258,15 +263,15 @@ public class RepeatableQuestGenerator( if (eliminationConfig.DistanceProbability > rand.NextDouble() && isDistanceRequirementAllowed) { // Random distance with lower values more likely; simple distribution for starters... - distance = (int)Math.Floor( + distance = (int) Math.Floor( Math.Abs(rand.NextDouble() - rand.NextDouble()) * (1 + eliminationConfig.MaxDistance - eliminationConfig.MinDistance) + eliminationConfig.MinDistance ?? 0 ); - distance = (int)Math.Ceiling((decimal)(distance / 5)) * 5; - distanceDifficulty = (int)(maxDistDifficulty * distance / eliminationConfig.MaxDistance); + distance = (int) Math.Ceiling((decimal) (distance / 5)) * 5; + distanceDifficulty = (int) (maxDistDifficulty * distance / eliminationConfig.MaxDistance); } string? allowedWeaponsCategory = null; @@ -277,7 +282,7 @@ public class RepeatableQuestGenerator( { List weaponTypeBlacklist = ["Shotgun", "Pistol"]; weaponCategoryRequirementConfig = - (ProbabilityObjectArray>)weaponCategoryRequirementConfig + (ProbabilityObjectArray>) weaponCategoryRequirementConfig .Where( category => weaponTypeBlacklist .Contains(category.Key) @@ -288,7 +293,7 @@ public class RepeatableQuestGenerator( List weaponTypeBlacklist = ["MarksmanRifle", "DMR"]; // Filter out far range weapons from close distance requirement weaponCategoryRequirementConfig = - (ProbabilityObjectArray>)weaponCategoryRequirementConfig + (ProbabilityObjectArray>) weaponCategoryRequirementConfig .Where( category => weaponTypeBlacklist .Contains(category.Key) @@ -335,7 +340,10 @@ public class RepeatableQuestGenerator( var quest = GenerateRepeatableTemplate("Elimination", traderId, repeatableConfig.Side, sessionId); // ASSUMPTION: All fence quests are for scavs - if (traderId == Traders.FENCE) quest.Side = "Scav"; + if (traderId == Traders.FENCE) + { + quest.Side = "Scav"; + } var availableForFinishCondition = quest.Conditions.AvailableForFinish[0]; availableForFinishCondition.Counter.Id = _hashUtil.Generate(); @@ -387,10 +395,14 @@ public class RepeatableQuestGenerator( EliminationConfig eliminationConfig) { if (targetsConfig.Data(targetKey).IsBoss.GetValueOrDefault(false)) + { return _randomUtil.RandInt(eliminationConfig.MinBossKills.Value, eliminationConfig.MaxBossKills + 1); + } if (targetsConfig.Data(targetKey).IsPmc.GetValueOrDefault(false)) + { return _randomUtil.RandInt(eliminationConfig.MinPmcKills.Value, eliminationConfig.MaxPmcKills + 1); + } return _randomUtil.RandInt(eliminationConfig.MinKills.Value, eliminationConfig.MaxKills + 1); } @@ -448,7 +460,11 @@ public class RepeatableQuestGenerator( Value = 1, ResetOnSessionEnd = false, EnemyHealthEffects = [], - Daytime = new DaytimeCounter { From = 0, To = 0 }, + Daytime = new DaytimeCounter + { + From = 0, + To = 0 + }, ConditionType = "Kills" }; @@ -459,14 +475,26 @@ public class RepeatableQuestGenerator( } // Has specific body part hit condition - if (targetedBodyParts is not null) killConditionProps.BodyPart = targetedBodyParts; + if (targetedBodyParts is not null) + { + killConditionProps.BodyPart = targetedBodyParts; + } // Don't allow distance + melee requirement if (distance is not null && allowedWeaponCategory != "5b5f7a0886f77409407a7f96") - killConditionProps.Distance = new CounterConditionDistance { CompareMethod = ">=", Value = distance.Value }; + { + killConditionProps.Distance = new CounterConditionDistance + { + CompareMethod = ">=", + Value = distance.Value + }; + } // Has specific weapon requirement - if (allowedWeapon is not null) killConditionProps.Weapon = [allowedWeapon]; + if (allowedWeapon is not null) + { + killConditionProps.Weapon = [allowedWeapon]; + } // Has specific weapon category requirement if (allowedWeaponCategory?.Length > 0) @@ -510,7 +538,7 @@ public class RepeatableQuestGenerator( // Be fair, don't var the items be more expensive than the reward var multi = _randomUtil.GetDouble(0.5, 1); var roublesBudget = Math.Floor( - (double)(_mathUtil.Interp1(pmcLevel, levelsConfig, roublesConfig) * multi) + (double) (_mathUtil.Interp1(pmcLevel, levelsConfig, roublesConfig) * multi) ); roublesBudget = Math.Max(roublesBudget, 5000d); var itemSelection = possibleItemsToRetrievePool.Where( @@ -587,6 +615,7 @@ public class RepeatableQuestGenerator( var found = false; for (var j = 0; j < _maxRandomNumberAttempts; j++) + { if (usedItemIndexes.Contains(chosenItemIndex)) { chosenItemIndex = _randomUtil.RandInt(itemSelection.Count); @@ -596,6 +625,7 @@ public class RepeatableQuestGenerator( found = true; break; } + } if (!found) { @@ -604,7 +634,8 @@ public class RepeatableQuestGenerator( "repeatable-no_reward_item_found_in_price_range", new { - minPrice = 0, roublesBudget + minPrice = 0, + roublesBudget } ) ); @@ -637,12 +668,14 @@ public class RepeatableQuestGenerator( var value = minValue; // Get the value range within budget - var x = (int)Math.Floor(roublesBudget / itemUnitPrice); + var x = (int) Math.Floor(roublesBudget / itemUnitPrice); maxValue = Math.Min(maxValue, x); if (maxValue > minValue) // If it doesn't blow the budget we have for the request, draw a random amount of the selected // Item type to be requested + { value = _randomUtil.RandInt(minValue, maxValue + 1); + } roublesBudget -= value * itemUnitPrice; @@ -655,7 +688,10 @@ public class RepeatableQuestGenerator( // Reduce the list possible items to fulfill the new budget constraint itemSelection = itemSelection.Where(dbItem => _itemHelper.GetItemPrice(dbItem.Id) < roublesBudget) .ToList(); - if (!itemSelection.Any()) break; + if (!itemSelection.Any()) + { + break; + } } else { @@ -692,10 +728,15 @@ public class RepeatableQuestGenerator( _itemHelper.IsOfBaseclass(itemTpl, BaseClasses.WEAPON) || _itemHelper.IsOfBaseclass(itemTpl, BaseClasses.ARMOR) ) + { minDurability = _randomUtil.GetArrayValue([60, 80]); + } // By default all collected items must be FiR, except dog tags - if (_itemHelper.IsDogtag(itemTpl)) onlyFoundInRaid = false; + if (_itemHelper.IsDogtag(itemTpl)) + { + onlyFoundInRaid = false; + } return new QuestCondition { diff --git a/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs b/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs index 8107b376..d4022c46 100644 --- a/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs +++ b/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs @@ -43,12 +43,12 @@ public class RepeatableQuestRewardGenerator( * - 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 * @param pmcLevel Level of player reward is being generated for * @param difficulty Reward scaling factor from 0.2 to 1 @@ -73,7 +73,12 @@ public class RepeatableQuestRewardGenerator( var itemRewardBudget = rewardParams.RewardRoubles; // Possible improvement -> draw trader-specific items e.g. with _itemHelper.isOfBaseclass(val._id, ItemHelper.BASECLASS.FoodDrink) - QuestRewards rewards = new() { Started = [], Success = [], Fail = [] }; + QuestRewards rewards = new() + { + Started = [], + Success = [], + Fail = [] + }; // Start reward index to keep track var rewardIndex = -1; @@ -130,14 +135,20 @@ public class RepeatableQuestRewardGenerator( var filteredRewardItemPool = inBudgetRewardItemPool.Where( item => !rewardTplBlacklist.Contains(item.Id) ); - if (filteredRewardItemPool.Count() > 0) inBudgetRewardItemPool = filteredRewardItemPool.ToList(); + if (filteredRewardItemPool.Count() > 0) + { + inBudgetRewardItemPool = filteredRewardItemPool.ToList(); + } } if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Generating: {repeatableConfig.Name} quest for: {traderId} with budget: {itemRewardBudget} totalling: {rewardParams.RewardNumItems} items" ); + } + if (inBudgetRewardItemPool.Count > 0) { var itemsToReward = GetRewardableItemsFromPoolWithinBudget( @@ -172,11 +183,14 @@ public class RepeatableQuestRewardGenerator( rewards.Success.Add(reward); rewardIndex++; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Adding: {rewardParams.RewardReputation} {traderId} trader reputation reward"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Adding: {rewardParams.RewardReputation} {traderId} trader reputation reward"); + } } // Chance of adding skill reward - if (_randomUtil.GetChance100((double)rewardParams.SkillRewardChance * 100)) + if (_randomUtil.GetChance100((double) rewardParams.SkillRewardChance * 100)) { var targetSkill = _randomUtil.GetArrayValue(eliminationConfig.PossibleSkillRewards); Reward reward = new() @@ -192,7 +206,10 @@ public class RepeatableQuestRewardGenerator( }; rewards.Success.Add(reward); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Adding {rewardParams.SkillPointReward} skill points to {targetSkill}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Adding {rewardParams.SkillPointReward} skill points to {targetSkill}"); + } } return rewards; @@ -212,7 +229,10 @@ public class RepeatableQuestRewardGenerator( var reputationConfig = rewardScaling.Reputation; var effectiveDifficulty = difficulty is null ? 1 : difficulty; - if (difficulty is null) _logger.Warning(_localisationService.GetText("repeatable-difficulty_was_nan")); + if (difficulty is null) + { + _logger.Warning(_localisationService.GetText("repeatable-difficulty_was_nan")); + } return new QuestRewardValues { @@ -250,7 +270,7 @@ public class RepeatableQuestRewardGenerator( return Math.Floor( effectiveDifficulty * _mathUtil.Interp1(pmcLevel, levelsConfig, xpConfig) * - _randomUtil.GetDouble((double)(1 - rewardSpreadConfig), (double)(1 + rewardSpreadConfig)) ?? + _randomUtil.GetDouble((double) (1 - rewardSpreadConfig), (double) (1 + rewardSpreadConfig)) ?? 0 ); } @@ -262,7 +282,7 @@ public class RepeatableQuestRewardGenerator( return Math.Ceiling( effectiveDifficulty * _mathUtil.Interp1(pmcLevel, levelsConfig, gpCoinConfig) * - _randomUtil.GetDouble((double)(1 - rewardSpreadConfig), (double)(1 + rewardSpreadConfig)) ?? + _randomUtil.GetDouble((double) (1 - rewardSpreadConfig), (double) (1 + rewardSpreadConfig)) ?? 0 ); } @@ -275,7 +295,7 @@ public class RepeatableQuestRewardGenerator( 100 * effectiveDifficulty * _mathUtil.Interp1(pmcLevel, levelsConfig, reputationConfig) * - _randomUtil.GetDouble((double)(1 - rewardSpreadConfig), (double)(1 + rewardSpreadConfig)) ?? + _randomUtil.GetDouble((double) (1 - rewardSpreadConfig), (double) (1 + rewardSpreadConfig)) ?? 0 ) / 100; @@ -283,7 +303,7 @@ public class RepeatableQuestRewardGenerator( private int GetRewardNumItems(int pmcLevel, List? levelsConfig, List? itemsConfig) { - return _randomUtil.RandInt(1, (int)Math.Round(_mathUtil.Interp1(pmcLevel, levelsConfig, itemsConfig) ?? 0) + 1); + return _randomUtil.RandInt(1, (int) Math.Round(_mathUtil.Interp1(pmcLevel, levelsConfig, itemsConfig) ?? 0) + 1); } private double GetRewardRoubles(double? effectiveDifficulty, int pmcLevel, List? levelsConfig, @@ -293,7 +313,9 @@ public class RepeatableQuestRewardGenerator( return Math.Floor( effectiveDifficulty * _mathUtil.Interp1(pmcLevel, levelsConfig, roublesConfig) * - _randomUtil.GetDouble((1d - rewardSpreadConfig.Value), 1d + rewardSpreadConfig.Value) ?? 0); + _randomUtil.GetDouble(1d - rewardSpreadConfig.Value, 1d + rewardSpreadConfig.Value) ?? + 0 + ); } private Dictionary GetRewardableItemsFromPoolWithinBudget(List itemPool, @@ -309,7 +331,10 @@ public class RepeatableQuestRewardGenerator( // Get a random item var chosenItemFromPool = exhausableItemPool.GetRandomValue(); - if (!exhausableItemPool.HasValues()) break; + if (!exhausableItemPool.HasValues()) + { + break; + } // Handle edge case - ammo if (_itemHelper.IsOfBaseclass(chosenItemFromPool.Id, BaseClasses.AMMO)) @@ -332,13 +357,18 @@ public class RepeatableQuestRewardGenerator( // 25% chance to double, triple or quadruple reward stack // (Only occurs when item is stackable and not weapon, armor or ammo) if (CanIncreaseRewardItemStackSize(chosenItemFromPool, 70000, 25)) + { rewardItemStackCount = GetRandomisedRewardItemStackSizeByPrice(chosenItemFromPool); + } itemsToReturn.Add(chosenItemFromPool, rewardItemStackCount); var itemCost = _presetHelper.GetDefaultPresetOrItemPrice(chosenItemFromPool.Id); var calculatedItemRewardBudget = itemRewardBudget - rewardItemStackCount * itemCost; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Added item: {chosenItemFromPool.Id} with price: {rewardItemStackCount * itemCost}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Added item: {chosenItemFromPool.Id} with price: {rewardItemStackCount * itemCost}"); + } // If we still have budget narrow down possible items if (calculatedItemRewardBudget > 0) @@ -351,8 +381,12 @@ public class RepeatableQuestRewardGenerator( ); if (!exhausableItemPool.HasValues()) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Reward pool empty with: {calculatedItemRewardBudget} roubles of budget remaining"); + } + } } // No budget for more items, end loop @@ -385,7 +419,7 @@ public class RepeatableQuestRewardGenerator( var stackMaxCount = Math.Min(itemSelected.Properties.StackMaxSize.Value, 100); // Ensure stack size is at least 1 + is no larger than the max possible stack size - return (int)Math.Max(1, Math.Min(stackSizeThatFitsBudget, stackMaxCount)); + return (int) Math.Max(1, Math.Min(stackSizeThatFitsBudget, stackMaxCount)); } private bool CanIncreaseRewardItemStackSize(TemplateItem item, int maxRoublePriceToStack, @@ -425,7 +459,10 @@ public class RepeatableQuestRewardGenerator( // Find the appropriate price tier and return a random stack size from its options var tier = priceTiers.FirstOrDefault(tier => rewardItemPrice < tier.Item1); - if (tier is null) return 4; // Default to 2 if no tier matches + if (tier is null) + { + return 4; // Default to 2 if no tier matches + } return _randomUtil.GetArrayValue(tier.Item2); } @@ -457,7 +494,8 @@ public class RepeatableQuestRewardGenerator( "repeatable-no_reward_item_found_in_price_range", new { - minPrice, roublesBudget + minPrice, + roublesBudget } ) ); @@ -502,7 +540,10 @@ public class RepeatableQuestRewardGenerator( while (defaultPresetPool.HasValues()) { var randomPreset = defaultPresetPool.GetRandomValue(); - if (randomPreset is null) continue; + if (randomPreset is null) + { + continue; + } // Gather all tpls so we can get prices of them var tpls = randomPreset.Items.Select(item => item.Template).ToList(); @@ -526,7 +567,7 @@ public class RepeatableQuestRewardGenerator( /** * Helper to create a reward item structured as required by the client - * + * * @param {string} tpl ItemId of the rewarded item * @param {integer} count Amount of items to give * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index @@ -553,9 +594,15 @@ public class RepeatableQuestRewardGenerator( // Get presets root item var rootItem = preset.FirstOrDefault(item => item.Template == tpl); - if (rootItem is null) _logger.Warning($"Root item of preset: {tpl} not found"); + if (rootItem is null) + { + _logger.Warning($"Root item of preset: {tpl} not found"); + } - if (rootItem.Upd is not null) rootItem.Upd.SpawnedInSession = foundInRaid; + if (rootItem.Upd is not null) + { + rootItem.Upd.SpawnedInSession = foundInRaid; + } questRewardItem.Items = _itemHelper.ReparentItemAndChildren(rootItem, preset); questRewardItem.Target = rootItem.Id; // Target property and root items id must match @@ -565,7 +612,7 @@ public class RepeatableQuestRewardGenerator( /** * Helper to create a reward item structured as required by the client - * + * * @param {string} tpl ItemId of the rewarded item * @param {integer} count Amount of items to give * @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index @@ -592,7 +639,13 @@ public class RepeatableQuestRewardGenerator( var rootItem = new Item { - Id = id, Template = tpl, Upd = new Upd { StackObjectsCount = count, SpawnedInSession = foundInRaid } + Id = id, + Template = tpl, + Upd = new Upd + { + StackObjectsCount = count, + SpawnedInSession = foundInRaid + } }; questRewardItem.Items = [rootItem]; @@ -637,9 +690,15 @@ public class RepeatableQuestRewardGenerator( itemTemplate => { // Base "Item" item has no parent, ignore it - if (itemTemplate.Parent == "") return false; + if (itemTemplate.Parent == "") + { + return false; + } - if (seasonalItems.Contains(itemTemplate.Id)) return false; + if (seasonalItems.Contains(itemTemplate.Id)) + { + return false; + } var traderWhitelist = repeatableQuestConfig.TraderWhitelist.FirstOrDefault( trader => trader.TraderId == traderId @@ -665,7 +724,10 @@ public class RepeatableQuestRewardGenerator( List? itemBaseWhitelist = null) { // Return early if not valid item to give as reward - if (!_itemHelper.IsValidItem(tpl)) return false; + if (!_itemHelper.IsValidItem(tpl)) + { + return false; + } // Check item is not blacklisted if ( @@ -674,16 +736,27 @@ public class RepeatableQuestRewardGenerator( repeatableQuestConfig.RewardBlacklist.Contains(tpl) || _itemFilterService.IsItemBlacklisted(tpl) ) + { return false; + } // Item has blacklisted base types - if (_itemHelper.IsOfBaseclasses(tpl, repeatableQuestConfig.RewardBaseTypeBlacklist)) return false; + if (_itemHelper.IsOfBaseclasses(tpl, repeatableQuestConfig.RewardBaseTypeBlacklist)) + { + return false; + } // Skip boss items - if (_itemFilterService.IsBossItem(tpl)) return false; + if (_itemFilterService.IsBossItem(tpl)) + { + return false; + } // Trader has specific item base types they can give as rewards to player - if (itemBaseWhitelist is not null && !_itemHelper.IsOfBaseclasses(tpl, itemBaseWhitelist)) return false; + if (itemBaseWhitelist is not null && !_itemHelper.IsOfBaseclasses(tpl, itemBaseWhitelist)) + { + return false; + } return true; } diff --git a/Libraries/Core/Generators/ScavCaseRewardGenerator.cs b/Libraries/Core/Generators/ScavCaseRewardGenerator.cs index 368072a5..74e0d88d 100644 --- a/Libraries/Core/Generators/ScavCaseRewardGenerator.cs +++ b/Libraries/Core/Generators/ScavCaseRewardGenerator.cs @@ -1,9 +1,7 @@ using Core.Helpers; using Core.Models.Common; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Hideout; -using Core.Models.Eft.ItemEvent; using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Models.Spt.Hideout; @@ -12,6 +10,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; namespace Core.Generators; @@ -31,12 +30,12 @@ public class ScavCaseRewardGenerator( ICloner _cloner ) { - protected ScavCaseConfig _scavCaseConfig = _configServer.GetConfig(); - protected List _dbItemsCache = []; protected List _dbAmmoItemsCache = []; + protected List _dbItemsCache = []; + protected ScavCaseConfig _scavCaseConfig = _configServer.GetConfig(); /// - /// Create an array of rewards that will be given to the player upon completing their scav case build + /// Create an array of rewards that will be given to the player upon completing their scav case build /// /// recipe of the scav case craft /// Product array @@ -83,8 +82,8 @@ public class ScavCaseRewardGenerator( } /// - /// Get all db items that are not blacklisted in scavcase config or global blacklist - /// Store in class field + /// Get all db items that are not blacklisted in scavcase config or global blacklist + /// Store in class field /// protected void CacheDbItems() { @@ -93,16 +92,26 @@ public class ScavCaseRewardGenerator( // Get an array of seasonal items that should not be shown right now as seasonal event is not active var inactiveSeasonalItems = _seasonalEventService.GetInactiveSeasonalEventItems(); if (!_dbItemsCache.Any()) + { _dbItemsCache = _databaseService.GetItems() .Values.Where( item => { // Base "Item" item has no parent, ignore it - if (item.Parent == "") return false; + if (item.Parent == "") + { + return false; + } - if (item.Type == "Node") return false; + if (item.Type == "Node") + { + return false; + } - if (item.Properties.QuestItem ?? false) return false; + if (item.Properties.QuestItem ?? false) + { + return false; + } // Skip item if item id is on blacklist if ( @@ -110,62 +119,102 @@ public class ScavCaseRewardGenerator( _scavCaseConfig.RewardItemBlacklist.Contains(item.Id) || _itemFilterService.IsItemBlacklisted(item.Id) ) + { return false; + } // Globally reward-blacklisted - if (_itemFilterService.IsItemRewardBlacklisted(item.Id)) return false; + if (_itemFilterService.IsItemRewardBlacklisted(item.Id)) + { + return false; + } - if (!_scavCaseConfig.AllowBossItemsAsRewards && _itemFilterService.IsBossItem(item.Id)) return false; + if (!_scavCaseConfig.AllowBossItemsAsRewards && _itemFilterService.IsBossItem(item.Id)) + { + return false; + } // Skip item if parent id is blacklisted - if (_itemHelper.IsOfBaseclasses(item.Id, _scavCaseConfig.RewardItemParentBlacklist)) return false; + if (_itemHelper.IsOfBaseclasses(item.Id, _scavCaseConfig.RewardItemParentBlacklist)) + { + return false; + } - if (inactiveSeasonalItems.Contains(item.Id)) return false; + if (inactiveSeasonalItems.Contains(item.Id)) + { + return false; + } return true; } ) .ToList(); + } if (!_dbAmmoItemsCache.Any()) + { _dbAmmoItemsCache = _databaseService.GetItems() .Values.Where( item => { // Base "Item" item has no parent, ignore it - if (item.Parent == "") return false; + if (item.Parent == "") + { + return false; + } - if (item.Type != "Item") return false; + if (item.Type != "Item") + { + return false; + } // Not ammo, skip - if (!_itemHelper.IsOfBaseclass(item.Id, BaseClasses.AMMO)) return false; + if (!_itemHelper.IsOfBaseclass(item.Id, BaseClasses.AMMO)) + { + return false; + } // Skip item if item id is on blacklist if ( _scavCaseConfig.RewardItemBlacklist.Contains(item.Id) || _itemFilterService.IsItemBlacklisted(item.Id) ) + { return false; + } // Globally reward-blacklisted - if (_itemFilterService.IsItemRewardBlacklisted(item.Id)) return false; + if (_itemFilterService.IsItemRewardBlacklisted(item.Id)) + { + return false; + } - if (!_scavCaseConfig.AllowBossItemsAsRewards && _itemFilterService.IsBossItem(item.Id)) return false; + if (!_scavCaseConfig.AllowBossItemsAsRewards && _itemFilterService.IsBossItem(item.Id)) + { + return false; + } // Skip seasonal items - if (inactiveSeasonalItems.Contains(item.Id)) return false; + if (inactiveSeasonalItems.Contains(item.Id)) + { + return false; + } // Skip ammo that doesn't stack as high as value in config - if (item.Properties.StackMaxSize < _scavCaseConfig.AmmoRewards.MinStackSize) return false; + if (item.Properties.StackMaxSize < _scavCaseConfig.AmmoRewards.MinStackSize) + { + return false; + } return true; } ) .ToList(); + } } /// - /// Pick a number of items to be rewards, the count is defined by the values in `itemFilters` param + /// Pick a number of items to be rewards, the count is defined by the values in `itemFilters` param /// /// item pool to pick rewards from /// how the rewards should be filtered down (by item count) @@ -179,30 +228,38 @@ public class ScavCaseRewardGenerator( var rewardWasMoney = false; var rewardWasAmmo = false; - var randomCount = _randomUtil.GetInt((int)itemFilters.MinCount, (int)itemFilters.MaxCount); + var randomCount = _randomUtil.GetInt((int) itemFilters.MinCount, (int) itemFilters.MaxCount); for (var i = 0; i < randomCount; i++) + { if (RewardShouldBeMoney() && !rewardWasMoney) { // Only allow one reward to be money result.Add(GetRandomMoney()); - if (!_scavCaseConfig.AllowMultipleMoneyRewardsPerRarity) rewardWasMoney = true; + if (!_scavCaseConfig.AllowMultipleMoneyRewardsPerRarity) + { + rewardWasMoney = true; + } } else if (RewardShouldBeAmmo() && !rewardWasAmmo) { // Only allow one reward to be ammo result.Add(GetRandomAmmo(rarity)); - if (!_scavCaseConfig.AllowMultipleAmmoRewardsPerRarity) rewardWasAmmo = true; + if (!_scavCaseConfig.AllowMultipleAmmoRewardsPerRarity) + { + rewardWasAmmo = true; + } } else { result.Add(_randomUtil.GetArrayValue(items)); } + } return result; } /// - /// Choose if money should be a reward based on the moneyRewardChancePercent config chance in scavCaseConfig + /// Choose if money should be a reward based on the moneyRewardChancePercent config chance in scavCaseConfig /// /// true if reward should be money protected bool RewardShouldBeMoney() @@ -211,7 +268,7 @@ public class ScavCaseRewardGenerator( } /// - /// Choose if ammo should be a reward based on the ammoRewardChancePercent config chance in scavCaseConfig + /// Choose if ammo should be a reward based on the ammoRewardChancePercent config chance in scavCaseConfig /// /// true if reward should be ammo protected bool RewardShouldBeAmmo() @@ -220,7 +277,7 @@ public class ScavCaseRewardGenerator( } /// - /// Choose from rouble/dollar/euro at random + /// Choose from rouble/dollar/euro at random /// protected TemplateItem GetRandomMoney() { @@ -235,7 +292,7 @@ public class ScavCaseRewardGenerator( } /// - /// Get a random ammo from items.json that is not in the ammo blacklist AND inside the price range defined in scavcase.json config + /// Get a random ammo from items.json that is not in the ammo blacklist AND inside the price range defined in scavcase.json config /// /// The rarity this ammo reward is for /// random ammo item from items.json @@ -250,21 +307,26 @@ public class ScavCaseRewardGenerator( handbookPrice >= _scavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub[rarity].Min && handbookPrice <= _scavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub[rarity].Max ) + { return true; + } return false; } ); - if (!possibleAmmoPool.Any()) _logger.Warning("Unable to get a list of ammo that matches desired criteria for scav case reward"); + if (!possibleAmmoPool.Any()) + { + _logger.Warning("Unable to get a list of ammo that matches desired criteria for scav case reward"); + } // Get a random ammo and return it return _randomUtil.GetArrayValue(possibleAmmoPool); } /// - /// Take all the rewards picked create the Product object array ready to return to calling code - /// Also add a stack count to ammo and money + /// Take all the rewards picked create the Product object array ready to return to calling code + /// Also add a stack count to ammo and money /// /// items to convert /// Product array @@ -274,7 +336,15 @@ public class ScavCaseRewardGenerator( List> result = []; foreach (var rewardItemDb in rewardItems) { - List resultItem = [new() { Id = _hashUtil.Generate(), Template = rewardItemDb.Id, Upd = null }]; + List resultItem = + [ + new() + { + Id = _hashUtil.Generate(), + Template = rewardItemDb.Id, + Upd = null + } + ]; var rootItem = resultItem.FirstOrDefault(); if (_itemHelper.IsOfBaseclass(rewardItemDb.Id, BaseClasses.AMMO_BOX)) @@ -303,7 +373,10 @@ public class ScavCaseRewardGenerator( } else if (_itemHelper.IsOfBaseclasses(rewardItemDb.Id, [BaseClasses.AMMO, BaseClasses.MONEY])) { - rootItem.Upd = new Upd { StackObjectsCount = GetRandomAmountRewardForScavCase(rewardItemDb, rarity) }; + rootItem.Upd = new Upd + { + StackObjectsCount = GetRandomAmountRewardForScavCase(rewardItemDb, rarity) + }; } result.Add(resultItem); @@ -325,7 +398,10 @@ public class ScavCaseRewardGenerator( item => { var handbookPrice = _ragfairPriceService.GetStaticPriceForItem(item.Id); - if (handbookPrice >= itemFilters.MinPriceRub && handbookPrice <= itemFilters.MaxPriceRub) return true; + if (handbookPrice >= itemFilters.MinPriceRub && handbookPrice <= itemFilters.MaxPriceRub) + { + return true; + } return false; } @@ -334,7 +410,7 @@ public class ScavCaseRewardGenerator( } /// - /// Gathers the reward min and max count params for each reward quality level from config and scavcase.json into a single object + /// Gathers the reward min and max count params for each reward quality level from config and scavcase.json into a single object /// /// production.json/scavRecipes object /// ScavCaseRewardCountsAndPrices object @@ -368,7 +444,7 @@ public class ScavCaseRewardGenerator( } /// - /// Randomises the size of ammo and money stacks + /// Randomises the size of ammo and money stacks /// /// ammo or money item /// rarity (common/rare/superrare) @@ -377,31 +453,35 @@ public class ScavCaseRewardGenerator( { var amountToGive = 1; if (itemToCalculate.Parent == BaseClasses.AMMO) + { amountToGive = _randomUtil.GetInt( _scavCaseConfig.AmmoRewards.MinStackSize, itemToCalculate.Properties.StackMaxSize ?? 0 ); + } else if (itemToCalculate.Parent == BaseClasses.MONEY) + { amountToGive = itemToCalculate.Id switch { Money.ROUBLES => _randomUtil.GetInt( - (int)_scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Min, - (int)_scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Max ), Money.EUROS => _randomUtil.GetInt( - (int)_scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Min, - (int)_scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Max ), Money.DOLLARS => _randomUtil.GetInt( - (int)_scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Min, - (int)_scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Max ), Money.GP => _randomUtil.GetInt( - (int)_scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Min, - (int)_scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Max ), _ => amountToGive }; + } return amountToGive; } diff --git a/Libraries/Core/Generators/WeaponGen/IInventoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/IInventoryMagGen.cs index 8e1bf2d9..bd40493a 100644 --- a/Libraries/Core/Generators/WeaponGen/IInventoryMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/IInventoryMagGen.cs @@ -2,7 +2,7 @@ public interface IInventoryMagGen { - public abstract int GetPriority(); - public abstract bool CanHandleInventoryMagGen(InventoryMagGen inventoryMagGen); - public abstract void Process(InventoryMagGen inventoryMagGen); + public int GetPriority(); + public bool CanHandleInventoryMagGen(InventoryMagGen inventoryMagGen); + public void Process(InventoryMagGen inventoryMagGen); } diff --git a/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs index 727a7c8e..54bbf34e 100644 --- a/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/Implementations/BarrelInvetoryMagGen.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Enums; using Core.Utils; +using SptCommon.Annotations; namespace Core.Generators.WeaponGen.Implementations; @@ -27,16 +27,20 @@ public class BarrelInvetoryMagGen( double? randomisedAmmoStackSize; if (inventoryMagGen.GetAmmoTemplate().Properties.StackMaxRandom == 1) // Doesn't stack + { randomisedAmmoStackSize = _randomUtil.GetInt(3, 6); + } else + { randomisedAmmoStackSize = _randomUtil.GetInt( inventoryMagGen.GetAmmoTemplate().Properties.StackMinRandom.Value, inventoryMagGen.GetAmmoTemplate().Properties.StackMaxRandom.Value ); + } _botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots( inventoryMagGen.GetAmmoTemplate().Id, - (int)randomisedAmmoStackSize, + (int) randomisedAmmoStackSize, inventoryMagGen.GetPmcInventory(), null ); diff --git a/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs index 55520df1..bc6ab055 100644 --- a/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Utils; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Generators.WeaponGen.Implementations; @@ -61,7 +61,9 @@ public class ExternalInventoryMagGen( if (fitsIntoInventory == ItemAddedResult.NO_CONTAINERS) // No containers to fit magazines, stop trying + { break; + } // No space for magazine and we haven't reached desired magazine count if (fitsIntoInventory == ItemAddedResult.NO_SPACE && i < randomizedMagazineCount) @@ -70,7 +72,9 @@ public class ExternalInventoryMagGen( if (fitAttempts > 5) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Failed {fitAttempts} times to add magazine {magazineTpl} to bot inventory, stopping"); + } break; } @@ -81,18 +85,24 @@ public class ExternalInventoryMagGen( if (magazineTpl == defaultMagazineTpl) // We were already on default - stop here to prevent infinite loop + { break; + } // Add failed magazine tpl to blacklist attemptedMagBlacklist.Add(magazineTpl); if (defaultMagazineTpl is null) // No default to fall back to, stop trying to add mags + { break; + } if (defaultMagazineTpl == BaseClasses.MAGAZINE) // Magazine base type, do not use + { break; + } // Set chosen magazine tpl to the weapons default magazine tpl and try to fit into inventory next loop magazineTpl = defaultMagazineTpl; @@ -117,12 +127,17 @@ public class ExternalInventoryMagGen( if (result?.Id is null) { // Highly likely shotgun has no external mags - if (isShotgun) break; + if (isShotgun) + { + break; + } if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to add additional magazine into bot inventory: vest/pockets for weapon: {weapon.Name}, attempted: {fitAttempts} times. Reason: {fitsIntoInventory}" ); + } break; } @@ -138,27 +153,38 @@ public class ExternalInventoryMagGen( if (fitsIntoInventory == ItemAddedResult.SUCCESS) // Reset fit counter now it succeeded + { fitAttempts = 0; + } } } public TemplateItem? GetRandomExternalMagazineForInternalMagazineGun(string weaponTpl, List magazineBlacklist) { // The mag Slot data for the weapon - var magSlot = _itemHelper.GetItem(weaponTpl).Value.Properties.Slots.FirstOrDefault((x) => x.Name == "mod_magazine"); - if (magSlot is null) return null; + var magSlot = _itemHelper.GetItem(weaponTpl).Value.Properties.Slots.FirstOrDefault(x => x.Name == "mod_magazine"); + if (magSlot is null) + { + return null; + } // All possible mags that fit into the weapon excluding blacklisted var magazinePool = magSlot.Props.Filters[0] - .Filter.Where((x) => !magazineBlacklist.Contains(x)) + .Filter.Where(x => !magazineBlacklist.Contains(x)) .Select( - (x) => _itemHelper.GetItem(x).Value + x => _itemHelper.GetItem(x).Value ); - if (magazinePool is null) return null; + if (magazinePool is null) + { + return null; + } // Non-internal magazines that fit into the weapon - var externalMagazineOnlyPool = magazinePool.Where((x) => x.Properties.ReloadMagType != ReloadMode.InternalMagazine); - if (externalMagazineOnlyPool is null || externalMagazineOnlyPool?.Count() == 0) return null; + var externalMagazineOnlyPool = magazinePool.Where(x => x.Properties.ReloadMagType != ReloadMode.InternalMagazine); + if (externalMagazineOnlyPool is null || externalMagazineOnlyPool?.Count() == 0) + { + return null; + } // Randomly chosen external magazine return _randomUtil.GetArrayValue(externalMagazineOnlyPool); diff --git a/Libraries/Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs index fc147dc7..c95ca57c 100644 --- a/Libraries/Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/Implementations/InternalMagazineInventoryMagGen.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Generators.WeaponGen.Implementations; @@ -27,7 +27,7 @@ public class InternalMagazineInventoryMagGen( ); _botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots( inventoryMagGen.GetAmmoTemplate().Id, - (int)bulletCount, + (int) bulletCount, inventoryMagGen.GetPmcInventory(), null ); diff --git a/Libraries/Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs b/Libraries/Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs index 506a94a1..faa06bbe 100644 --- a/Libraries/Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/Implementations/UbglExternalMagGen.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Helpers; +using Core.Helpers; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Generators.WeaponGen.Implementations; @@ -27,7 +27,7 @@ public class UbglExternalMagGen( ); _botWeaponGeneratorHelper.AddAmmoIntoEquipmentSlots( inventoryMagGen.GetAmmoTemplate().Id, - (int)bulletCount, + (int) bulletCount, inventoryMagGen.GetPmcInventory(), [EquipmentSlots.TacticalVest] ); diff --git a/Libraries/Core/Generators/WeaponGen/InventoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/InventoryMagGen.cs index 00c3a1b6..8dee9775 100644 --- a/Libraries/Core/Generators/WeaponGen/InventoryMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/InventoryMagGen.cs @@ -1,16 +1,16 @@ -using SptCommon.Annotations; -using Core.Models.Eft.Common.Tables; +using Core.Models.Eft.Common.Tables; +using SptCommon.Annotations; namespace Core.Generators.WeaponGen; [Injectable] public class InventoryMagGen() { - private GenerationData _magCounts; - private TemplateItem _magazineTemplate; - private TemplateItem _weaponTemplate; - private TemplateItem _ammoTemplate; - private BotBaseInventory _pmcInventory; + private readonly TemplateItem _ammoTemplate; + private readonly TemplateItem _magazineTemplate; + private readonly GenerationData _magCounts; + private readonly BotBaseInventory _pmcInventory; + private readonly TemplateItem _weaponTemplate; public InventoryMagGen ( diff --git a/Libraries/Core/Generators/WeatherGenerator.cs b/Libraries/Core/Generators/WeatherGenerator.cs index e9e10d0f..301abe2f 100644 --- a/Libraries/Core/Generators/WeatherGenerator.cs +++ b/Libraries/Core/Generators/WeatherGenerator.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Weather; using Core.Models.Enums; @@ -6,6 +5,7 @@ using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Generators; @@ -104,7 +104,10 @@ public class WeatherGenerator( protected SeasonalValues GetWeatherValuesBySeason(Season currentSeason) { var result = _weatherConfig.Weather.SeasonValues.TryGetValue(currentSeason.ToString(), out var value); - if (!result) return _weatherConfig.Weather.SeasonValues["default"]; + if (!result) + { + return _weatherConfig.Weather.SeasonValues["default"]; + } return value!; } diff --git a/Libraries/Core/Helpers/AssortHelper.cs b/Libraries/Core/Helpers/AssortHelper.cs index 04927693..05a28ed9 100644 --- a/Libraries/Core/Helpers/AssortHelper.cs +++ b/Libraries/Core/Helpers/AssortHelper.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Utils; using Core.Servers; using Core.Services; +using SptCommon.Annotations; namespace Core.Helpers; @@ -47,11 +47,17 @@ public class AssortHelper( { // Get quest id that unlocks assort + statuses quest can be in to show assort var unlockValues = GetQuestIdAndStatusThatShowAssort(mergedQuestAssorts, assortId.Key); - if (unlockValues is null) continue; + if (unlockValues is null) + { + continue; + } // Remove assort if quest in profile does not have status that unlocks assort var questStatusInProfile = _questHelper.GetQuestStatus(pmcProfile, unlockValues.Value.Key); - if (!unlockValues.Value.Value.Contains(questStatusInProfile)) strippedTraderAssorts = RemoveItemFromAssort(traderAssorts, assortId.Key, flea); + if (!unlockValues.Value.Value.Contains(questStatusInProfile)) + { + strippedTraderAssorts = RemoveItemFromAssort(traderAssorts, assortId.Key, flea); + } } return strippedTraderAssorts; @@ -69,22 +75,28 @@ public class AssortHelper( { if (mergedQuestAssorts.TryGetValue("started", out var dict1) && dict1.ContainsKey(assortId)) // Assort unlocked by starting quest, assort is visible to player when : started or ready to hand in + handed in + { return new KeyValuePair>( mergedQuestAssorts["started"][assortId], [QuestStatusEnum.Started, QuestStatusEnum.AvailableForFinish, QuestStatusEnum.Success] ); + } if (mergedQuestAssorts.TryGetValue("success", out var dict2) && dict2.ContainsKey(assortId)) + { return new KeyValuePair>( mergedQuestAssorts["success"][assortId], [QuestStatusEnum.Success] ); + } if (mergedQuestAssorts.TryGetValue("fail", out var dict3) && dict3.ContainsKey(assortId)) + { return new KeyValuePair>( mergedQuestAssorts["fail"][assortId], [QuestStatusEnum.Fail] ); + } return null; } @@ -110,8 +122,12 @@ public class AssortHelper( // Remove items restricted by loyalty levels above those reached by the player foreach (var item in assort.LoyalLevelItems) + { if (pmcProfile.TradersInfo.TryGetValue(traderId, out var info) && assort.LoyalLevelItems[item.Key] > info.LoyaltyLevel) + { strippedAssort = RemoveItemFromAssort(assort, item.Key); + } + } return strippedAssort; } diff --git a/Libraries/Core/Helpers/BotDifficultyHelper.cs b/Libraries/Core/Helpers/BotDifficultyHelper.cs index e948497b..2cceba58 100644 --- a/Libraries/Core/Helpers/BotDifficultyHelper.cs +++ b/Libraries/Core/Helpers/BotDifficultyHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Bots; using Core.Models.Spt.Config; @@ -7,6 +6,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Helpers; @@ -24,7 +24,7 @@ public class BotDifficultyHelper( protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// Get difficulty settings for desired bot type, if not found use assault bot types + /// Get difficulty settings for desired bot type, if not found use assault bot types /// /// bot type to retrieve difficulty of /// difficulty to get settings for (easy/normal etc) @@ -65,7 +65,7 @@ public class BotDifficultyHelper( } /// - /// Get difficulty settings for a PMC + /// Get difficulty settings for a PMC /// /// "usec" / "bear" /// what difficulty to retrieve @@ -83,7 +83,7 @@ public class BotDifficultyHelper( } /// - /// Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + /// Translate chosen value from pre-raid difficulty dropdown into bot difficulty value /// /// Dropdown difficulty value to convert /// bot difficulty @@ -101,7 +101,7 @@ public class BotDifficultyHelper( } /// - /// Choose a random difficulty from - easy/normal/hard/impossible + /// Choose a random difficulty from - easy/normal/hard/impossible /// /// random difficulty public string ChooseRandomDifficulty() diff --git a/Libraries/Core/Helpers/BotGeneratorHelper.cs b/Libraries/Core/Helpers/BotGeneratorHelper.cs index f57fe100..acb953c2 100644 --- a/Libraries/Core/Helpers/BotGeneratorHelper.cs +++ b/Libraries/Core/Helpers/BotGeneratorHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Context; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Match; @@ -9,6 +8,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -30,8 +30,8 @@ public class BotGeneratorHelper( protected PmcConfig _pmcConfig = _configServer.GetConfig(); /// - /// Adds properties to an item - /// e.g. Repairable / HasHinge / Foldable / MaxDurability + /// Adds properties to an item + /// e.g. Repairable / HasHinge / Foldable / MaxDurability /// /// Item extra properties are being generated for /// Used by weapons to randomize the durability values. Null for non-equipped items @@ -45,7 +45,10 @@ public class BotGeneratorHelper( var raidIsNight = raidSettings?.TimeVariant == DateTimeEnum.PAST; RandomisedResourceDetails randomisationSettings = null; - if (botRole is not null) _botConfig.LootItemResourceRandomization.TryGetValue(botRole, out randomisationSettings); + if (botRole is not null) + { + _botConfig.LootItemResourceRandomization.TryGetValue(botRole, out randomisationSettings); + } Upd itemProperties = new(); @@ -69,21 +72,33 @@ public class BotGeneratorHelper( if (itemTemplate?.Properties?.HasHinge ?? false) { - itemProperties.Togglable = new UpdTogglable { On = true }; + itemProperties.Togglable = new UpdTogglable + { + On = true + }; hasProperties = true; } if (itemTemplate?.Properties?.Foldable ?? false) { - itemProperties.Foldable = new UpdFoldable { Folded = false }; + itemProperties.Foldable = new UpdFoldable + { + Folded = false + }; hasProperties = true; } if (itemTemplate?.Properties?.WeapFireType?.Count == 0) { itemProperties.FireMode = itemTemplate.Properties.WeapFireType.Contains("fullauto") - ? new UpdFireMode { FireMode = "fullauto" } - : new UpdFireMode { FireMode = _randomUtil.GetArrayValue(itemTemplate.Properties.WeapFireType) }; + ? new UpdFireMode + { + FireMode = "fullauto" + } + : new UpdFireMode + { + FireMode = _randomUtil.GetArrayValue(itemTemplate.Properties.WeapFireType) + }; hasProperties = true; } @@ -117,7 +132,11 @@ public class BotGeneratorHelper( var lightLaserActiveChance = raidIsNight ? GetBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50) : GetBotEquipmentSettingFromConfig(botRole, "lightIsActiveDayChancePercent", 25); - itemProperties.Light = new UpdLight { IsActive = _randomUtil.GetChance100(lightLaserActiveChance), SelectedMode = 0 }; + itemProperties.Light = new UpdLight + { + IsActive = _randomUtil.GetChance100(lightLaserActiveChance), + SelectedMode = 0 + }; hasProperties = true; } else if (itemTemplate?.Parent == BaseClasses.TACTICAL_COMBO) @@ -142,7 +161,10 @@ public class BotGeneratorHelper( var nvgActiveChance = raidIsNight ? GetBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceNightPercent", 90) : GetBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceDayPercent", 15); - itemProperties.Togglable = new UpdTogglable { On = _randomUtil.GetChance100(nvgActiveChance) }; + itemProperties.Togglable = new UpdTogglable + { + On = _randomUtil.GetChance100(nvgActiveChance) + }; hasProperties = true; } @@ -154,7 +176,10 @@ public class BotGeneratorHelper( "faceShieldIsActiveChancePercent", 75 ); - itemProperties.Togglable = new UpdTogglable { On = _randomUtil.GetChance100(faceShieldActiveChance) }; + itemProperties.Togglable = new UpdTogglable + { + On = _randomUtil.GetChance100(faceShieldActiveChance) + }; hasProperties = true; } @@ -163,16 +188,22 @@ public class BotGeneratorHelper( } /// - /// Randomize the HpResource for bots e.g (245/400 resources) + /// Randomize the HpResource for bots e.g (245/400 resources) /// /// Max resource value of medical items /// Value provided from config /// Randomized value from maxHpResource private double GetRandomizedResourceValue(double maxResource, RandomisedResourceValues? randomizationValues) { - if (randomizationValues is null) return maxResource; + if (randomizationValues is null) + { + return maxResource; + } - if (_randomUtil.GetChance100(randomizationValues.ChanceMaxResourcePercent)) return maxResource; + if (_randomUtil.GetChance100(randomizationValues.ChanceMaxResourcePercent)) + { + return maxResource; + } return _randomUtil.GetDouble( _randomUtil.GetPercentOfValue(randomizationValues.ResourcePercent, maxResource, 0), @@ -181,7 +212,7 @@ public class BotGeneratorHelper( } /// - /// Get the chance for the weapon attachment or helmet equipment to be set as activated + /// Get the chance for the weapon attachment or helmet equipment to be set as activated /// /// role of bot with weapon/helmet /// the setting of the weapon attachment/helmet equipment to be activated @@ -189,7 +220,10 @@ public class BotGeneratorHelper( /// Percent chance to be active private double? GetBotEquipmentSettingFromConfig(string? botRole, string setting, double defaultValue) { - if (botRole is null) return defaultValue; + if (botRole is null) + { + return defaultValue; + } var botEquipmentSettings = _botConfig.Equipment[GetBotEquipmentRole(botRole)]; if (botEquipmentSettings is null) @@ -210,10 +244,13 @@ public class BotGeneratorHelper( } var props = botEquipmentSettings.GetType().GetProperties(); - var propValue = (double?)props.FirstOrDefault(x => string.Equals(x.Name, setting, StringComparison.CurrentCultureIgnoreCase)) + var propValue = (double?) props.FirstOrDefault(x => string.Equals(x.Name, setting, StringComparison.CurrentCultureIgnoreCase)) ?.GetValue(botEquipmentSettings); - if (propValue is not null) return propValue; + if (propValue is not null) + { + return propValue; + } _logger.Warning( _localisationService.GetText( @@ -231,7 +268,7 @@ public class BotGeneratorHelper( } /// - /// Create a repairable object for a weapon that containers durability + max durability properties + /// Create a repairable object for a weapon that containers durability + max durability properties /// /// weapon object being generated for /// type of bot being generated for @@ -245,11 +282,15 @@ public class BotGeneratorHelper( maxDurability ); - return new UpdRepairable { Durability = Math.Round(currentDurability, 5), MaxDurability = Math.Round(maxDurability, 5) }; + return new UpdRepairable + { + Durability = Math.Round(currentDurability, 5), + MaxDurability = Math.Round(maxDurability, 5) + }; } /// - /// Create a repairable object for an armor that containers durability + max durability properties + /// Create a repairable object for an armor that containers durability + max durability properties /// /// weapon object being generated for /// type of bot being generated for @@ -273,11 +314,15 @@ public class BotGeneratorHelper( ); } - return new UpdRepairable { Durability = Math.Round(currentDurability, 5), MaxDurability = Math.Round(maxDurability, 5) }; + return new UpdRepairable + { + Durability = Math.Round(currentDurability, 5), + MaxDurability = Math.Round(maxDurability, 5) + }; } /// - /// Can item be added to another item without conflict + /// Can item be added to another item without conflict /// /// Items to check compatibilities with /// Tpl of the item to check for incompatibilities @@ -287,7 +332,15 @@ public class BotGeneratorHelper( { // Skip slots that have no incompatibilities List slotsToCheck = ["Scabbard", "Backpack", "SecureContainer", "Holster", "ArmBand"]; - if (slotsToCheck.Contains(equipmentSlot)) return new ChooseRandomCompatibleModResult { Incompatible = false, Found = false, Reason = "" }; + if (slotsToCheck.Contains(equipmentSlot)) + { + return new ChooseRandomCompatibleModResult + { + Incompatible = false, + Found = false, + Reason = "" + }; + } // TODO: Can probably be optimized to cache itemTemplates as items are added to inventory var equippedItemsDb = itemsEquipped.Select(equippedItem => _itemHelper.GetItem(equippedItem.Template).Value).ToList(); @@ -306,7 +359,12 @@ public class BotGeneratorHelper( ) ); - return new ChooseRandomCompatibleModResult { Incompatible = true, Found = false, Reason = $"item: {tplToCheck} does not exist in the database" }; + return new ChooseRandomCompatibleModResult + { + Incompatible = true, + Found = false, + Reason = $"item: {tplToCheck} does not exist in the database" + }; } if (itemToEquip?.Properties is null) @@ -323,7 +381,12 @@ public class BotGeneratorHelper( ) ); - return new ChooseRandomCompatibleModResult { Incompatible = true, Found = false, Reason = $"item: {tplToCheck} does not have a _props field" }; + return new ChooseRandomCompatibleModResult + { + Incompatible = true, + Found = false, + Reason = $"item: {tplToCheck} does not have a _props field" + }; } // Does an equipped item have a property that blocks the desired item - check for prop "BlocksX" .e.g BlocksEarpiece / BlocksFaceCover @@ -333,16 +396,7 @@ public class BotGeneratorHelper( ); if (blockingItem is not null) // this.logger.warning(`1 incompatibility found between - {itemToEquip[1]._name} and {blockingItem._name} - {equipmentSlot}`); - return new ChooseRandomCompatibleModResult - { - Incompatible = true, Found = false, - Reason = $"{tplToCheck} {itemToEquip.Name} in slot: {equipmentSlot} blocked by: {blockingItem.Id} {blockingItem.Name}", SlotBlocked = true - }; - - // Check if any of the current inventory templates have the incoming item defined as incompatible - blockingItem = templateItems.FirstOrDefault(x => x?.Properties?.ConflictingItems?.Contains(tplToCheck) ?? false); - if (blockingItem is not null) - // this.logger.warning(`2 incompatibility found between - {itemToEquip[1]._name} and {blockingItem._props.Name} - {equipmentSlot}`); + { return new ChooseRandomCompatibleModResult { Incompatible = true, @@ -350,12 +404,28 @@ public class BotGeneratorHelper( Reason = $"{tplToCheck} {itemToEquip.Name} in slot: {equipmentSlot} blocked by: {blockingItem.Id} {blockingItem.Name}", SlotBlocked = true }; + } + + // Check if any of the current inventory templates have the incoming item defined as incompatible + blockingItem = templateItems.FirstOrDefault(x => x?.Properties?.ConflictingItems?.Contains(tplToCheck) ?? false); + if (blockingItem is not null) + // this.logger.warning(`2 incompatibility found between - {itemToEquip[1]._name} and {blockingItem._props.Name} - {equipmentSlot}`); + { + return new ChooseRandomCompatibleModResult + { + Incompatible = true, + Found = false, + Reason = $"{tplToCheck} {itemToEquip.Name} in slot: {equipmentSlot} blocked by: {blockingItem.Id} {blockingItem.Name}", + SlotBlocked = true + }; + } // Does item being checked get blocked/block existing item if (itemToEquip.Properties.BlocksHeadwear ?? false) { - var existingHeadwear = itemsEquipped.FirstOrDefault((x) => x.SlotId == "Headwear"); + var existingHeadwear = itemsEquipped.FirstOrDefault(x => x.SlotId == "Headwear"); if (existingHeadwear is not null) + { return new ChooseRandomCompatibleModResult { Incompatible = true, @@ -363,13 +433,15 @@ public class BotGeneratorHelper( Reason = $"{tplToCheck} {itemToEquip.Name} is blocked by: {existingHeadwear.Template} in slot: {existingHeadwear.SlotId}", SlotBlocked = true }; + } } // Does item being checked get blocked/block existing item if (itemToEquip.Properties.BlocksFaceCover.GetValueOrDefault(false)) { - var existingFaceCover = itemsEquipped.FirstOrDefault((item) => item.SlotId == "FaceCover"); + var existingFaceCover = itemsEquipped.FirstOrDefault(item => item.SlotId == "FaceCover"); if (existingFaceCover is not null) + { return new ChooseRandomCompatibleModResult { Incompatible = true, @@ -377,13 +449,15 @@ public class BotGeneratorHelper( Reason = $"{tplToCheck} {itemToEquip.Name} is blocked by: {existingFaceCover.Template} in slot: {existingFaceCover.SlotId}", SlotBlocked = true }; + } } // Does item being checked get blocked/block existing item if (itemToEquip.Properties.BlocksEarpiece.GetValueOrDefault(false)) { - var existingEarpiece = itemsEquipped.FirstOrDefault((item) => item.SlotId == "Earpiece"); + var existingEarpiece = itemsEquipped.FirstOrDefault(item => item.SlotId == "Earpiece"); if (existingEarpiece is not null) + { return new ChooseRandomCompatibleModResult { Incompatible = true, @@ -391,13 +465,15 @@ public class BotGeneratorHelper( Reason = $"{tplToCheck} {itemToEquip.Name} is blocked by: {existingEarpiece.Template} in slot: {existingEarpiece.SlotId}", SlotBlocked = true }; + } } // Does item being checked get blocked/block existing item if (itemToEquip.Properties.BlocksArmorVest.GetValueOrDefault(false)) { - var existingArmorVest = itemsEquipped.FirstOrDefault((item) => item.SlotId == "ArmorVest"); + var existingArmorVest = itemsEquipped.FirstOrDefault(item => item.SlotId == "ArmorVest"); if (existingArmorVest is not null) + { return new ChooseRandomCompatibleModResult { Incompatible = true, @@ -405,24 +481,31 @@ public class BotGeneratorHelper( Reason = $"{tplToCheck} {itemToEquip.Name} is blocked by: {existingArmorVest.Template} in slot: {existingArmorVest.SlotId}", SlotBlocked = true }; + } } // Check if the incoming item has any inventory items defined as incompatible - var blockingInventoryItem = itemsEquipped.FirstOrDefault((x) => itemToEquip.Properties.ConflictingItems?.Contains(x.Template) ?? false); + var blockingInventoryItem = itemsEquipped.FirstOrDefault(x => itemToEquip.Properties.ConflictingItems?.Contains(x.Template) ?? false); if (blockingInventoryItem is not null) // this.logger.warning(`3 incompatibility found between - {itemToEquip[1]._name} and {blockingInventoryItem._tpl} - {equipmentSlot}`) + { return new ChooseRandomCompatibleModResult { Incompatible = true, Found = false, Reason = $"{tplToCheck} blocks existing item {blockingInventoryItem.Template} in slot {blockingInventoryItem.SlotId}" }; + } - return new ChooseRandomCompatibleModResult { Incompatible = false, Reason = "" }; + return new ChooseRandomCompatibleModResult + { + Incompatible = false, + Reason = "" + }; } /// - /// Convert a bots role to the equipment role used in config/bot.json + /// Convert a bots role to the equipment role used in config/bot.json /// /// Role to convert /// Equipment role (e.g. pmc / assault / bossTagilla) @@ -437,7 +520,7 @@ public class BotGeneratorHelper( } /// - /// Adds an item with all its children into specified equipmentSlots, wherever it fits. + /// Adds an item with all its children into specified equipmentSlots, wherever it fits. /// /// Slot to add item+children into /// Root item id to use as mod items parentid @@ -458,7 +541,10 @@ public class BotGeneratorHelper( var missingContainerCount = 0; foreach (var equipmentSlotId in equipmentSlots) { - if (containersIdFull?.Contains(equipmentSlotId.ToString()) ?? false) continue; + if (containersIdFull?.Contains(equipmentSlotId.ToString()) ?? false) + { + continue; + } // Get container to put item into var container = inventory.Items.FirstOrDefault(item => item.SlotId == equipmentSlotId.ToString()); @@ -469,9 +555,11 @@ public class BotGeneratorHelper( { // Bot doesn't have any containers we want to add item to if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to add item: {itemWithChildren.FirstOrDefault()?.Template} to bot as it lacks the following containers: {string.Join(",", equipmentSlots)}" ); + } return ItemAddedResult.NO_CONTAINERS; } @@ -492,7 +580,9 @@ public class BotGeneratorHelper( if (value?.Properties?.Grids?.Count == 0) // Container has no slots to hold items + { continue; + } // Get x/y grid size of item var itemSize = _inventoryHelper.GetItemSize(rootItemTplId, rootItemId, itemWithChildren); @@ -506,12 +596,16 @@ public class BotGeneratorHelper( if (slotGrid.Props?.CellsH == 0 || slotGrid.Props?.CellsV == 0 || itemSize[0] * itemSize[1] > slotGrid.Props?.CellsV * slotGrid.Props?.CellsH) + { continue; + } // Can't put item type in grid, skip all grids as we're assuming they have the same rules if (!ItemAllowedInContainer(slotGrid, rootItemTplId)) // Multiple containers, maybe next one allows item, only break out of loop for the containers grids + { break; + } // Get all root items in found container var existingContainerItems = (inventory.Items ?? []).Where( @@ -539,7 +633,7 @@ public class BotGeneratorHelper( // Free slot found, add item if (findSlotResult.Success ?? false) { - var parentItem = itemWithChildren.FirstOrDefault((i) => i.Id == rootItemId); + var parentItem = itemWithChildren.FirstOrDefault(i => i.Id == rootItemId); // Set items parent to container id if (parentItem is not null) @@ -562,24 +656,33 @@ public class BotGeneratorHelper( } // If we've checked all grids in container and reached this point, there's no space for item - if (currentGridCount >= totalSlotGridCount) break; + if (currentGridCount >= totalSlotGridCount) + { + break; + } currentGridCount++; // No space in this grid, move to next container grid and try again } // if we got to this point, the item couldn't be placed on the container - if (containersIdFull is null) continue; + if (containersIdFull is null) + { + continue; + } // if the item was a one by one, we know it must be full. Or if the maps cant find a slot for a one by one - if (itemSize[0] == 1 && itemSize[1] == 1) containersIdFull.Add(equipmentSlotId.ToString()); + if (itemSize[0] == 1 && itemSize[1] == 1) + { + containersIdFull.Add(equipmentSlotId.ToString()); + } } return ItemAddedResult.NO_SPACE; } /// - /// Take a list of items and check if they need children + add them + /// Take a list of items and check if they need children + add them /// /// /// @@ -601,7 +704,7 @@ public class BotGeneratorHelper( } /// - /// Is the provided item allowed inside a container + /// Is the provided item allowed inside a container /// /// Items sub-grid we want to place item inside /// Item tpl being placed @@ -614,19 +717,30 @@ public class BotGeneratorHelper( if (propFilters?.Count == 0) // no filters, item is fine to add + { return true; + } // Check if item base type is excluded var itemDetails = _itemHelper.GetItem(itemTpl).Value; // if item to add is found in exclude filter, not allowed - if (excludedFilter.Contains(itemDetails?.Parent ?? string.Empty)) return false; + if (excludedFilter.Contains(itemDetails?.Parent ?? string.Empty)) + { + return false; + } // If Filter array only contains 1 filter and its for basetype 'item', allow it - if (filter.Count == 1 && filter.Contains(BaseClasses.ITEM)) return true; + if (filter.Count == 1 && filter.Contains(BaseClasses.ITEM)) + { + return true; + } // If allowed filter has something in it + filter doesnt have basetype 'item', not allowed - if (filter.Count > 0 && !filter.Contains(itemDetails?.Parent ?? string.Empty)) return false; + if (filter.Count > 0 && !filter.Contains(itemDetails?.Parent ?? string.Empty)) + { + return false; + } return true; } diff --git a/Libraries/Core/Helpers/BotHelper.cs b/Libraries/Core/Helpers/BotHelper.cs index a3740587..b3588e47 100644 --- a/Libraries/Core/Helpers/BotHelper.cs +++ b/Libraries/Core/Helpers/BotHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Config; @@ -6,7 +5,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; - +using SptCommon.Annotations; namespace Core.Helpers; @@ -23,7 +22,7 @@ public class BotHelper( protected List _pmcNames = ["usec", "bear", "pmc", "pmcbear", "pmcusec"]; /// - /// Get a template object for the specified botRole from bots.types db + /// Get a template object for the specified botRole from bots.types db /// /// botRole to get template for /// BotType object @@ -40,7 +39,7 @@ public class BotHelper( } /// - /// Is the passed in bot role a PMC (usec/bear/pmc) + /// Is the passed in bot role a PMC (usec/bear/pmc) /// /// bot role to check /// true if is pmc @@ -65,7 +64,7 @@ public class BotHelper( } /// - /// Add a bot to the FRIENDLY_BOT_TYPES list + /// Add a bot to the FRIENDLY_BOT_TYPES list /// /// bot settings to alter /// bot type to add to friendly list @@ -74,13 +73,16 @@ public class BotHelper( var friendlyBotTypesKey = "FRIENDLY_BOT_TYPES"; // Null guard - if (difficultySettings.Mind[friendlyBotTypesKey] is null) difficultySettings.Mind[friendlyBotTypesKey] = new List(); + if (difficultySettings.Mind[friendlyBotTypesKey] is null) + { + difficultySettings.Mind[friendlyBotTypesKey] = new List(); + } - ((List)difficultySettings.Mind[friendlyBotTypesKey]).Add(typeToAdd); + ((List) difficultySettings.Mind[friendlyBotTypesKey]).Add(typeToAdd); } /// - /// Add a bot to the REVENGE_BOT_TYPES list + /// Add a bot to the REVENGE_BOT_TYPES list /// /// bot settings to alter /// bot type to add to revenge list @@ -89,15 +91,25 @@ public class BotHelper( var revengePropKey = "REVENGE_BOT_TYPES"; // Nothing to add - if (typesToAdd is null) return; + if (typesToAdd is null) + { + return; + } // Null guard - if (difficultySettings.Mind[revengePropKey] is null) difficultySettings.Mind[revengePropKey] = new List(); + if (difficultySettings.Mind[revengePropKey] is null) + { + difficultySettings.Mind[revengePropKey] = new List(); + } - var revengeArray = (List)difficultySettings.Mind[revengePropKey]; + var revengeArray = (List) difficultySettings.Mind[revengePropKey]; foreach (var botTypeToAdd in typesToAdd) + { if (!revengeArray.Contains(botTypeToAdd)) + { revengeArray.Add(botTypeToAdd); + } + } } public bool RollChanceToBePmc(MinMax botConvertMinMax) @@ -108,13 +120,16 @@ public class BotHelper( protected Dictionary GetPmcConversionValuesForLocation(string location) { var result = _pmcConfig.ConvertIntoPmcChance[location.ToLower()]; - if (result is null) _pmcConfig.ConvertIntoPmcChance = new Dictionary>(); + if (result is null) + { + _pmcConfig.ConvertIntoPmcChance = new Dictionary>(); + } return result; } /// - /// is the provided role a PMC, case-agnostic + /// is the provided role a PMC, case-agnostic /// /// Role to check /// True if role is PMC @@ -127,7 +142,7 @@ public class BotHelper( } /// - /// Get randomization settings for bot from config/bot.json + /// Get randomization settings for bot from config/bot.json /// /// level of bot /// bot equipment json @@ -135,15 +150,18 @@ public class BotHelper( public RandomisationDetails GetBotRandomizationDetails(int botLevel, EquipmentFilters botEquipConfig) { // No randomisation details found, skip - if (botEquipConfig is null || botEquipConfig.Randomisation is null) return null; + if (botEquipConfig is null || botEquipConfig.Randomisation is null) + { + return null; + } return botEquipConfig.Randomisation.FirstOrDefault( - (randDetails) => botLevel >= randDetails.LevelRange.Min && botLevel <= randDetails.LevelRange.Max + randDetails => botLevel >= randDetails.LevelRange.Min && botLevel <= randDetails.LevelRange.Max ); } /// - /// Choose between pmcBEAR and pmcUSEC at random based on the % defined in pmcConfig.isUsec + /// Choose between pmcBEAR and pmcUSEC at random based on the % defined in pmcConfig.isUsec /// /// pmc role public string GetRandomizedPmcRole() @@ -152,23 +170,27 @@ public class BotHelper( } /// - /// Get the corresponding side when pmcBEAR or pmcUSEC is passed in + /// Get the corresponding side when pmcBEAR or pmcUSEC is passed in /// /// role to get side for /// side (usec/bear) public string GetPmcSideByRole(string botRole) { if (_pmcConfig.BearType.ToLower() == botRole.ToLower()) + { return "Bear"; + } if (_pmcConfig.UsecType.ToLower() == botRole.ToLower()) + { return "Usec"; + } return GetRandomizedPmcSide(); } /// - /// Get a randomized PMC side based on bot config value 'isUsec' + /// Get a randomized PMC side based on bot config value 'isUsec' /// /// pmc side as string protected string GetRandomizedPmcSide() @@ -177,7 +199,7 @@ public class BotHelper( } /// - /// Get a name from a PMC that fits the desired length + /// Get a name from a PMC that fits the desired length /// /// Max length of name, inclusive /// OPTIONAL - what side PMC to get name from (usec/bear) @@ -186,7 +208,7 @@ public class BotHelper( { var randomType = side is not null ? side : _randomUtil.GetInt(0, 1) == 0 ? "usec" : "bear"; var allNames = _databaseService.GetBots().Types[randomType.ToLower()].FirstNames; - var filteredNames = allNames.Where((name) => name.Length <= maxLength); + var filteredNames = allNames.Where(name => name.Length <= maxLength); if (filteredNames.Count() == 0) { _logger.Warning( diff --git a/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs b/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs index 7575ccac..d5e5a37e 100644 --- a/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs +++ b/Libraries/Core/Helpers/BotWeaponGeneratorHelper.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Helpers; @@ -23,7 +23,7 @@ public class BotWeaponGeneratorHelper( private readonly List _magCheck = ["CylinderMagazine", "SpringDrivenCylinder"]; /// - /// Get a randomized number of bullets for a specific magazine + /// Get a randomized number of bullets for a specific magazine /// /// Weights of magazines /// Magazine to generate bullet count for @@ -57,17 +57,17 @@ public class BotWeaponGeneratorHelper( } /// - /// Get a randomized count of magazines + /// Get a randomized count of magazines /// /// Min and max value returned value can be between /// Numerical value of magazine count public int GetRandomizedMagazineCount(GenerationData magCounts) { - return (int)_weightedRandomHelper.GetWeightedValue(magCounts.Weights); + return (int) _weightedRandomHelper.GetWeightedValue(magCounts.Weights); } /// - /// Is this magazine cylinder related (revolvers and grenade launchers) + /// Is this magazine cylinder related (revolvers and grenade launchers) /// /// The name of the magazines parent /// True if it is cylinder related @@ -77,7 +77,7 @@ public class BotWeaponGeneratorHelper( } /// - /// Create a magazine using the parameters given + /// Create a magazine using the parameters given /// /// Tpl of the magazine to create /// Ammo to add to magazine @@ -87,7 +87,11 @@ public class BotWeaponGeneratorHelper( { List magazine = [ - new() { Id = _hashUtil.Generate(), Template = magazineTpl } + new() + { + Id = _hashUtil.Generate(), + Template = magazineTpl + } ]; _itemHelper.FillMagazineWithCartridge(magazine, magTemplate, ammoTpl, 1); @@ -96,7 +100,7 @@ public class BotWeaponGeneratorHelper( } /// - /// Add a specific number of cartridges to a bots inventory (defaults to vest and pockets) + /// Add a specific number of cartridges to a bots inventory (defaults to vest and pockets) /// /// Ammo tpl to add to vest/pockets /// Number of cartridges to add to vest/pockets @@ -110,14 +114,19 @@ public class BotWeaponGeneratorHelper( ) { if (equipmentSlotsToAddTo is null) + { equipmentSlotsToAddTo = [EquipmentSlots.TacticalVest, EquipmentSlots.Pockets]; + } var ammoItems = _itemHelper.SplitStack( new Item { Id = _hashUtil.Generate(), Template = ammoTpl, - Upd = new Upd { StackObjectsCount = cartridgeCount } + Upd = new Upd + { + StackObjectsCount = cartridgeCount + } } ); @@ -137,13 +146,15 @@ public class BotWeaponGeneratorHelper( if (result == ItemAddedResult.NO_SPACE || result == ItemAddedResult.NO_CONTAINERS) // If there's no space for 1 stack or no containers to hold item, there's no space for the others + { break; + } } } } /// - /// Get a weapons default magazine template id + /// Get a weapons default magazine template id /// /// Weapon to get default magazine for /// Tpl of magazine diff --git a/Libraries/Core/Helpers/ContainerHelper.cs b/Libraries/Core/Helpers/ContainerHelper.cs index 1ccb11c9..7b943bb0 100644 --- a/Libraries/Core/Helpers/ContainerHelper.cs +++ b/Libraries/Core/Helpers/ContainerHelper.cs @@ -7,7 +7,7 @@ namespace Core.Helpers; public class ContainerHelper { /// - /// Finds a slot for an item in a given 2D container map + /// Finds a slot for an item in a given 2D container map /// /// List of container with slots filled/free /// Width of item @@ -23,20 +23,28 @@ public class ContainerHelper var limitX = containerX - minVolume; // Every x+y slot taken up in container, exit - if (container2D.All((x) => x.All((y) => y == 1))) return new FindSlotResult(false); + if (container2D.All(x => x.All(y => y == 1))) + { + return new FindSlotResult(false); + } // Down = y for (var y = 0; y < limitY; y++) { - if (container2D[y].All((x) => x == 1)) + if (container2D[y].All(x => x == 1)) // Every item in row is full, skip row + { continue; + } // Try each slot on the row (across = x) for (var x = 0; x < limitX; x++) { var foundSlot = LocateSlot(container2D, containerX, containerY, x, y, itemWidth, itemHeight); - if (foundSlot) return new FindSlotResult(true, x, y, rotation); + if (foundSlot) + { + return new FindSlotResult(true, x, y, rotation); + } // Failed to find slot, rotate item and try again if (!foundSlot && ItemBiggerThan1X1(itemWidth, itemHeight)) @@ -64,7 +72,7 @@ public class ContainerHelper } /// - /// Find a slot inside a container an item can be placed in + /// Find a slot inside a container an item can be placed in /// /// Container to find space in /// Container x size @@ -109,14 +117,17 @@ public class ContainerHelper } } - if (!foundSlot) break; + if (!foundSlot) + { + break; + } } return foundSlot; } /// - /// Find a free slot for an item to be placed at + /// Find a free slot for an item to be placed at /// /// Container to place item in /// Container x size @@ -138,11 +149,17 @@ public class ContainerHelper for (var tmpY = y; tmpY < y + itemHeight; tmpY++) for (var tmpX = x; tmpX < x + itemWidth; tmpX++) + { if (container2D[tmpY][tmpX] == 0) // Flag slot as used + { container2D[tmpY][tmpX] = 1; + } else + { throw new Exception($"Slot at({x}, {y}) is already filled. Cannot fit a {itemW} by {itemH} item"); + } + } } } @@ -166,14 +183,30 @@ public class FindSlotResult } [JsonPropertyName("success")] - public bool? Success { get; set; } + public bool? Success + { + get; + set; + } [JsonPropertyName("x")] - public int? X { get; set; } + public int? X + { + get; + set; + } [JsonPropertyName("y")] - public int? Y { get; set; } + public int? Y + { + get; + set; + } [JsonPropertyName("rotation")] - public bool? Rotation { get; set; } + public bool? Rotation + { + get; + set; + } } diff --git a/Libraries/Core/Helpers/Dialogue/AbstractDialogChatBot.cs b/Libraries/Core/Helpers/Dialogue/AbstractDialogChatBot.cs index eb3a28b6..badecb68 100644 --- a/Libraries/Core/Helpers/Dialogue/AbstractDialogChatBot.cs +++ b/Libraries/Core/Helpers/Dialogue/AbstractDialogChatBot.cs @@ -30,9 +30,14 @@ public abstract class AbstractDialogChatBot( var commandos = _chatCommands.Where(c => c.GetCommandPrefix() == splitCommand.FirstOrDefault()); if (commandos.FirstOrDefault()?.GetCommands().Contains(splitCommand[1]) ?? false) + { return commandos.FirstOrDefault().Handle(splitCommand[1], GetChatBot(), sessionId, request); + } - if (splitCommand.FirstOrDefault()?.ToLower() == "help") return SendPlayerHelpMessage(sessionId, request); + if (splitCommand.FirstOrDefault()?.ToLower() == "help") + { + return SendPlayerHelpMessage(sessionId, request); + } _mailSendService.SendUserMessageToPlayer( sessionId, @@ -72,6 +77,7 @@ public abstract class AbstractDialogChatBot( () => { foreach (var subCommand in chatCommand.GetCommands()) + { _mailSendService.SendUserMessageToPlayer( sessionId, GetChatBot(), @@ -79,6 +85,7 @@ public abstract class AbstractDialogChatBot( [], null ); + } }, TimeSpan.FromSeconds(1) ); @@ -93,9 +100,11 @@ public abstract class AbstractDialogChatBot( public void RegisterChatCommand(IChatCommand chatCommand) { if (_chatCommands.Any(cc => cc.GetCommandPrefix() == chatCommand.GetCommandPrefix())) + { throw new Exception( $"The command \"{chatCommand.GetCommandPrefix()}\" attempting to be registered already exists." ); + } _chatCommands.Add(chatCommand); } diff --git a/Libraries/Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs b/Libraries/Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs index 79ae38a5..e3ba4e7f 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/SptCommandoCommands.cs @@ -1,18 +1,18 @@ -using SptCommon.Annotations; -using Core.Helpers.Dialog.Commando.SptCommands; +using Core.Helpers.Dialog.Commando.SptCommands; using Core.Models.Eft.Dialog; using Core.Models.Eft.Profile; using Core.Models.Spt.Config; using Core.Servers; using Core.Services; +using SptCommon.Annotations; namespace Core.Helpers.Dialog.Commando; [Injectable] public class SptCommandoCommands : IChatCommand { - protected List _sptCommands; protected LocalisationService _localisationService; + protected List _sptCommands; public SptCommandoCommands( ConfigServer configServer, @@ -32,18 +32,6 @@ public class SptCommandoCommands : IChatCommand } } - public void RegisterSptCommandoCommand(ISptCommand command) - { - if (_sptCommands.Any((c) => c.GetCommand() == command.GetCommand())) - throw new Exception( - _localisationService.GetText( - "chat-unable_to_register_command_already_registered", - command.GetCommand() - ) - ); - _sptCommands.Add(command); - } - public string GetCommandPrefix() { return "spt"; @@ -62,7 +50,22 @@ public class SptCommandoCommands : IChatCommand public string Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request) { return _sptCommands - .First((c) => c.GetCommand() == command) + .First(c => c.GetCommand() == command) .PerformAction(commandHandler, sessionId, request); } + + public void RegisterSptCommandoCommand(ISptCommand command) + { + if (_sptCommands.Any(c => c.GetCommand() == command.GetCommand())) + { + throw new Exception( + _localisationService.GetText( + "chat-unable_to_register_command_already_registered", + command.GetCommand() + ) + ); + } + + _sptCommands.Add(command); + } } diff --git a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs index f96b0b0f..bd6b7127 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/GiveSptCommand.cs @@ -25,9 +25,8 @@ public class GiveSptCommand( ICloner _cloner ) : ISptCommand { - protected Dictionary _savedCommand = new(); - private static readonly Regex _commandRegex = new(@"^spt give (((([a-z]{2,5}) )?""(.+)""|\w+) )?([0-9]+)$"); private const double _acceptableConfidence = 0.9d; + private static readonly Regex _commandRegex = new(@"^spt give (((([a-z]{2,5}) )?""(.+)""|\w+) )?([0-9]+)$"); // Exception for flares protected readonly HashSet _excludedPresetItems = @@ -37,6 +36,8 @@ public class GiveSptCommand( ItemTpl.FLARE_RSP30_REACTIVE_SIGNAL_CARTRIDGE_YELLOW ]; + protected Dictionary _savedCommand = new(); + public string GetCommand() { return "give"; @@ -104,7 +105,10 @@ public class GiveSptCommand( else { // A new give request was entered, we need to ignore the old saved command - if (_savedCommand.ContainsKey(sessionId)) _savedCommand.Remove(sessionId); + if (_savedCommand.ContainsKey(sessionId)) + { + _savedCommand.Remove(sessionId); + } isItemName = result.Groups[5].Value != null; item = result.Groups[5].Value is not null ? result.Groups[5].Value : result.Groups[2].Value; @@ -228,7 +232,13 @@ public class GiveSptCommand( for (var i = 0; i < quantity; i++) { List ammoBoxArray = []; - ammoBoxArray.Add(new Item { Id = _hashUtil.Generate(), Template = checkedItem.Value.Id }); + ammoBoxArray.Add( + new Item + { + Id = _hashUtil.Generate(), + Template = checkedItem.Value.Id + } + ); // DO NOT generate the ammo box cartridges, the mail service does it for us! :) // _itemHelper.addCartridgesToAmmoBox(ammoBoxArray, checkedItem[1]); itemsToSend.AddRange(ammoBoxArray); @@ -239,6 +249,7 @@ public class GiveSptCommand( if (checkedItem.Value.Properties.StackMaxSize == 1) { for (var i = 0; i < quantity; i++) + { itemsToSend.Add( new Item { @@ -247,6 +258,7 @@ public class GiveSptCommand( Upd = _itemHelper.generateUpdForItem(checkedItem.Value) } ); + } } else { diff --git a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.cs b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.cs index bd46c878..76a4d8aa 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/SavedCommand.cs @@ -16,7 +16,21 @@ public class SavedCommand Locale = locale; } - public int Quantity { get; set; } - public List PotentialItemNames { get; set; } - public string Locale { get; set; } + public int Quantity + { + get; + set; + } + + public List PotentialItemNames + { + get; + set; + } + + public string Locale + { + get; + set; + } } diff --git a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/StringSimilarity.cs b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/StringSimilarity.cs index 229a6b2b..a30f83eb 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/StringSimilarity.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/GiveCommand/StringSimilarity.cs @@ -1,5 +1,3 @@ -using static System.Runtime.InteropServices.JavaScript.JSType; - namespace Core.Helpers.Dialogue.Commando.SptCommands.GiveCommand; public static class StringSimilarity @@ -16,7 +14,9 @@ public static class StringSimilarity } if (str1.Length < substringLength || str2.Length < substringLength) + { return 0; + } var map = new Dictionary(); for (var i = 0; i < str1.Length - (substringLength - 1); i++) diff --git a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs index 210b77f1..63037f45 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs @@ -1,6 +1,5 @@ using System.Text.RegularExpressions; using Core.Helpers.Dialog.Commando.SptCommands; -using Core.Helpers.Dialogue.Commando.SptCommands.GiveCommand; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Dialog; using Core.Models.Eft.Profile; @@ -83,41 +82,41 @@ public class ProfileSptCommand( profileChangeEvent = HandleLevelCommand(quantity); break; case "skill": - { - var enumSkill = Enum.GetValues(typeof(SkillTypes)) - .Cast() - .FirstOrDefault( - t => t.ToString().ToLower() == skill - ); - - if (enumSkill == null) { - _mailSendService.SendUserMessageToPlayer( - sessionId, - commandHandler, - "Invalid use of profile command, the skill was not found. Use 'help' for more information." - ); - return request.DialogId; - } + var enumSkill = Enum.GetValues(typeof(SkillTypes)) + .Cast() + .FirstOrDefault( + t => t.ToString().ToLower() == skill + ); - if (quantity is < 0 or > 51) - { - _mailSendService.SendUserMessageToPlayer( - sessionId, - commandHandler, - "Invalid use of profile command, the skill level was outside bounds: 1 to 51. Use 'help' for more information." - ); - return request.DialogId; - } + if (enumSkill == null) + { + _mailSendService.SendUserMessageToPlayer( + sessionId, + commandHandler, + "Invalid use of profile command, the skill was not found. Use 'help' for more information." + ); + return request.DialogId; + } - profileChangeEvent = HandleSkillCommand(enumSkill, quantity); - break; - } + if (quantity is < 0 or > 51) + { + _mailSendService.SendUserMessageToPlayer( + sessionId, + commandHandler, + "Invalid use of profile command, the skill level was outside bounds: 1 to 51. Use 'help' for more information." + ); + return request.DialogId; + } + + profileChangeEvent = HandleSkillCommand(enumSkill, quantity); + break; + } case "examine": - { - profileChangeEvent = HandleExamineCommand(); - break; - } + { + profileChangeEvent = HandleExamineCommand(); + break; + } default: _mailSendService.SendUserMessageToPlayer( sessionId, @@ -135,7 +134,10 @@ public class ProfileSptCommand( { Id = _hashUtil.Generate(), Template = Money.ROUBLES, - Upd = new Upd { StackObjectsCount = 1 }, + Upd = new Upd + { + StackObjectsCount = 1 + }, ParentId = _hashUtil.Generate(), SlotId = "main" } diff --git a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs index 19fadab0..629ce12d 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/SptCommands/TraderCommand/TraderSptCommand.cs @@ -75,15 +75,15 @@ public class TraderSptCommand( profileChangeEventType = ProfileChangeEventType.TraderSalesSum; break; default: - { - _mailSendService.SendUserMessageToPlayer( - sessionId, - commandHandler, - "Invalid use of trader command, ProfileChangeEventType was not found. Use 'help' for more information." - ); + { + _mailSendService.SendUserMessageToPlayer( + sessionId, + commandHandler, + "Invalid use of trader command, ProfileChangeEventType was not found. Use 'help' for more information." + ); - return request.DialogId; - } + return request.DialogId; + } } _mailSendService.SendSystemMessageToPlayer( @@ -94,7 +94,10 @@ public class TraderSptCommand( { Id = _hashUtil.Generate(), Template = Money.ROUBLES, - Upd = new Upd { StackObjectsCount = 1 }, + Upd = new Upd + { + StackObjectsCount = 1 + }, ParentId = _hashUtil.Generate(), SlotId = "main" } diff --git a/Libraries/Core/Helpers/Dialogue/CommandoDialogChatBot.cs b/Libraries/Core/Helpers/Dialogue/CommandoDialogChatBot.cs index 7af004f6..e0075566 100644 --- a/Libraries/Core/Helpers/Dialogue/CommandoDialogChatBot.cs +++ b/Libraries/Core/Helpers/Dialogue/CommandoDialogChatBot.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers.Dialog.Commando; using Core.Models.Eft.Profile; using Core.Models.Enums; @@ -6,6 +5,7 @@ using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Services; +using SptCommon.Annotations; namespace Core.Helpers.Dialogue; diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs index 432a3387..859024bb 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs @@ -28,6 +28,7 @@ public class ForceChristmasMessageHandler( { var enableEventResult = _seasonalEventService.ForceSeasonalEvent(SeasonalEventType.Christmas); if (enableEventResult) + { _mailSendService.SendUserMessageToPlayer( sessionId, sptFriendUser, @@ -39,5 +40,6 @@ public class ForceChristmasMessageHandler( [], null ); + } } } diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs index 029896d0..1a769e46 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs @@ -28,6 +28,7 @@ public class ForceHalloweenMessageHandler( { var enableEventResult = _seasonalEventService.ForceSeasonalEvent(SeasonalEventType.Halloween); if (enableEventResult) + { _mailSendService.SendUserMessageToPlayer( sessionId, sptFriendUser, @@ -39,5 +40,6 @@ public class ForceHalloweenMessageHandler( [], null ); + } } } diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs index 3fda583d..947773e7 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs @@ -16,7 +16,7 @@ public class ForceSnowMessageHandler( RandomUtil _randomUtil, ConfigServer _configServer) : IChatMessageHandler { - private WeatherConfig _weatherConfig = _configServer.GetConfig(); + private readonly WeatherConfig _weatherConfig = _configServer.GetConfig(); public int GetPriority() { diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs index 19ef2cae..257484dd 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs @@ -16,7 +16,7 @@ public class ForceSummerMessageHandler( RandomUtil _randomUtil, ConfigServer _configServer) : IChatMessageHandler { - private WeatherConfig _weatherConfig = _configServer.GetConfig(); + private readonly WeatherConfig _weatherConfig = _configServer.GetConfig(); public int GetPriority() { diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs index 44ca995d..cb805cd6 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs @@ -36,7 +36,5 @@ public class GarbageMessageHandler( [], null ); - - } } diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs index 5fc16dc5..44816ae3 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs @@ -16,7 +16,7 @@ public class GiveMeSpaceMessageHandler( RandomUtil _randomUtil, ConfigServer _configServer) : IChatMessageHandler { - private CoreConfig _coreConfig = _configServer.GetConfig(); + private readonly CoreConfig _coreConfig = _configServer.GetConfig(); public int GetPriority() { diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs index f89fb89f..c1c874c1 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/HelloMessageHandler.cs @@ -15,6 +15,42 @@ public class HelloMessageHandler( protected List _listOfMessages = ["hello", "hi", "sup", "yo", "hey", "bonjour"]; + public int GetPriority() + { + return 100; + } + + public bool CanHandle(string message) + { + return _listOfMessages.Contains(message, StringComparer.OrdinalIgnoreCase); + } + + public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData sender) + { + _mailSendService.SendUserMessageToPlayer( + sessionId, + sptFriendUser, + _randomUtil.GetArrayValue( + [ + "Howdy", + "Hi", + "Greetings", + "Hello", + "Bonjor", + "Yo", + "Sup", + "Heyyyyy", + "Hey there", + "OH its you", + $"Hello {sender?.Info?.Nickname}" + ] + ), + [], + null + ); + } + + public string GetCommand() { return "hello"; @@ -55,40 +91,4 @@ public class HelloMessageHandler( return request.DialogId; } - - - public int GetPriority() - { - return 100; - } - - public bool CanHandle(string message) - { - return _listOfMessages.Contains(message, StringComparer.OrdinalIgnoreCase); - } - - public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData sender) - { - _mailSendService.SendUserMessageToPlayer( - sessionId, - sptFriendUser, - _randomUtil.GetArrayValue( - [ - "Howdy", - "Hi", - "Greetings", - "Hello", - "Bonjor", - "Yo", - "Sup", - "Heyyyyy", - "Hey there", - "OH its you", - $"Hello {sender?.Info?.Nickname}" - ] - ), - [], - null - ); - } } diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/IChatMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/IChatMessageHandler.cs index 34382036..1b0505b3 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/IChatMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/IChatMessageHandler.cs @@ -8,6 +8,6 @@ public interface IChatMessageHandler // Lower = More priority int GetPriority(); - public abstract bool CanHandle(string message); - public abstract void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData sender); + public bool CanHandle(string message); + public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData sender); } diff --git a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs index a9d15b85..90543d7f 100644 --- a/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs +++ b/Libraries/Core/Helpers/Dialogue/SPTFriend/Commands/SendGiftMessageHandler.cs @@ -16,8 +16,8 @@ public class SendGiftMessageHandler( GiftService _giftService, ConfigServer _configServer) : IChatMessageHandler { - private CoreConfig _coreConfig = _configServer.GetConfig(); - private string commandSent = string.Empty; + private readonly CoreConfig _coreConfig = _configServer.GetConfig(); + private readonly string commandSent = string.Empty; public int GetPriority() { @@ -32,7 +32,10 @@ public class SendGiftMessageHandler( public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData sender) { // Gifts may be disabled via config - if (!_coreConfig.Features.ChatbotFeatures.SptFriendGiftsEnabled) return; + if (!_coreConfig.Features.ChatbotFeatures.SptFriendGiftsEnabled) + { + return; + } var giftSent = _giftService.SendGiftToPlayer(sessionId, commandSent); switch (giftSent) diff --git a/Libraries/Core/Helpers/Dialogue/SptDialogueChatBot.cs b/Libraries/Core/Helpers/Dialogue/SptDialogueChatBot.cs index b679ef5c..cbaa99e0 100644 --- a/Libraries/Core/Helpers/Dialogue/SptDialogueChatBot.cs +++ b/Libraries/Core/Helpers/Dialogue/SptDialogueChatBot.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers.Dialog.Commando; using Core.Helpers.Dialogue.SPTFriend.Commands; using Core.Models.Eft.Dialog; @@ -9,6 +8,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils.Callbacks; +using SptCommon.Annotations; namespace Core.Helpers.Dialogue; @@ -24,14 +24,6 @@ public class SptDialogueChatBot( { protected IEnumerable _chatMessageHandlers = ChatMessageHandlerSetup(chatMessageHandlers); - private static List ChatMessageHandlerSetup(IEnumerable components) - { - var chatMessageHandlers = components.ToList(); - chatMessageHandlers.Sort((a, b) => a.GetPriority() - b.GetPriority()); - - return chatMessageHandlers; - } - protected CoreConfig _coreConfig = _configServer.GetConfig(); @@ -57,10 +49,13 @@ public class SptDialogueChatBot( var sender = _profileHelper.GetPmcProfile(sessionId); var sptFriendUser = GetChatBot(); - if (request.Text?.ToLower() == "help") return SendPlayerHelpMessage(sessionId, request); + if (request.Text?.ToLower() == "help") + { + return SendPlayerHelpMessage(sessionId, request); + } - var handler = _chatMessageHandlers.FirstOrDefault((v) => v.CanHandle(request.Text)); + var handler = _chatMessageHandlers.FirstOrDefault(v => v.CanHandle(request.Text)); if (handler is not null) { handler.Process(sessionId, sptFriendUser, sender); @@ -80,6 +75,14 @@ public class SptDialogueChatBot( return request.DialogId; } + private static List ChatMessageHandlerSetup(IEnumerable components) + { + var chatMessageHandlers = components.ToList(); + chatMessageHandlers.Sort((a, b) => a.GetPriority() - b.GetPriority()); + + return chatMessageHandlers; + } + private string GetUnrecognizedCommandMessage() { return "Unknown command."; @@ -112,6 +115,7 @@ public class SptDialogueChatBot( () => { foreach (var subCommand in chatCommand.GetCommands()) + { _mailSendService.SendUserMessageToPlayer( sessionId, GetChatBot(), @@ -119,6 +123,7 @@ public class SptDialogueChatBot( [], null ); + } }, TimeSpan.FromSeconds(1) ); diff --git a/Libraries/Core/Helpers/DialogueHelper.cs b/Libraries/Core/Helpers/DialogueHelper.cs index a54b137a..900fe60b 100644 --- a/Libraries/Core/Helpers/DialogueHelper.cs +++ b/Libraries/Core/Helpers/DialogueHelper.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Helpers; @@ -21,7 +21,7 @@ public class DialogueHelper( ) { /// - /// Get the preview contents of the last message in a dialogue. + /// Get the preview contents of the last message in a dialogue. /// /// /// MessagePreview @@ -38,16 +38,20 @@ public class DialogueHelper( }; if (message?.Text is not null) + { result.Text = message.Text; + } if (message?.SystemData is not null) + { result.SystemData = message?.SystemData; + } return result; } /// - /// Get the item contents for a particular message. + /// Get the item contents for a particular message. /// /// /// @@ -61,18 +65,24 @@ public class DialogueHelper( { var message = dialogueData[dialogue.Key].Messages.FirstOrDefault(x => x.Id == messageID); if (message is null) + { continue; + } if (message.Id == messageID) { var attachmentsNew = fullProfile.DialogueRecords[dialogue.Key].AttachmentsNew; if (attachmentsNew > 0) + { fullProfile.DialogueRecords[dialogue.Key].AttachmentsNew = attachmentsNew - 1; + } // Check reward count when item being moved isn't in reward list // If count is 0, it means after this move occurs the reward array will be empty and all rewards collected if (message.Items.Data is null) + { message.Items.Data = []; + } var rewardItems = message.Items.Data?.Where(x => x.Id != itemId); if (rewardItems.Count() == 0) @@ -89,7 +99,7 @@ public class DialogueHelper( } /// - /// Get the dialogs dictionary for a profile, create if doesn't exist + /// Get the dialogs dictionary for a profile, create if doesn't exist /// /// Session/player id /// Dialog dictionary @@ -107,7 +117,9 @@ public class DialogueHelper( foreach (var dialogue in dialogues.Values) { if (dialogue.Id == dialogueId) + { returnDialogue = dialogue; + } break; } diff --git a/Libraries/Core/Helpers/DurabilityLimitsHelper.cs b/Libraries/Core/Helpers/DurabilityLimitsHelper.cs index 886a620e..f7100718 100644 --- a/Libraries/Core/Helpers/DurabilityLimitsHelper.cs +++ b/Libraries/Core/Helpers/DurabilityLimitsHelper.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Helpers; @@ -17,7 +17,7 @@ public class DurabilityLimitsHelper( private readonly BotConfig _botConfig = _configServer.GetConfig(); /// - /// Get max durability for a weapon based on bot role + /// Get max durability for a weapon based on bot role /// /// UNUSED - Item to get durability for /// Role of bot to get max durability for @@ -30,7 +30,7 @@ public class DurabilityLimitsHelper( } /// - /// Get max durability value for armor based on bot role + /// Get max durability value for armor based on bot role /// /// Item to get max durability for /// Role of bot to get max durability for @@ -38,19 +38,31 @@ public class DurabilityLimitsHelper( public double GetRandomizedMaxArmorDurability(TemplateItem? itemTemplate, string? botRole = null) { var itemMaxDurability = itemTemplate.Properties.MaxDurability.Value; - if (botRole is null) return itemMaxDurability; + if (botRole is null) + { + return itemMaxDurability; + } - if (_botHelper.IsBotPmc(botRole)) return GenerateMaxPmcArmorDurability(itemMaxDurability); + if (_botHelper.IsBotPmc(botRole)) + { + return GenerateMaxPmcArmorDurability(itemMaxDurability); + } - if (_botHelper.IsBotBoss(botRole)) return itemMaxDurability; + if (_botHelper.IsBotBoss(botRole)) + { + return itemMaxDurability; + } - if (_botHelper.IsBotFollower(botRole)) return itemMaxDurability; + if (_botHelper.IsBotFollower(botRole)) + { + return itemMaxDurability; + } return itemMaxDurability; } /// - /// Get randomised current weapon durability by bot role + /// Get randomised current weapon durability by bot role /// /// Unused - Item to get current durability of /// Role of bot to get current durability for @@ -64,21 +76,36 @@ public class DurabilityLimitsHelper( } /// - /// Convert a botrole into a durability role used for looking up durability values with + /// Convert a botrole into a durability role used for looking up durability values with /// /// Role to convert /// private string GetDurabilityRole(string? botRole) { - if (botRole is null) return "default"; + if (botRole is null) + { + return "default"; + } - if (_botHelper.IsBotPmc(botRole)) return "pmc"; + if (_botHelper.IsBotPmc(botRole)) + { + return "pmc"; + } - if (_botHelper.IsBotBoss(botRole)) return "boss"; + if (_botHelper.IsBotBoss(botRole)) + { + return "boss"; + } - if (_botHelper.IsBotFollower(botRole)) return "follower"; + if (_botHelper.IsBotFollower(botRole)) + { + return "follower"; + } - if (_botHelper.IsBotZombie(botRole)) return "zombie"; + if (_botHelper.IsBotZombie(botRole)) + { + return "zombie"; + } var roleExistsInConfig = _botConfig.Durability.BotDurabilities.ContainsKey(botRole); if (!roleExistsInConfig) @@ -92,7 +119,7 @@ public class DurabilityLimitsHelper( } /// - /// Get randomised current armor durability by bot role + /// Get randomised current armor durability by bot role /// /// Unused - Item to get current durability of /// Role of bot to get current durability for @@ -124,9 +151,15 @@ public class DurabilityLimitsHelper( protected int GetLowestMaxWeaponFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Weapon.LowestMax; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Weapon.LowestMax; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Weapon.LowestMax; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Weapon.LowestMax; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var durability); return durability.Weapon.LowestMax; @@ -134,9 +167,15 @@ public class DurabilityLimitsHelper( protected int GetHighestMaxWeaponDurabilityFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Weapon.HighestMax; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Weapon.HighestMax; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Weapon.HighestMax; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Weapon.HighestMax; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var durability); return durability.Weapon.HighestMax; @@ -172,9 +211,15 @@ public class DurabilityLimitsHelper( protected int GetMinWeaponDeltaFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Weapon.MinDelta; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Weapon.MinDelta; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Weapon.MinDelta; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Weapon.MinDelta; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var value); @@ -183,9 +228,15 @@ public class DurabilityLimitsHelper( protected int GetMaxWeaponDeltaFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Weapon.MaxDelta; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Weapon.MaxDelta; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Weapon.MaxDelta; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Weapon.MaxDelta; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var value); @@ -194,9 +245,15 @@ public class DurabilityLimitsHelper( protected int GetMinArmorDeltaFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Armor.MinDelta; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Armor.MinDelta; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Armor.MinDelta; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Armor.MinDelta; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var value); @@ -205,9 +262,15 @@ public class DurabilityLimitsHelper( protected int GetMaxArmorDeltaFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Armor.MaxDelta; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Armor.MaxDelta; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Armor.MaxDelta; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Armor.MaxDelta; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var value); @@ -216,9 +279,15 @@ public class DurabilityLimitsHelper( protected double GetMinArmorLimitPercentFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Armor.MinLimitPercent; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Armor.MinLimitPercent; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Armor.MinLimitPercent; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Armor.MinLimitPercent; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var value); @@ -227,9 +296,15 @@ public class DurabilityLimitsHelper( protected double GetMinWeaponLimitPercentFromConfig(string? botRole = null) { - if (botRole is null or "default") return _botConfig.Durability.Default.Weapon.MinLimitPercent; + if (botRole is null or "default") + { + return _botConfig.Durability.Default.Weapon.MinLimitPercent; + } - if (botRole == "pmc") return _botConfig.Durability.Pmc.Weapon.MinLimitPercent; + if (botRole == "pmc") + { + return _botConfig.Durability.Pmc.Weapon.MinLimitPercent; + } _botConfig.Durability.BotDurabilities.TryGetValue(botRole, out var value); diff --git a/Libraries/Core/Helpers/HandbookHelper.cs b/Libraries/Core/Helpers/HandbookHelper.cs index 2e05754e..118b2de4 100644 --- a/Libraries/Core/Helpers/HandbookHelper.cs +++ b/Libraries/Core/Helpers/HandbookHelper.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Helpers; @@ -15,12 +15,12 @@ public class HandbookHelper( ICloner _cloner ) { - protected ItemConfig _itemConfig = _configServer.GetConfig(); - protected bool _lookupCacheGenerated = false; protected LookupCollection _handbookPriceCache = new(); + protected ItemConfig _itemConfig = _configServer.GetConfig(); + protected bool _lookupCacheGenerated; /// - /// Create an in-memory cache of all items with associated handbook price in handbookPriceCache class + /// Create an in-memory cache of all items with associated handbook price in handbookPriceCache class /// public void HydrateLookup() { @@ -52,7 +52,9 @@ public class HandbookHelper( { _handbookPriceCache.Items.ById.TryAdd(handbookItem.Id, handbookItem.Price ?? 0); if (!_handbookPriceCache.Items.ByParent.TryGetValue(handbookItem.ParentId, out _)) + { _handbookPriceCache.Items.ByParent.TryAdd(handbookItem.ParentId, []); + } _handbookPriceCache.Items.ByParent.TryGetValue(handbookItem.ParentId, out var array); array.Add(handbookItem.Id); @@ -64,7 +66,9 @@ public class HandbookHelper( if (handbookCategory.ParentId is not null) { if (!_handbookPriceCache.Categories.ByParent.TryGetValue(handbookCategory.ParentId, out _)) + { _handbookPriceCache.Categories.ByParent.TryAdd(handbookCategory.ParentId, []); + } _handbookPriceCache.Categories.ByParent.TryGetValue(handbookCategory.ParentId, out var array); array.Add(handbookCategory.Id); @@ -73,8 +77,8 @@ public class HandbookHelper( } /// - /// Get price from internal cache, if cache empty look up price directly in handbook (expensive) - /// If no values found, return 0 + /// Get price from internal cache, if cache empty look up price directly in handbook (expensive) + /// If no values found, return 0 /// /// Item tpl to look up price for /// price in roubles @@ -86,19 +90,28 @@ public class HandbookHelper( _lookupCacheGenerated = true; } - if (_handbookPriceCache.Items.ById.TryGetValue(tpl, out var item)) return item; + if (_handbookPriceCache.Items.ById.TryGetValue(tpl, out var item)) + { + return item; + } var handbookItem = _databaseService.GetHandbook().Items?.FirstOrDefault(item => item.Id == tpl); if (handbookItem is null) { var newValue = 0; - if (!_handbookPriceCache.Items.ById.TryAdd(tpl, newValue)) _handbookPriceCache.Items.ById[tpl] = newValue; + if (!_handbookPriceCache.Items.ById.TryAdd(tpl, newValue)) + { + _handbookPriceCache.Items.ById[tpl] = newValue; + } return newValue; } - if (!_handbookPriceCache.Items.ById.TryAdd(tpl, handbookItem.Price ?? 0)) _handbookPriceCache.Items.ById[tpl] = handbookItem.Price ?? 0; + if (!_handbookPriceCache.Items.ById.TryAdd(tpl, handbookItem.Price ?? 0)) + { + _handbookPriceCache.Items.ById[tpl] = handbookItem.Price ?? 0; + } return handbookItem.Price.Value; } @@ -106,13 +119,16 @@ public class HandbookHelper( public double GetTemplatePriceForItems(List items) { var total = 0D; - foreach (var item in items) total += GetTemplatePrice(item.Template); + foreach (var item in items) + { + total += GetTemplatePrice(item.Template); + } return total; } /// - /// Get all items in template with the given parent category + /// Get all items in template with the given parent category /// /// /// string array @@ -124,7 +140,7 @@ public class HandbookHelper( } /// - /// Does category exist in handbook cache + /// Does category exist in handbook cache /// /// /// true if exists in cache @@ -134,7 +150,7 @@ public class HandbookHelper( } /// - /// Get all items associated with a categories parent + /// Get all items associated with a categories parent /// /// /// string array @@ -145,31 +161,34 @@ public class HandbookHelper( } /// - /// Convert non-roubles into roubles + /// Convert non-roubles into roubles /// /// Currency count to convert /// What current currency is /// Count in roubles public int InRUB(double nonRoubleCurrencyCount, string currencyTypeFrom) { - return (int)(currencyTypeFrom == Money.ROUBLES + return (int) (currencyTypeFrom == Money.ROUBLES ? nonRoubleCurrencyCount : Math.Round(nonRoubleCurrencyCount * GetTemplatePrice(currencyTypeFrom))); } /// - /// Convert roubles into another currency + /// Convert roubles into another currency /// /// roubles to convert /// Currency to convert roubles into /// currency count in desired type public int FromRUB(double roubleCurrencyCount, string currencyTypeTo) { - if (currencyTypeTo == Money.ROUBLES) return (int)roubleCurrencyCount; + if (currencyTypeTo == Money.ROUBLES) + { + return (int) roubleCurrencyCount; + } // Get price of currency from handbook var price = GetTemplatePrice(currencyTypeTo); - return (int)(price > 0 ? Math.Max(1, Math.Round(roubleCurrencyCount / price)) : 0); + return (int) (price > 0 ? Math.Max(1, Math.Round(roubleCurrencyCount / price)) : 0); } public HandbookCategory GetCategoryById(string handbookId) @@ -180,24 +199,42 @@ public class HandbookHelper( public class LookupItem { - public Dictionary ById { get; set; } - public Dictionary> ByParent { get; set; } - public LookupItem() { ById = new Dictionary(); ByParent = new Dictionary>(); } + + public Dictionary ById + { + get; + set; + } + + public Dictionary> ByParent + { + get; + set; + } } public class LookupCollection { - public LookupItem Items { get; set; } - public LookupItem Categories { get; set; } - public LookupCollection() { Items = new LookupItem(); Categories = new LookupItem(); } + + public LookupItem Items + { + get; + set; + } + + public LookupItem Categories + { + get; + set; + } } diff --git a/Libraries/Core/Helpers/HealthHelper.cs b/Libraries/Core/Helpers/HealthHelper.cs index b6c63787..f2da8628 100644 --- a/Libraries/Core/Helpers/HealthHelper.cs +++ b/Libraries/Core/Helpers/HealthHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; @@ -6,6 +5,7 @@ using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; using BodyPartHealth = Core.Models.Eft.Common.Tables.BodyPartHealth; using Vitality = Core.Models.Eft.Profile.Vitality; @@ -23,7 +23,7 @@ public class HealthHelper( protected HealthConfig _healthConfig = _configServer.GetConfig(); /// - /// Resets the profiles vitality/health and vitality/effects properties to their defaults + /// Resets the profiles vitality/health and vitality/effects properties to their defaults /// /// Session Id /// Updated profile @@ -38,7 +38,13 @@ public class HealthHelper( public void DefaultVitality(Vitality? vitality) { - vitality ??= new Vitality { Health = null, Energy = 0, Temperature = 0, Hydration = 0 }; + vitality ??= new Vitality + { + Health = null, + Energy = 0, + Temperature = 0, + Hydration = 0 + }; vitality.Health = new Dictionary { @@ -116,7 +122,7 @@ public class HealthHelper( } /// - /// Update player profile vitality values with changes from client request object + /// Update player profile vitality values with changes from client request object /// /// Player profile /// Post raid data @@ -139,7 +145,10 @@ public class HealthHelper( .GetByJsonProp(profileEdition) .GetByJsonProp(profileSide.ToLower()) ?.Character?.Health?.Temperature ?? - new CurrentMinMax { Current = 36.6 }; + new CurrentMinMax + { + Current = 36.6 + }; StoreHydrationEnergyTempInProfile( fullProfile, @@ -153,15 +162,21 @@ public class HealthHelper( { // Effects if (postRaidHealth.BodyParts[bodyPart.Key].Effects is not null) + { fullProfile.VitalityData.Health[bodyPart.Key].Effects = postRaidHealth.BodyParts[bodyPart.Key].Effects; + } // Limb hp if (!isDead) // Player alive, not is limb alive + { fullProfile.VitalityData.Health[bodyPart.Key].Health.Current = postRaidHealth.BodyParts[bodyPart.Key].Health.Current ?? 0; + } else + { fullProfile.VitalityData.Health[bodyPart.Key].Health.Current = pmcData.Health.BodyParts[bodyPart.Key].Health.Maximum * _healthConfig.HealthMultipliers.Death ?? 0; + } } TransferPostRaidLimbEffectsToProfile(postRaidHealth.BodyParts, pmcData); @@ -188,7 +203,7 @@ public class HealthHelper( } /// - /// Take body part effects from client profile and apply to server profile + /// Take body part effects from client profile and apply to server profile /// /// Post-raid body part data /// Player profile on server @@ -213,38 +228,60 @@ public class HealthHelper( { if (effectsToIgnore.Contains(effect.Key)) // Get rid of certain effects we dont want to persist out of raid + { dictEffect = null; + } continue; } if (effectsToIgnore.Contains(effect.Key)) // Do not pass some effects to out of raid profile + { continue; + } - var effectToAdd = new BodyPartEffectProperties { Time = effectDetails.Time ?? -1 }; + var effectToAdd = new BodyPartEffectProperties + { + Time = effectDetails.Time ?? -1 + }; // Add effect to server profile - if (profileBodyPartEffects.TryAdd(effect.Key, effectToAdd)) profileBodyPartEffects[effect.Key] = effectToAdd; + if (profileBodyPartEffects.TryAdd(effect.Key, effectToAdd)) + { + profileBodyPartEffects[effect.Key] = effectToAdd; + } } } } /// - /// Adjust hydration/energy/temperate and body part hp values in player profile to values in profile.vitality + /// Adjust hydration/energy/temperate and body part hp values in player profile to values in profile.vitality /// /// Profile to update /// Session id protected void SaveHealth(PmcData pmcData, string sessionID) { - if (!_healthConfig.Save.Health) return; + if (!_healthConfig.Save.Health) + { + return; + } var profileHealth = _saveServer.GetProfile(sessionID).VitalityData; - if (profileHealth.Hydration > pmcData.Health.Hydration.Maximum) profileHealth.Hydration = pmcData.Health.Hydration.Maximum; + if (profileHealth.Hydration > pmcData.Health.Hydration.Maximum) + { + profileHealth.Hydration = pmcData.Health.Hydration.Maximum; + } - if (profileHealth.Energy > pmcData.Health.Energy.Maximum) profileHealth.Energy = pmcData.Health.Energy.Maximum; + if (profileHealth.Energy > pmcData.Health.Energy.Maximum) + { + profileHealth.Energy = pmcData.Health.Energy.Maximum; + } - if (profileHealth.Temperature > pmcData.Health.Temperature.Maximum) profileHealth.Temperature = pmcData.Health.Temperature.Maximum; + if (profileHealth.Temperature > pmcData.Health.Temperature.Maximum) + { + profileHealth.Temperature = pmcData.Health.Temperature.Maximum; + } pmcData.Health.Hydration.Current = Math.Round(profileHealth.Hydration ?? 0); pmcData.Health.Energy.Current = Math.Round(profileHealth.Energy ?? 0); @@ -253,19 +290,23 @@ public class HealthHelper( foreach (var bodyPart in pmcData.Health.BodyParts) { if (profileHealth.Health[bodyPart.Key].Health.Maximum > bodyPart.Value.Health.Maximum) + { profileHealth.Health[bodyPart.Key].Health.Maximum = bodyPart.Value.Health.Maximum; + } if (profileHealth.Health[bodyPart.Key].Health.Current == 0) + { profileHealth.Health[bodyPart.Key].Health.Current = bodyPart.Value.Health.Maximum * _healthConfig.HealthMultipliers.Blacked; + } bodyPart.Value.Health.Current = Math.Round(profileHealth.Health[bodyPart.Key].Health.Current ?? 0); } } /// - /// Save effects to profile - /// Works by removing all effects and adding them back from profile - /// Removes empty 'Effects' objects if found + /// Save effects to profile + /// Works by removing all effects and adding them back from profile + /// Removes empty 'Effects' objects if found /// /// Player profile /// Session id @@ -278,26 +319,36 @@ public class HealthHelper( bool deleteExistingEffects = true) { // TODO: this will need to change, typing is all fucked up - if (!_healthConfig.Save.Effects) return; + if (!_healthConfig.Save.Effects) + { + return; + } foreach (var bodyPart in bodyPartsWithEffects) { // clear effects from profile bodyPart - if (deleteExistingEffects) pmcData.Health.BodyParts[bodyPart.Key].Effects = new Dictionary(); + if (deleteExistingEffects) + { + pmcData.Health.BodyParts[bodyPart.Key].Effects = new Dictionary(); + } foreach (var effectType in bodyPartsWithEffects[bodyPart.Key].Effects) { var time = effectType.Value.Time; if (time is not null && time > 0) + { AddEffect(pmcData, effectType, time); + } else + { AddEffect(pmcData, effectType); + } } } } /// - /// Add effect to body part in profile + /// Add effect to body part in profile /// /// Player profile /// Body part to edit @@ -308,6 +359,9 @@ public class HealthHelper( var profileBodyPart = pmcData.Health.BodyParts[effectType.Key]; profileBodyPart.Effects ??= new Dictionary(); - profileBodyPart.Effects[effectType.Key] = new BodyPartEffectProperties { Time = duration }; + profileBodyPart.Effects[effectType.Key] = new BodyPartEffectProperties + { + Time = duration + }; } } diff --git a/Libraries/Core/Helpers/HideoutHelper.cs b/Libraries/Core/Helpers/HideoutHelper.cs index 5062cf48..a48e91b1 100644 --- a/Libraries/Core/Helpers/HideoutHelper.cs +++ b/Libraries/Core/Helpers/HideoutHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Hideout; @@ -12,6 +11,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -33,17 +33,16 @@ public class HideoutHelper( ICloner _cloner ) { - protected HideoutConfig hideoutConfig = _configServer.GetConfig(); - public const string BitcoinFarm = "5d5c205bd582a50d042a3c0e"; public const string CultistCircleCraftId = "66827062405f392b203a44cf"; public const string BitcoinProductionId = "5d5c205bd582a50d042a3c0e"; public const string WaterCollector = "5d5589c1f934db045e6c5492"; public const int MaxSkillPoint = 5000; protected List _idCheck = [BitcoinFarm, CultistCircleCraftId]; + protected HideoutConfig hideoutConfig = _configServer.GetConfig(); /// - /// Add production to profiles' Hideout.Production array + /// Add production to profiles' Hideout.Production array /// /// Profile to add production to /// Production request @@ -56,7 +55,7 @@ public class HideoutHelper( { var recipe = _databaseService .GetHideout() - .Production.Recipes.FirstOrDefault((production) => production.Id == body.RecipeId); + .Production.Recipes.FirstOrDefault(production => production.Id == body.RecipeId); if (recipe is null) { _logger.Error(_localisationService.GetText("hideout-missing_recipe_in_db", body.RecipeId)); @@ -67,7 +66,10 @@ public class HideoutHelper( // @Important: Here we need to be very exact: // - normal recipe: Production time value is stored in attribute "productionType" with small "p" // - scav case recipe: Production time value is stored in attribute "ProductionType" with capital "P" - if (pmcData.Hideout?.Production is null) pmcData.Hideout.Production = new Dictionary(); + if (pmcData.Hideout?.Production is null) + { + pmcData.Hideout.Production = new Dictionary(); + } var modifiedProductionTime = GetAdjustedCraftTimeWithSkills(pmcData, body.RecipeId); @@ -84,7 +86,7 @@ public class HideoutHelper( foreach (var tool in body.Tools) { - var toolItem = _cloner.Clone(pmcData.Inventory.Items.FirstOrDefault((x) => x.Id == tool.Id)); + var toolItem = _cloner.Clone(pmcData.Inventory.Items.FirstOrDefault(x => x.Id == tool.Id)); // Make sure we only return as many as we took _itemHelper.AddUpdObjectToItem(toolItem); @@ -106,7 +108,7 @@ public class HideoutHelper( } /// - /// Add production to profiles' Hideout.Production array + /// Add production to profiles' Hideout.Production array /// /// Profile to add production to /// Production request @@ -119,7 +121,7 @@ public class HideoutHelper( { var recipe = _databaseService .GetHideout() - .Production.Recipes.FirstOrDefault((production) => production.Id == body.RecipeId); + .Production.Recipes.FirstOrDefault(production => production.Id == body.RecipeId); if (recipe is null) { _logger.Error(_localisationService.GetText("hideout-missing_recipe_in_db", body.RecipeId)); @@ -130,7 +132,10 @@ public class HideoutHelper( // @Important: Here we need to be very exact: // - normal recipe: Production time value is stored in attribute "productionType" with small "p" // - scav case recipe: Production time value is stored in attribute "ProductionType" with capital "P" - if (pmcData.Hideout?.Production is null) pmcData.Hideout.Production = new Dictionary(); + if (pmcData.Hideout?.Production is null) + { + pmcData.Hideout.Production = new Dictionary(); + } var modifiedProductionTime = GetAdjustedCraftTimeWithSkills(pmcData, body.RecipeId); @@ -144,8 +149,8 @@ public class HideoutHelper( } /// - /// This convenience function initializes new Production Object - /// with all the constants. + /// This convenience function initializes new Production Object + /// with all the constants. /// public Production InitProduction( string recipeId, @@ -169,7 +174,7 @@ public class HideoutHelper( } /// - /// Apply bonus to player profile given after completing hideout upgrades + /// Apply bonus to player profile given after completing hideout upgrades /// /// Profile to add bonus to /// Bonus to add to profile @@ -179,16 +184,18 @@ public class HideoutHelper( switch (bonus.Type) { case BonusType.StashSize: - { - // Find stash item and adjust tpl to new tpl from bonus - var stashItem = profileData.Inventory.Items.FirstOrDefault((x) => x.Id == profileData.Inventory.Stash); - if (stashItem is null) - _logger.Warning(_localisationService.GetText("hideout-unable_to_apply_stashsize_bonus_no_stash_found", profileData.Inventory.Stash)); + { + // Find stash item and adjust tpl to new tpl from bonus + var stashItem = profileData.Inventory.Items.FirstOrDefault(x => x.Id == profileData.Inventory.Stash); + if (stashItem is null) + { + _logger.Warning(_localisationService.GetText("hideout-unable_to_apply_stashsize_bonus_no_stash_found", profileData.Inventory.Stash)); + } - stashItem.Template = bonus.TemplateId; + stashItem.Template = bonus.TemplateId; - break; - } + break; + } case BonusType.MaximumEnergyReserve: // Amend max energy in profile profileData.Health.Energy.Maximum += bonus.Value; @@ -203,12 +210,16 @@ public class HideoutHelper( // Add bonus to player bonuses array in profile // EnergyRegeneration, HealthRegeneration, RagfairCommission, ScavCooldownTimer, SkillGroupLevelingBoost, ExperienceRate, QuestMoneyReward etc - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Adding bonus: {bonus.Type} to profile, value: {bonus.Value}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Adding bonus: {bonus.Type} to profile, value: {bonus.Value}"); + } + profileData.Bonuses.Add(bonus); } /// - /// Process a players hideout, update areas that use resources + increment production timers + /// Process a players hideout, update areas that use resources + increment production timers /// /// Session id public void UpdatePlayerHideout(string sessionID) @@ -224,21 +235,21 @@ public class HideoutHelper( } /// - /// Get various properties that will be passed to hideout update-related functions + /// Get various properties that will be passed to hideout update-related functions /// /// Player profile /// Properties protected HideoutProperties GetHideoutProperties(PmcData pmcData) { - var bitcoinFarm = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.BITCOIN_FARM); - var bitcoinCount = bitcoinFarm?.Slots.Where((slot) => slot.Items is not null).Count(); // Get slots with an item property + var bitcoinFarm = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.BITCOIN_FARM); + var bitcoinCount = bitcoinFarm?.Slots.Where(slot => slot.Items is not null).Count(); // Get slots with an item property var hideoutProperties = new HideoutProperties { BtcFarmGcs = bitcoinCount, - IsGeneratorOn = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.GENERATOR)?.Active ?? false, + IsGeneratorOn = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.GENERATOR)?.Active ?? false, WaterCollectorHasFilter = DoesWaterCollectorHaveFilter( - pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.WATER_COLLECTOR) + pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.WATER_COLLECTOR) ) }; @@ -250,14 +261,16 @@ public class HideoutHelper( // Can put filters in from L3 if (waterCollector.Level == 3) // Has filter in at least one slot + { return waterCollector.Slots.Any(slot => slot.Items is not null); + } // No Filter return false; } /// - /// Iterate over productions and update their progress timers + /// Iterate over productions and update their progress timers /// /// Profile to check for productions and update /// Hideout properties @@ -288,7 +301,10 @@ public class HideoutHelper( } // Skip processing (Don't skip continious crafts like bitcoin farm or cultist circle) - if (IsCraftComplete(craft)) continue; + if (IsCraftComplete(craft)) + { + continue; + } // Special handling required if (IsCraftOfType(craft, HideoutAreas.SCAV_CASE)) @@ -327,7 +343,7 @@ public class HideoutHelper( } // Ensure recipe exists before using it in updateProductionProgress() - var recipe = recipes.Recipes.FirstOrDefault((r) => r.Id == prodId.Key); + var recipe = recipes.Recipes.FirstOrDefault(r => r.Id == prodId.Key); if (recipe is null) { _logger.Error(_localisationService.GetText("hideout-missing_recipe_for_area", prodId)); @@ -340,7 +356,7 @@ public class HideoutHelper( } /// - /// Is a craft from a particular hideout area + /// Is a craft from a particular hideout area /// /// Craft to check /// Type to check craft against @@ -364,8 +380,8 @@ public class HideoutHelper( } /// - /// Has the craft completed - /// Ignores bitcoin farm/cultist circle as they're continuous crafts + /// Has the craft completed + /// Ignores bitcoin farm/cultist circle as they're continuous crafts /// /// Craft to check /// True when craft is complete @@ -376,7 +392,7 @@ public class HideoutHelper( } /// - /// Update progress timer for water collector + /// Update progress timer for water collector /// /// profile to update /// id of water collection production to update @@ -387,11 +403,14 @@ public class HideoutHelper( HideoutProperties hideoutProperties) { var timeElapsed = GetTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.IsGeneratorOn); - if (hideoutProperties.WaterCollectorHasFilter) pmcData.Hideout.Production[productionId].Progress += timeElapsed; + if (hideoutProperties.WaterCollectorHasFilter) + { + pmcData.Hideout.Production[productionId].Progress += timeElapsed; + } } /// - /// Update a productions progress value based on the amount of time that has passed + /// Update a productions progress value based on the amount of time that has passed /// /// Player profile /// Production id being crafted @@ -404,7 +423,10 @@ public class HideoutHelper( HideoutProperties hideoutProperties) { // Production is complete, no need to do any calculations - if (DoesProgressMatchProductionTime(pmcData, prodId)) return; + if (DoesProgressMatchProductionTime(pmcData, prodId)) + { + return; + } // Get seconds since last hideout update + now var timeElapsed = GetTimeElapsedSinceLastServerTick(pmcData, hideoutProperties.IsGeneratorOn, recipe); @@ -417,7 +439,9 @@ public class HideoutHelper( // Limit progress to total production time if progress is over (dont run for continious crafts)) if (!(recipe.Continuous ?? false)) // If progress is larger than prod time, return ProductionTime, hard cap the vaue + { production.Progress = Math.Min(production.Progress ?? 0, production.ProductionTime ?? 0); + } } protected void UpdateCultistCircleCraftProgress(PmcData pmcData, string prodId) @@ -425,7 +449,10 @@ public class HideoutHelper( var production = pmcData.Hideout.Production[prodId]; // Check if we're already complete, skip - if (production.AvailableForFinish ?? false) return; + if (production.AvailableForFinish ?? false) + { + return; + } // Get seconds since last hideout update var timeElapsedSeconds = _timeUtil.GetTimeStamp() - pmcData.Hideout.SptUpdateLastRunTimestamp; @@ -436,7 +463,10 @@ public class HideoutHelper( production.Progress += timeElapsedSeconds; // Check if craft is complete - if (production.Progress >= production.ProductionTime) FlagCultistCircleCraftAsComplete(production); + if (production.Progress >= production.ProductionTime) + { + FlagCultistCircleCraftAsComplete(production); + } return; } @@ -455,7 +485,7 @@ public class HideoutHelper( } /// - /// Check if a productions progress value matches its corresponding recipes production time value + /// Check if a productions progress value matches its corresponding recipes production time value /// /// Player profile /// Production id @@ -467,7 +497,7 @@ public class HideoutHelper( } /// - /// Update progress timer for scav case + /// Update progress timer for scav case /// /// Profile to update /// Id of scav case production to update @@ -482,7 +512,7 @@ public class HideoutHelper( } /// - /// Iterate over hideout areas that use resources (fuel/filters etc) and update associated values + /// Iterate over hideout areas that use resources (fuel/filters etc) and update associated values /// /// Session id /// Profile to update areas of @@ -493,10 +523,14 @@ public class HideoutHelper( HideoutProperties hideoutProperties) { foreach (var area in pmcData.Hideout.Areas) + { switch (area.Type) { case HideoutAreas.GENERATOR: - if (hideoutProperties.IsGeneratorOn) UpdateFuel(area, pmcData, hideoutProperties.IsGeneratorOn); + if (hideoutProperties.IsGeneratorOn) + { + UpdateFuel(area, pmcData, hideoutProperties.IsGeneratorOn); + } break; case HideoutAreas.WATER_COLLECTOR: @@ -504,14 +538,18 @@ public class HideoutHelper( break; case HideoutAreas.AIR_FILTERING: - if (hideoutProperties.IsGeneratorOn) UpdateAirFilters(area, pmcData, hideoutProperties.IsGeneratorOn); + if (hideoutProperties.IsGeneratorOn) + { + UpdateAirFilters(area, pmcData, hideoutProperties.IsGeneratorOn); + } break; } + } } /// - /// Decrease fuel from generator slots based on amount of time since last time this occurred + /// Decrease fuel from generator slots based on amount of time since last time this occurred /// /// Hideout area /// Player profile @@ -539,7 +577,10 @@ public class HideoutHelper( var combinedBonus = 1.0 - (fuelConsumptionBonusRate + hideoutManagementConsumptionBonusRate); // Sanity check, never let fuel consumption go negative, otherwise it returns fuel to the player - if (combinedBonus < 0) combinedBonus = 0; + if (combinedBonus < 0) + { + combinedBonus = 0; + } fuelUsedSinceLastTick *= combinedBonus; @@ -550,17 +591,23 @@ public class HideoutHelper( var generatorSlot = generatorArea.Slots[i]; if (generatorSlot?.Items is null) // No item in slot, skip + { continue; + } var fuelItemInSlot = generatorSlot?.Items[0]; if (fuelItemInSlot is null) // No item in slot, skip + { continue; + } var fuelRemaining = fuelItemInSlot.Upd?.Resource?.Value; if (fuelRemaining == 0) // No fuel left, skip + { continue; + } // Undefined fuel, fresh fuel item and needs its max fuel amount looked up if (fuelRemaining is null) @@ -572,7 +619,7 @@ public class HideoutHelper( else { // Fuel exists already, deduct fuel from item remaining value - pointsConsumed = (double)((fuelItemInSlot.Upd.Resource.UnitsConsumed ?? 0) + fuelUsedSinceLastTick); + pointsConsumed = (double) ((fuelItemInSlot.Upd.Resource.UnitsConsumed ?? 0) + fuelUsedSinceLastTick); fuelRemaining -= fuelUsedSinceLastTick; } @@ -593,7 +640,11 @@ public class HideoutHelper( // Deducted all used fuel from this container, clean up and exit loop fuelItemInSlot.Upd = GetAreaUpdObject(1, fuelRemaining, pointsConsumed, isFuelItemFoundInRaid); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Profile: {pmcData.Id} Generator has: {fuelRemaining} fuel left in slot {i + 1}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Profile: {pmcData.Id} Generator has: {fuelRemaining} fuel left in slot {i + 1}"); + } + hasFuelRemaining = true; break; // Break to avoid updating all the fuel tanks @@ -603,11 +654,17 @@ public class HideoutHelper( // Ran out of fuel items to deduct fuel from fuelUsedSinceLastTick = Math.Abs(fuelRemaining ?? 0); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Profile: {pmcData.Id} Generator ran out of fuel"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Profile: {pmcData.Id} Generator ran out of fuel"); + } } // Out of fuel, flag generator as offline - if (!hasFuelRemaining) generatorArea.Active = false; + if (!hasFuelRemaining) + { + generatorArea.Active = false; + } } protected void UpdateWaterCollector( @@ -617,9 +674,15 @@ public class HideoutHelper( HideoutProperties hideoutProperties) { // Skip water collector when not level 3 (cant collect until 3) - if (area.Level != 3) return; + if (area.Level != 3) + { + return; + } - if (!hideoutProperties.WaterCollectorHasFilter) return; + if (!hideoutProperties.WaterCollectorHasFilter) + { + return; + } // Canister with purified water craft exists var purifiedWaterCraft = pmcData.Hideout.Production[WaterCollector]; @@ -652,7 +715,7 @@ public class HideoutHelper( } /// - /// Get craft time and make adjustments to account for dev profile + crafting skill level + /// Get craft time and make adjustments to account for dev profile + crafting skill level /// /// Player profile making craft /// Recipe being crafted @@ -667,7 +730,7 @@ public class HideoutHelper( var recipe = _databaseService .GetHideout() - .Production.Recipes.FirstOrDefault((production) => production.Id == recipeId); + .Production.Recipes.FirstOrDefault(production => production.Id == recipeId); if (recipe is null) { _logger.Error(_localisationService.GetText("hideout-missing_recipe_in_db", recipeId)); @@ -680,33 +743,43 @@ public class HideoutHelper( // Bitcoin farm is excluded from crafting skill cooldown reduction if (recipeId != BitcoinFarm) // Seconds to deduct from crafts total time + { timeReductionSeconds += GetSkillProductionTimeReduction( pmcData, recipe.ProductionTime ?? 0, SkillTypes.Crafting, globalSkillsDb.Crafting.ProductionTimeReductionPerLevel ?? 0 ); + } // Some crafts take into account hideout management, e.g. fuel, water/air filters if (applyHideoutManagementBonus) + { timeReductionSeconds += GetSkillProductionTimeReduction( pmcData, recipe.ProductionTime ?? 0, SkillTypes.HideoutManagement, globalSkillsDb.HideoutManagement.ConsumptionReductionPerLevel ?? 0 ); + } var modifiedProductionTime = recipe.ProductionTime - timeReductionSeconds; - if (modifiedProductionTime > 0 && _profileHelper.IsDeveloperAccount(pmcData.Id)) modifiedProductionTime = 40; + if (modifiedProductionTime > 0 && _profileHelper.IsDeveloperAccount(pmcData.Id)) + { + modifiedProductionTime = 40; + } // Sanity check, don't let anything craft in less than 5 seconds - if (modifiedProductionTime < 5) modifiedProductionTime = 5; + if (modifiedProductionTime < 5) + { + modifiedProductionTime = 5; + } return modifiedProductionTime; } /// - /// Adjust water filter objects resourceValue or delete when they reach 0 resource + /// Adjust water filter objects resourceValue or delete when they reach 0 resource /// /// Water filter area to update /// Production object @@ -735,13 +808,18 @@ public class HideoutHelper( // Check progress against the productions craft time (dont use base time as it doesnt include any time bonuses profile has) if (production.Progress > production.ProductionTime) // Craft is complete nothing to do + { return; + } // Check all slots that take water filters until we find one with filter in it for (var i = 0; i < waterFilterArea.Slots.Count; i++) { // No water filter in slot, skip - if (waterFilterArea.Slots[i].Items is null) continue; + if (waterFilterArea.Slots[i].Items is null) + { + continue; + } var waterFilterItemInSlot = waterFilterArea.Slots[i].Items[0]; @@ -784,7 +862,10 @@ public class HideoutHelper( pointsConsumed, isWaterFilterFoundInRaid ); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Water filter has: {resourceValue} units left in slot {i + 1}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Water filter has: {resourceValue} units left in slot {i + 1}"); + } break; // Break here to avoid iterating other filters now w're done } @@ -798,8 +879,8 @@ public class HideoutHelper( } /// - /// Get an adjusted water filter drain rate based on time elapsed since last run, - /// handle edge case when craft time has gone on longer than total production time + /// Get an adjusted water filter drain rate based on time elapsed since last run, + /// handle edge case when craft time has gone on longer than total production time /// /// Time passed /// Total time collecting water @@ -822,7 +903,7 @@ public class HideoutHelper( } /// - /// Get the water filter drain rate based on hideout bonuses player has + /// Get the water filter drain rate based on hideout bonuses player has /// /// Player profile /// Drain rate @@ -854,7 +935,7 @@ public class HideoutHelper( } /// - /// Get the production time in seconds for the desired production + /// Get the production time in seconds for the desired production /// /// Id, e.g. Water collector id /// Seconds to produce item @@ -862,7 +943,7 @@ public class HideoutHelper( { return _databaseService.GetHideout() .Production.Recipes.FirstOrDefault( - (prod) => + prod => prod.Id == prodId ) ?.ProductionTime ?? @@ -870,7 +951,7 @@ public class HideoutHelper( } /// - /// Create a upd object using passed in parameters + /// Create a upd object using passed in parameters /// /// /// @@ -885,7 +966,11 @@ public class HideoutHelper( return new Upd { StackObjectsCount = stackCount, - Resource = new UpdResource { Value = resourceValue, UnitsConsumed = resourceUnitsConsumed }, + Resource = new UpdResource + { + Value = resourceValue, + UnitsConsumed = resourceUnitsConsumed + }, SpawnedInSession = isFoundInRaid }; } @@ -907,6 +992,7 @@ public class HideoutHelper( var pointsConsumed = 0D; for (var i = 0; i < airFilterArea.Slots.Count; i++) + { if (airFilterArea.Slots[i].Items is not null) { var resourceValue = airFilterArea.Slots[i].Items[0].Upd?.Resource is not null @@ -939,9 +1025,17 @@ public class HideoutHelper( airFilterArea.Slots[i].Items[0].Upd = new Upd { StackObjectsCount = 1, - Resource = new UpdResource { Value = resourceValue, UnitsConsumed = pointsConsumed } + Resource = new UpdResource + { + Value = resourceValue, + UnitsConsumed = pointsConsumed + } }; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Air filter: {resourceValue} filter left on slot {i + 1}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Air filter: {resourceValue} filter left on slot {i + 1}"); + } + break; // Break here to avoid updating all filters } @@ -949,6 +1043,7 @@ public class HideoutHelper( // Update remaining resources to be subtracted filterDrainRate = Math.Abs(resourceValue ?? 0); } + } } protected void UpdateBitcoinFarm( @@ -958,7 +1053,10 @@ public class HideoutHelper( bool isGeneratorOn) { var isBtcProd = btcProduction.GetType() == typeof(Production); - if (!isBtcProd) return; + if (!isBtcProd) + { + return; + } // The wiki has a wrong formula! // Do not change unless you validate it with the Client code files! @@ -997,7 +1095,9 @@ public class HideoutHelper( // Needs power to function if (!isGeneratorOn) // Return with no changes + { return; + } var coinSlotCount = GetBTCSlots(pmcData); @@ -1012,7 +1112,7 @@ public class HideoutHelper( var bitcoinProdData = _databaseService .GetHideout() - .Production.Recipes.FirstOrDefault((production) => production.Id == BitcoinProductionId); + .Production.Recipes.FirstOrDefault(production => production.Id == BitcoinProductionId); // BSG finally fixed their settings, they now get loaded from the settings and used in the client var adjustedCraftTime = @@ -1025,18 +1125,24 @@ public class HideoutHelper( btcProduction.Progress += Math.Floor(timeElapsedSeconds * timeMultiplier ?? 0); while (btcProduction.Progress >= bitcoinProdData.ProductionTime) + { if (btcProduction.Products.Count < coinSlotCount) // Has space to add a coin to production rewards + { AddBtcToProduction(btcProduction, bitcoinProdData.ProductionTime ?? 0); + } else // Filled up bitcoin storage + { btcProduction.Progress = 0; + } + } btcProduction.StartTimestamp = _timeUtil.GetTimeStamp(); } /// - /// Add bitcoin object to btc production products array and set progress time + /// Add bitcoin object to btc production products array and set progress time /// /// Bitcoin production object /// Time to craft a bitcoin @@ -1047,7 +1153,10 @@ public class HideoutHelper( { Id = _hashUtil.Generate(), Template = ItemTpl.BARTER_PHYSICAL_BITCOIN, - Upd = new Upd { StackObjectsCount = 1 } + Upd = new Upd + { + StackObjectsCount = 1 + } } ); @@ -1056,7 +1165,7 @@ public class HideoutHelper( } /// - /// Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off + /// Get number of ticks that have passed since hideout areas were last processed, reduced when generator is off /// /// Player profile /// Is the generator on for the duration of elapsed time @@ -1072,19 +1181,24 @@ public class HideoutHelper( if (recipe is not null) { - var hideoutArea = _databaseService.GetHideout().Areas.FirstOrDefault((area) => area.Type == recipe.AreaType); + var hideoutArea = _databaseService.GetHideout().Areas.FirstOrDefault(area => area.Type == recipe.AreaType); if (!(hideoutArea.NeedsFuel ?? false)) // e.g. Lavatory works at 100% when power is on / off + { return timeElapsed; + } } - if (!isGeneratorOn) timeElapsed *= (long)_databaseService.GetHideout().Settings.GeneratorSpeedWithoutFuel; + if (!isGeneratorOn) + { + timeElapsed *= (long) _databaseService.GetHideout().Settings.GeneratorSpeedWithoutFuel; + } return timeElapsed; } /// - /// Get a count of how many possible BTC can be gathered by the profile + /// Get a count of how many possible BTC can be gathered by the profile /// /// Profile to look up /// Coin slot count @@ -1092,7 +1206,7 @@ public class HideoutHelper( { var bitcoinProductions = _databaseService .GetHideout() - .Production.Recipes.FirstOrDefault((production) => production.Id == BitcoinFarm); + .Production.Recipes.FirstOrDefault(production => production.Id == BitcoinFarm); var productionSlots = bitcoinProductions?.ProductionLimitCount ?? 3; // Default to 3 if none found var hasManagementSkillSlots = _profileHelper.HasEliteSkillLevel(SkillTypes.HideoutManagement, pmcData); var managementSlotsCount = GetEliteSkillAdditionalBitcoinSlotCount() ?? 2; @@ -1101,7 +1215,7 @@ public class HideoutHelper( } /// - /// Get a count of how many additional bitcoins player hideout can hold with elite skill + /// Get a count of how many additional bitcoins player hideout can hold with elite skill /// protected double? GetEliteSkillAdditionalBitcoinSlotCount() { @@ -1111,15 +1225,18 @@ public class HideoutHelper( } /// - /// HideoutManagement skill gives a consumption bonus the higher the level - /// 0.5% per level per 1-51, (25.5% at max) + /// HideoutManagement skill gives a consumption bonus the higher the level + /// 0.5% per level per 1-51, (25.5% at max) /// /// Profile to get hideout consumption level from /// Consumption bonus protected double? GetHideoutManagementConsumptionBonus(PmcData pmcData) { var hideoutManagementSkill = _profileHelper.GetSkillFromProfile(pmcData, SkillTypes.HideoutManagement); - if (hideoutManagementSkill is null || hideoutManagementSkill.Progress == 0) return 0; + if (hideoutManagementSkill is null || hideoutManagementSkill.Progress == 0) + { + return 0; + } // If the level is 51 we need to round it at 50 so on elite you dont get 25.5% // at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki @@ -1135,7 +1252,7 @@ public class HideoutHelper( } /// - /// Get a multiplier based on player's skill level and value per level + /// Get a multiplier based on player's skill level and value per level /// /// Player profile /// Player skill from profile @@ -1144,7 +1261,10 @@ public class HideoutHelper( protected double GetSkillBonusMultipliedBySkillLevel(PmcData pmcData, SkillTypes skill, double valuePerLevel) { var profileSkill = _profileHelper.GetSkillFromProfile(pmcData, skill); - if (profileSkill is null || profileSkill.Progress == 0) return 0; + if (profileSkill is null || profileSkill.Progress == 0) + { + return 0; + } // If the level is 51 we need to round it at 50 so on elite you dont get 25.5% // at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki @@ -1174,8 +1294,8 @@ public class HideoutHelper( } /// - /// Gather crafted BTC from hideout area and add to inventory - /// Reset production start timestamp if hideout area at full coin capacity + /// Gather crafted BTC from hideout area and add to inventory + /// Reset production start timestamp if hideout area at full coin capacity /// /// Player profile /// Take production request @@ -1201,16 +1321,21 @@ public class HideoutHelper( List> itemsToAdd = []; for (var index = 0; index < craftedCoinCount; index++) + { itemsToAdd.Add( [ new Item { Id = _hashUtil.Generate(), Template = ItemTpl.BARTER_PHYSICAL_BITCOIN, - Upd = new Upd { StackObjectsCount = 1 } + Upd = new Upd + { + StackObjectsCount = 1 + } } ] ); + } // Create request for what we want to add to stash var addItemsRequest = new AddItemsDirectRequest @@ -1223,14 +1348,19 @@ public class HideoutHelper( // Add FiR coins to player inventory _inventoryHelper.AddItemsToStash(sessionId, addItemsRequest, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } // Is at max capacity + we collected all coins - reset production start time var coinSlotCount = GetBTCSlots(pmcData); if (pmcData.Hideout.Production[BitcoinFarm].Products.Count >= coinSlotCount) // Set start to now + { pmcData.Hideout.Production[BitcoinFarm].StartTimestamp = _timeUtil .GetTimeStamp(); + } // Remove crafted coins from production in profile now they've been collected // Can only collect all coins, not individially @@ -1238,25 +1368,31 @@ public class HideoutHelper( } /// - /// Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded + /// Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded /// /// Profile to upgrade wall in public void UnlockHideoutWallInProfile(PmcData profileData) { var profileHideoutAreas = profileData.Hideout.Areas; - var waterCollector = profileHideoutAreas.FirstOrDefault((x) => x.Type == HideoutAreas.WATER_COLLECTOR); - var medStation = profileHideoutAreas.FirstOrDefault((x) => x.Type == HideoutAreas.MEDSTATION); - var wall = profileHideoutAreas.FirstOrDefault((x) => x.Type == HideoutAreas.EMERGENCY_WALL); + var waterCollector = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.WATER_COLLECTOR); + var medStation = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.MEDSTATION); + var wall = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.EMERGENCY_WALL); // No collector or med station, skip - if (waterCollector is null && medStation is null) return; + if (waterCollector is null && medStation is null) + { + return; + } // If med-station > level 1 AND water collector > level 1 AND wall is level 0 - if (waterCollector?.Level >= 1 && medStation?.Level >= 1 && wall?.Level <= 0) wall.Level = 3; + if (waterCollector?.Level >= 1 && medStation?.Level >= 1 && wall?.Level <= 0) + { + wall.Level = 3; + } } /// - /// Hideout improvement is flagged as complete + /// Hideout improvement is flagged as complete /// /// hideout improvement object /// true if complete @@ -1266,45 +1402,50 @@ public class HideoutHelper( } /// - /// Iterate over hideout improvements not completed and check if they need to be adjusted + /// Iterate over hideout improvements not completed and check if they need to be adjusted /// /// Profile to adjust public void SetHideoutImprovementsToCompleted(PmcData profileData) { foreach (var improvementId in profileData.Hideout.Improvements) { - if (!profileData.Hideout.Improvements.TryGetValue(improvementId.Key, out var improvementDetails)) continue; + if (!profileData.Hideout.Improvements.TryGetValue(improvementId.Key, out var improvementDetails)) + { + continue; + } if (improvementDetails.Completed == false && improvementDetails.ImproveCompleteTimestamp < _timeUtil.GetTimeStamp() ) + { improvementDetails.Completed = true; + } } } /// - /// Add/remove bonus combat skill based on number of dogtags in place of fame hideout area + /// Add/remove bonus combat skill based on number of dogtags in place of fame hideout area /// /// Player profile public void ApplyPlaceOfFameDogtagBonus(PmcData pmcData) { - var fameAreaProfile = pmcData.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.PLACE_OF_FAME); + var fameAreaProfile = pmcData.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.PLACE_OF_FAME); // Get hideout area 16 bonus array var fameAreaDb = _databaseService .GetHideout() - .Areas.FirstOrDefault((area) => area.Type == HideoutAreas.PLACE_OF_FAME); + .Areas.FirstOrDefault(area => area.Type == HideoutAreas.PLACE_OF_FAME); // Get SkillGroupLevelingBoost object var combatBoostBonusDb = fameAreaDb.Stages[fameAreaProfile.Level.ToString()] .Bonuses.FirstOrDefault( - (bonus) => bonus.Type.ToString() == "SkillGroupLevelingBoost" + bonus => bonus.Type.ToString() == "SkillGroupLevelingBoost" ); // Get SkillGroupLevelingBoost object in profile - var combatBonusProfile = pmcData.Bonuses.FirstOrDefault((bonus) => bonus.Id == combatBoostBonusDb.Id); + var combatBonusProfile = pmcData.Bonuses.FirstOrDefault(bonus => bonus.Id == combatBoostBonusDb.Id); // Get all slotted dogtag items - var activeDogtags = pmcData.Inventory.Items.Where((item) => item?.SlotId?.StartsWith("dogtag") ?? false).ToList(); + var activeDogtags = pmcData.Inventory.Items.Where(item => item?.SlotId?.StartsWith("dogtag") ?? false).ToList(); // Calculate bonus percent (apply hideoutManagement bonus) var hideoutManagementSkill = _profileHelper.GetSkillFromProfile(pmcData, SkillTypes.HideoutManagement); @@ -1317,8 +1458,8 @@ public class HideoutHelper( } /// - /// Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags - /// Reverse engineered from client code + /// Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags + /// Reverse engineered from client code /// /// Player profile /// Active dogtags in place of fame dogtag slots @@ -1330,9 +1471,15 @@ public class HideoutHelper( var result = 0D; foreach (var dogtag in activeDogtags) { - if (dogtag.Upd.Dogtag is null) continue; + if (dogtag.Upd.Dogtag is null) + { + continue; + } - if (int.Parse(dogtag.Upd.Dogtag?.AccountId) == pmcData.Aid) continue; + if (int.Parse(dogtag.Upd.Dogtag?.AccountId) == pmcData.Aid) + { + continue; + } result += 0.01 * dogtag.Upd.Dogtag.Level ?? 0; } @@ -1341,23 +1488,29 @@ public class HideoutHelper( } /// - /// The wall pollutes a profile with various temp buffs/debuffs, - /// Remove them all + /// The wall pollutes a profile with various temp buffs/debuffs, + /// Remove them all /// /// Hideout area data /// Player profile public void RemoveHideoutWallBuffsAndDebuffs(HideoutArea wallAreaDb, PmcData pmcData) { // Smush all stage bonuses into one array for easy iteration - var wallBonuses = wallAreaDb.Stages.SelectMany((stage) => stage.Value.Bonuses); + var wallBonuses = wallAreaDb.Stages.SelectMany(stage => stage.Value.Bonuses); // Get all bonus Ids that the wall adds List bonusIdsToRemove = []; - foreach (var bonus in wallBonuses) bonusIdsToRemove.Add(bonus.Id); + foreach (var bonus in wallBonuses) + { + bonusIdsToRemove.Add(bonus.Id); + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Removing: {bonusIdsToRemove.Count} bonuses from profile"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Removing: {bonusIdsToRemove.Count} bonuses from profile"); + } // Remove the wall bonuses from profile by id - pmcData.Bonuses = pmcData.Bonuses.Where((bonus) => !bonusIdsToRemove.Contains(bonus.Id)).ToList(); + pmcData.Bonuses = pmcData.Bonuses.Where(bonus => !bonusIdsToRemove.Contains(bonus.Id)).ToList(); } } diff --git a/Libraries/Core/Helpers/HttpServerHelper.cs b/Libraries/Core/Helpers/HttpServerHelper.cs index eb6ce1c8..80cb4976 100644 --- a/Libraries/Core/Helpers/HttpServerHelper.cs +++ b/Libraries/Core/Helpers/HttpServerHelper.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Models.Spt.Config; +using Core.Models.Spt.Config; using Core.Servers; +using SptCommon.Annotations; namespace Core.Helpers; @@ -45,7 +45,9 @@ public class HttpServerHelper(ConfigServer configServer) return $"http://{BuildUrl()}"; } - /** Get websocket url + port */ + /** + * Get websocket url + port + */ public string GetWebsocketUrl() { return $"ws://{BuildUrl()}"; diff --git a/Libraries/Core/Helpers/InRaidHelper.cs b/Libraries/Core/Helpers/InRaidHelper.cs index dec4e3bb..f0dea61d 100644 --- a/Libraries/Core/Helpers/InRaidHelper.cs +++ b/Libraries/Core/Helpers/InRaidHelper.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; -using Core.Models.Eft.Common; +using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; namespace Core.Helpers; @@ -18,24 +18,27 @@ public class InRaidHelper( DatabaseService _databaseService ) { - protected LostOnDeathConfig _lostOnDeathConfig = _configServer.GetConfig(); protected InRaidConfig _inRaidConfig = _configServer.GetConfig(); + protected LostOnDeathConfig _lostOnDeathConfig = _configServer.GetConfig(); protected List _pocketSlots = ["pocket1", "pocket2", "pocket3", "pocket4"]; /// - /// Deprecated. Reset the skill points earned in a raid to 0, ready for next raid. + /// Deprecated. Reset the skill points earned in a raid to 0, ready for next raid. /// /// Profile to update protected void ResetSkillPointsEarnedDuringRaid(PmcData profile) { - foreach (var skill in profile.Skills.Common) skill.PointsEarnedDuringSession = 0.0; + foreach (var skill in profile.Skills.Common) + { + skill.PointsEarnedDuringSession = 0.0; + } } /// - /// Update a player's inventory post-raid. - /// Remove equipped items from pre-raid. - /// Add new items found in raid to profile. - /// Store insurance items in profile. + /// Update a player's inventory post-raid. + /// Remove equipped items from pre-raid. + /// Add new items found in raid to profile. + /// Store insurance items in profile. /// /// Session id /// Profile to update @@ -72,7 +75,10 @@ public class InRaidHelper( // Handle Removing of FIR status if player did not survive + not transferring // Do after above filtering code to reduce work done - if (!isSurvived && !isTransfer && !_inRaidConfig.AlwaysKeepFoundInRaidOnRaidEnd) RemoveFiRStatusFromCertainItems(postRaidProfile.Inventory.Items); + if (!isSurvived && !isTransfer && !_inRaidConfig.AlwaysKeepFoundInRaidOnRaidEnd) + { + RemoveFiRStatusFromCertainItems(postRaidProfile.Inventory.Items); + } // Add items from client profile into server profile AddItemsToInventory(postRaidInventoryItems, serverProfile.Inventory.Items); @@ -85,7 +91,7 @@ public class InRaidHelper( } /// - /// Remove FiR status from items. + /// Remove FiR status from items. /// /// Items to process protected void RemoveFiRStatusFromCertainItems(List items) @@ -106,12 +112,16 @@ public class InRaidHelper( ); foreach (var item in itemsToRemovePropertyFrom) + { if (item.Upd is not null) + { item.Upd.SpawnedInSession = false; + } + } } /// - /// Add items from one parameter into another. + /// Add items from one parameter into another. /// /// Items we want to add /// Location to add items to @@ -138,8 +148,8 @@ public class InRaidHelper( } /// - /// Clear PMC inventory of all items except those that are exempt. - /// Used post-raid to remove items after death. + /// Clear PMC inventory of all items except those that are exempt. + /// Used post-raid to remove items after death. /// /// Player profile /// Session id @@ -149,14 +159,16 @@ public class InRaidHelper( var itemIdsToDeleteFromProfile = GetInventoryItemsLostOnDeath(pmcData).Select(item => item.Id); foreach (var itemIdToDelete in itemIdsToDeleteFromProfile) // Items inside containers are handled as part of function + { _inventoryHelper.RemoveItem(pmcData, itemIdToDelete, sessionId); + } // Remove contents of fast panel pmcData.Inventory.FastPanel = new Dictionary(); } /// - /// Remove FiR status from designated container. + /// Remove FiR status from designated container. /// /// Session id /// Player profile @@ -166,20 +178,31 @@ public class InRaidHelper( PmcData pmcData, string secureContainerSlotId) { - if (!pmcData.Inventory.Items.Any(item => item.SlotId == secureContainerSlotId)) return; + if (!pmcData.Inventory.Items.Any(item => item.SlotId == secureContainerSlotId)) + { + return; + } List itemsInsideContainer = []; foreach (var inventoryItem in pmcData.Inventory.Items.Where(item => item.Upd is not null && item.SlotId != "hideout")) + { if (_itemHelper.ItemIsInsideContainer(inventoryItem, secureContainerSlotId, pmcData.Inventory.Items)) + { itemsInsideContainer.Add(inventoryItem); + } + } foreach (var item in itemsInsideContainer) + { if (item.Upd.SpawnedInSession ?? false) + { item.Upd.SpawnedInSession = false; + } + } } /// - /// Get a list of items from a profile that will be lost on death. + /// Get a list of items from a profile that will be lost on death. /// /// Profile to get items from /// List of items lost on death @@ -193,10 +216,16 @@ public class InRaidHelper( item => { // Keep items flagged as kept after death - if (IsItemKeptAfterDeath(pmcProfile, item)) return false; + if (IsItemKeptAfterDeath(pmcProfile, item)) + { + return false; + } // Remove normal items or quest raid items - if (item.ParentId == equipmentRootId || item.ParentId == questRaidItemContainerId) return true; + if (item.ParentId == equipmentRootId || item.ParentId == questRaidItemContainerId) + { + return true; + } // Pocket items are lost on death // Ensure we dont pick up pocket items from manniquins @@ -204,7 +233,9 @@ public class InRaidHelper( item.SlotId.StartsWith("pocket") && _inventoryHelper.DoesItemHaveRootId(pmcProfile, item, pmcProfile.Inventory.Equipment) ) + { return true; + } return false; } @@ -213,7 +244,7 @@ public class InRaidHelper( } /// - /// Does the provided item's slotId mean it's kept on the player after death? + /// Does the provided item's slotId mean it's kept on the player after death? /// /// Player profile /// Item to check should be kept @@ -221,7 +252,10 @@ public class InRaidHelper( protected bool IsItemKeptAfterDeath(PmcData pmcData, Item itemToCheck) { // Base inventory items are always kept - if (itemToCheck.ParentId is null) return true; + if (itemToCheck.ParentId is null) + { + return true; + } // Is item equipped on player if (itemToCheck.ParentId == pmcData.Inventory.Equipment) @@ -230,19 +264,30 @@ public class InRaidHelper( var discard = _lostOnDeathConfig.Equipment.GetByJsonProp(itemToCheck.SlotId); if (discard) // Lost on death + { return false; + } return true; } // Should we keep items in pockets on death - if (!_lostOnDeathConfig.Equipment.PocketItems && _pocketSlots.Contains(itemToCheck.SlotId)) return true; + if (!_lostOnDeathConfig.Equipment.PocketItems && _pocketSlots.Contains(itemToCheck.SlotId)) + { + return true; + } // Is quest item + quest item not lost on death - if (itemToCheck.ParentId == pmcData.Inventory.QuestRaidItems && !_lostOnDeathConfig.QuestItems) return true; + if (itemToCheck.ParentId == pmcData.Inventory.QuestRaidItems && !_lostOnDeathConfig.QuestItems) + { + return true; + } // special slots are always kept after death - if ((itemToCheck.SlotId?.Contains("SpecialSlot") ?? false) && _lostOnDeathConfig.SpecialSlotItems) return true; + if ((itemToCheck.SlotId?.Contains("SpecialSlot") ?? false) && _lostOnDeathConfig.SpecialSlotItems) + { + return true; + } // All other cases item is lost return false; diff --git a/Libraries/Core/Helpers/InventoryHelper.cs b/Libraries/Core/Helpers/InventoryHelper.cs index c3b32657..bd5f67d4 100644 --- a/Libraries/Core/Helpers/InventoryHelper.cs +++ b/Libraries/Core/Helpers/InventoryHelper.cs @@ -38,10 +38,9 @@ public class InventoryHelper( ICloner _cloner ) { - protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); - // Item types to ignore inside `GetSizeByInventoryItemHash` - private List _itemBaseTypesToIgnore = [BaseClasses.BACKPACK, BaseClasses.SEARCHABLE_ITEM, BaseClasses.SIMPLE_CONTAINER]; + private readonly List _itemBaseTypesToIgnore = [BaseClasses.BACKPACK, BaseClasses.SEARCHABLE_ITEM, BaseClasses.SIMPLE_CONTAINER]; + protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); /// /// Add multiple items to player stash (assuming they all fit) @@ -81,7 +80,10 @@ public class InventoryHelper( // Add to player inventory AddItemToStash(sessionId, addItemRequest, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } } } @@ -122,7 +124,9 @@ public class InventoryHelper( ); if (output.Warnings?.Count > 0) // Failed to place, error out + { return; + } // Apply/remove FiR to item + mods SetFindInRaidStatusForItem(itemWithModsToAddClone, request.FoundInRaid.GetValueOrDefault(false)); @@ -134,7 +138,9 @@ public class InventoryHelper( try { if (request.Callback is not null) - request.Callback((int)(itemWithModsToAddClone[0].Upd.StackObjectsCount ?? 0)); + { + request.Callback((int) (itemWithModsToAddClone[0].Upd.StackObjectsCount ?? 0)); + } } catch (Exception ex) { @@ -153,9 +159,11 @@ public class InventoryHelper( pmcData.Inventory.Items.AddRange(itemWithModsToAddClone); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Added {itemWithModsToAddClone[0].Upd?.StackObjectsCount ?? 1} item: {itemWithModsToAddClone[0].Template} with: {itemWithModsToAddClone.Count - 1} mods to inventory" ); + } } /// @@ -180,11 +188,20 @@ public class InventoryHelper( /// Object to update protected void RemoveTraderRagfairRelatedUpdProperties(Upd upd) { - if (upd.UnlimitedCount is not null) upd.UnlimitedCount = null; + if (upd.UnlimitedCount is not null) + { + upd.UnlimitedCount = null; + } - if (upd.BuyRestrictionCurrent is not null) upd.BuyRestrictionCurrent = null; + if (upd.BuyRestrictionCurrent is not null) + { + upd.BuyRestrictionCurrent = null; + } - if (upd.BuyRestrictionMax is not null) upd.BuyRestrictionMax = null; + if (upd.BuyRestrictionMax is not null) + { + upd.BuyRestrictionMax = null; + } } /// @@ -450,6 +467,7 @@ public class InventoryHelper( if (itemAndChildrenToRemove.Count == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( _localisationService.GetText( "inventory-unable_to_remove_item_id_not_found", @@ -460,6 +478,7 @@ public class InventoryHelper( } ) ); + } return; } @@ -468,7 +487,16 @@ public class InventoryHelper( var insuredItems = profile.InsuredItems; // We have output object, inform client of root item deletion, not children - if (output is not null) output.ProfileChanges[sessionId].Items.DeletedItems.Add(new Item { Id = itemId }); + if (output is not null) + { + output.ProfileChanges[sessionId] + .Items.DeletedItems.Add( + new Item + { + Id = itemId + } + ); + } foreach (var item in itemAndChildrenToRemove) { @@ -476,8 +504,11 @@ public class InventoryHelper( // Therefore, we want to use a NON-Greedy function and escape the iteration as soon as we find requested item. var inventoryIndex = inventoryItems.FindIndex(inventoryItem => inventoryItem.Id == item.Id); if (inventoryIndex != -1) + { inventoryItems.RemoveAt(inventoryIndex); + } else + { _logger.Warning( _localisationService.GetText( "inventory-unable_to_remove_item_id_not_found", @@ -488,9 +519,13 @@ public class InventoryHelper( } ) ); + } var insuredItemIndex = insuredItems.FindIndex(insuredItem => insuredItem.ItemId == item.Id); - if (insuredItemIndex != -1) insuredItems.RemoveAt(insuredItemIndex); + if (insuredItemIndex != -1) + { + insuredItems.RemoveAt(insuredItemIndex); + } } } @@ -561,7 +596,10 @@ public class InventoryHelper( public ItemEventRouterResponse RemoveItemByCount(PmcData pmcData, string? itemId, int countToRemove, string sessionId, ItemEventRouterResponse? output) { - if (itemId is null) return output; + if (itemId is null) + { + return output; + } // Goal is to keep removing items until we can remove part of an items stack var itemsToReduce = _itemHelper.FindAndReturnChildrenAsItems(pmcData.Inventory.Items, itemId); @@ -581,12 +619,16 @@ public class InventoryHelper( itemToReduce.Upd.StackObjectsCount -= remainingCount; remainingCount = 0; if (output is not null) + { output.ProfileChanges[sessionId].Items.ChangedItems.Add(itemToReduce); + } } if (remainingCount == 0) // Desired count of item has been removed / we ran out of items to remove + { break; + } } return output ?? _eventOutputHolder.GetOutput(sessionId); @@ -615,14 +657,21 @@ public class InventoryHelper( /// An array representing the [width, height] of the item protected List GetSizeByInventoryItemHash(string itemTpl, string itemID, InventoryItemHash inventoryItemHash) { - var toDo = new List { itemID }; + var toDo = new List + { + itemID + }; var (key, tmpItem) = _itemHelper.GetItem(itemTpl); // Invalid item - if (!key) _logger.Error(_localisationService.GetText("inventory-invalid_item_missing_from_db", itemTpl)); + if (!key) + { + _logger.Error(_localisationService.GetText("inventory-invalid_item_missing_from_db", itemTpl)); + } // Item found but no _props property if (key && tmpItem.Properties is null) + { _localisationService.GetText( "inventory-item_missing_props_property", new @@ -631,6 +680,7 @@ public class InventoryHelper( itemName = tmpItem?.Name } ); + } // No item object or getItem() returned false if (!key && tmpItem is null) @@ -661,37 +711,52 @@ public class InventoryHelper( // The item itself is collapsible if (isFoldable is not null && string.IsNullOrEmpty(foldedSlot) && rootIsFolded) + { outX -= tmpItem.Properties.SizeReduceRight.Value; + } // Calculate size contribution from child items/attachments if (!_itemBaseTypesToIgnore.Contains(tmpItem.Parent)) + { while (toDo.Count > 0) { if (inventoryItemHash.ByParentId.ContainsKey(toDo[0])) + { foreach (var item in inventoryItemHash.ByParentId[toDo[0]]) { // Filtering child items outside of mod slots, such as those inside containers, without counting their ExtraSize attribute - if (item.SlotId.IndexOf("mod_") < 0) continue; + if (item.SlotId.IndexOf("mod_") < 0) + { + continue; + } toDo.Add(item.Id); // If the barrel is folded the space in the barrel is not counted var itemResult = _itemHelper.GetItem(item.Template); if (!itemResult.Key) + { _logger.Error( _localisationService.GetText( "inventory-get_item_size_item_not_found_by_tpl", item.Template ) ); + } var itm = itemResult.Value; var childFoldable = itm.Properties.Foldable.GetValueOrDefault(false); var childFolded = item.Upd?.Foldable is not null && item.Upd.Foldable.Folded == true; - if (isFoldable is true && foldedSlot == item.SlotId && (rootIsFolded || childFolded)) continue; + if (isFoldable is true && foldedSlot == item.SlotId && (rootIsFolded || childFolded)) + { + continue; + } - if (childFoldable && rootIsFolded && childFolded) continue; + if (childFoldable && rootIsFolded && childFolded) + { + continue; + } // Calculating child ExtraSize if (itm.Properties.ExtraSizeForceAdd == true) @@ -715,9 +780,11 @@ public class InventoryHelper( : sizeRight; } } + } toDo.RemoveAt(0); } + } return [ @@ -766,16 +833,22 @@ public class InventoryHelper( // Get subset of items that belong to the desired container if (!inventoryItemHash.ByParentId.TryGetValue(containerId, out var containerItemHash)) // No items in container, exit early + { return container2D; + } // Check each item in container foreach (var item in containerItemHash) { ItemLocation? itemLocation; if (item.Location is JsonElement) - itemLocation = ((JsonElement)item.Location).ToObject(); + { + itemLocation = ((JsonElement) item.Location).ToObject(); + } else - itemLocation = (ItemLocation)item.Location; + { + itemLocation = (ItemLocation) item.Location; + } if (itemLocation is null) { @@ -796,12 +869,15 @@ public class InventoryHelper( var fillTo = itemLocation.X + fW; for (var y = 0; y < fH; y++) + { try { var rowIndex = itemLocation.Y + y; var containerRow = container2D[rowIndex.Value]; if (containerRow is null) + { _logger.Error($"Unable to find container: {containerId} row line: {itemLocation.Y + y}"); + } // Fill the corresponding cells in the container map to show the slot is taken Array.Fill(containerRow, 1, itemLocation.X.Value, fW); @@ -819,6 +895,7 @@ public class InventoryHelper( ) ); } + } } return container2D; @@ -841,10 +918,16 @@ public class InventoryHelper( { inventoryItemHash.ByItemId.TryAdd(item.Id, item); - if (item.ParentId is null) continue; + if (item.ParentId is null) + { + continue; + } if (!inventoryItemHash.ByParentId.ContainsKey(item.ParentId)) + { inventoryItemHash.ByParentId[item.ParentId] = []; + } + inventoryItemHash.ByParentId[item.ParentId].Add(item); } @@ -965,7 +1048,10 @@ public class InventoryHelper( // this sets automatically a stash size from items.json (it's not added anywhere yet because we still use base stash) var stashTPL = GetStashType(sessionId); - if (stashTPL is null) _logger.Error(_localisationService.GetText("inventory-missing_stash_size")); + if (stashTPL is null) + { + _logger.Error(_localisationService.GetText("inventory-missing_stash_size")); + } var stashItemResult = _itemHelper.GetItem(stashTPL); if (!stashItemResult.Key) @@ -982,7 +1068,10 @@ public class InventoryHelper( var stashV = firstStashItemGrid.Props.CellsV != 0 ? firstStashItemGrid.Props.CellsV : 66; // Player has a bonus, apply to vertical size - if (stashRowBonus is not null) stashV += (int)stashRowBonus.Value; + if (stashRowBonus is not null) + { + stashV += (int) stashRowBonus.Value; + } return [stashH.Value, stashV.Value]; } @@ -996,7 +1085,10 @@ public class InventoryHelper( { var pmcData = _profileHelper.GetPmcProfile(sessionId); var stashObj = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == pmcData.Inventory.Stash); - if (stashObj is null) _logger.Error(_localisationService.GetText("inventory-unable_to_find_stash")); + if (stashObj is null) + { + _logger.Error(_localisationService.GetText("inventory-unable_to_find_stash")); + } return stashObj?.Template; } @@ -1030,10 +1122,14 @@ public class InventoryHelper( if (request.To.Location is not null) // Update location object + { itemToMove.Location = request.To.Location; + } else // No location in request, delete it + { itemToMove.Location = null; + } } toItems.Add(itemToMove); @@ -1070,9 +1166,11 @@ public class InventoryHelper( } if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"{moveRequest.Action} item: {moveRequest.Item} from slotid: {matchingInventoryItem.SlotId} to container: {moveRequest.To.Container}" ); + } // Don't move shells from camora to cartridges (happens when loading shells into mts-255 revolver shotgun) if (matchingInventoryItem.SlotId?.Contains("camora_") is null && moveRequest.To.Container == "cartridges") @@ -1106,7 +1204,10 @@ public class InventoryHelper( else { // Moved from slot with location to one without, clean up - if (matchingInventoryItem.Location is not null) matchingInventoryItem.Location = null; + if (matchingInventoryItem.Location is not null) + { + matchingInventoryItem.Location = null; + } } return true; @@ -1121,18 +1222,27 @@ public class InventoryHelper( { // Find matching _id in fast panel - if (!pmcData.Inventory.FastPanel.TryGetValue(itemBeingMoved.Id, out var fastPanelSlot)) return; + if (!pmcData.Inventory.FastPanel.TryGetValue(itemBeingMoved.Id, out var fastPanelSlot)) + { + return; + } // Get moved items parent (should be container item was put into) var itemParent = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == itemBeingMoved.ParentId); - if (itemParent is null) return; + if (itemParent is null) + { + return; + } // Reset fast panel value if item was moved to a container other than pocket/rig (cant be used from fastpanel) List slots = ["pockets", "tacticalvest"]; var wasMovedToFastPanelAccessibleContainer = slots.Contains( itemParent?.SlotId?.ToLower() ?? "" ); - if (!wasMovedToFastPanelAccessibleContainer) pmcData.Inventory.FastPanel[fastPanelSlot[0].ToString()] = ""; + if (!wasMovedToFastPanelAccessibleContainer) + { + pmcData.Inventory.FastPanel[fastPanelSlot[0].ToString()] = ""; + } } /// @@ -1141,7 +1251,10 @@ public class InventoryHelper( protected void HandleCartridges(List items, InventoryMoveRequestData request) { // Not moving item into a cartridge slot, skip - if (request.To.Container != "cartridges") return; + if (request.To.Container != "cartridges") + { + return; + } // Get a count of cartridges in existing magazine var cartridgeCount = items.Count(item => item.ParentId == request.To.Id); @@ -1186,10 +1299,16 @@ public class InventoryHelper( { // Item not found / has no parent var item = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == itemId); - if (item?.ParentId is null) return false; + if (item?.ParentId is null) + { + return false; + } // Root level. Items parent is the stash with slotId "hideout" - if (item.ParentId == pmcData.Inventory.Stash && item.SlotId == "hideout") return true; + if (item.ParentId == pmcData.Inventory.Stash && item.SlotId == "hideout") + { + return true; + } // Recursive case: Check the items parent return IsParentInStash(item.ParentId, pmcData); @@ -1200,7 +1319,10 @@ public class InventoryHelper( var errors = itemsToValidate.Where(item => !_hashUtil.IsValidMongoId(item.Id)) .Select(item => $"Id: {item.Id} - tpl: {item.Template}") .ToList(); - foreach (var message in errors) _logger.Error(message); + foreach (var message in errors) + { + _logger.Error(message); + } throw new Exception( "This profile is not compatible with SPT, See above for a list of incompatible IDs that is not compatible. Loading of SPT has been halted, use another profile or create a new one" @@ -1220,7 +1342,10 @@ public class InventoryHelper( while (currentItem is not null) { // If we've found the equipment root ID, return true - if (currentItem.Id == rootId) return true; + if (currentItem.Id == rootId) + { + return true; + } // Otherwise get the parent item currentItem = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == currentItem.ParentId); @@ -1233,8 +1358,16 @@ public class InventoryHelper( public class InventoryItemHash { [JsonPropertyName("byItemId")] - public Dictionary ByItemId { get; set; } + public Dictionary ByItemId + { + get; + set; + } [JsonPropertyName("byParentId")] - public Dictionary> ByParentId { get; set; } + public Dictionary> ByParentId + { + get; + set; + } } diff --git a/Libraries/Core/Helpers/ItemHelper.cs b/Libraries/Core/Helpers/ItemHelper.cs index 477d1cfc..d8d1e443 100644 --- a/Libraries/Core/Helpers/ItemHelper.cs +++ b/Libraries/Core/Helpers/ItemHelper.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; @@ -8,6 +7,7 @@ using Core.Services; using Core.Utils; using Core.Utils.Cloners; using Core.Utils.Collections; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -59,19 +59,19 @@ public class ItemHelper( ]; /** - * Does the provided pool of items contain the desired item - * @param itemPool Item collection to check - * @param item Item to look for - * @param slotId OPTIONAL - slotid of desired item - * @returns True if pool contains item - */ + * Does the provided pool of items contain the desired item + * @param itemPool Item collection to check + * @param item Item to look for + * @param slotId OPTIONAL - slotid of desired item + * @returns True if pool contains item + */ public bool hasItemWithTpl(List itemPool, string item, string slotId = null) { // Filter the pool by slotId if provided - var filteredPool = slotId is not null ? itemPool.Where((item) => item.SlotId?.StartsWith(slotId) ?? false) : itemPool; + var filteredPool = slotId is not null ? itemPool.Where(item => item.SlotId?.StartsWith(slotId) ?? false) : itemPool; // Check if any item in the filtered pool matches the provided item - return filteredPool.Any((poolItem) => poolItem.Template == item); + return filteredPool.Any(poolItem => poolItem.Template == item); } /** @@ -84,10 +84,10 @@ public class ItemHelper( public Item getItemFromPoolByTpl(List itemPool, string item, string slotId = null) { // Filter the pool by slotId if provided - var filteredPool = slotId is not null ? itemPool.Where((item) => item.SlotId?.StartsWith(slotId) ?? false) : itemPool; + var filteredPool = slotId is not null ? itemPool.Where(item => item.SlotId?.StartsWith(slotId) ?? false) : itemPool; // Check if any item in the filtered pool matches the provided item - return filteredPool.FirstOrDefault((poolItem) => poolItem.Template == item); + return filteredPool.FirstOrDefault(poolItem => poolItem.Template == item); } /** @@ -100,14 +100,23 @@ public class ItemHelper( */ public bool IsSameItems(List item1, List item2, HashSet compareUpdProperties = null) { - if (item1.Count() != item2.Count) return false; + if (item1.Count() != item2.Count) + { + return false; + } foreach (var itemOf1 in item1) { - var itemOf2 = item2.FirstOrDefault((i2) => i2.Template == itemOf1.Template); - if (itemOf2 is null) return false; + var itemOf2 = item2.FirstOrDefault(i2 => i2.Template == itemOf1.Template); + if (itemOf2 is null) + { + return false; + } - if (!IsSameItem(itemOf1, itemOf2, compareUpdProperties)) return false; + if (!IsSameItem(itemOf1, itemOf2, compareUpdProperties)) + { + return false; + } } return true; @@ -124,16 +133,28 @@ public class ItemHelper( public bool IsSameItem(Item item1, Item item2, HashSet? compareUpdProperties = null) { // Different tpl == different item - if (item1.Template != item2.Template) return false; + if (item1.Template != item2.Template) + { + return false; + } // Both lack upd object + same tpl = same - if (item1.Upd is null && item2.Upd is null) return true; + if (item1.Upd is null && item2.Upd is null) + { + return true; + } // item1 lacks upd, item2 has one - if (item1.Upd is null && item2.Upd is not null) return false; + if (item1.Upd is null && item2.Upd is not null) + { + return false; + } // item1 has upd, item2 lacks one - if (item1.Upd is not null && item2.Upd is null) return false; + if (item1.Upd is not null && item2.Upd is null) + { + return false; + } // key = Upd property Type as string, value = comparison function that returns bool var comparers = new Dictionary> @@ -157,9 +178,14 @@ public class ItemHelper( { if (!comparers.TryGetValue(propertyName, out var comparer)) // Key not found, skip + { continue; + } - if (!comparer(item1.Upd, item2.Upd)) return false; + if (!comparer(item1.Upd, item2.Upd)) + { + return false; + } } return true; @@ -176,38 +202,97 @@ public class ItemHelper( // armors, etc if (itemTemplate.Properties.MaxDurability is not null) + { itemProperties.Repairable = new UpdRepairable { Durability = itemTemplate.Properties.MaxDurability, MaxDurability = itemTemplate.Properties.MaxDurability }; + } - if (itemTemplate.Properties.HasHinge ?? false) itemProperties.Togglable = new UpdTogglable { On = true }; + if (itemTemplate.Properties.HasHinge ?? false) + { + itemProperties.Togglable = new UpdTogglable + { + On = true + }; + } - if (itemTemplate.Properties.Foldable ?? false) itemProperties.Foldable = new UpdFoldable { Folded = false }; + if (itemTemplate.Properties.Foldable ?? false) + { + itemProperties.Foldable = new UpdFoldable + { + Folded = false + }; + } if (itemTemplate.Properties.WeapFireType?.Any() ?? false) { if (itemTemplate.Properties.WeapFireType.Contains("fullauto")) - itemProperties.FireMode = new UpdFireMode { FireMode = "fullauto" }; + { + itemProperties.FireMode = new UpdFireMode + { + FireMode = "fullauto" + }; + } else - itemProperties.FireMode = new UpdFireMode { FireMode = _randomUtil.GetArrayValue(itemTemplate.Properties.WeapFireType) }; + { + itemProperties.FireMode = new UpdFireMode + { + FireMode = _randomUtil.GetArrayValue(itemTemplate.Properties.WeapFireType) + }; + } } - if (itemTemplate.Properties.MaxHpResource is not null) itemProperties.MedKit = new UpdMedKit { HpResource = itemTemplate.Properties.MaxHpResource }; + if (itemTemplate.Properties.MaxHpResource is not null) + { + itemProperties.MedKit = new UpdMedKit + { + HpResource = itemTemplate.Properties.MaxHpResource + }; + } if (itemTemplate.Properties.MaxResource is not null && itemTemplate.Properties.FoodUseTime is not null) - itemProperties.FoodDrink = new UpdFoodDrink { HpPercent = itemTemplate.Properties.MaxResource }; + { + itemProperties.FoodDrink = new UpdFoodDrink + { + HpPercent = itemTemplate.Properties.MaxResource + }; + } if (itemTemplate.Parent == BaseClasses.FLASHLIGHT) - itemProperties.Light = new UpdLight { IsActive = false, SelectedMode = 0 }; - else if (itemTemplate.Parent == BaseClasses.TACTICAL_COMBO) itemProperties.Light = new UpdLight { IsActive = false, SelectedMode = 0 }; + { + itemProperties.Light = new UpdLight + { + IsActive = false, + SelectedMode = 0 + }; + } + else if (itemTemplate.Parent == BaseClasses.TACTICAL_COMBO) + { + itemProperties.Light = new UpdLight + { + IsActive = false, + SelectedMode = 0 + }; + } - if (itemTemplate.Parent == BaseClasses.NIGHTVISION) itemProperties.Togglable = new UpdTogglable { On = false }; + if (itemTemplate.Parent == BaseClasses.NIGHTVISION) + { + itemProperties.Togglable = new UpdTogglable + { + On = false + }; + } // Togglable face shield if ((itemTemplate.Properties.HasHinge ?? false) && (itemTemplate.Properties.FaceShieldComponent ?? false)) - itemProperties.Togglable = new UpdTogglable { On = false }; + { + itemProperties.Togglable = new UpdTogglable + { + On = false + }; + } return itemProperties; } @@ -228,11 +313,14 @@ public class ItemHelper( var baseTypes = invalidBaseTypes ?? _defaultInvalidBaseTypes; var itemDetails = GetItem(tpl); - if (!itemDetails.Key) return false; + if (!itemDetails.Key) + { + return false; + } return !(itemDetails.Value.Properties.QuestItem ?? false) && itemDetails.Value.Type == "Item" && - baseTypes.All((x) => !IsOfBaseclass(tpl, x)) && + baseTypes.All(x => !IsOfBaseclass(tpl, x)) && GetItemPrice(tpl) > 0 && !_itemFilterService.IsItemBlacklisted(tpl); } @@ -271,7 +359,10 @@ public class ItemHelper( // @returns True if item needs some kind of insert public bool ArmorItemHasRemovableOrSoftInsertSlots(string itemTpl) { - if (!ArmorItemCanHoldMods(itemTpl)) return false; + if (!ArmorItemCanHoldMods(itemTpl)) + { + return false; + } return ArmorItemHasRemovablePlateSlots(itemTpl) || ItemRequiresSoftInserts(itemTpl); } @@ -284,7 +375,7 @@ public class ItemHelper( var itemTemplate = GetItem(itemTpl); var plateSlotIds = GetRemovablePlateSlotIds(); - return itemTemplate.Value.Properties.Slots.Any((slot) => plateSlotIds.Contains(slot.Name.ToLower())); + return itemTemplate.Value.Properties.Slots.Any(slot => plateSlotIds.Contains(slot.Name.ToLower())); } // Does the provided item tpl require soft inserts to become a valid armor item @@ -293,18 +384,30 @@ public class ItemHelper( public bool ItemRequiresSoftInserts(string itemTpl) { // not a slot that takes soft-inserts - if (!ArmorItemCanHoldMods(itemTpl)) return false; + if (!ArmorItemCanHoldMods(itemTpl)) + { + return false; + } // Check is an item var itemDbDetails = GetItem(itemTpl); - if (!itemDbDetails.Key) return false; + if (!itemDbDetails.Key) + { + return false; + } // Has no slots - if (!(itemDbDetails.Value.Properties.Slots ?? []).Any()) return false; + if (!(itemDbDetails.Value.Properties.Slots ?? []).Any()) + { + return false; + } // Check if item has slots that match soft insert name ids var softInsertIds = GetSoftInsertSlotIds(); - if (itemDbDetails.Value.Properties.Slots.Any((slot) => softInsertIds.Contains(slot.Name.ToLower()))) return true; + if (itemDbDetails.Value.Properties.Slots.Any(slot => softInsertIds.Contains(slot.Name.ToLower()))) + { + return true; + } return false; } @@ -339,26 +442,29 @@ public class ItemHelper( public double GetItemAndChildrenPrice(List tpls) { // Run getItemPrice for each tpl in tpls array, return sum - return tpls.Aggregate(0, (total, tpl) => total + (int)GetItemPrice(tpl).GetValueOrDefault(0)); + return tpls.Aggregate(0, (total, tpl) => total + (int) GetItemPrice(tpl).GetValueOrDefault(0)); } /// - /// Returns the item price based on the handbook or as a fallback from the prices.json if the item is not - /// found in the handbook. If the price can't be found at all return 0 + /// Returns the item price based on the handbook or as a fallback from the prices.json if the item is not + /// found in the handbook. If the price can't be found at all return 0 /// /// Item to look price up of /// Price in roubles public double? GetItemPrice(string tpl) { var handbookPrice = GetStaticItemPrice(tpl); - if (handbookPrice >= 1) return handbookPrice; + if (handbookPrice >= 1) + { + return handbookPrice; + } return GetDynamicItemPrice(tpl); } /// - /// Returns the item price based on the handbook or as a fallback from the prices.json if the item is not - /// found in the handbook. If the price can't be found at all return 0 + /// Returns the item price based on the handbook or as a fallback from the prices.json if the item is not + /// found in the handbook. If the price can't be found at all return 0 /// /// Item to look price up of /// Price in roubles @@ -371,39 +477,48 @@ public class ItemHelper( } /// - /// Get the static (handbook) price in roubles for an item by tpl + /// Get the static (handbook) price in roubles for an item by tpl /// /// Items tpl id to look up price /// Price in roubles (0 if not found) public double GetStaticItemPrice(string tpl) { var handbookPrice = _handbookHelper.GetTemplatePrice(tpl); - if (handbookPrice >= 1) return handbookPrice; + if (handbookPrice >= 1) + { + return handbookPrice; + } return 0; } /// - /// Get the dynamic (flea) price in roubles for an item by tpl + /// Get the dynamic (flea) price in roubles for an item by tpl /// /// Items tpl id to look up price /// Price in roubles (undefined if not found) public double? GetDynamicItemPrice(string tpl) { - if (_databaseService.GetPrices().TryGetValue(tpl, out var price)) return price; + if (_databaseService.GetPrices().TryGetValue(tpl, out var price)) + { + return price; + } return null; } /// - /// Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + /// Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined /// /// Item to update /// Fixed item public Item FixItemStackCount(Item item) { // Ensure item has 'Upd' object - item.Upd ??= new Upd { StackObjectsCount = 1 }; + item.Upd ??= new Upd + { + StackObjectsCount = 1 + }; // Ensure item has 'StackObjectsCount' property item.Upd.StackObjectsCount ??= 1; @@ -412,7 +527,7 @@ public class ItemHelper( } /// - /// Get cloned copy of all item data from items.json + /// Get cloned copy of all item data from items.json /// /// List of TemplateItem objects public List GetItems() @@ -428,7 +543,10 @@ public class ItemHelper( public KeyValuePair GetItem(string itemTpl) { // -> Gets item from - if (_databaseService.GetItems().TryGetValue(itemTpl, out var item)) return new KeyValuePair(true, item); + if (_databaseService.GetItems().TryGetValue(itemTpl, out var item)) + { + return new KeyValuePair(true, item); + } return new KeyValuePair(false, null); } @@ -440,7 +558,10 @@ public class ItemHelper( */ public bool ItemHasSlots(string itemTpl) { - if (_databaseService.GetItems().TryGetValue(itemTpl, out var item)) return GetItem(itemTpl).Value.Properties?.Slots?.Count() > 0; + if (_databaseService.GetItems().TryGetValue(itemTpl, out var item)) + { + return GetItem(itemTpl).Value.Properties?.Slots?.Count() > 0; + } return false; } @@ -463,14 +584,20 @@ public class ItemHelper( */ public double GetItemQualityModifierForItems(List itemWithChildren, bool skipArmorItemsWithoutDurability = false) { - if (IsOfBaseclass(itemWithChildren[0].Template, BaseClasses.WEAPON)) return Math.Round(GetItemQualityModifier(itemWithChildren[0]), 5); + if (IsOfBaseclass(itemWithChildren[0].Template, BaseClasses.WEAPON)) + { + return Math.Round(GetItemQualityModifier(itemWithChildren[0]), 5); + } var qualityModifier = 0D; var itemsWithQualityCount = 0D; foreach (var item in itemWithChildren) { var result = GetItemQualityModifier(item, skipArmorItemsWithoutDurability); - if (result == -1) continue; + if (result == -1) + { + continue; + } qualityModifier += result; itemsWithQualityCount++; @@ -478,7 +605,9 @@ public class ItemHelper( if (itemsWithQualityCount == 0) // Can happen when rigs without soft inserts or plates are listed + { return 1; + } return Math.Min(Math.Round(qualityModifier / itemsWithQualityCount, 5), 1); } @@ -506,7 +635,9 @@ public class ItemHelper( if (skipArmorItemsWithoutDurability && IsOfBaseclass(item.Template, BaseClasses.ARMOR) && itemDetails?.Properties?.MaxDurability == 0 ) + { return -1; + } if (item.Upd is not null) { @@ -541,7 +672,9 @@ public class ItemHelper( if (result == 0) // make item non-zero but still very low + { result = 0.01; + } return result; } @@ -592,8 +725,12 @@ public class ItemHelper( List list = []; foreach (var childitem in items) + { if (childitem.ParentId == baseItemId) + { list.AddRange(FindAndReturnChildrenByItems(items, childitem.Id)); + } + } list.Add(baseItemId); // Required, push original item id onto array @@ -620,11 +757,16 @@ public class ItemHelper( } // Is stored in parent and disallowed - if (modsOnly && childItem.Location is not null) continue; + if (modsOnly && childItem.Location is not null) + { + continue; + } // Items parentid matches root item AND returned items doesnt contain current child - if (childItem.ParentId == baseItemId && !list.Any((item) => childItem.Id == item.Id)) + if (childItem.ParentId == baseItemId && !list.Any(item => childItem.Id == item.Id)) + { list.AddRange(FindAndReturnChildrenAsItems(items, childItem.Id)); + } } return list; @@ -642,11 +784,13 @@ public class ItemHelper( foreach (var itemFromAssort in assort) // Parent matches desired item + all items in list do not match + { if (itemFromAssort.ParentId == itemIdToFind && list.All(item => itemFromAssort.Id != item.Id)) { list.Add(itemFromAssort); list = list.Concat(FindAndReturnChildrenByAssort(itemFromAssort.Id, assort)).ToList(); } + } return list; } @@ -658,13 +802,16 @@ public class ItemHelper( */ public bool HasBuyRestrictions(Item itemToCheck) { - if (itemToCheck.Upd?.BuyRestrictionCurrent is not null && itemToCheck.Upd?.BuyRestrictionMax is not null) return true; + if (itemToCheck.Upd?.BuyRestrictionCurrent is not null && itemToCheck.Upd?.BuyRestrictionMax is not null) + { + return true; + } return false; } /// - /// Checks if the passed template id is a dog tag. + /// Checks if the passed template id is a dog tag. /// /// Template id to check. /// True if it is a dogtag. @@ -688,39 +835,48 @@ public class ItemHelper( } /// - /// Gets the identifier for a child using slotId, locationX and locationY. + /// Gets the identifier for a child using slotId, locationX and locationY. /// /// Item. /// SlotId OR slotid, locationX, locationY. public string GetChildId(Item item) { - if (item.Location is null) return item.SlotId; + if (item.Location is null) + { + return item.SlotId; + } - var LocationTyped = (ItemLocation)item.Location; + var LocationTyped = (ItemLocation) item.Location; return $"{item.SlotId},{LocationTyped.X},{LocationTyped.Y}"; } /// - /// Checks if the passed item can be stacked. + /// Checks if the passed item can be stacked. /// /// Item to check. /// True if it can be stacked. public bool? IsItemTplStackable(string tpl) { - if (!_databaseService.GetItems().TryGetValue(tpl, out var item)) return null; + if (!_databaseService.GetItems().TryGetValue(tpl, out var item)) + { + return null; + } return item.Properties.StackMaxSize > 1; } /// - /// Splits the item stack if it exceeds its items StackMaxSize property into child items of the passed parent. + /// Splits the item stack if it exceeds its items StackMaxSize property into child items of the passed parent. /// /// Item to split into smaller stacks. /// List of root item + children. public List SplitStack(Item itemToSplit) { - if (itemToSplit?.Upd?.StackObjectsCount is null) return [itemToSplit]; + if (itemToSplit?.Upd?.StackObjectsCount is null) + { + return [itemToSplit]; + } var maxStackSize = GetItem(itemToSplit.Template).Value.Properties.StackMaxSize; var remainingCount = itemToSplit.Upd.StackObjectsCount; @@ -750,7 +906,7 @@ public class ItemHelper( } /// - /// Turns items like money into separate stacks that adhere to max stack size. + /// Turns items like money into separate stacks that adhere to max stack size. /// /// Item to split into smaller stacks. /// List of separate item stacks. @@ -760,7 +916,10 @@ public class ItemHelper( var itemMaxStackSize = itemTemplate.Properties.StackMaxSize ?? 1; // item already within bounds of stack size, return it - if (itemToSplit.Upd?.StackObjectsCount <= itemMaxStackSize) return [[itemToSplit]]; + if (itemToSplit.Upd?.StackObjectsCount <= itemMaxStackSize) + { + return [[itemToSplit]]; + } // Split items stack into chunks List> result = []; @@ -780,7 +939,7 @@ public class ItemHelper( } /// - /// Finds Barter items from a list of items. + /// Finds Barter items from a list of items. /// /// Tpl or id. /// Array of items to iterate over. @@ -790,24 +949,32 @@ public class ItemHelper( { // Find required items to take after buying (handles multiple items) List desiredBarterIds = - desiredBarterItemIds.GetType() == typeof(string) ? [(string)desiredBarterItemIds] : (List)desiredBarterItemIds; + desiredBarterItemIds.GetType() == typeof(string) ? [(string) desiredBarterItemIds] : (List) desiredBarterItemIds; List matchingItems = []; foreach (var barterId in desiredBarterIds) { - var filterResult = itemsToSearch.Where((item) => { return by == "tpl" ? item.Template == barterId : item.Id == barterId; }); + var filterResult = itemsToSearch.Where( + item => + { + return by == "tpl" ? item.Template == barterId : item.Id == barterId; + } + ); matchingItems.AddRange(filterResult); } - if (matchingItems.Count == 0) _logger.Warning($"No items found for barter Id: {desiredBarterIds}"); + if (matchingItems.Count == 0) + { + _logger.Warning($"No items found for barter Id: {desiredBarterIds}"); + } return matchingItems; } /// - /// Replaces the _id value for the base item + all children that are children of it. - /// REPARENTS ROOT ITEM ID, NOTHING ELSE. + /// Replaces the _id value for the base item + all children that are children of it. + /// REPARENTS ROOT ITEM ID, NOTHING ELSE. /// /// Item with mods to update. /// New id to add on children of base item. @@ -821,8 +988,12 @@ public class ItemHelper( // Update all parentIds of items attached to base item to use new id foreach (var item in itemWithChildren) + { if (item.ParentId == oldId) + { item.ParentId = newId; + } + } } public void ReplaceProfileInventoryIds(BotBaseInventory inventory, List? insuredItems = null) @@ -843,12 +1014,18 @@ public class ItemHelper( itemIdBlacklist.UnionWith(inventory.HideoutAreaStashes.Values); // Add insured items ids to blacklist - if (insuredItems is not null) itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId)); + if (insuredItems is not null) + { + itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId)); + } foreach (var item in inventory.Items) { - if (itemIdBlacklist.Contains(item.Id)) continue; + if (itemIdBlacklist.Contains(item.Id)) + { + continue; + } // Generate new id var newId = _hashUtil.Generate(); @@ -861,13 +1038,22 @@ public class ItemHelper( // Find all children of item and update their parent ids to match var childItems = inventory.Items.Where(x => x.ParentId == originalId); - foreach (var childItem in childItems) childItem.ParentId = newId; + foreach (var childItem in childItems) + { + childItem.ParentId = newId; + } // Also replace in quick slot if the old ID exists. - if (inventory.FastPanel is null) continue; + if (inventory.FastPanel is null) + { + continue; + } // Update quickslot id - if (inventory.FastPanel.ContainsKey(originalId)) inventory.FastPanel[originalId] = newId; + if (inventory.FastPanel.ContainsKey(originalId)) + { + inventory.FastPanel[originalId] = newId; + } } } @@ -886,15 +1072,18 @@ public class ItemHelper( // Find all children of item and update their parent ids to match var childItems = items.Where(x => x.ParentId == originalId); - foreach (var childItem in childItems) childItem.ParentId = newId; + foreach (var childItem in childItems) + { + childItem.ParentId = newId; + } } return items; } /// - /// Regenerate all GUIDs with new IDs, with the exception of special item types (e.g. quest, sorting table, etc.) This - /// function will not mutate the original items list, but will return a new list with new GUIDs. + /// Regenerate all GUIDs with new IDs, with the exception of special item types (e.g. quest, sorting table, etc.) This + /// function will not mutate the original items list, but will return a new list with new GUIDs. /// /// Items to adjust the IDs of /// Player profile @@ -928,12 +1117,18 @@ public class ItemHelper( // Add insured items ids to blacklist - if (insuredItems is not null) itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId)); + if (insuredItems is not null) + { + itemIdBlacklist.UnionWith(insuredItems.Select(x => x.ItemId)); + } foreach (var item in originalItems) { - if (itemIdBlacklist.Contains(item.Id)) continue; + if (itemIdBlacklist.Contains(item.Id)) + { + continue; + } // Generate new id var newId = _hashUtil.Generate(); @@ -946,21 +1141,30 @@ public class ItemHelper( // Find all children of item and update their parent ids to match var childItems = originalItems.Where(x => x.ParentId == originalId); - foreach (var childItem in childItems) childItem.ParentId = newId; + foreach (var childItem in childItems) + { + childItem.ParentId = newId; + } // Also replace in quick slot if the old ID exists. - if (pmcData.Inventory.FastPanel is null) continue; + if (pmcData.Inventory.FastPanel is null) + { + continue; + } // Update quickslot id - if (pmcData.Inventory.FastPanel.ContainsKey(originalId)) pmcData.Inventory.FastPanel[originalId] = newId; + if (pmcData.Inventory.FastPanel.ContainsKey(originalId)) + { + pmcData.Inventory.FastPanel[originalId] = newId; + } } return originalItems; } /// - /// Mark the passed in list of items as found in raid. - /// Modifies passed in items + /// Mark the passed in list of items as found in raid. + /// Modifies passed in items /// /// The list of items to mark as FiR /// Skip adding FiR status to currency items @@ -968,28 +1172,35 @@ public class ItemHelper( { foreach (var item in items) { - if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY)) continue; + if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY)) + { + continue; + } + item.Upd ??= new Upd(); item.Upd.SpawnedInSession = true; } } /// - /// Mark the passed in list of items as found in raid. - /// Modifies passed in items + /// Mark the passed in list of items as found in raid. + /// Modifies passed in items /// /// The list of items to mark as FiR /// Skip adding FiR status to currency items public void SetFoundInRaid(Item item, bool excludeCurrency = true) { - if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY)) return; + if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY)) + { + return; + } item.Upd ??= new Upd(); item.Upd.SpawnedInSession = true; } /// - /// WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do + /// WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do /// /// Items tpl to check parents of /// Tpl values to check if parents of item match @@ -1002,25 +1213,33 @@ public class ItemHelper( // not an item, drop out if (!itemExists) + { return false; + } // no parent to check if (item.Parent == null) + { return false; + } // Does templateId match any values in tplsToCheck array if (tplsToCheck.Contains(item.Id)) + { return true; + } // check items parent with same method if (tplsToCheck.Contains(item.Parent)) + { return true; + } return DoesItemOrParentsIdMatch(item.Parent, tplsToCheck); } /// - /// Check if item is quest item + /// Check if item is quest item /// /// Items tpl to check quest status of /// true if item is flagged as quest item @@ -1028,15 +1247,17 @@ public class ItemHelper( { var itemDetails = GetItem(tpl); if (itemDetails.Key && itemDetails.Value.Properties.QuestItem.GetValueOrDefault(false)) + { return true; + } return false; } /// - /// Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the - /// parent items existence in the database, the existence (and value) of the items RaidModdable property, and that - /// the parents slot-required property exists, matches that of the item, and its value. + /// Checks to see if the item is *actually* moddable in-raid. Checks include the items existence in the database, the + /// parent items existence in the database, the existence (and value) of the items RaidModdable property, and that + /// the parents slot-required property exists, matches that of the item, and its value. /// /// The item to be checked /// The parent of the item to be checked @@ -1045,7 +1266,9 @@ public class ItemHelper( { // This check requires the item to have the slotId property populated. if (item.SlotId == null) + { return null; + } var itemTemplate = GetItem(item.Template); var parentTemplate = GetItem(parent.Template); @@ -1053,32 +1276,34 @@ public class ItemHelper( // Check for RaidModdable property on the item template. var isNotRaidModdable = false; if (itemTemplate.Key) + { isNotRaidModdable = itemTemplate.Value?.Properties?.RaidModdable == false; + } // Check to see if the slot that the item is attached to is marked as required in the parent item's template. 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) ) ?? false; + } return itemTemplate.Key && parentTemplate.Key && (isNotRaidModdable || isRequiredSlot); } /// - /// Retrieves the main parent item for a given attachment item. - /// - /// This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent - /// item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it - /// will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately - /// attached to, even if that gun is located within multiple containers. - /// - /// It's important to note that traversal is expensive, so this method requires that you pass it a Map 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. + /// Retrieves the main parent item for a given attachment item. + /// This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the main parent + /// item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it + /// will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately + /// attached to, even if that gun is located within multiple containers. + /// It's important to note that traversal is expensive, so this method requires that you pass it a Map 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. /// /// The unique identifier of the item for which to find the main parent. /// A Dictionary containing item IDs mapped to their corresponding Item objects for quick lookup. @@ -1091,7 +1316,9 @@ public class ItemHelper( { currentItem = itemsMap.FirstOrDefault(x => x.Key == currentItem.ParentId).Value; if (currentItem == null) + { return null; + } } return currentItem; @@ -1099,7 +1326,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. */ @@ -1112,15 +1339,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. @@ -1132,7 +1359,10 @@ public class ItemHelper( while (currentItem is not null && !_slotsAsStrings.Contains(currentItem.SlotId)) { currentItem = itemsMap.GetValueOrDefault(currentItem.ParentId); - if (currentItem is null) return null; + if (currentItem is null) + { + return null; + } } return currentItem; @@ -1146,7 +1376,7 @@ public class ItemHelper( */ public ItemSize GetItemSize(List items, string rootItemId) { - var rootTemplate = GetItem(items.Where((x) => x.Id == rootItemId).ToList()[0].Template).Value; + var rootTemplate = GetItem(items.Where(x => x.Id == rootItemId).ToList()[0].Template).Value; var width = rootTemplate.Properties.Width; var height = rootTemplate.Properties.Height; @@ -1220,7 +1450,10 @@ public class ItemHelper( var cartridgeMaxStackSize = cartridgeDetails.Value.Properties.StackMaxSize; // Exit if ammo already exists in box - if (ammoBox.Any((item) => item.Template == cartridgeTpl)) return; + if (ammoBox.Any(item => item.Template == cartridgeTpl)) + { + return; + } // Add new stack-size-correct items to ammo box double? currentStoredCartridgeCount = 0; @@ -1237,13 +1470,16 @@ public class ItemHelper( var cartridgeItemToAdd = CreateCartridges( ammoBox[0].Id, cartridgeTpl, - (int)cartridgeCountToAdd, + (int) cartridgeCountToAdd, location, ammoBox[0].Upd?.SpawnedInSession ?? false ); // In live no ammo box has the first cartridge item with a location - if (location == 0) cartridgeItemToAdd.Location = null; + if (location == 0) + { + cartridgeItemToAdd.Location = null; + } ammoBox.Add(cartridgeItemToAdd); @@ -1265,7 +1501,7 @@ public class ItemHelper( CreateCartridges( ammoBox[0].Id, cartridgeTpl, - (int)ammoBoxMaxCartridgeCount, + (int) ammoBoxMaxCartridgeCount, 0, ammoBox[0].Upd?.SpawnedInSession ?? false ) @@ -1282,12 +1518,17 @@ public class ItemHelper( public bool ItemIsInsideContainer(Item itemToCheck, string desiredContainerSlotId, List items) { // Get items parent - var parent = items.FirstOrDefault((item) => item.Id == itemToCheck.ParentId); + var parent = items.FirstOrDefault(item => item.Id == itemToCheck.ParentId); if (parent is null) // No parent, end of line, not inside container + { return false; + } - if (parent.SlotId == desiredContainerSlotId) return true; + if (parent.SlotId == desiredContainerSlotId) + { + return true; + } return ItemIsInsideContainer(parent, desiredContainerSlotId, items); } @@ -1314,7 +1555,10 @@ public class ItemHelper( var chosenCaliber = caliber ?? GetRandomValidCaliber(magTemplate); // Edge case for the Klin pp-9, it has a typo in its ammo caliber - if (chosenCaliber == "Caliber9x18PMM") chosenCaliber = "Caliber9x18PM"; + if (chosenCaliber == "Caliber9x18PMM") + { + chosenCaliber = "Caliber9x18PM"; + } // Chose a randomly weighted cartridge that fits var cartridgeTpl = DrawAmmoTpl( @@ -1326,7 +1570,9 @@ public class ItemHelper( if (cartridgeTpl is null) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Unable to fill item: {magazine.FirstOrDefault().Id} {magTemplate.Name} with cartridges, none found."); + } return; } @@ -1335,7 +1581,7 @@ public class ItemHelper( } /// - /// Add child items to a magazine of a specific cartridge + /// Add child items to a magazine of a specific cartridge /// /// Magazine to add child items to /// Db template of magazine @@ -1351,14 +1597,22 @@ public class ItemHelper( var isUBGL = IsOfBaseclass(magTemplate.Id, BaseClasses.UBGL); if (isUBGL) // UBGL don't have mags + { return; + } // Get cartridge properties and max allowed stack size var cartridgeDetails = GetItem(cartridgeTpl); - if (!cartridgeDetails.Key) _logger.Error(_localisationService.GetText("item-invalid_tpl_item", cartridgeTpl)); + if (!cartridgeDetails.Key) + { + _logger.Error(_localisationService.GetText("item-invalid_tpl_item", cartridgeTpl)); + } var cartridgeMaxStackSize = cartridgeDetails.Value?.Properties?.StackMaxSize; - if (cartridgeMaxStackSize is null) _logger.Error($"Item with tpl: {cartridgeTpl} lacks a _props or StackMaxSize property"); + if (cartridgeMaxStackSize is null) + { + _logger.Error($"Item with tpl: {cartridgeTpl} lacks a _props or StackMaxSize property"); + } // Get max number of cartridges in magazine, choose random value between min/max var magProps = magTemplate.Properties; @@ -1376,14 +1630,17 @@ public class ItemHelper( var desiredStackCount = _randomUtil.GetInt( (int) Math.Round(minSizeMultiplier * magazineCartridgeMaxCount ?? 0), - (int)magazineCartridgeMaxCount + (int) magazineCartridgeMaxCount ); - if (magazineWithChildCartridges.Count > 1) _logger.Warning($"Magazine {magTemplate.Name} already has cartridges defined, this may cause issues"); + if (magazineWithChildCartridges.Count > 1) + { + _logger.Warning($"Magazine {magTemplate.Name} already has cartridges defined, this may cause issues"); + } // Loop over cartridge count and add stacks to magazine - int currentStoredCartridgeCount = 0; - int location = 0; + var currentStoredCartridgeCount = 0; + var location = 0; while (currentStoredCartridgeCount < desiredStackCount) { // Get stack size of cartridges @@ -1392,7 +1649,10 @@ public class ItemHelper( // Ensure we don't go over the max stackCount size var remainingSpace = desiredStackCount - currentStoredCartridgeCount; - if (cartridgeCountToAdd > remainingSpace) cartridgeCountToAdd = remainingSpace; + if (cartridgeCountToAdd > remainingSpace) + { + cartridgeCountToAdd = remainingSpace; + } // Add cartridge item object into items array magazineWithChildCartridges.Add( @@ -1410,11 +1670,14 @@ public class ItemHelper( } // Only one cartridge stack added, remove location property as it's only used for 2 or more stacks - if (location == 1) magazineWithChildCartridges[1].Location = null; + if (location == 1) + { + magazineWithChildCartridges[1].Location = null; + } } /// - /// Choose a random bullet type from the list of possible a magazine has + /// Choose a random bullet type from the list of possible a magazine has /// /// Magazine template from Db /// Tpl of cartridge @@ -1422,15 +1685,15 @@ public class ItemHelper( { var ammoTpls = magTemplate.Properties.Cartridges[0].Props.Filters[0].Filter; List calibers = ammoTpls - .Where((x) => GetItem(x).Key) - .Select((x) => GetItem(x).Value.Properties.Caliber) + .Where(x => GetItem(x).Key) + .Select(x => GetItem(x).Value.Properties.Caliber) .ToList(); return _randomUtil.DrawRandomFromList(calibers).FirstOrDefault(); } /// - /// Chose a randomly weighted cartridge that fits + /// Chose a randomly weighted cartridge that fits /// /// Desired caliber /// Cartridges and their weights @@ -1464,16 +1727,19 @@ public class ItemHelper( { // Whitelist exists and tpl not inside it, skip // Fixes 9x18mm kedr issues - if (cartridgeWhitelist is not null && !cartridgeWhitelist.Contains(icd.Tpl)) continue; + if (cartridgeWhitelist is not null && !cartridgeWhitelist.Contains(icd.Tpl)) + { + continue; + } - ammoArray.Add(new ProbabilityObject(icd.Tpl, (double)icd.RelativeProbability, null)); + ammoArray.Add(new ProbabilityObject(icd.Tpl, (double) icd.RelativeProbability, null)); } - return ammoArray.Draw(1).FirstOrDefault(); + return ammoArray.Draw().FirstOrDefault(); } /// - /// Create a basic cartridge object + /// Create a basic cartridge object /// /// container cartridges will be placed in /// Cartridge to insert @@ -1496,24 +1762,31 @@ public class ItemHelper( ParentId = parentId, SlotId = "cartridges", Location = location, - Upd = new Upd { StackObjectsCount = stackCount, SpawnedInSession = foundInRaid } + Upd = new Upd + { + StackObjectsCount = stackCount, + SpawnedInSession = foundInRaid + } }; } /// - /// Get the size of a stack, return 1 if no stack object count property found + /// Get the size of a stack, return 1 if no stack object count property found /// /// Item to get stack size of /// size of stack public int GetItemStackSize(Item item) { - if (item.Upd?.StackObjectsCount is not null) return (int)item.Upd.StackObjectsCount; + if (item.Upd?.StackObjectsCount is not null) + { + return (int) item.Upd.StackObjectsCount; + } return 1; } /// - /// Get the name of an item from the locale file using the item tpl + /// Get the name of an item from the locale file using the item tpl /// /// Tpl of item to get name of /// Full name, short name if not found @@ -1521,13 +1794,16 @@ public class ItemHelper( { var localeDb = _localeService.GetLocaleDb(); var result = localeDb[$"{itemTpl} Name"]; - if (result?.Length > 0) return result; + if (result?.Length > 0) + { + return result; + } return localeDb[$"{itemTpl} ShortName"]; } /// - /// Get all item tpls with a desired base type + /// Get all item tpls with a desired base type /// /// Item base type wanted /// Array of tpls @@ -1535,13 +1811,13 @@ public class ItemHelper( { return _databaseService.GetItems() .Values - .Where((item) => item.Parent == desiredBaseType) - .Select((item) => item.Id) + .Where(item => item.Parent == desiredBaseType) + .Select(item => item.Id) .ToList(); } /// - /// Add child slot items to an item, chooses random child item if multiple choices exist + /// Add child slot items to an item, chooses random child item if multiple choices exist /// /// array with single object (root item) /// Db template for root item @@ -1560,7 +1836,10 @@ public class ItemHelper( foreach (var slot in itemToAddTemplate.Properties.Slots) { // If only required mods is requested, skip non-essential - if (requiredOnly && !(slot.Required ?? false)) continue; + if (requiredOnly && !(slot.Required ?? false)) + { + continue; + } // Roll chance for non-required slot mods if (modSpawnChanceDict is not null && !(slot.Required ?? false)) @@ -1568,17 +1847,23 @@ public class ItemHelper( // only roll chance to not include mod if dict exists and has value for this mod type (e.g. front_plate) var modSpawnChance = modSpawnChanceDict[slot.Name.ToLower()]; if (modSpawnChance is not null) + { if (!_randomUtil.GetChance100(modSpawnChance ?? 0)) + { continue; + } + } } var itemPool = slot.Props.Filters[0].Filter ?? []; if (itemPool.Count() == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to choose a mod for slot: {slot.Name} on item: {itemToAddTemplate.Id} {itemToAddTemplate.Name}, parents' 'Filter' array is empty, skipping" ); + } continue; } @@ -1587,9 +1872,11 @@ public class ItemHelper( if (chosenTpl is null) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to choose a mod for slot: {slot.Name} on item: {itemToAddTemplate.Id} {itemToAddTemplate.Name}, no compatible tpl found in pool of {itemPool.Count()}, skipping" ); + } continue; } @@ -1616,14 +1903,17 @@ public class ItemHelper( } /// - /// Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter + /// Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter /// /// Tpls to randomly choose from /// Incompatible tpls to not allow /// Chosen tpl or undefined public string GetCompatibleTplFromArray(List possibleTpls, HashSet incompatibleModTpls) { - if (!possibleTpls.Any()) return null; + if (!possibleTpls.Any()) + { + return null; + } string? chosenTpl = null; var count = 0; @@ -1635,7 +1925,10 @@ public class ItemHelper( { // Incompatible tpl was chosen, try again count++; - if (count >= possibleTpls.Count) return null; + if (count >= possibleTpls.Count) + { + return null; + } continue; } @@ -1647,7 +1940,7 @@ public class ItemHelper( } /// - /// Is the provided item._props.Slots._name property a plate slot + /// Is the provided item._props.Slots._name property a plate slot /// /// Name of slot (_name) of Items Slot array /// True if its a slot that holds a removable plate @@ -1676,20 +1969,30 @@ public class ItemHelper( foreach (var mod in itemWithChildren) { - if (!idMappings.ContainsKey(mod.Id)) idMappings[mod.Id] = _hashUtil.Generate(); + if (!idMappings.ContainsKey(mod.Id)) + { + idMappings[mod.Id] = _hashUtil.Generate(); + } // Has parentId + no remapping exists for its parent if (mod.ParentId is not null && (!idMappings.ContainsKey(mod.ParentId) || idMappings?[mod.ParentId] is null)) // Make remapping for items parentId + { idMappings[mod.ParentId] = _hashUtil.Generate(); + } mod.Id = idMappings[mod.Id]; - if (mod.ParentId is not null) mod.ParentId = idMappings[mod.ParentId]; + if (mod.ParentId is not null) + { + mod.ParentId = idMappings[mod.ParentId]; + } } // Force item's details into first location of presetItems if (itemWithChildren[0].Template != rootItem.Template) + { _logger.Warning($"Reassigning root item from {itemWithChildren[0].Template} to {rootItem.Template}"); + } itemWithChildren[0] = rootItem; @@ -1718,7 +2021,10 @@ public class ItemHelper( } // Child with parent of root, update - if (item.ParentId == rootItemExistingId) item.ParentId = newId; + if (item.ParentId == rootItemExistingId) + { + item.ParentId = newId; + } } return newId; @@ -1736,7 +2042,7 @@ public class ItemHelper( foreach (var item in items) { // Check if the item's parent exists. - var parentExists = items.Any((parentItem) => parentItem.Id == item.ParentId); + var parentExists = items.Any(parentItem => parentItem.Id == item.ParentId); // If the parent does not exist and the item is not already a 'hideout' item, adopt the orphaned item by // setting the parent ID to the PMCs inventory equipment ID, the slot ID to 'hideout', and remove the location. @@ -1772,8 +2078,12 @@ public class ItemHelper( item.Upd = new Upd(); if (warningMessageWhenMissing is not null) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug(warningMessageWhenMissing); + } + } return true; } @@ -1807,18 +2117,24 @@ public class ItemHelper( var result = GetItem(tpl); if (!result.Key) // Not an item + { return null; + } var currentItem = result.Value; while (currentItem is not null) { if (currentItem.Type == "Node" && !rootOnly) // Hit first base type + { return currentItem.Id; + } if (currentItem.Parent is null) // No parent, reached root + { return currentItem.Id; + } // Get parent item and start loop again currentItem = GetItem(tpl).Value; @@ -1832,16 +2148,28 @@ public class ItemHelper( public void RemoveSpawnedInSessionPropertyFromItems(List items) { foreach (var item in items) + { if (item.Upd is not null) + { item.Upd.SpawnedInSession = null; + } + } } } public class ItemSize { [JsonPropertyName("width")] - public int Width { get; set; } + public int Width + { + get; + set; + } [JsonPropertyName("height")] - public int Height { get; set; } + public int Height + { + get; + set; + } } diff --git a/Libraries/Core/Helpers/NotificationSendHelper.cs b/Libraries/Core/Helpers/NotificationSendHelper.cs index b49f66ee..4f483932 100644 --- a/Libraries/Core/Helpers/NotificationSendHelper.cs +++ b/Libraries/Core/Helpers/NotificationSendHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Profile; using Core.Models.Eft.Ws; using Core.Models.Enums; @@ -6,6 +5,7 @@ using Core.Servers; using Core.Servers.Ws; using Core.Services; using Core.Utils; +using SptCommon.Annotations; namespace Core.Helpers; @@ -19,20 +19,24 @@ public class NotificationSendHelper( ) { /// - /// Send notification message to the appropriate channel + /// Send notification message to the appropriate channel /// /// /// public void SendMessage(string sessionID, WsNotificationEvent notificationMessage) { if (_sptWebSocketConnectionHandler.IsWebSocketConnected(sessionID)) + { _sptWebSocketConnectionHandler.SendMessage(sessionID, notificationMessage); + } else + { _notificationService.Add(sessionID, notificationMessage); + } } /// - /// Send a message directly to the player + /// Send a message directly to the player /// /// Session id /// Who is sending the message to player @@ -71,7 +75,7 @@ public class NotificationSendHelper( } /// - /// Helper function for SendMessageToPlayer(), get new dialog for storage in profile or find existing by sender id + /// Helper function for SendMessageToPlayer(), get new dialog for storage in profile or find existing by sender id /// /// Session id /// Type of message to generate diff --git a/Libraries/Core/Helpers/NotifierHelper.cs b/Libraries/Core/Helpers/NotifierHelper.cs index f7187134..9905234d 100644 --- a/Libraries/Core/Helpers/NotifierHelper.cs +++ b/Libraries/Core/Helpers/NotifierHelper.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Eft.Profile; using Core.Models.Eft.Ws; +using SptCommon.Annotations; namespace Core.Helpers; @@ -30,7 +30,7 @@ public class NotifierHelper(HttpServerHelper _httpServerHelper) EventIdentifier = dialogueMessage.Id, OfferId = ragfairData.OfferId, HandbookId = ragfairData.HandbookId, - Count = (int)ragfairData.Count + Count = (int) ragfairData.Count }; } diff --git a/Libraries/Core/Helpers/PaymentHelper.cs b/Libraries/Core/Helpers/PaymentHelper.cs index c785a065..128bb6a2 100644 --- a/Libraries/Core/Helpers/PaymentHelper.cs +++ b/Libraries/Core/Helpers/PaymentHelper.cs @@ -1,19 +1,19 @@ -using SptCommon.Annotations; using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Servers; +using SptCommon.Annotations; namespace Core.Helpers; [Injectable] public class PaymentHelper(ConfigServer _configServer) { + protected bool _addedCustomMoney; protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); protected List _moneyTpls = [Money.DOLLARS, Money.EUROS, Money.ROUBLES, Money.GP]; - protected bool _addedCustomMoney; /// - /// Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) + /// Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) /// /// /// @@ -29,7 +29,7 @@ public class PaymentHelper(ConfigServer _configServer) } /// - /// Gets currency TPL from TAG + /// Gets currency TPL from TAG /// /// /// diff --git a/Libraries/Core/Helpers/PresetHelper.cs b/Libraries/Core/Helpers/PresetHelper.cs index dda8e4f4..cb1ec249 100644 --- a/Libraries/Core/Helpers/PresetHelper.cs +++ b/Libraries/Core/Helpers/PresetHelper.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Enums; using Core.Services; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Helpers; @@ -13,14 +13,14 @@ public class PresetHelper( ICloner _cloner ) { - /// - /// Preset cache - key = item tpl, value = preset ids - /// - protected Dictionary> _lookup = new(); - protected Dictionary _defaultEquipmentPresets; protected Dictionary? _defaultWeaponPresets; + /// + /// Preset cache - key = item tpl, value = preset ids + /// + protected Dictionary> _lookup = new(); + public void HydratePresetStore(Dictionary> input) { _lookup = input; @@ -81,7 +81,10 @@ public class PresetHelper( public bool IsPreset(string id) { if (string.IsNullOrEmpty(id)) + { return false; + } + return _databaseService.GetGlobals().ItemPresets.ContainsKey(id); } @@ -113,12 +116,18 @@ public class PresetHelper( public List GetPresets(string templateId) { - if (!HasPreset(templateId)) return []; + if (!HasPreset(templateId)) + { + return []; + } List presets = []; var ids = _lookup[templateId]; - foreach (var id in ids) presets.Add(GetPreset(id)); + foreach (var id in ids) + { + presets.Add(GetPreset(id)); + } return presets; } @@ -130,13 +139,20 @@ public class PresetHelper( */ public Preset? GetDefaultPreset(string templateId) { - if (!HasPreset(templateId)) return null; + if (!HasPreset(templateId)) + { + return null; + } var allPresets = GetPresets(templateId); foreach (var preset in allPresets) + { if (preset.Encyclopedia is not null) + { return preset; + } + } return allPresets[0]; } @@ -148,8 +164,12 @@ public class PresetHelper( var preset = GetPreset(presetId); foreach (var item in preset.Items) + { if (preset.Parent == item.Id) + { return item.Template; + } + } } return ""; @@ -166,7 +186,7 @@ public class PresetHelper( var defaultPreset = GetDefaultPreset(tpl); // Bundle up tpls we want price for - var tpls = defaultPreset is not null ? defaultPreset.Items.Select((item) => item.Template) : [tpl]; + var tpls = defaultPreset is not null ? defaultPreset.Items.Select(item => item.Template) : [tpl]; // Get price of tpls return _itemHelper.GetItemAndChildrenPrice(tpls.ToList()); diff --git a/Libraries/Core/Helpers/ProbabilityHelper.cs b/Libraries/Core/Helpers/ProbabilityHelper.cs index bd2fad96..95229d4c 100644 --- a/Libraries/Core/Helpers/ProbabilityHelper.cs +++ b/Libraries/Core/Helpers/ProbabilityHelper.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Models.Utils; +using Core.Models.Utils; using Core.Utils; +using SptCommon.Annotations; namespace Core.Helpers; @@ -11,13 +11,13 @@ public class ProbabilityHelper( ) { /// - /// Chance to roll a number out of 100 + /// Chance to roll a number out of 100 /// /// Percentage chance roll should success /// scale of chance to allow support of numbers > 1-100 /// true if success public bool RollChance(double chance, double scale = 1) { - return _randomUtil.GetInt(1, (int)(100 * scale)) / (1 * scale) <= chance; + return _randomUtil.GetInt(1, (int) (100 * scale)) / (1 * scale) <= chance; } } diff --git a/Libraries/Core/Helpers/ProfileHelper.cs b/Libraries/Core/Helpers/ProfileHelper.cs index 662929ae..74bc3af9 100644 --- a/Libraries/Core/Helpers/ProfileHelper.cs +++ b/Libraries/Core/Helpers/ProfileHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; @@ -9,6 +8,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -27,10 +27,11 @@ public class ProfileHelper( ConfigServer _configServer ) { + protected readonly List gameEditions = ["edge_of_darkness", "unheard_edition"]; protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); /// - /// Remove/reset a completed quest condtion from players profile quest data + /// Remove/reset a completed quest condtion from players profile quest data /// /// Session id /// Quest with condition to remove @@ -42,12 +43,14 @@ public class ProfileHelper( var profileQuest = pmcData.Quests.FirstOrDefault(q => q.QId == conditionId); if (profileQuest != null) // Remove condition + { profileQuest.CompletedConditions.Remove(conditionId); + } } } /// - /// Get all profiles from server + /// Get all profiles from server /// /// Dictionary of profiles public Dictionary GetProfiles() @@ -56,7 +59,7 @@ public class ProfileHelper( } /// - /// Get the pmc and scav profiles as an array by profile id + /// Get the pmc and scav profiles as an array by profile id /// /// /// Array of PmcData objects @@ -65,7 +68,9 @@ public class ProfileHelper( var output = new List(); if (IsWiped(sessionId)) + { return output; + } var FullProfileClone = _cloner.Clone(GetFullProfile(sessionId)); @@ -80,18 +85,21 @@ public class ProfileHelper( } /// - /// Sanitize any information from the profile that the client does not expect to receive + /// Sanitize any information from the profile that the client does not expect to receive /// /// A clone of the full player profile protected void SanitizeProfileForClient(SptProfile clonedProfile) { // Remove `loyaltyLevel` from `TradersInfo`, as otherwise it causes the client to not // properly calculate the player's `loyaltyLevel` - foreach (var trader in clonedProfile.CharacterData.PmcData.TradersInfo.Values) trader.LoyaltyLevel = null; + foreach (var trader in clonedProfile.CharacterData.PmcData.TradersInfo.Values) + { + trader.LoyaltyLevel = null; + } } /// - /// Check if a nickname is used by another profile loaded by the server + /// Check if a nickname is used by another profile loaded by the server /// /// nickname request object /// Session id @@ -120,7 +128,7 @@ public class ProfileHelper( } /// - /// Add experience to a PMC inside the players profile + /// Add experience to a PMC inside the players profile /// /// Session id /// Experience to add to PMC character @@ -128,13 +136,17 @@ public class ProfileHelper( { var pmcData = GetPmcProfile(sessionID); if (pmcData != null) + { pmcData.Info.Experience += experienceToAdd; + } else + { _logger.Error($"Profile {sessionID} does not exist"); + } } /// - /// Iterate all profiles and find matching pmc profile by provided id + /// Iterate all profiles and find matching pmc profile by provided id /// /// Profile id to find /// PmcData @@ -144,7 +156,7 @@ public class ProfileHelper( } /// - /// Get experience value for given level + /// Get experience value for given level /// /// Level to get xp for /// Number of xp points for level @@ -155,15 +167,20 @@ public class ProfileHelper( int? exp = 0; if (playerLevel >= expTable.Length) // make sure to not go out of bounds + { playerLevel = expTable.Length - 1; + } - for (var i = 0; i < playerLevel; i++) exp += expTable[i].Experience; + for (var i = 0; i < playerLevel; i++) + { + exp += expTable[i].Experience; + } return exp; } /// - /// Get the max level a player can be + /// Get the max level a player can be /// /// Max level public int GetMaxLevel() @@ -172,7 +189,7 @@ public class ProfileHelper( } /// - /// Get default Spt data object + /// Get default Spt data object /// /// Spt public Spt GetDefaultSptDataObject() @@ -190,7 +207,7 @@ public class ProfileHelper( } /// - /// Get full representation of a players profile json + /// Get full representation of a players profile json /// /// Profile id to get /// SptProfile object @@ -200,7 +217,7 @@ public class ProfileHelper( } /// - /// Get full representation of a players profile JSON by the account ID, or undefined if not found + /// Get full representation of a players profile JSON by the account ID, or undefined if not found /// /// Account ID to find /// @@ -208,13 +225,15 @@ public class ProfileHelper( { var check = int.TryParse(accountID, out var aid); if (!check) + { _logger.Error($"Account {accountID} does not exist"); + } return _saveServer.GetProfiles().FirstOrDefault(p => p.Value?.ProfileInfo?.Aid == aid).Value; } /// - /// Retrieve a ChatRoomMember formatted profile for the given session ID + /// Retrieve a ChatRoomMember formatted profile for the given session ID /// /// The session ID to return the profile for /// @@ -222,13 +241,15 @@ public class ProfileHelper( { var pmcProfile = GetFullProfile(sessionID)?.CharacterData?.PmcData; if (pmcProfile == null) + { return null; + } return GetChatRoomMemberFromPmcProfile(pmcProfile); } /// - /// Retrieve a ChatRoomMember formatted profile for the given PMC profile data + /// Retrieve a ChatRoomMember formatted profile for the given PMC profile data /// /// The PMC profile data to format into a ChatRoomMember structure /// @@ -250,7 +271,7 @@ public class ProfileHelper( } /// - /// Get a PMC profile by its session id + /// Get a PMC profile by its session id /// /// Profile id to return /// PmcData object @@ -262,7 +283,7 @@ public class ProfileHelper( } /// - /// Is given user id a player + /// Is given user id a player /// /// Id to validate /// True is a player @@ -273,7 +294,7 @@ public class ProfileHelper( } /// - /// Get a full profiles scav-specific sub-profile + /// Get a full profiles scav-specific sub-profile /// /// Profiles id /// IPmcData object @@ -283,7 +304,7 @@ public class ProfileHelper( } /// - /// Get baseline counter values for a fresh profile + /// Get baseline counter values for a fresh profile /// /// Default profile Stats object public Stats GetDefaultCounters() @@ -293,7 +314,12 @@ public class ProfileHelper( Eft = new EftStats { CarriedQuestItems = new List(), - DamageHistory = new DamageHistory { LethalDamagePart = "Head", LethalDamage = null, BodyParts = new BodyPartsDamageHistory() }, + DamageHistory = new DamageHistory + { + LethalDamagePart = "Head", + LethalDamage = null, + BodyParts = new BodyPartsDamageHistory() + }, DroppedItems = new List(), ExperienceBonusMult = 0, FoundInRaidItems = new List(), @@ -317,7 +343,7 @@ public class ProfileHelper( } /// - /// is this profile flagged for data removal + /// is this profile flagged for data removal /// /// Profile id /// True if profile is to be wiped of data/progress @@ -328,7 +354,7 @@ public class ProfileHelper( } /// - /// Iterate over player profile inventory items and find the secure container and remove it + /// Iterate over player profile inventory items and find the secure container and remove it /// /// Profile to remove secure container from /// profile without secure container @@ -349,8 +375,8 @@ public class ProfileHelper( } /// - /// Flag a profile as having received a gift - /// Store giftid in profile spt object + /// Flag a profile as having received a gift + /// Store giftid in profile spt object /// /// Player to add gift flag to /// Gift player received @@ -380,7 +406,7 @@ public class ProfileHelper( } /// - /// Check if profile has recieved a gift by id + /// Check if profile has recieved a gift by id /// /// Player profile to check for gift /// Gift to check for @@ -391,22 +417,30 @@ public class ProfileHelper( var profile = GetFullProfile(playerId); if (profile == null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Unable to gift {giftId}, Profile: {playerId} does not exist"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Unable to gift {giftId}, Profile: {playerId} does not exist"); + } + return false; } if (profile.SptData.ReceivedGifts == null) + { return false; + } var giftDataFromProfile = profile.SptData.ReceivedGifts.FirstOrDefault(g => g.GiftId == giftId); if (giftDataFromProfile == null) + { return false; + } return giftDataFromProfile.Current >= maxGiftCount; } /// - /// Find Stat in profile counters and increment by one. + /// Find Stat in profile counters and increment by one. /// /// Counters to search for key /// Key @@ -415,11 +449,13 @@ public class ProfileHelper( { var stat = counters.FirstOrDefault(c => c.Key.Contains(keyToIncrement)); if (stat != null) + { stat.Value++; + } } /// - /// Check if player has a skill at elite level + /// Check if player has a skill at elite level /// /// Skill to check /// Profile to find skill in @@ -428,7 +464,9 @@ public class ProfileHelper( { var profileSkills = pmcProfile.Skills.Common; if (profileSkills == null) + { return false; + } var profileSkill = profileSkills.FirstOrDefault(s => s.Id == skill.ToString()); if (profileSkill == null) @@ -441,7 +479,7 @@ public class ProfileHelper( } /// - /// Add points to a specific skill in player profile + /// Add points to a specific skill in player profile /// /// Player profile with skill /// Skill to add points to @@ -478,7 +516,9 @@ public class ProfileHelper( } if (_inventoryConfig.SkillGainMultipliers.TryGetValue(skill.ToString(), out _)) + { pointsToAddToSkill *= _inventoryConfig.SkillGainMultipliers[skill.ToString()]; + } profileSkill.Progress += pointsToAddToSkill; profileSkill.Progress = Math.Min(profileSkill?.Progress ?? 0D, 5100); // Prevent skill from ever going above level 51 (5100) @@ -486,7 +526,7 @@ public class ProfileHelper( } /// - /// Get a specific common skill from supplied profile + /// Get a specific common skill from supplied profile /// /// Player profile /// Skill to look up and return value from @@ -495,13 +535,15 @@ public class ProfileHelper( { var skillToReturn = pmcData?.Skills?.Common.FirstOrDefault(s => s.Id == skill.ToString()); if (skillToReturn == null) + { _logger.Warning($"Profile {pmcData.SessionId} does not have a skill named: {skill.ToString()}"); + } return skillToReturn; } /// - /// Is the provided session id for a developer account + /// Is the provided session id for a developer account /// /// Profile id to check /// True if account is developer @@ -511,7 +553,7 @@ public class ProfileHelper( } /// - /// Add stash row bonus to profile or increments rows given count if it already exists + /// Add stash row bonus to profile or increments rows given count if it already exists /// /// Profile id to give rows to /// How many rows to give profile @@ -520,6 +562,7 @@ public class ProfileHelper( var profile = GetPmcProfile(sessionId); var existingBonus = profile?.Bonuses?.FirstOrDefault(b => b.Type == BonusType.StashRows); if (existingBonus != null) + { profile?.Bonuses?.Add( new Bonus { @@ -531,12 +574,15 @@ public class ProfileHelper( IsProduction = false } ); + } else + { existingBonus.Value += rowsToAdd; + } } /// - /// Iterate over all bonuses and sum up all bonuses of desired type in provided profile + /// Iterate over all bonuses and sum up all bonuses of desired type in provided profile /// /// Player profile /// Bonus to sum up @@ -545,10 +591,12 @@ public class ProfileHelper( { var bonuses = pmcProfile?.Bonuses?.Where(b => b.Type == desiredBonus); if (bonuses.Count() == 0) + { return 0; + } // Sum all bonuses found above - return bonuses?.Sum(new Func(bonus => bonus?.Value ?? 0)) ?? 0; + return bonuses?.Sum(bonus => bonus?.Value ?? 0) ?? 0; } public bool PlayerIsFleaBanned(PmcData pmcProfile) @@ -557,15 +605,13 @@ public class ProfileHelper( return pmcProfile?.Info?.Bans?.Any(b => b.BanType == BanType.RAGFAIR && currentTimestamp < b.DateTime) ?? false; } - protected readonly List gameEditions = ["edge_of_darkness", "unheard_edition"]; - public bool HasAccessToRepeatableFreeRefreshSystem(PmcData pmcProfile) { return gameEditions.Contains(pmcProfile.Info.GameVersion); } /// - /// Find a profiles "Pockets" item and replace its tpl with passed in value + /// Find a profiles "Pockets" item and replace its tpl with passed in value /// /// Player profile /// New tpl to set profiles Pockets to @@ -580,11 +626,14 @@ public class ProfileHelper( return; } - foreach (var pocket in pockets) pocket.Template = newPocketTpl; + foreach (var pocket in pockets) + { + pocket.Template = newPocketTpl; + } } /// - /// Return all quest items current in the supplied profile + /// Return all quest items current in the supplied profile /// /// Profile to get quest items from /// List of item objects @@ -594,7 +643,7 @@ public class ProfileHelper( } /// - /// Return a favorites list in the format expected by the GetOtherProfile call + /// Return a favorites list in the format expected by the GetOtherProfile call /// /// /// A list of Item objects representing the favorited data @@ -622,9 +671,11 @@ public class ProfileHelper( public void AddHideoutCustomisationUnlock(SptProfile fullProfile, Reward reward, string source) { if (fullProfile?.CustomisationUnlocks == null) + { fullProfile.CustomisationUnlocks = new List(); + } - if (fullProfile?.CustomisationUnlocks?.Any(u => u.Id == (string)reward.Target) ?? false) + if (fullProfile?.CustomisationUnlocks?.Any(u => u.Id == (string) reward.Target) ?? false) { _logger.Warning($"Profile: {fullProfile.ProfileInfo.ProfileId} already has hideout customisaiton reward: {reward.Target}, skipping"); return; diff --git a/Libraries/Core/Helpers/QuestConditionHelper.cs b/Libraries/Core/Helpers/QuestConditionHelper.cs index 7727b85b..a12afc75 100644 --- a/Libraries/Core/Helpers/QuestConditionHelper.cs +++ b/Libraries/Core/Helpers/QuestConditionHelper.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; +using SptCommon.Annotations; namespace Core.Helpers; @@ -40,11 +40,14 @@ public class QuestConditionHelper Func>? furtherFilter = null) { var filteredQuests = questConditions.Where( - (c) => + c => { if (c.ConditionType == questType) // return true or run the passed in function + { return furtherFilter is null || furtherFilter(c).Any(); + } + return false; } ) diff --git a/Libraries/Core/Helpers/QuestHelper.cs b/Libraries/Core/Helpers/QuestHelper.cs index 76398f37..5a8ddf65 100644 --- a/Libraries/Core/Helpers/QuestHelper.cs +++ b/Libraries/Core/Helpers/QuestHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.ItemEvent; @@ -11,6 +10,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -38,31 +38,34 @@ public class QuestHelper( ICloner _cloner ) { - protected QuestConfig _questConfig = _configServer.GetConfig(); protected List _newlyQuestCheck = [QuestStatusEnum.Started, QuestStatusEnum.AvailableForFinish]; + protected QuestConfig _questConfig = _configServer.GetConfig(); /// - /// Get status of a quest in player profile by its id + /// Get status of a quest in player profile by its id /// /// Profile to search /// Quest id to look up /// QuestStatus enum public QuestStatusEnum GetQuestStatus(PmcData pmcData, string questId) { - var quest = pmcData.Quests?.FirstOrDefault((q) => q.QId == questId); + var quest = pmcData.Quests?.FirstOrDefault(q => q.QId == questId); return quest?.Status ?? QuestStatusEnum.Locked; } /// - /// returns true if the level condition is satisfied + /// returns true if the level condition is satisfied /// /// Players level /// Quest condition /// true if player level is greater than or equal to quest public bool DoesPlayerLevelFulfilCondition(double playerLevel, QuestCondition condition) { - if (condition.ConditionType != "Level") return true; + if (condition.ConditionType != "Level") + { + return true; + } var conditionValue = double.Parse(condition.Value.ToString()); switch (condition.CompareMethod) @@ -87,7 +90,7 @@ public class QuestHelper( } /// - /// Get the quests found in both lists (inner join) + /// Get the quests found in both lists (inner join) /// /// List of quests #1 /// List of quests #2 @@ -95,26 +98,40 @@ public class QuestHelper( public List GetDeltaQuests(List before, List after) { List knownQuestsIds = []; - foreach (var quest in before) knownQuestsIds.Add(quest.Id); + foreach (var quest in before) + { + knownQuestsIds.Add(quest.Id); + } if (knownQuestsIds.Count != 0) - return after.Where((q) => { return knownQuestsIds.IndexOf(q.Id) == -1; }).ToList(); + { + return after.Where( + q => + { + return knownQuestsIds.IndexOf(q.Id) == -1; + } + ) + .ToList(); + } return after; } /// - /// Adjust skill experience for low skill levels, mimicking the official client + /// Adjust skill experience for low skill levels, mimicking the official client /// /// the skill experience is being added to /// the amount of experience being added to the skill /// the adjusted skill progress gain public int AdjustSkillExpForLowLevels(Common profileSkill, int progressAmount) { - var currentLevel = Math.Floor((double)(profileSkill.Progress / 100)); + var currentLevel = Math.Floor((double) (profileSkill.Progress / 100)); // Only run this if the current level is under 9 - if (currentLevel >= 9) return progressAmount; + if (currentLevel >= 9) + { + return progressAmount; + } // This calculates how much progress we have in the skill's starting level var startingLevelProgress = profileSkill.Progress % 100 * ((currentLevel + 1) / 10); @@ -129,26 +146,36 @@ public class QuestHelper( { // Calculate how much progress to add, limiting it to the current level max progress var currentLevelRemainingProgress = (currentLevel + 1) * 10 - startingLevelProgress; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"currentLevelRemainingProgress: {currentLevelRemainingProgress}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"currentLevelRemainingProgress: {currentLevelRemainingProgress}"); + } + var progressToAdd = Math.Min(remainingProgress, currentLevelRemainingProgress ?? 0); var adjustedProgressToAdd = 10 / (currentLevel + 1) * progressToAdd; - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Progress To Add: {progressToAdd} Adjusted for level: {adjustedProgressToAdd}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Progress To Add: {progressToAdd} Adjusted for level: {adjustedProgressToAdd}"); + } // Add the progress amount adjusted by level - adjustedSkillProgress += (int)adjustedProgressToAdd; - remainingProgress -= (int)progressToAdd; + adjustedSkillProgress += (int) adjustedProgressToAdd; + remainingProgress -= (int) progressToAdd; startingLevelProgress = 0; currentLevel++; } // If there's any remaining progress, add it. This handles if you go from level 8 -> 9 - if (remainingProgress > 0) adjustedSkillProgress += remainingProgress; + if (remainingProgress > 0) + { + adjustedSkillProgress += remainingProgress; + } return adjustedSkillProgress; } /// - /// Get quest name by quest id + /// Get quest name by quest id /// /// id to get /// @@ -159,7 +186,7 @@ public class QuestHelper( } /// - /// Check if trader has sufficient loyalty to fulfill quest requirement + /// Check if trader has sufficient loyalty to fulfill quest requirement /// /// Quest props /// Player profile @@ -173,9 +200,11 @@ public class QuestHelper( : questProperties.Target.List.FirstOrDefault(), out var trader )) + { _logger.Error( _localisationService.GetText("quest-unable_to_find_trader_in_profile", questProperties.Target) ); + } return CompareAvailableForValues( trader.LoyaltyLevel.Value, @@ -185,7 +214,7 @@ public class QuestHelper( } /// - /// Check if trader has sufficient standing to fulfill quest requirement + /// Check if trader has sufficient standing to fulfill quest requirement /// /// Quest props /// Player profile @@ -199,9 +228,11 @@ public class QuestHelper( : questProperties.Target.List.FirstOrDefault(), out var trader )) + { _logger.Error( _localisationService.GetText("quest-unable_to_find_trader_in_profile", questProperties.Target) ); + } return CompareAvailableForValues(trader.Standing ?? 1, requiredLoyaltyLevel, questProperties.CompareMethod); } @@ -248,7 +279,10 @@ public class QuestHelper( existingQuest.StatusTimers[newState] = currentTimestamp; existingQuest.CompletedConditions = []; - if (existingQuest.AvailableAfter is not null) existingQuest.AvailableAfter = null; + if (existingQuest.AvailableAfter is not null) + { + existingQuest.AvailableAfter = null; + } return existingQuest; } @@ -265,6 +299,7 @@ public class QuestHelper( // Check if quest has a prereq to be placed in a 'pending' state, otherwise set status timers value var questDbData = GetQuestFromDb(acceptedQuest.QuestId, pmcData); if (questDbData is null) + { _logger.Error( _localisationService.GetText( "quest-unable_to_find_quest_in_db", @@ -275,6 +310,7 @@ public class QuestHelper( } ) ); + } var waitTime = questDbData?.Conditions.AvailableForStart.FirstOrDefault(x => x.AvailableAfter > 0); if (waitTime is not null && acceptedQuest.Type != "repeatable") @@ -323,34 +359,57 @@ public class QuestHelper( ); // Not found, skip quest - if (acceptedQuestCondition is null) return false; + if (acceptedQuestCondition is null) + { + return false; + } // Skip locked event quests - if (!ShowEventQuestToPlayer(quest.Id)) return false; + if (!ShowEventQuestToPlayer(quest.Id)) + { + return false; + } // Skip quest if its flagged as for other side - if (QuestIsForOtherSide(profile.Info.Side, quest.Id)) return false; + if (QuestIsForOtherSide(profile.Info.Side, quest.Id)) + { + return false; + } - if (QuestIsProfileBlacklisted(profile.Info.GameVersion, quest.Id)) return false; + if (QuestIsProfileBlacklisted(profile.Info.GameVersion, quest.Id)) + { + return false; + } - if (QuestIsProfileWhitelisted(profile.Info.GameVersion, quest.Id)) return false; + if (QuestIsProfileWhitelisted(profile.Info.GameVersion, quest.Id)) + { + return false; + } var standingRequirements = _questConditionHelper.GetStandingConditions( quest.Conditions.AvailableForStart ); foreach (var condition in standingRequirements) + { if (!TraderStandingRequirementCheck(condition, profile)) + { return false; + } + } var loyaltyRequirements = _questConditionHelper.GetLoyaltyConditions( quest.Conditions.AvailableForStart ); foreach (var condition in loyaltyRequirements) + { if (!TraderLoyaltyLevelRequirementCheck(condition, profile)) + { return false; + } + } // Include if quest found in profile and is started or ready to hand in - return startedQuestInProfile is not null && _newlyQuestCheck.Contains((QuestStatusEnum)startedQuestInProfile.Status); + return startedQuestInProfile is not null && _newlyQuestCheck.Contains((QuestStatusEnum) startedQuestInProfile.Status); } ); @@ -370,17 +429,23 @@ public class QuestHelper( // Not christmas + quest is for christmas if (!isChristmasEventActive && _seasonalEventService.IsQuestRelatedToEvent(questId, SeasonalEventType.Christmas)) + { return false; + } // Not halloween + quest is for halloween if (!isHalloweenEventActive && _seasonalEventService.IsQuestRelatedToEvent(questId, SeasonalEventType.Halloween)) + { return false; + } // Should non-season event quests be shown to player if (!(_questConfig.ShowNonSeasonalEventQuests ?? false) && _seasonalEventService.IsQuestRelatedToEvent(questId, SeasonalEventType.None)) + { return false; + } return true; } @@ -395,11 +460,15 @@ public class QuestHelper( var isUsec = playerSide.ToLower() == "usec"; if (isUsec && _questConfig.BearOnlyQuests.Contains(questId)) // Player is usec and quest is bear only, skip + { return true; + } if (!isUsec && _questConfig.UsecOnlyQuests.Contains(questId)) // Player is bear and quest is usec only, skip + { return true; + } return false; } @@ -416,7 +485,9 @@ public class QuestHelper( var questBlacklist = _questConfig.ProfileBlacklist?.GetValueOrDefault(gameVersion); if (questBlacklist is null) // Not blacklisted + { return false; + } return questBlacklist.Contains(questId); } @@ -433,7 +504,9 @@ public class QuestHelper( var questBlacklist = _questConfig.ProfileBlacklist.GetValueOrDefault(gameVersion); if (questBlacklist is null) // Not blacklisted + { return false; + } return questBlacklist.Contains(questId); } @@ -447,11 +520,11 @@ public class QuestHelper( public List FailedUnlocked(string failedQuestId, string sessionId) { var profile = _profileHelper.GetPmcProfile(sessionId); - var profileQuest = profile.Quests.FirstOrDefault((x) => x.QId == failedQuestId); + var profileQuest = profile.Quests.FirstOrDefault(x => x.QId == failedQuestId); var quests = GetQuestsFromDb() .Where( - (q) => + q => { var acceptedQuestCondition = q.Conditions.AvailableForStart.FirstOrDefault( c => c.ConditionType == "Quest" && @@ -459,26 +532,75 @@ public class QuestHelper( c.Status[0] == QuestStatusEnum.Fail ); - if (acceptedQuestCondition is null) return false; + if (acceptedQuestCondition is null) + { + return false; + } return profileQuest is not null && profileQuest.Status == QuestStatusEnum.Fail; } ) .ToList(); - if (quests.Any()) return quests; + if (quests.Any()) + { + return quests; + } return GetQuestsWithOnlyLevelRequirementStartCondition(quests); } /** - * Sets the item stack to new value, or delete the item if value <= 0 - * // TODO maybe merge this function and the one from customization - * @param pmcData Profile - * @param itemId id of item to adjust stack size of - * @param newStackSize Stack size to adjust to - * @param sessionID Session id - * @param output ItemEvent router response + * Sets the item stack to new value, or delete the item if value + * < + * = + * 0 + * / + * / + * TODO + * maybe + * merge + * this + * function + * and + * the + * one + * from + * customization + * @ + * param + * pmcData + * Profile + * @ + * param + * itemId + * id + * of + * item + * to + * adjust + * stack + * size + * of + * @ + * param + * newStackSize + * Stack + * size + * to + * adjust + * to + * @ + * param + * sessionID + * Session + * id + * @ + * param + * output + * ItemEvent + * router + * response */ public void ChangeItemStack( PmcData pmcData, @@ -487,7 +609,7 @@ public class QuestHelper( string sessionID, ItemEventRouterResponse output) { - var inventoryItemIndex = pmcData.Inventory.Items.FindIndex((item) => item.Id == itemId); + var inventoryItemIndex = pmcData.Inventory.Items.FindIndex(item => item.Id == itemId); if (inventoryItemIndex < 0) { _logger.Error(_localisationService.GetText("quest-item_not_found_in_inventory", itemId)); @@ -508,7 +630,13 @@ public class QuestHelper( { // this case is probably dead Code right now, since the only calling function // checks explicitly for Value > 0. - output.ProfileChanges[sessionID].Items.DeletedItems.Add(new Item { Id = itemId }); + output.ProfileChanges[sessionID] + .Items.DeletedItems.Add( + new Item + { + Id = itemId + } + ); pmcData.Inventory.Items.RemoveAt(inventoryItemIndex); } } @@ -532,8 +660,11 @@ public class QuestHelper( Template = item.Template, ParentId = item.ParentId, SlotId = item.SlotId, - Location = (ItemLocation)item.Location, - Upd = new Upd { StackObjectsCount = item.Upd.StackObjectsCount } + Location = (ItemLocation) item.Location, + Upd = new Upd + { + StackObjectsCount = item.Upd.StackObjectsCount + } } ); } @@ -557,7 +688,7 @@ public class QuestHelper( { var updatedQuest = _cloner.Clone(quest); updatedQuest.Conditions.AvailableForStart = updatedQuest.Conditions.AvailableForStart.Where( - (q) => q.ConditionType == "Level" + q => q.ConditionType == "Level" ) .ToList(); @@ -580,7 +711,10 @@ public class QuestHelper( var updatedOutput = output; // Prepare response to send back to client - if (updatedOutput is null) updatedOutput = _eventOutputHolder.GetOutput(sessionID); + if (updatedOutput is null) + { + updatedOutput = _eventOutputHolder.GetOutput(sessionID); + } UpdateQuestState(pmcData, QuestStatusEnum.Fail, failRequest.QuestId); var questRewards = _questRewardHelper.ApplyQuestReward( @@ -596,13 +730,15 @@ public class QuestHelper( // 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 + repeatableType => repeatableType.ActiveQuests ) - .FirstOrDefault((activeQuest) => activeQuest.Id == failRequest.QuestId); + .FirstOrDefault(activeQuest => activeQuest.Id == failRequest.QuestId); // Quest found and no repeatable found if (quest is not null && matchingRepeatableQuest is null) + { if (quest.FailMessageText.Trim().Count() > 0) + { _mailSendService.SendLocalisedNpcMessageToPlayer( sessionID, _traderHelper.GetTraderById(quest?.TraderId ?? matchingRepeatableQuest?.TraderId) @@ -610,8 +746,10 @@ public class QuestHelper( MessageType.QUEST_FAIL, quest.FailMessageText, questRewards.ToList(), - _timeUtil.GetHoursAsSeconds((int)GetMailItemRedeemTimeHoursForProfile(pmcData)) + _timeUtil.GetHoursAsSeconds((int) GetMailItemRedeemTimeHoursForProfile(pmcData)) ); + } + } updatedOutput.ProfileChanges[sessionID].Quests.AddRange(FailedUnlocked(failRequest.QuestId, sessionID)); } @@ -635,7 +773,10 @@ public class QuestHelper( public Quest GetQuestFromDb(string questId, PmcData pmcData) { // Maybe a repeatable quest? - if (_databaseService.GetQuests().TryGetValue(questId, out var quest)) return quest; + if (_databaseService.GetQuests().TryGetValue(questId, out var quest)) + { + return quest; + } // Check daily/weekly objects return pmcData.RepeatableQuests @@ -644,7 +785,7 @@ public class QuestHelper( } /// - /// Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead + /// Get a quests startedMessageText key from db, if no startedMessageText key found, use description key instead /// /// startedMessageText property from Quest /// description property from Quest @@ -659,13 +800,15 @@ public class QuestHelper( startedMessageText.ToLower() == "test" || startedMessageText.Length == 24 ) + { return questDescriptionId; + } return startedMessageTextId; } /// - /// Get the locale Id from locale db for a quest message + /// Get the locale Id from locale db for a quest message /// /// Quest message id to look up /// Locale Id from locale db @@ -676,7 +819,7 @@ public class QuestHelper( } /// - /// Alter a quests state + Add a record to its status timers object + /// Alter a quests state + Add a record to its status timers object /// /// Profile to update /// New state the quest should be in @@ -684,7 +827,7 @@ public class QuestHelper( public void UpdateQuestState(PmcData pmcData, QuestStatusEnum newQuestState, string questId) { // Find quest in profile, update status to desired status - var questToUpdate = pmcData.Quests.FirstOrDefault((quest) => quest.QId == questId); + var questToUpdate = pmcData.Quests.FirstOrDefault(quest => quest.QId == questId); if (questToUpdate is not null) { questToUpdate.Status = newQuestState; @@ -693,14 +836,14 @@ public class QuestHelper( } /// - /// Resets a quests values back to its chosen state + /// Resets a quests values back to its chosen state /// /// Profile to update /// New state the quest should be in /// Id of the quest to alter the status of public void ResetQuestState(PmcData pmcData, QuestStatusEnum newQuestState, string questId) { - var questToUpdate = pmcData.Quests.FirstOrDefault((quest) => quest.QId == questId); + var questToUpdate = pmcData.Quests.FirstOrDefault(quest => quest.QId == questId); if (questToUpdate is not null) { var currentTimestamp = _timeUtil.GetTimeStamp(); @@ -708,14 +851,21 @@ public class QuestHelper( questToUpdate.Status = newQuestState; // Only set start time when quest is being started - if (newQuestState == QuestStatusEnum.Started) questToUpdate.StartTime = currentTimestamp; + if (newQuestState == QuestStatusEnum.Started) + { + questToUpdate.StartTime = currentTimestamp; + } questToUpdate.StatusTimers[newQuestState] = currentTimestamp; // Delete all status timers after applying new status foreach (var statusKey in questToUpdate.StatusTimers) + { if (statusKey.Key > newQuestState) + { questToUpdate.StatusTimers.Remove(statusKey.Key); + } + } // Remove all completed conditions questToUpdate.CompletedConditions = []; @@ -723,11 +873,11 @@ public class QuestHelper( } /** - * Find quest with 'findItem' condition that needs the item tpl be handed in - * @param itemTpl item tpl to look for - * @param questIds Quests to search through for the findItem condition - * @returns quest id with 'FindItem' condition id - */ + * Find quest with 'findItem' condition that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @param questIds Quests to search through for the findItem condition + * @returns quest id with 'FindItem' condition id + */ public Dictionary GetFindItemConditionByQuestItem( string itemTpl, string[] questIds, @@ -737,10 +887,14 @@ public class QuestHelper( Dictionary result = new(); foreach (var questId in questIds) { - var questInDb = allQuests.FirstOrDefault((x) => x.Id == questId); + var questInDb = allQuests.FirstOrDefault(x => x.Id == questId); if (questInDb is null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Unable to find quest: {questId} in db, cannot get 'FindItem' condition, skipping"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Unable to find quest: {questId} in db, cannot get 'FindItem' condition, skipping"); + } + continue; } @@ -771,11 +925,17 @@ public class QuestHelper( foreach (var (key, questData) in quests) { // Quest from db matches quests in profile, skip - if (pmcProfile.Quests.Any((x) => x.QId == questData.Id)) continue; + if (pmcProfile.Quests.Any(x => x.QId == questData.Id)) + { + continue; + } // Create dict of status to add to quest in profile var statusesDict = new Dictionary(); - foreach (var status in statuses) statusesDict.Add(status, _timeUtil.GetTimeStamp()); + foreach (var status in statuses) + { + statusesDict.Add(status, _timeUtil.GetTimeStamp()); + } var questRecordToAdd = new QuestStatus { @@ -805,7 +965,7 @@ public class QuestHelper( public void FindAndRemoveQuestFromArrayIfExists(string questId, List quests) { - var pmcQuestToReplaceStatus = quests.FirstOrDefault((quest) => quest.QId == questId); + var pmcQuestToReplaceStatus = quests.FirstOrDefault(quest => quest.QId == questId); if (pmcQuestToReplaceStatus is not null) { var index = quests.IndexOf(pmcQuestToReplaceStatus); @@ -822,10 +982,13 @@ public class QuestHelper( { var questsInDb = GetQuestsFromDb(); return questsInDb.Where( - (quest) => + quest => { // No fail conditions, exit early - if (quest.Conditions.Fail is null || quest.Conditions.Fail.Count == 0) return false; + if (quest.Conditions.Fail is null || quest.Conditions.Fail.Count == 0) + { + return false; + } return quest.Conditions.Fail.Any( condition => @@ -847,7 +1010,10 @@ public class QuestHelper( public double? GetMailItemRedeemTimeHoursForProfile(PmcData pmcData) { var value = _questConfig.MailRedeemTimeHours.GetValueOrDefault(pmcData.Info.GameVersion); - if (value is null) return 0; + if (value is null) + { + return 0; + } return value; } @@ -874,7 +1040,10 @@ public class QuestHelper( // Check for linked failed + unrestartable quests (only get quests not already failed var questsToFail = GetQuestsFromProfileFailedByCompletingQuest(completedQuestId, pmcData); - if (questsToFail?.Count > 0) FailQuests(sessionID, pmcData, questsToFail, completeQuestResponse); + if (questsToFail?.Count > 0) + { + FailQuests(sessionID, pmcData, questsToFail, completeQuestResponse); + } // Show modal on player screen SendSuccessDialogMessageOnQuestComplete(sessionID, pmcData, completedQuestId, questRewards.ToList()); @@ -892,17 +1061,24 @@ public class QuestHelper( foreach (var currentRepeatable in pmcData.RepeatableQuests) { var repeatableQuest = currentRepeatable.ActiveQuests.FirstOrDefault( - (activeRepeatable) => activeRepeatable.Id == completedQuestId + 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 + { if (repeatableQuest.Side == "Scav") + { RemoveQuestFromScavProfile(sessionID, repeatableQuest.Id); + } + } } // Hydrate client response questsStatus array with data var questStatusChanges = GetQuestsWithDifferentStatuses(preCompleteProfileQuests, pmcData.Quests); - if (questStatusChanges is not null) completeQuestResponse.ProfileChanges[sessionID].QuestsStatus.AddRange(questStatusChanges); + if (questStatusChanges is not null) + { + completeQuestResponse.ProfileChanges[sessionID].QuestsStatus.AddRange(questStatusChanges); + } return completeQuestResponse; } @@ -938,20 +1114,32 @@ public class QuestHelper( } // Filter out bear quests for USEC and vice versa - if (QuestIsForOtherSide(profile.Info.Side, quest.Id)) continue; + if (QuestIsForOtherSide(profile.Info.Side, quest.Id)) + { + continue; + } - if (!ShowEventQuestToPlayer(quest.Id)) continue; + if (!ShowEventQuestToPlayer(quest.Id)) + { + continue; + } // Don't add quests that have a level higher than the user's - if (!PlayerLevelFulfillsQuestRequirement(quest, profile.Info.Level.Value)) continue; + if (!PlayerLevelFulfillsQuestRequirement(quest, profile.Info.Level.Value)) + { + continue; + } // Player can use trader mods then remove them, leaving quests behind if (!profile.TradersInfo.TryGetValue(quest.TraderId, out var trader)) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to show quest: {quest.QuestName} as its for a trader: {quest.TraderId} that no longer exists." ); + } + continue; } @@ -1006,30 +1194,39 @@ public class QuestHelper( ); var unlockTime = previousQuestCompleteTime + conditionToFulfil.AvailableAfter; if (unlockTime > _timeUtil.GetTimeStamp()) + { _logger.Debug( $"Quest {quest.QuestName} is locked for another: {unlockTime - _timeUtil.GetTimeStamp()} seconds" ); + } } } // Previous quest not completed, skip - if (!haveCompletedPreviousQuest) continue; + if (!haveCompletedPreviousQuest) + { + continue; + } var passesLoyaltyRequirements = true; foreach (var condition in loyaltyRequirements) + { if (!TraderLoyaltyLevelRequirementCheck(condition, profile)) { passesLoyaltyRequirements = false; break; } + } var passesStandingRequirements = true; foreach (var condition in standingRequirements) + { if (!TraderStandingRequirementCheck(condition, profile)) { passesStandingRequirements = false; break; } + } if (haveCompletedPreviousQuest && passesLoyaltyRequirements && passesStandingRequirements) { @@ -1058,9 +1255,11 @@ public class QuestHelper( foreach (var rewardType in propsAsDict) { if (rewardType.Value is null) + { continue; + } - propsAsDict[rewardType.Key] = ((List)propsAsDict[rewardType.Key]) + propsAsDict[rewardType.Key] = ((List) propsAsDict[rewardType.Key]) .Where( reward => _rewardHelper.RewardIsForGameEdition(reward, gameVersion) @@ -1084,10 +1283,16 @@ public class QuestHelper( quest => { // No fail conditions, skip - if (quest.Conditions.Fail is null || quest.Conditions.Fail.Count == 0) return false; + if (quest.Conditions.Fail is null || quest.Conditions.Fail.Count == 0) + { + return false; + } // Quest already failed in profile, skip - if (pmcProfile.Quests.Any(profileQuest => profileQuest.QId == quest.Id && profileQuest.Status == QuestStatusEnum.Fail)) return false; + if (pmcProfile.Quests.Any(profileQuest => profileQuest.QId == quest.Id && profileQuest.Status == QuestStatusEnum.Fail)) + { + return false; + } return quest.Conditions.Fail.Any(condition => condition.Target?.List?.Contains(completedQuestId) ?? false); } @@ -1113,7 +1318,10 @@ public class QuestHelper( foreach (var questToFail in questsToFail) { // Skip failing a quest that has a fail status of something other than success - if (questToFail.Conditions.Fail?.Any(x => x.Status?.Any(status => status != QuestStatusEnum.Success) ?? false) ?? false) continue; + if (questToFail.Conditions.Fail?.Any(x => x.Status?.Any(status => status != QuestStatusEnum.Success) ?? false) ?? false) + { + continue; + } var isActiveQuestInPlayerProfile = pmcData.Quests.FirstOrDefault(quest => quest.QId == questToFail.Id); if (isActiveQuestInPlayerProfile is not null) @@ -1134,7 +1342,10 @@ public class QuestHelper( // Failing an entirely new quest that doesn't exist in profile var statusTimers = new Dictionary(); - if (!statusTimers.TryGetValue(QuestStatusEnum.Fail, out _)) statusTimers.Add(QuestStatusEnum.Fail, 0); + if (!statusTimers.TryGetValue(QuestStatusEnum.Fail, out _)) + { + statusTimers.Add(QuestStatusEnum.Fail, 0); + } statusTimers[QuestStatusEnum.Fail] = _timeUtil.GetTimeStamp(); var questData = new QuestStatus @@ -1172,7 +1383,7 @@ public class QuestHelper( MessageType.QUEST_SUCCESS, quest.SuccessMessageText, questRewards, - _timeUtil.GetHoursAsSeconds((int)GetMailItemRedeemTimeHoursForProfile(pmcData)) + _timeUtil.GetHoursAsSeconds((int) GetMailItemRedeemTimeHoursForProfile(pmcData)) ); } @@ -1271,10 +1482,16 @@ public class QuestHelper( { // Add quest if status differs or quest not found var preQuest = preQuestStatuses.FirstOrDefault(x => x.QId == quest.QId); - if (preQuest is null || preQuest.Status != quest.Status) result.Add(quest); + if (preQuest is null || preQuest.Status != quest.Status) + { + result.Add(quest); + } } - if (result.Count == 0) return null; + if (result.Count == 0) + { + return null; + } return result; } @@ -1289,14 +1506,22 @@ public class QuestHelper( { if (quest.Conditions is null) // No conditions + { return true; + } var levelConditions = _questConditionHelper.GetLevelConditions(quest.Conditions.AvailableForStart); if (levelConditions is not null) + { foreach (var levelCondition in levelConditions) + { if (!DoesPlayerLevelFulfilCondition(playerLevel, levelCondition)) // Not valid, exit out + { return false; + } + } + } // All conditions passed / has no level requirement, valid return true; diff --git a/Libraries/Core/Helpers/QuestRewardHelper.cs b/Libraries/Core/Helpers/QuestRewardHelper.cs index cb5459ff..728f6a4a 100644 --- a/Libraries/Core/Helpers/QuestRewardHelper.cs +++ b/Libraries/Core/Helpers/QuestRewardHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.ItemEvent; @@ -9,9 +8,9 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; - namespace Core.Helpers; [Injectable] @@ -65,7 +64,9 @@ public class QuestRewardHelper( var questMoneyRewardBonusMultiplier = GetQuestMoneyRewardBonusMultiplier(pmcProfile); if (questMoneyRewardBonusMultiplier > 0) // money = money + (money * intelCenterBonus / 100) + { questDetails = ApplyMoneyBoost(questDetails, questMoneyRewardBonusMultiplier, state); + } // e.g. 'Success' or 'AvailableForFinish' var rewards = questDetails.Rewards.GetByJsonProp>(state.ToString()); @@ -91,18 +92,22 @@ public class QuestRewardHelper( var quest = _databaseService.GetQuests()[questId]; if (quest == null) // Check daily/weekly objects + { foreach (var repeatableQuest in pmcData.RepeatableQuests) { quest = repeatableQuest.ActiveQuests.FirstOrDefault(r => r.Id == questId); if (quest != null) + { break; + } } + } return quest; } /// - /// Get players money reward bonus from profile + /// Get players money reward bonus from profile /// /// player profile /// bonus as a percent @@ -137,7 +142,7 @@ public class QuestRewardHelper( public Quest ApplyMoneyBoost(Quest quest, double bonusPercent, QuestStatusEnum questStatus) { var clonedQuest = _cloner.Clone(quest); - var rewards = (List)clonedQuest.Rewards.GetType() + var rewards = (List) clonedQuest.Rewards.GetType() .GetProperties() .FirstOrDefault(p => p.Name == questStatus.ToString()) .GetValue(quest.Rewards) ?? diff --git a/Libraries/Core/Helpers/RagfairHelper.cs b/Libraries/Core/Helpers/RagfairHelper.cs index d8659c98..38caf8c3 100644 --- a/Libraries/Core/Helpers/RagfairHelper.cs +++ b/Libraries/Core/Helpers/RagfairHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Ragfair; using Core.Models.Enums; @@ -6,6 +5,7 @@ using Core.Models.Spt.Config; using Core.Servers; using Core.Services; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Helpers; @@ -50,7 +50,10 @@ public class RagfairHelper( var result = new List(); // Case: weapon builds - if (request.BuildCount > 0) return request.BuildItems.Keys.ToList(); + if (request.BuildCount > 0) + { + return request.BuildItems.Keys.ToList(); + } // Case: search if (!string.IsNullOrEmpty(request.LinkedSearchId)) @@ -65,9 +68,13 @@ public class RagfairHelper( var handbook = GetCategoryList(request.HandbookId); if (result.Count != null && result.Count > 0) + { result = utilityHelper.ArrayIntersect(result, handbook); + } else + { result = handbook; + } } return result; @@ -76,7 +83,8 @@ public class RagfairHelper( public Dictionary GetDisplayableAssorts(string sessionId) { var result = new Dictionary(); - foreach (var traderId in databaseService.GetTraders().Keys + foreach (var traderId in databaseService.GetTraders() + .Keys .Where(traderId => _ragfairConfig.Traders.ContainsKey(traderId))) { result[traderId] = traderAssortHelper.GetAssort(sessionId, traderId, true); diff --git a/Libraries/Core/Helpers/RagfairOfferHelper.cs b/Libraries/Core/Helpers/RagfairOfferHelper.cs index d66c3539..b65b1aec 100644 --- a/Libraries/Core/Helpers/RagfairOfferHelper.cs +++ b/Libraries/Core/Helpers/RagfairOfferHelper.cs @@ -1,9 +1,6 @@ -using System.Text.RegularExpressions; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; -using Core.Models.Eft.Hideout; using Core.Models.Eft.ItemEvent; -using Core.Models.Eft.Player; using Core.Models.Eft.Profile; using Core.Models.Eft.Ragfair; using Core.Models.Enums; @@ -42,9 +39,9 @@ public class RagfairOfferHelper( EventOutputHolder _eventOutputHolder, ConfigServer _configServer) { - protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); - protected BotConfig _botConfig = _configServer.GetConfig(); protected const string _goodSoldTemplate = "5bdabfb886f7743e152e867e 0"; // Your {soldItem} {itemCount} items were bought by {buyerNickname}. + protected BotConfig _botConfig = _configServer.GetConfig(); + protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); /// /// Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see @@ -67,7 +64,10 @@ public class RagfairOfferHelper( .Where( offer => { - if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) return false; + if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) + { + return false; + } var isDisplayable = IsDisplayableOffer( searchRequest, @@ -78,16 +78,21 @@ public class RagfairOfferHelper( playerIsFleaBanned ); - if (!isDisplayable) return false; + if (!isDisplayable) + { + return false; + } // Not trader offer + tiered flea enabled if (tieredFlea.Enabled && !OfferIsFromTrader(offer)) + { CheckAndLockOfferFromPlayerTieredFlea( tieredFlea, offer, tieredFleaLimitTypes.Keys.ToList(), pmcData.Info.Level.Value ); + } return true; } @@ -110,32 +115,41 @@ public class RagfairOfferHelper( { var offerItemTpl = offer.Items.FirstOrDefault().Template; if (tieredFlea.AmmoTplUnlocks is not null && _itemHelper.IsOfBaseclass(offerItemTpl, BaseClasses.AMMO)) + { if (tieredFlea.AmmoTplUnlocks.TryGetValue(offerItemTpl, out var unlockLevel) && playerLevel < unlockLevel) { offer.Locked = true; return; } + } // Check for a direct level requirement for the offer item if (tieredFlea.UnlocksTpl.TryGetValue(offerItemTpl, out var itemLevelRequirement)) + { if (playerLevel < itemLevelRequirement) { offer.Locked = true; return; } + } // Optimisation - Ensure the item has at least one of the limited base types if (_itemHelper.IsOfBaseclasses(offerItemTpl, tieredFleaLimitTypes)) // Loop over flea types + { foreach (var tieredItemType in tieredFleaLimitTypes .Where(tieredItemType => _itemHelper.IsOfBaseclass(offerItemTpl, tieredItemType))) { - if (playerLevel < tieredFlea.UnlocksType[tieredItemType]) offer.Locked = true; + if (playerLevel < tieredFlea.UnlocksType[tieredItemType]) + { + offer.Locked = true; + } break; } + } } /// @@ -154,15 +168,20 @@ public class RagfairOfferHelper( return requiredOffers.Where( offer => { - if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) return false; + if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) + { + return false; + } if (tieredFlea.Enabled && !OfferIsFromTrader(offer)) + { CheckAndLockOfferFromPlayerTieredFlea( tieredFlea, offer, tieredFleaLimitTypes.Keys.ToList(), pmcData.Info.Level.Value ); + } return true; } @@ -195,14 +214,22 @@ public class RagfairOfferHelper( var matchingOffers = _ragfairOfferService.GetOffersOfType(desiredItemTpl.Key); if (matchingOffers is null) // No offers found for this item, skip + { continue; + } foreach (var offer in matchingOffers) { // Don't show pack offers - if (offer.SellInOnePiece.GetValueOrDefault(false)) continue; + if (offer.SellInOnePiece.GetValueOrDefault(false)) + { + continue; + } - if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) continue; + if (!PassesSearchFilterCriteria(searchRequest, offer, pmcData)) + { + continue; + } if ( !IsDisplayableOffer( @@ -214,17 +241,31 @@ public class RagfairOfferHelper( playerIsFleaBanned ) ) + { continue; + } if (OfferIsFromTrader(offer)) { - if (TraderBuyRestrictionReached(offer)) continue; + if (TraderBuyRestrictionReached(offer)) + { + continue; + } - if (TraderOutOfStock(offer)) continue; + if (TraderOutOfStock(offer)) + { + continue; + } - if (TraderOfferItemQuestLocked(offer, traderAssorts)) continue; + if (TraderOfferItemQuestLocked(offer, traderAssorts)) + { + continue; + } - if (TraderOfferLockedBehindLoyaltyLevel(offer, pmcData)) continue; + if (TraderOfferLockedBehindLoyaltyLevel(offer, pmcData)) + { + continue; + } } // Tiered flea and not trader offer @@ -238,11 +279,17 @@ public class RagfairOfferHelper( ); // Do not add offer to build if user does not have access to it - if (offer.Locked.GetValueOrDefault(false)) continue; + if (offer.Locked.GetValueOrDefault(false)) + { + continue; + } } var key = offer.Items[0].Template; - if (!offersMap.ContainsKey(key)) offersMap.Add(key, []); + if (!offersMap.ContainsKey(key)) + { + offersMap.Add(key, []); + } offersMap[key].Add(offer); } @@ -299,36 +346,49 @@ public class RagfairOfferHelper( var moneyTypeTpl = offer.Requirements[0].Template; var isTraderOffer = _databaseService.GetTraders().ContainsKey(offer.User.Id); - if (!isTraderOffer && playerIsFleaBanned) return false; + if (!isTraderOffer && playerIsFleaBanned) + { + return false; + } // Offer root items tpl not in searched for array if (!itemsToAdd.Contains(offerRootItem.Template)) // skip items we shouldn't include + { return false; + } // Performing a required search and offer doesn't have requirement for item if ( !string.IsNullOrEmpty(searchRequest.NeededSearchId) && !offer.Requirements.Any(requirement => requirement.Template == searchRequest.NeededSearchId) ) + { return false; + } // Weapon/equipment search + offer is preset if ( searchRequest.BuildItems.Count == 0 && // Prevent equipment loadout searches filtering out presets searchRequest.BuildCount.GetValueOrDefault(0) > 0 && _presetHelper.HasPreset(offerRootItem.Template)) + { return false; + } // commented out as required search "which is for checking offers that are barters" // has info.removeBartering as true, this if statement removed barter items. if (searchRequest.RemoveBartering.GetValueOrDefault(false) && !_paymentHelper.IsMoneyTpl(moneyTypeTpl)) // Don't include barter offers + { return false; + } if (offer.RequirementsCost is null) // Don't include offers with undefined or NaN in it + { return false; + } // Handle trader items to remove items that are not available to the user right now // e.g. required search for "lamp" shows 4 items, 3 of which are not available to a new player @@ -337,13 +397,23 @@ public class RagfairOfferHelper( { if (!traderAssorts.ContainsKey(offer.User.Id)) // trader not visible on flea market + { return false; + } if ( - !traderAssorts[offer.User.Id].Items.Any(item => { return item.Id == offer.Root; }) + !traderAssorts[offer.User.Id] + .Items.Any( + item => + { + return item.Id == offer.Root; + } + ) ) // skip (quest) locked items + { return false; + } } return true; @@ -365,8 +435,12 @@ public class RagfairOfferHelper( OfferIsFromTrader(offer) && offer.BuyRestrictionCurrent >= offer.BuyRestrictionMax ) + { if (offer.BuyRestrictionCurrent >= offer.BuyRestrictionMax) + { return false; + } + } // Doesnt have buy limits, retrun offer return true; @@ -431,7 +505,9 @@ public class RagfairOfferHelper( .Any(subBarter => subBarter.SptQuestLocked.GetValueOrDefault(false)) ) )) + { return true; + } } // Fallback, nothing found @@ -445,7 +521,10 @@ public class RagfairOfferHelper( /// true if out of stock protected bool TraderOutOfStock(RagfairOffer offer) { - if (offer?.Items?.Count == 0) return true; + if (offer?.Items?.Count == 0) + { + return true; + } return offer.Items[0]?.Upd?.StackObjectsCount == 0; } @@ -475,14 +554,22 @@ public class RagfairOfferHelper( if (assortData.Upd is null) // No Upd = no chance of limits + { return false; + } // No restriction values // Can't use !assortData.upd.BuyRestrictionX as value could be 0 - if (assortData.Upd.BuyRestrictionMax is null || assortData.Upd.BuyRestrictionCurrent is null) return false; + if (assortData.Upd.BuyRestrictionMax is null || assortData.Upd.BuyRestrictionCurrent is null) + { + return false; + } // Current equals max, limit reached - if (assortData.Upd.BuyRestrictionCurrent >= assortData.Upd.BuyRestrictionMax) return true; + if (assortData.Upd.BuyRestrictionCurrent >= assortData.Upd.BuyRestrictionMax) + { + return true; + } return false; } @@ -491,9 +578,13 @@ public class RagfairOfferHelper( { var loyaltyLockedOffers = new List(); foreach (var offer in offers.Where(offer => OfferIsFromTrader(offer))) + { if (pmcProfile.TradersInfo.TryGetValue(offer.User.Id, out var traderDetails) && traderDetails.LoyaltyLevel < offer.LoyaltyLevel) + { loyaltyLockedOffers.Add(offer.Id); + } + } return loyaltyLockedOffers; } @@ -509,7 +600,10 @@ public class RagfairOfferHelper( var profileOffers = GetProfileOffers(sessionId); // No offers, don't do anything - if (profileOffers?.Count == 0) return true; + if (profileOffers?.Count == 0) + { + return true; + } // Index backwards as CompleteOffer() can delete offer object for (var index = profileOffers.Count - 1; index >= 0; index--) @@ -553,7 +647,9 @@ public class RagfairOfferHelper( var total = 0d; foreach (var itemAndChildren in itemsInInventoryToList) // Only count the root items stack count in total + { total += itemAndChildren[0]?.Upd?.StackObjectsCount.GetValueOrDefault(1) ?? 1; + } return total; } @@ -590,7 +686,10 @@ public class RagfairOfferHelper( { var profile = _profileHelper.GetPmcProfile(sessionId); - if (profile.RagfairInfo?.Offers is null) return []; + if (profile.RagfairInfo?.Offers is null) + { + return []; + } return profile.RagfairInfo.Offers; } @@ -604,9 +703,15 @@ public class RagfairOfferHelper( { var profileRagfairInfo = _profileHelper.GetPmcProfile(sessionId).RagfairInfo; var offerIndex = profileRagfairInfo.Offers.FindIndex(o => o.Id == offerId); - if (offerIndex == -1) _logger.Warning($"Unable to find offer: {offerId} in profile: {sessionId}, unable to delete"); + if (offerIndex == -1) + { + _logger.Warning($"Unable to find offer: {offerId} in profile: {sessionId}, unable to delete"); + } - if (offerIndex >= 0) profileRagfairInfo.Offers.Splice(offerIndex, 1); + if (offerIndex >= 0) + { + profileRagfairInfo.Offers.Splice(offerIndex, 1); + } // Also delete from ragfair @@ -649,19 +754,28 @@ public class RagfairOfferHelper( { Id = _hashUtil.Generate(), Template = requirement.Template, - Upd = new Upd { StackObjectsCount = requirement.Count * boughtAmount } + Upd = new Upd + { + StackObjectsCount = requirement.Count * boughtAmount + } }; var stacks = _itemHelper.SplitStack(requestedItem); foreach (var item in stacks) { - var outItems = new List { item }; + var outItems = new List + { + item + }; // TODO - is this code used?, may have been when adding barters to flea was still possible for player if (requirement.OnlyFunctional.GetValueOrDefault(false)) { var presetItems = _ragfairServerHelper.GetPresetItemsByTpl(item); - if (presetItems.Count > 0) outItems.Add(presetItems[0]); + if (presetItems.Count > 0) + { + outItems.Add(presetItems[0]); + } } paymentItemsToSendToPlayer.AddRange(outItems); @@ -683,7 +797,7 @@ public class RagfairOfferHelper( MessageType.FLEAMARKET_MESSAGE, GetLocalisedOfferSoldMessage(itemTpl, boughtAmount), paymentItemsToSendToPlayer, - _timeUtil.GetHoursAsSeconds((int)_questHelper.GetMailItemRedeemTimeHoursForProfile(sellerProfile).Value), + _timeUtil.GetHoursAsSeconds((int) _questHelper.GetMailItemRedeemTimeHoursForProfile(sellerProfile).Value), null, ragfairDetails ); @@ -706,9 +820,11 @@ public class RagfairOfferHelper( // Generate a message to inform that item was sold var globalLocales = _localeService.GetLocaleDb(); if (!globalLocales.TryGetValue(_goodSoldTemplate, out var soldMessageLocaleGuid)) + { _logger.Error( _localisationService.GetText("ragfair-unable_to_find_locale_by_key", _goodSoldTemplate) ); + } // Used to replace tokens in sold message sent to player var messageKey = $"{itemTpl} Name"; @@ -749,34 +865,48 @@ public class RagfairOfferHelper( if (pmcData.Info.Level < _databaseService.GetGlobals().Configuration.RagFair.MinUserLevel && isDefaultUserOffer) // Skip item if player is < global unlock level (default is 15) and item is from a dynamically generated source + { return false; + } if (searchRequest.OfferOwnerType == OfferOwnerType.TRADEROWNERTYPE && !isTraderOffer) // don't include player offers + { return false; + } if (searchRequest.OfferOwnerType == OfferOwnerType.PLAYEROWNERTYPE && isTraderOffer) // don't include trader offers + { return false; + } if ( searchRequest.OneHourExpiration.GetValueOrDefault(false) && offer.EndTime - _timeUtil.GetTimeStamp() > TimeUtil.OneHourAsSeconds ) // offer expires within an hour + { return false; + } if (searchRequest.QuantityFrom > 0 && offerRootItem.Upd.StackObjectsCount < searchRequest.QuantityFrom) // too little items to offer + { return false; + } if (searchRequest.QuantityTo > 0 && offerRootItem.Upd.StackObjectsCount > searchRequest.QuantityTo) // Too many items to offer + { return false; + } if (searchRequest.OnlyFunctional.GetValueOrDefault(false) && !IsItemFunctional(offerRootItem, offer)) // Don't include non-functional items + { return false; + } if (offer.Items.Count == 1) { @@ -786,14 +916,22 @@ public class RagfairOfferHelper( IsConditionItem(offerRootItem) && !ItemQualityInRange(offerRootItem, searchRequest.ConditionFrom.Value, searchRequest.ConditionTo.Value) ) + { return false; + } } else { var itemQualityPercent = _itemHelper.GetItemQualityModifierForItems(offer.Items) * 100; - if (itemQualityPercent < searchRequest.ConditionFrom) return false; + if (itemQualityPercent < searchRequest.ConditionFrom) + { + return false; + } - if (itemQualityPercent > searchRequest.ConditionTo) return false; + if (itemQualityPercent > searchRequest.ConditionTo) + { + return false; + } } if (searchRequest.Currency > 0 && _paymentHelper.IsMoneyTpl(offerMoneyTypeTpl)) @@ -802,16 +940,22 @@ public class RagfairOfferHelper( string[] currencies = ["all", "RUB", "USD", "EUR"]; if (_ragfairHelper.GetCurrencyTag(offerMoneyTypeTpl) != currencies[searchRequest.Currency.Value]) // Don't include item paid in wrong currency + { return false; + } } if (searchRequest.PriceFrom > 0 && searchRequest.PriceFrom >= offer.RequirementsCost) // price is too low + { return false; + } if (searchRequest.PriceTo > 0 && searchRequest.PriceTo <= offer.RequirementsCost) // price is too high + { return false; + } // Passes above checks, search criteria filters have not filtered offer out return true; @@ -826,7 +970,10 @@ public class RagfairOfferHelper( public bool IsItemFunctional(Item offerRootItem, RagfairOffer offer) { // Non-preset weapons/armor are always functional - if (!_presetHelper.HasPreset(offerRootItem.Template)) return true; + if (!_presetHelper.HasPreset(offerRootItem.Template)) + { + return true; + } // For armor items that can hold mods, make sure the item count is at least the amount of required plates if (_itemHelper.ArmorItemCanHoldMods(offerRootItem.Template)) @@ -852,7 +999,10 @@ public class RagfairOfferHelper( { // thanks typescript, undefined assertion is not returnable since it // tries to return a multi-type object - if (item.Upd is null) return false; + if (item.Upd is null) + { + return false; + } return item.Upd.MedKit is not null || item.Upd.Repairable is not null || @@ -874,11 +1024,15 @@ public class RagfairOfferHelper( var itemQualityPercentage = 100 * _itemHelper.GetItemQualityModifier(item); if (min > 0 && min > itemQualityPercentage) // Item condition too low + { return false; + } if (max < 100 && max <= itemQualityPercentage) // Item condition too high + { return false; + } return true; } diff --git a/Libraries/Core/Helpers/RagfairSellHelper.cs b/Libraries/Core/Helpers/RagfairSellHelper.cs index e072707a..beefbc64 100644 --- a/Libraries/Core/Helpers/RagfairSellHelper.cs +++ b/Libraries/Core/Helpers/RagfairSellHelper.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Eft.Ragfair; using Core.Models.Spt.Config; -using Core.Servers; using Core.Models.Utils; +using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -20,7 +20,7 @@ public class RagfairSellHelper( protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); /// - /// Get the percent chance to sell an item based on its average listed price vs player chosen listing price + /// Get the percent chance to sell an item based on its average listed price vs player chosen listing price /// /// Price of average offer in roubles /// Price player listed item for in roubles @@ -41,16 +41,22 @@ public class RagfairSellHelper( var sellChance = Math.Round(baseSellChancePercent * sellModifier * Math.Pow(sellModifier, 3) + 10); // Power of 3 // Adjust sell chance if below config value - if (sellChance < sellConfig.MinSellChancePercent) sellChance = sellConfig.MinSellChancePercent; + if (sellChance < sellConfig.MinSellChancePercent) + { + sellChance = sellConfig.MinSellChancePercent; + } // Adjust sell chance if above config value - if (sellChance > sellConfig.MaxSellChancePercent) sellChance = sellConfig.MaxSellChancePercent; + if (sellChance > sellConfig.MaxSellChancePercent) + { + sellChance = sellConfig.MaxSellChancePercent; + } return sellChance; } /// - /// Get list of item count and sell time (empty list = no sell) + /// Get list of item count and sell time (empty list = no sell) /// /// chance item will sell /// count of items to sell @@ -63,7 +69,7 @@ public class RagfairSellHelper( // Get a time in future to stop simulating sell chances at var endTime = startTimestamp + - _timeUtil.GetHoursAsSeconds((int)_databaseService.GetGlobals().Configuration.RagFair.OfferDurationTimeInHour.Value); + _timeUtil.GetHoursAsSeconds((int) _databaseService.GetGlobals().Configuration.RagFair.OfferDurationTimeInHour.Value); var sellTimestamp = startTimestamp; var remainingCount = itemSellCount; @@ -77,10 +83,16 @@ public class RagfairSellHelper( _logger.Warning($"Sell chance was not a number: {sellChancePercent}, defaulting to {_ragfairConfig.Sell.Chance.Base}%"); } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Rolling to sell: {itemSellCount}items(chance: {effectiveSellChance}%)"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Rolling to sell: {itemSellCount}items(chance: {effectiveSellChance}%)"); + } // No point rolling for a sale on a 0% chance item, exit early - if (effectiveSellChance == 0) return result; + if (effectiveSellChance == 0) + { + return result; + } while (remainingCount > 0 && sellTimestamp < endTime) { @@ -92,22 +104,40 @@ public class RagfairSellHelper( var weighting = (100 - effectiveSellChance) / 100; var maximumTime = weighting * _ragfairConfig.Sell.Time.Max * 60; var minimumTime = _ragfairConfig.Sell.Time.Min * 60; - if (maximumTime < minimumTime) maximumTime = minimumTime + 5; + if (maximumTime < minimumTime) + { + maximumTime = minimumTime + 5; + } + // Sell time will be random between min/max var random = new Random(); var newSellTime = Math.Floor(random.NextDouble() * (maximumTime.Value - minimumTime.Value) + minimumTime.Value); if (newSellTime == 0) // Ensure all sales don't occur the same exact time + { newSellTime += 1; - sellTimestamp += (long)newSellTime; - result.Add(new SellResult { SellTime = sellTimestamp, Amount = boughtAmount }); + } + + sellTimestamp += (long) newSellTime; + result.Add( + new SellResult + { + SellTime = sellTimestamp, + Amount = boughtAmount + } + ); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Offer will sell at: {_timeUtil.GetDateTimeFromTimeStamp(sellTimestamp).ToLocalTime().ToString()}, bought: {boughtAmount}"); + } } else { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Offer rolled not to sell, item count: {boughtAmount}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Offer rolled not to sell, item count: {boughtAmount}"); + } } remainingCount -= boughtAmount; diff --git a/Libraries/Core/Helpers/RagfairServerHelper.cs b/Libraries/Core/Helpers/RagfairServerHelper.cs index 2f56f0b8..4e3b2aaa 100644 --- a/Libraries/Core/Helpers/RagfairServerHelper.cs +++ b/Libraries/Core/Helpers/RagfairServerHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Config; @@ -7,6 +6,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Helpers; @@ -24,8 +24,8 @@ public class RagfairServerHelper( ICloner cloner ) { - protected RagfairConfig ragfairConfig = configServer.GetConfig(); protected const string goodsReturnedTemplate = "5bdabfe486f7743e1665df6e 0"; // Your item was not sold + protected RagfairConfig ragfairConfig = configServer.GetConfig(); /** * Is item valid / on blacklist / quest item @@ -37,12 +37,21 @@ public class RagfairServerHelper( var blacklistConfig = ragfairConfig.Dynamic.Blacklist; // Skip invalid items - if (!itemDetails.Key) return false; + if (!itemDetails.Key) + { + return false; + } - if (!itemHelper.IsValidItem(itemDetails.Value.Id)) return false; + if (!itemHelper.IsValidItem(itemDetails.Value.Id)) + { + return false; + } // Skip bsg blacklisted items - if (blacklistConfig.EnableBsgList && !(itemDetails.Value?.Properties?.CanSellOnRagfair ?? false)) return false; + if (blacklistConfig.EnableBsgList && !(itemDetails.Value?.Properties?.CanSellOnRagfair ?? false)) + { + return false; + } // Skip custom blacklisted items and flag as unsellable by players if (IsItemOnCustomFleaBlacklist(itemDetails.Value.Id)) @@ -57,10 +66,15 @@ public class RagfairServerHelper( blacklistConfig.EnableCustomItemCategoryList && IsItemCategoryOnCustomFleaBlacklist(itemDetails.Value.Parent) ) + { return false; + } // Skip quest items - if (blacklistConfig.EnableQuestList && itemHelper.IsQuestItem(itemDetails.Value.Id)) return false; + if (blacklistConfig.EnableQuestList && itemHelper.IsQuestItem(itemDetails.Value.Id)) + { + return false; + } // Don't include damaged ammo packs if ( @@ -68,7 +82,9 @@ public class RagfairServerHelper( itemDetails.Value.Parent == BaseClasses.AMMO_BOX && itemDetails.Value.Name.Contains("_damaged") ) + { return false; + } return true; } @@ -116,7 +132,7 @@ public class RagfairServerHelper( MessageType.MESSAGE_WITH_ITEMS, goodsReturnedTemplate, returnedItems, - timeUtil.GetHoursAsSeconds((int)databaseService.GetGlobals().Configuration.RagFair.YourOfferDidNotSellMaxStorageTimeInHour) + timeUtil.GetHoursAsSeconds((int) databaseService.GetGlobals().Configuration.RagFair.YourOfferDidNotSellMaxStorageTimeInHour) ); } @@ -127,30 +143,37 @@ public class RagfairServerHelper( // Lookup item details - check if item not found var itemDetails = itemHelper.GetItem(tplId); if (!itemDetails.Key) + { throw new Exception( localisationService.GetText( "ragfair-item_not_in_db_unable_to_generate_dynamic_stack_count", tplId ) ); + } // Item Types to return one of if (isWeaponPreset || itemHelper.IsOfBaseclasses(itemDetails.Value.Id, ragfairConfig.Dynamic.ShowAsSingleStack) ) + { return 1; + } // Get max possible stack count var maxStackSize = itemDetails.Value?.Properties?.StackMaxSize ?? 1; // non-stackable - use different values to calculate stack size - if (maxStackSize == 1) return (int)randomUtil.GetDouble(config.NonStackableCount.Min.Value, config.NonStackableCount.Max.Value); + if (maxStackSize == 1) + { + return (int) randomUtil.GetDouble(config.NonStackableCount.Min.Value, config.NonStackableCount.Max.Value); + } // Get a % to get of stack size var stackPercent = randomUtil.GetDouble(config.StackablePercent.Min.Value, config.StackablePercent.Max.Value); // Min value to return should be no less than 1 - return Math.Max((int)randomUtil.GetPercentOfValue(stackPercent, maxStackSize, 0), 1); + return Math.Max((int) randomUtil.GetPercentOfValue(stackPercent, maxStackSize, 0), 1); } /** @@ -163,10 +186,14 @@ public class RagfairServerHelper( var bias = new List(); foreach (var item in currencies.Keys) + { for (var i = 0; i < currencies[item]; i++) + { bias.Add(item); + } + } - var index = Math.Min((int)Math.Floor(randomUtil.RandNum(0, 1, 14) * bias.Count), 99); + var index = Math.Min((int) Math.Floor(randomUtil.RandNum(0, 1, 14) * bias.Count), 99); return bias[index]; } @@ -191,11 +218,13 @@ public class RagfairServerHelper( { var presets = new List(); foreach (var itemId in databaseService.GetGlobals().ItemPresets.Keys) + { if (databaseService.GetGlobals().ItemPresets[itemId].Items[0].Template == item.Template) { var presetItems = cloner.Clone(databaseService.GetGlobals().ItemPresets[itemId].Items); presets.AddRange(itemHelper.ReparentItemAndChildren(item, presetItems)); } + } return presets; } diff --git a/Libraries/Core/Helpers/RagfairSortHelper.cs b/Libraries/Core/Helpers/RagfairSortHelper.cs index 4ea3a123..f81d0180 100644 --- a/Libraries/Core/Helpers/RagfairSortHelper.cs +++ b/Libraries/Core/Helpers/RagfairSortHelper.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; using Core.Models.Eft.Ragfair; using Core.Models.Enums; using Core.Services; +using SptCommon.Annotations; namespace Core.Helpers; @@ -47,7 +47,10 @@ public class RagfairSortHelper( } // 0=ASC 1=DESC - if (direction == 1) offers.Reverse(); + if (direction == 1) + { + offers.Reverse(); + } return offers; } @@ -67,7 +70,7 @@ public class RagfairSortHelper( protected int SortOffersByRating(RagfairOffer a, RagfairOffer b) { - return (int)(a.User.Rating.Value - b.User.Rating.Value); + return (int) (a.User.Rating.Value - b.User.Rating.Value); } protected int SortOffersByName(RagfairOffer a, RagfairOffer b) @@ -90,11 +93,11 @@ public class RagfairSortHelper( */ protected int SortOffersByPrice(RagfairOffer a, RagfairOffer b) { - return (int)(a.RequirementsCost.Value - b.RequirementsCost.Value); + return (int) (a.RequirementsCost.Value - b.RequirementsCost.Value); } protected int SortOffersByExpiry(RagfairOffer a, RagfairOffer b) { - return (int)(a.EndTime - b.EndTime); + return (int) (a.EndTime - b.EndTime); } } diff --git a/Libraries/Core/Helpers/RepairHelper.cs b/Libraries/Core/Helpers/RepairHelper.cs index f7eefcea..96e65063 100644 --- a/Libraries/Core/Helpers/RepairHelper.cs +++ b/Libraries/Core/Helpers/RepairHelper.cs @@ -1,14 +1,13 @@ -using Core.Models.Eft.Common; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; +using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; -using Core.Models.Enums; namespace Core.Helpers; @@ -24,7 +23,7 @@ public class RepairHelper( protected RepairConfig _repairConfig = _configServer.GetConfig(); /// - /// Alter an items durability after a repair by trader/repair kit + /// Alter an items durability after a repair by trader/repair kit /// /// item to update durability details /// db details of item to repair @@ -43,7 +42,10 @@ public class RepairHelper( bool applyMaxDurabilityDegradation = true ) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Adding {amountToRepair} to {itemToRepairDetails.Name} using kit: {useRepairKit}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Adding {amountToRepair} to {itemToRepairDetails.Name} using kit: {useRepairKit}"); + } var itemMaxDurability = _cloner.Clone(itemToRepair.Upd.Repairable.MaxDurability); var itemCurrentDurability = _cloner.Clone(itemToRepair.Upd.Repairable.Durability); @@ -53,13 +55,23 @@ public class RepairHelper( var newCurrentMaxDurability = itemCurrentMaxDurability + amountToRepair; // Ensure new max isnt above items max - if (newCurrentMaxDurability > itemMaxDurability) newCurrentMaxDurability = itemMaxDurability; + if (newCurrentMaxDurability > itemMaxDurability) + { + newCurrentMaxDurability = itemMaxDurability; + } // Ensure new current isnt above items max - if (newCurrentDurability > itemMaxDurability) newCurrentDurability = itemMaxDurability; + if (newCurrentDurability > itemMaxDurability) + { + newCurrentDurability = itemMaxDurability; + } // Update Repairable properties with new values after repair - itemToRepair.Upd.Repairable = new UpdRepairable { Durability = newCurrentDurability, MaxDurability = newCurrentMaxDurability }; + itemToRepair.Upd.Repairable = new UpdRepairable + { + Durability = newCurrentDurability, + MaxDurability = newCurrentMaxDurability + }; // when modders set the repair coefficient to 0 it means that they dont want to lose durability on items // the code below generates a random degradation on the weapon durability @@ -84,15 +96,20 @@ public class RepairHelper( // After adjusting max durability with degradation, ensure current dura isnt above max if (itemToRepair.Upd.Repairable.Durability > itemToRepair.Upd.Repairable.MaxDurability) + { itemToRepair.Upd.Repairable.Durability = itemToRepair.Upd.Repairable.MaxDurability; + } } // Repair mask cracks - if (itemToRepair.Upd.FaceShield is not null && itemToRepair.Upd.FaceShield?.Hits > 0) itemToRepair.Upd.FaceShield.Hits = 0; + if (itemToRepair.Upd.FaceShield is not null && itemToRepair.Upd.FaceShield?.Hits > 0) + { + itemToRepair.Upd.FaceShield.Hits = 0; + } } /// - /// Repairing armor reduces the total durability value slightly, get a randomised (to 2dp) amount based on armor material + /// Repairing armor reduces the total durability value slightly, get a randomised (to 2dp) amount based on armor material /// /// What material is the armor being repaired made of /// Was a repair kit used @@ -108,7 +125,9 @@ public class RepairHelper( { // Degradation value is based on the armor material if (!_databaseService.GetGlobals().Configuration.ArmorMaterials.TryGetValue(material, out var armorMaterialSettings)) + { _logger.Error($"Unable to find armor with a type of: {material}"); + } var minMultiplier = isRepairKit ? armorMaterialSettings.MinRepairKitDegradation @@ -118,14 +137,14 @@ public class RepairHelper( ? armorMaterialSettings.MaxRepairKitDegradation : armorMaterialSettings.MaxRepairDegradation; - var duraLossPercent = _randomUtil.GetDouble((double)minMultiplier, (double)maxMultiplier); + var duraLossPercent = _randomUtil.GetDouble((double) minMultiplier, (double) maxMultiplier); var duraLossMultipliedByTraderMultiplier = duraLossPercent * armorMax * traderQualityMultipler; return Math.Round(duraLossMultipliedByTraderMultiplier, 2); } /// - /// Repairing weapons reduces the total durability value slightly, get a randomised (to 2dp) amount + /// Repairing weapons reduces the total durability value slightly, get a randomised (to 2dp) amount /// /// Weapon properties /// Was a repair kit used @@ -143,9 +162,12 @@ public class RepairHelper( var maxRepairDeg = isRepairKit ? itemProps.MaxRepairKitDegradation : itemProps.MaxRepairDegradation; // WORKAROUND: Some items are always 0 when repairkit is true - if (maxRepairDeg == 0) maxRepairDeg = itemProps.MaxRepairDegradation; + if (maxRepairDeg == 0) + { + maxRepairDeg = itemProps.MaxRepairDegradation; + } - var duraLossPercent = _randomUtil.GetDouble((double)minRepairDeg, (double)maxRepairDeg); + var duraLossPercent = _randomUtil.GetDouble((double) minRepairDeg, (double) maxRepairDeg); var duraLossMultipliedByTraderMultiplier = duraLossPercent * weaponMax * traderQualityMultipler; return Math.Round(duraLossMultipliedByTraderMultiplier, 2); diff --git a/Libraries/Core/Helpers/RepeatableQuestHelper.cs b/Libraries/Core/Helpers/RepeatableQuestHelper.cs index c6b060fe..ea579552 100644 --- a/Libraries/Core/Helpers/RepeatableQuestHelper.cs +++ b/Libraries/Core/Helpers/RepeatableQuestHelper.cs @@ -1,7 +1,5 @@ using Core.Models.Spt.Config; using Core.Models.Utils; -using Core.Utils; -using Core.Utils.Cloners; using SptCommon.Annotations; namespace Core.Helpers; diff --git a/Libraries/Core/Helpers/RewardHelper.cs b/Libraries/Core/Helpers/RewardHelper.cs index 56b31ba5..fc0a027c 100644 --- a/Libraries/Core/Helpers/RewardHelper.cs +++ b/Libraries/Core/Helpers/RewardHelper.cs @@ -1,5 +1,5 @@ -using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Common; +using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Hideout; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Profile; @@ -58,7 +58,10 @@ public class RewardHelper( foreach (var reward in rewards) { // Handle reward availability for different game versions, notAvailableInGameEditions currently not used - if (!RewardIsForGameEdition(reward, gameVersion)) continue; + if (!RewardIsForGameEdition(reward, gameVersion)) + { + continue; + } switch (reward.Type) { @@ -100,7 +103,7 @@ public class RewardHelper( case RewardType.StashRows: _profileHelper.AddStashRowsBonusToProfile( sessionId, - (int)reward.Value + (int) reward.Value ); // Add specified stash rows from reward - requires client restart break; case RewardType.ProductionScheme: @@ -119,7 +122,7 @@ public class RewardHelper( new { rewardType = reward.Type, - questId = questId + questId } ) ); @@ -131,21 +134,25 @@ public class RewardHelper( } /** - * Does the provided reward have a game version requirement to be given and does it match - * @param reward Reward to check - * @param gameVersion Version of game to check reward against - * @returns True if it has requirement, false if it doesnt pass check - */ + * Does the provided reward have a game version requirement to be given and does it match + * @param reward Reward to check + * @param gameVersion Version of game to check reward against + * @returns True if it has requirement, false if it doesnt pass check + */ public bool RewardIsForGameEdition(Reward reward, string gameVersion) { if (reward.AvailableInGameEditions?.Count > 0 && !reward.AvailableInGameEditions.Contains(gameVersion)) // Reward has edition whitelist and game version isn't in it + { return false; + } if (reward.NotAvailableInGameEditions?.Count > 0 && reward.NotAvailableInGameEditions.Contains(gameVersion)) // Reward has edition blacklist and game version is in it + { return false; + } // No whitelist/blacklist or reward isn't blacklisted/whitelisted return true; @@ -175,7 +182,7 @@ public class RewardHelper( "reward-unable_to_find_matching_hideout_production", new { - questId = questId, + questId, matchCount = matchingProductions.Count } ) @@ -206,15 +213,15 @@ public class RewardHelper( var craftingRecipes = _databaseService.GetHideout().Production.Recipes; // Area that will be used to craft unlocked item - var desiredHideoutAreaType = (HideoutAreas)int.Parse(craftUnlockReward.TraderId.ToString()); + var desiredHideoutAreaType = (HideoutAreas) int.Parse(craftUnlockReward.TraderId.ToString()); var matchingProductions = craftingRecipes.Where( - (prod) => + 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.Type == "QuestComplete") && prod.Requirements.Any( - (requirement) => requirement.RequiredLevel == craftUnlockReward.LoyaltyLevel + requirement => requirement.RequiredLevel == craftUnlockReward.LoyaltyLevel ) && prod.EndProduct == craftUnlockReward.Items.FirstOrDefault().Template ) @@ -223,11 +230,13 @@ public class RewardHelper( // More/less than single match, above filtering wasn't strict enough 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) + prod => + prod.Requirements.Any(requirement => requirement.QuestId == questId) ) .ToList(); + } return matchingProductions; } @@ -242,7 +251,7 @@ public class RewardHelper( { // Iterate over all rewards with the desired status, flatten out items that have a type of Item var rewardItems = rewards.SelectMany( - (reward) => + reward => reward.Type == RewardType.Item && RewardIsForGameEdition(reward, gameVersion) ? ProcessReward(reward) : [] @@ -266,9 +275,13 @@ public class RewardHelper( // Is armor item that may need inserts / plates if (reward.Items.Count == 1 && _itemHelper.ArmorItemCanHoldMods(reward.Items[0].Template)) // Only process items with slots + { if (_itemHelper.ItemHasSlots(reward.Items.FirstOrDefault().Template)) // Attempt to pull default preset from globals and add child items to reward (clones reward.items) + { GenerateArmorRewardChildSlots(reward.Items.FirstOrDefault(), reward); + } + } foreach (var rewardItem in reward.Items) { @@ -288,19 +301,26 @@ public class RewardHelper( rewardItem.Upd.StackObjectsCount != null && // Has upd with stackobject count rewardItem.Upd.StackObjectsCount > 1 // More than 1 item in stack ) + { rewardItem.Upd.StackObjectsCount = 1; + } targets = _itemHelper.SplitStack(rewardItem); // splitStack created new ids for the new stacks. This would destroy the relation to possible children. // Instead, we reset the id to preserve relations and generate a new id in the downstream loop, where we are also reparenting if required - foreach (var target in targets) target.Id = rewardItem.Id; + foreach (var target in targets) + { + target.Id = rewardItem.Id; + } } else { // Is child mod if (reward.Items.FirstOrDefault().Upd.SpawnedInSession.GetValueOrDefault(false)) // Propigate FiR status into child items + { rewardItem.Upd.SpawnedInSession = reward.Items.FirstOrDefault()?.Upd.SpawnedInSession; + } mods.Add(rewardItem); } @@ -310,13 +330,19 @@ public class RewardHelper( foreach (var target in targets) { // This has all the original id relations since we reset the id to the original after the splitStack - var itemsClone = new List { _cloner.Clone(target) }; + var itemsClone = new List + { + _cloner.Clone(target) + }; // Here we generate a new id for the root item target.Id = _hashUtil.Generate(); // Add cloned mods to root item array var clonedMods = _cloner.Clone(mods); - foreach (var mod in clonedMods) itemsClone.Add(mod); + foreach (var mod in clonedMods) + { + itemsClone.Add(mod); + } // Re-parent items + generate new ids to ensure valid ids var itemsToAdd = _itemHelper.ReparentItemAndChildren(target, itemsClone); @@ -344,7 +370,7 @@ public class RewardHelper( reward.Items = presetAndMods; // Find root item and set its stack count - var rootItem = reward.Items.FirstOrDefault((item) => item.Id == newRootId); + var rootItem = reward.Items.FirstOrDefault(item => item.Id == newRootId); // Remap target id to the new presets root id reward.Target = rootItem.Id; @@ -365,11 +391,11 @@ public class RewardHelper( } /** - * Add an achievement to player profile and handle any rewards for the achievement - * Triggered from a quest, or another achievement - * @param fullProfile Profile to add achievement to - * @param achievementId Id of achievement to add - */ + * Add an achievement to player profile and handle any rewards for the achievement + * Triggered from a quest, or another achievement + * @param fullProfile Profile to add achievement to + * @param achievementId Id of achievement to add + */ public void AddAchievementToProfile(SptProfile fullProfile, string achievementId) { // Add achievement id to profile with timestamp it was unlocked @@ -378,8 +404,11 @@ public class RewardHelper( // Check for any customisation unlocks var achievementDataDb = _databaseService .GetTemplates() - .Achievements.FirstOrDefault((achievement) => achievement.Id == achievementId); - if (achievementDataDb is null) return; + .Achievements.FirstOrDefault(achievement => achievement.Id == achievementId); + if (achievementDataDb is null) + { + return; + } // Note: At the moment, we don't know the exact quest and achievement data layout for an achievement // that is triggered by a quest, that gives an item, because BSG has only done this once. However diff --git a/Libraries/Core/Helpers/SecureContainerHelper.cs b/Libraries/Core/Helpers/SecureContainerHelper.cs index d38dc471..bf95e26b 100644 --- a/Libraries/Core/Helpers/SecureContainerHelper.cs +++ b/Libraries/Core/Helpers/SecureContainerHelper.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; +using SptCommon.Annotations; namespace Core.Helpers; @@ -7,20 +7,23 @@ namespace Core.Helpers; public class SecureContainerHelper(ItemHelper _itemHelper) { /// - /// Get a list of the item IDs (NOT tpls) inside a secure container + /// Get a list of the item IDs (NOT tpls) inside a secure container /// /// Inventory items to look for secure container in /// List of ids public List GetSecureContainerItems(List items) { - var secureContainer = items.First((x) => x.SlotId == "SecuredContainer"); + var secureContainer = items.First(x => x.SlotId == "SecuredContainer"); // No container found, drop out - if (secureContainer is null) return []; + if (secureContainer is null) + { + return []; + } var itemsInSecureContainer = _itemHelper.FindAndReturnChildrenByItems(items, secureContainer.Id); // Return all items returned and exclude the secure container item itself - return itemsInSecureContainer.Where((x) => x != secureContainer.Id).ToList(); + return itemsInSecureContainer.Where(x => x != secureContainer.Id).ToList(); } } diff --git a/Libraries/Core/Helpers/TradeHelper.cs b/Libraries/Core/Helpers/TradeHelper.cs index 2f6ce415..20c075d3 100644 --- a/Libraries/Core/Helpers/TradeHelper.cs +++ b/Libraries/Core/Helpers/TradeHelper.cs @@ -1,5 +1,4 @@ using System.Text.RegularExpressions; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Inventory; @@ -13,6 +12,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -36,11 +36,11 @@ public class TradeHelper( ICloner _cloner ) { - protected TraderConfig _traderConfig = _configServer.GetConfig(); protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); + protected TraderConfig _traderConfig = _configServer.GetConfig(); /// - /// Buy item from flea or trader + /// Buy item from flea or trader /// /// Player profile /// data from client @@ -86,7 +86,7 @@ public class TradeHelper( { Items = [ - new PurchaseItems() + new PurchaseItems { ItemId = buyRequestData.ItemId, Count = buyCount @@ -122,7 +122,11 @@ public class TradeHelper( var rootItemIndex = fenceItems.FindIndex(item => item.Id == buyRequestData.ItemId); if (rootItemIndex == -1) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Tried to buy item {buyRequestData.ItemId} from fence that no longer exists"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Tried to buy item {buyRequestData.ItemId} from fence that no longer exists"); + } + var message = _localisationService.GetText("ragfair-offer_no_longer_exists"); _httpResponseUtil.AppendErrorToOutput(output, message); @@ -143,6 +147,7 @@ public class TradeHelper( var assortHasBuyRestrictions = _itemHelper.HasBuyRestrictions(itemPurchased); if (assortHasBuyRestrictions) // Will throw error if check fails + { CheckPurchaseIsWithinTraderItemLimit( sessionID, pmcData, @@ -151,12 +156,15 @@ public class TradeHelper( buyRequestData.ItemId, buyCount ); + } // Check if trader has enough stock if (itemPurchased.Upd.StackObjectsCount < buyCount) + { throw new Exception( $"Unable to purchase {buyCount} items, this would exceed the remaining stock left {itemPurchased.Upd.StackObjectsCount} from the traders assort: {buyRequestData.TransactionId} this refresh" ); + } // Decrement trader item count itemPurchased.Upd.StackObjectsCount -= buyCount; @@ -185,7 +193,10 @@ public class TradeHelper( // Get item + children for purchase var relevantItems = _itemHelper.FindAndReturnChildrenAsItems(traderItems, buyRequestData.ItemId); - if (relevantItems.Count == 0) _logger.Error($"Purchased trader: {buyRequestData.TransactionId} offer: {buyRequestData.ItemId} has no items"); + if (relevantItems.Count == 0) + { + _logger.Error($"Purchased trader: {buyRequestData.TransactionId} offer: {buyRequestData.ItemId} has no items"); + } offerItems.AddRange(relevantItems); } @@ -207,7 +218,10 @@ public class TradeHelper( // Prevent any collisions _itemHelper.RemapRootItemId(offerClone); - if (offerClone.Count > 1) _itemHelper.ReparentItemAndChildren(offerClone.FirstOrDefault(), offerClone); + if (offerClone.Count > 1) + { + _itemHelper.ReparentItemAndChildren(offerClone.FirstOrDefault(), offerClone); + } itemsToSendToPlayer.Add(offerClone); @@ -226,7 +240,10 @@ public class TradeHelper( // Add items + their children to stash _inventoryHelper.AddItemsToStash(sessionID, request, pmcData, output); - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } /// Pay for purchase _paymentService.PayMoney(pmcData, buyRequestData, sessionID, output); @@ -238,7 +255,7 @@ public class TradeHelper( } /// - /// Sell item to trader + /// Sell item to trader /// /// Profile to remove items from /// Profile to accept the money for selling item @@ -258,7 +275,9 @@ public class TradeHelper( // MUST OCCUR PRIOR TO ITEMS BEING REMOVED FROM INVENTORY if (sellRequest.TransactionId == Traders.RAGMAN) // Edge case, `Circulate` quest needs to track when certain items are sold to him + { IncrementCirculateSoldToTraderCounter(profileWithItemsToSell, profileToReceiveMoney, sellRequest); + } var pattern = @"\s+"; @@ -278,13 +297,18 @@ public class TradeHelper( return; } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Selling: id: {matchingItemInInventory.Id} tpl: {matchingItemInInventory.Template}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Selling: id: {matchingItemInInventory.Id} tpl: {matchingItemInInventory.Template}"); + } if (sellRequest.TransactionId == Traders.FENCE) + { _fenceService.AddItemsToFenceAssort( profileWithItemsToSell.Inventory.Items, matchingItemInInventory ); + } // Remove item from inventory + any child items it has _inventoryHelper.RemoveItem(profileWithItemsToSell, itemToBeRemoved.Id, sessionID, output); @@ -306,7 +330,10 @@ public class TradeHelper( ); // Player not on Circulate quest ,exit - if (activeCirculateQuest is null) return; + if (activeCirculateQuest is null) + { + return; + } // Find related task condition var taskCondition = profileToReceiveMoney.TaskConditionCounters.Values.FirstOrDefault( @@ -360,12 +387,15 @@ public class TradeHelper( } // Is sold item on the increment list - if (itemsTplsThatIncrement.List.Contains(itemDetails.Template)) taskCondition.Value += itemSoldToTrader.Count; + if (itemsTplsThatIncrement.List.Contains(itemDetails.Template)) + { + taskCondition.Value += itemSoldToTrader.Count; + } } } /// - /// Traders allow a limited number of purchases per refresh cycle (default 60 mins) + /// Traders allow a limited number of purchases per refresh cycle (default 60 mins) /// /// Session id /// Profile making the purchase @@ -388,24 +418,44 @@ public class TradeHelper( assortBeingPurchased.Id ); var traderItemPurchaseLimit = _traderHelper.GetAccountTypeAdjustedTraderPurchaseLimit( - (double)assortBeingPurchased.Upd?.BuyRestrictionMax, + (double) assortBeingPurchased.Upd?.BuyRestrictionMax, pmcData.Info.GameVersion ); if ((traderPurchaseData?.PurchaseCount ?? 0) + count > traderItemPurchaseLimit) + { throw new Exception( $"Unable to purchase: {count} items, this would exceed your purchase limit of {traderItemPurchaseLimit} from the trader: {traderId} assort: {assortId} this refresh" ); + } } } public record PurchaseDetails { - public List Items { get; set; } - public string TraderId { get; set; } + public List Items + { + get; + set; + } + + public string TraderId + { + get; + set; + } } public record PurchaseItems { - public string ItemId { get; set; } - public double Count { get; set; } + public string ItemId + { + get; + set; + } + + public double Count + { + get; + set; + } } diff --git a/Libraries/Core/Helpers/TraderAssortHelper.cs b/Libraries/Core/Helpers/TraderAssortHelper.cs index 62a8f2c4..d711fa72 100644 --- a/Libraries/Core/Helpers/TraderAssortHelper.cs +++ b/Libraries/Core/Helpers/TraderAssortHelper.cs @@ -1,5 +1,4 @@ using Core.Generators; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Config; @@ -8,6 +7,7 @@ using Core.Servers; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Helpers; @@ -32,14 +32,14 @@ public class TraderAssortHelper( ICloner _cloner ) { - protected TraderConfig _traderConfig = _configServer.GetConfig(); protected Dictionary> _mergedQuestAssorts = new(); - protected bool createdMergedQuestAssorts = false; + protected TraderConfig _traderConfig = _configServer.GetConfig(); + protected bool createdMergedQuestAssorts; /// - /// Get a traders assorts - /// Can be used for returning ragfair / fence assorts - /// Filter out assorts not unlocked due to level OR quest completion + /// Get a traders assorts + /// Can be used for returning ragfair / fence assorts + /// Filter out assorts not unlocked due to level OR quest completion /// /// session id /// traders id @@ -51,10 +51,16 @@ public class TraderAssortHelper( var fullProfile = _profileHelper.GetFullProfile(sessionId); var pmcProfile = fullProfile?.CharacterData?.PmcData; - if (traderId == Traders.FENCE) return _fenceService.GetFenceAssorts(pmcProfile); + if (traderId == Traders.FENCE) + { + return _fenceService.GetFenceAssorts(pmcProfile); + } // Strip assorts player should not see yet - if (!showLockedAssorts) traderClone.Assort = _assortHelper.StripLockedLoyaltyAssort(pmcProfile, traderId, traderClone.Assort); + if (!showLockedAssorts) + { + traderClone.Assort = _assortHelper.StripLockedLoyaltyAssort(pmcProfile, traderId, traderClone.Assort); + } ResetBuyRestrictionCurrentValue(traderClone.Assort.Items); @@ -74,7 +80,9 @@ public class TraderAssortHelper( if (assortToAdjust is null) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Cannot find trader: {traderClone.Base.Nickname} assort: {assortId} to adjust BuyRestrictionCurrent value, skipping"); + } continue; } @@ -82,14 +90,16 @@ public class TraderAssortHelper( if (assortToAdjust.Upd is null) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Unable to adjust assort {assortToAdjust.Id} item: {assortToAdjust.Template} BuyRestrictionCurrent value, assort has a null upd object" ); + } continue; } - assortToAdjust.Upd.BuyRestrictionCurrent = (int)(assortPurchasesfromTrader[assortId.Key].PurchaseCount ?? 0); + assortToAdjust.Upd.BuyRestrictionCurrent = (int) (assortPurchasesfromTrader[assortId.Key].PurchaseCount ?? 0); } // Get rid of quest locked assorts @@ -108,13 +118,16 @@ public class TraderAssortHelper( ); // Filter out root assorts that are blacklisted for this profile - if (fullProfile.SptData.BlacklistedItemTemplates?.Count > 0) RemoveItemsFromAssort(traderClone.Assort, fullProfile.SptData.BlacklistedItemTemplates); + if (fullProfile.SptData.BlacklistedItemTemplates?.Count > 0) + { + RemoveItemsFromAssort(traderClone.Assort, fullProfile.SptData.BlacklistedItemTemplates); + } return traderClone.Assort; } /// - /// Given the blacklist provided, remove root items from assort + /// Given the blacklist provided, remove root items from assort /// /// Trader assort to modify /// Item TPLs the assort should not have @@ -128,7 +141,7 @@ public class TraderAssortHelper( } /// - /// Reset every traders root item `BuyRestrictionCurrent` property to 0 + /// Reset every traders root item `BuyRestrictionCurrent` property to 0 /// /// Items to adjust protected void ResetBuyRestrictionCurrentValue(List assortItems) @@ -137,14 +150,17 @@ public class TraderAssortHelper( foreach (var assort in assortItems.Where(item => item.SlotId == "hideout")) { // no value to adjust - if (assort.Upd.BuyRestrictionCurrent is null) continue; + if (assort.Upd.BuyRestrictionCurrent is null) + { + continue; + } assort.Upd.BuyRestrictionCurrent = 0; } } /// - /// Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed + /// Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed /// protected void HydrateMergedQuestAssorts() { @@ -156,21 +172,26 @@ public class TraderAssortHelper( var trader = traders[traderId.Key]; if (trader.QuestAssort is not null) // Started/Success/fail + { foreach (var questStatus in trader.QuestAssort) // Each assort to quest id record foreach (var assortId in trader.QuestAssort[questStatus.Key]) { // Null guard - if (!_mergedQuestAssorts.TryGetValue(questStatus.Key, out _)) _mergedQuestAssorts.TryAdd(questStatus.Key, new Dictionary()); + if (!_mergedQuestAssorts.TryGetValue(questStatus.Key, out _)) + { + _mergedQuestAssorts.TryAdd(questStatus.Key, new Dictionary()); + } _mergedQuestAssorts[questStatus.Key][assortId.Key] = trader.QuestAssort[questStatus.Key][assortId.Key]; } + } } } /// - /// Reset a traders assorts and move nextResupply value to future - /// Flag trader as needing a flea offer reset to be picked up by flea update() function + /// Reset a traders assorts and move nextResupply value to future + /// Flag trader as needing a flea offer reset to be picked up by flea update() function /// /// trader details to alter public void ResetExpiredTrader(Trader trader) @@ -178,14 +199,14 @@ public class TraderAssortHelper( trader.Assort.Items = GetPristineTraderAssorts(trader.Base.Id); // Update resupply value to next timestamp - trader.Base.NextResupply = (int)_traderHelper.GetNextUpdateTimestamp(trader.Base.Id); + trader.Base.NextResupply = (int) _traderHelper.GetNextUpdateTimestamp(trader.Base.Id); // Flag a refresh is needed so ragfair update() will pick it up trader.Base.RefreshTraderRagfairOffers = true; } /// - /// Does the supplied trader need its assorts refreshed + /// Does the supplied trader need its assorts refreshed /// /// Trader to check /// true they need refreshing @@ -198,7 +219,7 @@ public class TraderAssortHelper( } /// - /// Get an array of pristine trader items prior to any alteration by player (as they were on server start) + /// Get an array of pristine trader items prior to any alteration by player (as they were on server start) /// /// trader id /// array of Items diff --git a/Libraries/Core/Helpers/TraderHelper.cs b/Libraries/Core/Helpers/TraderHelper.cs index 433497ef..4c5f6387 100644 --- a/Libraries/Core/Helpers/TraderHelper.cs +++ b/Libraries/Core/Helpers/TraderHelper.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Models.Common; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -9,6 +8,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -30,14 +30,14 @@ public class TraderHelper( ConfigServer _configServer ) { - protected TraderConfig _traderConfig = _configServer.GetConfig(); - protected Dictionary _highestTraderPriceItems = new(); protected List _gameVersions = [GameEditions.EDGE_OF_DARKNESS, GameEditions.UNHEARD]; + protected Dictionary _highestTraderPriceItems = new(); + protected TraderConfig _traderConfig = _configServer.GetConfig(); /// - /// Get a trader base object, update profile to reflect players current standing in profile - /// when trader not found in profile + /// Get a trader base object, update profile to reflect players current standing in profile + /// when trader not found in profile /// /// Traders Id to get /// Players id @@ -45,14 +45,18 @@ public class TraderHelper( public TraderBase? GetTrader(string traderID, string sessionID) { if (traderID == "ragfair") + { return new TraderBase { Currency = CurrencyType.RUB }; + } var pmcData = _profileHelper.GetPmcProfile(sessionID); if (pmcData == null) + { throw new Exception(_localisationService.GetText("trader-unable_to_find_profile_with_id", sessionID)); + } // Profile has traderInfo dict (profile beyond creation stage) but no requested trader in profile if (pmcData?.TradersInfo != null && (pmcData?.TradersInfo?.ContainsKey(traderID) ?? false)) @@ -64,13 +68,15 @@ public class TraderHelper( var traderBase = _databaseService.GetTrader(traderID).Base; if (traderBase == null) + { _logger.Error(_localisationService.GetText("trader-unable_to_find_trader_by_id", traderID)); + } return traderBase; } /// - /// Get all assort data for a particular trader + /// Get all assort data for a particular trader /// /// Trader to get assorts for /// TraderAssort @@ -82,7 +88,7 @@ public class TraderHelper( } /// - /// Retrieve the Item from a traders assort data by its id + /// Retrieve the Item from a traders assort data by its id /// /// Trader to get assorts for /// Id of assort to find @@ -92,7 +98,10 @@ public class TraderHelper( var traderAssorts = GetTraderAssortsByTraderId(traderId); if (traderAssorts is null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"No assorts on trader: {traderId} found"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"No assorts on trader: {traderId} found"); + } return null; } @@ -101,7 +110,10 @@ public class TraderHelper( var purchasedAssort = traderAssorts.Items.FirstOrDefault(item => item.Id == assortId); if (purchasedAssort is null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"No assort {assortId} on trader: {traderId} found"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"No assort {assortId} on trader: {traderId} found"); + } return null; } @@ -110,8 +122,8 @@ public class TraderHelper( } /// - /// Reset a profiles trader data back to its initial state as seen by a level 1 player - /// Does NOT take into account different profile levels + /// Reset a profiles trader data back to its initial state as seen by a level 1 player + /// Does NOT take into account different profile levels /// /// session id of player /// trader id to reset @@ -121,7 +133,10 @@ public class TraderHelper( var trader = _databaseService.GetTrader(traderID); var fullProfile = _profileHelper.GetFullProfile(sessionID); - if (fullProfile is null) throw new Exception(_localisationService.GetText("trader-unable_to_find_profile_by_id", sessionID)); + if (fullProfile is null) + { + throw new Exception(_localisationService.GetText("trader-unable_to_find_profile_by_id", sessionID)); + } var pmcData = fullProfile.CharacterData.PmcData; var rawProfileTemplate = profiles.GetByJsonProp(fullProfile.ProfileInfo.Edition) @@ -138,11 +153,17 @@ public class TraderHelper( Unlocked = trader.Base.UnlockedByDefault }; - if (!pmcData.TradersInfo.TryAdd(traderID, newTraderData)) pmcData.TradersInfo[traderID] = newTraderData; + if (!pmcData.TradersInfo.TryAdd(traderID, newTraderData)) + { + pmcData.TradersInfo[traderID] = newTraderData; + } // Check if trader should be locked by default - if (rawProfileTemplate.LockedByDefaultOverride?.Contains(traderID) ?? false) pmcData.TradersInfo[traderID].Unlocked = true; + if (rawProfileTemplate.LockedByDefaultOverride?.Contains(traderID) ?? false) + { + pmcData.TradersInfo[traderID].Unlocked = true; + } if (rawProfileTemplate.PurchaseAllClothingByDefaultForTrader?.Contains(traderID) ?? false) { @@ -150,10 +171,12 @@ public class TraderHelper( var clothing = _databaseService.GetTrader(traderID).Suits; if (clothing?.Count > 0) // Force suit ids into profile + { AddSuitsToProfile( fullProfile, clothing.Select(suit => suit.SuiteId).ToList() ); + } } if ((rawProfileTemplate.FleaBlockedDays ?? 0) > 0) @@ -161,8 +184,11 @@ public class TraderHelper( var newBanDateTime = _timeUtil.GetTimeStampFromNowDays(rawProfileTemplate.FleaBlockedDays ?? 0); var existingBan = pmcData.Info.Bans.FirstOrDefault(ban => ban.BanType == BanType.RAGFAIR); if (existingBan is not null) + { existingBan.DateTime = newBanDateTime; + } else + { pmcData.Info.Bans.Add( new Ban { @@ -170,13 +196,17 @@ public class TraderHelper( DateTime = newBanDateTime } ); + } } - if (traderID == Traders.JAEGER) pmcData.TradersInfo[traderID].Unlocked = rawProfileTemplate.JaegerUnlocked; + if (traderID == Traders.JAEGER) + { + pmcData.TradersInfo[traderID].Unlocked = rawProfileTemplate.JaegerUnlocked; + } } /// - /// Get the starting standing of a trader based on the current profiles type (e.g. EoD, Standard etc) + /// Get the starting standing of a trader based on the current profiles type (e.g. EoD, Standard etc) /// /// Trader id to get standing for /// Raw profile from profiles.json to look up standing from @@ -186,7 +216,10 @@ public class TraderHelper( if (rawProfileTemplate.InitialStanding.TryGetValue(traderId, out var standing)) { // Edge case for Lightkeeper, 0 standing means seeing `Make Amends - Buyout` quest - if (traderId == Traders.LIGHTHOUSEKEEPER && standing == 0) return 0.01; + if (traderId == Traders.LIGHTHOUSEKEEPER && standing == 0) + { + return 0.01; + } return standing; } @@ -195,22 +228,29 @@ public class TraderHelper( } /// - /// Add a list of suit ids to a profiles suit list, no duplicates + /// Add a list of suit ids to a profiles suit list, no duplicates /// /// Profile to add to /// Suit Ids to add protected void AddSuitsToProfile(SptProfile fullProfile, List suitIds) { - if (fullProfile.Suits is null) fullProfile.Suits = []; + if (fullProfile.Suits is null) + { + fullProfile.Suits = []; + } foreach (var suitId in suitIds) // Don't add dupes + { if (!fullProfile.Suits.Contains(suitId)) + { fullProfile.Suits.Add(suitId); + } + } } /// - /// Alter a traders unlocked status + /// Alter a traders unlocked status /// /// Trader to alter /// New status to use @@ -230,7 +270,7 @@ public class TraderHelper( } /// - /// Add standing to a trader and level them up if exp goes over level threshold + /// Add standing to a trader and level them up if exp goes over level threshold /// /// Session id of player /// Traders id to add standing to @@ -245,13 +285,15 @@ public class TraderHelper( if (traderId == Traders.FENCE) // Must add rep to scav profile to ensure consistency + { fullProfile.CharacterData.ScavData.TradersInfo[traderId].Standing = pmcTraderInfo.Standing; + } LevelUp(traderId, fullProfile.CharacterData.PmcData); } /// - /// Add standing to current standing and clamp value if it goes too low + /// Add standing to current standing and clamp value if it goes too low /// /// current trader standing /// standing to add to trader standing @@ -265,19 +307,22 @@ public class TraderHelper( } /// - /// Iterate over a profile's traders and ensure they have the correct loyalty level for the player. + /// Iterate over a profile's traders and ensure they have the correct loyalty level for the player. /// /// Profile to check. public void ValidateTraderStandingsAndPlayerLevelForProfile(string sessionId) { var profile = _profileHelper.GetPmcProfile(sessionId); var traders = _databaseService.GetTraders(); - foreach (var trader in traders) LevelUp(trader.Key, profile); + foreach (var trader in traders) + { + LevelUp(trader.Key, profile); + } } /// - /// Calculate trader's level based on experience amount and increments level if over threshold. - /// Also validates and updates player level if not correct based on XP value. + /// Calculate trader's level based on experience amount and increments level if over threshold. + /// Also validates and updates player level if not correct based on XP value. /// /// Trader to check standing of. /// Profile to update trader in. @@ -295,20 +340,24 @@ public class TraderHelper( pmcData.TradersInfo[traderID].Standing = Math.Round(pmcData.TradersInfo[traderID].Standing * 100 ?? 0, 2) / 100; foreach (var loyaltyLevel in loyaltyLevels) + { if (loyaltyLevel.MinLevel <= pmcData.Info.Level && loyaltyLevel.MinSalesSum <= pmcData.TradersInfo[traderID].SalesSum && loyaltyLevel.MinStanding <= pmcData.TradersInfo[traderID].Standing && targetLevel < 4 ) // level reached + { targetLevel++; + } + } // set level pmcData.TradersInfo[traderID].LoyaltyLevel = targetLevel; } /// - /// Get the next update timestamp for a trader. + /// Get the next update timestamp for a trader. /// /// Trader to look up update value for. /// Future timestamp. @@ -320,13 +369,13 @@ public class TraderHelper( } /// - /// Get the reset time between trader assort refreshes in seconds. + /// Get the reset time between trader assort refreshes in seconds. /// /// Trader to look up. /// Time in seconds. public long? GetTraderUpdateSeconds(string traderId) { - var traderDetails = _traderConfig.UpdateTime.FirstOrDefault((x) => x.TraderId == traderId); + var traderDetails = _traderConfig.UpdateTime.FirstOrDefault(x => x.TraderId == traderId); if (traderDetails is null || traderDetails.Seconds?.Min is null || traderDetails.Seconds.Max is null) { _logger.Warning( @@ -334,7 +383,7 @@ public class TraderHelper( "trader-missing_trader_details_using_default_refresh_time", new { - traderId = traderId, + traderId, updateTime = _traderConfig.UpdateTimeDefault } ) @@ -352,7 +401,7 @@ public class TraderHelper( return null; } - return _randomUtil.GetInt((int)traderDetails.Seconds.Min, (int)traderDetails.Seconds.Max); + return _randomUtil.GetInt((int) traderDetails.Seconds.Min, (int) traderDetails.Seconds.Max); } public TraderLoyaltyLevel GetLoyaltyLevel(string traderID, PmcData pmcData) @@ -360,17 +409,26 @@ public class TraderHelper( var traderBase = _databaseService.GetTrader(traderID).Base; int? loyaltyLevel = null; - if (pmcData.TradersInfo.TryGetValue(traderID, out var traderInfo)) loyaltyLevel = traderInfo.LoyaltyLevel; + if (pmcData.TradersInfo.TryGetValue(traderID, out var traderInfo)) + { + loyaltyLevel = traderInfo.LoyaltyLevel; + } - if (loyaltyLevel is null or < 1) loyaltyLevel = 1; + if (loyaltyLevel is null or < 1) + { + loyaltyLevel = 1; + } - if (loyaltyLevel > traderBase.LoyaltyLevels.Count) loyaltyLevel = traderBase.LoyaltyLevels.Count; + if (loyaltyLevel > traderBase.LoyaltyLevels.Count) + { + loyaltyLevel = traderBase.LoyaltyLevels.Count; + } return traderBase.LoyaltyLevels[loyaltyLevel - 1 ?? 1]; } /// - /// Store the purchase of an assort from a trader in the player profile + /// Store the purchase of an assort from a trader in the player profile /// /// Session id /// New item assort id + count @@ -408,20 +466,22 @@ public class TraderHelper( if (profile.TraderPurchases[traderId][purchasedItem.ItemId].PurchaseCount + purchasedItem.Count > GetAccountTypeAdjustedTraderPurchaseLimit( - (double)itemPurchased.Upd.BuyRestrictionMax, + (double) itemPurchased.Upd.BuyRestrictionMax, profile.CharacterData.PmcData.Info.GameVersion ) ) + { throw new Exception( _localisationService.GetText( "trader-unable_to_purchase_item_limit_reached", new { - traderId = traderId, + traderId, limit = itemPurchased.Upd.BuyRestrictionMax } ) ); + } profile.TraderPurchases[traderId][purchasedItem.ItemId].PurchaseCount += purchasedItem.Count; profile.TraderPurchases[traderId][purchasedItem.ItemId].PurchaseTimestamp = currentTime; @@ -429,37 +489,49 @@ public class TraderHelper( } /// - /// EoD and Unheard get a 20% bonus to personal trader limit purchases + /// EoD and Unheard get a 20% bonus to personal trader limit purchases /// /// Existing value from trader item /// Profiles game version /// buyRestrictionMax value public double GetAccountTypeAdjustedTraderPurchaseLimit(double buyRestrictionMax, string gameVersion) { - if (_gameVersions.Contains(gameVersion)) return Math.Floor(buyRestrictionMax * 1.2); + if (_gameVersions.Contains(gameVersion)) + { + return Math.Floor(buyRestrictionMax * 1.2); + } return buyRestrictionMax; } /// - /// Get the highest rouble price for an item from traders - /// UNUSED + /// Get the highest rouble price for an item from traders + /// UNUSED /// /// Item to look up highest price for /// highest rouble cost for item public double GetHighestTraderPriceRouble(string tpl) { - if (_highestTraderPriceItems is not null) return _highestTraderPriceItems[tpl]; + if (_highestTraderPriceItems is not null) + { + return _highestTraderPriceItems[tpl]; + } // Init dict and fill foreach (var traderName in Traders.TradersDictionary) { // Skip some traders - if (traderName.Value == Traders.FENCE) continue; + if (traderName.Value == Traders.FENCE) + { + continue; + } // Get assorts for trader, skip trader if no assorts found var traderAssorts = _databaseService.GetTrader(traderName.Value).Assort; - if (traderAssorts is null) continue; + if (traderAssorts is null) + { + continue; + } // Get all item assorts that have parentId of hideout (base item and not a mod of other item) foreach (var item in traderAssorts.Items.Where(x => x.ParentId == "hideout")) @@ -484,7 +556,7 @@ public class TraderHelper( } /// - /// Get the highest price item can be sold to trader for (roubles) + /// Get the highest price item can be sold to trader for (roubles) /// /// Item to look up best trader sell-to price /// Rouble price @@ -498,7 +570,10 @@ public class TraderHelper( var traderBase = _databaseService.GetTrader(trader.Value).Base; // Skip traders that don't sell - if (traderBase is null || !_itemHelper.IsOfBaseclasses(tpl, traderBase.ItemsBuy.Category)) continue; + if (traderBase is null || !_itemHelper.IsOfBaseclasses(tpl, traderBase.ItemsBuy.Category)) + { + continue; + } // Get loyalty level details player has achieved with this trader // Uses lowest loyalty level as this function is used before a player has logged into server @@ -509,14 +584,17 @@ public class TraderHelper( var priceTraderBuysItemAt = _randomUtil.GetPercentOfValue(traderBuyBackPricePercent ?? 0, itemHandbookPrice, 0); // Price from this trader is higher than highest found, update - if (priceTraderBuysItemAt > highestPrice) highestPrice = (int)priceTraderBuysItemAt; + if (priceTraderBuysItemAt > highestPrice) + { + highestPrice = (int) priceTraderBuysItemAt; + } } return highestPrice; } /// - /// Get a trader enum key by its value + /// Get a trader enum key by its value /// /// Traders id /// Traders key @@ -535,16 +613,13 @@ public class TraderHelper( } /// - /// Validates that the provided traderEnumValue exists in the Traders enum. If the value is valid, it returns the - /// same enum value, effectively serving as a trader ID; otherwise, it logs an error and returns an empty string. - /// This method provides a runtime check to prevent undefined behavior when using the enum as a dictionary key. - /// - /// For example, instead of this: - /// const traderId = Traders[Traders.PRAPOR]; - /// - /// You can use safely use this: - /// const traderId = this.traderHelper.getValidTraderIdByEnumValue(Traders.PRAPOR); - /// + /// Validates that the provided traderEnumValue exists in the Traders enum. If the value is valid, it returns the + /// same enum value, effectively serving as a trader ID; otherwise, it logs an error and returns an empty string. + /// This method provides a runtime check to prevent undefined behavior when using the enum as a dictionary key. + /// For example, instead of this: + /// const traderId = Traders[Traders.PRAPOR]; + /// You can use safely use this: + /// const traderId = this.traderHelper.getValidTraderIdByEnumValue(Traders.PRAPOR); /// /// The trader enum value to validate /// The validated trader enum value as a string, or an empty string if invalid @@ -556,7 +631,7 @@ public class TraderHelper( } /// - /// Does the 'Traders' enum has a value that matches the passed in parameter + /// Does the 'Traders' enum has a value that matches the passed in parameter /// /// Value to check for /// True, values exists in Traders enum as a value @@ -566,7 +641,7 @@ public class TraderHelper( } /// - /// Accepts a trader id + /// Accepts a trader id /// /// Trader id /// True if Traders enum has the param as a value diff --git a/Libraries/Core/Helpers/WeatherHelper.cs b/Libraries/Core/Helpers/WeatherHelper.cs index 259ee11d..edb60a81 100644 --- a/Libraries/Core/Helpers/WeatherHelper.cs +++ b/Libraries/Core/Helpers/WeatherHelper.cs @@ -1,10 +1,9 @@ -using SptCommon.Annotations; -using Core.Models.Enums; +using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; - +using SptCommon.Annotations; namespace Core.Helpers; @@ -18,7 +17,7 @@ public class WeatherHelper( protected WeatherConfig _weatherConfig = _configServer.GetConfig(); /// - /// Get the current in-raid time - does not include an accurate date, only time + /// Get the current in-raid time - does not include an accurate date, only time /// /// (new Date()) /// Date object of current in-raid time @@ -39,7 +38,7 @@ public class WeatherHelper( } /// - /// Is the current raid at nighttime + /// Is the current raid at nighttime /// /// PASS OR CURR (from raid settings) /// True when nighttime @@ -49,7 +48,9 @@ public class WeatherHelper( // getInRaidTime() provides left side value, if player chose right side, set ahead 12 hrs if (timeVariant == DateTimeEnum.PAST) + { time.AddHours(12); + } // Night if after 9pm or before 5am return time.Hour > 21 || time.Hour < 5; diff --git a/Libraries/Core/Helpers/WeightedRandomHelper.cs b/Libraries/Core/Helpers/WeightedRandomHelper.cs index d15f2ec5..148b8c1a 100644 --- a/Libraries/Core/Helpers/WeightedRandomHelper.cs +++ b/Libraries/Core/Helpers/WeightedRandomHelper.cs @@ -1,7 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Spt.Helper; using Core.Models.Utils; - +using SptCommon.Annotations; namespace Core.Helpers; @@ -11,7 +10,7 @@ public class WeightedRandomHelper( ) { /// - /// Choose an item from the passed in array based on the weightings of each + /// Choose an item from the passed in array based on the weightings of each /// /// Items and weights to use /// Chosen item from array @@ -26,30 +25,40 @@ public class WeightedRandomHelper( } /// - /// Picks the random item based on its weight. - /// The items with higher weight will be picked more often (with a higher probability). - /// - /// For example: - /// - items = ['banana', 'orange', 'apple'] - /// - weights = [0, 0.2, 0.8] - /// - weightedRandom(items, weights) in 80% of cases will return 'apple', in 20% of cases will return - /// 'orange' and it will never return 'banana' (because probability of picking the banana is 0%) - /// + /// Picks the random item based on its weight. + /// The items with higher weight will be picked more often (with a higher probability). + /// For example: + /// - items = ['banana', 'orange', 'apple'] + /// - weights = [0, 0.2, 0.8] + /// - weightedRandom(items, weights) in 80% of cases will return 'apple', in 20% of cases will return + /// 'orange' and it will never return 'banana' (because probability of picking the banana is 0%) /// /// List of items /// List of weights /// Dictionary with item and index public WeightedRandomResult WeightedRandom(List items, List weights) { - if (items.Count == 0) _logger.Error("Items must not be empty"); + if (items.Count == 0) + { + _logger.Error("Items must not be empty"); + } - if (weights.Count == 0) _logger.Error("Item weights must not be empty"); + if (weights.Count == 0) + { + _logger.Error("Item weights must not be empty"); + } - if (items.Count != weights.Count) _logger.Error("Items and weight inputs must be of the same length"); + if (items.Count != weights.Count) + { + _logger.Error("Items and weight inputs must be of the same length"); + } // Preparing the cumulative weights list. List cumulativeWeights = []; - for (var i = 0; i < weights.Count; i++) cumulativeWeights.Add((int)weights[i] + (i > 0 ? cumulativeWeights[i - 1] : 0)); + for (var i = 0; i < weights.Count; i++) + { + cumulativeWeights.Add((int) weights[i] + (i > 0 ? cumulativeWeights[i - 1] : 0)); + } // Getting the random number in a range of [0...sum(weights)] var maxCumulativeWeight = cumulativeWeights[cumulativeWeights.Count - 1]; @@ -57,24 +66,31 @@ public class WeightedRandomHelper( // Picking the random item based on its weight. for (var itemIndex = 0; itemIndex < items.Count; itemIndex++) + { if (cumulativeWeights[itemIndex] >= randomNumber) - return new WeightedRandomResult() + { + return new WeightedRandomResult { Item = items[itemIndex], Index = itemIndex }; + } + } throw new InvalidOperationException("No item was picked."); } /// - /// Find the greated common divisor of all weights and use it on the passed in dictionary + /// Find the greated common divisor of all weights and use it on the passed in dictionary /// /// Values to reduce public void ReduceWeightValues(Dictionary weightedDict) { // No values, nothing to reduce - if (weightedDict.Count == 0) return; + if (weightedDict.Count == 0) + { + return; + } // Only one value, set to 1 and exit if (weightedDict.Count == 1) @@ -89,9 +105,15 @@ public class WeightedRandomHelper( var commonDivisor = CommonDivisor(weights); // No point in dividing by 1 - if (commonDivisor == 1) return; + if (commonDivisor == 1) + { + return; + } - foreach (var kvp in weightedDict) weightedDict[kvp.Key] /= commonDivisor; + foreach (var kvp in weightedDict) + { + weightedDict[kvp.Key] /= commonDivisor; + } } /** @@ -100,7 +122,10 @@ public class WeightedRandomHelper( protected double CommonDivisor(List numbers) { var result = numbers[0]; - for (var i = 1; i < numbers.Count; i++) result = Gcd(result, numbers[i]); + for (var i = 1; i < numbers.Count; i++) + { + result = Gcd(result, numbers[i]); + } return result; } diff --git a/Libraries/Core/Loaders/PostDBModLoader.cs b/Libraries/Core/Loaders/PostDBModLoader.cs index d3abc472..273431a9 100644 --- a/Libraries/Core/Loaders/PostDBModLoader.cs +++ b/Libraries/Core/Loaders/PostDBModLoader.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.External; using Core.Models.Utils; +using SptCommon.Annotations; namespace Core.Loaders; @@ -14,7 +14,10 @@ public class PostDBModLoader( public async Task OnLoad() { _logger.Info("Loading PostDBLoadMod..."); - foreach (var postDbLoadMod in _postDbLoadMods) postDbLoadMod.PostDBLoad(); + foreach (var postDbLoadMod in _postDbLoadMods) + { + postDbLoadMod.PostDBLoad(); + } _logger.Info("Finished loading PostDBLoadMod..."); } diff --git a/Libraries/Core/Loaders/PostSptModLoader.cs b/Libraries/Core/Loaders/PostSptModLoader.cs index 68e18fc8..a1fb1b79 100644 --- a/Libraries/Core/Loaders/PostSptModLoader.cs +++ b/Libraries/Core/Loaders/PostSptModLoader.cs @@ -1,9 +1,8 @@ -using SptCommon.Annotations; -using Core.DI; +using Core.DI; using Core.Models.External; using Core.Models.Utils; using Server; - +using SptCommon.Annotations; namespace Core.Loaders; @@ -22,7 +21,10 @@ public class PostSptModLoader( } _logger.Info("Loading PostSptMods..."); - foreach (var postSptLoadMod in _postSptLoadMods) postSptLoadMod.PostSptLoad(); + foreach (var postSptLoadMod in _postSptLoadMods) + { + postSptLoadMod.PostSptLoad(); + } _logger.Info("Finished loading PostSptMods..."); } diff --git a/Libraries/Core/Models/Common/IdWithCount.cs b/Libraries/Core/Models/Common/IdWithCount.cs index b52d655c..2aa0cc9c 100644 --- a/Libraries/Core/Models/Common/IdWithCount.cs +++ b/Libraries/Core/Models/Common/IdWithCount.cs @@ -4,11 +4,23 @@ namespace 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 { get; set; } + public string? Id + { + get; + set; + } - /** Amount of money to take off player for treatment */ + /** + * Amount of money to take off player for treatment + */ [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } } diff --git a/Libraries/Core/Models/Common/MinMax.cs b/Libraries/Core/Models/Common/MinMax.cs index 61efeb5a..772f8712 100644 --- a/Libraries/Core/Models/Common/MinMax.cs +++ b/Libraries/Core/Models/Common/MinMax.cs @@ -15,11 +15,23 @@ public record MinMax } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("max")] - public double? Max { get; set; } + public double? Max + { + get; + set; + } [JsonPropertyName("min")] - public double? Min { get; set; } + public double? Min + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Bot/GenerateBotsRequestData.cs b/Libraries/Core/Models/Eft/Bot/GenerateBotsRequestData.cs index 1acd439f..133a6c52 100644 --- a/Libraries/Core/Models/Eft/Bot/GenerateBotsRequestData.cs +++ b/Libraries/Core/Models/Eft/Bot/GenerateBotsRequestData.cs @@ -6,20 +6,36 @@ namespace Core.Models.Eft.Bot; public record GenerateBotsRequestData : IRequestData { [JsonPropertyName("conditions")] - public List? Conditions { get; set; } + public List? Conditions + { + get; + set; + } } public record GenerateCondition { /// - /// e.g. assault/pmcBot/bossKilla + /// e.g. assault/pmcBot/bossKilla /// [JsonPropertyName("Role")] - public string? Role { get; set; } + public string? Role + { + get; + set; + } [JsonPropertyName("Limit")] - public int Limit { get; set; } + public int Limit + { + get; + set; + } [JsonPropertyName("Difficulty")] - public string? Difficulty { get; set; } + public string? Difficulty + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Bot/RandomisedBotLevelResult.cs b/Libraries/Core/Models/Eft/Bot/RandomisedBotLevelResult.cs index 4ff26ec4..ff0321a6 100644 --- a/Libraries/Core/Models/Eft/Bot/RandomisedBotLevelResult.cs +++ b/Libraries/Core/Models/Eft/Bot/RandomisedBotLevelResult.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Bot; public record RandomisedBotLevelResult { [JsonPropertyName("level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("exp")] - public int? Exp { get; set; } + public int? Exp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Builds/SetMagazineRequest.cs b/Libraries/Core/Models/Eft/Builds/SetMagazineRequest.cs index b88eac3c..b5c7d222 100644 --- a/Libraries/Core/Models/Eft/Builds/SetMagazineRequest.cs +++ b/Libraries/Core/Models/Eft/Builds/SetMagazineRequest.cs @@ -7,20 +7,44 @@ namespace Core.Models.Eft.Builds; public record SetMagazineRequest : IRequestData { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("Caliber")] - public string? Caliber { get; set; } + public string? Caliber + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("TopCount")] - public int? TopCount { get; set; } + public int? TopCount + { + get; + set; + } [JsonPropertyName("BottomCount")] - public int? BottomCount { get; set; } + public int? BottomCount + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Globals.cs b/Libraries/Core/Models/Eft/Common/Globals.cs index 9ef29fbf..f88cc28a 100644 --- a/Libraries/Core/Models/Eft/Common/Globals.cs +++ b/Libraries/Core/Models/Eft/Common/Globals.cs @@ -1,4391 +1,9760 @@ +using System.Text.Json.Serialization; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Hideout; using Core.Models.Enums; namespace Core.Models.Eft.Common; -using System.Text.Json.Serialization; - public record Globals { [JsonPropertyName("config")] - public Config? Configuration { get; set; } + public Config? Configuration + { + get; + set; + } [JsonPropertyName("LocationInfection")] - public LocationInfection? LocationInfection { get; set; } + public LocationInfection? LocationInfection + { + get; + set; + } [JsonPropertyName("bot_presets")] - public List? BotPresets { get; set; } + public List? BotPresets + { + get; + set; + } [JsonPropertyName("BotWeaponScatterings")] - public List? BotWeaponScatterings { get; set; } + public List? BotWeaponScatterings + { + get; + set; + } [JsonPropertyName("ItemPresets")] - public Dictionary? ItemPresets { get; set; } + public Dictionary? ItemPresets + { + get; + set; + } } public record PlayerSettings { [JsonPropertyName("BaseMaxMovementRolloff")] - public double? BaseMaxMovementRolloff { get; set; } + public double? BaseMaxMovementRolloff + { + get; + set; + } [JsonPropertyName("EnabledOcclusionDynamicRolloff")] - public bool? IsEnabledOcclusionDynamicRolloff { get; set; } + public bool? IsEnabledOcclusionDynamicRolloff + { + get; + set; + } [JsonPropertyName("IndoorRolloffMult")] - public double? IndoorRolloffMultiplier { get; set; } + public double? IndoorRolloffMultiplier + { + get; + set; + } [JsonPropertyName("MinStepSoundRolloffMult")] - public double? MinStepSoundRolloffMultiplier { get; set; } + public double? MinStepSoundRolloffMultiplier + { + get; + set; + } [JsonPropertyName("MinStepSoundVolumeMult")] - public double? MinStepSoundVolumeMultiplier { get; set; } + public double? MinStepSoundVolumeMultiplier + { + get; + set; + } [JsonPropertyName("MovementRolloffMultipliers")] - public List? MovementRolloffMultipliers { get; set; } + public List? MovementRolloffMultipliers + { + get; + set; + } [JsonPropertyName("OutdoorRolloffMult")] - public double? OutdoorRolloffMultiplier { get; set; } + public double? OutdoorRolloffMultiplier + { + get; + set; + } } public record MovementRolloffMultiplier { [JsonPropertyName("MovementState")] - public string? MovementState { get; set; } + public string? MovementState + { + get; + set; + } [JsonPropertyName("RolloffMultiplier")] - public double? RolloffMultiplier { get; set; } + public double? RolloffMultiplier + { + get; + set; + } } public record RadioBroadcastSettings { [JsonPropertyName("EnabledBroadcast")] - public bool? EnabledBroadcast { get; set; } + public bool? EnabledBroadcast + { + get; + set; + } [JsonPropertyName("RadioStations")] - public List? RadioStations { get; set; } + public List? RadioStations + { + get; + set; + } } public record RadioStation { [JsonPropertyName("Enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("Station")] - public RadioStationType? Station { get; set; } + public RadioStationType? Station + { + get; + set; + } } public record LocationInfection { [JsonPropertyName("Interchange")] - public double? Interchange { get; set; } + public double? Interchange + { + get; + set; + } [JsonPropertyName("Lighthouse")] - public double? Lighthouse { get; set; } + public double? Lighthouse + { + get; + set; + } [JsonPropertyName("RezervBase")] - public double? RezervBase { get; set; } + public double? RezervBase + { + get; + set; + } [JsonPropertyName("Sandbox")] - public double? Sandbox { get; set; } + public double? Sandbox + { + get; + set; + } [JsonPropertyName("Shoreline")] - public double? Shoreline { get; set; } + public double? Shoreline + { + get; + set; + } [JsonPropertyName("TarkovStreets")] - public double? TarkovStreets { get; set; } + public double? TarkovStreets + { + get; + set; + } [JsonPropertyName("Woods")] - public double? Woods { get; set; } + public double? Woods + { + get; + set; + } [JsonPropertyName("bigmap")] - public double? BigMap { get; set; } + public double? BigMap + { + get; + set; + } [JsonPropertyName("factory4")] - public double? Factory4 { get; set; } + public double? Factory4 + { + get; + set; + } [JsonPropertyName("laboratory")] - public double? Laboratory { get; set; } + public double? Laboratory + { + get; + set; + } } public record ArtilleryShelling { [JsonPropertyName("ArtilleryMapsConfigs")] - public Dictionary? ArtilleryMapsConfigs { get; set; } + public Dictionary? ArtilleryMapsConfigs + { + get; + set; + } [JsonPropertyName("ProjectileExplosionParams")] - public ProjectileExplosionParams? ProjectileExplosionParams { get; set; } + public ProjectileExplosionParams? ProjectileExplosionParams + { + get; + set; + } [JsonPropertyName("MaxCalledShellingCount")] - public double? MaxCalledShellingCount { get; set; } + public double? MaxCalledShellingCount + { + get; + set; + } } public record ArtilleryMapSettings { [JsonPropertyName("PlanedShellingOn")] - public bool? PlanedShellingOn { get; set; } + public bool? PlanedShellingOn + { + get; + set; + } [JsonPropertyName("InitShellingTimer")] - public double? InitShellingTimer { get; set; } + public double? InitShellingTimer + { + get; + set; + } [JsonPropertyName("BeforeShellingSignalTime")] - public double? BeforeShellingSignalTime { get; set; } + public double? BeforeShellingSignalTime + { + get; + set; + } [JsonPropertyName("ShellingCount")] - public double? ShellingCount { get; set; } + public double? ShellingCount + { + get; + set; + } [JsonPropertyName("ZonesInShelling")] - public double? ZonesInShelling { get; set; } + public double? ZonesInShelling + { + get; + set; + } [JsonPropertyName("NewZonesForEachShelling")] - public bool? NewZonesForEachShelling { get; set; } + public bool? NewZonesForEachShelling + { + get; + set; + } [JsonPropertyName("InitCalledShellingTime")] - public double? InitCalledShellingTime { get; set; } + public double? InitCalledShellingTime + { + get; + set; + } [JsonPropertyName("ShellingZones")] - public List? ShellingZones { get; set; } + public List? ShellingZones + { + get; + set; + } [JsonPropertyName("Brigades")] - public List? Brigades { get; set; } + public List? Brigades + { + get; + set; + } [JsonPropertyName("ArtilleryShellingAirDropSettings")] - public ArtilleryShellingAirDropSettings? ArtilleryShellingAirDropSettings { get; set; } + public ArtilleryShellingAirDropSettings? ArtilleryShellingAirDropSettings + { + get; + set; + } [JsonPropertyName("PauseBetweenShellings")] - public XYZ? PauseBetweenShellings { get; set; } + public XYZ? PauseBetweenShellings + { + get; + set; + } } public record ShellingZone { [JsonPropertyName("ID")] - public double? ID { get; set; } + public double? ID + { + get; + set; + } [JsonPropertyName("PointsInShellings")] - public XYZ? PointsInShellings { get; set; } + public XYZ? PointsInShellings + { + get; + set; + } [JsonPropertyName("ShellingRounds")] - public double? ShellingRounds { get; set; } + public double? ShellingRounds + { + get; + set; + } [JsonPropertyName("ShotCount")] - public double? ShotCount { get; set; } + public double? ShotCount + { + get; + set; + } [JsonPropertyName("PauseBetweenRounds")] - public XYZ? PauseBetweenRounds { get; set; } + public XYZ? PauseBetweenRounds + { + get; + set; + } [JsonPropertyName("PauseBetweenShots")] - public XYZ? PauseBetweenShots { get; set; } + public XYZ? PauseBetweenShots + { + get; + set; + } [JsonPropertyName("Center")] - public XYZ? Center { get; set; } + public XYZ? Center + { + get; + set; + } [JsonPropertyName("Rotate")] - public double? Rotate { get; set; } + public double? Rotate + { + get; + set; + } [JsonPropertyName("GridStep")] - public XYZ? GridStep { get; set; } + public XYZ? GridStep + { + get; + set; + } [JsonPropertyName("Points")] - public XYZ? Points { get; set; } + public XYZ? Points + { + get; + set; + } [JsonPropertyName("PointRadius")] - public double? PointRadius { get; set; } + public double? PointRadius + { + get; + set; + } [JsonPropertyName("ExplosionDistanceRange")] - public XYZ? ExplosionDistanceRange { get; set; } + public XYZ? ExplosionDistanceRange + { + get; + set; + } [JsonPropertyName("AlarmStages")] - public List? AlarmStages { get; set; } + public List? AlarmStages + { + get; + set; + } [JsonPropertyName("BeforeShellingSignalTime")] - public double? BeforeShellingSignalTime { get; set; } + public double? BeforeShellingSignalTime + { + get; + set; + } [JsonPropertyName("UsedInPlanedShelling")] - public bool? UsedInPlanedShelling { get; set; } + public bool? UsedInPlanedShelling + { + get; + set; + } [JsonPropertyName("UseInCalledShelling")] - public bool? UseInCalledShelling { get; set; } + public bool? UseInCalledShelling + { + get; + set; + } [JsonPropertyName("IsActive")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } } public record AlarmStage { [JsonPropertyName("Value")] - public Position? Value { get; set; } + public Position? Value + { + get; + set; + } } public record Brigade { [JsonPropertyName("ID")] - public double? Id { get; set; } + public double? Id + { + get; + set; + } [JsonPropertyName("ArtilleryGuns")] - public List? ArtilleryGuns { get; set; } + public List? ArtilleryGuns + { + get; + set; + } } public record ArtilleryGun { [JsonPropertyName("Position")] - public XYZ? Position { get; set; } + public XYZ? Position + { + get; + set; + } } public record ArtilleryShellingAirDropSettings { [JsonPropertyName("UseAirDrop")] - public bool? UseAirDrop { get; set; } + public bool? UseAirDrop + { + get; + set; + } [JsonPropertyName("AirDropTime")] - public double? AirDropTime { get; set; } + public double? AirDropTime + { + get; + set; + } [JsonPropertyName("AirDropPosition")] - public XYZ? AirDropPosition { get; set; } + public XYZ? AirDropPosition + { + get; + set; + } [JsonPropertyName("LootTemplateId")] - public string? LootTemplateId { get; set; } + public string? LootTemplateId + { + get; + set; + } } public record ProjectileExplosionParams { [JsonPropertyName("Blindness")] - public XYZ? Blindness { get; set; } + public XYZ? Blindness + { + get; + set; + } [JsonPropertyName("Contusion")] - public XYZ? Contusion { get; set; } + public XYZ? Contusion + { + get; + set; + } [JsonPropertyName("ArmorDistanceDistanceDamage")] - public XYZ? ArmorDistanceDistanceDamage { get; set; } + public XYZ? ArmorDistanceDistanceDamage + { + get; + set; + } // Checked in client [JsonPropertyName("MinExplosionDistance")] - public double? MinExplosionDistance { get; set; } + public double? MinExplosionDistance + { + get; + set; + } [JsonPropertyName("MaxExplosionDistance")] - public float? MaxExplosionDistance { get; set; } + public float? MaxExplosionDistance + { + get; + set; + } // Checked in client [JsonPropertyName("FragmentsCount")] - public int? FragmentsCount { get; set; } + public int? FragmentsCount + { + get; + set; + } [JsonPropertyName("Strength")] - public double? Strength { get; set; } + public double? Strength + { + get; + set; + } // Checked in client [JsonPropertyName("ArmorDamage")] - public double? ArmorDamage { get; set; } + public double? ArmorDamage + { + get; + set; + } // Checked in client [JsonPropertyName("StaminaBurnRate")] - public double? StaminaBurnRate { get; set; } + public double? StaminaBurnRate + { + get; + set; + } // Checked in client [JsonPropertyName("PenetrationPower")] - public double? PenetrationPower { get; set; } + public double? PenetrationPower + { + get; + set; + } [JsonPropertyName("DirectionalDamageAngle")] - public double? DirectionalDamageAngle { get; set; } + public double? DirectionalDamageAngle + { + get; + set; + } [JsonPropertyName("DirectionalDamageMultiplier")] - public double? DirectionalDamageMultiplier { get; set; } + public double? DirectionalDamageMultiplier + { + get; + set; + } [JsonPropertyName("FragmentType")] - public string? FragmentType { get; set; } + public string? FragmentType + { + get; + set; + } [JsonPropertyName("DeadlyDistance")] - public double? DeadlyDistance { get; set; } + public double? DeadlyDistance + { + get; + set; + } } public record Config { [JsonPropertyName("ArtilleryShelling")] - public ArtilleryShelling? ArtilleryShelling { get; set; } + public ArtilleryShelling? ArtilleryShelling + { + get; + set; + } [JsonPropertyName("content")] - public Content? Content { get; set; } + public Content? Content + { + get; + set; + } [JsonPropertyName("AimPunchMagnitude")] - public double? AimPunchMagnitude { get; set; } + public double? AimPunchMagnitude + { + get; + set; + } [JsonPropertyName("WeaponSkillProgressRate")] - public double? WeaponSkillProgressRate { get; set; } + public double? WeaponSkillProgressRate + { + get; + set; + } [JsonPropertyName("SkillAtrophy")] - public bool? SkillAtrophy { get; set; } + public bool? SkillAtrophy + { + get; + set; + } [JsonPropertyName("exp")] - public Exp? Exp { get; set; } + public Exp? Exp + { + get; + set; + } [JsonPropertyName("t_base_looting")] - public double? TBaseLooting { get; set; } + public double? TBaseLooting + { + get; + set; + } [JsonPropertyName("t_base_lockpicking")] - public double? TBaseLockpicking { get; set; } + public double? TBaseLockpicking + { + get; + set; + } [JsonPropertyName("armor")] - public Armor? Armor { get; set; } + public Armor? Armor + { + get; + set; + } [JsonPropertyName("SessionsToShowHotKeys")] - public double? SessionsToShowHotKeys { get; set; } + public double? SessionsToShowHotKeys + { + get; + set; + } [JsonPropertyName("MaxBotsAliveOnMap")] - public double? MaxBotsAliveOnMap { get; set; } + public double? MaxBotsAliveOnMap + { + get; + set; + } [JsonPropertyName("MaxBotsAliveOnMapPvE")] - public double? MaxBotsAliveOnMapPvE { get; set; } + public double? MaxBotsAliveOnMapPvE + { + get; + set; + } [JsonPropertyName("RunddansSettings")] - public RunddansSettings? RunddansSettings { get; set; } + public RunddansSettings? RunddansSettings + { + get; + set; + } // Checked in client [JsonPropertyName("SavagePlayCooldown")] - public int? SavagePlayCooldown { get; set; } + public int? SavagePlayCooldown + { + get; + set; + } [JsonPropertyName("SavagePlayCooldownNdaFree")] - public double? SavagePlayCooldownNdaFree { get; set; } + public double? SavagePlayCooldownNdaFree + { + get; + set; + } [JsonPropertyName("SeasonActivity")] - public SeasonActivity? SeasonActivity { get; set; } + public SeasonActivity? SeasonActivity + { + get; + set; + } [JsonPropertyName("MarksmanAccuracy")] - public double? MarksmanAccuracy { get; set; } + public double? MarksmanAccuracy + { + get; + set; + } [JsonPropertyName("SavagePlayCooldownDevelop")] - public double? SavagePlayCooldownDevelop { get; set; } + public double? SavagePlayCooldownDevelop + { + get; + set; + } [JsonPropertyName("TODSkyDate")] - public string? TODSkyDate { get; set; } + public string? TODSkyDate + { + get; + set; + } [JsonPropertyName("Mastering")] - public Mastering[] Mastering { get; set; } + public Mastering[] Mastering + { + get; + set; + } [JsonPropertyName("GlobalItemPriceModifier")] - public double? GlobalItemPriceModifier { get; set; } + public double? GlobalItemPriceModifier + { + get; + set; + } [JsonPropertyName("TradingUnlimitedItems")] - public bool? TradingUnlimitedItems { get; set; } + public bool? TradingUnlimitedItems + { + get; + set; + } [JsonPropertyName("TradingUnsetPersonalLimitItems")] - public bool? TradingUnsetPersonalLimitItems { get; set; } + public bool? TradingUnsetPersonalLimitItems + { + get; + set; + } [JsonPropertyName("TransitSettings")] - public TransitSettings? TransitSettings { get; set; } + public TransitSettings? TransitSettings + { + get; + set; + } [JsonPropertyName("TripwiresSettings")] - public TripwiresSettings? TripwiresSettings { get; set; } + public TripwiresSettings? TripwiresSettings + { + get; + set; + } [JsonPropertyName("MaxLoyaltyLevelForAll")] - public bool? MaxLoyaltyLevelForAll { get; set; } + public bool? MaxLoyaltyLevelForAll + { + get; + set; + } [JsonPropertyName("MountingSettings")] - public MountingSettings? MountingSettings { get; set; } + public MountingSettings? MountingSettings + { + get; + set; + } [JsonPropertyName("GlobalLootChanceModifier")] - public double? GlobalLootChanceModifier { get; set; } + public double? GlobalLootChanceModifier + { + get; + set; + } [JsonPropertyName("GlobalLootChanceModifierPvE")] - public double? GlobalLootChanceModifierPvE { get; set; } + public double? GlobalLootChanceModifierPvE + { + get; + set; + } [JsonPropertyName("GraphicSettings")] - public GraphicSettings? GraphicSettings { get; set; } + public GraphicSettings? GraphicSettings + { + get; + set; + } [JsonPropertyName("TimeBeforeDeploy")] - public double? TimeBeforeDeploy { get; set; } + public double? TimeBeforeDeploy + { + get; + set; + } [JsonPropertyName("TimeBeforeDeployLocal")] - public double? TimeBeforeDeployLocal { get; set; } + public double? TimeBeforeDeployLocal + { + get; + set; + } [JsonPropertyName("TradingSetting")] - public double? TradingSetting { get; set; } + public double? TradingSetting + { + get; + set; + } [JsonPropertyName("TradingSettings")] - public TradingSettings? TradingSettings { get; set; } + public TradingSettings? TradingSettings + { + get; + set; + } [JsonPropertyName("ItemsCommonSettings")] - public ItemsCommonSettings? ItemsCommonSettings { get; set; } + public ItemsCommonSettings? ItemsCommonSettings + { + get; + set; + } [JsonPropertyName("LoadTimeSpeedProgress")] - public double? LoadTimeSpeedProgress { get; set; } + public double? LoadTimeSpeedProgress + { + get; + set; + } [JsonPropertyName("BaseLoadTime")] - public double? BaseLoadTime { get; set; } + public double? BaseLoadTime + { + get; + set; + } [JsonPropertyName("BaseUnloadTime")] - public double? BaseUnloadTime { get; set; } + public double? BaseUnloadTime + { + get; + set; + } [JsonPropertyName("BaseCheckTime")] - public double? BaseCheckTime { get; set; } + public double? BaseCheckTime + { + get; + set; + } [JsonPropertyName("BluntDamageReduceFromSoftArmorMod")] - public double? BluntDamageReduceFromSoftArmorMod { get; set; } + public double? BluntDamageReduceFromSoftArmorMod + { + get; + set; + } [JsonPropertyName("BodyPartColliderSettings")] - public BodyPartColliderSettings? BodyPartColliderSettings { get; set; } + public BodyPartColliderSettings? BodyPartColliderSettings + { + get; + set; + } [JsonPropertyName("Customization")] - public Customization? Customization { get; set; } + public Customization? Customization + { + get; + set; + } [JsonPropertyName("UncheckOnShot")] - public bool? UncheckOnShot { get; set; } + public bool? UncheckOnShot + { + get; + set; + } [JsonPropertyName("BotsEnabled")] - public bool? BotsEnabled { get; set; } + public bool? BotsEnabled + { + get; + set; + } [JsonPropertyName("BufferZone")] - public BufferZone? BufferZone { get; set; } + public BufferZone? BufferZone + { + get; + set; + } [JsonPropertyName("Airdrop")] - public AirdropGlobalSettings? Airdrop { get; set; } + public AirdropGlobalSettings? Airdrop + { + get; + set; + } [JsonPropertyName("ArmorMaterials")] - public Dictionary? ArmorMaterials { get; set; } + public Dictionary? ArmorMaterials + { + get; + set; + } [JsonPropertyName("ArenaEftTransferSettings")] public ArenaEftTransferSettings - ArenaEftTransferSettings { get; set; } // TODO: this needs to be looked into, there are two types further down commented out with the same name + ArenaEftTransferSettings + { + get; + set; + } // TODO: this needs to be looked into, there are two types further down commented out with the same name [JsonPropertyName("KarmaCalculationSettings")] - public KarmaCalculationSettings? KarmaCalculationSettings { get; set; } + public KarmaCalculationSettings? KarmaCalculationSettings + { + get; + set; + } [JsonPropertyName("LegsOverdamage")] - public double? LegsOverdamage { get; set; } + public double? LegsOverdamage + { + get; + set; + } [JsonPropertyName("HandsOverdamage")] - public double? HandsOverdamage { get; set; } + public double? HandsOverdamage + { + get; + set; + } [JsonPropertyName("StomachOverdamage")] - public double? StomachOverdamage { get; set; } + public double? StomachOverdamage + { + get; + set; + } [JsonPropertyName("Health")] - public Health? Health { get; set; } + public Health? Health + { + get; + set; + } [JsonPropertyName("rating")] - public Rating? Rating { get; set; } + public Rating? Rating + { + get; + set; + } [JsonPropertyName("tournament")] - public Tournament? Tournament { get; set; } + public Tournament? Tournament + { + get; + set; + } [JsonPropertyName("QuestSettings")] - public QuestSettings? QuestSettings { get; set; } + public QuestSettings? QuestSettings + { + get; + set; + } [JsonPropertyName("RagFair")] - public RagFair? RagFair { get; set; } + public RagFair? RagFair + { + get; + set; + } [JsonPropertyName("handbook")] - public Handbook? Handbook { get; set; } + public Handbook? Handbook + { + get; + set; + } [JsonPropertyName("FractureCausedByFalling")] - public Probability? FractureCausedByFalling { get; set; } + public Probability? FractureCausedByFalling + { + get; + set; + } [JsonPropertyName("FractureCausedByBulletHit")] - public Probability? FractureCausedByBulletHit { get; set; } + public Probability? FractureCausedByBulletHit + { + get; + set; + } [JsonPropertyName("WAVE_COEF_LOW")] - public double? WaveCoefficientLow { get; set; } + public double? WaveCoefficientLow + { + get; + set; + } [JsonPropertyName("WAVE_COEF_MID")] - public double? WaveCoefficientMid { get; set; } + public double? WaveCoefficientMid + { + get; + set; + } [JsonPropertyName("WAVE_COEF_HIGH")] - public double? WaveCoefficientHigh { get; set; } + public double? WaveCoefficientHigh + { + get; + set; + } [JsonPropertyName("WAVE_COEF_HORDE")] - public double? WaveCoefficientHorde { get; set; } + public double? WaveCoefficientHorde + { + get; + set; + } [JsonPropertyName("Stamina")] - public Stamina? Stamina { get; set; } + public Stamina? Stamina + { + get; + set; + } [JsonPropertyName("StaminaRestoration")] - public StaminaRestoration? StaminaRestoration { get; set; } + public StaminaRestoration? StaminaRestoration + { + get; + set; + } [JsonPropertyName("StaminaDrain")] - public StaminaDrain? StaminaDrain { get; set; } + public StaminaDrain? StaminaDrain + { + get; + set; + } [JsonPropertyName("RequirementReferences")] - public RequirementReferences? RequirementReferences { get; set; } + public RequirementReferences? RequirementReferences + { + get; + set; + } [JsonPropertyName("RestrictionsInRaid")] - public RestrictionsInRaid[] RestrictionsInRaid { get; set; } + public RestrictionsInRaid[] RestrictionsInRaid + { + get; + set; + } [JsonPropertyName("SkillMinEffectiveness")] - public double? SkillMinEffectiveness { get; set; } + public double? SkillMinEffectiveness + { + get; + set; + } [JsonPropertyName("SkillFatiguePerPoint")] - public double? SkillFatiguePerPoint { get; set; } + public double? SkillFatiguePerPoint + { + get; + set; + } [JsonPropertyName("SkillFreshEffectiveness")] - public double? SkillFreshEffectiveness { get; set; } + public double? SkillFreshEffectiveness + { + get; + set; + } [JsonPropertyName("SkillFreshPoints")] - public double? SkillFreshPoints { get; set; } + public double? SkillFreshPoints + { + get; + set; + } [JsonPropertyName("SkillPointsBeforeFatigue")] - public double? SkillPointsBeforeFatigue { get; set; } + public double? SkillPointsBeforeFatigue + { + get; + set; + } [JsonPropertyName("SkillFatigueReset")] - public double? SkillFatigueReset { get; set; } + public double? SkillFatigueReset + { + get; + set; + } [JsonPropertyName("DiscardLimitsEnabled")] - public bool? DiscardLimitsEnabled { get; set; } + public bool? DiscardLimitsEnabled + { + get; + set; + } [JsonPropertyName("EnvironmentSettings")] - public EnvironmentUISettings? EnvironmentSettings { get; set; } + public EnvironmentUISettings? EnvironmentSettings + { + get; + set; + } [JsonPropertyName("EventSettings")] - public EventSettings? EventSettings { get; set; } + public EventSettings? EventSettings + { + get; + set; + } [JsonPropertyName("FavoriteItemsSettings")] - public FavoriteItemsSettings? FavoriteItemsSettings { get; set; } + public FavoriteItemsSettings? FavoriteItemsSettings + { + get; + set; + } [JsonPropertyName("VaultingSettings")] - public VaultingSettings? VaultingSettings { get; set; } + public VaultingSettings? VaultingSettings + { + get; + set; + } [JsonPropertyName("BTRSettings")] - public BTRSettings? BTRSettings { get; set; } + public BTRSettings? BTRSettings + { + get; + set; + } [JsonPropertyName("EventType")] - public List EventType { get; set; } + public List EventType + { + get; + set; + } [JsonPropertyName("WalkSpeed")] - public XYZ? WalkSpeed { get; set; } + public XYZ? WalkSpeed + { + get; + set; + } [JsonPropertyName("SprintSpeed")] - public XYZ? SprintSpeed { get; set; } + public XYZ? SprintSpeed + { + get; + set; + } [JsonPropertyName("SquadSettings")] - public SquadSettings? SquadSettings { get; set; } + public SquadSettings? SquadSettings + { + get; + set; + } [JsonPropertyName("SkillEnduranceWeightThreshold")] - public double? SkillEnduranceWeightThreshold { get; set; } + public double? SkillEnduranceWeightThreshold + { + get; + set; + } [JsonPropertyName("TeamSearchingTimeout")] - public double? TeamSearchingTimeout { get; set; } + public double? TeamSearchingTimeout + { + get; + set; + } [JsonPropertyName("Insurance")] - public Insurance? Insurance { get; set; } + public Insurance? Insurance + { + get; + set; + } [JsonPropertyName("SkillExpPerLevel")] - public double? SkillExpPerLevel { get; set; } + public double? SkillExpPerLevel + { + get; + set; + } [JsonPropertyName("GameSearchingTimeout")] - public double? GameSearchingTimeout { get; set; } + public double? GameSearchingTimeout + { + get; + set; + } [JsonPropertyName("WallContusionAbsorption")] - public XYZ? WallContusionAbsorption { get; set; } + public XYZ? WallContusionAbsorption + { + get; + set; + } [JsonPropertyName("WeaponFastDrawSettings")] - public WeaponFastDrawSettings? WeaponFastDrawSettings { get; set; } + public WeaponFastDrawSettings? WeaponFastDrawSettings + { + get; + set; + } [JsonPropertyName("SkillsSettings")] - public SkillsSettings? SkillsSettings { get; set; } + public SkillsSettings? SkillsSettings + { + get; + set; + } [JsonPropertyName("AzimuthPanelShowsPlayerOrientation")] - public bool? AzimuthPanelShowsPlayerOrientation { get; set; } + public bool? AzimuthPanelShowsPlayerOrientation + { + get; + set; + } [JsonPropertyName("Aiming")] - public Aiming? Aiming { get; set; } + public Aiming? Aiming + { + get; + set; + } [JsonPropertyName("Malfunction")] - public Malfunction? Malfunction { get; set; } + public Malfunction? Malfunction + { + get; + set; + } [JsonPropertyName("Overheat")] - public Overheat? Overheat { get; set; } + public Overheat? Overheat + { + get; + set; + } [JsonPropertyName("FenceSettings")] - public FenceSettings? FenceSettings { get; set; } + public FenceSettings? FenceSettings + { + get; + set; + } [JsonPropertyName("TestValue")] - public double? TestValue { get; set; } + public double? TestValue + { + get; + set; + } [JsonPropertyName("Inertia")] - public Inertia? Inertia { get; set; } + public Inertia? Inertia + { + get; + set; + } [JsonPropertyName("Ballistic")] - public Ballistic? Ballistic { get; set; } + public Ballistic? Ballistic + { + get; + set; + } [JsonPropertyName("RepairSettings")] - public RepairSettings? RepairSettings { get; set; } + public RepairSettings? RepairSettings + { + get; + set; + } [JsonPropertyName("AudioSettings")] - public AudioSettings? AudioSettings { get; set; } + public AudioSettings? AudioSettings + { + get; + set; + } - public CoopSettings? CoopSettings { get; set; } + public CoopSettings? CoopSettings + { + get; + set; + } - public PveSettings? PveSettings { get; set; } + public PveSettings? PveSettings + { + get; + set; + } } public record PveSettings { - public List? AvailableVersions { get; set; } - public bool? ModeEnabled { get; set; } + public List? AvailableVersions + { + get; + set; + } + + public bool? ModeEnabled + { + get; + set; + } } public record CoopSettings { - public List? AvailableVersions { get; set; } + public List? AvailableVersions + { + get; + set; + } } public record RunddansSettings { [JsonPropertyName("accessKeys")] - public List? AccessKeys { get; set; } + public List? AccessKeys + { + get; + set; + } [JsonPropertyName("active")] - public bool? Active { get; set; } + public bool? Active + { + get; + set; + } [JsonPropertyName("activePVE")] - public bool? ActivePVE { get; set; } + public bool? ActivePVE + { + get; + set; + } [JsonPropertyName("applyFrozenEverySec")] - public double? ApplyFrozenEverySec { get; set; } + public double? ApplyFrozenEverySec + { + get; + set; + } [JsonPropertyName("consumables")] - public List? Consumables { get; set; } + public List? Consumables + { + get; + set; + } [JsonPropertyName("drunkImmunitySec")] - public double? DrunkImmunitySec { get; set; } + public double? DrunkImmunitySec + { + get; + set; + } [JsonPropertyName("durability")] - public XY? Durability { get; set; } + public XY? Durability + { + get; + set; + } [JsonPropertyName("fireDistanceToHeat")] - public double? FireDistanceToHeat { get; set; } + public double? FireDistanceToHeat + { + get; + set; + } [JsonPropertyName("grenadeDistanceToBreak")] - public double? GrenadeDistanceToBreak { get; set; } + public double? GrenadeDistanceToBreak + { + get; + set; + } [JsonPropertyName("interactionDistance")] - public double? InteractionDistance { get; set; } + public double? InteractionDistance + { + get; + set; + } [JsonPropertyName("knifeCritChanceToBreak")] - public double? KnifeCritChanceToBreak { get; set; } + public double? KnifeCritChanceToBreak + { + get; + set; + } [JsonPropertyName("locations")] - public List? Locations { get; set; } + public List? Locations + { + get; + set; + } [JsonPropertyName("multitoolRepairSec")] - public double? MultitoolRepairSec { get; set; } + public double? MultitoolRepairSec + { + get; + set; + } [JsonPropertyName("nonExitsLocations")] - public List? NonExitsLocations { get; set; } + public List? NonExitsLocations + { + get; + set; + } [JsonPropertyName("rainForFrozen")] - public double? RainForFrozen { get; set; } + public double? RainForFrozen + { + get; + set; + } [JsonPropertyName("repairSec")] - public double? RepairSec { get; set; } + public double? RepairSec + { + get; + set; + } [JsonPropertyName("secToBreak")] - public XY? SecToBreak { get; set; } + public XY? SecToBreak + { + get; + set; + } [JsonPropertyName("sleighLocations")] - public List? SleighLocations { get; set; } + public List? SleighLocations + { + get; + set; + } } public record SeasonActivity { [JsonPropertyName("InfectionHalloween")] - public SeasonActivityHalloween? InfectionHalloween { get; set; } + public SeasonActivityHalloween? InfectionHalloween + { + get; + set; + } } public record SeasonActivityHalloween { [JsonPropertyName("DisplayUIEnabled")] - public bool? DisplayUIEnabled { get; set; } + public bool? DisplayUIEnabled + { + get; + set; + } [JsonPropertyName("Enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("ZombieBleedMul")] - public double? ZombieBleedMul { get; set; } + public double? ZombieBleedMul + { + get; + set; + } } public record EnvironmentUISettings { - public EnvironmentUIData? EnvironmentUIData { get; set; } + public EnvironmentUIData? EnvironmentUIData + { + get; + set; + } } public record EnvironmentUIData { - public string[] TheUnheardEditionEnvironmentUiType { get; set; } + public string[] TheUnheardEditionEnvironmentUiType + { + get; + set; + } } public record BodyPartColliderSettings { - public BodyPartColliderPart? BackHead { get; set; } - public BodyPartColliderPart? Ears { get; set; } - public BodyPartColliderPart? Eyes { get; set; } - public BodyPartColliderPart? HeadCommon { get; set; } - public BodyPartColliderPart? Jaw { get; set; } - public BodyPartColliderPart? LeftCalf { get; set; } - public BodyPartColliderPart? LeftForearm { get; set; } - public BodyPartColliderPart? LeftSideChestDown { get; set; } - public BodyPartColliderPart? LeftSideChestUp { get; set; } - public BodyPartColliderPart? LeftThigh { get; set; } - public BodyPartColliderPart? LeftUpperArm { get; set; } - public BodyPartColliderPart? NeckBack { get; set; } - public BodyPartColliderPart? NeckFront { get; set; } - public BodyPartColliderPart? ParietalHead { get; set; } - public BodyPartColliderPart? Pelvis { get; set; } - public BodyPartColliderPart? PelvisBack { get; set; } - public BodyPartColliderPart? RibcageLow { get; set; } - public BodyPartColliderPart? RibcageUp { get; set; } - public BodyPartColliderPart? RightCalf { get; set; } - public BodyPartColliderPart? RightForearm { get; set; } - public BodyPartColliderPart? RightSideChestDown { get; set; } - public BodyPartColliderPart? RightSideChestUp { get; set; } - public BodyPartColliderPart? RightThigh { get; set; } - public BodyPartColliderPart? RightUpperArm { get; set; } - public BodyPartColliderPart? SpineDown { get; set; } - public BodyPartColliderPart? SpineTop { get; set; } + public BodyPartColliderPart? BackHead + { + get; + set; + } + + public BodyPartColliderPart? Ears + { + get; + set; + } + + public BodyPartColliderPart? Eyes + { + get; + set; + } + + public BodyPartColliderPart? HeadCommon + { + get; + set; + } + + public BodyPartColliderPart? Jaw + { + get; + set; + } + + public BodyPartColliderPart? LeftCalf + { + get; + set; + } + + public BodyPartColliderPart? LeftForearm + { + get; + set; + } + + public BodyPartColliderPart? LeftSideChestDown + { + get; + set; + } + + public BodyPartColliderPart? LeftSideChestUp + { + get; + set; + } + + public BodyPartColliderPart? LeftThigh + { + get; + set; + } + + public BodyPartColliderPart? LeftUpperArm + { + get; + set; + } + + public BodyPartColliderPart? NeckBack + { + get; + set; + } + + public BodyPartColliderPart? NeckFront + { + get; + set; + } + + public BodyPartColliderPart? ParietalHead + { + get; + set; + } + + public BodyPartColliderPart? Pelvis + { + get; + set; + } + + public BodyPartColliderPart? PelvisBack + { + get; + set; + } + + public BodyPartColliderPart? RibcageLow + { + get; + set; + } + + public BodyPartColliderPart? RibcageUp + { + get; + set; + } + + public BodyPartColliderPart? RightCalf + { + get; + set; + } + + public BodyPartColliderPart? RightForearm + { + get; + set; + } + + public BodyPartColliderPart? RightSideChestDown + { + get; + set; + } + + public BodyPartColliderPart? RightSideChestUp + { + get; + set; + } + + public BodyPartColliderPart? RightThigh + { + get; + set; + } + + public BodyPartColliderPart? RightUpperArm + { + get; + set; + } + + public BodyPartColliderPart? SpineDown + { + get; + set; + } + + public BodyPartColliderPart? SpineTop + { + get; + set; + } } public record BodyPartColliderPart { [JsonPropertyName("PenetrationChance")] - public double? PenetrationChance { get; set; } + public double? PenetrationChance + { + get; + set; + } [JsonPropertyName("PenetrationDamageMod")] - public double? PenetrationDamageMod { get; set; } + public double? PenetrationDamageMod + { + get; + set; + } [JsonPropertyName("PenetrationLevel")] - public double? PenetrationLevel { get; set; } + public double? PenetrationLevel + { + get; + set; + } } public record WeaponFastDrawSettings { [JsonPropertyName("HandShakeCurveFrequency")] - public double? HandShakeCurveFrequency { get; set; } + public double? HandShakeCurveFrequency + { + get; + set; + } [JsonPropertyName("HandShakeCurveIntensity")] - public double? HandShakeCurveIntensity { get; set; } + public double? HandShakeCurveIntensity + { + get; + set; + } [JsonPropertyName("HandShakeMaxDuration")] - public double? HandShakeMaxDuration { get; set; } + public double? HandShakeMaxDuration + { + get; + set; + } [JsonPropertyName("HandShakeTremorIntensity")] - public double? HandShakeTremorIntensity { get; set; } + public double? HandShakeTremorIntensity + { + get; + set; + } [JsonPropertyName("WeaponFastSwitchMaxSpeedMult")] - public double? WeaponFastSwitchMaxSpeedMult { get; set; } + public double? WeaponFastSwitchMaxSpeedMult + { + get; + set; + } [JsonPropertyName("WeaponFastSwitchMinSpeedMult")] - public double? WeaponFastSwitchMinSpeedMult { get; set; } + public double? WeaponFastSwitchMinSpeedMult + { + get; + set; + } [JsonPropertyName("WeaponPistolFastSwitchMaxSpeedMult")] - public double? WeaponPistolFastSwitchMaxSpeedMult { get; set; } + public double? WeaponPistolFastSwitchMaxSpeedMult + { + get; + set; + } [JsonPropertyName("WeaponPistolFastSwitchMinSpeedMult")] - public double? WeaponPistolFastSwitchMinSpeedMult { get; set; } + public double? WeaponPistolFastSwitchMinSpeedMult + { + get; + set; + } } public record EventSettings { [JsonPropertyName("EventActive")] - public bool? EventActive { get; set; } + public bool? EventActive + { + get; + set; + } [JsonPropertyName("EventTime")] - public double? EventTime { get; set; } + public double? EventTime + { + get; + set; + } [JsonPropertyName("EventWeather")] - public EventWeather? EventWeather { get; set; } + public EventWeather? EventWeather + { + get; + set; + } [JsonPropertyName("ExitTimeMultiplier")] - public double? ExitTimeMultiplier { get; set; } + public double? ExitTimeMultiplier + { + get; + set; + } [JsonPropertyName("StaminaMultiplier")] - public double? StaminaMultiplier { get; set; } + public double? StaminaMultiplier + { + get; + set; + } [JsonPropertyName("SummonFailedWeather")] - public EventWeather? SummonFailedWeather { get; set; } + public EventWeather? SummonFailedWeather + { + get; + set; + } [JsonPropertyName("SummonSuccessWeather")] - public EventWeather? SummonSuccessWeather { get; set; } + public EventWeather? SummonSuccessWeather + { + get; + set; + } [JsonPropertyName("WeatherChangeTime")] - public double? WeatherChangeTime { get; set; } + public double? WeatherChangeTime + { + get; + set; + } } public record EventWeather { [JsonPropertyName("Cloudness")] - public double? Cloudness { get; set; } + public double? Cloudness + { + get; + set; + } [JsonPropertyName("Hour")] - public double? Hour { get; set; } + public double? Hour + { + get; + set; + } [JsonPropertyName("Minute")] - public double? Minute { get; set; } + public double? Minute + { + get; + set; + } [JsonPropertyName("Rain")] - public double? Rain { get; set; } + public double? Rain + { + get; + set; + } [JsonPropertyName("RainRandomness")] - public double? RainRandomness { get; set; } + public double? RainRandomness + { + get; + set; + } [JsonPropertyName("ScaterringFogDensity")] - public double? ScaterringFogDensity { get; set; } + public double? ScaterringFogDensity + { + get; + set; + } [JsonPropertyName("TopWindDirection")] - public XYZ? TopWindDirection { get; set; } + public XYZ? TopWindDirection + { + get; + set; + } [JsonPropertyName("Wind")] - public double? Wind { get; set; } + public double? Wind + { + get; + set; + } [JsonPropertyName("WindDirection")] - public double? WindDirection { get; set; } + public double? WindDirection + { + get; + set; + } } public record TransitSettings { [JsonPropertyName("BearPriceMod")] - public double? BearPriceMod { get; set; } + public double? BearPriceMod + { + get; + set; + } [JsonPropertyName("ClearAllPlayerEffectsOnTransit")] - public bool? ClearAllPlayerEffectsOnTransit { get; set; } + public bool? ClearAllPlayerEffectsOnTransit + { + get; + set; + } [JsonPropertyName("CoefficientDiscountCharisma")] - public double? CoefficientDiscountCharisma { get; set; } + public double? CoefficientDiscountCharisma + { + get; + set; + } [JsonPropertyName("DeliveryMinPrice")] - public double? DeliveryMinPrice { get; set; } + public double? DeliveryMinPrice + { + get; + set; + } [JsonPropertyName("DeliveryPrice")] - public double? DeliveryPrice { get; set; } + public double? DeliveryPrice + { + get; + set; + } [JsonPropertyName("ModDeliveryCost")] - public double? ModDeliveryCost { get; set; } + public double? ModDeliveryCost + { + get; + set; + } [JsonPropertyName("PercentageOfMissingEnergyRestore")] - public double? PercentageOfMissingEnergyRestore { get; set; } + public double? PercentageOfMissingEnergyRestore + { + get; + set; + } [JsonPropertyName("PercentageOfMissingHealthRestore")] - public double? PercentageOfMissingHealthRestore { get; set; } + public double? PercentageOfMissingHealthRestore + { + get; + set; + } [JsonPropertyName("PercentageOfMissingWaterRestore")] - public double? PercentageOfMissingWaterRestore { get; set; } + public double? PercentageOfMissingWaterRestore + { + get; + set; + } [JsonPropertyName("RestoreHealthOnDestroyedParts")] - public bool? RestoreHealthOnDestroyedParts { get; set; } + public bool? RestoreHealthOnDestroyedParts + { + get; + set; + } [JsonPropertyName("ScavPriceMod")] - public double? ScavPriceMod { get; set; } + public double? ScavPriceMod + { + get; + set; + } [JsonPropertyName("UsecPriceMod")] - public double? UsecPriceMod { get; set; } + public double? UsecPriceMod + { + get; + set; + } [JsonPropertyName("active")] - public bool? Active { get; set; } + public bool? Active + { + get; + set; + } } public record TripwiresSettings { [JsonPropertyName("CollisionCapsuleCheckCoef")] - public double? CollisionCapsuleCheckCoef { get; set; } + public double? CollisionCapsuleCheckCoef + { + get; + set; + } [JsonPropertyName("CollisionCapsuleRadius")] - public double? CollisionCapsuleRadius { get; set; } + public double? CollisionCapsuleRadius + { + get; + set; + } [JsonPropertyName("DefuseTimeSeconds")] - public double? DefuseTimeSeconds { get; set; } + public double? DefuseTimeSeconds + { + get; + set; + } [JsonPropertyName("DestroyedSeconds")] - public double? DestroyedSeconds { get; set; } + public double? DestroyedSeconds + { + get; + set; + } [JsonPropertyName("GroundDotProductTolerance")] - public double? GroundDotProductTolerance { get; set; } + public double? GroundDotProductTolerance + { + get; + set; + } [JsonPropertyName("InertSeconds")] - public double? InertSeconds { get; set; } + public double? InertSeconds + { + get; + set; + } [JsonPropertyName("InteractionSqrDistance")] - public double? InteractionSqrDistance { get; set; } + public double? InteractionSqrDistance + { + get; + set; + } [JsonPropertyName("MaxHeightDifference")] - public double? MaxHeightDifference { get; set; } + public double? MaxHeightDifference + { + get; + set; + } [JsonPropertyName("MaxLength")] - public double? MaxLength { get; set; } + public double? MaxLength + { + get; + set; + } [JsonPropertyName("MaxPreviewLength")] - public double? MaxPreviewLength { get; set; } + public double? MaxPreviewLength + { + get; + set; + } [JsonPropertyName("MaxTripwireToPlayerDistance")] - public double? MaxTripwireToPlayerDistance { get; set; } + public double? MaxTripwireToPlayerDistance + { + get; + set; + } [JsonPropertyName("MinLength")] - public double? MinLength { get; set; } + public double? MinLength + { + get; + set; + } [JsonPropertyName("MultitoolDefuseTimeSeconds")] - public double? MultitoolDefuseTimeSeconds { get; set; } + public double? MultitoolDefuseTimeSeconds + { + get; + set; + } [JsonPropertyName("ShotSqrDistance")] - public double? ShotSqrDistance { get; set; } + public double? ShotSqrDistance + { + get; + set; + } } public record MountingSettings { [JsonPropertyName("MovementSettings")] - public MountingMovementSettings? MovementSettings { get; set; } + public MountingMovementSettings? MovementSettings + { + get; + set; + } [JsonPropertyName("PointDetectionSettings")] - public MountingPointDetectionSettings? PointDetectionSettings { get; set; } + public MountingPointDetectionSettings? PointDetectionSettings + { + get; + set; + } } public record MountingMovementSettings { [JsonPropertyName("ApproachTime")] - public double? ApproachTime { get; set; } + public double? ApproachTime + { + get; + set; + } [JsonPropertyName("ApproachTimeDeltaAngleModifier")] - public double? ApproachTimeDeltaAngleModifier { get; set; } + public double? ApproachTimeDeltaAngleModifier + { + get; + set; + } [JsonPropertyName("ExitTime")] - public double? ExitTime { get; set; } + public double? ExitTime + { + get; + set; + } [JsonPropertyName("MaxApproachTime")] - public double? MaxApproachTime { get; set; } + public double? MaxApproachTime + { + get; + set; + } [JsonPropertyName("MaxPitchLimitExcess")] - public double? MaxPitchLimitExcess { get; set; } + public double? MaxPitchLimitExcess + { + get; + set; + } [JsonPropertyName("MaxVerticalMountAngle")] - public double? MaxVerticalMountAngle { get; set; } + public double? MaxVerticalMountAngle + { + get; + set; + } [JsonPropertyName("MaxYawLimitExcess")] - public double? MaxYawLimitExcess { get; set; } + public double? MaxYawLimitExcess + { + get; + set; + } [JsonPropertyName("MinApproachTime")] - public double? MinApproachTime { get; set; } + public double? MinApproachTime + { + get; + set; + } [JsonPropertyName("MountingCameraSpeed")] - public double? MountingCameraSpeed { get; set; } + public double? MountingCameraSpeed + { + get; + set; + } [JsonPropertyName("MountingSwayFactorModifier")] - public double? MountingSwayFactorModifier { get; set; } + public double? MountingSwayFactorModifier + { + get; + set; + } [JsonPropertyName("PitchLimitHorizontal")] - public XYZ? PitchLimitHorizontal { get; set; } + public XYZ? PitchLimitHorizontal + { + get; + set; + } [JsonPropertyName("PitchLimitHorizontalBipod")] - public XYZ? PitchLimitHorizontalBipod { get; set; } + public XYZ? PitchLimitHorizontalBipod + { + get; + set; + } [JsonPropertyName("PitchLimitVertical")] - public XYZ? PitchLimitVertical { get; set; } + public XYZ? PitchLimitVertical + { + get; + set; + } [JsonPropertyName("RotationSpeedClamp")] - public double? RotationSpeedClamp { get; set; } + public double? RotationSpeedClamp + { + get; + set; + } [JsonPropertyName("SensitivityMultiplier")] - public double? SensitivityMultiplier { get; set; } + public double? SensitivityMultiplier + { + get; + set; + } } public record MountingPointDetectionSettings { [JsonPropertyName("CheckHorizontalSecondaryOffset")] - public double? CheckHorizontalSecondaryOffset { get; set; } + public double? CheckHorizontalSecondaryOffset + { + get; + set; + } [JsonPropertyName("CheckWallOffset")] - public double? CheckWallOffset { get; set; } + public double? CheckWallOffset + { + get; + set; + } [JsonPropertyName("EdgeDetectionDistance")] - public double? EdgeDetectionDistance { get; set; } + public double? EdgeDetectionDistance + { + get; + set; + } [JsonPropertyName("GridMaxHeight")] - public double? GridMaxHeight { get; set; } + public double? GridMaxHeight + { + get; + set; + } [JsonPropertyName("GridMinHeight")] - public double? GridMinHeight { get; set; } + public double? GridMinHeight + { + get; + set; + } [JsonPropertyName("HorizontalGridFromTopOffset")] - public double? HorizontalGridFromTopOffset { get; set; } + public double? HorizontalGridFromTopOffset + { + get; + set; + } [JsonPropertyName("HorizontalGridSize")] - public double? HorizontalGridSize { get; set; } + public double? HorizontalGridSize + { + get; + set; + } [JsonPropertyName("HorizontalGridStepsAmount")] - public double? HorizontalGridStepsAmount { get; set; } + public double? HorizontalGridStepsAmount + { + get; + set; + } [JsonPropertyName("MaxFramesForRaycast")] - public double? MaxFramesForRaycast { get; set; } + public double? MaxFramesForRaycast + { + get; + set; + } [JsonPropertyName("MaxHorizontalMountAngleDotDelta")] - public double? MaxHorizontalMountAngleDotDelta { get; set; } + public double? MaxHorizontalMountAngleDotDelta + { + get; + set; + } [JsonPropertyName("MaxProneMountAngleDotDelta")] - public double? MaxProneMountAngleDotDelta { get; set; } + public double? MaxProneMountAngleDotDelta + { + get; + set; + } [JsonPropertyName("MaxVerticalMountAngleDotDelta")] - public double? MaxVerticalMountAngleDotDelta { get; set; } + public double? MaxVerticalMountAngleDotDelta + { + get; + set; + } [JsonPropertyName("PointHorizontalMountOffset")] - public double? PointHorizontalMountOffset { get; set; } + public double? PointHorizontalMountOffset + { + get; + set; + } [JsonPropertyName("PointVerticalMountOffset")] - public double? PointVerticalMountOffset { get; set; } + public double? PointVerticalMountOffset + { + get; + set; + } [JsonPropertyName("RaycastDistance")] - public double? RaycastDistance { get; set; } + public double? RaycastDistance + { + get; + set; + } [JsonPropertyName("SecondCheckVerticalDistance")] - public double? SecondCheckVerticalDistance { get; set; } + public double? SecondCheckVerticalDistance + { + get; + set; + } [JsonPropertyName("SecondCheckVerticalGridOffset")] - public double? SecondCheckVerticalGridOffset { get; set; } + public double? SecondCheckVerticalGridOffset + { + get; + set; + } [JsonPropertyName("SecondCheckVerticalGridSize")] - public double? SecondCheckVerticalGridSize { get; set; } + public double? SecondCheckVerticalGridSize + { + get; + set; + } [JsonPropertyName("SecondCheckVerticalGridSizeStepsAmount")] - public double? SecondCheckVerticalGridSizeStepsAmount { get; set; } + public double? SecondCheckVerticalGridSizeStepsAmount + { + get; + set; + } [JsonPropertyName("VerticalGridSize")] - public double? VerticalGridSize { get; set; } + public double? VerticalGridSize + { + get; + set; + } [JsonPropertyName("VerticalGridStepsAmount")] - public double? VerticalGridStepsAmount { get; set; } + public double? VerticalGridStepsAmount + { + get; + set; + } } public record GraphicSettings { [JsonPropertyName("ExperimentalFogInCity")] - public bool? ExperimentalFogInCity { get; set; } + public bool? ExperimentalFogInCity + { + get; + set; + } } public record BufferZone { [JsonPropertyName("CustomerAccessTime")] - public double? CustomerAccessTime { get; set; } + public double? CustomerAccessTime + { + get; + set; + } [JsonPropertyName("CustomerCriticalTimeStart")] - public double? CustomerCriticalTimeStart { get; set; } + public double? CustomerCriticalTimeStart + { + get; + set; + } [JsonPropertyName("CustomerKickNotifTime")] - public double? CustomerKickNotifTime { get; set; } + public double? CustomerKickNotifTime + { + get; + set; + } } public record ItemsCommonSettings { [JsonPropertyName("ItemRemoveAfterInterruptionTime")] - public double? ItemRemoveAfterInterruptionTime { get; set; } + public double? ItemRemoveAfterInterruptionTime + { + get; + set; + } } public record TradingSettings { [JsonPropertyName("BuyRestrictionMaxBonus")] - public Dictionary? BuyRestrictionMaxBonus { get; set; } + public Dictionary? BuyRestrictionMaxBonus + { + get; + set; + } [JsonPropertyName("BuyoutRestrictions")] - public BuyoutRestrictions? BuyoutRestrictions { get; set; } + public BuyoutRestrictions? BuyoutRestrictions + { + get; + set; + } } public record BuyRestrictionMaxBonus { [JsonPropertyName("multiplier")] - public double? Multiplier { get; set; } + public double? Multiplier + { + get; + set; + } } public record BuyoutRestrictions { [JsonPropertyName("MinDurability")] - public double? MinDurability { get; set; } + public double? MinDurability + { + get; + set; + } [JsonPropertyName("MinFoodDrinkResource")] - public double? MinFoodDrinkResource { get; set; } + public double? MinFoodDrinkResource + { + get; + set; + } [JsonPropertyName("MinMedsResource")] - public double? MinMedsResource { get; set; } + public double? MinMedsResource + { + get; + set; + } } public record Content { [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public double? Port { get; set; } + public double? Port + { + get; + set; + } [JsonPropertyName("root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } } public record Exp { [JsonPropertyName("heal")] - public Heal? Heal { get; set; } + public Heal? Heal + { + get; + set; + } [JsonPropertyName("match_end")] - public MatchEnd? MatchEnd { get; set; } + public MatchEnd? MatchEnd + { + get; + set; + } [JsonPropertyName("kill")] - public Kill? Kill { get; set; } + public Kill? Kill + { + get; + set; + } [JsonPropertyName("level")] - public Level? Level { get; set; } + public Level? Level + { + get; + set; + } [JsonPropertyName("loot_attempts")] - public List? LootAttempts { get; set; } + public List? LootAttempts + { + get; + set; + } // Confirmed in client [JsonPropertyName("expForLevelOneDogtag")] - public double? ExpForLevelOneDogtag { get; set; } + public double? ExpForLevelOneDogtag + { + get; + set; + } // Confirmed in client [JsonPropertyName("expForLockedDoorOpen")] - public int? ExpForLockedDoorOpen { get; set; } + public int? ExpForLockedDoorOpen + { + get; + set; + } // Confirmed in client [JsonPropertyName("expForLockedDoorBreach")] - public int? ExpForLockedDoorBreach { get; set; } + public int? ExpForLockedDoorBreach + { + get; + set; + } [JsonPropertyName("triggerMult")] - public double? TriggerMult { get; set; } + public double? TriggerMult + { + get; + set; + } } public record Heal { [JsonPropertyName("expForHeal")] - public double? ExpForHeal { get; set; } + public double? ExpForHeal + { + get; + set; + } [JsonPropertyName("expForHydration")] - public double? ExpForHydration { get; set; } + public double? ExpForHydration + { + get; + set; + } [JsonPropertyName("expForEnergy")] - public double? ExpForEnergy { get; set; } + public double? ExpForEnergy + { + get; + set; + } } public record MatchEnd { [JsonPropertyName("README")] - public string? ReadMe { get; set; } + public string? ReadMe + { + get; + set; + } // Confirmed in client [JsonPropertyName("survived_exp_requirement")] - public int? SurvivedExperienceRequirement { get; set; } + public int? SurvivedExperienceRequirement + { + get; + set; + } // Confirmed in client [JsonPropertyName("survived_seconds_requirement")] - public int? SurvivedSecondsRequirement { get; set; } + public int? SurvivedSecondsRequirement + { + get; + set; + } // Confirmed in client [JsonPropertyName("survived_exp_reward")] - public int? SurvivedExperienceReward { get; set; } + public int? SurvivedExperienceReward + { + get; + set; + } // Confirmed in client [JsonPropertyName("mia_exp_reward")] - public int? MiaExperienceReward { get; set; } + public int? MiaExperienceReward + { + get; + set; + } [JsonPropertyName("runner_exp_reward")] - public int? RunnerExperienceReward { get; set; } + public int? RunnerExperienceReward + { + get; + set; + } [JsonPropertyName("leftMult")] - public double? LeftMultiplier { get; set; } + public double? LeftMultiplier + { + get; + set; + } [JsonPropertyName("miaMult")] - public double? MiaMultiplier { get; set; } + public double? MiaMultiplier + { + get; + set; + } [JsonPropertyName("survivedMult")] - public double? SurvivedMultiplier { get; set; } + public double? SurvivedMultiplier + { + get; + set; + } [JsonPropertyName("runnerMult")] - public double? RunnerMultiplier { get; set; } + public double? RunnerMultiplier + { + get; + set; + } [JsonPropertyName("killedMult")] - public double? KilledMultiplier { get; set; } + public double? KilledMultiplier + { + get; + set; + } [JsonPropertyName("transit_exp_reward")] - public double? TransitExperienceReward { get; set; } + public double? TransitExperienceReward + { + get; + set; + } [JsonPropertyName("transit_mult")] - public List>? TransitMultiplier { get; set; } + public List>? TransitMultiplier + { + get; + set; + } } public record Kill { [JsonPropertyName("combo")] - public Combo[] Combos { get; set; } + public Combo[] Combos + { + get; + set; + } [JsonPropertyName("victimLevelExp")] - public double? VictimLevelExperience { get; set; } + public double? VictimLevelExperience + { + get; + set; + } [JsonPropertyName("headShotMult")] - public double? HeadShotMultiplier { get; set; } + public double? HeadShotMultiplier + { + get; + set; + } [JsonPropertyName("expOnDamageAllHealth")] - public double? ExperienceOnDamageAllHealth { get; set; } + public double? ExperienceOnDamageAllHealth + { + get; + set; + } [JsonPropertyName("longShotDistance")] - public double? LongShotDistance { get; set; } + public double? LongShotDistance + { + get; + set; + } [JsonPropertyName("bloodLossToLitre")] - public double? BloodLossToLitre { get; set; } + public double? BloodLossToLitre + { + get; + set; + } [JsonPropertyName("botExpOnDamageAllHealth")] - public double? BotExperienceOnDamageAllHealth { get; set; } + public double? BotExperienceOnDamageAllHealth + { + get; + set; + } [JsonPropertyName("botHeadShotMult")] - public double? BotHeadShotMultiplier { get; set; } + public double? BotHeadShotMultiplier + { + get; + set; + } [JsonPropertyName("victimBotLevelExp")] - public double? VictimBotLevelExperience { get; set; } + public double? VictimBotLevelExperience + { + get; + set; + } [JsonPropertyName("pmcExpOnDamageAllHealth")] - public double? PmcExperienceOnDamageAllHealth { get; set; } + public double? PmcExperienceOnDamageAllHealth + { + get; + set; + } [JsonPropertyName("pmcHeadShotMult")] - public double? PmcHeadShotMultiplier { get; set; } + public double? PmcHeadShotMultiplier + { + get; + set; + } } public record Combo { [JsonPropertyName("percent")] - public double? Percentage { get; set; } + public double? Percentage + { + get; + set; + } } public record Level { [JsonPropertyName("exp_table")] - public ExpTable[] ExperienceTable { get; set; } + public ExpTable[] ExperienceTable + { + get; + set; + } [JsonPropertyName("trade_level")] - public double? TradeLevel { get; set; } + public double? TradeLevel + { + get; + set; + } [JsonPropertyName("savage_level")] - public double? SavageLevel { get; set; } + public double? SavageLevel + { + get; + set; + } [JsonPropertyName("clan_level")] - public double? ClanLevel { get; set; } + public double? ClanLevel + { + get; + set; + } [JsonPropertyName("mastering1")] - public double? Mastering1 { get; set; } + public double? Mastering1 + { + get; + set; + } [JsonPropertyName("mastering2")] - public double? Mastering2 { get; set; } + public double? Mastering2 + { + get; + set; + } } public record ExpTable { [JsonPropertyName("exp")] - public int? Experience { get; set; } + public int? Experience + { + get; + set; + } } public record LootAttempt { [JsonPropertyName("k_exp")] - public double? ExperiencePoints { get; set; } + public double? ExperiencePoints + { + get; + set; + } } public record Armor { [JsonPropertyName("class")] - public List? Classes { get; set; } + public List? Classes + { + get; + set; + } } public record Class { // Checked in client [JsonPropertyName("resistance")] - public int? Resistance { get; set; } + public int? Resistance + { + get; + set; + } } public record Mastering { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("Templates")] - public List? Templates { get; set; } + public List? Templates + { + get; + set; + } [JsonPropertyName("Progress")] - public double? Progress { get; set; } + public double? Progress + { + get; + set; + } // Checked in client [JsonPropertyName("Level2")] - public int? Level2 { get; set; } + public int? Level2 + { + get; + set; + } // Checked in client [JsonPropertyName("Level3")] - public int? Level3 { get; set; } + public int? Level3 + { + get; + set; + } } public record Customization { [JsonPropertyName("SavageHead")] - public Dictionary? Head { get; set; } + public Dictionary? Head + { + get; + set; + } [JsonPropertyName("SavageBody")] - public Dictionary? Body { get; set; } + public Dictionary? Body + { + get; + set; + } [JsonPropertyName("SavageFeet")] - public Dictionary? Feet { get; set; } + public Dictionary? Feet + { + get; + set; + } [JsonPropertyName("CustomizationVoice")] - public List? VoiceOptions { get; set; } + public List? VoiceOptions + { + get; + set; + } [JsonPropertyName("BodyParts")] - public BodyParts? BodyParts { get; set; } + public BodyParts? BodyParts + { + get; + set; + } } public record WildHead { [JsonPropertyName("head")] - public string? Head { get; set; } + public string? Head + { + get; + set; + } [JsonPropertyName("isNotRandom")] - public bool? IsNotRandom { get; set; } + public bool? IsNotRandom + { + get; + set; + } [JsonPropertyName("NotRandom")] - public bool? NotRandom { get; set; } + public bool? NotRandom + { + get; + set; + } } public record WildBody { [JsonPropertyName("body")] - public string? Body { get; set; } + public string? Body + { + get; + set; + } [JsonPropertyName("hands")] - public string? Hands { get; set; } + public string? Hands + { + get; + set; + } [JsonPropertyName("isNotRandom")] - public bool? IsNotRandom { get; set; } + public bool? IsNotRandom + { + get; + set; + } } public record WildFeet { [JsonPropertyName("feet")] - public string? Feet { get; set; } + public string? Feet + { + get; + set; + } [JsonPropertyName("isNotRandom")] - public bool? IsNotRandom { get; set; } + public bool? IsNotRandom + { + get; + set; + } [JsonPropertyName("NotRandom")] - public bool? NotRandom { get; set; } + public bool? NotRandom + { + get; + set; + } } public record CustomizationVoice { [JsonPropertyName("voice")] - public string? Voice { get; set; } + public string? Voice + { + get; + set; + } [JsonPropertyName("side")] - public List? Side { get; set; } + public List? Side + { + get; + set; + } [JsonPropertyName("isNotRandom")] - public bool? IsNotRandom { get; set; } + public bool? IsNotRandom + { + get; + set; + } } public record BodyParts { - public string? Head { get; set; } - public string? Body { get; set; } - public string? Feet { get; set; } - public string? Hands { get; set; } + public string? Head + { + get; + set; + } + + public string? Body + { + get; + set; + } + + public string? Feet + { + get; + set; + } + + public string? Hands + { + get; + set; + } } public record AirdropGlobalSettings { - public string? AirdropViewType { get; set; } - public double? ParachuteEndOpenHeight { get; set; } - public double? ParachuteStartOpenHeight { get; set; } - public double? PlaneAdditionalDistance { get; set; } - public double? PlaneAirdropDuration { get; set; } - public double? PlaneAirdropFlareWait { get; set; } - public double? PlaneAirdropSmoke { get; set; } - public double? PlaneMaxFlightHeight { get; set; } - public double? PlaneMinFlightHeight { get; set; } - public double? PlaneSpeed { get; set; } - public double? SmokeActivateHeight { get; set; } + public string? AirdropViewType + { + get; + set; + } + + public double? ParachuteEndOpenHeight + { + get; + set; + } + + public double? ParachuteStartOpenHeight + { + get; + set; + } + + public double? PlaneAdditionalDistance + { + get; + set; + } + + public double? PlaneAirdropDuration + { + get; + set; + } + + public double? PlaneAirdropFlareWait + { + get; + set; + } + + public double? PlaneAirdropSmoke + { + get; + set; + } + + public double? PlaneMaxFlightHeight + { + get; + set; + } + + public double? PlaneMinFlightHeight + { + get; + set; + } + + public double? PlaneSpeed + { + get; + set; + } + + public double? SmokeActivateHeight + { + get; + set; + } } public record KarmaCalculationSettings { [JsonPropertyName("defaultPveKarmaValue")] - public double? DefaultPveKarmaValue { get; set; } + public double? DefaultPveKarmaValue + { + get; + set; + } [JsonPropertyName("enable")] - public bool? Enable { get; set; } + public bool? Enable + { + get; + set; + } [JsonPropertyName("expireDaysAfterLastRaid")] - public double? ExpireDaysAfterLastRaid { get; set; } + public double? ExpireDaysAfterLastRaid + { + get; + set; + } [JsonPropertyName("maxKarmaThresholdPercentile")] - public double? MaxKarmaThresholdPercentile { get; set; } + public double? MaxKarmaThresholdPercentile + { + get; + set; + } [JsonPropertyName("minKarmaThresholdPercentile")] - public double? MinKarmaThresholdPercentile { get; set; } + public double? MinKarmaThresholdPercentile + { + get; + set; + } [JsonPropertyName("minSurvivedRaidCount")] - public double? MinSurvivedRaidCount { get; set; } + public double? MinSurvivedRaidCount + { + get; + set; + } } public record ArenaEftTransferSettings { - public double? ArenaManagerReputationTaxMultiplier { get; set; } - public double? CharismaTaxMultiplier { get; set; } - public double? CreditPriceTaxMultiplier { get; set; } - public double? RubTaxMultiplier { get; set; } - public Dictionary? TransferLimitsByGameEdition { get; set; } - public Dictionary? TransferLimitsSettings { get; set; } + public double? ArenaManagerReputationTaxMultiplier + { + get; + set; + } + + public double? CharismaTaxMultiplier + { + get; + set; + } + + public double? CreditPriceTaxMultiplier + { + get; + set; + } + + public double? RubTaxMultiplier + { + get; + set; + } + + public Dictionary? TransferLimitsByGameEdition + { + get; + set; + } + + public Dictionary? TransferLimitsSettings + { + get; + set; + } } public record ArmorType { [JsonPropertyName("Destructibility")] - public double? Destructibility { get; set; } + public double? Destructibility + { + get; + set; + } [JsonPropertyName("MinRepairDegradation")] - public double? MinRepairDegradation { get; set; } + public double? MinRepairDegradation + { + get; + set; + } [JsonPropertyName("MaxRepairDegradation")] - public double? MaxRepairDegradation { get; set; } + public double? MaxRepairDegradation + { + get; + set; + } [JsonPropertyName("ExplosionDestructibility")] - public double? ExplosionDestructibility { get; set; } + public double? ExplosionDestructibility + { + get; + set; + } [JsonPropertyName("MinRepairKitDegradation")] - public double? MinRepairKitDegradation { get; set; } + public double? MinRepairKitDegradation + { + get; + set; + } [JsonPropertyName("MaxRepairKitDegradation")] - public double? MaxRepairKitDegradation { get; set; } + public double? MaxRepairKitDegradation + { + get; + set; + } } public record Health { [JsonPropertyName("Falling")] - public Falling? Falling { get; set; } + public Falling? Falling + { + get; + set; + } [JsonPropertyName("Effects")] - public Effects? Effects { get; set; } + public Effects? Effects + { + get; + set; + } [JsonPropertyName("HealPrice")] - public HealPrice? HealPrice { get; set; } + public HealPrice? HealPrice + { + get; + set; + } [JsonPropertyName("ProfileHealthSettings")] - public ProfileHealthSettings? ProfileHealthSettings { get; set; } + public ProfileHealthSettings? ProfileHealthSettings + { + get; + set; + } } public record Falling { [JsonPropertyName("DamagePerMeter")] - public double? DamagePerMeter { get; set; } + public double? DamagePerMeter + { + get; + set; + } [JsonPropertyName("SafeHeight")] - public double? SafeHeight { get; set; } + public double? SafeHeight + { + get; + set; + } } public record Effects { [JsonPropertyName("Existence")] - public Existence? Existence { get; set; } + public Existence? Existence + { + get; + set; + } [JsonPropertyName("Dehydration")] - public Dehydration? Dehydration { get; set; } + public Dehydration? Dehydration + { + get; + set; + } [JsonPropertyName("BreakPart")] - public BreakPart? BreakPart { get; set; } + public BreakPart? BreakPart + { + get; + set; + } [JsonPropertyName("Contusion")] - public Contusion? Contusion { get; set; } + public Contusion? Contusion + { + get; + set; + } [JsonPropertyName("Disorientation")] - public Disorientation? Disorientation { get; set; } + public Disorientation? Disorientation + { + get; + set; + } [JsonPropertyName("Exhaustion")] - public Exhaustion? Exhaustion { get; set; } + public Exhaustion? Exhaustion + { + get; + set; + } [JsonPropertyName("LowEdgeHealth")] - public LowEdgeHealth? LowEdgeHealth { get; set; } + public LowEdgeHealth? LowEdgeHealth + { + get; + set; + } [JsonPropertyName("RadExposure")] - public RadExposure? RadExposure { get; set; } + public RadExposure? RadExposure + { + get; + set; + } [JsonPropertyName("Stun")] - public Stun? Stun { get; set; } + public Stun? Stun + { + get; + set; + } [JsonPropertyName("Intoxication")] - public Intoxication? Intoxication { get; set; } + public Intoxication? Intoxication + { + get; + set; + } [JsonPropertyName("Regeneration")] - public Regeneration? Regeneration { get; set; } + public Regeneration? Regeneration + { + get; + set; + } [JsonPropertyName("Wound")] - public Wound? Wound { get; set; } + public Wound? Wound + { + get; + set; + } [JsonPropertyName("Berserk")] - public Berserk? Berserk { get; set; } + public Berserk? Berserk + { + get; + set; + } [JsonPropertyName("Flash")] - public Flash? Flash { get; set; } + public Flash? Flash + { + get; + set; + } [JsonPropertyName("MedEffect")] - public MedEffect? MedEffect { get; set; } + public MedEffect? MedEffect + { + get; + set; + } [JsonPropertyName("Pain")] - public Pain? Pain { get; set; } + public Pain? Pain + { + get; + set; + } [JsonPropertyName("PainKiller")] - public PainKiller? PainKiller { get; set; } + public PainKiller? PainKiller + { + get; + set; + } [JsonPropertyName("SandingScreen")] - public SandingScreen? SandingScreen { get; set; } + public SandingScreen? SandingScreen + { + get; + set; + } [JsonPropertyName("MildMusclePain")] - public MusclePainEffect? MildMusclePain { get; set; } + public MusclePainEffect? MildMusclePain + { + get; + set; + } [JsonPropertyName("SevereMusclePain")] - public MusclePainEffect? SevereMusclePain { get; set; } + public MusclePainEffect? SevereMusclePain + { + get; + set; + } [JsonPropertyName("Stimulator")] - public Stimulator? Stimulator { get; set; } + public Stimulator? Stimulator + { + get; + set; + } [JsonPropertyName("Tremor")] - public Tremor? Tremor { get; set; } + public Tremor? Tremor + { + get; + set; + } [JsonPropertyName("ChronicStaminaFatigue")] - public ChronicStaminaFatigue? ChronicStaminaFatigue { get; set; } + public ChronicStaminaFatigue? ChronicStaminaFatigue + { + get; + set; + } [JsonPropertyName("Fracture")] - public Fracture? Fracture { get; set; } + public Fracture? Fracture + { + get; + set; + } [JsonPropertyName("HeavyBleeding")] - public HeavyBleeding? HeavyBleeding { get; set; } + public HeavyBleeding? HeavyBleeding + { + get; + set; + } [JsonPropertyName("LightBleeding")] - public LightBleeding? LightBleeding { get; set; } + public LightBleeding? LightBleeding + { + get; + set; + } [JsonPropertyName("BodyTemperature")] - public BodyTemperature? BodyTemperature { get; set; } + public BodyTemperature? BodyTemperature + { + get; + set; + } [JsonPropertyName("ZombieInfection")] - public ZombieInfection? ZombieInfection { get; set; } + public ZombieInfection? ZombieInfection + { + get; + set; + } } public record ZombieInfection { [JsonPropertyName("Dehydration")] - public double? Dehydration { get; set; } + public double? Dehydration + { + get; + set; + } [JsonPropertyName("HearingDebuffPercentage")] - public double? HearingDebuffPercentage { get; set; } + public double? HearingDebuffPercentage + { + get; + set; + } // The C on the Cumulatie down here is the russian C, its encoded differently, I THINK // Just in case, dont change it [JsonPropertyName("СumulativeTime")] - public double? CumulativeTime { get; set; } + public double? CumulativeTime + { + get; + set; + } } public record Existence { [JsonPropertyName("EnergyLoopTime")] - public double? EnergyLoopTime { get; set; } + public double? EnergyLoopTime + { + get; + set; + } [JsonPropertyName("HydrationLoopTime")] - public double? HydrationLoopTime { get; set; } + public double? HydrationLoopTime + { + get; + set; + } [JsonPropertyName("EnergyDamage")] - public double? EnergyDamage { get; set; } + public double? EnergyDamage + { + get; + set; + } [JsonPropertyName("HydrationDamage")] - public double? HydrationDamage { get; set; } + public double? HydrationDamage + { + get; + set; + } [JsonPropertyName("DestroyedStomachEnergyTimeFactor")] - public double? DestroyedStomachEnergyTimeFactor { get; set; } + public double? DestroyedStomachEnergyTimeFactor + { + get; + set; + } [JsonPropertyName("DestroyedStomachHydrationTimeFactor")] - public double? DestroyedStomachHydrationTimeFactor { get; set; } + public double? DestroyedStomachHydrationTimeFactor + { + get; + set; + } } public record Dehydration { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("BleedingHealth")] - public double? BleedingHealth { get; set; } + public double? BleedingHealth + { + get; + set; + } [JsonPropertyName("BleedingLoopTime")] - public double? BleedingLoopTime { get; set; } + public double? BleedingLoopTime + { + get; + set; + } [JsonPropertyName("BleedingLifeTime")] - public double? BleedingLifeTime { get; set; } + public double? BleedingLifeTime + { + get; + set; + } [JsonPropertyName("DamageOnStrongDehydration")] - public double? DamageOnStrongDehydration { get; set; } + public double? DamageOnStrongDehydration + { + get; + set; + } [JsonPropertyName("StrongDehydrationLoopTime")] - public double? StrongDehydrationLoopTime { get; set; } + public double? StrongDehydrationLoopTime + { + get; + set; + } } public record BreakPart { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("HealExperience")] - public double? HealExperience { get; set; } + public double? HealExperience + { + get; + set; + } [JsonPropertyName("OfflineDurationMin")] - public double? OfflineDurationMin { get; set; } + public double? OfflineDurationMin + { + get; + set; + } [JsonPropertyName("OfflineDurationMax")] - public double? OfflineDurationMax { get; set; } + public double? OfflineDurationMax + { + get; + set; + } [JsonPropertyName("RemovePrice")] - public double? RemovePrice { get; set; } + public double? RemovePrice + { + get; + set; + } [JsonPropertyName("RemovedAfterDeath")] - public bool? RemovedAfterDeath { get; set; } + public bool? RemovedAfterDeath + { + get; + set; + } [JsonPropertyName("BulletHitProbability")] - public Probability? BulletHitProbability { get; set; } + public Probability? BulletHitProbability + { + get; + set; + } [JsonPropertyName("FallingProbability")] - public Probability? FallingProbability { get; set; } + public Probability? FallingProbability + { + get; + set; + } } public record Contusion { [JsonPropertyName("Dummy")] - public double? Dummy { get; set; } + public double? Dummy + { + get; + set; + } } public record Disorientation { [JsonPropertyName("Dummy")] - public double? Dummy { get; set; } + public double? Dummy + { + get; + set; + } } public record Exhaustion { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("Damage")] - public double? Damage { get; set; } + public double? Damage + { + get; + set; + } [JsonPropertyName("DamageLoopTime")] - public double? DamageLoopTime { get; set; } + public double? DamageLoopTime + { + get; + set; + } } public record LowEdgeHealth { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("StartCommonHealth")] - public double? StartCommonHealth { get; set; } + public double? StartCommonHealth + { + get; + set; + } } public record RadExposure { [JsonPropertyName("Damage")] - public double? Damage { get; set; } + public double? Damage + { + get; + set; + } [JsonPropertyName("DamageLoopTime")] - public double? DamageLoopTime { get; set; } + public double? DamageLoopTime + { + get; + set; + } } public record Stun { [JsonPropertyName("Dummy")] - public double? Dummy { get; set; } + public double? Dummy + { + get; + set; + } } public record Intoxication { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("DamageHealth")] - public double? DamageHealth { get; set; } + public double? DamageHealth + { + get; + set; + } [JsonPropertyName("HealthLoopTime")] - public double? HealthLoopTime { get; set; } + public double? HealthLoopTime + { + get; + set; + } [JsonPropertyName("OfflineDurationMin")] - public double? OfflineDurationMin { get; set; } + public double? OfflineDurationMin + { + get; + set; + } [JsonPropertyName("OfflineDurationMax")] - public double? OfflineDurationMax { get; set; } + public double? OfflineDurationMax + { + get; + set; + } [JsonPropertyName("RemovedAfterDeath")] - public bool? RemovedAfterDeath { get; set; } + public bool? RemovedAfterDeath + { + get; + set; + } [JsonPropertyName("HealExperience")] - public double? HealExperience { get; set; } + public double? HealExperience + { + get; + set; + } [JsonPropertyName("RemovePrice")] - public double? RemovePrice { get; set; } + public double? RemovePrice + { + get; + set; + } } public record Regeneration { [JsonPropertyName("LoopTime")] - public double? LoopTime { get; set; } + public double? LoopTime + { + get; + set; + } [JsonPropertyName("MinimumHealthPercentage")] - public double? MinimumHealthPercentage { get; set; } + public double? MinimumHealthPercentage + { + get; + set; + } [JsonPropertyName("Energy")] - public double? Energy { get; set; } + public double? Energy + { + get; + set; + } [JsonPropertyName("Hydration")] - public double? Hydration { get; set; } + public double? Hydration + { + get; + set; + } [JsonPropertyName("BodyHealth")] - public BodyHealth? BodyHealth { get; set; } + public BodyHealth? BodyHealth + { + get; + set; + } [JsonPropertyName("Influences")] - public Influences? Influences { get; set; } + public Influences? Influences + { + get; + set; + } } public record BodyHealth { [JsonPropertyName("Head")] - public BodyHealthValue? Head { get; set; } + public BodyHealthValue? Head + { + get; + set; + } [JsonPropertyName("Chest")] - public BodyHealthValue? Chest { get; set; } + public BodyHealthValue? Chest + { + get; + set; + } [JsonPropertyName("Stomach")] - public BodyHealthValue? Stomach { get; set; } + public BodyHealthValue? Stomach + { + get; + set; + } [JsonPropertyName("LeftArm")] - public BodyHealthValue? LeftArm { get; set; } + public BodyHealthValue? LeftArm + { + get; + set; + } [JsonPropertyName("RightArm")] - public BodyHealthValue? RightArm { get; set; } + public BodyHealthValue? RightArm + { + get; + set; + } [JsonPropertyName("LeftLeg")] - public BodyHealthValue? LeftLeg { get; set; } + public BodyHealthValue? LeftLeg + { + get; + set; + } [JsonPropertyName("RightLeg")] - public BodyHealthValue? RightLeg { get; set; } + public BodyHealthValue? RightLeg + { + get; + set; + } } public record BodyHealthValue { [JsonPropertyName("Value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record Influences { [JsonPropertyName("LightBleeding")] - public Influence? LightBleeding { get; set; } + public Influence? LightBleeding + { + get; + set; + } [JsonPropertyName("HeavyBleeding")] - public Influence? HeavyBleeding { get; set; } + public Influence? HeavyBleeding + { + get; + set; + } [JsonPropertyName("Fracture")] - public Influence? Fracture { get; set; } + public Influence? Fracture + { + get; + set; + } [JsonPropertyName("RadExposure")] - public Influence? RadExposure { get; set; } + public Influence? RadExposure + { + get; + set; + } [JsonPropertyName("Intoxication")] - public Influence? Intoxication { get; set; } + public Influence? Intoxication + { + get; + set; + } } public record Influence { [JsonPropertyName("HealthSlowDownPercentage")] - public double? HealthSlowDownPercentage { get; set; } + public double? HealthSlowDownPercentage + { + get; + set; + } [JsonPropertyName("EnergySlowDownPercentage")] - public double? EnergySlowDownPercentage { get; set; } + public double? EnergySlowDownPercentage + { + get; + set; + } [JsonPropertyName("HydrationSlowDownPercentage")] - public double? HydrationSlowDownPercentage { get; set; } + public double? HydrationSlowDownPercentage + { + get; + set; + } } public record Wound { [JsonPropertyName("WorkingTime")] - public double? WorkingTime { get; set; } + public double? WorkingTime + { + get; + set; + } [JsonPropertyName("ThresholdMin")] - public double? ThresholdMin { get; set; } + public double? ThresholdMin + { + get; + set; + } [JsonPropertyName("ThresholdMax")] - public double? ThresholdMax { get; set; } + public double? ThresholdMax + { + get; + set; + } } public record Berserk { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("WorkingTime")] - public double? WorkingTime { get; set; } + public double? WorkingTime + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } } public record Flash { [JsonPropertyName("Dummy")] - public double? Dummy { get; set; } + public double? Dummy + { + get; + set; + } } public record MedEffect { [JsonPropertyName("LoopTime")] - public double? LoopTime { get; set; } + public double? LoopTime + { + get; + set; + } [JsonPropertyName("StartDelay")] - public double? StartDelay { get; set; } + public double? StartDelay + { + get; + set; + } [JsonPropertyName("DrinkStartDelay")] - public double? DrinkStartDelay { get; set; } + public double? DrinkStartDelay + { + get; + set; + } [JsonPropertyName("FoodStartDelay")] - public double? FoodStartDelay { get; set; } + public double? FoodStartDelay + { + get; + set; + } [JsonPropertyName("DrugsStartDelay")] - public double? DrugsStartDelay { get; set; } + public double? DrugsStartDelay + { + get; + set; + } [JsonPropertyName("MedKitStartDelay")] - public double? MedKitStartDelay { get; set; } + public double? MedKitStartDelay + { + get; + set; + } [JsonPropertyName("MedicalStartDelay")] - public double? MedicalStartDelay { get; set; } + public double? MedicalStartDelay + { + get; + set; + } [JsonPropertyName("StimulatorStartDelay")] - public double? StimulatorStartDelay { get; set; } + public double? StimulatorStartDelay + { + get; + set; + } } public record Pain { [JsonPropertyName("TremorDelay")] - public double? TremorDelay { get; set; } + public double? TremorDelay + { + get; + set; + } [JsonPropertyName("HealExperience")] - public double? HealExperience { get; set; } + public double? HealExperience + { + get; + set; + } } public record PainKiller { - public double? Dummy { get; set; } + public double? Dummy + { + get; + set; + } } public record SandingScreen { - public double? Dummy { get; set; } + public double? Dummy + { + get; + set; + } } public record MusclePainEffect { - public double? GymEffectivity { get; set; } - public double? OfflineDurationMax { get; set; } - public double? OfflineDurationMin { get; set; } - public double? TraumaChance { get; set; } + public double? GymEffectivity + { + get; + set; + } + + public double? OfflineDurationMax + { + get; + set; + } + + public double? OfflineDurationMin + { + get; + set; + } + + public double? TraumaChance + { + get; + set; + } } public record Stimulator { - public double? BuffLoopTime { get; set; } - public Dictionary>? Buffs { get; set; } + public double? BuffLoopTime + { + get; + set; + } + + public Dictionary>? Buffs + { + get; + set; + } } public record Buff { [JsonPropertyName("BuffType")] - public string? BuffType { get; set; } + public string? BuffType + { + get; + set; + } [JsonPropertyName("Chance")] - public double? Chance { get; set; } + public double? Chance + { + get; + set; + } [JsonPropertyName("Delay")] - public double? Delay { get; set; } + public double? Delay + { + get; + set; + } [JsonPropertyName("Duration")] - public double? Duration { get; set; } + public double? Duration + { + get; + set; + } [JsonPropertyName("Value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("AbsoluteValue")] - public bool? AbsoluteValue { get; set; } + public bool? AbsoluteValue + { + get; + set; + } [JsonPropertyName("SkillName")] - public string? SkillName { get; set; } + public string? SkillName + { + get; + set; + } - public List? AppliesTo { get; set; } + public List? AppliesTo + { + get; + set; + } } public record Tremor { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } } public record ChronicStaminaFatigue { [JsonPropertyName("EnergyRate")] - public double? EnergyRate { get; set; } + public double? EnergyRate + { + get; + set; + } [JsonPropertyName("WorkingTime")] - public double? WorkingTime { get; set; } + public double? WorkingTime + { + get; + set; + } [JsonPropertyName("TicksEvery")] - public double? TicksEvery { get; set; } + public double? TicksEvery + { + get; + set; + } [JsonPropertyName("EnergyRatePerStack")] - public double? EnergyRatePerStack { get; set; } + public double? EnergyRatePerStack + { + get; + set; + } } public record Fracture { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("HealExperience")] - public double? HealExperience { get; set; } + public double? HealExperience + { + get; + set; + } [JsonPropertyName("OfflineDurationMin")] - public double? OfflineDurationMin { get; set; } + public double? OfflineDurationMin + { + get; + set; + } [JsonPropertyName("OfflineDurationMax")] - public double? OfflineDurationMax { get; set; } + public double? OfflineDurationMax + { + get; + set; + } [JsonPropertyName("RemovePrice")] - public double? RemovePrice { get; set; } + public double? RemovePrice + { + get; + set; + } [JsonPropertyName("RemovedAfterDeath")] - public bool? RemovedAfterDeath { get; set; } + public bool? RemovedAfterDeath + { + get; + set; + } [JsonPropertyName("BulletHitProbability")] - public Probability? BulletHitProbability { get; set; } + public Probability? BulletHitProbability + { + get; + set; + } [JsonPropertyName("FallingProbability")] - public Probability? FallingProbability { get; set; } + public Probability? FallingProbability + { + get; + set; + } } public record HeavyBleeding { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("DamageEnergy")] - public double? DamageEnergy { get; set; } + public double? DamageEnergy + { + get; + set; + } [JsonPropertyName("DamageHealth")] - public double? DamageHealth { get; set; } + public double? DamageHealth + { + get; + set; + } [JsonPropertyName("EnergyLoopTime")] - public double? EnergyLoopTime { get; set; } + public double? EnergyLoopTime + { + get; + set; + } [JsonPropertyName("HealthLoopTime")] - public double? HealthLoopTime { get; set; } + public double? HealthLoopTime + { + get; + set; + } [JsonPropertyName("DamageHealthDehydrated")] - public double? DamageHealthDehydrated { get; set; } + public double? DamageHealthDehydrated + { + get; + set; + } [JsonPropertyName("HealthLoopTimeDehydrated")] - public double? HealthLoopTimeDehydrated { get; set; } + public double? HealthLoopTimeDehydrated + { + get; + set; + } [JsonPropertyName("LifeTimeDehydrated")] - public double? LifeTimeDehydrated { get; set; } + public double? LifeTimeDehydrated + { + get; + set; + } [JsonPropertyName("EliteVitalityDuration")] - public double? EliteVitalityDuration { get; set; } + public double? EliteVitalityDuration + { + get; + set; + } [JsonPropertyName("HealExperience")] - public double? HealExperience { get; set; } + public double? HealExperience + { + get; + set; + } [JsonPropertyName("OfflineDurationMin")] - public double? OfflineDurationMin { get; set; } + public double? OfflineDurationMin + { + get; + set; + } [JsonPropertyName("OfflineDurationMax")] - public double? OfflineDurationMax { get; set; } + public double? OfflineDurationMax + { + get; + set; + } [JsonPropertyName("RemovePrice")] - public double? RemovePrice { get; set; } + public double? RemovePrice + { + get; + set; + } [JsonPropertyName("RemovedAfterDeath")] - public bool? RemovedAfterDeath { get; set; } + public bool? RemovedAfterDeath + { + get; + set; + } [JsonPropertyName("Probability")] - public Probability? Probability { get; set; } + public Probability? Probability + { + get; + set; + } } public record Probability { [JsonPropertyName("FunctionType")] - public string? FunctionType { get; set; } + public string? FunctionType + { + get; + set; + } [JsonPropertyName("K")] - public double? K { get; set; } + public double? K + { + get; + set; + } [JsonPropertyName("B")] - public double? B { get; set; } + public double? B + { + get; + set; + } [JsonPropertyName("Threshold")] - public double? Threshold { get; set; } + public double? Threshold + { + get; + set; + } } public record LightBleeding { [JsonPropertyName("DefaultDelay")] - public double? DefaultDelay { get; set; } + public double? DefaultDelay + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("DamageEnergy")] - public double? DamageEnergy { get; set; } + public double? DamageEnergy + { + get; + set; + } [JsonPropertyName("DamageHealth")] - public double? DamageHealth { get; set; } + public double? DamageHealth + { + get; + set; + } [JsonPropertyName("EnergyLoopTime")] - public double? EnergyLoopTime { get; set; } + public double? EnergyLoopTime + { + get; + set; + } [JsonPropertyName("HealthLoopTime")] - public double? HealthLoopTime { get; set; } + public double? HealthLoopTime + { + get; + set; + } [JsonPropertyName("DamageHealthDehydrated")] - public double? DamageHealthDehydrated { get; set; } + public double? DamageHealthDehydrated + { + get; + set; + } [JsonPropertyName("HealthLoopTimeDehydrated")] - public double? HealthLoopTimeDehydrated { get; set; } + public double? HealthLoopTimeDehydrated + { + get; + set; + } [JsonPropertyName("LifeTimeDehydrated")] - public double? LifeTimeDehydrated { get; set; } + public double? LifeTimeDehydrated + { + get; + set; + } [JsonPropertyName("EliteVitalityDuration")] - public double? EliteVitalityDuration { get; set; } + public double? EliteVitalityDuration + { + get; + set; + } [JsonPropertyName("HealExperience")] - public double? HealExperience { get; set; } + public double? HealExperience + { + get; + set; + } [JsonPropertyName("OfflineDurationMin")] - public double? OfflineDurationMin { get; set; } + public double? OfflineDurationMin + { + get; + set; + } [JsonPropertyName("OfflineDurationMax")] - public double? OfflineDurationMax { get; set; } + public double? OfflineDurationMax + { + get; + set; + } [JsonPropertyName("RemovePrice")] - public double? RemovePrice { get; set; } + public double? RemovePrice + { + get; + set; + } [JsonPropertyName("RemovedAfterDeath")] - public bool? RemovedAfterDeath { get; set; } + public bool? RemovedAfterDeath + { + get; + set; + } [JsonPropertyName("Probability")] - public Probability? Probability { get; set; } + public Probability? Probability + { + get; + set; + } } public record BodyTemperature { [JsonPropertyName("DefaultBuildUpTime")] - public double? DefaultBuildUpTime { get; set; } + public double? DefaultBuildUpTime + { + get; + set; + } [JsonPropertyName("DefaultResidueTime")] - public double? DefaultResidueTime { get; set; } + public double? DefaultResidueTime + { + get; + set; + } [JsonPropertyName("LoopTime")] - public double? LoopTime { get; set; } + public double? LoopTime + { + get; + set; + } } public record HealPrice { [JsonPropertyName("HealthPointPrice")] - public double? HealthPointPrice { get; set; } + public double? HealthPointPrice + { + get; + set; + } [JsonPropertyName("HydrationPointPrice")] - public double? HydrationPointPrice { get; set; } + public double? HydrationPointPrice + { + get; + set; + } [JsonPropertyName("EnergyPointPrice")] - public double? EnergyPointPrice { get; set; } + public double? EnergyPointPrice + { + get; + set; + } [JsonPropertyName("TrialLevels")] - public double? TrialLevels { get; set; } + public double? TrialLevels + { + get; + set; + } [JsonPropertyName("TrialRaids")] - public double? TrialRaids { get; set; } + public double? TrialRaids + { + get; + set; + } } public record ProfileHealthSettings { [JsonPropertyName("BodyPartsSettings")] - public BodyPartsSettings? BodyPartsSettings { get; set; } + public BodyPartsSettings? BodyPartsSettings + { + get; + set; + } [JsonPropertyName("HealthFactorsSettings")] - public HealthFactorsSettings? HealthFactorsSettings { get; set; } + public HealthFactorsSettings? HealthFactorsSettings + { + get; + set; + } [JsonPropertyName("DefaultStimulatorBuff")] - public string? DefaultStimulatorBuff { get; set; } + public string? DefaultStimulatorBuff + { + get; + set; + } } public record BodyPartsSettings { [JsonPropertyName("Head")] - public BodyPartsSetting? Head { get; set; } + public BodyPartsSetting? Head + { + get; + set; + } [JsonPropertyName("Chest")] - public BodyPartsSetting? Chest { get; set; } + public BodyPartsSetting? Chest + { + get; + set; + } [JsonPropertyName("Stomach")] - public BodyPartsSetting? Stomach { get; set; } + public BodyPartsSetting? Stomach + { + get; + set; + } [JsonPropertyName("LeftArm")] - public BodyPartsSetting? LeftArm { get; set; } + public BodyPartsSetting? LeftArm + { + get; + set; + } [JsonPropertyName("RightArm")] - public BodyPartsSetting? RightArm { get; set; } + public BodyPartsSetting? RightArm + { + get; + set; + } [JsonPropertyName("LeftLeg")] - public BodyPartsSetting? LeftLeg { get; set; } + public BodyPartsSetting? LeftLeg + { + get; + set; + } [JsonPropertyName("RightLeg")] - public BodyPartsSetting? RightLeg { get; set; } + public BodyPartsSetting? RightLeg + { + get; + set; + } } public record BodyPartsSetting { [JsonPropertyName("Minimum")] - public double? Minimum { get; set; } + public double? Minimum + { + get; + set; + } [JsonPropertyName("Maximum")] - public double? Maximum { get; set; } + public double? Maximum + { + get; + set; + } [JsonPropertyName("Default")] - public double? Default { get; set; } + public double? Default + { + get; + set; + } [JsonPropertyName("EnvironmentDamageMultiplier")] - public float? EnvironmentDamageMultiplier { get; set; } + public float? EnvironmentDamageMultiplier + { + get; + set; + } [JsonPropertyName("OverDamageReceivedMultiplier")] - public float? OverDamageReceivedMultiplier { get; set; } + public float? OverDamageReceivedMultiplier + { + get; + set; + } } public record HealthFactorsSettings { [JsonPropertyName("Energy")] - public HealthFactorSetting? Energy { get; set; } + public HealthFactorSetting? Energy + { + get; + set; + } [JsonPropertyName("Hydration")] - public HealthFactorSetting? Hydration { get; set; } + public HealthFactorSetting? Hydration + { + get; + set; + } [JsonPropertyName("Temperature")] - public HealthFactorSetting? Temperature { get; set; } + public HealthFactorSetting? Temperature + { + get; + set; + } [JsonPropertyName("Poisoning")] - public HealthFactorSetting? Poisoning { get; set; } + public HealthFactorSetting? Poisoning + { + get; + set; + } [JsonPropertyName("Radiation")] - public HealthFactorSetting? Radiation { get; set; } + public HealthFactorSetting? Radiation + { + get; + set; + } } public record HealthFactorSetting { [JsonPropertyName("Minimum")] - public double? Minimum { get; set; } + public double? Minimum + { + get; + set; + } [JsonPropertyName("Maximum")] - public double? Maximum { get; set; } + public double? Maximum + { + get; + set; + } [JsonPropertyName("Default")] - public double? Default { get; set; } + public double? Default + { + get; + set; + } } public record Rating { [JsonPropertyName("levelRequired")] - public double? LevelRequired { get; set; } + public double? LevelRequired + { + get; + set; + } [JsonPropertyName("limit")] - public double? Limit { get; set; } + public double? Limit + { + get; + set; + } [JsonPropertyName("categories")] - public Categories? Categories { get; set; } + public Categories? Categories + { + get; + set; + } } public record Categories { [JsonPropertyName("experience")] - public bool? Experience { get; set; } + public bool? Experience + { + get; + set; + } [JsonPropertyName("kd")] - public bool? Kd { get; set; } + public bool? Kd + { + get; + set; + } [JsonPropertyName("surviveRatio")] - public bool? SurviveRatio { get; set; } + public bool? SurviveRatio + { + get; + set; + } [JsonPropertyName("avgEarnings")] - public bool? AvgEarnings { get; set; } + public bool? AvgEarnings + { + get; + set; + } [JsonPropertyName("pmcKills")] - public bool? PmcKills { get; set; } + public bool? PmcKills + { + get; + set; + } [JsonPropertyName("raidCount")] - public bool? RaidCount { get; set; } + public bool? RaidCount + { + get; + set; + } [JsonPropertyName("longestShot")] - public bool? LongestShot { get; set; } + public bool? LongestShot + { + get; + set; + } [JsonPropertyName("timeOnline")] - public bool? TimeOnline { get; set; } + public bool? TimeOnline + { + get; + set; + } [JsonPropertyName("inventoryFullCost")] - public bool? InventoryFullCost { get; set; } + public bool? InventoryFullCost + { + get; + set; + } [JsonPropertyName("ragFairStanding")] - public bool? RagFairStanding { get; set; } + public bool? RagFairStanding + { + get; + set; + } } public record Tournament { [JsonPropertyName("categories")] - public TournamentCategories? Categories { get; set; } + public TournamentCategories? Categories + { + get; + set; + } [JsonPropertyName("limit")] - public double? Limit { get; set; } + public double? Limit + { + get; + set; + } [JsonPropertyName("levelRequired")] - public double? LevelRequired { get; set; } + public double? LevelRequired + { + get; + set; + } } public record TournamentCategories { [JsonPropertyName("dogtags")] - public bool? Dogtags { get; set; } + public bool? Dogtags + { + get; + set; + } } public record RagFair { [JsonPropertyName("enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("priceStabilizerEnabled")] - public bool? PriceStabilizerEnabled { get; set; } + public bool? PriceStabilizerEnabled + { + get; + set; + } [JsonPropertyName("includePveTraderSales")] - public bool? IncludePveTraderSales { get; set; } + public bool? IncludePveTraderSales + { + get; + set; + } [JsonPropertyName("priceStabilizerStartIntervalInHours")] - public double? PriceStabilizerStartIntervalInHours { get; set; } + public double? PriceStabilizerStartIntervalInHours + { + get; + set; + } // Checked in client [JsonPropertyName("minUserLevel")] - public int? MinUserLevel { get; set; } + public int? MinUserLevel + { + get; + set; + } [JsonPropertyName("communityTax")] - public float? CommunityTax { get; set; } + public float? CommunityTax + { + get; + set; + } [JsonPropertyName("communityItemTax")] - public float? CommunityItemTax { get; set; } + public float? CommunityItemTax + { + get; + set; + } // Checked in client [JsonPropertyName("communityRequirementTax")] - public double? CommunityRequirementTax { get; set; } + public double? CommunityRequirementTax + { + get; + set; + } [JsonPropertyName("offerPriorityCost")] - public float? OfferPriorityCost { get; set; } + public float? OfferPriorityCost + { + get; + set; + } [JsonPropertyName("offerDurationTimeInHour")] - public double? OfferDurationTimeInHour { get; set; } + public double? OfferDurationTimeInHour + { + get; + set; + } [JsonPropertyName("offerDurationTimeInHourAfterRemove")] - public double? OfferDurationTimeInHourAfterRemove { get; set; } + public double? OfferDurationTimeInHourAfterRemove + { + get; + set; + } [JsonPropertyName("priorityTimeModifier")] - public float? PriorityTimeModifier { get; set; } + public float? PriorityTimeModifier + { + get; + set; + } [JsonPropertyName("maxRenewOfferTimeInHour")] - public double? MaxRenewOfferTimeInHour { get; set; } + public double? MaxRenewOfferTimeInHour + { + get; + set; + } [JsonPropertyName("renewPricePerHour")] - public float? RenewPricePerHour { get; set; } + public float? RenewPricePerHour + { + get; + set; + } [JsonPropertyName("maxActiveOfferCount")] - public List? MaxActiveOfferCount { get; set; } + public List? MaxActiveOfferCount + { + get; + set; + } [JsonPropertyName("balancerRemovePriceCoefficient")] - public float? BalancerRemovePriceCoefficient { get; set; } + public float? BalancerRemovePriceCoefficient + { + get; + set; + } [JsonPropertyName("balancerMinPriceCount")] - public float? BalancerMinPriceCount { get; set; } + public float? BalancerMinPriceCount + { + get; + set; + } [JsonPropertyName("balancerAveragePriceCoefficient")] - public float? BalancerAveragePriceCoefficient { get; set; } + public float? BalancerAveragePriceCoefficient + { + get; + set; + } [JsonPropertyName("delaySinceOfferAdd")] - public int? DelaySinceOfferAdd { get; set; } + public int? DelaySinceOfferAdd + { + get; + set; + } [JsonPropertyName("uniqueBuyerTimeoutInDays")] - public double? UniqueBuyerTimeoutInDays { get; set; } + public double? UniqueBuyerTimeoutInDays + { + get; + set; + } [JsonPropertyName("userRatingChangeFrequencyMultiplayer")] - public float? UserRatingChangeFrequencyMultiplayer { get; set; } + public float? UserRatingChangeFrequencyMultiplayer + { + get; + set; + } [JsonPropertyName("RagfairTurnOnTimestamp")] - public long? RagfairTurnOnTimestamp { get; set; } + public long? RagfairTurnOnTimestamp + { + get; + set; + } [JsonPropertyName("ratingSumForIncrease")] - public double? RatingSumForIncrease { get; set; } + public double? RatingSumForIncrease + { + get; + set; + } [JsonPropertyName("ratingIncreaseCount")] - public double? RatingIncreaseCount { get; set; } + public double? RatingIncreaseCount + { + get; + set; + } [JsonPropertyName("ratingSumForDecrease")] - public double? RatingSumForDecrease { get; set; } + public double? RatingSumForDecrease + { + get; + set; + } [JsonPropertyName("ratingDecreaseCount")] - public double? RatingDecreaseCount { get; set; } + public double? RatingDecreaseCount + { + get; + set; + } [JsonPropertyName("maxSumForIncreaseRatingPerOneSale")] - public double? MaxSumForIncreaseRatingPerOneSale { get; set; } + public double? MaxSumForIncreaseRatingPerOneSale + { + get; + set; + } [JsonPropertyName("maxSumForDecreaseRatingPerOneSale")] - public double? MaxSumForDecreaseRatingPerOneSale { get; set; } + public double? MaxSumForDecreaseRatingPerOneSale + { + get; + set; + } [JsonPropertyName("maxSumForRarity")] - public MaxSumForRarity? MaxSumForRarity { get; set; } + public MaxSumForRarity? MaxSumForRarity + { + get; + set; + } [JsonPropertyName("ChangePriceCoef")] - public double? ChangePriceCoef { get; set; } + public double? ChangePriceCoef + { + get; + set; + } [JsonPropertyName("ItemRestrictions")] - public List? ItemRestrictions { get; set; } + public List? ItemRestrictions + { + get; + set; + } [JsonPropertyName("balancerUserItemSaleCooldownEnabled")] - public bool? BalancerUserItemSaleCooldownEnabled { get; set; } + public bool? BalancerUserItemSaleCooldownEnabled + { + get; + set; + } [JsonPropertyName("balancerUserItemSaleCooldown")] - public float? BalancerUserItemSaleCooldown { get; set; } + public float? BalancerUserItemSaleCooldown + { + get; + set; + } [JsonPropertyName("youSellOfferMaxStorageTimeInHour")] - public double? YouSellOfferMaxStorageTimeInHour { get; set; } + public double? YouSellOfferMaxStorageTimeInHour + { + get; + set; + } [JsonPropertyName("yourOfferDidNotSellMaxStorageTimeInHour")] - public double? YourOfferDidNotSellMaxStorageTimeInHour { get; set; } + public double? YourOfferDidNotSellMaxStorageTimeInHour + { + get; + set; + } [JsonPropertyName("isOnlyFoundInRaidAllowed")] - public bool? IsOnlyFoundInRaidAllowed { get; set; } + public bool? IsOnlyFoundInRaidAllowed + { + get; + set; + } [JsonPropertyName("sellInOnePiece")] - public double? SellInOnePiece { get; set; } + public double? SellInOnePiece + { + get; + set; + } } public record ItemGlobalRestrictions { [JsonPropertyName("MaxFlea")] - public double? MaxFlea { get; set; } + public double? MaxFlea + { + get; + set; + } [JsonPropertyName("MaxFleaStacked")] - public double? MaxFleaStacked { get; set; } + public double? MaxFleaStacked + { + get; + set; + } [JsonPropertyName("TemplateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } } public record MaxActiveOfferCount { [JsonPropertyName("from")] - public double? From { get; set; } + public double? From + { + get; + set; + } [JsonPropertyName("to")] - public double? To { get; set; } + public double? To + { + get; + set; + } [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("countForSpecialEditions")] - public double? CountForSpecialEditions { get; set; } + public double? CountForSpecialEditions + { + get; + set; + } } public record MaxSumForRarity { [JsonPropertyName("Common")] - public RarityMaxSum? Common { get; set; } + public RarityMaxSum? Common + { + get; + set; + } [JsonPropertyName("Rare")] - public RarityMaxSum? Rare { get; set; } + public RarityMaxSum? Rare + { + get; + set; + } [JsonPropertyName("Superrare")] - public RarityMaxSum? Superrare { get; set; } + public RarityMaxSum? Superrare + { + get; + set; + } [JsonPropertyName("Not_exist")] - public RarityMaxSum? NotExist { get; set; } + public RarityMaxSum? NotExist + { + get; + set; + } } public record RarityMaxSum { [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record Handbook { [JsonPropertyName("defaultCategory")] - public string? DefaultCategory { get; set; } + public string? DefaultCategory + { + get; + set; + } } public record Stamina { [JsonPropertyName("Capacity")] - public double? Capacity { get; set; } + public double? Capacity + { + get; + set; + } [JsonPropertyName("SprintDrainRate")] - public double? SprintDrainRate { get; set; } + public double? SprintDrainRate + { + get; + set; + } [JsonPropertyName("BaseRestorationRate")] - public double? BaseRestorationRate { get; set; } + public double? BaseRestorationRate + { + get; + set; + } [JsonPropertyName("BipodAimDrainRateMultiplier")] - public double? BipodAimDrainRateMultiplier { get; set; } + public double? BipodAimDrainRateMultiplier + { + get; + set; + } [JsonPropertyName("JumpConsumption")] - public double? JumpConsumption { get; set; } + public double? JumpConsumption + { + get; + set; + } [JsonPropertyName("MountingHorizontalAimDrainRateMultiplier")] - public double? MountingHorizontalAimDrainRateMultiplier { get; set; } + public double? MountingHorizontalAimDrainRateMultiplier + { + get; + set; + } [JsonPropertyName("MountingVerticalAimDrainRateMultiplier")] - public double? MountingVerticalAimDrainRateMultiplier { get; set; } + public double? MountingVerticalAimDrainRateMultiplier + { + get; + set; + } [JsonPropertyName("GrenadeHighThrow")] - public double? GrenadeHighThrow { get; set; } + public double? GrenadeHighThrow + { + get; + set; + } [JsonPropertyName("GrenadeLowThrow")] - public double? GrenadeLowThrow { get; set; } + public double? GrenadeLowThrow + { + get; + set; + } [JsonPropertyName("AimDrainRate")] - public double? AimDrainRate { get; set; } + public double? AimDrainRate + { + get; + set; + } [JsonPropertyName("AimRangeFinderDrainRate")] - public double? AimRangeFinderDrainRate { get; set; } + public double? AimRangeFinderDrainRate + { + get; + set; + } [JsonPropertyName("OxygenCapacity")] - public double? OxygenCapacity { get; set; } + public double? OxygenCapacity + { + get; + set; + } [JsonPropertyName("OxygenRestoration")] - public double? OxygenRestoration { get; set; } + public double? OxygenRestoration + { + get; + set; + } [JsonPropertyName("WalkOverweightLimits")] - public XYZ? WalkOverweightLimits { get; set; } + public XYZ? WalkOverweightLimits + { + get; + set; + } [JsonPropertyName("BaseOverweightLimits")] - public XYZ? BaseOverweightLimits { get; set; } + public XYZ? BaseOverweightLimits + { + get; + set; + } [JsonPropertyName("SprintOverweightLimits")] - public XYZ? SprintOverweightLimits { get; set; } + public XYZ? SprintOverweightLimits + { + get; + set; + } [JsonPropertyName("WalkSpeedOverweightLimits")] - public XYZ? WalkSpeedOverweightLimits { get; set; } + public XYZ? WalkSpeedOverweightLimits + { + get; + set; + } [JsonPropertyName("CrouchConsumption")] - public XYZ? CrouchConsumption { get; set; } + public XYZ? CrouchConsumption + { + get; + set; + } [JsonPropertyName("WalkConsumption")] - public XYZ? WalkConsumption { get; set; } + public XYZ? WalkConsumption + { + get; + set; + } [JsonPropertyName("StandupConsumption")] - public XYZ? StandupConsumption { get; set; } + public XYZ? StandupConsumption + { + get; + set; + } [JsonPropertyName("TransitionSpeed")] - public XYZ? TransitionSpeed { get; set; } + public XYZ? TransitionSpeed + { + get; + set; + } [JsonPropertyName("SprintAccelerationLowerLimit")] - public double? SprintAccelerationLowerLimit { get; set; } + public double? SprintAccelerationLowerLimit + { + get; + set; + } [JsonPropertyName("SprintSpeedLowerLimit")] - public double? SprintSpeedLowerLimit { get; set; } + public double? SprintSpeedLowerLimit + { + get; + set; + } [JsonPropertyName("SprintSensitivityLowerLimit")] - public double? SprintSensitivityLowerLimit { get; set; } + public double? SprintSensitivityLowerLimit + { + get; + set; + } [JsonPropertyName("AimConsumptionByPose")] - public XYZ? AimConsumptionByPose { get; set; } + public XYZ? AimConsumptionByPose + { + get; + set; + } [JsonPropertyName("RestorationMultiplierByPose")] - public XYZ? RestorationMultiplierByPose { get; set; } + public XYZ? RestorationMultiplierByPose + { + get; + set; + } [JsonPropertyName("OverweightConsumptionByPose")] - public XYZ? OverweightConsumptionByPose { get; set; } + public XYZ? OverweightConsumptionByPose + { + get; + set; + } [JsonPropertyName("AimingSpeedMultiplier")] - public double? AimingSpeedMultiplier { get; set; } + public double? AimingSpeedMultiplier + { + get; + set; + } [JsonPropertyName("WalkVisualEffectMultiplier")] - public double? WalkVisualEffectMultiplier { get; set; } + public double? WalkVisualEffectMultiplier + { + get; + set; + } [JsonPropertyName("WeaponFastSwitchConsumption")] - public double? WeaponFastSwitchConsumption { get; set; } + public double? WeaponFastSwitchConsumption + { + get; + set; + } [JsonPropertyName("HandsCapacity")] - public double? HandsCapacity { get; set; } + public double? HandsCapacity + { + get; + set; + } [JsonPropertyName("HandsRestoration")] - public double? HandsRestoration { get; set; } + public double? HandsRestoration + { + get; + set; + } [JsonPropertyName("ProneConsumption")] - public double? ProneConsumption { get; set; } + public double? ProneConsumption + { + get; + set; + } [JsonPropertyName("BaseHoldBreathConsumption")] - public double? BaseHoldBreathConsumption { get; set; } + public double? BaseHoldBreathConsumption + { + get; + set; + } [JsonPropertyName("SoundRadius")] - public XYZ? SoundRadius { get; set; } + public XYZ? SoundRadius + { + get; + set; + } [JsonPropertyName("ExhaustedMeleeSpeed")] - public double? ExhaustedMeleeSpeed { get; set; } + public double? ExhaustedMeleeSpeed + { + get; + set; + } [JsonPropertyName("FatigueRestorationRate")] - public double? FatigueRestorationRate { get; set; } + public double? FatigueRestorationRate + { + get; + set; + } [JsonPropertyName("FatigueAmountToCreateEffect")] - public double? FatigueAmountToCreateEffect { get; set; } + public double? FatigueAmountToCreateEffect + { + get; + set; + } [JsonPropertyName("ExhaustedMeleeDamageMultiplier")] - public double? ExhaustedMeleeDamageMultiplier { get; set; } + public double? ExhaustedMeleeDamageMultiplier + { + get; + set; + } [JsonPropertyName("FallDamageMultiplier")] - public double? FallDamageMultiplier { get; set; } + public double? FallDamageMultiplier + { + get; + set; + } [JsonPropertyName("SafeHeightOverweight")] - public double? SafeHeightOverweight { get; set; } + public double? SafeHeightOverweight + { + get; + set; + } [JsonPropertyName("SitToStandConsumption")] - public double? SitToStandConsumption { get; set; } + public double? SitToStandConsumption + { + get; + set; + } [JsonPropertyName("StaminaExhaustionCausesJiggle")] - public bool? StaminaExhaustionCausesJiggle { get; set; } + public bool? StaminaExhaustionCausesJiggle + { + get; + set; + } [JsonPropertyName("StaminaExhaustionStartsBreathSound")] - public bool? StaminaExhaustionStartsBreathSound { get; set; } + public bool? StaminaExhaustionStartsBreathSound + { + get; + set; + } [JsonPropertyName("StaminaExhaustionRocksCamera")] - public bool? StaminaExhaustionRocksCamera { get; set; } + public bool? StaminaExhaustionRocksCamera + { + get; + set; + } [JsonPropertyName("HoldBreathStaminaMultiplier")] - public XYZ? HoldBreathStaminaMultiplier { get; set; } + public XYZ? HoldBreathStaminaMultiplier + { + get; + set; + } [JsonPropertyName("PoseLevelIncreaseSpeed")] - public XYZ? PoseLevelIncreaseSpeed { get; set; } + public XYZ? PoseLevelIncreaseSpeed + { + get; + set; + } [JsonPropertyName("PoseLevelDecreaseSpeed")] - public XYZ? PoseLevelDecreaseSpeed { get; set; } + public XYZ? PoseLevelDecreaseSpeed + { + get; + set; + } [JsonPropertyName("PoseLevelConsumptionPerNotch")] - public XYZ? PoseLevelConsumptionPerNotch { get; set; } + public XYZ? PoseLevelConsumptionPerNotch + { + get; + set; + } - public XYZ? ClimbLegsConsumption { get; set; } - public XYZ? ClimbOneHandConsumption { get; set; } - public XYZ? ClimbTwoHandsConsumption { get; set; } - public XYZ? VaultLegsConsumption { get; set; } - public XYZ? VaultOneHandConsumption { get; set; } + public XYZ? ClimbLegsConsumption + { + get; + set; + } + + public XYZ? ClimbOneHandConsumption + { + get; + set; + } + + public XYZ? ClimbTwoHandsConsumption + { + get; + set; + } + + public XYZ? VaultLegsConsumption + { + get; + set; + } + + public XYZ? VaultOneHandConsumption + { + get; + set; + } } public record StaminaRestoration { [JsonPropertyName("LowerLeftPoint")] - public double? LowerLeftPoint { get; set; } + public double? LowerLeftPoint + { + get; + set; + } [JsonPropertyName("LowerRightPoint")] - public double? LowerRightPoint { get; set; } + public double? LowerRightPoint + { + get; + set; + } [JsonPropertyName("LeftPlatoPoint")] - public double? LeftPlatoPoint { get; set; } + public double? LeftPlatoPoint + { + get; + set; + } [JsonPropertyName("RightPlatoPoint")] - public double? RightPlatoPoint { get; set; } + public double? RightPlatoPoint + { + get; + set; + } [JsonPropertyName("RightLimit")] - public double? RightLimit { get; set; } + public double? RightLimit + { + get; + set; + } [JsonPropertyName("ZeroValue")] - public double? ZeroValue { get; set; } + public double? ZeroValue + { + get; + set; + } } public record StaminaDrain { [JsonPropertyName("LowerLeftPoint")] - public double? LowerLeftPoint { get; set; } + public double? LowerLeftPoint + { + get; + set; + } [JsonPropertyName("LowerRightPoint")] - public double? LowerRightPoint { get; set; } + public double? LowerRightPoint + { + get; + set; + } [JsonPropertyName("LeftPlatoPoint")] - public double? LeftPlatoPoint { get; set; } + public double? LeftPlatoPoint + { + get; + set; + } [JsonPropertyName("RightPlatoPoint")] - public double? RightPlatoPoint { get; set; } + public double? RightPlatoPoint + { + get; + set; + } [JsonPropertyName("RightLimit")] - public double? RightLimit { get; set; } + public double? RightLimit + { + get; + set; + } [JsonPropertyName("ZeroValue")] - public double? ZeroValue { get; set; } + public double? ZeroValue + { + get; + set; + } } public record RequirementReferences { [JsonPropertyName("Alpinist")] - public List? Alpinists { get; set; } + public List? Alpinists + { + get; + set; + } } public record Alpinist { [JsonPropertyName("Requirement")] - public string? Requirement { get; set; } + public string? Requirement + { + get; + set; + } [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("RequiredSlot")] - public string? RequiredSlot { get; set; } + public string? RequiredSlot + { + get; + set; + } [JsonPropertyName("RequirementTip")] - public string? RequirementTip { get; set; } + public string? RequirementTip + { + get; + set; + } } public record RestrictionsInRaid { [JsonPropertyName("MaxInLobby")] - public double? MaxInLobby { get; set; } + public double? MaxInLobby + { + get; + set; + } [JsonPropertyName("MaxInRaid")] - public double? MaxInRaid { get; set; } + public double? MaxInRaid + { + get; + set; + } [JsonPropertyName("TemplateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } } public record FavoriteItemsSettings { [JsonPropertyName("WeaponStandMaxItemsCount")] - public double? WeaponStandMaxItemsCount { get; set; } + public double? WeaponStandMaxItemsCount + { + get; + set; + } [JsonPropertyName("PlaceOfFameMaxItemsCount")] - public double? PlaceOfFameMaxItemsCount { get; set; } + public double? PlaceOfFameMaxItemsCount + { + get; + set; + } } public record VaultingSettings { [JsonPropertyName("IsActive")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } [JsonPropertyName("VaultingInputTime")] - public double? VaultingInputTime { get; set; } + public double? VaultingInputTime + { + get; + set; + } [JsonPropertyName("GridSettings")] - public VaultingGridSettings? GridSettings { get; set; } + public VaultingGridSettings? GridSettings + { + get; + set; + } [JsonPropertyName("MovesSettings")] - public VaultingMovesSettings? MovesSettings { get; set; } + public VaultingMovesSettings? MovesSettings + { + get; + set; + } } public record VaultingGridSettings { [JsonPropertyName("GridSizeX")] - public double? GridSizeX { get; set; } + public double? GridSizeX + { + get; + set; + } [JsonPropertyName("GridSizeY")] - public double? GridSizeY { get; set; } + public double? GridSizeY + { + get; + set; + } [JsonPropertyName("GridSizeZ")] - public double? GridSizeZ { get; set; } + public double? GridSizeZ + { + get; + set; + } [JsonPropertyName("SteppingLengthX")] - public double? SteppingLengthX { get; set; } + public double? SteppingLengthX + { + get; + set; + } [JsonPropertyName("SteppingLengthY")] - public double? SteppingLengthY { get; set; } + public double? SteppingLengthY + { + get; + set; + } [JsonPropertyName("SteppingLengthZ")] - public double? SteppingLengthZ { get; set; } + public double? SteppingLengthZ + { + get; + set; + } [JsonPropertyName("GridOffsetX")] - public double? GridOffsetX { get; set; } + public double? GridOffsetX + { + get; + set; + } [JsonPropertyName("GridOffsetY")] - public double? GridOffsetY { get; set; } + public double? GridOffsetY + { + get; + set; + } [JsonPropertyName("GridOffsetZ")] - public double? GridOffsetZ { get; set; } + public double? GridOffsetZ + { + get; + set; + } [JsonPropertyName("OffsetFactor")] - public double? OffsetFactor { get; set; } + public double? OffsetFactor + { + get; + set; + } } public record VaultingMovesSettings { [JsonPropertyName("VaultSettings")] - public VaultingSubMoveSettings? VaultSettings { get; set; } + public VaultingSubMoveSettings? VaultSettings + { + get; + set; + } [JsonPropertyName("ClimbSettings")] - public VaultingSubMoveSettings? ClimbSettings { get; set; } + public VaultingSubMoveSettings? ClimbSettings + { + get; + set; + } } public record VaultingSubMoveSettings { [JsonPropertyName("IsActive")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } [JsonPropertyName("MaxWithoutHandHeight")] - public double? MaxWithoutHandHeight { get; set; } + public double? MaxWithoutHandHeight + { + get; + set; + } - public double? MaxOneHandHeight { get; set; } + public double? MaxOneHandHeight + { + get; + set; + } [JsonPropertyName("SpeedRange")] - public XYZ? SpeedRange { get; set; } + public XYZ? SpeedRange + { + get; + set; + } [JsonPropertyName("MoveRestrictions")] - public MoveRestrictions? MoveRestrictions { get; set; } + public MoveRestrictions? MoveRestrictions + { + get; + set; + } [JsonPropertyName("AutoMoveRestrictions")] - public MoveRestrictions? AutoMoveRestrictions { get; set; } + public MoveRestrictions? AutoMoveRestrictions + { + get; + set; + } } public record MoveRestrictions { [JsonPropertyName("IsActive")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } [JsonPropertyName("MinDistantToInteract")] - public double? MinDistantToInteract { get; set; } + public double? MinDistantToInteract + { + get; + set; + } [JsonPropertyName("MinHeight")] - public double? MinHeight { get; set; } + public double? MinHeight + { + get; + set; + } [JsonPropertyName("MaxHeight")] - public double? MaxHeight { get; set; } + public double? MaxHeight + { + get; + set; + } [JsonPropertyName("MinLength")] - public double? MinLength { get; set; } + public double? MinLength + { + get; + set; + } [JsonPropertyName("MaxLength")] - public double? MaxLength { get; set; } + public double? MaxLength + { + get; + set; + } } public record BTRSettings { [JsonPropertyName("LocationsWithBTR")] - public List? LocationsWithBTR { get; set; } + public List? LocationsWithBTR + { + get; + set; + } [JsonPropertyName("BasePriceTaxi")] - public double? BasePriceTaxi { get; set; } + public double? BasePriceTaxi + { + get; + set; + } [JsonPropertyName("AddPriceTaxi")] - public double? AddPriceTaxi { get; set; } + public double? AddPriceTaxi + { + get; + set; + } [JsonPropertyName("CleanUpPrice")] - public double? CleanUpPrice { get; set; } + public double? CleanUpPrice + { + get; + set; + } [JsonPropertyName("DeliveryPrice")] - public double? DeliveryPrice { get; set; } + public double? DeliveryPrice + { + get; + set; + } [JsonPropertyName("ModDeliveryCost")] - public double? ModDeliveryCost { get; set; } + public double? ModDeliveryCost + { + get; + set; + } [JsonPropertyName("BearPriceMod")] - public double? BearPriceMod { get; set; } + public double? BearPriceMod + { + get; + set; + } [JsonPropertyName("UsecPriceMod")] - public double? UsecPriceMod { get; set; } + public double? UsecPriceMod + { + get; + set; + } [JsonPropertyName("ScavPriceMod")] - public double? ScavPriceMod { get; set; } + public double? ScavPriceMod + { + get; + set; + } [JsonPropertyName("CoefficientDiscountCharisma")] - public double? CoefficientDiscountCharisma { get; set; } + public double? CoefficientDiscountCharisma + { + get; + set; + } [JsonPropertyName("DeliveryMinPrice")] - public double? DeliveryMinPrice { get; set; } + public double? DeliveryMinPrice + { + get; + set; + } [JsonPropertyName("TaxiMinPrice")] - public double? TaxiMinPrice { get; set; } + public double? TaxiMinPrice + { + get; + set; + } [JsonPropertyName("BotCoverMinPrice")] - public double? BotCoverMinPrice { get; set; } + public double? BotCoverMinPrice + { + get; + set; + } [JsonPropertyName("MapsConfigs")] - public Dictionary? MapsConfigs { get; set; } + public Dictionary? MapsConfigs + { + get; + set; + } [JsonPropertyName("DiameterWheel")] - public double? DiameterWheel { get; set; } + public double? DiameterWheel + { + get; + set; + } [JsonPropertyName("HeightWheel")] - public double? HeightWheel { get; set; } + public double? HeightWheel + { + get; + set; + } [JsonPropertyName("HeightWheelMaxPosLimit")] - public double? HeightWheelMaxPosLimit { get; set; } + public double? HeightWheelMaxPosLimit + { + get; + set; + } [JsonPropertyName("HeightWheelMinPosLimit")] - public double? HeightWheelMinPosLimit { get; set; } + public double? HeightWheelMinPosLimit + { + get; + set; + } [JsonPropertyName("SnapToSurfaceWheelsSpeed")] - public double? SnapToSurfaceWheelsSpeed { get; set; } + public double? SnapToSurfaceWheelsSpeed + { + get; + set; + } [JsonPropertyName("CheckSurfaceForWheelsTimer")] - public double? CheckSurfaceForWheelsTimer { get; set; } + public double? CheckSurfaceForWheelsTimer + { + get; + set; + } [JsonPropertyName("HeightWheelOffset")] - public double? HeightWheelOffset { get; set; } + public double? HeightWheelOffset + { + get; + set; + } } public record BtrMapConfig { [JsonPropertyName("BtrSkin")] - public string? BtrSkin { get; set; } + public string? BtrSkin + { + get; + set; + } [JsonPropertyName("CheckSurfaceForWheelsTimer")] - public double? CheckSurfaceForWheelsTimer { get; set; } + public double? CheckSurfaceForWheelsTimer + { + get; + set; + } [JsonPropertyName("DiameterWheel")] - public double? DiameterWheel { get; set; } + public double? DiameterWheel + { + get; + set; + } [JsonPropertyName("HeightWheel")] - public double? HeightWheel { get; set; } + public double? HeightWheel + { + get; + set; + } [JsonPropertyName("HeightWheelMaxPosLimit")] - public double? HeightWheelMaxPosLimit { get; set; } + public double? HeightWheelMaxPosLimit + { + get; + set; + } [JsonPropertyName("HeightWheelMinPosLimit")] - public double? HeightWheelMinPosLimit { get; set; } + public double? HeightWheelMinPosLimit + { + get; + set; + } [JsonPropertyName("HeightWheelOffset")] - public double? HeightWheelOffset { get; set; } + public double? HeightWheelOffset + { + get; + set; + } [JsonPropertyName("SnapToSurfaceWheelsSpeed")] - public double? SnapToSurfaceWheelsSpeed { get; set; } + public double? SnapToSurfaceWheelsSpeed + { + get; + set; + } [JsonPropertyName("SuspensionDamperStiffness")] - public double? SuspensionDamperStiffness { get; set; } + public double? SuspensionDamperStiffness + { + get; + set; + } [JsonPropertyName("SuspensionRestLength")] - public double? SuspensionRestLength { get; set; } + public double? SuspensionRestLength + { + get; + set; + } [JsonPropertyName("SuspensionSpringStiffness")] - public double? SuspensionSpringStiffness { get; set; } + public double? SuspensionSpringStiffness + { + get; + set; + } [JsonPropertyName("SuspensionTravel")] - public double? SuspensionTravel { get; set; } + public double? SuspensionTravel + { + get; + set; + } [JsonPropertyName("SuspensionWheelRadius")] - public double? SuspensionWheelRadius { get; set; } + public double? SuspensionWheelRadius + { + get; + set; + } [JsonPropertyName("mapID")] - public string? MapID { get; set; } + public string? MapID + { + get; + set; + } [JsonPropertyName("pathsConfigurations")] - public List? PathsConfigurations { get; set; } + public List? PathsConfigurations + { + get; + set; + } } public record PathConfig { [JsonPropertyName("active")] - public bool? Active { get; set; } + public bool? Active + { + get; + set; + } [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("enterPoint")] - public string? EnterPoint { get; set; } + public string? EnterPoint + { + get; + set; + } [JsonPropertyName("exitPoint")] - public string? ExitPoint { get; set; } + public string? ExitPoint + { + get; + set; + } [JsonPropertyName("pathPoints")] - public List? PathPoints { get; set; } + public List? PathPoints + { + get; + set; + } [JsonPropertyName("once")] - public bool? Once { get; set; } + public bool? Once + { + get; + set; + } [JsonPropertyName("circle")] - public bool? Circle { get; set; } + public bool? Circle + { + get; + set; + } [JsonPropertyName("circleCount")] - public double? CircleCount { get; set; } + public double? CircleCount + { + get; + set; + } [JsonPropertyName("skinType")] - public List? SkinType { get; set; } + public List? SkinType + { + get; + set; + } } public record SquadSettings { [JsonPropertyName("CountOfRequestsToOnePlayer")] - public double? CountOfRequestsToOnePlayer { get; set; } + public double? CountOfRequestsToOnePlayer + { + get; + set; + } [JsonPropertyName("SecondsForExpiredRequest")] - public double? SecondsForExpiredRequest { get; set; } + public double? SecondsForExpiredRequest + { + get; + set; + } [JsonPropertyName("SendRequestDelaySeconds")] - public double? SendRequestDelaySeconds { get; set; } + public double? SendRequestDelaySeconds + { + get; + set; + } } public record Insurance { [JsonPropertyName("ChangeForReturnItemsInOfflineRaid")] - public double? ChangeForReturnItemsInOfflineRaid { get; set; } + public double? ChangeForReturnItemsInOfflineRaid + { + get; + set; + } [JsonPropertyName("MaxStorageTimeInHour")] - public double? MaxStorageTimeInHour { get; set; } + public double? MaxStorageTimeInHour + { + get; + set; + } [JsonPropertyName("CoefOfSendingMessageTime")] - public double? CoefOfSendingMessageTime { get; set; } + public double? CoefOfSendingMessageTime + { + get; + set; + } [JsonPropertyName("CoefOfHavingMarkOfUnknown")] - public double? CoefOfHavingMarkOfUnknown { get; set; } + public double? CoefOfHavingMarkOfUnknown + { + get; + set; + } [JsonPropertyName("EditionSendingMessageTime")] - public Dictionary? EditionSendingMessageTime { get; set; } + public Dictionary? EditionSendingMessageTime + { + get; + set; + } [JsonPropertyName("OnlyInDeathCase")] - public bool? OnlyInDeathCase { get; set; } + public bool? OnlyInDeathCase + { + get; + set; + } } public record MessageSendTimeMultiplier { [JsonPropertyName("multiplier")] - public double? Multiplier { get; set; } + public double? Multiplier + { + get; + set; + } } public record SkillsSettings { [JsonPropertyName("SkillProgressRate")] - public double? SkillProgressRate { get; set; } + public double? SkillProgressRate + { + get; + set; + } [JsonPropertyName("WeaponSkillProgressRate")] - public double? WeaponSkillProgressRate { get; set; } + public double? WeaponSkillProgressRate + { + get; + set; + } [JsonPropertyName("WeaponSkillRecoilBonusPerLevel")] - public double? WeaponSkillRecoilBonusPerLevel { get; set; } + public double? WeaponSkillRecoilBonusPerLevel + { + get; + set; + } [JsonPropertyName("HideoutManagement")] - public HideoutManagement? HideoutManagement { get; set; } + public HideoutManagement? HideoutManagement + { + get; + set; + } [JsonPropertyName("Crafting")] - public Crafting? Crafting { get; set; } + public Crafting? Crafting + { + get; + set; + } [JsonPropertyName("Metabolism")] - public Metabolism? Metabolism { get; set; } + public Metabolism? Metabolism + { + get; + set; + } [JsonPropertyName("MountingErgonomicsBonusPerLevel")] - public double? MountingErgonomicsBonusPerLevel { get; set; } + public double? MountingErgonomicsBonusPerLevel + { + get; + set; + } [JsonPropertyName("Immunity")] - public Immunity? Immunity { get; set; } + public Immunity? Immunity + { + get; + set; + } [JsonPropertyName("Endurance")] - public Endurance? Endurance { get; set; } + public Endurance? Endurance + { + get; + set; + } [JsonPropertyName("Strength")] - public Strength? Strength { get; set; } + public Strength? Strength + { + get; + set; + } [JsonPropertyName("Vitality")] - public Vitality? Vitality { get; set; } + public Vitality? Vitality + { + get; + set; + } [JsonPropertyName("Health")] - public HealthSkillProgress? Health { get; set; } + public HealthSkillProgress? Health + { + get; + set; + } [JsonPropertyName("StressResistance")] - public StressResistance? StressResistance { get; set; } + public StressResistance? StressResistance + { + get; + set; + } [JsonPropertyName("Throwing")] - public Throwing? Throwing { get; set; } + public Throwing? Throwing + { + get; + set; + } [JsonPropertyName("RecoilControl")] - public RecoilControl? RecoilControl { get; set; } + public RecoilControl? RecoilControl + { + get; + set; + } [JsonPropertyName("Pistol")] - public WeaponSkills? Pistol { get; set; } + public WeaponSkills? Pistol + { + get; + set; + } [JsonPropertyName("Revolver")] - public WeaponSkills? Revolver { get; set; } + public WeaponSkills? Revolver + { + get; + set; + } [JsonPropertyName("SMG")] - public List? SMG { get; set; } + public List? SMG + { + get; + set; + } [JsonPropertyName("Assault")] - public WeaponSkills? Assault { get; set; } + public WeaponSkills? Assault + { + get; + set; + } [JsonPropertyName("Shotgun")] - public WeaponSkills? Shotgun { get; set; } + public WeaponSkills? Shotgun + { + get; + set; + } [JsonPropertyName("Sniper")] - public WeaponSkills? Sniper { get; set; } + public WeaponSkills? Sniper + { + get; + set; + } [JsonPropertyName("LMG")] - public List? LMG { get; set; } + public List? LMG + { + get; + set; + } [JsonPropertyName("HMG")] - public List? HMG { get; set; } + public List? HMG + { + get; + set; + } [JsonPropertyName("Launcher")] - public List? Launcher { get; set; } + public List? Launcher + { + get; + set; + } [JsonPropertyName("AttachedLauncher")] - public List? AttachedLauncher { get; set; } + public List? AttachedLauncher + { + get; + set; + } [JsonPropertyName("Melee")] - public MeleeSkill? Melee { get; set; } + public MeleeSkill? Melee + { + get; + set; + } [JsonPropertyName("DMR")] - public WeaponSkills? DMR { get; set; } + public WeaponSkills? DMR + { + get; + set; + } [JsonPropertyName("BearAssaultoperations")] - public List? BearAssaultoperations { get; set; } + public List? BearAssaultoperations + { + get; + set; + } [JsonPropertyName("BearAuthority")] - public List? BearAuthority { get; set; } + public List? BearAuthority + { + get; + set; + } [JsonPropertyName("BearAksystems")] - public List? BearAksystems { get; set; } + public List? BearAksystems + { + get; + set; + } [JsonPropertyName("BearHeavycaliber")] - public List? BearHeavycaliber { get; set; } + public List? BearHeavycaliber + { + get; + set; + } [JsonPropertyName("BearRawpower")] - public List? BearRawpower { get; set; } + public List? BearRawpower + { + get; + set; + } [JsonPropertyName("BipodErgonomicsBonusPerLevel")] - public double? BipodErgonomicsBonusPerLevel { get; set; } + public double? BipodErgonomicsBonusPerLevel + { + get; + set; + } [JsonPropertyName("UsecArsystems")] - public List? UsecArsystems { get; set; } + public List? UsecArsystems + { + get; + set; + } [JsonPropertyName("UsecDeepweaponmodding_Settings")] - public List? UsecDeepweaponmodding_Settings { get; set; } + public List? UsecDeepweaponmodding_Settings + { + get; + set; + } [JsonPropertyName("UsecLongrangeoptics_Settings")] - public List? UsecLongrangeoptics_Settings { get; set; } + public List? UsecLongrangeoptics_Settings + { + get; + set; + } [JsonPropertyName("UsecNegotiations")] - public List? UsecNegotiations { get; set; } + public List? UsecNegotiations + { + get; + set; + } [JsonPropertyName("UsecTactics")] - public List? UsecTactics { get; set; } + public List? UsecTactics + { + get; + set; + } [JsonPropertyName("BotReload")] - public List? BotReload { get; set; } + public List? BotReload + { + get; + set; + } [JsonPropertyName("CovertMovement")] - public CovertMovement? CovertMovement { get; set; } + public CovertMovement? CovertMovement + { + get; + set; + } [JsonPropertyName("FieldMedicine")] - public List? FieldMedicine { get; set; } + public List? FieldMedicine + { + get; + set; + } [JsonPropertyName("Search")] - public Search? Search { get; set; } + public Search? Search + { + get; + set; + } [JsonPropertyName("Sniping")] - public List? Sniping { get; set; } + public List? Sniping + { + get; + set; + } [JsonPropertyName("ProneMovement")] - public List? ProneMovement { get; set; } + public List? ProneMovement + { + get; + set; + } [JsonPropertyName("FirstAid")] - public List? FirstAid { get; set; } + public List? FirstAid + { + get; + set; + } [JsonPropertyName("LightVests")] - public ArmorSkills? LightVests { get; set; } + public ArmorSkills? LightVests + { + get; + set; + } [JsonPropertyName("HeavyVests")] - public ArmorSkills? HeavyVests { get; set; } + public ArmorSkills? HeavyVests + { + get; + set; + } [JsonPropertyName("WeaponModding")] - public List? WeaponModding { get; set; } + public List? WeaponModding + { + get; + set; + } [JsonPropertyName("AdvancedModding")] - public List? AdvancedModding { get; set; } + public List? AdvancedModding + { + get; + set; + } [JsonPropertyName("NightOps")] - public List? NightOps { get; set; } + public List? NightOps + { + get; + set; + } [JsonPropertyName("SilentOps")] - public List? SilentOps { get; set; } + public List? SilentOps + { + get; + set; + } [JsonPropertyName("Lockpicking")] - public List? Lockpicking { get; set; } + public List? Lockpicking + { + get; + set; + } [JsonPropertyName("WeaponTreatment")] - public WeaponTreatment? WeaponTreatment { get; set; } + public WeaponTreatment? WeaponTreatment + { + get; + set; + } [JsonPropertyName("MagDrills")] - public MagDrills? MagDrills { get; set; } + public MagDrills? MagDrills + { + get; + set; + } [JsonPropertyName("Freetrading")] - public List? Freetrading { get; set; } + public List? Freetrading + { + get; + set; + } [JsonPropertyName("Auctions")] - public List? Auctions { get; set; } + public List? Auctions + { + get; + set; + } [JsonPropertyName("Cleanoperations")] - public List? Cleanoperations { get; set; } + public List? Cleanoperations + { + get; + set; + } [JsonPropertyName("Barter")] - public List? Barter { get; set; } + public List? Barter + { + get; + set; + } [JsonPropertyName("Shadowconnections")] - public List? Shadowconnections { get; set; } + public List? Shadowconnections + { + get; + set; + } [JsonPropertyName("Taskperformance")] - public List? Taskperformance { get; set; } + public List? Taskperformance + { + get; + set; + } [JsonPropertyName("Perception")] - public Perception? Perception { get; set; } + public Perception? Perception + { + get; + set; + } [JsonPropertyName("Intellect")] - public Intellect? Intellect { get; set; } + public Intellect? Intellect + { + get; + set; + } [JsonPropertyName("Attention")] - public Attention? Attention { get; set; } + public Attention? Attention + { + get; + set; + } [JsonPropertyName("Charisma")] - public Charisma? Charisma { get; set; } + public Charisma? Charisma + { + get; + set; + } [JsonPropertyName("Memory")] - public Memory? Memory { get; set; } + public Memory? Memory + { + get; + set; + } [JsonPropertyName("Surgery")] - public Surgery? Surgery { get; set; } + public Surgery? Surgery + { + get; + set; + } [JsonPropertyName("AimDrills")] - public AimDrills? AimDrills { get; set; } + public AimDrills? AimDrills + { + get; + set; + } [JsonPropertyName("BotSound")] - public List? BotSound { get; set; } + public List? BotSound + { + get; + set; + } [JsonPropertyName("TroubleShooting")] - public TroubleShooting? TroubleShooting { get; set; } + public TroubleShooting? TroubleShooting + { + get; + set; + } } public record MeleeSkill { - public BuffSettings? BuffSettings { get; set; } + public BuffSettings? BuffSettings + { + get; + set; + } } public record ArmorSkills { - public double? BluntThroughputDamageHVestsReducePerLevel { get; set; } - public double? WearAmountRepairHVestsReducePerLevel { get; set; } - public double? WearChanceRepairHVestsReduceEliteLevel { get; set; } - public double? BuffMaxCount { get; set; } - public BuffSettings? BuffSettings { get; set; } - public ArmorCounters? Counters { get; set; } - public double? MoveSpeedPenaltyReductionHVestsReducePerLevel { get; set; } - public double? RicochetChanceHVestsCurrentDurabilityThreshold { get; set; } - public double? RicochetChanceHVestsEliteLevel { get; set; } - public double? RicochetChanceHVestsMaxDurabilityThreshold { get; set; } - public double? MeleeDamageLVestsReducePerLevel { get; set; } - public double? MoveSpeedPenaltyReductionLVestsReducePerLevel { get; set; } - public double? WearAmountRepairLVestsReducePerLevel { get; set; } - public double? WearChanceRepairLVestsReduceEliteLevel { get; set; } + public double? BluntThroughputDamageHVestsReducePerLevel + { + get; + set; + } + + public double? WearAmountRepairHVestsReducePerLevel + { + get; + set; + } + + public double? WearChanceRepairHVestsReduceEliteLevel + { + get; + set; + } + + public double? BuffMaxCount + { + get; + set; + } + + public BuffSettings? BuffSettings + { + get; + set; + } + + public ArmorCounters? Counters + { + get; + set; + } + + public double? MoveSpeedPenaltyReductionHVestsReducePerLevel + { + get; + set; + } + + public double? RicochetChanceHVestsCurrentDurabilityThreshold + { + get; + set; + } + + public double? RicochetChanceHVestsEliteLevel + { + get; + set; + } + + public double? RicochetChanceHVestsMaxDurabilityThreshold + { + get; + set; + } + + public double? MeleeDamageLVestsReducePerLevel + { + get; + set; + } + + public double? MoveSpeedPenaltyReductionLVestsReducePerLevel + { + get; + set; + } + + public double? WearAmountRepairLVestsReducePerLevel + { + get; + set; + } + + public double? WearChanceRepairLVestsReduceEliteLevel + { + get; + set; + } } public record ArmorCounters { [JsonPropertyName("armorDurability")] - public SkillCounter? ArmorDurability { get; set; } + public SkillCounter? ArmorDurability + { + get; + set; + } } public record HideoutManagement { - public double? SkillPointsPerAreaUpgrade { get; set; } - public double? SkillPointsPerCraft { get; set; } - public double? CircleOfCultistsBonusPercent { get; set; } - public double? ConsumptionReductionPerLevel { get; set; } - public double? SkillBoostPercent { get; set; } - public SkillPointsRate? SkillPointsRate { get; set; } - public EliteSlots? EliteSlots { get; set; } + public double? SkillPointsPerAreaUpgrade + { + get; + set; + } + + public double? SkillPointsPerCraft + { + get; + set; + } + + public double? CircleOfCultistsBonusPercent + { + get; + set; + } + + public double? ConsumptionReductionPerLevel + { + get; + set; + } + + public double? SkillBoostPercent + { + get; + set; + } + + public SkillPointsRate? SkillPointsRate + { + get; + set; + } + + public EliteSlots? EliteSlots + { + get; + set; + } } public record SkillPointsRate { - public SkillPointRate? Generator { get; set; } - public SkillPointRate? AirFilteringUnit { get; set; } - public SkillPointRate? WaterCollector { get; set; } - public SkillPointRate? SolarPower { get; set; } + public SkillPointRate? Generator + { + get; + set; + } + + public SkillPointRate? AirFilteringUnit + { + get; + set; + } + + public SkillPointRate? WaterCollector + { + get; + set; + } + + public SkillPointRate? SolarPower + { + get; + set; + } } public record SkillPointRate { - public double? ResourceSpent { get; set; } - public double? PointsGained { get; set; } + public double? ResourceSpent + { + get; + set; + } + + public double? PointsGained + { + get; + set; + } } public record EliteSlots { - public EliteSlot? Generator { get; set; } - public EliteSlot? AirFilteringUnit { get; set; } - public EliteSlot? WaterCollector { get; set; } - public EliteSlot? BitcoinFarm { get; set; } + public EliteSlot? Generator + { + get; + set; + } + + public EliteSlot? AirFilteringUnit + { + get; + set; + } + + public EliteSlot? WaterCollector + { + get; + set; + } + + public EliteSlot? BitcoinFarm + { + get; + set; + } } public record EliteSlot { - public double? Slots { get; set; } - public double? Container { get; set; } + public double? Slots + { + get; + set; + } + + public double? Container + { + get; + set; + } } public record Crafting { [JsonPropertyName("DependentSkillRatios")] - public List? DependentSkillRatios { get; set; } + public List? DependentSkillRatios + { + get; + set; + } [JsonPropertyName("PointsPerCraftingCycle")] - public double? PointsPerCraftingCycle { get; set; } + public double? PointsPerCraftingCycle + { + get; + set; + } [JsonPropertyName("CraftingCycleHours")] - public double? CraftingCycleHours { get; set; } + public double? CraftingCycleHours + { + get; + set; + } [JsonPropertyName("PointsPerUniqueCraftCycle")] - public double? PointsPerUniqueCraftCycle { get; set; } + public double? PointsPerUniqueCraftCycle + { + get; + set; + } [JsonPropertyName("UniqueCraftsPerCycle")] - public double? UniqueCraftsPerCycle { get; set; } + public double? UniqueCraftsPerCycle + { + get; + set; + } [JsonPropertyName("CraftTimeReductionPerLevel")] - public double? CraftTimeReductionPerLevel { get; set; } + public double? CraftTimeReductionPerLevel + { + get; + set; + } [JsonPropertyName("ProductionTimeReductionPerLevel")] - public double? ProductionTimeReductionPerLevel { get; set; } + public double? ProductionTimeReductionPerLevel + { + get; + set; + } [JsonPropertyName("EliteExtraProductions")] - public double? EliteExtraProductions { get; set; } + public double? EliteExtraProductions + { + get; + set; + } // Yes, there is a typo [JsonPropertyName("CraftingPointsToInteligence")] - public double? CraftingPointsToIntelligence { get; set; } + public double? CraftingPointsToIntelligence + { + get; + set; + } } public record Metabolism { [JsonPropertyName("HydrationRecoveryRate")] - public double? HydrationRecoveryRate { get; set; } + public double? HydrationRecoveryRate + { + get; + set; + } [JsonPropertyName("EnergyRecoveryRate")] - public double? EnergyRecoveryRate { get; set; } + public double? EnergyRecoveryRate + { + get; + set; + } [JsonPropertyName("IncreasePositiveEffectDurationRate")] - public double? IncreasePositiveEffectDurationRate { get; set; } + public double? IncreasePositiveEffectDurationRate + { + get; + set; + } [JsonPropertyName("DecreaseNegativeEffectDurationRate")] - public double? DecreaseNegativeEffectDurationRate { get; set; } + public double? DecreaseNegativeEffectDurationRate + { + get; + set; + } [JsonPropertyName("DecreasePoisonDurationRate")] - public double? DecreasePoisonDurationRate { get; set; } + public double? DecreasePoisonDurationRate + { + get; + set; + } } public record Immunity { [JsonPropertyName("ImmunityMiscEffects")] - public double? ImmunityMiscEffects { get; set; } + public double? ImmunityMiscEffects + { + get; + set; + } [JsonPropertyName("ImmunityPoisonBuff")] - public double? ImmunityPoisonBuff { get; set; } + public double? ImmunityPoisonBuff + { + get; + set; + } [JsonPropertyName("ImmunityPainKiller")] - public double? ImmunityPainKiller { get; set; } + public double? ImmunityPainKiller + { + get; + set; + } [JsonPropertyName("HealthNegativeEffect")] - public double? HealthNegativeEffect { get; set; } + public double? HealthNegativeEffect + { + get; + set; + } [JsonPropertyName("StimulatorNegativeBuff")] - public double? StimulatorNegativeBuff { get; set; } + public double? StimulatorNegativeBuff + { + get; + set; + } } public record Endurance { [JsonPropertyName("MovementAction")] - public double? MovementAction { get; set; } + public double? MovementAction + { + get; + set; + } [JsonPropertyName("SprintAction")] - public double? SprintAction { get; set; } + public double? SprintAction + { + get; + set; + } [JsonPropertyName("GainPerFatigueStack")] - public double? GainPerFatigueStack { get; set; } + public double? GainPerFatigueStack + { + get; + set; + } [JsonPropertyName("DependentSkillRatios")] - public List? DependentSkillRatios { get; set; } + public List? DependentSkillRatios + { + get; + set; + } [JsonPropertyName("QTELevelMultipliers")] - public Dictionary>? QTELevelMultipliers { get; set; } + public Dictionary>? QTELevelMultipliers + { + get; + set; + } } public record Strength { [JsonPropertyName("DependentSkillRatios")] - public List? DependentSkillRatios { get; set; } + public List? DependentSkillRatios + { + get; + set; + } [JsonPropertyName("SprintActionMin")] - public double? SprintActionMin { get; set; } + public double? SprintActionMin + { + get; + set; + } [JsonPropertyName("SprintActionMax")] - public double? SprintActionMax { get; set; } + public double? SprintActionMax + { + get; + set; + } [JsonPropertyName("MovementActionMin")] - public double? MovementActionMin { get; set; } + public double? MovementActionMin + { + get; + set; + } [JsonPropertyName("MovementActionMax")] - public double? MovementActionMax { get; set; } + public double? MovementActionMax + { + get; + set; + } [JsonPropertyName("PushUpMin")] - public double? PushUpMin { get; set; } + public double? PushUpMin + { + get; + set; + } [JsonPropertyName("PushUpMax")] - public double? PushUpMax { get; set; } + public double? PushUpMax + { + get; + set; + } [JsonPropertyName("QTELevelMultipliers")] - public List? QTELevelMultipliers { get; set; } + public List? QTELevelMultipliers + { + get; + set; + } [JsonPropertyName("FistfightAction")] - public double? FistfightAction { get; set; } + public double? FistfightAction + { + get; + set; + } [JsonPropertyName("ThrowAction")] - public double? ThrowAction { get; set; } + public double? ThrowAction + { + get; + set; + } } public record DependentSkillRatio { [JsonPropertyName("Ratio")] - public double? Ratio { get; set; } + public double? Ratio + { + get; + set; + } [JsonPropertyName("SkillId")] - public string? SkillId { get; set; } + public string? SkillId + { + get; + set; + } } public record QTELevelMultiplier { [JsonPropertyName("Level")] - public double? Level { get; set; } + public double? Level + { + get; + set; + } [JsonPropertyName("Multiplier")] - public double? Multiplier { get; set; } + public double? Multiplier + { + get; + set; + } } public record Vitality { [JsonPropertyName("DamageTakenAction")] - public double? DamageTakenAction { get; set; } + public double? DamageTakenAction + { + get; + set; + } [JsonPropertyName("HealthNegativeEffect")] - public double? HealthNegativeEffect { get; set; } + public double? HealthNegativeEffect + { + get; + set; + } } public record HealthSkillProgress { [JsonPropertyName("SkillProgress")] - public double? SkillProgress { get; set; } + public double? SkillProgress + { + get; + set; + } } public record StressResistance { [JsonPropertyName("HealthNegativeEffect")] - public double? HealthNegativeEffect { get; set; } + public double? HealthNegativeEffect + { + get; + set; + } [JsonPropertyName("LowHPDuration")] - public double? LowHPDuration { get; set; } + public double? LowHPDuration + { + get; + set; + } } public record Throwing { [JsonPropertyName("ThrowAction")] - public double? ThrowAction { get; set; } + public double? ThrowAction + { + get; + set; + } } public record RecoilControl { [JsonPropertyName("RecoilAction")] - public double? RecoilAction { get; set; } + public double? RecoilAction + { + get; + set; + } [JsonPropertyName("RecoilBonusPerLevel")] - public double? RecoilBonusPerLevel { get; set; } + public double? RecoilBonusPerLevel + { + get; + set; + } } public record WeaponSkills { [JsonPropertyName("WeaponReloadAction")] - public double? WeaponReloadAction { get; set; } + public double? WeaponReloadAction + { + get; + set; + } [JsonPropertyName("WeaponShotAction")] - public double? WeaponShotAction { get; set; } + public double? WeaponShotAction + { + get; + set; + } [JsonPropertyName("WeaponFixAction")] - public double? WeaponFixAction { get; set; } + public double? WeaponFixAction + { + get; + set; + } [JsonPropertyName("WeaponChamberAction")] - public double? WeaponChamberAction { get; set; } + public double? WeaponChamberAction + { + get; + set; + } } public record CovertMovement { [JsonPropertyName("MovementAction")] - public double? MovementAction { get; set; } + public double? MovementAction + { + get; + set; + } } public record Search { [JsonPropertyName("SearchAction")] - public double? SearchAction { get; set; } + public double? SearchAction + { + get; + set; + } [JsonPropertyName("FindAction")] - public double? FindAction { get; set; } + public double? FindAction + { + get; + set; + } } public record WeaponTreatment { [JsonPropertyName("BuffMaxCount")] - public double? BuffMaxCount { get; set; } + public double? BuffMaxCount + { + get; + set; + } [JsonPropertyName("BuffSettings")] - public BuffSettings? BuffSettings { get; set; } + public BuffSettings? BuffSettings + { + get; + set; + } [JsonPropertyName("Counters")] - public WeaponTreatmentCounters? Counters { get; set; } + public WeaponTreatmentCounters? Counters + { + get; + set; + } [JsonPropertyName("DurLossReducePerLevel")] - public double? DurLossReducePerLevel { get; set; } + public double? DurLossReducePerLevel + { + get; + set; + } [JsonPropertyName("SkillPointsPerRepair")] - public double? SkillPointsPerRepair { get; set; } + public double? SkillPointsPerRepair + { + get; + set; + } [JsonPropertyName("Filter")] - public List? Filter { get; set; } + public List? Filter + { + get; + set; + } [JsonPropertyName("WearAmountRepairGunsReducePerLevel")] - public double? WearAmountRepairGunsReducePerLevel { get; set; } + public double? WearAmountRepairGunsReducePerLevel + { + get; + set; + } [JsonPropertyName("WearChanceRepairGunsReduceEliteLevel")] - public double? WearChanceRepairGunsReduceEliteLevel { get; set; } + public double? WearChanceRepairGunsReduceEliteLevel + { + get; + set; + } } public record WeaponTreatmentCounters { [JsonPropertyName("firearmsDurability")] - public SkillCounter? FirearmsDurability { get; set; } + public SkillCounter? FirearmsDurability + { + get; + set; + } } public record BuffSettings { [JsonPropertyName("CommonBuffChanceLevelBonus")] - public double? CommonBuffChanceLevelBonus { get; set; } + public double? CommonBuffChanceLevelBonus + { + get; + set; + } [JsonPropertyName("CommonBuffMinChanceValue")] - public double? CommonBuffMinChanceValue { get; set; } + public double? CommonBuffMinChanceValue + { + get; + set; + } [JsonPropertyName("CurrentDurabilityLossToRemoveBuff")] - public double? CurrentDurabilityLossToRemoveBuff { get; set; } + public double? CurrentDurabilityLossToRemoveBuff + { + get; + set; + } [JsonPropertyName("MaxDurabilityLossToRemoveBuff")] - public double? MaxDurabilityLossToRemoveBuff { get; set; } + public double? MaxDurabilityLossToRemoveBuff + { + get; + set; + } [JsonPropertyName("RareBuffChanceCoff")] - public double? RareBuffChanceCoff { get; set; } + public double? RareBuffChanceCoff + { + get; + set; + } [JsonPropertyName("ReceivedDurabilityMaxPercent")] - public double? ReceivedDurabilityMaxPercent { get; set; } + public double? ReceivedDurabilityMaxPercent + { + get; + set; + } } public record MagDrills { [JsonPropertyName("RaidLoadedAmmoAction")] - public double? RaidLoadedAmmoAction { get; set; } + public double? RaidLoadedAmmoAction + { + get; + set; + } [JsonPropertyName("RaidUnloadedAmmoAction")] - public double? RaidUnloadedAmmoAction { get; set; } + public double? RaidUnloadedAmmoAction + { + get; + set; + } [JsonPropertyName("MagazineCheckAction")] - public double? MagazineCheckAction { get; set; } + public double? MagazineCheckAction + { + get; + set; + } } public record Perception { [JsonPropertyName("DependentSkillRatios")] - public List? DependentSkillRatios { get; set; } + public List? DependentSkillRatios + { + get; + set; + } [JsonPropertyName("OnlineAction")] - public double? OnlineAction { get; set; } + public double? OnlineAction + { + get; + set; + } [JsonPropertyName("UniqueLoot")] - public double? UniqueLoot { get; set; } + public double? UniqueLoot + { + get; + set; + } } public record SkillRatio { [JsonPropertyName("Ratio")] - public double? Ratio { get; set; } + public double? Ratio + { + get; + set; + } [JsonPropertyName("SkillId")] - public string? SkillId { get; set; } + public string? SkillId + { + get; + set; + } } public record Intellect { - public SkillRatio[] DependentSkillRatios { get; set; } + public SkillRatio[] DependentSkillRatios + { + get; + set; + } [JsonPropertyName("Counters")] - public IntellectCounters? Counters { get; set; } + public IntellectCounters? Counters + { + get; + set; + } [JsonPropertyName("ExamineAction")] - public double? ExamineAction { get; set; } + public double? ExamineAction + { + get; + set; + } [JsonPropertyName("SkillProgress")] - public double? SkillProgress { get; set; } + public double? SkillProgress + { + get; + set; + } [JsonPropertyName("RepairAction")] - public double? RepairAction { get; set; } + public double? RepairAction + { + get; + set; + } [JsonPropertyName("WearAmountReducePerLevel")] - public double? WearAmountReducePerLevel { get; set; } + public double? WearAmountReducePerLevel + { + get; + set; + } [JsonPropertyName("WearChanceReduceEliteLevel")] - public double? WearChanceReduceEliteLevel { get; set; } + public double? WearChanceReduceEliteLevel + { + get; + set; + } [JsonPropertyName("RepairPointsCostReduction")] - public double? RepairPointsCostReduction { get; set; } + public double? RepairPointsCostReduction + { + get; + set; + } } public record IntellectCounters { [JsonPropertyName("armorDurability")] - public SkillCounter? ArmorDurability { get; set; } + public SkillCounter? ArmorDurability + { + get; + set; + } [JsonPropertyName("firearmsDurability")] - public SkillCounter? FirearmsDurability { get; set; } + public SkillCounter? FirearmsDurability + { + get; + set; + } [JsonPropertyName("meleeWeaponDurability")] - public SkillCounter? MeleeWeaponDurability { get; set; } + public SkillCounter? MeleeWeaponDurability + { + get; + set; + } } public record SkillCounter { [JsonPropertyName("divisor")] - public double? Divisor { get; set; } + public double? Divisor + { + get; + set; + } [JsonPropertyName("points")] - public double? Points { get; set; } + public double? Points + { + get; + set; + } } public record Attention { [JsonPropertyName("DependentSkillRatios")] - public SkillRatio[] DependentSkillRatios { get; set; } + public SkillRatio[] DependentSkillRatios + { + get; + set; + } [JsonPropertyName("ExamineWithInstruction")] - public double? ExamineWithInstruction { get; set; } + public double? ExamineWithInstruction + { + get; + set; + } [JsonPropertyName("FindActionFalse")] - public double? FindActionFalse { get; set; } + public double? FindActionFalse + { + get; + set; + } [JsonPropertyName("FindActionTrue")] - public double? FindActionTrue { get; set; } + public double? FindActionTrue + { + get; + set; + } } public record Charisma { [JsonPropertyName("BonusSettings")] - public BonusSettings? BonusSettings { get; set; } + public BonusSettings? BonusSettings + { + get; + set; + } [JsonPropertyName("Counters")] - public CharismaSkillCounters? Counters { get; set; } + public CharismaSkillCounters? Counters + { + get; + set; + } [JsonPropertyName("SkillProgressInt")] - public double? SkillProgressInt { get; set; } + public double? SkillProgressInt + { + get; + set; + } [JsonPropertyName("SkillProgressAtn")] - public double? SkillProgressAtn { get; set; } + public double? SkillProgressAtn + { + get; + set; + } [JsonPropertyName("SkillProgressPer")] - public double? SkillProgressPer { get; set; } + public double? SkillProgressPer + { + get; + set; + } } public record CharismaSkillCounters { [JsonPropertyName("insuranceCost")] - public SkillCounter? InsuranceCost { get; set; } + public SkillCounter? InsuranceCost + { + get; + set; + } [JsonPropertyName("repairCost")] - public SkillCounter? RepairCost { get; set; } + public SkillCounter? RepairCost + { + get; + set; + } [JsonPropertyName("repeatableQuestCompleteCount")] - public SkillCounter? RepeatableQuestCompleteCount { get; set; } + public SkillCounter? RepeatableQuestCompleteCount + { + get; + set; + } [JsonPropertyName("restoredHealthCost")] - public SkillCounter? RestoredHealthCost { get; set; } + public SkillCounter? RestoredHealthCost + { + get; + set; + } [JsonPropertyName("scavCaseCost")] - public SkillCounter? ScavCaseCost { get; set; } + public SkillCounter? ScavCaseCost + { + get; + set; + } } public record BonusSettings { [JsonPropertyName("EliteBonusSettings")] - public EliteBonusSettings? EliteBonusSettings { get; set; } + public EliteBonusSettings? EliteBonusSettings + { + get; + set; + } [JsonPropertyName("LevelBonusSettings")] - public LevelBonusSettings? LevelBonusSettings { get; set; } + public LevelBonusSettings? LevelBonusSettings + { + get; + set; + } } public record EliteBonusSettings { [JsonPropertyName("FenceStandingLossDiscount")] - public double? FenceStandingLossDiscount { get; set; } + public double? FenceStandingLossDiscount + { + get; + set; + } [JsonPropertyName("RepeatableQuestExtraCount")] - public int? RepeatableQuestExtraCount { get; set; } + public int? RepeatableQuestExtraCount + { + get; + set; + } [JsonPropertyName("ScavCaseDiscount")] - public double? ScavCaseDiscount { get; set; } + public double? ScavCaseDiscount + { + get; + set; + } } public record LevelBonusSettings { [JsonPropertyName("HealthRestoreDiscount")] - public double? HealthRestoreDiscount { get; set; } + public double? HealthRestoreDiscount + { + get; + set; + } [JsonPropertyName("HealthRestoreTraderDiscount")] - public double? HealthRestoreTraderDiscount { get; set; } + public double? HealthRestoreTraderDiscount + { + get; + set; + } [JsonPropertyName("InsuranceDiscount")] - public double? InsuranceDiscount { get; set; } + public double? InsuranceDiscount + { + get; + set; + } [JsonPropertyName("InsuranceTraderDiscount")] - public double? InsuranceTraderDiscount { get; set; } + public double? InsuranceTraderDiscount + { + get; + set; + } [JsonPropertyName("PaidExitDiscount")] - public double? PaidExitDiscount { get; set; } + public double? PaidExitDiscount + { + get; + set; + } [JsonPropertyName("RepeatableQuestChangeDiscount")] - public double? RepeatableQuestChangeDiscount { get; set; } + public double? RepeatableQuestChangeDiscount + { + get; + set; + } } public record Memory { [JsonPropertyName("AnySkillUp")] - public double? AnySkillUp { get; set; } + public double? AnySkillUp + { + get; + set; + } [JsonPropertyName("SkillProgress")] - public double? SkillProgress { get; set; } + public double? SkillProgress + { + get; + set; + } } public record Surgery { [JsonPropertyName("SurgeryAction")] - public double? SurgeryAction { get; set; } + public double? SurgeryAction + { + get; + set; + } [JsonPropertyName("SkillProgress")] - public double? SkillProgress { get; set; } + public double? SkillProgress + { + get; + set; + } } public record AimDrills { [JsonPropertyName("WeaponShotAction")] - public double? WeaponShotAction { get; set; } + public double? WeaponShotAction + { + get; + set; + } } public record TroubleShooting { [JsonPropertyName("MalfRepairSpeedBonusPerLevel")] - public double? MalfRepairSpeedBonusPerLevel { get; set; } + public double? MalfRepairSpeedBonusPerLevel + { + get; + set; + } [JsonPropertyName("SkillPointsPerMalfFix")] - public double? SkillPointsPerMalfFix { get; set; } + public double? SkillPointsPerMalfFix + { + get; + set; + } [JsonPropertyName("EliteDurabilityChanceReduceMult")] - public double? EliteDurabilityChanceReduceMult { get; set; } + public double? EliteDurabilityChanceReduceMult + { + get; + set; + } [JsonPropertyName("EliteAmmoChanceReduceMult")] - public double? EliteAmmoChanceReduceMult { get; set; } + public double? EliteAmmoChanceReduceMult + { + get; + set; + } [JsonPropertyName("EliteMagChanceReduceMult")] - public double? EliteMagChanceReduceMult { get; set; } + public double? EliteMagChanceReduceMult + { + get; + set; + } } public record Aiming { [JsonPropertyName("ProceduralIntensityByPose")] - public XYZ? ProceduralIntensityByPose { get; set; } + public XYZ? ProceduralIntensityByPose + { + get; + set; + } [JsonPropertyName("AimProceduralIntensity")] - public double? AimProceduralIntensity { get; set; } + public double? AimProceduralIntensity + { + get; + set; + } [JsonPropertyName("HeavyWeight")] - public double? HeavyWeight { get; set; } + public double? HeavyWeight + { + get; + set; + } [JsonPropertyName("LightWeight")] - public double? LightWeight { get; set; } + public double? LightWeight + { + get; + set; + } [JsonPropertyName("MaxTimeHeavy")] - public double? MaxTimeHeavy { get; set; } + public double? MaxTimeHeavy + { + get; + set; + } [JsonPropertyName("MinTimeHeavy")] - public double? MinTimeHeavy { get; set; } + public double? MinTimeHeavy + { + get; + set; + } [JsonPropertyName("MaxTimeLight")] - public double? MaxTimeLight { get; set; } + public double? MaxTimeLight + { + get; + set; + } [JsonPropertyName("MinTimeLight")] - public double? MinTimeLight { get; set; } + public double? MinTimeLight + { + get; + set; + } [JsonPropertyName("RecoilScaling")] - public double? RecoilScaling { get; set; } + public double? RecoilScaling + { + get; + set; + } [JsonPropertyName("RecoilDamping")] - public double? RecoilDamping { get; set; } + public double? RecoilDamping + { + get; + set; + } [JsonPropertyName("CameraSnapGlobalMult")] - public double? CameraSnapGlobalMult { get; set; } + public double? CameraSnapGlobalMult + { + get; + set; + } [JsonPropertyName("RecoilXIntensityByPose")] - public XYZ? RecoilXIntensityByPose { get; set; } + public XYZ? RecoilXIntensityByPose + { + get; + set; + } [JsonPropertyName("RecoilYIntensityByPose")] - public XYZ? RecoilYIntensityByPose { get; set; } + public XYZ? RecoilYIntensityByPose + { + get; + set; + } [JsonPropertyName("RecoilZIntensityByPose")] - public XYZ? RecoilZIntensityByPose { get; set; } + public XYZ? RecoilZIntensityByPose + { + get; + set; + } [JsonPropertyName("RecoilCrank")] - public bool? RecoilCrank { get; set; } + public bool? RecoilCrank + { + get; + set; + } [JsonPropertyName("RecoilHandDamping")] - public double? RecoilHandDamping { get; set; } + public double? RecoilHandDamping + { + get; + set; + } [JsonPropertyName("RecoilConvergenceMult")] - public double? RecoilConvergenceMult { get; set; } + public double? RecoilConvergenceMult + { + get; + set; + } [JsonPropertyName("RecoilVertBonus")] - public double? RecoilVertBonus { get; set; } + public double? RecoilVertBonus + { + get; + set; + } [JsonPropertyName("RecoilBackBonus")] - public double? RecoilBackBonus { get; set; } + public double? RecoilBackBonus + { + get; + set; + } } public record Malfunction { [JsonPropertyName("AmmoMalfChanceMult")] - public double? AmmoMalfChanceMult { get; set; } + public double? AmmoMalfChanceMult + { + get; + set; + } [JsonPropertyName("MagazineMalfChanceMult")] - public double? MagazineMalfChanceMult { get; set; } + public double? MagazineMalfChanceMult + { + get; + set; + } [JsonPropertyName("MalfRepairHardSlideMult")] - public double? MalfRepairHardSlideMult { get; set; } + public double? MalfRepairHardSlideMult + { + get; + set; + } [JsonPropertyName("MalfRepairOneHandBrokenMult")] - public double? MalfRepairOneHandBrokenMult { get; set; } + public double? MalfRepairOneHandBrokenMult + { + get; + set; + } [JsonPropertyName("MalfRepairTwoHandsBrokenMult")] - public double? MalfRepairTwoHandsBrokenMult { get; set; } + public double? MalfRepairTwoHandsBrokenMult + { + get; + set; + } [JsonPropertyName("AllowMalfForBots")] - public bool? AllowMalfForBots { get; set; } + public bool? AllowMalfForBots + { + get; + set; + } [JsonPropertyName("ShowGlowAttemptsCount")] - public double? ShowGlowAttemptsCount { get; set; } + public double? ShowGlowAttemptsCount + { + get; + set; + } [JsonPropertyName("OutToIdleSpeedMultForPistol")] - public double? OutToIdleSpeedMultForPistol { get; set; } + public double? OutToIdleSpeedMultForPistol + { + get; + set; + } [JsonPropertyName("IdleToOutSpeedMultOnMalf")] - public double? IdleToOutSpeedMultOnMalf { get; set; } + public double? IdleToOutSpeedMultOnMalf + { + get; + set; + } [JsonPropertyName("TimeToQuickdrawPistol")] - public double? TimeToQuickdrawPistol { get; set; } + public double? TimeToQuickdrawPistol + { + get; + set; + } [JsonPropertyName("DurRangeToIgnoreMalfs")] - public XYZ? DurRangeToIgnoreMalfs { get; set; } + public XYZ? DurRangeToIgnoreMalfs + { + get; + set; + } [JsonPropertyName("DurFeedWt")] - public double? DurFeedWt { get; set; } + public double? DurFeedWt + { + get; + set; + } [JsonPropertyName("DurMisfireWt")] - public double? DurMisfireWt { get; set; } + public double? DurMisfireWt + { + get; + set; + } [JsonPropertyName("DurJamWt")] - public double? DurJamWt { get; set; } + public double? DurJamWt + { + get; + set; + } [JsonPropertyName("DurSoftSlideWt")] - public double? DurSoftSlideWt { get; set; } + public double? DurSoftSlideWt + { + get; + set; + } [JsonPropertyName("DurHardSlideMinWt")] - public double? DurHardSlideMinWt { get; set; } + public double? DurHardSlideMinWt + { + get; + set; + } [JsonPropertyName("DurHardSlideMaxWt")] - public double? DurHardSlideMaxWt { get; set; } + public double? DurHardSlideMaxWt + { + get; + set; + } [JsonPropertyName("AmmoMisfireWt")] - public double? AmmoMisfireWt { get; set; } + public double? AmmoMisfireWt + { + get; + set; + } [JsonPropertyName("AmmoFeedWt")] - public double? AmmoFeedWt { get; set; } + public double? AmmoFeedWt + { + get; + set; + } [JsonPropertyName("AmmoJamWt")] - public double? AmmoJamWt { get; set; } + public double? AmmoJamWt + { + get; + set; + } [JsonPropertyName("OverheatFeedWt")] - public double? OverheatFeedWt { get; set; } + public double? OverheatFeedWt + { + get; + set; + } [JsonPropertyName("OverheatJamWt")] - public double? OverheatJamWt { get; set; } + public double? OverheatJamWt + { + get; + set; + } [JsonPropertyName("OverheatSoftSlideWt")] - public double? OverheatSoftSlideWt { get; set; } + public double? OverheatSoftSlideWt + { + get; + set; + } [JsonPropertyName("OverheatHardSlideMinWt")] - public double? OverheatHardSlideMinWt { get; set; } + public double? OverheatHardSlideMinWt + { + get; + set; + } [JsonPropertyName("OverheatHardSlideMaxWt")] - public double? OverheatHardSlideMaxWt { get; set; } + public double? OverheatHardSlideMaxWt + { + get; + set; + } } public record Overheat { [JsonPropertyName("MinOverheat")] - public double? MinimumOverheat { get; set; } + public double? MinimumOverheat + { + get; + set; + } [JsonPropertyName("MaxOverheat")] - public double? MaximumOverheat { get; set; } + public double? MaximumOverheat + { + get; + set; + } [JsonPropertyName("OverheatProblemsStart")] - public double? OverheatProblemsStart { get; set; } + public double? OverheatProblemsStart + { + get; + set; + } [JsonPropertyName("ModHeatFactor")] - public double? ModificationHeatFactor { get; set; } + public double? ModificationHeatFactor + { + get; + set; + } [JsonPropertyName("ModCoolFactor")] - public double? ModificationCoolFactor { get; set; } + public double? ModificationCoolFactor + { + get; + set; + } [JsonPropertyName("MinWearOnOverheat")] - public double? MinimumWearOnOverheat { get; set; } + public double? MinimumWearOnOverheat + { + get; + set; + } [JsonPropertyName("MaxWearOnOverheat")] - public double? MaximumWearOnOverheat { get; set; } + public double? MaximumWearOnOverheat + { + get; + set; + } [JsonPropertyName("MinWearOnMaxOverheat")] - public double? MinimumWearOnMaximumOverheat { get; set; } + public double? MinimumWearOnMaximumOverheat + { + get; + set; + } [JsonPropertyName("MaxWearOnMaxOverheat")] - public double? MaximumWearOnMaximumOverheat { get; set; } + public double? MaximumWearOnMaximumOverheat + { + get; + set; + } [JsonPropertyName("OverheatWearLimit")] - public double? OverheatWearLimit { get; set; } + public double? OverheatWearLimit + { + get; + set; + } [JsonPropertyName("MaxCOIIncreaseMult")] - public double? MaximumCOIIncreaseMultiplier { get; set; } + public double? MaximumCOIIncreaseMultiplier + { + get; + set; + } [JsonPropertyName("MinMalfChance")] - public double? MinimumMalfunctionChance { get; set; } + public double? MinimumMalfunctionChance + { + get; + set; + } [JsonPropertyName("MaxMalfChance")] - public double? MaximumMalfunctionChance { get; set; } + public double? MaximumMalfunctionChance + { + get; + set; + } [JsonPropertyName("DurReduceMinMult")] - public double? DurabilityReductionMinimumMultiplier { get; set; } + public double? DurabilityReductionMinimumMultiplier + { + get; + set; + } [JsonPropertyName("DurReduceMaxMult")] - public double? DurabilityReductionMaximumMultiplier { get; set; } + public double? DurabilityReductionMaximumMultiplier + { + get; + set; + } [JsonPropertyName("BarrelMoveRndDuration")] - public double? BarrelMovementRandomDuration { get; set; } + public double? BarrelMovementRandomDuration + { + get; + set; + } [JsonPropertyName("BarrelMoveMaxMult")] - public double? BarrelMovementMaximumMultiplier { get; set; } + public double? BarrelMovementMaximumMultiplier + { + get; + set; + } [JsonPropertyName("FireratePitchMult")] - public double? FireRatePitchMultiplier { get; set; } + public double? FireRatePitchMultiplier + { + get; + set; + } [JsonPropertyName("FirerateReduceMinMult")] - public double? FireRateReductionMinimumMultiplier { get; set; } + public double? FireRateReductionMinimumMultiplier + { + get; + set; + } [JsonPropertyName("FirerateReduceMaxMult")] - public double? FireRateReductionMaximumMultiplier { get; set; } + public double? FireRateReductionMaximumMultiplier + { + get; + set; + } [JsonPropertyName("FirerateOverheatBorder")] - public double? FireRateOverheatBorder { get; set; } + public double? FireRateOverheatBorder + { + get; + set; + } [JsonPropertyName("EnableSlideOnMaxOverheat")] - public bool? IsSlideEnabledOnMaximumOverheat { get; set; } + public bool? IsSlideEnabledOnMaximumOverheat + { + get; + set; + } [JsonPropertyName("StartSlideOverheat")] - public double? StartSlideOverheat { get; set; } + public double? StartSlideOverheat + { + get; + set; + } [JsonPropertyName("FixSlideOverheat")] - public double? FixSlideOverheat { get; set; } + public double? FixSlideOverheat + { + get; + set; + } [JsonPropertyName("AutoshotMinOverheat")] - public double? AutoshotMinimumOverheat { get; set; } + public double? AutoshotMinimumOverheat + { + get; + set; + } [JsonPropertyName("AutoshotChance")] - public double? AutoshotChance { get; set; } + public double? AutoshotChance + { + get; + set; + } [JsonPropertyName("AutoshotPossibilityDuration")] - public double? AutoshotPossibilityDuration { get; set; } + public double? AutoshotPossibilityDuration + { + get; + set; + } [JsonPropertyName("MaxOverheatCoolCoef")] - public double? MaximumOverheatCoolCoefficient { get; set; } + public double? MaximumOverheatCoolCoefficient + { + get; + set; + } } public record FenceSettings { // MongoId [JsonPropertyName("FenceId")] - public string? FenceIdentifier { get; set; } + public string? FenceIdentifier + { + get; + set; + } [JsonPropertyName("Levels")] - public Dictionary? Levels { get; set; } + public Dictionary? Levels + { + get; + set; + } [JsonPropertyName("paidExitStandingNumerator")] - public double? PaidExitStandingNumerator { get; set; } + public double? PaidExitStandingNumerator + { + get; + set; + } - public double? PmcBotKillStandingMultiplier { get; set; } + public double? PmcBotKillStandingMultiplier + { + get; + set; + } } public record FenceLevel { [JsonPropertyName("ReachOnMarkOnUnknowns")] - public bool? CanReachOnMarkOnUnknowns { get; set; } + public bool? CanReachOnMarkOnUnknowns + { + get; + set; + } [JsonPropertyName("SavageCooldownModifier")] - public double? SavageCooldownModifier { get; set; } + public double? SavageCooldownModifier + { + get; + set; + } [JsonPropertyName("ScavCaseTimeModifier")] - public double? ScavCaseTimeModifier { get; set; } + public double? ScavCaseTimeModifier + { + get; + set; + } [JsonPropertyName("PaidExitCostModifier")] - public double? PaidExitCostModifier { get; set; } + public double? PaidExitCostModifier + { + get; + set; + } [JsonPropertyName("BotFollowChance")] - public double? BotFollowChance { get; set; } + public double? BotFollowChance + { + get; + set; + } [JsonPropertyName("ScavEquipmentSpawnChanceModifier")] - public double? ScavEquipmentSpawnChanceModifier { get; set; } + public double? ScavEquipmentSpawnChanceModifier + { + get; + set; + } [JsonPropertyName("TransitGridSize")] - public XYZ? TransitGridSize { get; set; } + public XYZ? TransitGridSize + { + get; + set; + } [JsonPropertyName("PriceModifier")] - public double? PriceModifier { get; set; } + public double? PriceModifier + { + get; + set; + } [JsonPropertyName("HostileBosses")] - public bool? AreHostileBossesPresent { get; set; } + public bool? AreHostileBossesPresent + { + get; + set; + } [JsonPropertyName("HostileScavs")] - public bool? AreHostileScavsPresent { get; set; } + public bool? AreHostileScavsPresent + { + get; + set; + } [JsonPropertyName("ScavAttackSupport")] - public bool? IsScavAttackSupported { get; set; } + public bool? IsScavAttackSupported + { + get; + set; + } [JsonPropertyName("ExfiltrationPriceModifier")] - public double? ExfiltrationPriceModifier { get; set; } + public double? ExfiltrationPriceModifier + { + get; + set; + } [JsonPropertyName("AvailableExits")] - public double? AvailableExits { get; set; } + public double? AvailableExits + { + get; + set; + } [JsonPropertyName("BotApplySilenceChance")] - public double? BotApplySilenceChance { get; set; } + public double? BotApplySilenceChance + { + get; + set; + } [JsonPropertyName("BotGetInCoverChance")] - public double? BotGetInCoverChance { get; set; } + public double? BotGetInCoverChance + { + get; + set; + } [JsonPropertyName("BotHelpChance")] - public double? BotHelpChance { get; set; } + public double? BotHelpChance + { + get; + set; + } [JsonPropertyName("BotSpreadoutChance")] - public double? BotSpreadoutChance { get; set; } + public double? BotSpreadoutChance + { + get; + set; + } [JsonPropertyName("BotStopChance")] - public double? BotStopChance { get; set; } + public double? BotStopChance + { + get; + set; + } [JsonPropertyName("PriceModTaxi")] - public double? PriceModifierTaxi { get; set; } + public double? PriceModifierTaxi + { + get; + set; + } [JsonPropertyName("PriceModDelivery")] - public double? PriceModifierDelivery { get; set; } + public double? PriceModifierDelivery + { + get; + set; + } [JsonPropertyName("PriceModCleanUp")] - public double? PriceModifierCleanUp { get; set; } + public double? PriceModifierCleanUp + { + get; + set; + } [JsonPropertyName("ReactOnMarkOnUnknowns")] - public bool? ReactOnMarkOnUnknowns { get; set; } + public bool? ReactOnMarkOnUnknowns + { + get; + set; + } [JsonPropertyName("ReactOnMarkOnUnknownsPVE")] - public bool? ReactOnMarkOnUnknownsPVE { get; set; } + public bool? ReactOnMarkOnUnknownsPVE + { + get; + set; + } [JsonPropertyName("DeliveryGridSize")] - public XYZ? DeliveryGridSize { get; set; } + public XYZ? DeliveryGridSize + { + get; + set; + } [JsonPropertyName("CanInteractWithBtr")] - public bool? CanInteractWithBtr { get; set; } + public bool? CanInteractWithBtr + { + get; + set; + } [JsonPropertyName("CircleOfCultistsBonusPercent")] - public double? CircleOfCultistsBonusPercentage { get; set; } + public double? CircleOfCultistsBonusPercentage + { + get; + set; + } } public record Inertia { [JsonPropertyName("InertiaLimits")] - public XYZ? InertiaLimits { get; set; } + public XYZ? InertiaLimits + { + get; + set; + } [JsonPropertyName("InertiaLimitsStep")] - public double? InertiaLimitsStep { get; set; } + public double? InertiaLimitsStep + { + get; + set; + } [JsonPropertyName("ExitMovementStateSpeedThreshold")] - public XYZ? ExitMovementStateSpeedThreshold { get; set; } + public XYZ? ExitMovementStateSpeedThreshold + { + get; + set; + } [JsonPropertyName("WalkInertia")] - public XYZ? WalkInertia { get; set; } + public XYZ? WalkInertia + { + get; + set; + } [JsonPropertyName("FallThreshold")] - public double? FallThreshold { get; set; } + public double? FallThreshold + { + get; + set; + } [JsonPropertyName("SpeedLimitAfterFallMin")] - public XYZ? SpeedLimitAfterFallMin { get; set; } + public XYZ? SpeedLimitAfterFallMin + { + get; + set; + } [JsonPropertyName("SpeedLimitAfterFallMax")] - public XYZ? SpeedLimitAfterFallMax { get; set; } + public XYZ? SpeedLimitAfterFallMax + { + get; + set; + } [JsonPropertyName("SpeedLimitDurationMin")] - public XYZ? SpeedLimitDurationMin { get; set; } + public XYZ? SpeedLimitDurationMin + { + get; + set; + } [JsonPropertyName("SpeedLimitDurationMax")] - public XYZ? SpeedLimitDurationMax { get; set; } + public XYZ? SpeedLimitDurationMax + { + get; + set; + } [JsonPropertyName("SpeedInertiaAfterJump")] - public XYZ? SpeedInertiaAfterJump { get; set; } + public XYZ? SpeedInertiaAfterJump + { + get; + set; + } [JsonPropertyName("BaseJumpPenaltyDuration")] - public double? BaseJumpPenaltyDuration { get; set; } + public double? BaseJumpPenaltyDuration + { + get; + set; + } [JsonPropertyName("DurationPower")] - public double? DurationPower { get; set; } + public double? DurationPower + { + get; + set; + } [JsonPropertyName("BaseJumpPenalty")] - public double? BaseJumpPenalty { get; set; } + public double? BaseJumpPenalty + { + get; + set; + } [JsonPropertyName("PenaltyPower")] - public double? PenaltyPower { get; set; } + public double? PenaltyPower + { + get; + set; + } [JsonPropertyName("InertiaTiltCurveMin")] - public XYZ? InertiaTiltCurveMin { get; set; } + public XYZ? InertiaTiltCurveMin + { + get; + set; + } [JsonPropertyName("InertiaTiltCurveMax")] - public XYZ? InertiaTiltCurveMax { get; set; } + public XYZ? InertiaTiltCurveMax + { + get; + set; + } [JsonPropertyName("InertiaBackwardCoef")] - public XYZ? InertiaBackwardCoef { get; set; } + public XYZ? InertiaBackwardCoef + { + get; + set; + } [JsonPropertyName("TiltInertiaMaxSpeed")] - public XYZ? TiltInertiaMaxSpeed { get; set; } + public XYZ? TiltInertiaMaxSpeed + { + get; + set; + } [JsonPropertyName("TiltStartSideBackSpeed")] - public XYZ? TiltStartSideBackSpeed { get; set; } + public XYZ? TiltStartSideBackSpeed + { + get; + set; + } [JsonPropertyName("TiltMaxSideBackSpeed")] - public XYZ? TiltMaxSideBackSpeed { get; set; } + public XYZ? TiltMaxSideBackSpeed + { + get; + set; + } [JsonPropertyName("TiltAcceleration")] - public XYZ? TiltAcceleration { get; set; } + public XYZ? TiltAcceleration + { + get; + set; + } [JsonPropertyName("AverageRotationFrameSpan")] - public double? AverageRotationFrameSpan { get; set; } + public double? AverageRotationFrameSpan + { + get; + set; + } [JsonPropertyName("SprintSpeedInertiaCurveMin")] - public XYZ? SprintSpeedInertiaCurveMin { get; set; } + public XYZ? SprintSpeedInertiaCurveMin + { + get; + set; + } [JsonPropertyName("SprintSpeedInertiaCurveMax")] - public XYZ? SprintSpeedInertiaCurveMax { get; set; } + public XYZ? SprintSpeedInertiaCurveMax + { + get; + set; + } [JsonPropertyName("SprintBrakeInertia")] - public XYZ? SprintBrakeInertia { get; set; } + public XYZ? SprintBrakeInertia + { + get; + set; + } [JsonPropertyName("SprintTransitionMotionPreservation")] - public XYZ? SprintTransitionMotionPreservation { get; set; } + public XYZ? SprintTransitionMotionPreservation + { + get; + set; + } [JsonPropertyName("WeaponFlipSpeed")] - public XYZ? WeaponFlipSpeed { get; set; } + public XYZ? WeaponFlipSpeed + { + get; + set; + } [JsonPropertyName("PreSprintAccelerationLimits")] - public XYZ? PreSprintAccelerationLimits { get; set; } + public XYZ? PreSprintAccelerationLimits + { + get; + set; + } [JsonPropertyName("SprintAccelerationLimits")] - public XYZ? SprintAccelerationLimits { get; set; } + public XYZ? SprintAccelerationLimits + { + get; + set; + } [JsonPropertyName("SideTime")] - public XYZ? SideTime { get; set; } + public XYZ? SideTime + { + get; + set; + } [JsonPropertyName("DiagonalTime")] - public XYZ? DiagonalTime { get; set; } + public XYZ? DiagonalTime + { + get; + set; + } [JsonPropertyName("MaxTimeWithoutInput")] - public XYZ? MaxTimeWithoutInput { get; set; } + public XYZ? MaxTimeWithoutInput + { + get; + set; + } [JsonPropertyName("MinDirectionBlendTime")] - public double? MinDirectionBlendTime { get; set; } + public double? MinDirectionBlendTime + { + get; + set; + } [JsonPropertyName("MoveTimeRange")] - public XYZ? MoveTimeRange { get; set; } + public XYZ? MoveTimeRange + { + get; + set; + } [JsonPropertyName("ProneDirectionAccelerationRange")] - public XYZ? ProneDirectionAccelerationRange { get; set; } + public XYZ? ProneDirectionAccelerationRange + { + get; + set; + } [JsonPropertyName("ProneSpeedAccelerationRange")] - public XYZ? ProneSpeedAccelerationRange { get; set; } + public XYZ? ProneSpeedAccelerationRange + { + get; + set; + } [JsonPropertyName("MinMovementAccelerationRangeRight")] - public XYZ? MinMovementAccelerationRangeRight { get; set; } + public XYZ? MinMovementAccelerationRangeRight + { + get; + set; + } [JsonPropertyName("MaxMovementAccelerationRangeRight")] - public XYZ? MaxMovementAccelerationRangeRight { get; set; } + public XYZ? MaxMovementAccelerationRangeRight + { + get; + set; + } - public XYZ? CrouchSpeedAccelerationRange { get; set; } + public XYZ? CrouchSpeedAccelerationRange + { + get; + set; + } } public record Ballistic { [JsonPropertyName("GlobalDamageDegradationCoefficient")] - public double? GlobalDamageDegradationCoefficient { get; set; } + public double? GlobalDamageDegradationCoefficient + { + get; + set; + } } public record RepairSettings { [JsonPropertyName("ItemEnhancementSettings")] - public ItemEnhancementSettings? ItemEnhancementSettings { get; set; } + public ItemEnhancementSettings? ItemEnhancementSettings + { + get; + set; + } [JsonPropertyName("MinimumLevelToApplyBuff")] - public double? MinimumLevelToApplyBuff { get; set; } + public double? MinimumLevelToApplyBuff + { + get; + set; + } [JsonPropertyName("RepairStrategies")] - public RepairStrategies? RepairStrategies { get; set; } + public RepairStrategies? RepairStrategies + { + get; + set; + } [JsonPropertyName("armorClassDivisor")] - public double? ArmorClassDivisor { get; set; } + public double? ArmorClassDivisor + { + get; + set; + } [JsonPropertyName("durabilityPointCostArmor")] - public double? DurabilityPointCostArmor { get; set; } + public double? DurabilityPointCostArmor + { + get; + set; + } [JsonPropertyName("durabilityPointCostGuns")] - public double? DurabilityPointCostGuns { get; set; } + public double? DurabilityPointCostGuns + { + get; + set; + } } public record ItemEnhancementSettings { [JsonPropertyName("DamageReduction")] - public PriceModifier? DamageReduction { get; set; } + public PriceModifier? DamageReduction + { + get; + set; + } [JsonPropertyName("MalfunctionProtections")] - public PriceModifier? MalfunctionProtections { get; set; } + public PriceModifier? MalfunctionProtections + { + get; + set; + } [JsonPropertyName("WeaponSpread")] - public PriceModifier? WeaponSpread { get; set; } + public PriceModifier? WeaponSpread + { + get; + set; + } } public record PriceModifier { [JsonPropertyName("PriceModifier")] - public double? PriceModifierValue { get; set; } + public double? PriceModifierValue + { + get; + set; + } } public record RepairStrategies { [JsonPropertyName("Armor")] - public RepairStrategy? Armor { get; set; } + public RepairStrategy? Armor + { + get; + set; + } [JsonPropertyName("Firearms")] - public RepairStrategy? Firearms { get; set; } + public RepairStrategy? Firearms + { + get; + set; + } } public record RepairStrategy { [JsonPropertyName("BuffTypes")] - public List? BuffTypes { get; set; } + public List? BuffTypes + { + get; + set; + } [JsonPropertyName("Filter")] - public List? Filter { get; set; } + public List? Filter + { + get; + set; + } } public record BotPreset { [JsonPropertyName("UseThis")] - public bool? UseThis { get; set; } + public bool? UseThis + { + get; + set; + } [JsonPropertyName("Role")] - public string? Role { get; set; } + public string? Role + { + get; + set; + } [JsonPropertyName("BotDifficulty")] - public string? BotDifficulty { get; set; } + public string? BotDifficulty + { + get; + set; + } [JsonPropertyName("VisibleAngle")] - public double? VisibleAngle { get; set; } + public double? VisibleAngle + { + get; + set; + } [JsonPropertyName("VisibleDistance")] - public double? VisibleDistance { get; set; } + public double? VisibleDistance + { + get; + set; + } [JsonPropertyName("ScatteringPerMeter")] - public double? ScatteringPerMeter { get; set; } + public double? ScatteringPerMeter + { + get; + set; + } [JsonPropertyName("HearingSense")] - public double? HearingSense { get; set; } + public double? HearingSense + { + get; + set; + } [JsonPropertyName("SCATTERING_DIST_MODIF")] - public double? ScatteringDistModif { get; set; } + public double? ScatteringDistModif + { + get; + set; + } [JsonPropertyName("MAX_AIMING_UPGRADE_BY_TIME")] - public double? MaxAimingUpgradeByTime { get; set; } + public double? MaxAimingUpgradeByTime + { + get; + set; + } [JsonPropertyName("FIRST_CONTACT_ADD_SEC")] - public double? FirstContactAddSec { get; set; } + public double? FirstContactAddSec + { + get; + set; + } [JsonPropertyName("COEF_IF_MOVE")] - public double? CoefIfMove { get; set; } + public double? CoefIfMove + { + get; + set; + } } public record AudioSettings { [JsonPropertyName("AudioGroupPresets")] - public List? AudioGroupPresets { get; set; } + public List? AudioGroupPresets + { + get; + set; + } [JsonPropertyName("EnvironmentSettings")] - public EnvironmentSettings? EnvironmentSettings { get; set; } + public EnvironmentSettings? EnvironmentSettings + { + get; + set; + } [JsonPropertyName("MetaXRAudioPluginSettings")] - public MetaXRAudioPluginSettings? MetaXRAudioPluginSettings { get; set; } + public MetaXRAudioPluginSettings? MetaXRAudioPluginSettings + { + get; + set; + } [JsonPropertyName("PlayerSettings")] - public PlayerSettings? PlayerSettings { get; set; } + public PlayerSettings? PlayerSettings + { + get; + set; + } [JsonPropertyName("RadioBroadcastSettings")] - public RadioBroadcastSettings? RadioBroadcastSettings { get; set; } + public RadioBroadcastSettings? RadioBroadcastSettings + { + get; + set; + } } public record AudioGroupPreset { [JsonPropertyName("AngleToAllowBinaural")] - public double? AngleToAllowBinaural { get; set; } + public double? AngleToAllowBinaural + { + get; + set; + } [JsonPropertyName("DisabledBinauralByDistance")] - public bool? DisabledBinauralByDistance { get; set; } + public bool? DisabledBinauralByDistance + { + get; + set; + } [JsonPropertyName("DistanceToAllowBinaural")] - public double? DistanceToAllowBinaural { get; set; } + public double? DistanceToAllowBinaural + { + get; + set; + } [JsonPropertyName("GroupType")] - public double? GroupType { get; set; } + public double? GroupType + { + get; + set; + } [JsonPropertyName("HeightToAllowBinaural")] - public double? HeightToAllowBinaural { get; set; } + public double? HeightToAllowBinaural + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("OcclusionEnabled")] - public bool? OcclusionEnabled { get; set; } + public bool? OcclusionEnabled + { + get; + set; + } [JsonPropertyName("OcclusionIntensity")] - public double? OcclusionIntensity { get; set; } + public double? OcclusionIntensity + { + get; + set; + } [JsonPropertyName("OcclusionRolloffScale")] - public double? OcclusionRolloffScale { get; set; } + public double? OcclusionRolloffScale + { + get; + set; + } [JsonPropertyName("OverallVolume")] - public double? OverallVolume { get; set; } + public double? OverallVolume + { + get; + set; + } } public record EnvironmentSettings { [JsonPropertyName("SnowStepsVolumeMultiplier")] - public double? SnowStepsVolumeMultiplier { get; set; } + public double? SnowStepsVolumeMultiplier + { + get; + set; + } [JsonPropertyName("SurfaceMultipliers")] - public List? SurfaceMultipliers { get; set; } + public List? SurfaceMultipliers + { + get; + set; + } } public record MetaXRAudioPluginSettings { - public bool? EnabledPluginErrorChecker { get; set; } - public double? OutputVolumeCheckCooldown { get; set; } + public bool? EnabledPluginErrorChecker + { + get; + set; + } + + public double? OutputVolumeCheckCooldown + { + get; + set; + } } public record SurfaceMultiplier { [JsonPropertyName("SurfaceType")] - public string? SurfaceType { get; set; } + public string? SurfaceType + { + get; + set; + } [JsonPropertyName("VolumeMult")] - public double? VolumeMultiplier { get; set; } + public double? VolumeMultiplier + { + get; + set; + } } public record BotWeaponScattering { [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("PriorityScatter1meter")] - public double? PriorityScatter1Meter { get; set; } + public double? PriorityScatter1Meter + { + get; + set; + } [JsonPropertyName("PriorityScatter10meter")] - public double? PriorityScatter10Meter { get; set; } + public double? PriorityScatter10Meter + { + get; + set; + } [JsonPropertyName("PriorityScatter100meter")] - public double? PriorityScatter100Meter { get; set; } + public double? PriorityScatter100Meter + { + get; + set; + } } public record Preset { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("_changeWeaponName")] - public bool? ChangeWeaponName { get; set; } + public bool? ChangeWeaponName + { + get; + set; + } [JsonPropertyName("_name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get; + set; + } [JsonPropertyName("_items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } - /** Default presets have this property */ + /** + * Default presets have this property + */ [JsonPropertyName("_encyclopedia")] - public string? Encyclopedia { get; set; } + public string? Encyclopedia + { + get; + set; + } } public record QuestSettings { [JsonPropertyName("GlobalRewardRepModifierDailyQuestPvE")] - public double? GlobalRewardRepModifierDailyQuestPvE { get; set; } + public double? GlobalRewardRepModifierDailyQuestPvE + { + get; + set; + } [JsonPropertyName("GlobalRewardRepModifierQuestPvE")] - public double? GlobalRewardRepModifierQuestPvE { get; set; } + public double? GlobalRewardRepModifierQuestPvE + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Location.cs b/Libraries/Core/Models/Eft/Common/Location.cs index d83638d0..43b426d3 100644 --- a/Libraries/Core/Models/Eft/Common/Location.cs +++ b/Libraries/Core/Models/Eft/Common/Location.cs @@ -6,197 +6,397 @@ namespace Core.Models.Eft.Common; public record Location { - /** Map meta-data */ + /** + * Map meta-data + */ [JsonPropertyName("base")] - public LocationBase? Base { get; set; } + public LocationBase? Base + { + get; + set; + } - /** Loose loot positions and item weights */ + /** + * Loose loot positions and item weights + */ [JsonPropertyName("looseLoot")] - public LazyLoad? LooseLoot { get; set; } + public LazyLoad? LooseLoot + { + get; + set; + } - /** Static loot item weights */ + /** + * Static loot item weights + */ [JsonPropertyName("staticLoot")] - public LazyLoad>? StaticLoot { get; set; } + public LazyLoad>? StaticLoot + { + get; + set; + } - /** Static container positions and item weights */ + /** + * Static container positions and item weights + */ [JsonPropertyName("staticContainers")] - public LazyLoad? StaticContainers { get; set; } + public LazyLoad? StaticContainers + { + get; + set; + } [JsonPropertyName("staticAmmo")] - public Dictionary> StaticAmmo { get; set; } + public Dictionary> StaticAmmo + { + get; + set; + } - /** All possible static containers on map + their assign groupings */ + /** + * All possible static containers on map + their assign groupings + */ [JsonPropertyName("statics")] - public StaticContainer? Statics { get; set; } + public StaticContainer? Statics + { + get; + set; + } - /** All possible map extracts */ + /** + * All possible map extracts + */ [JsonPropertyName("allExtracts")] - public Exit[] AllExtracts { get; set; } + public Exit[] AllExtracts + { + get; + set; + } } public record StaticContainer { [JsonPropertyName("containersGroups")] - public Dictionary? ContainersGroups { get; set; } + public Dictionary? ContainersGroups + { + get; + set; + } [JsonPropertyName("containers")] - public Dictionary? Containers { get; set; } + public Dictionary? Containers + { + get; + set; + } } public record ContainerMinMax { [JsonPropertyName("minContainers")] - public int? MinContainers { get; set; } + public int? MinContainers + { + get; + set; + } [JsonPropertyName("maxContainers")] - public int? MaxContainers { get; set; } + public int? MaxContainers + { + get; + set; + } [JsonPropertyName("current")] - public int? Current { get; set; } + public int? Current + { + get; + set; + } [JsonPropertyName("chosenCount")] - public int? ChosenCount { get; set; } + public int? ChosenCount + { + get; + set; + } } public record ContainerData { [JsonPropertyName("groupId")] - public string? GroupId { get; set; } + public string? GroupId + { + get; + set; + } } public record StaticLootDetails { [JsonPropertyName("itemcountDistribution")] - public ItemCountDistribution[] ItemCountDistribution { get; set; } + public ItemCountDistribution[] ItemCountDistribution + { + get; + set; + } [JsonPropertyName("itemDistribution")] - public ItemDistribution[] ItemDistribution { get; set; } + public ItemDistribution[] ItemDistribution + { + get; + set; + } } public record ItemCountDistribution { [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("relativeProbability")] - public float? RelativeProbability { get; set; } + public float? RelativeProbability + { + get; + set; + } } public record ItemDistribution { [JsonPropertyName("tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } [JsonPropertyName("relativeProbability")] - public float? RelativeProbability { get; set; } + public float? RelativeProbability + { + get; + set; + } } public record StaticPropsBase { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("IsContainer")] - public bool? IsContainer { get; set; } + public bool? IsContainer + { + get; + set; + } [JsonPropertyName("useGravity")] - public bool? UseGravity { get; set; } + public bool? UseGravity + { + get; + set; + } [JsonPropertyName("randomRotation")] - public bool? RandomRotation { get; set; } + public bool? RandomRotation + { + get; + set; + } [JsonPropertyName("Position")] - public XYZ? Position { get; set; } + public XYZ? Position + { + get; + set; + } [JsonPropertyName("Rotation")] - public XYZ? Rotation { get; set; } + public XYZ? Rotation + { + get; + set; + } [JsonPropertyName("IsGroupPosition")] - public bool? IsGroupPosition { get; set; } + public bool? IsGroupPosition + { + get; + set; + } [JsonPropertyName("IsAlwaysSpawn")] - public bool? IsAlwaysSpawn { get; set; } + public bool? IsAlwaysSpawn + { + get; + set; + } [JsonPropertyName("GroupPositions")] - public GroupPosition[] GroupPositions { get; set; } + public GroupPosition[] GroupPositions + { + get; + set; + } [JsonPropertyName("Root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } [JsonPropertyName("Items")] - public Item[] Items { get; set; } + public Item[] Items + { + get; + set; + } } [Obsolete("use SpawnpointTemplate")] public record StaticWeaponProps : StaticPropsBase { [JsonPropertyName("Items")] - public Item[] Items { get; set; } + public Item[] Items + { + get; + set; + } } public record StaticContainerDetails { [JsonPropertyName("staticWeapons")] - public List StaticWeapons { get; set; } + public List StaticWeapons + { + get; + set; + } [JsonPropertyName("staticContainers")] - public List StaticContainers { get; set; } + public List StaticContainers + { + get; + set; + } [JsonPropertyName("staticForced")] - public List StaticForced { get; set; } + public List StaticForced + { + get; + set; + } } public record StaticForced { [JsonPropertyName("containerId")] - public string ContainerId { get; set; } + public string ContainerId + { + get; + set; + } [JsonPropertyName("itemTpl")] - public string ItemTpl { get; set; } + public string ItemTpl + { + get; + set; + } } public record StaticContainerData { [JsonPropertyName("probability")] - public float? Probability { get; set; } + public float? Probability + { + get; + set; + } [JsonPropertyName("template")] - public SpawnpointTemplate? Template { get; set; } + public SpawnpointTemplate? Template + { + get; + set; + } } public record StaticAmmoDetails { [JsonPropertyName("tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } [JsonPropertyName("relativeProbability")] - public float? RelativeProbability { get; set; } + public float? RelativeProbability + { + get; + set; + } } public record StaticForcedProps { [JsonPropertyName("containerId")] - public string? ContainerId { get; set; } + public string? ContainerId + { + get; + set; + } [JsonPropertyName("itemTpl")] - public string? ItemTpl { get; set; } + public string? ItemTpl + { + get; + set; + } } [Obsolete("use SpawnpointTemplate")] public record StaticContainerProps : StaticPropsBase { [JsonPropertyName("Items")] - public StaticItem[] Items { get; set; } + public StaticItem[] Items + { + get; + set; + } } public record StaticItem { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } [JsonPropertyName("upd")] - public Upd? Upd { get; set; } + public Upd? Upd + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/LocationBase.cs b/Libraries/Core/Models/Eft/Common/LocationBase.cs index b96738c1..919f983f 100644 --- a/Libraries/Core/Models/Eft/Common/LocationBase.cs +++ b/Libraries/Core/Models/Eft/Common/LocationBase.cs @@ -9,941 +9,2075 @@ namespace Core.Models.Eft.Common; public record LocationBase { [JsonPropertyName("AccessKeys")] - public List? AccessKeys { get; set; } + public List? AccessKeys + { + get; + set; + } [JsonPropertyName("AccessKeysPvE")] - public List? AccessKeysPvE { get; set; } + public List? AccessKeysPvE + { + get; + set; + } [JsonPropertyName("AirdropParameters")] - public List? AirdropParameters { get; set; } + public List? AirdropParameters + { + get; + set; + } [JsonPropertyName("NewSpawnForPlayers")] - public bool? NewSpawnForPlayers { get; set; } + public bool? NewSpawnForPlayers + { + get; + set; + } [JsonPropertyName("OfflineNewSpawn")] - public bool? OfflineNewSpawn { get; set; } + public bool? OfflineNewSpawn + { + get; + set; + } [JsonPropertyName("OfflineOldSpawn")] - public bool? OfflineOldSpawn { get; set; } + public bool? OfflineOldSpawn + { + get; + set; + } [JsonPropertyName("Area")] - public double? Area { get; set; } + public double? Area + { + get; + set; + } [JsonPropertyName("AveragePlayTime")] - public double? AveragePlayTime { get; set; } + public double? AveragePlayTime + { + get; + set; + } [JsonPropertyName("AveragePlayerLevel")] - public double? AveragePlayerLevel { get; set; } + public double? AveragePlayerLevel + { + get; + set; + } [JsonPropertyName("Banners")] - public List? Banners { get; set; } + public List? Banners + { + get; + set; + } [JsonPropertyName("BossLocationSpawn")] - public List BossLocationSpawn { get; set; } + public List BossLocationSpawn + { + get; + set; + } [JsonPropertyName("secretExits")] - public List? SecretExits { get; set; } + public List? SecretExits + { + get; + set; + } [JsonPropertyName("BotStartPlayer")] - public int? BotStartPlayer { get; set; } + public int? BotStartPlayer + { + get; + set; + } [JsonPropertyName("BotAssault")] - public int? BotAssault { get; set; } + public int? BotAssault + { + get; + set; + } - /** 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 { get; set; } + public int? BotEasy + { + get; + set; + } - /** 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 { get; set; } + public int? BotHard + { + get; + set; + } - /** 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 { get; set; } + public int? BotImpossible + { + get; + set; + } [JsonPropertyName("BotLocationModifier")] - public BotLocationModifier? BotLocationModifier { get; set; } + public BotLocationModifier? BotLocationModifier + { + get; + set; + } [JsonPropertyName("BotMarksman")] - public int? BotMarksman { get; set; } + public int? BotMarksman + { + get; + set; + } - /** 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 { get; set; } + public int? BotMax + { + get; + set; + } - /** Is not used in 33420 */ + /** + * Is not used in 33420 + */ [JsonPropertyName("BotMaxPlayer")] - public int? BotMaxPlayer { get; set; } + public int? BotMaxPlayer + { + get; + set; + } - /** Is not used in 33420 */ + /** + * Is not used in 33420 + */ [JsonPropertyName("BotMaxTimePlayer")] - public int? BotMaxTimePlayer { get; set; } + public int? BotMaxTimePlayer + { + get; + set; + } - /** Does not even exist in the client in 33420 */ + /** + * Does not even exist in the client in 33420 + */ [JsonPropertyName("BotMaxPvE")] - public int? BotMaxPvE { get; set; } + public int? BotMaxPvE + { + get; + set; + } - /** 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 { get; set; } + public int? BotNormal + { + get; + set; + } - /** 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 { get; set; } + public int? BotSpawnCountStep + { + get; + set; + } - /** 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 { get; set; } + public int? BotSpawnPeriodCheck + { + get; + set; + } - /** 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 { get; set; } + public int? BotSpawnTimeOffMax + { + get; + set; + } [JsonPropertyName("BotSpawnTimeOffMin")] - public int? BotSpawnTimeOffMin { get; set; } + public int? BotSpawnTimeOffMin + { + get; + set; + } [JsonPropertyName("BotSpawnTimeOnMax")] - public int? BotSpawnTimeOnMax { get; set; } + public int? BotSpawnTimeOnMax + { + get; + set; + } [JsonPropertyName("BotSpawnTimeOnMin")] - public int? BotSpawnTimeOnMin { get; set; } + public int? BotSpawnTimeOnMin + { + get; + set; + } - /** How soon bots will be allowed to spawn */ + /** + * How soon bots will be allowed to spawn + */ [JsonPropertyName("BotStart")] - public int? BotStart { get; set; } + public int? BotStart + { + get; + set; + } - /** After this long bots will no longer spawn */ + /** + * After this long bots will no longer spawn + */ [JsonPropertyName("BotStop")] - public int? BotStop { get; set; } + public int? BotStop + { + get; + set; + } [JsonPropertyName("Description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("DisabledForScav")] - public bool? DisabledForScav { get; set; } + public bool? DisabledForScav + { + get; + set; + } [JsonPropertyName("DisabledScavExits")] - public string? DisabledScavExits { get; set; } + public string? DisabledScavExits + { + get; + set; + } [JsonPropertyName("Enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("EnableCoop")] - public bool? EnableCoop { get; set; } + public bool? EnableCoop + { + get; + set; + } [JsonPropertyName("GlobalLootChanceModifier")] - public double? GlobalLootChanceModifier { get; set; } + public double? GlobalLootChanceModifier + { + get; + set; + } [JsonPropertyName("GlobalLootChanceModifierPvE")] - public double? GlobalLootChanceModifierPvE { get; set; } + public double? GlobalLootChanceModifierPvE + { + get; + set; + } [JsonPropertyName("GlobalContainerChanceModifier")] - public double? GlobalContainerChanceModifier { get; set; } + public double? GlobalContainerChanceModifier + { + get; + set; + } [JsonPropertyName("IconX")] - public double? IconX { get; set; } + public double? IconX + { + get; + set; + } [JsonPropertyName("IconY")] - public double? IconY { get; set; } + public double? IconY + { + get; + set; + } [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Insurance")] - public bool? Insurance { get; set; } + public bool? Insurance + { + get; + set; + } [JsonPropertyName("IsSecret")] - public bool? IsSecret { get; set; } + public bool? IsSecret + { + get; + set; + } [JsonPropertyName("Locked")] - public bool? Locked { get; set; } + public bool? Locked + { + get; + set; + } [JsonPropertyName("Loot")] - public List? Loot { get; set; } + public List? Loot + { + get; + set; + } [JsonPropertyName("MatchMakerMinPlayersByWaitTime")] - public List? MatchMakerMinPlayersByWaitTime { get; set; } + public List? MatchMakerMinPlayersByWaitTime + { + get; + set; + } [JsonPropertyName("MaxBotPerZone")] - public int? MaxBotPerZone { get; set; } + public int? MaxBotPerZone + { + get; + set; + } [JsonPropertyName("MaxDistToFreePoint")] - public int? MaxDistToFreePoint { get; set; } + public int? MaxDistToFreePoint + { + get; + set; + } [JsonPropertyName("MaxPlayers")] - public int? MaxPlayers { get; set; } + public int? MaxPlayers + { + get; + set; + } [JsonPropertyName("MinDistToExitPoint")] - public double? MinDistToExitPoint { get; set; } + public double? MinDistToExitPoint + { + get; + set; + } [JsonPropertyName("MinDistToFreePoint")] - public double? MinDistToFreePoint { get; set; } + public double? MinDistToFreePoint + { + get; + set; + } [JsonPropertyName("MinMaxBots")] - public List? MinMaxBots { get; set; } + public List? MinMaxBots + { + get; + set; + } [JsonPropertyName("MinPlayers")] - public int? MinPlayers { get; set; } + public int? MinPlayers + { + get; + set; + } [JsonPropertyName("MaxCoopGroup")] - public int? MaxCoopGroup { get; set; } + public int? MaxCoopGroup + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("NonWaveGroupScenario")] - public NonWaveGroupScenario? NonWaveGroupScenario { get; set; } + public NonWaveGroupScenario? NonWaveGroupScenario + { + get; + set; + } [JsonPropertyName("NewSpawn")] - public bool? NewSpawn { get; set; } + public bool? NewSpawn + { + get; + set; + } [JsonPropertyName("OcculsionCullingEnabled")] - public bool? OcculsionCullingEnabled { get; set; } + public bool? OcculsionCullingEnabled + { + get; + set; + } [JsonPropertyName("OldSpawn")] - public bool? OldSpawn { get; set; } + public bool? OldSpawn + { + get; + set; + } [JsonPropertyName("OpenZones")] - public string? OpenZones { get; set; } + public string? OpenZones + { + get; + set; + } [JsonPropertyName("Preview")] - public Preview? Preview { get; set; } + public Preview? Preview + { + get; + set; + } [JsonPropertyName("PlayersRequestCount")] - public int? PlayersRequestCount { get; set; } + public int? PlayersRequestCount + { + get; + set; + } [JsonPropertyName("RequiredPlayerLevel")] - public int? RequiredPlayerLevel { get; set; } + public int? RequiredPlayerLevel + { + get; + set; + } [JsonPropertyName("RequiredPlayerLevelMin")] - public int? RequiredPlayerLevelMin { get; set; } + public int? RequiredPlayerLevelMin + { + get; + set; + } [JsonPropertyName("RequiredPlayerLevelMax")] - public int? RequiredPlayerLevelMax { get; set; } + public int? RequiredPlayerLevelMax + { + get; + set; + } [JsonPropertyName("MinPlayerLvlAccessKeys")] - public int? MinPlayerLvlAccessKeys { get; set; } + public int? MinPlayerLvlAccessKeys + { + get; + set; + } [JsonPropertyName("PmcMaxPlayersInGroup")] - public int? PmcMaxPlayersInGroup { get; set; } + public int? PmcMaxPlayersInGroup + { + get; + set; + } [JsonPropertyName("ScavMaxPlayersInGroup")] - public int? ScavMaxPlayersInGroup { get; set; } + public int? ScavMaxPlayersInGroup + { + get; + set; + } [JsonPropertyName("Rules")] - public string? Rules { get; set; } + public string? Rules + { + get; + set; + } [JsonPropertyName("SafeLocation")] - public bool? SafeLocation { get; set; } + public bool? SafeLocation + { + get; + set; + } [JsonPropertyName("Scene")] - public Scene? Scene { get; set; } + public Scene? Scene + { + get; + set; + } [JsonPropertyName("SpawnPointParams")] - public List? SpawnPointParams { get; set; } + public List? SpawnPointParams + { + get; + set; + } [JsonPropertyName("areas")] - public Dictionary? Areas { get; set; } + public Dictionary? Areas + { + get; + set; + } [JsonPropertyName("UnixDateTime")] - public long? UnixDateTime { get; set; } + public long? UnixDateTime + { + get; + set; + } [JsonPropertyName("_Id")] - public string? IdField { get; set; } + public string? IdField + { + get; + set; + } [JsonPropertyName("doors")] - public List? Doors { get; set; } + public List? Doors + { + get; + set; + } [JsonPropertyName("EscapeTimeLimit")] - public double? EscapeTimeLimit { get; set; } + public double? EscapeTimeLimit + { + get; + set; + } // BSG fucked up another property name [JsonPropertyName("escape_time_limit")] public int Escape_Time_Limit_Do_Not_Use { - set => EscapeTimeLimit = value; + set + { + EscapeTimeLimit = value; + } } [JsonPropertyName("EscapeTimeLimitCoop")] - public int? EscapeTimeLimitCoop { get; set; } + public int? EscapeTimeLimitCoop + { + get; + set; + } [JsonPropertyName("EscapeTimeLimitPVE")] - public int? EscapeTimeLimitPVE { get; set; } + public int? EscapeTimeLimitPVE + { + get; + set; + } [JsonPropertyName("Events")] - public LocationEvents? Events { get; set; } + public LocationEvents? Events + { + get; + set; + } // Checked in client [JsonPropertyName("exit_access_time")] - public int? ExitAccessTime { get; set; } + public int? ExitAccessTime + { + get; + set; + } [JsonPropertyName("ForceOnlineRaidInPVE")] - public bool? ForceOnlineRaidInPVE { get; set; } + public bool? ForceOnlineRaidInPVE + { + get; + set; + } [JsonPropertyName("ExitZones")] - public string? ExitZones { get; set; } + public string? ExitZones + { + get; + set; + } [JsonPropertyName("exit_count")] - public int? ExitCount { get; set; } + public int? ExitCount + { + get; + set; + } [JsonPropertyName("exit_time")] - public double? ExitTime { get; set; } + public double? ExitTime + { + get; + set; + } [JsonPropertyName("exits")] - public List? Exits { get; set; } + public List? Exits + { + get; + set; + } [JsonPropertyName("filter_ex")] - public List? FilterEx { get; set; } + public List? FilterEx + { + get; + set; + } [JsonPropertyName("limits")] - public List? Limits { get; set; } + public List? Limits + { + get; + set; + } [JsonPropertyName("matching_min_seconds")] - public int? MatchingMinSeconds { get; set; } + public int? MatchingMinSeconds + { + get; + set; + } [JsonPropertyName("GenerateLocalLootCache")] - public bool? GenerateLocalLootCache { get; set; } + public bool? GenerateLocalLootCache + { + get; + set; + } [JsonPropertyName("maxItemCountInLocation")] - public List? MaxItemCountInLocation { get; set; } + public List? MaxItemCountInLocation + { + get; + set; + } [JsonPropertyName("sav_summon_seconds")] - public int? SavSummonSeconds { get; set; } + public int? SavSummonSeconds + { + get; + set; + } [JsonPropertyName("tmp_location_field_remove_me")] - public int? TmpLocationFieldRemoveMe { get; set; } + public int? TmpLocationFieldRemoveMe + { + get; + set; + } [JsonPropertyName("transits")] - public List? Transits { get; set; } + public List? Transits + { + get; + set; + } [JsonPropertyName("users_gather_seconds")] - public int? UsersGatherSeconds { get; set; } + public int? UsersGatherSeconds + { + get; + set; + } [JsonPropertyName("users_spawn_seconds_n")] - public int? UsersSpawnSecondsN { get; set; } + public int? UsersSpawnSecondsN + { + get; + set; + } [JsonPropertyName("users_spawn_seconds_n2")] - public int? UsersSpawnSecondsN2 { get; set; } + public int? UsersSpawnSecondsN2 + { + get; + set; + } [JsonPropertyName("users_summon_seconds")] - public int? UsersSummonSeconds { get; set; } + public int? UsersSummonSeconds + { + get; + set; + } [JsonPropertyName("waves")] - public List Waves { get; set; } + public List Waves + { + get; + set; + } } public record Transit { [JsonPropertyName("activateAfterSec")] - public int? ActivateAfterSeconds { get; set; } // TODO: Int in client + public int? ActivateAfterSeconds + { + get; + set; + } // TODO: Int in client [JsonPropertyName("active")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } [JsonPropertyName("events")] - public bool? Events { get; set; } + public bool? Events + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("conditions")] - public string? Conditions { get; set; } + public string? Conditions + { + get; + set; + } [JsonPropertyName("description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("id")] - public int? Id { get; set; } + public int? Id + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("target")] - public string? Target { get; set; } + public string? Target + { + get; + set; + } [JsonPropertyName("time")] - public long? Time { get; set; } + public long? Time + { + get; + set; + } } public record NonWaveGroupScenario { [JsonPropertyName("Chance")] - public double? Chance { get; set; } + public double? Chance + { + get; + set; + } [JsonPropertyName("Enabled")] - public bool? IsEnabled { get; set; } + public bool? IsEnabled + { + get; + set; + } [JsonPropertyName("MaxToBeGroup")] - public int? MaximumToBeGrouped { get; set; } + public int? MaximumToBeGrouped + { + get; + set; + } [JsonPropertyName("MinToBeGroup")] - public int? MinimumToBeGrouped { get; set; } + public int? MinimumToBeGrouped + { + get; + set; + } } public record Limit : MinMax { [JsonPropertyName("items")] - public object[] Items { get; set; } // TODO: was on TS any[] hmmm.. + public object[] Items + { + get; + set; + } // TODO: was on TS any[] hmmm.. [JsonPropertyName("min")] - public int? Min { get; set; } + public int? Min + { + get; + set; + } [JsonPropertyName("max")] - public int? Max { get; set; } + public int? Max + { + get; + set; + } } public record AirdropParameter { [JsonPropertyName("AirdropPointDeactivateDistance")] - public int? AirdropPointDeactivateDistance { get; set; } + public int? AirdropPointDeactivateDistance + { + get; + set; + } [JsonPropertyName("MinPlayersCountToSpawnAirdrop")] - public int? MinimumPlayersCountToSpawnAirdrop { get; set; } + public int? MinimumPlayersCountToSpawnAirdrop + { + get; + set; + } [JsonPropertyName("PlaneAirdropChance")] - public double? PlaneAirdropChance { get; set; } + public double? PlaneAirdropChance + { + get; + set; + } [JsonPropertyName("PlaneAirdropCooldownMax")] - public int? PlaneAirdropCooldownMax { get; set; } + public int? PlaneAirdropCooldownMax + { + get; + set; + } [JsonPropertyName("PlaneAirdropCooldownMin")] - public int? PlaneAirdropCooldownMin { get; set; } + public int? PlaneAirdropCooldownMin + { + get; + set; + } [JsonPropertyName("PlaneAirdropEnd")] - public int? PlaneAirdropEnd { get; set; } + public int? PlaneAirdropEnd + { + get; + set; + } [JsonPropertyName("PlaneAirdropMax")] - public int? PlaneAirdropMax { get; set; } + public int? PlaneAirdropMax + { + get; + set; + } [JsonPropertyName("PlaneAirdropStartMax")] - public int? PlaneAirdropStartMax { get; set; } + public int? PlaneAirdropStartMax + { + get; + set; + } [JsonPropertyName("PlaneAirdropStartMin")] - public int? PlaneAirdropStartMin { get; set; } + public int? PlaneAirdropStartMin + { + get; + set; + } [JsonPropertyName("UnsuccessfulTryPenalty")] - public int? UnsuccessfulTryPenalty { get; set; } + public int? UnsuccessfulTryPenalty + { + get; + set; + } } public record Banner { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("pic")] - public Pic? Picture { get; set; } + public Pic? Picture + { + get; + set; + } } public record Pic { [JsonPropertyName("path")] - public string? Path { get; set; } + public string? Path + { + get; + set; + } [JsonPropertyName("rcid")] - public string? Rcid { get; set; } + public string? Rcid + { + get; + set; + } } public record BossLocationSpawn { [JsonPropertyName("BossChance")] - public double? BossChance { get; set; } + public double? BossChance + { + get; + set; + } [JsonPropertyName("BossDifficult")] - public string? BossDifficulty { get; set; } + public string? BossDifficulty + { + get; + set; + } [JsonPropertyName("BossEscortAmount")] - public string? BossEscortAmount { get; set; } + public string? BossEscortAmount + { + get; + set; + } [JsonPropertyName("BossEscortDifficult")] - public string? BossEscortDifficulty { get; set; } + public string? BossEscortDifficulty + { + get; + set; + } [JsonPropertyName("BossEscortType")] - public string? BossEscortType { get; set; } + public string? BossEscortType + { + get; + set; + } [JsonPropertyName("BossName")] - public string? BossName { get; set; } + public string? BossName + { + get; + set; + } [JsonPropertyName("BossPlayer")] - public bool? IsBossPlayer { get; set; } + public bool? IsBossPlayer + { + get; + set; + } [JsonPropertyName("BossZone")] - public string? BossZone { get; set; } + public string? BossZone + { + get; + set; + } [JsonPropertyName("RandomTimeSpawn")] - public bool? IsRandomTimeSpawn { get; set; } + public bool? IsRandomTimeSpawn + { + get; + set; + } [JsonPropertyName("Time")] - public double? Time { get; set; } + public double? Time + { + get; + set; + } [JsonPropertyName("TriggerId")] - public string? TriggerId { get; set; } + public string? TriggerId + { + get; + set; + } [JsonPropertyName("TriggerName")] - public string? TriggerName { get; set; } + public string? TriggerName + { + get; + set; + } [JsonPropertyName("Delay")] - public double? Delay { get; set; } + public double? Delay + { + get; + set; + } [JsonPropertyName("DependKarma")] - public bool? DependKarma { get; set; } + public bool? DependKarma + { + get; + set; + } [JsonPropertyName("DependKarmaPVE")] - public bool? DependKarmaPVE { get; set; } + public bool? DependKarmaPVE + { + get; + set; + } [JsonPropertyName("ForceSpawn")] - public bool? ForceSpawn { get; set; } + public bool? ForceSpawn + { + get; + set; + } [JsonPropertyName("IgnoreMaxBots")] - public bool? IgnoreMaxBots { get; set; } + public bool? IgnoreMaxBots + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("Supports")] - public List Supports { get; set; } + public List Supports + { + get; + set; + } [JsonPropertyName("sptId")] - public string? SptId { get; set; } + public string? SptId + { + get; + set; + } [JsonPropertyName("SpawnMode")] - public List SpawnMode { get; set; } + public List SpawnMode + { + get; + set; + } } public record BossSupport { [JsonPropertyName("BossEscortAmount")] - public string? BossEscortAmount { get; set; } + public string? BossEscortAmount + { + get; + set; + } [JsonPropertyName("BossEscortDifficult")] [JsonConverter(typeof(ListOrTConverterFactory))] - public ListOrT BossEscortDifficulty { get; set; } + public ListOrT BossEscortDifficulty + { + get; + set; + } [JsonPropertyName("BossEscortType")] - public string? BossEscortType { get; set; } + public string? BossEscortType + { + get; + set; + } } public record BotLocationModifier { [JsonPropertyName("AccuracySpeed")] - public double? AccuracySpeed { get; set; } + public double? AccuracySpeed + { + get; + set; + } [JsonPropertyName("AdditionalHostilitySettings")] - public List AdditionalHostilitySettings { get; set; } + public List AdditionalHostilitySettings + { + get; + set; + } [JsonPropertyName("DistToActivate")] - public double? DistanceToActivate { get; set; } + public double? DistanceToActivate + { + get; + set; + } [JsonPropertyName("DistToActivatePvE")] - public double? DistanceToActivatePvE { get; set; } + public double? DistanceToActivatePvE + { + get; + set; + } [JsonPropertyName("DistToPersueAxemanCoef")] - public double? DistanceToPursueAxemanCoefficient { get; set; } + public double? DistanceToPursueAxemanCoefficient + { + get; + set; + } [JsonPropertyName("DistToSleep")] - public double? DistanceToSleep { get; set; } + public double? DistanceToSleep + { + get; + set; + } [JsonPropertyName("DistToSleepPvE")] - public double? DistanceToSleepPvE { get; set; } + public double? DistanceToSleepPvE + { + get; + set; + } [JsonPropertyName("GainSight")] - public double? GainSight { get; set; } + public double? GainSight + { + get; + set; + } [JsonPropertyName("KhorovodChance")] - public double? KhorovodChance { get; set; } + public double? KhorovodChance + { + get; + set; + } [JsonPropertyName("MagnetPower")] - public double? MagnetPower { get; set; } + public double? MagnetPower + { + get; + set; + } [JsonPropertyName("MarksmanAccuratyCoef")] - public double? MarksmanAccuracyCoefficient { get; set; } + public double? MarksmanAccuracyCoefficient + { + get; + set; + } [JsonPropertyName("Scattering")] - public double? Scattering { get; set; } + public double? Scattering + { + get; + set; + } [JsonPropertyName("VisibleDistance")] - public double? VisibleDistance { get; set; } + public double? VisibleDistance + { + get; + set; + } [JsonPropertyName("MaxExfiltrationTime")] - public double? MaxExfiltrationTime { get; set; } + public double? MaxExfiltrationTime + { + get; + set; + } [JsonPropertyName("MinExfiltrationTime")] - public double? MinExfiltrationTime { get; set; } + public double? MinExfiltrationTime + { + get; + set; + } } public record AdditionalHostilitySettings { [JsonPropertyName("AlwaysEnemies")] - public List? AlwaysEnemies { get; set; } + public List? AlwaysEnemies + { + get; + set; + } [JsonPropertyName("AlwaysFriends")] - public List? AlwaysFriends { get; set; } + public List? AlwaysFriends + { + get; + set; + } [JsonPropertyName("BearEnemyChance")] - public double? BearEnemyChance { get; set; } + public double? BearEnemyChance + { + get; + set; + } [JsonPropertyName("BearPlayerBehaviour")] - public string? BearPlayerBehaviour { get; set; } + public string? BearPlayerBehaviour + { + get; + set; + } [JsonPropertyName("BotRole")] - public string? BotRole { get; set; } + public string? BotRole + { + get; + set; + } [JsonPropertyName("ChancedEnemies")] - public List? ChancedEnemies { get; set; } + public List? ChancedEnemies + { + get; + set; + } [JsonPropertyName("Neutral")] - public List? Neutral { get; set; } + public List? Neutral + { + get; + set; + } [JsonPropertyName("SavagePlayerBehaviour")] - public string? SavagePlayerBehaviour { get; set; } + public string? SavagePlayerBehaviour + { + get; + set; + } [JsonPropertyName("SavageEnemyChance")] - public double? SavageEnemyChance { get; set; } + public double? SavageEnemyChance + { + get; + set; + } [JsonPropertyName("UsecEnemyChance")] - public double? UsecEnemyChance { get; set; } + public double? UsecEnemyChance + { + get; + set; + } [JsonPropertyName("UsecPlayerBehaviour")] - public string? UsecPlayerBehaviour { get; set; } + public string? UsecPlayerBehaviour + { + get; + set; + } [JsonPropertyName("Warn")] - public List? Warn { get; set; } + public List? Warn + { + get; + set; + } } public record ChancedEnemy { [JsonPropertyName("EnemyChance")] - public int? EnemyChance { get; set; } + public int? EnemyChance + { + get; + set; + } [JsonPropertyName("Role")] - public string? Role { get; set; } + public string? Role + { + get; + set; + } } public record MinMaxBot : MinMax { [JsonPropertyName("WildSpawnType")] - public string? WildSpawnType { get; set; } // TODO: Could be WildSpawnType or string + public string? WildSpawnType + { + get; + set; + } // TODO: Could be WildSpawnType or string } public record MinPlayerWaitTime { [JsonPropertyName("minPlayers")] - public int? MinPlayers { get; set; } + public int? MinPlayers + { + get; + set; + } [JsonPropertyName("time")] - public long? Time { get; set; } + public long? Time + { + get; + set; + } } public record Preview { [JsonPropertyName("path")] - public string? Path { get; set; } + public string? Path + { + get; + set; + } [JsonPropertyName("rcid")] - public string? Rcid { get; set; } + public string? Rcid + { + get; + set; + } } public record Scene { [JsonPropertyName("path")] - public string? Path { get; set; } + public string? Path + { + get; + set; + } [JsonPropertyName("rcid")] - public string? Rcid { get; set; } + public string? Rcid + { + get; + set; + } } public record SpawnPointParam { [JsonPropertyName("BotZoneName")] - public string? BotZoneName { get; set; } + public string? BotZoneName + { + get; + set; + } [JsonPropertyName("Categories")] - public List? Categories { get; set; } + public List? Categories + { + get; + set; + } [JsonPropertyName("ColliderParams")] - public ColliderParams? ColliderParams { get; set; } + public ColliderParams? ColliderParams + { + get; + set; + } [JsonPropertyName("CorePointId")] - public int? CorePointId { get; set; } + public int? CorePointId + { + get; + set; + } [JsonPropertyName("DelayToCanSpawnSec")] - public double? DelayToCanSpawnSec { get; set; } + public double? DelayToCanSpawnSec + { + get; + set; + } [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Infiltration")] - public string? Infiltration { get; set; } + public string? Infiltration + { + get; + set; + } [JsonPropertyName("Position")] - public XYZ? Position { get; set; } + public XYZ? Position + { + get; + set; + } [JsonPropertyName("Rotation")] - public double? Rotation { get; set; } + public double? Rotation + { + get; + set; + } [JsonPropertyName("Sides")] - public List? Sides { get; set; } + public List? Sides + { + get; + set; + } } public record ColliderParams { [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get; + set; + } [JsonPropertyName("_props")] - public ColliderProps? Props { get; set; } + public ColliderProps? Props + { + get; + set; + } } public record ColliderProps { [JsonPropertyName("Center")] - public XYZ? Center { get; set; } + public XYZ? Center + { + get; + set; + } [JsonPropertyName("Size")] - public XYZ? Size { get; set; } + public XYZ? Size + { + get; + set; + } [JsonPropertyName("Radius")] - public double? Radius { get; set; } + public double? Radius + { + get; + set; + } } 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 { get; set; } + public double? Chance + { + get; + set; + } [JsonPropertyName("ChancePVE")] - public double? ChancePVE { get; set; } + public double? ChancePVE + { + get; + set; + } [JsonPropertyName("Count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("CountPVE")] - public int? CountPVE { get; set; } + public int? CountPVE + { + get; + set; + } // Had to add this property as BSG sometimes names the properties with full PVE capitals // This property will just point the value to CountPve [JsonPropertyName("CountPve")] public int CountPve { - set => CountPVE = value; + set + { + CountPVE = value; + } } [JsonPropertyName("EntryPoints")] - public string? EntryPoints { get; set; } + public string? EntryPoints + { + get; + set; + } [JsonPropertyName("EventAvailable")] - public bool? EventAvailable { get; set; } + public bool? EventAvailable + { + get; + set; + } [JsonPropertyName("EligibleForPMC")] - public bool? EligibleForPMC { get; set; } + public bool? EligibleForPMC + { + get; + set; + } [JsonPropertyName("EligibleForScav")] - public bool? EligibleForScav { get; set; } + public bool? EligibleForScav + { + get; + set; + } [JsonPropertyName("ExfiltrationTime")] - public double? ExfiltrationTime { get; set; } + public double? ExfiltrationTime + { + get; + set; + } [JsonPropertyName("ExfiltrationTimePVE")] - public double? ExfiltrationTimePVE { get; set; } + public double? ExfiltrationTimePVE + { + get; + set; + } [JsonPropertyName("ExfiltrationType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public ExfiltrationType? ExfiltrationType { get; set; } + public ExfiltrationType? ExfiltrationType + { + get; + set; + } [JsonPropertyName("RequiredSlot")] [JsonConverter(typeof(JsonStringEnumConverter))] - public EquipmentSlots? RequiredSlot { get; set; } + public EquipmentSlots? RequiredSlot + { + get; + set; + } [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("MaxTime")] - public double? MaxTime { get; set; } + public double? MaxTime + { + get; + set; + } [JsonPropertyName("MaxTimePVE")] - public double? MaxTimePVE { get; set; } + public double? MaxTimePVE + { + get; + set; + } // Checked in client [JsonPropertyName("MinTime")] - public double? MinTime { get; set; } + public double? MinTime + { + get; + set; + } [JsonPropertyName("MinTimePVE")] - public double? MinTimePVE { get; set; } + public double? MinTimePVE + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("_Name")] - public string? _Name { get; set; } + public string? _Name + { + get; + set; + } [JsonPropertyName("_name")] - public string? _NameLower { get; set; } + public string? _NameLower + { + get; + set; + } [JsonPropertyName("PassageRequirement")] [JsonConverter(typeof(JsonStringEnumConverter))] - public RequirementState? PassageRequirement { get; set; } + public RequirementState? PassageRequirement + { + get; + set; + } [JsonPropertyName("PlayersCount")] - public int? PlayersCount { get; set; } + public int? PlayersCount + { + get; + set; + } [JsonPropertyName("PlayersCountPVE")] - public int? PlayersCountPVE { get; set; } + public int? PlayersCountPVE + { + get; + set; + } [JsonPropertyName("RequirementTip")] - public string? RequirementTip { get; set; } + public string? RequirementTip + { + get; + set; + } [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } } public record MaxItemCountInLocation { [JsonPropertyName("TemplateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("Value")] - public int? Value { get; set; } + public int? Value + { + get; + set; + } } public record Wave { [JsonPropertyName("BotPreset")] - public string? BotPreset { get; set; } + public string? BotPreset + { + get; + set; + } [JsonPropertyName("BotSide")] - public string? BotSide { get; set; } + public string? BotSide + { + get; + set; + } [JsonPropertyName("SpawnPoints")] - public string? SpawnPoints { get; set; } + public string? SpawnPoints + { + get; + set; + } [JsonPropertyName("WildSpawnType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public WildSpawnType? WildSpawnType { get; set; } + public WildSpawnType? WildSpawnType + { + get; + set; + } [JsonPropertyName("isPlayers")] - public bool? IsPlayers { get; set; } + public bool? IsPlayers + { + get; + set; + } [JsonPropertyName("number")] - public int? Number { get; set; } + public int? Number + { + get; + set; + } [JsonPropertyName("slots_max")] - public int? SlotsMax { get; set; } + public int? SlotsMax + { + get; + set; + } [JsonPropertyName("slots_min")] - public int? SlotsMin { get; set; } + public int? SlotsMin + { + get; + set; + } [JsonPropertyName("time_max")] - public int? TimeMax { get; set; } + public int? TimeMax + { + get; + set; + } [JsonPropertyName("time_min")] - public int? TimeMin { get; set; } + public int? TimeMin + { + get; + set; + } - /** 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 { get; set; } + public string? SptId + { + get; + set; + } [JsonPropertyName("ChanceGroup")] - public int? ChanceGroup { get; set; } + public int? ChanceGroup + { + get; + set; + } - /** 'pve' and/or 'regular' */ + /** + * 'pve' and/or 'regular' + */ [JsonPropertyName("SpawnMode")] - public List? SpawnMode { get; set; } + public List? SpawnMode + { + get; + set; + } [JsonPropertyName("OpenZones")] - public string? OpenZones { get; set; } + public string? OpenZones + { + get; + set; + } } public record LocationEvents { [JsonPropertyName("Halloween2024")] - public Halloween2024? Halloween2024 { get; set; } + public Halloween2024? Halloween2024 + { + get; + set; + } - public Khorovod? Khorovod { get; set; } + public Khorovod? Khorovod + { + get; + set; + } } public record Khorovod { - public double? Chance { get; set; } + public double? Chance + { + get; + set; + } } public record Halloween2024 { [JsonPropertyName("CrowdAttackBlockRadius")] - public int? CrowdAttackBlockRadius { get; set; } + public int? CrowdAttackBlockRadius + { + get; + set; + } [JsonPropertyName("CrowdAttackSpawnParams")] - public List? CrowdAttackSpawnParams { get; set; } + public List? CrowdAttackSpawnParams + { + get; + set; + } [JsonPropertyName("CrowdCooldownPerPlayerSec")] - public int? CrowdCooldownPerPlayerSec { get; set; } + public int? CrowdCooldownPerPlayerSec + { + get; + set; + } [JsonPropertyName("CrowdsLimit")] - public int? CrowdsLimit { get; set; } + public int? CrowdsLimit + { + get; + set; + } [JsonPropertyName("InfectedLookCoeff")] - public double? InfectedLookCoeff { get; set; } + public double? InfectedLookCoeff + { + get; + set; + } [JsonPropertyName("MaxCrowdAttackSpawnLimit")] - public int? MaxCrowdAttackSpawnLimit { get; set; } + public int? MaxCrowdAttackSpawnLimit + { + get; + set; + } [JsonPropertyName("MinInfectionPercentage")] - public double? MinInfectionPercentage { get; set; } + public double? MinInfectionPercentage + { + get; + set; + } [JsonPropertyName("MinSpawnDistToPlayer")] - public double? MinSpawnDistToPlayer { get; set; } + public double? MinSpawnDistToPlayer + { + get; + set; + } [JsonPropertyName("TargetPointSearchRadiusLimit")] - public double? TargetPointSearchRadiusLimit { get; set; } + public double? TargetPointSearchRadiusLimit + { + get; + set; + } [JsonPropertyName("ZombieCallDeltaRadius")] - public double? ZombieCallDeltaRadius { get; set; } + public double? ZombieCallDeltaRadius + { + get; + set; + } [JsonPropertyName("ZombieCallPeriodSec")] - public int? ZombieCallPeriodSec { get; set; } + public int? ZombieCallPeriodSec + { + get; + set; + } [JsonPropertyName("ZombieCallRadiusLimit")] - public double? ZombieCallRadiusLimit { get; set; } + public double? ZombieCallRadiusLimit + { + get; + set; + } [JsonPropertyName("ZombieMultiplier")] - public double? ZombieMultiplier { get; set; } + public double? ZombieMultiplier + { + get; + set; + } [JsonPropertyName("InfectionPercentage")] - public double? InfectionPercentage { get; set; } + public double? InfectionPercentage + { + get; + set; + } - public Khorovod? Khorovod { get; set; } + public Khorovod? Khorovod + { + get; + set; + } } public record CrowdAttackSpawnParam { [JsonPropertyName("Difficulty")] - public string? Difficulty { get; set; } + public string? Difficulty + { + get; + set; + } [JsonPropertyName("Role")] - public string? Role { get; set; } + public string? Role + { + get; + set; + } [JsonPropertyName("Weight")] - public int? Weight { get; set; } + public int? Weight + { + get; + set; + } } public record Area { [JsonPropertyName("center")] - public XYZ? Center { get; set; } + public XYZ? Center + { + get; + set; + } [JsonPropertyName("infiltrationZone")] - public string? InfiltrationZone { get; set; } + public string? InfiltrationZone + { + get; + set; + } [JsonPropertyName("orientation")] - public double? Orientation { get; set; } + public double? Orientation + { + get; + set; + } [JsonPropertyName("position")] - public XYZ? Position { get; set; } + public XYZ? Position + { + get; + set; + } [JsonPropertyName("sides")] - public List? Sides { get; set; } + public List? Sides + { + get; + set; + } [JsonPropertyName("size")] - public XYZ? Size { get; set; } + public XYZ? Size + { + get; + set; + } } public enum WildSpawnType diff --git a/Libraries/Core/Models/Eft/Common/LooseLoot.cs b/Libraries/Core/Models/Eft/Common/LooseLoot.cs index f4594048..7b5482f6 100644 --- a/Libraries/Core/Models/Eft/Common/LooseLoot.cs +++ b/Libraries/Core/Models/Eft/Common/LooseLoot.cs @@ -6,111 +6,225 @@ namespace Core.Models.Eft.Common; public record LooseLoot { [JsonPropertyName("spawnpointCount")] - public SpawnpointCount? SpawnpointCount { get; set; } + public SpawnpointCount? SpawnpointCount + { + get; + set; + } [JsonPropertyName("spawnpointsForced")] - public List? SpawnpointsForced { get; set; } + public List? SpawnpointsForced + { + get; + set; + } [JsonPropertyName("spawnpoints")] - public List? Spawnpoints { get; set; } + public List? Spawnpoints + { + get; + set; + } } public record SpawnpointCount { [JsonPropertyName("mean")] - public double? Mean { get; set; } + public double? Mean + { + get; + set; + } [JsonPropertyName("std")] - public double? Std { get; set; } + public double? Std + { + get; + set; + } } public record SpawnpointTemplate { + private string? _root; + [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("IsContainer")] - public bool? IsContainer { get; set; } + public bool? IsContainer + { + get; + set; + } [JsonPropertyName("useGravity")] - public bool? UseGravity { get; set; } + public bool? UseGravity + { + get; + set; + } [JsonPropertyName("randomRotation")] - public bool? RandomRotation { get; set; } + public bool? RandomRotation + { + get; + set; + } [JsonPropertyName("Position")] - public XYZ? Position { get; set; } + public XYZ? Position + { + get; + set; + } [JsonPropertyName("Rotation")] - public XYZ? Rotation { get; set; } + public XYZ? Rotation + { + get; + set; + } [JsonPropertyName("IsAlwaysSpawn")] - public bool? IsAlwaysSpawn { get; set; } + public bool? IsAlwaysSpawn + { + get; + set; + } [JsonPropertyName("IsGroupPosition")] - public bool? IsGroupPosition { get; set; } + public bool? IsGroupPosition + { + get; + set; + } [JsonPropertyName("GroupPositions")] - public List? GroupPositions { get; set; } + public List? GroupPositions + { + get; + set; + } - private string? _root; [JsonPropertyName("Root")] public string? Root { - get => _root; - set => _root = value == null ? null : string.Intern(value); + get + { + return _root; + } + set + { + _root = value == null ? null : string.Intern(value); + } } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record GroupPosition { private string? _name; + [JsonPropertyName("Name")] public string? Name { - get => _name; - set => _name = value == null ? null : string.Intern(value); + get + { + return _name; + } + set + { + _name = value == null ? null : string.Intern(value); + } } [JsonPropertyName("Weight")] - public double? Weight { get; set; } + public double? Weight + { + get; + set; + } [JsonPropertyName("Position")] - public XYZ? Position { get; set; } + public XYZ? Position + { + get; + set; + } [JsonPropertyName("Rotation")] - public XYZ? Rotation { get; set; } + public XYZ? Rotation + { + get; + set; + } } public record Spawnpoint { [JsonPropertyName("locationId")] - public string? LocationId { get; set; } + public string? LocationId + { + get; + set; + } [JsonPropertyName("probability")] - public double? Probability { get; set; } + public double? Probability + { + get; + set; + } [JsonPropertyName("template")] - public SpawnpointTemplate? Template { get; set; } + public SpawnpointTemplate? Template + { + get; + set; + } [JsonPropertyName("itemDistribution")] - public List? ItemDistribution { get; set; } + public List? ItemDistribution + { + get; + set; + } } public record LooseLootItemDistribution { [JsonPropertyName("composedKey")] - public ComposedKey? ComposedKey { get; set; } + public ComposedKey? ComposedKey + { + get; + set; + } [JsonPropertyName("relativeProbability")] - public double? RelativeProbability { get; set; } + public double? RelativeProbability + { + get; + set; + } } public record ComposedKey { [JsonPropertyName("key")] - public string? Key { get; set; } + public string? Key + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/MetricsTableData.cs b/Libraries/Core/Models/Eft/Common/MetricsTableData.cs index a6ec70a3..50988c9f 100644 --- a/Libraries/Core/Models/Eft/Common/MetricsTableData.cs +++ b/Libraries/Core/Models/Eft/Common/MetricsTableData.cs @@ -5,17 +5,37 @@ namespace Core.Models.Eft.Common; public record MetricsTableData { [JsonPropertyName("Keys")] - public List? Keys { get; set; } + public List? Keys + { + get; + set; + } [JsonPropertyName("NetProcessingBins")] - public List? NetProcessingBins { get; set; } + public List? NetProcessingBins + { + get; + set; + } [JsonPropertyName("RenderBins")] - public List? RenderBins { get; set; } + public List? RenderBins + { + get; + set; + } [JsonPropertyName("GameUpdateBins")] - public List? GameUpdateBins { get; set; } + public List? GameUpdateBins + { + get; + set; + } [JsonPropertyName("MemoryMeasureInterval")] - public int? MemoryMeasureInterval { get; set; } + public int? MemoryMeasureInterval + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/PmcData.cs b/Libraries/Core/Models/Eft/Common/PmcData.cs index fc8521b0..e954e29d 100644 --- a/Libraries/Core/Models/Eft/Common/PmcData.cs +++ b/Libraries/Core/Models/Eft/Common/PmcData.cs @@ -8,11 +8,23 @@ public record PmcData : BotBase { [JsonPropertyName("Prestige")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public Dictionary? Prestige { get; set; } + public Dictionary? Prestige + { + get; + set; + } - public Dictionary? CheckedMagazines { get; set; } + public Dictionary? CheckedMagazines + { + get; + set; + } - public object CheckedChambers { get; set; } + public object CheckedChambers + { + get; + set; + } } public record PostRaidPmcData : PmcData @@ -22,9 +34,19 @@ public record PostRaidPmcData : PmcData public record PostRaidStats { [JsonPropertyName("Eft")] - public EftStats? Eft { get; set; } + public EftStats? Eft + { + get; + set; + } - /** 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 { get; set; } + public EftStats? Arena + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Request/BaseInteractionRequestData.cs b/Libraries/Core/Models/Eft/Common/Request/BaseInteractionRequestData.cs index ffa9981e..f94174a0 100644 --- a/Libraries/Core/Models/Eft/Common/Request/BaseInteractionRequestData.cs +++ b/Libraries/Core/Models/Eft/Common/Request/BaseInteractionRequestData.cs @@ -5,20 +5,40 @@ namespace Core.Models.Eft.Common.Request; public record BaseInteractionRequestData { [JsonPropertyName("Action")] - public string? Action { get; set; } + public string? Action + { + get; + set; + } [JsonPropertyName("fromOwner")] - public OwnerInfo? FromOwner { get; set; } + public OwnerInfo? FromOwner + { + get; + set; + } [JsonPropertyName("toOwner")] - public OwnerInfo? ToOwner { get; set; } + public OwnerInfo? ToOwner + { + get; + set; + } } public record OwnerInfo { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Request/UIDRequestData.cs b/Libraries/Core/Models/Eft/Common/Request/UIDRequestData.cs index 859dbe51..3066ea8e 100644 --- a/Libraries/Core/Models/Eft/Common/Request/UIDRequestData.cs +++ b/Libraries/Core/Models/Eft/Common/Request/UIDRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Common.Request; public record UIDRequestData : IRequestData { [JsonPropertyName("uid")] - public string? Uid { get; set; } + public string? Uid + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/Achievement.cs b/Libraries/Core/Models/Eft/Common/Tables/Achievement.cs index 0c3a9b9b..05946d86 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Achievement.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Achievement.cs @@ -5,65 +5,145 @@ namespace Core.Models.Eft.Common.Tables; public record Achievement { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("imageUrl")] - public string? ImageUrl { get; set; } + public string? ImageUrl + { + get; + set; + } [JsonPropertyName("assetPath")] - public string? AssetPath { get; set; } + public string? AssetPath + { + get; + set; + } [JsonPropertyName("rewards")] - public List? Rewards { get; set; } + public List? Rewards + { + get; + set; + } [JsonPropertyName("conditions")] - public AchievementQuestConditionTypes? Conditions { get; set; } + public AchievementQuestConditionTypes? Conditions + { + get; + set; + } [JsonPropertyName("instantComplete")] - public bool? InstantComplete { get; set; } + public bool? InstantComplete + { + get; + set; + } [JsonPropertyName("showNotificationsInGame")] - public bool? ShowNotificationsInGame { get; set; } + public bool? ShowNotificationsInGame + { + get; + set; + } [JsonPropertyName("showProgress")] - public bool? ShowProgress { get; set; } + public bool? ShowProgress + { + get; + set; + } [JsonPropertyName("prefab")] - public string? Prefab { get; set; } + public string? Prefab + { + get; + set; + } [JsonPropertyName("rarity")] - public string? Rarity { get; set; } + public string? Rarity + { + get; + set; + } [JsonPropertyName("hidden")] - public bool? Hidden { get; set; } + public bool? Hidden + { + get; + set; + } [JsonPropertyName("showConditions")] - public bool? ShowConditions { get; set; } + public bool? ShowConditions + { + get; + set; + } [JsonPropertyName("progressBarEnabled")] - public bool? ProgressBarEnabled { get; set; } + public bool? ProgressBarEnabled + { + get; + set; + } [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } } public record AchievementQuestConditionTypes { [JsonPropertyName("started")] - public List? Started { get; set; } + public List? Started + { + get; + set; + } [JsonPropertyName("availableForFinish")] - public List? AvailableForFinish { get; set; } + public List? AvailableForFinish + { + get; + set; + } [JsonPropertyName("availableForStart")] - public List? AvailableForStart { get; set; } + public List? AvailableForStart + { + get; + set; + } [JsonPropertyName("success")] - public List? Success { get; set; } + public List? Success + { + get; + set; + } [JsonPropertyName("fail")] - public List? Fail { get; set; } + public List? Fail + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs index 03fb105f..92d53df7 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs @@ -10,249 +10,610 @@ namespace Core.Models.Eft.Common.Tables; public record BotBase { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } - /** 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 { get; set; } + public string? SessionId + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("savage")] - public string? Savage { get; set; } + public string? Savage + { + get; + set; + } [JsonPropertyName("karmaValue")] - public double? KarmaValue { get; set; } + public double? KarmaValue + { + get; + set; + } [JsonPropertyName("Info")] - public Info? Info { get; set; } + public Info? Info + { + get; + set; + } [JsonPropertyName("Customization")] - public Customization? Customization { get; set; } + public Customization? Customization + { + get; + set; + } [JsonPropertyName("Health")] - public BotBaseHealth? Health { get; set; } + public BotBaseHealth? Health + { + get; + set; + } [JsonPropertyName("Inventory")] - public BotBaseInventory? Inventory { get; set; } + public BotBaseInventory? Inventory + { + get; + set; + } [JsonPropertyName("Skills")] - public Skills? Skills { get; set; } + public Skills? Skills + { + get; + set; + } [JsonPropertyName("Stats")] - public Stats? Stats { get; set; } + public Stats? Stats + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("Encyclopedia")] - public Dictionary? Encyclopedia { get; set; } + public Dictionary? Encyclopedia + { + get; + set; + } [JsonPropertyName("TaskConditionCounters")] - public Dictionary? TaskConditionCounters { get; set; } + public Dictionary? TaskConditionCounters + { + get; + set; + } [JsonPropertyName("InsuredItems")] - public List? InsuredItems { get; set; } + public List? InsuredItems + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("Hideout")] - public Hideout? Hideout { get; set; } + public Hideout? Hideout + { + get; + set; + } [JsonPropertyName("Quests")] - public List? Quests { get; set; } + public List? Quests + { + get; + set; + } [JsonPropertyName("TradersInfo")] - public Dictionary? TradersInfo { get; set; } + public Dictionary? TradersInfo + { + get; + set; + } [JsonPropertyName("UnlockedInfo")] - public UnlockedInfo? UnlockedInfo { get; set; } + public UnlockedInfo? UnlockedInfo + { + get; + set; + } [JsonPropertyName("RagfairInfo")] - public RagfairInfo? RagfairInfo { get; set; } + public RagfairInfo? RagfairInfo + { + get; + set; + } - /** Achievement id and timestamp */ + /** + * Achievement id and timestamp + */ [JsonPropertyName("Achievements")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public Dictionary? Achievements { get; set; } + public Dictionary? Achievements + { + get; + set; + } [JsonPropertyName("RepeatableQuests")] - public List? RepeatableQuests { get; set; } + public List? RepeatableQuests + { + get; + set; + } [JsonPropertyName("Bonuses")] - public List? Bonuses { get; set; } + public List? Bonuses + { + get; + set; + } [JsonPropertyName("Notes")] - public Notes? Notes { get; set; } + public Notes? Notes + { + get; + set; + } [JsonPropertyName("CarExtractCounts")] - public Dictionary? CarExtractCounts { get; set; } + public Dictionary? CarExtractCounts + { + get; + set; + } [JsonPropertyName("CoopExtractCounts")] - public Dictionary? CoopExtractCounts { get; set; } + public Dictionary? CoopExtractCounts + { + get; + set; + } [JsonPropertyName("SurvivorClass")] - public SurvivorClass? SurvivorClass { get; set; } + public SurvivorClass? SurvivorClass + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("WishList")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public DictionaryOrList? WishList { get; set; } + public DictionaryOrList? WishList + { + get; + set; + } [JsonPropertyName("moneyTransferLimitData")] - public MoneyTransferLimits? MoneyTransferLimitData { get; set; } + public MoneyTransferLimits? MoneyTransferLimitData + { + get; + set; + } - /** SPT specific property used during bot generation in raid */ + /** + * SPT specific property used during bot generation in raid + */ [JsonPropertyName("sptIsPmc")] - public bool? IsPmc { get; set; } + public bool? IsPmc + { + get; + set; + } } public record MoneyTransferLimits { // Resets every 24 hours in live - /** TODO: Implement */ + /** + * TODO: Implement + */ [JsonPropertyName("nextResetTime")] - public double? NextResetTime { get; set; } + public double? NextResetTime + { + get; + set; + } [JsonPropertyName("remainingLimit")] - public double? RemainingLimit { get; set; } + public double? RemainingLimit + { + get; + set; + } [JsonPropertyName("totalLimit")] - public double? TotalLimit { get; set; } + public double? TotalLimit + { + get; + set; + } [JsonPropertyName("resetInterval")] - public double? ResetInterval { get; set; } + public double? ResetInterval + { + get; + set; + } } public record TaskConditionCounter { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } - /** Quest id */ + /** + * Quest id + */ [JsonPropertyName("sourceId")] - public string? SourceId { get; set; } + public string? SourceId + { + get; + set; + } } public record UnlockedInfo { [JsonPropertyName("unlockedProductionRecipe")] - public List? UnlockedProductionRecipe { get; set; } + public List? UnlockedProductionRecipe + { + get; + set; + } } public record Info { - public string? EntryPoint { get; set; } - public string? Nickname { get; set; } - public string? MainProfileNickname { get; set; } - public string? LowerNickname { get; set; } - private string? _side; - public string? Side - { - get => _side; - set => _side = string.Intern(value); - } - - public bool? SquadInviteRestriction { get; set; } - - // Confirmed in client - public int? PrestigeLevel { get; set; } private string? _voice; + + public string? EntryPoint + { + get; + set; + } + + public string? Nickname + { + get; + set; + } + + public string? MainProfileNickname + { + get; + set; + } + + public string? LowerNickname + { + get; + set; + } + + public string? Side + { + get + { + return _side; + } + set + { + _side = string.Intern(value); + } + } + + public bool? SquadInviteRestriction + { + get; + set; + } + + // Confirmed in client + public int? PrestigeLevel + { + get; + set; + } + public string? Voice { - get => _voice; - set => _voice = value == null ? null : string.Intern(value); + get + { + return _voice; + } + set + { + _voice = value == null ? null : string.Intern(value); + } + } + + public int? Level + { + get; + set; } - public int? Level { get; set; } //Experience the bot has gained // Confirmed in client - public int? Experience { get; set; } + public int? Experience + { + get; + set; + } - public List? Bans { get; set; } - public bool? BannedState { get; set; } - public long? BannedUntil { get; set; } - public bool? IsStreamerModeAvailable { get; set; } + public List? Bans + { + get; + set; + } + + public bool? BannedState + { + get; + set; + } + + public long? BannedUntil + { + get; + set; + } + + public bool? IsStreamerModeAvailable + { + get; + set; + } // Confirmed in client [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? RegistrationDate { get; set; } + public int? RegistrationDate + { + get; + set; + } - public string? GameVersion { get; set; } - public MemberCategory? MemberCategory { get; set; } - public MemberCategory? SelectedMemberCategory { get; set; } + public string? GameVersion + { + get; + set; + } + + public MemberCategory? MemberCategory + { + get; + set; + } + + public MemberCategory? SelectedMemberCategory + { + get; + set; + } [JsonPropertyName("lockedMoveCommands")] - public bool? LockedMoveCommands { get; set; } + public bool? LockedMoveCommands + { + get; + set; + } - public double? SavageLockTime { get; set; } - public long? LastTimePlayedAsSavage { get; set; } - public BotInfoSettings? Settings { get; set; } - public List? NeedWipeOptions { get; set; } + public double? SavageLockTime + { + get; + set; + } + + public long? LastTimePlayedAsSavage + { + get; + set; + } + + public BotInfoSettings? Settings + { + get; + set; + } + + public List? NeedWipeOptions + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("lastCompletedWipe")] - public LastCompleted? LastCompletedWipe { get; set; } + public LastCompleted? LastCompletedWipe + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("lastWipeTimestamp")] - public LastCompleted? LastWipeTimestamp { get; set; } + public LastCompleted? LastWipeTimestamp + { + get; + set; + } - public double? AccountType { get; set; } - public long? NicknameChangeDate { get; set; } + public double? AccountType + { + get; + set; + } + + public long? NicknameChangeDate + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("lastCompletedEvent")] - public LastCompleted? LastCompletedEvent { get; set; } + public LastCompleted? LastCompletedEvent + { + get; + set; + } [JsonPropertyName("isMigratedSkills")] - public bool? IsMigratedSkills { get; set; } + public bool? IsMigratedSkills + { + get; + set; + } - public double? GroupId { get; set; } - public double? TeamId { get; set; } - public bool? HasCoopExtension { get; set; } - public bool? HasPveGame { get; set; } - public string? Type { get; set; } + public double? GroupId + { + get; + set; + } + + public double? TeamId + { + get; + set; + } + + public bool? HasCoopExtension + { + get; + set; + } + + public bool? HasPveGame + { + get; + set; + } + + public string? Type + { + get; + set; + } } public record BotInfoSettings { + private string? _botDifficulty; private string? _role; + public string? Role { - get => _role; - set => _role = value == null ? null : string.Intern(value); + get + { + return _role; + } + set + { + _role = value == null ? null : string.Intern(value); + } } - private string? _botDifficulty; public string? BotDifficulty { - get => _botDifficulty; - set => _botDifficulty = value == null ? null : string.Intern(value); + get + { + return _botDifficulty; + } + set + { + _botDifficulty = value == null ? null : string.Intern(value); + } } // Experience given for being killed - public int? Experience { get; set; } - public double? StandingForKill { get; set; } - public double? AggressorBonus { get; set; } - public bool? UseSimpleAnimator { get; set; } + public int? Experience + { + get; + set; + } + + public double? StandingForKill + { + get; + set; + } + + public double? AggressorBonus + { + get; + set; + } + + public bool? UseSimpleAnimator + { + get; + set; + } } public record Ban { [JsonPropertyName("banType")] - public BanType? BanType { get; set; } + public BanType? BanType + { + get; + set; + } [JsonPropertyName("dateTime")] - public long? DateTime { get; set; } + public long? DateTime + { + get; + set; + } } public enum BanType @@ -268,148 +629,350 @@ public enum BanType public record Customization { - private string? _head; - public string? Head - { - get => _head; - set => _head = value == null ? null : string.Intern(value); - } - private string? _body; - public string? Body - { - get => _body; - set => _body = value == null ? null : string.Intern(value); - } - - private string? _feet; - public string? Feet - { - get => _feet; - set => _feet = value == null ? null : string.Intern(value); - } - - private string? _hands; - public string? Hands - { - get => _hands; - set => _hands = value == null ? null : string.Intern(value); - } private string? _dogtag; + + private string? _feet; + + private string? _hands; + private string? _head; + + public string? Head + { + get + { + return _head; + } + set + { + _head = value == null ? null : string.Intern(value); + } + } + + public string? Body + { + get + { + return _body; + } + set + { + _body = value == null ? null : string.Intern(value); + } + } + + public string? Feet + { + get + { + return _feet; + } + set + { + _feet = value == null ? null : string.Intern(value); + } + } + + public string? Hands + { + get + { + return _hands; + } + set + { + _hands = value == null ? null : string.Intern(value); + } + } + public string? DogTag { - get => _dogtag; - set => _dogtag = value == null ? null : string.Intern(value); + get + { + return _dogtag; + } + set + { + _dogtag = value == null ? null : string.Intern(value); + } } } public record BotBaseHealth { - public CurrentMinMax? Hydration { get; set; } - public CurrentMinMax? Energy { get; set; } - public CurrentMinMax? Temperature { get; set; } - public CurrentMinMax? Poison { get; set; } + public CurrentMinMax? Hydration + { + get; + set; + } + + public CurrentMinMax? Energy + { + get; + set; + } + + public CurrentMinMax? Temperature + { + get; + set; + } + + public CurrentMinMax? Poison + { + get; + set; + } [JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonPropertyName("BodyParts")] - public Dictionary? BodyParts { get; set; } + public Dictionary? BodyParts + { + get; + set; + } - public double? UpdateTime { get; set; } - public bool? Immortal { get; set; } + public double? UpdateTime + { + get; + set; + } + + public bool? Immortal + { + get; + set; + } } public record BodyPartHealth { - public CurrentMinMax? Health { get; set; } - public Dictionary? Effects { get; set; } // TODO: change key to DamageEffectType enum + public CurrentMinMax? Health + { + get; + set; + } + + public Dictionary? Effects + { + get; + set; + } // TODO: change key to DamageEffectType enum } public record BodyPartEffectProperties { // TODO: this was any, what actual type is it? - public object? ExtraData { get; set; } - public double? Time { get; set; } + public object? ExtraData + { + get; + set; + } + + public double? Time + { + get; + set; + } } public record CurrentMinMax { - public double? Current { get; set; } - public double? Minimum { get; set; } - public double? Maximum { get; set; } - public double? OverDamageReceivedMultiplier { get; set; } - public double? EnvironmentDamageMultiplier { get; set; } + public double? Current + { + get; + set; + } + + public double? Minimum + { + get; + set; + } + + public double? Maximum + { + get; + set; + } + + public double? OverDamageReceivedMultiplier + { + get; + set; + } + + public double? EnvironmentDamageMultiplier + { + get; + set; + } } public record BotBaseInventory { [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("equipment")] - public string? Equipment { get; set; } + public string? Equipment + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("stash")] - public string? Stash { get; set; } + public string? Stash + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("sortingTable")] - public string? SortingTable { get; set; } + public string? SortingTable + { + get; + set; + } [JsonPropertyName("questRaidItems")] - public string? QuestRaidItems { get; set; } + public string? QuestRaidItems + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("questStashItems")] - public string? QuestStashItems { get; set; } + public string? QuestStashItems + { + get; + set; + } - /** 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")] - public Dictionary? HideoutAreaStashes { get; set; } + public Dictionary? HideoutAreaStashes + { + get; + set; + } [JsonPropertyName("fastPanel")] - public Dictionary? FastPanel { get; set; } + public Dictionary? FastPanel + { + get; + set; + } [JsonPropertyName("favoriteItems")] - public List? FavoriteItems { get; set; } + public List? FavoriteItems + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("hideoutCustomizationStashId")] - public string? HideoutCustomizationStashId { get; set; } + public string? HideoutCustomizationStashId + { + get; + set; + } } public record BaseJsonSkills { - public List? Common { get; set; } + public List? Common + { + get; + set; + } - public List? Mastering { get; set; } - public double? Points { get; set; } + public List? Mastering + { + get; + set; + } + + public double? Points + { + get; + set; + } } public record Skills { - public List? Common { get; set; } + public List? Common + { + get; + set; + } - public List? Mastering { get; set; } + public List? Mastering + { + get; + set; + } - public double? Points { get; set; } + public double? Points + { + get; + set; + } } public record BaseSkill { - public double? PointsEarnedDuringSession { get; set; } - public long? LastAccess { get; set; } - public string? Id { get; set; } - public double? Progress { get; set; } + public double? PointsEarnedDuringSession + { + get; + set; + } + + public long? LastAccess + { + get; + set; + } + + public string? Id + { + get; + set; + } + + public double? Progress + { + get; + set; + } [JsonPropertyName("max")] - public int? Max { get; set; } + public int? Max + { + get; + set; + } [JsonPropertyName("min")] - public int? Min { get; set; } + public int? Min + { + get; + set; + } } public record Common : BaseSkill @@ -422,341 +985,948 @@ public record Mastering : BaseSkill public record Stats { - public EftStats? Eft { get; set; } + public EftStats? Eft + { + get; + set; + } } public record EftStats { - public List? CarriedQuestItems { get; set; } - public List? Victims { get; set; } - public double? TotalSessionExperience { get; set; } - public long? LastSessionDate { get; set; } - public SessionCounters? SessionCounters { get; set; } - public OverallCounters? OverallCounters { get; set; } - public float? SessionExperienceMult { get; set; } - public float? ExperienceBonusMult { get; set; } + public List? CarriedQuestItems + { + get; + set; + } + + public List? Victims + { + get; + set; + } + + public double? TotalSessionExperience + { + get; + set; + } + + public long? LastSessionDate + { + get; + set; + } + + public SessionCounters? SessionCounters + { + get; + set; + } + + public OverallCounters? OverallCounters + { + get; + set; + } + + public float? SessionExperienceMult + { + get; + set; + } + + public float? ExperienceBonusMult + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public Aggressor? Aggressor { get; set; } + public Aggressor? Aggressor + { + get; + set; + } - public List? DroppedItems { get; set; } - public List? FoundInRaidItems { get; set; } - public DamageHistory? DamageHistory { get; set; } - public DeathCause? DeathCause { get; set; } + public List? DroppedItems + { + get; + set; + } + + public List? FoundInRaidItems + { + get; + set; + } + + public DamageHistory? DamageHistory + { + get; + set; + } + + public DeathCause? DeathCause + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public LastPlayerState? LastPlayerState { get; set; } + public LastPlayerState? LastPlayerState + { + get; + set; + } - public long? TotalInGameTime { get; set; } - public string? SurvivorClass { get; set; } + public long? TotalInGameTime + { + get; + set; + } + + public string? SurvivorClass + { + get; + set; + } [JsonPropertyName("sptLastRaidFenceRepChange")] - public float? SptLastRaidFenceRepChange { get; set; } + public float? SptLastRaidFenceRepChange + { + get; + set; + } } public record DroppedItem { - public string? QuestId { get; set; } - public string? ItemId { get; set; } - public string? ZoneId { get; set; } + public string? QuestId + { + get; + set; + } + + public string? ItemId + { + get; + set; + } + + public string? ZoneId + { + get; + set; + } } public record FoundInRaidItem { - public string? QuestId { get; set; } - public string? ItemId { get; set; } + public string? QuestId + { + get; + set; + } + + public string? ItemId + { + get; + set; + } } public record Victim { - public string? AccountId { get; set; } - public string? ProfileId { get; set; } - public string? Name { get; set; } - public string? Side { get; set; } - public string? BodyPart { get; set; } - public string? Time { get; set; } - public double? Distance { get; set; } - public double? Level { get; set; } - public string? Weapon { get; set; } - public double? PrestigeLevel { get; set; } - public string? ColliderType { get; set; } - public string? Role { get; set; } - public string? Location { get; set; } + public string? AccountId + { + get; + set; + } + + public string? ProfileId + { + get; + set; + } + + public string? Name + { + get; + set; + } + + public string? Side + { + get; + set; + } + + public string? BodyPart + { + get; + set; + } + + public string? Time + { + get; + set; + } + + public double? Distance + { + get; + set; + } + + public double? Level + { + get; + set; + } + + public string? Weapon + { + get; + set; + } + + public double? PrestigeLevel + { + get; + set; + } + + public string? ColliderType + { + get; + set; + } + + public string? Role + { + get; + set; + } + + public string? Location + { + get; + set; + } [JsonExtensionData] - public Dictionary OtherProperties { get; set; } + public Dictionary OtherProperties + { + get; + set; + } } public record SessionCounters { - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record OverallCounters { - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record CounterKeyValue { - public List? Key { get; set; } - public double? Value { get; set; } + public List? Key + { + get; + set; + } + + public double? Value + { + get; + set; + } } public record Aggressor { - public double? PrestigeLevel { get; set; } + public double? PrestigeLevel + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? AccountId { get; set; } + public string? AccountId + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? MainProfileNickname { get; set; } + public string? MainProfileNickname + { + get; + set; + } - public string? Name { get; set; } - public string? Side { get; set; } - public string? BodyPart { get; set; } - public string? HeadSegment { get; set; } - public string? WeaponName { get; set; } - public string? Category { get; set; } - public string? ColliderType { get; set; } - public string? Role { get; set; } + public string? Name + { + get; + set; + } + + public string? Side + { + get; + set; + } + + public string? BodyPart + { + get; + set; + } + + public string? HeadSegment + { + get; + set; + } + + public string? WeaponName + { + get; + set; + } + + public string? Category + { + get; + set; + } + + public string? ColliderType + { + get; + set; + } + + public string? Role + { + get; + set; + } [JsonExtensionData] - public Dictionary OtherProperties { get; set; } + public Dictionary OtherProperties + { + get; + set; + } } public record DamageHistory { - public string? LethalDamagePart { get; set; } + public string? LethalDamagePart + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public DamageStats? LethalDamage { get; set; } + public DamageStats? LethalDamage + { + get; + set; + } [JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public BodyPartsDamageHistory? BodyParts { get; set; } + public BodyPartsDamageHistory? BodyParts + { + get; + set; + } } public record BodyPartsDamageHistory { - public List? Head { get; set; } - public List? Chest { get; set; } - public List? Stomach { get; set; } - public List? LeftArm { get; set; } - public List? RightArm { get; set; } - public List? LeftLeg { get; set; } - public List? RightLeg { get; set; } - public List? Common { get; set; } + public List? Head + { + get; + set; + } + + public List? Chest + { + get; + set; + } + + public List? Stomach + { + get; + set; + } + + public List? LeftArm + { + get; + set; + } + + public List? RightArm + { + get; + set; + } + + public List? LeftLeg + { + get; + set; + } + + public List? RightLeg + { + get; + set; + } + + public List? Common + { + get; + set; + } } public record DamageStats { - public double? Amount { get; set; } - public string? Type { get; set; } - public string? SourceId { get; set; } + public double? Amount + { + get; + set; + } + + public string? Type + { + get; + set; + } + + public string? SourceId + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? OverDamageFrom { get; set; } + public string? OverDamageFrom + { + get; + set; + } - public bool? Blunt { get; set; } - public double? ImpactsCount { get; set; } + public bool? Blunt + { + get; + set; + } + + public double? ImpactsCount + { + get; + set; + } } public record DeathCause { - public string? DamageType { get; set; } - public string? Side { get; set; } - public string? Role { get; set; } - public string? WeaponId { get; set; } + public string? DamageType + { + get; + set; + } + + public string? Side + { + get; + set; + } + + public string? Role + { + get; + set; + } + + public string? WeaponId + { + get; + set; + } } public record LastPlayerState { - public LastPlayerStateInfo? Info { get; set; } - public Dictionary? Customization { get; set; } + public LastPlayerStateInfo? Info + { + get; + set; + } + + public Dictionary? Customization + { + get; + set; + } // TODO: there is no definition on TS just any - public object? Equipment { get; set; } + public object? Equipment + { + get; + set; + } } public record LastPlayerStateInfo { - public string? Nickname { get; set; } - public string? Side { get; set; } - public double? Level { get; set; } - public MemberCategory? MemberCategory { get; set; } + public string? Nickname + { + get; + set; + } + + public string? Side + { + get; + set; + } + + public double? Level + { + get; + set; + } + + public MemberCategory? MemberCategory + { + get; + set; + } } public record BackendCounter { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("qid")] - public string? QId { get; set; } + public string? QId + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record InsuredItem { - /** Trader Id item was insured by */ + /** + * Trader Id item was insured by + */ [JsonPropertyName("tid")] - public string? TId { get; set; } + public string? TId + { + get; + set; + } [JsonPropertyName("itemId")] - public string? ItemId { get; set; } + public string? ItemId + { + get; + set; + } } public record Hideout { - public Dictionary? Production { get; set; } - public List? Areas { get; set; } - public Dictionary? Improvements { get; set; } + public Dictionary? Production + { + get; + set; + } + + public List? Areas + { + get; + set; + } + + public Dictionary? Improvements + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public HideoutCounters? HideoutCounters { get; set; } + public HideoutCounters? HideoutCounters + { + get; + set; + } - public double? Seed { get; set; } - public Dictionary? MannequinPoses { get; set; } + public double? Seed + { + get; + set; + } + + public Dictionary? MannequinPoses + { + get; + set; + } [JsonPropertyName("sptUpdateLastRunTimestamp")] - public long? SptUpdateLastRunTimestamp { get; set; } + public long? SptUpdateLastRunTimestamp + { + get; + set; + } - public Dictionary? Customization { get; set; } + public Dictionary? Customization + { + get; + set; + } } public record HideoutCounters { [JsonPropertyName("fuelCounter")] - public double? FuelCounter { get; set; } + public double? FuelCounter + { + get; + set; + } [JsonPropertyName("airFilterCounter")] - public double? AirFilterCounter { get; set; } + public double? AirFilterCounter + { + get; + set; + } [JsonPropertyName("waterFilterCounter")] - public double? WaterFilterCounter { get; set; } + public double? WaterFilterCounter + { + get; + set; + } [JsonPropertyName("craftingTimeCounter")] - public double? CraftingTimeCounter { get; set; } + public double? CraftingTimeCounter + { + get; + set; + } } public record HideoutImprovement { [JsonPropertyName("completed")] - public bool? Completed { get; set; } + public bool? Completed + { + get; + set; + } [JsonPropertyName("improveCompleteTimestamp")] - public long? ImproveCompleteTimestamp { get; set; } + public long? ImproveCompleteTimestamp + { + get; + set; + } } public record Production // use this instead of productive and scavcase { - public List? Products { get; set; } + public List? Products + { + get; + set; + } - /** Seconds passed of production */ - public double? Progress { get; set; } + /** + * Seconds passed of production + */ + public double? Progress + { + get; + set; + } - /** 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 { get; set; } + public bool? InProgress + { + get; + set; + } - public long? StartTimestamp { get; set; } - public double? SkipTime { get; set; } + public long? StartTimestamp + { + get; + set; + } - /** Seconds needed to fully craft */ - public double? ProductionTime { get; set; } + public double? SkipTime + { + get; + set; + } - public List? GivenItemsInStart { get; set; } - public bool? Interrupted { get; set; } - public string? Code { get; set; } - public bool? Decoded { get; set; } - public bool? AvailableForFinish { get; set; } + /** + * Seconds needed to fully craft + */ + public double? ProductionTime + { + get; + set; + } - /** Used in hideout production.json */ - public bool? needFuelForAllProductionTime { get; set; } + public List? GivenItemsInStart + { + get; + set; + } - /** Used when sending data to client */ - public bool? NeedFuelForAllProductionTime { get; set; } + public bool? Interrupted + { + get; + set; + } + + public string? Code + { + get; + set; + } + + public bool? Decoded + { + get; + set; + } + + public bool? AvailableForFinish + { + get; + set; + } + + /** + * Used in hideout production.json + */ + public bool? needFuelForAllProductionTime + { + get; + set; + } + + /** + * Used when sending data to client + */ + public bool? NeedFuelForAllProductionTime + { + get; + set; + } [JsonPropertyName("sptIsScavCase")] - public bool? SptIsScavCase { get; set; } + public bool? SptIsScavCase + { + get; + set; + } - /** 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 { get; set; } + public bool? SptIsComplete + { + get; + set; + } - /** 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 { get; set; } + public bool? SptIsContinuous + { + get; + set; + } - /** 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 { get; set; } + public List? SptRequiredTools + { + get; + set; + } // Craft is cultist circle sacrifice [JsonPropertyName("sptIsCultistCircle")] - public bool? SptIsCultistCircle { get; set; } + public bool? SptIsCultistCircle + { + get; + set; + } - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } } public record BotHideoutArea { [JsonPropertyName("type")] - public HideoutAreas? Type { get; set; } + public HideoutAreas? Type + { + get; + set; + } [JsonPropertyName("level")] - public double? Level { get; set; } + public double? Level + { + get; + set; + } [JsonPropertyName("active")] - public bool? Active { get; set; } + public bool? Active + { + get; + set; + } [JsonPropertyName("passiveBonusesEnabled")] - public bool? PassiveBonusesEnabled { get; set; } + public bool? PassiveBonusesEnabled + { + get; + set; + } - /** Must be integer */ + /** + * Must be integer + */ [JsonPropertyName("completeTime")] - public double? CompleteTime { get; set; } + public double? CompleteTime + { + get; + set; + } [JsonPropertyName("constructing")] - public bool? Constructing { get; set; } + public bool? Constructing + { + get; + set; + } [JsonPropertyName("slots")] - public List? Slots { get; set; } + public List? Slots + { + get; + set; + } [JsonPropertyName("lastRecipe")] - public string? LastRecipe { get; set; } + public string? LastRecipe + { + get; + set; + } } public record HideoutSlot { /// - /// SPT specific value to keep track of what index this slot is (0,1,2,3 etc) + /// SPT specific value to keep track of what index this slot is (0,1,2,3 etc) /// [JsonPropertyName("locationIndex")] - public double? LocationIndex { get; set; } + public double? LocationIndex + { + get; + set; + } [JsonPropertyName("item")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record LastCompleted { [JsonPropertyName("$oid")] - public string? OId { get; set; } + public string? OId + { + get; + set; + } } public record Notes { [JsonPropertyName("Notes")] - public List? DataNotes { get; set; } + public List? DataNotes + { + get; + set; + } } public enum SurvivorClass @@ -771,94 +1941,204 @@ public enum SurvivorClass public record Quests { [JsonPropertyName("qid")] - public string? QId { get; set; } + public string? QId + { + get; + set; + } [JsonPropertyName("startTime")] - public long? StartTime { get; set; } + public long? StartTime + { + get; + set; + } [JsonPropertyName("status")] - public QuestStatusEnum? Status { get; set; } + public QuestStatusEnum? Status + { + get; + set; + } [JsonPropertyName("statusTimers")] - public Dictionary? StatusTimers { get; set; } + public Dictionary? StatusTimers + { + get; + set; + } - /** 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 { get; set; } + public List? CompletedConditions + { + get; + set; + } [JsonPropertyName("availableAfter")] - public long? AvailableAfter { get; set; } + public long? AvailableAfter + { + get; + set; + } } public record TraderInfo { [JsonPropertyName("loyaltyLevel")] - public int? LoyaltyLevel { get; set; } + public int? LoyaltyLevel + { + get; + set; + } [JsonPropertyName("salesSum")] - public double? SalesSum { get; set; } + public double? SalesSum + { + get; + set; + } [JsonPropertyName("standing")] - public double? Standing { get; set; } + public double? Standing + { + get; + set; + } [JsonPropertyName("nextResupply")] - public double? NextResupply { get; set; } + public double? NextResupply + { + get; + set; + } [JsonPropertyName("unlocked")] - public bool? Unlocked { get; set; } + public bool? Unlocked + { + get; + set; + } [JsonPropertyName("disabled")] - public bool? Disabled { get; set; } + public bool? Disabled + { + get; + set; + } } public record RagfairInfo { [JsonPropertyName("rating")] - public double? Rating { get; set; } + public double? Rating + { + get; + set; + } [JsonPropertyName("isRatingGrowing")] - public bool? IsRatingGrowing { get; set; } + public bool? IsRatingGrowing + { + get; + set; + } [JsonPropertyName("offers")] - public List? Offers { get; set; } + public List? Offers + { + get; + set; + } [JsonPropertyName("sellSum")] - public double? SellSum { get; set; } + public double? SellSum + { + get; + set; + } [JsonPropertyName("notSellSum")] - public double? NotSellSum { get; set; } + public double? NotSellSum + { + get; + set; + } } public record Bonus { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] - public BonusType? Type { get; set; } + public BonusType? Type + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("passive")] - public bool? IsPassive { get; set; } + public bool? IsPassive + { + get; + set; + } [JsonPropertyName("production")] - public bool? IsProduction { get; set; } + public bool? IsProduction + { + get; + set; + } [JsonPropertyName("visible")] - public bool? IsVisible { get; set; } + public bool? IsVisible + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("icon")] - public string? Icon { get; set; } + public string? Icon + { + get; + set; + } [JsonPropertyName("filter")] - public List? Filter { get; set; } + public List? Filter + { + get; + set; + } [JsonPropertyName("skillType")] - public BonusSkillType? SkillType { get; set; } + public BonusSkillType? SkillType + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/BotCore.cs b/Libraries/Core/Models/Eft/Common/Tables/BotCore.cs index df5529b9..c24477f0 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/BotCore.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/BotCore.cs @@ -5,395 +5,919 @@ namespace Core.Models.Eft.Common.Tables; public record BotCore { [JsonPropertyName("SAVAGE_KILL_DIST")] - public double? SavageKillDistance { get; set; } + public double? SavageKillDistance + { + get; + set; + } [JsonPropertyName("SOUND_DOOR_BREACH_METERS")] - public double? SoundDoorBreachMeters { get; set; } + public double? SoundDoorBreachMeters + { + get; + set; + } [JsonPropertyName("SOUND_DOOR_OPEN_METERS")] - public double? SoundDoorOpenMeters { get; set; } + public double? SoundDoorOpenMeters + { + get; + set; + } [JsonPropertyName("STEP_NOISE_DELTA")] - public double? StepNoiseDelta { get; set; } + public double? StepNoiseDelta + { + get; + set; + } [JsonPropertyName("JUMP_NOISE_DELTA")] - public double? JumpNoiseDelta { get; set; } + public double? JumpNoiseDelta + { + get; + set; + } [JsonPropertyName("GUNSHOT_SPREAD")] - public double? GunshotSpread { get; set; } + public double? GunshotSpread + { + get; + set; + } [JsonPropertyName("GUNSHOT_SPREAD_SILENCE")] - public double? GunshotSpreadSilence { get; set; } + public double? GunshotSpreadSilence + { + get; + set; + } [JsonPropertyName("BASE_WALK_SPEREAD2")] - public double? BaseWalkSpread2 { get; set; } + public double? BaseWalkSpread2 + { + get; + set; + } [JsonPropertyName("MOVE_SPEED_COEF_MAX")] - public double? MoveSpeedCoefficientMax { get; set; } + public double? MoveSpeedCoefficientMax + { + get; + set; + } [JsonPropertyName("SPEED_SERV_SOUND_COEF_A")] - public double? SpeedServiceSoundCoefficientA { get; set; } + public double? SpeedServiceSoundCoefficientA + { + get; + set; + } [JsonPropertyName("SPEED_SERV_SOUND_COEF_B")] - public double? SpeedServiceSoundCoefficientB { get; set; } + public double? SpeedServiceSoundCoefficientB + { + get; + set; + } [JsonPropertyName("G")] - public double? Gravity { get; set; } + public double? Gravity + { + get; + set; + } [JsonPropertyName("STAY_COEF")] - public double? StayCoefficient { get; set; } + public double? StayCoefficient + { + get; + set; + } [JsonPropertyName("SIT_COEF")] - public double? SitCoefficient { get; set; } + public double? SitCoefficient + { + get; + set; + } [JsonPropertyName("LAY_COEF")] - public double? LayCoefficient { get; set; } + public double? LayCoefficient + { + get; + set; + } [JsonPropertyName("MAX_ITERATIONS")] - public double? MaxIterations { get; set; } + public double? MaxIterations + { + get; + set; + } [JsonPropertyName("START_DIST_TO_COV")] - public double? StartDistanceToCover { get; set; } + public double? StartDistanceToCover + { + get; + set; + } [JsonPropertyName("MAX_DIST_TO_COV")] - public double? MaxDistanceToCover { get; set; } + public double? MaxDistanceToCover + { + get; + set; + } [JsonPropertyName("STAY_HEIGHT")] - public double? StayHeight { get; set; } + public double? StayHeight + { + get; + set; + } [JsonPropertyName("CLOSE_POINTS")] - public double? ClosePoints { get; set; } + public double? ClosePoints + { + get; + set; + } [JsonPropertyName("COUNT_TURNS")] - public double? CountTurns { get; set; } + public double? CountTurns + { + get; + set; + } [JsonPropertyName("SIMPLE_POINT_LIFE_TIME_SEC")] - public double? SimplePointLifetimeSeconds { get; set; } + public double? SimplePointLifetimeSeconds + { + get; + set; + } [JsonPropertyName("DANGER_POINT_LIFE_TIME_SEC")] - public double? DangerPointLifetimeSeconds { get; set; } + public double? DangerPointLifetimeSeconds + { + get; + set; + } [JsonPropertyName("DANGER_POWER")] - public double? DangerPower { get; set; } + public double? DangerPower + { + get; + set; + } [JsonPropertyName("COVER_DIST_CLOSE")] - public double? CoverDistanceClose { get; set; } + public double? CoverDistanceClose + { + get; + set; + } [JsonPropertyName("GOOD_DIST_TO_POINT")] - public double? GoodDistanceToPoint { get; set; } + public double? GoodDistanceToPoint + { + get; + set; + } [JsonPropertyName("COVER_TOOFAR_FROM_BOSS")] - public double? CoverTooFarFromBoss { get; set; } + public double? CoverTooFarFromBoss + { + get; + set; + } [JsonPropertyName("COVER_TOOFAR_FROM_BOSS_SQRT")] - public double? CoverTooFarFromBossSqrt { get; set; } + public double? CoverTooFarFromBossSqrt + { + get; + set; + } [JsonPropertyName("MAX_Y_DIFF_TO_PROTECT")] - public double? MaxYDifferenceToProtect { get; set; } + public double? MaxYDifferenceToProtect + { + get; + set; + } [JsonPropertyName("FLARE_POWER")] - public double? FlarePower { get; set; } + public double? FlarePower + { + get; + set; + } [JsonPropertyName("MOVE_COEF")] - public double? MoveCoefficient { get; set; } + public double? MoveCoefficient + { + get; + set; + } [JsonPropertyName("PRONE_POSE")] - public double? PronePose { get; set; } + public double? PronePose + { + get; + set; + } [JsonPropertyName("LOWER_POSE")] - public double? LowerPose { get; set; } + public double? LowerPose + { + get; + set; + } [JsonPropertyName("MAX_POSE")] - public double? MaxPose { get; set; } + public double? MaxPose + { + get; + set; + } [JsonPropertyName("FLARE_TIME")] - public double? FlareTime { get; set; } + public double? FlareTime + { + get; + set; + } [JsonPropertyName("MAX_REQUESTS__PER_GROUP")] - public double? MaxRequestsPerGroup { get; set; } + public double? MaxRequestsPerGroup + { + get; + set; + } [JsonPropertyName("UPDATE_GOAL_TIMER_SEC")] - public double? UpdateGoalTimerSeconds { get; set; } + public double? UpdateGoalTimerSeconds + { + get; + set; + } [JsonPropertyName("DIST_NOT_TO_GROUP")] - public double? DistanceNotToGroup { get; set; } + public double? DistanceNotToGroup + { + get; + set; + } [JsonPropertyName("DIST_NOT_TO_GROUP_SQR")] - public double? DistanceNotToGroupSquared { get; set; } + public double? DistanceNotToGroupSquared + { + get; + set; + } [JsonPropertyName("LAST_SEEN_POS_LIFETIME")] - public double? LastSeenPositionLifetime { get; set; } + public double? LastSeenPositionLifetime + { + get; + set; + } [JsonPropertyName("DELTA_GRENADE_START_TIME")] - public double? DeltaGrenadeStartTime { get; set; } + public double? DeltaGrenadeStartTime + { + get; + set; + } [JsonPropertyName("DELTA_GRENADE_END_TIME")] - public double? DeltaGrenadeEndTime { get; set; } + public double? DeltaGrenadeEndTime + { + get; + set; + } [JsonPropertyName("DELTA_GRENADE_RUN_DIST")] - public double? DeltaGrenadeRunDistance { get; set; } + public double? DeltaGrenadeRunDistance + { + get; + set; + } [JsonPropertyName("DELTA_GRENADE_RUN_DIST_SQRT")] - public double? DeltaGrenadeRunDistanceSqrt { get; set; } + public double? DeltaGrenadeRunDistanceSqrt + { + get; + set; + } [JsonPropertyName("PATROL_MIN_LIGHT_DIST")] - public double? PatrolMinimumLightDistance { get; set; } + public double? PatrolMinimumLightDistance + { + get; + set; + } [JsonPropertyName("HOLD_MIN_LIGHT_DIST")] - public double? HoldMinimumLightDistance { get; set; } + public double? HoldMinimumLightDistance + { + get; + set; + } [JsonPropertyName("STANDART_BOT_PAUSE_DOOR")] - public double? StandardBotPauseDoor { get; set; } + public double? StandardBotPauseDoor + { + get; + set; + } [JsonPropertyName("ARMOR_CLASS_COEF")] - public double? ArmorClassCoefficient { get; set; } + public double? ArmorClassCoefficient + { + get; + set; + } [JsonPropertyName("SHOTGUN_POWER")] - public double? ShotgunPower { get; set; } + public double? ShotgunPower + { + get; + set; + } [JsonPropertyName("RIFLE_POWER")] - public double? RiflePower { get; set; } + public double? RiflePower + { + get; + set; + } [JsonPropertyName("PISTOL_POWER")] - public double? PistolPower { get; set; } + public double? PistolPower + { + get; + set; + } [JsonPropertyName("SMG_POWER")] - public double? SMGPower { get; set; } + public double? SMGPower + { + get; + set; + } [JsonPropertyName("SNIPE_POWER")] - public double? SniperPower { get; set; } + public double? SniperPower + { + get; + set; + } [JsonPropertyName("GESTUS_PERIOD_SEC")] - public double? GestusPeriodSeconds { get; set; } + public double? GestusPeriodSeconds + { + get; + set; + } [JsonPropertyName("GESTUS_AIMING_DELAY")] - public double? GestusAimingDelay { get; set; } + public double? GestusAimingDelay + { + get; + set; + } [JsonPropertyName("GESTUS_REQUEST_LIFETIME")] - public double? GestusRequestLifetime { get; set; } + public double? GestusRequestLifetime + { + get; + set; + } [JsonPropertyName("GESTUS_FIRST_STAGE_MAX_TIME")] - public double? GestusFirstStageMaxTime { get; set; } + public double? GestusFirstStageMaxTime + { + get; + set; + } [JsonPropertyName("GESTUS_SECOND_STAGE_MAX_TIME")] - public double? GestusSecondStageMaxTime { get; set; } + public double? GestusSecondStageMaxTime + { + get; + set; + } [JsonPropertyName("GESTUS_MAX_ANSWERS")] - public double? GestusMaxAnswers { get; set; } + public double? GestusMaxAnswers + { + get; + set; + } [JsonPropertyName("GESTUS_FUCK_TO_SHOOT")] - public double? GestusFuckToShoot { get; set; } + public double? GestusFuckToShoot + { + get; + set; + } [JsonPropertyName("GESTUS_DIST_ANSWERS")] - public double? GestusDistanceAnswers { get; set; } + public double? GestusDistanceAnswers + { + get; + set; + } [JsonPropertyName("GESTUS_DIST_ANSWERS_SQRT")] - public double? GestusDistanceAnswersSqrt { get; set; } + public double? GestusDistanceAnswersSqrt + { + get; + set; + } [JsonPropertyName("GESTUS_ANYWAY_CHANCE")] - public double? GestusAnywayChance { get; set; } + public double? GestusAnywayChance + { + get; + set; + } [JsonPropertyName("TALK_DELAY")] - public double? TalkDelay { get; set; } + public double? TalkDelay + { + get; + set; + } [JsonPropertyName("CAN_SHOOT_TO_HEAD")] - public bool? CanShootToHead { get; set; } + public bool? CanShootToHead + { + get; + set; + } [JsonPropertyName("CAN_TILT")] - public bool? CanTilt { get; set; } + public bool? CanTilt + { + get; + set; + } [JsonPropertyName("TILT_CHANCE")] - public double? TiltChance { get; set; } + public double? TiltChance + { + get; + set; + } [JsonPropertyName("MIN_BLOCK_DIST")] - public double? MinimumBlockDistance { get; set; } + public double? MinimumBlockDistance + { + get; + set; + } [JsonPropertyName("MIN_BLOCK_TIME")] - public double? MinimumBlockTime { get; set; } + public double? MinimumBlockTime + { + get; + set; + } [JsonPropertyName("COVER_SECONDS_AFTER_LOSE_VISION")] - public double? CoverSecondsAfterLoseVision { get; set; } + public double? CoverSecondsAfterLoseVision + { + get; + set; + } [JsonPropertyName("MIN_ARG_COEF")] - public double? MinimumArgumentCoefficient { get; set; } + public double? MinimumArgumentCoefficient + { + get; + set; + } [JsonPropertyName("MAX_ARG_COEF")] - public double? MaximumArgumentCoefficient { get; set; } + public double? MaximumArgumentCoefficient + { + get; + set; + } [JsonPropertyName("DEAD_AGR_DIST")] - public double? DeadAgrDistance { get; set; } + public double? DeadAgrDistance + { + get; + set; + } [JsonPropertyName("MAX_DANGER_CARE_DIST_SQRT")] - public double? MaxDangerCareDistanceSqrt { get; set; } + public double? MaxDangerCareDistanceSqrt + { + get; + set; + } [JsonPropertyName("MAX_DANGER_CARE_DIST")] - public double? MaxDangerCareDistance { get; set; } + public double? MaxDangerCareDistance + { + get; + set; + } [JsonPropertyName("MIN_MAX_PERSON_SEARCH")] - public double? MinimumMaximumPersonSearch { get; set; } + public double? MinimumMaximumPersonSearch + { + get; + set; + } [JsonPropertyName("PERCENT_PERSON_SEARCH")] - public double? PercentPersonSearch { get; set; } + public double? PercentPersonSearch + { + get; + set; + } [JsonPropertyName("LOOK_ANYSIDE_BY_WALL_SEC_OF_ENEMY")] - public double? LookAnySideByWallSecondsOfEnemy { get; set; } + public double? LookAnySideByWallSecondsOfEnemy + { + get; + set; + } [JsonPropertyName("CLOSE_TO_WALL_ROTATE_BY_WALL_SQRT")] - public double? CloseToWallRotateByWallSqrt { get; set; } + public double? CloseToWallRotateByWallSqrt + { + get; + set; + } [JsonPropertyName("SHOOT_TO_CHANGE_RND_PART_MIN")] - public double? ShootToChangeRandomPartMinimum { get; set; } + public double? ShootToChangeRandomPartMinimum + { + get; + set; + } [JsonPropertyName("SHOOT_TO_CHANGE_RND_PART_MAX")] - public double? ShootToChangeRandomPartMaximum { get; set; } + public double? ShootToChangeRandomPartMaximum + { + get; + set; + } [JsonPropertyName("SHOOT_TO_CHANGE_RND_PART_DELTA")] - public double? ShootToChangeRandomPartDelta { get; set; } + public double? ShootToChangeRandomPartDelta + { + get; + set; + } [JsonPropertyName("FORMUL_COEF_DELTA_DIST")] - public double? FormulaCoefficientDeltaDistance { get; set; } + public double? FormulaCoefficientDeltaDistance + { + get; + set; + } [JsonPropertyName("FORMUL_COEF_DELTA_SHOOT")] - public double? FormulaCoefficientDeltaShoot { get; set; } + public double? FormulaCoefficientDeltaShoot + { + get; + set; + } [JsonPropertyName("FORMUL_COEF_DELTA_FRIEND_COVER")] - public double? FormulaCoefficientDeltaFriendCover { get; set; } + public double? FormulaCoefficientDeltaFriendCover + { + get; + set; + } [JsonPropertyName("SUSPETION_POINT_DIST_CHECK")] - public double? SuspicionPointDistanceCheck { get; set; } + public double? SuspicionPointDistanceCheck + { + get; + set; + } [JsonPropertyName("MAX_BASE_REQUESTS_PER_PLAYER")] - public double? MaxBaseRequestsPerPlayer { get; set; } + public double? MaxBaseRequestsPerPlayer + { + get; + set; + } [JsonPropertyName("MAX_HOLD_REQUESTS_PER_PLAYER")] - public double? MaxHoldRequestsPerPlayer { get; set; } + public double? MaxHoldRequestsPerPlayer + { + get; + set; + } [JsonPropertyName("MAX_GO_TO_REQUESTS_PER_PLAYER")] - public double? MaxGoToRequestsPerPlayer { get; set; } + public double? MaxGoToRequestsPerPlayer + { + get; + set; + } [JsonPropertyName("MAX_COME_WITH_ME_REQUESTS_PER_PLAYER")] - public double? MaxComeWithMeRequestsPerPlayer { get; set; } + public double? MaxComeWithMeRequestsPerPlayer + { + get; + set; + } [JsonPropertyName("CORE_POINT_MAX_VALUE")] - public double? CorePointMaxValue { get; set; } + public double? CorePointMaxValue + { + get; + set; + } [JsonPropertyName("CORE_POINTS_MAX")] - public double? CorePointsMax { get; set; } + public double? CorePointsMax + { + get; + set; + } [JsonPropertyName("CORE_POINTS_MIN")] - public double? CorePointsMin { get; set; } + public double? CorePointsMin + { + get; + set; + } [JsonPropertyName("BORN_POISTS_FREE_ONLY_FAREST_BOT")] - public bool? BornPointsFreeOnlyFarthestBot { get; set; } + public bool? BornPointsFreeOnlyFarthestBot + { + get; + set; + } [JsonPropertyName("BORN_POINSTS_FREE_ONLY_FAREST_PLAYER")] - public bool? BornPointsFreeOnlyFarthestPlayer { get; set; } + public bool? BornPointsFreeOnlyFarthestPlayer + { + get; + set; + } [JsonPropertyName("SCAV_GROUPS_TOGETHER")] - public bool? ScavGroupsTogether { get; set; } + public bool? ScavGroupsTogether + { + get; + set; + } [JsonPropertyName("LAY_DOWN_ANG_SHOOT")] - public double? LayDownAngleShoot { get; set; } + public double? LayDownAngleShoot + { + get; + set; + } [JsonPropertyName("HOLD_REQUEST_TIME_SEC")] - public double? HoldRequestTimeSeconds { get; set; } + public double? HoldRequestTimeSeconds + { + get; + set; + } [JsonPropertyName("TRIGGERS_DOWN_TO_RUN_WHEN_MOVE")] - public double? TriggersDownToRunWhenMove { get; set; } + public double? TriggersDownToRunWhenMove + { + get; + set; + } [JsonPropertyName("MIN_DIST_TO_RUN_WHILE_ATTACK_MOVING")] - public double? MinimumDistanceToRunWhileAttackingMoving { get; set; } + public double? MinimumDistanceToRunWhileAttackingMoving + { + get; + set; + } [JsonPropertyName("MIN_DIST_TO_RUN_WHILE_ATTACK_MOVING_OTHER_ENEMIS")] - public double? MinimumDistanceToRunWhileAttackingMovingOtherEnemies { get; set; } + public double? MinimumDistanceToRunWhileAttackingMovingOtherEnemies + { + get; + set; + } [JsonPropertyName("MIN_DIST_TO_STOP_RUN")] - public double? MinimumDistanceToStopRunning { get; set; } + public double? MinimumDistanceToStopRunning + { + get; + set; + } [JsonPropertyName("JUMP_SPREAD_DIST")] - public double? JumpSpreadDistance { get; set; } + public double? JumpSpreadDistance + { + get; + set; + } [JsonPropertyName("LOOK_TIMES_TO_KILL")] - public double? LookTimesToKill { get; set; } + public double? LookTimesToKill + { + get; + set; + } [JsonPropertyName("COME_INSIDE_TIMES")] - public double? ComeInsideTimes { get; set; } + public double? ComeInsideTimes + { + get; + set; + } [JsonPropertyName("TOTAL_TIME_KILL")] - public double? TotalTimeKill { get; set; } + public double? TotalTimeKill + { + get; + set; + } [JsonPropertyName("TOTAL_TIME_KILL_AFTER_WARN")] - public double? TotalTimeKillAfterWarning { get; set; } + public double? TotalTimeKillAfterWarning + { + get; + set; + } [JsonPropertyName("MOVING_AIM_COEF")] - public double? MovingAimCoefficient { get; set; } + public double? MovingAimCoefficient + { + get; + set; + } [JsonPropertyName("VERTICAL_DIST_TO_IGNORE_SOUND")] - public double? VerticalDistanceToIgnoreSound { get; set; } + public double? VerticalDistanceToIgnoreSound + { + get; + set; + } [JsonPropertyName("DEFENCE_LEVEL_SHIFT")] - public double? DefenseLevelShift { get; set; } + public double? DefenseLevelShift + { + get; + set; + } [JsonPropertyName("MIN_DIST_CLOSE_DEF")] - public double? MinimumDistanceCloseDefense { get; set; } + public double? MinimumDistanceCloseDefense + { + get; + set; + } [JsonPropertyName("USE_ID_PRIOR_WHO_GO")] - public bool? UseIdPriorWhoGoes { get; set; } + public bool? UseIdPriorWhoGoes + { + get; + set; + } [JsonPropertyName("SMOKE_GRENADE_RADIUS_COEF")] - public double? SmokeGrenadeRadiusCoefficient { get; set; } + public double? SmokeGrenadeRadiusCoefficient + { + get; + set; + } [JsonPropertyName("GRENADE_PRECISION")] - public double? GrenadePrecision { get; set; } + public double? GrenadePrecision + { + get; + set; + } [JsonPropertyName("MAX_WARNS_BEFORE_KILL")] - public double? MaxWarningsBeforeKill { get; set; } + public double? MaxWarningsBeforeKill + { + get; + set; + } [JsonPropertyName("CARE_ENEMY_ONLY_TIME")] - public double? CareEnemyOnlyTime { get; set; } + public double? CareEnemyOnlyTime + { + get; + set; + } [JsonPropertyName("MIDDLE_POINT_COEF")] - public double? MiddlePointCoefficient { get; set; } + public double? MiddlePointCoefficient + { + get; + set; + } [JsonPropertyName("MAIN_TACTIC_ONLY_ATTACK")] - public bool? MainTacticOnlyAttack { get; set; } + public bool? MainTacticOnlyAttack + { + get; + set; + } [JsonPropertyName("LAST_DAMAGE_ACTIVE")] - public double? LastDamageActive { get; set; } + public double? LastDamageActive + { + get; + set; + } [JsonPropertyName("SHALL_DIE_IF_NOT_INITED")] - public bool? ShallDieIfNotInitialized { get; set; } + public bool? ShallDieIfNotInitialized + { + get; + set; + } [JsonPropertyName("CHECK_BOT_INIT_TIME_SEC")] - public double? CheckBotInitializationTimeSeconds { get; set; } + public double? CheckBotInitializationTimeSeconds + { + get; + set; + } [JsonPropertyName("WEAPON_ROOT_Y_OFFSET")] - public double? WeaponRootYOffset { get; set; } + public double? WeaponRootYOffset + { + get; + set; + } [JsonPropertyName("DELTA_SUPRESS_DISTANCE_SQRT")] - public double? DeltaSuppressDistanceSqrt { get; set; } + public double? DeltaSuppressDistanceSqrt + { + get; + set; + } [JsonPropertyName("DELTA_SUPRESS_DISTANCE")] - public double? DeltaSuppressDistance { get; set; } + public double? DeltaSuppressDistance + { + get; + set; + } [JsonPropertyName("WAVE_COEF_LOW")] - public double? WaveCoefficientLow { get; set; } + public double? WaveCoefficientLow + { + get; + set; + } [JsonPropertyName("WAVE_COEF_MID")] - public double? WaveCoefficientMid { get; set; } + public double? WaveCoefficientMid + { + get; + set; + } [JsonPropertyName("WAVE_COEF_HIGH")] - public double? WaveCoefficientHigh { get; set; } + public double? WaveCoefficientHigh + { + get; + set; + } [JsonPropertyName("WAVE_COEF_HORDE")] - public double? WaveCoefficientHorde { get; set; } + public double? WaveCoefficientHorde + { + get; + set; + } [JsonPropertyName("WAVE_ONLY_AS_ONLINE")] - public bool? WaveOnlyAsOnline { get; set; } + public bool? WaveOnlyAsOnline + { + get; + set; + } [JsonPropertyName("LOCAL_BOTS_COUNT")] - public double? LocalBotsCount { get; set; } + public double? LocalBotsCount + { + get; + set; + } [JsonPropertyName("AXE_MAN_KILLS_END")] - public double? AxeManKillsEnd { get; set; } + public double? AxeManKillsEnd + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/BotType.cs b/Libraries/Core/Models/Eft/Common/Tables/BotType.cs index f17c6540..d0821b54 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/BotType.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/BotType.cs @@ -2,77 +2,152 @@ using System.Text.Json.Serialization; using Core.Models.Common; using Core.Models.Enums; using Core.Utils.Json.Converters; -using SptCommon.Extensions; namespace Core.Models.Eft.Common.Tables; public record BotType { [JsonPropertyName("appearance")] - public Appearance? BotAppearance { get; set; } + public Appearance? BotAppearance + { + get; + set; + } [JsonPropertyName("chances")] - public Chances? BotChances { get; set; } + public Chances? BotChances + { + get; + set; + } [JsonPropertyName("difficulty")] - public Dictionary? BotDifficulty { get; set; } + public Dictionary? BotDifficulty + { + get; + set; + } [JsonPropertyName("experience")] - public Experience? BotExperience { get; set; } + public Experience? BotExperience + { + get; + set; + } [JsonPropertyName("firstName")] - public List? FirstNames { get; set; } + public List? FirstNames + { + get; + set; + } [JsonPropertyName("generation")] - public Generation? BotGeneration { get; set; } + public Generation? BotGeneration + { + get; + set; + } [JsonPropertyName("health")] - public BotTypeHealth? BotHealth { get; set; } + public BotTypeHealth? BotHealth + { + get; + set; + } [JsonPropertyName("inventory")] - public BotTypeInventory? BotInventory { get; set; } + public BotTypeInventory? BotInventory + { + get; + set; + } [JsonPropertyName("lastName")] - public List? LastNames { get; set; } + public List? LastNames + { + get; + set; + } [JsonPropertyName("skills")] - public BotDbSkills? BotSkills { get; set; } + public BotDbSkills? BotSkills + { + get; + set; + } } public record Appearance { [JsonPropertyName("body")] - public Dictionary? Body { get; set; } + public Dictionary? Body + { + get; + set; + } [JsonPropertyName("feet")] - public Dictionary? Feet { get; set; } + public Dictionary? Feet + { + get; + set; + } [JsonPropertyName("hands")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public Dictionary? Hands { get; set; } + public Dictionary? Hands + { + get; + set; + } [JsonPropertyName("head")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public Dictionary? Head { get; set; } + public Dictionary? Head + { + get; + set; + } [JsonPropertyName("voice")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public Dictionary? Voice { get; set; } + public Dictionary? Voice + { + get; + set; + } } public record Chances { [JsonPropertyName("equipment")] - public Dictionary? EquipmentChances { get; set; } + public Dictionary? EquipmentChances + { + get; + set; + } [JsonPropertyName("weaponMods")] - public Dictionary? WeaponModsChances { get; set; } + public Dictionary? WeaponModsChances + { + get; + set; + } [JsonPropertyName("equipmentMods")] - public Dictionary? EquipmentModsChances { get; set; } + public Dictionary? EquipmentModsChances + { + get; + set; + } [JsonPropertyName("mods")] - public Dictionary? Mods { get; set; } + public Dictionary? Mods + { + get; + set; + } } /* record removed in favor of Dictionary @@ -243,180 +318,529 @@ public double? ModPistol_Grip { get; set; } public record Difficulties { [JsonPropertyName("easy")] - public DifficultyCategories? Easy { get; set; } + public DifficultyCategories? Easy + { + get; + set; + } [JsonPropertyName("normal")] - public DifficultyCategories? Normal { get; set; } + public DifficultyCategories? Normal + { + get; + set; + } [JsonPropertyName("hard")] - public DifficultyCategories? Hard { get; set; } + public DifficultyCategories? Hard + { + get; + set; + } [JsonPropertyName("impossible")] - public DifficultyCategories? Impossible { get; set; } + public DifficultyCategories? Impossible + { + get; + set; + } } public record DifficultyCategories { - public Dictionary? Aiming { get; set; } // TODO: string | number | boolean - public Dictionary? Boss { get; set; } // TODO: string | number | boolean - public Dictionary? Change { get; set; } // TODO: string | number | boolean - public Dictionary? Core { get; set; } // TODO: string | number | boolean - public Dictionary? Cover { get; set; } // TODO: string | number | boolean - public Dictionary? Grenade { get; set; } // TODO: string | number | boolean - public Dictionary? Hearing { get; set; } // TODO: string | number | boolean - public Dictionary? Lay { get; set; } // TODO: string | number | boolean - public Dictionary? Look { get; set; } // TODO: string | number | boolean - public Dictionary? Mind { get; set; } // TODO: string | number | boolean | string[] - public Dictionary? Move { get; set; } // TODO: string | number | boolean - public Dictionary? Patrol { get; set; } // TODO: string | number | boolean - public Dictionary? Scattering { get; set; } // TODO: string | number | boolean - public Dictionary? Shoot { get; set; } // TODO: string | number | boolean + public Dictionary? Aiming + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Boss + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Change + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Core + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Cover + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Grenade + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Hearing + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Lay + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Look + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Mind + { + get; + set; + } // TODO: string | number | boolean | string[] + + public Dictionary? Move + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Patrol + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Scattering + { + get; + set; + } // TODO: string | number | boolean + + public Dictionary? Shoot + { + get; + set; + } // TODO: string | number | boolean } public record Experience { - /** key = bot difficulty */ + /** + * key = bot difficulty + */ [JsonPropertyName("aggressorBonus")] - public Dictionary? AggressorBonus { get; set; } + public Dictionary? AggressorBonus + { + get; + set; + } [JsonPropertyName("level")] - public MinMax? Level { get; set; } + public MinMax? Level + { + get; + set; + } - /** key = bot difficulty */ + /** + * key = bot difficulty + */ [JsonPropertyName("reward")] - public Dictionary? Reward { get; set; } + public Dictionary? Reward + { + get; + set; + } - /** key = bot difficulty */ + /** + * key = bot difficulty + */ [JsonPropertyName("standingForKill")] - public Dictionary? StandingForKill { get; set; } + public Dictionary? StandingForKill + { + get; + set; + } [JsonPropertyName("useSimpleAnimator")] - public bool? UseSimpleAnimator { get; set; } + public bool? UseSimpleAnimator + { + get; + set; + } } public record Generation { [JsonPropertyName("items")] - public GenerationWeightingItems? Items { get; set; } + public GenerationWeightingItems? Items + { + get; + set; + } } public record GenerationData { - /** key: number of items, value: weighting */ + /** + * key: number of items, value: weighting + */ [JsonPropertyName("weights")] - public Dictionary? Weights { get; set; } + public Dictionary? Weights + { + get; + set; + } - /** Array of item tpls */ + /** + * Array of item tpls + */ [JsonPropertyName("whitelist")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] - public Dictionary? Whitelist { get; set; } + public Dictionary? Whitelist + { + get; + set; + } } public record GenerationWeightingItems { [JsonPropertyName("grenades")] - public GenerationData Grenades { get; set; } + public GenerationData Grenades + { + get; + set; + } [JsonPropertyName("healing")] - public GenerationData Healing { get; set; } + public GenerationData Healing + { + get; + set; + } [JsonPropertyName("drugs")] - public GenerationData Drugs { get; set; } + public GenerationData Drugs + { + get; + set; + } [JsonPropertyName("food")] - public GenerationData Food { get; set; } + public GenerationData Food + { + get; + set; + } [JsonPropertyName("drink")] - public GenerationData Drink { get; set; } + public GenerationData Drink + { + get; + set; + } [JsonPropertyName("currency")] - public GenerationData Currency { get; set; } + public GenerationData Currency + { + get; + set; + } [JsonPropertyName("stims")] - public GenerationData Stims { get; set; } + public GenerationData Stims + { + get; + set; + } [JsonPropertyName("backpackLoot")] - public GenerationData BackpackLoot { get; set; } + public GenerationData BackpackLoot + { + get; + set; + } [JsonPropertyName("pocketLoot")] - public GenerationData PocketLoot { get; set; } + public GenerationData PocketLoot + { + get; + set; + } [JsonPropertyName("vestLoot")] - public GenerationData VestLoot { get; set; } + public GenerationData VestLoot + { + get; + set; + } [JsonPropertyName("magazines")] - public GenerationData Magazines { get; set; } + public GenerationData Magazines + { + get; + set; + } [JsonPropertyName("specialItems")] - public GenerationData SpecialItems { get; set; } + public GenerationData SpecialItems + { + get; + set; + } [JsonPropertyName("looseLoot")] - public GenerationData LooseLoot { get; set; } + public GenerationData LooseLoot + { + get; + set; + } } public record BotTypeHealth { - public List? BodyParts { get; set; } - public MinMax? Energy { get; set; } - public MinMax? Hydration { get; set; } - public MinMax? Temperature { get; set; } + public List? BodyParts + { + get; + set; + } + + public MinMax? Energy + { + get; + set; + } + + public MinMax? Hydration + { + get; + set; + } + + public MinMax? Temperature + { + get; + set; + } } public record BodyPart { - public MinMax? Chest { get; set; } - public MinMax? Head { get; set; } - public MinMax? LeftArm { get; set; } - public MinMax? LeftLeg { get; set; } - public MinMax? RightArm { get; set; } - public MinMax? RightLeg { get; set; } - public MinMax? Stomach { get; set; } + public MinMax? Chest + { + get; + set; + } + + public MinMax? Head + { + get; + set; + } + + public MinMax? LeftArm + { + get; + set; + } + + public MinMax? LeftLeg + { + get; + set; + } + + public MinMax? RightArm + { + get; + set; + } + + public MinMax? RightLeg + { + get; + set; + } + + public MinMax? Stomach + { + get; + set; + } } public record BotTypeInventory { [JsonPropertyName("equipment")] - public Dictionary>? Equipment { get; set; } + public Dictionary>? Equipment + { + get; + set; + } - public GlobalAmmo? Ammo { get; set; } + public GlobalAmmo? Ammo + { + get; + set; + } [JsonPropertyName("items")] - public ItemPools? Items { get; set; } + public ItemPools? Items + { + get; + set; + } [JsonPropertyName("mods")] - public GlobalMods? Mods { get; set; } + public GlobalMods? Mods + { + get; + set; + } } public record Equipment { - public Dictionary? ArmBand { get; set; } - public Dictionary? ArmorVest { get; set; } - public Dictionary? Backpack { get; set; } - public Dictionary? Earpiece { get; set; } - public Dictionary? Eyewear { get; set; } - public Dictionary? FaceCover { get; set; } - public Dictionary? FirstPrimaryWeapon { get; set; } - public Dictionary? Headwear { get; set; } - public Dictionary? Holster { get; set; } - public Dictionary? Pockets { get; set; } - public Dictionary? Scabbard { get; set; } - public Dictionary? SecondPrimaryWeapon { get; set; } - public Dictionary? SecuredContainer { get; set; } - public Dictionary? TacticalVest { get; set; } + public Dictionary? ArmBand + { + get; + set; + } + + public Dictionary? ArmorVest + { + get; + set; + } + + public Dictionary? Backpack + { + get; + set; + } + + public Dictionary? Earpiece + { + get; + set; + } + + public Dictionary? Eyewear + { + get; + set; + } + + public Dictionary? FaceCover + { + get; + set; + } + + public Dictionary? FirstPrimaryWeapon + { + get; + set; + } + + public Dictionary? Headwear + { + get; + set; + } + + public Dictionary? Holster + { + get; + set; + } + + public Dictionary? Pockets + { + get; + set; + } + + public Dictionary? Scabbard + { + get; + set; + } + + public Dictionary? SecondPrimaryWeapon + { + get; + set; + } + + public Dictionary? SecuredContainer + { + get; + set; + } + + public Dictionary? TacticalVest + { + get; + set; + } } public record ItemPools { - public Dictionary? Backpack { get; set; } - public Dictionary? Pockets { get; set; } - public Dictionary? SecuredContainer { get; set; } - public Dictionary? SpecialLoot { get; set; } - public Dictionary? TacticalVest { get; set; } + public Dictionary? Backpack + { + get; + set; + } + + public Dictionary? Pockets + { + get; + set; + } + + public Dictionary? SecuredContainer + { + get; + set; + } + + public Dictionary? SpecialLoot + { + get; + set; + } + + public Dictionary? TacticalVest + { + get; + set; + } } public record BotDbSkills { - public Dictionary? Common { get; set; } + public Dictionary? Common + { + get; + set; + } - public Dictionary? Mastering { get; set; } + public Dictionary? Mastering + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/CustomisationStorage.cs b/Libraries/Core/Models/Eft/Common/Tables/CustomisationStorage.cs index d539dd3d..1dd85f10 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/CustomisationStorage.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/CustomisationStorage.cs @@ -5,13 +5,25 @@ namespace Core.Models.Eft.Common.Tables; public record CustomisationStorage { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("source")] - public string? Source { get; set; } + public string? Source + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } public record CustomisationType diff --git a/Libraries/Core/Models/Eft/Common/Tables/CustomizationItem.cs b/Libraries/Core/Models/Eft/Common/Tables/CustomizationItem.cs index 73e2962e..fb76cd90 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/CustomizationItem.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/CustomizationItem.cs @@ -1,96 +1,212 @@ -namespace Core.Models.Eft.Common.Tables; - using System.Text.Json.Serialization; +namespace Core.Models.Eft.Common.Tables; + public record CustomizationItem { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get; + set; + } [JsonPropertyName("_type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("_props")] - public CustomizationProps? Properties { get; set; } + public CustomizationProps? Properties + { + get; + set; + } [JsonPropertyName("_proto")] - public string? Proto { get; set; } + public string? Proto + { + get; + set; + } } public class CustomizationProps { [JsonPropertyName("Prefab")] - public object? Prefab { get; set; } // Prefab object or string + public object? Prefab + { + get; + set; + } // Prefab object or string [JsonPropertyName("WatchPrefab")] - public Prefab? WatchPrefab { get; set; } + public Prefab? WatchPrefab + { + get; + set; + } [JsonPropertyName("WatchRotation")] - public XYZ? WatchRotation { get; set; } + public XYZ? WatchRotation + { + get; + set; + } [JsonPropertyName("WatchPosition")] - public XYZ? WatchPosition { get; set; } + public XYZ? WatchPosition + { + get; + set; + } [JsonPropertyName("IntegratedArmorVest")] - public bool? IntegratedArmorVest { get; set; } + public bool? IntegratedArmorVest + { + get; + set; + } [JsonPropertyName("MannequinPoseName")] - public string? MannequinPoseName { get; set; } + public string? MannequinPoseName + { + get; + set; + } [JsonPropertyName("BodyPart")] - public string? BodyPart { get; set; } + public string? BodyPart + { + get; + set; + } [JsonPropertyName("Game")] - public List? Game { get; set; } + public List? Game + { + get; + set; + } [JsonPropertyName("Hands")] - public string? Hands { get; set; } + public string? Hands + { + get; + set; + } [JsonPropertyName("Feet")] - public string? Feet { get; set; } + public string? Feet + { + get; + set; + } [JsonPropertyName("Body")] - public string? Body { get; set; } + public string? Body + { + get; + set; + } [JsonPropertyName("ProfileVersions")] - public List? ProfileVersions { get; set; } + public List? ProfileVersions + { + get; + set; + } [JsonPropertyName("Side")] - public List? Side { get; set; } + public List? Side + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("ShortName")] - public string? ShortName { get; set; } + public string? ShortName + { + get; + set; + } [JsonPropertyName("Description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("AvailableAsDefault")] - public bool? AvailableAsDefault { get; set; } + public bool? AvailableAsDefault + { + get; + set; + } [JsonPropertyName("EnvironmentUIType")] - public string? EnvironmentUIType { get; set; } + public string? EnvironmentUIType + { + get; + set; + } [JsonPropertyName("Interaction")] - public string? Interaction { get; set; } + public string? Interaction + { + get; + set; + } [JsonPropertyName("UsecTemplateId")] - public string? UsecTemplateId { get; set; } + public string? UsecTemplateId + { + get; + set; + } [JsonPropertyName("BearTemplateId")] - public string? BearTemplateId { get; set; } + public string? BearTemplateId + { + get; + set; + } [JsonPropertyName("AssetPath")] - public Prefab? AssetPath { get; set; } + public Prefab? AssetPath + { + get; + set; + } [JsonPropertyName("HideGarbage")] - public bool? HideGarbage { get; set; } + public bool? HideGarbage + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/HandbookBase.cs b/Libraries/Core/Models/Eft/Common/Tables/HandbookBase.cs index c94807ee..71e35251 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/HandbookBase.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/HandbookBase.cs @@ -5,41 +5,81 @@ namespace Core.Models.Eft.Common.Tables; public record HandbookBase { [JsonPropertyName("Categories")] - public List? Categories { get; set; } + public List? Categories + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record HandbookCategory { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("ParentId")] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? ParentId { get; set; } + public string? ParentId + { + get; + set; + } [JsonPropertyName("Icon")] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? Icon { get; set; } + public string? Icon + { + get; + set; + } [JsonPropertyName("Color")] - public string? Color { get; set; } + public string? Color + { + get; + set; + } [JsonPropertyName("Order")] - public string? Order { get; set; } + public string? Order + { + get; + set; + } } public record HandbookItem { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("ParentId")] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public string? ParentId { get; set; } + public string? ParentId + { + get; + set; + } [JsonPropertyName("Price")] - public double? Price { get; set; } + public double? Price + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/Item.cs b/Libraries/Core/Models/Eft/Common/Tables/Item.cs index ece117c3..06ce1a95 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Item.cs @@ -5,58 +5,111 @@ namespace Core.Models.Eft.Common.Tables; public record Item { - // MongoId - [JsonPropertyName("_id")] - public string? Id { get; set; } + private string? _parentId; + + private string? _SlotId; private string? _tpl; + + // MongoId + [JsonPropertyName("_id")] + public string? Id + { + get; + set; + } + [JsonPropertyName("_tpl")] // MongoId public string? Template { - get => _tpl; - set => _tpl = string.Intern(value); + get + { + return _tpl; + } + set + { + _tpl = string.Intern(value); + } } - private string? _parentId; [JsonPropertyName("parentId")] public string? ParentId { - get => _parentId; - set => _parentId = value == null ? null : string.Intern(value); + get + { + return _parentId; + } + set + { + _parentId = value == null ? null : string.Intern(value); + } } - private string? _SlotId; [JsonPropertyName("slotId")] public string? SlotId { - get => _SlotId; - set => _SlotId = value == null ? null : string.Intern(value); + get + { + return _SlotId; + } + set + { + _SlotId = value == null ? null : string.Intern(value); + } } [JsonPropertyName("location")] - public object? Location { get; set; } // TODO: Can be IItemLocation or number + public object? Location + { + get; + set; + } // TODO: Can be IItemLocation or number [JsonPropertyName("desc")] - public string? Desc { get; set; } + public string? Desc + { + get; + set; + } [JsonPropertyName("upd")] - public Upd? Upd { get; set; } + public Upd? Upd + { + get; + set; + } } public record HideoutItem { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_tpl")] - public string? Template { get; set; } + public string? Template + { + get; + set; + } [JsonPropertyName("upd")] - public Upd? Upd { get; set; } + public Upd? Upd + { + get; + set; + } [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } public Item ConvertToItem() { @@ -72,58 +125,212 @@ public record HideoutItem public record ItemLocation { [JsonPropertyName("x")] - public int? X { get; set; } + public int? X + { + get; + set; + } [JsonPropertyName("y")] - public int? Y { get; set; } + public int? Y + { + get; + set; + } [JsonPropertyName("r")] - public object? R { get; set; } // TODO: Can be string or number + public object? R + { + get; + set; + } // TODO: Can be string or number [JsonPropertyName("isSearched")] - public bool? IsSearched { get; set; } + public bool? IsSearched + { + get; + set; + } - /** SPT property? */ + /** + * SPT property? + */ [JsonPropertyName("rotation")] - public object? Rotation { get; set; } // TODO: Can be string or boolean + public object? Rotation + { + get; + set; + } // TODO: Can be string or boolean } public record Upd { - public UpdBuff? Buff { get; set; } - public double? OriginalStackObjectsCount { get; set; } - public UpdTogglable? Togglable { get; set; } - public UpdMap? Map { get; set; } - public UpdTag? Tag { get; set; } + public UpdBuff? Buff + { + get; + set; + } - /** SPT specific property, not made by BSG */ + public double? OriginalStackObjectsCount + { + get; + set; + } + + public UpdTogglable? Togglable + { + get; + set; + } + + public UpdMap? Map + { + get; + set; + } + + public UpdTag? Tag + { + get; + set; + } + + /** + * SPT specific property, not made by BSG + */ [JsonPropertyName("sptPresetId")] - public string? SptPresetId { get; set; } + public string? SptPresetId + { + get; + set; + } - public UpdFaceShield? FaceShield { get; set; } + public UpdFaceShield? FaceShield + { + get; + set; + } [JsonConverter(typeof(StringToNumberFactoryConverter))] - public double? StackObjectsCount { get; set; } // TODO: LootDumpGen is outputting doubles, we can turn back to int once fixed + public double? StackObjectsCount + { + get; + set; + } // TODO: LootDumpGen is outputting doubles, we can turn back to int once fixed - public bool? UnlimitedCount { get; set; } - public UpdRepairable? Repairable { get; set; } - public UpdRecodableComponent? RecodableComponent { get; set; } - public UpdFireMode? FireMode { get; set; } - public bool? SpawnedInSession { get; set; } - public UpdLight? Light { get; set; } - public UpdKey? Key { get; set; } - public UpdResource? Resource { get; set; } - public UpdSight? Sight { get; set; } - public UpdMedKit? MedKit { get; set; } - public UpdFoodDrink? FoodDrink { get; set; } - public UpdDogtag? Dogtag { get; set; } - public int? BuyRestrictionMax { get; set; } - public int? BuyRestrictionCurrent { get; set; } - public UpdFoldable? Foldable { get; set; } - public UpdSideEffect? SideEffect { get; set; } - public UpdRepairKit? RepairKit { get; set; } - public UpdCultistAmulet? CultistAmulet { get; set; } - public PinLockState? PinLockState { get; set; } + public bool? UnlimitedCount + { + get; + set; + } + + public UpdRepairable? Repairable + { + get; + set; + } + + public UpdRecodableComponent? RecodableComponent + { + get; + set; + } + + public UpdFireMode? FireMode + { + get; + set; + } + + public bool? SpawnedInSession + { + get; + set; + } + + public UpdLight? Light + { + get; + set; + } + + public UpdKey? Key + { + get; + set; + } + + public UpdResource? Resource + { + get; + set; + } + + public UpdSight? Sight + { + get; + set; + } + + public UpdMedKit? MedKit + { + get; + set; + } + + public UpdFoodDrink? FoodDrink + { + get; + set; + } + + public UpdDogtag? Dogtag + { + get; + set; + } + + public int? BuyRestrictionMax + { + get; + set; + } + + public int? BuyRestrictionCurrent + { + get; + set; + } + + public UpdFoldable? Foldable + { + get; + set; + } + + public UpdSideEffect? SideEffect + { + get; + set; + } + + public UpdRepairKit? RepairKit + { + get; + set; + } + + public UpdCultistAmulet? CultistAmulet + { + get; + set; + } + + public PinLockState? PinLockState + { + get; + set; + } } public enum PinLockState @@ -136,193 +343,373 @@ public enum PinLockState public record UpdBuff { [JsonPropertyName("Rarity")] - public string? Rarity { get; set; } + public string? Rarity + { + get; + set; + } [JsonPropertyName("BuffType")] - public string? BuffType { get; set; } + public string? BuffType + { + get; + set; + } [JsonPropertyName("Value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("ThresholdDurability")] - public double? ThresholdDurability { get; set; } + public double? ThresholdDurability + { + get; + set; + } } public record UpdTogglable { [JsonPropertyName("On")] - public bool? On { get; set; } + public bool? On + { + get; + set; + } } public record UpdMap { [JsonPropertyName("Markers")] - public List? Markers { get; set; } + public List? Markers + { + get; + set; + } } public record MapMarker { [JsonPropertyName("Type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("X")] - public double? X { get; set; } + public double? X + { + get; + set; + } [JsonPropertyName("Y")] - public double? Y { get; set; } + public double? Y + { + get; + set; + } [JsonPropertyName("Note")] - public string? Note { get; set; } + public string? Note + { + get; + set; + } } public record UpdTag { [JsonPropertyName("Color")] - public int? Color { get; set; } + public int? Color + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } } public record UpdFaceShield { [JsonPropertyName("Hits")] - public int? Hits { get; set; } + public int? Hits + { + get; + set; + } [JsonPropertyName("HitSeed")] - public int? HitSeed { get; set; } + public int? HitSeed + { + get; + set; + } } public record UpdRepairable { [JsonPropertyName("Durability")] - public double? Durability { get; set; } + public double? Durability + { + get; + set; + } [JsonPropertyName("MaxDurability")] - public double? MaxDurability { get; set; } + public double? MaxDurability + { + get; + set; + } } public record UpdRecodableComponent { [JsonPropertyName("IsEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } } public record UpdMedKit { [JsonPropertyName("HpResource")] - public double? HpResource { get; set; } + public double? HpResource + { + get; + set; + } } public record UpdSight { [JsonPropertyName("ScopesCurrentCalibPointIndexes")] - public List? ScopesCurrentCalibPointIndexes { get; set; } + public List? ScopesCurrentCalibPointIndexes + { + get; + set; + } [JsonPropertyName("ScopesSelectedModes")] - public List? ScopesSelectedModes { get; set; } + public List? ScopesSelectedModes + { + get; + set; + } [JsonPropertyName("SelectedScope")] - public int? SelectedScope { get; set; } + public int? SelectedScope + { + get; + set; + } - public double? ScopeZoomValue { get; set; } + public double? ScopeZoomValue + { + get; + set; + } } public record UpdFoldable { [JsonPropertyName("Folded")] - public bool? Folded { get; set; } + public bool? Folded + { + get; + set; + } } public record UpdFireMode { [JsonPropertyName("FireMode")] - public string? FireMode { get; set; } + public string? FireMode + { + get; + set; + } } public record UpdFoodDrink { [JsonPropertyName("HpPercent")] - public double? HpPercent { get; set; } + public double? HpPercent + { + get; + set; + } } public record UpdKey { // Checked in client [JsonPropertyName("NumberOfUsages")] - public int? NumberOfUsages { get; set; } + public int? NumberOfUsages + { + get; + set; + } } public record UpdResource { [JsonPropertyName("Value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("UnitsConsumed")] - public double? UnitsConsumed { get; set; } + public double? UnitsConsumed + { + get; + set; + } } public record UpdLight { [JsonPropertyName("IsActive")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } [JsonPropertyName("SelectedMode")] - public int? SelectedMode { get; set; } + public int? SelectedMode + { + get; + set; + } } public record UpdDogtag { [JsonPropertyName("AccountId")] - public string? AccountId { get; set; } + public string? AccountId + { + get; + set; + } [JsonPropertyName("ProfileId")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("Side")] - public object? Side { get; set; } + public object? Side + { + get; + set; + } [JsonPropertyName("Level")] - public double? Level { get; set; } + public double? Level + { + get; + set; + } [JsonPropertyName("Time")] - public string? Time { get; set; } + public string? Time + { + get; + set; + } [JsonPropertyName("Status")] - public string? Status { get; set; } + public string? Status + { + get; + set; + } [JsonPropertyName("KillerAccountId")] - public string? KillerAccountId { get; set; } + public string? KillerAccountId + { + get; + set; + } [JsonPropertyName("KillerProfileId")] - public string? KillerProfileId { get; set; } + public string? KillerProfileId + { + get; + set; + } [JsonPropertyName("KillerName")] - public string? KillerName { get; set; } + public string? KillerName + { + get; + set; + } [JsonPropertyName("WeaponName")] - public string? WeaponName { get; set; } + public string? WeaponName + { + get; + set; + } - public bool? CarriedByGroupMember { get; set; } + public bool? CarriedByGroupMember + { + get; + set; + } } public record UpdSideEffect { [JsonPropertyName("Value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record UpdRepairKit { [JsonPropertyName("Resource")] - public double? Resource { get; set; } + public double? Resource + { + get; + set; + } } public record UpdCultistAmulet { [JsonPropertyName("NumberOfUsages")] - public double? NumberOfUsages { get; set; } + public double? NumberOfUsages + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/LocationServices.cs b/Libraries/Core/Models/Eft/Common/Tables/LocationServices.cs index 1f2d037c..cf1a1a22 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/LocationServices.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/LocationServices.cs @@ -7,184 +7,384 @@ namespace Core.Models.Eft.Common.Tables; public record LocationServices { [JsonPropertyName("TraderServerSettings")] - public TraderServerSettings? TraderServerSettings { get; set; } + public TraderServerSettings? TraderServerSettings + { + get; + set; + } [JsonPropertyName("BTRServerSettings")] - public BtrServerSettings? BtrServerSettings { get; set; } + public BtrServerSettings? BtrServerSettings + { + get; + set; + } } public record TraderServerSettings { [JsonPropertyName("TraderServices")] - public TraderServices? TraderServices { get; set; } + public TraderServices? TraderServices + { + get; + set; + } } public record TraderServices { [JsonPropertyName("ExUsecLoyalty")] - public TraderService? ExUsecLoyalty { get; set; } + public TraderService? ExUsecLoyalty + { + get; + set; + } [JsonPropertyName("ZryachiyAid")] - public TraderService? ZryachiyAid { get; set; } + public TraderService? ZryachiyAid + { + get; + set; + } [JsonPropertyName("CultistsAid")] - public TraderService? CultistsAid { get; set; } + public TraderService? CultistsAid + { + get; + set; + } [JsonPropertyName("PlayerTaxi")] - public TraderService? PlayerTaxi { get; set; } + public TraderService? PlayerTaxi + { + get; + set; + } [JsonPropertyName("BtrItemsDelivery")] - public TraderService? BtrItemsDelivery { get; set; } + public TraderService? BtrItemsDelivery + { + get; + set; + } [JsonPropertyName("BtrBotCover")] - public TraderService? BtrBotCover { get; set; } + public TraderService? BtrBotCover + { + get; + set; + } [JsonPropertyName("TransitItemsDelivery")] - public TraderService? TransitItemsDelivery { get; set; } + public TraderService? TransitItemsDelivery + { + get; + set; + } } public record TraderService { [JsonPropertyName("TraderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("TraderServiceType")] - public TraderServiceType? TraderServiceType { get; set; } + public TraderServiceType? TraderServiceType + { + get; + set; + } [JsonPropertyName("Requirements")] - public ServiceRequirements? Requirements { get; set; } + public ServiceRequirements? Requirements + { + get; + set; + } [JsonPropertyName("ServiceItemCost")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public Dictionary? ServiceItemCost { get; set; } + public Dictionary? ServiceItemCost + { + get; + set; + } [JsonPropertyName("UniqueItems")] - public List? UniqueItems { get; set; } + public List? UniqueItems + { + get; + set; + } } public record ServiceRequirements { [JsonPropertyName("CompletedQuests")] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public List? CompletedQuests { get; set; } + public List? CompletedQuests + { + get; + set; + } [JsonPropertyName("Standings")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public Dictionary? Standings { get; set; } + public Dictionary? Standings + { + get; + set; + } } public record CompletedQuest { [JsonPropertyName("QuestId")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } } public record StandingRequirement { [JsonPropertyName("Value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record ServiceItemCostDetails { [JsonPropertyName("Count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } public record BtrServerSettings { [JsonPropertyName("ChanceSpawn")] - public double? ChanceSpawn { get; set; } + public double? ChanceSpawn + { + get; + set; + } [JsonPropertyName("SpawnPeriod")] - public XYZ? SpawnPeriod { get; set; } + public XYZ? SpawnPeriod + { + get; + set; + } [JsonPropertyName("MoveSpeed")] - public float? MoveSpeed { get; set; } + public float? MoveSpeed + { + get; + set; + } [JsonPropertyName("ReadyToDepartureTime")] - public float? ReadyToDepartureTime { get; set; } + public float? ReadyToDepartureTime + { + get; + set; + } [JsonPropertyName("CheckTurnDistanceTime")] - public float? CheckTurnDistanceTime { get; set; } + public float? CheckTurnDistanceTime + { + get; + set; + } [JsonPropertyName("TurnCheckSensitivity")] - public float? TurnCheckSensitivity { get; set; } + public float? TurnCheckSensitivity + { + get; + set; + } [JsonPropertyName("DecreaseSpeedOnTurnLimit")] - public double? DecreaseSpeedOnTurnLimit { get; set; } + public double? DecreaseSpeedOnTurnLimit + { + get; + set; + } [JsonPropertyName("EndSplineDecelerationDistance")] - public double? EndSplineDecelerationDistance { get; set; } + public double? EndSplineDecelerationDistance + { + get; + set; + } [JsonPropertyName("AccelerationSpeed")] - public double? AccelerationSpeed { get; set; } + public double? AccelerationSpeed + { + get; + set; + } [JsonPropertyName("DecelerationSpeed")] - public double? DecelerationSpeed { get; set; } + public double? DecelerationSpeed + { + get; + set; + } [JsonPropertyName("PauseDurationRange")] - public XYZ? PauseDurationRange { get; set; } + public XYZ? PauseDurationRange + { + get; + set; + } [JsonPropertyName("BodySwingReturnSpeed")] - public float? BodySwingReturnSpeed { get; set; } + public float? BodySwingReturnSpeed + { + get; + set; + } [JsonPropertyName("BodySwingDamping")] - public float? BodySwingDamping { get; set; } + public float? BodySwingDamping + { + get; + set; + } [JsonPropertyName("BodySwingIntensity")] - public float? BodySwingIntensity { get; set; } + public float? BodySwingIntensity + { + get; + set; + } [JsonPropertyName("ServerMapBTRSettings")] - public Dictionary? ServerMapBTRSettings { get; set; } + public Dictionary? ServerMapBTRSettings + { + get; + set; + } } public record ServerMapBtrsettings { [JsonPropertyName("MapID")] - public string? MapID { get; set; } + public string? MapID + { + get; + set; + } [JsonPropertyName("ChanceSpawn")] - public double? ChanceSpawn { get; set; } + public double? ChanceSpawn + { + get; + set; + } [JsonPropertyName("SpawnPeriod")] - public XYZ? SpawnPeriod { get; set; } + public XYZ? SpawnPeriod + { + get; + set; + } [JsonPropertyName("MoveSpeed")] - public float? MoveSpeed { get; set; } + public float? MoveSpeed + { + get; + set; + } [JsonPropertyName("ReadyToDepartureTime")] - public float? ReadyToDepartureTime { get; set; } + public float? ReadyToDepartureTime + { + get; + set; + } [JsonPropertyName("CheckTurnDistanceTime")] - public float? CheckTurnDistanceTime { get; set; } + public float? CheckTurnDistanceTime + { + get; + set; + } [JsonPropertyName("TurnCheckSensitivity")] - public float? TurnCheckSensitivity { get; set; } + public float? TurnCheckSensitivity + { + get; + set; + } [JsonPropertyName("DecreaseSpeedOnTurnLimit")] - public float? DecreaseSpeedOnTurnLimit { get; set; } + public float? DecreaseSpeedOnTurnLimit + { + get; + set; + } [JsonPropertyName("EndSplineDecelerationDistance")] - public float? EndSplineDecelerationDistance { get; set; } + public float? EndSplineDecelerationDistance + { + get; + set; + } [JsonPropertyName("AccelerationSpeed")] - public float? AccelerationSpeed { get; set; } + public float? AccelerationSpeed + { + get; + set; + } [JsonPropertyName("DecelerationSpeed")] - public float? DecelerationSpeed { get; set; } + public float? DecelerationSpeed + { + get; + set; + } [JsonPropertyName("PauseDurationRange")] - public XYZ? PauseDurationRange { get; set; } + public XYZ? PauseDurationRange + { + get; + set; + } [JsonPropertyName("BodySwingReturnSpeed")] - public float? BodySwingReturnSpeed { get; set; } + public float? BodySwingReturnSpeed + { + get; + set; + } [JsonPropertyName("BodySwingDamping")] - public float? BodySwingDamping { get; set; } + public float? BodySwingDamping + { + get; + set; + } [JsonPropertyName("BodySwingIntensity")] - public float? BodySwingIntensity { get; set; } + public float? BodySwingIntensity + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/LocationsBase.cs b/Libraries/Core/Models/Eft/Common/Tables/LocationsBase.cs index 78a4c2c0..c2f5a4fc 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/LocationsBase.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/LocationsBase.cs @@ -5,10 +5,18 @@ namespace Core.Models.Eft.Common.Tables; public record LocationsBase { [JsonPropertyName("locations")] - public Locations? Locations { get; set; } + public Locations? Locations + { + get; + set; + } [JsonPropertyName("paths")] - public List? Paths { get; set; } + public List? Paths + { + get; + set; + } } public record Locations @@ -19,10 +27,22 @@ public record Locations public record Path { [JsonPropertyName("Source")] - public string? Source { get; set; } + public string? Source + { + get; + set; + } [JsonPropertyName("Destination")] - public string? Destination { get; set; } + public string? Destination + { + get; + set; + } - public bool? Event { get; set; } + public bool? Event + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/LocationsGenerateAllResponse.cs b/Libraries/Core/Models/Eft/Common/Tables/LocationsGenerateAllResponse.cs index f4915e4e..54643499 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/LocationsGenerateAllResponse.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/LocationsGenerateAllResponse.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Common.Tables; public record LocationsGenerateAllResponse { [JsonPropertyName("locations")] - public Dictionary Locations { get; set; } + public Dictionary Locations + { + get; + set; + } [JsonPropertyName("paths")] - public List? Paths { get; set; } + public List? Paths + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/Match.cs b/Libraries/Core/Models/Eft/Common/Tables/Match.cs index 03de4185..b784c3fa 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Match.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Match.cs @@ -5,26 +5,54 @@ namespace Core.Models.Eft.Common.Tables; public record Match { [JsonPropertyName("metrics")] - public Metrics? Metrics { get; set; } + public Metrics? Metrics + { + get; + set; + } } public record Metrics { [JsonPropertyName("Keys")] - public List? Keys { get; set; } + public List? Keys + { + get; + set; + } [JsonPropertyName("NetProcessingBins")] - public List? NetProcessingBins { get; set; } + public List? NetProcessingBins + { + get; + set; + } [JsonPropertyName("RenderBins")] - public List? RenderBins { get; set; } + public List? RenderBins + { + get; + set; + } [JsonPropertyName("GameUpdateBins")] - public List? GameUpdateBins { get; set; } + public List? GameUpdateBins + { + get; + set; + } [JsonPropertyName("MemoryMeasureInterval")] - public int? MemoryMeasureInterval { get; set; } + public int? MemoryMeasureInterval + { + get; + set; + } [JsonPropertyName("PauseReasons")] - public List? PauseReasons { get; set; } + public List? PauseReasons + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/Prestige.cs b/Libraries/Core/Models/Eft/Common/Tables/Prestige.cs index d7c3cdfc..523b6caf 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Prestige.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Prestige.cs @@ -1,75 +1,143 @@ -namespace Core.Models.Eft.Common.Tables; +using System.Text.Json.Serialization; -using System.Text.Json.Serialization; +namespace Core.Models.Eft.Common.Tables; public record Prestige { [JsonPropertyName("elements")] - public List? Elements { get; set; } + public List? Elements + { + get; + set; + } } public record PrestigeElement { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("conditions")] - public List? Conditions { get; set; } + public List? Conditions + { + get; + set; + } [JsonPropertyName("rewards")] - public List? Rewards { get; set; } + public List? Rewards + { + get; + set; + } [JsonPropertyName("transferConfigs")] - public TransferConfigs? TransferConfigs { get; set; } + public TransferConfigs? TransferConfigs + { + get; + set; + } [JsonPropertyName("image")] - public string? Image { get; set; } + public string? Image + { + get; + set; + } [JsonPropertyName("bigImage")] - public string? BigImage { get; set; } + public string? BigImage + { + get; + set; + } } public record TransferConfigs { [JsonPropertyName("stashConfig")] - public StashPrestigeConfig? StashConfig { get; set; } + public StashPrestigeConfig? StashConfig + { + get; + set; + } [JsonPropertyName("skillConfig")] - public PrestigeSkillConfig? SkillConfig { get; set; } + public PrestigeSkillConfig? SkillConfig + { + get; + set; + } [JsonPropertyName("masteringConfig")] - public PrestigeMasteringConfig? MasteringConfig { get; set; } + public PrestigeMasteringConfig? MasteringConfig + { + get; + set; + } } public record StashPrestigeConfig { [JsonPropertyName("xCellCount")] - public int? XCellCount { get; set; } + public int? XCellCount + { + get; + set; + } [JsonPropertyName("yCellCount")] - public int? YCellCount { get; set; } + public int? YCellCount + { + get; + set; + } [JsonPropertyName("filters")] - public StashPrestigeFilters? Filters { get; set; } + public StashPrestigeFilters? Filters + { + get; + set; + } } public record StashPrestigeFilters { [JsonPropertyName("includedItems")] - public List? IncludedItems { get; set; } + public List? IncludedItems + { + get; + set; + } [JsonPropertyName("excludedItems")] - public List? ExcludedItems { get; set; } + public List? ExcludedItems + { + get; + set; + } } public record PrestigeSkillConfig { [JsonPropertyName("transferMultiplier")] - public double? TransferMultiplier { get; set; } + public double? TransferMultiplier + { + get; + set; + } } public record PrestigeMasteringConfig { [JsonPropertyName("transferMultiplier")] - public double? TransferMultiplier { get; set; } + public double? TransferMultiplier + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/ProfileTemplate.cs b/Libraries/Core/Models/Eft/Common/Tables/ProfileTemplate.cs index 44a2aeb0..3770b152 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/ProfileTemplate.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/ProfileTemplate.cs @@ -1,104 +1,221 @@ using System.Text.Json.Serialization; using Core.Models.Eft.Profile; -using SptCommon.Extensions; namespace Core.Models.Eft.Common.Tables; public record ProfileTemplates { [JsonPropertyName("Standard")] - public ProfileSides? Standard { get; set; } + public ProfileSides? Standard + { + get; + set; + } [JsonPropertyName("Left Behind")] - public ProfileSides? LeftBehind { get; set; } + public ProfileSides? LeftBehind + { + get; + set; + } [JsonPropertyName("Prepare To Escape")] - public ProfileSides? PrepareToEscape { get; set; } + public ProfileSides? PrepareToEscape + { + get; + set; + } [JsonPropertyName("Edge Of Darkness")] - public ProfileSides? EdgeOfDarkness { get; set; } + public ProfileSides? EdgeOfDarkness + { + get; + set; + } [JsonPropertyName("Unheard")] - public ProfileSides? Unheard { get; set; } + public ProfileSides? Unheard + { + get; + set; + } [JsonPropertyName("Tournament")] - public ProfileSides? Tournament { get; set; } + public ProfileSides? Tournament + { + get; + set; + } [JsonPropertyName("SPT Developer")] - public ProfileSides? SPTDeveloper { get; set; } + public ProfileSides? SPTDeveloper + { + get; + set; + } [JsonPropertyName("SPT Easy start")] - public ProfileSides? SPTEasyStart { get; set; } + public ProfileSides? SPTEasyStart + { + get; + set; + } [JsonPropertyName("SPT Zero to hero")] - public ProfileSides? SPTZeroToHero { get; set; } + public ProfileSides? SPTZeroToHero + { + get; + set; + } } public record ProfileSides { [JsonPropertyName("descriptionLocaleKey")] - public string? DescriptionLocaleKey { get; set; } + public string? DescriptionLocaleKey + { + get; + set; + } [JsonPropertyName("usec")] - public TemplateSide? Usec { get; set; } + public TemplateSide? Usec + { + get; + set; + } [JsonPropertyName("bear")] - public TemplateSide? Bear { get; set; } + public TemplateSide? Bear + { + get; + set; + } } public record TemplateSide { [JsonPropertyName("character")] - public PmcData? Character { get; set; } + public PmcData? Character + { + get; + set; + } [JsonPropertyName("suits")] - public List? Suits { get; set; } + public List? Suits + { + get; + set; + } [JsonPropertyName("dialogues")] - public Dictionary? Dialogues { get; set; } + public Dictionary? Dialogues + { + get; + set; + } [JsonPropertyName("userbuilds")] - public UserBuilds? UserBuilds { get; set; } + public UserBuilds? UserBuilds + { + get; + set; + } [JsonPropertyName("trader")] - public ProfileTraderTemplate? Trader { get; set; } + public ProfileTraderTemplate? Trader + { + get; + set; + } [JsonPropertyName("equipmentBuilds")] - public object? EquipmentBuilds { get; set; } + public object? EquipmentBuilds + { + get; + set; + } [JsonPropertyName("weaponbuilds")] - public object? WeaponBuilds { get; set; } + public object? WeaponBuilds + { + get; + set; + } } public record ProfileTraderTemplate { [JsonPropertyName("initialLoyaltyLevel")] - public Dictionary? InitialLoyaltyLevel { get; set; } + public Dictionary? InitialLoyaltyLevel + { + get; + set; + } [JsonPropertyName("initialStanding")] - public Dictionary? InitialStanding { get; set; } + public Dictionary? InitialStanding + { + get; + set; + } [JsonPropertyName("setQuestsAvailableForStart")] - public bool? SetQuestsAvailableForStart { get; set; } + public bool? SetQuestsAvailableForStart + { + get; + set; + } [JsonPropertyName("setQuestsAvailableForFinish")] - public bool? SetQuestsAvailableForFinish { get; set; } + public bool? SetQuestsAvailableForFinish + { + get; + set; + } [JsonPropertyName("initialSalesSum")] - public int? InitialSalesSum { get; set; } + public int? InitialSalesSum + { + get; + set; + } [JsonPropertyName("jaegerUnlocked")] - public bool? JaegerUnlocked { get; set; } + public bool? JaegerUnlocked + { + get; + set; + } - /** 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 { get; set; } + public int? FleaBlockedDays + { + get; + set; + } - /** What traders default to being locked on profile creation */ + /** + * What traders default to being locked on profile creation + */ [JsonPropertyName("lockedByDefaultOverride")] - public List? LockedByDefaultOverride { get; set; } + public List? LockedByDefaultOverride + { + get; + set; + } - /** 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 { get; set; } + public List? PurchaseAllClothingByDefaultForTrader + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/Quest.cs b/Libraries/Core/Models/Eft/Common/Tables/Quest.cs index 9c4c2679..a9c81fe1 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Quest.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Quest.cs @@ -2,497 +2,1072 @@ using System.Text.Json.Serialization; using Core.Models.Enums; using Core.Utils.Json; using Core.Utils.Json.Converters; -using SptCommon.Extensions; namespace Core.Models.Eft.Common.Tables; public record Quest { /// - /// SPT addition - human readable quest name + /// SPT addition - human readable quest name /// [JsonPropertyName("QuestName")] - public string? QuestName { get; set; } + public string? QuestName + { + get; + set; + } /// - /// _id + /// _id /// [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("canShowNotificationsInGame")] - public bool? CanShowNotificationsInGame { get; set; } + public bool? CanShowNotificationsInGame + { + get; + set; + } [JsonPropertyName("conditions")] - public QuestConditionTypes? Conditions { get; set; } + public QuestConditionTypes? Conditions + { + get; + set; + } [JsonPropertyName("description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("failMessageText")] - public string? FailMessageText { get; set; } + public string? FailMessageText + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("note")] - public string? Note { get; set; } + public string? Note + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("image")] - public string? Image { get; set; } + public string? Image + { + get; + set; + } [JsonPropertyName("type")] // can be string or QuestTypeEnum [JsonConverter(typeof(JsonStringEnumConverter))] - public QuestTypeEnum? Type { get; set; } + public QuestTypeEnum? Type + { + get; + set; + } [JsonPropertyName("isKey")] - public bool? IsKey { get; set; } + public bool? IsKey + { + get; + set; + } [JsonPropertyName("restartable")] - public bool? Restartable { get; set; } + public bool? Restartable + { + get; + set; + } [JsonPropertyName("instantComplete")] - public bool? InstantComplete { get; set; } + public bool? InstantComplete + { + get; + set; + } [JsonPropertyName("secretQuest")] - public bool? SecretQuest { get; set; } + public bool? SecretQuest + { + get; + set; + } [JsonPropertyName("startedMessageText")] - public string? StartedMessageText { get; set; } + public string? StartedMessageText + { + get; + set; + } [JsonPropertyName("successMessageText")] - public string? SuccessMessageText { get; set; } + public string? SuccessMessageText + { + get; + set; + } [JsonPropertyName("acceptPlayerMessage")] - public string? AcceptPlayerMessage { get; set; } + public string? AcceptPlayerMessage + { + get; + set; + } [JsonPropertyName("declinePlayerMessage")] - public string? DeclinePlayerMessage { get; set; } + public string? DeclinePlayerMessage + { + get; + set; + } [JsonPropertyName("completePlayerMessage")] - public string? CompletePlayerMessage { get; set; } + public string? CompletePlayerMessage + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("rewards")] - public QuestRewards? Rewards { get; set; } + public QuestRewards? Rewards + { + get; + set; + } /// - /// Becomes 'AppearStatus' inside client + /// Becomes 'AppearStatus' inside client /// [JsonPropertyName("status")] - public object? Status { get; set; } // TODO: string | number + public object? Status + { + get; + set; + } // TODO: string | number [JsonPropertyName("KeyQuest")] - public bool? KeyQuest { get; set; } + public bool? KeyQuest + { + get; + set; + } [JsonPropertyName("changeQuestMessageText")] - public string? ChangeQuestMessageText { get; set; } + public string? ChangeQuestMessageText + { + get; + set; + } /// - /// "Pmc" or "Scav" + /// "Pmc" or "Scav" /// [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("acceptanceAndFinishingSource")] - public string? AcceptanceAndFinishingSource { get; set; } + public string? AcceptanceAndFinishingSource + { + get; + set; + } [JsonPropertyName("progressSource")] - public string? ProgressSource { get; set; } + public string? ProgressSource + { + get; + set; + } [JsonPropertyName("rankingModes")] - public List? RankingModes { get; set; } + public List? RankingModes + { + get; + set; + } [JsonPropertyName("gameModes")] - public List? GameModes { get; set; } + public List? GameModes + { + get; + set; + } [JsonPropertyName("arenaLocations")] - public List? ArenaLocations { get; set; } + public List? ArenaLocations + { + get; + set; + } /// - /// Status of quest to player + /// Status of quest to player /// [JsonPropertyName("sptStatus")] - public QuestStatusEnum? SptStatus { get; set; } + public QuestStatusEnum? SptStatus + { + get; + set; + } [JsonPropertyName("questStatus")] - public QuestStatus? QuestStatus { get; set; } + public QuestStatus? QuestStatus + { + get; + set; + } [JsonPropertyName("changeCost")] - public List ChangeCost { get; set; } + public List ChangeCost + { + get; + set; + } [JsonPropertyName("changeStandingCost")] - public double ChangeStandingCost { get; set; } + public double ChangeStandingCost + { + get; + set; + } } /// -/// Same as BotBase.Quests +/// Same as BotBase.Quests /// public record QuestStatus { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("uid")] - public string? Uid { get; set; } + public string? Uid + { + get; + set; + } [JsonPropertyName("qid")] - public string? QId { get; set; } + public string? QId + { + get; + set; + } [JsonPropertyName("startTime")] - public double? StartTime { get; set; } + public double? StartTime + { + get; + set; + } [JsonPropertyName("status")] - public QuestStatusEnum? Status { get; set; } + public QuestStatusEnum? Status + { + get; + set; + } [JsonPropertyName("statusTimers")] - public Dictionary? StatusTimers { get; set; } + public Dictionary? StatusTimers + { + get; + set; + } [JsonPropertyName("completedConditions")] - public List? CompletedConditions { get; set; } + public List? CompletedConditions + { + get; + set; + } [JsonPropertyName("availableAfter")] - public double? AvailableAfter { get; set; } + public double? AvailableAfter + { + get; + set; + } } public record QuestConditionTypes { [JsonPropertyName("Started")] - public List? Started { get; set; } + public List? Started + { + get; + set; + } [JsonPropertyName("AvailableForFinish")] - public List? AvailableForFinish { get; set; } + public List? AvailableForFinish + { + get; + set; + } [JsonPropertyName("AvailableForStart")] - public List? AvailableForStart { get; set; } + public List? AvailableForStart + { + get; + set; + } [JsonPropertyName("Success")] - public List? Success { get; set; } + public List? Success + { + get; + set; + } [JsonPropertyName("Fail")] - public List? Fail { get; set; } + public List? Fail + { + get; + set; + } } public record QuestCondition { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } [JsonPropertyName("compareMethod")] - public string? CompareMethod { get; set; } + public string? CompareMethod + { + get; + set; + } [JsonPropertyName("dynamicLocale")] - public bool? DynamicLocale { get; set; } + public bool? DynamicLocale + { + get; + set; + } [JsonPropertyName("visibilityConditions")] - public List? VisibilityConditions { get; set; } + public List? VisibilityConditions + { + get; + set; + } [JsonPropertyName("globalQuestCounterId")] - public string? GlobalQuestCounterId { get; set; } + public string? GlobalQuestCounterId + { + get; + set; + } [JsonPropertyName("parentId")] - public string? ParentId { get; set; } + public string? ParentId + { + get; + set; + } /// - /// Can be: string[] or string + /// Can be: string[] or string /// [JsonPropertyName("target")] [JsonConverter(typeof(ListOrTConverterFactory))] - public ListOrT? Target { get; set; } // TODO: string[] | string + public ListOrT? Target + { + get; + set; + } // TODO: string[] | string [JsonPropertyName("value")] - public object? Value { get; set; } // TODO: string | number + public object? Value + { + get; + set; + } // TODO: string | number [JsonPropertyName("type")] - public object? Type { get; set; } // TODO: boolean | string + public object? Type + { + get; + set; + } // TODO: boolean | string [JsonPropertyName("status")] - public List? Status { get; set; } + public List? Status + { + get; + set; + } [JsonPropertyName("availableAfter")] - public int? AvailableAfter { get; set; } + public int? AvailableAfter + { + get; + set; + } [JsonPropertyName("dispersion")] - public double? Dispersion { get; set; } + public double? Dispersion + { + get; + set; + } [JsonPropertyName("onlyFoundInRaid")] - public bool? OnlyFoundInRaid { get; set; } + public bool? OnlyFoundInRaid + { + get; + set; + } [JsonPropertyName("oneSessionOnly")] - public bool? OneSessionOnly { get; set; } + public bool? OneSessionOnly + { + get; + set; + } [JsonPropertyName("isResetOnConditionFailed")] - public bool? IsResetOnConditionFailed { get; set; } + public bool? IsResetOnConditionFailed + { + get; + set; + } [JsonPropertyName("isNecessary")] - public bool? IsNecessary { get; set; } + public bool? IsNecessary + { + get; + set; + } [JsonPropertyName("doNotResetIfCounterCompleted")] - public bool? DoNotResetIfCounterCompleted { get; set; } + public bool? DoNotResetIfCounterCompleted + { + get; + set; + } [JsonPropertyName("dogtagLevel")] - public object? DogtagLevel { get; set; } // TODO: number | string + public object? DogtagLevel + { + get; + set; + } // TODO: number | string [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("maxDurability")] - public object? MaxDurability { get; set; } // TODO: number | string + public object? MaxDurability + { + get; + set; + } // TODO: number | string [JsonPropertyName("minDurability")] - public object? MinDurability { get; set; } // TODO: number | string + public object? MinDurability + { + get; + set; + } // TODO: number | string [JsonPropertyName("counter")] - public QuestConditionCounter? Counter { get; set; } + public QuestConditionCounter? Counter + { + get; + set; + } [JsonPropertyName("plantTime")] - public double? PlantTime { get; set; } + public double? PlantTime + { + get; + set; + } [JsonPropertyName("zoneId")] - public string? ZoneId { get; set; } + public string? ZoneId + { + get; + set; + } [JsonPropertyName("countInRaid")] - public bool? CountInRaid { get; set; } + public bool? CountInRaid + { + get; + set; + } [JsonPropertyName("completeInSeconds")] - public double? CompleteInSeconds { get; set; } + public double? CompleteInSeconds + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } [JsonPropertyName("conditionType")] - public string? ConditionType { get; set; } + public string? ConditionType + { + get; + set; + } [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("baseAccuracy")] - public ValueCompare? BaseAccuracy { get; set; } + public ValueCompare? BaseAccuracy + { + get; + set; + } [JsonPropertyName("containsItems")] - public List? ContainsItems { get; set; } + public List? ContainsItems + { + get; + set; + } [JsonPropertyName("durability")] - public ValueCompare? Durability { get; set; } + public ValueCompare? Durability + { + get; + set; + } [JsonPropertyName("effectiveDistance")] - public ValueCompare? EffectiveDistance { get; set; } + public ValueCompare? EffectiveDistance + { + get; + set; + } [JsonPropertyName("emptyTacticalSlot")] - public ValueCompare? EmptyTacticalSlot { get; set; } + public ValueCompare? EmptyTacticalSlot + { + get; + set; + } [JsonPropertyName("ergonomics")] - public ValueCompare? Ergonomics { get; set; } + public ValueCompare? Ergonomics + { + get; + set; + } [JsonPropertyName("height")] - public ValueCompare? Height { get; set; } + public ValueCompare? Height + { + get; + set; + } [JsonPropertyName("hasItemFromCategory")] - public List? HasItemFromCategory { get; set; } + public List? HasItemFromCategory + { + get; + set; + } [JsonPropertyName("magazineCapacity")] - public ValueCompare? MagazineCapacity { get; set; } + public ValueCompare? MagazineCapacity + { + get; + set; + } [JsonPropertyName("muzzleVelocity")] - public ValueCompare? MuzzleVelocity { get; set; } + public ValueCompare? MuzzleVelocity + { + get; + set; + } [JsonPropertyName("recoil")] - public ValueCompare? Recoil { get; set; } + public ValueCompare? Recoil + { + get; + set; + } [JsonPropertyName("weight")] - public ValueCompare? Weight { get; set; } + public ValueCompare? Weight + { + get; + set; + } [JsonPropertyName("width")] - public ValueCompare? Width { get; set; } + public ValueCompare? Width + { + get; + set; + } } public record QuestConditionCounter { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("conditions")] - public List? Conditions { get; set; } + public List? Conditions + { + get; + set; + } } public record QuestConditionCounterCondition { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("dynamicLocale")] - public bool? DynamicLocale { get; set; } + public bool? DynamicLocale + { + get; + set; + } [JsonPropertyName("target")] - public object? Target { get; set; } // TODO: string[] | string + public object? Target + { + get; + set; + } // TODO: string[] | string [JsonPropertyName("completeInSeconds")] - public int? CompleteInSeconds { get; set; } + public int? CompleteInSeconds + { + get; + set; + } [JsonPropertyName("energy")] - public ValueCompare? Energy { get; set; } + public ValueCompare? Energy + { + get; + set; + } [JsonPropertyName("exitName")] - public string? ExitName { get; set; } + public string? ExitName + { + get; + set; + } [JsonPropertyName("hydration")] - public ValueCompare? Hydration { get; set; } + public ValueCompare? Hydration + { + get; + set; + } [JsonPropertyName("time")] - public ValueCompare? Time { get; set; } + public ValueCompare? Time + { + get; + set; + } [JsonPropertyName("compareMethod")] - public string? CompareMethod { get; set; } + public string? CompareMethod + { + get; + set; + } [JsonPropertyName("value")] - public object? Value { get; set; } // TODO: number | string + public object? Value + { + get; + set; + } // TODO: number | string [JsonPropertyName("weapon")] - public List? Weapon { get; set; } + public List? Weapon + { + get; + set; + } [JsonPropertyName("distance")] - public CounterConditionDistance? Distance { get; set; } + public CounterConditionDistance? Distance + { + get; + set; + } [JsonPropertyName("equipmentInclusive")] - public List>? EquipmentInclusive { get; set; } + public List>? EquipmentInclusive + { + get; + set; + } [JsonPropertyName("weaponModsInclusive")] - public List>? WeaponModsInclusive { get; set; } + public List>? WeaponModsInclusive + { + get; + set; + } [JsonPropertyName("weaponModsExclusive")] - public List>? WeaponModsExclusive { get; set; } + public List>? WeaponModsExclusive + { + get; + set; + } [JsonPropertyName("enemyEquipmentInclusive")] - public List>? EnemyEquipmentInclusive { get; set; } + public List>? EnemyEquipmentInclusive + { + get; + set; + } [JsonPropertyName("enemyEquipmentExclusive")] - public List>? EnemyEquipmentExclusive { get; set; } + public List>? EnemyEquipmentExclusive + { + get; + set; + } [JsonPropertyName("weaponCaliber")] - public List? WeaponCaliber { get; set; } + public List? WeaponCaliber + { + get; + set; + } [JsonPropertyName("savageRole")] - public List? SavageRole { get; set; } + public List? SavageRole + { + get; + set; + } [JsonPropertyName("status")] - public List? Status { get; set; } + public List? Status + { + get; + set; + } [JsonPropertyName("bodyPart")] - public List? BodyPart { get; set; } + public List? BodyPart + { + get; + set; + } [JsonPropertyName("daytime")] - public DaytimeCounter? Daytime { get; set; } + public DaytimeCounter? Daytime + { + get; + set; + } [JsonPropertyName("conditionType")] - public string? ConditionType { get; set; } + public string? ConditionType + { + get; + set; + } [JsonPropertyName("enemyHealthEffects")] - public List? EnemyHealthEffects { get; set; } + public List? EnemyHealthEffects + { + get; + set; + } [JsonPropertyName("resetOnSessionEnd")] - public bool? ResetOnSessionEnd { get; set; } + public bool? ResetOnSessionEnd + { + get; + set; + } [JsonPropertyName("bodyPartsWithEffects")] - public List? BodyPartsWithEffects { get; set; } + public List? BodyPartsWithEffects + { + get; + set; + } [JsonPropertyName("IncludeNotEquippedItems")] - public bool? IncludeNotEquippedItems { get; set; } + public bool? IncludeNotEquippedItems + { + get; + set; + } [JsonPropertyName("equipmentExclusive")] - public List>? EquipmentExclusive { get; set; } + public List>? EquipmentExclusive + { + get; + set; + } [JsonPropertyName("zoneIds")] - public List? Zones { get; set; } + public List? Zones + { + get; + set; + } } public record EnemyHealthEffect { [JsonPropertyName("bodyParts")] - public List? BodyParts { get; set; } + public List? BodyParts + { + get; + set; + } [JsonPropertyName("effects")] - public List? Effects { get; set; } + public List? Effects + { + get; + set; + } } public record ValueCompare { [JsonPropertyName("compareMethod")] - public string? CompareMethod { get; set; } + public string? CompareMethod + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record CounterConditionDistance { [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("compareMethod")] - public string? CompareMethod { get; set; } + public string? CompareMethod + { + get; + set; + } } public record DaytimeCounter { [JsonPropertyName("from")] - public int? From { get; set; } + public int? From + { + get; + set; + } [JsonPropertyName("to")] - public int? To { get; set; } + public int? To + { + get; + set; + } } public record VisibilityCondition { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("target")] - public string? Target { get; set; } + public string? Target + { + get; + set; + } [JsonPropertyName("value")] - public int? Value { get; set; } + public int? Value + { + get; + set; + } [JsonPropertyName("dynamicLocale")] - public bool? DynamicLocale { get; set; } + public bool? DynamicLocale + { + get; + set; + } [JsonPropertyName("oneSessionOnly")] - public bool? OneSessionOnly { get; set; } + public bool? OneSessionOnly + { + get; + set; + } [JsonPropertyName("conditionType")] - public string? ConditionType { get; set; } + public string? ConditionType + { + get; + set; + } } public record QuestRewards { [JsonPropertyName("AvailableForStart")] - public List? AvailableForStart { get; set; } + public List? AvailableForStart + { + get; + set; + } [JsonPropertyName("AvailableForFinish")] - public List? AvailableForFinish { get; set; } + public List? AvailableForFinish + { + get; + set; + } [JsonPropertyName("Started")] - public List? Started { get; set; } + public List? Started + { + get; + set; + } [JsonPropertyName("Success")] - public List? Success { get; set; } + public List? Success + { + get; + set; + } [JsonPropertyName("Fail")] - public List? Fail { get; set; } + public List? Fail + { + get; + set; + } [JsonPropertyName("FailRestartable")] - public List? FailRestartable { get; set; } + public List? FailRestartable + { + get; + set; + } [JsonPropertyName("Expired")] - public List? Expired { get; set; } + public List? Expired + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/RepeatableQuests.cs b/Libraries/Core/Models/Eft/Common/Tables/RepeatableQuests.cs index 590f1fad..975594d2 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/RepeatableQuests.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/RepeatableQuests.cs @@ -5,131 +5,275 @@ namespace Core.Models.Eft.Common.Tables; public record RepeatableQuest : Quest { [JsonPropertyName("changeCost")] - public List? ChangeCost { get; set; } + public List? ChangeCost + { + get; + set; + } [JsonPropertyName("changeStandingCost")] - public int? ChangeStandingCost { get; set; } + public int? ChangeStandingCost + { + get; + set; + } [JsonPropertyName("sptRepatableGroupName")] - public string? SptRepatableGroupName { get; set; } + public string? SptRepatableGroupName + { + get; + set; + } [JsonPropertyName("acceptanceAndFinishingSource")] - public string? AcceptanceAndFinishingSource { get; set; } + public string? AcceptanceAndFinishingSource + { + get; + set; + } [JsonPropertyName("progressSource")] - public string? ProgressSource { get; set; } + public string? ProgressSource + { + get; + set; + } [JsonPropertyName("rankingModes")] - public List? RankingModes { get; set; } + public List? RankingModes + { + get; + set; + } [JsonPropertyName("gameModes")] - public List? GameModes { get; set; } + public List? GameModes + { + get; + set; + } [JsonPropertyName("arenaLocations")] - public List? ArenaLocations { get; set; } + public List? ArenaLocations + { + get; + set; + } [JsonPropertyName("questStatus")] - public RepeatableQuestStatus? QuestStatus { get; set; } + public RepeatableQuestStatus? QuestStatus + { + get; + set; + } } public record RepeatableQuestDatabase { [JsonPropertyName("templates")] - public RepeatableTemplates? Templates { get; set; } + public RepeatableTemplates? Templates + { + get; + set; + } [JsonPropertyName("rewards")] - public RewardOptions? Rewards { get; set; } + public RewardOptions? Rewards + { + get; + set; + } [JsonPropertyName("data")] - public Options? Data { get; set; } + public Options? Data + { + get; + set; + } [JsonPropertyName("samples")] - public List? Samples { get; set; } + public List? Samples + { + get; + set; + } } public record RepeatableQuestStatus { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("uid")] - public string? Uid { get; set; } + public string? Uid + { + get; + set; + } [JsonPropertyName("qid")] - public string? QId { get; set; } + public string? QId + { + get; + set; + } [JsonPropertyName("startTime")] - public long? StartTime { get; set; } + public long? StartTime + { + get; + set; + } [JsonPropertyName("status")] - public int? Status { get; set; } + public int? Status + { + get; + set; + } [JsonPropertyName("statusTimers")] - public object? StatusTimers { get; set; } // Use object for any type + public object? StatusTimers + { + get; + set; + } // Use object for any type } public record RepeatableTemplates { [JsonPropertyName("Elimination")] - public RepeatableQuest? Elimination { get; set; } + public RepeatableQuest? Elimination + { + get; + set; + } [JsonPropertyName("Completion")] - public RepeatableQuest? Completion { get; set; } + public RepeatableQuest? Completion + { + get; + set; + } [JsonPropertyName("Exploration")] - public RepeatableQuest? Exploration { get; set; } + public RepeatableQuest? Exploration + { + get; + set; + } [JsonPropertyName("Pickup")] - public RepeatableQuest? Pickup { get; set; } + public RepeatableQuest? Pickup + { + get; + set; + } } public record PmcDataRepeatableQuest { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("unavailableTime")] - public string? UnavailableTime { get; set; } + public string? UnavailableTime + { + get; + set; + } [JsonPropertyName("activeQuests")] - public List? ActiveQuests { get; set; } + public List? ActiveQuests + { + get; + set; + } [JsonPropertyName("inactiveQuests")] - public List? InactiveQuests { get; set; } + public List? InactiveQuests + { + get; + set; + } [JsonPropertyName("endTime")] - public long? EndTime { get; set; } + public long? EndTime + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("changeRequirement")] - public Dictionary? ChangeRequirement { get; set; } + public Dictionary? ChangeRequirement + { + get; + set; + } [JsonPropertyName("freeChanges")] - public int? FreeChanges { get; set; } + public int? FreeChanges + { + get; + set; + } [JsonPropertyName("freeChangesAvailable")] - public int? FreeChangesAvailable { get; set; } + public int? FreeChangesAvailable + { + get; + set; + } } public record ChangeRequirement { [JsonPropertyName("changeCost")] - public List? ChangeCost { get; set; } + public List? ChangeCost + { + get; + set; + } [JsonPropertyName("changeStandingCost")] - public double? ChangeStandingCost { get; set; } + public double? ChangeStandingCost + { + get; + set; + } } public record ChangeCost { [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } // Config Options @@ -137,98 +281,206 @@ public record ChangeCost public record RewardOptions { [JsonPropertyName("itemsBlacklist")] - public List? ItemsBlacklist { get; set; } + public List? ItemsBlacklist + { + get; + set; + } } public record Options { [JsonPropertyName("Completion")] - public CompletionFilter? Completion { get; set; } + public CompletionFilter? Completion + { + get; + set; + } } public record CompletionFilter { [JsonPropertyName("itemsBlacklist")] - public List? ItemsBlacklist { get; set; } + public List? ItemsBlacklist + { + get; + set; + } [JsonPropertyName("itemsWhitelist")] - public List? ItemsWhitelist { get; set; } + public List? ItemsWhitelist + { + get; + set; + } } public record ItemsBlacklist { [JsonPropertyName("minPlayerLevel")] - public int? MinPlayerLevel { get; set; } + public int? MinPlayerLevel + { + get; + set; + } [JsonPropertyName("itemIds")] - public List? ItemIds { get; set; } + public List? ItemIds + { + get; + set; + } } public record ItemsWhitelist { [JsonPropertyName("minPlayerLevel")] - public int? MinPlayerLevel { get; set; } + public int? MinPlayerLevel + { + get; + set; + } [JsonPropertyName("itemIds")] - public List? ItemIds { get; set; } + public List? ItemIds + { + get; + set; + } } public record SampleQuests { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("image")] - public string? Image { get; set; } + public string? Image + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("isKey")] - public bool? IsKey { get; set; } + public bool? IsKey + { + get; + set; + } [JsonPropertyName("restartable")] - public bool? Restartable { get; set; } + public bool? Restartable + { + get; + set; + } [JsonPropertyName("instantComplete")] - public bool? InstantComplete { get; set; } + public bool? InstantComplete + { + get; + set; + } [JsonPropertyName("secretQuest")] - public bool? SecretQuest { get; set; } + public bool? SecretQuest + { + get; + set; + } [JsonPropertyName("canShowNotificationsInGame")] - public bool? CanShowNotificationsInGame { get; set; } + public bool? CanShowNotificationsInGame + { + get; + set; + } [JsonPropertyName("rewards")] - public QuestRewards? Rewards { get; set; } + public QuestRewards? Rewards + { + get; + set; + } [JsonPropertyName("conditions")] - public QuestConditionTypes? Conditions { get; set; } + public QuestConditionTypes? Conditions + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("note")] - public string? Note { get; set; } + public string? Note + { + get; + set; + } [JsonPropertyName("description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("successMessageText")] - public string? SuccessMessageText { get; set; } + public string? SuccessMessageText + { + get; + set; + } [JsonPropertyName("failMessageText")] - public string? FailMessageText { get; set; } + public string? FailMessageText + { + get; + set; + } [JsonPropertyName("startedMessageText")] - public string? StartedMessageText { get; set; } + public string? StartedMessageText + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/Reward.cs b/Libraries/Core/Models/Eft/Common/Tables/Reward.cs index cc458232..1c10ada9 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Reward.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Reward.cs @@ -6,55 +6,125 @@ namespace Core.Models.Eft.Common.Tables; public record Reward { [JsonPropertyName("value")] - public object? Value { get; set; } // TODO: Can be either string or number + public object? Value + { + get; + set; + } // TODO: Can be either string or number [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] - public RewardType? Type { get; set; } + public RewardType? Type + { + get; + set; + } [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } [JsonPropertyName("target")] - public string? Target { get; set; } + public string? Target + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("loyaltyLevel")] - public int? LoyaltyLevel { get; set; } + public int? LoyaltyLevel + { + get; + set; + } - /** Hideout area id */ + /** + * Hideout area id + */ [JsonPropertyName("traderId")] - public object? TraderId { get; set; } // TODO: string | int + public object? TraderId + { + get; + set; + } // TODO: string | int [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } [JsonPropertyName("unknown")] - public bool? Unknown { get; set; } + public bool? Unknown + { + get; + set; + } [JsonPropertyName("findInRaid")] - public bool? FindInRaid { get; set; } + public bool? FindInRaid + { + get; + set; + } [JsonPropertyName("gameMode")] - public List? GameMode { get; set; } + public List? GameMode + { + get; + set; + } - /** Game editions whitelisted to get reward */ + /** + * Game editions whitelisted to get reward + */ [JsonPropertyName("availableInGameEditions")] - public List? AvailableInGameEditions { get; set; } + public List? AvailableInGameEditions + { + get; + set; + } - /** Game editions blacklisted from getting reward */ + /** + * Game editions blacklisted from getting reward + */ [JsonPropertyName("notAvailableInGameEditions")] - public List? NotAvailableInGameEditions { get; set; } + public List? NotAvailableInGameEditions + { + get; + set; + } // This is always Null atm in the achievements.json [JsonPropertyName("illustrationConfig")] - public object? IllustrationConfig { get; set; } + public object? IllustrationConfig + { + get; + set; + } [JsonPropertyName("isHidden")] - public bool? IsHidden { get; set; } + public bool? IsHidden + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs b/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs index dd8afcc6..06b137e7 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs @@ -7,1470 +7,3351 @@ namespace Core.Models.Eft.Common.Tables; public record TemplateItem { private string? _id; + + private string? _name; + + private string? _parent; + + private string? _type; + [JsonPropertyName("_id")] public string? Id { - get => _id; - set => _id = string.Intern(value); + get + { + return _id; + } + set + { + _id = string.Intern(value); + } } - private string? _name; [JsonPropertyName("_name")] public string? Name { - get => _name; - set => _name = string.Intern(value); + get + { + return _name; + } + set + { + _name = string.Intern(value); + } } - private string? _parent; [JsonPropertyName("_parent")] public string? Parent { - get => _parent; - set => _parent = string.Intern(value); + get + { + return _parent; + } + set + { + _parent = string.Intern(value); + } } - private string? _type; [JsonPropertyName("_type")] public string? Type { - get => _type; - set => _type = string.Intern(value); + get + { + return _type; + } + set + { + _type = string.Intern(value); + } } [JsonPropertyName("_props")] - public Props? Properties { get; set; } + public Props? Properties + { + get; + set; + } [JsonPropertyName("_proto")] - public string? Prototype { get; set; } + public string? Prototype + { + get; + set; + } } public record Props { + private string? _metascoreGroup; + + private string? _rarityPvE; + + private string? _unlootableFromSlot; + [JsonPropertyName("AllowSpawnOnLocations")] - public List? AllowSpawnOnLocations { get; set; } + public List? AllowSpawnOnLocations + { + get; + set; + } [JsonPropertyName("BeltMagazineRefreshCount")] - public double? BeltMagazineRefreshCount { get; set; } + public double? BeltMagazineRefreshCount + { + get; + set; + } [JsonPropertyName("ChangePriceCoef")] - public double? ChangePriceCoef { get; set; } + public double? ChangePriceCoef + { + get; + set; + } [JsonPropertyName("FixedPrice")] - public bool? FixedPrice { get; set; } + public bool? FixedPrice + { + get; + set; + } [JsonPropertyName("SendToClient")] - public bool? SendToClient { get; set; } + public bool? SendToClient + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("ShortName")] - public string? ShortName { get; set; } + public string? ShortName + { + get; + set; + } [JsonPropertyName("Description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("Weight")] - public double? Weight { get; set; } + public double? Weight + { + get; + set; + } [JsonPropertyName("BackgroundColor")] - public string? BackgroundColor { get; set; } + public string? BackgroundColor + { + get; + set; + } // Type confirmed via client [JsonPropertyName("Width")] - public int? Width { get; set; } + public int? Width + { + get; + set; + } // Type confirmed via client [JsonPropertyName("Height")] - public int? Height { get; set; } + public int? Height + { + get; + set; + } // Type confirmed via client [JsonPropertyName("StackMaxSize")] - public int? StackMaxSize { get; set; } + public int? StackMaxSize + { + get; + set; + } // Type confirmed via client [JsonPropertyName("Rarity")] - public LootRarity? Rarity { get; set; } + public LootRarity? Rarity + { + get; + set; + } [JsonPropertyName("SpawnChance")] - public double? SpawnChance { get; set; } + public double? SpawnChance + { + get; + set; + } [JsonPropertyName("CreditsPrice")] - public double? CreditsPrice { get; set; } + public double? CreditsPrice + { + get; + set; + } [JsonPropertyName("ItemSound")] - public string? ItemSound { get; set; } + public string? ItemSound + { + get; + set; + } [JsonPropertyName("Prefab")] // TODO: TYPE FUCKERY: can be a Prefab object or empty string or a string - public Prefab? Prefab { get; set; } + public Prefab? Prefab + { + get; + set; + } [JsonPropertyName("UsePrefab")] - public Prefab? UsePrefab { get; set; } + public Prefab? UsePrefab + { + get; + set; + } [JsonPropertyName("airDropTemplateId")] - public string? AirDropTemplateId { get; set; } + public string? AirDropTemplateId + { + get; + set; + } [JsonPropertyName("StackObjectsCount")] - public double? StackObjectsCount { get; set; } + public double? StackObjectsCount + { + get; + set; + } [JsonPropertyName("NotShownInSlot")] - public bool? NotShownInSlot { get; set; } + public bool? NotShownInSlot + { + get; + set; + } [JsonPropertyName("ExaminedByDefault")] - public bool? ExaminedByDefault { get; set; } + public bool? ExaminedByDefault + { + get; + set; + } [JsonPropertyName("ExamineTime")] - public double? ExamineTime { get; set; } + public double? ExamineTime + { + get; + set; + } [JsonPropertyName("IsUndiscardable")] - public bool? IsUndiscardable { get; set; } + public bool? IsUndiscardable + { + get; + set; + } [JsonPropertyName("IsUnsaleable")] - public bool? IsUnsaleable { get; set; } + public bool? IsUnsaleable + { + get; + set; + } [JsonPropertyName("IsUnbuyable")] - public bool? IsUnbuyable { get; set; } + public bool? IsUnbuyable + { + get; + set; + } [JsonPropertyName("IsUngivable")] - public bool? IsUngivable { get; set; } + public bool? IsUngivable + { + get; + set; + } [JsonPropertyName("IsUnremovable")] - public bool? IsUnRemovable { get; set; } + public bool? IsUnRemovable + { + get; + set; + } [JsonPropertyName("IsLockedafterEquip")] - public bool? IsLockedAfterEquip { get; set; } + public bool? IsLockedAfterEquip + { + get; + set; + } [JsonPropertyName("IsSecretExitRequirement")] - public bool? IsSecretExitRequirement { get; set; } + public bool? IsSecretExitRequirement + { + get; + set; + } [JsonPropertyName("IsRagfairCurrency")] - public bool? IsRagfairCurrency { get; set; } + public bool? IsRagfairCurrency + { + get; + set; + } [JsonPropertyName("IsSpecialSlotOnly")] - public bool? IsSpecialSlotOnly { get; set; } + public bool? IsSpecialSlotOnly + { + get; + set; + } [JsonPropertyName("IsStationaryWeapon")] - public bool? IsStationaryWeapon { get; set; } + public bool? IsStationaryWeapon + { + get; + set; + } [JsonPropertyName("QuestItem")] - public bool? QuestItem { get; set; } + public bool? QuestItem + { + get; + set; + } [JsonPropertyName("QuestStashMaxCount")] - public double? QuestStashMaxCount { get; set; } + public double? QuestStashMaxCount + { + get; + set; + } // Type confirmed via client [JsonPropertyName("LootExperience")] - public int? LootExperience { get; set; } + public int? LootExperience + { + get; + set; + } // Type confirmed via client [JsonPropertyName("ExamineExperience")] - public int? ExamineExperience { get; set; } + public int? ExamineExperience + { + get; + set; + } [JsonPropertyName("HideEntrails")] - public bool? HideEntrails { get; set; } + public bool? HideEntrails + { + get; + set; + } [JsonPropertyName("InsuranceDisabled")] - public bool? InsuranceDisabled { get; set; } + public bool? InsuranceDisabled + { + get; + set; + } // Type confirmed via client [JsonPropertyName("RepairCost")] - public int? RepairCost { get; set; } + public int? RepairCost + { + get; + set; + } // Type confirmed via client [JsonPropertyName("RepairSpeed")] - public int? RepairSpeed { get; set; } + public int? RepairSpeed + { + get; + set; + } [JsonPropertyName("ExtraSizeLeft")] - public int? ExtraSizeLeft { get; set; } + public int? ExtraSizeLeft + { + get; + set; + } [JsonPropertyName("ExtraSizeRight")] - public int? ExtraSizeRight { get; set; } + public int? ExtraSizeRight + { + get; + set; + } [JsonPropertyName("ExtraSizeUp")] - public int? ExtraSizeUp { get; set; } + public int? ExtraSizeUp + { + get; + set; + } [JsonPropertyName("FlareTypes")] - public List? FlareTypes { get; set; } + public List? FlareTypes + { + get; + set; + } [JsonPropertyName("ExtraSizeDown")] - public int? ExtraSizeDown { get; set; } + public int? ExtraSizeDown + { + get; + set; + } [JsonPropertyName("ExtraSizeForceAdd")] - public bool? ExtraSizeForceAdd { get; set; } + public bool? ExtraSizeForceAdd + { + get; + set; + } [JsonPropertyName("MergesWithChildren")] - public bool? MergesWithChildren { get; set; } + public bool? MergesWithChildren + { + get; + set; + } - private string? _metascoreGroup; [JsonPropertyName("MetascoreGroup")] public string? MetascoreGroup { - get => _metascoreGroup; - set => _metascoreGroup = value == null ? null : string.Intern(value); + get + { + return _metascoreGroup; + } + set + { + _metascoreGroup = value == null ? null : string.Intern(value); + } } [JsonPropertyName("NpcCompressorSendLevel")] - public double? NpcCompressorSendLevel { get; set; } + public double? NpcCompressorSendLevel + { + get; + set; + } [JsonPropertyName("ObservedPlayerCompressorSendLevel")] - public double? ObservedPlayerCompressorSendLevel { get; set; } + public double? ObservedPlayerCompressorSendLevel + { + get; + set; + } [JsonPropertyName("CanSellOnRagfair")] - public bool? CanSellOnRagfair { get; set; } + public bool? CanSellOnRagfair + { + get; + set; + } [JsonPropertyName("CanRequireOnRagfair")] - public bool? CanRequireOnRagfair { get; set; } + public bool? CanRequireOnRagfair + { + get; + set; + } [JsonPropertyName("ConflictingItems")] - public List? ConflictingItems { get; set; } + public List? ConflictingItems + { + get; + set; + } [JsonPropertyName("Unlootable")] - public bool? Unlootable { get; set; } + public bool? Unlootable + { + get; + set; + } - private string? _unlootableFromSlot; [JsonPropertyName("UnlootableFromSlot")] public string? UnlootableFromSlot { - get => _unlootableFromSlot; - set => _unlootableFromSlot = value == null ? null : string.Intern(value); + get + { + return _unlootableFromSlot; + } + set + { + _unlootableFromSlot = value == null ? null : string.Intern(value); + } } [JsonPropertyName("UnlootableFromSide")] - public List? UnlootableFromSide { get; set; } + public List? UnlootableFromSide + { + get; + set; + } // Type confirmed via client [JsonPropertyName("AnimationVariantsNumber")] - public int? AnimationVariantsNumber { get; set; } + public int? AnimationVariantsNumber + { + get; + set; + } [JsonPropertyName("DiscardingBlock")] - public bool? DiscardingBlock { get; set; } + public bool? DiscardingBlock + { + get; + set; + } [JsonPropertyName("DropSoundType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public ItemDropSoundType? DropSoundType { get; set; } + public ItemDropSoundType? DropSoundType + { + get; + set; + } [JsonPropertyName("RagFairCommissionModifier")] - public double? RagFairCommissionModifier { get; set; } + public double? RagFairCommissionModifier + { + get; + set; + } - private string? _rarityPvE; [JsonPropertyName("RarityPvE")] public string? RarityPvE { - get => _rarityPvE; - set => _rarityPvE = value == null ? null : string.Intern(value); + get + { + return _rarityPvE; + } + set + { + _rarityPvE = value == null ? null : string.Intern(value); + } } [JsonPropertyName("IsAlwaysAvailableForInsurance")] - public bool? IsAlwaysAvailableForInsurance { get; set; } + public bool? IsAlwaysAvailableForInsurance + { + get; + set; + } [JsonPropertyName("DiscardLimit")] - public double? DiscardLimit { get; set; } + public double? DiscardLimit + { + get; + set; + } // Type confirmed via client [JsonPropertyName("MaxResource")] - public int? MaxResource { get; set; } + public int? MaxResource + { + get; + set; + } [JsonPropertyName("Resource")] - public double? Resource { get; set; } + public double? Resource + { + get; + set; + } [JsonPropertyName("DogTagQualities")] - public bool? DogTagQualities { get; set; } + public bool? DogTagQualities + { + get; + set; + } [JsonPropertyName("Grids")] - public List? Grids { get; set; } + public List? Grids + { + get; + set; + } [JsonPropertyName("Slots")] - public List? Slots { get; set; } + public List? Slots + { + get; + set; + } [JsonPropertyName("CanPutIntoDuringTheRaid")] - public bool? CanPutIntoDuringTheRaid { get; set; } + public bool? CanPutIntoDuringTheRaid + { + get; + set; + } [JsonPropertyName("CantRemoveFromSlotsDuringRaid")] - public List? CantRemoveFromSlotsDuringRaid { get; set; } + public List? CantRemoveFromSlotsDuringRaid + { + get; + set; + } [JsonPropertyName("KeyIds")] - public List? KeyIds { get; set; } + public List? KeyIds + { + get; + set; + } [JsonPropertyName("TagColor")] - public double? TagColor { get; set; } + public double? TagColor + { + get; + set; + } [JsonPropertyName("TagName")] - public string? TagName { get; set; } + public string? TagName + { + get; + set; + } [JsonPropertyName("Durability")] - public double? Durability { get; set; } + public double? Durability + { + get; + set; + } [JsonPropertyName("Accuracy")] - public double? Accuracy { get; set; } + public double? Accuracy + { + get; + set; + } [JsonPropertyName("Recoil")] - public double? Recoil { get; set; } + public double? Recoil + { + get; + set; + } [JsonPropertyName("Loudness")] - public double? Loudness { get; set; } + public double? Loudness + { + get; + set; + } [JsonPropertyName("EffectiveDistance")] - public double? EffectiveDistance { get; set; } + public double? EffectiveDistance + { + get; + set; + } [JsonPropertyName("Ergonomics")] - public double? Ergonomics { get; set; } + public double? Ergonomics + { + get; + set; + } [JsonPropertyName("Velocity")] - public double? Velocity { get; set; } + public double? Velocity + { + get; + set; + } [JsonPropertyName("WeaponRecoilSettings")] - public WeaponRecoilSettings? WeaponRecoilSettings { get; set; } + public WeaponRecoilSettings? WeaponRecoilSettings + { + get; + set; + } [JsonPropertyName("WithAnimatorAiming")] - public bool? WithAnimatorAiming { get; set; } + public bool? WithAnimatorAiming + { + get; + set; + } [JsonPropertyName("RaidModdable")] - public bool? RaidModdable { get; set; } + public bool? RaidModdable + { + get; + set; + } [JsonPropertyName("ToolModdable")] - public bool? ToolModdable { get; set; } + public bool? ToolModdable + { + get; + set; + } [JsonPropertyName("UniqueAnimationModID")] - public double? UniqueAnimationModID { get; set; } + public double? UniqueAnimationModID + { + get; + set; + } [JsonPropertyName("BlocksFolding")] - public bool? BlocksFolding { get; set; } + public bool? BlocksFolding + { + get; + set; + } [JsonPropertyName("BlocksCollapsible")] - public bool? BlocksCollapsible { get; set; } + public bool? BlocksCollapsible + { + get; + set; + } [JsonPropertyName("IsAnimated")] - public bool? IsAnimated { get; set; } + public bool? IsAnimated + { + get; + set; + } [JsonPropertyName("HasShoulderContact")] - public bool? HasShoulderContact { get; set; } + public bool? HasShoulderContact + { + get; + set; + } [JsonPropertyName("SightingRange")] - public double? SightingRange { get; set; } + public double? SightingRange + { + get; + set; + } [JsonPropertyName("ZoomSensitivity")] - public double? ZoomSensitivity { get; set; } + public double? ZoomSensitivity + { + get; + set; + } [JsonPropertyName("DoubleActionAccuracyPenaltyMult")] - public double? DoubleActionAccuracyPenaltyMult { get; set; } + public double? DoubleActionAccuracyPenaltyMult + { + get; + set; + } [JsonPropertyName("ModesCount")] - public object? ModesCount { get; set; } // TODO: object here + public object? ModesCount + { + get; + set; + } // TODO: object here [JsonPropertyName("DurabilityBurnModificator")] - public double? DurabilityBurnModificator { get; set; } + public double? DurabilityBurnModificator + { + get; + set; + } [JsonPropertyName("HeatFactor")] - public double? HeatFactor { get; set; } + public double? HeatFactor + { + get; + set; + } [JsonPropertyName("CoolFactor")] - public double? CoolFactor { get; set; } + public double? CoolFactor + { + get; + set; + } [JsonPropertyName("muzzleModType")] - public string? MuzzleModType { get; set; } + public string? MuzzleModType + { + get; + set; + } [JsonPropertyName("CustomAimPlane")] - public string? CustomAimPlane { get; set; } + public string? CustomAimPlane + { + get; + set; + } [JsonPropertyName("IsAdjustableOptic")] - public bool? IsAdjustableOptic { get; set; } + public bool? IsAdjustableOptic + { + get; + set; + } [JsonPropertyName("MinMaxFov")] - public XYZ? MinMaxFov { get; set; } + public XYZ? MinMaxFov + { + get; + set; + } [JsonPropertyName("sightModType")] - public string? SightModType { get; set; } + public string? SightModType + { + get; + set; + } [JsonPropertyName("SightModesCount")] - public double? SightModesCount { get; set; } + public double? SightModesCount + { + get; + set; + } [JsonPropertyName("OpticCalibrationDistances")] - public List? OpticCalibrationDistances { get; set; } + public List? OpticCalibrationDistances + { + get; + set; + } [JsonPropertyName("ScopesCount")] - public double? ScopesCount { get; set; } + public double? ScopesCount + { + get; + set; + } [JsonPropertyName("AimSensitivity")] - public object? AimSensitivity { get; set; } // TODO: object here + public object? AimSensitivity + { + get; + set; + } // TODO: object here [JsonPropertyName("Zooms")] - public List>? Zooms { get; set; } + public List>? Zooms + { + get; + set; + } [JsonPropertyName("CalibrationDistances")] - public List>? CalibrationDistances { get; set; } + public List>? CalibrationDistances + { + get; + set; + } [JsonPropertyName("Intensity")] - public double? Intensity { get; set; } + public double? Intensity + { + get; + set; + } [JsonPropertyName("Mask")] - public string? Mask { get; set; } + public string? Mask + { + get; + set; + } [JsonPropertyName("MaskSize")] - public double? MaskSize { get; set; } + public double? MaskSize + { + get; + set; + } [JsonPropertyName("IsMagazineForStationaryWeapon")] - public bool? IsMagazineForStationaryWeapon { get; set; } + public bool? IsMagazineForStationaryWeapon + { + get; + set; + } [JsonPropertyName("NoiseIntensity")] - public double? NoiseIntensity { get; set; } + public double? NoiseIntensity + { + get; + set; + } [JsonPropertyName("NoiseScale")] - public double? NoiseScale { get; set; } + public double? NoiseScale + { + get; + set; + } [JsonPropertyName("Color")] - public Color? Color { get; set; } + public Color? Color + { + get; + set; + } [JsonPropertyName("DiffuseIntensity")] - public double? DiffuseIntensity { get; set; } + public double? DiffuseIntensity + { + get; + set; + } [JsonPropertyName("MagazineWithBelt")] - public bool? MagazineWithBelt { get; set; } + public bool? MagazineWithBelt + { + get; + set; + } [JsonPropertyName("HasHinge")] - public bool? HasHinge { get; set; } + public bool? HasHinge + { + get; + set; + } [JsonPropertyName("RampPalette")] - public string? RampPalette { get; set; } + public string? RampPalette + { + get; + set; + } [JsonPropertyName("DepthFade")] - public double? DepthFade { get; set; } + public double? DepthFade + { + get; + set; + } [JsonPropertyName("RoughnessCoef")] - public double? RoughnessCoef { get; set; } + public double? RoughnessCoef + { + get; + set; + } [JsonPropertyName("SpecularCoef")] - public double? SpecularCoef { get; set; } + public double? SpecularCoef + { + get; + set; + } [JsonPropertyName("MainTexColorCoef")] - public double? MainTexColorCoef { get; set; } + public double? MainTexColorCoef + { + get; + set; + } [JsonPropertyName("MinimumTemperatureValue")] - public double? MinimumTemperatureValue { get; set; } + public double? MinimumTemperatureValue + { + get; + set; + } [JsonPropertyName("RampShift")] - public double? RampShift { get; set; } + public double? RampShift + { + get; + set; + } [JsonPropertyName("HeatMin")] - public double? HeatMin { get; set; } + public double? HeatMin + { + get; + set; + } [JsonPropertyName("ColdMax")] - public double? ColdMax { get; set; } + public double? ColdMax + { + get; + set; + } [JsonPropertyName("IsNoisy")] - public bool? IsNoisy { get; set; } + public bool? IsNoisy + { + get; + set; + } [JsonPropertyName("IsFpsStuck")] - public bool? IsFpsStuck { get; set; } + public bool? IsFpsStuck + { + get; + set; + } [JsonPropertyName("IsGlitch")] - public bool? IsGlitch { get; set; } + public bool? IsGlitch + { + get; + set; + } [JsonPropertyName("IsMotionBlurred")] - public bool? IsMotionBlurred { get; set; } + public bool? IsMotionBlurred + { + get; + set; + } [JsonPropertyName("IsPixelated")] - public bool? IsPixelated { get; set; } + public bool? IsPixelated + { + get; + set; + } [JsonPropertyName("PixelationBlockCount")] - public double? PixelationBlockCount { get; set; } + public double? PixelationBlockCount + { + get; + set; + } [JsonPropertyName("ShiftsAimCamera")] - public double? ShiftsAimCamera { get; set; } + public double? ShiftsAimCamera + { + get; + set; + } [JsonPropertyName("magAnimationIndex")] - public double? MagAnimationIndex { get; set; } + public double? MagAnimationIndex + { + get; + set; + } [JsonPropertyName("Cartridges")] - public List? Cartridges { get; set; } + public List? Cartridges + { + get; + set; + } [JsonPropertyName("CanFast")] - public bool? CanFast { get; set; } + public bool? CanFast + { + get; + set; + } [JsonPropertyName("CanHit")] - public bool? CanHit { get; set; } + public bool? CanHit + { + get; + set; + } [JsonPropertyName("CanAdmin")] - public bool? CanAdmin { get; set; } + public bool? CanAdmin + { + get; + set; + } [JsonPropertyName("LoadUnloadModifier")] - public double? LoadUnloadModifier { get; set; } + public double? LoadUnloadModifier + { + get; + set; + } [JsonPropertyName("CheckTimeModifier")] - public double? CheckTimeModifier { get; set; } + public double? CheckTimeModifier + { + get; + set; + } [JsonPropertyName("CheckOverride")] - public double? CheckOverride { get; set; } + public double? CheckOverride + { + get; + set; + } [JsonConverter(typeof(JsonStringEnumConverter))] [JsonPropertyName("ReloadMagType")] - public ReloadMode? ReloadMagType { get; set; } + public ReloadMode? ReloadMagType + { + get; + set; + } [JsonPropertyName("VisibleAmmoRangesString")] - public string? VisibleAmmoRangesString { get; set; } + public string? VisibleAmmoRangesString + { + get; + set; + } [JsonPropertyName("MalfunctionChance")] - public double? MalfunctionChance { get; set; } + public double? MalfunctionChance + { + get; + set; + } [JsonPropertyName("IsShoulderContact")] - public bool? IsShoulderContact { get; set; } + public bool? IsShoulderContact + { + get; + set; + } [JsonPropertyName("Foldable")] - public bool? Foldable { get; set; } + public bool? Foldable + { + get; + set; + } [JsonPropertyName("Retractable")] - public bool? Retractable { get; set; } + public bool? Retractable + { + get; + set; + } [JsonPropertyName("SizeReduceRight")] - public int? SizeReduceRight { get; set; } + public int? SizeReduceRight + { + get; + set; + } [JsonPropertyName("CenterOfImpact")] - public double? CenterOfImpact { get; set; } + public double? CenterOfImpact + { + get; + set; + } [JsonPropertyName("IsSilencer")] - public bool? IsSilencer { get; set; } + public bool? IsSilencer + { + get; + set; + } [JsonPropertyName("DeviationCurve")] - public double? DeviationCurve { get; set; } + public double? DeviationCurve + { + get; + set; + } [JsonPropertyName("DeviationMax")] - public double? DeviationMax { get; set; } + public double? DeviationMax + { + get; + set; + } [JsonPropertyName("SearchSound")] - public string? SearchSound { get; set; } + public string? SearchSound + { + get; + set; + } [JsonPropertyName("BlocksArmorVest")] - public bool? BlocksArmorVest { get; set; } + public bool? BlocksArmorVest + { + get; + set; + } [JsonPropertyName("speedPenaltyPercent")] - public double? SpeedPenaltyPercent { get; set; } + public double? SpeedPenaltyPercent + { + get; + set; + } [JsonPropertyName("GridLayoutName")] - public string? GridLayoutName { get; set; } + public string? GridLayoutName + { + get; + set; + } [JsonPropertyName("ContainerSpawnChanceModifier")] - public double? ContainerSpawnChanceModifier { get; set; } + public double? ContainerSpawnChanceModifier + { + get; + set; + } [JsonPropertyName("SpawnFilter")] - public List? SpawnFilter { get; set; } // TODO: object here + public List? SpawnFilter + { + get; + set; + } // TODO: object here [JsonPropertyName("containType")] - public List? ContainType { get; set; } // TODO: object here + public List? ContainType + { + get; + set; + } // TODO: object here [JsonPropertyName("sizeWidth")] - public double? SizeWidth { get; set; } + public double? SizeWidth + { + get; + set; + } [JsonPropertyName("sizeHeight")] - public double? SizeHeight { get; set; } + public double? SizeHeight + { + get; + set; + } [JsonPropertyName("isSecured")] - public bool? IsSecured { get; set; } + public bool? IsSecured + { + get; + set; + } [JsonPropertyName("spawnTypes")] - public string? SpawnTypes { get; set; } + public string? SpawnTypes + { + get; + set; + } [JsonPropertyName("lootFilter")] - public List? LootFilter { get; set; } // TODO: object here + public List? LootFilter + { + get; + set; + } // TODO: object here [JsonPropertyName("spawnRarity")] - public string? SpawnRarity { get; set; } + public string? SpawnRarity + { + get; + set; + } [JsonPropertyName("minCountSpawn")] - public double? MinCountSpawn { get; set; } + public double? MinCountSpawn + { + get; + set; + } [JsonPropertyName("maxCountSpawn")] - public double? MaxCountSpawn { get; set; } + public double? MaxCountSpawn + { + get; + set; + } [JsonPropertyName("openedByKeyID")] - public List? OpenedByKeyID { get; set; } + public List? OpenedByKeyID + { + get; + set; + } [JsonPropertyName("RigLayoutName")] - public string? RigLayoutName { get; set; } + public string? RigLayoutName + { + get; + set; + } [JsonPropertyName("MaxDurability")] - public double? MaxDurability { get; set; } + public double? MaxDurability + { + get; + set; + } [JsonPropertyName("armorZone")] - public List? ArmorZone { get; set; } + public List? ArmorZone + { + get; + set; + } // Type confirmed via client [JsonPropertyName("armorClass")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? ArmorClass { get; set; } + public int? ArmorClass + { + get; + set; + } [JsonPropertyName("armorColliders")] - public List? ArmorColliders { get; set; } + public List? ArmorColliders + { + get; + set; + } [JsonPropertyName("armorPlateColliders")] - public List? ArmorPlateColliders { get; set; } + public List? ArmorPlateColliders + { + get; + set; + } [JsonPropertyName("bluntDamageReduceFromSoftArmor")] - public bool? BluntDamageReduceFromSoftArmor { get; set; } + public bool? BluntDamageReduceFromSoftArmor + { + get; + set; + } [JsonPropertyName("mousePenalty")] - public double? MousePenalty { get; set; } + public double? MousePenalty + { + get; + set; + } [JsonPropertyName("weaponErgonomicPenalty")] - public double? WeaponErgonomicPenalty { get; set; } + public double? WeaponErgonomicPenalty + { + get; + set; + } [JsonPropertyName("BluntThroughput")] - public double? BluntThroughput { get; set; } + public double? BluntThroughput + { + get; + set; + } [JsonConverter(typeof(JsonStringEnumConverter))] [JsonPropertyName("ArmorMaterial")] - public ArmorMaterial? ArmorMaterial { get; set; } + public ArmorMaterial? ArmorMaterial + { + get; + set; + } [JsonPropertyName("ArmorType")] - public string? ArmorType { get; set; } + public string? ArmorType + { + get; + set; + } [JsonPropertyName("weapClass")] - public string? WeapClass { get; set; } + public string? WeapClass + { + get; + set; + } [JsonPropertyName("weapUseType")] - public string? WeapUseType { get; set; } + public string? WeapUseType + { + get; + set; + } [JsonPropertyName("ammoCaliber")] - public string? AmmoCaliber { get; set; } + public string? AmmoCaliber + { + get; + set; + } [JsonPropertyName("OperatingResource")] - public double? OperatingResource { get; set; } + public double? OperatingResource + { + get; + set; + } [JsonPropertyName("PostRecoilHorizontalRangeHandRotation")] - public XYZ? PostRecoilHorizontalRangeHandRotation { get; set; } + public XYZ? PostRecoilHorizontalRangeHandRotation + { + get; + set; + } [JsonPropertyName("PostRecoilVerticalRangeHandRotation")] - public XYZ? PostRecoilVerticalRangeHandRotation { get; set; } + public XYZ? PostRecoilVerticalRangeHandRotation + { + get; + set; + } [JsonPropertyName("ProgressRecoilAngleOnStable")] - public XYZ? ProgressRecoilAngleOnStable { get; set; } + public XYZ? ProgressRecoilAngleOnStable + { + get; + set; + } [JsonPropertyName("RepairComplexity")] - public double? RepairComplexity { get; set; } + public double? RepairComplexity + { + get; + set; + } [JsonPropertyName("durabSpawnMin")] - public double? DurabSpawnMin { get; set; } + public double? DurabSpawnMin + { + get; + set; + } [JsonPropertyName("durabSpawnMax")] - public double? DurabSpawnMax { get; set; } + public double? DurabSpawnMax + { + get; + set; + } [JsonPropertyName("isFastReload")] - public bool? IsFastReload { get; set; } + public bool? IsFastReload + { + get; + set; + } [JsonPropertyName("RecoilForceUp")] - public double? RecoilForceUp { get; set; } + public double? RecoilForceUp + { + get; + set; + } [JsonPropertyName("RecoilForceBack")] - public double? RecoilForceBack { get; set; } + public double? RecoilForceBack + { + get; + set; + } [JsonPropertyName("RecoilAngle")] - public double? RecoilAngle { get; set; } + public double? RecoilAngle + { + get; + set; + } [JsonPropertyName("RecoilCamera")] - public double? RecoilCamera { get; set; } + public double? RecoilCamera + { + get; + set; + } [JsonPropertyName("RecoilCategoryMultiplierHandRotation")] - public double? RecoilCategoryMultiplierHandRotation { get; set; } + public double? RecoilCategoryMultiplierHandRotation + { + get; + set; + } [JsonPropertyName("weapFireType")] - public List? WeapFireType { get; set; } + public List? WeapFireType + { + get; + set; + } [JsonPropertyName("RecolDispersion")] - public double? RecolDispersion { get; set; } + public double? RecolDispersion + { + get; + set; + } [JsonPropertyName("SingleFireRate")] - public double? SingleFireRate { get; set; } + public double? SingleFireRate + { + get; + set; + } [JsonPropertyName("CanQueueSecondShot")] - public bool? CanQueueSecondShot { get; set; } + public bool? CanQueueSecondShot + { + get; + set; + } [JsonPropertyName("bFirerate")] - public double? BFirerate { get; set; } + public double? BFirerate + { + get; + set; + } [JsonPropertyName("bEffDist")] - public double? BEffDist { get; set; } + public double? BEffDist + { + get; + set; + } [JsonPropertyName("bHearDist")] - public double? BHearDist { get; set; } + public double? BHearDist + { + get; + set; + } [JsonPropertyName("blockLeftStance")] - public bool? BlockLeftStance { get; set; } + public bool? BlockLeftStance + { + get; + set; + } [JsonPropertyName("isChamberLoad")] - public bool? IsChamberLoad { get; set; } + public bool? IsChamberLoad + { + get; + set; + } [JsonPropertyName("chamberAmmoCount")] - public double? ChamberAmmoCount { get; set; } + public double? ChamberAmmoCount + { + get; + set; + } [JsonPropertyName("isBoltCatch")] - public bool? IsBoltCatch { get; set; } + public bool? IsBoltCatch + { + get; + set; + } [JsonPropertyName("defMagType")] - public string? DefMagType { get; set; } + public string? DefMagType + { + get; + set; + } [JsonPropertyName("defAmmo")] - public string? DefAmmo { get; set; } + public string? DefAmmo + { + get; + set; + } [JsonPropertyName("AdjustCollimatorsToTrajectory")] - public bool? AdjustCollimatorsToTrajectory { get; set; } + public bool? AdjustCollimatorsToTrajectory + { + get; + set; + } [JsonPropertyName("ShotgunDispersion")] - public double? ShotgunDispersion { get; set; } + public double? ShotgunDispersion + { + get; + set; + } [JsonPropertyName("shotgunDispersion")] - public double? shotgunDispersion { get; set; } + public double? shotgunDispersion + { + get; + set; + } [JsonPropertyName("Chambers")] - public List? Chambers { get; set; } + public List? Chambers + { + get; + set; + } [JsonPropertyName("CameraSnap")] - public double? CameraSnap { get; set; } + public double? CameraSnap + { + get; + set; + } [JsonPropertyName("CameraToWeaponAngleSpeedRange")] - public XYZ? CameraToWeaponAngleSpeedRange { get; set; } + public XYZ? CameraToWeaponAngleSpeedRange + { + get; + set; + } [JsonPropertyName("CameraToWeaponAngleStep")] - public double? CameraToWeaponAngleStep { get; set; } + public double? CameraToWeaponAngleStep + { + get; + set; + } [JsonConverter(typeof(JsonStringEnumConverter))] [JsonPropertyName("ReloadMode")] - public ReloadMode? ReloadMode { get; set; } + public ReloadMode? ReloadMode + { + get; + set; + } [JsonPropertyName("AimPlane")] - public double? AimPlane { get; set; } + public double? AimPlane + { + get; + set; + } [JsonPropertyName("TacticalReloadStiffnes")] - public XYZ? TacticalReloadStiffnes { get; set; } + public XYZ? TacticalReloadStiffnes + { + get; + set; + } [JsonPropertyName("TacticalReloadFixation")] - public double? TacticalReloadFixation { get; set; } + public double? TacticalReloadFixation + { + get; + set; + } [JsonPropertyName("RecoilCenter")] - public XYZ? RecoilCenter { get; set; } + public XYZ? RecoilCenter + { + get; + set; + } [JsonPropertyName("RotationCenter")] - public XYZ? RotationCenter { get; set; } + public XYZ? RotationCenter + { + get; + set; + } [JsonPropertyName("RotationCenterNoStock")] - public XYZ? RotationCenterNoStock { get; set; } + public XYZ? RotationCenterNoStock + { + get; + set; + } [JsonPropertyName("ShotsGroupSettings")] - public List? ShotsGroupSettings { get; set; } + public List? ShotsGroupSettings + { + get; + set; + } [JsonPropertyName("FoldedSlot")] - public string? FoldedSlot { get; set; } + public string? FoldedSlot + { + get; + set; + } [JsonPropertyName("ForbidMissingVitalParts")] - public bool? ForbidMissingVitalParts { get; set; } + public bool? ForbidMissingVitalParts + { + get; + set; + } [JsonPropertyName("ForbidNonEmptyContainers")] - public bool? ForbidNonEmptyContainers { get; set; } + public bool? ForbidNonEmptyContainers + { + get; + set; + } [JsonPropertyName("CompactHandling")] - public bool? CompactHandling { get; set; } + public bool? CompactHandling + { + get; + set; + } [JsonPropertyName("MinRepairDegradation")] - public double? MinRepairDegradation { get; set; } + public double? MinRepairDegradation + { + get; + set; + } [JsonPropertyName("MaxRepairDegradation")] - public double? MaxRepairDegradation { get; set; } + public double? MaxRepairDegradation + { + get; + set; + } [JsonPropertyName("IronSightRange")] - public double? IronSightRange { get; set; } + public double? IronSightRange + { + get; + set; + } [JsonPropertyName("IsBeltMachineGun")] - public bool? IsBeltMachineGun { get; set; } + public bool? IsBeltMachineGun + { + get; + set; + } [JsonPropertyName("IsFlareGun")] - public bool? IsFlareGun { get; set; } + public bool? IsFlareGun + { + get; + set; + } [JsonPropertyName("IsGrenadeLauncher")] - public bool? IsGrenadeLauncher { get; set; } + public bool? IsGrenadeLauncher + { + get; + set; + } [JsonPropertyName("IsOneoff")] - public bool? IsOneoff { get; set; } + public bool? IsOneoff + { + get; + set; + } [JsonPropertyName("MustBoltBeOpennedForExternalReload")] - public bool? MustBoltBeOpennedForExternalReload { get; set; } + public bool? MustBoltBeOpennedForExternalReload + { + get; + set; + } [JsonPropertyName("MustBoltBeOpennedForInternalReload")] - public bool? MustBoltBeOpennedForInternalReload { get; set; } + public bool? MustBoltBeOpennedForInternalReload + { + get; + set; + } [JsonPropertyName("NoFiremodeOnBoltcatch")] - public bool? NoFiremodeOnBoltcatch { get; set; } + public bool? NoFiremodeOnBoltcatch + { + get; + set; + } [JsonPropertyName("BoltAction")] - public bool? BoltAction { get; set; } + public bool? BoltAction + { + get; + set; + } [JsonPropertyName("HipAccuracyRestorationDelay")] - public double? HipAccuracyRestorationDelay { get; set; } + public double? HipAccuracyRestorationDelay + { + get; + set; + } [JsonPropertyName("HipAccuracyRestorationSpeed")] - public double? HipAccuracyRestorationSpeed { get; set; } + public double? HipAccuracyRestorationSpeed + { + get; + set; + } [JsonPropertyName("HipInnaccuracyGain")] - public double? HipInnaccuracyGain { get; set; } + public double? HipInnaccuracyGain + { + get; + set; + } [JsonPropertyName("ManualBoltCatch")] - public bool? ManualBoltCatch { get; set; } + public bool? ManualBoltCatch + { + get; + set; + } [JsonPropertyName("BurstShotsCount")] - public double? BurstShotsCount { get; set; } + public double? BurstShotsCount + { + get; + set; + } [JsonPropertyName("BaseMalfunctionChance")] - public double? BaseMalfunctionChance { get; set; } + public double? BaseMalfunctionChance + { + get; + set; + } [JsonPropertyName("AllowJam")] - public bool? AllowJam { get; set; } + public bool? AllowJam + { + get; + set; + } [JsonPropertyName("AllowFeed")] - public bool? AllowFeed { get; set; } + public bool? AllowFeed + { + get; + set; + } [JsonPropertyName("AllowMisfire")] - public bool? AllowMisfire { get; set; } + public bool? AllowMisfire + { + get; + set; + } [JsonPropertyName("AllowSlide")] - public bool? AllowSlide { get; set; } + public bool? AllowSlide + { + get; + set; + } [JsonPropertyName("DurabilityBurnRatio")] - public double? DurabilityBurnRatio { get; set; } + public double? DurabilityBurnRatio + { + get; + set; + } [JsonPropertyName("HeatFactorGun")] - public double? HeatFactorGun { get; set; } + public double? HeatFactorGun + { + get; + set; + } [JsonPropertyName("CoolFactorGun")] - public double? CoolFactorGun { get; set; } + public double? CoolFactorGun + { + get; + set; + } [JsonPropertyName("CoolFactorGunMods")] - public double? CoolFactorGunMods { get; set; } + public double? CoolFactorGunMods + { + get; + set; + } [JsonPropertyName("HeatFactorByShot")] - public double? HeatFactorByShot { get; set; } + public double? HeatFactorByShot + { + get; + set; + } [JsonPropertyName("AllowOverheat")] - public bool? AllowOverheat { get; set; } + public bool? AllowOverheat + { + get; + set; + } [JsonPropertyName("DoubleActionAccuracyPenalty")] - public double? DoubleActionAccuracyPenalty { get; set; } + public double? DoubleActionAccuracyPenalty + { + get; + set; + } [JsonPropertyName("RecoilPosZMult")] - public double? RecoilPosZMult { get; set; } + public double? RecoilPosZMult + { + get; + set; + } [JsonPropertyName("RecoilReturnPathDampingHandRotation")] - public double? RecoilReturnPathDampingHandRotation { get; set; } + public double? RecoilReturnPathDampingHandRotation + { + get; + set; + } [JsonPropertyName("RecoilReturnPathOffsetHandRotation")] - public double? RecoilReturnPathOffsetHandRotation { get; set; } + public double? RecoilReturnPathOffsetHandRotation + { + get; + set; + } [JsonPropertyName("RecoilReturnSpeedHandRotation")] - public double? RecoilReturnSpeedHandRotation { get; set; } + public double? RecoilReturnSpeedHandRotation + { + get; + set; + } [JsonPropertyName("RecoilStableAngleIncreaseStep")] - public double? RecoilStableAngleIncreaseStep { get; set; } + public double? RecoilStableAngleIncreaseStep + { + get; + set; + } [JsonPropertyName("RecoilStableIndexShot")] - public double? RecoilStableIndexShot { get; set; } + public double? RecoilStableIndexShot + { + get; + set; + } [JsonPropertyName("MinRepairKitDegradation")] - public double? MinRepairKitDegradation { get; set; } + public double? MinRepairKitDegradation + { + get; + set; + } [JsonPropertyName("MaxRepairKitDegradation")] - public double? MaxRepairKitDegradation { get; set; } + public double? MaxRepairKitDegradation + { + get; + set; + } [JsonPropertyName("MountCameraSnapMultiplier")] - public double? MountCameraSnapMultiplier { get; set; } + public double? MountCameraSnapMultiplier + { + get; + set; + } [JsonPropertyName("MountHorizontalRecoilMultiplier")] - public double? MountHorizontalRecoilMultiplier { get; set; } + public double? MountHorizontalRecoilMultiplier + { + get; + set; + } [JsonPropertyName("MountReturnSpeedHandMultiplier")] - public double? MountReturnSpeedHandMultiplier { get; set; } + public double? MountReturnSpeedHandMultiplier + { + get; + set; + } [JsonPropertyName("MountVerticalRecoilMultiplier")] - public double? MountVerticalRecoilMultiplier { get; set; } + public double? MountVerticalRecoilMultiplier + { + get; + set; + } [JsonPropertyName("MountingHorizontalOutOfBreathMultiplier")] - public double? MountingHorizontalOutOfBreathMultiplier { get; set; } + public double? MountingHorizontalOutOfBreathMultiplier + { + get; + set; + } [JsonPropertyName("MountingPosition")] - public XYZ? MountingPosition { get; set; } + public XYZ? MountingPosition + { + get; + set; + } [JsonPropertyName("MountingVerticalOutOfBreathMultiplier")] - public double? MountingVerticalOutOfBreathMultiplier { get; set; } + public double? MountingVerticalOutOfBreathMultiplier + { + get; + set; + } [JsonPropertyName("BlocksEarpiece")] - public bool? BlocksEarpiece { get; set; } + public bool? BlocksEarpiece + { + get; + set; + } [JsonPropertyName("BlocksEyewear")] - public bool? BlocksEyewear { get; set; } + public bool? BlocksEyewear + { + get; + set; + } [JsonPropertyName("BlocksHeadwear")] - public bool? BlocksHeadwear { get; set; } + public bool? BlocksHeadwear + { + get; + set; + } [JsonPropertyName("BlocksFaceCover")] - public bool? BlocksFaceCover { get; set; } + public bool? BlocksFaceCover + { + get; + set; + } [JsonPropertyName("Indestructibility")] - public double? Indestructibility { get; set; } + public double? Indestructibility + { + get; + set; + } [JsonPropertyName("FaceShieldComponent")] - public bool? FaceShieldComponent { get; set; } + public bool? FaceShieldComponent + { + get; + set; + } [JsonPropertyName("FaceShieldMask")] - public string? FaceShieldMask { get; set; } + public string? FaceShieldMask + { + get; + set; + } [JsonPropertyName("MaterialType")] - public string? MaterialType { get; set; } + public string? MaterialType + { + get; + set; + } [JsonPropertyName("RicochetParams")] - public XYZ? RicochetParams { get; set; } + public XYZ? RicochetParams + { + get; + set; + } [JsonPropertyName("DeafStrength")] - public string? DeafStrength { get; set; } + public string? DeafStrength + { + get; + set; + } [JsonPropertyName("BlindnessProtection")] - public double? BlindnessProtection { get; set; } + public double? BlindnessProtection + { + get; + set; + } [JsonPropertyName("Distortion")] - public double? Distortion { get; set; } + public double? Distortion + { + get; + set; + } [JsonPropertyName("CompressorAttack")] - public double? CompressorAttack { get; set; } + public double? CompressorAttack + { + get; + set; + } [JsonPropertyName("CompressorRelease")] - public double? CompressorRelease { get; set; } + public double? CompressorRelease + { + get; + set; + } [JsonPropertyName("CompressorGain")] - public double? CompressorGain { get; set; } + public double? CompressorGain + { + get; + set; + } [JsonPropertyName("EQBand1Frequency")] - public double? EQBand1Frequency { get; set; } + public double? EQBand1Frequency + { + get; + set; + } [JsonPropertyName("EQBand1Gain")] - public double? EQBand1Gain { get; set; } + public double? EQBand1Gain + { + get; + set; + } [JsonPropertyName("EQBand1Q")] - public double? EQBand1Q { get; set; } + public double? EQBand1Q + { + get; + set; + } [JsonPropertyName("EQBand2Frequency")] - public double? EQBand2Frequency { get; set; } + public double? EQBand2Frequency + { + get; + set; + } [JsonPropertyName("EQBand2Gain")] - public double? EQBand2Gain { get; set; } + public double? EQBand2Gain + { + get; + set; + } [JsonPropertyName("EQBand2Q")] - public double? EQBand2Q { get; set; } + public double? EQBand2Q + { + get; + set; + } [JsonPropertyName("EQBand3Frequency")] - public double? EQBand3Frequency { get; set; } + public double? EQBand3Frequency + { + get; + set; + } [JsonPropertyName("EQBand3Gain")] - public double? EQBand3Gain { get; set; } + public double? EQBand3Gain + { + get; + set; + } [JsonPropertyName("EQBand3Q")] - public double? EQBand3Q { get; set; } + public double? EQBand3Q + { + get; + set; + } [JsonPropertyName("EffectsReturnsCompressorSendLevel")] - public double? EffectsReturnsCompressorSendLevel { get; set; } + public double? EffectsReturnsCompressorSendLevel + { + get; + set; + } [JsonPropertyName("EffectsReturnsGroupVolume")] - public double? EffectsReturnsGroupVolume { get; set; } + public double? EffectsReturnsGroupVolume + { + get; + set; + } [JsonPropertyName("EnvCommonCompressorSendLevel")] - public double? EffectsReturnsGrEnvCommonCompressorSendLeveloupVolume { get; set; } + public double? EffectsReturnsGrEnvCommonCompressorSendLeveloupVolume + { + get; + set; + } [JsonPropertyName("EnvNatureCompressorSendLevel")] - public double? EnvNatureCompressorSendLevel { get; set; } + public double? EnvNatureCompressorSendLevel + { + get; + set; + } [JsonPropertyName("EnvTechnicalCompressorSendLevel")] - public double? EnvTechnicalCompressorSendLevel { get; set; } + public double? EnvTechnicalCompressorSendLevel + { + get; + set; + } [JsonPropertyName("GunsCompressorSendLevel")] - public double? GunsCompressorSendLevel { get; set; } + public double? GunsCompressorSendLevel + { + get; + set; + } [JsonPropertyName("HeadphonesMixerVolume")] - public double? HeadphonesMixerVolume { get; set; } + public double? HeadphonesMixerVolume + { + get; + set; + } [JsonPropertyName("HighpassFreq")] - public double? HighpassFreq { get; set; } + public double? HighpassFreq + { + get; + set; + } [JsonPropertyName("HighpassResonance")] - public double? HighpassResonance { get; set; } + public double? HighpassResonance + { + get; + set; + } [JsonPropertyName("LowpassFreq")] - public double? LowpassFreq { get; set; } + public double? LowpassFreq + { + get; + set; + } [JsonPropertyName("RolloffMultiplier")] - public double? RolloffMultiplier { get; set; } + public double? RolloffMultiplier + { + get; + set; + } [JsonPropertyName("AmbientVolume")] - public double? AmbientVolume { get; set; } + public double? AmbientVolume + { + get; + set; + } [JsonPropertyName("AmbientCompressorSendLevel")] - public double? AmbientCompressorSendLevel { get; set; } + public double? AmbientCompressorSendLevel + { + get; + set; + } [JsonPropertyName("ClientPlayerCompressorSendLevel")] - public double? ClientPlayerCompressorSendLevel { get; set; } + public double? ClientPlayerCompressorSendLevel + { + get; + set; + } [JsonPropertyName("CompressorThreshold")] - public double? CompressorThreshold { get; set; } + public double? CompressorThreshold + { + get; + set; + } [JsonPropertyName("DryVolume")] - public double? DryVolume { get; set; } + public double? DryVolume + { + get; + set; + } [JsonPropertyName("foodUseTime")] - public double? FoodUseTime { get; set; } + public double? FoodUseTime + { + get; + set; + } [JsonPropertyName("foodEffectType")] - public string? FoodEffectType { get; set; } + public string? FoodEffectType + { + get; + set; + } [JsonPropertyName("StimulatorBuffs")] - public string? StimulatorBuffs { get; set; } + public string? StimulatorBuffs + { + get; + set; + } [JsonPropertyName("effects_health")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public Dictionary? EffectsHealth { get; set; } + public Dictionary? EffectsHealth + { + get; + set; + } [JsonPropertyName("effects_damage")] [JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public Dictionary? EffectsDamage { get; set; } + public Dictionary? EffectsDamage + { + get; + set; + } // Confirmed in client [JsonPropertyName("MaximumNumberOfUsage")] - public int? MaximumNumberOfUsage { get; set; } + public int? MaximumNumberOfUsage + { + get; + set; + } [JsonPropertyName("knifeHitDelay")] - public double? KnifeHitDelay { get; set; } + public double? KnifeHitDelay + { + get; + set; + } [JsonPropertyName("knifeHitSlashRate")] - public double? KnifeHitSlashRate { get; set; } + public double? KnifeHitSlashRate + { + get; + set; + } [JsonPropertyName("knifeHitStabRate")] - public double? KnifeHitStabRate { get; set; } + public double? KnifeHitStabRate + { + get; + set; + } [JsonPropertyName("knifeHitRadius")] - public double? KnifeHitRadius { get; set; } + public double? KnifeHitRadius + { + get; + set; + } // Confirmed on client [JsonPropertyName("knifeHitSlashDam")] - public int? KnifeHitSlashDam { get; set; } + public int? KnifeHitSlashDam + { + get; + set; + } // Confirmed on client [JsonPropertyName("knifeHitStabDam")] - public int? KnifeHitStabDam { get; set; } + public int? KnifeHitStabDam + { + get; + set; + } [JsonPropertyName("knifeDurab")] - public double? KnifeDurab { get; set; } + public double? KnifeDurab + { + get; + set; + } [JsonPropertyName("PrimaryDistance")] - public double? PrimaryDistance { get; set; } + public double? PrimaryDistance + { + get; + set; + } [JsonPropertyName("SecondryDistance")] - public double? SecondryDistance { get; set; } + public double? SecondryDistance + { + get; + set; + } // Confirmed on client [JsonPropertyName("SlashPenetration")] - public int? SlashPenetration { get; set; } + public int? SlashPenetration + { + get; + set; + } // Confirmed on client [JsonPropertyName("StabPenetration")] - public int? StabPenetration { get; set; } + public int? StabPenetration + { + get; + set; + } [JsonPropertyName("PrimaryConsumption")] - public double? PrimaryConsumption { get; set; } + public double? PrimaryConsumption + { + get; + set; + } [JsonPropertyName("SecondryConsumption")] - public double? SecondryConsumption { get; set; } + public double? SecondryConsumption + { + get; + set; + } [JsonPropertyName("DeflectionConsumption")] - public double? DeflectionConsumption { get; set; } + public double? DeflectionConsumption + { + get; + set; + } [JsonPropertyName("AppliedTrunkRotation")] - public XYZ? AppliedTrunkRotation { get; set; } + public XYZ? AppliedTrunkRotation + { + get; + set; + } [JsonPropertyName("AppliedHeadRotation")] - public XYZ? AppliedHeadRotation { get; set; } + public XYZ? AppliedHeadRotation + { + get; + set; + } [JsonPropertyName("DisplayOnModel")] - public bool? DisplayOnModel { get; set; } + public bool? DisplayOnModel + { + get; + set; + } [JsonPropertyName("AdditionalAnimationLayer")] - public int? AdditionalAnimationLayer { get; set; } + public int? AdditionalAnimationLayer + { + get; + set; + } [JsonPropertyName("StaminaBurnRate")] - public double? StaminaBurnRate { get; set; } + public double? StaminaBurnRate + { + get; + set; + } [JsonPropertyName("ColliderScaleMultiplier")] - public XYZ? ColliderScaleMultiplier { get; set; } + public XYZ? ColliderScaleMultiplier + { + get; + set; + } [JsonPropertyName("ConfigPathStr")] - public string? ConfigPathStr { get; set; } + public string? ConfigPathStr + { + get; + set; + } // Confirmed on client [JsonPropertyName("MaxMarkersCount")] - public int? MaxMarkersCount { get; set; } + public int? MaxMarkersCount + { + get; + set; + } [JsonPropertyName("scaleMin")] - public double? ScaleMin { get; set; } + public double? ScaleMin + { + get; + set; + } [JsonPropertyName("scaleMax")] - public double? ScaleMax { get; set; } + public double? ScaleMax + { + get; + set; + } [JsonPropertyName("medUseTime")] - public double? MedUseTime { get; set; } + public double? MedUseTime + { + get; + set; + } [JsonPropertyName("medEffectType")] - public string? MedEffectType { get; set; } + public string? MedEffectType + { + get; + set; + } // Confirmed in client [JsonPropertyName("MaxHpResource")] - public int? MaxHpResource { get; set; } + public int? MaxHpResource + { + get; + set; + } [JsonPropertyName("hpResourceRate")] - public double? HpResourceRate { get; set; } + public double? HpResourceRate + { + get; + set; + } [JsonPropertyName("apResource")] - public double? ApResource { get; set; } + public double? ApResource + { + get; + set; + } [JsonPropertyName("krResource")] - public double? KrResource { get; set; } + public double? KrResource + { + get; + set; + } [JsonPropertyName("MaxOpticZoom")] - public double? MaxOpticZoom { get; set; } + public double? MaxOpticZoom + { + get; + set; + } // Confirmed in client [JsonPropertyName("MaxRepairResource")] - public int? MaxRepairResource { get; set; } + public int? MaxRepairResource + { + get; + set; + } // Confirmed on client - MongoId [JsonPropertyName("TargetItemFilter")] - public List? TargetItemFilter { get; set; } + public List? TargetItemFilter + { + get; + set; + } [JsonPropertyName("RepairQuality")] - public double? RepairQuality { get; set; } + public double? RepairQuality + { + get; + set; + } [JsonPropertyName("RepairType")] - public string? RepairType { get; set; } + public string? RepairType + { + get; + set; + } [JsonPropertyName("StackMinRandom")] - public int? StackMinRandom { get; set; } + public int? StackMinRandom + { + get; + set; + } [JsonPropertyName("StackMaxRandom")] - public int? StackMaxRandom { get; set; } + public int? StackMaxRandom + { + get; + set; + } [JsonPropertyName("ammoType")] - public string? AmmoType { get; set; } + public string? AmmoType + { + get; + set; + } [JsonPropertyName("InitialSpeed")] - public double? InitialSpeed { get; set; } + public double? InitialSpeed + { + get; + set; + } [JsonPropertyName("BulletMassGram")] - public double? BulletMassGram { get; set; } + public double? BulletMassGram + { + get; + set; + } [JsonPropertyName("BulletDiameterMillimeters")] - public double? BulletDiameterMillimeters { get; set; } + public double? BulletDiameterMillimeters + { + get; + set; + } [JsonPropertyName("Damage")] - public double? Damage { get; set; } + public double? Damage + { + get; + set; + } [JsonPropertyName("ammoAccr")] - public double? AmmoAccr { get; set; } + public double? AmmoAccr + { + get; + set; + } [JsonPropertyName("ammoRec")] - public double? AmmoRec { get; set; } + public double? AmmoRec + { + get; + set; + } [JsonPropertyName("ammoDist")] - public double? AmmoDist { get; set; } + public double? AmmoDist + { + get; + set; + } [JsonPropertyName("buckshotBullets")] - public double? BuckshotBullets { get; set; } + public double? BuckshotBullets + { + get; + set; + } // Confirmed in client [JsonPropertyName("PenetrationPower")] - public int? PenetrationPower { get; set; } + public int? PenetrationPower + { + get; + set; + } [JsonPropertyName("PenetrationPowerDeviation")] - public double? PenetrationPowerDeviation { get; set; } + public double? PenetrationPowerDeviation + { + get; + set; + } [JsonPropertyName("ammoHear")] - public double? AmmoHear { get; set; } + public double? AmmoHear + { + get; + set; + } [JsonPropertyName("ammoSfx")] - public string? AmmoSfx { get; set; } + public string? AmmoSfx + { + get; + set; + } [JsonPropertyName("MisfireChance")] - public double? MisfireChance { get; set; } + public double? MisfireChance + { + get; + set; + } // Confirmed in client [JsonPropertyName("MinFragmentsCount")] - public int? MinFragmentsCount { get; set; } + public int? MinFragmentsCount + { + get; + set; + } // Confirmed in client [JsonPropertyName("MaxFragmentsCount")] - public int? MaxFragmentsCount { get; set; } + public int? MaxFragmentsCount + { + get; + set; + } [JsonPropertyName("ammoShiftChance")] - public double? AmmoShiftChance { get; set; } + public double? AmmoShiftChance + { + get; + set; + } [JsonPropertyName("casingName")] - public string? CasingName { get; set; } + public string? CasingName + { + get; + set; + } [JsonPropertyName("casingEjectPower")] - public double? CasingEjectPower { get; set; } + public double? CasingEjectPower + { + get; + set; + } [JsonPropertyName("casingMass")] - public double? CasingMass { get; set; } + public double? CasingMass + { + get; + set; + } [JsonPropertyName("casingSounds")] - public string? CasingSounds { get; set; } + public string? CasingSounds + { + get; + set; + } [JsonPropertyName("ProjectileCount")] - public double? ProjectileCount { get; set; } + public double? ProjectileCount + { + get; + set; + } [JsonPropertyName("PenetrationChanceObstacle")] - public double? PenetrationChanceObstacle { get; set; } + public double? PenetrationChanceObstacle + { + get; + set; + } [JsonPropertyName("PenetrationDamageMod")] - public double? PenetrationDamageMod { get; set; } + public double? PenetrationDamageMod + { + get; + set; + } [JsonPropertyName("RicochetChance")] - public double? RicochetChance { get; set; } + public double? RicochetChance + { + get; + set; + } [JsonPropertyName("FragmentationChance")] - public double? FragmentationChance { get; set; } + public double? FragmentationChance + { + get; + set; + } [JsonPropertyName("Deterioration")] - public double? Deterioration { get; set; } + public double? Deterioration + { + get; + set; + } [JsonPropertyName("SpeedRetardation")] - public double? SpeedRetardation { get; set; } + public double? SpeedRetardation + { + get; + set; + } [JsonPropertyName("Tracer")] - public bool? Tracer { get; set; } + public bool? Tracer + { + get; + set; + } [JsonPropertyName("TracerColor")] - public string? TracerColor { get; set; } + public string? TracerColor + { + get; + set; + } [JsonPropertyName("TracerDistance")] - public double? TracerDistance { get; set; } + public double? TracerDistance + { + get; + set; + } [JsonPropertyName("ArmorDamage")] - public double? ArmorDamage { get; set; } + public double? ArmorDamage + { + get; + set; + } [JsonPropertyName("Caliber")] - public string? Caliber { get; set; } + public string? Caliber + { + get; + set; + } [JsonPropertyName("StaminaBurnPerDamage")] - public double? StaminaBurnPerDamage { get; set; } + public double? StaminaBurnPerDamage + { + get; + set; + } [JsonPropertyName("HeavyBleedingDelta")] - public double? HeavyBleedingDelta { get; set; } + public double? HeavyBleedingDelta + { + get; + set; + } [JsonPropertyName("LightBleedingDelta")] - public double? LightBleedingDelta { get; set; } + public double? LightBleedingDelta + { + get; + set; + } [JsonPropertyName("ShowBullet")] - public bool? ShowBullet { get; set; } + public bool? ShowBullet + { + get; + set; + } [JsonPropertyName("HasGrenaderComponent")] - public bool? HasGrenaderComponent { get; set; } + public bool? HasGrenaderComponent + { + get; + set; + } [JsonPropertyName("FuzeArmTimeSec")] - public double? FuzeArmTimeSec { get; set; } + public double? FuzeArmTimeSec + { + get; + set; + } [JsonPropertyName("ExplosionStrength")] - public double? ExplosionStrength { get; set; } + public double? ExplosionStrength + { + get; + set; + } [JsonPropertyName("MinExplosionDistance")] - public double? MinExplosionDistance { get; set; } + public double? MinExplosionDistance + { + get; + set; + } [JsonPropertyName("PenetrationPowerDiviation")] - public double? MinExplosiPenetrationPowerDiviationonDistance { get; set; } + public double? MinExplosiPenetrationPowerDiviationonDistance + { + get; + set; + } [JsonPropertyName("MaxExplosionDistance")] - public double? MaxExplosionDistance { get; set; } + public double? MaxExplosionDistance + { + get; + set; + } // Confirmed in client [JsonPropertyName("FragmentsCount")] - public int? FragmentsCount { get; set; } + public int? FragmentsCount + { + get; + set; + } [JsonPropertyName("FragmentType")] - public string? FragmentType { get; set; } + public string? FragmentType + { + get; + set; + } [JsonPropertyName("ShowHitEffectOnExplode")] - public bool? ShowHitEffectOnExplode { get; set; } + public bool? ShowHitEffectOnExplode + { + get; + set; + } [JsonPropertyName("ExplosionType")] - public string? ExplosionType { get; set; } + public string? ExplosionType + { + get; + set; + } [JsonPropertyName("AmmoLifeTimeSec")] - public double? AmmoLifeTimeSec { get; set; } + public double? AmmoLifeTimeSec + { + get; + set; + } [JsonPropertyName("AmmoTooltipClass")] - public string? AmmoTooltipClass { get; set; } + public string? AmmoTooltipClass + { + get; + set; + } [JsonPropertyName("Contusion")] - public XYZ? Contusion { get; set; } + public XYZ? Contusion + { + get; + set; + } [JsonPropertyName("ArmorDistanceDistanceDamage")] - public XYZ? ArmorDistanceDistanceDamage { get; set; } + public XYZ? ArmorDistanceDistanceDamage + { + get; + set; + } [JsonPropertyName("Blindness")] - public XYZ? Blindness { get; set; } + public XYZ? Blindness + { + get; + set; + } [JsonPropertyName("IsLightAndSoundShot")] - public bool? IsLightAndSoundShot { get; set; } + public bool? IsLightAndSoundShot + { + get; + set; + } [JsonPropertyName("LightAndSoundShotAngle")] - public double? LightAndSoundShotAngle { get; set; } + public double? LightAndSoundShotAngle + { + get; + set; + } [JsonPropertyName("LightAndSoundShotSelfContusionTime")] - public double? LightAndSoundShotSelfContusionTime { get; set; } + public double? LightAndSoundShotSelfContusionTime + { + get; + set; + } [JsonPropertyName("LightAndSoundShotSelfContusionStrength")] - public double? LightAndSoundShotSelfContusionStrength { get; set; } + public double? LightAndSoundShotSelfContusionStrength + { + get; + set; + } [JsonPropertyName("MalfMisfireChance")] - public double? MalfMisfireChance { get; set; } + public double? MalfMisfireChance + { + get; + set; + } [JsonPropertyName("MalfFeedChance")] - public double? MalfFeedChance { get; set; } + public double? MalfFeedChance + { + get; + set; + } [JsonPropertyName("StackSlots")] - public List? StackSlots { get; set; } + public List? StackSlots + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("eqMin")] - public double? EqMin { get; set; } + public double? EqMin + { + get; + set; + } [JsonPropertyName("eqMax")] - public double? EqMax { get; set; } + public double? EqMax + { + get; + set; + } [JsonPropertyName("rate")] - public double? Rate { get; set; } + public double? Rate + { + get; + set; + } [JsonPropertyName("ThrowType")] - public ThrowWeapType? ThrowType { get; set; } + public ThrowWeapType? ThrowType + { + get; + set; + } [JsonPropertyName("ExplDelay")] - public double? ExplDelay { get; set; } + public double? ExplDelay + { + get; + set; + } [JsonPropertyName("explDelay")] - public double? explDelay { get; set; } + public double? explDelay + { + get; + set; + } [JsonPropertyName("Strength")] - public double? Strength { get; set; } + public double? Strength + { + get; + set; + } [JsonPropertyName("ContusionDistance")] - public double? ContusionDistance { get; set; } + public double? ContusionDistance + { + get; + set; + } [JsonPropertyName("throwDamMax")] - public double? ThrowDamMax { get; set; } + public double? ThrowDamMax + { + get; + set; + } [JsonPropertyName("EmitTime")] - public double? EmitTime { get; set; } + public double? EmitTime + { + get; + set; + } [JsonPropertyName("CanBeHiddenDuringThrow")] - public bool? CanBeHiddenDuringThrow { get; set; } + public bool? CanBeHiddenDuringThrow + { + get; + set; + } [JsonPropertyName("CanPlantOnGround")] - public bool? CanPlantOnGround { get; set; } + public bool? CanPlantOnGround + { + get; + set; + } [JsonPropertyName("MinTimeToContactExplode")] - public double? MinTimeToContactExplode { get; set; } + public double? MinTimeToContactExplode + { + get; + set; + } [JsonPropertyName("ExplosionEffectType")] - public string? ExplosionEffectType { get; set; } + public string? ExplosionEffectType + { + get; + set; + } [JsonPropertyName("LinkedWeapon")] - public string? LinkedWeapon { get; set; } + public string? LinkedWeapon + { + get; + set; + } [JsonPropertyName("UseAmmoWithoutShell")] - public bool? UseAmmoWithoutShell { get; set; } + public bool? UseAmmoWithoutShell + { + get; + set; + } [JsonPropertyName("RecoilDampingHandRotation")] - public double? RecoilDampingHandRotation { get; set; } + public double? RecoilDampingHandRotation + { + get; + set; + } [JsonPropertyName("LeanWeaponAgainstBody")] - public bool? LeanWeaponAgainstBody { get; set; } + public bool? LeanWeaponAgainstBody + { + get; + set; + } [JsonPropertyName("RemoveShellAfterFire")] - public bool? RemoveShellAfterFire { get; set; } + public bool? RemoveShellAfterFire + { + get; + set; + } [JsonPropertyName("RepairStrategyTypes")] - public List? RepairStrategyTypes { get; set; } + public List? RepairStrategyTypes + { + get; + set; + } [JsonPropertyName("IsEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } [JsonPropertyName("LayoutName")] - public string? LayoutName { get; set; } + public string? LayoutName + { + get; + set; + } [JsonPropertyName("Lower75Prefab")] - public Prefab? Lower75Prefab { get; set; } + public Prefab? Lower75Prefab + { + get; + set; + } [JsonPropertyName("MaxUsages")] - public double? MaxUsages { get; set; } + public double? MaxUsages + { + get; + set; + } [JsonPropertyName("BallisticCoeficient")] - public double? BallisticCoeficient { get; set; } + public double? BallisticCoeficient + { + get; + set; + } [JsonPropertyName("BulletDiameterMilimeters")] - public double? BulletDiameterMilimeters { get; set; } + public double? BulletDiameterMilimeters + { + get; + set; + } [JsonPropertyName("ScavKillExpPenalty")] - public double? ScavKillExpPenalty { get; set; } + public double? ScavKillExpPenalty + { + get; + set; + } [JsonPropertyName("ScavKillExpPenaltyPVE")] - public double? ScavKillExpPenaltyPVE { get; set; } + public double? ScavKillExpPenaltyPVE + { + get; + set; + } [JsonPropertyName("ScavKillStandingPenalty")] - public double? ScavKillStandingPenalty { get; set; } + public double? ScavKillStandingPenalty + { + get; + set; + } [JsonPropertyName("ScavKillStandingPenaltyPVE")] - public double? ScavKillStandingPenaltyPVE { get; set; } + public double? ScavKillStandingPenaltyPVE + { + get; + set; + } [JsonPropertyName("TradersDiscount")] - public double? TradersDiscount { get; set; } + public double? TradersDiscount + { + get; + set; + } [JsonPropertyName("TradersDiscountPVE")] - public double? TradersDiscountPVE { get; set; } + public double? TradersDiscountPVE + { + get; + set; + } [JsonPropertyName("AvailableAsDefault")] - public bool? AvailableAsDefault { get; set; } + public bool? AvailableAsDefault + { + get; + set; + } [JsonPropertyName("ProfileVersions")] - public List? ProfileVersions { get; set; } + public List? ProfileVersions + { + get; + set; + } [JsonPropertyName("Side")] - public List? Side { get; set; } + public List? Side + { + get; + set; + } [JsonPropertyName("BipodCameraSnapMultiplier")] - public double? BipodCameraSnapMultiplier { get; set; } + public double? BipodCameraSnapMultiplier + { + get; + set; + } [JsonPropertyName("BipodOutOfStaminaBreathMultiplier")] - public double? BipodOutOfStaminaBreathMultiplier { get; set; } + public double? BipodOutOfStaminaBreathMultiplier + { + get; + set; + } [JsonPropertyName("BipodRecoilMultiplier")] - public double? BipodRecoilMultiplier { get; set; } + public double? BipodRecoilMultiplier + { + get; + set; + } [JsonPropertyName("BipodReturnHandSpeedMultiplier")] - public double? BipodReturnHandSpeedMultiplier { get; set; } + public double? BipodReturnHandSpeedMultiplier + { + get; + set; + } [JsonPropertyName("PitchLimitProneBipod")] - public XYZ? PitchLimitProneBipod { get; set; } + public XYZ? PitchLimitProneBipod + { + get; + set; + } [JsonPropertyName("YawLimitProneBipod")] - public XYZ? YawLimitProneBipod { get; set; } + public XYZ? YawLimitProneBipod + { + get; + set; + } [JsonPropertyName("AdjustableOpticSensitivity")] - public double? AdjustableOpticSensitivity { get; set; } + public double? AdjustableOpticSensitivity + { + get; + set; + } [JsonPropertyName("AdjustableOpticSensitivityMax")] - public double? AdjustableOpticSensitivityMax { get; set; } + public double? AdjustableOpticSensitivityMax + { + get; + set; + } //[JsonExtensionData] //public Dictionary OtherProperties { get; set; } @@ -1479,380 +3360,786 @@ public record Props public record WeaponRecoilSettings { [JsonPropertyName("Enable")] - public bool? Enable { get; set; } + public bool? Enable + { + get; + set; + } [JsonPropertyName("Values")] - public List? Values { get; set; } + public List? Values + { + get; + set; + } } public record WeaponRecoilSettingValues { [JsonPropertyName("Enable")] - public bool? Enable { get; set; } + public bool? Enable + { + get; + set; + } [JsonPropertyName("Process")] - public WeaponRecoilProcess? Process { get; set; } + public WeaponRecoilProcess? Process + { + get; + set; + } [JsonPropertyName("Target")] - public string? Target { get; set; } + public string? Target + { + get; + set; + } } public record WeaponRecoilProcess { [JsonPropertyName("ComponentType")] - public string? ComponentType { get; set; } + public string? ComponentType + { + get; + set; + } [JsonPropertyName("CurveAimingValueMultiply")] - public double? CurveAimingValueMultiply { get; set; } + public double? CurveAimingValueMultiply + { + get; + set; + } [JsonPropertyName("CurveTimeMultiply")] - public double? CurveTimeMultiply { get; set; } + public double? CurveTimeMultiply + { + get; + set; + } [JsonPropertyName("CurveValueMultiply")] - public double? CurveValueMultiply { get; set; } + public double? CurveValueMultiply + { + get; + set; + } [JsonPropertyName("TransformationCurve")] - public WeaponRecoilTransformationCurve? TransformationCurve { get; set; } + public WeaponRecoilTransformationCurve? TransformationCurve + { + get; + set; + } } public record WeaponRecoilTransformationCurve { [JsonPropertyName("Keys")] - public List? Keys { get; set; } + public List? Keys + { + get; + set; + } } public record WeaponRecoilTransformationCurveKey { [JsonPropertyName("inTangent")] - public double? InTangent { get; set; } + public double? InTangent + { + get; + set; + } [JsonPropertyName("outTangent")] - public double? OutTangent { get; set; } + public double? OutTangent + { + get; + set; + } [JsonPropertyName("time")] - public double? Time { get; set; } + public double? Time + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record HealthEffect { [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } } public record Prefab { [JsonPropertyName("path")] - public string? Path { get; set; } + public string? Path + { + get; + set; + } [JsonPropertyName("rcid")] - public string? Rcid { get; set; } + public string? Rcid + { + get; + set; + } } public record Grid { [JsonPropertyName("_name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get; + set; + } [JsonPropertyName("_props")] - public GridProps? Props { get; set; } + public GridProps? Props + { + get; + set; + } [JsonPropertyName("_proto")] - public string? Proto { get; set; } + public string? Proto + { + get; + set; + } } public record GridProps { [JsonPropertyName("filters")] - public List? Filters { get; set; } + public List? Filters + { + get; + set; + } [JsonPropertyName("cellsH")] - public int? CellsH { get; set; } + public int? CellsH + { + get; + set; + } [JsonPropertyName("cellsV")] - public int? CellsV { get; set; } + public int? CellsV + { + get; + set; + } [JsonPropertyName("minCount")] - public double? MinCount { get; set; } + public double? MinCount + { + get; + set; + } [JsonPropertyName("maxCount")] - public double? MaxCount { get; set; } + public double? MaxCount + { + get; + set; + } [JsonPropertyName("maxWeight")] - public double? MaxWeight { get; set; } + public double? MaxWeight + { + get; + set; + } [JsonPropertyName("isSortingTable")] - public bool? IsSortingTable { get; set; } + public bool? IsSortingTable + { + get; + set; + } } public record GridFilter { [JsonPropertyName("Filter")] - public List? Filter { get; set; } + public List? Filter + { + get; + set; + } [JsonPropertyName("ExcludedFilter")] - public List? ExcludedFilter { get; set; } + public List? ExcludedFilter + { + get; + set; + } [JsonPropertyName("locked")] - public bool? Locked { get; set; } + public bool? Locked + { + get; + set; + } } public record Slot { private string? _name; + + private string? _proto; + [JsonPropertyName("_name")] public string? Name { - get => _name; - set => _name = value == null ? null : string.Intern(value); + get + { + return _name; + } + set + { + _name = value == null ? null : string.Intern(value); + } } [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get; + set; + } [JsonPropertyName("_props")] - public SlotProps? Props { get; set; } + public SlotProps? Props + { + get; + set; + } [JsonPropertyName("_max_count")] - public double? MaxCount { get; set; } + public double? MaxCount + { + get; + set; + } [JsonPropertyName("_required")] - public bool? Required { get; set; } + public bool? Required + { + get; + set; + } [JsonPropertyName("_mergeSlotWithChildren")] - public bool? MergeSlotWithChildren { get; set; } + public bool? MergeSlotWithChildren + { + get; + set; + } - private string? _proto; [JsonPropertyName("_proto")] public string? Proto { - get => _proto; - set => _proto = value == null ? null : string.Intern(value); + get + { + return _proto; + } + set + { + _proto = value == null ? null : string.Intern(value); + } } } public record SlotProps { [JsonPropertyName("filters")] - public List? Filters { get; set; } + public List? Filters + { + get; + set; + } [JsonPropertyName("MaxStackCount")] - public double? MaxStackCount { get; set; } + public double? MaxStackCount + { + get; + set; + } } public record SlotFilter { [JsonPropertyName("Shift")] - public double? Shift { get; set; } + public double? Shift + { + get; + set; + } [JsonPropertyName("locked")] - public bool? Locked { get; set; } + public bool? Locked + { + get; + set; + } [JsonPropertyName("Plate")] - public string? Plate { get; set; } + public string? Plate + { + get; + set; + } [JsonPropertyName("armorColliders")] - public List? ArmorColliders { get; set; } + public List? ArmorColliders + { + get; + set; + } [JsonPropertyName("armorPlateColliders")] - public List? ArmorPlateColliders { get; set; } + public List? ArmorPlateColliders + { + get; + set; + } [JsonPropertyName("Filter")] - public List? Filter { get; set; } + public List? Filter + { + get; + set; + } [JsonPropertyName("AnimationIndex")] - public double? AnimationIndex { get; set; } + public double? AnimationIndex + { + get; + set; + } [JsonPropertyName("MaxStackCount")] - public double? MaxStackCount { get; set; } + public double? MaxStackCount + { + get; + set; + } [JsonPropertyName("bluntDamageReduceFromSoftArmor")] - public bool? BluntDamageReduceFromSoftArmor { get; set; } + public bool? BluntDamageReduceFromSoftArmor + { + get; + set; + } } public record StackSlot { [JsonPropertyName("_name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get; + set; + } [JsonPropertyName("_max_count")] - public double? MaxCount { get; set; } + public double? MaxCount + { + get; + set; + } [JsonPropertyName("_props")] - public StackSlotProps? Props { get; set; } + public StackSlotProps? Props + { + get; + set; + } [JsonPropertyName("_proto")] - public string? Proto { get; set; } + public string? Proto + { + get; + set; + } [JsonPropertyName("upd")] - public object? Upd { get; set; } // TODO: object here + public object? Upd + { + get; + set; + } // TODO: object here } public record StackSlotProps { [JsonPropertyName("filters")] - public List? Filters { get; set; } + public List? Filters + { + get; + set; + } } public record RandomLootSettings { [JsonPropertyName("allowToSpawnIdenticalItems")] - public bool? AllowToSpawnIdenticalItems { get; set; } + public bool? AllowToSpawnIdenticalItems + { + get; + set; + } [JsonPropertyName("allowToSpawnQuestItems")] - public bool? AllowToSpawnQuestItems { get; set; } + public bool? AllowToSpawnQuestItems + { + get; + set; + } [JsonPropertyName("countByRarity")] - public List? CountByRarity { get; set; } // TODO: object here + public List? CountByRarity + { + get; + set; + } // TODO: object here [JsonPropertyName("excluded")] - public RandomLootExcluded? Excluded { get; set; } + public RandomLootExcluded? Excluded + { + get; + set; + } [JsonPropertyName("filters")] - public List? Filters { get; set; } // TODO: object here + public List? Filters + { + get; + set; + } // TODO: object here [JsonPropertyName("findInRaid")] - public bool? FindInRaid { get; set; } + public bool? FindInRaid + { + get; + set; + } [JsonPropertyName("maxCount")] - public double? MaxCount { get; set; } + public double? MaxCount + { + get; + set; + } [JsonPropertyName("minCount")] - public double? MinCount { get; set; } + public double? MinCount + { + get; + set; + } } public record RandomLootExcluded { [JsonPropertyName("categoryTemplates")] - public List? CategoryTemplates { get; set; } // TODO: object here + public List? CategoryTemplates + { + get; + set; + } // TODO: object here [JsonPropertyName("rarity")] - public List? Rarity { get; set; } + public List? Rarity + { + get; + set; + } [JsonPropertyName("templates")] - public List? Templates { get; set; } // TODO: object here + public List? Templates + { + get; + set; + } // TODO: object here } public record EffectsHealth { [JsonPropertyName("Energy")] - public EffectsHealthProps? Energy { get; set; } + public EffectsHealthProps? Energy + { + get; + set; + } [JsonPropertyName("Hydration")] - public EffectsHealthProps? Hydration { get; set; } + public EffectsHealthProps? Hydration + { + get; + set; + } } public record EffectsHealthProps { [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("delay")] - public double? Delay { get; set; } + public double? Delay + { + get; + set; + } [JsonPropertyName("duration")] - public double? Duration { get; set; } + public double? Duration + { + get; + set; + } } public record EffectsDamage { [JsonPropertyName("Pain")] - public EffectDamageProps? Pain { get; set; } + public EffectDamageProps? Pain + { + get; + set; + } [JsonPropertyName("LightBleeding")] - public EffectDamageProps? LightBleeding { get; set; } + public EffectDamageProps? LightBleeding + { + get; + set; + } [JsonPropertyName("HeavyBleeding")] - public EffectDamageProps? HeavyBleeding { get; set; } + public EffectDamageProps? HeavyBleeding + { + get; + set; + } [JsonPropertyName("Contusion")] - public EffectDamageProps? Contusion { get; set; } + public EffectDamageProps? Contusion + { + get; + set; + } [JsonPropertyName("RadExposure")] - public EffectDamageProps? RadExposure { get; set; } + public EffectDamageProps? RadExposure + { + get; + set; + } [JsonPropertyName("Fracture")] - public EffectDamageProps? Fracture { get; set; } + public EffectDamageProps? Fracture + { + get; + set; + } [JsonPropertyName("DestroyedPart")] - public EffectDamageProps? DestroyedPart { get; set; } + public EffectDamageProps? DestroyedPart + { + get; + set; + } } public record EffectDamageProps { [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("delay")] - public double? Delay { get; set; } + public double? Delay + { + get; + set; + } [JsonPropertyName("duration")] - public double? Duration { get; set; } + public double? Duration + { + get; + set; + } [JsonPropertyName("fadeOut")] - public double? FadeOut { get; set; } + public double? FadeOut + { + get; + set; + } [JsonPropertyName("cost")] - public double? Cost { get; set; } + public double? Cost + { + get; + set; + } [JsonPropertyName("healthPenaltyMin")] - public double? HealthPenaltyMin { get; set; } + public double? HealthPenaltyMin + { + get; + set; + } [JsonPropertyName("healthPenaltyMax")] - public double? HealthPenaltyMax { get; set; } + public double? HealthPenaltyMax + { + get; + set; + } } public record Color { [JsonPropertyName("r")] - public double? R { get; set; } + public double? R + { + get; + set; + } [JsonPropertyName("g")] - public double? G { get; set; } + public double? G + { + get; + set; + } [JsonPropertyName("b")] - public double? B { get; set; } + public double? B + { + get; + set; + } [JsonPropertyName("a")] - public double? A { get; set; } + public double? A + { + get; + set; + } } public record ShotsGroupSettings { [JsonPropertyName("EndShotIndex")] - public double? EndShotIndex { get; set; } + public double? EndShotIndex + { + get; + set; + } [JsonPropertyName("ShotRecoilPositionStrength")] - public XYZ? ShotRecoilPositionStrength { get; set; } + public XYZ? ShotRecoilPositionStrength + { + get; + set; + } [JsonPropertyName("ShotRecoilRadianRange")] - public XYZ? ShotRecoilRadianRange { get; set; } + public XYZ? ShotRecoilRadianRange + { + get; + set; + } [JsonPropertyName("ShotRecoilRotationStrength")] - public XYZ? ShotRecoilRotationStrength { get; set; } + public XYZ? ShotRecoilRotationStrength + { + get; + set; + } [JsonPropertyName("StartShotIndex")] - public double? StartShotIndex { get; set; } + public double? StartShotIndex + { + get; + set; + } } public enum ItemType diff --git a/Libraries/Core/Models/Eft/Common/Tables/Trader.cs b/Libraries/Core/Models/Eft/Common/Tables/Trader.cs index fe0a8091..00a84b69 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Trader.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Trader.cs @@ -8,314 +8,674 @@ namespace Core.Models.Eft.Common.Tables; public record Trader { [JsonPropertyName("assort")] - public TraderAssort? Assort { get; set; } + public TraderAssort? Assort + { + get; + set; + } [JsonPropertyName("base")] - public TraderBase? Base { get; set; } + public TraderBase? Base + { + get; + set; + } [JsonPropertyName("dialogue")] - public Dictionary?>? Dialogue { get; set; } + public Dictionary?>? Dialogue + { + get; + set; + } [JsonPropertyName("questassort")] - public Dictionary>? QuestAssort { get; set; } + public Dictionary>? QuestAssort + { + get; + set; + } [JsonPropertyName("suits")] - public List? Suits { get; set; } + public List? Suits + { + get; + set; + } [JsonPropertyName("services")] - public List? Services { get; set; } + public List? Services + { + get; + set; + } } public record TraderBase { [JsonPropertyName("refreshTraderRagfairOffers")] - public bool? RefreshTraderRagfairOffers { get; set; } + public bool? RefreshTraderRagfairOffers + { + get; + set; + } [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("availableInRaid")] - public bool? AvailableInRaid { get; set; } + public bool? AvailableInRaid + { + get; + set; + } [JsonPropertyName("avatar")] - public string? Avatar { get; set; } + public string? Avatar + { + get; + set; + } [JsonPropertyName("balance_dol")] - public decimal? BalanceDollar { get; set; } + public decimal? BalanceDollar + { + get; + set; + } [JsonPropertyName("balance_eur")] - public decimal? BalanceEuro { get; set; } + public decimal? BalanceEuro + { + get; + set; + } [JsonPropertyName("balance_rub")] - public decimal? BalanceRub { get; set; } + public decimal? BalanceRub + { + get; + set; + } [JsonPropertyName("buyer_up")] - public bool? BuyerUp { get; set; } + public bool? BuyerUp + { + get; + set; + } [JsonPropertyName("currency")] - public CurrencyType? Currency { get; set; } + public CurrencyType? Currency + { + get; + set; + } [JsonPropertyName("customization_seller")] - public bool? CustomizationSeller { get; set; } + public bool? CustomizationSeller + { + get; + set; + } [JsonPropertyName("discount")] - public decimal? Discount { get; set; } + public decimal? Discount + { + get; + set; + } [JsonPropertyName("discount_end")] - public decimal? DiscountEnd { get; set; } + public decimal? DiscountEnd + { + get; + set; + } [JsonPropertyName("gridHeight")] - public double? GridHeight { get; set; } + public double? GridHeight + { + get; + set; + } [JsonPropertyName("sell_modifier_for_prohibited_items")] - public int? ProhibitedItemsSellModifier { get; set; } + public int? ProhibitedItemsSellModifier + { + get; + set; + } [JsonPropertyName("insurance")] - public TraderInsurance? Insurance { get; set; } + public TraderInsurance? Insurance + { + get; + set; + } [JsonPropertyName("items_buy")] - public ItemBuyData? ItemsBuy { get; set; } + public ItemBuyData? ItemsBuy + { + get; + set; + } [JsonPropertyName("items_buy_prohibited")] - public ItemBuyData? ItemsBuyProhibited { get; set; } + public ItemBuyData? ItemsBuyProhibited + { + get; + set; + } [JsonPropertyName("isCanTransferItems")] - public bool? IsCanTransferItems { get; set; } + public bool? IsCanTransferItems + { + get; + set; + } [JsonPropertyName("transferableItems")] - public ItemBuyData? TransferableItems { get; set; } + public ItemBuyData? TransferableItems + { + get; + set; + } [JsonPropertyName("prohibitedTransferableItems")] - public ItemBuyData? ProhibitedTransferableItems { get; set; } + public ItemBuyData? ProhibitedTransferableItems + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("loyaltyLevels")] - public List? LoyaltyLevels { get; set; } + public List? LoyaltyLevels + { + get; + set; + } [JsonPropertyName("medic")] - public bool? Medic { get; set; } + public bool? Medic + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } // Confirmed in client [JsonPropertyName("nextResupply")] - public int? NextResupply { get; set; } + public int? NextResupply + { + get; + set; + } [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("repair")] - public TraderRepair? Repair { get; set; } + public TraderRepair? Repair + { + get; + set; + } [JsonPropertyName("sell_category")] - public List? SellCategory { get; set; } + public List? SellCategory + { + get; + set; + } [JsonPropertyName("surname")] - public string? Surname { get; set; } + public string? Surname + { + get; + set; + } [JsonPropertyName("unlockedByDefault")] - public bool? UnlockedByDefault { get; set; } + public bool? UnlockedByDefault + { + get; + set; + } } public record ItemBuyData { // MongoId [JsonPropertyName("category")] - public List? Category { get; set; } + public List? Category + { + get; + set; + } // MongoId [JsonPropertyName("id_list")] - public List? IdList { get; set; } + public List? IdList + { + get; + set; + } } public record TraderInsurance { [JsonPropertyName("availability")] - public bool? Availability { get; set; } + public bool? Availability + { + get; + set; + } // MongoId [JsonPropertyName("excluded_category")] - public List? ExcludedCategory { get; set; } + public List? ExcludedCategory + { + get; + set; + } // Confirmed in client [JsonPropertyName("max_return_hour")] - public int? MaxReturnHour { get; set; } + public int? MaxReturnHour + { + get; + set; + } [JsonPropertyName("max_storage_time")] - public double? MaxStorageTime { get; set; } + public double? MaxStorageTime + { + get; + set; + } // Confirmed in client [JsonPropertyName("min_payment")] - public int? MinPayment { get; set; } + public int? MinPayment + { + get; + set; + } // Confirmed in client [JsonPropertyName("min_return_hour")] - public int? MinReturnHour { get; set; } + public int? MinReturnHour + { + get; + set; + } } public record TraderLoyaltyLevel { [JsonPropertyName("buy_price_coef")] - public double? BuyPriceCoefficient { get; set; } + public double? BuyPriceCoefficient + { + get; + set; + } [JsonPropertyName("exchange_price_coef")] - public double? ExchangePriceCoefficient { get; set; } + public double? ExchangePriceCoefficient + { + get; + set; + } [JsonPropertyName("heal_price_coef")] - public double? HealPriceCoefficient { get; set; } + public double? HealPriceCoefficient + { + get; + set; + } [JsonPropertyName("insurance_price_coef")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public double? InsurancePriceCoefficient { get; set; } + public double? InsurancePriceCoefficient + { + get; + set; + } // Chceked on client [JsonPropertyName("minLevel")] - public int? MinLevel { get; set; } + public int? MinLevel + { + get; + set; + } [JsonPropertyName("minSalesSum")] - public long? MinSalesSum { get; set; } + public long? MinSalesSum + { + get; + set; + } [JsonPropertyName("minStanding")] - public double? MinStanding { get; set; } + public double? MinStanding + { + get; + set; + } [JsonPropertyName("repair_price_coef")] - public double? RepairPriceCoefficient { get; set; } + public double? RepairPriceCoefficient + { + get; + set; + } } public record TraderRepair { [JsonPropertyName("availability")] - public bool? Availability { get; set; } + public bool? Availability + { + get; + set; + } [JsonPropertyName("currency")] - public string? Currency { get; set; } + public string? Currency + { + get; + set; + } [JsonPropertyName("currency_coefficient")] - public double? CurrencyCoefficient { get; set; } + public double? CurrencyCoefficient + { + get; + set; + } [JsonPropertyName("excluded_category")] - public List? ExcludedCategory { get; set; } + public List? ExcludedCategory + { + get; + set; + } [JsonPropertyName("excluded_id_list")] - public List? ExcludedIdList { get; set; } // Doesn't exist in client object + public List? ExcludedIdList + { + get; + set; + } // Doesn't exist in client object [JsonPropertyName("quality")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public double? Quality { get; set; } + public double? Quality + { + get; + set; + } [JsonPropertyName("price_rate")] - public double? PriceRate { get; set; } + public double? PriceRate + { + get; + set; + } } public record TraderAssort { [JsonPropertyName("nextResupply")] - public double? NextResupply { get; set; } + public double? NextResupply + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("barter_scheme")] - public Dictionary>>? BarterScheme { get; set; } + public Dictionary>>? BarterScheme + { + get; + set; + } [JsonPropertyName("loyal_level_items")] - public Dictionary? LoyalLevelItems { get; set; } + public Dictionary? LoyalLevelItems + { + get; + set; + } } public record BarterScheme { [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("_tpl")] - public string? Template { get; set; } + public string? Template + { + get; + set; + } [JsonPropertyName("onlyFunctional")] - public bool? OnlyFunctional { get; set; } + public bool? OnlyFunctional + { + get; + set; + } [JsonPropertyName("sptQuestLocked")] - public bool? SptQuestLocked { get; set; } + public bool? SptQuestLocked + { + get; + set; + } [JsonPropertyName("level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("side")] [JsonConverter(typeof(JsonStringEnumConverter))] - public DogtagExchangeSide? Side { get; set; } + public DogtagExchangeSide? Side + { + get; + set; + } } public record Suit { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("externalObtain")] - public bool? ExternalObtain { get; set; } + public bool? ExternalObtain + { + get; + set; + } [JsonPropertyName("internalObtain")] - public bool? InternalObtain { get; set; } + public bool? InternalObtain + { + get; + set; + } [JsonPropertyName("isHiddenInPVE")] - public bool? IsHiddenInPVE { get; set; } + public bool? IsHiddenInPVE + { + get; + set; + } [JsonPropertyName("tid")] - public string? Tid { get; set; } + public string? Tid + { + get; + set; + } [JsonPropertyName("suiteId")] - public string? SuiteId { get; set; } + public string? SuiteId + { + get; + set; + } [JsonPropertyName("isActive")] - public bool? IsActive { get; set; } + public bool? IsActive + { + get; + set; + } [JsonPropertyName("requirements")] - public SuitRequirements? Requirements { get; set; } + public SuitRequirements? Requirements + { + get; + set; + } } public record SuitRequirements { [JsonPropertyName("achievementRequirements")] - public List? AchievementRequirements { get; set; } + public List? AchievementRequirements + { + get; + set; + } [JsonPropertyName("loyaltyLevel")] - public double? LoyaltyLevel { get; set; } + public double? LoyaltyLevel + { + get; + set; + } [JsonPropertyName("profileLevel")] - public double? ProfileLevel { get; set; } + public double? ProfileLevel + { + get; + set; + } // Checked in client [JsonPropertyName("standing")] - public double? Standing { get; set; } + public double? Standing + { + get; + set; + } [JsonPropertyName("skillRequirements")] - public List? SkillRequirements { get; set; } + public List? SkillRequirements + { + get; + set; + } [JsonPropertyName("questRequirements")] - public List? QuestRequirements { get; set; } + public List? QuestRequirements + { + get; + set; + } [JsonPropertyName("itemRequirements")] - public List? ItemRequirements { get; set; } + public List? ItemRequirements + { + get; + set; + } [JsonPropertyName("requiredTid")] - public string? RequiredTid { get; set; } + public string? RequiredTid + { + get; + set; + } } public record ItemRequirement { [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("_tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("onlyFunctional")] - public bool? OnlyFunctional { get; set; } + public bool? OnlyFunctional + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/XY.cs b/Libraries/Core/Models/Eft/Common/XY.cs index 91848d99..9d6e4013 100644 --- a/Libraries/Core/Models/Eft/Common/XY.cs +++ b/Libraries/Core/Models/Eft/Common/XY.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Common; public record XY { [JsonPropertyName("x")] - public double? X { get; set; } + public double? X + { + get; + set; + } [JsonPropertyName("y")] - public double? Y { get; set; } + public double? Y + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Common/XYZ.cs b/Libraries/Core/Models/Eft/Common/XYZ.cs index cd693c30..84722c22 100644 --- a/Libraries/Core/Models/Eft/Common/XYZ.cs +++ b/Libraries/Core/Models/Eft/Common/XYZ.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Common; public record XYZ { [JsonPropertyName("x")] - public double? X { get; set; } + public double? X + { + get; + set; + } [JsonPropertyName("y")] - public double? Y { get; set; } + public double? Y + { + get; + set; + } [JsonPropertyName("z")] - public double? Z { get; set; } + public double? Z + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Customization/BuyClothingRequestData.cs b/Libraries/Core/Models/Eft/Customization/BuyClothingRequestData.cs index 0f6f1b47..61256349 100644 --- a/Libraries/Core/Models/Eft/Customization/BuyClothingRequestData.cs +++ b/Libraries/Core/Models/Eft/Customization/BuyClothingRequestData.cs @@ -6,20 +6,40 @@ namespace Core.Models.Eft.Customization; public record BuyClothingRequestData : InventoryBaseActionRequestData { [JsonPropertyName("offer")] - public string? Offer { get; set; } + public string? Offer + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record PaymentItemForClothing { [JsonPropertyName("del")] - public bool? Del { get; set; } + public bool? Del + { + get; + set; + } [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Customization/CustomizationSetRequest.cs b/Libraries/Core/Models/Eft/Customization/CustomizationSetRequest.cs index 7314b7b3..9e9a2852 100644 --- a/Libraries/Core/Models/Eft/Customization/CustomizationSetRequest.cs +++ b/Libraries/Core/Models/Eft/Customization/CustomizationSetRequest.cs @@ -6,17 +6,33 @@ namespace Core.Models.Eft.Customization; public record CustomizationSetRequest : InventoryBaseActionRequestData { [JsonPropertyName("customizations")] - public List? Customizations { get; set; } + public List? Customizations + { + get; + set; + } } public record CustomizationSetOption { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("source")] - public string? Source { get; set; } + public string? Source + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/AcceptFriendRequestData.cs b/Libraries/Core/Models/Eft/Dialog/AcceptFriendRequestData.cs index 2357d7c9..e9256dfd 100644 --- a/Libraries/Core/Models/Eft/Dialog/AcceptFriendRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/AcceptFriendRequestData.cs @@ -18,5 +18,9 @@ public record DeclineFriendRequestData : BaseFriendRequest public record BaseFriendRequest : IRequestData { [JsonPropertyName("profileId")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/AddUserGroupMailRequest.cs b/Libraries/Core/Models/Eft/Dialog/AddUserGroupMailRequest.cs index a716d5ef..ac33aaf6 100644 --- a/Libraries/Core/Models/Eft/Dialog/AddUserGroupMailRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/AddUserGroupMailRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Dialog; public record AddUserGroupMailRequest : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } [JsonPropertyName("uid")] - public string? Uid { get; set; } + public string? Uid + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/ChangeGroupMailOwnerRequest.cs b/Libraries/Core/Models/Eft/Dialog/ChangeGroupMailOwnerRequest.cs index de2343e2..7fa8c413 100644 --- a/Libraries/Core/Models/Eft/Dialog/ChangeGroupMailOwnerRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/ChangeGroupMailOwnerRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Dialog; public record ChangeGroupMailOwnerRequest : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } [JsonPropertyName("uid")] - public string? Uid { get; set; } + public string? Uid + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/ChatServer.cs b/Libraries/Core/Models/Eft/Dialog/ChatServer.cs index cd8bbbcd..53e82f9f 100644 --- a/Libraries/Core/Models/Eft/Dialog/ChatServer.cs +++ b/Libraries/Core/Models/Eft/Dialog/ChatServer.cs @@ -5,39 +5,85 @@ namespace Core.Models.Eft.Dialog; public record ChatServer { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("RegistrationId")] - public int? RegistrationId { get; set; } + public int? RegistrationId + { + get; + set; + } [JsonPropertyName("VersionId")] - public string? VersionId { get; set; } + public string? VersionId + { + get; + set; + } [JsonPropertyName("Ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("Port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } [JsonPropertyName("DateTime")] - public long? DateTime { get; set; } + public long? DateTime + { + get; + set; + } [JsonPropertyName("Chats")] - public List? Chats { get; set; } + public List? Chats + { + get; + set; + } [JsonPropertyName("Regions")] - public List? Regions { get; set; } + public List? Regions + { + get; + set; + } - /** Possibly removed */ + /** + * Possibly removed + */ [JsonPropertyName("IsDeveloper")] - public bool? IsDeveloper { get; set; } + public bool? IsDeveloper + { + get; + set; + } } public record Chat { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Members")] - public int? Members { get; set; } + public int? Members + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/ClearMailMessageRequest.cs b/Libraries/Core/Models/Eft/Dialog/ClearMailMessageRequest.cs index 1039dada..81aea926 100644 --- a/Libraries/Core/Models/Eft/Dialog/ClearMailMessageRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/ClearMailMessageRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record ClearMailMessageRequest : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/CreateGroupMailRequest.cs b/Libraries/Core/Models/Eft/Dialog/CreateGroupMailRequest.cs index 8c05d126..f1d04317 100644 --- a/Libraries/Core/Models/Eft/Dialog/CreateGroupMailRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/CreateGroupMailRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Dialog; public record CreateGroupMailRequest : IRequestData { [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("Users")] - public List? Users { get; set; } + public List? Users + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/DeleteFriendRequest.cs b/Libraries/Core/Models/Eft/Dialog/DeleteFriendRequest.cs index ede5dffd..66eb0edb 100644 --- a/Libraries/Core/Models/Eft/Dialog/DeleteFriendRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/DeleteFriendRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record DeleteFriendRequest : IRequestData { [JsonPropertyName("friend_id")] - public string? FriendId { get; set; } + public string? FriendId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/FriendRequestData.cs b/Libraries/Core/Models/Eft/Dialog/FriendRequestData.cs index b1bf2b94..b22abe6b 100644 --- a/Libraries/Core/Models/Eft/Dialog/FriendRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/FriendRequestData.cs @@ -6,14 +6,30 @@ namespace Core.Models.Eft.Dialog; public record FriendRequestData : IRequestData { [JsonPropertyName("status")] - public int? Status { get; set; } + public int? Status + { + get; + set; + } [JsonPropertyName("requestId")] - public string? RequestId { get; set; } + public string? RequestId + { + get; + set; + } [JsonPropertyName("retryAfter")] - public int? RetryAfter { get; set; } + public int? RetryAfter + { + get; + set; + } [JsonPropertyName("to")] - public string? To { get; set; } + public string? To + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/FriendRequestSendResponse.cs b/Libraries/Core/Models/Eft/Dialog/FriendRequestSendResponse.cs index 88204aa5..3bc053da 100644 --- a/Libraries/Core/Models/Eft/Dialog/FriendRequestSendResponse.cs +++ b/Libraries/Core/Models/Eft/Dialog/FriendRequestSendResponse.cs @@ -6,11 +6,23 @@ namespace Core.Models.Eft.Dialog; public record FriendRequestSendResponse { [JsonPropertyName("status")] - public BackendErrorCodes? Status { get; set; } + public BackendErrorCodes? Status + { + get; + set; + } [JsonPropertyName("requestId")] - public string? RequestId { get; set; } + public string? RequestId + { + get; + set; + } [JsonPropertyName("retryAfter")] - public int? RetryAfter { get; set; } + public int? RetryAfter + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsRequestData.cs b/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsRequestData.cs index e826f887..87096f04 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record GetAllAttachmentsRequestData : IRequestData { [JsonPropertyName("dialogId")] - public string DialogId { get; set; } + public string DialogId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsResponse.cs b/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsResponse.cs index 4a49fee7..b643a3af 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsResponse.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetAllAttachmentsResponse.cs @@ -6,11 +6,23 @@ namespace Core.Models.Eft.Dialog; public record GetAllAttachmentsResponse { [JsonPropertyName("messages")] - public List? Messages { get; set; } + public List? Messages + { + get; + set; + } [JsonPropertyName("profiles")] - public List? Profiles { get; set; } // Assuming 'any' translates to 'object' + public List? Profiles + { + get; + set; + } // Assuming 'any' translates to 'object' [JsonPropertyName("hasMessagesWithRewards")] - public bool? HasMessagesWithRewards { get; set; } + public bool? HasMessagesWithRewards + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetChatServerListRequestData.cs b/Libraries/Core/Models/Eft/Dialog/GetChatServerListRequestData.cs index a07ab827..3f512914 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetChatServerListRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetChatServerListRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record GetChatServerListRequestData : IRequestData { [JsonPropertyName("VersionId")] - public string? VersionId { get; set; } + public string? VersionId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetFriendListDataResponse.cs b/Libraries/Core/Models/Eft/Dialog/GetFriendListDataResponse.cs index 12e01572..a9b09ed7 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetFriendListDataResponse.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetFriendListDataResponse.cs @@ -6,11 +6,23 @@ namespace Core.Models.Eft.Dialog; public record GetFriendListDataResponse { [JsonPropertyName("Friends")] - public List? Friends { get; set; } + public List? Friends + { + get; + set; + } [JsonPropertyName("Ignore")] - public List? Ignore { get; set; } + public List? Ignore + { + get; + set; + } [JsonPropertyName("InIgnoreList")] - public List? InIgnoreList { get; set; } + public List? InIgnoreList + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetMailDialogInfoRequestData.cs b/Libraries/Core/Models/Eft/Dialog/GetMailDialogInfoRequestData.cs index 9b89bdaa..6316f16b 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetMailDialogInfoRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetMailDialogInfoRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record GetMailDialogInfoRequestData : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetMailDialogListRequestData.cs b/Libraries/Core/Models/Eft/Dialog/GetMailDialogListRequestData.cs index 39126070..43430177 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetMailDialogListRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetMailDialogListRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Dialog; public record GetMailDialogListRequestData : IRequestData { [JsonPropertyName("limit")] - public int? Limit { get; set; } + public int? Limit + { + get; + set; + } [JsonPropertyName("offset")] - public int? Offset { get; set; } + public int? Offset + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewRequestData.cs b/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewRequestData.cs index 05e65571..3919cf53 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewRequestData.cs @@ -7,14 +7,30 @@ namespace Core.Models.Eft.Dialog; public record GetMailDialogViewRequestData : IRequestData { [JsonPropertyName("type")] - public MessageType? Type { get; set; } + public MessageType? Type + { + get; + set; + } [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } [JsonPropertyName("limit")] - public int? Limit { get; set; } + public int? Limit + { + get; + set; + } [JsonPropertyName("time")] - public decimal? Time { get; set; } // decimal + public decimal? Time + { + get; + set; + } // decimal } diff --git a/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewResponseData.cs b/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewResponseData.cs index 76b50a45..e61dd194 100644 --- a/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewResponseData.cs +++ b/Libraries/Core/Models/Eft/Dialog/GetMailDialogViewResponseData.cs @@ -6,11 +6,23 @@ namespace Core.Models.Eft.Dialog; public record GetMailDialogViewResponseData { [JsonPropertyName("messages")] - public List? Messages { get; set; } + public List? Messages + { + get; + set; + } [JsonPropertyName("profiles")] - public List? Profiles { get; set; } + public List? Profiles + { + get; + set; + } [JsonPropertyName("hasMessagesWithRewards")] - public bool? HasMessagesWithRewards { get; set; } + public bool? HasMessagesWithRewards + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/PinDialogRequestData.cs b/Libraries/Core/Models/Eft/Dialog/PinDialogRequestData.cs index 3501e411..23c0a0f0 100644 --- a/Libraries/Core/Models/Eft/Dialog/PinDialogRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/PinDialogRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record PinDialogRequestData : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/RemoveDialogRequestData.cs b/Libraries/Core/Models/Eft/Dialog/RemoveDialogRequestData.cs index bb093c70..0239d578 100644 --- a/Libraries/Core/Models/Eft/Dialog/RemoveDialogRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/RemoveDialogRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record RemoveDialogRequestData : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/RemoveMailMessageRequest.cs b/Libraries/Core/Models/Eft/Dialog/RemoveMailMessageRequest.cs index 66fde976..a5115b80 100644 --- a/Libraries/Core/Models/Eft/Dialog/RemoveMailMessageRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/RemoveMailMessageRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record RemoveMailMessageRequest : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/RemoveUserGroupMailRequest.cs b/Libraries/Core/Models/Eft/Dialog/RemoveUserGroupMailRequest.cs index a091b515..f4d85d64 100644 --- a/Libraries/Core/Models/Eft/Dialog/RemoveUserGroupMailRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/RemoveUserGroupMailRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Dialog; public record RemoveUserGroupMailRequest : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } [JsonPropertyName("uid")] - public string? Uid { get; set; } + public string? Uid + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/SendMessageRequest.cs b/Libraries/Core/Models/Eft/Dialog/SendMessageRequest.cs index aecbd0b5..06f991b4 100644 --- a/Libraries/Core/Models/Eft/Dialog/SendMessageRequest.cs +++ b/Libraries/Core/Models/Eft/Dialog/SendMessageRequest.cs @@ -7,14 +7,30 @@ namespace Core.Models.Eft.Dialog; public record SendMessageRequest : IRequestData { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } [JsonPropertyName("type")] - public MessageType? Type { get; set; } + public MessageType? Type + { + get; + set; + } [JsonPropertyName("text")] - public string? Text { get; set; } + public string? Text + { + get; + set; + } [JsonPropertyName("replyTo")] - public string? ReplyTo { get; set; } + public string? ReplyTo + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Dialog/SetDialogReadRequestData.cs b/Libraries/Core/Models/Eft/Dialog/SetDialogReadRequestData.cs index 93dec7ef..9c4de057 100644 --- a/Libraries/Core/Models/Eft/Dialog/SetDialogReadRequestData.cs +++ b/Libraries/Core/Models/Eft/Dialog/SetDialogReadRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Dialog; public record SetDialogReadRequestData : IRequestData { [JsonPropertyName("dialogs")] - public List? Dialogs { get; set; } + public List? Dialogs + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/CheckVersionResponse.cs b/Libraries/Core/Models/Eft/Game/CheckVersionResponse.cs index 7a28dc77..76388392 100644 --- a/Libraries/Core/Models/Eft/Game/CheckVersionResponse.cs +++ b/Libraries/Core/Models/Eft/Game/CheckVersionResponse.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Game; public record CheckVersionResponse { [JsonPropertyName("isvalid")] - public bool? IsValid { get; set; } + public bool? IsValid + { + get; + set; + } [JsonPropertyName("latestVersion")] - public string? LatestVersion { get; set; } + public string? LatestVersion + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/CurrentGroupResponse.cs b/Libraries/Core/Models/Eft/Game/CurrentGroupResponse.cs index 0d57e4b1..45e86447 100644 --- a/Libraries/Core/Models/Eft/Game/CurrentGroupResponse.cs +++ b/Libraries/Core/Models/Eft/Game/CurrentGroupResponse.cs @@ -6,38 +6,78 @@ namespace Core.Models.Eft.Game; public record CurrentGroupResponse { [JsonPropertyName("squad")] - public List? Squad { get; set; } + public List? Squad + { + get; + set; + } } public record CurrentGroupSquadMember { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] - public string? Aid { get; set; } + public string? Aid + { + get; + set; + } [JsonPropertyName("info")] - public CurrentGroupMemberInfo? Info { get; set; } + public CurrentGroupMemberInfo? Info + { + get; + set; + } [JsonPropertyName("isLeader")] - public bool? IsLeader { get; set; } + public bool? IsLeader + { + get; + set; + } [JsonPropertyName("isReady")] - public bool? IsReady { get; set; } + public bool? IsReady + { + get; + set; + } } public record CurrentGroupMemberInfo { [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("Level")] - public string? Level { get; set; } + public string? Level + { + get; + set; + } [JsonPropertyName("MemberCategory")] - public MemberCategory? MemberCategory { get; set; } + public MemberCategory? MemberCategory + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameConfigResponse.cs b/Libraries/Core/Models/Eft/Game/GameConfigResponse.cs index 2c2b3626..bfa835dd 100644 --- a/Libraries/Core/Models/Eft/Game/GameConfigResponse.cs +++ b/Libraries/Core/Models/Eft/Game/GameConfigResponse.cs @@ -5,75 +5,165 @@ namespace Core.Models.Eft.Game; public record GameConfigResponse { [JsonPropertyName("aid")] - public double? Aid { get; set; } + public double? Aid + { + get; + set; + } [JsonPropertyName("lang")] - public string? Language { get; set; } + public string? Language + { + get; + set; + } [JsonPropertyName("languages")] - public Dictionary? Languages { get; set; } + public Dictionary? Languages + { + get; + set; + } [JsonPropertyName("ndaFree")] - public bool? IsNdaFree { get; set; } + public bool? IsNdaFree + { + get; + set; + } [JsonPropertyName("taxonomy")] - public int? Taxonomy { get; set; } + public int? Taxonomy + { + get; + set; + } [JsonPropertyName("activeProfileId")] - public string? ActiveProfileId { get; set; } + public string? ActiveProfileId + { + get; + set; + } [JsonPropertyName("backend")] - public Backend? Backend { get; set; } + public Backend? Backend + { + get; + set; + } [JsonPropertyName("useProtobuf")] - public bool? UseProtobuf { get; set; } + public bool? UseProtobuf + { + get; + set; + } [JsonPropertyName("utc_time")] - public double? UtcTime { get; set; } + public double? UtcTime + { + get; + set; + } - /** Total in game time */ + /** + * Total in game time + */ [JsonPropertyName("totalInGame")] - public double? TotalInGame { get; set; } + public double? TotalInGame + { + get; + set; + } [JsonPropertyName("reportAvailable")] - public bool? IsReportAvailable { get; set; } + public bool? IsReportAvailable + { + get; + set; + } [JsonPropertyName("twitchEventMember")] - public bool? IsTwitchEventMember { get; set; } + public bool? IsTwitchEventMember + { + get; + set; + } [JsonPropertyName("sessionMode")] - public string? SessionMode { get; set; } + public string? SessionMode + { + get; + set; + } [JsonPropertyName("purchasedGames")] - public PurchasedGames? PurchasedGames { get; set; } + public PurchasedGames? PurchasedGames + { + get; + set; + } [JsonPropertyName("isGameSynced")] - public bool? IsGameSynced { get; set; } + public bool? IsGameSynced + { + get; + set; + } } public record PurchasedGames { [JsonPropertyName("eft")] - public bool? IsEftPurchased { get; set; } + public bool? IsEftPurchased + { + get; + set; + } [JsonPropertyName("arena")] - public bool? IsArenaPurchased { get; set; } + public bool? IsArenaPurchased + { + get; + set; + } } public record Backend { [JsonPropertyName("Lobby")] - public string? Lobby { get; set; } + public string? Lobby + { + get; + set; + } [JsonPropertyName("Trading")] - public string? Trading { get; set; } + public string? Trading + { + get; + set; + } [JsonPropertyName("Messaging")] - public string? Messaging { get; set; } + public string? Messaging + { + get; + set; + } [JsonPropertyName("Main")] - public string? Main { get; set; } + public string? Main + { + get; + set; + } [JsonPropertyName("RagFair")] - public string? RagFair { get; set; } + public string? RagFair + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameEmptyCrcRequestData.cs b/Libraries/Core/Models/Eft/Game/GameEmptyCrcRequestData.cs index 03c5e030..d09aa178 100644 --- a/Libraries/Core/Models/Eft/Game/GameEmptyCrcRequestData.cs +++ b/Libraries/Core/Models/Eft/Game/GameEmptyCrcRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Game; public record GameEmptyCrcRequestData : IRequestData { [JsonPropertyName("crc")] - public int? Crc { get; set; } + public int? Crc + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameKeepAliveResponse.cs b/Libraries/Core/Models/Eft/Game/GameKeepAliveResponse.cs index b0087123..56d7f68f 100644 --- a/Libraries/Core/Models/Eft/Game/GameKeepAliveResponse.cs +++ b/Libraries/Core/Models/Eft/Game/GameKeepAliveResponse.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Game; public record GameKeepAliveResponse { [JsonPropertyName("msg")] - public string? Message { get; set; } + public string? Message + { + get; + set; + } [JsonPropertyName("utc_time")] - public double? UtcTime { get; set; } + public double? UtcTime + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameLogoutResponseData.cs b/Libraries/Core/Models/Eft/Game/GameLogoutResponseData.cs index 2b81d5c9..b18adcd7 100644 --- a/Libraries/Core/Models/Eft/Game/GameLogoutResponseData.cs +++ b/Libraries/Core/Models/Eft/Game/GameLogoutResponseData.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Game; public record GameLogoutResponseData { [JsonPropertyName("status")] - public string? Status { get; set; } + public string? Status + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameModeRequestData.cs b/Libraries/Core/Models/Eft/Game/GameModeRequestData.cs index a17faa52..ecbc1773 100644 --- a/Libraries/Core/Models/Eft/Game/GameModeRequestData.cs +++ b/Libraries/Core/Models/Eft/Game/GameModeRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Game; public record GameModeRequestData : IRequestData { [JsonPropertyName("sessionMode")] - public string? SessionMode { get; set; } + public string? SessionMode + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameModeResponse.cs b/Libraries/Core/Models/Eft/Game/GameModeResponse.cs index 49c7419f..6a5d6380 100644 --- a/Libraries/Core/Models/Eft/Game/GameModeResponse.cs +++ b/Libraries/Core/Models/Eft/Game/GameModeResponse.cs @@ -11,8 +11,16 @@ public enum SessionMode public record GameModeResponse { [JsonPropertyName("gameMode")] - public string? GameMode { get; set; } + public string? GameMode + { + get; + set; + } [JsonPropertyName("backendUrl")] - public string? BackendUrl { get; set; } + public string? BackendUrl + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GameStartResponse.cs b/Libraries/Core/Models/Eft/Game/GameStartResponse.cs index 43972c15..3284686a 100644 --- a/Libraries/Core/Models/Eft/Game/GameStartResponse.cs +++ b/Libraries/Core/Models/Eft/Game/GameStartResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Game; public record GameStartResponse { [JsonPropertyName("utc_time")] - public double UtcTime { get; set; } + public double UtcTime + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GetItemPricesResponse.cs b/Libraries/Core/Models/Eft/Game/GetItemPricesResponse.cs index 890e8863..2966d3f5 100644 --- a/Libraries/Core/Models/Eft/Game/GetItemPricesResponse.cs +++ b/Libraries/Core/Models/Eft/Game/GetItemPricesResponse.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Game; public record GetItemPricesResponse { [JsonPropertyName("supplyNextTime")] - public double? SupplyNextTime { get; set; } + public double? SupplyNextTime + { + get; + set; + } [JsonPropertyName("prices")] - public Dictionary? Prices { get; set; } + public Dictionary? Prices + { + get; + set; + } [JsonPropertyName("currencyCourses")] - public Dictionary? CurrencyCourses { get; set; } + public Dictionary? CurrencyCourses + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GetRaidTimeRequest.cs b/Libraries/Core/Models/Eft/Game/GetRaidTimeRequest.cs index 1175e52f..ed04e3e9 100644 --- a/Libraries/Core/Models/Eft/Game/GetRaidTimeRequest.cs +++ b/Libraries/Core/Models/Eft/Game/GetRaidTimeRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Game; public record GetRaidTimeRequest : IRequestData { [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("Location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/GetRaidTimeResponse.cs b/Libraries/Core/Models/Eft/Game/GetRaidTimeResponse.cs index 94cde485..d7bdbca0 100644 --- a/Libraries/Core/Models/Eft/Game/GetRaidTimeResponse.cs +++ b/Libraries/Core/Models/Eft/Game/GetRaidTimeResponse.cs @@ -5,29 +5,61 @@ namespace Core.Models.Eft.Game; public record GetRaidTimeResponse { [JsonPropertyName("RaidTimeMinutes")] - public double? RaidTimeMinutes { get; set; } + public double? RaidTimeMinutes + { + get; + set; + } [JsonPropertyName("NewSurviveTimeSeconds")] - public double? NewSurviveTimeSeconds { get; set; } + public double? NewSurviveTimeSeconds + { + get; + set; + } [JsonPropertyName("OriginalSurvivalTimeSeconds")] - public double? OriginalSurvivalTimeSeconds { get; set; } + public double? OriginalSurvivalTimeSeconds + { + get; + set; + } [JsonPropertyName("ExitChanges")] - public List? ExitChanges { get; set; } + public List? ExitChanges + { + get; + set; + } } public record ExtractChange { [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("MinTime")] - public double? MinTime { get; set; } + public double? MinTime + { + get; + set; + } [JsonPropertyName("MaxTime")] - public double? MaxTime { get; set; } + public double? MaxTime + { + get; + set; + } [JsonPropertyName("Chance")] - public double? Chance { get; set; } + public double? Chance + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/SendSurveyOpinionRequest.cs b/Libraries/Core/Models/Eft/Game/SendSurveyOpinionRequest.cs index e8a31194..5ddeffb2 100644 --- a/Libraries/Core/Models/Eft/Game/SendSurveyOpinionRequest.cs +++ b/Libraries/Core/Models/Eft/Game/SendSurveyOpinionRequest.cs @@ -6,23 +6,47 @@ namespace Core.Models.Eft.Game; public record SendSurveyOpinionRequest : IRequestData { [JsonPropertyName("resultJson")] - public string? ResultJson { get; set; } + public string? ResultJson + { + get; + set; + } [JsonPropertyName("surveyId")] - public int? SurveyId { get; set; } + public int? SurveyId + { + get; + set; + } [JsonPropertyName("answers")] - public List? Answers { get; set; } + public List? Answers + { + get; + set; + } } public record SurveyOpinionAnswer { [JsonPropertyName("questionId")] - public int? QuestionId { get; set; } + public int? QuestionId + { + get; + set; + } [JsonPropertyName("answerType")] - public string? AnswerType { get; set; } + public string? AnswerType + { + get; + set; + } [JsonPropertyName("answers")] - public object? Answers { get; set; } + public object? Answers + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/ServerDetails.cs b/Libraries/Core/Models/Eft/Game/ServerDetails.cs index 9713cceb..8c73df1c 100644 --- a/Libraries/Core/Models/Eft/Game/ServerDetails.cs +++ b/Libraries/Core/Models/Eft/Game/ServerDetails.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Game; public record ServerDetails { [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/SurveyResponseData.cs b/Libraries/Core/Models/Eft/Game/SurveyResponseData.cs index a9f7c754..50d9a2c8 100644 --- a/Libraries/Core/Models/Eft/Game/SurveyResponseData.cs +++ b/Libraries/Core/Models/Eft/Game/SurveyResponseData.cs @@ -5,86 +5,178 @@ namespace Core.Models.Eft.Game; public record SurveyResponseData { [JsonPropertyName("locale")] - public Dictionary>? Locale { get; set; } + public Dictionary>? Locale + { + get; + set; + } [JsonPropertyName("survey")] - public Survey? Survey { get; set; } + public Survey? Survey + { + get; + set; + } } public record Survey { [JsonPropertyName("id")] - public int? Id { get; set; } + public int? Id + { + get; + set; + } [JsonPropertyName("welcomePageData")] - public WelcomePageData? WelcomePageData { get; set; } + public WelcomePageData? WelcomePageData + { + get; + set; + } [JsonPropertyName("farewellPageData")] - public FarewellPageData? FarewellPageData { get; set; } + public FarewellPageData? FarewellPageData + { + get; + set; + } [JsonPropertyName("pages")] - public List>? Pages { get; set; } + public List>? Pages + { + get; + set; + } [JsonPropertyName("questions")] - public List? Questions { get; set; } + public List? Questions + { + get; + set; + } [JsonPropertyName("isNew")] - public bool? IsNew { get; set; } + public bool? IsNew + { + get; + set; + } } public record WelcomePageData { [JsonPropertyName("titleLocaleKey")] - public string? TitleLocaleKey { get; set; } + public string? TitleLocaleKey + { + get; + set; + } [JsonPropertyName("timeLocaleKey")] - public string? TimeLocaleKey { get; set; } + public string? TimeLocaleKey + { + get; + set; + } [JsonPropertyName("descriptionLocaleKey")] - public string? DescriptionLocaleKey { get; set; } + public string? DescriptionLocaleKey + { + get; + set; + } } public record FarewellPageData { [JsonPropertyName("textLocaleKey")] - public string? TextLocaleKey { get; set; } + public string? TextLocaleKey + { + get; + set; + } } public record SurveyQuestion { [JsonPropertyName("id")] - public int? Id { get; set; } + public int? Id + { + get; + set; + } [JsonPropertyName("sortIndex")] - public int? SortIndex { get; set; } + public int? SortIndex + { + get; + set; + } [JsonPropertyName("titleLocaleKey")] - public string? TitleLocaleKey { get; set; } + public string? TitleLocaleKey + { + get; + set; + } [JsonPropertyName("hintLocaleKey")] - public string? HintLocaleKey { get; set; } + public string? HintLocaleKey + { + get; + set; + } [JsonPropertyName("answerLimit")] - public int? AnswerLimit { get; set; } + public int? AnswerLimit + { + get; + set; + } [JsonPropertyName("answerType")] - public string? AnswerType { get; set; } + public string? AnswerType + { + get; + set; + } [JsonPropertyName("answers")] - public List? Answers { get; set; } + public List? Answers + { + get; + set; + } } public record SurveyAnswer { [JsonPropertyName("id")] - public int? Id { get; set; } + public int? Id + { + get; + set; + } [JsonPropertyName("questionId")] - public int? QuestionId { get; set; } + public int? QuestionId + { + get; + set; + } [JsonPropertyName("sortIndex")] - public int? SortIndex { get; set; } + public int? SortIndex + { + get; + set; + } [JsonPropertyName("localeKey")] - public string? LocaleKey { get; set; } + public string? LocaleKey + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Game/VersionValidateRequestData.cs b/Libraries/Core/Models/Eft/Game/VersionValidateRequestData.cs index 11e3cc80..5e9b136c 100644 --- a/Libraries/Core/Models/Eft/Game/VersionValidateRequestData.cs +++ b/Libraries/Core/Models/Eft/Game/VersionValidateRequestData.cs @@ -6,26 +6,54 @@ namespace Core.Models.Eft.Game; public record VersionValidateRequestData : IRequestData { [JsonPropertyName("version")] - public Version? Version { get; set; } + public Version? Version + { + get; + set; + } [JsonPropertyName("develop")] - public bool? Develop { get; set; } + public bool? Develop + { + get; + set; + } } public record Version { [JsonPropertyName("major")] - public string? Major { get; set; } + public string? Major + { + get; + set; + } [JsonPropertyName("minor")] - public string? Minor { get; set; } + public string? Minor + { + get; + set; + } [JsonPropertyName("game")] - public string? Game { get; set; } + public string? Game + { + get; + set; + } [JsonPropertyName("backend")] - public string? Backend { get; set; } + public string? Backend + { + get; + set; + } [JsonPropertyName("taxonomy")] - public string? Taxonomy { get; set; } + public string? Taxonomy + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs b/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs index 9d7967f4..9f884dcf 100644 --- a/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs +++ b/Libraries/Core/Models/Eft/Health/HealthTreatmentRequestData.cs @@ -1,6 +1,5 @@ using System.Text.Json.Serialization; using Core.Models.Common; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Health; @@ -8,60 +7,128 @@ namespace Core.Models.Eft.Health; public record HealthTreatmentRequestData : InventoryBaseActionRequestData { [JsonPropertyName("trader")] - public string? Trader { get; set; } + public string? Trader + { + get; + set; + } - /** 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 { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("difference")] - public Difference? Difference { get; set; } + public Difference? Difference + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } public record Difference { [JsonPropertyName("BodyParts")] - public BodyParts? BodyParts { get; set; } + public BodyParts? BodyParts + { + get; + set; + } [JsonPropertyName("Energy")] - public double? Energy { get; set; } + public double? Energy + { + get; + set; + } [JsonPropertyName("Hydration")] - public double? Hydration { get; set; } + public double? Hydration + { + get; + set; + } } public record BodyParts { [JsonPropertyName("Head")] - public BodyPartEffects? Head { get; set; } + public BodyPartEffects? Head + { + get; + set; + } [JsonPropertyName("Chest")] - public BodyPartEffects? Chest { get; set; } + public BodyPartEffects? Chest + { + get; + set; + } [JsonPropertyName("Stomach")] - public BodyPartEffects? Stomach { get; set; } + public BodyPartEffects? Stomach + { + get; + set; + } [JsonPropertyName("LeftArm")] - public BodyPartEffects? LeftArm { get; set; } + public BodyPartEffects? LeftArm + { + get; + set; + } [JsonPropertyName("RightArm")] - public BodyPartEffects? RightArm { get; set; } + public BodyPartEffects? RightArm + { + get; + set; + } [JsonPropertyName("LeftLeg")] - public BodyPartEffects? LeftLeg { get; set; } + public BodyPartEffects? LeftLeg + { + get; + set; + } [JsonPropertyName("RightLeg")] - public BodyPartEffects? RightLeg { get; set; } + public BodyPartEffects? RightLeg + { + get; + set; + } } public record BodyPartEffects { - public double Health { get; set; } + public double Health + { + get; + set; + } - /** Effects in array to be removed */ - public List Effects { get; set; } + /** + * Effects in array to be removed + */ + public List Effects + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Health/OffraidEatRequestData.cs b/Libraries/Core/Models/Eft/Health/OffraidEatRequestData.cs index 4e5c4104..bfbb1933 100644 --- a/Libraries/Core/Models/Eft/Health/OffraidEatRequestData.cs +++ b/Libraries/Core/Models/Eft/Health/OffraidEatRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Health; @@ -7,11 +6,23 @@ namespace Core.Models.Eft.Health; public record OffraidEatRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("time")] - public long? Time { get; set; } + public long? Time + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Health/OffraidHealRequestData.cs b/Libraries/Core/Models/Eft/Health/OffraidHealRequestData.cs index 5b4a74c5..839aa100 100644 --- a/Libraries/Core/Models/Eft/Health/OffraidHealRequestData.cs +++ b/Libraries/Core/Models/Eft/Health/OffraidHealRequestData.cs @@ -6,16 +6,32 @@ namespace Core.Models.Eft.Health; public record OffraidHealRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("part")] - public string? Part { get; set; } + public string? Part + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("time")] - public long? Time { get; set; } + public long? Time + { + get; + set; + } } public enum BodyPart diff --git a/Libraries/Core/Models/Eft/Health/SyncHealthRequestData.cs b/Libraries/Core/Models/Eft/Health/SyncHealthRequestData.cs index 7e79bced..048adcee 100644 --- a/Libraries/Core/Models/Eft/Health/SyncHealthRequestData.cs +++ b/Libraries/Core/Models/Eft/Health/SyncHealthRequestData.cs @@ -5,53 +5,113 @@ namespace Core.Models.Eft.Health; public record SyncHealthRequestData { [JsonPropertyName("Health")] - public List? Health { get; set; } + public List? Health + { + get; + set; + } [JsonPropertyName("IsAlive")] - public bool? IsAlive { get; set; } + public bool? IsAlive + { + get; + set; + } [JsonPropertyName("Hydration")] - public double? Hydration { get; set; } + public double? Hydration + { + get; + set; + } [JsonPropertyName("Energy")] - public double? Energy { get; set; } + public double? Energy + { + get; + set; + } [JsonPropertyName("Temperature")] - public double? Temperature { get; set; } + public double? Temperature + { + get; + set; + } } public record BodyPartCollection { [JsonPropertyName("Head")] - public BodyPartHealth? Head { get; set; } + public BodyPartHealth? Head + { + get; + set; + } [JsonPropertyName("Chest")] - public BodyPartHealth? Chest { get; set; } + public BodyPartHealth? Chest + { + get; + set; + } [JsonPropertyName("Stomach")] - public BodyPartHealth? Stomach { get; set; } + public BodyPartHealth? Stomach + { + get; + set; + } [JsonPropertyName("LeftArm")] - public BodyPartHealth? LeftArm { get; set; } + public BodyPartHealth? LeftArm + { + get; + set; + } [JsonPropertyName("RightArm")] - public BodyPartHealth? RightArm { get; set; } + public BodyPartHealth? RightArm + { + get; + set; + } [JsonPropertyName("LeftLeg")] - public BodyPartHealth? LeftLeg { get; set; } + public BodyPartHealth? LeftLeg + { + get; + set; + } [JsonPropertyName("RightLeg")] - public BodyPartHealth? RightLeg { get; set; } + public BodyPartHealth? RightLeg + { + get; + set; + } } public record BodyPartHealth { [JsonPropertyName("Maximum")] - public int? Maximum { get; set; } + public int? Maximum + { + get; + set; + } [JsonPropertyName("Current")] - public int? Current { get; set; } + public int? Current + { + get; + set; + } [JsonPropertyName("Effects")] - public Dictionary? Effects { get; set; } + public Dictionary? Effects + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Health/WorkoutData.cs b/Libraries/Core/Models/Eft/Health/WorkoutData.cs index 7081b45d..857368d9 100644 --- a/Libraries/Core/Models/Eft/Health/WorkoutData.cs +++ b/Libraries/Core/Models/Eft/Health/WorkoutData.cs @@ -1,28 +1,47 @@ +using System.Text.Json.Serialization; using Core.Models.Eft.Common.Tables; using Core.Models.Utils; using Mastering = Core.Models.Eft.Common.Mastering; namespace Core.Models.Eft.Health; -using System.Text.Json.Serialization; - public class WorkoutData : IRequestData { [JsonPropertyName("skills")] - public WorkoutSkills? Skills { get; set; } + public WorkoutSkills? Skills + { + get; + set; + } } public record WorkoutSkills { [JsonPropertyName("Common")] - public List Common { get; set; } + public List Common + { + get; + set; + } [JsonPropertyName("Mastering")] - public List? Mastering { get; set; } + public List? Mastering + { + get; + set; + } [JsonPropertyName("Bonuses")] - public Bonus? Bonuses { get; set; } + public Bonus? Bonuses + { + get; + set; + } [JsonPropertyName("Points")] - public int? Points { get; set; } + public int? Points + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs index 55844e08..a2ed865f 100644 --- a/Libraries/Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HandleQTEEventRequestData.cs @@ -5,14 +5,30 @@ namespace 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 { get; set; } + public List? Results + { + get; + set; + } - /** 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 { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutArea.cs b/Libraries/Core/Models/Eft/Hideout/HideoutArea.cs index 5d4e5710..3200650e 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutArea.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutArea.cs @@ -7,181 +7,395 @@ namespace Core.Models.Eft.Hideout; public record HideoutArea { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public HideoutAreas? Type { get; set; } + public HideoutAreas? Type + { + get; + set; + } [JsonPropertyName("enabled")] - public bool? IsEnabled { get; set; } + public bool? IsEnabled + { + get; + set; + } [JsonPropertyName("needsFuel")] - public bool? NeedsFuel { get; set; } + public bool? NeedsFuel + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } [JsonPropertyName("takeFromSlotLocked")] - public bool? IsTakeFromSlotLocked { get; set; } + public bool? IsTakeFromSlotLocked + { + get; + set; + } [JsonPropertyName("craftGivesExp")] - public bool? CraftGivesExperience { get; set; } + public bool? CraftGivesExperience + { + get; + set; + } [JsonPropertyName("displayLevel")] - public bool? DisplayLevel { get; set; } + public bool? DisplayLevel + { + get; + set; + } [JsonPropertyName("enableAreaRequirements")] - public bool? EnableAreaRequirements { get; set; } + public bool? EnableAreaRequirements + { + get; + set; + } [JsonPropertyName("parentArea")] - public string? ParentArea { get; set; } + public string? ParentArea + { + get; + set; + } [JsonPropertyName("stages")] - public Dictionary? Stages { get; set; } + public Dictionary? Stages + { + get; + set; + } } public record HideoutAreaRequirement { [JsonPropertyName("areaType")] - public int? AreaType { get; set; } + public int? AreaType + { + get; + set; + } [JsonPropertyName("requiredLevel")] - public int? RequiredLevel { get; set; } + public int? RequiredLevel + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } public record Stage { [JsonPropertyName("autoUpgrade")] - public bool? AutoUpgrade { get; set; } + public bool? AutoUpgrade + { + get; + set; + } [JsonPropertyName("bonuses")] - public List? Bonuses { get; set; } + public List? Bonuses + { + get; + set; + } [JsonPropertyName("constructionTime")] - public double? ConstructionTime { get; set; } + public double? ConstructionTime + { + get; + set; + } - /** Containers inventory tpl */ + /** + * Containers inventory tpl + */ [JsonPropertyName("container")] - public string? Container { get; set; } + public string? Container + { + get; + set; + } [JsonPropertyName("description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } [JsonPropertyName("globalCounterId")] - public string? GlobalCounterId { get; set; } + public string? GlobalCounterId + { + get; + set; + } [JsonPropertyName("displayInterface")] - public bool? DisplayInterface { get; set; } + public bool? DisplayInterface + { + get; + set; + } [JsonPropertyName("improvements")] - public List? Improvements { get; set; } + public List? Improvements + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } [JsonPropertyName("slots")] - public int? Slots { get; set; } + public int? Slots + { + get; + set; + } } public record StageImprovement { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("bonuses")] - public List? Bonuses { get; set; } + public List? Bonuses + { + get; + set; + } [JsonPropertyName("improvementTime")] - public double? ImprovementTime { get; set; } + public double? ImprovementTime + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } } public record StageImprovementBonus { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("passive")] - public bool? IsPassive { get; set; } + public bool? IsPassive + { + get; + set; + } [JsonPropertyName("production")] - public bool? IsProduction { get; set; } + public bool? IsProduction + { + get; + set; + } [JsonPropertyName("skillType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public SkillTypes? SkillType { get; set; } + public SkillTypes? SkillType + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("visible")] - public bool? IsVisible { get; set; } + public bool? IsVisible + { + get; + set; + } } public record StageImprovementRequirement { [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } [JsonPropertyName("isFunctional")] - public bool? IsFunctional { get; set; } + public bool? IsFunctional + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("isSpawnedInSession")] - public bool? IsSpawnedInSession { get; set; } + public bool? IsSpawnedInSession + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } public record StageRequirement { [JsonPropertyName("areaType")] - public int? AreaType { get; set; } + public int? AreaType + { + get; + set; + } [JsonPropertyName("requiredLevel")] - public int? RequiredLevel { get; set; } + public int? RequiredLevel + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } = false; + public bool? IsEncoded + { + get; + set; + } = false; [JsonPropertyName("isFunctional")] - public bool? IsFunctional { get; set; } + public bool? IsFunctional + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("isSpawnedInSession")] - public bool? IsSpawnedInSession { get; set; } + public bool? IsSpawnedInSession + { + get; + set; + } [JsonPropertyName("loyaltyLevel")] - public int? LoyaltyLevel { get; set; } + public int? LoyaltyLevel + { + get; + set; + } [JsonPropertyName("skillName")] - public string? SkillName { get; set; } + public string? SkillName + { + get; + set; + } [JsonPropertyName("skillLevel")] - public int? SkillLevel { get; set; } + public int? SkillLevel + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutCancelProductionRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutCancelProductionRequestData.cs index 97a25b23..51a61cb0 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutCancelProductionRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutCancelProductionRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Hideout; public record HideoutCancelProductionRequestData : BaseInteractionRequestData { [JsonPropertyName("recipeId")] - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutCircleOfCultistProductionStartRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutCircleOfCultistProductionStartRequestData.cs index 5cb372d9..b6d5699b 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutCircleOfCultistProductionStartRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutCircleOfCultistProductionStartRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,5 +6,9 @@ namespace Core.Models.Eft.Hideout; public record HideoutCircleOfCultistProductionStartRequestData : InventoryBaseActionRequestData { [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutContinuousProductionStartRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutContinuousProductionStartRequestData.cs index d94bf9a3..bd5a78e8 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutContinuousProductionStartRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutContinuousProductionStartRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,15 +6,37 @@ namespace Core.Models.Eft.Hideout; public record HideoutContinuousProductionStartRequestData : InventoryBaseActionRequestData { [JsonPropertyName("recipeId")] - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } [JsonPropertyName("timestamp")] - public double? Timestamp { get; set; } + public double? Timestamp + { + get; + set; + } } public record HideoutProperties { - public int? BtcFarmGcs { get; set; } - public bool IsGeneratorOn { get; set; } - public bool WaterCollectorHasFilter { get; set; } + public int? BtcFarmGcs + { + get; + set; + } + + public bool IsGeneratorOn + { + get; + set; + } + + public bool WaterCollectorHasFilter + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutCustomisation.cs b/Libraries/Core/Models/Eft/Hideout/HideoutCustomisation.cs index b567b02f..165e64d2 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutCustomisation.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutCustomisation.cs @@ -6,59 +6,127 @@ namespace Core.Models.Eft.Hideout; public record HideoutCustomisation { [JsonPropertyName("globals")] - public List? Globals { get; set; } + public List? Globals + { + get; + set; + } [JsonPropertyName("slots")] - public List? Slots { get; set; } + public List? Slots + { + get; + set; + } } public record HideoutCustomisationGlobal { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("conditions")] - public List? Conditions { get; set; } + public List? Conditions + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } [JsonPropertyName("systemName")] - public string? SystemName { get; set; } + public string? SystemName + { + get; + set; + } [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + public bool? IsEnabled + { + get; + set; + } [JsonPropertyName("itemId")] - public string? ItemId { get; set; } + public string? ItemId + { + get; + set; + } } public record HideoutCustomisationSlot { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("conditions")] - public List? Conditions { get; set; } + public List? Conditions + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } [JsonPropertyName("systemName")] - public string? SystemName { get; set; } + public string? SystemName + { + get; + set; + } [JsonPropertyName("isEnabled")] - public bool? IsEnabled { get; set; } + public bool? IsEnabled + { + get; + set; + } [JsonPropertyName("slotId")] - public string? SlotId { get; set; } + public string? SlotId + { + get; + set; + } [JsonPropertyName("areaTypeId")] - public int? AreaTypeId { get; set; } + public int? AreaTypeId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationApplyRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationApplyRequestData.cs index 8eaaabd6..98a4d3df 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationApplyRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationApplyRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,11 +6,19 @@ namespace Core.Models.Eft.Hideout; public record HideoutCustomizationApplyRequestData : InventoryBaseActionRequestData { /// - /// Id of the newly picked item to apply to hideout + /// Id of the newly picked item to apply to hideout /// [JsonPropertyName("offerId")] - public string? OfferId { get; set; } + public string? OfferId + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationSetMannequinPoseRequest.cs b/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationSetMannequinPoseRequest.cs index d2833405..59f4f76b 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationSetMannequinPoseRequest.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutCustomizationSetMannequinPoseRequest.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,8 +6,16 @@ namespace Core.Models.Eft.Hideout; public record HideoutCustomizationSetMannequinPoseRequest : InventoryBaseActionRequestData { [JsonPropertyName("poses")] - public Dictionary? Poses { get; set; } + public Dictionary? Poses + { + get; + set; + } [JsonPropertyName("timestamp")] - public double? Timestamp { get; set; } + public double? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutDeleteProductionRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutDeleteProductionRequestData.cs index 9b9ca28e..5c40a7bf 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutDeleteProductionRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutDeleteProductionRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,8 +6,16 @@ namespace Core.Models.Eft.Hideout; public record HideoutDeleteProductionRequestData : InventoryBaseActionRequestData { [JsonPropertyName("recipeId")] - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } [JsonPropertyName("timestamp")] - public double? Timestamp { get; set; } + public double? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs index 4477de42..2253073e 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutImproveAreaRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Inventory; using Core.Models.Enums; @@ -8,16 +7,34 @@ namespace 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 { get; set; } + public string? AreaId + { + get; + set; + } [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs b/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs index 27064b51..aa63d720 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs @@ -7,120 +7,258 @@ namespace Core.Models.Eft.Hideout; public record HideoutProductionData { [JsonPropertyName("recipes")] - public List? Recipes { get; set; } + public List? Recipes + { + get; + set; + } [JsonPropertyName("scavRecipes")] - public List? ScavRecipes { get; set; } + public List? ScavRecipes + { + get; + set; + } [JsonPropertyName("cultistRecipes")] - public List? CultistRecipes { get; set; } + public List? CultistRecipes + { + get; + set; + } } public record HideoutProduction { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } [JsonPropertyName("productionTime")] - public double? ProductionTime { get; set; } + public double? ProductionTime + { + get; + set; + } - /** Tpl of item being crafted */ + /** + * Tpl of item being crafted + */ [JsonPropertyName("endProduct")] - public string? EndProduct { get; set; } + public string? EndProduct + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } [JsonPropertyName("locked")] - public bool? Locked { get; set; } + public bool? Locked + { + get; + set; + } [JsonPropertyName("needFuelForAllProductionTime")] - public bool? NeedFuelForAllProductionTime { get; set; } + public bool? NeedFuelForAllProductionTime + { + get; + set; + } [JsonPropertyName("continuous")] - public bool? Continuous { get; set; } + public bool? Continuous + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("productionLimitCount")] - public int? ProductionLimitCount { get; set; } + public int? ProductionLimitCount + { + get; + set; + } [JsonPropertyName("isCodeProduction")] - public bool? IsCodeProduction { get; set; } + public bool? IsCodeProduction + { + get; + set; + } } public record Requirement { [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } [JsonPropertyName("isFunctional")] - public bool? IsFunctional { get; set; } + public bool? IsFunctional + { + get; + set; + } [JsonPropertyName("areaType")] - public int? AreaType { get; set; } + public int? AreaType + { + get; + set; + } [JsonPropertyName("requiredLevel")] - public int? RequiredLevel { get; set; } + public int? RequiredLevel + { + get; + set; + } [JsonPropertyName("resource")] - public int? Resource { get; set; } + public int? Resource + { + get; + set; + } [JsonPropertyName("questId")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } [JsonPropertyName("isSpawnedInSession")] - public bool? IsSpawnedInSession { get; set; } + public bool? IsSpawnedInSession + { + get; + set; + } [JsonPropertyName("gameVersions")] - public List? GameVersions { get; set; } + public List? GameVersions + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } public record ScavRecipe { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } [JsonPropertyName("productionTime")] - public double? ProductionTime { get; set; } + public double? ProductionTime + { + get; + set; + } [JsonPropertyName("endProducts")] - public EndProducts? EndProducts { get; set; } + public EndProducts? EndProducts + { + get; + set; + } } public record EndProducts { [JsonPropertyName("Common")] - public MinMax? Common { get; set; } + public MinMax? Common + { + get; + set; + } [JsonPropertyName("Rare")] - public MinMax? Rare { get; set; } + public MinMax? Rare + { + get; + set; + } [JsonPropertyName("Superrare")] - public MinMax? Superrare { get; set; } + public MinMax? Superrare + { + get; + set; + } } public record CultistRecipe { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutPutItemInRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutPutItemInRequestData.cs index 72614334..b3491afc 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutPutItemInRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutPutItemInRequestData.cs @@ -1,6 +1,5 @@ using System.Text.Json.Serialization; using Core.Models.Common; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; using Core.Models.Enums; @@ -9,11 +8,23 @@ namespace Core.Models.Eft.Hideout; public record HideoutPutItemInRequestData : InventoryBaseActionRequestData { [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("items")] - public Dictionary? Items { get; set; } + public Dictionary? Items + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutScavCaseStartRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutScavCaseStartRequestData.cs index d390ac45..8e5779ee 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutScavCaseStartRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutScavCaseStartRequestData.cs @@ -1,6 +1,5 @@ using System.Text.Json.Serialization; using Core.Models.Common; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -8,14 +7,30 @@ namespace Core.Models.Eft.Hideout; public record HideoutScavCaseStartRequestData : InventoryBaseActionRequestData { [JsonPropertyName("recipeId")] - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("tools")] - public List? Tools { get; set; } + public List? Tools + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutSettingsBase.cs b/Libraries/Core/Models/Eft/Hideout/HideoutSettingsBase.cs index 81d74d4c..b9e25b96 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutSettingsBase.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutSettingsBase.cs @@ -5,17 +5,37 @@ namespace Core.Models.Eft.Hideout; public record HideoutSettingsBase { [JsonPropertyName("generatorSpeedWithoutFuel")] - public double? GeneratorSpeedWithoutFuel { get; set; } + public double? GeneratorSpeedWithoutFuel + { + get; + set; + } [JsonPropertyName("generatorFuelFlowRate")] - public double? GeneratorFuelFlowRate { get; set; } + public double? GeneratorFuelFlowRate + { + get; + set; + } [JsonPropertyName("airFilterUnitFlowRate")] - public double? AirFilterUnitFlowRate { get; set; } + public double? AirFilterUnitFlowRate + { + get; + set; + } [JsonPropertyName("cultistAmuletBonusPercent")] - public double? CultistAmuletBonusPercent { get; set; } + public double? CultistAmuletBonusPercent + { + get; + set; + } [JsonPropertyName("gpuBoostRate")] - public double? GpuBoostRate { get; set; } + public double? GpuBoostRate + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutSingleProductionStartRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutSingleProductionStartRequestData.cs index 06ba91f0..8d77b84a 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutSingleProductionStartRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutSingleProductionStartRequestData.cs @@ -1,6 +1,5 @@ using System.Text.Json.Serialization; using Core.Models.Common; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -8,14 +7,30 @@ namespace Core.Models.Eft.Hideout; public record HideoutSingleProductionStartRequestData : InventoryBaseActionRequestData { [JsonPropertyName("recipeId")] - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("tools")] - public List? Tools { get; set; } + public List? Tools + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutTakeItemOutRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutTakeItemOutRequestData.cs index d96a9bad..1c05d260 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutTakeItemOutRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutTakeItemOutRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; using Core.Models.Enums; @@ -8,11 +7,23 @@ namespace Core.Models.Eft.Hideout; public record HideoutTakeItemOutRequestData : InventoryBaseActionRequestData { [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("slots")] - public List? Slots { get; set; } + public List? Slots + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutTakeProductionRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutTakeProductionRequestData.cs index 8ab02548..3050be10 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutTakeProductionRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutTakeProductionRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,8 +6,16 @@ namespace Core.Models.Eft.Hideout; public record HideoutTakeProductionRequestData : InventoryBaseActionRequestData { [JsonPropertyName("recipeId")] - public string? RecipeId { get; set; } + public string? RecipeId + { + get; + set; + } [JsonPropertyName("timestamp")] - public int? Timestamp { get; set; } + public int? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutToggleAreaRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutToggleAreaRequestData.cs index 5e050d38..00d30cd1 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutToggleAreaRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutToggleAreaRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; using Core.Models.Enums; @@ -8,11 +7,23 @@ namespace Core.Models.Eft.Hideout; public record HideoutToggleAreaRequestData : InventoryBaseActionRequestData { [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeCompleteRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeCompleteRequestData.cs index 417f202e..1262a302 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeCompleteRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeCompleteRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; using Core.Models.Enums; @@ -8,8 +7,16 @@ namespace Core.Models.Eft.Hideout; public record HideoutUpgradeCompleteRequestData : InventoryBaseActionRequestData { [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeRequestData.cs b/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeRequestData.cs index c7cfd73f..6196dcbc 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeRequestData.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutUpgradeRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Inventory; using Core.Models.Enums; @@ -9,11 +8,23 @@ namespace Core.Models.Eft.Hideout; public record HideoutUpgradeRequestData : InventoryBaseActionRequestData { [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/QteData.cs b/Libraries/Core/Models/Eft/Hideout/QteData.cs index 9d1e8739..e6aad743 100644 --- a/Libraries/Core/Models/Eft/Hideout/QteData.cs +++ b/Libraries/Core/Models/Eft/Hideout/QteData.cs @@ -8,22 +8,46 @@ namespace Core.Models.Eft.Hideout; public record QteData { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public QteActivityType? Type { get; set; } + public QteActivityType? Type + { + get; + set; + } [JsonPropertyName("area")] - public HideoutAreas? Area { get; set; } + public HideoutAreas? Area + { + get; + set; + } [JsonPropertyName("areaLevel")] - public int? AreaLevel { get; set; } + public int? AreaLevel + { + get; + set; + } [JsonPropertyName("quickTimeEvents")] - public List? QuickTimeEvents { get; set; } + public List? QuickTimeEvents + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } /* TODO: Could be an array of any of these: | IAreaRequirement @@ -39,220 +63,440 @@ public record QteData */ [JsonPropertyName("results")] - public Dictionary? Results { get; set; } + public Dictionary? Results + { + get; + set; + } } public record QuickTimeEvent { [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] - public QteType? EventType { get; set; } + public QteType? EventType + { + get; + set; + } [JsonPropertyName("position")] - public Position? Coordinates { get; set; } + public Position? Coordinates + { + get; + set; + } [JsonPropertyName("startDelay")] - public double? StartDelay { get; set; } + public double? StartDelay + { + get; + set; + } [JsonPropertyName("endDelay")] - public double? EndDelay { get; set; } + public double? EndDelay + { + get; + set; + } [JsonPropertyName("speed")] - public float? MovementSpeed { get; set; } + public float? MovementSpeed + { + get; + set; + } [JsonPropertyName("successRange")] - public Position? SuccessCoordinates { get; set; } + public Position? SuccessCoordinates + { + get; + set; + } [JsonPropertyName("key")] - public string? UniqueKey { get; set; } + public string? UniqueKey + { + get; + set; + } } public record QteRequirement { [JsonPropertyName("type")] - public RequirementType? RequirementType { get; set; } + public RequirementType? RequirementType + { + get; + set; + } } public record QteResult { [JsonPropertyName("energy")] - public int? Energy { get; set; } + public int? Energy + { + get; + set; + } [JsonPropertyName("hydration")] - public int? Hydration { get; set; } + public int? Hydration + { + get; + set; + } [JsonPropertyName("rewardsRange")] - public List? RewardEffects { get; set; } + public List? RewardEffects + { + get; + set; + } } public record QteEffect { [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] - public QteRewardType? Type { get; set; } + public QteRewardType? Type + { + get; + set; + } [JsonPropertyName("skillId")] [JsonConverter(typeof(JsonStringEnumConverter))] - public SkillTypes? SkillId { get; set; } + public SkillTypes? SkillId + { + get; + set; + } [JsonPropertyName("levelMultipliers")] - public List? LevelMultipliers { get; set; } + public List? LevelMultipliers + { + get; + set; + } [JsonPropertyName("time")] - public long? Time { get; set; } + public long? Time + { + get; + set; + } [JsonPropertyName("weight")] - public float? Weight { get; set; } + public float? Weight + { + get; + set; + } [JsonPropertyName("result")] [JsonConverter(typeof(JsonStringEnumConverter))] - public QteResultType? Result { get; set; } + public QteResultType? Result + { + get; + set; + } } public record SkillLevelMultiplier { [JsonPropertyName("level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("multiplier")] - public float? MultiplierValue { get; set; } + public float? MultiplierValue + { + get; + set; + } } public record Position { [JsonPropertyName("x")] - public float? X { get; set; } + public float? X + { + get; + set; + } [JsonPropertyName("y")] - public float? Y { get; set; } + public float? Y + { + get; + set; + } } public record AreaRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.Area; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.Area; [JsonPropertyName("areaType")] - public HideoutAreas? AreaType { get; set; } + public HideoutAreas? AreaType + { + get; + set; + } [JsonPropertyName("requiredLevel")] - public int? RequiredLevel { get; set; } + public int? RequiredLevel + { + get; + set; + } } public record TraderUnlockRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.TraderUnlock; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.TraderUnlock; [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } } public record TraderLoyaltyRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.TraderLoyalty; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.TraderLoyalty; [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("loyaltyLevel")] - public int? LoyaltyLevel { get; set; } + public int? LoyaltyLevel + { + get; + set; + } } public record SkillRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.Skill; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.Skill; [JsonPropertyName("skillName")] [JsonConverter(typeof(JsonStringEnumConverter))] - public SkillTypes? SkillName { get; set; } + public SkillTypes? SkillName + { + get; + set; + } [JsonPropertyName("skillLevel")] - public int? SkillLevel { get; set; } + public int? SkillLevel + { + get; + set; + } } public record ResourceRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.Resource; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.Resource; [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("resource")] - public int? Resource { get; set; } + public int? Resource + { + get; + set; + } } public record ItemRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.Item; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.Item; [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("isFunctional")] - public bool? IsFunctional { get; set; } + public bool? IsFunctional + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } } public record ToolRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.Tool; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.Tool; [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("isFunctional")] - public bool? IsFunctional { get; set; } + public bool? IsFunctional + { + get; + set; + } [JsonPropertyName("isEncoded")] - public bool? IsEncoded { get; set; } + public bool? IsEncoded + { + get; + set; + } } public record QuestRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.QuestComplete; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.QuestComplete; [JsonPropertyName("questId")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } } public record HealthRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.Health; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.Health; [JsonPropertyName("energy")] - public int? Energy { get; set; } + public int? Energy + { + get; + set; + } [JsonPropertyName("hydration")] - public int? Hydration { get; set; } + public int? Hydration + { + get; + set; + } } public record BodyPartBuffRequirement : QteRequirement { [JsonPropertyName("type")] - public RequirementType? Type { get; set; } = Models.Enums.Hideout.RequirementType.BodyPartBuff; + public RequirementType? Type + { + get; + set; + } = Enums.Hideout.RequirementType.BodyPartBuff; [JsonPropertyName("effectName")] - public Effect? EffectName { get; set; } + public Effect? EffectName + { + get; + set; + } [JsonPropertyName("bodyPart")] - public BodyPart? BodyPart { get; set; } + public BodyPart? BodyPart + { + get; + set; + } [JsonPropertyName("excluded")] - public bool? Excluded { get; set; } + public bool? Excluded + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Hideout/RecordShootingRangePoints.cs b/Libraries/Core/Models/Eft/Hideout/RecordShootingRangePoints.cs index e0c6528a..d8b7f24d 100644 --- a/Libraries/Core/Models/Eft/Hideout/RecordShootingRangePoints.cs +++ b/Libraries/Core/Models/Eft/Hideout/RecordShootingRangePoints.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Hideout; @@ -7,5 +6,9 @@ namespace Core.Models.Eft.Hideout; public record RecordShootingRangePoints : InventoryBaseActionRequestData { [JsonPropertyName("points")] - public int? Points { get; set; } + public int? Points + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/HttpResponse/GetBodyResponseData.cs b/Libraries/Core/Models/Eft/HttpResponse/GetBodyResponseData.cs index d8a17ac0..2fb2e9ff 100644 --- a/Libraries/Core/Models/Eft/HttpResponse/GetBodyResponseData.cs +++ b/Libraries/Core/Models/Eft/HttpResponse/GetBodyResponseData.cs @@ -6,12 +6,24 @@ namespace Core.Models.Eft.HttpResponse; public record GetBodyResponseData { [JsonPropertyName("err")] - public BackendErrorCodes? Err { get; set; } + public BackendErrorCodes? Err + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("errmsg")] - public string? ErrMsg { get; set; } + public string? ErrMsg + { + get; + set; + } [JsonPropertyName("data")] - public T? Data { get; set; } + public T? Data + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/HttpResponse/NullResponseData.cs b/Libraries/Core/Models/Eft/HttpResponse/NullResponseData.cs index 4f6c001d..beae5e72 100644 --- a/Libraries/Core/Models/Eft/HttpResponse/NullResponseData.cs +++ b/Libraries/Core/Models/Eft/HttpResponse/NullResponseData.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.HttpResponse; public record NullResponseData { [JsonPropertyName("err")] - public int? Err { get; set; } + public int? Err + { + get; + set; + } [JsonPropertyName("errmsg")] - public object? ErrMsg { get; set; } + public object? ErrMsg + { + get; + set; + } [JsonPropertyName("data")] - public object? Data { get; set; } + public object? Data + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/InRaid/InsuredItemsData.cs b/Libraries/Core/Models/Eft/InRaid/InsuredItemsData.cs index 19f86b63..c89ccddb 100644 --- a/Libraries/Core/Models/Eft/InRaid/InsuredItemsData.cs +++ b/Libraries/Core/Models/Eft/InRaid/InsuredItemsData.cs @@ -5,17 +5,37 @@ namespace Core.Models.Eft.InRaid; public record InsuredItemsData { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("durability")] - public int? Durability { get; set; } + public int? Durability + { + get; + set; + } [JsonPropertyName("maxDurability")] - public int? MaxDurability { get; set; } + public int? MaxDurability + { + get; + set; + } [JsonPropertyName("hits")] - public int? Hits { get; set; } + public int? Hits + { + get; + set; + } [JsonPropertyName("usedInQuest")] - public bool? UsedInQuest { get; set; } + public bool? UsedInQuest + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/InRaid/ItemDeliveryRequestData.cs b/Libraries/Core/Models/Eft/InRaid/ItemDeliveryRequestData.cs index de717c76..4485419a 100644 --- a/Libraries/Core/Models/Eft/InRaid/ItemDeliveryRequestData.cs +++ b/Libraries/Core/Models/Eft/InRaid/ItemDeliveryRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.InRaid; public record ItemDeliveryRequestData { [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/InRaid/RegisterPlayerRequestData.cs b/Libraries/Core/Models/Eft/InRaid/RegisterPlayerRequestData.cs index 8a46adee..e4f6064b 100644 --- a/Libraries/Core/Models/Eft/InRaid/RegisterPlayerRequestData.cs +++ b/Libraries/Core/Models/Eft/InRaid/RegisterPlayerRequestData.cs @@ -6,11 +6,23 @@ namespace Core.Models.Eft.InRaid; public record RegisterPlayerRequestData : IRequestData { [JsonPropertyName("crc")] - public int? Crc { get; set; } + public int? Crc + { + get; + set; + } [JsonPropertyName("locationId")] - public string? LocationId { get; set; } + public string? LocationId + { + get; + set; + } [JsonPropertyName("variantId")] - public int? VariantId { get; set; } + public int? VariantId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Insurance/GetInsuranceCostRequestData.cs b/Libraries/Core/Models/Eft/Insurance/GetInsuranceCostRequestData.cs index 0dea8356..b68ab59e 100644 --- a/Libraries/Core/Models/Eft/Insurance/GetInsuranceCostRequestData.cs +++ b/Libraries/Core/Models/Eft/Insurance/GetInsuranceCostRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Insurance; public record GetInsuranceCostRequestData : IRequestData { [JsonPropertyName("traders")] - public List? Traders { get; set; } + public List? Traders + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Insurance/InsureRequestData.cs b/Libraries/Core/Models/Eft/Insurance/InsureRequestData.cs index 03fc1be0..15f57665 100644 --- a/Libraries/Core/Models/Eft/Insurance/InsureRequestData.cs +++ b/Libraries/Core/Models/Eft/Insurance/InsureRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Insurance; @@ -7,8 +6,16 @@ namespace Core.Models.Eft.Insurance; public record InsureRequestData : InventoryBaseActionRequestData { [JsonPropertyName("tid")] - public string? TransactionId { get; set; } + public string? TransactionId + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs b/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs index 6f37f98e..41d2aee5 100644 --- a/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs +++ b/Libraries/Core/Models/Eft/Inventory/AddItemDirectRequest.cs @@ -6,17 +6,33 @@ namespace Core.Models.Eft.Inventory; public record AddItemDirectRequest { /// - /// Item and child mods to add to player inventory + /// Item and child mods to add to player inventory /// [JsonPropertyName("itemWithModsToAdd")] - public List? ItemWithModsToAdd { get; set; } + public List? ItemWithModsToAdd + { + get; + set; + } [JsonPropertyName("foundInRaid")] - public bool? FoundInRaid { get; set; } + public bool? FoundInRaid + { + get; + set; + } [JsonPropertyName("callback")] - public Action? Callback { get; set; } + public Action? Callback + { + get; + set; + } [JsonPropertyName("useSortingTable")] - public bool? UseSortingTable { get; set; } + public bool? UseSortingTable + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/AddItemRequestData.cs b/Libraries/Core/Models/Eft/Inventory/AddItemRequestData.cs index 34caf786..e55f5450 100644 --- a/Libraries/Core/Models/Eft/Inventory/AddItemRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/AddItemRequestData.cs @@ -6,20 +6,40 @@ public record AddItemRequestData { // Trader id [JsonPropertyName("tid")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record ItemToAdd { [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("sptIsPreset")] - public bool? IsPreset { get; set; } + public bool? IsPreset + { + get; + set; + } [JsonPropertyName("item_id")] - public string? ItemId { get; set; } + public string? ItemId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/AddItemTempObject.cs b/Libraries/Core/Models/Eft/Inventory/AddItemTempObject.cs index 630423c7..52ca255b 100644 --- a/Libraries/Core/Models/Eft/Inventory/AddItemTempObject.cs +++ b/Libraries/Core/Models/Eft/Inventory/AddItemTempObject.cs @@ -6,18 +6,38 @@ namespace Core.Models.Eft.Inventory; public record AddItemTempObject { [JsonPropertyName("itemRef")] - public Item? ItemReference { get; set; } + public Item? ItemReference + { + get; + set; + } [JsonPropertyName("count")] - public int? ItemCount { get; set; } + public int? ItemCount + { + get; + set; + } [JsonPropertyName("isPreset")] - public bool? IsPresetItem { get; set; } + public bool? IsPresetItem + { + get; + set; + } [JsonPropertyName("location")] - public ItemLocation? ItemLocation { get; set; } + public ItemLocation? ItemLocation + { + get; + set; + } // Container item will be placed in - stash or sorting table [JsonPropertyName("containerId")] - public string? ContainerIdentifier { get; set; } + public string? ContainerIdentifier + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/AddItemsDirectRequest.cs b/Libraries/Core/Models/Eft/Inventory/AddItemsDirectRequest.cs index f67087f5..50a72828 100644 --- a/Libraries/Core/Models/Eft/Inventory/AddItemsDirectRequest.cs +++ b/Libraries/Core/Models/Eft/Inventory/AddItemsDirectRequest.cs @@ -1,7 +1,5 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; -using Core.Models.Eft.Trade; namespace Core.Models.Eft.Inventory; @@ -9,16 +7,32 @@ public record AddItemsDirectRequest { /// Item and child mods to add to player inventory [JsonPropertyName("itemsWithModsToAdd")] - public List>? ItemsWithModsToAdd { get; set; } + public List>? ItemsWithModsToAdd + { + get; + set; + } [JsonPropertyName("foundInRaid")] - public bool? FoundInRaid { get; set; } + public bool? FoundInRaid + { + get; + set; + } /// Runs after EACH item with children is added [JsonPropertyName("callback")] - public Action? Callback { get; set; } + public Action? Callback + { + get; + set; + } /// Should sorting table be used when no space found in stash [JsonPropertyName("useSortingTable")] - public bool? UseSortingTable { get; set; } + public bool? UseSortingTable + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryAddRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryAddRequestData.cs index 7a1545d8..ad036402 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryAddRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryAddRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryAddRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("container")] - public Container? Container { get; set; } + public Container? Container + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryBaseActionRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryBaseActionRequestData.cs index 94b2de02..222dfe20 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryBaseActionRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryBaseActionRequestData.cs @@ -10,44 +10,92 @@ public abstract record InventoryBaseActionRequestData : BaseInteractionRequestDa public record To { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("container")] - public string? Container { get; set; } + public string? Container + { + get; + set; + } [JsonPropertyName("location")] - public object? Location { get; set; } // TODO: types given IItemLocation or number + public object? Location + { + get; + set; + } // TODO: types given IItemLocation or number [JsonPropertyName("isSearched")] - public bool? IsSearched { get; set; } + public bool? IsSearched + { + get; + set; + } } public record Container { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("container")] - public string? ContainerName { get; set; } + public string? ContainerName + { + get; + set; + } [JsonPropertyName("location")] - public object? Location { get; set; } // TODO: types given: ILocation or number + public object? Location + { + get; + set; + } // TODO: types given: ILocation or number } public record Location { [JsonPropertyName("x")] - public double? X { get; set; } + public double? X + { + get; + set; + } [JsonPropertyName("y")] - public double? Y { get; set; } + public double? Y + { + get; + set; + } [JsonPropertyName("r")] - public string? R { get; set; } + public string? R + { + get; + set; + } [JsonPropertyName("rotation")] - public string? Rotation { get; set; } + public string? Rotation + { + get; + set; + } [JsonPropertyName("isSearched")] - public bool? IsSearched { get; set; } + public bool? IsSearched + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryBindRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryBindRequestData.cs index 10717375..3a17dc27 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryBindRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryBindRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryBindRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("index")] - public string? Index { get; set; } + public string? Index + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryCreateMarkerRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryCreateMarkerRequestData.cs index 5fa5324a..230cddb6 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryCreateMarkerRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryCreateMarkerRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryCreateMarkerRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("mapMarker")] - public MapMarker? MapMarker { get; set; } + public MapMarker? MapMarker + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryDeleteMarkerRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryDeleteMarkerRequestData.cs index 98d2c3bb..929c6f70 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryDeleteMarkerRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryDeleteMarkerRequestData.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Inventory; public record InventoryDeleteMarkerRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("X")] - public int? X { get; set; } + public int? X + { + get; + set; + } [JsonPropertyName("Y")] - public int? Y { get; set; } + public int? Y + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryEditMarkerRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryEditMarkerRequestData.cs index 72513715..7af84934 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryEditMarkerRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryEditMarkerRequestData.cs @@ -6,14 +6,30 @@ namespace Core.Models.Eft.Inventory; public record InventoryEditMarkerRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("X")] - public double? X { get; set; } + public double? X + { + get; + set; + } [JsonPropertyName("Y")] - public double? Y { get; set; } + public double? Y + { + get; + set; + } [JsonPropertyName("mapMarker")] - public MapMarker? MapMarker { get; set; } + public MapMarker? MapMarker + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryExamineRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryExamineRequestData.cs index 3c549e2b..81f55fe8 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryExamineRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryExamineRequestData.cs @@ -1,10 +1,13 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; namespace Core.Models.Eft.Inventory; public record InventoryExamineRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryFoldRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryFoldRequestData.cs index eeae15db..7f215fc5 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryFoldRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryFoldRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryFoldRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("value")] - public bool? Value { get; set; } + public bool? Value + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryMergeRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryMergeRequestData.cs index 16eab832..04546243 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryMergeRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryMergeRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryMergeRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("with")] - public string? With { get; set; } + public string? With + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryMoveRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryMoveRequestData.cs index c723f1d6..b82d9989 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryMoveRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryMoveRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryMoveRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("to")] - public To? To { get; set; } + public To? To + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryReadEncyclopediaRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryReadEncyclopediaRequestData.cs index 5734e796..dd00798c 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryReadEncyclopediaRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryReadEncyclopediaRequestData.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Inventory; public record InventoryReadEncyclopediaRequestData : InventoryBaseActionRequestData { [JsonPropertyName("ids")] - public List Ids { get; set; } + public List Ids + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryRemoveRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryRemoveRequestData.cs index 924a2cdc..2c6d20df 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryRemoveRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryRemoveRequestData.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Inventory; public record InventoryRemoveRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventorySortRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventorySortRequestData.cs index 4ca45915..f0db994d 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventorySortRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventorySortRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Inventory; public record InventorySortRequestData : InventoryBaseActionRequestData { [JsonPropertyName("changedItems")] - public List? ChangedItems { get; set; } + public List? ChangedItems + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventorySplitRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventorySplitRequestData.cs index 101683d5..3695dfcb 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventorySplitRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventorySplitRequestData.cs @@ -4,18 +4,40 @@ namespace Core.Models.Eft.Inventory; public record InventorySplitRequestData : InventoryBaseActionRequestData { - /** Id of item to split */ + /** + * Id of item to split + */ [JsonPropertyName("splitItem")] - public string? SplitItem { get; set; } + public string? SplitItem + { + get; + set; + } - /** Id of new item stack */ + /** + * Id of new item stack + */ [JsonPropertyName("newItem")] - public string? NewItem { get; set; } + public string? NewItem + { + get; + set; + } - /** Destination new item will be placed in */ + /** + * Destination new item will be placed in + */ [JsonPropertyName("container")] - public Container? Container { get; set; } + public Container? Container + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventorySwapRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventorySwapRequestData.cs index 30088293..b415a232 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventorySwapRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventorySwapRequestData.cs @@ -6,20 +6,44 @@ namespace Core.Models.Eft.Inventory; public record InventorySwapRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("to")] - public To? To { get; set; } + public To? To + { + get; + set; + } [JsonPropertyName("item2")] - public string? Item2 { get; set; } + public string? Item2 + { + get; + set; + } [JsonPropertyName("to2")] - public To? To2 { get; set; } + public To? To2 + { + get; + set; + } [JsonPropertyName("fromOwner2")] - public OwnerInfo? FromOwner2 { get; set; } + public OwnerInfo? FromOwner2 + { + get; + set; + } [JsonPropertyName("toOwner2")] - public OwnerInfo? ToOwner2 { get; set; } + public OwnerInfo? ToOwner2 + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryTagRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryTagRequestData.cs index 156f9016..582b4945 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryTagRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryTagRequestData.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Inventory; public record InventoryTagRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("TagName")] - public string? TagName { get; set; } + public string? TagName + { + get; + set; + } [JsonPropertyName("TagColor")] - public int? TagColor { get; set; } + public int? TagColor + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryToggleRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryToggleRequestData.cs index 4c30f7a0..d85f6255 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryToggleRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryToggleRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryToggleRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("value")] - public bool? Value { get; set; } + public bool? Value + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryTransferRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryTransferRequestData.cs index f7791ddc..ddd2d805 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryTransferRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryTransferRequestData.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Inventory; public record InventoryTransferRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("with")] - public string? With { get; set; } + public string? With + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/InventoryUnbindRequestData.cs b/Libraries/Core/Models/Eft/Inventory/InventoryUnbindRequestData.cs index 27bdbf08..1e3cfa67 100644 --- a/Libraries/Core/Models/Eft/Inventory/InventoryUnbindRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/InventoryUnbindRequestData.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record InventoryUnbindRequestData : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/OpenRandomLootContainerRequestData.cs b/Libraries/Core/Models/Eft/Inventory/OpenRandomLootContainerRequestData.cs index fc904aca..ce1881fa 100644 --- a/Libraries/Core/Models/Eft/Inventory/OpenRandomLootContainerRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/OpenRandomLootContainerRequestData.cs @@ -5,11 +5,19 @@ namespace Core.Models.Eft.Inventory; public record OpenRandomLootContainerRequestData : InventoryBaseActionRequestData { /// - /// Container item id being opened + /// Container item id being opened /// [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("to")] - public List? To { get; set; } + public List? To + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/PinOrLockItemRequest.cs b/Libraries/Core/Models/Eft/Inventory/PinOrLockItemRequest.cs index 8fecbfea..2773dbd4 100644 --- a/Libraries/Core/Models/Eft/Inventory/PinOrLockItemRequest.cs +++ b/Libraries/Core/Models/Eft/Inventory/PinOrLockItemRequest.cs @@ -5,12 +5,24 @@ namespace Core.Models.Eft.Inventory; public record PinOrLockItemRequest : InventoryBaseActionRequestData { - /** Id of item being pinned */ + /** + * Id of item being pinned + */ [JsonPropertyName("Item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } - /** "Pinned"/"Locked"/"Free" */ + /** + * "Pinned"/"Locked"/"Free" + */ [JsonPropertyName("State")] [JsonConverter(typeof(JsonStringEnumConverter))] - public PinLockState? State { get; set; } + public PinLockState? State + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/RedeemProfileRequestData.cs b/Libraries/Core/Models/Eft/Inventory/RedeemProfileRequestData.cs index e540aebd..43f913f8 100644 --- a/Libraries/Core/Models/Eft/Inventory/RedeemProfileRequestData.cs +++ b/Libraries/Core/Models/Eft/Inventory/RedeemProfileRequestData.cs @@ -5,14 +5,26 @@ namespace Core.Models.Eft.Inventory; public record RedeemProfileRequestData : InventoryBaseActionRequestData { [JsonPropertyName("events")] - public List? Events { get; set; } + public List? Events + { + get; + set; + } } public record RedeemProfileRequestEvent { [JsonPropertyName("MessageId")] - public string? MessageId { get; set; } + public string? MessageId + { + get; + set; + } [JsonPropertyName("EventId")] - public string? EventId { get; set; } + public string? EventId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Inventory/SetFavoriteItems.cs b/Libraries/Core/Models/Eft/Inventory/SetFavoriteItems.cs index 86323d83..d1f9af94 100644 --- a/Libraries/Core/Models/Eft/Inventory/SetFavoriteItems.cs +++ b/Libraries/Core/Models/Eft/Inventory/SetFavoriteItems.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Inventory; public record SetFavoriteItems : InventoryBaseActionRequestData { [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/ItemEvent/EmptyItemEventRouterResponse.cs b/Libraries/Core/Models/Eft/ItemEvent/EmptyItemEventRouterResponse.cs index 168b0dfb..d16acce7 100644 --- a/Libraries/Core/Models/Eft/ItemEvent/EmptyItemEventRouterResponse.cs +++ b/Libraries/Core/Models/Eft/ItemEvent/EmptyItemEventRouterResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.ItemEvent; public record EmptyItemEventRouterResponse : ItemEventRouterBase { [JsonPropertyName("profileChanges")] - public string? ProfileChanges { get; set; } = ""; + public string? ProfileChanges + { + get; + set; + } = ""; } diff --git a/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs b/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs index 698047ff..8816b5b9 100644 --- a/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs +++ b/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterBase.cs @@ -1,169 +1,348 @@ +using System.Text.Json.Serialization; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Ragfair; using Core.Models.Enums; namespace Core.Models.Eft.ItemEvent; -using System.Text.Json.Serialization; - public record ItemEventRouterBase { [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("warnings")] - public List? Warnings { get; set; } + public List? Warnings + { + get; + set; + } [JsonPropertyName("profileChanges")] - public Dictionary ProfileChanges { get; set; } + public Dictionary ProfileChanges + { + get; + set; + } } public record Warning { [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } [JsonPropertyName("errmsg")] - public string? ErrorMessage { get; set; } + public string? ErrorMessage + { + get; + set; + } [JsonPropertyName("code")] - public BackendErrorCodes? Code { get; set; } + public BackendErrorCodes? Code + { + get; + set; + } [JsonPropertyName("data")] - public object? Data { get; set; } + public object? Data + { + get; + set; + } } public record ProfileChange { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("experience")] - public double? Experience { get; set; } + public double? Experience + { + get; + set; + } [JsonPropertyName("quests")] - public List? Quests { get; set; } + public List? Quests + { + get; + set; + } [JsonPropertyName("ragFairOffers")] - public List? RagFairOffers { get; set; } + public List? RagFairOffers + { + get; + set; + } [JsonPropertyName("weaponBuilds")] - public List? WeaponBuilds { get; set; } + public List? WeaponBuilds + { + get; + set; + } [JsonPropertyName("equipmentBuilds")] - public List? EquipmentBuilds { get; set; } + public List? EquipmentBuilds + { + get; + set; + } [JsonPropertyName("items")] - public ItemChanges? Items { get; set; } + public ItemChanges? Items + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("production")] - public Dictionary? Production { get; set; } + public Dictionary? Production + { + get; + set; + } - /** Hideout area improvement id */ + /** + * Hideout area improvement id + */ [JsonPropertyName("improvements")] - public Dictionary? Improvements { get; set; } + public Dictionary? Improvements + { + get; + set; + } [JsonPropertyName("skills")] - public Skills? Skills { get; set; } + public Skills? Skills + { + get; + set; + } [JsonPropertyName("health")] - public BotBaseHealth Health { get; set; } + public BotBaseHealth Health + { + get; + set; + } [JsonPropertyName("traderRelations")] - public Dictionary? TraderRelations { get; set; } + public Dictionary? TraderRelations + { + get; + set; + } [JsonPropertyName("moneyTransferLimitData")] - public MoneyTransferLimits? MoneyTransferLimitData { get; set; } + public MoneyTransferLimits? MoneyTransferLimitData + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("repeatableQuests")] - public List? RepeatableQuests { get; set; } + public List? RepeatableQuests + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("recipeUnlocked")] - public Dictionary? RecipeUnlocked { get; set; } + public Dictionary? RecipeUnlocked + { + get; + set; + } [JsonPropertyName("changedHideoutStashes")] - public Dictionary? ChangedHideoutStashes { get; set; } + public Dictionary? ChangedHideoutStashes + { + get; + set; + } [JsonPropertyName("questsStatus")] - public List? QuestsStatus { get; set; } + public List? QuestsStatus + { + get; + set; + } } public record HideoutStashItem { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("tpl")] - public string? Template { get; set; } + public string? Template + { + get; + set; + } } public record WeaponBuildChange { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record EquipmentBuildChange { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("fastpanel")] - public List? FastPanel { get; set; } + public List? FastPanel + { + get; + set; + } [JsonPropertyName("buildType")] - public EquipmentBuildType? BuildType { get; set; } + public EquipmentBuildType? BuildType + { + get; + set; + } } public record ItemChanges { [JsonPropertyName("new")] - public List? NewItems { get; set; } + public List? NewItems + { + get; + set; + } [JsonPropertyName("change")] - public List? ChangedItems { get; set; } + public List? ChangedItems + { + get; + set; + } [JsonPropertyName("del")] - public List DeletedItems { get; set; } // Only needs _id property + public List DeletedItems + { + get; + set; + } // Only needs _id property } -/** Related to TraderInfo */ +/** + * Related to TraderInfo + */ public record TraderData { [JsonPropertyName("salesSum")] - public double? SalesSum { get; set; } + public double? SalesSum + { + get; + set; + } [JsonPropertyName("standing")] - public double? Standing { get; set; } + public double? Standing + { + get; + set; + } [JsonPropertyName("loyalty")] - public double? Loyalty { get; set; } + public double? Loyalty + { + get; + set; + } [JsonPropertyName("unlocked")] - public bool? Unlocked { get; set; } + public bool? Unlocked + { + get; + set; + } [JsonPropertyName("disabled")] - public bool? Disabled { get; set; } + public bool? Disabled + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterRequest.cs b/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterRequest.cs index e77f091f..22b57afc 100644 --- a/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterRequest.cs +++ b/Libraries/Core/Models/Eft/ItemEvent/ItemEventRouterRequest.cs @@ -8,74 +8,154 @@ namespace Core.Models.Eft.ItemEvent; public record ItemEventRouterRequest : IRequestData { [JsonPropertyName("data")] - public List? Data { get; set; } + public List? Data + { + get; + set; + } [JsonPropertyName("tm")] - public long? Time { get; set; } + public long? Time + { + get; + set; + } [JsonPropertyName("reload")] - public int? Reload { get; set; } + public int? Reload + { + get; + set; + } } public record Daum { [JsonPropertyName("Action")] - public string? Action { get; set; } + public string? Action + { + get; + set; + } [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("to")] - public To? To { get; set; } + public To? To + { + get; + set; + } [JsonPropertyName("with")] - public string? With { get; set; } + public string? With + { + get; + set; + } [JsonPropertyName("fromOwner")] - public FromOwner? FromOwner { get; set; } + public FromOwner? FromOwner + { + get; + set; + } [JsonPropertyName("qid")] - public string? Qid { get; set; } + public string? Qid + { + get; + set; + } [JsonPropertyName("offer")] - public string? Offer { get; set; } + public string? Offer + { + get; + set; + } } public record FromOwner { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } public record To { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("container")] - public string? Container { get; set; } + public string? Container + { + get; + set; + } [JsonPropertyName("location")] - public Location? Location { get; set; } + public Location? Location + { + get; + set; + } } public record Location { [JsonPropertyName("x")] - public int? X { get; set; } + public int? X + { + get; + set; + } [JsonPropertyName("y")] - public int? Y { get; set; } + public int? Y + { + get; + set; + } [JsonPropertyName("r")] - public string? R { get; set; } + public string? R + { + get; + set; + } [JsonPropertyName("isSearched")] - public bool? IsSearched { get; set; } + public bool? IsSearched + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Launcher/ChangeRequestData.cs b/Libraries/Core/Models/Eft/Launcher/ChangeRequestData.cs index 19e1327a..82495b99 100644 --- a/Libraries/Core/Models/Eft/Launcher/ChangeRequestData.cs +++ b/Libraries/Core/Models/Eft/Launcher/ChangeRequestData.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Launcher; public record ChangeRequestData : LoginRequestData { [JsonPropertyName("change")] - public string? Change { get; set; } + public string? Change + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Launcher/GetMiniProfileRequestData.cs b/Libraries/Core/Models/Eft/Launcher/GetMiniProfileRequestData.cs index a2b10e84..2c452f47 100644 --- a/Libraries/Core/Models/Eft/Launcher/GetMiniProfileRequestData.cs +++ b/Libraries/Core/Models/Eft/Launcher/GetMiniProfileRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Launcher; public record GetMiniProfileRequestData : IRequestData { [JsonPropertyName("username")] - public string? Username { get; set; } + public string? Username + { + get; + set; + } [JsonPropertyName("password")] - public string? Password { get; set; } + public string? Password + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Launcher/LoginRequestData.cs b/Libraries/Core/Models/Eft/Launcher/LoginRequestData.cs index 1cfd6d81..44129b4b 100644 --- a/Libraries/Core/Models/Eft/Launcher/LoginRequestData.cs +++ b/Libraries/Core/Models/Eft/Launcher/LoginRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Launcher; public record LoginRequestData : IRequestData { [JsonPropertyName("username")] - public string? Username { get; set; } + public string? Username + { + get; + set; + } [JsonPropertyName("password")] - public string? Password { get; set; } + public string? Password + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Launcher/MiniProfile.cs b/Libraries/Core/Models/Eft/Launcher/MiniProfile.cs index b092f141..a6405d34 100644 --- a/Libraries/Core/Models/Eft/Launcher/MiniProfile.cs +++ b/Libraries/Core/Models/Eft/Launcher/MiniProfile.cs @@ -5,38 +5,86 @@ namespace Core.Models.Eft.Launcher; public record MiniProfile { [JsonPropertyName("username")] - public string? Username { get; set; } + public string? Username + { + get; + set; + } [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("currlvl")] - public int? CurrentLevel { get; set; } + public int? CurrentLevel + { + get; + set; + } [JsonPropertyName("currexp")] - public int? CurrentExperience { get; set; } + public int? CurrentExperience + { + get; + set; + } [JsonPropertyName("prevexp")] - public int? PreviousExperience { get; set; } + public int? PreviousExperience + { + get; + set; + } [JsonPropertyName("nextlvl")] - public int? NextLevel { get; set; } + public int? NextLevel + { + get; + set; + } [JsonPropertyName("maxlvl")] - public int? MaxLevel { get; set; } + public int? MaxLevel + { + get; + set; + } [JsonPropertyName("edition")] - public string? Edition { get; set; } + public string? Edition + { + get; + set; + } [JsonPropertyName("profileId")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonPropertyName("sptData")] - public Profile.Spt? SptData { get; set; } + public Profile.Spt? SptData + { + get; + set; + } [JsonPropertyName("hasPassword")] - public bool? HasPassword { get; set; } + public bool? HasPassword + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Launcher/RegisterData.cs b/Libraries/Core/Models/Eft/Launcher/RegisterData.cs index b055ffe9..bc615316 100644 --- a/Libraries/Core/Models/Eft/Launcher/RegisterData.cs +++ b/Libraries/Core/Models/Eft/Launcher/RegisterData.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Launcher; public record RegisterData : LoginRequestData { [JsonPropertyName("edition")] - public string? Edition { get; set; } + public string? Edition + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Location/AirdropLootResult.cs b/Libraries/Core/Models/Eft/Location/AirdropLootResult.cs index c2c760bf..57f12db4 100644 --- a/Libraries/Core/Models/Eft/Location/AirdropLootResult.cs +++ b/Libraries/Core/Models/Eft/Location/AirdropLootResult.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Location; public record AirdropLootResult { [JsonPropertyName("dropType")] - public string? DropType { get; set; } + public string? DropType + { + get; + set; + } [JsonPropertyName("loot")] - public List? Loot { get; set; } + public List? Loot + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Location/GetAirdropLootRequest.cs b/Libraries/Core/Models/Eft/Location/GetAirdropLootRequest.cs index 3c3c613a..9a2c8c63 100644 --- a/Libraries/Core/Models/Eft/Location/GetAirdropLootRequest.cs +++ b/Libraries/Core/Models/Eft/Location/GetAirdropLootRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Location; public record GetAirdropLootRequest : IRequestData { [JsonPropertyName("containerId")] - public string? ContainerId { get; set; } + public string? ContainerId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Location/GetAirdropLootResponse.cs b/Libraries/Core/Models/Eft/Location/GetAirdropLootResponse.cs index 2c5cf353..61e6143f 100644 --- a/Libraries/Core/Models/Eft/Location/GetAirdropLootResponse.cs +++ b/Libraries/Core/Models/Eft/Location/GetAirdropLootResponse.cs @@ -8,8 +8,16 @@ public record GetAirdropLootResponse { // The type of airdrop [JsonPropertyName("icon")] - public AirdropTypeEnum? Icon { get; set; } + public AirdropTypeEnum? Icon + { + get; + set; + } [JsonPropertyName("container")] - public List? Container { get; set; } + public List? Container + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Location/GetLocationRequestData.cs b/Libraries/Core/Models/Eft/Location/GetLocationRequestData.cs index 3d29c498..6564784f 100644 --- a/Libraries/Core/Models/Eft/Location/GetLocationRequestData.cs +++ b/Libraries/Core/Models/Eft/Location/GetLocationRequestData.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Location; public record GetLocationRequestData { [JsonPropertyName("crc")] - public int? Crc { get; set; } + public int? Crc + { + get; + set; + } [JsonPropertyName("locationId")] - public string? LocationId { get; set; } + public string? LocationId + { + get; + set; + } [JsonPropertyName("variantId")] - public int? VariantId { get; set; } + public int? VariantId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/EndLocalRaidRequestData.cs b/Libraries/Core/Models/Eft/Match/EndLocalRaidRequestData.cs index f7400552..e0f1db4d 100644 --- a/Libraries/Core/Models/Eft/Match/EndLocalRaidRequestData.cs +++ b/Libraries/Core/Models/Eft/Match/EndLocalRaidRequestData.cs @@ -9,117 +9,225 @@ namespace Core.Models.Eft.Match; public record EndLocalRaidRequestData : IRequestData { /// - /// ID of server player just left + /// ID of server player just left /// [JsonPropertyName("serverId")] - public string? ServerId { get; set; } + public string? ServerId + { + get; + set; + } [JsonPropertyName("results")] - public EndRaidResult? Results { get; set; } + public EndRaidResult? Results + { + get; + set; + } /// - /// Insured items left in raid by player + /// Insured items left in raid by player /// [JsonPropertyName("lostInsuredItems")] - public List? LostInsuredItems { get; set; } + public List? LostInsuredItems + { + get; + set; + } /// - /// Items sent via traders to player, keyed to service e.g. BTRTransferStash + /// Items sent via traders to player, keyed to service e.g. BTRTransferStash /// [JsonPropertyName("transferItems")] - public Dictionary>? TransferItems { get; set; } + public Dictionary>? TransferItems + { + get; + set; + } [JsonPropertyName("locationTransit")] - public LocationTransit? LocationTransit { get; set; } + public LocationTransit? LocationTransit + { + get; + set; + } } public record EndRaidResult { [JsonPropertyName("profile")] - public PmcData? Profile { get; set; } + public PmcData? Profile + { + get; + set; + } /// - /// "Survived/Transit" etc + /// "Survived/Transit" etc /// [JsonPropertyName("result")] [JsonConverter(typeof(JsonStringEnumConverter))] - public ExitStatus? Result { get; set; } + public ExitStatus? Result + { + get; + set; + } [JsonPropertyName("killerId")] - public string? KillerId { get; set; } + public string? KillerId + { + get; + set; + } [JsonPropertyName("killerAid")] - public string? KillerAid { get; set; } + public string? KillerAid + { + get; + set; + } /// - /// "Gate 3" etc + /// "Gate 3" etc /// [JsonPropertyName("exitName")] - public string? ExitName { get; set; } + public string? ExitName + { + get; + set; + } [JsonPropertyName("inSession")] - public bool? InSession { get; set; } + public bool? InSession + { + get; + set; + } [JsonPropertyName("favorite")] - public bool? Favorite { get; set; } + public bool? Favorite + { + get; + set; + } /// - /// Seconds in raid + /// Seconds in raid /// [JsonPropertyName("playTime")] - public double? PlayTime { get; set; } + public double? PlayTime + { + get; + set; + } } public record LocationTransit { [JsonPropertyName("hash")] - public string? Hash { get; set; } + public string? Hash + { + get; + set; + } [JsonPropertyName("playersCount")] - public int? PlayersCount { get; set; } + public int? PlayersCount + { + get; + set; + } [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("profiles")] - public Dictionary? Profiles { get; set; } + public Dictionary? Profiles + { + get; + set; + } [JsonPropertyName("transitionRaidId")] - public string? TransitionRaidId { get; set; } + public string? TransitionRaidId + { + get; + set; + } [JsonPropertyName("raidMode")] - public string? RaidMode { get; set; } + public string? RaidMode + { + get; + set; + } [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("dayTime")] - public string? DayTime { get; set; } + public string? DayTime + { + get; + set; + } /// - /// The location player last visited + /// The location player last visited /// [JsonPropertyName("sptLastVisitedLocation")] - public string? SptLastVisitedLocation { get; set; } + public string? SptLastVisitedLocation + { + get; + set; + } /// - /// Name of exit taken + /// Name of exit taken /// [JsonPropertyName("sptExitName")] - public string? SptExitName { get; set; } + public string? SptExitName + { + get; + set; + } } public record TransitProfile { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("keyId")] - public string? KeyId { get; set; } + public string? KeyId + { + get; + set; + } [JsonPropertyName("isSolo")] - public bool? IsSolo { get; set; } + public bool? IsSolo + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/EndOfflineRaidRequestData.cs b/Libraries/Core/Models/Eft/Match/EndOfflineRaidRequestData.cs index d9b12926..66336956 100644 --- a/Libraries/Core/Models/Eft/Match/EndOfflineRaidRequestData.cs +++ b/Libraries/Core/Models/Eft/Match/EndOfflineRaidRequestData.cs @@ -5,14 +5,30 @@ namespace Core.Models.Eft.Match; public record EndOfflineRaidRequestData { [JsonPropertyName("crc")] - public int? Crc { get; set; } + public int? Crc + { + get; + set; + } [JsonPropertyName("exitStatus")] - public string? ExitStatus { get; set; } + public string? ExitStatus + { + get; + set; + } [JsonPropertyName("exitName")] - public string? ExitName { get; set; } + public string? ExitName + { + get; + set; + } [JsonPropertyName("raidSeconds")] - public int? RaidSeconds { get; set; } + public int? RaidSeconds + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/GetRaidConfigurationRequestData.cs b/Libraries/Core/Models/Eft/Match/GetRaidConfigurationRequestData.cs index 6153dcbc..d850eed7 100644 --- a/Libraries/Core/Models/Eft/Match/GetRaidConfigurationRequestData.cs +++ b/Libraries/Core/Models/Eft/Match/GetRaidConfigurationRequestData.cs @@ -7,12 +7,24 @@ namespace Core.Models.Eft.Match; public record GetRaidConfigurationRequestData : RaidSettings, IRequestData { [JsonPropertyName("keyId")] - public string? KeyId { get; set; } + public string? KeyId + { + get; + set; + } [JsonPropertyName("MaxGroupCount")] - public int? MaxGroupCount { get; set; } + public int? MaxGroupCount + { + get; + set; + } [JsonPropertyName("transitionType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public TransitionType TransitionType { get; set; } + public TransitionType TransitionType + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/GroupCharacter.cs b/Libraries/Core/Models/Eft/Match/GroupCharacter.cs index ca29ffee..7c4b1413 100644 --- a/Libraries/Core/Models/Eft/Match/GroupCharacter.cs +++ b/Libraries/Core/Models/Eft/Match/GroupCharacter.cs @@ -7,107 +7,227 @@ namespace Core.Models.Eft.Match; public record GroupCharacter { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("Info")] - public CharacterInfo? Info { get; set; } + public CharacterInfo? Info + { + get; + set; + } [JsonPropertyName("PlayerVisualRepresentation")] - public PlayerVisualRepresentation? VisualRepresentation { get; set; } + public PlayerVisualRepresentation? VisualRepresentation + { + get; + set; + } [JsonPropertyName("isLeader")] - public bool? IsLeader { get; set; } + public bool? IsLeader + { + get; + set; + } [JsonPropertyName("isReady")] - public bool? IsReady { get; set; } + public bool? IsReady + { + get; + set; + } [JsonPropertyName("region")] - public string? Region { get; set; } + public string? Region + { + get; + set; + } [JsonPropertyName("lookingGroup")] - public bool? LookingGroup { get; set; } + public bool? LookingGroup + { + get; + set; + } } public record CharacterInfo { [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("Level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("MemberCategory")] - public MemberCategory? MemberCategory { get; set; } + public MemberCategory? MemberCategory + { + get; + set; + } [JsonPropertyName("GameVersion")] - public string? GameVersion { get; set; } + public string? GameVersion + { + get; + set; + } [JsonPropertyName("SavageLockTime")] - public double? SavageLockTime { get; set; } + public double? SavageLockTime + { + get; + set; + } [JsonPropertyName("SavageNickname")] - public string? SavageNickname { get; set; } + public string? SavageNickname + { + get; + set; + } [JsonPropertyName("hasCoopExtension")] - public bool? HasCoopExtension { get; set; } + public bool? HasCoopExtension + { + get; + set; + } } public record PlayerVisualRepresentation { [JsonPropertyName("Info")] - public VisualInfo? Info { get; set; } + public VisualInfo? Info + { + get; + set; + } [JsonPropertyName("Customization")] - public Customization? Customization { get; set; } + public Customization? Customization + { + get; + set; + } [JsonPropertyName("Equipment")] - public Equipment? Equipment { get; set; } + public Equipment? Equipment + { + get; + set; + } } public record VisualInfo { [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("Level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("MemberCategory")] - public MemberCategory? MemberCategory { get; set; } + public MemberCategory? MemberCategory + { + get; + set; + } [JsonPropertyName("GameVersion")] - public string? GameVersion { get; set; } + public string? GameVersion + { + get; + set; + } } public record Customization { [JsonPropertyName("Head")] - public string? Head { get; set; } + public string? Head + { + get; + set; + } [JsonPropertyName("Body")] - public string? Body { get; set; } + public string? Body + { + get; + set; + } [JsonPropertyName("Feet")] - public string? Feet { get; set; } + public string? Feet + { + get; + set; + } [JsonPropertyName("Hands")] - public string? Hands { get; set; } + public string? Hands + { + get; + set; + } } public record Equipment { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupCurrentResponse.cs b/Libraries/Core/Models/Eft/Match/MatchGroupCurrentResponse.cs index f2c41aab..81aae79a 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupCurrentResponse.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupCurrentResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Match; public record MatchGroupCurrentResponse { [JsonPropertyName("squad")] - public List? Squad { get; set; } + public List? Squad + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupInviteSendRequest.cs b/Libraries/Core/Models/Eft/Match/MatchGroupInviteSendRequest.cs index 9403f2a5..77bd3056 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupInviteSendRequest.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupInviteSendRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Match; public record MatchGroupInviteSendRequest : IRequestData { [JsonPropertyName("to")] - public string? To { get; set; } + public string? To + { + get; + set; + } [JsonPropertyName("inLobby")] - public bool? InLobby { get; set; } + public bool? InLobby + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupPlayerRemoveRequest.cs b/Libraries/Core/Models/Eft/Match/MatchGroupPlayerRemoveRequest.cs index 6daf1fd9..ca09f844 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupPlayerRemoveRequest.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupPlayerRemoveRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Match; public record MatchGroupPlayerRemoveRequest : IRequestData { [JsonPropertyName("aidToKick")] - public string? AidToKick { get; set; } + public string? AidToKick + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupStartGameRequest.cs b/Libraries/Core/Models/Eft/Match/MatchGroupStartGameRequest.cs index 43227a08..9fb384c5 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupStartGameRequest.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupStartGameRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Match; public record MatchGroupStartGameRequest : IRequestData { [JsonPropertyName("groupId")] - public string? GroupId { get; set; } + public string? GroupId + { + get; + set; + } [JsonPropertyName("servers")] - public List? Servers { get; set; } + public List? Servers + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupStatusRequest.cs b/Libraries/Core/Models/Eft/Match/MatchGroupStatusRequest.cs index 39ee3522..fdb2fa10 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupStatusRequest.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupStatusRequest.cs @@ -7,20 +7,44 @@ namespace Core.Models.Eft.Match; public record MatchGroupStatusRequest : IRequestData { [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("savage")] - public bool? IsSavage { get; set; } + public bool? IsSavage + { + get; + set; + } [JsonPropertyName("dt")] - public string? DateTime { get; set; } + public string? DateTime + { + get; + set; + } [JsonPropertyName("keyId")] - public string? KeyId { get; set; } + public string? KeyId + { + get; + set; + } [JsonPropertyName("raidMode")] - public RaidMode? RaidMode { get; set; } + public RaidMode? RaidMode + { + get; + set; + } [JsonPropertyName("spawnPlace")] - public string? SpawnPlace { get; set; } + public string? SpawnPlace + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupStatusResponse.cs b/Libraries/Core/Models/Eft/Match/MatchGroupStatusResponse.cs index 304eadfc..3d86e757 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupStatusResponse.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupStatusResponse.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Match; public record MatchGroupStatusResponse { [JsonPropertyName("players")] - public List? Players { get; set; } + public List? Players + { + get; + set; + } [JsonPropertyName("maxPveCountExceeded")] - public bool? MaxPveCountExceeded { get; set; } + public bool? MaxPveCountExceeded + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/MatchGroupTransferRequest.cs b/Libraries/Core/Models/Eft/Match/MatchGroupTransferRequest.cs index 08f7fd37..60c58617 100644 --- a/Libraries/Core/Models/Eft/Match/MatchGroupTransferRequest.cs +++ b/Libraries/Core/Models/Eft/Match/MatchGroupTransferRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Match; public record MatchGroupTransferRequest : IRequestData { [JsonPropertyName("aidToChange")] - public string? AidToChange { get; set; } + public string? AidToChange + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/ProfileStatusRequest.cs b/Libraries/Core/Models/Eft/Match/ProfileStatusRequest.cs index 61811018..ee69ab61 100644 --- a/Libraries/Core/Models/Eft/Match/ProfileStatusRequest.cs +++ b/Libraries/Core/Models/Eft/Match/ProfileStatusRequest.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Match; public record ProfileStatusRequest { [JsonPropertyName("groupId")] - public int? GroupId { get; set; } + public int? GroupId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/ProfileStatusResponse.cs b/Libraries/Core/Models/Eft/Match/ProfileStatusResponse.cs index 6ed4e3dc..dee7886b 100644 --- a/Libraries/Core/Models/Eft/Match/ProfileStatusResponse.cs +++ b/Libraries/Core/Models/Eft/Match/ProfileStatusResponse.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Match; public record ProfileStatusResponse { [JsonPropertyName("maxPveCountExceeded")] - public bool? MaxPveCountExceeded { get; set; } + public bool? MaxPveCountExceeded + { + get; + set; + } [JsonPropertyName("profiles")] - public List? Profiles { get; set; } + public List? Profiles + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/PutMetricsRequestData.cs b/Libraries/Core/Models/Eft/Match/PutMetricsRequestData.cs index 90b53df5..55127365 100644 --- a/Libraries/Core/Models/Eft/Match/PutMetricsRequestData.cs +++ b/Libraries/Core/Models/Eft/Match/PutMetricsRequestData.cs @@ -6,158 +6,354 @@ namespace Core.Models.Eft.Match; public record PutMetricsRequestData : IRequestData { [JsonPropertyName("sid")] - public string? SessionId { get; set; } + public string? SessionId + { + get; + set; + } [JsonPropertyName("Settings")] - public object? Settings { get; set; } + public object? Settings + { + get; + set; + } [JsonPropertyName("SharedSettings")] - public SharedSettings? SharedSettings { get; set; } + public SharedSettings? SharedSettings + { + get; + set; + } [JsonPropertyName("HardwareDescription")] - public HardwareDescription? HardwareDescription { get; set; } + public HardwareDescription? HardwareDescription + { + get; + set; + } [JsonPropertyName("Location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("Metrics")] - public object? Metrics { get; set; } + public object? Metrics + { + get; + set; + } [JsonPropertyName("ClientEvents")] - public ClientEvents? ClientEvents { get; set; } + public ClientEvents? ClientEvents + { + get; + set; + } [JsonPropertyName("SpikeSamples")] - public List? SpikeSamples { get; set; } + public List? SpikeSamples + { + get; + set; + } [JsonPropertyName("mode")] - public string? Mode { get; set; } + public string? Mode + { + get; + set; + } } public record SharedSettings { [JsonPropertyName("StatedFieldOfView")] - public double? StatedFieldOfView { get; set; } + public double? StatedFieldOfView + { + get; + set; + } } public record HardwareDescription { [JsonPropertyName("deviceUniqueIdentifier")] - public string? DeviceUniqueIdentifier { get; set; } + public string? DeviceUniqueIdentifier + { + get; + set; + } [JsonPropertyName("systemMemorySize")] - public double? SystemMemorySize { get; set; } + public double? SystemMemorySize + { + get; + set; + } [JsonPropertyName("graphicsDeviceID")] - public double? GraphicsDeviceId { get; set; } + public double? GraphicsDeviceId + { + get; + set; + } [JsonPropertyName("graphicsDeviceName")] - public string? GraphicsDeviceName { get; set; } + public string? GraphicsDeviceName + { + get; + set; + } [JsonPropertyName("graphicsDeviceType")] - public string? GraphicsDeviceType { get; set; } + public string? GraphicsDeviceType + { + get; + set; + } [JsonPropertyName("graphicsDeviceVendor")] - public string? GraphicsDeviceVendor { get; set; } + public string? GraphicsDeviceVendor + { + get; + set; + } [JsonPropertyName("graphicsDeviceVendorID")] - public double? GraphicsDeviceVendorId { get; set; } + public double? GraphicsDeviceVendorId + { + get; + set; + } [JsonPropertyName("graphicsDeviceVersion")] - public string? GraphicsDeviceVersion { get; set; } + public string? GraphicsDeviceVersion + { + get; + set; + } [JsonPropertyName("graphicsMemorySize")] - public double? GraphicsMemorySize { get; set; } + public double? GraphicsMemorySize + { + get; + set; + } [JsonPropertyName("graphicsMultiThreaded")] - public bool? GraphicsMultiThreaded { get; set; } + public bool? GraphicsMultiThreaded + { + get; + set; + } [JsonPropertyName("graphicsShaderLevel")] - public double? GraphicsShaderLevel { get; set; } + public double? GraphicsShaderLevel + { + get; + set; + } [JsonPropertyName("operatingSystem")] - public string? OperatingSystem { get; set; } + public string? OperatingSystem + { + get; + set; + } [JsonPropertyName("processorCount")] - public double? ProcessorCount { get; set; } + public double? ProcessorCount + { + get; + set; + } [JsonPropertyName("processorFrequency")] - public double? ProcessorFrequency { get; set; } + public double? ProcessorFrequency + { + get; + set; + } [JsonPropertyName("processorType")] - public string? ProcessorType { get; set; } + public string? ProcessorType + { + get; + set; + } [JsonPropertyName("driveType")] - public string? DriveType { get; set; } + public string? DriveType + { + get; + set; + } [JsonPropertyName("swapDriveType")] - public string? SwapDriveType { get; set; } + public string? SwapDriveType + { + get; + set; + } } public record ClientEvents { [JsonPropertyName("MatchingCompleted")] - public double? MatchingCompleted { get; set; } + public double? MatchingCompleted + { + get; + set; + } [JsonPropertyName("MatchingCompletedReal")] - public double? MatchingCompletedReal { get; set; } + public double? MatchingCompletedReal + { + get; + set; + } [JsonPropertyName("LocationLoaded")] - public double? LocationLoaded { get; set; } + public double? LocationLoaded + { + get; + set; + } [JsonPropertyName("LocationLoadedReal")] - public double? LocationLoadedReal { get; set; } + public double? LocationLoadedReal + { + get; + set; + } [JsonPropertyName("GamePrepared")] - public double? GamePrepared { get; set; } + public double? GamePrepared + { + get; + set; + } [JsonPropertyName("GamePreparedReal")] - public double? GamePreparedReal { get; set; } + public double? GamePreparedReal + { + get; + set; + } [JsonPropertyName("GameCreated")] - public double? GameCreated { get; set; } + public double? GameCreated + { + get; + set; + } [JsonPropertyName("GameCreatedReal")] - public double? GameCreatedReal { get; set; } + public double? GameCreatedReal + { + get; + set; + } [JsonPropertyName("GamePooled")] - public double? GamePooled { get; set; } + public double? GamePooled + { + get; + set; + } [JsonPropertyName("GamePooledReal")] - public double? GamePooledReal { get; set; } + public double? GamePooledReal + { + get; + set; + } [JsonPropertyName("GameRunned")] - public double? GameRunned { get; set; } + public double? GameRunned + { + get; + set; + } [JsonPropertyName("GameRunnedReal")] - public double? GameRunnedReal { get; set; } + public double? GameRunnedReal + { + get; + set; + } [JsonPropertyName("GameSpawn")] - public double? GameSpawn { get; set; } + public double? GameSpawn + { + get; + set; + } [JsonPropertyName("GameSpawnReal")] - public double? GameSpawnReal { get; set; } + public double? GameSpawnReal + { + get; + set; + } [JsonPropertyName("PlayerSpawnEvent")] - public double? PlayerSpawnEvent { get; set; } + public double? PlayerSpawnEvent + { + get; + set; + } [JsonPropertyName("PlayerSpawnEventReal")] - public double? PlayerSpawnEventReal { get; set; } + public double? PlayerSpawnEventReal + { + get; + set; + } [JsonPropertyName("GameSpawned")] - public double? GameSpawned { get; set; } + public double? GameSpawned + { + get; + set; + } [JsonPropertyName("GameSpawnedReal")] - public double? GameSpawnedReal { get; set; } + public double? GameSpawnedReal + { + get; + set; + } [JsonPropertyName("GameStarting")] - public double? GameStarting { get; set; } + public double? GameStarting + { + get; + set; + } [JsonPropertyName("GameStartingReal")] - public double? GameStartingReal { get; set; } + public double? GameStartingReal + { + get; + set; + } [JsonPropertyName("GameStarted")] - public double? GameStarted { get; set; } + public double? GameStarted + { + get; + set; + } [JsonPropertyName("GameStartedReal")] - public double? GameStartedReal { get; set; } + public double? GameStartedReal + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/RaidSettings.cs b/Libraries/Core/Models/Eft/Match/RaidSettings.cs index 357c69b8..c58d19e4 100644 --- a/Libraries/Core/Models/Eft/Match/RaidSettings.cs +++ b/Libraries/Core/Models/Eft/Match/RaidSettings.cs @@ -8,100 +8,204 @@ namespace Core.Models.Eft.Match; public record RaidSettings { [JsonPropertyName("keyId")] - public string? KeyId { get; set; } + public string? KeyId + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("isLocationTransition")] - public bool? IsLocationTransition { get; set; } + public bool? IsLocationTransition + { + get; + set; + } [JsonPropertyName("timeVariant")] [JsonConverter(typeof(JsonStringEnumConverter))] - public DateTimeEnum TimeVariant { get; set; } + public DateTimeEnum TimeVariant + { + get; + set; + } [JsonPropertyName("metabolismDisabled")] - public bool? MetabolismDisabled { get; set; } + public bool? MetabolismDisabled + { + get; + set; + } [JsonPropertyName("timeAndWeatherSettings")] - public TimeAndWeatherSettings? TimeAndWeatherSettings { get; set; } + public TimeAndWeatherSettings? TimeAndWeatherSettings + { + get; + set; + } [JsonPropertyName("botSettings")] - public BotSettings? BotSettings { get; set; } + public BotSettings? BotSettings + { + get; + set; + } [JsonPropertyName("wavesSettings")] - public WavesSettings? WavesSettings { get; set; } + public WavesSettings? WavesSettings + { + get; + set; + } [JsonPropertyName("side")] - public SideType? Side { get; set; } + public SideType? Side + { + get; + set; + } [JsonPropertyName("raidMode")] [JsonConverter(typeof(JsonStringEnumConverter))] - public RaidMode? RaidMode { get; set; } + public RaidMode? RaidMode + { + get; + set; + } [JsonPropertyName("playersSpawnPlace")] [JsonConverter(typeof(JsonStringEnumConverter))] - public PlayersSpawnPlace? PlayersSpawnPlace { get; set; } + public PlayersSpawnPlace? PlayersSpawnPlace + { + get; + set; + } [JsonPropertyName("CanShowGroupPreview")] - public bool? CanShowGroupPreview { get; set; } + public bool? CanShowGroupPreview + { + get; + set; + } } public record TimeAndWeatherSettings { [JsonPropertyName("isRandomTime")] - public bool? IsRandomTime { get; set; } + public bool? IsRandomTime + { + get; + set; + } [JsonPropertyName("isRandomWeather")] - public bool? IsRandomWeather { get; set; } + public bool? IsRandomWeather + { + get; + set; + } [JsonPropertyName("cloudinessType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public CloudinessType? CloudinessType { get; set; } + public CloudinessType? CloudinessType + { + get; + set; + } [JsonPropertyName("rainType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public RainType? RainType { get; set; } + public RainType? RainType + { + get; + set; + } [JsonPropertyName("fogType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public FogType? FogType { get; set; } + public FogType? FogType + { + get; + set; + } [JsonPropertyName("windType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public WindSpeed? WindType { get; set; } + public WindSpeed? WindType + { + get; + set; + } [JsonPropertyName("timeFlowType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public TimeFlowType? TimeFlowType { get; set; } + public TimeFlowType? TimeFlowType + { + get; + set; + } [JsonPropertyName("hourOfDay")] - public int? HourOfDay { get; set; } + public int? HourOfDay + { + get; + set; + } } public record BotSettings { [JsonPropertyName("isScavWars")] - public bool? IsScavWars { get; set; } + public bool? IsScavWars + { + get; + set; + } [JsonPropertyName("botAmount")] [JsonConverter(typeof(JsonStringEnumConverter))] - public BotAmount? BotAmount { get; set; } + public BotAmount? BotAmount + { + get; + set; + } } public record WavesSettings { [JsonPropertyName("botAmount")] [JsonConverter(typeof(JsonStringEnumConverter))] - public BotAmount? BotAmount { get; set; } + public BotAmount? BotAmount + { + get; + set; + } [JsonPropertyName("botDifficulty")] [JsonConverter(typeof(JsonStringEnumConverter))] - public BotDifficulty? BotDifficulty { get; set; } + public BotDifficulty? BotDifficulty + { + get; + set; + } [JsonPropertyName("isBosses")] - public bool? IsBosses { get; set; } + public bool? IsBosses + { + get; + set; + } [JsonPropertyName("isTaggedAndCursed")] - public bool? IsTaggedAndCursed { get; set; } + public bool? IsTaggedAndCursed + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/RequestIdRequest.cs b/Libraries/Core/Models/Eft/Match/RequestIdRequest.cs index a2dc61d3..879bfbb1 100644 --- a/Libraries/Core/Models/Eft/Match/RequestIdRequest.cs +++ b/Libraries/Core/Models/Eft/Match/RequestIdRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Match; public record RequestIdRequest : IRequestData { [JsonPropertyName("requestId")] - public string? RequestId { get; set; } + public string? RequestId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/Server.cs b/Libraries/Core/Models/Eft/Match/Server.cs index 2591ec25..4a2dafeb 100644 --- a/Libraries/Core/Models/Eft/Match/Server.cs +++ b/Libraries/Core/Models/Eft/Match/Server.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Match; public record Server { [JsonPropertyName("ping")] - public int? Ping { get; set; } + public int? Ping + { + get; + set; + } [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/SessionStatus.cs b/Libraries/Core/Models/Eft/Match/SessionStatus.cs index 7ddb1344..09c17fc1 100644 --- a/Libraries/Core/Models/Eft/Match/SessionStatus.cs +++ b/Libraries/Core/Models/Eft/Match/SessionStatus.cs @@ -5,38 +5,86 @@ namespace Core.Models.Eft.Match; public record SessionStatus { [JsonPropertyName("profileid")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonPropertyName("profileToken")] - public string? ProfileToken { get; set; } + public string? ProfileToken + { + get; + set; + } [JsonPropertyName("status")] - public string? Status { get; set; } + public string? Status + { + get; + set; + } [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } [JsonPropertyName("sid")] - public string? Sid { get; set; } + public string? Sid + { + get; + set; + } [JsonPropertyName("version")] - public string? Version { get; set; } + public string? Version + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("raidMode")] - public string? RaidMode { get; set; } + public string? RaidMode + { + get; + set; + } [JsonPropertyName("mode")] - public string? Mode { get; set; } + public string? Mode + { + get; + set; + } [JsonPropertyName("shortId")] - public string? ShortId { get; set; } + public string? ShortId + { + get; + set; + } [JsonPropertyName("additional_info")] - public List? AdditionalInfo { get; set; } + public List? AdditionalInfo + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/StartLocalRaidRequestData.cs b/Libraries/Core/Models/Eft/Match/StartLocalRaidRequestData.cs index 18ca1d8f..31479ef5 100644 --- a/Libraries/Core/Models/Eft/Match/StartLocalRaidRequestData.cs +++ b/Libraries/Core/Models/Eft/Match/StartLocalRaidRequestData.cs @@ -7,27 +7,61 @@ namespace Core.Models.Eft.Match; public record StartLocalRaidRequestData : IRequestData { [JsonPropertyName("serverId")] - public string? ServerId { get; set; } + public string? ServerId + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("timeVariant")] - public string? TimeVariant { get; set; } + public string? TimeVariant + { + get; + set; + } [JsonPropertyName("mode")] - public string? Mode { get; set; } + public string? Mode + { + get; + set; + } [JsonPropertyName("playerSide")] - public string? PlayerSide { get; set; } + public string? PlayerSide + { + get; + set; + } [JsonPropertyName("transitionType")] - public TransitionType? TransitionType { get; set; } + public TransitionType? TransitionType + { + get; + set; + } [JsonPropertyName("transition")] - public Transition? Transition { get; set; } + public Transition? Transition + { + get; + set; + } - /** Should loot generation be skipped, default false */ + /** + * Should loot generation be skipped, default false + */ [JsonPropertyName("sptSkipLootGeneration")] - public bool? ShouldSkipLootGeneration { get; set; } + public bool? ShouldSkipLootGeneration + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/StartLocalRaidResponseData.cs b/Libraries/Core/Models/Eft/Match/StartLocalRaidResponseData.cs index e68206d2..944345ad 100644 --- a/Libraries/Core/Models/Eft/Match/StartLocalRaidResponseData.cs +++ b/Libraries/Core/Models/Eft/Match/StartLocalRaidResponseData.cs @@ -8,42 +8,86 @@ namespace Core.Models.Eft.Match; public record StartLocalRaidResponseData { [JsonPropertyName("serverId")] - public string? ServerId { get; set; } + public string? ServerId + { + get; + set; + } [JsonPropertyName("serverSettings")] - public LocationServices? ServerSettings { get; set; } + public LocationServices? ServerSettings + { + get; + set; + } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonPropertyName("profile")] - public ProfileInsuredItems? Profile { get; set; } + public ProfileInsuredItems? Profile + { + get; + set; + } [JsonPropertyName("locationLoot")] - public LocationBase? LocationLoot { get; set; } + public LocationBase? LocationLoot + { + get; + set; + } [JsonPropertyName("transitionType")] - public TransitionType? TransitionType { get; set; } + public TransitionType? TransitionType + { + get; + set; + } [JsonPropertyName("transition")] - public Transition? Transition { get; set; } + public Transition? Transition + { + get; + set; + } } public record ProfileInsuredItems { [JsonPropertyName("insuredItems")] - public List? InsuredItems { get; set; } + public List? InsuredItems + { + get; + set; + } } public record Transition { [JsonPropertyName("transitionType")] - public TransitionType? TransitionType { get; set; } + public TransitionType? TransitionType + { + get; + set; + } [JsonPropertyName("transitionRaidId")] - public string? TransitionRaidId { get; set; } + public string? TransitionRaidId + { + get; + set; + } [JsonPropertyName("transitionCount")] - public int? TransitionCount { get; set; } + public int? TransitionCount + { + get; + set; + } [JsonPropertyName("visitedLocations")] - public List? VisitedLocations { get; set; } + public List? VisitedLocations + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Match/UpdatePingRequestData.cs b/Libraries/Core/Models/Eft/Match/UpdatePingRequestData.cs index 24f2cc77..1b2cbe2a 100644 --- a/Libraries/Core/Models/Eft/Match/UpdatePingRequestData.cs +++ b/Libraries/Core/Models/Eft/Match/UpdatePingRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Match; public record UpdatePingRequestData : IRequestData { [JsonPropertyName("servers")] - public List? servers { get; set; } + public List? servers + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Notes/NoteActionData.cs b/Libraries/Core/Models/Eft/Notes/NoteActionData.cs index 779ca202..7004947e 100644 --- a/Libraries/Core/Models/Eft/Notes/NoteActionData.cs +++ b/Libraries/Core/Models/Eft/Notes/NoteActionData.cs @@ -6,17 +6,33 @@ namespace Core.Models.Eft.Notes; public record NoteActionData : BaseInteractionRequestData { [JsonPropertyName("index")] - public int? Index { get; set; } + public int? Index + { + get; + set; + } [JsonPropertyName("note")] - public Note? Note { get; set; } + public Note? Note + { + get; + set; + } } public record Note { [JsonPropertyName("Time")] - public double? Time { get; set; } + public double? Time + { + get; + set; + } [JsonPropertyName("Text")] - public string? Text { get; set; } + public string? Text + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Notifier/Notifier.cs b/Libraries/Core/Models/Eft/Notifier/Notifier.cs index afad1fdb..3d6566f1 100644 --- a/Libraries/Core/Models/Eft/Notifier/Notifier.cs +++ b/Libraries/Core/Models/Eft/Notifier/Notifier.cs @@ -5,17 +5,37 @@ namespace Core.Models.Eft.Notifier; public record NotifierChannel { [JsonPropertyName("server")] - public string? Server { get; set; } + public string? Server + { + get; + set; + } [JsonPropertyName("channel_id")] - public string? ChannelId { get; set; } + public string? ChannelId + { + get; + set; + } [JsonPropertyName("url")] - public string? Url { get; set; } + public string? Url + { + get; + set; + } [JsonPropertyName("notifierServer")] - public string? NotifierServer { get; set; } + public string? NotifierServer + { + get; + set; + } [JsonPropertyName("ws")] - public string? WebSocket { get; set; } + public string? WebSocket + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Notifier/SelectProfileResponse.cs b/Libraries/Core/Models/Eft/Notifier/SelectProfileResponse.cs index cd03f923..6d56527d 100644 --- a/Libraries/Core/Models/Eft/Notifier/SelectProfileResponse.cs +++ b/Libraries/Core/Models/Eft/Notifier/SelectProfileResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Notifier; public record SelectProfileResponse { [JsonPropertyName("status")] - public string? Status { get; set; } + public string? Status + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Player/PlayerIncrementSkillLevelRequestData.cs b/Libraries/Core/Models/Eft/Player/PlayerIncrementSkillLevelRequestData.cs index dec03da5..f4255e60 100644 --- a/Libraries/Core/Models/Eft/Player/PlayerIncrementSkillLevelRequestData.cs +++ b/Libraries/Core/Models/Eft/Player/PlayerIncrementSkillLevelRequestData.cs @@ -6,44 +6,92 @@ namespace Core.Models.Eft.Player; public record PlayerIncrementSkillLevelRequestData { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("experience")] - public int? Experience { get; set; } + public int? Experience + { + get; + set; + } [JsonPropertyName("quests")] - public List? Quests { get; set; } + public List? Quests + { + get; + set; + } [JsonPropertyName("ragFairOffers")] - public List? RagFairOffers { get; set; } + public List? RagFairOffers + { + get; + set; + } [JsonPropertyName("builds")] - public List? Builds { get; set; } + public List? Builds + { + get; + set; + } [JsonPropertyName("items")] - public Items? Items { get; set; } + public Items? Items + { + get; + set; + } [JsonPropertyName("production")] - public Production? Production { get; set; } + public Production? Production + { + get; + set; + } [JsonPropertyName("skills")] - public Skills? Skills { get; set; } + public Skills? Skills + { + get; + set; + } [JsonPropertyName("traderRelations")] - public TraderRelations? TraderRelations { get; set; } + public TraderRelations? TraderRelations + { + get; + set; + } } // TODO: These are all lists of objects. public record Items { [JsonPropertyName("new")] - public List? NewItems { get; set; } + public List? NewItems + { + get; + set; + } [JsonPropertyName("change")] - public List? ChangedItems { get; set; } + public List? ChangedItems + { + get; + set; + } [JsonPropertyName("del")] - public List? DeletedItems { get; set; } + public List? DeletedItems + { + get; + set; + } } public record Production diff --git a/Libraries/Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs b/Libraries/Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs index 0792cb3f..17fcc493 100644 --- a/Libraries/Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs +++ b/Libraries/Core/Models/Eft/PresetBuild/PresetBuildActionRequestData.cs @@ -7,18 +7,40 @@ namespace Core.Models.Eft.PresetBuild; public record PresetBuildActionRequestData : IRequestData { [JsonPropertyName("Action")] - public string? Action { get; set; } + public string? Action + { + get; + set; + } [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } - /** name of preset given by player */ + /** + * name of preset given by player + */ [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("Root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/PresetBuild/RemoveBuildRequestData.cs b/Libraries/Core/Models/Eft/PresetBuild/RemoveBuildRequestData.cs index 9a7851c1..fa0a7bb3 100644 --- a/Libraries/Core/Models/Eft/PresetBuild/RemoveBuildRequestData.cs +++ b/Libraries/Core/Models/Eft/PresetBuild/RemoveBuildRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.PresetBuild; public record RemoveBuildRequestData : IRequestData { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Prestige/GetPrestigeResponse.cs b/Libraries/Core/Models/Eft/Prestige/GetPrestigeResponse.cs index 0701981c..4d3c1909 100644 --- a/Libraries/Core/Models/Eft/Prestige/GetPrestigeResponse.cs +++ b/Libraries/Core/Models/Eft/Prestige/GetPrestigeResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Prestige; public record GetPrestigeResponse { [JsonPropertyName("elements")] - public List? Elements { get; set; } + public List? Elements + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Prestige/ObtainPrestigeRequest.cs b/Libraries/Core/Models/Eft/Prestige/ObtainPrestigeRequest.cs index fb5f44e6..2f36fc6a 100644 --- a/Libraries/Core/Models/Eft/Prestige/ObtainPrestigeRequest.cs +++ b/Libraries/Core/Models/Eft/Prestige/ObtainPrestigeRequest.cs @@ -10,23 +10,47 @@ public class ObtainPrestigeRequestList : List, IRequestDa public record ObtainPrestigeRequest : IRequestData { [JsonPropertyName("id")] - public string Id { get; set; } + public string Id + { + get; + set; + } [JsonPropertyName("location")] - public Location Location { get; set; } + public Location Location + { + get; + set; + } } public record Location { [JsonPropertyName("x")] - public int X { get; set; } + public int X + { + get; + set; + } [JsonPropertyName("y")] - public int Y { get; set; } + public int Y + { + get; + set; + } [JsonPropertyName("z")] - public int Z { get; set; } + public int Z + { + get; + set; + } [JsonPropertyName("r")] - public string R { get; set; } + public string R + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/CompletedAchievementsResponse.cs b/Libraries/Core/Models/Eft/Profile/CompletedAchievementsResponse.cs index 52d1e0b2..18e7f7b5 100644 --- a/Libraries/Core/Models/Eft/Profile/CompletedAchievementsResponse.cs +++ b/Libraries/Core/Models/Eft/Profile/CompletedAchievementsResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Profile; public record CompletedAchievementsResponse { [JsonPropertyName("elements")] - public Dictionary? Elements { get; set; } + public Dictionary? Elements + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/ConnectResponse.cs b/Libraries/Core/Models/Eft/Profile/ConnectResponse.cs index 92aa0ce9..2fe66f7f 100644 --- a/Libraries/Core/Models/Eft/Profile/ConnectResponse.cs +++ b/Libraries/Core/Models/Eft/Profile/ConnectResponse.cs @@ -5,14 +5,30 @@ namespace Core.Models.Eft.Profile; public record ConnectResponse { [JsonPropertyName("backendUrl")] - public string? BackendUrl { get; set; } + public string? BackendUrl + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("editions")] - public List? Editions { get; set; } + public List? Editions + { + get; + set; + } [JsonPropertyName("profileDescriptions")] - public Dictionary? ProfileDescriptions { get; set; } + public Dictionary? ProfileDescriptions + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/CreateProfileResponse.cs b/Libraries/Core/Models/Eft/Profile/CreateProfileResponse.cs index b10dba79..ed306fb0 100644 --- a/Libraries/Core/Models/Eft/Profile/CreateProfileResponse.cs +++ b/Libraries/Core/Models/Eft/Profile/CreateProfileResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Profile; public record CreateProfileResponse { [JsonPropertyName("uid")] - public string? UserId { get; set; } + public string? UserId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/GetAchievementsResponse.cs b/Libraries/Core/Models/Eft/Profile/GetAchievementsResponse.cs index 088f86e3..e646a230 100644 --- a/Libraries/Core/Models/Eft/Profile/GetAchievementsResponse.cs +++ b/Libraries/Core/Models/Eft/Profile/GetAchievementsResponse.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Profile; public record GetAchievementsResponse { [JsonPropertyName("elements")] - public List? Elements { get; set; } + public List? Elements + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/GetOtherProfileRequest.cs b/Libraries/Core/Models/Eft/Profile/GetOtherProfileRequest.cs index 40e0cea9..1bcef518 100644 --- a/Libraries/Core/Models/Eft/Profile/GetOtherProfileRequest.cs +++ b/Libraries/Core/Models/Eft/Profile/GetOtherProfileRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Profile; public record GetOtherProfileRequest : IRequestData { [JsonPropertyName("accountId")] - public string? AccountId { get; set; } + public string? AccountId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/GetOtherProfileResponse.cs b/Libraries/Core/Models/Eft/Profile/GetOtherProfileResponse.cs index b1b009db..38e60cf8 100644 --- a/Libraries/Core/Models/Eft/Profile/GetOtherProfileResponse.cs +++ b/Libraries/Core/Models/Eft/Profile/GetOtherProfileResponse.cs @@ -6,110 +6,234 @@ namespace Core.Models.Eft.Profile; public record GetOtherProfileResponse { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("info")] - public OtherProfileInfo? Info { get; set; } + public OtherProfileInfo? Info + { + get; + set; + } [JsonPropertyName("customization")] - public OtherProfileCustomization? Customization { get; set; } + public OtherProfileCustomization? Customization + { + get; + set; + } [JsonPropertyName("skills")] - public Skills? Skills { get; set; } + public Skills? Skills + { + get; + set; + } [JsonPropertyName("equipment")] - public OtherProfileEquipment? Equipment { get; set; } + public OtherProfileEquipment? Equipment + { + get; + set; + } [JsonPropertyName("achievements")] - public Dictionary? Achievements { get; set; } + public Dictionary? Achievements + { + get; + set; + } [JsonPropertyName("favoriteItems")] - public List? FavoriteItems { get; set; } + public List? FavoriteItems + { + get; + set; + } [JsonPropertyName("pmcStats")] - public OtherProfileStats? PmcStats { get; set; } + public OtherProfileStats? PmcStats + { + get; + set; + } [JsonPropertyName("scavStats")] - public OtherProfileStats? ScavStats { get; set; } + public OtherProfileStats? ScavStats + { + get; + set; + } [JsonPropertyName("hideout")] - public Common.Tables.Hideout Hideout { get; set; } + public Common.Tables.Hideout Hideout + { + get; + set; + } [JsonPropertyName("customizationStash")] - public string CustomizationStash { get; set; } + public string CustomizationStash + { + get; + set; + } [JsonPropertyName("hideoutAreaStashes")] - public Dictionary HideoutAreaStashes { get; set; } + public Dictionary HideoutAreaStashes + { + get; + set; + } [JsonPropertyName("items")] - public List Items { get; set; } + public List Items + { + get; + set; + } } public record OtherProfileInfo { [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("experience")] - public int? Experience { get; set; } + public int? Experience + { + get; + set; + } [JsonPropertyName("memberCategory")] - public int? MemberCategory { get; set; } + public int? MemberCategory + { + get; + set; + } [JsonPropertyName("bannedState")] - public bool? BannedState { get; set; } + public bool? BannedState + { + get; + set; + } [JsonPropertyName("bannedUntil")] - public long? BannedUntil { get; set; } + public long? BannedUntil + { + get; + set; + } [JsonPropertyName("registrationDate")] - public long? RegistrationDate { get; set; } + public long? RegistrationDate + { + get; + set; + } } public record OtherProfileCustomization { [JsonPropertyName("head")] - public string? Head { get; set; } + public string? Head + { + get; + set; + } [JsonPropertyName("body")] - public string? Body { get; set; } + public string? Body + { + get; + set; + } [JsonPropertyName("feet")] - public string? Feet { get; set; } + public string? Feet + { + get; + set; + } [JsonPropertyName("hands")] - public string? Hands { get; set; } + public string? Hands + { + get; + set; + } [JsonPropertyName("dogtag")] - public string? Dogtag { get; set; } + public string? Dogtag + { + get; + set; + } } public record OtherProfileEquipment { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record OtherProfileStats { [JsonPropertyName("eft")] - public OtherProfileSubStats? Eft { get; set; } + public OtherProfileSubStats? Eft + { + get; + set; + } } public record OtherProfileSubStats { [JsonPropertyName("totalInGameTime")] - public long? TotalInGameTime { get; set; } + public long? TotalInGameTime + { + get; + set; + } [JsonPropertyName("overAllCounters")] - public OverallCounters? OverAllCounters { get; set; } + public OverallCounters? OverAllCounters + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/GetProfileSettingsRequest.cs b/Libraries/Core/Models/Eft/Profile/GetProfileSettingsRequest.cs index db69135b..69d2d3c8 100644 --- a/Libraries/Core/Models/Eft/Profile/GetProfileSettingsRequest.cs +++ b/Libraries/Core/Models/Eft/Profile/GetProfileSettingsRequest.cs @@ -6,11 +6,19 @@ namespace Core.Models.Eft.Profile; public record GetProfileSettingsRequest : IRequestData { /// - /// Chosen value for profile.Info.SelectedMemberCategory + /// Chosen value for profile.Info.SelectedMemberCategory /// [JsonPropertyName("memberCategory")] - public int? MemberCategory { get; set; } + public int? MemberCategory + { + get; + set; + } [JsonPropertyName("squadInviteRestriction")] - public bool? SquadInviteRestriction { get; set; } + public bool? SquadInviteRestriction + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/GetProfileStatusResponseData.cs b/Libraries/Core/Models/Eft/Profile/GetProfileStatusResponseData.cs index 481e3ade..f1161c9f 100644 --- a/Libraries/Core/Models/Eft/Profile/GetProfileStatusResponseData.cs +++ b/Libraries/Core/Models/Eft/Profile/GetProfileStatusResponseData.cs @@ -5,47 +5,103 @@ namespace Core.Models.Eft.Profile; public record GetProfileStatusResponseData { [JsonPropertyName("maxPveCountExceeded")] - public bool? MaxPveCountExceeded { get; set; } = false; + public bool? MaxPveCountExceeded + { + get; + set; + } = false; [JsonPropertyName("profiles")] - public List? Profiles { get; set; } + public List? Profiles + { + get; + set; + } } public record ProfileStatusData { [JsonPropertyName("profileid")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonPropertyName("profileToken")] - public string? ProfileToken { get; set; } + public string? ProfileToken + { + get; + set; + } [JsonPropertyName("status")] - public string? Status { get; set; } + public string? Status + { + get; + set; + } [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } [JsonPropertyName("sid")] - public string? Sid { get; set; } + public string? Sid + { + get; + set; + } [JsonPropertyName("version")] - public string? Version { get; set; } + public string? Version + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("raidMode")] - public string? RaidMode { get; set; } + public string? RaidMode + { + get; + set; + } [JsonPropertyName("mode")] - public string? Mode { get; set; } + public string? Mode + { + get; + set; + } [JsonPropertyName("shortId")] - public string? ShortId { get; set; } + public string? ShortId + { + get; + set; + } [JsonPropertyName("additional_info")] - public List? AdditionalInfo { get; set; } // TODO: Was `any` in the node server + public List? AdditionalInfo + { + get; + set; + } // TODO: Was `any` in the node server } diff --git a/Libraries/Core/Models/Eft/Profile/MessageContentRagfair.cs b/Libraries/Core/Models/Eft/Profile/MessageContentRagfair.cs index fa35f9e2..d5b8d576 100644 --- a/Libraries/Core/Models/Eft/Profile/MessageContentRagfair.cs +++ b/Libraries/Core/Models/Eft/Profile/MessageContentRagfair.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Profile; public record MessageContentRagfair { [JsonPropertyName("offerId")] - public string? OfferId { get; set; } + public string? OfferId + { + get; + set; + } [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("handbookId")] - public string? HandbookId { get; set; } + public string? HandbookId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/ProfileChangeNicknameRequestData.cs b/Libraries/Core/Models/Eft/Profile/ProfileChangeNicknameRequestData.cs index 83873ed4..59b3fd44 100644 --- a/Libraries/Core/Models/Eft/Profile/ProfileChangeNicknameRequestData.cs +++ b/Libraries/Core/Models/Eft/Profile/ProfileChangeNicknameRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Profile; public record ProfileChangeNicknameRequestData : IRequestData { [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/ProfileChangeVoiceRequestData.cs b/Libraries/Core/Models/Eft/Profile/ProfileChangeVoiceRequestData.cs index 77b5d734..d3250f66 100644 --- a/Libraries/Core/Models/Eft/Profile/ProfileChangeVoiceRequestData.cs +++ b/Libraries/Core/Models/Eft/Profile/ProfileChangeVoiceRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Profile; public record ProfileChangeVoiceRequestData : IRequestData { [JsonPropertyName("voice")] - public string? Voice { get; set; } + public string? Voice + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/ProfileCreateRequestData.cs b/Libraries/Core/Models/Eft/Profile/ProfileCreateRequestData.cs index 5b5054d7..e95ce034 100644 --- a/Libraries/Core/Models/Eft/Profile/ProfileCreateRequestData.cs +++ b/Libraries/Core/Models/Eft/Profile/ProfileCreateRequestData.cs @@ -6,14 +6,30 @@ namespace Core.Models.Eft.Profile; public record ProfileCreateRequestData : IRequestData { [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("headId")] - public string? HeadId { get; set; } + public string? HeadId + { + get; + set; + } [JsonPropertyName("voiceId")] - public string? VoiceId { get; set; } + public string? VoiceId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/SearchFriendResponse.cs b/Libraries/Core/Models/Eft/Profile/SearchFriendResponse.cs index 24bf6168..b3051725 100644 --- a/Libraries/Core/Models/Eft/Profile/SearchFriendResponse.cs +++ b/Libraries/Core/Models/Eft/Profile/SearchFriendResponse.cs @@ -3,16 +3,28 @@ using System.Text.Json.Serialization; namespace Core.Models.Eft.Profile; /// -/// Identical to `UserDialogInfo` +/// Identical to `UserDialogInfo` /// public record SearchFriendResponse { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("Info")] - public UserDialogDetails? Info { get; set; } + public UserDialogDetails? Info + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/SearchProfilesRequestData.cs b/Libraries/Core/Models/Eft/Profile/SearchProfilesRequestData.cs index 158ae9d9..9aae3191 100644 --- a/Libraries/Core/Models/Eft/Profile/SearchProfilesRequestData.cs +++ b/Libraries/Core/Models/Eft/Profile/SearchProfilesRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Profile; public record SearchProfilesRequestData : IRequestData { [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/SptProfile.cs b/Libraries/Core/Models/Eft/Profile/SptProfile.cs index bb1451e0..42b4cc36 100644 --- a/Libraries/Core/Models/Eft/Profile/SptProfile.cs +++ b/Libraries/Core/Models/Eft/Profile/SptProfile.cs @@ -1,5 +1,5 @@ -using Core.Models.Eft.Common; using System.Text.Json.Serialization; +using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Dialog; @@ -9,446 +9,948 @@ namespace Core.Models.Eft.Profile; public record SptProfile { [JsonPropertyName("info")] - public Info? ProfileInfo { get; set; } + public Info? ProfileInfo + { + get; + set; + } [JsonPropertyName("characters")] - public Characters? CharacterData { get; set; } + public Characters? CharacterData + { + get; + set; + } - /** Clothing purchases */ + /** + * Clothing purchases + */ [JsonPropertyName("suits")] - public List? Suits { get; set; } + public List? Suits + { + get; + set; + } [JsonPropertyName("userbuilds")] - public UserBuilds? UserBuildData { get; set; } + public UserBuilds? UserBuildData + { + get; + set; + } [JsonPropertyName("dialogues")] - public Dictionary? DialogueRecords { get; set; } + public Dictionary? DialogueRecords + { + get; + set; + } [JsonPropertyName("spt")] - public Spt? SptData { get; set; } + public Spt? SptData + { + get; + set; + } [JsonPropertyName("vitality")] - public Vitality? VitalityData { get; set; } + public Vitality? VitalityData + { + get; + set; + } [JsonPropertyName("inraid")] - public Inraid? InraidData { get; set; } + public Inraid? InraidData + { + get; + set; + } [JsonPropertyName("insurance")] - public List? InsuranceList { get; set; } + public List? InsuranceList + { + get; + set; + } - /** Assort purchases made by player since last trader refresh */ + /** + * Assort purchases made by player since last trader refresh + */ [JsonPropertyName("traderPurchases")] - public Dictionary?>? TraderPurchases { get; set; } + public Dictionary?>? TraderPurchases + { + get; + set; + } - /** List of friend profile IDs */ + /** + * List of friend profile IDs + */ [JsonPropertyName("friends")] - public List? FriendProfileIds { get; set; } + public List? FriendProfileIds + { + get; + set; + } [JsonPropertyName("customisationUnlocks")] - public List? CustomisationUnlocks { get; set; } + public List? CustomisationUnlocks + { + get; + set; + } } public record TraderPurchaseData { [JsonPropertyName("count")] - public double? PurchaseCount { get; set; } + public double? PurchaseCount + { + get; + set; + } [JsonPropertyName("purchaseTimestamp")] - public long? PurchaseTimestamp { get; set; } + public long? PurchaseTimestamp + { + get; + set; + } } public record Info { - /** main profile id */ + /** + * main profile id + */ [JsonPropertyName("id")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonPropertyName("scavId")] - public string? ScavengerId { get; set; } + public string? ScavengerId + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("username")] - public string? Username { get; set; } + public string? Username + { + get; + set; + } [JsonPropertyName("password")] - public string? Password { get; set; } + public string? Password + { + get; + set; + } [JsonPropertyName("wipe")] - public bool? IsWiped { get; set; } + public bool? IsWiped + { + get; + set; + } [JsonPropertyName("edition")] - public string? Edition { get; set; } + public string? Edition + { + get; + set; + } } public record Characters { [JsonPropertyName("pmc")] - public PmcData? PmcData { get; set; } + public PmcData? PmcData + { + get; + set; + } [JsonPropertyName("scav")] - public PmcData? ScavData { get; set; } + public PmcData? ScavData + { + get; + set; + } } -/** used by profile.userbuilds */ +/** + * used by profile.userbuilds + */ public record UserBuilds { [JsonPropertyName("weaponBuilds")] - public List? WeaponBuilds { get; set; } + public List? WeaponBuilds + { + get; + set; + } [JsonPropertyName("equipmentBuilds")] - public List? EquipmentBuilds { get; set; } + public List? EquipmentBuilds + { + get; + set; + } [JsonPropertyName("magazineBuilds")] - public List? MagazineBuilds { get; set; } + public List? MagazineBuilds + { + get; + set; + } } public record UserBuild { [JsonPropertyName("Id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } } public record WeaponBuild : UserBuild { [JsonPropertyName("Root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } // Same as PMC inventory items + public List? Items + { + get; + set; + } // Same as PMC inventory items } public record EquipmentBuild : UserBuild { [JsonPropertyName("Root")] - public string? Root { get; set; } + public string? Root + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } // Same as PMC inventory items + public List? Items + { + get; + set; + } // Same as PMC inventory items [JsonPropertyName("BuildType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public EquipmentBuildType? BuildType { get; set; } + public EquipmentBuildType? BuildType + { + get; + set; + } } public record MagazineBuild : UserBuild { [JsonPropertyName("Caliber")] - public string? Caliber { get; set; } + public string? Caliber + { + get; + set; + } [JsonPropertyName("TopCount")] - public int? TopCount { get; set; } + public int? TopCount + { + get; + set; + } [JsonPropertyName("BottomCount")] - public int? BottomCount { get; set; } + public int? BottomCount + { + get; + set; + } [JsonPropertyName("Items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record MagazineTemplateAmmoItem { [JsonPropertyName("TemplateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("Count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } -/** Used by defaultEquipmentPresets.json */ +/** + * Used by defaultEquipmentPresets.json + */ public record DefaultEquipmentPreset : EquipmentBuild { [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } public record Dialogue { [JsonPropertyName("attachmentsNew")] - public int? AttachmentsNew { get; set; } + public int? AttachmentsNew + { + get; + set; + } [JsonPropertyName("new")] - public int? New { get; set; } + public int? New + { + get; + set; + } [JsonPropertyName("type")] - public MessageType? Type { get; set; } + public MessageType? Type + { + get; + set; + } [JsonPropertyName("Users")] - public List? Users { get; set; } + public List? Users + { + get; + set; + } [JsonPropertyName("pinned")] - public bool? Pinned { get; set; } + public bool? Pinned + { + get; + set; + } [JsonPropertyName("messages")] - public List? Messages { get; set; } + public List? Messages + { + get; + set; + } [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } } // @Cleanup: Maybe the same as Dialogue? public record DialogueInfo { [JsonPropertyName("attachmentsNew")] - public int? AttachmentsNew { get; set; } + public int? AttachmentsNew + { + get; + set; + } [JsonPropertyName("new")] - public int? New { get; set; } + public int? New + { + get; + set; + } [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("type")] - public MessageType? Type { get; set; } + public MessageType? Type + { + get; + set; + } [JsonPropertyName("pinned")] - public bool? Pinned { get; set; } + public bool? Pinned + { + get; + set; + } [JsonPropertyName("Users")] - public List? Users { get; set; } + public List? Users + { + get; + set; + } [JsonPropertyName("message")] - public MessagePreview? Message { get; set; } + public MessagePreview? Message + { + get; + set; + } } public record Message { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("uid")] - public string? UserId { get; set; } + public string? UserId + { + get; + set; + } [JsonPropertyName("type")] - public MessageType? MessageType { get; set; } + public MessageType? MessageType + { + get; + set; + } [JsonPropertyName("dt")] - public long? DateTime { get; set; } + public long? DateTime + { + get; + set; + } [JsonPropertyName("UtcDateTime")] - public long? UtcDateTime { get; set; } + public long? UtcDateTime + { + get; + set; + } [JsonPropertyName("Member")] - public UpdatableChatMember? Member { get; set; } + public UpdatableChatMember? Member + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("text")] - public string? Text { get; set; } + public string? Text + { + get; + set; + } [JsonPropertyName("replyTo")] - public ReplyTo? ReplyTo { get; set; } + public ReplyTo? ReplyTo + { + get; + set; + } [JsonPropertyName("hasRewards")] - public bool? HasRewards { get; set; } + public bool? HasRewards + { + get; + set; + } [JsonPropertyName("rewardCollected")] - public bool? RewardCollected { get; set; } + public bool? RewardCollected + { + get; + set; + } [JsonPropertyName("items")] - public MessageItems? Items { get; set; } + public MessageItems? Items + { + get; + set; + } [JsonPropertyName("maxStorageTime")] - public long? MaxStorageTime { get; set; } + public long? MaxStorageTime + { + get; + set; + } [JsonPropertyName("systemData")] - public SystemData? SystemData { get; set; } + public SystemData? SystemData + { + get; + set; + } [JsonPropertyName("profileChangeEvents")] - public List? ProfileChangeEvents { get; set; } + public List? ProfileChangeEvents + { + get; + set; + } } public record ReplyTo { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("uid")] - public string? UserId { get; set; } + public string? UserId + { + get; + set; + } [JsonPropertyName("type")] - public MessageType? MessageType { get; set; } + public MessageType? MessageType + { + get; + set; + } [JsonPropertyName("dt")] - public long? DateTime { get; set; } + public long? DateTime + { + get; + set; + } [JsonPropertyName("text")] - public string? Text { get; set; } + public string? Text + { + get; + set; + } } public record MessagePreview { [JsonPropertyName("uid")] - public string? UserId { get; set; } + public string? UserId + { + get; + set; + } [JsonPropertyName("type")] - public MessageType? MessageType { get; set; } + public MessageType? MessageType + { + get; + set; + } [JsonPropertyName("dt")] - public long? DateTime { get; set; } + public long? DateTime + { + get; + set; + } [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } [JsonPropertyName("text")] - public string? Text { get; set; } + public string? Text + { + get; + set; + } [JsonPropertyName("systemData")] - public SystemData? SystemData { get; set; } + public SystemData? SystemData + { + get; + set; + } } public record MessageItems { [JsonPropertyName("stash")] - public string? Stash { get; set; } + public string? Stash + { + get; + set; + } [JsonPropertyName("data")] - public List? Data { get; set; } + public List? Data + { + get; + set; + } } public record UpdatableChatMember { [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("Level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("MemberCategory")] - public MemberCategory? MemberCategory { get; set; } + public MemberCategory? MemberCategory + { + get; + set; + } [JsonPropertyName("Ignored")] - public bool? IsIgnored { get; set; } + public bool? IsIgnored + { + get; + set; + } [JsonPropertyName("Banned")] - public bool? IsBanned { get; set; } + public bool? IsBanned + { + get; + set; + } } 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 { get; set; } + public string? Version + { + get; + set; + } - /** 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 { get; set; } + public List? Mods + { + get; + set; + } - /** What gifts has this profile received and how many */ + /** + * What gifts has this profile received and how many + */ [JsonPropertyName("receivedGifts")] - public List? ReceivedGifts { get; set; } + public List? ReceivedGifts + { + get; + set; + } - /** 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 List? BlacklistedItemTemplates { get; set; } + public List? BlacklistedItemTemplates + { + get; + set; + } - /** key: daily type */ + /** + * key: daily type + */ [JsonPropertyName("freeRepeatableRefreshUsedCount")] - public Dictionary? FreeRepeatableRefreshUsedCount { get; set; } + public Dictionary? FreeRepeatableRefreshUsedCount + { + get; + set; + } - /** When was a profile migrated, value is timestamp */ + /** + * When was a profile migrated, value is timestamp + */ [JsonPropertyName("migrations")] - public Dictionary? Migrations { get; set; } + public Dictionary? Migrations + { + get; + set; + } - /** 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 { get; set; } + public Dictionary? CultistRewards + { + get; + set; + } } public record AcceptedCultistReward { [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } [JsonPropertyName("sacrificeItems")] - public List? SacrificeItems { get; set; } + public List? SacrificeItems + { + get; + set; + } [JsonPropertyName("rewardItems")] - public List? RewardItems { get; set; } + public List? RewardItems + { + get; + set; + } } public record ModDetails { [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("version")] - public string? Version { get; set; } + public string? Version + { + get; + set; + } [JsonPropertyName("author")] - public string? Author { get; set; } + public string? Author + { + get; + set; + } [JsonPropertyName("dateAdded")] - public long? DateAdded { get; set; } + public long? DateAdded + { + get; + set; + } [JsonPropertyName("url")] - public string? Url { get; set; } + public string? Url + { + get; + set; + } } public record ReceivedGift { [JsonPropertyName("giftId")] - public string? GiftId { get; set; } + public string? GiftId + { + get; + set; + } [JsonPropertyName("timestampLastAccepted")] - public long? TimestampLastAccepted { get; set; } + public long? TimestampLastAccepted + { + get; + set; + } [JsonPropertyName("current")] - public int? Current { get; set; } + public int? Current + { + get; + set; + } } public record Vitality { [JsonPropertyName("Hydration")] - public double? Hydration { get; set; } + public double? Hydration + { + get; + set; + } [JsonPropertyName("Energy")] - public double? Energy { get; set; } + public double? Energy + { + get; + set; + } [JsonPropertyName("Temperature")] - public double? Temperature { get; set; } + public double? Temperature + { + get; + set; + } [JsonPropertyName("Health")] // This now does health and effects to each bodypart - public Dictionary? Health { get; set; } + public Dictionary? Health + { + get; + set; + } } public record Inraid { [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("character")] - public string? Character { get; set; } + public string? Character + { + get; + set; + } } public record Insurance { [JsonPropertyName("scheduledTime")] - public int? ScheduledTime { get; set; } + public int? ScheduledTime + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("maxStorageTime")] - public int? MaxStorageTime { get; set; } + public int? MaxStorageTime + { + get; + set; + } [JsonPropertyName("systemData")] - public SystemData? SystemData { get; set; } + public SystemData? SystemData + { + get; + set; + } [JsonPropertyName("messageType")] - public MessageType? MessageType { get; set; } + public MessageType? MessageType + { + get; + set; + } [JsonPropertyName("messageTemplateId")] - public string? MessageTemplateId { get; set; } + public string? MessageTemplateId + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/SystemData.cs b/Libraries/Core/Models/Eft/Profile/SystemData.cs index b07fcfe1..2c441a10 100644 --- a/Libraries/Core/Models/Eft/Profile/SystemData.cs +++ b/Libraries/Core/Models/Eft/Profile/SystemData.cs @@ -5,20 +5,44 @@ namespace Core.Models.Eft.Profile; public record SystemData { [JsonPropertyName("date")] - public string? Date { get; set; } + public string? Date + { + get; + set; + } [JsonPropertyName("time")] - public string? Time { get; set; } + public string? Time + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("buyerNickname")] - public string? BuyerNickname { get; set; } + public string? BuyerNickname + { + get; + set; + } [JsonPropertyName("soldItem")] - public string? SoldItem { get; set; } + public string? SoldItem + { + get; + set; + } [JsonPropertyName("itemCount")] - public int? ItemCount { get; set; } + public int? ItemCount + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/UserDialogInfo.cs b/Libraries/Core/Models/Eft/Profile/UserDialogInfo.cs index 322250b0..7507c2ea 100644 --- a/Libraries/Core/Models/Eft/Profile/UserDialogInfo.cs +++ b/Libraries/Core/Models/Eft/Profile/UserDialogInfo.cs @@ -6,32 +6,64 @@ namespace Core.Models.Eft.Profile; public record UserDialogInfo { /// - /// _id + /// _id /// [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("Info")] - public UserDialogDetails? Info { get; set; } + public UserDialogDetails? Info + { + get; + set; + } } public record UserDialogDetails { [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("Side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("Level")] - public double? Level { get; set; } + public double? Level + { + get; + set; + } [JsonPropertyName("MemberCategory")] - public MemberCategory? MemberCategory { get; set; } + public MemberCategory? MemberCategory + { + get; + set; + } [JsonPropertyName("SelectedMemberCategory")] - public MemberCategory? SelectedMemberCategory { get; set; } + public MemberCategory? SelectedMemberCategory + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Profile/ValidateNicknameRequestData.cs b/Libraries/Core/Models/Eft/Profile/ValidateNicknameRequestData.cs index ee63a497..893b31a6 100644 --- a/Libraries/Core/Models/Eft/Profile/ValidateNicknameRequestData.cs +++ b/Libraries/Core/Models/Eft/Profile/ValidateNicknameRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Profile; public record ValidateNicknameRequestData : IRequestData { [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Quests/AcceptQuestRequestData.cs b/Libraries/Core/Models/Eft/Quests/AcceptQuestRequestData.cs index 8ec0e0a0..088966f3 100644 --- a/Libraries/Core/Models/Eft/Quests/AcceptQuestRequestData.cs +++ b/Libraries/Core/Models/Eft/Quests/AcceptQuestRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Quests; public record AcceptQuestRequestData : InventoryBaseActionRequestData { [JsonPropertyName("qid")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Quests/CompleteQuestRequestData.cs b/Libraries/Core/Models/Eft/Quests/CompleteQuestRequestData.cs index eaa90d6e..2fa8345b 100644 --- a/Libraries/Core/Models/Eft/Quests/CompleteQuestRequestData.cs +++ b/Libraries/Core/Models/Eft/Quests/CompleteQuestRequestData.cs @@ -5,10 +5,20 @@ namespace Core.Models.Eft.Quests; public record CompleteQuestRequestData : InventoryBaseActionRequestData { - /** Quest Id */ + /** + * Quest Id + */ [JsonPropertyName("qid")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } [JsonPropertyName("removeExcessItems")] - public bool? RemoveExcessItems { get; set; } + public bool? RemoveExcessItems + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Quests/FailQuestRequestData.cs b/Libraries/Core/Models/Eft/Quests/FailQuestRequestData.cs index 16f23f2b..7d2af9ab 100644 --- a/Libraries/Core/Models/Eft/Quests/FailQuestRequestData.cs +++ b/Libraries/Core/Models/Eft/Quests/FailQuestRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Quests; public record FailQuestRequestData : InventoryBaseActionRequestData { [JsonPropertyName("qid")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } [JsonPropertyName("removeExcessItems")] - public bool? RemoveExcessItems { get; set; } + public bool? RemoveExcessItems + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Quests/HandoverQuestRequestData.cs b/Libraries/Core/Models/Eft/Quests/HandoverQuestRequestData.cs index 8669280e..0f3cf9fa 100644 --- a/Libraries/Core/Models/Eft/Quests/HandoverQuestRequestData.cs +++ b/Libraries/Core/Models/Eft/Quests/HandoverQuestRequestData.cs @@ -7,11 +7,23 @@ namespace Core.Models.Eft.Quests; public record HandoverQuestRequestData : InventoryBaseActionRequestData { [JsonPropertyName("qid")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } [JsonPropertyName("conditionId")] - public string? ConditionId { get; set; } + public string? ConditionId + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Quests/ListQuestsRequestData.cs b/Libraries/Core/Models/Eft/Quests/ListQuestsRequestData.cs index d3e73c97..4586721f 100644 --- a/Libraries/Core/Models/Eft/Quests/ListQuestsRequestData.cs +++ b/Libraries/Core/Models/Eft/Quests/ListQuestsRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Quests; public record ListQuestsRequestData : IRequestData { [JsonPropertyName("completed")] - public bool? Completed { get; set; } + public bool? Completed + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Quests/RepeatableQuestChangeEvent.cs b/Libraries/Core/Models/Eft/Quests/RepeatableQuestChangeEvent.cs index 553d542b..e5f2cb27 100644 --- a/Libraries/Core/Models/Eft/Quests/RepeatableQuestChangeEvent.cs +++ b/Libraries/Core/Models/Eft/Quests/RepeatableQuestChangeEvent.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Quests; public record RepeatableQuestChangeRequest : InventoryBaseActionRequestData { [JsonPropertyName("qid")] - public string? QuestId { get; set; } + public string? QuestId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/AddOfferRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/AddOfferRequestData.cs index d0ab78b8..9bf2e5b4 100644 --- a/Libraries/Core/Models/Eft/Ragfair/AddOfferRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/AddOfferRequestData.cs @@ -6,30 +6,62 @@ namespace Core.Models.Eft.Ragfair; public record AddOfferRequestData : InventoryBaseActionRequestData { [JsonPropertyName("sellInOnePiece")] - public bool? SellInOnePiece { get; set; } + public bool? SellInOnePiece + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } } public record Requirement { [JsonPropertyName("_tpl")] - public string? Template { get; set; } + public string? Template + { + get; + set; + } // Can be decimal value [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("side")] - public int? Side { get; set; } + public int? Side + { + get; + set; + } [JsonPropertyName("onlyFunctional")] - public bool? OnlyFunctional { get; set; } + public bool? OnlyFunctional + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/ExtendOfferRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/ExtendOfferRequestData.cs index a53906d4..cb9de052 100644 --- a/Libraries/Core/Models/Eft/Ragfair/ExtendOfferRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/ExtendOfferRequestData.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Ragfair; public record ExtendOfferRequestData : InventoryBaseActionRequestData { [JsonPropertyName("offerId")] - public string? OfferId { get; set; } + public string? OfferId + { + get; + set; + } [JsonPropertyName("renewalTime")] - public long? RenewalTime { get; set; } + public long? RenewalTime + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs b/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs index e2d26202..19d41446 100644 --- a/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs +++ b/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Ragfair; public record GetItemPriceResult : MinMax { [JsonPropertyName("avg")] - public double? Avg { get; set; } + public double? Avg + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/GetMarketPriceRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/GetMarketPriceRequestData.cs index 52691bea..994e8787 100644 --- a/Libraries/Core/Models/Eft/Ragfair/GetMarketPriceRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/GetMarketPriceRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Ragfair; public record GetMarketPriceRequestData : IRequestData { [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/GetOffersResult.cs b/Libraries/Core/Models/Eft/Ragfair/GetOffersResult.cs index fa249a79..e1406c52 100644 --- a/Libraries/Core/Models/Eft/Ragfair/GetOffersResult.cs +++ b/Libraries/Core/Models/Eft/Ragfair/GetOffersResult.cs @@ -5,14 +5,30 @@ namespace Core.Models.Eft.Ragfair; public record GetOffersResult { [JsonPropertyName("categories")] - public Dictionary? Categories { get; set; } + public Dictionary? Categories + { + get; + set; + } [JsonPropertyName("offers")] - public List? Offers { get; set; } + public List? Offers + { + get; + set; + } [JsonPropertyName("offersCount")] - public int? OffersCount { get; set; } + public int? OffersCount + { + get; + set; + } [JsonPropertyName("selectedCategory")] - public string? SelectedCategory { get; set; } + public string? SelectedCategory + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/GetRagfairOfferByIdRequest.cs b/Libraries/Core/Models/Eft/Ragfair/GetRagfairOfferByIdRequest.cs index 05a42fd2..87d38ed1 100644 --- a/Libraries/Core/Models/Eft/Ragfair/GetRagfairOfferByIdRequest.cs +++ b/Libraries/Core/Models/Eft/Ragfair/GetRagfairOfferByIdRequest.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Ragfair; public record GetRagfairOfferByIdRequest { [JsonPropertyName("id")] - public int? Id { get; set; } + public int? Id + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs b/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs index 17fc9adb..130df610 100644 --- a/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs +++ b/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs @@ -6,137 +6,291 @@ namespace Core.Models.Eft.Ragfair; public record RagfairOffer { - [JsonPropertyName("sellResult")] - public List? SellResults { get; set; } - private string? _id; + + private string? _root; + + [JsonPropertyName("sellResult")] + public List? SellResults + { + get; + set; + } + [JsonPropertyName("_id")] public string? Id { - get => _id; - set => _id = string.Intern(value); + get + { + return _id; + } + set + { + _id = string.Intern(value); + } } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("requirements")] - public List? Requirements { get; set; } + public List? Requirements + { + get; + set; + } - private string? _root; [JsonPropertyName("root")] public string? Root { - get => _root; - set => _root = string.Intern(value); + get + { + return _root; + } + set + { + _root = string.Intern(value); + } } [JsonPropertyName("intId")] - public int? InternalId { get; set; } + public int? InternalId + { + get; + set; + } - /** Handbook price */ + /** + * Handbook price + */ [JsonPropertyName("itemsCost")] - public double? ItemsCost { get; set; } + public double? ItemsCost + { + get; + set; + } - /** Rouble price per item */ + /** + * Rouble price per item + */ [JsonPropertyName("requirementsCost")] - public double? RequirementsCost { get; set; } + public double? RequirementsCost + { + get; + set; + } [JsonPropertyName("startTime")] - public long? StartTime { get; set; } + public long? StartTime + { + get; + set; + } [JsonPropertyName("endTime")] - public long? EndTime { get; set; } + public long? EndTime + { + get; + set; + } - /** True when offer is sold as pack */ + /** + * True when offer is sold as pack + */ [JsonPropertyName("sellInOnePiece")] - public bool? SellInOnePiece { get; set; } + public bool? SellInOnePiece + { + get; + set; + } - /** Rouble price - same as requirementsCost */ + /** + * Rouble price - same as requirementsCost + */ [JsonPropertyName("summaryCost")] - public double? SummaryCost { get; set; } + public double? SummaryCost + { + get; + set; + } [JsonPropertyName("user")] - public RagfairOfferUser? User { get; set; } + public RagfairOfferUser? User + { + get; + set; + } - /** Trader only */ + /** + * Trader only + */ [JsonPropertyName("unlimitedCount")] - public bool? UnlimitedCount { get; set; } + public bool? UnlimitedCount + { + get; + set; + } [JsonPropertyName("loyaltyLevel")] - public int? LoyaltyLevel { get; set; } + public int? LoyaltyLevel + { + get; + set; + } [JsonPropertyName("buyRestrictionMax")] - public int? BuyRestrictionMax { get; set; } + public int? BuyRestrictionMax + { + get; + set; + } // Confirmed in client [JsonPropertyName("buyRestrictionCurrent")] - public int? BuyRestrictionCurrent { get; set; } + public int? BuyRestrictionCurrent + { + get; + set; + } [JsonPropertyName("locked")] - public bool? Locked { get; set; } + public bool? Locked + { + get; + set; + } } public record OfferRequirement { private string? _tpl; + [JsonPropertyName("_tpl")] public string? Template { - get => _tpl; - set => _tpl = string.Intern(value); + get + { + return _tpl; + } + set + { + _tpl = string.Intern(value); + } } [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } [JsonPropertyName("onlyFunctional")] - public bool? OnlyFunctional { get; set; } + public bool? OnlyFunctional + { + get; + set; + } [JsonPropertyName("level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } [JsonPropertyName("side")] - public DogtagExchangeSide? Side { get; set; } + public DogtagExchangeSide? Side + { + get; + set; + } } public record RagfairOfferUser { private string? _id; + [JsonPropertyName("id")] public string? Id { - get => _id; - set => _id = string.Intern(value); + get + { + return _id; + } + set + { + _id = string.Intern(value); + } } [JsonPropertyName("nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } [JsonPropertyName("rating")] - public double? Rating { get; set; } + public double? Rating + { + get; + set; + } [JsonPropertyName("memberType")] - public MemberCategory? MemberType { get; set; } + public MemberCategory? MemberType + { + get; + set; + } [JsonPropertyName("selectedMemberCategory")] - public MemberCategory? SelectedMemberCategory { get; set; } + public MemberCategory? SelectedMemberCategory + { + get; + set; + } [JsonPropertyName("avatar")] - public string? Avatar { get; set; } + public string? Avatar + { + get; + set; + } [JsonPropertyName("isRatingGrowing")] - public bool? IsRatingGrowing { get; set; } + public bool? IsRatingGrowing + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } } public record SellResult { [JsonPropertyName("sellTime")] - public long? SellTime { get; set; } + public long? SellTime + { + get; + set; + } [JsonPropertyName("amount")] - public int? Amount { get; set; } + public int? Amount + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/RemoveOfferRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/RemoveOfferRequestData.cs index 147042ec..deeaa7c3 100644 --- a/Libraries/Core/Models/Eft/Ragfair/RemoveOfferRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/RemoveOfferRequestData.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Ragfair; public record RemoveOfferRequestData : InventoryBaseActionRequestData { [JsonPropertyName("offerId")] - public string? OfferId { get; set; } + public string? OfferId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/SearchRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/SearchRequestData.cs index 2b8782a3..cd6ee2d9 100644 --- a/Libraries/Core/Models/Eft/Ragfair/SearchRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/SearchRequestData.cs @@ -7,76 +7,168 @@ namespace Core.Models.Eft.Ragfair; public record SearchRequestData : IRequestData { [JsonPropertyName("page")] - public int? Page { get; set; } + public int? Page + { + get; + set; + } [JsonPropertyName("limit")] - public int? Limit { get; set; } + public int? Limit + { + get; + set; + } [JsonPropertyName("sortType")] - public RagfairSort? SortType { get; set; } + public RagfairSort? SortType + { + get; + set; + } [JsonPropertyName("sortDirection")] - public int? SortDirection { get; set; } + public int? SortDirection + { + get; + set; + } [JsonPropertyName("currency")] - public int? Currency { get; set; } + public int? Currency + { + get; + set; + } [JsonPropertyName("priceFrom")] - public int? PriceFrom { get; set; } + public int? PriceFrom + { + get; + set; + } [JsonPropertyName("priceTo")] - public int? PriceTo { get; set; } + public int? PriceTo + { + get; + set; + } [JsonPropertyName("quantityFrom")] - public int? QuantityFrom { get; set; } + public int? QuantityFrom + { + get; + set; + } [JsonPropertyName("quantityTo")] - public int? QuantityTo { get; set; } + public int? QuantityTo + { + get; + set; + } [JsonPropertyName("conditionFrom")] - public int? ConditionFrom { get; set; } + public int? ConditionFrom + { + get; + set; + } [JsonPropertyName("conditionTo")] - public int? ConditionTo { get; set; } + public int? ConditionTo + { + get; + set; + } [JsonPropertyName("oneHourExpiration")] - public bool? OneHourExpiration { get; set; } + public bool? OneHourExpiration + { + get; + set; + } [JsonPropertyName("removeBartering")] - public bool? RemoveBartering { get; set; } + public bool? RemoveBartering + { + get; + set; + } [JsonPropertyName("offerOwnerType")] - public OfferOwnerType? OfferOwnerType { get; set; } + public OfferOwnerType? OfferOwnerType + { + get; + set; + } /// - /// 'Only Operational' + /// 'Only Operational' /// [JsonPropertyName("onlyFunctional")] - public bool? OnlyFunctional { get; set; } + public bool? OnlyFunctional + { + get; + set; + } [JsonPropertyName("updateOfferCount")] - public bool? UpdateOfferCount { get; set; } + public bool? UpdateOfferCount + { + get; + set; + } [JsonPropertyName("handbookId")] - public string? HandbookId { get; set; } + public string? HandbookId + { + get; + set; + } [JsonPropertyName("linkedSearchId")] - public string? LinkedSearchId { get; set; } + public string? LinkedSearchId + { + get; + set; + } [JsonPropertyName("neededSearchId")] - public string? NeededSearchId { get; set; } + public string? NeededSearchId + { + get; + set; + } [JsonPropertyName("buildItems")] - public Dictionary? BuildItems { get; set; } + public Dictionary? BuildItems + { + get; + set; + } [JsonPropertyName("buildCount")] - public int? BuildCount { get; set; } + public int? BuildCount + { + get; + set; + } [JsonPropertyName("tm")] - public int? Tm { get; set; } + public int? Tm + { + get; + set; + } [JsonPropertyName("reload")] - public int? Reload { get; set; } + public int? Reload + { + get; + set; + } } public enum OfferOwnerType diff --git a/Libraries/Core/Models/Eft/Ragfair/SendRagfairReportRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/SendRagfairReportRequestData.cs index 55c8241d..1d4d718a 100644 --- a/Libraries/Core/Models/Eft/Ragfair/SendRagfairReportRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/SendRagfairReportRequestData.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Ragfair; public record SendRagfairReportRequestData { [JsonPropertyName("offerId")] - public int? OfferId { get; set; } + public int? OfferId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ragfair/StorePlayerOfferTaxAmountRequestData.cs b/Libraries/Core/Models/Eft/Ragfair/StorePlayerOfferTaxAmountRequestData.cs index bcaed895..b8ea111a 100644 --- a/Libraries/Core/Models/Eft/Ragfair/StorePlayerOfferTaxAmountRequestData.cs +++ b/Libraries/Core/Models/Eft/Ragfair/StorePlayerOfferTaxAmountRequestData.cs @@ -6,14 +6,30 @@ namespace Core.Models.Eft.Ragfair; public record StorePlayerOfferTaxAmountRequestData : IRequestData { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("fee")] - public double? Fee { get; set; } + public double? Fee + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Repair/BaseRepairActionDataRequest.cs b/Libraries/Core/Models/Eft/Repair/BaseRepairActionDataRequest.cs index a62d1a60..ed3dc6ae 100644 --- a/Libraries/Core/Models/Eft/Repair/BaseRepairActionDataRequest.cs +++ b/Libraries/Core/Models/Eft/Repair/BaseRepairActionDataRequest.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Repair; public record BaseRepairActionDataRequest { [JsonPropertyName("Action")] - public string? Action { get; set; } + public string? Action + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Repair/RepairActionDataRequest.cs b/Libraries/Core/Models/Eft/Repair/RepairActionDataRequest.cs index 6c2458bc..5f3650dc 100644 --- a/Libraries/Core/Models/Eft/Repair/RepairActionDataRequest.cs +++ b/Libraries/Core/Models/Eft/Repair/RepairActionDataRequest.cs @@ -6,17 +6,33 @@ namespace Core.Models.Eft.Repair; public record RepairActionDataRequest : InventoryBaseActionRequestData { [JsonPropertyName("repairKitsInfo")] - public List? RepairKitsInfo { get; set; } + public List? RepairKitsInfo + { + get; + set; + } [JsonPropertyName("target")] - public string? Target { get; set; } // item to repair + public string? Target + { + get; + set; + } // item to repair } public record RepairKitsInfo { [JsonPropertyName("_id")] - public string? Id { get; set; } // id of repair kit to use + public string? Id + { + get; + set; + } // id of repair kit to use [JsonPropertyName("count")] - public int? Count { get; set; } // amount of units to reduce kit by + public int? Count + { + get; + set; + } // amount of units to reduce kit by } diff --git a/Libraries/Core/Models/Eft/Repair/TraderRepairActionDataRequest.cs b/Libraries/Core/Models/Eft/Repair/TraderRepairActionDataRequest.cs index 757d16f1..428c841d 100644 --- a/Libraries/Core/Models/Eft/Repair/TraderRepairActionDataRequest.cs +++ b/Libraries/Core/Models/Eft/Repair/TraderRepairActionDataRequest.cs @@ -6,17 +6,33 @@ namespace Core.Models.Eft.Repair; public record TraderRepairActionDataRequest : InventoryBaseActionRequestData { [JsonPropertyName("tid")] - public string? TId { get; set; } + public string? TId + { + get; + set; + } [JsonPropertyName("repairItems")] - public List? RepairItems { get; set; } + public List? RepairItems + { + get; + set; + } } public record RepairItem { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("count")] - public double? Count { get; set; } + public double? Count + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Trade/ProcessBaseTradeRequestData.cs b/Libraries/Core/Models/Eft/Trade/ProcessBaseTradeRequestData.cs index 480acca2..2edbc729 100644 --- a/Libraries/Core/Models/Eft/Trade/ProcessBaseTradeRequestData.cs +++ b/Libraries/Core/Models/Eft/Trade/ProcessBaseTradeRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Trade; @@ -7,8 +6,16 @@ namespace Core.Models.Eft.Trade; public record ProcessBaseTradeRequestData : InventoryBaseActionRequestData { [JsonPropertyName("type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("tid")] - public string? TransactionId { get; set; } + public string? TransactionId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs b/Libraries/Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs index f803837c..a9f52546 100644 --- a/Libraries/Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs +++ b/Libraries/Core/Models/Eft/Trade/ProcessBuyTradeRequestData.cs @@ -1,19 +1,35 @@ -using Core.Models.Common; using System.Text.Json.Serialization; +using Core.Models.Common; namespace Core.Models.Eft.Trade; public record ProcessBuyTradeRequestData : ProcessBaseTradeRequestData { [JsonPropertyName("item_id")] - public string? ItemId { get; set; } + public string? ItemId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("scheme_id")] - public int? SchemeId { get; set; } + public int? SchemeId + { + get; + set; + } [JsonPropertyName("scheme_items")] - public List? SchemeItems { get; set; } + public List? SchemeItems + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Trade/ProcessRagfairTradeRequestData.cs b/Libraries/Core/Models/Eft/Trade/ProcessRagfairTradeRequestData.cs index 14d06395..baa92f3e 100644 --- a/Libraries/Core/Models/Eft/Trade/ProcessRagfairTradeRequestData.cs +++ b/Libraries/Core/Models/Eft/Trade/ProcessRagfairTradeRequestData.cs @@ -7,17 +7,33 @@ namespace Core.Models.Eft.Trade; public record ProcessRagfairTradeRequestData : InventoryBaseActionRequestData { [JsonPropertyName("offers")] - public List? Offers { get; set; } + public List? Offers + { + get; + set; + } } public record OfferRequest { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Trade/ProcessSellTradeRequestData.cs b/Libraries/Core/Models/Eft/Trade/ProcessSellTradeRequestData.cs index d0a23ba5..6fe78bf6 100644 --- a/Libraries/Core/Models/Eft/Trade/ProcessSellTradeRequestData.cs +++ b/Libraries/Core/Models/Eft/Trade/ProcessSellTradeRequestData.cs @@ -5,20 +5,40 @@ namespace Core.Models.Eft.Trade; public record ProcessSellTradeRequestData : ProcessBaseTradeRequestData { [JsonPropertyName("price")] - public double? Price { get; set; } + public double? Price + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } public record SoldItem { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("scheme_id")] - public int? SchemeId { get; set; } + public int? SchemeId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Trade/SellScavItemsToFenceRequestData.cs b/Libraries/Core/Models/Eft/Trade/SellScavItemsToFenceRequestData.cs index 604e54c1..18133f18 100644 --- a/Libraries/Core/Models/Eft/Trade/SellScavItemsToFenceRequestData.cs +++ b/Libraries/Core/Models/Eft/Trade/SellScavItemsToFenceRequestData.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common.Request; using Core.Models.Eft.Inventory; namespace Core.Models.Eft.Trade; @@ -7,5 +6,9 @@ namespace Core.Models.Eft.Trade; public record SellScavItemsToFenceRequestData : InventoryBaseActionRequestData { [JsonPropertyName("totalValue")] - public double? TotalValue { get; set; } + public double? TotalValue + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Weather/WeatherData.cs b/Libraries/Core/Models/Eft/Weather/WeatherData.cs index 312a1b59..420e92b0 100644 --- a/Libraries/Core/Models/Eft/Weather/WeatherData.cs +++ b/Libraries/Core/Models/Eft/Weather/WeatherData.cs @@ -6,61 +6,144 @@ namespace Core.Models.Eft.Weather; public record WeatherData { [JsonPropertyName("acceleration")] - public double? Acceleration { get; set; } + public double? Acceleration + { + get; + set; + } [JsonPropertyName("time")] - public string? Time { get; set; } + public string? Time + { + get; + set; + } [JsonPropertyName("date")] - public string? Date { get; set; } + public string? Date + { + get; + set; + } [JsonPropertyName("weather")] - public Weather? Weather { get; set; } + public Weather? Weather + { + get; + set; + } [JsonPropertyName("season")] - public Season? Season { get; set; } + public Season? Season + { + get; + set; + } } public record Weather { [JsonPropertyName("pressure")] - public double? Pressure { get; set; } + public double? Pressure + { + get; + set; + } [JsonPropertyName("temp")] - public double? Temperature { get; set; } + public double? Temperature + { + get; + set; + } [JsonPropertyName("fog")] - public double? Fog { get; set; } + public double? Fog + { + get; + set; + } [JsonPropertyName("rain_intensity")] - public double? RainIntensity { get; set; } + public double? RainIntensity + { + get; + set; + } - /** 1 - 3 light rain, 3+ 'rain' */ + /** + * 1 - 3 light rain, 3+ 'rain' + */ [JsonPropertyName("rain")] - public double? Rain { get; set; } + public double? Rain + { + get; + set; + } [JsonPropertyName("wind_gustiness")] - public double? WindGustiness { get; set; } + public double? WindGustiness + { + get; + set; + } [JsonPropertyName("wind_direction")] - public WindDirection? WindDirection { get; set; } + public WindDirection? WindDirection + { + get; + set; + } [JsonPropertyName("wind_speed")] - public double? WindSpeed { get; set; } + public double? WindSpeed + { + get; + set; + } - /** < -0.4 = clear day */ + /** + * < + * - + * 0 + * . + * 4 + * = + * clear + * day + */ [JsonPropertyName("cloud")] - public double? Cloud { get; set; } + public double? Cloud + { + get; + set; + } [JsonPropertyName("time")] - public string? Time { get; set; } + public string? Time + { + get; + set; + } [JsonPropertyName("date")] - public string? Date { get; set; } + public string? Date + { + get; + set; + } [JsonPropertyName("timestamp")] - public long? Timestamp { get; set; } + public long? Timestamp + { + get; + set; + } [JsonPropertyName("sptInRaidTimestamp")] - public long? SptInRaidTimestamp { get; set; } + public long? SptInRaidTimestamp + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Wishlist/AddToWishlistRequest.cs b/Libraries/Core/Models/Eft/Wishlist/AddToWishlistRequest.cs index 1541ab98..555e8d08 100644 --- a/Libraries/Core/Models/Eft/Wishlist/AddToWishlistRequest.cs +++ b/Libraries/Core/Models/Eft/Wishlist/AddToWishlistRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Wishlist; public record AddToWishlistRequest : InventoryBaseActionRequestData { [JsonPropertyName("items")] - public Dictionary? Items { get; set; } + public Dictionary? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Wishlist/ChangeWishlistItemCategoryRequest.cs b/Libraries/Core/Models/Eft/Wishlist/ChangeWishlistItemCategoryRequest.cs index 4e1ec30a..b7b214d3 100644 --- a/Libraries/Core/Models/Eft/Wishlist/ChangeWishlistItemCategoryRequest.cs +++ b/Libraries/Core/Models/Eft/Wishlist/ChangeWishlistItemCategoryRequest.cs @@ -6,8 +6,16 @@ namespace Core.Models.Eft.Wishlist; public record ChangeWishlistItemCategoryRequest : InventoryBaseActionRequestData { [JsonPropertyName("item")] - public string? Item { get; set; } + public string? Item + { + get; + set; + } [JsonPropertyName("category")] - public int? Category { get; set; } + public int? Category + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Wishlist/RemoveFromWishlistRequest.cs b/Libraries/Core/Models/Eft/Wishlist/RemoveFromWishlistRequest.cs index 6fdd09f1..60ae6831 100644 --- a/Libraries/Core/Models/Eft/Wishlist/RemoveFromWishlistRequest.cs +++ b/Libraries/Core/Models/Eft/Wishlist/RemoveFromWishlistRequest.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Wishlist; public record RemoveFromWishlistRequest : InventoryBaseActionRequestData { [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsAid.cs b/Libraries/Core/Models/Eft/Ws/WsAid.cs index 05105959..76fbc440 100644 --- a/Libraries/Core/Models/Eft/Ws/WsAid.cs +++ b/Libraries/Core/Models/Eft/Ws/WsAid.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Ws; public record WsAid : WsNotificationEvent { [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsAidNickname.cs b/Libraries/Core/Models/Eft/Ws/WsAidNickname.cs index c61d3e3a..688fdb77 100644 --- a/Libraries/Core/Models/Eft/Ws/WsAidNickname.cs +++ b/Libraries/Core/Models/Eft/Ws/WsAidNickname.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Ws; public record WsAidNickname : WsNotificationEvent { [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsChatMessageReceived.cs b/Libraries/Core/Models/Eft/Ws/WsChatMessageReceived.cs index 77367e14..3e1333af 100644 --- a/Libraries/Core/Models/Eft/Ws/WsChatMessageReceived.cs +++ b/Libraries/Core/Models/Eft/Ws/WsChatMessageReceived.cs @@ -7,11 +7,23 @@ namespace Core.Models.Eft.Ws; public record WsChatMessageReceived : WsNotificationEvent { [JsonPropertyName("dialogId")] - public string? DialogId { get; set; } + public string? DialogId + { + get; + set; + } [JsonPropertyName("message")] - public Message? Message { get; set; } + public Message? Message + { + get; + set; + } [JsonPropertyName("profiles")] - public List? Profiles { get; set; } + public List? Profiles + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsFriendListAccept.cs b/Libraries/Core/Models/Eft/Ws/WsFriendListAccept.cs index 7dbe7336..1183f918 100644 --- a/Libraries/Core/Models/Eft/Ws/WsFriendListAccept.cs +++ b/Libraries/Core/Models/Eft/Ws/WsFriendListAccept.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Ws; public record WsFriendsListAccept : WsNotificationEvent { [JsonPropertyName("profile")] - public SearchFriendResponse? Profile { get; set; } + public SearchFriendResponse? Profile + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupId.cs b/Libraries/Core/Models/Eft/Ws/WsGroupId.cs index 2721a201..b30cede4 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupId.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupId.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Ws; public record WsGroupId : WsNotificationEvent { [JsonPropertyName("groupId")] - public string? GroupId { get; set; } + public string? GroupId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs b/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs index f3522267..54df6654 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs @@ -7,26 +7,58 @@ public record WsGroupMatchInviteAccept : WsNotificationEvent // TODO: trying to { // Copy pasted properties from GroupCharacter to resolve multitype [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("Info")] - public CharacterInfo? Info { get; set; } + public CharacterInfo? Info + { + get; + set; + } [JsonPropertyName("PlayerVisualRepresentation")] - public PlayerVisualRepresentation? VisualRepresentation { get; set; } + public PlayerVisualRepresentation? VisualRepresentation + { + get; + set; + } [JsonPropertyName("isLeader")] - public bool? IsLeader { get; set; } + public bool? IsLeader + { + get; + set; + } [JsonPropertyName("isReady")] - public bool? IsReady { get; set; } + public bool? IsReady + { + get; + set; + } [JsonPropertyName("region")] - public string? Region { get; set; } + public string? Region + { + get; + set; + } [JsonPropertyName("lookingGroup")] - public bool? LookingGroup { get; set; } + public bool? LookingGroup + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteDecline.cs b/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteDecline.cs index 1d0045b7..b08b571c 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteDecline.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteDecline.cs @@ -5,8 +5,16 @@ namespace Core.Models.Eft.Ws; public record WsGroupMatchInviteDecline : WsNotificationEvent { [JsonPropertyName("aid")] - public int? Aid { get; set; } + public int? Aid + { + get; + set; + } [JsonPropertyName("Nickname")] - public string? Nickname { get; set; } + public string? Nickname + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteSend.cs b/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteSend.cs index 7b7e2071..a3fa4f45 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteSend.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupMatchInviteSend.cs @@ -6,11 +6,23 @@ namespace Core.Models.Eft.Ws; public record WsGroupMatchInviteSend : WsNotificationEvent { [JsonPropertyName("requestId")] - public string? RequestId { get; set; } + public string? RequestId + { + get; + set; + } [JsonPropertyName("from")] - public int? From { get; set; } + public int? From + { + get; + set; + } [JsonPropertyName("members")] - public List? Members { get; set; } + public List? Members + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupMatchLeaderChanged.cs b/Libraries/Core/Models/Eft/Ws/WsGroupMatchLeaderChanged.cs index 04a91fba..f985c067 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupMatchLeaderChanged.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupMatchLeaderChanged.cs @@ -5,5 +5,9 @@ namespace Core.Models.Eft.Ws; public record WsGroupMatchLeaderChanged : WsNotificationEvent { [JsonPropertyName("owner")] - public int? Owner { get; set; } + public int? Owner + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidReady.cs b/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidReady.cs index bec93785..e8b07bf8 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidReady.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidReady.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Ws; public record WsGroupMatchRaidReady : WsNotificationEvent { [JsonPropertyName("extendedProfile")] - public GroupCharacter? ExtendedProfile { get; set; } + public GroupCharacter? ExtendedProfile + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidSettings.cs b/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidSettings.cs index 2ddd0c04..d94380d1 100644 --- a/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidSettings.cs +++ b/Libraries/Core/Models/Eft/Ws/WsGroupMatchRaidSettings.cs @@ -6,5 +6,9 @@ namespace Core.Models.Eft.Ws; public record WsGroupMatchRaidSettings : WsNotificationEvent { [JsonPropertyName("raidSettings")] - public RaidSettings? RaidSettings { get; set; } + public RaidSettings? RaidSettings + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsNotificationEvent.cs b/Libraries/Core/Models/Eft/Ws/WsNotificationEvent.cs index c52b7345..5741a16c 100644 --- a/Libraries/Core/Models/Eft/Ws/WsNotificationEvent.cs +++ b/Libraries/Core/Models/Eft/Ws/WsNotificationEvent.cs @@ -6,8 +6,16 @@ public record WsNotificationEvent { [JsonPropertyName("type")] [JsonConverter(typeof(JsonStringEnumConverter))] - public NotificationEventType? EventType { get; set; } + public NotificationEventType? EventType + { + get; + set; + } [JsonPropertyName("eventId")] - public string? EventIdentifier { get; set; } + public string? EventIdentifier + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsRagfairOfferSold.cs b/Libraries/Core/Models/Eft/Ws/WsRagfairOfferSold.cs index 72dfce9c..b223e16a 100644 --- a/Libraries/Core/Models/Eft/Ws/WsRagfairOfferSold.cs +++ b/Libraries/Core/Models/Eft/Ws/WsRagfairOfferSold.cs @@ -5,11 +5,23 @@ namespace Core.Models.Eft.Ws; public record WsRagfairOfferSold : WsNotificationEvent { [JsonPropertyName("offerId")] - public string? OfferId { get; set; } + public string? OfferId + { + get; + set; + } [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } [JsonPropertyName("handbookId")] - public string? HandbookId { get; set; } + public string? HandbookId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Eft/Ws/WsUserConfirmed.cs b/Libraries/Core/Models/Eft/Ws/WsUserConfirmed.cs index 97e94a26..41a57079 100644 --- a/Libraries/Core/Models/Eft/Ws/WsUserConfirmed.cs +++ b/Libraries/Core/Models/Eft/Ws/WsUserConfirmed.cs @@ -6,38 +6,86 @@ namespace Core.Models.Eft.Ws; public record WsUserConfirmed : WsNotificationEvent { [JsonPropertyName("profileid")] - public string? ProfileId { get; set; } + public string? ProfileId + { + get; + set; + } [JsonPropertyName("profileToken")] - public string? ProfileToken { get; set; } + public string? ProfileToken + { + get; + set; + } [JsonPropertyName("status")] - public ProfileStatus? Status { get; set; } + public ProfileStatus? Status + { + get; + set; + } [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } [JsonPropertyName("sid")] - public string? Sid { get; set; } + public string? Sid + { + get; + set; + } [JsonPropertyName("version")] - public string? Version { get; set; } + public string? Version + { + get; + set; + } [JsonPropertyName("location")] - public string? Location { get; set; } + public string? Location + { + get; + set; + } [JsonPropertyName("raidMode")] - public RaidMode? RaidMode { get; set; } + public RaidMode? RaidMode + { + get; + set; + } [JsonPropertyName("mode")] - public string? Mode { get; set; } + public string? Mode + { + get; + set; + } [JsonPropertyName("shortId")] - public string? ShortId { get; set; } + public string? ShortId + { + get; + set; + } [JsonPropertyName("additional_info")] - public List? AdditionalInfo { get; set; } // TODO: Was `any` in the node server. + public List? AdditionalInfo + { + get; + set; + } // TODO: Was `any` in the node server. } diff --git a/Libraries/Core/Models/Enums/ItemTpl.cs b/Libraries/Core/Models/Enums/ItemTpl.cs index dbe3e289..6dd04074 100644 --- a/Libraries/Core/Models/Enums/ItemTpl.cs +++ b/Libraries/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/Core/Models/Enums/ModSpawn.cs b/Libraries/Core/Models/Enums/ModSpawn.cs index b647dffa..24635c1b 100644 --- a/Libraries/Core/Models/Enums/ModSpawn.cs +++ b/Libraries/Core/Models/Enums/ModSpawn.cs @@ -2,12 +2,18 @@ namespace Core.Models.Enums; public enum ModSpawn { - /** Chosen mod should be the tpl from the default weapon template */ + /** + * Chosen mod should be the tpl from the default weapon template + */ DEFAULT_MOD = 0, - /** Normal behaviour */ + /** + * Normal behaviour + */ SPAWN = 1, - /** Item should not be chosen */ + /** + * Item should not be chosen + */ SKIP = 2 } diff --git a/Libraries/Core/Models/Enums/Traders.cs b/Libraries/Core/Models/Enums/Traders.cs index 9bfef9d6..89b37004 100644 --- a/Libraries/Core/Models/Enums/Traders.cs +++ b/Libraries/Core/Models/Enums/Traders.cs @@ -14,7 +14,11 @@ public static class Traders public const string BTR = "656f0f98d80a697f855d34b1"; public const string REF = "6617beeaa9cfa777ca915b7c"; - public static Dictionary TradersDictionary { get; set; } = new() + public static Dictionary TradersDictionary + { + get; + set; + } = new() { { TradersEnum.Prapor, "54cb50c76803fa8b248b4571" }, { TradersEnum.Therapist, "54cb57776803fa99248b456e" }, diff --git a/Libraries/Core/Models/Enums/Weapons.cs b/Libraries/Core/Models/Enums/Weapons.cs index 2952a87d..f7384764 100644 --- a/Libraries/Core/Models/Enums/Weapons.cs +++ b/Libraries/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/Core/Models/Spt/Bots/BotGenerationDetails.cs b/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs index 713a14a5..4123d629 100644 --- a/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs +++ b/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs @@ -6,71 +6,123 @@ namespace Core.Models.Spt.Bots; public record BotGenerationDetails { /// - /// Should the bot be generated as a PMC + /// Should the bot be generated as a PMC /// [JsonPropertyName("isPmc")] - public bool? IsPmc { get; set; } + public bool? IsPmc + { + get; + set; + } /// - /// assault/pmcBot etc + /// assault/pmcBot etc /// [JsonPropertyName("role")] - public string? Role { get; set; } + public string? Role + { + get; + set; + } /// - /// Side of bot + /// Side of bot /// [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } /// - /// Active players current level + /// Active players current level /// [JsonPropertyName("playerLevel")] - public double? PlayerLevel { get; set; } + public double? PlayerLevel + { + get; + set; + } [JsonPropertyName("playerName")] - public string? PlayerName { get; set; } + public string? PlayerName + { + get; + set; + } /// - /// Level specific overrides for PMC level + /// Level specific overrides for PMC level /// [JsonPropertyName("locationSpecificPmcLevelOverride")] - public MinMax? LocationSpecificPmcLevelOverride { get; set; } + public MinMax? LocationSpecificPmcLevelOverride + { + get; + set; + } /// - /// Delta of highest level of bot e.g. 50 means 50 levels above player + /// Delta of highest level of bot e.g. 50 means 50 levels above player /// [JsonPropertyName("botRelativeLevelDeltaMax")] - public double? BotRelativeLevelDeltaMax { get; set; } + public double? BotRelativeLevelDeltaMax + { + get; + set; + } /// - /// Delta of lowest level of bot e.g. 50 means 50 levels below player + /// Delta of lowest level of bot e.g. 50 means 50 levels below player /// [JsonPropertyName("botRelativeLevelDeltaMin")] - public double? BotRelativeLevelDeltaMin { get; set; } + public double? BotRelativeLevelDeltaMin + { + get; + set; + } /// - /// How many to create and store + /// How many to create and store /// [JsonPropertyName("botCountToGenerate")] - public int? BotCountToGenerate { get; set; } + public int? BotCountToGenerate + { + get; + set; + } /// - /// Desired difficulty of the bot + /// Desired difficulty of the bot /// [JsonPropertyName("botDifficulty")] - public string? BotDifficulty { get; set; } + public string? BotDifficulty + { + get; + set; + } /// - /// Will the generated bot be a player scav + /// Will the generated bot be a player scav /// [JsonPropertyName("isPlayerScav")] - public bool? IsPlayerScav { get; set; } + public bool? IsPlayerScav + { + get; + set; + } [JsonPropertyName("eventRole")] - public string? EventRole { get; set; } + public string? EventRole + { + get; + set; + } [JsonPropertyName("allPmcsHaveSameNameAsPlayer")] - public bool? AllPmcsHaveSameNameAsPlayer { get; set; } + public bool? AllPmcsHaveSameNameAsPlayer + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/BotLootCache.cs b/Libraries/Core/Models/Spt/Bots/BotLootCache.cs index 872dc72b..7cab55c0 100644 --- a/Libraries/Core/Models/Spt/Bots/BotLootCache.cs +++ b/Libraries/Core/Models/Spt/Bots/BotLootCache.cs @@ -5,43 +5,95 @@ namespace Core.Models.Spt.Bots; public record BotLootCache { [JsonPropertyName("backpackLoot")] - public Dictionary? BackpackLoot { get; set; } + public Dictionary? BackpackLoot + { + get; + set; + } [JsonPropertyName("pocketLoot")] - public Dictionary? PocketLoot { get; set; } + public Dictionary? PocketLoot + { + get; + set; + } [JsonPropertyName("vestLoot")] - public Dictionary? VestLoot { get; set; } + public Dictionary? VestLoot + { + get; + set; + } [JsonPropertyName("secureLoot")] - public Dictionary? SecureLoot { get; set; } + public Dictionary? SecureLoot + { + get; + set; + } [JsonPropertyName("combinedPoolLoot")] - public Dictionary? CombinedPoolLoot { get; set; } + public Dictionary? CombinedPoolLoot + { + get; + set; + } [JsonPropertyName("specialItems")] - public Dictionary? SpecialItems { get; set; } + public Dictionary? SpecialItems + { + get; + set; + } [JsonPropertyName("healingItems")] - public Dictionary? HealingItems { get; set; } + public Dictionary? HealingItems + { + get; + set; + } [JsonPropertyName("drugItems")] - public Dictionary? DrugItems { get; set; } + public Dictionary? DrugItems + { + get; + set; + } [JsonPropertyName("foodItems")] - public Dictionary? FoodItems { get; set; } + public Dictionary? FoodItems + { + get; + set; + } [JsonPropertyName("drinkItems")] - public Dictionary? DrinkItems { get; set; } + public Dictionary? DrinkItems + { + get; + set; + } [JsonPropertyName("currencyItems")] - public Dictionary? CurrencyItems { get; set; } + public Dictionary? CurrencyItems + { + get; + set; + } [JsonPropertyName("stimItems")] - public Dictionary? StimItems { get; set; } + public Dictionary? StimItems + { + get; + set; + } [JsonPropertyName("grenadeItems")] - public Dictionary? GrenadeItems { get; set; } + public Dictionary? GrenadeItems + { + get; + set; + } } public record LootCacheType diff --git a/Libraries/Core/Models/Spt/Bots/Bots.cs b/Libraries/Core/Models/Spt/Bots/Bots.cs index e782d1fb..b6d867a2 100644 --- a/Libraries/Core/Models/Spt/Bots/Bots.cs +++ b/Libraries/Core/Models/Spt/Bots/Bots.cs @@ -6,11 +6,23 @@ namespace Core.Models.Spt.Bots; public record Bots { [JsonPropertyName("types")] - public Dictionary? Types { get; set; } + public Dictionary? Types + { + get; + set; + } [JsonPropertyName("base")] - public BotBase? Base { get; set; } + public BotBase? Base + { + get; + set; + } [JsonPropertyName("core")] - public Dictionary? Core { get; set; } + public Dictionary? Core + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/ChooseRandomCompatibleModResult.cs b/Libraries/Core/Models/Spt/Bots/ChooseRandomCompatibleModResult.cs index 4cb03eb2..d946d00c 100644 --- a/Libraries/Core/Models/Spt/Bots/ChooseRandomCompatibleModResult.cs +++ b/Libraries/Core/Models/Spt/Bots/ChooseRandomCompatibleModResult.cs @@ -5,17 +5,37 @@ namespace Core.Models.Spt.Bots; public record ChooseRandomCompatibleModResult { [JsonPropertyName("incompatible")] - public bool? Incompatible { get; set; } + public bool? Incompatible + { + get; + set; + } [JsonPropertyName("found")] - public bool? Found { get; set; } + public bool? Found + { + get; + set; + } [JsonPropertyName("chosenTpl")] - public string? ChosenTemplate { get; set; } + public string? ChosenTemplate + { + get; + set; + } [JsonPropertyName("reason")] - public string? Reason { get; set; } + public string? Reason + { + get; + set; + } [JsonPropertyName("slotBlocked")] - public bool? SlotBlocked { get; set; } + public bool? SlotBlocked + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/FilterPlateModsForSlotByLevelResult.cs b/Libraries/Core/Models/Spt/Bots/FilterPlateModsForSlotByLevelResult.cs index 899f6872..c2c81a5c 100644 --- a/Libraries/Core/Models/Spt/Bots/FilterPlateModsForSlotByLevelResult.cs +++ b/Libraries/Core/Models/Spt/Bots/FilterPlateModsForSlotByLevelResult.cs @@ -5,10 +5,18 @@ namespace Core.Models.Spt.Bots; public record FilterPlateModsForSlotByLevelResult { [JsonPropertyName("result")] - public Result? Result { get; set; } + public Result? Result + { + get; + set; + } [JsonPropertyName("plateModTpls")] - public HashSet? PlateModTemplates { get; set; } + public HashSet? PlateModTemplates + { + get; + set; + } } public enum Result diff --git a/Libraries/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs b/Libraries/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs index cd4c8b2d..f8e58362 100644 --- a/Libraries/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs +++ b/Libraries/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs @@ -8,50 +8,90 @@ namespace Core.Models.Spt.Bots; public record GenerateEquipmentProperties { /// - /// Root Slot being generated + /// Root Slot being generated /// [JsonPropertyName("rootEquipmentSlot")] - public EquipmentSlots RootEquipmentSlot { get; set; } + public EquipmentSlots RootEquipmentSlot + { + get; + set; + } /// - /// Equipment pool for root slot being generated + /// Equipment pool for root slot being generated /// [JsonPropertyName("rootEquipmentPool")] - public Dictionary? RootEquipmentPool { get; set; } + public Dictionary? RootEquipmentPool + { + get; + set; + } [JsonPropertyName("modPool")] - public GlobalMods? ModPool { get; set; } + public GlobalMods? ModPool + { + get; + set; + } /// - /// Dictionary of mod items and their chance to spawn for this bot type + /// Dictionary of mod items and their chance to spawn for this bot type /// [JsonPropertyName("spawnChances")] - public Chances? SpawnChances { get; set; } + public Chances? SpawnChances + { + get; + set; + } /// - /// Bot-specific properties + /// Bot-specific properties /// [JsonPropertyName("botData")] - public BotData? BotData { get; set; } + public BotData? BotData + { + get; + set; + } [JsonPropertyName("inventory")] - public BotBaseInventory? Inventory { get; set; } + public BotBaseInventory? Inventory + { + get; + set; + } [JsonPropertyName("botEquipmentConfig")] - public EquipmentFilters? BotEquipmentConfig { get; set; } + public EquipmentFilters? BotEquipmentConfig + { + get; + set; + } /// - /// Settings from bot.json to adjust how item is generated + /// Settings from bot.json to adjust how item is generated /// [JsonPropertyName("randomisationDetails")] - public RandomisationDetails? RandomisationDetails { get; set; } + public RandomisationDetails? RandomisationDetails + { + get; + set; + } /// - /// OPTIONAL - Do not generate mods for tpls in this array + /// OPTIONAL - Do not generate mods for tpls in this array /// [JsonPropertyName("generateModsBlacklist")] - public List? GenerateModsBlacklist { get; set; } + public List? GenerateModsBlacklist + { + get; + set; + } [JsonPropertyName("generatingPlayerLevel")] - public double? GeneratingPlayerLevel { get; set; } + public double? GeneratingPlayerLevel + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/GenerateWeaponRequest.cs b/Libraries/Core/Models/Spt/Bots/GenerateWeaponRequest.cs index a1fef553..84a8f157 100644 --- a/Libraries/Core/Models/Spt/Bots/GenerateWeaponRequest.cs +++ b/Libraries/Core/Models/Spt/Bots/GenerateWeaponRequest.cs @@ -5,97 +5,215 @@ namespace 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 { get; set; } + public List? Weapon + { + get; + set; + } - /** Pool of compatible mods to attach to weapon */ + /** + * Pool of compatible mods to attach to weapon + */ [JsonPropertyName("modPool")] - public GlobalMods? ModPool { get; set; } + public GlobalMods? ModPool + { + get; + set; + } - /** ParentId of weapon */ + /** + * ParentId of weapon + */ [JsonPropertyName("weaponId")] - public string? WeaponId { get; set; } + public string? WeaponId + { + get; + set; + } - /** Weapon which mods will be generated on */ + /** + * Weapon which mods will be generated on + */ [JsonPropertyName("parentTemplate")] - public TemplateItem? ParentTemplate { get; set; } + public TemplateItem? ParentTemplate + { + get; + set; + } - /** Chance values mod will be added */ + /** + * Chance values mod will be added + */ [JsonPropertyName("modSpawnChances")] - public Dictionary? ModSpawnChances { get; set; } + public Dictionary? ModSpawnChances + { + get; + set; + } - /** Ammo tpl to use when generating magazines/cartridges */ + /** + * Ammo tpl to use when generating magazines/cartridges + */ [JsonPropertyName("ammoTpl")] - public string? AmmoTpl { get; set; } + public string? AmmoTpl + { + get; + set; + } - /** Bot-specific properties */ + /** + * Bot-specific properties + */ [JsonPropertyName("botData")] - public BotData? BotData { get; set; } + public BotData? BotData + { + get; + set; + } - /** limits placed on certain mod types per gun */ + /** + * limits placed on certain mod types per gun + */ [JsonPropertyName("modLimits")] - public BotModLimits? ModLimits { get; set; } + public BotModLimits? ModLimits + { + get; + set; + } - /** Info related to the weapon being generated */ + /** + * Info related to the weapon being generated + */ [JsonPropertyName("weaponStats")] - public WeaponStats? WeaponStats { get; set; } + public WeaponStats? WeaponStats + { + get; + set; + } - /** Array of item tpls the weapon does not support */ + /** + * Array of item tpls the weapon does not support + */ [JsonPropertyName("conflictingItemTpls")] - public HashSet? ConflictingItemTpls { get; set; } + public HashSet? ConflictingItemTpls + { + get; + set; + } } public record BotData { - /** Role of bot weapon is generated for */ + /** + * Role of bot weapon is generated for + */ [JsonPropertyName("role")] - public string? Role { get; set; } + public string? Role + { + get; + set; + } - /** Level of the bot weapon is being generated for */ + /** + * Level of the bot weapon is being generated for + */ [JsonPropertyName("level")] - public int? Level { get; set; } + public int? Level + { + get; + set; + } - /** 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 { get; set; } + public string? EquipmentRole + { + get; + set; + } } public record WeaponStats { [JsonPropertyName("hasOptic")] - public bool? HasOptic { get; set; } + public bool? HasOptic + { + get; + set; + } [JsonPropertyName("hasFrontIronSight")] - public bool? HasFrontIronSight { get; set; } + public bool? HasFrontIronSight + { + get; + set; + } [JsonPropertyName("hasRearIronSight")] - public bool? HasRearIronSight { get; set; } + public bool? HasRearIronSight + { + get; + set; + } } public record BotModLimits { [JsonPropertyName("scope")] - public ItemCount? Scope { get; set; } + public ItemCount? Scope + { + get; + set; + } [JsonPropertyName("scopeMax")] - public int? ScopeMax { get; set; } + public int? ScopeMax + { + get; + set; + } [JsonPropertyName("scopeBaseTypes")] - public List? ScopeBaseTypes { get; set; } + public List? ScopeBaseTypes + { + get; + set; + } [JsonPropertyName("flashlightLaser")] - public ItemCount? FlashlightLaser { get; set; } + public ItemCount? FlashlightLaser + { + get; + set; + } [JsonPropertyName("flashlightLaserMax")] - public int? FlashlightLaserMax { get; set; } + public int? FlashlightLaserMax + { + get; + set; + } [JsonPropertyName("flashlightLaserBaseTypes")] - public List? FlashlightLaserBaseTypes { get; set; } + public List? FlashlightLaserBaseTypes + { + get; + set; + } } public record ItemCount { [JsonPropertyName("count")] - public int? Count { get; set; } + public int? Count + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/GenerateWeaponResult.cs b/Libraries/Core/Models/Spt/Bots/GenerateWeaponResult.cs index a12fa48f..804b04d1 100644 --- a/Libraries/Core/Models/Spt/Bots/GenerateWeaponResult.cs +++ b/Libraries/Core/Models/Spt/Bots/GenerateWeaponResult.cs @@ -6,17 +6,37 @@ namespace Core.Models.Spt.Bots; public record GenerateWeaponResult { [JsonPropertyName("weapon")] - public List? Weapon { get; set; } + public List? Weapon + { + get; + set; + } [JsonPropertyName("chosenAmmoTpl")] - public string? ChosenAmmoTemplate { get; set; } + public string? ChosenAmmoTemplate + { + get; + set; + } [JsonPropertyName("chosenUbglAmmoTpl")] - public string? ChosenUbglAmmoTemplate { get; set; } + public string? ChosenUbglAmmoTemplate + { + get; + set; + } [JsonPropertyName("weaponMods")] - public GlobalMods? WeaponMods { get; set; } + public GlobalMods? WeaponMods + { + get; + set; + } [JsonPropertyName("weaponTemplate")] - public TemplateItem? WeaponTemplate { get; set; } + public TemplateItem? WeaponTemplate + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs b/Libraries/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs index 5919c6be..a82c9814 100644 --- a/Libraries/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs +++ b/Libraries/Core/Models/Spt/Bots/ItemSpawnLimitSettings.cs @@ -5,8 +5,16 @@ namespace Core.Models.Spt.Bots; public record ItemSpawnLimitSettings { [JsonPropertyName("currentLimits")] - public Dictionary? CurrentLimits { get; set; } + public Dictionary? CurrentLimits + { + get; + set; + } [JsonPropertyName("globalLimits")] - public Dictionary? GlobalLimits { get; set; } + public Dictionary? GlobalLimits + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Bots/ModToSpawnRequest.cs b/Libraries/Core/Models/Spt/Bots/ModToSpawnRequest.cs index 96d0d652..4bcd7c8b 100644 --- a/Libraries/Core/Models/Spt/Bots/ModToSpawnRequest.cs +++ b/Libraries/Core/Models/Spt/Bots/ModToSpawnRequest.cs @@ -8,74 +8,126 @@ namespace Core.Models.Spt.Bots; public record ModToSpawnRequest { /// - /// Slot mod will fit into + /// Slot mod will fit into /// [JsonPropertyName("modSlot")] - public string? ModSlot { get; set; } + public string? ModSlot + { + get; + set; + } /// - /// Will generate a randomised mod pool if true + /// Will generate a randomised mod pool if true /// [JsonPropertyName("isRandomisableSlot")] - public bool? IsRandomisableSlot { get; set; } + public bool? IsRandomisableSlot + { + get; + set; + } [JsonPropertyName("randomisationSettings")] - public RandomisationDetails? RandomisationSettings { get; set; } + public RandomisationDetails? RandomisationSettings + { + get; + set; + } /// - /// Parent slot the item will be a part of + /// Parent slot the item will be a part of /// [JsonPropertyName("botWeaponSightWhitelist")] - public Dictionary>? BotWeaponSightWhitelist { get; set; } + public Dictionary>? BotWeaponSightWhitelist + { + get; + set; + } /// - /// Blacklist to prevent mods from being picked + /// Blacklist to prevent mods from being picked /// [JsonPropertyName("botEquipBlacklist")] - public EquipmentFilterDetails? BotEquipBlacklist { get; set; } + public EquipmentFilterDetails? BotEquipBlacklist + { + get; + set; + } /// - /// Pool of items to pick from + /// Pool of items to pick from /// [JsonPropertyName("itemModPool")] - public Dictionary>? ItemModPool { get; set; } + public Dictionary>? ItemModPool + { + get; + set; + } /// - /// List with only weapon tpl in it, ready for mods to be added + /// List with only weapon tpl in it, ready for mods to be added /// [JsonPropertyName("weapon")] - public List? Weapon { get; set; } + public List? Weapon + { + get; + set; + } /// - /// Ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) + /// Ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) /// [JsonPropertyName("ammoTpl")] - public string? AmmoTpl { get; set; } + public string? AmmoTpl + { + get; + set; + } /// - /// Parent item the mod will go into + /// Parent item the mod will go into /// [JsonPropertyName("parentTemplate")] - public TemplateItem? ParentTemplate { get; set; } + public TemplateItem? ParentTemplate + { + get; + set; + } /// - /// Should mod be spawned/skipped/use default + /// Should mod be spawned/skipped/use default /// [JsonPropertyName("modSpawnResult")] - public ModSpawn? ModSpawnResult { get; set; } + public ModSpawn? ModSpawnResult + { + get; + set; + } /// - /// Weapon stats for weapon being generated + /// Weapon stats for weapon being generated /// [JsonPropertyName("weaponStats")] - public WeaponStats? WeaponStats { get; set; } + public WeaponStats? WeaponStats + { + get; + set; + } /// - /// List of item tpls the weapon does not support + /// List of item tpls the weapon does not support /// [JsonPropertyName("conflictingItemTpls")] - public HashSet? ConflictingItemTpls { get; set; } + public HashSet? ConflictingItemTpls + { + get; + set; + } [JsonPropertyName("botData")] - public BotData? BotData { get; set; } + public BotData? BotData + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/AirdropConfig.cs b/Libraries/Core/Models/Spt/Config/AirdropConfig.cs index c7b7c7ba..aeca7d4c 100644 --- a/Libraries/Core/Models/Spt/Config/AirdropConfig.cs +++ b/Libraries/Core/Models/Spt/Config/AirdropConfig.cs @@ -7,123 +7,223 @@ namespace Core.Models.Spt.Config; public record AirdropConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-airdrop"; + public string Kind + { + get; + set; + } = "spt-airdrop"; [JsonPropertyName("airdropTypeWeightings")] - public Dictionary AirdropTypeWeightings { get; set; } + public Dictionary AirdropTypeWeightings + { + get; + set; + } /// - /// What rewards will the loot crate contain, keyed by drop type e.g. mixed/weaponArmor/foodMedical/barter + /// What rewards will the loot crate contain, keyed by drop type e.g. mixed/weaponArmor/foodMedical/barter /// [JsonPropertyName("loot")] - public Dictionary Loot { get; set; } + public Dictionary Loot + { + get; + set; + } [JsonPropertyName("customAirdropMapping")] - public Dictionary CustomAirdropMapping { get; set; } + public Dictionary CustomAirdropMapping + { + get; + set; + } } /// -/// Chance map will have an airdrop occur out of 100 - locations not included count as 0% +/// Chance map will have an airdrop occur out of 100 - locations not included count as 0% /// public record AirdropChancePercent { [JsonPropertyName("bigmap")] - public double Bigmap { get; set; } + public double Bigmap + { + get; + set; + } [JsonPropertyName("woods")] - public double Woods { get; set; } + public double Woods + { + get; + set; + } [JsonPropertyName("lighthouse")] - public double Lighthouse { get; set; } + public double Lighthouse + { + get; + set; + } [JsonPropertyName("shoreline")] - public double Shoreline { get; set; } + public double Shoreline + { + get; + set; + } [JsonPropertyName("interchange")] - public double Interchange { get; set; } + public double Interchange + { + get; + set; + } [JsonPropertyName("reserve")] - public double Reserve { get; set; } + public double Reserve + { + get; + set; + } [JsonPropertyName("tarkovStreets")] - public double TarkovStreets { get; set; } + public double TarkovStreets + { + get; + set; + } [JsonPropertyName("sandbox")] - public double Sandbox { get; set; } + public double Sandbox + { + get; + set; + } } /// -/// Loot inside crate +/// Loot inside crate /// public record AirdropLoot { [JsonPropertyName("icon")] [JsonConverter(typeof(JsonStringEnumConverter))] - public AirdropTypeEnum Icon { get; set; } + public AirdropTypeEnum Icon + { + get; + set; + } /// - /// Min/max of weapons inside crate + /// Min/max of weapons inside crate /// [JsonPropertyName("weaponPresetCount")] - public MinMax? WeaponPresetCount { get; set; } + public MinMax? WeaponPresetCount + { + get; + set; + } /// - /// Min/max of armors (head/chest/rig) inside crate + /// Min/max of armors (head/chest/rig) inside crate /// [JsonPropertyName("armorPresetCount")] - public MinMax? ArmorPresetCount { get; set; } + public MinMax? ArmorPresetCount + { + get; + set; + } /// - /// Min/max of items inside crate + /// Min/max of items inside crate /// [JsonPropertyName("itemCount")] - public MinMax ItemCount { get; set; } + public MinMax ItemCount + { + get; + set; + } /// - /// Min/max of sealed weapon boxes inside crate + /// Min/max of sealed weapon boxes inside crate /// [JsonPropertyName("weaponCrateCount")] - public MinMax WeaponCrateCount { get; set; } + public MinMax WeaponCrateCount + { + get; + set; + } /// - /// Items to never allow - tpls + /// Items to never allow - tpls /// [JsonPropertyName("itemBlacklist")] - public List ItemBlacklist { get; set; } + public List ItemBlacklist + { + get; + set; + } /// - /// Item type (parentId) to allow inside crate + /// Item type (parentId) to allow inside crate /// [JsonPropertyName("itemTypeWhitelist")] - public List ItemTypeWhitelist { get; set; } + public List ItemTypeWhitelist + { + get; + set; + } /// - /// Item type/ item tpls to limit count of inside crate - key: item base type: value: max count + /// Item type/ item tpls to limit count of inside crate - key: item base type: value: max count /// [JsonPropertyName("itemLimits")] - public Dictionary ItemLimits { get; set; } + public Dictionary ItemLimits + { + get; + set; + } /// - /// Items to limit stack size of key: item tpl value: min/max stack size + /// Items to limit stack size of key: item tpl value: min/max stack size /// [JsonPropertyName("itemStackLimits")] - public Dictionary ItemStackLimits { get; set; } + public Dictionary ItemStackLimits + { + get; + set; + } /// - /// Armor levels to allow inside crate e.g. [4,5,6] + /// Armor levels to allow inside crate e.g. [4,5,6] /// [JsonPropertyName("armorLevelWhitelist")] - public List? ArmorLevelWhitelist { get; set; } + public List? ArmorLevelWhitelist + { + get; + set; + } /// - /// Should boss items be added to airdrop crate + /// Should boss items be added to airdrop crate /// [JsonPropertyName("allowBossItems")] - public bool AllowBossItems { get; set; } + public bool AllowBossItems + { + get; + set; + } [JsonPropertyName("useForcedLoot")] - public bool? UseForcedLoot { get; set; } + public bool? UseForcedLoot + { + get; + set; + } [JsonPropertyName("forcedLoot")] - public Dictionary? ForcedLoot { get; set; } + public Dictionary? ForcedLoot + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/BackupConfig.cs b/Libraries/Core/Models/Spt/Config/BackupConfig.cs index d8db1d78..53e412dd 100644 --- a/Libraries/Core/Models/Spt/Config/BackupConfig.cs +++ b/Libraries/Core/Models/Spt/Config/BackupConfig.cs @@ -1,30 +1,58 @@ -namespace Core.Models.Spt.Config; +using System.Text.Json.Serialization; -using System.Text.Json.Serialization; +namespace Core.Models.Spt.Config; public record BackupConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-backup"; + public string Kind + { + get; + set; + } = "spt-backup"; [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("maxBackups")] - public int MaxBackups { get; set; } + public int MaxBackups + { + get; + set; + } [JsonPropertyName("directory")] - public string Directory { get; set; } + public string Directory + { + get; + set; + } [JsonPropertyName("backupInterval")] - public BackupConfigInterval BackupInterval { get; set; } + public BackupConfigInterval BackupInterval + { + get; + set; + } } public record BackupConfigInterval { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("intervalMinutes")] - public int IntervalMinutes { get; set; } + public int IntervalMinutes + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/BaseConfig.cs b/Libraries/Core/Models/Spt/Config/BaseConfig.cs index 3a308045..d2f1ebaa 100644 --- a/Libraries/Core/Models/Spt/Config/BaseConfig.cs +++ b/Libraries/Core/Models/Spt/Config/BaseConfig.cs @@ -5,14 +5,26 @@ namespace Core.Models.Spt.Config; public record BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } + public string Kind + { + get; + set; + } } public record RunIntervalValues { [JsonPropertyName("inRaid")] - public int InRaid { get; set; } + public int InRaid + { + get; + set; + } [JsonPropertyName("outOfRaid")] - public int OutOfRaid { get; set; } + public int OutOfRaid + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/BotConfig.cs b/Libraries/Core/Models/Spt/Config/BotConfig.cs index e1fa7343..8c41cbce 100644 --- a/Libraries/Core/Models/Spt/Config/BotConfig.cs +++ b/Libraries/Core/Models/Spt/Config/BotConfig.cs @@ -8,553 +8,1098 @@ namespace Core.Models.Spt.Config; public record BotConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-bot"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public Dictionary? PresetBatch + { + get; + set; + } - /** 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 { get; set; } + public List BotsToNotAddPMCsAsEnemiesTo + { + get; + set; + } - /** What bot types should be classified as bosses */ + /** + * What bot types should be classified as bosses + */ [JsonPropertyName("bosses")] - public List Bosses { get; set; } + public List Bosses + { + get; + set; + } - /** 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 { get; set; } + public BotDurability Durability + { + get; + set; + } - /** Controls the percentage values of randomization item resources */ + /** + * Controls the percentage values of randomization item resources + */ [JsonPropertyName("lootItemResourceRandomization")] - public Dictionary LootItemResourceRandomization { get; set; } + public Dictionary LootItemResourceRandomization + { + get; + set; + } - /** 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 { get; set; } + public Dictionary> Revenge + { + get; + set; + } - /** Control how many items are allowed to spawn on a bot - * key: bottype, value: */ + /** + * Control how many items are allowed to spawn on a bot + * key: bottype, value: + * + */ [JsonPropertyName("itemSpawnLimits")] - public Dictionary> ItemSpawnLimits { get; set; } + public Dictionary> ItemSpawnLimits + { + get; + set; + } - /** Blacklist/whitelist items on a bot */ + /** + * Blacklist/whitelist items on a bot + */ [JsonPropertyName("equipment")] - public Dictionary Equipment { get; set; } + public Dictionary Equipment + { + get; + set; + } - /** Show a bots botType value after their name */ + /** + * Show a bots botType value after their name + */ [JsonPropertyName("showTypeInNickname")] - public bool ShowTypeInNickname { get; set; } + public bool ShowTypeInNickname + { + get; + set; + } - /** 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 { get; set; } + public Dictionary> AssaultBrainType + { + get; + set; + } - /** 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 { get; set; } + public Dictionary> PlayerScavBrainType + { + get; + set; + } - /** 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 { get; set; } + public Dictionary MaxBotCap + { + get; + set; + } - /** 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 { get; set; } + public int ChanceAssaultScavHasPlayerScavName + { + get; + set; + } - /** 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 { get; set; } + public int SecureContainerAmmoStackCount + { + get; + set; + } - /** 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 List BotRolesWithDogTags { get; set; } + public List BotRolesWithDogTags + { + get; + set; + } - /** 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 { get; set; } + public WalletLootSettings WalletLoot + { + get; + set; + } - /** Currency weights, Keyed by botrole / currency */ + /** + * Currency weights, Keyed by botrole / currency + */ [JsonPropertyName("currencyStackSize")] - public Dictionary>> CurrencyStackSize { get; set; } + public Dictionary>> CurrencyStackSize + { + get; + set; + } - /** Tpls for low profile gas blocks */ + /** + * Tpls for low profile gas blocks + */ [JsonPropertyName("lowProfileGasBlockTpls")] - public List LowProfileGasBlockTpls { get; set; } + public List LowProfileGasBlockTpls + { + get; + set; + } - /** 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 List DisableLootOnBotTypes { get; set; } + public List DisableLootOnBotTypes + { + get; + set; + } [JsonPropertyName("assaultToBossConversion")] - public AssaultToBossConversion AssaultToBossConversion { get; set; } + public AssaultToBossConversion AssaultToBossConversion + { + get; + set; + } - /** Max length a bots name can be */ + /** + * Max length a bots name can be + */ [JsonPropertyName("botNameLengthLimit")] - public int BotNameLengthLimit { get; set; } + public int BotNameLengthLimit + { + get; + set; + } - /** 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 List BotRolesThatMustHaveUniqueName { get; set; } + public List BotRolesThatMustHaveUniqueName + { + get; + set; + } } public record AssaultToBossConversion { [JsonPropertyName("bossConvertEnabled")] - public bool BossConvertEnabled { get; set; } + public bool BossConvertEnabled + { + get; + set; + } [JsonPropertyName("bossesToConvertToWeights")] - public Dictionary BossesToConvertToWeights { get; set; } + public Dictionary BossesToConvertToWeights + { + get; + set; + } [JsonPropertyName("bossConvertMinMax")] - public Dictionary BossConvertMinMax { get; set; } + public Dictionary BossConvertMinMax + { + get; + set; + } } -/** 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 { [JsonPropertyName("assault")] - public int Assault { get; set; } + public int Assault + { + get; + set; + } [JsonPropertyName("bossBully")] - public int BossBully { get; set; } + public int BossBully + { + get; + set; + } [JsonPropertyName("bossGluhar")] - public int BossGluhar { get; set; } + public int BossGluhar + { + get; + set; + } [JsonPropertyName("bossKilla")] - public int BossKilla { get; set; } + public int BossKilla + { + get; + set; + } [JsonPropertyName("bossKojaniy")] - public int BossKojaniy { get; set; } + public int BossKojaniy + { + get; + set; + } [JsonPropertyName("bossSanitar")] - public int BossSanitar { get; set; } + public int BossSanitar + { + get; + set; + } [JsonPropertyName("bossTagilla")] - public int BossTagilla { get; set; } + public int BossTagilla + { + get; + set; + } [JsonPropertyName("bossKnight")] - public int BossKnight { get; set; } + public int BossKnight + { + get; + set; + } [JsonPropertyName("bossZryachiy")] - public int BossZryachiy { get; set; } + public int BossZryachiy + { + get; + set; + } [JsonPropertyName("bossKolontay")] - public int BossKolontay { get; set; } + public int BossKolontay + { + get; + set; + } [JsonPropertyName("bossPartisan")] - public int BossPartisan { get; set; } + public int BossPartisan + { + get; + set; + } [JsonPropertyName("bossTest")] - public int BossTest { get; set; } + public int BossTest + { + get; + set; + } [JsonPropertyName("cursedAssault")] - public int CursedAssault { get; set; } + public int CursedAssault + { + get; + set; + } [JsonPropertyName("followerBully")] - public int FollowerBully { get; set; } + public int FollowerBully + { + get; + set; + } [JsonPropertyName("followerGluharAssault")] - public int FollowerGluharAssault { get; set; } + public int FollowerGluharAssault + { + get; + set; + } [JsonPropertyName("followerGluharScout")] - public int FollowerGluharScout { get; set; } + public int FollowerGluharScout + { + get; + set; + } [JsonPropertyName("followerGluharSecurity")] - public int FollowerGluharSecurity { get; set; } + public int FollowerGluharSecurity + { + get; + set; + } [JsonPropertyName("followerGluharSnipe")] - public int FollowerGluharSnipe { get; set; } + public int FollowerGluharSnipe + { + get; + set; + } [JsonPropertyName("followerKojaniy")] - public int FollowerKojaniy { get; set; } + public int FollowerKojaniy + { + get; + set; + } [JsonPropertyName("followerSanitar")] - public int FollowerSanitar { get; set; } + public int FollowerSanitar + { + get; + set; + } [JsonPropertyName("followerTagilla")] - public int FollowerTagilla { get; set; } + public int FollowerTagilla + { + get; + set; + } [JsonPropertyName("followerBirdEye")] - public int FollowerBirdEye { get; set; } + public int FollowerBirdEye + { + get; + set; + } [JsonPropertyName("followerBigPipe")] - public int FollowerBigPipe { get; set; } + public int FollowerBigPipe + { + get; + set; + } [JsonPropertyName("followerTest")] - public int FollowerTest { get; set; } + public int FollowerTest + { + get; + set; + } [JsonPropertyName("followerBoar")] - public int FollowerBoar { get; set; } + public int FollowerBoar + { + get; + set; + } [JsonPropertyName("followerBoarClose1")] - public int FollowerBoarClose1 { get; set; } + public int FollowerBoarClose1 + { + get; + set; + } [JsonPropertyName("followerBoarClose2")] - public int FollowerBoarClose2 { get; set; } + public int FollowerBoarClose2 + { + get; + set; + } [JsonPropertyName("followerZryachiy")] - public int FollowerZryachiy { get; set; } + public int FollowerZryachiy + { + get; + set; + } [JsonPropertyName("followerKolontayAssault")] - public int FollowerKolontayAssault { get; set; } + public int FollowerKolontayAssault + { + get; + set; + } [JsonPropertyName("followerKolontaySecurity")] - public int FollowerKolontaySecurity { get; set; } + public int FollowerKolontaySecurity + { + get; + set; + } [JsonPropertyName("marksman")] - public int Marksman { get; set; } + public int Marksman + { + get; + set; + } [JsonPropertyName("pmcBot")] - public int PmcBot { get; set; } + public int PmcBot + { + get; + set; + } [JsonPropertyName("sectantPriest")] - public int SectantPriest { get; set; } + public int SectantPriest + { + get; + set; + } [JsonPropertyName("sectantWarrior")] - public int SectantWarrior { get; set; } + public int SectantWarrior + { + get; + set; + } [JsonPropertyName("gifter")] - public int Gifter { get; set; } + public int Gifter + { + get; + set; + } [JsonPropertyName("test")] - public int Test { get; set; } + public int Test + { + get; + set; + } [JsonPropertyName("exUsec")] - public int ExUsec { get; set; } + public int ExUsec + { + get; + set; + } [JsonPropertyName("arenaFighterEvent")] - public int ArenaFighterEvent { get; set; } + public int ArenaFighterEvent + { + get; + set; + } [JsonPropertyName("arenaFighter")] - public int ArenaFighter { get; set; } + public int ArenaFighter + { + get; + set; + } [JsonPropertyName("crazyAssaultEvent")] - public int CrazyAssaultEvent { get; set; } + public int CrazyAssaultEvent + { + get; + set; + } [JsonPropertyName("bossBoar")] - public int BossBoar { get; set; } + public int BossBoar + { + get; + set; + } [JsonPropertyName("bossBoarSniper")] - public int BossBoarSniper { get; set; } + public int BossBoarSniper + { + get; + set; + } [JsonPropertyName("pmcUSEC")] - public int PmcUSEC { get; set; } + public int PmcUSEC + { + get; + set; + } [JsonPropertyName("pmcBEAR")] - public int PmcBEAR { get; set; } + public int PmcBEAR + { + get; + set; + } [JsonPropertyName("shooterBTR")] - public int ShooterBTR { get; set; } + public int ShooterBTR + { + get; + set; + } [JsonExtensionData] - public IDictionary AdditionalData { get; set; } + public IDictionary AdditionalData + { + get; + set; + } } public record WalletLootSettings { /// - /// Chance wallets have loot in them + /// Chance wallets have loot in them /// [JsonPropertyName("chancePercent")] - public float ChancePercent { get; set; } + public float ChancePercent + { + get; + set; + } [JsonPropertyName("itemCount")] - public MinMax ItemCount { get; set; } + public MinMax ItemCount + { + get; + set; + } [JsonPropertyName("stackSizeWeight")] - public Dictionary StackSizeWeight { get; set; } + public Dictionary StackSizeWeight + { + get; + set; + } [JsonPropertyName("currencyWeight")] - public Dictionary CurrencyWeight { get; set; } + public Dictionary CurrencyWeight + { + get; + set; + } /// - /// What wallets will have money in them + /// What wallets will have money in them /// [JsonPropertyName("walletTplPool")] - public List WalletTplPool { get; set; } + public List WalletTplPool + { + get; + set; + } } public record EquipmentFilters { /// - /// Limits for mod types per weapon .e.g. scopes + /// Limits for mod types per weapon .e.g. scopes /// [JsonPropertyName("weaponModLimits")] - public ModLimits WeaponModLimits { get; set; } + public ModLimits WeaponModLimits + { + get; + set; + } /// - /// Whitelist for weapon sight types allowed per gun + /// Whitelist for weapon sight types allowed per gun /// [JsonPropertyName("weaponSightWhitelist")] - public Dictionary> WeaponSightWhitelist { get; set; } + public Dictionary> WeaponSightWhitelist + { + get; + set; + } /// - /// Chance face shield is down/active + /// Chance face shield is down/active /// [JsonPropertyName("faceShieldIsActiveChancePercent")] - public double? FaceShieldIsActiveChancePercent { get; set; } + public double? FaceShieldIsActiveChancePercent + { + get; + set; + } /// - /// Chance gun flashlight is active during the day + /// Chance gun flashlight is active during the day /// [JsonPropertyName("lightIsActiveDayChancePercent")] - public double? LightIsActiveDayChancePercent { get; set; } + public double? LightIsActiveDayChancePercent + { + get; + set; + } /// - /// Chance gun flashlight is active during the night + /// Chance gun flashlight is active during the night /// [JsonPropertyName("lightIsActiveNightChancePercent")] - public double? LightIsActiveNightChancePercent { get; set; } + public double? LightIsActiveNightChancePercent + { + get; + set; + } /// - /// Chance gun laser is active during the day + /// Chance gun laser is active during the day /// [JsonPropertyName("laserIsActiveChancePercent")] - public double? LaserIsActiveChancePercent { get; set; } + public double? LaserIsActiveChancePercent + { + get; + set; + } /// - /// Chance NODS are down/active during the day + /// Chance NODS are down/active during the day /// [JsonPropertyName("nvgIsActiveChanceDayPercent")] - public double? NvgIsActiveChanceDayPercent { get; set; } + public double? NvgIsActiveChanceDayPercent + { + get; + set; + } /// - /// Chance NODS are down/active during the night + /// Chance NODS are down/active during the night /// [JsonPropertyName("nvgIsActiveChanceNightPercent")] - public double? NvgIsActiveChanceNightPercent { get; set; } + public double? NvgIsActiveChanceNightPercent + { + get; + set; + } [JsonPropertyName("forceOnlyArmoredRigWhenNoArmor")] - public bool? ForceOnlyArmoredRigWhenNoArmor { get; set; } + public bool? ForceOnlyArmoredRigWhenNoArmor + { + get; + set; + } /// - /// Should plates be filtered by level + /// Should plates be filtered by level /// [JsonPropertyName("filterPlatesByLevel")] - public bool? FilterPlatesByLevel { get; set; } + public bool? FilterPlatesByLevel + { + get; + set; + } /// - /// What additional slot ids should be seen as required when choosing a mod to add to a weapon + /// What additional slot ids should be seen as required when choosing a mod to add to a weapon /// [JsonPropertyName("weaponSlotIdsToMakeRequired")] - public List? WeaponSlotIdsToMakeRequired { get; set; } + public List? WeaponSlotIdsToMakeRequired + { + get; + set; + } /// - /// Adjust weighting/chances of items on bot by level of bot + /// Adjust weighting/chances of items on bot by level of bot /// [JsonPropertyName("randomisation")] - public List Randomisation { get; set; } + public List Randomisation + { + get; + set; + } /// - /// Blacklist equipment by level of bot + /// Blacklist equipment by level of bot /// [JsonPropertyName("blacklist")] - public List Blacklist { get; set; } + public List Blacklist + { + get; + set; + } /// - /// Whitelist equipment by level of bot + /// Whitelist equipment by level of bot /// [JsonPropertyName("whitelist")] - public List Whitelist { get; set; } + public List Whitelist + { + get; + set; + } /// - /// Adjust equipment/ammo + /// Adjust equipment/ammo /// [JsonPropertyName("weightingAdjustmentsByBotLevel")] - public List WeightingAdjustmentsByBotLevel { get; set; } + public List WeightingAdjustmentsByBotLevel + { + get; + set; + } /// - /// Same as weightingAdjustments but based on player level instead of bot level + /// Same as weightingAdjustments but based on player level instead of bot level /// [JsonPropertyName("weightingAdjustmentsByPlayerLevel")] - public List? WeightingAdjustmentsByPlayerLevel { get; set; } + public List? WeightingAdjustmentsByPlayerLevel + { + get; + set; + } /// - /// Should the stock mod be forced to spawn on bot + /// Should the stock mod be forced to spawn on bot /// [JsonPropertyName("forceStock")] - public bool? ForceStock { get; set; } + public bool? ForceStock + { + get; + set; + } [JsonPropertyName("armorPlateWeighting")] - public List? ArmorPlateWeighting { get; set; } + public List? ArmorPlateWeighting + { + get; + set; + } [JsonPropertyName("forceRigWhenNoVest")] - public bool? ForceRigWhenNoVest { get; set; } + public bool? ForceRigWhenNoVest + { + get; + set; + } } public record ModLimits { /// - /// How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR + /// How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR /// [JsonPropertyName("scopeLimit")] - public int? ScopeLimit { get; set; } + public int? ScopeLimit + { + get; + set; + } /// - /// How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT + /// How many lasers or lights are allowed on a weapon - hard coded to work with TACTICAL_COMBO, and FLASHLIGHT /// [JsonPropertyName("lightLaserLimit")] - public int? LightLaserLimit { get; set; } + public int? LightLaserLimit + { + get; + set; + } } public record RandomisationDetails { /// - /// Between what levels do these randomisation setting apply to + /// Between what levels do these randomisation setting apply to /// [JsonPropertyName("levelRange")] - public MinMax LevelRange { get; set; } + public MinMax LevelRange + { + get; + set; + } [JsonPropertyName("generation")] - public Dictionary? Generation { get; set; } + public Dictionary? Generation + { + get; + set; + } /// - /// Mod slots that should be fully randomised -ignores mods from bottype.json and instead creates a pool using items.json + /// Mod slots that should be fully randomised -ignores mods from bottype.json and instead creates a pool using items.json /// [JsonPropertyName("randomisedWeaponModSlots")] - public List? RandomisedWeaponModSlots { get; set; } + public List? RandomisedWeaponModSlots + { + get; + set; + } /// - /// Armor slots that should be randomised e.g. 'Headwear, Armband' + /// Armor slots that should be randomised e.g. 'Headwear, Armband' /// [JsonPropertyName("randomisedArmorSlots")] - public List? RandomisedArmorSlots { get; set; } + public List? RandomisedArmorSlots + { + get; + set; + } /// - /// Equipment chances + /// Equipment chances /// [JsonPropertyName("equipment")] - public Dictionary? Equipment { get; set; } + public Dictionary? Equipment + { + get; + set; + } /// - /// Weapon mod chances + /// Weapon mod chances /// [JsonPropertyName("weaponMods")] - public Dictionary? WeaponMods { get; set; } + public Dictionary? WeaponMods + { + get; + set; + } /// - /// Equipment mod chances + /// Equipment mod chances /// [JsonPropertyName("equipmentMods")] - public Dictionary? EquipmentMods { get; set; } + public Dictionary? EquipmentMods + { + get; + set; + } [JsonPropertyName("nighttimeChanges")] - public NighttimeChanges? NighttimeChanges { get; set; } + public NighttimeChanges? NighttimeChanges + { + get; + set; + } /// - /// Key = weapon tpl, value = min size of magazine allowed + /// Key = weapon tpl, value = min size of magazine allowed /// [JsonPropertyName("minimumMagazineSize")] - public Dictionary? MinimumMagazineSize { get; set; } + public Dictionary? MinimumMagazineSize + { + get; + set; + } } public record NighttimeChanges { /// - /// Applies changes to values stored in equipmentMods + /// Applies changes to values stored in equipmentMods /// [JsonPropertyName("equipmentModsModifiers")] - public Dictionary EquipmentModsModifiers { get; set; } + public Dictionary EquipmentModsModifiers + { + get; + set; + } [JsonPropertyName("weaponModsModifiers")] - public Dictionary WeaponModsModifiers { get; set; } // TODO: currently not in use anywhere + public Dictionary WeaponModsModifiers + { + get; + set; + } // TODO: currently not in use anywhere } public record EquipmentFilterDetails { /// - /// Between what levels do these equipment filter setting apply to + /// Between what levels do these equipment filter setting apply to /// [JsonPropertyName("levelRange")] - public MinMax LevelRange { get; set; } + public MinMax LevelRange + { + get; + set; + } /// - /// Key: mod slot name e.g. mod_magazine, value: item tpls + /// Key: mod slot name e.g. mod_magazine, value: item tpls /// [JsonPropertyName("equipment")] - public Dictionary>? Equipment { get; set; } + public Dictionary>? Equipment + { + get; + set; + } /// - /// Key: equipment slot name e.g. FirstPrimaryWeapon, value: item tpls + /// Key: equipment slot name e.g. FirstPrimaryWeapon, value: item tpls /// [JsonPropertyName("gear")] - public Dictionary>? Gear { get; set; } + public Dictionary>? Gear + { + get; + set; + } /// - /// Key: cartridge type e.g. Caliber23x75, value: item tpls + /// Key: cartridge type e.g. Caliber23x75, value: item tpls /// [JsonPropertyName("cartridge")] - public Dictionary>? Cartridge { get; set; } + public Dictionary>? Cartridge + { + get; + set; + } } public record WeightingAdjustmentDetails { /// - /// Between what levels do these weight settings apply to + /// Between what levels do these weight settings apply to /// [JsonPropertyName("levelRange")] - public MinMax LevelRange { get; set; } + public MinMax LevelRange + { + get; + set; + } /// - /// Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight + /// Key: ammo type e.g. Caliber556x45NATO, value: item tpl + weight /// [JsonPropertyName("ammo")] - public AdjustmentDetails? Ammo { get; set; } + public AdjustmentDetails? Ammo + { + get; + set; + } /// - /// Key: equipment slot e.g. TacticalVest, value: item tpl + weight + /// Key: equipment slot e.g. TacticalVest, value: item tpl + weight /// [JsonPropertyName("equipment")] - public AdjustmentDetails? Equipment { get; set; } + public AdjustmentDetails? Equipment + { + get; + set; + } /// - /// Key: clothing slot e.g. feet, value: item tpl + weight + /// Key: clothing slot e.g. feet, value: item tpl + weight /// [JsonPropertyName("clothing")] - public AdjustmentDetails? Clothing { get; set; } + public AdjustmentDetails? Clothing + { + get; + set; + } } public record AdjustmentDetails { [JsonPropertyName("add")] - public Dictionary> Add { get; set; } + public Dictionary> Add + { + get; + set; + } [JsonPropertyName("edit")] - public Dictionary> Edit { get; set; } + public Dictionary> Edit + { + get; + set; + } } public class ArmorPlateWeights { [JsonPropertyName("levelRange")] - public MinMax LevelRange { get; set; } + public MinMax LevelRange + { + get; + set; + } [JsonPropertyName("values")] - public Dictionary> Values { get; set; } + public Dictionary> Values + { + get; + set; + } } public record RandomisedResourceDetails { [JsonPropertyName("food")] - public RandomisedResourceValues Food { get; set; } + public RandomisedResourceValues Food + { + get; + set; + } [JsonPropertyName("meds")] - public RandomisedResourceValues Meds { get; set; } + public RandomisedResourceValues Meds + { + get; + set; + } } public record RandomisedResourceValues { /// - /// Minimum percent of item to randomized between min and max resource + /// Minimum percent of item to randomized between min and max resource /// [JsonPropertyName("resourcePercent")] - public float ResourcePercent { get; set; } + public float ResourcePercent + { + get; + set; + } /// - /// Chance for randomization to not occur + /// Chance for randomization to not occur /// [JsonPropertyName("chanceMaxResourcePercent")] - public float ChanceMaxResourcePercent { get; set; } + public float ChanceMaxResourcePercent + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/BotDurability.cs b/Libraries/Core/Models/Spt/Config/BotDurability.cs index 679cfe0b..18b3f9ce 100644 --- a/Libraries/Core/Models/Spt/Config/BotDurability.cs +++ b/Libraries/Core/Models/Spt/Config/BotDurability.cs @@ -5,84 +5,174 @@ namespace Core.Models.Spt.Config; public record BotDurability { [JsonPropertyName("default")] - public DefaultDurability Default { get; set; } + public DefaultDurability Default + { + get; + set; + } [JsonPropertyName("botDurabilities")] - public Dictionary BotDurabilities { get; set; } + public Dictionary BotDurabilities + { + get; + set; + } [JsonPropertyName("pmc")] - public PmcDurability Pmc { get; set; } + public PmcDurability Pmc + { + get; + set; + } } -/** 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 { [JsonPropertyName("armor")] - public ArmorDurability Armor { get; set; } + public ArmorDurability Armor + { + get; + set; + } [JsonPropertyName("weapon")] - public WeaponDurability Weapon { get; set; } + public WeaponDurability Weapon + { + get; + set; + } } public record PmcDurability { [JsonPropertyName("armor")] - public PmcDurabilityArmor Armor { get; set; } + public PmcDurabilityArmor Armor + { + get; + set; + } [JsonPropertyName("weapon")] - public WeaponDurability Weapon { get; set; } + public WeaponDurability Weapon + { + get; + set; + } } public record PmcDurabilityArmor { [JsonPropertyName("lowestMaxPercent")] - public int LowestMaxPercent { get; set; } + public int LowestMaxPercent + { + get; + set; + } [JsonPropertyName("highestMaxPercent")] - public int HighestMaxPercent { get; set; } + public int HighestMaxPercent + { + get; + set; + } [JsonPropertyName("maxDelta")] - public int MaxDelta { get; set; } + public int MaxDelta + { + get; + set; + } [JsonPropertyName("minDelta")] - public int MinDelta { get; set; } + public int MinDelta + { + get; + set; + } [JsonPropertyName("minLimitPercent")] - public int MinLimitPercent { get; set; } + public int MinLimitPercent + { + get; + set; + } } public record ArmorDurability { [JsonPropertyName("maxDelta")] - public int MaxDelta { get; set; } + public int MaxDelta + { + get; + set; + } [JsonPropertyName("minDelta")] - public int MinDelta { get; set; } + public int MinDelta + { + get; + set; + } [JsonPropertyName("minLimitPercent")] - public int MinLimitPercent { get; set; } + public int MinLimitPercent + { + get; + set; + } [JsonPropertyName("lowestMaxPercent")] - public int LowestMaxPercent { get; set; } + public int LowestMaxPercent + { + get; + set; + } [JsonPropertyName("highestMaxPercent")] - public int HighestMaxPercent { get; set; } + public int HighestMaxPercent + { + get; + set; + } } public record WeaponDurability { [JsonPropertyName("lowestMax")] - public int LowestMax { get; set; } + public int LowestMax + { + get; + set; + } [JsonPropertyName("highestMax")] - public int HighestMax { get; set; } + public int HighestMax + { + get; + set; + } [JsonPropertyName("maxDelta")] - public int MaxDelta { get; set; } + public int MaxDelta + { + get; + set; + } [JsonPropertyName("minDelta")] - public int MinDelta { get; set; } + public int MinDelta + { + get; + set; + } [JsonPropertyName("minLimitPercent")] - public double MinLimitPercent { get; set; } + public double MinLimitPercent + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/CoreConfig.cs b/Libraries/Core/Models/Spt/Config/CoreConfig.cs index f778b638..ce1f59fe 100644 --- a/Libraries/Core/Models/Spt/Config/CoreConfig.cs +++ b/Libraries/Core/Models/Spt/Config/CoreConfig.cs @@ -6,55 +6,125 @@ namespace Core.Models.Spt.Config; public record CoreConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-core"; + public string Kind + { + get; + set; + } = "spt-core"; [JsonPropertyName("sptVersion")] - public string SptVersion { get; set; } + public string SptVersion + { + get; + set; + } [JsonPropertyName("projectName")] - public string ProjectName { get; set; } + public string ProjectName + { + get; + set; + } [JsonPropertyName("compatibleTarkovVersion")] - public string CompatibleTarkovVersion { get; set; } + public string CompatibleTarkovVersion + { + get; + set; + } [JsonPropertyName("serverName")] - public string ServerName { get; set; } + public string ServerName + { + get; + set; + } [JsonPropertyName("profileSaveIntervalSeconds")] - public int ProfileSaveIntervalInSeconds { get; set; } + public int ProfileSaveIntervalInSeconds + { + get; + set; + } [JsonPropertyName("sptFriendNickname")] - public string SptFriendNickname { get; set; } + public string SptFriendNickname + { + get; + set; + } [JsonPropertyName("allowProfileWipe")] - public bool AllowProfileWipe { get; set; } + public bool AllowProfileWipe + { + get; + set; + } [JsonPropertyName("bsgLogging")] - public BsgLogging BsgLogging { get; set; } + public BsgLogging BsgLogging + { + get; + set; + } [JsonPropertyName("release")] - public Release Release { get; set; } + public Release Release + { + get; + set; + } [JsonPropertyName("fixes")] - public GameFixes Fixes { get; set; } + public GameFixes Fixes + { + get; + set; + } [JsonPropertyName("survey")] - public SurveyResponseData Survey { get; set; } + public SurveyResponseData Survey + { + get; + set; + } [JsonPropertyName("features")] - public ServerFeatures Features { get; set; } + public ServerFeatures Features + { + get; + set; + } - /** Commit hash build server was created from */ + /** + * Commit hash build server was created from + */ [JsonPropertyName("commit")] - public string? Commit { get; set; } + public string? Commit + { + get; + set; + } - /** Timestamp of server build */ + /** + * Timestamp of server build + */ [JsonPropertyName("buildTime")] - public string? BuildTime { get; set; } + public string? BuildTime + { + get; + set; + } - /** 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 { get; set; } + public List? CustomWatermarkLocaleKeys + { + get; + set; + } } public record BsgLogging @@ -72,124 +142,250 @@ public record BsgLogging * 6 - off */ [JsonPropertyName("verbosity")] - public int Verbosity { get; set; } + public int Verbosity + { + get; + set; + } // Should we send the logging to the server [JsonPropertyName("sendToServer")] - public bool SendToServer { get; set; } + public bool SendToServer + { + get; + set; + } } public record Release { // Disclaimer outlining the intended usage of bleeding edge [JsonPropertyName("betaDisclaimerText")] - public string? BetaDisclaimerText { get; set; } + public string? BetaDisclaimerText + { + get; + set; + } // Text logged when users agreed to terms [JsonPropertyName("betaDisclaimerAcceptText")] - public string BetaDisclaimerAcceptText { get; set; } + public string BetaDisclaimerAcceptText + { + get; + set; + } // Server mods loaded message [JsonPropertyName("serverModsLoadedText")] - public string ServerModsLoadedText { get; set; } + public string ServerModsLoadedText + { + get; + set; + } // Server mods loaded debug message text [JsonPropertyName("serverModsLoadedDebugText")] - public string ServerModsLoadedDebugText { get; set; } + public string ServerModsLoadedDebugText + { + get; + set; + } // Client mods loaded message [JsonPropertyName("clientModsLoadedText")] - public string ClientModsLoadedText { get; set; } + public string ClientModsLoadedText + { + get; + set; + } // Client mods loaded debug message text [JsonPropertyName("clientModsLoadedDebugText")] - public string ClientModsLoadedDebugText { get; set; } + public string ClientModsLoadedDebugText + { + get; + set; + } // Illegal plugins log message [JsonPropertyName("illegalPluginsLoadedText")] - public string IllegalPluginsLoadedText { get; set; } + public string IllegalPluginsLoadedText + { + get; + set; + } // Illegal plugins exception [JsonPropertyName("illegalPluginsExceptionText")] - public string IllegalPluginsExceptionText { get; set; } + public string IllegalPluginsExceptionText + { + get; + set; + } // Summary of release changes [JsonPropertyName("releaseSummaryText")] - public string? ReleaseSummaryText { get; set; } + public string? ReleaseSummaryText + { + get; + set; + } // Enables the cool watermark in-game [JsonPropertyName("isBeta")] - public bool? IsBeta { get; set; } + public bool? IsBeta + { + get; + set; + } // Whether mods are enabled [JsonPropertyName("isModdable")] - public bool? IsModdable { get; set; } + public bool? IsModdable + { + get; + set; + } // Are mods loaded on the server? [JsonPropertyName("isModded")] - public bool IsModded { get; set; } + public bool IsModded + { + get; + set; + } // How long before the messagebox times out and closes the game [JsonPropertyName("betaDisclaimerTimeoutDelay")] - public int BetaDisclaimerTimeoutDelay { get; set; } + public int BetaDisclaimerTimeoutDelay + { + get; + set; + } } 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 { get; set; } + public bool FixShotgunDispersion + { + get; + set; + } - /** 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 { get; set; } + public bool RemoveModItemsFromProfile + { + get; + set; + } - /** 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 { get; set; } + public bool RemoveInvalidTradersFromProfile + { + get; + set; + } - /** 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 { get; set; } + public bool FixProfileBreakingInventoryItemIssues + { + get; + set; + } } public record ServerFeatures { /* Controls whether or not the server attempts to download mod dependencies not included in the server's executable */ [JsonPropertyName("autoInstallModDependencies")] - public bool AutoInstallModDependencies { get; set; } + public bool AutoInstallModDependencies + { + get; + set; + } [JsonPropertyName("compressProfile")] - public bool CompressProfile { get; set; } + public bool CompressProfile + { + get; + set; + } [JsonPropertyName("chatbotFeatures")] - public ChatbotFeatures ChatbotFeatures { get; set; } + public ChatbotFeatures ChatbotFeatures + { + get; + set; + } - /** Keyed to profile type e.g. "Standard" or "SPT Developer" */ + /** + * Keyed to profile type e.g. "Standard" or "SPT Developer" + */ [JsonPropertyName("createNewProfileTypesBlacklist")] - public List CreateNewProfileTypesBlacklist { get; set; } + public List CreateNewProfileTypesBlacklist + { + get; + set; + } } public record ChatbotFeatures { [JsonPropertyName("sptFriendGiftsEnabled")] - public bool SptFriendGiftsEnabled { get; set; } + public bool SptFriendGiftsEnabled + { + get; + set; + } [JsonPropertyName("commandoFeatures")] - public CommandoFeatures CommandoFeatures { get; set; } + public CommandoFeatures CommandoFeatures + { + get; + set; + } [JsonPropertyName("commandUseLimits")] - public Dictionary CommandUseLimits { get; set; } + public Dictionary CommandUseLimits + { + get; + set; + } [JsonPropertyName("ids")] - public Dictionary Ids { get; set; } + public Dictionary Ids + { + get; + set; + } [JsonPropertyName("enabledBots")] - public Dictionary EnabledBots { get; set; } + public Dictionary EnabledBots + { + get; + set; + } } public record CommandoFeatures { [JsonPropertyName("giveCommandEnabled")] - public bool GiveCommandEnabled { get; set; } + public bool GiveCommandEnabled + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/GiftsConfig.cs b/Libraries/Core/Models/Spt/Config/GiftsConfig.cs index de60443e..de2c665a 100644 --- a/Libraries/Core/Models/Spt/Config/GiftsConfig.cs +++ b/Libraries/Core/Models/Spt/Config/GiftsConfig.cs @@ -9,72 +9,132 @@ namespace Core.Models.Spt.Config; public record GiftsConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-gifts"; + public string Kind + { + get; + set; + } = "spt-gifts"; [JsonPropertyName("gifts")] - public Dictionary Gifts { get; set; } + public Dictionary Gifts + { + get; + set; + } } public record Gift { /// - /// Items to send to player + /// Items to send to player /// [JsonPropertyName("items")] - public List Items { get; set; } + public List Items + { + get; + set; + } /// - /// Who is sending the gift to player + /// Who is sending the gift to player /// [JsonPropertyName("sender")] - public GiftSenderType Sender { get; set; } + public GiftSenderType Sender + { + get; + set; + } /// - /// Optional - supply a users id to send from, not necessary when sending from SYSTEM or TRADER + /// Optional - supply a users id to send from, not necessary when sending from SYSTEM or TRADER /// [JsonPropertyName("senderId")] - public string? SenderId { get; set; } + public string? SenderId + { + get; + set; + } [JsonPropertyName("senderDetails")] - public UserDialogInfo SenderDetails { get; set; } + public UserDialogInfo SenderDetails + { + get; + set; + } /// - /// Optional - supply a trader type to send from, not necessary when sending from SYSTEM or USER + /// Optional - supply a trader type to send from, not necessary when sending from SYSTEM or USER /// [JsonPropertyName("trader")] - public string? Trader { get; set; } + public string? Trader + { + get; + set; + } [JsonPropertyName("messageText")] - public string MessageText { get; set; } + public string MessageText + { + get; + set; + } /// - /// Optional - if sending text from the client locale file + /// Optional - if sending text from the client locale file /// [JsonPropertyName("localeTextId")] - public string? LocaleTextId { get; set; } + public string? LocaleTextId + { + get; + set; + } /// - /// Optional - Used by Seasonal events to send on specific day + /// Optional - Used by Seasonal events to send on specific day /// [JsonPropertyName("timestampToSend")] - public long? TimestampToSend { get; set; } + public long? TimestampToSend + { + get; + set; + } [JsonPropertyName("associatedEvent")] - public SeasonalEventType AssociatedEvent { get; set; } + public SeasonalEventType AssociatedEvent + { + get; + set; + } [JsonPropertyName("collectionTimeHours")] - public int? CollectionTimeHours { get; set; } + public int? CollectionTimeHours + { + get; + set; + } /// - /// Optional, can be used to change profile settings like level/skills + /// Optional, can be used to change profile settings like level/skills /// [JsonPropertyName("profileChangeEvents")] - public List? ProfileChangeEvents { get; set; } + public List? ProfileChangeEvents + { + get; + set; + } [JsonPropertyName("maxToSendPlayer")] - public int? MaxToSendPlayer { get; set; } + public int? MaxToSendPlayer + { + get; + set; + } [JsonPropertyName("maxToSendToPlayer")] - public int? MaxToSendToPlayer { get; set; } + public int? MaxToSendToPlayer + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/HealthConfig.cs b/Libraries/Core/Models/Spt/Config/HealthConfig.cs index 9317d7de..fe9a5ff6 100644 --- a/Libraries/Core/Models/Spt/Config/HealthConfig.cs +++ b/Libraries/Core/Models/Spt/Config/HealthConfig.cs @@ -5,29 +5,57 @@ namespace Core.Models.Spt.Config; public record HealthConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-health"; + public string Kind + { + get; + set; + } = "spt-health"; [JsonPropertyName("healthMultipliers")] - public HealthMultipliers HealthMultipliers { get; set; } + public HealthMultipliers HealthMultipliers + { + get; + set; + } [JsonPropertyName("save")] - public HealthSave Save { get; set; } + public HealthSave Save + { + get; + set; + } } public record HealthMultipliers { [JsonPropertyName("death")] - public double Death { get; set; } + public double Death + { + get; + set; + } [JsonPropertyName("blacked")] - public double Blacked { get; set; } + public double Blacked + { + get; + set; + } } public record HealthSave { [JsonPropertyName("health")] - public bool Health { get; set; } + public bool Health + { + get; + set; + } [JsonPropertyName("effects")] - public bool Effects { get; set; } + public bool Effects + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/HideoutConfig.cs b/Libraries/Core/Models/Spt/Config/HideoutConfig.cs index 84d1a1be..0c62c8f7 100644 --- a/Libraries/Core/Models/Spt/Config/HideoutConfig.cs +++ b/Libraries/Core/Models/Spt/Config/HideoutConfig.cs @@ -7,152 +7,284 @@ namespace Core.Models.Spt.Config; public record HideoutConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-hideout"; + public string Kind + { + get; + set; + } = "spt-hideout"; /// - /// How many seconds should pass before hideout crafts / fuel usage is checked and processed + /// How many seconds should pass before hideout crafts / fuel usage is checked and processed /// [JsonPropertyName("runIntervalSeconds")] - public int RunIntervalSeconds { get; set; } + public int RunIntervalSeconds + { + get; + set; + } /// - /// Default values used to hydrate `RunIntervalSeconds` with + /// Default values used to hydrate `RunIntervalSeconds` with /// [JsonPropertyName("runIntervalValues")] - public RunIntervalValues RunIntervalValues { get; set; } + public RunIntervalValues RunIntervalValues + { + get; + set; + } [JsonPropertyName("hoursForSkillCrafting")] - public int HoursForSkillCrafting { get; set; } + public int HoursForSkillCrafting + { + get; + set; + } [JsonPropertyName("expCraftAmount")] - public int ExpCraftAmount { get; set; } + public int ExpCraftAmount + { + get; + set; + } [JsonPropertyName("overrideCraftTimeSeconds")] - public int OverrideCraftTimeSeconds { get; set; } + public int OverrideCraftTimeSeconds + { + get; + set; + } [JsonPropertyName("overrideBuildTimeSeconds")] - public int OverrideBuildTimeSeconds { get; set; } + public int OverrideBuildTimeSeconds + { + get; + set; + } /// - /// Only process a profile's hideout crafts when it has been active in the last x minutes + /// Only process a profile's hideout crafts when it has been active in the last x minutes /// [JsonPropertyName("updateProfileHideoutWhenActiveWithinMinutes")] - public int UpdateProfileHideoutWhenActiveWithinMinutes { get; set; } + public int UpdateProfileHideoutWhenActiveWithinMinutes + { + get; + set; + } [JsonPropertyName("cultistCircle")] - public CultistCircleSettings CultistCircle { get; set; } + public CultistCircleSettings CultistCircle + { + get; + set; + } [JsonPropertyName("hideoutCraftsToAdd")] - public List HideoutCraftsToAdd { get; set; } + public List HideoutCraftsToAdd + { + get; + set; + } } public record HideoutCraftToAdd { [JsonPropertyName("requirements")] - public List Requirements { get; set; } + public List Requirements + { + get; + set; + } [JsonPropertyName("craftIdToCopy")] - public string CraftIdToCopy { get; set; } + public string CraftIdToCopy + { + get; + set; + } [JsonPropertyName("craftOutputTpl")] - public string CraftOutputTpl { get; set; } + public string CraftOutputTpl + { + get; + set; + } } public record CultistCircleSettings { [JsonPropertyName("maxRewardItemCount")] - public int MaxRewardItemCount { get; set; } + public int MaxRewardItemCount + { + get; + set; + } [JsonPropertyName("maxAttemptsToPickRewardsWithinBudget")] - public int MaxAttemptsToPickRewardsWithinBudget { get; set; } + public int MaxAttemptsToPickRewardsWithinBudget + { + get; + set; + } [JsonPropertyName("rewardPriceMultiplerMinMax")] - public MinMax RewardPriceMultiplerMinMax { get; set; } + public MinMax RewardPriceMultiplerMinMax + { + get; + set; + } /// - /// The odds that meeting the highest threshold gives you a bonus to crafting time + /// The odds that meeting the highest threshold gives you a bonus to crafting time /// [JsonPropertyName("bonusAmountMultiplier")] - public double BonusAmountMultiplier { get; set; } + public double BonusAmountMultiplier + { + get; + set; + } [JsonPropertyName("bonusChanceMultiplier")] - public double BonusChanceMultiplier { get; set; } + public double BonusChanceMultiplier + { + get; + set; + } /// - /// What is considered a "high-value" item + /// What is considered a "high-value" item /// [JsonPropertyName("highValueThresholdRub")] - public int HighValueThresholdRub { get; set; } + public int HighValueThresholdRub + { + get; + set; + } /// - /// Hideout/task reward crafts have a unique craft time + /// Hideout/task reward crafts have a unique craft time /// [JsonPropertyName("hideoutTaskRewardTimeSeconds")] - public int HideoutTaskRewardTimeSeconds { get; set; } + public int HideoutTaskRewardTimeSeconds + { + get; + set; + } /// - /// Rouble amount player needs to sacrifice to get chance of hideout/task rewards + /// Rouble amount player needs to sacrifice to get chance of hideout/task rewards /// [JsonPropertyName("hideoutCraftSacrificeThresholdRub")] - public int HideoutCraftSacrificeThresholdRub { get; set; } + public int HideoutCraftSacrificeThresholdRub + { + get; + set; + } [JsonPropertyName("craftTimeThreshholds")] - public List CraftTimeThreshholds { get; set; } + public List CraftTimeThreshholds + { + get; + set; + } /// - /// -1 means no override, value in seconds + /// -1 means no override, value in seconds /// [JsonPropertyName("craftTimeOverride")] - public int CraftTimeOverride { get; set; } + public int CraftTimeOverride + { + get; + set; + } /// - /// Specific reward pool when player sacrifices specific item(s) + /// Specific reward pool when player sacrifices specific item(s) /// [JsonPropertyName("directRewards")] - public List DirectRewards { get; set; } + public List DirectRewards + { + get; + set; + } /// - /// Overrides for reward stack sizes, keyed by item tpl + /// Overrides for reward stack sizes, keyed by item tpl /// [JsonPropertyName("directRewardStackSize")] - public Dictionary DirectRewardStackSize { get; set; } + public Dictionary DirectRewardStackSize + { + get; + set; + } /// - /// Item tpls to exclude from the reward pool + /// Item tpls to exclude from the reward pool /// [JsonPropertyName("rewardItemBlacklist")] - public List RewardItemBlacklist { get; set; } + public List RewardItemBlacklist + { + get; + set; + } /// - /// Item tpls to include in the reward pool + /// Item tpls to include in the reward pool /// [JsonPropertyName("additionalRewardItemPool")] - public List AdditionalRewardItemPool { get; set; } + public List AdditionalRewardItemPool + { + get; + set; + } [JsonPropertyName("currencyRewards")] - public Dictionary CurrencyRewards { get; set; } + public Dictionary CurrencyRewards + { + get; + set; + } } public record CraftTimeThreshold : MinMax { [JsonPropertyName("craftTimeSeconds")] - public int CraftTimeSeconds { get; set; } + public int CraftTimeSeconds + { + get; + set; + } } public record DirectRewardSettings { [JsonPropertyName("reward")] - public List Reward { get; set; } + public List Reward + { + get; + set; + } [JsonPropertyName("requiredItems")] - public List RequiredItems { get; set; } + public List RequiredItems + { + get; + set; + } [JsonPropertyName("craftTimeSeconds")] - public int CraftTimeSeconds { get; set; } + public int CraftTimeSeconds + { + get; + set; + } /// - /// Is the reward a one time reward or can it be given multiple times + /// Is the reward a one time reward or can it be given multiple times /// [JsonPropertyName("repeatable")] - public bool Repeatable { get; set; } + public bool Repeatable + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/HttpConfig.cs b/Libraries/Core/Models/Spt/Config/HttpConfig.cs index 3817444a..4c866a19 100644 --- a/Libraries/Core/Models/Spt/Config/HttpConfig.cs +++ b/Libraries/Core/Models/Spt/Config/HttpConfig.cs @@ -5,35 +5,67 @@ namespace Core.Models.Spt.Config; public record HttpConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-http"; + public string Kind + { + get; + set; + } = "spt-http"; /// - /// Address used by webserver + /// Address used by webserver /// [JsonPropertyName("ip")] - public string Ip { get; set; } + public string Ip + { + get; + set; + } [JsonPropertyName("port")] - public int Port { get; set; } + public int Port + { + get; + set; + } /// - /// Address used by game client to connect to + /// Address used by game client to connect to /// [JsonPropertyName("backendIp")] - public string BackendIp { get; set; } + public string BackendIp + { + get; + set; + } [JsonPropertyName("backendPort")] - public int BackendPort { get; set; } + public int BackendPort + { + get; + set; + } [JsonPropertyName("webSocketPingDelayMs")] - public int WebSocketPingDelayMs { get; set; } + public int WebSocketPingDelayMs + { + get; + set; + } [JsonPropertyName("logRequests")] - public bool LogRequests { get; set; } + public bool LogRequests + { + get; + set; + } /// - /// e.g. "SPT_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "SPT_Data/Server/images/traders/NewTraderImage.png" + /// e.g. "SPT_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "SPT_Data/Server/images/traders/NewTraderImage.png" /// [JsonPropertyName("serverImagePathOverride")] - public Dictionary ServerImagePathOverride { get; set; } + public Dictionary ServerImagePathOverride + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/InRaidConfig.cs b/Libraries/Core/Models/Spt/Config/InRaidConfig.cs index c30ebf94..18e3d5eb 100644 --- a/Libraries/Core/Models/Spt/Config/InRaidConfig.cs +++ b/Libraries/Core/Models/Spt/Config/InRaidConfig.cs @@ -5,83 +5,191 @@ namespace Core.Models.Spt.Config; public record InRaidConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-inraid"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public RaidMenuSettings RaidMenuSettings + { + get; + set; + } - /** What effects should be saved post-raid */ + /** + * What effects should be saved post-raid + */ [JsonPropertyName("save")] - public RaidSave Save { get; set; } + public RaidSave Save + { + get; + set; + } - /** Names of car extracts */ + /** + * Names of car extracts + */ [JsonPropertyName("carExtracts")] - public List CarExtracts { get; set; } + public List CarExtracts + { + get; + set; + } - /** Names of coop extracts */ + /** + * Names of coop extracts + */ [JsonPropertyName("coopExtracts")] - public List CoopExtracts { get; set; } + public List CoopExtracts + { + get; + set; + } - /** Fence rep gain from a single car extract */ + /** + * Fence rep gain from a single car extract + */ [JsonPropertyName("carExtractBaseStandingGain")] - public double CarExtractBaseStandingGain { get; set; } + public double CarExtractBaseStandingGain + { + get; + set; + } - /** Fence rep gain from a single coop extract */ + /** + * Fence rep gain from a single coop extract + */ [JsonPropertyName("coopExtractBaseStandingGain")] - public double CoopExtractBaseStandingGain { get; set; } + public double CoopExtractBaseStandingGain + { + get; + set; + } - /** Fence rep gain when successfully extracting as pscav */ + /** + * Fence rep gain when successfully extracting as pscav + */ [JsonPropertyName("scavExtractStandingGain")] - public double ScavExtractStandingGain { get; set; } + public double ScavExtractStandingGain + { + get; + set; + } - /** 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 { get; set; } + public double PmcKillProbabilityForScavGain + { + get; + set; + } - /** 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 { get; set; } + public bool KeepFiRSecureContainerOnDeath + { + get; + set; + } - /** 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 { get; set; } + public bool AlwaysKeepFoundInRaidOnRaidEnd + { + get; + set; + } - /** 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 { get; set; } + public double PlayerScavHostileChancePercent + { + get; + set; + } } public record RaidMenuSettings { [JsonPropertyName("aiAmount")] - public string AiAmount { get; set; } + public string AiAmount + { + get; + set; + } [JsonPropertyName("aiDifficulty")] - public string AiDifficulty { get; set; } + public string AiDifficulty + { + get; + set; + } [JsonPropertyName("bossEnabled")] - public bool BossEnabled { get; set; } + public bool BossEnabled + { + get; + set; + } [JsonPropertyName("scavWars")] - public bool ScavWars { get; set; } + public bool ScavWars + { + get; + set; + } [JsonPropertyName("taggedAndCursed")] - public bool TaggedAndCursed { get; set; } + public bool TaggedAndCursed + { + get; + set; + } [JsonPropertyName("enablePve")] - public bool EnablePve { get; set; } + public bool EnablePve + { + get; + set; + } [JsonPropertyName("randomWeather")] - public bool RandomWeather { get; set; } + public bool RandomWeather + { + get; + set; + } [JsonPropertyName("randomTime")] - public bool RandomTime { get; set; } + public bool RandomTime + { + get; + set; + } } public record RaidSave { - /** Should loot gained from raid be saved */ + /** + * Should loot gained from raid be saved + */ [JsonPropertyName("loot")] - public bool Loot { get; set; } + public bool Loot + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/InsuranceConfig.cs b/Libraries/Core/Models/Spt/Config/InsuranceConfig.cs index 33cd342a..879ee2f5 100644 --- a/Libraries/Core/Models/Spt/Config/InsuranceConfig.cs +++ b/Libraries/Core/Models/Spt/Config/InsuranceConfig.cs @@ -5,52 +5,92 @@ namespace Core.Models.Spt.Config; public record InsuranceConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-insurance"; + public string Kind + { + get; + set; + } = "spt-insurance"; /// - /// Chance item is returned as insurance, keyed by trader id + /// Chance item is returned as insurance, keyed by trader id /// [JsonPropertyName("returnChancePercent")] - public Dictionary ReturnChancePercent { get; set; } + public Dictionary ReturnChancePercent + { + get; + set; + } /// - /// Item slots that should never be returned as insurance + /// Item slots that should never be returned as insurance /// [JsonPropertyName("blacklistedEquipment")] - public List BlacklistedEquipment { get; set; } + public List BlacklistedEquipment + { + get; + set; + } /// - /// Some slots should always be removed, e.g. 'cartridges' + /// Some slots should always be removed, e.g. 'cartridges' /// [JsonPropertyName("slotIdsToAlwaysRemove")] - public List SlotIdsToAlwaysRemove { get; set; } + public List SlotIdsToAlwaysRemove + { + get; + set; + } /// - /// Override to control how quickly insurance is processed/returned in seconds + /// Override to control how quickly insurance is processed/returned in seconds /// [JsonPropertyName("returnTimeOverrideSeconds")] - public double ReturnTimeOverrideSeconds { get; set; } + public double ReturnTimeOverrideSeconds + { + get; + set; + } /// - /// Override to control how long insurance returns stay in mail before expiring - in seconds + /// Override to control how long insurance returns stay in mail before expiring - in seconds /// [JsonPropertyName("storageTimeOverrideSeconds")] - public double StorageTimeOverrideSeconds { get; set; } + public double StorageTimeOverrideSeconds + { + get; + set; + } /// - /// How often server should process insurance in seconds + /// How often server should process insurance in seconds /// [JsonPropertyName("runIntervalSeconds")] - public double RunIntervalSeconds { get; set; } + public double RunIntervalSeconds + { + get; + set; + } // Lowest rouble price for an attachment to be allowed to be taken [JsonPropertyName("minAttachmentRoublePriceToBeTaken")] - public double MinAttachmentRoublePriceToBeTaken { get; set; } + public double MinAttachmentRoublePriceToBeTaken + { + get; + set; + } // Chance out of 100% no attachments from a parent are taken [JsonPropertyName("chanceNoAttachmentsTakenPercent")] - public double ChanceNoAttachmentsTakenPercent { get; set; } + public double ChanceNoAttachmentsTakenPercent + { + get; + set; + } [JsonPropertyName("simulateItemsBeingTaken")] - public bool SimulateItemsBeingTaken { get; set; } + public bool SimulateItemsBeingTaken + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/InventoryConfig.cs b/Libraries/Core/Models/Spt/Config/InventoryConfig.cs index 2b21db13..9f7c1923 100644 --- a/Libraries/Core/Models/Spt/Config/InventoryConfig.cs +++ b/Libraries/Core/Models/Spt/Config/InventoryConfig.cs @@ -6,70 +6,156 @@ namespace Core.Models.Spt.Config; public record InventoryConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-inventory"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public bool NewItemsMarkedFound + { + get; + set; + } [JsonPropertyName("randomLootContainers")] - public Dictionary RandomLootContainers { get; set; } + public Dictionary RandomLootContainers + { + get; + set; + } [JsonPropertyName("sealedAirdropContainer")] - public SealedAirdropContainerSettings SealedAirdropContainer { get; set; } + public SealedAirdropContainerSettings SealedAirdropContainer + { + get; + set; + } - /** 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 { get; set; } + public List CustomMoneyTpls + { + get; + set; + } - /** 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 { get; set; } + public Dictionary SkillGainMultipliers + { + get; + set; + } - /** 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 List DeprioritisedMoneyContainers { get; set; } + public List DeprioritisedMoneyContainers + { + get; + set; + } } public record RewardDetails { [JsonPropertyName("_type")] - public string? Type { get; set; } + public string? Type + { + get; + set; + } [JsonPropertyName("rewardCount")] - public int RewardCount { get; set; } + public int RewardCount + { + get; + set; + } [JsonPropertyName("foundInRaid")] - public bool FoundInRaid { get; set; } + public bool FoundInRaid + { + get; + set; + } [JsonPropertyName("rewardTplPool")] - public Dictionary? RewardTplPool { get; set; } + public Dictionary? RewardTplPool + { + get; + set; + } [JsonPropertyName("rewardTypePool")] - public List? RewardTypePool { get; set; } + public List? RewardTypePool + { + get; + set; + } } public record SealedAirdropContainerSettings { [JsonPropertyName("weaponRewardWeight")] - public Dictionary WeaponRewardWeight { get; set; } + public Dictionary WeaponRewardWeight + { + get; + set; + } [JsonPropertyName("defaultPresetsOnly")] - public bool DefaultPresetsOnly { get; set; } + public bool DefaultPresetsOnly + { + get; + set; + } - /** 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 { get; set; } + public bool FoundInRaid + { + get; + set; + } [JsonPropertyName("weaponModRewardLimits")] - public Dictionary WeaponModRewardLimits { get; set; } + public Dictionary WeaponModRewardLimits + { + get; + set; + } [JsonPropertyName("rewardTypeLimits")] - public Dictionary RewardTypeLimits { get; set; } + public Dictionary RewardTypeLimits + { + get; + set; + } [JsonPropertyName("ammoBoxWhitelist")] - public List AmmoBoxWhitelist { get; set; } + public List AmmoBoxWhitelist + { + get; + set; + } [JsonPropertyName("allowBossItems")] - public bool AllowBossItems { get; set; } + public bool AllowBossItems + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/ItemConfig.cs b/Libraries/Core/Models/Spt/Config/ItemConfig.cs index e57d2418..a80b00d0 100644 --- a/Libraries/Core/Models/Spt/Config/ItemConfig.cs +++ b/Libraries/Core/Models/Spt/Config/ItemConfig.cs @@ -6,43 +6,99 @@ namespace Core.Models.Spt.Config; public record ItemConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-item"; + public string Kind + { + get; + set; + } = "spt-item"; - /** Items that should be globally blacklisted */ + /** + * Items that should be globally blacklisted + */ [JsonPropertyName("blacklist")] - public HashSet Blacklist { get; set; } + public HashSet Blacklist + { + get; + set; + } - /** Items that should not be lootable from any location */ + /** + * Items that should not be lootable from any location + */ [JsonPropertyName("lootableItemBlacklist")] - public HashSet LootableItemBlacklist { get; set; } + public HashSet LootableItemBlacklist + { + get; + set; + } - /** items that should not be given as rewards */ + /** + * items that should not be given as rewards + */ [JsonPropertyName("rewardItemBlacklist")] - public HashSet RewardItemBlacklist { get; set; } + public HashSet RewardItemBlacklist + { + get; + set; + } - /** 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 { get; set; } + public HashSet RewardItemTypeBlacklist + { + get; + set; + } - /** Items that can only be found on bosses */ + /** + * Items that can only be found on bosses + */ [JsonPropertyName("bossItems")] - public HashSet BossItems { get; set; } + public HashSet BossItems + { + get; + set; + } [JsonPropertyName("handbookPriceOverride")] - public Dictionary HandbookPriceOverride { get; set; } + public Dictionary HandbookPriceOverride + { + get; + set; + } - /** 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 { get; set; } + public List CustomItemGlobalPresets + { + get; + set; + } } public record HandbookPriceOverride { - /** Price in roubles */ + /** + * Price in roubles + */ [JsonPropertyName("price")] - public double Price { get; set; } + public double Price + { + get; + set; + } - /** NOT parentId from items.json, but handbook.json */ + /** + * NOT parentId from items.json, but handbook.json + */ [JsonPropertyName("parentId")] - public string ParentId { get; set; } + public string ParentId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/LocaleConfig.cs b/Libraries/Core/Models/Spt/Config/LocaleConfig.cs index e37963f9..7d3ebd3c 100644 --- a/Libraries/Core/Models/Spt/Config/LocaleConfig.cs +++ b/Libraries/Core/Models/Spt/Config/LocaleConfig.cs @@ -5,20 +5,46 @@ namespace Core.Models.Spt.Config; public record LocaleConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-locale"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public string GameLocale + { + get; + set; + } - /** 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 { get; set; } + public string ServerLocale + { + get; + set; + } - /** Languages server can be translated into */ + /** + * Languages server can be translated into + */ [JsonPropertyName("serverSupportedLocales")] - public List ServerSupportedLocales { get; set; } + public List ServerSupportedLocales + { + get; + set; + } [JsonPropertyName("fallbacks")] - public Dictionary Fallbacks { get; set; } + public Dictionary Fallbacks + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/LocationConfig.cs b/Libraries/Core/Models/Spt/Config/LocationConfig.cs index b4d4126d..b744961a 100644 --- a/Libraries/Core/Models/Spt/Config/LocationConfig.cs +++ b/Libraries/Core/Models/Spt/Config/LocationConfig.cs @@ -7,316 +7,612 @@ namespace Core.Models.Spt.Config; public record LocationConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-location"; + public string Kind + { + get; + set; + } = "spt-location"; /// - /// Rogues are classified as bosses and spawn immediately, this can result in no scavs spawning, delay rogues spawning to allow scavs to spawn first + /// Rogues are classified as bosses and spawn immediately, this can result in no scavs spawning, delay rogues spawning to allow scavs to spawn first /// [JsonPropertyName("rogueLighthouseSpawnTimeSettings")] - public RogueLighthouseSpawnTimeSettings RogueLighthouseSpawnTimeSettings { get; set; } + public RogueLighthouseSpawnTimeSettings RogueLighthouseSpawnTimeSettings + { + get; + set; + } [JsonPropertyName("looseLootMultiplier")] - public Dictionary LooseLootMultiplier { get; set; } + public Dictionary LooseLootMultiplier + { + get; + set; + } [JsonPropertyName("staticLootMultiplier")] - public Dictionary StaticLootMultiplier { get; set; } + public Dictionary StaticLootMultiplier + { + get; + set; + } /// - /// Custom bot waves to add to a locations base json on game start if addCustomBotWavesToMaps is true + /// Custom bot waves to add to a locations base json on game start if addCustomBotWavesToMaps is true /// [JsonPropertyName("customWaves")] - public CustomWaves CustomWaves { get; set; } + public CustomWaves CustomWaves + { + get; + set; + } /// - /// Open zones to add to map + /// Open zones to add to map /// [JsonPropertyName("openZones")] - public Dictionary> OpenZones { get; set; } + public Dictionary> OpenZones + { + get; + set; + } /// - /// Key = map id, value = item tpls that should only have one forced loot spawn position + /// Key = map id, value = item tpls that should only have one forced loot spawn position /// [JsonPropertyName("forcedLootSingleSpawnById")] - public Dictionary> ForcedLootSingleSpawnById { get; set; } + public Dictionary> ForcedLootSingleSpawnById + { + get; + set; + } /// - /// How many attempts should be taken to fit an item into a container before giving up + /// How many attempts should be taken to fit an item into a container before giving up /// [JsonPropertyName("fitLootIntoContainerAttempts")] - public int FitLootIntoContainerAttempts { get; set; } + public int FitLootIntoContainerAttempts + { + get; + set; + } /// - /// Add all possible zones to each maps `OpenZones` property + /// Add all possible zones to each maps `OpenZones` property /// [JsonPropertyName("addOpenZonesToAllMaps")] - public bool AddOpenZonesToAllMaps { get; set; } + public bool AddOpenZonesToAllMaps + { + get; + set; + } /// - /// Allow addition of custom bot waves designed by SPT to be added to maps - defined in configs/location.json.customWaves + /// Allow addition of custom bot waves designed by SPT to be added to maps - defined in configs/location.json.customWaves /// [JsonPropertyName("addCustomBotWavesToMaps")] - public bool AddCustomBotWavesToMaps { get; set; } + public bool AddCustomBotWavesToMaps + { + get; + set; + } /// - /// Should the limits defined inside botTypeLimits to be applied to locations on game start + /// Should the limits defined inside botTypeLimits to be applied to locations on game start /// [JsonPropertyName("enableBotTypeLimits")] - public bool EnableBotTypeLimits { get; set; } + public bool EnableBotTypeLimits + { + get; + set; + } /// - /// Add limits to a locations base.MinMaxBots array if enableBotTypeLimits is true + /// Add limits to a locations base.MinMaxBots array if enableBotTypeLimits is true /// [JsonPropertyName("botTypeLimits")] - public Dictionary> BotTypeLimits { get; set; } + public Dictionary> BotTypeLimits + { + get; + set; + } /// - /// Container randomisation settings + /// Container randomisation settings /// [JsonPropertyName("containerRandomisationSettings")] - public ContainerRandomisationSettings ContainerRandomisationSettings { get; set; } + public ContainerRandomisationSettings ContainerRandomisationSettings + { + get; + set; + } /// - /// How full must a random loose magazine be % + /// How full must a random loose magazine be % /// [JsonPropertyName("minFillLooseMagazinePercent")] - public int MinFillLooseMagazinePercent { get; set; } + public int MinFillLooseMagazinePercent + { + get; + set; + } /// - /// How full must a random static magazine be % + /// How full must a random static magazine be % /// [JsonPropertyName("minFillStaticMagazinePercent")] - public int MinFillStaticMagazinePercent { get; set; } + public int MinFillStaticMagazinePercent + { + get; + set; + } [JsonPropertyName("allowDuplicateItemsInStaticContainers")] - public bool AllowDuplicateItemsInStaticContainers { get; set; } + public bool AllowDuplicateItemsInStaticContainers + { + get; + set; + } /// - /// Chance loose magazines have ammo in them TODO - rename to dynamicMagazineLootHasAmmoChancePercent + /// Chance loose magazines have ammo in them TODO - rename to dynamicMagazineLootHasAmmoChancePercent /// [JsonPropertyName("magazineLootHasAmmoChancePercent")] - public int MagazineLootHasAmmoChancePercent { get; set; } + public int MagazineLootHasAmmoChancePercent + { + get; + set; + } /// - /// Chance static magazines have ammo in them + /// Chance static magazines have ammo in them /// [JsonPropertyName("staticMagazineLootHasAmmoChancePercent")] - public int StaticMagazineLootHasAmmoChancePercent { get; set; } + public int StaticMagazineLootHasAmmoChancePercent + { + get; + set; + } /// - /// Key: map, value: loose loot ids to ignore + /// Key: map, value: loose loot ids to ignore /// [JsonPropertyName("looseLootBlacklist")] - public Dictionary> LooseLootBlacklist { get; set; } + public Dictionary> LooseLootBlacklist + { + get; + set; + } /// - /// Key: map, value: settings to control how long scav raids are + /// Key: map, value: settings to control how long scav raids are /// [JsonPropertyName("scavRaidTimeSettings")] - public ScavRaidTimeSettings ScavRaidTimeSettings { get; set; } + public ScavRaidTimeSettings ScavRaidTimeSettings + { + get; + set; + } /// - /// Settings to adjust mods for lootable equipment in raid + /// Settings to adjust mods for lootable equipment in raid /// [JsonPropertyName("equipmentLootSettings")] - public EquipmentLootSettings EquipmentLootSettings { get; set; } + public EquipmentLootSettings EquipmentLootSettings + { + get; + set; + } /// - /// Min percentage to set raider spawns at, -1 makes no changes + /// Min percentage to set raider spawns at, -1 makes no changes /// [JsonPropertyName("reserveRaiderSpawnChanceOverrides")] - public ReserveRaiderSpawnChanceOverrides ReserveRaiderSpawnChanceOverrides { get; set; } + public ReserveRaiderSpawnChanceOverrides ReserveRaiderSpawnChanceOverrides + { + get; + set; + } /// - /// Containers to remove all children from when generating static/loose loot + /// Containers to remove all children from when generating static/loose loot /// [JsonPropertyName("tplsToStripChildItemsFrom")] - public List TplsToStripChildItemsFrom { get; set; } + public List TplsToStripChildItemsFrom + { + get; + set; + } /// - /// Map ids players cannot visit + /// Map ids players cannot visit /// [JsonPropertyName("nonMaps")] - public List NonMaps { get; set; } + public List NonMaps + { + get; + set; + } } public record ReserveRaiderSpawnChanceOverrides { [JsonPropertyName("nonTriggered")] - public int NonTriggered { get; set; } + public int NonTriggered + { + get; + set; + } [JsonPropertyName("triggered")] - public int Triggered { get; set; } + public int Triggered + { + get; + set; + } } public record EquipmentLootSettings { // Percentage chance item will be added to equipment [JsonPropertyName("modSpawnChancePercent")] - public Dictionary ModSpawnChancePercent { get; set; } + public Dictionary ModSpawnChancePercent + { + get; + set; + } } public record FixEmptyBotWavesSettings { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("ignoreMaps")] - public List IgnoreMaps { get; set; } + public List IgnoreMaps + { + get; + set; + } } public record RogueLighthouseSpawnTimeSettings { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("waitTimeSeconds")] - public int WaitTimeSeconds { get; set; } + public int WaitTimeSeconds + { + get; + set; + } } public record SplitWaveSettings { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("ignoreMaps")] - public List IgnoreMaps { get; set; } + public List IgnoreMaps + { + get; + set; + } [JsonPropertyName("waveSizeThreshold")] - public int WaveSizeThreshold { get; set; } + public int WaveSizeThreshold + { + get; + set; + } } public record CustomWaves { - /** Bosses spawn on raid start */ + /** + * Bosses spawn on raid start + */ [JsonPropertyName("boss")] - public Dictionary> Boss { get; set; } + public Dictionary> Boss + { + get; + set; + } [JsonPropertyName("normal")] - public Dictionary> Normal { get; set; } + public Dictionary> Normal + { + get; + set; + } } public record BotTypeLimit : MinMax { [JsonPropertyName("type")] - public string Type { get; set; } + public string Type + { + get; + set; + } } -/** 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 { [JsonPropertyName("bigmap")] - public double BigMap { get; set; } + public double BigMap + { + get; + set; + } [JsonPropertyName("develop")] - public double Develop { get; set; } + public double Develop + { + get; + set; + } [JsonPropertyName("factory4_day")] - public double Factory4Day { get; set; } + public double Factory4Day + { + get; + set; + } [JsonPropertyName("factory4_night")] - public double Factory4Night { get; set; } + public double Factory4Night + { + get; + set; + } [JsonPropertyName("interchange")] - public double Interchange { get; set; } + public double Interchange + { + get; + set; + } [JsonPropertyName("laboratory")] - public double Laboratory { get; set; } + public double Laboratory + { + get; + set; + } [JsonPropertyName("rezervbase")] - public double RezervBase { get; set; } + public double RezervBase + { + get; + set; + } [JsonPropertyName("shoreline")] - public double Shoreline { get; set; } + public double Shoreline + { + get; + set; + } [JsonPropertyName("woods")] - public double Woods { get; set; } + public double Woods + { + get; + set; + } [JsonPropertyName("hideout")] - public double Hideout { get; set; } + public double Hideout + { + get; + set; + } [JsonPropertyName("lighthouse")] - public double Lighthouse { get; set; } + public double Lighthouse + { + get; + set; + } [JsonPropertyName("privatearea")] - public double PrivateArea { get; set; } + public double PrivateArea + { + get; + set; + } [JsonPropertyName("suburbs")] - public double Suburbs { get; set; } + public double Suburbs + { + get; + set; + } [JsonPropertyName("tarkovstreets")] - public double TarkovStreets { get; set; } + public double TarkovStreets + { + get; + set; + } [JsonPropertyName("terminal")] - public double Terminal { get; set; } + public double Terminal + { + get; + set; + } [JsonPropertyName("town")] - public double Town { get; set; } + public double Town + { + get; + set; + } [JsonPropertyName("sandbox")] - public double Sandbox { get; set; } + public double Sandbox + { + get; + set; + } [JsonPropertyName("sandbox_high")] - public double SandboxHigh { get; set; } + public double SandboxHigh + { + get; + set; + } } public record ContainerRandomisationSettings { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } - /** What maps can use the container randomisation feature */ + /** + * What maps can use the container randomisation feature + */ [JsonPropertyName("maps")] - public Dictionary Maps { get; set; } + public Dictionary Maps + { + get; + set; + } - /** Some container types don't work when randomised */ + /** + * Some container types don't work when randomised + */ [JsonPropertyName("containerTypesToNotRandomise")] - public List ContainerTypesToNotRandomise { get; set; } + public List ContainerTypesToNotRandomise + { + get; + set; + } [JsonPropertyName("containerGroupMinSizeMultiplier")] - public double ContainerGroupMinSizeMultiplier { get; set; } + public double ContainerGroupMinSizeMultiplier + { + get; + set; + } [JsonPropertyName("containerGroupMaxSizeMultiplier")] - public double ContainerGroupMaxSizeMultiplier { get; set; } + public double ContainerGroupMaxSizeMultiplier + { + get; + set; + } } public record ScavRaidTimeSettings { [JsonPropertyName("settings")] - public ScavRaidTimeConfigSettings Settings { get; set; } + public ScavRaidTimeConfigSettings Settings + { + get; + set; + } [JsonPropertyName("maps")] - public Dictionary? Maps { get; set; } + public Dictionary? Maps + { + get; + set; + } } public record ScavRaidTimeConfigSettings { [JsonPropertyName("trainArrivalDelayObservedSeconds")] - public int TrainArrivalDelayObservedSeconds { get; set; } + public int TrainArrivalDelayObservedSeconds + { + get; + set; + } } 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 { get; set; } + public bool ReduceLootByPercent + { + get; + set; + } - /** Smallest % of container loot that should be spawned */ + /** + * Smallest % of container loot that should be spawned + */ [JsonPropertyName("minStaticLootPercent")] - public double MinStaticLootPercent { get; set; } + public double MinStaticLootPercent + { + get; + set; + } - /** Smallest % of loose loot that should be spawned */ + /** + * Smallest % of loose loot that should be spawned + */ [JsonPropertyName("minDynamicLootPercent")] - public double MinDynamicLootPercent { get; set; } + public double MinDynamicLootPercent + { + get; + set; + } - /** Chance raid time is reduced */ + /** + * Chance raid time is reduced + */ [JsonPropertyName("reducedChancePercent")] - public double ReducedChancePercent { get; set; } + public double ReducedChancePercent + { + get; + set; + } - /** How much should raid time be reduced - weighted */ + /** + * How much should raid time be reduced - weighted + */ [JsonPropertyName("reductionPercentWeights")] - public Dictionary ReductionPercentWeights { get; set; } + public Dictionary ReductionPercentWeights + { + get; + set; + } - /** Should bot waves be removed / spawn times be adjusted */ + /** + * Should bot waves be removed / spawn times be adjusted + */ [JsonPropertyName("adjustWaves")] - public bool AdjustWaves { get; set; } + public bool AdjustWaves + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/LootConfig.cs b/Libraries/Core/Models/Spt/Config/LootConfig.cs index 24c1e9fa..a2bb02af 100644 --- a/Libraries/Core/Models/Spt/Config/LootConfig.cs +++ b/Libraries/Core/Models/Spt/Config/LootConfig.cs @@ -6,13 +6,29 @@ namespace Core.Models.Spt.Config; public record LootConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-loot"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public Dictionary LooseLoot + { + get; + set; + } - /** Loose loot probability adjustments to apply on game start */ + /** + * Loose loot probability adjustments to apply on game start + */ [JsonPropertyName("looseLootSpawnPointAdjustments")] - public Dictionary>? LooseLootSpawnPointAdjustments { get; set; } + public Dictionary>? LooseLootSpawnPointAdjustments + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/LostOnDeathConfig.cs b/Libraries/Core/Models/Spt/Config/LostOnDeathConfig.cs index 8e3dac85..bb3034b6 100644 --- a/Libraries/Core/Models/Spt/Config/LostOnDeathConfig.cs +++ b/Libraries/Core/Models/Spt/Config/LostOnDeathConfig.cs @@ -5,65 +5,147 @@ namespace Core.Models.Spt.Config; public record LostOnDeathConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-lostondeath"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public LostEquipment Equipment + { + get; + set; + } - /** 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 { get; set; } + public bool SpecialSlotItems + { + get; + set; + } - /** 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 { get; set; } + public bool QuestItems + { + get; + set; + } } public record LostEquipment { [JsonPropertyName("ArmBand")] - public bool ArmBand { get; set; } + public bool ArmBand + { + get; + set; + } [JsonPropertyName("Headwear")] - public bool Headwear { get; set; } + public bool Headwear + { + get; + set; + } [JsonPropertyName("Earpiece")] - public bool Earpiece { get; set; } + public bool Earpiece + { + get; + set; + } [JsonPropertyName("FaceCover")] - public bool FaceCover { get; set; } + public bool FaceCover + { + get; + set; + } [JsonPropertyName("ArmorVest")] - public bool ArmorVest { get; set; } + public bool ArmorVest + { + get; + set; + } [JsonPropertyName("Eyewear")] - public bool Eyewear { get; set; } + public bool Eyewear + { + get; + set; + } [JsonPropertyName("TacticalVest")] - public bool TacticalVest { get; set; } + public bool TacticalVest + { + get; + set; + } [JsonPropertyName("PocketItems")] - public bool PocketItems { get; set; } + public bool PocketItems + { + get; + set; + } [JsonPropertyName("Backpack")] - public bool Backpack { get; set; } + public bool Backpack + { + get; + set; + } [JsonPropertyName("Holster")] - public bool Holster { get; set; } + public bool Holster + { + get; + set; + } [JsonPropertyName("FirstPrimaryWeapon")] - public bool FirstPrimaryWeapon { get; set; } + public bool FirstPrimaryWeapon + { + get; + set; + } [JsonPropertyName("SecondPrimaryWeapon")] - public bool SecondPrimaryWeapon { get; set; } + public bool SecondPrimaryWeapon + { + get; + set; + } [JsonPropertyName("Scabbard")] - public bool Scabbard { get; set; } + public bool Scabbard + { + get; + set; + } [JsonPropertyName("Compass")] - public bool Compass { get; set; } + public bool Compass + { + get; + set; + } [JsonPropertyName("SecuredContainer")] - public bool SecuredContainer { get; set; } + public bool SecuredContainer + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/MatchConfig.cs b/Libraries/Core/Models/Spt/Config/MatchConfig.cs index 73d3aac6..3e6021ba 100644 --- a/Libraries/Core/Models/Spt/Config/MatchConfig.cs +++ b/Libraries/Core/Models/Spt/Config/MatchConfig.cs @@ -5,11 +5,23 @@ namespace Core.Models.Spt.Config; public record MatchConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-match"; + public string Kind + { + get; + set; + } = "spt-match"; [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("randomiseMapContainers")] - public Dictionary RandomiseMapContainers { get; set; } + public Dictionary RandomiseMapContainers + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/PlayerScavConfig.cs b/Libraries/Core/Models/Spt/Config/PlayerScavConfig.cs index b7b83fa4..b3eb1cbd 100644 --- a/Libraries/Core/Models/Spt/Config/PlayerScavConfig.cs +++ b/Libraries/Core/Models/Spt/Config/PlayerScavConfig.cs @@ -7,59 +7,123 @@ namespace Core.Models.Spt.Config; public record PlayerScavConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-playerscav"; + public string Kind + { + get; + set; + } = "spt-playerscav"; [JsonPropertyName("karmaLevel")] - public Dictionary KarmaLevel { get; set; } + public Dictionary KarmaLevel + { + get; + set; + } } public record KarmaLevel { [JsonPropertyName("botTypeForLoot")] - public string BotTypeForLoot { get; set; } + public string BotTypeForLoot + { + get; + set; + } [JsonPropertyName("modifiers")] - public Modifiers Modifiers { get; set; } + public Modifiers Modifiers + { + get; + set; + } [JsonPropertyName("itemLimits")] - public Dictionary ItemLimits { get; set; } + public Dictionary ItemLimits + { + get; + set; + } [JsonPropertyName("equipmentBlacklist")] - public Dictionary> EquipmentBlacklist { get; set; } + public Dictionary> EquipmentBlacklist + { + get; + set; + } [JsonPropertyName("labsAccessCardChancePercent")] - public double? LabsAccessCardChancePercent { get; set; } + public double? LabsAccessCardChancePercent + { + get; + set; + } [JsonPropertyName("lootItemsToAddChancePercent")] - public Dictionary LootItemsToAddChancePercent { get; set; } + public Dictionary LootItemsToAddChancePercent + { + get; + set; + } } public record Modifiers { [JsonPropertyName("equipment")] - public Dictionary Equipment { get; set; } + public Dictionary Equipment + { + get; + set; + } [JsonPropertyName("mod")] - public Dictionary Mod { get; set; } + public Dictionary Mod + { + get; + set; + } } public record ItemLimits { [JsonPropertyName("healing")] - public GenerationData Healing { get; set; } + public GenerationData Healing + { + get; + set; + } [JsonPropertyName("drugs")] - public GenerationData Drugs { get; set; } + public GenerationData Drugs + { + get; + set; + } [JsonPropertyName("stims")] - public GenerationData Stims { get; set; } + public GenerationData Stims + { + get; + set; + } [JsonPropertyName("looseLoot")] - public GenerationData LooseLoot { get; set; } + public GenerationData LooseLoot + { + get; + set; + } [JsonPropertyName("magazines")] - public GenerationData Magazines { get; set; } + public GenerationData Magazines + { + get; + set; + } [JsonPropertyName("grenades")] - public GenerationData Grenades { get; set; } + public GenerationData Grenades + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/PmcChatResponse.cs b/Libraries/Core/Models/Spt/Config/PmcChatResponse.cs index e51b3a6b..86611bd2 100644 --- a/Libraries/Core/Models/Spt/Config/PmcChatResponse.cs +++ b/Libraries/Core/Models/Spt/Config/PmcChatResponse.cs @@ -5,29 +5,61 @@ namespace Core.Models.Spt.Config; public record PmcChatResponse : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-pmcchatresponse"; + public string Kind + { + get; + set; + } = "spt-pmcchatresponse"; [JsonPropertyName("victim")] - public ResponseSettings Victim { get; set; } + public ResponseSettings Victim + { + get; + set; + } [JsonPropertyName("killer")] - public ResponseSettings Killer { get; set; } + public ResponseSettings Killer + { + get; + set; + } } public record ResponseSettings { [JsonPropertyName("responseChancePercent")] - public double ResponseChancePercent { get; set; } + public double ResponseChancePercent + { + get; + set; + } [JsonPropertyName("responseTypeWeights")] - public Dictionary ResponseTypeWeights { get; set; } + public Dictionary ResponseTypeWeights + { + get; + set; + } [JsonPropertyName("stripCapitalisationChancePercent")] - public double StripCapitalisationChancePercent { get; set; } + public double StripCapitalisationChancePercent + { + get; + set; + } [JsonPropertyName("allCapsChancePercent")] - public double AllCapsChancePercent { get; set; } + public double AllCapsChancePercent + { + get; + set; + } [JsonPropertyName("appendBroToMessageEndChancePercent")] - public double AppendBroToMessageEndChancePercent { get; set; } + public double AppendBroToMessageEndChancePercent + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/PmcConfig.cs b/Libraries/Core/Models/Spt/Config/PmcConfig.cs index 34da9688..46dbd7ad 100644 --- a/Libraries/Core/Models/Spt/Config/PmcConfig.cs +++ b/Libraries/Core/Models/Spt/Config/PmcConfig.cs @@ -8,179 +8,411 @@ namespace Core.Models.Spt.Config; public record PmcConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-pmc"; + public string Kind + { + get; + set; + } = "spt-pmc"; - /** What game version should the PMC have */ + /** + * What game version should the PMC have + */ [JsonPropertyName("gameVersionWeight")] - public Dictionary GameVersionWeight { get; set; } + public Dictionary GameVersionWeight + { + get; + set; + } - /** What account type should the PMC have */ + /** + * What account type should the PMC have + */ [JsonPropertyName("accountTypeWeight")] - public Dictionary AccountTypeWeight { get; set; } + public Dictionary AccountTypeWeight + { + get; + set; + } - /** Global whitelist/blacklist of vest loot for PMCs */ + /** + * Global whitelist/blacklist of vest loot for PMCs + */ [JsonPropertyName("vestLoot")] - public SlotLootSettings VestLoot { get; set; } + public SlotLootSettings VestLoot + { + get; + set; + } - /** Global whitelist/blacklist of pocket loot for PMCs */ + /** + * Global whitelist/blacklist of pocket loot for PMCs + */ [JsonPropertyName("pocketLoot")] - public SlotLootSettings PocketLoot { get; set; } + public SlotLootSettings PocketLoot + { + get; + set; + } - /** Global whitelist/blacklist of backpack loot for PMCs */ + /** + * Global whitelist/blacklist of backpack loot for PMCs + */ [JsonPropertyName("backpackLoot")] - public SlotLootSettings BackpackLoot { get; set; } + public SlotLootSettings BackpackLoot + { + get; + set; + } [JsonPropertyName("globalLootBlacklist")] - public List GlobalLootBlacklist { get; set; } + public List GlobalLootBlacklist + { + get; + set; + } - /** 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 { get; set; } + public bool UseDifficultyOverride + { + get; + set; + } - /** Difficulty override e.g. "AsOnline/Hard" */ + /** + * Difficulty override e.g. "AsOnline/Hard" + */ [JsonPropertyName("difficulty")] - public string Difficulty { get; set; } + public string Difficulty + { + get; + set; + } - /** 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 { get; set; } + public double LooseWeaponInBackpackChancePercent + { + get; + set; + } - /** 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 { get; set; } + public double WeaponHasEnhancementChancePercent + { + get; + set; + } - /** MinMax count of weapons to have in backpack */ + /** + * MinMax count of weapons to have in backpack + */ [JsonPropertyName("looseWeaponInBackpackLootMinMax")] - public MinMax LooseWeaponInBackpackLootMinMax { get; set; } + public MinMax LooseWeaponInBackpackLootMinMax + { + get; + set; + } [JsonPropertyName("_isUsec")] - public string? IsUsecDescription { get; set; } + public string? IsUsecDescription + { + get; + set; + } - /** Percentage chance PMC will be USEC */ + /** + * Percentage chance PMC will be USEC + */ [JsonPropertyName("isUsec")] - public double IsUsec { get; set; } + public double IsUsec + { + get; + set; + } - /** WildSpawnType enum value USEC PMCs use */ + /** + * WildSpawnType enum value USEC PMCs use + */ [JsonPropertyName("usecType")] - public string UsecType { get; set; } + public string UsecType + { + get; + set; + } - /** WildSpawnType enum value BEAR PMCs use */ + /** + * WildSpawnType enum value BEAR PMCs use + */ [JsonPropertyName("bearType")] - public string BearType { get; set; } + public string BearType + { + get; + set; + } [JsonPropertyName("_pmcType")] - public string? PmcTypeDescription { get; set; } + public string? PmcTypeDescription + { + get; + set; + } - /** 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 { get; set; } + public Dictionary>> PmcType + { + get; + set; + } [JsonPropertyName("maxBackpackLootTotalRub")] - public List MaxBackpackLootTotalRub { get; set; } + public List MaxBackpackLootTotalRub + { + get; + set; + } [JsonPropertyName("maxPocketLootTotalRub")] - public int MaxPocketLootTotalRub { get; set; } + public int MaxPocketLootTotalRub + { + get; + set; + } [JsonPropertyName("maxVestLootTotalRub")] - public int MaxVestLootTotalRub { get; set; } + public int MaxVestLootTotalRub + { + get; + set; + } - /** Percentage chance a bot from a wave is converted into a PMC, first key = map, second key = bot wildspawn type (assault/exusec), value: min+max chance to be converted */ + /** + * Percentage chance a bot from a wave is converted into a PMC, first key = map, second key = bot wildspawn type (assault/exusec), value: min+max chance to be converted + */ [JsonPropertyName("convertIntoPmcChance")] - public Dictionary> ConvertIntoPmcChance { get; set; } + public Dictionary> ConvertIntoPmcChance + { + get; + set; + } - /** How many levels above player level can a PMC be */ + /** + * How many levels above player level can a PMC be + */ [JsonPropertyName("botRelativeLevelDeltaMax")] - public double BotRelativeLevelDeltaMax { get; set; } + public double BotRelativeLevelDeltaMax + { + get; + set; + } - /** How many levels below player level can a PMC be */ + /** + * How many levels below player level can a PMC be + */ [JsonPropertyName("botRelativeLevelDeltaMin")] - public double BotRelativeLevelDeltaMin { get; set; } + public double BotRelativeLevelDeltaMin + { + get; + set; + } - /** 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 { get; set; } + public bool ForceHealingItemsIntoSecure + { + get; + set; + } [JsonPropertyName("hostilitySettings")] - public Dictionary HostilitySettings { get; set; } + public Dictionary HostilitySettings + { + get; + set; + } [JsonPropertyName("allPMCsHavePlayerNameWithRandomPrefixChance")] - public double AllPMCsHavePlayerNameWithRandomPrefixChance { get; set; } + public double AllPMCsHavePlayerNameWithRandomPrefixChance + { + get; + set; + } [JsonPropertyName("locationSpecificPmcLevelOverride")] - public Dictionary LocationSpecificPmcLevelOverride { get; set; } + public Dictionary LocationSpecificPmcLevelOverride + { + get; + set; + } - /** 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 { get; set; } + public bool AddSecureContainerLootFromBotConfig + { + get; + set; + } [JsonPropertyName("addPrefixToSameNamePMCAsPlayerChance")] - public int? AddPrefixToSameNamePMCAsPlayerChance { get; set; } + public int? AddPrefixToSameNamePMCAsPlayerChance + { + get; + set; + } [JsonPropertyName("lootItemLimitsRub")] - public List? LootItemLimitsRub { get; set; } + public List? LootItemLimitsRub + { + get; + set; + } } public record HostilitySettings { - /** Bot roles that are 100% an enemy */ + /** + * Bot roles that are 100% an enemy + */ [JsonPropertyName("additionalEnemyTypes")] - public List? AdditionalEnemyTypes { get; set; } + public List? AdditionalEnemyTypes + { + get; + set; + } - /** 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 { get; set; } + public List? ChancedEnemies + { + get; + set; + } [JsonPropertyName("bearEnemyChance")] - public double? BearEnemyChance { get; set; } + public double? BearEnemyChance + { + get; + set; + } [JsonPropertyName("usecEnemyChance")] - public double? UsecEnemyChance { get; set; } + public double? UsecEnemyChance + { + get; + set; + } [JsonPropertyName("savageEnemyChance")] - public double? SavageEnemyChance { get; set; } + public double? SavageEnemyChance + { + get; + set; + } - /** Bot roles that are 100% a friendly */ + /** + * Bot roles that are 100% a friendly + */ [JsonPropertyName("additionalFriendlyTypes")] - public List? AdditionalFriendlyTypes { get; set; } + public List? AdditionalFriendlyTypes + { + get; + set; + } [JsonPropertyName("savagePlayerBehaviour")] - public string? SavagePlayerBehaviour { get; set; } + public string? SavagePlayerBehaviour + { + get; + set; + } } public record PmcTypes { [JsonPropertyName("usec")] - public string Usec { get; set; } + public string Usec + { + get; + set; + } [JsonPropertyName("bear")] - public string Bear { get; set; } + public string Bear + { + get; + set; + } } public record SlotLootSettings { - /** Item Type whitelist */ + /** + * Item Type whitelist + */ [JsonPropertyName("whitelist")] - public List Whitelist { get; set; } + public List Whitelist + { + get; + set; + } - /** Item tpl blacklist */ + /** + * Item tpl blacklist + */ [JsonPropertyName("blacklist")] - public List Blacklist { get; set; } + public List Blacklist + { + get; + set; + } } public record MinMaxLootValue : MinMax { [JsonPropertyName("value")] - public double Value { get; set; } + public double Value + { + get; + set; + } } public record MinMaxLootItemValue : MinMax { [JsonPropertyName("backpack")] - public MinMax Backpack { get; set; } + public MinMax Backpack + { + get; + set; + } [JsonPropertyName("pocket")] - public MinMax Pocket { get; set; } + public MinMax Pocket + { + get; + set; + } [JsonPropertyName("vest")] - public MinMax Vest { get; set; } + public MinMax Vest + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/QuestConfig.cs b/Libraries/Core/Models/Spt/Config/QuestConfig.cs index 3817a44e..59a0af99 100644 --- a/Libraries/Core/Models/Spt/Config/QuestConfig.cs +++ b/Libraries/Core/Models/Spt/Config/QuestConfig.cs @@ -9,347 +9,749 @@ namespace Core.Models.Spt.Config; public record QuestConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-quest"; + public string Kind + { + get; + set; + } = "spt-quest"; // Hours to get/redeem items from quest mail keyed by profile type [JsonPropertyName("mailRedeemTimeHours")] - public Dictionary? MailRedeemTimeHours { get; set; } + public Dictionary? MailRedeemTimeHours + { + get; + set; + } [JsonPropertyName("questTemplateIds")] - public PlayerTypeQuestIds? QuestTemplateIds { get; set; } + public PlayerTypeQuestIds? QuestTemplateIds + { + get; + set; + } - /** Show non-seasonal quests be shown to player */ + /** + * Show non-seasonal quests be shown to player + */ [JsonPropertyName("showNonSeasonalEventQuests")] - public bool? ShowNonSeasonalEventQuests { get; set; } + public bool? ShowNonSeasonalEventQuests + { + get; + set; + } [JsonPropertyName("eventQuests")] - public Dictionary? EventQuests { get; set; } + public Dictionary? EventQuests + { + get; + set; + } [JsonPropertyName("repeatableQuests")] - public List? RepeatableQuests { get; set; } + public List? RepeatableQuests + { + get; + set; + } [JsonPropertyName("locationIdMap")] - public Dictionary? LocationIdMap { get; set; } + public Dictionary? LocationIdMap + { + get; + set; + } [JsonPropertyName("bearOnlyQuests")] - public List? BearOnlyQuests { get; set; } + public List? BearOnlyQuests + { + get; + set; + } [JsonPropertyName("usecOnlyQuests")] - public List? UsecOnlyQuests { get; set; } + public List? UsecOnlyQuests + { + get; + set; + } - /** 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 { get; set; } + public Dictionary>? ProfileBlacklist + { + get; + set; + } - /** key=questid, gameversions that can see/access quest */ + /** + * key=questid, gameversions that can see/access quest + */ [JsonPropertyName("profileWhitelist")] - public Dictionary>? ProfileWhitelist { get; set; } + public Dictionary>? ProfileWhitelist + { + get; + set; + } } public record PlayerTypeQuestIds { [JsonPropertyName("pmc")] - public QuestTypeIds? Pmc { get; set; } + public QuestTypeIds? Pmc + { + get; + set; + } [JsonPropertyName("scav")] - public QuestTypeIds? Scav { get; set; } + public QuestTypeIds? Scav + { + get; + set; + } } public record QuestTypeIds { [JsonPropertyName("elimination")] - public string? Elimination { get; set; } + public string? Elimination + { + get; + set; + } [JsonPropertyName("completion")] - public string? Completion { get; set; } + public string? Completion + { + get; + set; + } [JsonPropertyName("exploration")] - public string? Exploration { get; set; } + public string? Exploration + { + get; + set; + } [JsonPropertyName("pickup")] - public string? Pickup { get; set; } + public string? Pickup + { + get; + set; + } } public record EventQuestData { [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("season")] - public SeasonalEventType? Season { get; set; } + public SeasonalEventType? Season + { + get; + set; + } [JsonPropertyName("startTimestamp")] - public long? StartTimestamp { get; set; } + public long? StartTimestamp + { + get; + set; + } [JsonPropertyName("endTimestamp")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public long? EndTimestamp { get; set; } + public long? EndTimestamp + { + get; + set; + } [JsonPropertyName("yearly")] - public bool? Yearly { get; set; } + public bool? Yearly + { + get; + set; + } } public record RepeatableQuestConfig { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("side")] - public string? Side { get; set; } + public string? Side + { + get; + set; + } [JsonPropertyName("types")] - public List? Types { get; set; } + public List? Types + { + get; + set; + } [JsonPropertyName("resetTime")] - public long? ResetTime { get; set; } + public long? ResetTime + { + get; + set; + } [JsonPropertyName("numQuests")] - public int? NumQuests { get; set; } + public int? NumQuests + { + get; + set; + } [JsonPropertyName("minPlayerLevel")] - public int? MinPlayerLevel { get; set; } + public int? MinPlayerLevel + { + get; + set; + } [JsonPropertyName("rewardScaling")] - public RewardScaling? RewardScaling { get; set; } + public RewardScaling? RewardScaling + { + get; + set; + } [JsonPropertyName("locations")] - public Dictionary>? Locations { get; set; } + public Dictionary>? Locations + { + get; + set; + } [JsonPropertyName("traderWhitelist")] - public List? TraderWhitelist { get; set; } + public List? TraderWhitelist + { + get; + set; + } [JsonPropertyName("questConfig")] - public RepeatableQuestTypesConfig? QuestConfig { get; set; } + public RepeatableQuestTypesConfig? QuestConfig + { + get; + set; + } - /** Item base types to block when generating rewards */ + /** + * Item base types to block when generating rewards + */ [JsonPropertyName("rewardBaseTypeBlacklist")] - public List? RewardBaseTypeBlacklist { get; set; } + public List? RewardBaseTypeBlacklist + { + get; + set; + } - /** Item tplIds to ignore when generating rewards */ + /** + * Item tplIds to ignore when generating rewards + */ [JsonPropertyName("rewardBlacklist")] - public List? RewardBlacklist { get; set; } + public List? RewardBlacklist + { + get; + set; + } [JsonPropertyName("rewardAmmoStackMinSize")] - public int? RewardAmmoStackMinSize { get; set; } + public int? RewardAmmoStackMinSize + { + get; + set; + } [JsonPropertyName("freeChangesAvailable")] - public int? FreeChangesAvailable { get; set; } + public int? FreeChangesAvailable + { + get; + set; + } [JsonPropertyName("freeChanges")] - public int? FreeChanges { get; set; } + public int? FreeChanges + { + get; + set; + } [JsonPropertyName("keepDailyQuestTypeOnReplacement")] - public bool? KeepDailyQuestTypeOnReplacement { get; set; } + public bool? KeepDailyQuestTypeOnReplacement + { + get; + set; + } } public record RewardScaling { [JsonPropertyName("levels")] - public List? Levels { get; set; } + public List? Levels + { + get; + set; + } [JsonPropertyName("experience")] - public List? Experience { get; set; } + public List? Experience + { + get; + set; + } [JsonPropertyName("roubles")] - public List? Roubles { get; set; } + public List? Roubles + { + get; + set; + } [JsonPropertyName("gpCoins")] - public List? GpCoins { get; set; } + public List? GpCoins + { + get; + set; + } [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } [JsonPropertyName("reputation")] - public List? Reputation { get; set; } + public List? Reputation + { + get; + set; + } [JsonPropertyName("rewardSpread")] - public double? RewardSpread { get; set; } + public double? RewardSpread + { + get; + set; + } [JsonPropertyName("skillRewardChance")] - public List? SkillRewardChance { get; set; } + public List? SkillRewardChance + { + get; + set; + } [JsonPropertyName("skillPointReward")] - public List? SkillPointReward { get; set; } + public List? SkillPointReward + { + get; + set; + } } public record TraderWhitelist { [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } [JsonPropertyName("questTypes")] - public List? QuestTypes { get; set; } + public List? QuestTypes + { + get; + set; + } [JsonPropertyName("rewardBaseWhitelist")] - public List? RewardBaseWhitelist { get; set; } + public List? RewardBaseWhitelist + { + get; + set; + } [JsonPropertyName("rewardCanBeWeapon")] - public bool? RewardCanBeWeapon { get; set; } + public bool? RewardCanBeWeapon + { + get; + set; + } [JsonPropertyName("weaponRewardChancePercent")] - public double? WeaponRewardChancePercent { get; set; } + public double? WeaponRewardChancePercent + { + get; + set; + } } public record RepeatableQuestTypesConfig { [JsonPropertyName("Exploration")] - public Exploration? Exploration { get; set; } + public Exploration? Exploration + { + get; + set; + } [JsonPropertyName("Completion")] - public Completion? Completion { get; set; } + public Completion? Completion + { + get; + set; + } [JsonPropertyName("Pickup")] - public Pickup? Pickup { get; set; } + public Pickup? Pickup + { + get; + set; + } [JsonPropertyName("Elimination")] - public List? Elimination { get; set; } + public List? Elimination + { + get; + set; + } } public record Exploration : BaseQuestConfig { [JsonPropertyName("maxExtracts")] - public int? MaximumExtracts { get; set; } + public int? MaximumExtracts + { + get; + set; + } [JsonPropertyName("maxExtractsWithSpecificExit")] - public int? MaximumExtractsWithSpecificExit { get; set; } + public int? MaximumExtractsWithSpecificExit + { + get; + set; + } [JsonPropertyName("specificExits")] - public SpecificExits? SpecificExits { get; set; } + public SpecificExits? SpecificExits + { + get; + set; + } } public record SpecificExits { [JsonPropertyName("probability")] - public double? Probability { get; set; } + public double? Probability + { + get; + set; + } [JsonPropertyName("passageRequirementWhitelist")] - public List? PassageRequirementWhitelist { get; set; } + public List? PassageRequirementWhitelist + { + get; + set; + } } public record Completion : BaseQuestConfig { [JsonPropertyName("minRequestedAmount")] - public int? MinimumRequestedAmount { get; set; } + public int? MinimumRequestedAmount + { + get; + set; + } [JsonPropertyName("maxRequestedAmount")] - public int? MaximumRequestedAmount { get; set; } + public int? MaximumRequestedAmount + { + get; + set; + } [JsonPropertyName("uniqueItemCount")] - public int? UniqueItemCount { get; set; } + public int? UniqueItemCount + { + get; + set; + } [JsonPropertyName("minRequestedBulletAmount")] - public int? MinimumRequestedBulletAmount { get; set; } + public int? MinimumRequestedBulletAmount + { + get; + set; + } [JsonPropertyName("maxRequestedBulletAmount")] - public int? MaximumRequestedBulletAmount { get; set; } + public int? MaximumRequestedBulletAmount + { + get; + set; + } [JsonPropertyName("useWhitelist")] - public bool? UseWhitelist { get; set; } + public bool? UseWhitelist + { + get; + set; + } [JsonPropertyName("useBlacklist")] - public bool? UseBlacklist { get; set; } + public bool? UseBlacklist + { + get; + set; + } } public record Pickup : BaseQuestConfig { [JsonPropertyName("ItemTypeToFetchWithMaxCount")] - public List? ItemTypeToFetchWithMaxCount { get; set; } + public List? ItemTypeToFetchWithMaxCount + { + get; + set; + } - public List? ItemTypesToFetch { get; set; } + public List? ItemTypesToFetch + { + get; + set; + } [JsonPropertyName("maxItemFetchCount")] - public int? MaxItemFetchCount { get; set; } + public int? MaxItemFetchCount + { + get; + set; + } } public record PickupTypeWithMaxCount { [JsonPropertyName("itemType")] - public string? ItemType { get; set; } + public string? ItemType + { + get; + set; + } [JsonPropertyName("maxPickupCount")] - public int? MaximumPickupCount { get; set; } + public int? MaximumPickupCount + { + get; + set; + } [JsonPropertyName("minPickupCount")] - public int? MinimumPickupCount { get; set; } + public int? MinimumPickupCount + { + get; + set; + } } public record EliminationConfig : BaseQuestConfig { [JsonPropertyName("levelRange")] - public MinMax? LevelRange { get; set; } + public MinMax? LevelRange + { + get; + set; + } [JsonPropertyName("targets")] - public List>? Targets { get; set; } + public List>? Targets + { + get; + set; + } [JsonPropertyName("bodyPartProb")] - public double? BodyPartProbability { get; set; } + public double? BodyPartProbability + { + get; + set; + } [JsonPropertyName("bodyParts")] - public List>>? BodyParts { get; set; } + public List>>? BodyParts + { + get; + set; + } [JsonPropertyName("specificLocationProb")] - public double? SpecificLocationProbability { get; set; } + public double? SpecificLocationProbability + { + get; + set; + } [JsonPropertyName("distLocationBlacklist")] - public List? DistLocationBlacklist { get; set; } + public List? DistLocationBlacklist + { + get; + set; + } [JsonPropertyName("distProb")] - public double? DistanceProbability { get; set; } + public double? DistanceProbability + { + get; + set; + } [JsonPropertyName("maxDist")] - public double? MaxDistance { get; set; } + public double? MaxDistance + { + get; + set; + } [JsonPropertyName("minDist")] - public double? MinDistance { get; set; } + public double? MinDistance + { + get; + set; + } [JsonPropertyName("maxKills")] - public int? MaxKills { get; set; } + public int? MaxKills + { + get; + set; + } [JsonPropertyName("minKills")] - public int? MinKills { get; set; } + public int? MinKills + { + get; + set; + } [JsonPropertyName("minBossKills")] - public int? MinBossKills { get; set; } + public int? MinBossKills + { + get; + set; + } [JsonPropertyName("maxBossKills")] - public int? MaxBossKills { get; set; } + public int? MaxBossKills + { + get; + set; + } [JsonPropertyName("minPmcKills")] - public int? MinPmcKills { get; set; } + public int? MinPmcKills + { + get; + set; + } [JsonPropertyName("maxPmcKills")] - public int? MaxPmcKills { get; set; } + public int? MaxPmcKills + { + get; + set; + } [JsonPropertyName("weaponCategoryRequirementProb")] - public double? WeaponCategoryRequirementProbability { get; set; } + public double? WeaponCategoryRequirementProbability + { + get; + set; + } [JsonPropertyName("weaponCategoryRequirements")] - public List>>? WeaponCategoryRequirements { get; set; } + public List>>? WeaponCategoryRequirements + { + get; + set; + } [JsonPropertyName("weaponRequirementProb")] - public double? WeaponRequirementProbability { get; set; } + public double? WeaponRequirementProbability + { + get; + set; + } [JsonPropertyName("weaponRequirements")] - public List>>? WeaponRequirements { get; set; } + public List>>? WeaponRequirements + { + get; + set; + } } public record BaseQuestConfig { [JsonPropertyName("possibleSkillRewards")] - public List? PossibleSkillRewards { get; set; } + public List? PossibleSkillRewards + { + get; + set; + } } public record BossInfo { [JsonPropertyName("isBoss")] - public bool? IsBoss { get; set; } + public bool? IsBoss + { + get; + set; + } [JsonPropertyName("isPmc")] - public bool? IsPmc { get; set; } + public bool? IsPmc + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/RagfairConfig.cs b/Libraries/Core/Models/Spt/Config/RagfairConfig.cs index a0372606..b6143f29 100644 --- a/Libraries/Core/Models/Spt/Config/RagfairConfig.cs +++ b/Libraries/Core/Models/Spt/Config/RagfairConfig.cs @@ -1,403 +1,776 @@ +using System.Text.Json.Serialization; using Core.Models.Common; namespace Core.Models.Spt.Config; -using System.Text.Json.Serialization; - public record RagfairConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-ragfair"; + public string Kind + { + get; + set; + } = "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 { get; set; } + public int RunIntervalSeconds + { + get; + set; + } - /** Default values used to hydrate `runIntervalSeconds` with */ + /** + * Default values used to hydrate `runIntervalSeconds` with + */ [JsonPropertyName("runIntervalValues")] - public RunIntervalValues RunIntervalValues { get; set; } + public RunIntervalValues RunIntervalValues + { + get; + set; + } - /** Player listing settings */ + /** + * Player listing settings + */ [JsonPropertyName("sell")] - public Sell Sell { get; set; } + public Sell Sell + { + get; + set; + } - /** Trader ids + should their assorts be listed on flea */ + /** + * Trader ids + should their assorts be listed on flea + */ [JsonPropertyName("traders")] - public Dictionary Traders { get; set; } + public Dictionary Traders + { + get; + set; + } [JsonPropertyName("dynamic")] - public Dynamic Dynamic { get; set; } + public Dynamic Dynamic + { + get; + set; + } [JsonPropertyName("tieredFlea")] - public TieredFlea TieredFlea { get; set; } + public TieredFlea TieredFlea + { + get; + set; + } } 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 { get; set; } + public bool Fees + { + get; + set; + } - /** Settings to control chances of offer being sold */ + /** + * Settings to control chances of offer being sold + */ [JsonPropertyName("chance")] - public Chance Chance { get; set; } + public Chance Chance + { + get; + set; + } - /** 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 { get; set; } + public MinMax Time + { + get; + set; + } - /** Seconds from clicking remove to remove offer from market */ + /** + * Seconds from clicking remove to remove offer from market + */ [JsonPropertyName("expireSeconds")] - public int ExpireSeconds { get; set; } + public int ExpireSeconds + { + get; + set; + } } public record Chance { - /** Base chance percent to sell an item */ + /** + * Base chance percent to sell an item + */ [JsonPropertyName("base")] - public int Base { get; set; } + public int Base + { + get; + set; + } - /** Value to multiply the sell chance by */ + /** + * Value to multiply the sell chance by + */ [JsonPropertyName("sellMultiplier")] - public double SellMultiplier { get; set; } + public double SellMultiplier + { + get; + set; + } - /** Max possible sell chance % for a player listed offer */ + /** + * Max possible sell chance % for a player listed offer + */ [JsonPropertyName("maxSellChancePercent")] - public int MaxSellChancePercent { get; set; } + public int MaxSellChancePercent + { + get; + set; + } - /** Min possible sell chance % for a player listed offer */ + /** + * Min possible sell chance % for a player listed offer + */ [JsonPropertyName("minSellChancePercent")] - public int MinSellChancePercent { get; set; } + public int MinSellChancePercent + { + get; + set; + } } public record Dynamic { [JsonPropertyName("purchasesAreFoundInRaid")] // Should a purchased dynamic offers items be flagged as found in raid - public bool PurchasesAreFoundInRaid { get; set; } + public bool PurchasesAreFoundInRaid + { + get; + set; + } [JsonPropertyName("useTraderPriceForOffersIfHigher")] /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ - public bool UseTraderPriceForOffersIfHigher { get; set; } + public bool UseTraderPriceForOffersIfHigher + { + get; + set; + } [JsonPropertyName("barter")] /** Barter offer specific settings */ - public BarterDetails Barter { get; set; } + public BarterDetails Barter + { + get; + set; + } [JsonPropertyName("pack")] - public PackDetails Pack { get; set; } + public PackDetails Pack + { + get; + set; + } [JsonPropertyName("offerAdjustment")] /** Dynamic offer price below handbook adjustment values */ - public OfferAdjustment OfferAdjustment { get; set; } + public OfferAdjustment OfferAdjustment + { + get; + set; + } [JsonPropertyName("expiredOfferThreshold")] /** How many offers should expire before an offer regeneration occurs */ - public int ExpiredOfferThreshold { get; set; } + public int ExpiredOfferThreshold + { + get; + set; + } [JsonPropertyName("offerItemCount")] /** How many offers should be listed */ - public MinMax OfferItemCount { get; set; } + public MinMax OfferItemCount + { + get; + set; + } [JsonPropertyName("priceRanges")] /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - public PriceRanges PriceRanges { get; set; } + public PriceRanges PriceRanges + { + get; + set; + } [JsonPropertyName("showDefaultPresetsOnly")] /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ - public bool ShowDefaultPresetsOnly { get; set; } + public bool ShowDefaultPresetsOnly + { + get; + set; + } [JsonPropertyName("ignoreQualityPriceVarianceBlacklist")] /** Tpls that should not use the variable price system when their quality is < 100% (lower dura/uses = lower price) */ - public List IgnoreQualityPriceVarianceBlacklist { get; set; } + public List IgnoreQualityPriceVarianceBlacklist + { + get; + set; + } [JsonPropertyName("endTimeSeconds")] - public MinMax EndTimeSeconds { get; set; } + public MinMax EndTimeSeconds + { + get; + set; + } [JsonPropertyName("condition")] /** Settings to control the durability range of item items listed on flea */ - public Dictionary Condition { get; set; } + public Dictionary Condition + { + get; + set; + } [JsonPropertyName("stackablePercent")] /** Size stackable items should be listed for in percent of max stack size */ - public MinMax StackablePercent { get; set; } + public MinMax StackablePercent + { + get; + set; + } [JsonPropertyName("nonStackableCount")] /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ - public MinMax NonStackableCount { get; set; } + public MinMax NonStackableCount + { + get; + set; + } [JsonPropertyName("rating")] /** Range of rating offers for items being listed */ - public MinMax Rating { get; set; } + public MinMax Rating + { + get; + set; + } [JsonPropertyName("armor")] /** Armor specific flea settings */ - public ArmorSettings Armor { get; set; } + public ArmorSettings Armor + { + get; + set; + } [JsonPropertyName("itemPriceMultiplier")] /** A multipler to apply to individual tpls price just prior to item quality adjustment */ - public Dictionary? ItemPriceMultiplier { get; set; } + public Dictionary? ItemPriceMultiplier + { + get; + set; + } [JsonPropertyName("_currencies")] - public string? CurrenciesDescription { get; set; } + public string? CurrenciesDescription + { + get; + set; + } [JsonPropertyName("currencies")] /** Percentages to sell offers in each currency */ - public Dictionary Currencies { get; set; } + public Dictionary Currencies + { + get; + set; + } [JsonPropertyName("showAsSingleStack")] /** Item tpls that should be forced to sell as a single item */ - public List ShowAsSingleStack { get; set; } + public List ShowAsSingleStack + { + get; + set; + } [JsonPropertyName("removeSeasonalItemsWhenNotInEvent")] /** Should christmas/halloween items be removed from flea when not within the seasonal bounds */ - public bool RemoveSeasonalItemsWhenNotInEvent { get; set; } + public bool RemoveSeasonalItemsWhenNotInEvent + { + get; + set; + } [JsonPropertyName("blacklist")] /** Flea blacklist settings */ - public RagfairBlacklist Blacklist { get; set; } + public RagfairBlacklist Blacklist + { + get; + set; + } [JsonPropertyName("unreasonableModPrices")] /** Dict of price limits keyed by item type */ - public Dictionary UnreasonableModPrices { get; set; } + public Dictionary UnreasonableModPrices + { + get; + set; + } [JsonPropertyName("itemPriceOverrideRouble")] /** Custom rouble prices for items to override values from prices.json */ - public Dictionary ItemPriceOverrideRouble { get; set; } + public Dictionary ItemPriceOverrideRouble + { + get; + set; + } } public record PriceRanges { [JsonPropertyName("default")] - public MinMax Default { get; set; } + public MinMax Default + { + get; + set; + } [JsonPropertyName("preset")] - public MinMax Preset { get; set; } + public MinMax Preset + { + get; + set; + } [JsonPropertyName("pack")] - public MinMax Pack { get; set; } + public MinMax Pack + { + get; + set; + } } 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 { get; set; } + public double ChancePercent + { + get; + set; + } - /** Min number of required items for a barter requirement */ + /** + * Min number of required items for a barter requirement + */ [JsonPropertyName("itemCountMin")] - public int ItemCountMin { get; set; } + public int ItemCountMin + { + get; + set; + } - /** Max number of required items for a barter requirement */ + /** + * Max number of required items for a barter requirement + */ [JsonPropertyName("itemCountMax")] - public int ItemCountMax { get; set; } + public int ItemCountMax + { + get; + set; + } - /** 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 { get; set; } + public double PriceRangeVariancePercent + { + get; + set; + } - /** 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 { get; set; } + public double MinRoubleCostToBecomeBarter + { + get; + set; + } - /** Should barter offers only single stack */ + /** + * Should barter offers only single stack + */ [JsonPropertyName("makeSingleStackOnly")] - public bool MakeSingleStackOnly { get; set; } + public bool MakeSingleStackOnly + { + get; + set; + } - /** Item Tpls to never be turned into a barter */ + /** + * Item Tpls to never be turned into a barter + */ [JsonPropertyName("itemTypeBlacklist")] - public List ItemTypeBlacklist { get; set; } + public List ItemTypeBlacklist + { + get; + set; + } } 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 { get; set; } + public double ChancePercent + { + get; + set; + } - /** Min number of required items for a pack */ + /** + * Min number of required items for a pack + */ [JsonPropertyName("itemCountMin")] - public int ItemCountMin { get; set; } + public int ItemCountMin + { + get; + set; + } - /** Max number of required items for a pack */ + /** + * Max number of required items for a pack + */ [JsonPropertyName("itemCountMax")] - public int ItemCountMax { get; set; } + public int ItemCountMax + { + get; + set; + } - /** item types to allow being a pack */ + /** + * item types to allow being a pack + */ [JsonPropertyName("itemTypeWhitelist")] - public List ItemTypeWhitelist { get; set; } + public List ItemTypeWhitelist + { + get; + set; + } } public record OfferAdjustment { /// - /// Shuld offer price be adjusted when below handbook price + /// Shuld offer price be adjusted when below handbook price /// [JsonPropertyName("adjustPriceWhenBelowHandbookPrice")] - public bool AdjustPriceWhenBelowHandbookPrice { get; set; } + public bool AdjustPriceWhenBelowHandbookPrice + { + get; + set; + } /// - /// How big a percentage difference does price need to vary from handbook to be considered for adjustment + /// How big a percentage difference does price need to vary from handbook to be considered for adjustment /// [JsonPropertyName("maxPriceDifferenceBelowHandbookPercent")] - public double MaxPriceDifferenceBelowHandbookPercent { get; set; } + public double MaxPriceDifferenceBelowHandbookPercent + { + get; + set; + } /// - /// How much to multiply the handbook price to get the new price + /// How much to multiply the handbook price to get the new price /// [JsonPropertyName("handbookPriceMultipier")] - public double HandbookPriceMultiplier { get; set; } + public double HandbookPriceMultiplier + { + get; + set; + } /// - /// What is the minimum rouble price to consider adjusting price of item + /// What is the minimum rouble price to consider adjusting price of item /// [JsonPropertyName("priceThreshholdRub")] - public double PriceThresholdRub { get; set; } + public double PriceThresholdRub + { + get; + set; + } } public record Condition { /// - /// Percentage change durability is altered + /// Percentage change durability is altered /// [JsonPropertyName("conditionChance")] - public double ConditionChance { get; set; } + public double ConditionChance + { + get; + set; + } [JsonPropertyName("current")] - public MinMax Current { get; set; } + public MinMax Current + { + get; + set; + } [JsonPropertyName("max")] - public MinMax Max { get; set; } + public MinMax Max + { + get; + set; + } [JsonPropertyName("_name")] - public string Name { get; set; } + public string Name + { + get; + set; + } } public record RagfairBlacklist { /// - /// Damaged ammo packs + /// Damaged ammo packs /// [JsonPropertyName("damagedAmmoPacks")] - public bool DamagedAmmoPacks { get; set; } + public bool DamagedAmmoPacks + { + get; + set; + } /// - /// Custom blacklist for item Tpls + /// Custom blacklist for item Tpls /// [JsonPropertyName("custom")] - public List Custom { get; set; } + public List Custom + { + get; + set; + } /// - /// BSG blacklist a large number of items from flea, true = use blacklist + /// BSG blacklist a large number of items from flea, true = use blacklist /// [JsonPropertyName("enableBsgList")] - public bool EnableBsgList { get; set; } + public bool EnableBsgList + { + get; + set; + } /// - /// Should quest items be blacklisted from flea + /// Should quest items be blacklisted from flea /// [JsonPropertyName("enableQuestList")] - public bool EnableQuestList { get; set; } + public bool EnableQuestList + { + get; + set; + } /// - /// Should trader items that are blacklisted by bsg be listed on flea + /// Should trader items that are blacklisted by bsg be listed on flea /// [JsonPropertyName("traderItems")] - public bool TraderItems { get; set; } + public bool TraderItems + { + get; + set; + } /// - /// Maximum level an armor plate can be found in a flea-listed armor item + /// Maximum level an armor plate can be found in a flea-listed armor item /// [JsonPropertyName("armorPlate")] - public ArmorPlateBlacklistSettings ArmorPlate { get; set; } + public ArmorPlateBlacklistSettings ArmorPlate + { + get; + set; + } /// - /// Should specific categories be blacklisted from the flea, true = use blacklist + /// Should specific categories be blacklisted from the flea, true = use blacklist /// [JsonPropertyName("enableCustomItemCategoryList")] - public bool EnableCustomItemCategoryList { get; set; } + public bool EnableCustomItemCategoryList + { + get; + set; + } /// - /// Custom category blacklist for parent Ids + /// Custom category blacklist for parent Ids /// [JsonPropertyName("customItemCategoryList")] - public List CustomItemCategoryList { get; set; } + public List CustomItemCategoryList + { + get; + set; + } } public record ArmorPlateBlacklistSettings { /// - /// Max level of plates an armor can have without being removed + /// Max level of plates an armor can have without being removed /// [JsonPropertyName("maxProtectionLevel")] - public int MaxProtectionLevel { get; set; } + public int MaxProtectionLevel + { + get; + set; + } /// - /// Item slots to NOT remove from items on flea + /// Item slots to NOT remove from items on flea /// [JsonPropertyName("ignoreSlots")] - public List IgnoreSlots { get; set; } + public List IgnoreSlots + { + get; + set; + } } public record UnreasonableModPrices { /// - /// Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values + /// Enable a system that adjusts very high ragfair prices to be below a max multiple of items the handbook values /// [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } /// - /// Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted + /// Multipler to start adjusting item values from, e.g. a value of 10 means any value over 10x the handbook price gets adjusted /// [JsonPropertyName("handbookPriceOverMultiplier")] - public int HandbookPriceOverMultiplier { get; set; } + public int HandbookPriceOverMultiplier + { + get; + set; + } /// - /// The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price + /// The new multiplier for items found using above property, e.g. a value of 4 means set items price to 4x handbook price /// [JsonPropertyName("newPriceHandbookMultiplier")] - public int NewPriceHandbookMultiplier { get; set; } + public int NewPriceHandbookMultiplier + { + get; + set; + } [JsonPropertyName("itemType")] - public string ItemType { get; set; } + public string ItemType + { + get; + set; + } } public record ArmorSettings { /// - /// % chance / 100 that armor plates will be removed from an offer before listing + /// % chance / 100 that armor plates will be removed from an offer before listing /// [JsonPropertyName("removeRemovablePlateChance")] - public int RemoveRemovablePlateChance { get; set; } + public int RemoveRemovablePlateChance + { + get; + set; + } /// - /// What slots are to be removed when removeRemovablePlateChance is true + /// What slots are to be removed when removeRemovablePlateChance is true /// [JsonPropertyName("plateSlotIdToRemovePool")] - public List PlateSlotIdToRemovePool { get; set; } + public List PlateSlotIdToRemovePool + { + get; + set; + } } public record TieredFlea { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } /// - /// key: tpl, value: playerlevel + /// key: tpl, value: playerlevel /// [JsonPropertyName("unlocksTpl")] - public Dictionary UnlocksTpl { get; set; } + public Dictionary UnlocksTpl + { + get; + set; + } /// - /// key: item type id, value: playerlevel + /// key: item type id, value: playerlevel /// [JsonPropertyName("unlocksType")] - public Dictionary UnlocksType { get; set; } + public Dictionary UnlocksType + { + get; + set; + } [JsonPropertyName("ammoTplUnlocks")] - public Dictionary? AmmoTplUnlocks { get; set; } + public Dictionary? AmmoTplUnlocks + { + get; + set; + } [JsonPropertyName("ammoTiersEnabled")] - public bool AmmoTiersEnabled { get; set; } + public bool AmmoTiersEnabled + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/RepairConfig.cs b/Libraries/Core/Models/Spt/Config/RepairConfig.cs index 05820555..c4f9fdb0 100644 --- a/Libraries/Core/Models/Spt/Config/RepairConfig.cs +++ b/Libraries/Core/Models/Spt/Config/RepairConfig.cs @@ -1,116 +1,237 @@ +using System.Text.Json.Serialization; using Core.Models.Common; namespace Core.Models.Spt.Config; -using System.Text.Json.Serialization; - public record RepairConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-repair"; + public string Kind + { + get; + set; + } = "spt-repair"; [JsonPropertyName("priceMultiplier")] - public double PriceMultiplier { get; set; } + public double PriceMultiplier + { + get; + set; + } [JsonPropertyName("applyRandomizeDurabilityLoss")] - public bool ApplyRandomizeDurabilityLoss { get; set; } + public bool ApplyRandomizeDurabilityLoss + { + get; + set; + } [JsonPropertyName("weaponSkillRepairGain")] - public double WeaponSkillRepairGain { get; set; } + public double WeaponSkillRepairGain + { + get; + set; + } [JsonPropertyName("armorKitSkillPointGainPerRepairPointMultiplier")] - public double ArmorKitSkillPointGainPerRepairPointMultiplier { get; set; } + public double ArmorKitSkillPointGainPerRepairPointMultiplier + { + get; + set; + } - /** INT gain multiplier per repaired item type */ + /** + * INT gain multiplier per repaired item type + */ [JsonPropertyName("repairKitIntellectGainMultiplier")] - public IntellectGainValues RepairKitIntellectGainMultiplier { get; set; } + public IntellectGainValues RepairKitIntellectGainMultiplier + { + get; + set; + } // ** How much INT can be given to player per repair action */ [JsonPropertyName("maxIntellectGainPerRepair")] - public MaxIntellectGainValues MaxIntellectGainPerRepair { get; set; } + public MaxIntellectGainValues MaxIntellectGainPerRepair + { + get; + set; + } [JsonPropertyName("weaponTreatment")] - public WeaponTreatmentRepairValues WeaponTreatment { get; set; } + public WeaponTreatmentRepairValues WeaponTreatment + { + get; + set; + } [JsonPropertyName("repairKit")] - public RepairKit RepairKit { get; set; } + public RepairKit RepairKit + { + get; + set; + } } public record IntellectGainValues { [JsonPropertyName("weapon")] - public double Weapon { get; set; } + public double Weapon + { + get; + set; + } [JsonPropertyName("armor")] - public double Armor { get; set; } + public double Armor + { + get; + set; + } } public record MaxIntellectGainValues { [JsonPropertyName("kit")] - public double Kit { get; set; } + public double Kit + { + get; + set; + } [JsonPropertyName("trader")] - public double Trader { get; set; } + public double Trader + { + get; + set; + } } public record WeaponTreatmentRepairValues { - /** The chance to gain more weapon maintenance skill */ + /** + * The chance to gain more weapon maintenance skill + */ [JsonPropertyName("critSuccessChance")] - public double CritSuccessChance { get; set; } + public double CritSuccessChance + { + get; + set; + } [JsonPropertyName("critSuccessAmount")] - public double CritSuccessAmount { get; set; } + public double CritSuccessAmount + { + get; + set; + } - /** The chance to gain less weapon maintenance skill */ + /** + * The chance to gain less weapon maintenance skill + */ [JsonPropertyName("critFailureChance")] - public double CritFailureChance { get; set; } + public double CritFailureChance + { + get; + set; + } [JsonPropertyName("critFailureAmount")] - public double CritFailureAmount { get; set; } + public double CritFailureAmount + { + get; + set; + } - /** The multiplier used for calculating weapon maintenance XP */ + /** + * The multiplier used for calculating weapon maintenance XP + */ [JsonPropertyName("pointGainMultiplier")] - public double PointGainMultiplier { get; set; } + public double PointGainMultiplier + { + get; + set; + } } public record RepairKit { [JsonPropertyName("armor")] - public BonusSettings Armor { get; set; } + public BonusSettings Armor + { + get; + set; + } [JsonPropertyName("weapon")] - public BonusSettings Weapon { get; set; } + public BonusSettings Weapon + { + get; + set; + } [JsonPropertyName("vest")] - public BonusSettings Vest { get; set; } + public BonusSettings Vest + { + get; + set; + } [JsonPropertyName("headwear")] - public BonusSettings Headwear { get; set; } + public BonusSettings Headwear + { + get; + set; + } } public record BonusSettings { [JsonPropertyName("rarityWeight")] - public Dictionary RarityWeight { get; set; } + public Dictionary RarityWeight + { + get; + set; + } [JsonPropertyName("bonusTypeWeight")] - public Dictionary BonusTypeWeight { get; set; } + public Dictionary BonusTypeWeight + { + get; + set; + } [JsonPropertyName("Common")] - public Dictionary Common { get; set; } + public Dictionary Common + { + get; + set; + } [JsonPropertyName("Rare")] - public Dictionary Rare { get; set; } + public Dictionary Rare + { + get; + set; + } } public record BonusValues { [JsonPropertyName("valuesMinMax")] - public MinMax ValuesMinMax { get; set; } + public MinMax ValuesMinMax + { + get; + set; + } - /** 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 { get; set; } + public MinMax ActiveDurabilityPercentMinMax + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs b/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs index b05a1d06..121880ec 100644 --- a/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs +++ b/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs @@ -1,80 +1,163 @@ -using Core.Models.Common; +using System.Text.Json.Serialization; +using Core.Models.Common; namespace Core.Models.Spt.Config; -using System.Text.Json.Serialization; - public record ScavCaseConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-scavcase"; + public string Kind + { + get; + set; + } = "spt-scavcase"; [JsonPropertyName("rewardItemValueRangeRub")] - public Dictionary RewardItemValueRangeRub { get; set; } + public Dictionary RewardItemValueRangeRub + { + get; + set; + } [JsonPropertyName("moneyRewards")] - public MoneyRewards MoneyRewards { get; set; } + public MoneyRewards MoneyRewards + { + get; + set; + } [JsonPropertyName("ammoRewards")] - public AmmoRewards AmmoRewards { get; set; } + public AmmoRewards AmmoRewards + { + get; + set; + } [JsonPropertyName("rewardItemParentBlacklist")] - public List RewardItemParentBlacklist { get; set; } + public List RewardItemParentBlacklist + { + get; + set; + } [JsonPropertyName("rewardItemBlacklist")] - public List RewardItemBlacklist { get; set; } + public List RewardItemBlacklist + { + get; + set; + } [JsonPropertyName("allowMultipleMoneyRewardsPerRarity")] - public bool AllowMultipleMoneyRewardsPerRarity { get; set; } + public bool AllowMultipleMoneyRewardsPerRarity + { + get; + set; + } [JsonPropertyName("allowMultipleAmmoRewardsPerRarity")] - public bool AllowMultipleAmmoRewardsPerRarity { get; set; } + public bool AllowMultipleAmmoRewardsPerRarity + { + get; + set; + } [JsonPropertyName("allowBossItemsAsRewards")] - public bool AllowBossItemsAsRewards { get; set; } + public bool AllowBossItemsAsRewards + { + get; + set; + } } public record MoneyRewards { [JsonPropertyName("moneyRewardChancePercent")] - public int MoneyRewardChancePercent { get; set; } + public int MoneyRewardChancePercent + { + get; + set; + } [JsonPropertyName("rubCount")] - public MoneyLevels RubCount { get; set; } + public MoneyLevels RubCount + { + get; + set; + } [JsonPropertyName("usdCount")] - public MoneyLevels UsdCount { get; set; } + public MoneyLevels UsdCount + { + get; + set; + } [JsonPropertyName("eurCount")] - public MoneyLevels EurCount { get; set; } + public MoneyLevels EurCount + { + get; + set; + } [JsonPropertyName("gpCount")] - public MoneyLevels GpCount { get; set; } + public MoneyLevels GpCount + { + get; + set; + } } public record MoneyLevels { [JsonPropertyName("common")] - public MinMax Common { get; set; } + public MinMax Common + { + get; + set; + } [JsonPropertyName("rare")] - public MinMax Rare { get; set; } + public MinMax Rare + { + get; + set; + } [JsonPropertyName("superrare")] - public MinMax SuperRare { get; set; } + public MinMax SuperRare + { + get; + set; + } } public record AmmoRewards { [JsonPropertyName("ammoRewardChancePercent")] - public int AmmoRewardChancePercent { get; set; } + public int AmmoRewardChancePercent + { + get; + set; + } [JsonPropertyName("ammoRewardBlacklist")] - public Dictionary> AmmoRewardBlacklist { get; set; } + public Dictionary> AmmoRewardBlacklist + { + get; + set; + } [JsonPropertyName("ammoRewardValueRangeRub")] - public Dictionary AmmoRewardValueRangeRub { get; set; } + public Dictionary AmmoRewardValueRangeRub + { + get; + set; + } [JsonPropertyName("minStackSize")] - public int MinStackSize { get; set; } + public int MinStackSize + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/SeasonalEventConfig.cs b/Libraries/Core/Models/Spt/Config/SeasonalEventConfig.cs index 6c41ccb9..8f7d03bd 100644 --- a/Libraries/Core/Models/Spt/Config/SeasonalEventConfig.cs +++ b/Libraries/Core/Models/Spt/Config/SeasonalEventConfig.cs @@ -8,149 +8,322 @@ namespace Core.Models.Spt.Config; public record SeasonalEventConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-seasonalevents"; + public string Kind + { + get; + set; + } = "spt-seasonalevents"; [JsonPropertyName("enableSeasonalEventDetection")] - public bool EnableSeasonalEventDetection { get; set; } + public bool EnableSeasonalEventDetection + { + get; + set; + } - /** event / botType / equipSlot / itemid */ + /** + * event / botType / equipSlot / itemid + */ [JsonPropertyName("eventGear")] - public Dictionary>>> EventGear { get; set; } + public Dictionary>>> EventGear + { + get; + set; + } - /** event / bot type / equipSlot / itemid */ + /** + * event / bot type / equipSlot / itemid + */ [JsonPropertyName("eventLoot")] - public Dictionary>>> EventLoot { get; set; } + public Dictionary>>> EventLoot + { + get; + set; + } [JsonPropertyName("events")] - public List Events { get; set; } + public List Events + { + get; + set; + } [JsonPropertyName("eventBotMapping")] - public Dictionary EventBotMapping { get; set; } + public Dictionary EventBotMapping + { + get; + set; + } [JsonPropertyName("eventBossSpawns")] - public Dictionary>> EventBossSpawns { get; set; } + public Dictionary>> EventBossSpawns + { + get; + set; + } [JsonPropertyName("eventWaves")] - public Dictionary>> EventWaves { get; set; } + public Dictionary>> EventWaves + { + get; + set; + } [JsonPropertyName("gifterSettings")] - public List GifterSettings { get; set; } + public List GifterSettings + { + get; + set; + } - /** key = event, second key = map name */ + /** + * key = event, second key = map name + */ [JsonPropertyName("hostilitySettingsForEvent")] - public Dictionary>> HostilitySettingsForEvent { get; set; } + public Dictionary>> HostilitySettingsForEvent + { + get; + set; + } - /** 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 { get; set; } + public List ChristmasContainerIds + { + get; + set; + } - /** Season - botType - location (body/feet/hands/head) */ + /** + * Season - botType - location (body/feet/hands/head) + */ [JsonPropertyName("botAppearanceChanges")] - public Dictionary>>> BotAppearanceChanges { get; set; } + public Dictionary>>> BotAppearanceChanges + { + get; + set; + } } public record SeasonalEvent { [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + public bool Enabled + { + get; + set; + } [JsonPropertyName("name")] - public string Name { get; set; } + public string Name + { + get; + set; + } [JsonPropertyName("type")] - public SeasonalEventType Type { get; set; } + public SeasonalEventType Type + { + get; + set; + } [JsonPropertyName("startDay")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int StartDay { get; set; } + public int StartDay + { + get; + set; + } [JsonPropertyName("startMonth")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int StartMonth { get; set; } + public int StartMonth + { + get; + set; + } [JsonPropertyName("endDay")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int EndDay { get; set; } + public int EndDay + { + get; + set; + } [JsonPropertyName("endMonth")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int EndMonth { get; set; } + public int EndMonth + { + get; + set; + } [JsonPropertyName("settings")] - public SeasonalEventSettings? Settings { get; set; } + public SeasonalEventSettings? Settings + { + get; + set; + } [JsonPropertyName("setting")] public SeasonalEventSettings? SettingsDoNOTUse { - set => Settings = value; + set + { + Settings = value; + } } } public record SeasonalEventSettings { [JsonPropertyName("enableSummoning")] - public bool? EnableSummoning { get; set; } + public bool? EnableSummoning + { + get; + set; + } [JsonPropertyName("enableHalloweenHideout")] - public bool? EnableHalloweenHideout { get; set; } + public bool? EnableHalloweenHideout + { + get; + set; + } [JsonPropertyName("enableChristmasHideout")] - public bool? EnableChristmasHideout { get; set; } + public bool? EnableChristmasHideout + { + get; + set; + } [JsonPropertyName("enableSanta")] - public bool? EnableSanta { get; set; } + public bool? EnableSanta + { + get; + set; + } [JsonPropertyName("adjustBotAppearances")] - public bool? AdjustBotAppearances { get; set; } + public bool? AdjustBotAppearances + { + get; + set; + } [JsonPropertyName("addEventGearToBots")] - public bool? AddEventGearToBots { get; set; } + public bool? AddEventGearToBots + { + get; + set; + } [JsonPropertyName("addEventLootToBots")] - public bool? AddEventLootToBots { get; set; } + public bool? AddEventLootToBots + { + get; + set; + } [JsonPropertyName("removeEntryRequirement")] - public List? RemoveEntryRequirement { get; set; } + public List? RemoveEntryRequirement + { + get; + set; + } [JsonPropertyName("replaceBotHostility")] - public bool? ReplaceBotHostility { get; set; } + public bool? ReplaceBotHostility + { + get; + set; + } [JsonPropertyName("forceSeason")] - public Season? ForceSeason { get; set; } + public Season? ForceSeason + { + get; + set; + } [JsonPropertyName("zombieSettings")] - public ZombieSettings? ZombieSettings { get; set; } + public ZombieSettings? ZombieSettings + { + get; + set; + } [JsonPropertyName("disableBosses")] - public List? DisableBosses { get; set; } + public List? DisableBosses + { + get; + set; + } [JsonPropertyName("disableWaves")] - public List? DisableWaves { get; set; } + public List? DisableWaves + { + get; + set; + } } public record ZombieSettings { [JsonPropertyName("enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("mapInfectionAmount")] - public Dictionary? MapInfectionAmount { get; set; } + public Dictionary? MapInfectionAmount + { + get; + set; + } [JsonPropertyName("disableBosses")] - public List? DisableBosses { get; set; } + public List? DisableBosses + { + get; + set; + } [JsonPropertyName("disableWaves")] - public List? DisableWaves { get; set; } + public List? DisableWaves + { + get; + set; + } } public record GifterSetting { [JsonPropertyName("map")] - public string? Map { get; set; } + public string? Map + { + get; + set; + } [JsonPropertyName("zones")] - public string? Zones { get; set; } + public string? Zones + { + get; + set; + } [JsonPropertyName("spawnChance")] - public int? SpawnChance { get; set; } + public int? SpawnChance + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/TraderConfig.cs b/Libraries/Core/Models/Spt/Config/TraderConfig.cs index ec6896fa..3429bda3 100644 --- a/Libraries/Core/Models/Spt/Config/TraderConfig.cs +++ b/Libraries/Core/Models/Spt/Config/TraderConfig.cs @@ -7,174 +7,388 @@ namespace Core.Models.Spt.Config; public record TraderConfig : BaseConfig { [JsonPropertyName("kind")] - public string Kind { get; set; } = "spt-trader"; + public string Kind + { + get; + set; + } = "spt-trader"; [JsonPropertyName("updateTime")] - public List UpdateTime { get; set; } + public List UpdateTime + { + get; + set; + } [JsonPropertyName("updateTimeDefault")] - public int UpdateTimeDefault { get; set; } + public int UpdateTimeDefault + { + get; + set; + } [JsonPropertyName("purchasesAreFoundInRaid")] - public bool PurchasesAreFoundInRaid { get; set; } + public bool PurchasesAreFoundInRaid + { + get; + set; + } - /** 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 { get; set; } + public bool TradersResetFromServerStart + { + get; + set; + } [JsonPropertyName("traderPriceMultipler")] - public double TraderPriceMultipler { get; set; } + public double TraderPriceMultipler + { + get; + set; + } [JsonPropertyName("fence")] - public FenceConfig Fence { get; set; } + public FenceConfig Fence + { + get; + set; + } [JsonPropertyName("moddedTraders")] - public ModdedTraders ModdedTraders { get; set; } + public ModdedTraders ModdedTraders + { + get; + set; + } } public record UpdateTime { [JsonPropertyName("_name")] - public string Name { get; set; } + public string Name + { + get; + set; + } [JsonPropertyName("traderId")] - public string TraderId { get; set; } + public string TraderId + { + get; + set; + } - /** Seconds between trader resets */ + /** + * Seconds between trader resets + */ [JsonPropertyName("seconds")] - public MinMax Seconds { get; set; } + public MinMax Seconds + { + get; + set; + } } public record FenceConfig { [JsonPropertyName("discountOptions")] - public DiscountOptions DiscountOptions { get; set; } + public DiscountOptions DiscountOptions + { + get; + set; + } [JsonPropertyName("partialRefreshTimeSeconds")] - public int PartialRefreshTimeSeconds { get; set; } + public int PartialRefreshTimeSeconds + { + get; + set; + } [JsonPropertyName("partialRefreshChangePercent")] - public double PartialRefreshChangePercent { get; set; } + public double PartialRefreshChangePercent + { + get; + set; + } [JsonPropertyName("assortSize")] - public int AssortSize { get; set; } + public int AssortSize + { + get; + set; + } [JsonPropertyName("weaponPresetMinMax")] - public MinMax WeaponPresetMinMax { get; set; } + public MinMax WeaponPresetMinMax + { + get; + set; + } [JsonPropertyName("equipmentPresetMinMax")] - public MinMax EquipmentPresetMinMax { get; set; } + public MinMax EquipmentPresetMinMax + { + get; + set; + } [JsonPropertyName("itemPriceMult")] - public double ItemPriceMult { get; set; } + public double ItemPriceMult + { + get; + set; + } [JsonPropertyName("presetPriceMult")] - public double PresetPriceMult { get; set; } + public double PresetPriceMult + { + get; + set; + } [JsonPropertyName("armorMaxDurabilityPercentMinMax")] - public ItemDurabilityCurrentMax ArmorMaxDurabilityPercentMinMax { get; set; } + public ItemDurabilityCurrentMax ArmorMaxDurabilityPercentMinMax + { + get; + set; + } [JsonPropertyName("weaponDurabilityPercentMinMax")] - public ItemDurabilityCurrentMax WeaponDurabilityPercentMinMax { get; set; } + public ItemDurabilityCurrentMax WeaponDurabilityPercentMinMax + { + get; + set; + } - /** Keyed to plate protection level */ + /** + * Keyed to plate protection level + */ [JsonPropertyName("chancePlateExistsInArmorPercent")] - public Dictionary ChancePlateExistsInArmorPercent { get; set; } + public Dictionary ChancePlateExistsInArmorPercent + { + get; + set; + } - /** Key: item tpl */ + /** + * Key: item tpl + */ [JsonPropertyName("itemStackSizeOverrideMinMax")] - public Dictionary ItemStackSizeOverrideMinMax { get; set; } + public Dictionary ItemStackSizeOverrideMinMax + { + get; + set; + } [JsonPropertyName("itemTypeLimits")] - public Dictionary ItemTypeLimits { get; set; } + public Dictionary ItemTypeLimits + { + get; + set; + } - /** 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 { get; set; } + public List PreventDuplicateOffersOfCategory + { + get; + set; + } [JsonPropertyName("regenerateAssortsOnRefresh")] - public bool RegenerateAssortsOnRefresh { get; set; } + public bool RegenerateAssortsOnRefresh + { + get; + set; + } - /** 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 { get; set; } + public Dictionary ItemCategoryRoublePriceLimit + { + get; + set; + } - /** 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 { get; set; } + public Dictionary PresetSlotsToRemoveChancePercent + { + get; + set; + } - /** Block seasonal items from appearing when season is inactive */ + /** + * Block seasonal items from appearing when season is inactive + */ [JsonPropertyName("blacklistSeasonalItems")] - public bool BlacklistSeasonalItems { get; set; } + public bool BlacklistSeasonalItems + { + get; + set; + } - /** 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 { get; set; } + public double AmmoMaxPenLimit + { + get; + set; + } [JsonPropertyName("blacklist")] - public List Blacklist { get; set; } + public List Blacklist + { + get; + set; + } [JsonPropertyName("coopExtractGift")] - public CoopExtractReward CoopExtractGift { get; set; } + public CoopExtractReward CoopExtractGift + { + get; + set; + } [JsonPropertyName("btrDeliveryExpireHours")] - public int BtrDeliveryExpireHours { get; set; } + public int BtrDeliveryExpireHours + { + get; + set; + } - /** Smallest value player rep with fence can fall to */ + /** + * Smallest value player rep with fence can fall to + */ [JsonPropertyName("playerRepMin")] - public double PlayerRepMin { get; set; } + public double PlayerRepMin + { + get; + set; + } - /** Highest value player rep with fence can climb to */ + /** + * Highest value player rep with fence can climb to + */ [JsonPropertyName("playerRepMax")] - public double PlayerRepMax { get; set; } + public double PlayerRepMax + { + get; + set; + } } public record ItemDurabilityCurrentMax { [JsonPropertyName("current")] - public MinMax Current { get; set; } + public MinMax Current + { + get; + set; + } [JsonPropertyName("max")] - public MinMax Max { get; set; } + public MinMax Max + { + get; + set; + } } public record CoopExtractReward : LootRequest { [JsonPropertyName("sendGift")] - public bool SendGift { get; set; } + public bool SendGift + { + get; + set; + } [JsonPropertyName("useRewarditemBlacklist")] - public bool UseRewarditemBlacklist { get; set; } + public bool UseRewarditemBlacklist + { + get; + set; + } [JsonPropertyName("messageLocaleIds")] - public List MessageLocaleIds { get; set; } + public List MessageLocaleIds + { + get; + set; + } [JsonPropertyName("giftExpiryHours")] - public int GiftExpiryHours { get; set; } + public int GiftExpiryHours + { + get; + set; + } } public record DiscountOptions { [JsonPropertyName("assortSize")] - public int AssortSize { get; set; } + public int AssortSize + { + get; + set; + } [JsonPropertyName("itemPriceMult")] - public double ItemPriceMult { get; set; } + public double ItemPriceMult + { + get; + set; + } [JsonPropertyName("presetPriceMult")] - public double PresetPriceMult { get; set; } + public double PresetPriceMult + { + get; + set; + } [JsonPropertyName("weaponPresetMinMax")] - public MinMax WeaponPresetMinMax { get; set; } + public MinMax WeaponPresetMinMax + { + get; + set; + } [JsonPropertyName("equipmentPresetMinMax")] - public MinMax EquipmentPresetMinMax { get; set; } + public MinMax EquipmentPresetMinMax + { + get; + set; + } } -/** 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 { get; set; } + public List ClothingService + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Config/WeatherConfig.cs b/Libraries/Core/Models/Spt/Config/WeatherConfig.cs index 500f3594..42370ae4 100644 --- a/Libraries/Core/Models/Spt/Config/WeatherConfig.cs +++ b/Libraries/Core/Models/Spt/Config/WeatherConfig.cs @@ -8,104 +8,216 @@ namespace Core.Models.Spt.Config; public record WeatherConfig : BaseConfig { [JsonPropertyName("kind")] - public string? Kind { get; set; } = "spt-weather"; + public string? Kind + { + get; + set; + } = "spt-weather"; [JsonPropertyName("acceleration")] - public double? Acceleration { get; set; } + public double? Acceleration + { + get; + set; + } [JsonPropertyName("weather")] - public WeatherValues? Weather { get; set; } + public WeatherValues? Weather + { + get; + set; + } [JsonPropertyName("seasonDates")] - public List? SeasonDates { get; set; } + public List? SeasonDates + { + get; + set; + } [JsonPropertyName("overrideSeason")] - public Season? OverrideSeason { get; set; } + public Season? OverrideSeason + { + get; + set; + } } public record SeasonDateTimes { [JsonPropertyName("seasonType")] - public Season? SeasonType { get; set; } + public Season? SeasonType + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("startDay")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? StartDay { get; set; } + public int? StartDay + { + get; + set; + } [JsonPropertyName("startMonth")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? StartMonth { get; set; } + public int? StartMonth + { + get; + set; + } [JsonPropertyName("endDay")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? EndDay { get; set; } + public int? EndDay + { + get; + set; + } [JsonPropertyName("endMonth")] [JsonConverter(typeof(StringToNumberFactoryConverter))] - public int? EndMonth { get; set; } + public int? EndMonth + { + get; + set; + } } public record WeatherValues { [JsonPropertyName("seasonValues")] - public Dictionary? SeasonValues { get; set; } + public Dictionary? SeasonValues + { + get; + set; + } - /** 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 { get; set; } + public int? GenerateWeatherAmountHours + { + get; + set; + } - /** Length of each weather period */ + /** + * Length of each weather period + */ [JsonPropertyName("timePeriod")] - public WeatherSettings? TimePeriod { get; set; } + public WeatherSettings? TimePeriod + { + get; + set; + } } public record SeasonalValues { [JsonPropertyName("clouds")] - public WeatherSettings? Clouds { get; set; } + public WeatherSettings? Clouds + { + get; + set; + } [JsonPropertyName("windSpeed")] - public WeatherSettings? WindSpeed { get; set; } + public WeatherSettings? WindSpeed + { + get; + set; + } [JsonPropertyName("windDirection")] - public WeatherSettings? WindDirection { get; set; } + public WeatherSettings? WindDirection + { + get; + set; + } [JsonPropertyName("windGustiness")] - public MinMax? WindGustiness { get; set; } + public MinMax? WindGustiness + { + get; + set; + } [JsonPropertyName("rain")] - public WeatherSettings? Rain { get; set; } + public WeatherSettings? Rain + { + get; + set; + } [JsonPropertyName("rainIntensity")] - public MinMax? RainIntensity { get; set; } + public MinMax? RainIntensity + { + get; + set; + } [JsonPropertyName("fog")] - public WeatherSettings? Fog { get; set; } + public WeatherSettings? Fog + { + get; + set; + } [JsonPropertyName("temp")] - public TempDayNight? Temp { get; set; } + public TempDayNight? Temp + { + get; + set; + } [JsonPropertyName("pressure")] - public MinMax? Pressure { get; set; } + public MinMax? Pressure + { + get; + set; + } } public record TempDayNight { [JsonPropertyName("day")] - public MinMax? Day { get; set; } + public MinMax? Day + { + get; + set; + } [JsonPropertyName("night")] - public MinMax? Night { get; set; } + public MinMax? Night + { + get; + set; + } } public record WeatherSettings { [JsonPropertyName("values")] - public List? Values { get; set; } + public List? Values + { + get; + set; + } [JsonPropertyName("weights")] - public List? Weights { get; set; } + public List? Weights + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Dialog/SendMessageDetails.cs b/Libraries/Core/Models/Spt/Dialog/SendMessageDetails.cs index 64ea17b8..792cc7af 100644 --- a/Libraries/Core/Models/Spt/Dialog/SendMessageDetails.cs +++ b/Libraries/Core/Models/Spt/Dialog/SendMessageDetails.cs @@ -8,98 +8,172 @@ namespace Core.Models.Spt.Dialog; public record SendMessageDetails { /// - /// Player id + /// Player id /// [JsonPropertyName("recipientId")] - public string? RecipientId { get; set; } + public string? RecipientId + { + get; + set; + } /// - /// Who is sending this message + /// Who is sending this message /// [JsonPropertyName("sender")] - public MessageType? Sender { get; set; } + public MessageType? Sender + { + get; + set; + } /// - /// Optional - leave blank to use sender value + /// Optional - leave blank to use sender value /// [JsonPropertyName("dialogType")] - public MessageType? DialogType { get; set; } + public MessageType? DialogType + { + get; + set; + } /// - /// Optional - if sender is USER these details are used + /// Optional - if sender is USER these details are used /// [JsonPropertyName("senderDetails")] - public UserDialogInfo? SenderDetails { get; set; } + public UserDialogInfo? SenderDetails + { + get; + set; + } /// - /// Optional - the trader sending the message + /// Optional - the trader sending the message /// [JsonPropertyName("trader")] - public string? Trader { get; set; } + public string? Trader + { + get; + set; + } /// - /// Optional - used in player/system messages, otherwise templateId is used + /// Optional - used in player/system messages, otherwise templateId is used /// [JsonPropertyName("messageText")] - public string? MessageText { get; set; } + public string? MessageText + { + get; + set; + } /// - /// Optional - Items to send to player + /// Optional - Items to send to player /// [JsonPropertyName("items")] - public List? Items { get; set; } + public List? Items + { + get; + set; + } /// - /// Optional - How long items will be stored in mail before expiry + /// Optional - How long items will be stored in mail before expiry /// [JsonPropertyName("itemsMaxStorageLifetimeSeconds")] - public long? ItemsMaxStorageLifetimeSeconds { get; set; } + public long? ItemsMaxStorageLifetimeSeconds + { + get; + set; + } /// - /// Optional - Used when sending messages from traders who send text from locale json + /// Optional - Used when sending messages from traders who send text from locale json /// [JsonPropertyName("templateId")] - public string? TemplateId { get; set; } + public string? TemplateId + { + get; + set; + } /// - /// Optional - ragfair related + /// Optional - ragfair related /// [JsonPropertyName("systemData")] - public SystemData? SystemData { get; set; } + public SystemData? SystemData + { + get; + set; + } /// - /// Optional - Used by ragfair messages + /// Optional - Used by ragfair messages /// [JsonPropertyName("ragfairDetails")] - public MessageContentRagfair? RagfairDetails { get; set; } + public MessageContentRagfair? RagfairDetails + { + get; + set; + } /// - /// OPTIONAL - allows modification of profile settings via mail + /// OPTIONAL - allows modification of profile settings via mail /// [JsonPropertyName("profileChangeEvents")] - public List? ProfileChangeEvents { get; set; } + public List? ProfileChangeEvents + { + get; + set; + } - /** 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 { get; set; } + public string? ReplyTo + { + get; + set; + } } public record ProfileChangeEvent { [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("Type")] - public ProfileChangeEventType? Type { get; set; } + public ProfileChangeEventType? Type + { + get; + set; + } [JsonPropertyName("value")] - public double? Value { get; set; } + public double? Value + { + get; + set; + } [JsonPropertyName("entity")] - public string? Entity { get; set; } + public string? Entity + { + get; + set; + } [JsonPropertyName("data")] - public string? Data { get; set; } + public string? Data + { + get; + set; + } } public enum ProfileChangeEventType diff --git a/Libraries/Core/Models/Spt/Fence/CreateFenceAssortsResult.cs b/Libraries/Core/Models/Spt/Fence/CreateFenceAssortsResult.cs index 2e6d453c..b99b6b2e 100644 --- a/Libraries/Core/Models/Spt/Fence/CreateFenceAssortsResult.cs +++ b/Libraries/Core/Models/Spt/Fence/CreateFenceAssortsResult.cs @@ -6,11 +6,23 @@ namespace Core.Models.Spt.Fence; public record CreateFenceAssortsResult { [JsonPropertyName("sptItems")] - public List>? SptItems { get; set; } + public List>? SptItems + { + get; + set; + } [JsonPropertyName("barter_scheme")] - public Dictionary>>? BarterScheme { get; set; } + public Dictionary>>? BarterScheme + { + get; + set; + } [JsonPropertyName("loyal_level_items")] - public Dictionary? LoyalLevelItems { get; set; } + public Dictionary? LoyalLevelItems + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Fence/FenceAssortGenerationValues.cs b/Libraries/Core/Models/Spt/Fence/FenceAssortGenerationValues.cs index 1668286b..f0958b84 100644 --- a/Libraries/Core/Models/Spt/Fence/FenceAssortGenerationValues.cs +++ b/Libraries/Core/Models/Spt/Fence/FenceAssortGenerationValues.cs @@ -5,20 +5,40 @@ namespace Core.Models.Spt.Fence; public record FenceAssortGenerationValues { [JsonPropertyName("normal")] - public GenerationAssortValues? Normal { get; set; } + public GenerationAssortValues? Normal + { + get; + set; + } [JsonPropertyName("discount")] - public GenerationAssortValues? Discount { get; set; } + public GenerationAssortValues? Discount + { + get; + set; + } } public record GenerationAssortValues { [JsonPropertyName("item")] - public int? Item { get; set; } + public int? Item + { + get; + set; + } [JsonPropertyName("weaponPreset")] - public int? WeaponPreset { get; set; } + public int? WeaponPreset + { + get; + set; + } [JsonPropertyName("equipmentPreset")] - public int? EquipmentPreset { get; set; } + public int? EquipmentPreset + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Helper/WeightedRandomResult.cs b/Libraries/Core/Models/Spt/Helper/WeightedRandomResult.cs index 4b6887fd..ceb9b9e9 100644 --- a/Libraries/Core/Models/Spt/Helper/WeightedRandomResult.cs +++ b/Libraries/Core/Models/Spt/Helper/WeightedRandomResult.cs @@ -2,6 +2,15 @@ namespace Core.Models.Spt.Helper; public record WeightedRandomResult { - public T Item { get; set; } - public int Index { get; set; } + public T Item + { + get; + set; + } + + public int Index + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Hideout/CircleCraftDetails.cs b/Libraries/Core/Models/Spt/Hideout/CircleCraftDetails.cs index 47551c6c..bdb6b486 100644 --- a/Libraries/Core/Models/Spt/Hideout/CircleCraftDetails.cs +++ b/Libraries/Core/Models/Spt/Hideout/CircleCraftDetails.cs @@ -7,14 +7,30 @@ namespace Core.Models.Spt.Hideout; public record CircleCraftDetails { [JsonPropertyName("time")] - public long Time { get; set; } + public long Time + { + get; + set; + } [JsonPropertyName("rewardType")] - public CircleRewardType? RewardType { get; set; } + public CircleRewardType? RewardType + { + get; + set; + } [JsonPropertyName("rewardAmountRoubles")] - public int? RewardAmountRoubles { get; set; } + public int? RewardAmountRoubles + { + get; + set; + } [JsonPropertyName("rewardDetails")] - public CraftTimeThreshold? RewardDetails { get; set; } + public CraftTimeThreshold? RewardDetails + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Hideout/Hideout.cs b/Libraries/Core/Models/Spt/Hideout/Hideout.cs index cb1774a1..e001a9d0 100644 --- a/Libraries/Core/Models/Spt/Hideout/Hideout.cs +++ b/Libraries/Core/Models/Spt/Hideout/Hideout.cs @@ -6,17 +6,37 @@ namespace Core.Models.Spt.Hideout; public record Hideout { [JsonPropertyName("areas")] - public List? Areas { get; set; } + public List? Areas + { + get; + set; + } [JsonPropertyName("customisation")] - public HideoutCustomisation? Customisation { get; set; } + public HideoutCustomisation? Customisation + { + get; + set; + } [JsonPropertyName("production")] - public HideoutProductionData? Production { get; set; } + public HideoutProductionData? Production + { + get; + set; + } [JsonPropertyName("settings")] - public HideoutSettingsBase? Settings { get; set; } + public HideoutSettingsBase? Settings + { + get; + set; + } [JsonPropertyName("qte")] - public List? Qte { get; set; } + public List? Qte + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Hideout/ScavCaseRewardCountsAndPrices.cs b/Libraries/Core/Models/Spt/Hideout/ScavCaseRewardCountsAndPrices.cs index b28cc4d6..0f0fe789 100644 --- a/Libraries/Core/Models/Spt/Hideout/ScavCaseRewardCountsAndPrices.cs +++ b/Libraries/Core/Models/Spt/Hideout/ScavCaseRewardCountsAndPrices.cs @@ -5,26 +5,54 @@ namespace Core.Models.Spt.Hideout; public record ScavCaseRewardCountsAndPrices { [JsonPropertyName("Common")] - public RewardCountAndPriceDetails? Common { get; set; } + public RewardCountAndPriceDetails? Common + { + get; + set; + } [JsonPropertyName("Rare")] - public RewardCountAndPriceDetails? Rare { get; set; } + public RewardCountAndPriceDetails? Rare + { + get; + set; + } [JsonPropertyName("Superrare")] - public RewardCountAndPriceDetails? Superrare { get; set; } + public RewardCountAndPriceDetails? Superrare + { + get; + set; + } } public record RewardCountAndPriceDetails { [JsonPropertyName("minCount")] - public double? MinCount { get; set; } + public double? MinCount + { + get; + set; + } [JsonPropertyName("maxCount")] - public double? MaxCount { get; set; } + public double? MaxCount + { + get; + set; + } [JsonPropertyName("minPriceRub")] - public double? MinPriceRub { get; set; } + public double? MinPriceRub + { + get; + set; + } [JsonPropertyName("maxPriceRub")] - public double? MaxPriceRub { get; set; } + public double? MaxPriceRub + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Inventory/OwnerInventoryItems.cs b/Libraries/Core/Models/Spt/Inventory/OwnerInventoryItems.cs index 94ab531c..9fa3491f 100644 --- a/Libraries/Core/Models/Spt/Inventory/OwnerInventoryItems.cs +++ b/Libraries/Core/Models/Spt/Inventory/OwnerInventoryItems.cs @@ -6,14 +6,30 @@ namespace Core.Models.Spt.Inventory; public record OwnerInventoryItems { [JsonPropertyName("from")] - public List? From { get; set; } + public List? From + { + get; + set; + } [JsonPropertyName("to")] - public List? To { get; set; } + public List? To + { + get; + set; + } [JsonPropertyName("sameInventory")] - public bool? SameInventory { get; set; } + public bool? SameInventory + { + get; + set; + } [JsonPropertyName("isMail")] - public bool? IsMail { get; set; } + public bool? IsMail + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2CompatibleVersion.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2CompatibleVersion.cs index fd742cff..d7168722 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2CompatibleVersion.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2CompatibleVersion.cs @@ -4,6 +4,15 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2CompatibleVersion : IRequestData { - public required string SptVersion { get; set; } - public required string EftVersion { get; set; } + public required string SptVersion + { + get; + set; + } + + public required string EftVersion + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2LoginResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2LoginResponse.cs index 3d982c1f..8e27c9d2 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2LoginResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2LoginResponse.cs @@ -4,5 +4,9 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2LoginResponse : IRequestData { - public required bool Response { get; set; } + public required bool Response + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2ModsResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2ModsResponse.cs index f0f42f60..a4ae5bb3 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2ModsResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2ModsResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2ModsResponse : IRequestData { - public required Dictionary Response { get; set; } + public required Dictionary Response + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2PasswordChangeResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2PasswordChangeResponse.cs index d31d742a..d679e4b3 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2PasswordChangeResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2PasswordChangeResponse.cs @@ -5,6 +5,15 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2PasswordChangeResponse : IRequestData { - public required bool Response { get; set; } - public required List Profiles { get; set; } + public required bool Response + { + get; + set; + } + + public required List Profiles + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2PingResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2PingResponse.cs index 59571607..44347a05 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2PingResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2PingResponse.cs @@ -4,5 +4,9 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2PingResponse : IRequestData { - public required string Response { get; set; } + public required string Response + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2ProfilesResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2ProfilesResponse.cs index 3b5f3572..d0b7358f 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2ProfilesResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2ProfilesResponse.cs @@ -5,5 +5,9 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2ProfilesResponse : IRequestData { - public required List Response { get; set; } + public required List Response + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2RegisterResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2RegisterResponse.cs index ff97326f..77fbc80a 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2RegisterResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2RegisterResponse.cs @@ -5,6 +5,15 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2RegisterResponse : IRequestData { - public required bool Response { get; set; } - public required List Profiles { get; set; } + public required bool Response + { + get; + set; + } + + public required List Profiles + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2RemoveResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2RemoveResponse.cs index b19b3ac3..5fb56cdd 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2RemoveResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2RemoveResponse.cs @@ -5,6 +5,15 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2RemoveResponse : IRequestData { - public required bool Response { get; set; } - public required List Profiles { get; set; } + public required bool Response + { + get; + set; + } + + public required List Profiles + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2TypesResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2TypesResponse.cs index 0cadc001..5c6fe441 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2TypesResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2TypesResponse.cs @@ -4,5 +4,9 @@ namespace Core.Models.Spt.Launcher; public class LauncherV2TypesResponse : IRequestData { - public required Dictionary Response { get; set; } + public required Dictionary Response + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Launcher/LauncherV2VersionResponse.cs b/Libraries/Core/Models/Spt/Launcher/LauncherV2VersionResponse.cs index dcb65f38..9a802578 100644 --- a/Libraries/Core/Models/Spt/Launcher/LauncherV2VersionResponse.cs +++ b/Libraries/Core/Models/Spt/Launcher/LauncherV2VersionResponse.cs @@ -4,5 +4,9 @@ namespace Core.Models.Spt.Launcher; public record LauncherV2VersionResponse : IRequestData { - public required LauncherV2CompatibleVersion Response { get; set; } + public required LauncherV2CompatibleVersion Response + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Location/RaidChanges.cs b/Libraries/Core/Models/Spt/Location/RaidChanges.cs index 2c502e78..0c90606e 100644 --- a/Libraries/Core/Models/Spt/Location/RaidChanges.cs +++ b/Libraries/Core/Models/Spt/Location/RaidChanges.cs @@ -5,11 +5,23 @@ namespace Core.Models.Spt.Location; public record RaidChanges { [JsonPropertyName("dynamicLootPercent")] - public double? DynamicLootPercent { get; set; } + public double? DynamicLootPercent + { + get; + set; + } [JsonPropertyName("staticLootPercent")] - public double? StaticLootPercent { get; set; } + public double? StaticLootPercent + { + get; + set; + } [JsonPropertyName("simulatedRaidStartSeconds")] - public double? SimulatedRaidStartSeconds { get; set; } + public double? SimulatedRaidStartSeconds + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Logging/ClientLogRequest.cs b/Libraries/Core/Models/Spt/Logging/ClientLogRequest.cs index b7a00ed5..a8f4e25c 100644 --- a/Libraries/Core/Models/Spt/Logging/ClientLogRequest.cs +++ b/Libraries/Core/Models/Spt/Logging/ClientLogRequest.cs @@ -6,18 +6,38 @@ namespace Core.Models.Spt.Logging; public record ClientLogRequest : IRequestData { [JsonPropertyName("Source")] - public string? Source { get; set; } + public string? Source + { + get; + set; + } [JsonPropertyName("Level")] [JsonConverter(typeof(JsonStringEnumConverter))] // TODO: Fix in modules to send enumValue instead of string - public LogLevel? Level { get; set; } + public LogLevel? Level + { + get; + set; + } [JsonPropertyName("Message")] - public string? Message { get; set; } + public string? Message + { + get; + set; + } [JsonPropertyName("Color")] - public string? Color { get; set; } // TODO: FIX THIS SHIT FOR COLOURS + public string? Color + { + get; + set; + } // TODO: FIX THIS SHIT FOR COLOURS [JsonPropertyName("BackgroundColor")] - public string? BackgroundColor { get; set; } + public string? BackgroundColor + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Logging/LogBackgroundColor.cs b/Libraries/Core/Models/Spt/Logging/LogBackgroundColor.cs index 3dbf4cbd..f45f58a4 100644 --- a/Libraries/Core/Models/Spt/Logging/LogBackgroundColor.cs +++ b/Libraries/Core/Models/Spt/Logging/LogBackgroundColor.cs @@ -16,3 +16,4 @@ // TODO: this likely wont be used anymore, so commenting out insteaad of reimplementing + diff --git a/Libraries/Core/Models/Spt/Logging/LogTextColor.cs b/Libraries/Core/Models/Spt/Logging/LogTextColor.cs index b2db1494..8b2b7d8c 100644 --- a/Libraries/Core/Models/Spt/Logging/LogTextColor.cs +++ b/Libraries/Core/Models/Spt/Logging/LogTextColor.cs @@ -16,3 +16,4 @@ // TODO: this likely wont be used anymore, so commenting out insteaad of reimplementing + diff --git a/Libraries/Core/Models/Spt/Logging/SptLogger.cs b/Libraries/Core/Models/Spt/Logging/SptLogger.cs index 63b8cbde..378af013 100644 --- a/Libraries/Core/Models/Spt/Logging/SptLogger.cs +++ b/Libraries/Core/Models/Spt/Logging/SptLogger.cs @@ -2,11 +2,35 @@ public record SptLogger { - public object Error { get; set; } // error: (msg: string | Record) => void; - public object Warn { get; set; } // warn: (msg: string | Record) => void; - public object Succ { get; set; } // succ?: (msg: string | Record) => void; - public object Info { get; set; } // info: (msg: string | Record) => void; - public object Debug { get; set; } // debug: (msg: string | Record) => void; + public object Error + { + get; + set; + } // error: (msg: string | Record) => void; + + public object Warn + { + get; + set; + } // warn: (msg: string | Record) => void; + + public object Succ + { + get; + set; + } // succ?: (msg: string | Record) => void; + + public object Info + { + get; + set; + } // info: (msg: string | Record) => void; + + public object Debug + { + get; + set; + } // debug: (msg: string | Record) => void; } // TODO: needs to be reimplemented however we want to do it in this project diff --git a/Libraries/Core/Models/Spt/Mod/NewItemDetails.cs b/Libraries/Core/Models/Spt/Mod/NewItemDetails.cs index d3c19b04..4bae7166 100644 --- a/Libraries/Core/Models/Spt/Mod/NewItemDetails.cs +++ b/Libraries/Core/Models/Spt/Mod/NewItemDetails.cs @@ -1,5 +1,4 @@ using System.Text.Json.Serialization; -using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; namespace Core.Models.Spt.Mod; @@ -7,67 +6,127 @@ namespace Core.Models.Spt.Mod; public record NewItemDetails : NewItemDetailsBase { [JsonPropertyName("newItem")] - public TemplateItem? NewItem { get; set; } + public TemplateItem? NewItem + { + get; + set; + } } public record NewItemFromCloneDetails : NewItemDetailsBase { [JsonPropertyName("itemTplToClone")] - public string? ItemTplToClone { get; set; } + public string? ItemTplToClone + { + get; + set; + } [JsonPropertyName("overrideProperties")] - public Props? OverrideProperties { get; set; } + public Props? OverrideProperties + { + get; + set; + } [JsonPropertyName("parentId")] - public string? ParentId { get; set; } + public string? ParentId + { + get; + set; + } [JsonPropertyName("newId")] - public string? NewId { get; set; } = ""; + public string? NewId + { + get; + set; + } = ""; } public record NewItemDetailsBase { [JsonPropertyName("fleaPriceRoubles")] - public double? FleaPriceRoubles { get; set; } + public double? FleaPriceRoubles + { + get; + set; + } [JsonPropertyName("handbookPriceRoubles")] - public double? HandbookPriceRoubles { get; set; } + public double? HandbookPriceRoubles + { + get; + set; + } [JsonPropertyName("handbookParentId")] - public string? HandbookParentId { get; set; } + public string? HandbookParentId + { + get; + set; + } [JsonPropertyName("locales")] - public Dictionary? Locales { get; set; } + public Dictionary? Locales + { + get; + set; + } } public record LocaleDetails { [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("shortName")] - public string? ShortName { get; set; } + public string? ShortName + { + get; + set; + } [JsonPropertyName("description")] - public string? Description { get; set; } + public string? Description + { + get; + set; + } } public record CreateItemResult { - [JsonPropertyName("success")] - public bool? Success { get; set; } - - [JsonPropertyName("itemId")] - public string? ItemId { get; set; } - - [JsonPropertyName("errors")] - public List? Errors { get; set; } - public CreateItemResult() { Success = false; Errors = new List(); } + + [JsonPropertyName("success")] + public bool? Success + { + get; + set; + } + + [JsonPropertyName("itemId")] + public string? ItemId + { + get; + set; + } + + [JsonPropertyName("errors")] + public List? Errors + { + get; + set; + } } // TODO: This needs to be reworked with however we do it for this project diff --git a/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs b/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs index 15304ee2..bcaf7194 100644 --- a/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs +++ b/Libraries/Core/Models/Spt/Mod/PackageJsonData.cs @@ -5,53 +5,117 @@ namespace Core.Models.Spt.Mod; public record PackageJsonData { [JsonPropertyName("incompatibilities")] - public List? Incompatibilities { get; set; } + public List? Incompatibilities + { + get; + set; + } [JsonPropertyName("loadBefore")] - public List? LoadBefore { get; set; } + public List? LoadBefore + { + get; + set; + } [JsonPropertyName("loadAfter")] - public List? LoadAfter { get; set; } + public List? LoadAfter + { + get; + set; + } [JsonPropertyName("dependencies")] - public Dictionary? Dependencies { get; set; } + public Dictionary? Dependencies + { + get; + set; + } [JsonPropertyName("modDependencies")] - public Dictionary? ModDependencies { get; set; } + public Dictionary? ModDependencies + { + get; + set; + } [JsonPropertyName("name")] - public string? Name { get; set; } + public string? Name + { + get; + set; + } [JsonPropertyName("url")] - public string? Url { get; set; } + public string? Url + { + get; + set; + } [JsonPropertyName("author")] - public string? Author { get; set; } + public string? Author + { + get; + set; + } [JsonPropertyName("version")] - public string? Version { get; set; } + public string? Version + { + get; + set; + } [JsonPropertyName("sptVersion")] - public string? SptVersion { get; set; } + public string? SptVersion + { + get; + set; + } // We deliberately purge this data [JsonPropertyName("scripts")] - public Dictionary? Scripts { get; set; } + public Dictionary? Scripts + { + get; + set; + } [JsonPropertyName("devDependencies")] - public Dictionary? DevDependencies { get; set; } + public Dictionary? DevDependencies + { + get; + set; + } [JsonPropertyName("licence")] - public string? Licence { get; set; } + public string? Licence + { + get; + set; + } [JsonPropertyName("main")] - public string? Main { get; set; } + public string? Main + { + get; + set; + } [JsonPropertyName("isBundleMod")] - public bool? IsBundleMod { get; set; } + public bool? IsBundleMod + { + get; + set; + } [JsonPropertyName("contributors")] - public List? Contributors { get; set; } + public List? Contributors + { + get; + set; + } } // TODO: this will need changing to however we implement it in this project diff --git a/Libraries/Core/Models/Spt/Quests/GetRepeatableByIdResult.cs b/Libraries/Core/Models/Spt/Quests/GetRepeatableByIdResult.cs index 568ef944..a0367c54 100644 --- a/Libraries/Core/Models/Spt/Quests/GetRepeatableByIdResult.cs +++ b/Libraries/Core/Models/Spt/Quests/GetRepeatableByIdResult.cs @@ -6,8 +6,16 @@ namespace Core.Models.Spt.Quests; public record GetRepeatableByIdResult { [JsonPropertyName("quest")] - public RepeatableQuest? Quest { get; set; } + public RepeatableQuest? Quest + { + get; + set; + } [JsonPropertyName("repeatableType")] - public PmcDataRepeatableQuest? RepeatableType { get; set; } + public PmcDataRepeatableQuest? RepeatableType + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Ragfair/RagfairServerPrices.cs b/Libraries/Core/Models/Spt/Ragfair/RagfairServerPrices.cs index 687b8bb1..f01dd4a3 100644 --- a/Libraries/Core/Models/Spt/Ragfair/RagfairServerPrices.cs +++ b/Libraries/Core/Models/Spt/Ragfair/RagfairServerPrices.cs @@ -5,8 +5,16 @@ namespace Core.Models.Spt.Ragfair; public record RagfairServerPrices { [JsonPropertyName("staticPrices")] - public Dictionary? StaticPrices { get; set; } + public Dictionary? StaticPrices + { + get; + set; + } [JsonPropertyName("dynamicPrices")] - public Dictionary? DynamicPrices { get; set; } + public Dictionary? DynamicPrices + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Ragfair/TplWithFleaPrice.cs b/Libraries/Core/Models/Spt/Ragfair/TplWithFleaPrice.cs index 74dc0711..a8ab6958 100644 --- a/Libraries/Core/Models/Spt/Ragfair/TplWithFleaPrice.cs +++ b/Libraries/Core/Models/Spt/Ragfair/TplWithFleaPrice.cs @@ -5,9 +5,17 @@ namespace Core.Models.Spt.Ragfair; public record TplWithFleaPrice { [JsonPropertyName("tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } // Roubles [JsonPropertyName("price")] - public double? Price { get; set; } + public double? Price + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Repeatable/QuestRewardValues.cs b/Libraries/Core/Models/Spt/Repeatable/QuestRewardValues.cs index 2aad9ee1..31056c8c 100644 --- a/Libraries/Core/Models/Spt/Repeatable/QuestRewardValues.cs +++ b/Libraries/Core/Models/Spt/Repeatable/QuestRewardValues.cs @@ -5,23 +5,51 @@ namespace Core.Models.Spt.Repeatable; public record QuestRewardValues { [JsonPropertyName("skillPointReward")] - public double? SkillPointReward { get; set; } + public double? SkillPointReward + { + get; + set; + } [JsonPropertyName("skillRewardChance")] - public double? SkillRewardChance { get; set; } + public double? SkillRewardChance + { + get; + set; + } [JsonPropertyName("rewardReputation")] - public double? RewardReputation { get; set; } + public double? RewardReputation + { + get; + set; + } [JsonPropertyName("rewardNumItems")] - public int? RewardNumItems { get; set; } + public int? RewardNumItems + { + get; + set; + } [JsonPropertyName("rewardRoubles")] - public double? RewardRoubles { get; set; } + public double? RewardRoubles + { + get; + set; + } [JsonPropertyName("gpCoinRewardCount")] - public double? GpCoinRewardCount { get; set; } + public double? GpCoinRewardCount + { + get; + set; + } [JsonPropertyName("rewardXP")] - public double? RewardXP { get; set; } + public double? RewardXP + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Repeatable/QuestTypePool.cs b/Libraries/Core/Models/Spt/Repeatable/QuestTypePool.cs index 87f935c1..c9a7680a 100644 --- a/Libraries/Core/Models/Spt/Repeatable/QuestTypePool.cs +++ b/Libraries/Core/Models/Spt/Repeatable/QuestTypePool.cs @@ -6,38 +6,70 @@ namespace Core.Models.Spt.Repeatable; public record QuestTypePool { [JsonPropertyName("types")] - public List? Types { get; set; } + public List? Types + { + get; + set; + } [JsonPropertyName("pool")] - public QuestPool? Pool { get; set; } + public QuestPool? Pool + { + get; + set; + } } public record QuestPool { [JsonPropertyName("Exploration")] - public ExplorationPool? Exploration { get; set; } + public ExplorationPool? Exploration + { + get; + set; + } [JsonPropertyName("Elimination")] - public EliminationPool? Elimination { get; set; } + public EliminationPool? Elimination + { + get; + set; + } [JsonPropertyName("Pickup")] - public ExplorationPool? Pickup { get; set; } + public ExplorationPool? Pickup + { + get; + set; + } } public record ExplorationPool { [JsonPropertyName("locations")] - public Dictionary>? Locations { get; set; } // TODO: check the type, originally - Partial> + public Dictionary>? Locations + { + get; + set; + } // TODO: check the type, originally - Partial> } public record EliminationPool { [JsonPropertyName("targets")] - public Dictionary? Targets { get; set; } + public Dictionary? Targets + { + get; + set; + } } public record TargetLocation { [JsonPropertyName("locations")] - public List? Locations { get; set; } + public List? Locations + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Server/DatabaseTables.cs b/Libraries/Core/Models/Spt/Server/DatabaseTables.cs index f5802e66..71e80411 100644 --- a/Libraries/Core/Models/Spt/Server/DatabaseTables.cs +++ b/Libraries/Core/Models/Spt/Server/DatabaseTables.cs @@ -5,23 +5,63 @@ namespace Core.Models.Spt.Server; public record DatabaseTables { - public Bots.Bots? Bots { get; set; } + public Bots.Bots? Bots + { + get; + set; + } - public Hideout.Hideout? Hideout { get; set; } + public Hideout.Hideout? Hideout + { + get; + set; + } - public LocaleBase? Locales { get; set; } + public LocaleBase? Locales + { + get; + set; + } - public Locations? Locations { get; set; } + public Locations? Locations + { + get; + set; + } - public Match? Match { get; set; } + public Match? Match + { + get; + set; + } - public Templates.Templates? Templates { get; set; } + public Templates.Templates? Templates + { + get; + set; + } - public Dictionary? Traders { get; set; } + public Dictionary? Traders + { + get; + set; + } - public Globals? Globals { get; set; } + public Globals? Globals + { + get; + set; + } - public ServerBase? Server { get; set; } + public ServerBase? Server + { + get; + set; + } - public SettingsBase? Settings { get; set; } + public SettingsBase? Settings + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Server/LocaleBase.cs b/Libraries/Core/Models/Spt/Server/LocaleBase.cs index 5c582f94..9580c1dc 100644 --- a/Libraries/Core/Models/Spt/Server/LocaleBase.cs +++ b/Libraries/Core/Models/Spt/Server/LocaleBase.cs @@ -6,11 +6,23 @@ namespace Core.Models.Spt.Server; public record LocaleBase { [JsonPropertyName("global")] - public Dictionary>>? Global { get; set; } + public Dictionary>>? Global + { + get; + set; + } [JsonPropertyName("menu")] - public Dictionary>? Menu { get; set; } + public Dictionary>? Menu + { + get; + set; + } [JsonPropertyName("languages")] - public Dictionary? Languages { get; set; } + public Dictionary? Languages + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Server/Locations.cs b/Libraries/Core/Models/Spt/Server/Locations.cs index c552a1ff..a522633f 100644 --- a/Libraries/Core/Models/Spt/Server/Locations.cs +++ b/Libraries/Core/Models/Spt/Server/Locations.cs @@ -1,102 +1,13 @@ -using Core.Models.Eft.Common.Tables; using System.Text.Json.Serialization; +using Core.Models.Eft.Common.Tables; namespace Core.Models.Spt.Server; public record Locations { - [JsonPropertyName("bigmap")] - public Eft.Common.Location? Bigmap { get; set; } - - [JsonPropertyName("develop")] - public Eft.Common.Location? Develop { get; set; } - - [JsonPropertyName("factory4_day")] - public Eft.Common.Location? Factory4Day { get; set; } - - [JsonPropertyName("factory4_night")] - public Eft.Common.Location? Factory4Night { get; set; } - - [JsonPropertyName("hideout")] - public Eft.Common.Location? Hideout { get; set; } - - [JsonPropertyName("interchange")] - public Eft.Common.Location? Interchange { get; set; } - - [JsonPropertyName("laboratory")] - public Eft.Common.Location? Laboratory { get; set; } - - [JsonPropertyName("lighthouse")] - public Eft.Common.Location? Lighthouse { get; set; } - - [JsonPropertyName("privatearea")] - public Eft.Common.Location? PrivateArea { get; set; } - - [JsonPropertyName("rezervbase")] - public Eft.Common.Location? RezervBase { get; set; } - - [JsonPropertyName("shoreline")] - public Eft.Common.Location? Shoreline { get; set; } - - [JsonPropertyName("suburbs")] - public Eft.Common.Location? Suburbs { get; set; } - - [JsonPropertyName("tarkovstreets")] - public Eft.Common.Location? TarkovStreets { get; set; } - - [JsonPropertyName("terminal")] - public Eft.Common.Location? Terminal { get; set; } - - [JsonPropertyName("town")] - public Eft.Common.Location? Town { get; set; } - - [JsonPropertyName("woods")] - public Eft.Common.Location? Woods { get; set; } - - [JsonPropertyName("sandbox")] - public Eft.Common.Location? Sandbox { get; set; } - - [JsonPropertyName("sandbox_high")] - public Eft.Common.Location? SandboxHigh { get; set; } - - /** Holds a mapping of the linkages between locations on the UI */ - [JsonPropertyName("base")] - public LocationsBase? Base { get; set; } - - private Dictionary? _locationDictionaryCache; - - /// - /// Get map locations as a dictionary, keyed by its name e.g. Factory4Day - /// - /// - public Dictionary GetDictionary() - { - if (_locationDictionaryCache is null) - HydrateDictionary(); - - return _locationDictionaryCache; - } - - /// - /// Convert any type of key to Locations actual Property name. - /// "factory4_day" or "Factory4Day" returns "Factory4Day" - /// - /// - public string GetMappedKey(string key) - { - return _locationMappings.TryGetValue(key, out var value) ? value : key; - } - - private void HydrateDictionary() - { - 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); - } - // sometimes we get the key or value given so save changing logic in each place // have it key both - private Dictionary _locationMappings = new() + private readonly Dictionary _locationMappings = new() { // EFT { "factory4_day", "Factory4Day" }, @@ -138,4 +49,173 @@ public record Locations { "Sandbox", "Sandbox" }, { "SandboxHigh", "SandboxHigh" } }; + + private Dictionary? _locationDictionaryCache; + + [JsonPropertyName("bigmap")] + public Eft.Common.Location? Bigmap + { + get; + set; + } + + [JsonPropertyName("develop")] + public Eft.Common.Location? Develop + { + get; + set; + } + + [JsonPropertyName("factory4_day")] + public Eft.Common.Location? Factory4Day + { + get; + set; + } + + [JsonPropertyName("factory4_night")] + public Eft.Common.Location? Factory4Night + { + get; + set; + } + + [JsonPropertyName("hideout")] + public Eft.Common.Location? Hideout + { + get; + set; + } + + [JsonPropertyName("interchange")] + public Eft.Common.Location? Interchange + { + get; + set; + } + + [JsonPropertyName("laboratory")] + public Eft.Common.Location? Laboratory + { + get; + set; + } + + [JsonPropertyName("lighthouse")] + public Eft.Common.Location? Lighthouse + { + get; + set; + } + + [JsonPropertyName("privatearea")] + public Eft.Common.Location? PrivateArea + { + get; + set; + } + + [JsonPropertyName("rezervbase")] + public Eft.Common.Location? RezervBase + { + get; + set; + } + + [JsonPropertyName("shoreline")] + public Eft.Common.Location? Shoreline + { + get; + set; + } + + [JsonPropertyName("suburbs")] + public Eft.Common.Location? Suburbs + { + get; + set; + } + + [JsonPropertyName("tarkovstreets")] + public Eft.Common.Location? TarkovStreets + { + get; + set; + } + + [JsonPropertyName("terminal")] + public Eft.Common.Location? Terminal + { + get; + set; + } + + [JsonPropertyName("town")] + public Eft.Common.Location? Town + { + get; + set; + } + + [JsonPropertyName("woods")] + public Eft.Common.Location? Woods + { + get; + set; + } + + [JsonPropertyName("sandbox")] + public Eft.Common.Location? Sandbox + { + get; + set; + } + + [JsonPropertyName("sandbox_high")] + public Eft.Common.Location? SandboxHigh + { + get; + set; + } + + /** + * Holds a mapping of the linkages between locations on the UI + */ + [JsonPropertyName("base")] + public LocationsBase? Base + { + get; + set; + } + + /// + /// Get map locations as a dictionary, keyed by its name e.g. Factory4Day + /// + /// + public Dictionary GetDictionary() + { + if (_locationDictionaryCache is null) + { + HydrateDictionary(); + } + + return _locationDictionaryCache; + } + + /// + /// Convert any type of key to Locations actual Property name. + /// "factory4_day" or "Factory4Day" returns "Factory4Day" + /// + /// + public string GetMappedKey(string key) + { + return _locationMappings.TryGetValue(key, out var value) ? value : key; + } + + private void HydrateDictionary() + { + 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); + } } diff --git a/Libraries/Core/Models/Spt/Server/ServerBase.cs b/Libraries/Core/Models/Spt/Server/ServerBase.cs index 4315246f..22a9aa30 100644 --- a/Libraries/Core/Models/Spt/Server/ServerBase.cs +++ b/Libraries/Core/Models/Spt/Server/ServerBase.cs @@ -5,8 +5,16 @@ namespace Core.Models.Spt.Server; public record ServerBase { [JsonPropertyName("ip")] - public string? Ip { get; set; } + public string? Ip + { + get; + set; + } [JsonPropertyName("port")] - public int? Port { get; set; } + public int? Port + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Server/SettingsBase.cs b/Libraries/Core/Models/Spt/Server/SettingsBase.cs index f0455e45..2bae61bf 100644 --- a/Libraries/Core/Models/Spt/Server/SettingsBase.cs +++ b/Libraries/Core/Models/Spt/Server/SettingsBase.cs @@ -5,143 +5,311 @@ namespace Core.Models.Spt.Server; public record SettingsBase { [JsonPropertyName("config")] - public Config? Configuration { get; set; } + public Config? Configuration + { + get; + set; + } } public record Config { [JsonPropertyName("AFKTimeoutSeconds")] - public int? AFKTimeoutSeconds { get; set; } + public int? AFKTimeoutSeconds + { + get; + set; + } [JsonPropertyName("AdditionalRandomDelaySeconds")] - public int? AdditionalRandomDelaySeconds { get; set; } + public int? AdditionalRandomDelaySeconds + { + get; + set; + } [JsonPropertyName("ClientSendRateLimit")] - public int? ClientSendRateLimit { get; set; } + public int? ClientSendRateLimit + { + get; + set; + } [JsonPropertyName("CriticalRetriesCount")] - public int? CriticalRetriesCount { get; set; } + public int? CriticalRetriesCount + { + get; + set; + } [JsonPropertyName("DefaultRetriesCount")] - public int? DefaultRetriesCount { get; set; } + public int? DefaultRetriesCount + { + get; + set; + } [JsonPropertyName("FirstCycleDelaySeconds")] - public int? FirstCycleDelaySeconds { get; set; } + public int? FirstCycleDelaySeconds + { + get; + set; + } [JsonPropertyName("FramerateLimit")] - public FramerateLimit? FramerateLimit { get; set; } + public FramerateLimit? FramerateLimit + { + get; + set; + } [JsonPropertyName("GroupStatusInterval")] - public int? GroupStatusInterval { get; set; } + public int? GroupStatusInterval + { + get; + set; + } [JsonPropertyName("GroupStatusButtonInterval")] - public int? GroupStatusButtonInterval { get; set; } + public int? GroupStatusButtonInterval + { + get; + set; + } [JsonPropertyName("KeepAliveInterval")] - public int? KeepAliveInterval { get; set; } + public int? KeepAliveInterval + { + get; + set; + } [JsonPropertyName("LobbyKeepAliveInterval")] - public int? LobbyKeepAliveInterval { get; set; } + public int? LobbyKeepAliveInterval + { + get; + set; + } [JsonPropertyName("Mark502and504AsNonImportant")] - public bool? Mark502and504AsNonImportant { get; set; } + public bool? Mark502and504AsNonImportant + { + get; + set; + } [JsonPropertyName("MemoryManagementSettings")] - public MemoryManagementSettings? MemoryManagementSettings { get; set; } + public MemoryManagementSettings? MemoryManagementSettings + { + get; + set; + } [JsonPropertyName("NVidiaHighlights")] - public bool? NVidiaHighlights { get; set; } + public bool? NVidiaHighlights + { + get; + set; + } [JsonPropertyName("NextCycleDelaySeconds")] - public int? NextCycleDelaySeconds { get; set; } + public int? NextCycleDelaySeconds + { + get; + set; + } [JsonPropertyName("PingServerResultSendInterval")] - public int? PingServerResultSendInterval { get; set; } + public int? PingServerResultSendInterval + { + get; + set; + } [JsonPropertyName("PingServersInterval")] - public int? PingServersInterval { get; set; } + public int? PingServersInterval + { + get; + set; + } [JsonPropertyName("ReleaseProfiler")] - public ReleaseProfiler? ReleaseProfiler { get; set; } + public ReleaseProfiler? ReleaseProfiler + { + get; + set; + } [JsonPropertyName("RequestConfirmationTimeouts")] - public List? RequestConfirmationTimeouts { get; set; } + public List? RequestConfirmationTimeouts + { + get; + set; + } [JsonPropertyName("RequestsMadeThroughLobby")] - public List? RequestsMadeThroughLobby { get; set; } + public List? RequestsMadeThroughLobby + { + get; + set; + } [JsonPropertyName("SecondCycleDelaySeconds")] - public int? SecondCycleDelaySeconds { get; set; } + public int? SecondCycleDelaySeconds + { + get; + set; + } [JsonPropertyName("ShouldEstablishLobbyConnection")] - public bool? ShouldEstablishLobbyConnection { get; set; } + public bool? ShouldEstablishLobbyConnection + { + get; + set; + } [JsonPropertyName("TurnOffLogging")] - public bool? TurnOffLogging { get; set; } + public bool? TurnOffLogging + { + get; + set; + } [JsonPropertyName("WeaponOverlapDistanceCulling")] - public int? WeaponOverlapDistanceCulling { get; set; } + public int? WeaponOverlapDistanceCulling + { + get; + set; + } [JsonPropertyName("WebDiagnosticsEnabled")] - public bool? WebDiagnosticsEnabled { get; set; } + public bool? WebDiagnosticsEnabled + { + get; + set; + } [JsonPropertyName("NetworkStateView")] - public NetworkStateView? NetworkStateView { get; set; } + public NetworkStateView? NetworkStateView + { + get; + set; + } [JsonPropertyName("WsReconnectionDelays")] - public List? WsReconnectionDelays { get; set; } + public List? WsReconnectionDelays + { + get; + set; + } } public record FramerateLimit { [JsonPropertyName("MaxFramerateGameLimit")] - public int? MaxFramerateGameLimit { get; set; } + public int? MaxFramerateGameLimit + { + get; + set; + } [JsonPropertyName("MaxFramerateLobbyLimit")] - public int? MaxFramerateLobbyLimit { get; set; } + public int? MaxFramerateLobbyLimit + { + get; + set; + } [JsonPropertyName("MinFramerateLimit")] - public int? MinFramerateLimit { get; set; } + public int? MinFramerateLimit + { + get; + set; + } } public record MemoryManagementSettings { [JsonPropertyName("AggressiveGC")] - public bool? AggressiveGC { get; set; } + public bool? AggressiveGC + { + get; + set; + } [JsonPropertyName("GigabytesRequiredToDisableGCDuringRaid")] - public int? GigabytesRequiredToDisableGCDuringRaid { get; set; } + public int? GigabytesRequiredToDisableGCDuringRaid + { + get; + set; + } [JsonPropertyName("HeapPreAllocationEnabled")] - public bool? HeapPreAllocationEnabled { get; set; } + public bool? HeapPreAllocationEnabled + { + get; + set; + } [JsonPropertyName("HeapPreAllocationMB")] - public int? HeapPreAllocationMB { get; set; } + public int? HeapPreAllocationMB + { + get; + set; + } [JsonPropertyName("OverrideRamCleanerSettings")] - public bool? OverrideRamCleanerSettings { get; set; } + public bool? OverrideRamCleanerSettings + { + get; + set; + } [JsonPropertyName("RamCleanerEnabled")] - public bool? RamCleanerEnabled { get; set; } + public bool? RamCleanerEnabled + { + get; + set; + } } public record ReleaseProfiler { [JsonPropertyName("Enabled")] - public bool? Enabled { get; set; } + public bool? Enabled + { + get; + set; + } [JsonPropertyName("MaxRecords")] - public int? MaxRecords { get; set; } + public int? MaxRecords + { + get; + set; + } [JsonPropertyName("RecordTriggerValue")] - public int? RecordTriggerValue { get; set; } + public int? RecordTriggerValue + { + get; + set; + } } public record NetworkStateView { [JsonPropertyName("LossThreshold")] - public int? LossThreshold { get; set; } + public int? LossThreshold + { + get; + set; + } [JsonPropertyName("RttThreshold")] - public int? RttThreshold { get; set; } + public int? RttThreshold + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Services/InsuranceEquipmentPkg.cs b/Libraries/Core/Models/Spt/Services/InsuranceEquipmentPkg.cs index 8de0eb8d..bc095bb8 100644 --- a/Libraries/Core/Models/Spt/Services/InsuranceEquipmentPkg.cs +++ b/Libraries/Core/Models/Spt/Services/InsuranceEquipmentPkg.cs @@ -7,14 +7,30 @@ namespace Core.Models.Spt.Services; public record InsuranceEquipmentPkg { [JsonPropertyName("sessionID")] - public string? SessionId { get; set; } + public string? SessionId + { + get; + set; + } [JsonPropertyName("pmcData")] - public PmcData? PmcData { get; set; } + public PmcData? PmcData + { + get; + set; + } [JsonPropertyName("itemToReturnToPlayer")] - public Item? ItemToReturnToPlayer { get; set; } + public Item? ItemToReturnToPlayer + { + get; + set; + } [JsonPropertyName("traderId")] - public string? TraderId { get; set; } + public string? TraderId + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Services/LootItem.cs b/Libraries/Core/Models/Spt/Services/LootItem.cs index f32b40e2..c9a763e2 100644 --- a/Libraries/Core/Models/Spt/Services/LootItem.cs +++ b/Libraries/Core/Models/Spt/Services/LootItem.cs @@ -5,14 +5,30 @@ namespace Core.Models.Spt.Services; public record LootItem { [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get; + set; + } [JsonPropertyName("tpl")] - public string? Tpl { get; set; } + public string? Tpl + { + get; + set; + } [JsonPropertyName("isPreset")] - public bool? IsPreset { get; set; } + public bool? IsPreset + { + get; + set; + } [JsonPropertyName("stackCount")] - public int? StackCount { get; set; } + public int? StackCount + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Services/LootRequest.cs b/Libraries/Core/Models/Spt/Services/LootRequest.cs index b993932b..4c43715f 100644 --- a/Libraries/Core/Models/Spt/Services/LootRequest.cs +++ b/Libraries/Core/Models/Spt/Services/LootRequest.cs @@ -7,86 +7,142 @@ namespace Core.Models.Spt.Services; public record LootRequest { /// - /// Count of weapons to generate + /// Count of weapons to generate /// [JsonPropertyName("weaponPresetCount")] - public MinMax? WeaponPresetCount { get; set; } + public MinMax? WeaponPresetCount + { + get; + set; + } /// - /// Count of armor to generate + /// Count of armor to generate /// [JsonPropertyName("armorPresetCount")] - public MinMax? ArmorPresetCount { get; set; } + public MinMax? ArmorPresetCount + { + get; + set; + } /// - /// Count of items to generate + /// Count of items to generate /// [JsonPropertyName("itemCount")] - public MinMax? ItemCount { get; set; } + public MinMax? ItemCount + { + get; + set; + } /// - /// Count of sealed weapon crates to generate + /// Count of sealed weapon crates to generate /// [JsonPropertyName("weaponCrateCount")] - public MinMax? WeaponCrateCount { get; set; } + public MinMax? WeaponCrateCount + { + get; + set; + } /// - /// Item tpl blacklist to exclude + /// Item tpl blacklist to exclude /// [JsonPropertyName("itemBlacklist")] - public List? ItemBlacklist { get; set; } + public List? ItemBlacklist + { + get; + set; + } /// - /// Item tpl whitelist to pick from + /// Item tpl whitelist to pick from /// [JsonPropertyName("itemTypeWhitelist")] - public List? ItemTypeWhitelist { get; set; } + public List? ItemTypeWhitelist + { + get; + set; + } /// - /// key: item base type: value: max count + /// key: item base type: value: max count /// [JsonPropertyName("itemLimits")] - public Dictionary? ItemLimits { get; set; } + public Dictionary? ItemLimits + { + get; + set; + } [JsonPropertyName("itemStackLimits")] - public Dictionary? ItemStackLimits { get; set; } + public Dictionary? ItemStackLimits + { + get; + set; + } /// - /// Allowed armor plate levels 2/3/4/5/6 for armor generated + /// Allowed armor plate levels 2/3/4/5/6 for armor generated /// [JsonPropertyName("armorLevelWhitelist")] - public List? ArmorLevelWhitelist { get; set; } + public List? ArmorLevelWhitelist + { + get; + set; + } /// - /// Should boss items be included in allowed items + /// Should boss items be included in allowed items /// [JsonPropertyName("allowBossItems")] - public bool? AllowBossItems { get; set; } + public bool? AllowBossItems + { + get; + set; + } /// - /// Should item.json item reward blacklist be used + /// Should item.json item reward blacklist be used /// [JsonPropertyName("useRewardItemBlacklist")] - public bool? UseRewardItemBlacklist { get; set; } + public bool? UseRewardItemBlacklist + { + get; + set; + } /// - /// Should forced loot be used instead of randomised loot + /// Should forced loot be used instead of randomised loot /// [JsonPropertyName("useForcedLoot")] - public bool? UseForcedLoot { get; set; } + public bool? UseForcedLoot + { + get; + set; + } /// - /// Item tpls + count of items to force include + /// Item tpls + count of items to force include /// [JsonPropertyName("forcedLoot")] - public Dictionary? ForcedLoot { get; set; } + public Dictionary? ForcedLoot + { + get; + set; + } } public record AirdropLootRequest : LootRequest { /// - /// Airdrop icon used by client to show crate type + /// Airdrop icon used by client to show crate type /// [JsonPropertyName("icon")] - public AirdropTypeEnum? Icon { get; set; } + public AirdropTypeEnum? Icon + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Services/TraderServiceModel.cs b/Libraries/Core/Models/Spt/Services/TraderServiceModel.cs index 6a85ffa8..37b3b0d7 100644 --- a/Libraries/Core/Models/Spt/Services/TraderServiceModel.cs +++ b/Libraries/Core/Models/Spt/Services/TraderServiceModel.cs @@ -7,26 +7,54 @@ public record TraderServiceModel { [JsonPropertyName("serviceType")] [JsonConverter(typeof(JsonStringEnumConverter))] - public TraderServiceType? ServiceType { get; set; } + public TraderServiceType? ServiceType + { + get; + set; + } [JsonPropertyName("itemsToPay")] - public Dictionary? ItemsToPay { get; set; } + public Dictionary? ItemsToPay + { + get; + set; + } [JsonPropertyName("itemsToReceive")] - public List? ItemsToReceive { get; set; } + public List? ItemsToReceive + { + get; + set; + } [JsonPropertyName("subServices")] - public Dictionary? SubServices { get; set; } + public Dictionary? SubServices + { + get; + set; + } [JsonPropertyName("requirements")] - public TraderServiceRequirementsModel? Requirements { get; set; } + public TraderServiceRequirementsModel? Requirements + { + get; + set; + } } public record TraderServiceRequirementsModel { [JsonPropertyName("completedQuests")] - public List? CompletedQuests { get; set; } + public List? CompletedQuests + { + get; + set; + } [JsonPropertyName("standings")] - public Dictionary? Standings { get; set; } + public Dictionary? Standings + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Templates/Templates.cs b/Libraries/Core/Models/Spt/Templates/Templates.cs index b3815331..fbc5d071 100644 --- a/Libraries/Core/Models/Spt/Templates/Templates.cs +++ b/Libraries/Core/Models/Spt/Templates/Templates.cs @@ -1,5 +1,5 @@ -using Core.Models.Eft.Common.Tables; -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; +using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; namespace Core.Models.Spt.Templates; @@ -7,46 +7,108 @@ namespace Core.Models.Spt.Templates; public record Templates { [JsonPropertyName("character")] - public List? Character { get; set; } + public List? Character + { + get; + set; + } [JsonPropertyName("customisationStorage")] - public List? CustomisationStorage { get; set; } + public List? CustomisationStorage + { + get; + set; + } [JsonPropertyName("items")] - public Dictionary? Items { get; set; } + public Dictionary? Items + { + get; + set; + } [JsonPropertyName("prestige")] - public Prestige? Prestige { get; set; } + public Prestige? Prestige + { + get; + set; + } [JsonPropertyName("quests")] - public Dictionary? Quests { get; set; } + public Dictionary? Quests + { + get; + set; + } [JsonPropertyName("repeatableQuests")] - public RepeatableQuestDatabase? RepeatableQuests { get; set; } + public RepeatableQuestDatabase? RepeatableQuests + { + get; + set; + } [JsonPropertyName("handbook")] - public HandbookBase? Handbook { get; set; } + public HandbookBase? Handbook + { + get; + set; + } [JsonPropertyName("customization")] - public Dictionary? Customization { get; set; } + public Dictionary? Customization + { + get; + set; + } - /** 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 { get; set; } + public ProfileTemplates? Profiles + { + get; + set; + } - /** 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 { get; set; } + public Dictionary? Prices + { + get; + set; + } - /** Default equipment loadouts that show on main inventory screen */ + /** + * Default equipment loadouts that show on main inventory screen + */ [JsonPropertyName("defaultEquipmentPresets")] - public List? DefaultEquipmentPresets { get; set; } + public List? DefaultEquipmentPresets + { + get; + set; + } - /** Achievements */ + /** + * Achievements + */ [JsonPropertyName("achievements")] - public List? Achievements { get; set; } + public List? Achievements + { + get; + set; + } - /** Location services data */ + /** + * Location services data + */ [JsonPropertyName("locationServices")] - public LocationServices? LocationServices { get; set; } + public LocationServices? LocationServices + { + get; + set; + } } diff --git a/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs b/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs index e42f6846..cdec4da1 100644 --- a/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs +++ b/Libraries/Core/Models/Spt/Weather/GetLocalWeatherResponseData.cs @@ -1,13 +1,21 @@ -using Core.Models.Enums; using System.Text.Json.Serialization; +using Core.Models.Enums; namespace Core.Models.Spt.Weather; public record GetLocalWeatherResponseData { [JsonPropertyName("season")] - public Season? Season { get; set; } + public Season? Season + { + get; + set; + } [JsonPropertyName("weather")] - public List? Weather { get; set; } + public List? Weather + { + get; + set; + } } diff --git a/Libraries/Core/Routers/Dynamic/BotDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/BotDynamicRouter.cs index a89484dd..71789f09 100644 --- a/Libraries/Core/Routers/Dynamic/BotDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/BotDynamicRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/BundleDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/BundleDynamicRouter.cs index 5acf6720..582b398d 100644 --- a/Libraries/Core/Routers/Dynamic/BundleDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/BundleDynamicRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/CustomizationDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/CustomizationDynamicRouter.cs index 71717608..8bdf10c9 100644 --- a/Libraries/Core/Routers/Dynamic/CustomizationDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/CustomizationDynamicRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/DataDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/DataDynamicRouter.cs index ffd807f8..6cb02f89 100644 --- a/Libraries/Core/Routers/Dynamic/DataDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/DataDynamicRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/HttpDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/HttpDynamicRouter.cs index 6a7169d8..2884521d 100644 --- a/Libraries/Core/Routers/Dynamic/HttpDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/HttpDynamicRouter.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.DI; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/InraidDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/InraidDynamicRouter.cs index 4740f356..af9ec8fd 100644 --- a/Libraries/Core/Routers/Dynamic/InraidDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/InraidDynamicRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.InRaid; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/LocationDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/LocationDynamicRouter.cs index f2556a78..267411a7 100644 --- a/Libraries/Core/Routers/Dynamic/LocationDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/LocationDynamicRouter.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.DI; +using Core.DI; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/NotifierDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/NotifierDynamicRouter.cs index ebd87865..2806b02d 100644 --- a/Libraries/Core/Routers/Dynamic/NotifierDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/NotifierDynamicRouter.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/Dynamic/TraderDynamicRouter.cs b/Libraries/Core/Routers/Dynamic/TraderDynamicRouter.cs index bfc6341a..345d0ec0 100644 --- a/Libraries/Core/Routers/Dynamic/TraderDynamicRouter.cs +++ b/Libraries/Core/Routers/Dynamic/TraderDynamicRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Dynamic; diff --git a/Libraries/Core/Routers/EventOutputHolder.cs b/Libraries/Core/Routers/EventOutputHolder.cs index 90023dfb..9f19a13a 100644 --- a/Libraries/Core/Routers/EventOutputHolder.cs +++ b/Libraries/Core/Routers/EventOutputHolder.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -6,19 +5,20 @@ using Core.Models.Eft.ItemEvent; using Core.Models.Utils; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Routers; [Injectable] public class EventOutputHolder { - protected ISptLogger _logger; - protected ProfileHelper _profileHelper; - protected TimeUtil _timeUtil; + protected Dictionary> _clientActiveSessionStorage = new(); protected ICloner _cloner; + protected ISptLogger _logger; protected Dictionary _outputStore = new(); - protected Dictionary> _clientActiveSessionStorage = new(); + protected ProfileHelper _profileHelper; + protected TimeUtil _timeUtil; public EventOutputHolder( ISptLogger logger, @@ -36,7 +36,10 @@ public class EventOutputHolder public ItemEventRouterResponse GetOutput(string sessionId) { var resultFound = _outputStore.TryGetValue(sessionId, out var result); - if (resultFound) return result; + if (resultFound) + { + return result; + } // Nothing found, reset to default ResetOutput(sessionId); @@ -49,13 +52,16 @@ public class EventOutputHolder { var pmcProfile = _profileHelper.GetPmcProfile(sessionId); - if (_outputStore.ContainsKey(sessionId)) _outputStore.Remove(sessionId); + if (_outputStore.ContainsKey(sessionId)) + { + _outputStore.Remove(sessionId); + } _outputStore.Add( sessionId, new ItemEventRouterResponse { - ProfileChanges = new Dictionary() + ProfileChanges = new Dictionary { { sessionId, new ProfileChange @@ -66,13 +72,22 @@ public class EventOutputHolder RagFairOffers = [], WeaponBuilds = [], EquipmentBuilds = [], - Items = new ItemChanges { NewItems = [], ChangedItems = [], DeletedItems = [] }, + Items = new ItemChanges + { + NewItems = [], + ChangedItems = [], + DeletedItems = [] + }, Production = new Dictionary(), Improvements = new Dictionary(), - Skills = new Skills { Common = [], Mastering = [], Points = 0 }, + Skills = new Skills + { + Common = [], + Mastering = [], + Points = 0 + }, Health = _cloner.Clone(pmcProfile.Health), TraderRelations = new Dictionary(), - RecipeUnlocked = { }, QuestsStatus = [] } } @@ -110,6 +125,7 @@ public class EventOutputHolder private void CleanUpCompleteCraftsInProfile(Dictionary? productions) { foreach (var production in productions) + { if ((production.Value.SptIsComplete ?? false) && (production.Value.SptIsContinuous ?? false)) { // Water collector / Bitcoin etc @@ -122,6 +138,7 @@ public class EventOutputHolder // Normal completed craft, delete productions.Remove(production.Key); } + } } private Dictionary? GetImprovementsFromProfileAndFlagComplete(PmcData pmcData) @@ -131,9 +148,15 @@ public class EventOutputHolder var improvement = pmcData.Hideout.Improvements[improvementKey.Key]; // Skip completed - if (improvement.Completed ?? false) continue; + if (improvement.Completed ?? false) + { + continue; + } - if (improvement.ImproveCompleteTimestamp < _timeUtil.GetTimeStamp()) improvement.Completed = true; + if (improvement.ImproveCompleteTimestamp < _timeUtil.GetTimeStamp()) + { + improvement.Completed = true; + } } return pmcData.Hideout.Improvements; @@ -145,13 +168,21 @@ public class EventOutputHolder { if (production.Value is null) // Could be cancelled production, skip item to save processing + { continue; + } // Complete and is Continuous e.g. water collector - if ((production.Value.SptIsComplete ?? false) && (production.Value.SptIsContinuous ?? false)) continue; + if ((production.Value.SptIsComplete ?? false) && (production.Value.SptIsContinuous ?? false)) + { + continue; + } // Skip completed - if (!production.Value.InProgress ?? false) continue; + if (!production.Value.InProgress ?? false) + { + continue; + } // Client informed of craft, remove from data returned Dictionary? storageForSessionId = null; @@ -170,7 +201,10 @@ public class EventOutputHolder } // Flag started craft as having been seen by client so it won't happen subsequent times - if (production.Value.Progress > 0 && !storageForSessionId.ContainsKey(production.Key)) storageForSessionId.TryAdd(production.Key, true); + if (production.Value.Progress > 0 && !storageForSessionId.ContainsKey(production.Key)) + { + storageForSessionId.TryAdd(production.Key, true); + } } // Return undefined if there's no crafts to send to client to match live behaviour diff --git a/Libraries/Core/Routers/HttpRouter.cs b/Libraries/Core/Routers/HttpRouter.cs index 8a9f58af..6f9ccfc2 100644 --- a/Libraries/Core/Routers/HttpRouter.cs +++ b/Libraries/Core/Routers/HttpRouter.cs @@ -1,13 +1,13 @@ -using SptCommon.Annotations; using Core.DI; +using SptCommon.Annotations; namespace Core.Routers; [Injectable] public class HttpRouter { - protected IEnumerable _staticRouters; protected IEnumerable _dynamicRoutes; + protected IEnumerable _staticRouters; public HttpRouter( IEnumerable staticRouters, @@ -39,10 +39,16 @@ public class HttpRouter var wrapper = new ResponseWrapper(""); var handled = HandleRoute(req, sessionID, wrapper, _staticRouters, false, body, out deserializedObject); - if (!handled) HandleRoute(req, sessionID, wrapper, _dynamicRoutes, true, body, out deserializedObject); + if (!handled) + { + HandleRoute(req, sessionID, wrapper, _dynamicRoutes, true, body, out deserializedObject); + } // TODO: Temporary hack to change ItemEventRouter response sessionID binding to what client expects - if (wrapper.Output?.Contains("\"profileChanges\":{") ?? false) wrapper.Output = wrapper.Output.Replace(sessionID, sessionID); + if (wrapper.Output?.Contains("\"profileChanges\":{") ?? false) + { + wrapper.Output = wrapper.Output.Replace(sessionID, sessionID); + } //var filepath = $"c:\\SharpServer\\{req.Path.ToString().Substring(1).Replace("/", ".")}.json"; //File.WriteAllText(filepath, wrapper.Output); @@ -64,23 +70,38 @@ public class HttpRouter deserializedObject = null; // remove retry from url - if (url?.Contains("?retry=") ?? false) url = url.Split("?retry=")[0]; + if (url?.Contains("?retry=") ?? false) + { + url = url.Split("?retry=")[0]; + } + var matched = false; foreach (var route in routers) + { if (route.CanHandle(url, dynamic)) { if (dynamic) + { wrapper.Output = (route as DynamicRouter).HandleDynamic(url, body, sessionID, wrapper.Output) as string; + } else + { wrapper.Output = (route as StaticRouter).HandleStatic(url, body, sessionID, wrapper.Output) as string; + } + matched = true; } + } return matched; } protected class ResponseWrapper(string? output) { - public string? Output { get; set; } = output; + public string? Output + { + get; + set; + } = output; } } diff --git a/Libraries/Core/Routers/ImageRouter.cs b/Libraries/Core/Routers/ImageRouter.cs index 49618ab4..c3052472 100644 --- a/Libraries/Core/Routers/ImageRouter.cs +++ b/Libraries/Core/Routers/ImageRouter.cs @@ -1,6 +1,6 @@ using Core.Services.Image; -using SptCommon.Annotations; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers; @@ -8,8 +8,8 @@ namespace Core.Routers; public class ImageRouter { protected FileUtil _fileUtil; - protected ImageRouterService _imageRouterService; protected HttpFileUtil _httpFileUtil; + protected ImageRouterService _imageRouterService; public ImageRouter( FileUtil fileUtil, @@ -33,7 +33,10 @@ public class ImageRouter var url = _fileUtil.StripExtension(req.Path, true); // send image - if (_imageRouterService.ExistsByKey(url)) _httpFileUtil.SendFile(resp, _imageRouterService.GetByKey(url)); + if (_imageRouterService.ExistsByKey(url)) + { + _httpFileUtil.SendFile(resp, _imageRouterService.GetByKey(url)); + } } public string GetImage() diff --git a/Libraries/Core/Routers/ItemEventRouter.cs b/Libraries/Core/Routers/ItemEventRouter.cs index 823ebe52..1139cd35 100644 --- a/Libraries/Core/Routers/ItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.DI; using Core.Helpers; using Core.Models.Eft.ItemEvent; @@ -6,6 +5,7 @@ using Core.Models.Utils; using Core.Services; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Routers; @@ -13,14 +13,14 @@ namespace Core.Routers; [Injectable] public class ItemEventRouter { - protected ISptLogger _logger; - protected HttpResponseUtil _httpResponseUtil; - protected JsonUtil _jsonUtil; - protected ProfileHelper _profileHelper; - protected LocalisationService _localisationService; - protected EventOutputHolder _eventOutputHolder; - protected List _itemEventRouters; protected ICloner _cloner; + protected EventOutputHolder _eventOutputHolder; + protected HttpResponseUtil _httpResponseUtil; + protected List _itemEventRouters; + protected JsonUtil _jsonUtil; + protected LocalisationService _localisationService; + protected ISptLogger _logger; + protected ProfileHelper _profileHelper; public ItemEventRouter( ISptLogger logger, @@ -51,7 +51,7 @@ public class ItemEventRouter { var pmcData = _profileHelper.GetPmcProfile(sessionID); - var eventRouter = _itemEventRouters.FirstOrDefault((r) => r.CanHandle(body.Action)); + var eventRouter = _itemEventRouters.FirstOrDefault(r => r.CanHandle(body.Action)); if (eventRouter is null) { _logger.Error(_localisationService.GetText("event-unhandled_event", body.Action)); @@ -60,9 +60,16 @@ public class ItemEventRouter continue; } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"event: {body.Action}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"event: {body.Action}"); + } + eventRouter.HandleItemEvent(body.Action, pmcData, body, sessionID, output); - if (output.Warnings?.Count > 0) break; + if (output.Warnings?.Count > 0) + { + break; + } } _eventOutputHolder.UpdateOutputProperties(sessionID); diff --git a/Libraries/Core/Routers/ItemEvents/CustomizationItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/CustomizationItemEventRouter.cs index def5055b..f33cd90a 100644 --- a/Libraries/Core/Routers/ItemEvents/CustomizationItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/CustomizationItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -7,14 +6,15 @@ using Core.Models.Eft.Customization; using Core.Models.Eft.ItemEvent; using Core.Models.Enums; using Core.Models.Utils; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; [Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))] public class CustomizationItemEventRouter : ItemEventRouterDefinition { - protected ISptLogger _logger; protected CustomizationCallbacks _customizationCallbacks; + protected ISptLogger _logger; public CustomizationItemEventRouter ( diff --git a/Libraries/Core/Routers/ItemEvents/HealthItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/HealthItemEventRouter.cs index bc87b1fa..017020c0 100644 --- a/Libraries/Core/Routers/ItemEvents/HealthItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/HealthItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.Health; using Core.Models.Eft.ItemEvent; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/HideoutItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/HideoutItemEventRouter.cs index f6c77889..423267a4 100644 --- a/Libraries/Core/Routers/ItemEvents/HideoutItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/HideoutItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.Hideout; using Core.Models.Eft.ItemEvent; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/InsuranceItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/InsuranceItemEventRouter.cs index 94cd1120..69c50e3f 100644 --- a/Libraries/Core/Routers/ItemEvents/InsuranceItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/InsuranceItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.Insurance; using Core.Models.Eft.ItemEvent; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/InventoryItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/InventoryItemEventRouter.cs index 5bc348e3..18d0c83e 100644 --- a/Libraries/Core/Routers/ItemEvents/InventoryItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/InventoryItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -8,14 +7,15 @@ using Core.Models.Eft.Inventory; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Quests; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; [Injectable(InjectableTypeOverride = typeof(ItemEventRouterDefinition))] public class InventoryItemEventRouter : ItemEventRouterDefinition { - protected InventoryCallbacks _inventoryCallbacks; protected HideoutCallbacks _hideoutCallbacks; + protected InventoryCallbacks _inventoryCallbacks; public InventoryItemEventRouter ( diff --git a/Libraries/Core/Routers/ItemEvents/NoteItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/NoteItemEventRouter.cs index c5e75684..5181c80c 100644 --- a/Libraries/Core/Routers/ItemEvents/NoteItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/NoteItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Notes; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/QuestItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/QuestItemEventRouter.cs index a13b5d63..bd279c4d 100644 --- a/Libraries/Core/Routers/ItemEvents/QuestItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/QuestItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,7 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Quests; using Core.Models.Enums; - +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/RagfairItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/RagfairItemEventRouter.cs index d4ae5f1c..3d62a4b4 100644 --- a/Libraries/Core/Routers/ItemEvents/RagfairItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/RagfairItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Ragfair; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/RepairItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/RepairItemEventRouter.cs index 1a6387ec..089dc1f0 100644 --- a/Libraries/Core/Routers/ItemEvents/RepairItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/RepairItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Repair; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/TradeItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/TradeItemEventRouter.cs index 13803b8e..b025769e 100644 --- a/Libraries/Core/Routers/ItemEvents/TradeItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/TradeItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Trade; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/ItemEvents/WishlistItemEventRouter.cs b/Libraries/Core/Routers/ItemEvents/WishlistItemEventRouter.cs index 51bd1257..956dfefa 100644 --- a/Libraries/Core/Routers/ItemEvents/WishlistItemEventRouter.cs +++ b/Libraries/Core/Routers/ItemEvents/WishlistItemEventRouter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; @@ -6,6 +5,7 @@ using Core.Models.Eft.Common.Request; using Core.Models.Eft.ItemEvent; using Core.Models.Eft.Wishlist; using Core.Models.Enums; +using SptCommon.Annotations; namespace Core.Routers.ItemEvents; diff --git a/Libraries/Core/Routers/SaveLoad/HealthSaveLoadRouter.cs b/Libraries/Core/Routers/SaveLoad/HealthSaveLoadRouter.cs index 82dfa789..a8c67024 100644 --- a/Libraries/Core/Routers/SaveLoad/HealthSaveLoadRouter.cs +++ b/Libraries/Core/Routers/SaveLoad/HealthSaveLoadRouter.cs @@ -1,13 +1,12 @@ -using SptCommon.Annotations; using Core.DI; -using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; +using SptCommon.Annotations; namespace Core.Routers.SaveLoad; [Injectable(InjectableTypeOverride = typeof(SaveLoadRouter))] -public class HealthSaveLoadRouter() : SaveLoadRouter +public class HealthSaveLoadRouter : SaveLoadRouter { protected override List GetHandledRoutes() { @@ -23,7 +22,13 @@ public class HealthSaveLoadRouter() : SaveLoadRouter public void DefaultVitality(Vitality? vitality) { - vitality ??= new Vitality { Health = null, Energy = 0, Temperature = 0, Hydration = 0 }; + vitality ??= new Vitality + { + Health = null, + Energy = 0, + Temperature = 0, + Hydration = 0 + }; vitality.Health = new Dictionary { diff --git a/Libraries/Core/Routers/SaveLoad/InraidSaveLoadRouter.cs b/Libraries/Core/Routers/SaveLoad/InraidSaveLoadRouter.cs index 6c030d8f..cf60ec6b 100644 --- a/Libraries/Core/Routers/SaveLoad/InraidSaveLoadRouter.cs +++ b/Libraries/Core/Routers/SaveLoad/InraidSaveLoadRouter.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.Eft.Profile; +using SptCommon.Annotations; namespace Core.Routers.SaveLoad; @@ -15,7 +15,13 @@ public class InraidSaveLoadRouter : SaveLoadRouter public override SptProfile HandleLoad(SptProfile profile) { if (profile.InraidData == null) - profile.InraidData = new Inraid { Location = "none", Character = "none" }; + { + profile.InraidData = new Inraid + { + Location = "none", + Character = "none" + }; + } return profile; } diff --git a/Libraries/Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs b/Libraries/Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs index 1d13c56d..8e078ba1 100644 --- a/Libraries/Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs +++ b/Libraries/Core/Routers/SaveLoad/InsuranceSaveLoadRouter.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.Eft.Profile; +using SptCommon.Annotations; namespace Core.Routers.SaveLoad; @@ -15,7 +15,9 @@ public class InsuranceSaveLoadRouter : SaveLoadRouter public override SptProfile HandleLoad(SptProfile profile) { if (profile.InsuranceList == null) + { profile.InsuranceList = new List(); + } return profile; } diff --git a/Libraries/Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs b/Libraries/Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs index ef7b257b..29bb1099 100644 --- a/Libraries/Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs +++ b/Libraries/Core/Routers/SaveLoad/ProfileSaveLoadRouter.cs @@ -1,7 +1,7 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Profile; +using SptCommon.Annotations; namespace Core.Routers.SaveLoad; @@ -16,7 +16,13 @@ public class ProfileSaveLoadRouter : SaveLoadRouter public override SptProfile HandleLoad(SptProfile profile) { if (profile.CharacterData == null) - profile.CharacterData = new Characters { PmcData = new PmcData(), ScavData = new PmcData() }; + { + profile.CharacterData = new Characters + { + PmcData = new PmcData(), + ScavData = new PmcData() + }; + } return profile; } diff --git a/Libraries/Core/Routers/Serializers/ImageSerializer.cs b/Libraries/Core/Routers/Serializers/ImageSerializer.cs index 31ee1827..ac0f4a9c 100644 --- a/Libraries/Core/Routers/Serializers/ImageSerializer.cs +++ b/Libraries/Core/Routers/Serializers/ImageSerializer.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; using Core.DI; +using SptCommon.Annotations; namespace Core.Routers.Serializers; diff --git a/Libraries/Core/Routers/Static/AchievementStaticRouter.cs b/Libraries/Core/Routers/Static/AchievementStaticRouter.cs index d97ab9a5..d1d9d9d8 100644 --- a/Libraries/Core/Routers/Static/AchievementStaticRouter.cs +++ b/Libraries/Core/Routers/Static/AchievementStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/BotStaticRouter.cs b/Libraries/Core/Routers/Static/BotStaticRouter.cs index 180d7536..e5c0c0a3 100644 --- a/Libraries/Core/Routers/Static/BotStaticRouter.cs +++ b/Libraries/Core/Routers/Static/BotStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Bot; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/BuildStaticRouter.cs b/Libraries/Core/Routers/Static/BuildStaticRouter.cs index 7173d095..8ba6c113 100644 --- a/Libraries/Core/Routers/Static/BuildStaticRouter.cs +++ b/Libraries/Core/Routers/Static/BuildStaticRouter.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Builds; using Core.Models.Eft.Common; using Core.Models.Eft.PresetBuild; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/BundleStaticRouter.cs b/Libraries/Core/Routers/Static/BundleStaticRouter.cs index af6f3635..94e53bf9 100644 --- a/Libraries/Core/Routers/Static/BundleStaticRouter.cs +++ b/Libraries/Core/Routers/Static/BundleStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/ClientLogStaticRouter.cs b/Libraries/Core/Routers/Static/ClientLogStaticRouter.cs index f7abbd8e..ec59c8aa 100644 --- a/Libraries/Core/Routers/Static/ClientLogStaticRouter.cs +++ b/Libraries/Core/Routers/Static/ClientLogStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Spt.Logging; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/CustomizationStaticRouter.cs b/Libraries/Core/Routers/Static/CustomizationStaticRouter.cs index 28ee1fc6..ff17a516 100644 --- a/Libraries/Core/Routers/Static/CustomizationStaticRouter.cs +++ b/Libraries/Core/Routers/Static/CustomizationStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/DataStaticRouter.cs b/Libraries/Core/Routers/Static/DataStaticRouter.cs index 452ae8b7..1dd2ed10 100644 --- a/Libraries/Core/Routers/Static/DataStaticRouter.cs +++ b/Libraries/Core/Routers/Static/DataStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/DialogStaticRouter.cs b/Libraries/Core/Routers/Static/DialogStaticRouter.cs index b45bcb69..76f2218a 100644 --- a/Libraries/Core/Routers/Static/DialogStaticRouter.cs +++ b/Libraries/Core/Routers/Static/DialogStaticRouter.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Request; using Core.Models.Eft.Dialog; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/GameStaticRouter.cs b/Libraries/Core/Routers/Static/GameStaticRouter.cs index 913199bd..8e8499d1 100644 --- a/Libraries/Core/Routers/Static/GameStaticRouter.cs +++ b/Libraries/Core/Routers/Static/GameStaticRouter.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Request; using Core.Models.Eft.Game; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/HealthStaticRouter.cs b/Libraries/Core/Routers/Static/HealthStaticRouter.cs index 7c6a53b1..dcc9841e 100644 --- a/Libraries/Core/Routers/Static/HealthStaticRouter.cs +++ b/Libraries/Core/Routers/Static/HealthStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Health; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/InraidStaticRouter.cs b/Libraries/Core/Routers/Static/InraidStaticRouter.cs index 8bf87022..d13ff833 100644 --- a/Libraries/Core/Routers/Static/InraidStaticRouter.cs +++ b/Libraries/Core/Routers/Static/InraidStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.InRaid; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/InsuranceStaticRouter.cs b/Libraries/Core/Routers/Static/InsuranceStaticRouter.cs index 76c35de1..16bc3843 100644 --- a/Libraries/Core/Routers/Static/InsuranceStaticRouter.cs +++ b/Libraries/Core/Routers/Static/InsuranceStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Insurance; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/ItemEventStaticRouter.cs b/Libraries/Core/Routers/Static/ItemEventStaticRouter.cs index cf24434d..6960d9f1 100644 --- a/Libraries/Core/Routers/Static/ItemEventStaticRouter.cs +++ b/Libraries/Core/Routers/Static/ItemEventStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.ItemEvent; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/LauncherStaticRouter.cs b/Libraries/Core/Routers/Static/LauncherStaticRouter.cs index a6e1dd1a..bd7b473d 100644 --- a/Libraries/Core/Routers/Static/LauncherStaticRouter.cs +++ b/Libraries/Core/Routers/Static/LauncherStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Launcher; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/LauncherV2StaticRouter.cs b/Libraries/Core/Routers/Static/LauncherV2StaticRouter.cs index 0ba073b3..351d2ca2 100644 --- a/Libraries/Core/Routers/Static/LauncherV2StaticRouter.cs +++ b/Libraries/Core/Routers/Static/LauncherV2StaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Launcher; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/LocationStaticRouter.cs b/Libraries/Core/Routers/Static/LocationStaticRouter.cs index bfa76abb..b7548938 100644 --- a/Libraries/Core/Routers/Static/LocationStaticRouter.cs +++ b/Libraries/Core/Routers/Static/LocationStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Location; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/MatchStaticRouter.cs b/Libraries/Core/Routers/Static/MatchStaticRouter.cs index f3fbc7f2..6fb951de 100644 --- a/Libraries/Core/Routers/Static/MatchStaticRouter.cs +++ b/Libraries/Core/Routers/Static/MatchStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Match; using Core.Utils; +using SptCommon.Annotations; using static Core.Services.MatchLocationService; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/NotifierStaticRouter.cs b/Libraries/Core/Routers/Static/NotifierStaticRouter.cs index 21416a5d..d5bf351b 100644 --- a/Libraries/Core/Routers/Static/NotifierStaticRouter.cs +++ b/Libraries/Core/Routers/Static/NotifierStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Request; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/PrestigeStaticRouter.cs b/Libraries/Core/Routers/Static/PrestigeStaticRouter.cs index ba868915..fd891477 100644 --- a/Libraries/Core/Routers/Static/PrestigeStaticRouter.cs +++ b/Libraries/Core/Routers/Static/PrestigeStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Prestige; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/ProfileStaticRouter.cs b/Libraries/Core/Routers/Static/ProfileStaticRouter.cs index a56eb6f6..4c910d43 100644 --- a/Libraries/Core/Routers/Static/ProfileStaticRouter.cs +++ b/Libraries/Core/Routers/Static/ProfileStaticRouter.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Launcher; using Core.Models.Eft.Profile; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/QuestStaticRouter.cs b/Libraries/Core/Routers/Static/QuestStaticRouter.cs index fc9b1500..3af94fcf 100644 --- a/Libraries/Core/Routers/Static/QuestStaticRouter.cs +++ b/Libraries/Core/Routers/Static/QuestStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Quests; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/RagfairStaticRouter.cs b/Libraries/Core/Routers/Static/RagfairStaticRouter.cs index 9d3704b1..17c534cb 100644 --- a/Libraries/Core/Routers/Static/RagfairStaticRouter.cs +++ b/Libraries/Core/Routers/Static/RagfairStaticRouter.cs @@ -1,9 +1,9 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Ragfair; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/TraderStaticRouter.cs b/Libraries/Core/Routers/Static/TraderStaticRouter.cs index 2fac1924..148f721e 100644 --- a/Libraries/Core/Routers/Static/TraderStaticRouter.cs +++ b/Libraries/Core/Routers/Static/TraderStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Routers/Static/WeatherStaticRouter.cs b/Libraries/Core/Routers/Static/WeatherStaticRouter.cs index 116ed217..c0716e05 100644 --- a/Libraries/Core/Routers/Static/WeatherStaticRouter.cs +++ b/Libraries/Core/Routers/Static/WeatherStaticRouter.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; -using Core.Callbacks; +using Core.Callbacks; using Core.DI; using Core.Models.Eft.Common; using Core.Utils; +using SptCommon.Annotations; namespace Core.Routers.Static; diff --git a/Libraries/Core/Servers/ConfigServer.cs b/Libraries/Core/Servers/ConfigServer.cs index 309e7f45..c7a64139 100644 --- a/Libraries/Core/Servers/ConfigServer.cs +++ b/Libraries/Core/Servers/ConfigServer.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Servers; @@ -10,11 +10,11 @@ namespace Core.Servers; [Injectable(InjectionType.Singleton)] public class ConfigServer { - protected ISptLogger _logger; - protected JsonUtil _jsonUtil; - protected FileUtil _fileUtil; - protected Dictionary configs = new(); protected static readonly string[] acceptableFileExtensions = ["json", "jsonc"]; + protected FileUtil _fileUtil; + protected JsonUtil _jsonUtil; + protected ISptLogger _logger; + protected Dictionary configs = new(); public ConfigServer( ISptLogger logger, @@ -31,7 +31,10 @@ public class ConfigServer public T GetConfig() where T : BaseConfig { var configKey = GetConfigKey(typeof(T)); - if (!configs.ContainsKey(configKey.GetValue())) throw new Exception($"Config: {configKey} is undefined. Ensure you have not broken it via editing"); + if (!configs.ContainsKey(configKey.GetValue())) + { + throw new Exception($"Config: {configKey} is undefined. Ensure you have not broken it via editing"); + } return configs[configKey.GetValue()] as T; } @@ -40,7 +43,10 @@ public class ConfigServer { var configEnumerable = Enum.GetValues().Where(e => e.GetConfigType() == type); if (!configEnumerable.Any()) + { throw new Exception($"Config of type {type.Name} is not mapped to any ConfigTypes"); + } + return configEnumerable.First(); } @@ -51,7 +57,10 @@ public class ConfigServer public void Initialize() { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Importing configs..."); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Importing configs..."); + } // Get all filepaths var filepath = "./assets/configs/"; @@ -59,6 +68,7 @@ public class ConfigServer // Add file content to result foreach (var file in files) + { if (acceptableFileExtensions.Contains(_fileUtil.GetFileExtension(file))) { var fileContent = _fileUtil.ReadFile(file); @@ -73,6 +83,7 @@ public class ConfigServer configs[$"spt-{_fileUtil.StripExtension(file)}"] = deserializedContent; } + } /** TODO: deal with this: this.logger.info(`Commit hash: { diff --git a/Libraries/Core/Servers/DatabaseServer.cs b/Libraries/Core/Servers/DatabaseServer.cs index dec2f5c7..6c1d66ae 100644 --- a/Libraries/Core/Servers/DatabaseServer.cs +++ b/Libraries/Core/Servers/DatabaseServer.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; -using Core.Models.Spt.Server; +using Core.Models.Spt.Server; +using SptCommon.Annotations; namespace Core.Servers; diff --git a/Libraries/Core/Servers/Http/SptHttpListener.cs b/Libraries/Core/Servers/Http/SptHttpListener.cs index 0693d532..a06b8bf4 100644 --- a/Libraries/Core/Servers/Http/SptHttpListener.cs +++ b/Libraries/Core/Servers/Http/SptHttpListener.cs @@ -1,7 +1,6 @@ using System.Collections.Immutable; using System.IO.Compression; using System.Text; -using SptCommon.Annotations; using Core.DI; using Core.Models.Enums; using Core.Models.Utils; @@ -9,6 +8,7 @@ using Core.Routers; using Core.Services; using Core.Utils; using Server; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Servers.Http; @@ -22,14 +22,16 @@ public class SptHttpListener : IHttpListener // We want to read 1KB at a time, for most request this is already big enough private const int BodyReadBufferSize = 1024 * 1; + private static readonly ImmutableHashSet SupportedMethods = ["GET", "PUT", "POST"]; + protected readonly HttpResponseUtil _httpResponseUtil; + protected readonly JsonUtil _jsonUtil; + protected readonly LocalisationService _localisationService; + protected readonly ISptLogger _logger; + protected readonly ISptLogger _requestLogger; + protected readonly HttpRouter _router; protected readonly IEnumerable _serializers; - protected readonly ISptLogger _logger; - protected readonly ISptLogger _requestLogger; - protected readonly HttpResponseUtil _httpResponseUtil; - protected readonly LocalisationService _localisationService; - protected readonly JsonUtil _jsonUtil; public SptHttpListener( HttpRouter httpRouter, @@ -50,8 +52,6 @@ public class SptHttpListener : IHttpListener _jsonUtil = jsonUtil; } - private static readonly ImmutableHashSet SupportedMethods = ["GET", "PUT", "POST"]; - public bool CanHandle(string _, HttpRequest req) { return SupportedMethods.Contains(req.Method); @@ -62,67 +62,71 @@ public class SptHttpListener : IHttpListener switch (req.Method) { case "GET": - { - var response = GetResponse(sessionId, req, null); - SendResponse(sessionId, req, resp, null, response); - break; - } + { + var response = GetResponse(sessionId, req, null); + SendResponse(sessionId, req, resp, null, response); + break; + } // these are handled almost identically. case "POST": case "PUT": - { - // Contrary to reasonable expectations, the content-encoding is _not_ actually used to - // determine if the payload is compressed. All PUT requests are, and POST requests without - // debug = 1 are as well. This should be fixed. - // let compressed = req.headers["content-encoding"] === "deflate"; - var requestIsCompressed = !req.Headers.TryGetValue("requestcompressed", out var compressHeader) || - compressHeader != "0"; - var requestCompressed = req.Method == "PUT" || requestIsCompressed; - - // reserve some capacity to avoid having the list to resize - var totalRead = new List(InitialCapacityForListBuffer); - // read 1KB at a time - var memory = new Memory(new byte[BodyReadBufferSize]); - var readTask = req.Body.ReadAsync(memory).AsTask(); - readTask.Wait(); - var readBytes = 0; - while (readTask.Result != 0) { - readBytes += readTask.Result; - totalRead.AddRange(memory.ToArray()); - memory = new Memory(new byte[BodyReadBufferSize]); - readTask = req.Body.ReadAsync(memory).AsTask(); + // Contrary to reasonable expectations, the content-encoding is _not_ actually used to + // determine if the payload is compressed. All PUT requests are, and POST requests without + // debug = 1 are as well. This should be fixed. + // let compressed = req.headers["content-encoding"] === "deflate"; + var requestIsCompressed = !req.Headers.TryGetValue("requestcompressed", out var compressHeader) || + compressHeader != "0"; + var requestCompressed = req.Method == "PUT" || requestIsCompressed; + + // reserve some capacity to avoid having the list to resize + var totalRead = new List(InitialCapacityForListBuffer); + // read 1KB at a time + var memory = new Memory(new byte[BodyReadBufferSize]); + var readTask = req.Body.ReadAsync(memory).AsTask(); readTask.Wait(); - } + var readBytes = 0; + while (readTask.Result != 0) + { + readBytes += readTask.Result; + totalRead.AddRange(memory.ToArray()); + memory = new Memory(new byte[BodyReadBufferSize]); + readTask = req.Body.ReadAsync(memory).AsTask(); + readTask.Wait(); + } - string value; - if (requestCompressed) - { - using var uncompressedDataStream = new MemoryStream(); - using var compressedDataStream = new MemoryStream(totalRead[..readBytes].ToArray()); - using var deflateStream = new ZLibStream(compressedDataStream, CompressionMode.Decompress, true); - deflateStream.CopyTo(uncompressedDataStream); - value = Encoding.UTF8.GetString(uncompressedDataStream.ToArray()); - } - else - { - value = Encoding.UTF8.GetString(totalRead[..readBytes].ToArray()); - } + string value; + if (requestCompressed) + { + using var uncompressedDataStream = new MemoryStream(); + using var compressedDataStream = new MemoryStream(totalRead[..readBytes].ToArray()); + using var deflateStream = new ZLibStream(compressedDataStream, CompressionMode.Decompress, true); + deflateStream.CopyTo(uncompressedDataStream); + value = Encoding.UTF8.GetString(uncompressedDataStream.ToArray()); + } + else + { + value = Encoding.UTF8.GetString(totalRead[..readBytes].ToArray()); + } - if (!requestIsCompressed) - if (_logger.IsLogEnabled(LogLevel.Debug)) - _logger.Debug(value); + if (!requestIsCompressed) + { + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug(value); + } + } - var response = GetResponse(sessionId, req, value); - SendResponse(sessionId, req, resp, value, response); - break; - } + var response = GetResponse(sessionId, req, value); + SendResponse(sessionId, req, resp, value, response); + break; + } default: - { - _logger.Warning($"{_localisationService.GetText("unknown_request")}: {req.Method}"); - break; - } + { + _logger.Warning($"{_localisationService.GetText("unknown_request")}: {req.Method}"); + break; + } } } @@ -142,26 +146,37 @@ public class SptHttpListener : IHttpListener string output ) { - if (body == null) body = new object(); + if (body == null) + { + body = new object(); + } + var bodyInfo = _jsonUtil.Serialize(body); if (IsDebugRequest(req)) { // Send only raw response without transformation SendJson(resp, output, sessionID); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Response: {output}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Response: {output}"); + } LogRequest(req, output); return; } // Not debug, minority of requests need a serializer to do the job (IMAGE/BUNDLE/NOTIFY) - var serialiser = _serializers.FirstOrDefault((x) => x.CanHandle(output)); + var serialiser = _serializers.FirstOrDefault(x => x.CanHandle(output)); if (serialiser != null) + { serialiser.Serialize(sessionID, req, resp, bodyInfo); + } else // No serializer can handle the request (majority of requests dont), zlib the output and send response back + { SendZlibJson(resp, output, sessionID); + } LogRequest(req, output); } @@ -216,7 +231,11 @@ public class SptHttpListener : IHttpListener resp.StatusCode = 200; resp.ContentType = "application/json"; resp.Headers.Append("Set-Cookie", $"PHPSESSID={sessionID}"); - if (!string.IsNullOrEmpty(output)) resp.Body.WriteAsync(Encoding.UTF8.GetBytes(output)).AsTask().Wait(); + if (!string.IsNullOrEmpty(output)) + { + resp.Body.WriteAsync(Encoding.UTF8.GetBytes(output)).AsTask().Wait(); + } + resp.StartAsync().Wait(); resp.CompleteAsync().Wait(); } diff --git a/Libraries/Core/Servers/HttpServer.cs b/Libraries/Core/Servers/HttpServer.cs index 27a41dbd..2e4ac012 100644 --- a/Libraries/Core/Servers/HttpServer.cs +++ b/Libraries/Core/Servers/HttpServer.cs @@ -1,11 +1,10 @@ using Core.Context; +using Core.Models.Spt.Config; +using Core.Models.Utils; using Core.Servers.Http; using Core.Services; using Microsoft.Extensions.Primitives; using SptCommon.Annotations; -using Core.Models.Spt.Config; -using Core.Models.Utils; - namespace Core.Servers; @@ -32,9 +31,17 @@ public class HttpServer( // enable web socket app?.UseWebSockets(); - app?.Use((HttpContext req, RequestDelegate _) => { return Task.Factory.StartNew(() => HandleFallback(req)); }); + app?.Use( + (HttpContext req, RequestDelegate _) => + { + return Task.Factory.StartNew(() => HandleFallback(req)); + } + ); started = true; - if (app is null) throw new Exception($"Application context is null in HttpServer.Load()"); + if (app is null) + { + throw new Exception("Application context is null in HttpServer.Load()"); + } _applicationContext.AddValue(ContextVariableType.WEB_APPLICATION, app); } @@ -45,54 +52,67 @@ public class HttpServer( { return _webSocketServer.OnConnection(context); } - else + + context.Request.Cookies.TryGetValue("PHPSESSID", out var sessionId); + _applicationContext.AddValue(ContextVariableType.SESSION_ID, sessionId); + + // Extract headers for original IP detection + StringValues? realIp = null; + if (context.Request.Headers.ContainsKey("x-real-ip")) { - context.Request.Cookies.TryGetValue("PHPSESSID", out var sessionId); - _applicationContext.AddValue(ContextVariableType.SESSION_ID, sessionId); + realIp = context.Request.Headers["x-real-ip"]; + } - // Extract headers for original IP detection - StringValues? realIp = null; - if (context.Request.Headers.ContainsKey("x-real-ip")) - realIp = context.Request.Headers["x-real-ip"]; - StringValues? forwardedFor = null; - if (context.Request.Headers.ContainsKey("x-forwarded-for")) - forwardedFor = context.Request.Headers["x-forwarded-for"]; + StringValues? forwardedFor = null; + if (context.Request.Headers.ContainsKey("x-forwarded-for")) + { + forwardedFor = context.Request.Headers["x-forwarded-for"]; + } - var clientIp = realIp.HasValue - ? realIp.Value.First() - : forwardedFor.HasValue - ? forwardedFor.Value.First()!.Split(",")[0].Trim() - : context.Connection.RemoteIpAddress!.ToString(); + var clientIp = realIp.HasValue + ? realIp.Value.First() + : forwardedFor.HasValue + ? forwardedFor.Value.First()!.Split(",")[0].Trim() + : context.Connection.RemoteIpAddress!.ToString(); - if (_httpConfig.LogRequests) + if (_httpConfig.LogRequests) + { + var isLocalRequest = IsLocalRequest(clientIp); + if (isLocalRequest.HasValue) { - var isLocalRequest = IsLocalRequest(clientIp); - if (isLocalRequest.HasValue) + if (isLocalRequest.Value) { - if (isLocalRequest.Value) - _logger.Info(_localisationService.GetText("client_request", context.Request.Path.Value)); - else - _logger.Info( - _localisationService.GetText( - "client_request_ip", - new Dictionary - { { "ip", clientIp }, { "url", context.Request.Path.Value } } - ) - ); + _logger.Info(_localisationService.GetText("client_request", context.Request.Path.Value)); + } + else + { + _logger.Info( + _localisationService.GetText( + "client_request_ip", + new Dictionary + { + { "ip", clientIp }, + { "url", context.Request.Path.Value } + } + ) + ); } } - - - _httpListeners.SingleOrDefault(l => l.CanHandle(sessionId, context.Request))?.Handle(sessionId, context.Request, context.Response); - // This http request would be passed through the SPT Router and handled by an ICallback } + + _httpListeners.SingleOrDefault(l => l.CanHandle(sessionId, context.Request))?.Handle(sessionId, context.Request, context.Response); + // This http request would be passed through the SPT Router and handled by an ICallback + return Task.CompletedTask; } private bool? IsLocalRequest(string? remoteAddress) { - if (remoteAddress == null) return null; + if (remoteAddress == null) + { + return null; + } return remoteAddress.StartsWith("127.0.0") || remoteAddress.StartsWith("192.168.") || @@ -103,7 +123,10 @@ public class HttpServer( { var found = new Dictionary(); - foreach (var keyValuePair in req.Cookies) found.Add(keyValuePair.Key, keyValuePair.Value); + foreach (var keyValuePair in req.Cookies) + { + found.Add(keyValuePair.Key, keyValuePair.Value); + } return found; } diff --git a/Libraries/Core/Servers/RagfairServer.cs b/Libraries/Core/Servers/RagfairServer.cs index a7878d6a..09c0af9d 100644 --- a/Libraries/Core/Servers/RagfairServer.cs +++ b/Libraries/Core/Servers/RagfairServer.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Models.Eft.Ragfair; using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Services; +using SptCommon.Annotations; namespace Core.Servers; @@ -35,9 +35,15 @@ public class RagfairServer( foreach (var traderId in traders) { // Edge case - skip generating fence offers - if (traderId == Traders.FENCE) continue; + if (traderId == Traders.FENCE) + { + continue; + } - if (_ragfairOfferService.TraderOffersNeedRefreshing(traderId)) _ragfairOfferGenerator.GenerateFleaOffersForTrader(traderId); + if (_ragfairOfferService.TraderOffersNeedRefreshing(traderId)) + { + _ragfairOfferGenerator.GenerateFleaOffersForTrader(traderId); + } } // Regenerate expired offers when over threshold limit @@ -57,9 +63,9 @@ public class RagfairServer( } /** - * Get traders who need to be periodically refreshed - * @returns string array of traders - */ + * Get traders who need to be periodically refreshed + * @returns string array of traders + */ public List GetUpdateableTraders() { return _ragfairConfig.Traders.Keys.ToList(); @@ -75,13 +81,13 @@ public class RagfairServer( } /** - * Disable/Hide an offer from flea - * @param offerId - */ + * Disable/Hide an offer from flea + * @param offerId + */ public void HideOffer(string offerId) { var offers = _ragfairOfferService.GetOffers(); - var offer = offers.FirstOrDefault((x) => x.Id == offerId); + var offer = offers.FirstOrDefault(x => x.Id == offerId); if (offer is null) { diff --git a/Libraries/Core/Servers/SaveServer.cs b/Libraries/Core/Servers/SaveServer.cs index ee0ae845..d6a97d23 100644 --- a/Libraries/Core/Servers/SaveServer.cs +++ b/Libraries/Core/Servers/SaveServer.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using SptCommon.Annotations; using Core.DI; using Core.Models.Eft.Common; using Core.Models.Eft.Profile; @@ -7,6 +6,7 @@ using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Servers; @@ -23,12 +23,12 @@ public class SaveServer( ) { protected const string profileFilepath = "user/profiles/"; - - protected Dictionary profiles = new(); - private Lock _lock = new(); + private readonly Lock _lock = new(); // onLoad = require("../bindings/SaveLoad"); protected readonly Dictionary> onBeforeSaveCallbacks = new(); + + protected Dictionary profiles = new(); protected Dictionary saveMd5 = new(); /** @@ -48,7 +48,9 @@ public class SaveServer( public void RemoveBeforeSaveCallback(string id) { if (onBeforeSaveCallbacks.ContainsKey(id)) + { onBeforeSaveCallbacks.Remove(id); + } } /** @@ -57,16 +59,25 @@ public class SaveServer( public void Load() { // get files to load - if (!_fileUtil.DirectoryExists(profileFilepath)) _fileUtil.CreateDirectory(profileFilepath); + if (!_fileUtil.DirectoryExists(profileFilepath)) + { + _fileUtil.CreateDirectory(profileFilepath); + } - var files = _fileUtil.GetFiles(profileFilepath).Where((item) => _fileUtil.GetFileExtension(item) == "json"); + var files = _fileUtil.GetFiles(profileFilepath).Where(item => _fileUtil.GetFileExtension(item) == "json"); // load profiles var stopwatch = Stopwatch.StartNew(); - foreach (var file in files) LoadProfile(_fileUtil.StripExtension(file)); + foreach (var file in files) + { + LoadProfile(_fileUtil.StripExtension(file)); + } stopwatch.Stop(); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"{files.Count()} Profiles took: {stopwatch.ElapsedMilliseconds}ms to load."); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"{files.Count()} Profiles took: {stopwatch.ElapsedMilliseconds}ms to load."); + } } /** @@ -78,9 +89,15 @@ public class SaveServer( { // Save every profile var totalTime = 0L; - foreach (var sessionID in profiles) totalTime += SaveProfile(sessionID.Key); + foreach (var sessionID in profiles) + { + totalTime += SaveProfile(sessionID.Key); + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Saved {profiles.Count} profiles, took: {totalTime}ms"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Saved {profiles.Count} profiles, took: {totalTime}ms"); + } } } @@ -93,12 +110,20 @@ public class SaveServer( { lock (_lock) { - if (string.IsNullOrEmpty(sessionId)) throw new Exception("session id provided was empty, did you restart the server while the game was running?"); + if (string.IsNullOrEmpty(sessionId)) + { + throw new Exception("session id provided was empty, did you restart the server while the game was running?"); + } - if (profiles == null || profiles.Count == 0) throw new Exception($"no profiles found in saveServer with id: {sessionId}"); + if (profiles == null || profiles.Count == 0) + { + throw new Exception($"no profiles found in saveServer with id: {sessionId}"); + } if (!profiles.TryGetValue(sessionId, out var sptProfile)) + { throw new Exception($"no profile found for sessionId: {sessionId}"); + } return sptProfile; } @@ -145,14 +170,21 @@ public class SaveServer( { lock (_lock) { - if (profiles.ContainsKey(profileInfo.ProfileId)) throw new Exception($"profile already exists for sessionId: {profileInfo.ProfileId}"); + if (profiles.ContainsKey(profileInfo.ProfileId)) + { + throw new Exception($"profile already exists for sessionId: {profileInfo.ProfileId}"); + } profiles.Add( profileInfo.ProfileId, - new SptProfile() + new SptProfile { ProfileInfo = profileInfo, - CharacterData = new Characters() { PmcData = new PmcData(), ScavData = new PmcData() } + CharacterData = new Characters + { + PmcData = new PmcData(), + ScavData = new PmcData() + } } ); } @@ -183,12 +215,16 @@ public class SaveServer( var filePath = $"{profileFilepath}{filename}"; if (_fileUtil.FileExists(filePath)) // File found, store in profiles[] + { profiles[sessionID] = _jsonUtil.Deserialize(_fileUtil.ReadFile(filePath)); + } // Run callbacks foreach (var callback in _saveLoadRouters) // HealthSaveLoadRouter, InraidSaveLoadRouter, InsuranceSaveLoadRouter, ProfileSaveLoadRouter. THESE SHOULD EXIST IN HERE + { profiles[sessionID] = callback.HandleLoad(GetProfile(sessionID)); + } } } @@ -214,7 +250,16 @@ public class SaveServer( } catch (Exception e) { - _logger.Error(_localisationService.GetText("profile_save_callback_error", new { callback, error = e })); + _logger.Error( + _localisationService.GetText( + "profile_save_callback_error", + new + { + callback, + error = e + } + ) + ); profiles[sessionID] = previous; } } diff --git a/Libraries/Core/Servers/WebSocketServer.cs b/Libraries/Core/Servers/WebSocketServer.cs index da89fa18..edb51912 100644 --- a/Libraries/Core/Servers/WebSocketServer.cs +++ b/Libraries/Core/Servers/WebSocketServer.cs @@ -1,8 +1,8 @@ using System.Net.WebSockets; -using SptCommon.Annotations; using Core.Models.Utils; using Core.Servers.Ws; using Core.Utils; +using SptCommon.Annotations; namespace Core.Servers; @@ -34,7 +34,10 @@ public class WebSocketServer( foreach (var wsh in socketHandlers) { wsh.OnConnection(webSocket, context).Wait(); - if (webSocket.State == WebSocketState.Open) _logger.Info($"WebSocketHandler \"{wsh.GetSocketId()}\" connected"); + if (webSocket.State == WebSocketState.Open) + { + _logger.Info($"WebSocketHandler \"{wsh.GetSocketId()}\" connected"); + } } return Task.CompletedTask; diff --git a/Libraries/Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs b/Libraries/Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs index eaa78cd2..8f0d69b4 100644 --- a/Libraries/Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs +++ b/Libraries/Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs @@ -1,12 +1,13 @@ using System.Net.WebSockets; using System.Text; +using Core.Models.Utils; using SptCommon.Annotations; namespace Core.Servers.Ws.Message; [Injectable] public class DefaultSptWebSocketMessageHandler( - Models.Utils.ISptLogger _logger + ISptLogger _logger ) : ISptWebSocketMessageHandler { public async Task OnSptMessage(string sessionID, WebSocket client, byte[] rawData) diff --git a/Libraries/Core/Servers/Ws/SptWebSocketConnectionHandler.cs b/Libraries/Core/Servers/Ws/SptWebSocketConnectionHandler.cs index d59ca21d..9d9748a4 100644 --- a/Libraries/Core/Servers/Ws/SptWebSocketConnectionHandler.cs +++ b/Libraries/Core/Servers/Ws/SptWebSocketConnectionHandler.cs @@ -1,6 +1,5 @@ using System.Net.WebSockets; using System.Text; -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Ws; using Core.Models.Spt.Config; @@ -8,6 +7,7 @@ using Core.Models.Utils; using Core.Servers.Ws.Message; using Core.Services; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Servers.Ws; @@ -22,14 +22,13 @@ public class SptWebSocketConnectionHandler( IEnumerable _messageHandlers ) : IWebSocketConnectionHandler { + protected WsPing _defaultNotification = new(); protected HttpConfig _httpConfig = _configServer.GetConfig(); + protected Lock _lockObject = new(); + protected Dictionary _receiveTasks = new(); + protected Dictionary _socketAliveTimers = new(); protected Dictionary _sockets = new(); - protected Dictionary _socketAliveTimers = new(); - protected Dictionary _receiveTasks = new(); - protected Lock _lockObject = new(); - - protected WsPing _defaultNotification = new(); public string GetHookUrl() { @@ -62,7 +61,10 @@ public class SptWebSocketConnectionHandler( Task.Factory.StartNew(_ => ReceiveTask(sessionID, ws, cancelToken), null, cancelToken); } - while (ws.State == WebSocketState.Open) Thread.Sleep(1000); + while (ws.State == WebSocketState.Open) + { + Thread.Sleep(1000); + } // Once the websocket dies, we dispose of it //_logger.Debug(_localisationService.GetText("websocket-socket_lost_deleting_handle")); @@ -76,30 +78,19 @@ public class SptWebSocketConnectionHandler( } if (_sockets.ContainsKey(sessionID)) + { _sockets.Remove(sessionID); + } + if (_receiveTasks.TryGetValue(sessionID, out var receiveTask)) + { receiveTask.CancelAsync().Wait(); + } } } ); } - private void TimedTask(WebSocket ws, string sessionID) - { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug(_localisationService.GetText("websocket-pinging_player", sessionID)); - - if (ws.State == WebSocketState.Open) - { - var sendTask = ws.SendAsync( - Encoding.UTF8.GetBytes(_jsonUtil.Serialize(_defaultNotification)), - WebSocketMessageType.Text, - true, - CancellationToken.None - ); - sendTask.Wait(); - } - } - public void SendMessage(string sessionID, WsNotificationEvent output) { try @@ -115,11 +106,17 @@ public class SptWebSocketConnectionHandler( CancellationToken.None ); sendTask.Wait(); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug(_localisationService.GetText("websocket-message_sent")); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug(_localisationService.GetText("websocket-message_sent")); + } } else { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug(_localisationService.GetText("websocket-not_ready_message_not_sent", sessionID)); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug(_localisationService.GetText("websocket-not_ready_message_not_sent", sessionID)); + } } } catch (Exception err) @@ -128,14 +125,42 @@ public class SptWebSocketConnectionHandler( } } + public bool IsWebSocketConnected(string sessionID) + { + return _sockets.TryGetValue(sessionID, out var socket) && socket.State == WebSocketState.Open; + } + + private void TimedTask(WebSocket ws, string sessionID) + { + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug(_localisationService.GetText("websocket-pinging_player", sessionID)); + } + + if (ws.State == WebSocketState.Open) + { + var sendTask = ws.SendAsync( + Encoding.UTF8.GetBytes(_jsonUtil.Serialize(_defaultNotification)), + WebSocketMessageType.Text, + true, + CancellationToken.None + ); + sendTask.Wait(); + } + } + private void ReceiveTask(string sessionID, WebSocket ws, CancellationToken cancelToken) { List readBytes = new(); while (ws.State == WebSocketState.Open) + { try { if (cancelToken.IsCancellationRequested) + { break; + } + var isEndOfMessage = false; while (!isEndOfMessage) { @@ -146,7 +171,10 @@ public class SptWebSocketConnectionHandler( isEndOfMessage = readTask.Result.EndOfMessage; } - foreach (var sptWebSocketMessageHandler in _messageHandlers) sptWebSocketMessageHandler.OnSptMessage(sessionID, ws, readBytes.ToArray()).Wait(); + foreach (var sptWebSocketMessageHandler in _messageHandlers) + { + sptWebSocketMessageHandler.OnSptMessage(sessionID, ws, readBytes.ToArray()).Wait(); + } } catch (OperationCanceledException _) { @@ -170,11 +198,7 @@ public class SptWebSocketConnectionHandler( { readBytes.Clear(); } - } - - public bool IsWebSocketConnected(string sessionID) - { - return _sockets.TryGetValue(sessionID, out var socket) && socket.State == WebSocketState.Open; + } } public WebSocket GetSessionWebSocket(string sessionID) diff --git a/Libraries/Core/Services/AirdropService.cs b/Libraries/Core/Services/AirdropService.cs index 103140d0..eb1776a7 100644 --- a/Libraries/Core/Services/AirdropService.cs +++ b/Libraries/Core/Services/AirdropService.cs @@ -1,14 +1,14 @@ -using SptCommon.Annotations; +using Core.Generators; +using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Location; using Core.Models.Enums; -using Core.Models.Spt.Services; -using Core.Servers; using Core.Models.Spt.Config; +using Core.Models.Spt.Services; using Core.Models.Utils; -using Core.Generators; +using Core.Servers; using Core.Utils; -using Core.Helpers; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -41,16 +41,19 @@ public class AirdropService( } /// - /// Handle client/location/getAirdropLoot - /// Get loot for an airdrop container - /// Generates it randomly based on config/airdrop.json values + /// Handle client/location/getAirdropLoot + /// Get loot for an airdrop container + /// Generates it randomly based on config/airdrop.json values /// /// OPTIONAL - Desired airdrop type, randomised when not provided /// List of LootItem objects public GetAirdropLootResponse GenerateAirdropLoot(SptAirdropTypeEnum? forcedAirdropType = null) { var airdropType = forcedAirdropType != null ? forcedAirdropType : ChooseAirdropType(); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Chose: {airdropType} for airdrop loot"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Chose: {airdropType} for airdrop loot"); + } // Common/weapon/etc var airdropConfig = GetAirdropLootConfigByType(airdropType); @@ -61,7 +64,7 @@ public class AirdropService( : _lootGenerator.CreateRandomLoot(airdropConfig); // Create airdrop crate and add to result in first spot - var airdropCrateItem = GetAirdropCrateItem((SptAirdropTypeEnum)airdropType); + var airdropCrateItem = GetAirdropCrateItem((SptAirdropTypeEnum) airdropType); // Add crate to front of list crateLoot.Insert(0, airdropCrateItem); @@ -71,7 +74,9 @@ public class AirdropService( { if (item.Id == airdropCrateItem.Id) // Crate itself, don't alter + { continue; + } // no parentId = root item, make item have create as parent if (item.ParentId is null) @@ -81,11 +86,15 @@ public class AirdropService( } } - return new GetAirdropLootResponse { Icon = airdropConfig.Icon, Container = crateLoot }; + return new GetAirdropLootResponse + { + Icon = airdropConfig.Icon, + Container = crateLoot + }; } /// - /// Create a container create item based on passed in airdrop type + /// Create a container create item based on passed in airdrop type /// /// What type of container: weapon/common etc /// Item @@ -128,7 +137,7 @@ public class AirdropService( } /// - /// Randomly pick a type of airdrop loot using weighted values from config + /// Randomly pick a type of airdrop loot using weighted values from config /// /// airdrop type value protected SptAirdropTypeEnum ChooseAirdropType() @@ -139,7 +148,7 @@ public class AirdropService( } /// - /// Get the configuration for a specific type of airdrop + /// Get the configuration for a specific type of airdrop /// /// Type of airdrop to get settings for /// LootRequest diff --git a/Libraries/Core/Services/BackupService.cs b/Libraries/Core/Services/BackupService.cs index 114d3185..f8e41de9 100644 --- a/Libraries/Core/Services/BackupService.cs +++ b/Libraries/Core/Services/BackupService.cs @@ -10,17 +10,17 @@ namespace Core.Services; [Injectable(InjectionType.Singleton)] public class BackupService { - protected ISptLogger _logger; - protected JsonUtil _jsonUtil; - protected TimeUtil _timeUtil; - protected FileUtil _fileUtil; - protected BackupConfig _backupConfig; + protected const string _profileDir = "./user/profiles"; protected readonly List _activeServerMods; - protected const string _profileDir = "./user/profiles"; + protected BackupConfig _backupConfig; // Runs Init() every x minutes protected Timer _backupIntervalTimer; + protected FileUtil _fileUtil; + protected JsonUtil _jsonUtil; + protected ISptLogger _logger; + protected TimeUtil _timeUtil; public BackupService( ISptLogger logger, @@ -71,15 +71,18 @@ 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. - * + * * @returns A promise that resolves when the backup process is complete. */ public void Init() { - if (!IsEnabled()) return; + if (!IsEnabled()) + { + return; + } var targetDir = GenerateBackupTargetDir(); @@ -97,7 +100,10 @@ public class BackupService if (currentProfilePaths.Count == 0) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("No profiles to backup"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("No profiles to backup"); + } return; } @@ -120,7 +126,10 @@ public class BackupService // Write a copy of active mods. _fileUtil.WriteFile(Path.Combine(targetDir, "activeMods.json"), _jsonUtil.Serialize(_activeServerMods)); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Profile backup created in: {targetDir}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Profile backup created in: {targetDir}"); + } } catch (Exception ex) { @@ -133,14 +142,20 @@ public class BackupService /** * Check to see if the backup service is enabled via the config. - * + * * @returns True if enabled, false otherwise. */ protected bool IsEnabled() { - if (_backupConfig.Enabled) return true; + if (_backupConfig.Enabled) + { + return true; + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Profile backups disabled"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Profile backups disabled"); + } return false; } @@ -148,7 +163,7 @@ 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. - * + * * @returns The target directory path for the backup. */ protected string GenerateBackupTargetDir() @@ -159,7 +174,7 @@ public class BackupService /** * Generates a formatted backup date string in the format `YYYY-MM-DD_hh-mm-ss`. - * + * * @returns The formatted backup date string. */ protected string GenerateBackupDate() @@ -171,10 +186,10 @@ 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. - * + * * @returns A promise that resolves when the cleanup is complete. */ protected void CleanBackups() @@ -198,7 +213,10 @@ public class BackupService foreach (var backupPath in backupPaths) { var date = ExtractDateFromFolderName(backupPath); - if (!date.HasValue) continue; + if (!date.HasValue) + { + continue; + } result.Add(date.Value.ToFileTimeUtc(), backupPath); } @@ -208,7 +226,7 @@ public class BackupService /** * Retrieves and sorts the backup file paths from the specified directory. - * + * * @param dir - The directory to search for backup files. * @returns A promise that resolves to a List of sorted backup file paths. */ @@ -222,7 +240,7 @@ public class BackupService /** * Compares two backup folder names based on their extracted dates. - * + * * @param a - The name of the first backup folder. * @param b - The name of the second backup folder. * @returns The difference in time between the two dates in milliseconds, or `null` if either date is invalid. @@ -232,14 +250,17 @@ public class BackupService var dateA = ExtractDateFromFolderName(a); var dateB = ExtractDateFromFolderName(b); - if (!dateA.HasValue || !dateB.HasValue) return 0; // Skip comparison if either date is invalid. + if (!dateA.HasValue || !dateB.HasValue) + { + return 0; // Skip comparison if either date is invalid. + } - return (int)(dateA.Value.ToFileTimeUtc() - dateB.Value.ToFileTimeUtc()); + return (int) (dateA.Value.ToFileTimeUtc() - dateB.Value.ToFileTimeUtc()); } /** * Extracts a date from a folder name string formatted as `YYYY-MM-DD_hh-mm-ss`. - * + * * @param folderName - The name of the folder from which to extract the date. * @returns A DateTime object if the folder name is in the correct format, otherwise null. */ @@ -265,7 +286,7 @@ public class BackupService /** * Removes excess backups from the backup directory. - * + * * @param backups - A List of backup file names to be removed. * @returns A promise that resolves when all specified backups have been removed. */ @@ -276,18 +297,21 @@ public class BackupService { _fileUtil.DeleteDirectory(Path.Combine(pathToDelete), true); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Deleted old backup: {pathToDelete}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Deleted old backup: {pathToDelete}"); + } } } /** * Get a List of active server mod details. - * + * * @returns A List of mod names. */ protected List GetActiveServerMods() { - _logger.Error($"NOT IMPLEMENTED - GetActiveServerMods"); + _logger.Error("NOT IMPLEMENTED - GetActiveServerMods"); List result = []; return result; diff --git a/Libraries/Core/Services/BotEquipmentFilterService.cs b/Libraries/Core/Services/BotEquipmentFilterService.cs index 2dbe0231..98b7fb31 100644 --- a/Libraries/Core/Services/BotEquipmentFilterService.cs +++ b/Libraries/Core/Services/BotEquipmentFilterService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; @@ -6,6 +5,7 @@ using Core.Models.Spt.Bots; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; +using SptCommon.Annotations; using SptCommon.Extensions; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -14,12 +14,11 @@ namespace Core.Services; [Injectable(InjectionType.Singleton)] public class BotEquipmentFilterService { - protected ISptLogger _logger; - protected ProfileHelper _profileHelper; - protected BotHelper _botHelper; - protected BotConfig _botConfig; protected Dictionary _botEquipmentConfig; + protected BotHelper _botHelper; + protected ISptLogger _logger; + protected ProfileHelper _profileHelper; public BotEquipmentFilterService( ISptLogger logger, @@ -36,7 +35,7 @@ public class BotEquipmentFilterService } /// - /// Filter a bots data to exclude equipment and cartridges defines in the botConfig + /// Filter a bots data to exclude equipment and cartridges defines in the botConfig /// /// Players id /// bots json data to filter @@ -88,7 +87,7 @@ public class BotEquipmentFilterService } /// - /// Iterate over the changes passed in and apply them to baseValues parameter + /// Iterate over the changes passed in and apply them to baseValues parameter /// /// Changes to apply /// data to update @@ -96,13 +95,19 @@ public class BotEquipmentFilterService Dictionary equipmentChanges, Dictionary baseValues) { - if (equipmentChanges is null) return; + if (equipmentChanges is null) + { + return; + } - foreach (var itemKey in equipmentChanges) baseValues[itemKey.Key] = equipmentChanges[itemKey.Key]; + foreach (var itemKey in equipmentChanges) + { + baseValues[itemKey.Key] = equipmentChanges[itemKey.Key]; + } } /// - /// Iterate over the Generation changes and alter data in baseValues.Generation + /// Iterate over the Generation changes and alter data in baseValues.Generation /// /// Changes to apply /// dictionary to update @@ -110,7 +115,10 @@ public class BotEquipmentFilterService Dictionary generationChanges, Generation baseBotGeneration) { - if (generationChanges is null) return; + if (generationChanges is null) + { + return; + } foreach (var itemKey in generationChanges) { @@ -120,7 +128,7 @@ public class BotEquipmentFilterService } /// - /// Get equipment settings for bot + /// Get equipment settings for bot /// /// equipment role to return /// EquipmentFilters object @@ -130,7 +138,7 @@ public class BotEquipmentFilterService } /// - /// Get weapon sight whitelist for a specific bot type + /// Get weapon sight whitelist for a specific bot type /// /// equipment role of bot to look up /// Dictionary of weapon type and their whitelisted scope types @@ -138,13 +146,16 @@ public class BotEquipmentFilterService { var botEquipmentSettings = _botConfig.Equipment[botEquipmentRole]; - if (botEquipmentSettings is null) return null; + if (botEquipmentSettings is null) + { + return null; + } return botEquipmentSettings.WeaponSightWhitelist; } /// - /// Get an object that contains equipment and cartridge blacklists for a specified bot type + /// Get an object that contains equipment and cartridge blacklists for a specified bot type /// /// Role of the bot we want the blacklist for /// Level of the player @@ -159,7 +170,7 @@ public class BotEquipmentFilterService } /// - /// Get the whitelist for a specific bot type that's within the players level + /// Get the whitelist for a specific bot type that's within the players level /// /// Bot type /// Players level @@ -174,7 +185,7 @@ public class BotEquipmentFilterService } /// - /// Retrieve item weighting adjustments from bot.json config based on bot level + /// Retrieve item weighting adjustments from bot.json config based on bot level /// /// Bot type to get adjustments for /// Level of bot @@ -189,7 +200,7 @@ public class BotEquipmentFilterService } /// - /// Retrieve item weighting adjustments from bot.json config based on player level + /// Retrieve item weighting adjustments from bot.json config based on player level /// /// Bot type to get adjustments for /// Level of bot @@ -204,8 +215,8 @@ public class BotEquipmentFilterService } /// - /// Filter bot equipment based on blacklist and whitelist from config/bot.json - /// Prioritizes whitelist first, if one is found blacklist is ignored + /// Filter bot equipment based on blacklist and whitelist from config/bot.json + /// Prioritizes whitelist first, if one is found blacklist is ignored /// /// bot .json file to update /// equipment blacklist @@ -220,37 +231,53 @@ public class BotEquipmentFilterService // Skip equipment slot if whitelist doesn't exist / is empty var whitelistEquipmentForSlot = whitelist.Equipment[equipmentSlotKey.Key.ToString()]; - if (whitelistEquipmentForSlot is null || whitelistEquipmentForSlot.Count == 0) continue; + if (whitelistEquipmentForSlot is null || whitelistEquipmentForSlot.Count == 0) + { + continue; + } // Filter equipment slot items to just items in whitelist baseBotNode.BotInventory.Equipment[equipmentSlotKey.Key] = new Dictionary(); foreach (var dict in botEquipment) + { if (whitelistEquipmentForSlot.Contains(dict.Key)) + { baseBotNode.BotInventory.Equipment[equipmentSlotKey.Key][dict.Key] = botEquipment[dict.Key]; + } + } } return; } if (blacklist is not null) + { foreach (var equipmentSlotKvP in baseBotNode.BotInventory.Equipment) { var botEquipment = baseBotNode.BotInventory.Equipment[equipmentSlotKvP.Key]; // Skip equipment slot if blacklist doesn't exist / is empty - if (!blacklist.Equipment.TryGetValue(equipmentSlotKvP.Key.ToString(), out var equipmentSlotBlacklist)) continue; + if (!blacklist.Equipment.TryGetValue(equipmentSlotKvP.Key.ToString(), out var equipmentSlotBlacklist)) + { + continue; + } // Filter equipment slot items to just items not in blacklist equipmentSlotKvP.Value.Clear(); foreach (var dict in botEquipment) + { if (!equipmentSlotBlacklist.Contains(dict.Key)) + { equipmentSlotKvP.Value[dict.Key] = botEquipment[dict.Key]; + } + } } + } } /// - /// Filter bot cartridges based on blacklist and whitelist from config/bot.json - /// Prioritizes whitelist first, if one is found blacklist is ignored + /// Filter bot cartridges based on blacklist and whitelist from config/bot.json + /// Prioritizes whitelist first, if one is found blacklist is ignored /// /// bot .json file to update /// equipment on this list should be excluded from the bot @@ -268,38 +295,51 @@ public class BotEquipmentFilterService { if (!whitelist.Cartridge.TryGetValue(caliber, out var matchingWhitelist)) // No cartridge whitelist, move to next cartridge + { continue; + } // Loop over each cartridge + weight // Clear all cartridges ready for whitelist to be added foreach (var ammoKvP in cartridges) // Cartridge not on whitelist + { if (!matchingWhitelist.Contains(ammoKvP.Key)) // Remove + { cartridges.Remove(ammoKvP.Key); + } + } } return; } if (blacklist is not null) + { foreach (var ammoCaliberKvP in baseBotNode.BotInventory.Ammo) { var botAmmo = baseBotNode.BotInventory.Ammo[ammoCaliberKvP.Key]; // Skip cartridge slot if blacklist doesn't exist / is empty blacklist.Cartridge.TryGetValue(ammoCaliberKvP.Key, out List cartridgeCaliberBlacklist); - if (cartridgeCaliberBlacklist is null || cartridgeCaliberBlacklist.Count == 0) continue; + if (cartridgeCaliberBlacklist is null || cartridgeCaliberBlacklist.Count == 0) + { + continue; + } // Filter cartridge slot items to just items not in blacklist foreach (var blacklistedTpl in cartridgeCaliberBlacklist .Where(blacklistedTpl => ammoCaliberKvP.Value.ContainsKey(blacklistedTpl))) + { ammoCaliberKvP.Value.Remove(blacklistedTpl); + } } + } } /// - /// Add/Edit weighting changes to bot items using values from config/bot.json/equipment + /// Add/Edit weighting changes to bot items using values from config/bot.json/equipment /// /// Weighting change to apply to bot /// Bot item dictionary to adjust @@ -309,21 +349,31 @@ public class BotEquipmentFilterService bool showEditWarnings = true) { //TODO, bad typing by key with method below due to, EquipmentSlots - if (weightingAdjustments is null) return; + if (weightingAdjustments is null) + { + return; + } if (weightingAdjustments.Add?.Count > 0) + { foreach (var poolAdjustmentKvP in weightingAdjustments.Add) { var locationToUpdate = botItemPool[Enum.Parse(poolAdjustmentKvP.Key)]; - foreach (var itemToAddKvP in poolAdjustmentKvP.Value) locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value; + foreach (var itemToAddKvP in poolAdjustmentKvP.Value) + { + locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value; + } } + } if (weightingAdjustments.Edit?.Count > 0) + { foreach (var poolAdjustmentKvP in weightingAdjustments.Edit) { var locationToUpdate = botItemPool[Enum.Parse(poolAdjustmentKvP.Key)]; foreach (var itemToEditKvP in poolAdjustmentKvP.Value) // Only make change if item exists as we're editing, not adding + { if (locationToUpdate[itemToEditKvP.Key] != null || locationToUpdate[itemToEditKvP.Key] == 0) { locationToUpdate[itemToEditKvP.Key] = itemToEditKvP.Value; @@ -331,14 +381,20 @@ public class BotEquipmentFilterService else { if (showEditWarnings) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); + } + } } + } } + } } /// - /// Add/Edit weighting changes to bot items using values from config/bot.json/equipment + /// Add/Edit weighting changes to bot items using values from config/bot.json/equipment /// /// Weighting change to apply to bot /// Bot item dictionary to adjust @@ -348,21 +404,31 @@ public class BotEquipmentFilterService Dictionary> botItemPool, bool showEditWarnings = true) { - if (weightingAdjustments is null) return; + if (weightingAdjustments is null) + { + return; + } if (weightingAdjustments.Add?.Count > 0) + { foreach (var poolAdjustmentKvP in weightingAdjustments.Add) { var locationToUpdate = botItemPool[poolAdjustmentKvP.Key]; - foreach (var itemToAddKvP in poolAdjustmentKvP.Value) locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value; + foreach (var itemToAddKvP in poolAdjustmentKvP.Value) + { + locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value; + } } + } if (weightingAdjustments.Edit?.Count > 0) + { foreach (var poolAdjustmentKvP in weightingAdjustments.Edit) { var locationToUpdate = botItemPool[poolAdjustmentKvP.Key]; foreach (var itemToEditKvP in poolAdjustmentKvP.Value) // Only make change if item exists as we're editing, not adding + { if (locationToUpdate.GetValueOrDefault(itemToEditKvP.Key) != null || locationToUpdate[itemToEditKvP.Key] == 0) { locationToUpdate[itemToEditKvP.Key] = itemToEditKvP.Value; @@ -370,14 +436,20 @@ public class BotEquipmentFilterService else { if (showEditWarnings) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); + } + } } + } } + } } /// - /// Add/Edit weighting changes to bot items using values from config/bot.json/equipment + /// Add/Edit weighting changes to bot items using values from config/bot.json/equipment /// /// Weighting change to apply to bot /// Bot item dictionary to adjust @@ -386,21 +458,31 @@ public class BotEquipmentFilterService Appearance botItemPool, bool showEditWarnings = true) { - if (weightingAdjustments is null) return; + if (weightingAdjustments is null) + { + return; + } if (weightingAdjustments.Add?.Count > 0) + { foreach (var poolAdjustmentKvP in weightingAdjustments.Add) { var locationToUpdate = botItemPool.GetByJsonProp>(poolAdjustmentKvP.Key); - foreach (var itemToAddKvP in poolAdjustmentKvP.Value) locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value; + foreach (var itemToAddKvP in poolAdjustmentKvP.Value) + { + locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value; + } } + } if (weightingAdjustments.Edit?.Count > 0) + { foreach (var poolAdjustmentKvP in weightingAdjustments.Edit) { var locationToUpdate = botItemPool.GetByJsonProp>(poolAdjustmentKvP.Key); foreach (var itemToEditKvP in poolAdjustmentKvP.Value) // Only make change if item exists as we're editing, not adding + { if (locationToUpdate.GetValueOrDefault(itemToEditKvP.Key) != null || locationToUpdate.GetValueOrDefault(itemToEditKvP.Key) == 0) { locationToUpdate[itemToEditKvP.Key] = itemToEditKvP.Value; @@ -408,9 +490,15 @@ public class BotEquipmentFilterService else { if (showEditWarnings) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); + } + } } + } } + } } } diff --git a/Libraries/Core/Services/BotEquipmentModPoolService.cs b/Libraries/Core/Services/BotEquipmentModPoolService.cs index 4600d11c..dff21682 100644 --- a/Libraries/Core/Services/BotEquipmentModPoolService.cs +++ b/Libraries/Core/Services/BotEquipmentModPoolService.cs @@ -1,30 +1,29 @@ using System.Collections.Concurrent; -using SptCommon.Annotations; -using Core.Models.Eft.Common.Tables; -using Core.Models.Utils; using Core.Helpers; -using Core.Servers; +using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Spt.Config; +using Core.Models.Utils; +using Core.Servers; +using SptCommon.Annotations; namespace Core.Services; [Injectable(InjectionType.Singleton)] public class BotEquipmentModPoolService { - protected ISptLogger _logger; - protected ItemHelper _itemHelper; - protected DatabaseService _databaseService; - protected LocalisationService _localisationService; + private readonly Lock _lock = new(); + protected bool _armorPoolGenerated; + protected BotConfig _botConfig; protected ConfigServer _configServer; + protected DatabaseService _databaseService; + protected ConcurrentDictionary>> _gearModPool; + protected ItemHelper _itemHelper; + protected LocalisationService _localisationService; + protected ISptLogger _logger; + protected ConcurrentDictionary>> _weaponModPool; protected bool _weaponPoolGenerated; - protected bool _armorPoolGenerated; - protected ConcurrentDictionary>> _weaponModPool; - protected ConcurrentDictionary>> _gearModPool; - protected BotConfig _botConfig; - - private readonly Lock _lock = new(); public BotEquipmentModPoolService( ISptLogger logger, @@ -79,7 +78,10 @@ public class BotEquipmentModPoolService } // Skip item without slots - if (item.Properties.Slots is null || item.Properties.Slots.Count == 0) continue; + if (item.Properties.Slots is null || item.Properties.Slots.Count == 0) + { + continue; + } // Add base item (weapon/armor) to pool pool.TryAdd(item.Id, new ConcurrentDictionary>()); @@ -101,13 +103,17 @@ public class BotEquipmentModPoolService // Does tpl exist inside mod_slots hashset if (!SetContainsTpl(itemModPool[slot.Name], itemToAddTpl)) // Keyed by mod slot + { AddTplToSet(itemModPool[slot.Name], itemToAddTpl); + } var subItemDetails = _itemHelper.GetItem(itemToAddTpl).Value; var hasSubItemsToAdd = (subItemDetails?.Properties?.Slots?.Count ?? 0) > 0; if (hasSubItemsToAdd && !pool.ContainsKey(subItemDetails.Id)) // Recursive call + { GeneratePool([subItemDetails], poolType); + } } } } @@ -155,7 +161,9 @@ public class BotEquipmentModPoolService { if (!_weaponPoolGenerated) // Get every weapon in db and generate mod pool + { GenerateWeaponPool(); + } return _weaponModPool[itemTpl][slotName]; } @@ -167,7 +175,10 @@ public class BotEquipmentModPoolService */ public ConcurrentDictionary> GetModsForGearSlot(string itemTpl) { - if (!_armorPoolGenerated) GenerateGearPool(); + if (!_armorPoolGenerated) + { + GenerateGearPool(); + } return _gearModPool.TryGetValue(itemTpl, out var value) ? value @@ -181,7 +192,10 @@ public class BotEquipmentModPoolService */ public ConcurrentDictionary> GetModsForWeaponSlot(string itemTpl) { - if (!_weaponPoolGenerated) GenerateWeaponPool(); + if (!_weaponPoolGenerated) + { + GenerateWeaponPool(); + } return _weaponModPool[itemTpl]; } @@ -194,14 +208,19 @@ public class BotEquipmentModPoolService var itemDb = _itemHelper.GetItem(itemTpl).Value; if (itemDb.Properties.Slots is not null) // Loop over slots flagged as 'required' + { foreach (var slot in itemDb.Properties.Slots.Where(slot => slot.Required.GetValueOrDefault(false))) { // Create dict entry for mod slot result.Add(slot.Name, []); // Add compatible tpls to dicts hashset - foreach (var compatibleItemTpl in slot.Props.Filters.FirstOrDefault().Filter) result[slot.Name].Add(compatibleItemTpl); + foreach (var compatibleItemTpl in slot.Props.Filters.FirstOrDefault().Filter) + { + result[slot.Name].Add(compatibleItemTpl); + } } + } return result; } @@ -213,7 +232,7 @@ public class BotEquipmentModPoolService { var weapons = _databaseService.GetItems() .Values.Where( - (item) => item.Type == "Item" && _itemHelper.IsOfBaseclass(item.Id, BaseClasses.WEAPON) + item => item.Type == "Item" && _itemHelper.IsOfBaseclass(item.Id, BaseClasses.WEAPON) ); GeneratePool(weapons, "weapon"); @@ -228,16 +247,16 @@ public class BotEquipmentModPoolService { var gear = _databaseService.GetItems() .Values.Where( - (item) => item.Type == "Item" && - _itemHelper.IsOfBaseclasses( - item.Id, - [ - BaseClasses.ARMORED_EQUIPMENT, - BaseClasses.VEST, - BaseClasses.ARMOR, - BaseClasses.HEADWEAR - ] - ) + item => item.Type == "Item" && + _itemHelper.IsOfBaseclasses( + item.Id, + [ + BaseClasses.ARMORED_EQUIPMENT, + BaseClasses.VEST, + BaseClasses.ARMOR, + BaseClasses.HEADWEAR + ] + ) ); GeneratePool(gear, "gear"); diff --git a/Libraries/Core/Services/BotGenerationCacheService.cs b/Libraries/Core/Services/BotGenerationCacheService.cs index 0b60a1e3..bbf897ce 100644 --- a/Libraries/Core/Services/BotGenerationCacheService.cs +++ b/Libraries/Core/Services/BotGenerationCacheService.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; namespace Core.Services; @@ -11,9 +11,9 @@ public class BotGenerationCacheService( LocalisationService _localisationService ) { - protected Dictionary> _storedBots = new(); protected Queue _activeBotsInRaid = []; protected object _lock = new(); + protected Dictionary> _storedBots = new(); /** @@ -25,8 +25,12 @@ public class BotGenerationCacheService( lock (_lock) { foreach (var bot in botsToStore) + { if (!_storedBots.TryAdd(key, [bot])) + { _storedBots[key].Add(bot); + } + } } } @@ -41,7 +45,9 @@ public class BotGenerationCacheService( lock (_lock) { if (_storedBots.TryGetValue(key, out var bots)) + { if (bots.Count > 0) + { try { return bots.PopLast(); @@ -50,6 +56,8 @@ public class BotGenerationCacheService( { _logger.Error(_localisationService.GetText("bot-cache_has_zero_bots_of_requested_type", key)); } + } + } } _logger.Error(_localisationService.GetText("bot-no_bot_type_in_cache", key)); diff --git a/Libraries/Core/Services/BotLootCacheService.cs b/Libraries/Core/Services/BotLootCacheService.cs index 62749664..65e19d8e 100644 --- a/Libraries/Core/Services/BotLootCacheService.cs +++ b/Libraries/Core/Services/BotLootCacheService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Common; @@ -7,7 +6,7 @@ using Core.Models.Enums; using Core.Models.Spt.Bots; using Core.Models.Utils; using Core.Utils.Cloners; - +using SptCommon.Annotations; namespace Core.Services; @@ -21,11 +20,11 @@ public class BotLootCacheService( ICloner _cloner ) { - protected Dictionary _lootCache = new(); protected object _lock = new(); + protected Dictionary _lootCache = new(); /// - /// Remove cached bot loot data + /// Remove cached bot loot data /// public void ClearCache() { @@ -36,7 +35,7 @@ public class BotLootCacheService( } /// - /// Get the fully created loot array, ordered by price low to high + /// Get the fully created loot array, ordered by price low to high /// /// bot to get loot for /// is the bot a pmc @@ -113,9 +112,9 @@ public class BotLootCacheService( "bot-loot_type_not_found", new { - lootType = lootType, - botRole = botRole, - isPmc = isPmc + lootType, + botRole, + isPmc } ) ); @@ -129,11 +128,19 @@ public class BotLootCacheService( { var itemPrice = _itemHelper.GetItemPrice(i.Key); if (itemPriceMinMax?.Min is not null && itemPriceMinMax?.Max is not null) + { return itemPrice >= itemPriceMinMax?.Min && itemPrice <= itemPriceMinMax?.Max; + } - if (itemPriceMinMax?.Min is not null && itemPriceMinMax?.Max is null) return itemPrice >= itemPriceMinMax?.Min; + if (itemPriceMinMax?.Min is not null && itemPriceMinMax?.Max is null) + { + return itemPrice >= itemPriceMinMax?.Min; + } - if (itemPriceMinMax?.Min is null && itemPriceMinMax?.Max is not null) return itemPrice <= itemPriceMinMax?.Max; + if (itemPriceMinMax?.Min is null && itemPriceMinMax?.Max is not null) + { + return itemPrice <= itemPriceMinMax?.Max; + } return false; } @@ -146,7 +153,7 @@ public class BotLootCacheService( } /// - /// Generate loot for a bot and store inside a private class property + /// Generate loot for a bot and store inside a private class property /// /// bots role (assault / pmcBot etc) /// Is the bot a PMC (alters what loot is cached) @@ -187,7 +194,10 @@ public class BotLootCacheService( foreach (var kvp in poolsToProcess) { // No items to add, skip - if (kvp.Value.Count == 0) continue; + if (kvp.Value.Count == 0) + { + continue; + } // Sort loot pool into separate buckets switch (kvp.Key) @@ -213,7 +223,10 @@ public class BotLootCacheService( } // Add all items (if any) to combined pool (excluding secure) - if (kvp.Value.Count > 0 && kvp.Key.ToLower() != "securedcontainer") AddItemsToPool(combinedLootPool, kvp.Value); + if (kvp.Value.Count > 0 && kvp.Key.ToLower() != "securedcontainer") + { + AddItemsToPool(combinedLootPool, kvp.Value); + } } // Assign whitelisted special items to bot if any exist @@ -225,11 +238,16 @@ public class BotLootCacheService( // no whitelist, find and assign from combined item pool if (!specialLootItems.Any()) // key = tpl, value = weight + { foreach (var itemKvP in specialLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (!(IsBulletOrGrenade(itemTemplate.Properties) || IsMagazine(itemTemplate.Properties))) specialLootItems[itemKvP.Key] = itemKvP.Value; + if (!(IsBulletOrGrenade(itemTemplate.Properties) || IsMagazine(itemTemplate.Properties))) + { + specialLootItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted healing items to bot if any exist var healingItems = @@ -240,6 +258,7 @@ public class BotLootCacheService( // No whitelist, find and assign from combined item pool if (!healingItems.Any()) // key = tpl, value = weight + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; @@ -248,75 +267,111 @@ public class BotLootCacheService( itemTemplate.Parent != BaseClasses.STIMULATOR && itemTemplate.Parent != BaseClasses.DRUGS ) + { healingItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted drugs to bot if any exist var drugItems = botJsonTemplate.BotGeneration?.Items?.Drugs?.Whitelist ?? new Dictionary(); // no drugs whitelist, find and assign from combined item pool if (!drugItems.Any()) + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (IsMedicalItem(itemTemplate.Properties) && itemTemplate.Parent == BaseClasses.DRUGS) drugItems[itemKvP.Key] = itemKvP.Value; + if (IsMedicalItem(itemTemplate.Properties) && itemTemplate.Parent == BaseClasses.DRUGS) + { + drugItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted food to bot if any exist var foodItems = botJsonTemplate.BotGeneration?.Items?.Food?.Whitelist ?? new Dictionary(); // No food whitelist, find and assign from combined item pool if (!foodItems.Any()) + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.FOOD)) foodItems[itemKvP.Key] = itemKvP.Value; + if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.FOOD)) + { + foodItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted drink to bot if any exist var drinkItems = botJsonTemplate.BotGeneration?.Items?.Food?.Whitelist ?? new Dictionary(); // No drink whitelist, find and assign from combined item pool if (!drinkItems.Any()) + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.DRINK)) drinkItems[itemKvP.Key] = itemKvP.Value; + if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.DRINK)) + { + drinkItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted currency to bot if any exist var currencyItems = botJsonTemplate.BotGeneration?.Items?.Currency?.Whitelist ?? new Dictionary(); // No currency whitelist, find and assign from combined item pool if (!currencyItems.Any()) + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.MONEY)) currencyItems[itemKvP.Key] = itemKvP.Value; + if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.MONEY)) + { + currencyItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted stims to bot if any exist var stimItems = botJsonTemplate.BotGeneration?.Items?.Stims?.Whitelist ?? new Dictionary(); // No whitelist, find and assign from combined item pool if (!stimItems.Any()) + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (IsMedicalItem(itemTemplate.Properties) && itemTemplate.Parent == BaseClasses.STIMULATOR) stimItems[itemKvP.Key] = itemKvP.Value; + if (IsMedicalItem(itemTemplate.Properties) && itemTemplate.Parent == BaseClasses.STIMULATOR) + { + stimItems[itemKvP.Key] = itemKvP.Value; + } } + } // Assign whitelisted grenades to bot if any exist var grenadeItems = botJsonTemplate.BotGeneration?.Items?.Grenades?.Whitelist ?? new Dictionary(); // no whitelist, find and assign from combined item pool if (!grenadeItems.Any()) + { foreach (var itemKvP in combinedLootPool) { var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value; - if (IsGrenade(itemTemplate.Properties)) grenadeItems[itemKvP.Key] = itemKvP.Value; + if (IsGrenade(itemTemplate.Properties)) + { + grenadeItems[itemKvP.Key] = itemKvP.Value; + } } + } // Get backpack loot (excluding magazines, bullets, grenades, drink, food and healing/stim items) var filteredBackpackItems = new Dictionary(); foreach (var itemKvP in backpackLootPool) { var itemResult = _itemHelper.GetItem(itemKvP.Key); - if (itemResult.Value is null) continue; + if (itemResult.Value is null) + { + continue; + } var itemTemplate = itemResult.Value; if ( @@ -329,7 +384,9 @@ public class BotLootCacheService( IsCurrency(itemTemplate.Id) ) // Is type we don't want as backpack loot, skip + { continue; + } filteredBackpackItems[itemKvP.Key] = itemKvP.Value; } @@ -339,7 +396,10 @@ public class BotLootCacheService( foreach (var itemKvP in pocketLootPool) { var itemResult = _itemHelper.GetItem(itemKvP.Key); - if (itemResult.Value is null) continue; + if (itemResult.Value is null) + { + continue; + } var itemTemplate = itemResult.Value; if ( @@ -353,7 +413,9 @@ public class BotLootCacheService( itemTemplate.Properties.Height is null || // lacks height itemTemplate.Properties.Width is null // lacks width ) + { continue; + } filteredPocketItems[itemKvP.Key] = itemKvP.Value; } @@ -363,7 +425,10 @@ public class BotLootCacheService( foreach (var itemKvP in vestLootPool) { var itemResult = _itemHelper.GetItem(itemKvP.Key); - if (itemResult.Value is null) continue; + if (itemResult.Value is null) + { + continue; + } var itemTemplate = itemResult.Value; if ( @@ -375,7 +440,9 @@ public class BotLootCacheService( IsDrink(itemTemplate.Id) || IsCurrency(itemTemplate.Id) ) + { continue; + } filteredVestItems[itemKvP.Key] = itemKvP.Value; } @@ -402,7 +469,7 @@ public class BotLootCacheService( } /// - /// Add unique items into combined pool + /// Add unique items into combined pool /// /// Pool of items to add to /// items to add to combined pool if unique @@ -423,14 +490,17 @@ public class BotLootCacheService( foreach (var tpl in poolOfItemsToAdd) { // Skip adding items that already exist - if (poolToAddTo.ContainsKey(tpl.Key)) continue; + if (poolToAddTo.ContainsKey(tpl.Key)) + { + continue; + } poolToAddTo[tpl.Key] = poolOfItemsToAdd[tpl.Key]; } } /// - /// Ammo/grenades have this property + /// Ammo/grenades have this property /// /// /// @@ -440,7 +510,7 @@ public class BotLootCacheService( } /// - /// Internal and external magazine have this property + /// Internal and external magazine have this property /// /// /// @@ -450,7 +520,7 @@ public class BotLootCacheService( } /// - /// Medical use items (e.g. morphine/lip balm/grizzly) + /// Medical use items (e.g. morphine/lip balm/grizzly) /// /// /// @@ -460,7 +530,7 @@ public class BotLootCacheService( } /// - /// Grenades have this property (e.g. smoke/frag/flash grenades) + /// Grenades have this property (e.g. smoke/frag/flash grenades) /// /// /// @@ -485,7 +555,7 @@ public class BotLootCacheService( } /// - /// Check if a bot type exists inside the loot cache + /// Check if a bot type exists inside the loot cache /// /// role to check for /// true if they exist @@ -498,7 +568,7 @@ public class BotLootCacheService( } /// - /// If lootcache is undefined, init with empty property arrays + /// If lootcache is undefined, init with empty property arrays /// /// Bot role to hydrate protected void InitCacheForBotRole(string botRole) @@ -529,7 +599,7 @@ public class BotLootCacheService( } /// - /// Compares two item prices by their flea (or handbook if that doesnt exist) price + /// Compares two item prices by their flea (or handbook if that doesnt exist) price /// /// /// @@ -537,13 +607,25 @@ public class BotLootCacheService( protected int CompareByValue(int itemAPrice, int itemBPrice) { // If item A has no price, it should be moved to the back when sorting - if (itemAPrice is 0) return 1; + if (itemAPrice is 0) + { + return 1; + } - if (itemBPrice is 0) return -1; + if (itemBPrice is 0) + { + return -1; + } - if (itemAPrice < itemBPrice) return -1; + if (itemAPrice < itemBPrice) + { + return -1; + } - if (itemAPrice > itemBPrice) return 1; + if (itemAPrice > itemBPrice) + { + return 1; + } return 0; } diff --git a/Libraries/Core/Services/BotNameService.cs b/Libraries/Core/Services/BotNameService.cs index 92cd6fea..61e08206 100644 --- a/Libraries/Core/Services/BotNameService.cs +++ b/Libraries/Core/Services/BotNameService.cs @@ -1,11 +1,11 @@ -using SptCommon.Annotations; +using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Bots; -using Core.Helpers; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -21,11 +21,11 @@ public class BotNameService( ) { protected BotConfig _botConfig = _configServer.GetConfig(); - protected HashSet _usedNameCache = new(); protected object _lock = new(); + protected HashSet _usedNameCache = new(); /// - /// Clear out any entries in Name Set + /// Clear out any entries in Name Set /// public void ClearNameCache() { @@ -33,7 +33,7 @@ public class BotNameService( } /// - /// Create a unique bot nickname + /// Create a unique bot nickname /// /// bot JSON data from db /// @@ -63,7 +63,10 @@ public class BotNameService( name = name.Trim(); // Config is set to add role to end of bot name - if (showTypeInNickname) name += $" {botRole}"; + if (showTypeInNickname) + { + name += $" {botRole}"; + } // Replace pmc bot names with player name + prefix if (botGenerationDetails.IsPmc.GetValueOrDefault(false) && botGenerationDetails.AllPmcsHaveSameNameAsPlayer.GetValueOrDefault(false)) @@ -75,6 +78,7 @@ public class BotNameService( // Is this a role that must be unique if (roleShouldBeUnique.GetValueOrDefault(false)) // Check name in cache + { if (CacheContainsName(name)) { // Not unique @@ -83,7 +87,9 @@ public class BotNameService( // 5 attempts to generate a name, pool probably isn't big enough var genericName = $"{botGenerationDetails.Side} {_randomUtil.GetInt(100000, 999999)}"; if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Failed to find unique name for: {botRole} {botGenerationDetails.Side} after 5 attempts, using: {genericName}"); + } return genericName; } @@ -93,6 +99,7 @@ public class BotNameService( // Try again continue; } + } // Add bot name to cache to prevent being used again AddNameToCache(name); @@ -121,7 +128,7 @@ public class BotNameService( } /// - /// Add random PMC name to bots MainProfileNickname property + /// Add random PMC name to bots MainProfileNickname property /// /// Bot to update public void AddRandomPmcNameToBotMainProfileNicknameProperty(BotBase bot) @@ -132,7 +139,7 @@ public class BotNameService( } /// - /// Choose a random PMC name from bear or usec bot jsons + /// Choose a random PMC name from bear or usec bot jsons /// /// PMC name as string protected string GetRandomPmcName() diff --git a/Libraries/Core/Services/BotWeaponModLimitService.cs b/Libraries/Core/Services/BotWeaponModLimitService.cs index c0f4ac70..478eb8c1 100644 --- a/Libraries/Core/Services/BotWeaponModLimitService.cs +++ b/Libraries/Core/Services/BotWeaponModLimitService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; @@ -6,6 +5,7 @@ using Core.Models.Spt.Bots; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -20,7 +20,7 @@ public class BotWeaponModLimitService( protected BotConfig _botConfig = _configServer.GetConfig(); /// - /// Initalise mod limits to be used when generating a weapon + /// Initalise mod limits to be used when generating a weapon /// /// "assault", "bossTagilla" or "pmc" /// BotModLimits object @@ -28,7 +28,10 @@ public class BotWeaponModLimitService( { return new BotModLimits { - Scope = new ItemCount { Count = 0 }, + Scope = new ItemCount + { + Count = 0 + }, ScopeMax = _botConfig.Equipment[botRole]?.WeaponModLimits?.ScopeLimit, ScopeBaseTypes = [ @@ -38,7 +41,10 @@ public class BotWeaponModLimitService( BaseClasses.COMPACT_COLLIMATOR, BaseClasses.SPECIAL_SCOPE ], - FlashlightLaser = new ItemCount { Count = 0 }, + FlashlightLaser = new ItemCount + { + Count = 0 + }, FlashlightLaserMax = _botConfig.Equipment[botRole]?.WeaponModLimits?.LightLaserLimit, FlashlightLaserBaseTypes = [ @@ -50,11 +56,11 @@ 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 - /// Exception: Always disallow mounts that hold only flashlights once flashlight 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 /// mods template data @@ -74,7 +80,7 @@ public class BotWeaponModLimitService( { // If weapon already has a longer ranged scope on it, allow ncstar to be spawned if (weapon.Any( - (item) => + item => _itemHelper.IsOfBaseclasses( item.Template, [ @@ -84,17 +90,25 @@ public class BotWeaponModLimitService( ] ) )) + { return false; + } return true; } // Mods parent is scope and mod is scope, allow it (adds those mini-sights to the tops of sights) var modIsScope = _itemHelper.IsOfBaseclasses(modTemplate.Id, modLimits.ScopeBaseTypes); - if (_itemHelper.IsOfBaseclasses(modsParent.Id, modLimits.ScopeBaseTypes) && modIsScope) return false; + if (_itemHelper.IsOfBaseclasses(modsParent.Id, modLimits.ScopeBaseTypes) && modIsScope) + { + return false; + } // If mod is a scope , Exit early - if (modIsScope) return WeaponModLimitReached(modTemplate.Id, modLimits.Scope, modLimits.ScopeMax ?? 0, botRole); + if (modIsScope) + { + return WeaponModLimitReached(modTemplate.Id, modLimits.Scope, modLimits.ScopeMax ?? 0, botRole); + } // Don't allow multple mounts on a weapon (except when mount is on another mount) // Fail when: @@ -105,33 +119,39 @@ public class BotWeaponModLimitService( modTemplate.Properties.Slots?.Count() == 1 && _itemHelper.IsOfBaseclass(modTemplate.Id, BaseClasses.MOUNT) && !_itemHelper.IsOfBaseclass(modsParent.Id, BaseClasses.MOUNT) && - modTemplate.Properties.Slots.Any((slot) => slot.Name == "mod_scope") + modTemplate.Properties.Slots.Any(slot => slot.Name == "mod_scope") ) + { return true; + } // If mod is a light/laser, return if limit reached var modIsLightOrLaser = _itemHelper.IsOfBaseclasses(modTemplate.Id, modLimits.FlashlightLaserBaseTypes); if (modIsLightOrLaser) + { return WeaponModLimitReached( modTemplate.Id, modLimits.FlashlightLaser, modLimits.FlashlightLaserMax ?? 0, botRole ); + } // Mod is a mount that can hold only flashlights ad limit is reached (dont want to add empty mounts if limit is reached) if (modLimits.Scope.Count >= modLimits.ScopeMax && modTemplate.Properties.Slots?.Count() == 1 && _itemHelper.IsOfBaseclass(modTemplate.Id, BaseClasses.MOUNT) && - modTemplate.Properties.Slots.Any((slot) => slot.Name == "mod_flashlight") + modTemplate.Properties.Slots.Any(slot => slot.Name == "mod_flashlight") ) + { return true; + } return false; } /// - /// Check if the specific item type on the weapon has reached the set limit + /// Check if the specific item type on the weapon has reached the set limit /// /// log mod tpl if over type limit /// current number of this item on gun @@ -145,13 +165,19 @@ public class BotWeaponModLimitService( string botRole) { // No value or 0 - if (maxLimit is null || maxLimit is 0) return false; + if (maxLimit is null || maxLimit is 0) + { + return false; + } // Has mod limit for bot type been reached if (currentCount.Count >= maxLimit) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"[{botRole}] scope limit reached! tried to add {modTpl} but scope count is {currentCount.Count}"); + } + return true; } diff --git a/Libraries/Core/Services/Cache/BundleHashCacheService.cs b/Libraries/Core/Services/Cache/BundleHashCacheService.cs index 28c4bced..c5e5d556 100644 --- a/Libraries/Core/Services/Cache/BundleHashCacheService.cs +++ b/Libraries/Core/Services/Cache/BundleHashCacheService.cs @@ -13,8 +13,8 @@ public class BundleHashCacheService( FileUtil _fileUtil ) { - protected Dictionary _bundleHashes = new(); protected static readonly string _bundleHashCachePath = "./user/cache/bundleHashCache.json"; + protected Dictionary _bundleHashes = new(); public string GetStoredValue(string key) { @@ -29,7 +29,10 @@ public class BundleHashCacheService( _fileUtil.WriteFile(_bundleHashCachePath, _jsonUtil.Serialize(_bundleHashes)); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Bundle {key} hash stored in {_bundleHashCachePath}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Bundle {key} hash stored in {_bundleHashCachePath}"); + } } public bool MatchWithStoredHash(string bundlePath, string hash) diff --git a/Libraries/Core/Services/Cache/ModHashCacheService.cs b/Libraries/Core/Services/Cache/ModHashCacheService.cs index 8a60dad4..3c1fe336 100644 --- a/Libraries/Core/Services/Cache/ModHashCacheService.cs +++ b/Libraries/Core/Services/Cache/ModHashCacheService.cs @@ -13,8 +13,8 @@ public class ModHashCacheService( FileUtil _fileUtil ) { - protected readonly Dictionary _modHashes = new(); protected readonly string _modCachePath = "./user/cache/modCache.json"; + protected readonly Dictionary _modHashes = new(); public string? GetStoredValue(string key) { @@ -29,7 +29,10 @@ public class ModHashCacheService( _fileUtil.WriteFile(_modCachePath, _jsonUtil.Serialize(_modHashes)); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Mod {key} hash stored in: {_modCachePath}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Mod {key} hash stored in: {_modCachePath}"); + } } public bool MatchWithStoredHash(string modName, string hash) diff --git a/Libraries/Core/Services/CircleOfCultistService.cs b/Libraries/Core/Services/CircleOfCultistService.cs index 1ed9d9d8..c40ad343 100644 --- a/Libraries/Core/Services/CircleOfCultistService.cs +++ b/Libraries/Core/Services/CircleOfCultistService.cs @@ -1,5 +1,4 @@ using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Hideout; @@ -14,7 +13,9 @@ using Core.Routers; using Core.Servers; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; +using Hideout = Core.Models.Spt.Hideout.Hideout; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -39,13 +40,13 @@ public class CircleOfCultistService( ConfigServer _configServer ) { - protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); protected const string CircleOfCultistSlotId = "CircleOfCultistsGrid1"; + protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); /// - /// Start a sacrifice event - /// Generate rewards - /// Delete sacrificed items + /// Start a sacrifice event + /// Generate rewards + /// Delete sacrificed items /// /// Session id /// Player profile doing sacrifice @@ -97,8 +98,12 @@ public class CircleOfCultistService( // Remove sacrificed items from circle inventory foreach (var item in sacrificedItems) + { if (item.SlotId == CircleOfCultistSlotId) + { _inventoryHelper.RemoveItem(pmcData, item.Id, sessionId, output); + } + } var rewards = hasDirectReward ? GetDirectRewards(sessionId, directRewardSettings, cultistCircleStashId) @@ -123,21 +128,23 @@ public class CircleOfCultistService( { // Get a randomised value to multiply the sacrificed rouble cost by var rewardAmountMultiplier = _randomUtil.GetDouble( - (double)cultistCircleSettings.RewardPriceMultiplerMinMax.Min, - (double)cultistCircleSettings.RewardPriceMultiplerMinMax.Max + (double) cultistCircleSettings.RewardPriceMultiplerMinMax.Min, + (double) cultistCircleSettings.RewardPriceMultiplerMinMax.Max ); // Adjust value generated by the players hideout management skill var hideoutManagementSkill = _profileHelper.GetSkillFromProfile(pmcData, SkillTypes.HideoutManagement); if (hideoutManagementSkill is not null) + { rewardAmountMultiplier *= - (float)(1 + hideoutManagementSkill.Progress / 10000); // 5100 becomes 0.51, add 1 to it, 1.51, multiply the bonus by it (e.g. 1.2 x 1.51) + (float) (1 + hideoutManagementSkill.Progress / 10000); // 5100 becomes 0.51, add 1 to it, 1.51, multiply the bonus by it (e.g. 1.2 x 1.51) + } return rewardAmountMultiplier; } /// - /// Register production inside player profile + /// Register production inside player profile /// /// Session id /// Player profile @@ -166,8 +173,8 @@ public class CircleOfCultistService( } /// - /// Get the circle craft time as seconds, value is based on reward item value - /// And get the bonus status to determine what tier of reward is given + /// Get the circle craft time as seconds, value is based on reward item value + /// And get the bonus status to determine what tier of reward is given /// /// Value of rewards in roubles /// Circle config values @@ -183,7 +190,7 @@ public class CircleOfCultistService( { Time = -1, RewardType = CircleRewardType.RANDOM, - RewardAmountRoubles = (int)rewardAmountRoubles, + RewardAmountRoubles = (int) rewardAmountRoubles, RewardDetails = null }; @@ -229,7 +236,7 @@ public class CircleOfCultistService( ) { var matchingThreshold = thresholds.FirstOrDefault( - (craftThreshold) => craftThreshold.Min <= rewardAmountRoubles && craftThreshold.Max >= rewardAmountRoubles + craftThreshold => craftThreshold.Min <= rewardAmountRoubles && craftThreshold.Max >= rewardAmountRoubles ); // No matching threshold, make one @@ -244,14 +251,19 @@ public class CircleOfCultistService( ? firstThreshold.CraftTimeSeconds : _timeUtil.GetHoursAsSeconds(12); - return new CraftTimeThreshold { Min = firstThreshold?.Min ?? 1, Max = firstThreshold?.Max ?? 34999, CraftTimeSeconds = craftTime }; + return new CraftTimeThreshold + { + Min = firstThreshold?.Min ?? 1, + Max = firstThreshold?.Max ?? 34999, + CraftTimeSeconds = craftTime + }; } return matchingThreshold; } /// - /// Get the items player sacrificed in circle + /// Get the items player sacrificed in circle /// /// Player profile /// Array of items from player inventory @@ -259,7 +271,7 @@ public class CircleOfCultistService( { // Get root items that are in the cultist sacrifice window var inventoryRootItemsInCultistGrid = pmcData.Inventory.Items.Where( - (item) => item.SlotId == CircleOfCultistSlotId + item => item.SlotId == CircleOfCultistSlotId ); // Get rootitem + its children @@ -277,7 +289,7 @@ public class CircleOfCultistService( } /// - /// Given a pool of items + rouble budget, pick items until the budget is reached + /// Given a pool of items + rouble budget, pick items until the budget is reached /// /// Items that can be picked /// Rouble budget to reach @@ -336,7 +348,7 @@ public class CircleOfCultistService( _itemHelper.SetFoundInRaid(presetAndMods); rewardItemCount++; - totalRewardCost += (int)_itemHelper.GetItemPrice(randomItemTplFromPool); + totalRewardCost += (int) _itemHelper.GetItemPrice(randomItemTplFromPool); rewards.Add(presetAndMods); continue; @@ -345,7 +357,7 @@ public class CircleOfCultistService( // Some items can have variable stack size, e.g. ammo / currency var stackSize = GetRewardStackSize( randomItemTplFromPool, - (int)(rewardBudget / (rewardItemCount == 0 ? 1 : rewardItemCount)) // Remaining rouble budget + (int) (rewardBudget / (rewardItemCount == 0 ? 1 : rewardItemCount)) // Remaining rouble budget ); // Not a weapon/armor, standard single item @@ -377,7 +389,7 @@ public class CircleOfCultistService( rewardItemCount++; var singleItemPrice = _itemHelper.GetItemPrice(randomItemTplFromPool); var itemPrice = singleItemPrice * stackSize; - totalRewardCost += (int)itemPrice; + totalRewardCost += (int) itemPrice; rewards.Add(rewardItem); } @@ -386,7 +398,7 @@ public class CircleOfCultistService( } /// - /// Get direct rewards + /// Get direct rewards /// /// sessionId /// Items sacrificed @@ -403,7 +415,9 @@ public class CircleOfCultistService( // Handle special case of tagilla helmets - only one reward is allowed if (directReward.Reward.Contains(ItemTpl.FACECOVER_TAGILLAS_WELDING_MASK_GORILLA)) + { directReward.Reward = [_randomUtil.GetArrayValue(directReward.Reward)]; + } // Loop because these can include multiple rewards foreach (var rewardTpl in directReward.Reward) @@ -464,13 +478,16 @@ public class CircleOfCultistService( } // Direct reward is not repeatable, flag collected in profile - if (!directReward.Repeatable) FlagDirectRewardAsAcceptedInProfile(sessionId, directReward); + if (!directReward.Repeatable) + { + FlagDirectRewardAsAcceptedInProfile(sessionId, directReward); + } return rewards; } /// - /// Check for direct rewards from what player sacrificed + /// Check for direct rewards from what player sacrificed /// /// sessionId /// Items sacrificed @@ -482,7 +499,7 @@ public class CircleOfCultistService( ) { // Get sacrificed tpls - var sacrificedItemTpls = sacrificedItems.Select((item) => item.Template).ToList(); + var sacrificedItemTpls = sacrificedItems.Select(item => item.Template).ToList(); sacrificedItemTpls.Sort(); // Create md5 key of the items player sacrificed so we can compare against the direct reward cache var sacrificedItemsKey = _hashUtil.GenerateMd5ForData(string.Concat(sacrificedItemTpls, ",")); @@ -490,19 +507,23 @@ public class CircleOfCultistService( var matchingDirectReward = directRewardsCache.GetValueOrDefault(sacrificedItemsKey); if (matchingDirectReward is null) // No direct reward + { return null; + } var fullProfile = _profileHelper.GetFullProfile(sessionId); var directRewardHash = GetDirectRewardHashKey(matchingDirectReward); if (fullProfile.SptData.CultistRewards?.ContainsKey(directRewardHash) ?? false) // Player has already received this direct reward + { return null; + } return matchingDirectReward; } /// - /// Create an md5 key of the sacrificed + reward items + /// Create an md5 key of the sacrificed + reward items /// /// Direct reward to create key for /// Key @@ -520,7 +541,7 @@ public class CircleOfCultistService( } /// - /// Explicit rewards have their own stack sizes as they don't use a reward rouble pool + /// Explicit rewards have their own stack sizes as they don't use a reward rouble pool /// /// Item being rewarded to get stack size of /// stack size of item @@ -536,13 +557,16 @@ public class CircleOfCultistService( // Look for parent in dict var settings = _hideoutConfig.CultistCircle.DirectRewardStackSize.GetValueOrDefault(itemDetails.Value.Parent); - if (settings is null) return 1; + if (settings is null) + { + return 1; + } - return _randomUtil.GetInt((int)settings.Min, (int)settings.Max); + return _randomUtil.GetInt((int) settings.Min, (int) settings.Max); } /// - /// Add a record to the player's profile to signal they have accepted a non-repeatable direct reward + /// Add a record to the player's profile to signal they have accepted a non-repeatable direct reward /// /// Session id /// Reward sent to player @@ -560,8 +584,8 @@ public class CircleOfCultistService( } /// - /// Get the size of a reward item's stack - /// 1 for everything except ammo, ammo can be between min stack and max stack + /// Get the size of a reward item's stack + /// 1 for everything except ammo, ammo can be between min stack and max stack /// /// Item chosen /// Rouble amount of pool remaining to fill @@ -591,14 +615,14 @@ public class CircleOfCultistService( // How many items can we fit into chosen pool var itemCountToReward = Math.Round(roubleAmountToFill / currencyPriceAsRouble ?? 0); - return (int)itemCountToReward; + return (int) itemCountToReward; } return 1; } /// - /// Get a pool of tpl IDs of items the player needs to complete hideout crafts/upgrade areas + /// Get a pool of tpl IDs of items the player needs to complete hideout crafts/upgrade areas /// /// Session id /// Profile of player who will be getting the rewards @@ -618,8 +642,8 @@ public class CircleOfCultistService( // Get all items that match the blacklisted types and fold into item blacklist below var itemTypeBlacklist = _itemFilterService.GetItemRewardBaseTypeBlacklist(); var itemsMatchingTypeBlacklist = itemsDb - .Where((templateItem) => _itemHelper.IsOfBaseclasses(templateItem.Key, itemTypeBlacklist)) - .Select((templateItem) => templateItem.Key); + .Where(templateItem => _itemHelper.IsOfBaseclasses(templateItem.Key, itemTypeBlacklist)) + .Select(templateItem => templateItem.Key); // Create set of unique values to ignore var itemRewardBlacklist = new HashSet(); @@ -632,42 +656,49 @@ public class CircleOfCultistService( switch (craftingInfo.RewardType) { case CircleRewardType.RANDOM: - { - // Does reward pass the high value threshold - var isHighValueReward = craftingInfo.RewardAmountRoubles >= cultistCircleConfig.HighValueThresholdRub; - GenerateRandomisedItemsAndAddToRewardPool(rewardPool, itemRewardBlacklist, isHighValueReward); + { + // Does reward pass the high value threshold + var isHighValueReward = craftingInfo.RewardAmountRoubles >= cultistCircleConfig.HighValueThresholdRub; + GenerateRandomisedItemsAndAddToRewardPool(rewardPool, itemRewardBlacklist, isHighValueReward); - break; - } + break; + } case CircleRewardType.HIDEOUT_TASK: - { - // Hideout/Task loot - AddHideoutUpgradeRequirementsToRewardPool(hideoutDbData, pmcData, itemRewardBlacklist, rewardPool); - AddTaskItemRequirementsToRewardPool(pmcData, itemRewardBlacklist, rewardPool); + { + // Hideout/Task loot + AddHideoutUpgradeRequirementsToRewardPool(hideoutDbData, pmcData, itemRewardBlacklist, rewardPool); + AddTaskItemRequirementsToRewardPool(pmcData, itemRewardBlacklist, rewardPool); - // If we have no tasks or hideout stuff left or need more loot to fill it out, default to high value - if (rewardPool.Count < cultistCircleConfig.MaxRewardItemCount + 2) - GenerateRandomisedItemsAndAddToRewardPool(rewardPool, itemRewardBlacklist, true); + // If we have no tasks or hideout stuff left or need more loot to fill it out, default to high value + if (rewardPool.Count < cultistCircleConfig.MaxRewardItemCount + 2) + { + GenerateRandomisedItemsAndAddToRewardPool(rewardPool, itemRewardBlacklist, true); + } - break; - } + break; + } } // Add custom rewards from config if (cultistCircleConfig.AdditionalRewardItemPool.Count > 0) + { foreach (var additionalReward in cultistCircleConfig.AdditionalRewardItemPool) { - if (itemRewardBlacklist.Contains(additionalReward)) continue; + if (itemRewardBlacklist.Contains(additionalReward)) + { + continue; + } // Add tpl to reward pool rewardPool.Add(additionalReward); } + } return rewardPool.ToList(); } /// - /// Check player's profile for quests with hand-in requirements and add those required items to the pool + /// Check player's profile for quests with hand-in requirements and add those required items to the pool /// /// Player profile /// Items not to add to pool @@ -677,19 +708,25 @@ public class CircleOfCultistService( HashSet itemRewardBlacklist, HashSet rewardPool) { - var activeTasks = pmcData.Quests.Where((quest) => quest.Status == QuestStatusEnum.Started); + var activeTasks = pmcData.Quests.Where(quest => quest.Status == QuestStatusEnum.Started); foreach (var task in activeTasks) { var questData = _questHelper.GetQuestFromDb(task.QId, pmcData); var handoverConditions = questData.Conditions.AvailableForFinish.Where( - (condition) => condition.ConditionType == "HandoverItem" + condition => condition.ConditionType == "HandoverItem" ); foreach (var condition in handoverConditions) foreach (var neededItem in condition.Target.List) { - if (itemRewardBlacklist.Contains(neededItem) || !_itemHelper.IsValidItem(neededItem)) continue; + if (itemRewardBlacklist.Contains(neededItem) || !_itemHelper.IsValidItem(neededItem)) + { + continue; + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Added Task Loot: {_itemHelper.GetItemName(neededItem)}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Added Task Loot: {_itemHelper.GetItemName(neededItem)}"); + } rewardPool.Add(neededItem); } @@ -697,14 +734,14 @@ public class CircleOfCultistService( } /// - /// Adds items the player needs to complete hideout crafts/upgrades to the reward pool + /// Adds items the player needs to complete hideout crafts/upgrades to the reward pool /// /// Hideout area data /// Player profile /// Items not to add to pool /// Pool to add items to protected void AddHideoutUpgradeRequirementsToRewardPool( - Core.Models.Spt.Hideout.Hideout hideoutDbData, + Hideout hideoutDbData, PmcData pmcData, HashSet itemRewardBlacklist, HashSet rewardPool) @@ -716,7 +753,7 @@ public class CircleOfCultistService( var areaType = profileArea.Type; // Get next stage of area - var dbArea = dbAreas.FirstOrDefault((area) => area.Type == areaType); + var dbArea = dbAreas.FirstOrDefault(area => area.Type == areaType); var nextStageDbData = dbArea?.Stages[(currentStageLevel + 1).ToString()]; if (nextStageDbData is not null) { @@ -729,9 +766,14 @@ public class CircleOfCultistService( !_itemHelper.IsValidItem(rewardToAdd.TemplateId) ) // Dont reward items sacrificed + { continue; + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Added Hideout Loot: {_itemHelper.GetItemName(rewardToAdd.TemplateId)}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Added Hideout Loot: {_itemHelper.GetItemName(rewardToAdd.TemplateId)}"); + } rewardPool.Add(rewardToAdd.TemplateId); } @@ -740,18 +782,20 @@ public class CircleOfCultistService( } /// - /// Get all active hideout areas + /// Get all active hideout areas /// /// Hideout areas to iterate over /// Active area array protected List GetPlayerAccessibleHideoutAreas(List areas) { return areas.Where( - (area) => + area => { if (area.Type == HideoutAreas.CHRISTMAS_TREE && !_seasonalEventService.ChristmasEventEnabled()) // Christmas tree area and not Christmas, skip + { return false; + } return true; } @@ -760,7 +804,7 @@ public class CircleOfCultistService( } /// - /// Get array of random reward items + /// Get array of random reward items /// /// Reward pool to add to /// Item tpls to ignore @@ -782,16 +826,25 @@ public class CircleOfCultistService( { attempts++; var randomItem = _randomUtil.GetArrayValue(allItems); - if (itemRewardBlacklist.Contains(randomItem.Id) || !_itemHelper.IsValidItem(randomItem.Id)) continue; + if (itemRewardBlacklist.Contains(randomItem.Id) || !_itemHelper.IsValidItem(randomItem.Id)) + { + continue; + } // Valuable check if (itemsShouldBeHighValue) { var itemValue = _itemHelper.GetItemMaxPrice(randomItem.Id); - if (itemValue < _hideoutConfig.CultistCircle.HighValueThresholdRub) continue; + if (itemValue < _hideoutConfig.CultistCircle.HighValueThresholdRub) + { + continue; + } } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Added: {_itemHelper.GetItemName(randomItem.Id)}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Added: {_itemHelper.GetItemName(randomItem.Id)}"); + } rewardPool.Add(randomItem.Id); currentItemCount++; @@ -801,27 +854,27 @@ public class CircleOfCultistService( } /// - /// Iterate over passed in hideout requirements and return the Item + /// Iterate over passed in hideout requirements and return the Item /// /// Requirements to iterate over /// Array of item requirements protected List GetItemRequirements(List requirements) { - return requirements.Where((requirement) => requirement.Type == "Item").ToList(); + return requirements.Where(requirement => requirement.Type == "Item").ToList(); } /// - /// Iterate over passed in hideout requirements and return the Item + /// Iterate over passed in hideout requirements and return the Item /// /// Requirements to iterate over /// Array of item requirements protected List GetItemRequirements(List requirements) { - return requirements.Where((requirement) => requirement.Type == "Item").ToList(); + return requirements.Where(requirement => requirement.Type == "Item").ToList(); } /// - /// Create a map of the possible direct rewards, keyed by the items needed to be sacrificed + /// Create a map of the possible direct rewards, keyed by the items needed to be sacrificed /// /// Direct rewards array from hideout config /// Dictionary @@ -841,7 +894,7 @@ public class CircleOfCultistService( } /// - /// Attempt to add all rewards to cultist circle, if they don't fit remove one and try again until they fit + /// Attempt to add all rewards to cultist circle, if they don't fit remove one and try again until they fit /// /// Session id /// Player profile @@ -867,7 +920,10 @@ public class CircleOfCultistService( ); // Doesn't fit, remove one item - if (!canAddToContainer) rewards.PopLast(); + if (!canAddToContainer) + { + rewards.PopLast(); + } } foreach (var itemToAdd in rewards) diff --git a/Libraries/Core/Services/CreateProfileService.cs b/Libraries/Core/Services/CreateProfileService.cs index 9f3fce9c..b67b332f 100644 --- a/Libraries/Core/Services/CreateProfileService.cs +++ b/Libraries/Core/Services/CreateProfileService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Generators; using Core.Helpers; using Core.Models.Eft.Common; @@ -11,6 +10,7 @@ using Core.Routers; using Core.Servers; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; using Vitality = Core.Models.Eft.Profile.Vitality; @@ -54,7 +54,7 @@ public class CreateProfileService( pmcData.SessionId = sessionId; pmcData.Info.Nickname = request.Nickname; pmcData.Info.LowerNickname = request.Nickname.ToLower(); - pmcData.Info.RegistrationDate = (int)_timeUtil.GetTimeStamp(); + pmcData.Info.RegistrationDate = (int) _timeUtil.GetTimeStamp(); pmcData.Info.Voice = _databaseService.GetCustomization()[request.VoiceId].Name; pmcData.Stats = _profileHelper.GetDefaultCounters(); pmcData.Info.NeedWipeOptions = []; @@ -69,7 +69,13 @@ public class CreateProfileService( UpdateInventoryEquipmentId(pmcData); - if (pmcData.UnlockedInfo == null) pmcData.UnlockedInfo = new UnlockedInfo { UnlockedProductionRecipe = [] }; + if (pmcData.UnlockedInfo == null) + { + pmcData.UnlockedInfo = new UnlockedInfo + { + UnlockedProductionRecipe = [] + }; + } // Add required items to pmc stash AddMissingInternalContainersToProfile(pmcData); @@ -81,7 +87,11 @@ public class CreateProfileService( var profileDetails = new SptProfile { ProfileInfo = account, - CharacterData = new Characters { PmcData = pmcData, ScavData = new PmcData() }, + CharacterData = new Characters + { + PmcData = pmcData, + ScavData = new PmcData() + }, Suits = profileTemplate.Suits, UserBuildData = profileTemplate.UserBuilds, DialogueRecords = profileTemplate.Dialogues, @@ -101,7 +111,9 @@ public class CreateProfileService( _saveServer.AddProfile(profileDetails); if (profileTemplate.Trader.SetQuestsAvailableForStart ?? false) + { _questHelper.AddAllQuestsToProfile(profileDetails.CharacterData.PmcData, [QuestStatusEnum.AvailableForStart]); + } // Profile is flagged as wanting quests set to ready to hand in and collect rewards if (profileTemplate.Trader.SetQuestsAvailableForFinish ?? false) @@ -138,23 +150,27 @@ public class CreateProfileService( } /** - * Delete a profile - * @param sessionID Id of profile to delete - */ + * Delete a profile + * @param sessionID Id of profile to delete + */ protected void DeleteProfileBySessionId(string sessionID) { if (_saveServer.GetProfiles().ContainsKey(sessionID)) + { _saveServer.DeleteProfileById(sessionID); + } else + { _logger.Warning( _localisationService.GetText("profile-unable_to_find_profile_by_id_cannot_delete", sessionID) ); + } } /** - * make profiles pmcData.Inventory.equipment unique - * @param pmcData Profile to update - */ + * make profiles pmcData.Inventory.equipment unique + * @param pmcData Profile to update + */ protected void UpdateInventoryEquipmentId(PmcData pmcData) { var oldEquipmentId = pmcData.Inventory.Equipment; @@ -168,17 +184,23 @@ public class CreateProfileService( continue; } - if (item.Id == oldEquipmentId) item.Id = pmcData.Inventory.Equipment; + if (item.Id == oldEquipmentId) + { + item.Id = pmcData.Inventory.Equipment; + } } } /** - * For each trader reset their state to what a level 1 player would see - * @param sessionId Session id of profile to reset - */ + * For each trader reset their state to what a level 1 player would see + * @param sessionId Session id of profile to reset + */ protected void ResetAllTradersInProfile(string sessionId) { - foreach (var traderId in _databaseService.GetTraders().Keys) _traderHelper.ResetTrader(sessionId, traderId); + foreach (var traderId in _databaseService.GetTraders().Keys) + { + _traderHelper.ResetTrader(sessionId, traderId); + } } /** @@ -188,7 +210,8 @@ public class CreateProfileService( */ protected void AddMissingInternalContainersToProfile(PmcData pmcData) { - if (!pmcData.Inventory.Items.Any((item) => item.Id == pmcData.Inventory.HideoutCustomizationStashId)) + if (!pmcData.Inventory.Items.Any(item => item.Id == pmcData.Inventory.HideoutCustomizationStashId)) + { pmcData.Inventory.Items.Add( new Item { @@ -196,8 +219,10 @@ public class CreateProfileService( Template = ItemTpl.HIDEOUTAREACONTAINER_CUSTOMIZATION } ); + } - if (!pmcData.Inventory.Items.Any((item) => item.Id == pmcData.Inventory.SortingTable)) + if (!pmcData.Inventory.Items.Any(item => item.Id == pmcData.Inventory.SortingTable)) + { pmcData.Inventory.Items.Add( new Item { @@ -205,8 +230,10 @@ public class CreateProfileService( Template = ItemTpl.SORTINGTABLE_SORTING_TABLE } ); + } - if (!pmcData.Inventory.Items.Any((item) => item.Id == pmcData.Inventory.QuestStashItems)) + if (!pmcData.Inventory.Items.Any(item => item.Id == pmcData.Inventory.QuestStashItems)) + { pmcData.Inventory.Items.Add( new Item { @@ -214,8 +241,10 @@ public class CreateProfileService( Template = ItemTpl.STASH_QUESTOFFLINE } ); + } - if (!pmcData.Inventory.Items.Any((item) => item.Id == pmcData.Inventory.QuestRaidItems)) + if (!pmcData.Inventory.Items.Any(item => item.Id == pmcData.Inventory.QuestRaidItems)) + { pmcData.Inventory.Items.Add( new Item { @@ -223,10 +252,11 @@ public class CreateProfileService( Template = ItemTpl.STASH_QUESTRAID } ); + } } /// - /// Add customisations to game profiles based on game edition + /// Add customisations to game profiles based on game edition /// /// Profile to add customisations to public void AddCustomisationUnlocksToProfile(SptProfile fullProfile) @@ -327,6 +357,7 @@ public class CreateProfileService( if (pretigeLevel is not null) { if (pretigeLevel >= 1) + { fullProfile.CustomisationUnlocks.Add( new CustomisationStorage { @@ -335,8 +366,10 @@ public class CreateProfileService( Type = CustomisationType.DOG_TAG } ); + } if (pretigeLevel >= 2) + { fullProfile.CustomisationUnlocks.Add( new CustomisationStorage { @@ -345,11 +378,13 @@ public class CreateProfileService( Type = CustomisationType.DOG_TAG } ); + } } // Dev profile additions if (fullProfile.ProfileInfo.Edition.ToLower().Contains("developer")) // CyberTark background + { fullProfile.CustomisationUnlocks.Add( new CustomisationStorage { @@ -358,6 +393,7 @@ public class CreateProfileService( Type = CustomisationType.ENVIRONMENT } ); + } } /** @@ -366,7 +402,10 @@ public class CreateProfileService( private string? GetGameEdition(SptProfile profile) { var edition = profile.CharacterData?.PmcData?.Info?.GameVersion; - if (edition is not null) return edition; + if (edition is not null) + { + return edition; + } // Edge case - profile not created yet, fall back to what launcher has set var launcherEdition = profile.ProfileInfo.Edition; diff --git a/Libraries/Core/Services/CustomLocationWaveService.cs b/Libraries/Core/Services/CustomLocationWaveService.cs index 56048aed..c14ad9fc 100644 --- a/Libraries/Core/Services/CustomLocationWaveService.cs +++ b/Libraries/Core/Services/CustomLocationWaveService.cs @@ -75,13 +75,17 @@ public class CustomLocationWaveService( { if (locationBase.BossLocationSpawn.Any(x => x.SptId == bossWave.SptId)) // Already exists, skip + { continue; + } locationBase.BossLocationSpawn.Add(bossWave); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( $"Added custom boss wave to {mapKvP.Key} of type {bossWave.BossName}, time: {bossWave.Time}, chance: {bossWave.BossChance}, zone: {(string.IsNullOrEmpty(bossWave.BossZone) ? "Global" : bossWave.BossZone)}" ); + } } } @@ -99,7 +103,9 @@ public class CustomLocationWaveService( { if (locationBase.Waves.Any(x => x.SptId == normalWave.SptId)) // Already exists, skip + { continue; + } normalWave.Number = locationBase.Waves.Count; locationBase.Waves.Add(normalWave); diff --git a/Libraries/Core/Services/DatabaseService.cs b/Libraries/Core/Services/DatabaseService.cs index 3c31ed89..686b44ee 100644 --- a/Libraries/Core/Services/DatabaseService.cs +++ b/Libraries/Core/Services/DatabaseService.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Bots; @@ -8,6 +7,7 @@ using Core.Models.Spt.Templates; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; using Hideout = Core.Models.Spt.Hideout.Hideout; using Locations = Core.Models.Spt.Server.Locations; @@ -39,7 +39,9 @@ public class DatabaseService( public Bots GetBots() { if (_databaseServer.GetTables().Bots == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/bots")); + } return _databaseServer.GetTables().Bots!; } @@ -50,12 +52,14 @@ public class DatabaseService( public Globals GetGlobals() { if (_databaseServer.GetTables().Globals == null) + { throw new Exception( _localisationService.GetText( "database-data_at_path_missing", "assets/database/globals.json" ) ); + } return _databaseServer.GetTables().Globals!; } @@ -66,9 +70,11 @@ public class DatabaseService( public Hideout GetHideout() { if (_databaseServer.GetTables().Hideout == null) + { throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/hideout") ); + } return _databaseServer.GetTables().Hideout!; } @@ -79,9 +85,11 @@ public class DatabaseService( public LocaleBase GetLocales() { if (_databaseServer.GetTables().Locales == null) + { throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/locales") ); + } return _databaseServer.GetTables().Locales!; } @@ -92,9 +100,11 @@ public class DatabaseService( public Locations GetLocations() { if (_databaseServer.GetTables().Locations == null) + { throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/locales") ); + } return _databaseServer.GetTables().Locations!; } @@ -108,7 +118,10 @@ public class DatabaseService( { var locations = GetLocations(); var desiredLocation = locations.GetByJsonProp(locationId.ToLower()); - if (desiredLocation == null) throw new Exception(_localisationService.GetText("database-no_location_found_with_id", locationId)); + if (desiredLocation == null) + { + throw new Exception(_localisationService.GetText("database-no_location_found_with_id", locationId)); + } return desiredLocation; } @@ -119,9 +132,11 @@ public class DatabaseService( public Match GetMatch() { if (_databaseServer.GetTables().Match == null) + { throw new Exception( _localisationService.GetText("database-data_at_path_missing", "assets/database/locales") ); + } return _databaseServer.GetTables().Match!; } @@ -132,12 +147,14 @@ public class DatabaseService( public ServerBase GetServer() { if (_databaseServer.GetTables().Server == null) + { throw new Exception( _localisationService.GetText( "database-data_at_path_missing", "assets/database/server.json" ) ); + } return _databaseServer.GetTables().Server!; } @@ -148,12 +165,14 @@ public class DatabaseService( public SettingsBase GetSettings() { if (_databaseServer.GetTables().Settings == null) + { throw new Exception( _localisationService.GetText( "database-data_at_path_missing", "assets/database/settings.json" ) ); + } return _databaseServer.GetTables().Settings!; } @@ -164,12 +183,14 @@ public class DatabaseService( public Templates GetTemplates() { if (_databaseServer.GetTables().Templates == null) + { throw new Exception( _localisationService.GetText( "database-data_at_path_missing", "assets/database/templates" ) ); + } return _databaseServer.GetTables().Templates!; } @@ -180,12 +201,14 @@ public class DatabaseService( public List GetAchievements() { if (_databaseServer.GetTables().Templates?.Achievements == null) + { throw new Exception( _localisationService.GetText( "database-data_at_path_missing", "assets/database/templates/achievements.json" ) ); + } return _databaseServer.GetTables().Templates?.Achievements!; } @@ -196,12 +219,14 @@ public class DatabaseService( public Dictionary GetCustomization() { if (_databaseServer.GetTables().Templates?.Customization == null) + { throw new Exception( _localisationService.GetText( "database-data_at_path_missing", "assets/database/templates/customization.json" ) ); + } return _databaseServer.GetTables().Templates?.Customization!; } @@ -212,7 +237,9 @@ public class DatabaseService( public HandbookBase GetHandbook() { if (_databaseServer.GetTables().Templates?.Handbook == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/handbook.json")); + } return _databaseServer.GetTables().Templates?.Handbook!; } @@ -223,7 +250,9 @@ public class DatabaseService( public Dictionary GetItems() { if (_databaseServer.GetTables().Templates?.Items == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/items.json")); + } return _databaseServer.GetTables().Templates?.Items!; } @@ -234,7 +263,9 @@ public class DatabaseService( public Dictionary GetPrices() { if (_databaseServer.GetTables().Templates?.Prices == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/prices.json")); + } return _databaseServer.GetTables().Templates?.Prices!; } @@ -245,7 +276,9 @@ public class DatabaseService( public ProfileTemplates GetProfiles() { if (_databaseServer.GetTables().Templates?.Profiles == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/profiles.json")); + } return _databaseServer.GetTables().Templates?.Profiles!; } @@ -256,7 +289,9 @@ public class DatabaseService( public Dictionary GetQuests() { if (_databaseServer.GetTables().Templates?.Quests == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/templates/quests.json")); + } return _databaseServer.GetTables().Templates?.Quests!; } @@ -267,7 +302,9 @@ public class DatabaseService( public Dictionary GetTraders() { if (_databaseServer.GetTables().Traders == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/traders")); + } return _databaseServer.GetTables().Traders!; } @@ -281,7 +318,9 @@ public class DatabaseService( { var traders = GetTraders(); if (!traders.TryGetValue(traderId, out var desiredTrader)) + { throw new Exception(_localisationService.GetText("database-no_trader_found_with_id", traderId)); + } return desiredTrader; } @@ -292,7 +331,9 @@ public class DatabaseService( public LocationServices GetLocationServices() { if (_databaseServer.GetTables().Templates?.LocationServices == null) + { throw new Exception(_localisationService.GetText("database-data_at_path_missing", "assets/database/locationServices.json")); + } return _databaseServer.GetTables().Templates?.LocationServices!; } @@ -310,10 +351,16 @@ public class DatabaseService( ValidateTable(GetItems(), "item") && ValidateTable(GetCustomization(), "customization"); - if (!isDataValid) _logger.Error(_localisationService.GetText("database-invalid_data")); + if (!isDataValid) + { + _logger.Error(_localisationService.GetText("database-invalid_data")); + } start.Stop(); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"ID validation took: {start.ElapsedMilliseconds}ms"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"ID validation took: {start.ElapsedMilliseconds}ms"); + } } /** @@ -325,11 +372,13 @@ public class DatabaseService( private bool ValidateTable(Dictionary table, string tableType) { foreach (var keyValuePair in table) + { if (!_hashUtil.IsValidMongoId(keyValuePair.Key)) { _logger.Error($"Invalid {tableType} ID: '{keyValuePair.Key}'"); return false; } + } return true; } diff --git a/Libraries/Core/Services/FenceService.cs b/Libraries/Core/Services/FenceService.cs index eb0b2f62..b2d65df0 100644 --- a/Libraries/Core/Services/FenceService.cs +++ b/Libraries/Core/Services/FenceService.cs @@ -28,20 +28,21 @@ public class FenceService( ICloner _cloner ) { - protected TraderConfig traderConfig = configServer.GetConfig(); - - /** Time when some items in assort will be replaced */ - protected long nextPartialRefreshTimestamp; - - /** Main assorts you see at all rep levels */ - protected TraderAssort? fenceAssort = null; - - /** Assorts shown on a separate tab when you max out fence rep */ - protected TraderAssort? fenceDiscountAssort = null; - - /** 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 + */ + protected TraderAssort? fenceAssort; + + /** + * Assorts shown on a separate tab when you max out fence rep + */ + protected TraderAssort? fenceDiscountAssort; + protected HashSet fenceItemUpdCompareProperties = [ "Buff", @@ -55,6 +56,13 @@ public class FenceService( "RepairKit" ]; + /** + * Time when some items in assort will be replaced + */ + protected long nextPartialRefreshTimestamp; + + protected TraderConfig traderConfig = configServer.GetConfig(); + /** * Replace main fence assort with new assort @@ -111,7 +119,9 @@ public class FenceService( { if (traderConfig.Fence.RegenerateAssortsOnRefresh) // Using base assorts made earlier, do some alterations and store in fenceAssort + { GenerateFenceAssorts(); + } // Clone assorts so we can adjust prices before sending to client var assort = _cloner.Clone(fenceAssort); @@ -151,15 +161,31 @@ public class FenceService( // Fix IDs clonedItems = itemHelper.ReparentItemAndChildren(root, clonedItems); root.ParentId = "hideout"; - if (root.Upd?.SpawnedInSession != null) root.Upd.SpawnedInSession = false; + if (root.Upd?.SpawnedInSession != null) + { + root.Upd.SpawnedInSession = false; + } // Clean up the items // We may need to find an alternative to nodes: delete root.location; root.Location = null; var createAssort = new CreateFenceAssortsResult - { SptItems = [], BarterScheme = new Dictionary>>(), LoyalLevelItems = new Dictionary() }; - createAssort.BarterScheme[root.Id] = [[new BarterScheme { Count = cost, Template = Money.ROUBLES }]]; + { + SptItems = [], + BarterScheme = new Dictionary>>(), + LoyalLevelItems = new Dictionary() + }; + createAssort.BarterScheme[root.Id] = + [ + [ + new BarterScheme + { + Count = cost, + Template = Money.ROUBLES + } + ] + ]; createAssort.SptItems.Add(clonedItems); createAssort.LoyalLevelItems[root.Id] = 1; @@ -189,8 +215,12 @@ public class FenceService( { double? total = 0D; foreach (var item in items) + { if (itemHelper.IsOfBaseclass(item.Template, BaseClasses.AMMO)) + { total += handbookHelper.GetTemplatePrice(item.Template) * (item.Upd?.StackObjectsCount ?? 1); + } + } return total; } @@ -208,7 +238,10 @@ public class FenceService( ) { // Only get root items - foreach (var item in assort.Items.Where(x => x.SlotId is "hideout")) AdjustItemPriceByModifier(item, assort, itemMultiplier, presetMultiplier); + foreach (var item in assort.Items.Where(x => x.SlotId is "hideout")) + { + AdjustItemPriceByModifier(item, assort, itemMultiplier, presetMultiplier); + } } /** @@ -219,11 +252,20 @@ public class FenceService( */ protected TraderAssort MergeAssorts(TraderAssort firstAssort, TraderAssort secondAssort) { - foreach (var itemId in secondAssort.BarterScheme.Keys) firstAssort.BarterScheme[itemId] = secondAssort.BarterScheme[itemId]; + foreach (var itemId in secondAssort.BarterScheme.Keys) + { + firstAssort.BarterScheme[itemId] = secondAssort.BarterScheme[itemId]; + } - foreach (var item in secondAssort.Items) firstAssort.Items.Add(item); + foreach (var item in secondAssort.Items) + { + firstAssort.Items.Add(item); + } - foreach (var itemId in secondAssort.LoyalLevelItems.Keys) firstAssort.LoyalLevelItems[itemId] = secondAssort.LoyalLevelItems[itemId]; + foreach (var itemId in secondAssort.LoyalLevelItems.Keys) + { + firstAssort.LoyalLevelItems[itemId] = secondAssort.LoyalLevelItems[itemId]; + } return firstAssort; } @@ -252,16 +294,23 @@ public class FenceService( // Is preset if (item.Upd?.SptPresetId != null) { - if (assort.BarterScheme.TryGetValue(item.Id, out var barterSchemeForPreset)) barterSchemeForPreset[0][0].Count *= presetModifier; + if (assort.BarterScheme.TryGetValue(item.Id, out var barterSchemeForPreset)) + { + barterSchemeForPreset[0][0].Count *= presetModifier; + } return; } // Normal item if (assort.BarterScheme.TryGetValue(item.Id, out var barterScheme)) + { barterScheme[0][0].Count *= modifier; + } else + { logger.Warning($"adjustItemPriceByModifier() - no action taken for item: {item.Template}"); + } } /** @@ -315,18 +364,28 @@ public class FenceService( UpdateFenceAssorts(newDiscountItems, fenceDiscountAssort); // Add new barter items to fence barter scheme - foreach (var barterItemKey in newItems.BarterScheme.Keys) fenceAssort.BarterScheme[barterItemKey] = newItems.BarterScheme[barterItemKey]; + foreach (var barterItemKey in newItems.BarterScheme.Keys) + { + fenceAssort.BarterScheme[barterItemKey] = newItems.BarterScheme[barterItemKey]; + } // Add loyalty items to fence assorts loyalty object - foreach (var loyaltyItemKey in newItems.LoyalLevelItems.Keys) fenceAssort.LoyalLevelItems[loyaltyItemKey] = newItems.LoyalLevelItems[loyaltyItemKey]; + foreach (var loyaltyItemKey in newItems.LoyalLevelItems.Keys) + { + fenceAssort.LoyalLevelItems[loyaltyItemKey] = newItems.LoyalLevelItems[loyaltyItemKey]; + } // Add new barter items to fence assorts discounted barter scheme foreach (var barterItemKey in newDiscountItems.BarterScheme.Keys) + { fenceDiscountAssort.BarterScheme[barterItemKey] = newDiscountItems.BarterScheme[barterItemKey]; + } // Add loyalty items to fence discount assorts loyalty object foreach (var loyaltyItemKey in newDiscountItems.LoyalLevelItems.Keys) + { fenceDiscountAssort.LoyalLevelItems[loyaltyItemKey] = newDiscountItems.LoyalLevelItems[loyaltyItemKey]; + } // Reset the clock IncrementPartialRefreshTime(); @@ -345,10 +404,10 @@ public class FenceService( foreach (var itemWithChildren in newFenceAssorts.SptItems) { // Find the root item - var newRootItem = itemWithChildren.FirstOrDefault((item) => item.SlotId == "hideout"); + var newRootItem = itemWithChildren.FirstOrDefault(item => item.SlotId == "hideout"); if (newRootItem == null) { - var firstItem = itemWithChildren.FirstOrDefault((x) => x != null); + var firstItem = itemWithChildren.FirstOrDefault(x => x != null); logger.Error( $"Unable to process fence assort as root item is missing, {firstItem?.Template}, skipping" ); @@ -357,7 +416,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" + item => item.Template == newRootItem.Template && item.SlotId == "hideout" ); // Check if same type of item exists + its on list of item types to always stack @@ -370,7 +429,10 @@ public class FenceService( if (itemHelper.IsSameItems(itemWithChildren, existingFullItemTree, fenceItemUpdCompareProperties)) { // Guard against a missing stack count - if (existingRootItem.Upd?.StackObjectsCount == null) existingRootItem.Upd.StackObjectsCount = 1; + if (existingRootItem.Upd?.StackObjectsCount == null) + { + existingRootItem.Upd.StackObjectsCount = 1; + } // Merge new items count into existing, dont add new loyalty/barter data as it already exists existingRootItem.Upd.StackObjectsCount += newRootItem?.Upd?.StackObjectsCount ?? 1; @@ -380,7 +442,10 @@ public class FenceService( } // if the Upd doesnt exist just initialize it - if (newRootItem.Upd == null) newRootItem.Upd = new Upd(); + if (newRootItem.Upd == null) + { + newRootItem.Upd = new Upd(); + } // New assort to be added to existing assorts existingFenceAssorts.Items.AddRange(itemWithChildren); @@ -408,8 +473,8 @@ public class FenceService( GenerationAssortValues generationValues ) { - var allRootItems = assortItems.Where((item) => item.SlotId == "hideout"); - var rootPresetItems = allRootItems.Where((item) => item?.Upd?.SptPresetId != null); + var allRootItems = assortItems.Where(item => item.SlotId == "hideout"); + var rootPresetItems = allRootItems.Where(item => item?.Upd?.SptPresetId != null); // Get count of weapons var currentWeaponPresetCount = rootPresetItems.Aggregate( @@ -451,8 +516,11 @@ public class FenceService( { if (assort?.Items?.Count > 0) { - var rootItems = assort.Items.Where((item) => item.SlotId == "hideout").ToList(); - for (var index = 0; index < itemCountToReplace; index++) RemoveRandomItemFromAssorts(assort, rootItems); + var rootItems = assort.Items.Where(item => item.SlotId == "hideout").ToList(); + for (var index = 0; index < itemCountToReplace; index++) + { + RemoveRandomItemFromAssorts(assort, rootItems); + } } } @@ -494,7 +562,9 @@ public class FenceService( var itemWithChildren = itemHelper.FindAndReturnChildrenAsItems(assort.Items, rootItemToAdjust.Id); foreach (var itemToDelete in itemWithChildren) // Delete item from assort items array + { assort.Items.Remove(itemToDelete); + } // Need to remove item from all areas of trader assort // delete assort.barter_scheme[rootItemToAdjust._id]; @@ -510,7 +580,7 @@ public class FenceService( */ protected int GetCountOfItemsToReplace(int totalItemCount) { - return (int)Math.Round(totalItemCount * (traderConfig.Fence.PartialRefreshChangePercent / 100)); + return (int) Math.Round(totalItemCount * (traderConfig.Fence.PartialRefreshChangePercent / 100)); } /** @@ -519,7 +589,10 @@ public class FenceService( */ public int GetOfferCount() { - if ((fenceAssort?.Items?.Count ?? 0) == 0) return 0; + if ((fenceAssort?.Items?.Count ?? 0) == 0) + { + return 0; + } return fenceAssort.Items.Count; } @@ -557,7 +630,10 @@ public class FenceService( protected TraderAssort ConvertIntoFenceAssort(CreateFenceAssortsResult intermediaryAssorts) { var result = CreateFenceAssortSkeleton(); - foreach (var itemWithChilden in intermediaryAssorts.SptItems) result.Items.AddRange(itemWithChilden); + foreach (var itemWithChilden in intermediaryAssorts.SptItems) + { + result.Items.AddRange(itemWithChilden); + } result.BarterScheme = intermediaryAssorts.BarterScheme; result.LoyalLevelItems = intermediaryAssorts.LoyalLevelItems; @@ -573,32 +649,42 @@ public class FenceService( { var result = new FenceAssortGenerationValues { - Normal = new GenerationAssortValues { Item = 0, WeaponPreset = 0, EquipmentPreset = 0 }, - Discount = new GenerationAssortValues { Item = 0, WeaponPreset = 0, EquipmentPreset = 0 } + Normal = new GenerationAssortValues + { + Item = 0, + WeaponPreset = 0, + EquipmentPreset = 0 + }, + Discount = new GenerationAssortValues + { + Item = 0, + WeaponPreset = 0, + EquipmentPreset = 0 + } }; result.Normal.Item = traderConfig.Fence.AssortSize; result.Normal.WeaponPreset = randomUtil.GetInt( - (int)traderConfig.Fence.WeaponPresetMinMax.Min, - (int)traderConfig.Fence.WeaponPresetMinMax.Max + (int) traderConfig.Fence.WeaponPresetMinMax.Min, + (int) traderConfig.Fence.WeaponPresetMinMax.Max ); result.Normal.EquipmentPreset = randomUtil.GetInt( - (int)traderConfig.Fence.EquipmentPresetMinMax.Min, - (int)traderConfig.Fence.EquipmentPresetMinMax.Max + (int) traderConfig.Fence.EquipmentPresetMinMax.Min, + (int) 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 + (int) traderConfig.Fence.DiscountOptions.WeaponPresetMinMax.Min, + (int) traderConfig.Fence.DiscountOptions.WeaponPresetMinMax.Max ); result.Discount.EquipmentPreset = randomUtil.GetInt( - (int)traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Min, - (int)traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Max + (int) traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Min, + (int) traderConfig.Fence.DiscountOptions.EquipmentPresetMinMax.Max ); desiredAssortCounts = result; @@ -627,15 +713,23 @@ public class FenceService( protected CreateFenceAssortsResult CreateAssorts(GenerationAssortValues itemCounts, int loyaltyLevel) { var result = new CreateFenceAssortsResult - { SptItems = [], BarterScheme = new Dictionary>>(), LoyalLevelItems = new Dictionary() }; + { + SptItems = [], + BarterScheme = new Dictionary>>(), + LoyalLevelItems = new Dictionary() + }; var baseFenceAssortClone = _cloner.Clone(databaseService.GetTrader(Traders.FENCE).Assort); var itemTypeLimitCounts = InitItemLimitCounter(traderConfig.Fence.ItemTypeLimits); - if (itemCounts.Item > 0) AddItemAssorts(itemCounts.Item, result, baseFenceAssortClone, itemTypeLimitCounts, loyaltyLevel); + if (itemCounts.Item > 0) + { + AddItemAssorts(itemCounts.Item, result, baseFenceAssortClone, itemTypeLimitCounts, loyaltyLevel); + } if (itemCounts.WeaponPreset > 0 || itemCounts.EquipmentPreset > 0) // Add presets + { AddPresetsToAssort( itemCounts.WeaponPreset, itemCounts.EquipmentPreset, @@ -643,6 +737,7 @@ public class FenceService( baseFenceAssortClone, loyaltyLevel ); + } return result; } @@ -730,7 +825,10 @@ public class FenceService( // Only randomise Upd values for single var isSingleStack = Math.Abs((rootItemBeingAdded.Upd?.StackObjectsCount ?? 0) - 1) < 0.1; - if (isSingleStack) RandomiseItemUpdProperties(itemDbDetails, rootItemBeingAdded); + if (isSingleStack) + { + RandomiseItemUpdProperties(itemDbDetails, rootItemBeingAdded); + } // Skip items already in the assort if it exists in the prevent duplicate list var existingItemThatMatches = GetMatchingItem(rootItemBeingAdded, itemDbDetails, assorts.SptItems); @@ -745,7 +843,10 @@ public class FenceService( } // Add mods to armors so they dont show as red in the trade screen - if (itemHelper.ItemRequiresSoftInserts(rootItemBeingAdded.Template)) RandomiseArmorModDurability(desiredAssortItemAndChildrenClone, itemDbDetails); + if (itemHelper.ItemRequiresSoftInserts(rootItemBeingAdded.Template)) + { + RandomiseArmorModDurability(desiredAssortItemAndChildrenClone, itemDbDetails); + } assorts.SptItems.Add(desiredAssortItemAndChildrenClone); @@ -753,7 +854,10 @@ public class FenceService( _cloner.Clone(baseFenceAssortClone.BarterScheme[chosenBaseAssortRoot.Id]); // Only adjust item price by quality for solo items, never multi-stack - if (isSingleStack) AdjustItemPriceByQuality(assorts.BarterScheme, rootItemBeingAdded, itemDbDetails); + if (isSingleStack) + { + AdjustItemPriceByQuality(assorts.BarterScheme, rootItemBeingAdded, itemDbDetails); + } assorts.LoyalLevelItems[rootItemBeingAdded.Id] = loyaltyLevel; } @@ -776,17 +880,19 @@ public class FenceService( // Get matching root items var matchingItems = itemsWithChildren .Where( - (itemWithChildren) => itemWithChildren.FirstOrDefault( - (item) => item.Template == rootItemBeingAdded.Template && - item.ParentId == "hideout" - ) != - null + itemWithChildren => itemWithChildren.FirstOrDefault( + item => item.Template == rootItemBeingAdded.Template && + item.ParentId == "hideout" + ) != + null ) .SelectMany(i => i) .ToList(); if (matchingItems.Count == 0) // Nothing matches by tpl and is root item, exit early + { return null; + } var isMedical = itemHelper.IsOfBaseclasses( rootItemBeingAdded.Template, @@ -806,7 +912,10 @@ public class FenceService( (itemDbDetails.Properties.Slots?.Count ?? 0) > 0; // Only one match and its not medical or armored gear - if (matchingItems.Count == 1 && !(isMedical || isGearAndHasSlots)) return matchingItems[0]; + if (matchingItems.Count == 1 && !(isMedical || isGearAndHasSlots)) + { + return matchingItems[0]; + } // Items have sub properties that need to be checked against foreach (var item in matchingItems) @@ -814,7 +923,9 @@ public class FenceService( if (isMedical && rootItemBeingAdded.Upd?.MedKit?.HpResource == item.Upd?.MedKit?.HpResource) // e.g. bandages with multiple use // Both undefined === both max resoruce left + { return item; + } // Armors/helmets etc if ( @@ -822,7 +933,9 @@ public class FenceService( rootItemBeingAdded.Upd.Repairable?.Durability == item.Upd.Repairable?.Durability && rootItemBeingAdded.Upd.Repairable?.MaxDurability == item.Upd.Repairable?.MaxDurability ) + { return item; + } } return null; @@ -837,10 +950,16 @@ public class FenceService( protected bool ItemShouldBeForceStacked(Item? existingItem, TemplateItem itemDbDetails) { // No existing item in assort - if (existingItem == null) return false; + if (existingItem == null) + { + return false; + } // Don't stack child items, only root items - if (existingItem.ParentId != "hideout") return false; + if (existingItem.ParentId != "hideout") + { + return false; + } return ItemInPreventDupeCategoryList(itemDbDetails.Id); } @@ -870,13 +989,16 @@ public class FenceService( var current = itemRoot.Upd.MedKit.HpResource; // Current and max match, no adjustment necessary - if (itemTotalMax == current) return; + if (itemTotalMax == current) + { + return; + } var multipler = current / itemTotalMax; // Multiply item cost by desired multiplier var basePrice = barterSchemes[itemRoot.Id][0][0].Count; - barterSchemes[itemRoot.Id][0][0].Count = Math.Round((double)(basePrice * multipler)); + barterSchemes[itemRoot.Id][0][0].Count = Math.Round((double) (basePrice * multipler)); return; } @@ -886,7 +1008,7 @@ public class FenceService( { var itemQualityModifier = itemHelper.GetItemQualityModifier(itemRoot); var basePrice = barterSchemes[itemRoot.Id][0][0].Count; - barterSchemes[itemRoot.Id][0][0].Count = Math.Round((double)basePrice * itemQualityModifier); + barterSchemes[itemRoot.Id][0][0].Count = Math.Round((double) basePrice * itemQualityModifier); } } @@ -896,8 +1018,12 @@ public class FenceService( ) { foreach (var baseTypeKey in itemTypeLimits.Keys) + { if (itemHelper.IsOfBaseclass(itemTpl, baseTypeKey)) + { return itemTypeLimits[baseTypeKey]; + } + } return null; } @@ -926,7 +1052,10 @@ public class FenceService( while (weaponPresetsAddedCount < desiredWeaponPresetsCount) { var randomPresetRoot = randomUtil.GetArrayValue(weaponPresetRootItems); - if (traderConfig.Fence.Blacklist.Contains(randomPresetRoot.Template)) continue; + if (traderConfig.Fence.Blacklist.Contains(randomPresetRoot.Template)) + { + continue; + } var rootItemDb = itemHelper.GetItem(randomPresetRoot.Template).Value; @@ -942,9 +1071,13 @@ public class FenceService( var itemPrice = handbookHelper.GetTemplatePriceForItems(presetWithChildrenClone) * itemHelper.GetItemQualityModifierForItems(presetWithChildrenClone); if (traderConfig.Fence.ItemCategoryRoublePriceLimit.TryGetValue(rootItemDb.Parent, out var priceLimitRouble)) + { if (itemPrice > priceLimitRouble) // Too expensive, try again + { continue; + } + } // MUST randomise Ids as its possible to add the same base fence assort twice = duplicate IDs = dead client itemHelper.ReparentItemAndChildren(presetWithChildrenClone[0], presetWithChildrenClone); @@ -974,10 +1107,13 @@ public class FenceService( } var equipmentPresetsAddedCount = 0; - if (desiredEquipmentPresetsCount <= 0) return; + if (desiredEquipmentPresetsCount <= 0) + { + return; + } var equipmentPresetRootItems = baseFenceAssort.Items.Where( - (item) => item.Upd?.SptPresetId != null && itemHelper.ArmorItemCanHoldMods(item.Template) + item => item.Upd?.SptPresetId != null && itemHelper.ArmorItemCanHoldMods(item.Template) ); while (equipmentPresetsAddedCount < desiredEquipmentPresetsCount) { @@ -989,7 +1125,10 @@ public class FenceService( ); // Need to add mods to armors so they dont show as red in the trade screen - if (itemHelper.ItemRequiresSoftInserts(randomPresetRoot.Template)) RandomiseArmorModDurability(presetWithChildrenClone, rootItemDb); + if (itemHelper.ItemRequiresSoftInserts(randomPresetRoot.Template)) + { + RandomiseArmorModDurability(presetWithChildrenClone, rootItemDb); + } RemoveRandomModsOfItem(presetWithChildrenClone); @@ -999,9 +1138,13 @@ public class FenceService( handbookHelper.GetTemplatePriceForItems(presetWithChildrenClone) * itemHelper.GetItemQualityModifierForItems(presetWithChildrenClone); if (priceLimitRouble != null) + { if (itemPrice > priceLimitRouble) // Too expensive, try again + { continue; + } + } // MUST randomise Ids as its possible to add the same base fence assort twice = duplicate IDs = dead client itemHelper.ReparentItemAndChildren(presetWithChildrenClone[0], presetWithChildrenClone); @@ -1038,16 +1181,25 @@ public class FenceService( protected void RandomiseArmorModDurability(List armor, TemplateItem itemDbDetails) { // Armor has no mods, nothing to randomise - if (itemDbDetails.Properties.Slots == null) return; + if (itemDbDetails.Properties.Slots == null) + { + return; + } // Check for and adjust soft insert durability values var requiredSlots = itemDbDetails.Properties.Slots?.Where(slot => slot.Required ?? false).ToList(); - if ((requiredSlots?.Count ?? 0) > 1) RandomiseArmorSoftInsertDurabilities(requiredSlots, armor); + if ((requiredSlots?.Count ?? 0) > 1) + { + RandomiseArmorSoftInsertDurabilities(requiredSlots, armor); + } // Check for and adjust plate durability values var plateSlots = itemDbDetails.Properties.Slots?.Where(slot => itemHelper.IsRemovablePlateSlot(slot.Name)) .ToList(); - if ((plateSlots?.Count ?? 0) > 1) RandomiseArmorInsertsDurabilities(plateSlots, armor); + if ((plateSlots?.Count ?? 0) > 1) + { + RandomiseArmorInsertsDurabilities(plateSlots, armor); + } } /** @@ -1070,7 +1222,9 @@ public class FenceService( string.Empty; // "Plate" property appears to be the 'default' item for slot if (plateTpl == "") // Some bsg plate properties are empty, skip mod + { continue; + } // Find items mod to apply dura changes to var modItemToAdjust = @@ -1079,11 +1233,13 @@ public class FenceService( itemHelper.AddUpdObjectToItem(modItemToAdjust); if (modItemToAdjust.Upd.Repairable == null) + { modItemToAdjust.Upd.Repairable = new UpdRepairable { Durability = modItemDbDetails.Properties.MaxDurability, MaxDurability = modItemDbDetails.Properties.MaxDurability }; + } modItemToAdjust.Upd.Repairable.Durability = durabilityValues.Durability; modItemToAdjust.Upd.Repairable.MaxDurability = durabilityValues.MaxDurability; @@ -1094,7 +1250,12 @@ public class FenceService( modItemToAdjust.SlotId == "mod_equipment_000" && modItemToAdjust.Upd.Repairable.Durability < modItemDbDetails.Properties.MaxDurability) // Is damaged - modItemToAdjust.Upd.FaceShield = new UpdFaceShield { Hits = randomUtil.GetInt(1, 3) }; + { + modItemToAdjust.Upd.FaceShield = new UpdFaceShield + { + Hits = randomUtil.GetInt(1, 3) + }; + } } } @@ -1111,7 +1272,9 @@ public class FenceService( var plateTpl = plateSlot.Props.Filters[0].Plate; if (string.IsNullOrEmpty(plateTpl)) // Bsg data lacks a default plate, skip randomisng for this mod + { continue; + } var armorWithMods = armorItemAndMods; @@ -1153,11 +1316,13 @@ public class FenceService( itemHelper.AddUpdObjectToItem(modItemToAdjust); if (modItemToAdjust?.Upd?.Repairable == null) + { modItemToAdjust.Upd.Repairable = new UpdRepairable { Durability = modItemDbDetails.Properties.MaxDurability, MaxDurability = modItemDbDetails.Properties.MaxDurability }; + } modItemToAdjust.Upd.Repairable.Durability = durabilityValues.Durability; modItemToAdjust.Upd.Repairable.MaxDurability = durabilityValues.MaxDurability; @@ -1175,7 +1340,10 @@ public class FenceService( if (itemHelper.IsOfBaseclass(itemDbDetails.Id, BaseClasses.AMMO)) { overrideValues = traderConfig.Fence.ItemStackSizeOverrideMinMax[itemDbDetails.Parent]; - if (overrideValues != null) return randomUtil.GetInt((int)overrideValues.Min, (int)overrideValues.Max); + if (overrideValues != null) + { + return randomUtil.GetInt((int) overrideValues.Min, (int) overrideValues.Max); + } // No override, use stack max size from item db return itemDbDetails.Properties.StackMaxSize == 1 @@ -1188,11 +1356,15 @@ 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((int) overrideValues.Min, (int) 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((int) overrideValues.Min, (int) overrideValues.Max); + } return 1; } @@ -1208,20 +1380,29 @@ public class FenceService( // Find mods to remove from item that could've been scavenged by other players in-raid foreach (var itemMod in itemAndMods) + { if (PresetModItemWillBeRemoved(itemMod, toDelete)) { // Skip if not an item var itemDbDetails = itemHelper.GetItem(itemMod.Template); - if (!itemDbDetails.Key) continue; + if (!itemDbDetails.Key) + { + continue; + } // Remove item and its sub-items to prevent orphans toDelete.AddRange(itemHelper.FindAndReturnChildrenByItems(itemAndMods, itemMod.Id)); } + } // Reverse loop and remove items for (var index = itemAndMods.Count - 1; index >= 0; --index) + { if (toDelete.Contains(itemAndMods[index].Id)) + { itemAndMods.Splice(index, 1); + } + } } /** @@ -1233,7 +1414,10 @@ public class FenceService( protected bool PresetModItemWillBeRemoved(Item weaponMod, List itemsBeingDeleted) { var slotIdsThatCanFail = traderConfig.Fence.PresetSlotsToRemoveChancePercent; - if (!slotIdsThatCanFail.TryGetValue(weaponMod.SlotId, out var removalChance) || removalChance == 0.0) return false; + if (!slotIdsThatCanFail.TryGetValue(weaponMod.SlotId, out var removalChance) || removalChance == 0.0) + { + return false; + } // Roll from 0 to 9999, then divide it by 100: 9999 = 99.99% var randomChance = randomUtil.GetInt(0, 9999) / 100; @@ -1258,8 +1442,12 @@ public class FenceService( // Randomise hp resource of med items if (itemDetails.Properties.MaxHpResource != null && (itemDetails.Properties.MaxHpResource ?? 0) > 0) + { itemToAdjust.Upd.MedKit = new UpdMedKit - { HpResource = randomUtil.GetInt(1, (int)itemDetails.Properties.MaxHpResource) }; + { + HpResource = randomUtil.GetInt(1, (int) itemDetails.Properties.MaxHpResource) + }; + } // Randomise armor durability if ( @@ -1274,7 +1462,10 @@ public class FenceService( traderConfig.Fence.ArmorMaxDurabilityPercentMinMax ); itemToAdjust.Upd.Repairable = new UpdRepairable - { Durability = values.Durability, MaxDurability = values.MaxDurability }; + { + Durability = values.Durability, + MaxDurability = values.MaxDurability + }; return; } @@ -1295,7 +1486,10 @@ public class FenceService( ); itemToAdjust.Upd.Repairable = new UpdRepairable - { Durability = currentDurability, MaxDurability = chosenMaxDurability }; + { + Durability = currentDurability, + MaxDurability = chosenMaxDurability + }; return; } @@ -1329,7 +1523,10 @@ public class FenceService( var resourceCurrent = randomUtil.GetInt(1, itemDetails.Properties.MaxResource.Value); itemToAdjust.Upd.Resource = new UpdResource - { Value = resourceMax - resourceCurrent, UnitsConsumed = resourceCurrent }; + { + Value = resourceMax - resourceCurrent, + UnitsConsumed = resourceCurrent + }; } } @@ -1355,7 +1552,11 @@ public class FenceService( chosenMaxDurability ); - return new UpdRepairable { Durability = chosenCurrentDurability, MaxDurability = chosenMaxDurability }; + return new UpdRepairable + { + Durability = chosenCurrentDurability, + MaxDurability = chosenMaxDurability + }; } /** @@ -1368,7 +1569,9 @@ public class FenceService( var itemTypeCounts = new Dictionary(); foreach (var x in limits.Keys) - itemTypeCounts[x] = new(0, limits[x]); + { + itemTypeCounts[x] = new ValueTuple(0, limits[x]); + } return itemTypeCounts; } @@ -1390,9 +1593,9 @@ public class FenceService( */ protected int GetFenceRefreshTime() { - var fence = traderConfig.UpdateTime.FirstOrDefault((x) => x.TraderId == Traders.FENCE).Seconds; + var fence = traderConfig.UpdateTime.FirstOrDefault(x => x.TraderId == Traders.FENCE).Seconds; - return randomUtil.GetInt((int)fence.Min, (int)fence.Max); + return randomUtil.GetInt((int) fence.Min, (int) fence.Max); } /** @@ -1405,16 +1608,25 @@ public class FenceService( var fenceSettings = databaseService.GetGlobals().Configuration.FenceSettings; var pmcFenceInfo = pmcData.TradersInfo[fenceSettings.FenceIdentifier]; - if (pmcFenceInfo == null) return fenceSettings.Levels[0]; + if (pmcFenceInfo == null) + { + return fenceSettings.Levels[0]; + } var fenceLevels = fenceSettings.Levels.Keys; var minLevel = fenceLevels.Min(); var maxLevel = fenceLevels.Max(); - var pmcFenceLevel = Math.Floor((double)pmcFenceInfo.Standing); + var pmcFenceLevel = Math.Floor((double) pmcFenceInfo.Standing); - if (pmcFenceLevel < minLevel) return fenceSettings.Levels[minLevel]; + if (pmcFenceLevel < minLevel) + { + return fenceSettings.Levels[minLevel]; + } - if (pmcFenceLevel > maxLevel) return fenceSettings.Levels[maxLevel]; + if (pmcFenceLevel > maxLevel) + { + return fenceSettings.Levels[maxLevel]; + } return fenceSettings.Levels[pmcFenceLevel]; } @@ -1427,11 +1639,11 @@ public class FenceService( public void AmendOrRemoveFenceOffer(string assortId, int buyCount) { var isNormalAssort = true; - var fenceAssortItem = fenceAssort.Items.FirstOrDefault((item) => item.Id == assortId); + var fenceAssortItem = fenceAssort.Items.FirstOrDefault(item => item.Id == assortId); if (fenceAssortItem == null) { // Not in main assorts, check secondary section - fenceAssortItem = fenceDiscountAssort.Items.FirstOrDefault((item) => item.Id == assortId); + fenceAssortItem = fenceDiscountAssort.Items.FirstOrDefault(item => item.Id == assortId); if (fenceAssortItem == null) { logger.Error(localisationService.GetText("fence-unable_to_find_offer_by_id", assortId)); @@ -1459,18 +1671,20 @@ public class FenceService( var itemWithChildrenToRemove = itemHelper.FindAndReturnChildrenAsItems(assorts, assortId); foreach (var itemToRemove in itemWithChildrenToRemove) { - var indexToRemove = assorts.FindIndex((item) => item.Id == itemToRemove.Id); + var indexToRemove = assorts.FindIndex(item => item.Id == itemToRemove.Id); // No offer found in main assort, check discount items if (indexToRemove == -1) { - indexToRemove = fenceDiscountAssort.Items.FindIndex((item) => item.Id == itemToRemove.Id); + indexToRemove = fenceDiscountAssort.Items.FindIndex(item => item.Id == itemToRemove.Id); fenceDiscountAssort.Items.Splice(indexToRemove, 1); if (indexToRemove == -1) + { logger.Warning( $"unable to remove fence assort item: {itemToRemove.Id} tpl: {itemToRemove.Template}" ); + } return; } diff --git a/Libraries/Core/Services/GiftService.cs b/Libraries/Core/Services/GiftService.cs index c3ccf847..c7a8fe27 100644 --- a/Libraries/Core/Services/GiftService.cs +++ b/Libraries/Core/Services/GiftService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Profile; using Core.Models.Enums; @@ -7,6 +6,7 @@ using Core.Models.Spt.Dialog; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -67,25 +67,34 @@ public class GiftService( public GiftSentResult SendGiftToPlayer(string playerId, string giftId) { var giftData = GetGiftById(giftId); - if (giftData is null) return GiftSentResult.FAILED_GIFT_DOESNT_EXIST; + if (giftData is null) + { + return GiftSentResult.FAILED_GIFT_DOESNT_EXIST; + } var maxGiftsToSendCount = giftData.MaxToSendPlayer ?? 1; if (_profileHelper.PlayerHasRecievedMaxNumberOfGift(playerId, giftId, maxGiftsToSendCount)) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Player already received gift: {giftId}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Player already received gift: {giftId}"); + } return GiftSentResult.FAILED_GIFT_ALREADY_RECEIVED; } if (giftData.Items?.Count > 0 && giftData.CollectionTimeHours is not null) + { _logger.Warning($"Gift {giftId} has items but no collection time limit, defaulting to 48 hours"); + } // Handle system messsages if (giftData.Sender == GiftSenderType.System) { // Has a localisable text id to send to player if (giftData.LocaleTextId is not null) + { _mailSendService.SendLocalisedSystemMessageToPlayer( playerId, giftData.LocaleTextId, @@ -93,7 +102,9 @@ public class GiftService( giftData.ProfileChangeEvents, _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 1) ); + } else + { _mailSendService.SendSystemMessageToPlayer( playerId, giftData.MessageText, @@ -101,6 +112,7 @@ public class GiftService( _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 1), giftData.ProfileChangeEvents ); + } } // Handle user messages else if (giftData.Sender == GiftSenderType.User) @@ -116,27 +128,27 @@ public class GiftService( else if (giftData.Sender == GiftSenderType.Trader) { if (giftData.LocaleTextId is not null) + { _mailSendService.SendLocalisedNpcMessageToPlayer( playerId, giftData.Trader, MessageType.MESSAGE_WITH_ITEMS, giftData.LocaleTextId, giftData.Items, - _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 1), - null, - null + _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 1) ); + } else + { _mailSendService.SendLocalisedNpcMessageToPlayer( playerId, giftData.Trader, MessageType.MESSAGE_WITH_ITEMS, giftData.MessageText, giftData.Items, - _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 1), - null, - null + _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 1) ); + } } else { @@ -157,7 +169,10 @@ public class GiftService( ItemsMaxStorageLifetimeSeconds = _timeUtil.GetHoursAsSeconds(giftData.CollectionTimeHours ?? 0) }; - if (giftData.Trader is not null) details.Trader = giftData.Trader; + if (giftData.Trader is not null) + { + details.Trader = giftData.Trader; + } _mailSendService.SendMessageToPlayer(details); } @@ -174,9 +189,15 @@ public class GiftService( */ private string? GetSenderId(Gift giftData) { - if (giftData.Sender == GiftSenderType.Trader) return Enum.GetName(typeof(GiftSenderType), giftData.Sender); + if (giftData.Sender == GiftSenderType.Trader) + { + return Enum.GetName(typeof(GiftSenderType), giftData.Sender); + } - if (giftData.Sender == GiftSenderType.User) return giftData.Sender.ToString(); + if (giftData.Sender == GiftSenderType.User) + { + return giftData.Sender.ToString(); + } return null; } @@ -217,8 +238,12 @@ public class GiftService( }; if (giftId is not null) + { if (!_profileHelper.PlayerHasRecievedMaxNumberOfGift(sessionId, giftId, 1)) + { SendGiftToPlayer(sessionId, giftId); + } + } } /** @@ -229,6 +254,9 @@ public class GiftService( */ public void SendGiftWithSilentReceivedCheck(string giftId, string? sessionId, int giftCount) { - if (!_profileHelper.PlayerHasRecievedMaxNumberOfGift(sessionId, giftId, giftCount)) SendGiftToPlayer(sessionId, giftId); + if (!_profileHelper.PlayerHasRecievedMaxNumberOfGift(sessionId, giftId, giftCount)) + { + SendGiftToPlayer(sessionId, giftId); + } } } diff --git a/Libraries/Core/Services/I18nService.cs b/Libraries/Core/Services/I18nService.cs index 8a4ad72f..5a9e983f 100644 --- a/Libraries/Core/Services/I18nService.cs +++ b/Libraries/Core/Services/I18nService.cs @@ -6,15 +6,15 @@ namespace Core.Services; public class I18nService { - private List _locales; - private Dictionary _fallbacks; private readonly string _defaultLocale; private readonly string _directory; - private JsonUtil _jsonUtil; - private FileUtil _fileUtil; - private string _setLocale; + private readonly Dictionary _fallbacks; + private readonly FileUtil _fileUtil; + private readonly JsonUtil _jsonUtil; - private Dictionary>> _loadedLocales = new(); + private readonly Dictionary>> _loadedLocales = new(); + private List _locales; + private string _setLocale; // TODO: try convert to primary ctor public I18nService( @@ -40,8 +40,12 @@ public class I18nService { var files = _fileUtil.GetFiles(_directory, true).Where(f => _fileUtil.GetFileExtension(f) == "json").ToList(); if (files.Count == 0) + { throw new Exception($"Localisation files in directory {_directory} not found."); + } + foreach (var file in files) + { _loadedLocales.Add( _fileUtil.StripExtension(file), new LazyLoad>( @@ -49,9 +53,12 @@ public class I18nService new Dictionary() ) ); + } if (!_loadedLocales.ContainsKey(_defaultLocale)) + { throw new Exception($"The default locale '{_defaultLocale}' does not exist on the loaded locales."); + } } public void SetLocale(string locale) @@ -67,9 +74,12 @@ public class I18nService { var foundFallbackLocale = fallback.First().Value; if (!_loadedLocales.ContainsKey(foundFallbackLocale)) + { throw new Exception( $"Locale '{locale}' was not defined, and the found fallback locale did not match any of the loaded locales." ); + } + _setLocale = foundFallbackLocale; } @@ -80,7 +90,10 @@ public class I18nService public string GetLocalised(string key) { if (!_loadedLocales.TryGetValue(_setLocale, out var locales)) + { return key; + } + if (!locales.Value.TryGetValue(key, out var value)) { _loadedLocales.TryGetValue(_defaultLocale, out var defaults); @@ -99,7 +112,10 @@ public class I18nService public string GetLocalised(string key, object? args) { var rawLocalizedString = GetLocalised(key); - if (args == null) return rawLocalizedString; + if (args == null) + { + return rawLocalizedString; + } var typeToCheck = args.GetType(); var typeProps = typeToCheck.GetProperties(); @@ -108,7 +124,9 @@ public class I18nService { var localizedName = $"{{{{{propertyInfo.GetJsonName()}}}}}"; if (rawLocalizedString.Contains(localizedName)) + { rawLocalizedString = rawLocalizedString.Replace(localizedName, propertyInfo.GetValue(args)?.ToString() ?? string.Empty); + } } return rawLocalizedString; diff --git a/Libraries/Core/Services/InMemoryCacheService.cs b/Libraries/Core/Services/InMemoryCacheService.cs index 57bb7200..2ac9e015 100644 --- a/Libraries/Core/Services/InMemoryCacheService.cs +++ b/Libraries/Core/Services/InMemoryCacheService.cs @@ -23,7 +23,10 @@ public class InMemoryCacheService( // Stored data public T? GetDataByKey(string key) { - if (_cacheData.ContainsKey(key)) return (T)_cacheData[key]; + if (_cacheData.ContainsKey(key)) + { + return (T) _cacheData[key]; + } return default; } diff --git a/Libraries/Core/Services/InsuranceService.cs b/Libraries/Core/Services/InsuranceService.cs index 4abd00b9..3c0c517f 100644 --- a/Libraries/Core/Services/InsuranceService.cs +++ b/Libraries/Core/Services/InsuranceService.cs @@ -1,5 +1,4 @@ using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; @@ -10,6 +9,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using Insurance = Core.Models.Eft.Profile.Insurance; using LogLevel = Core.Models.Spt.Logging.LogLevel; @@ -36,7 +36,7 @@ public class InsuranceService( protected Dictionary>?> _insured = new(); /// - /// Does player have insurance dictionary exists + /// Does player have insurance dictionary exists /// /// Player id /// True if exists @@ -46,7 +46,7 @@ public class InsuranceService( } /// - /// Get all insured items by all traders for a profile + /// Get all insured items by all traders for a profile /// /// Profile id (session id) /// Item list @@ -57,12 +57,15 @@ public class InsuranceService( public void ResetInsurance(string sessionId) { - if (!_insured.TryAdd(sessionId, new Dictionary>())) _insured[sessionId] = new Dictionary>(); + if (!_insured.TryAdd(sessionId, new Dictionary>())) + { + _insured[sessionId] = new Dictionary>(); + } } /// - /// Sends 'I will go look for your stuff' trader message + - /// Store lost insurance items inside profile for later retrieval + /// Sends 'I will go look for your stuff' trader message + + /// Store lost insurance items inside profile for later retrieval /// /// Profile to send insured items to /// SessionId of current player @@ -111,7 +114,7 @@ public class InsuranceService( MessageType.NPC_TRADER, _randomUtil.GetArrayValue(dialogueTemplates["insuranceStart"] ?? ["INSURANCE START MESSAGE MISSING"]), null, - _timeUtil.GetHoursAsSeconds((int)globals.Configuration?.Insurance?.MaxStorageTimeInHour), + _timeUtil.GetHoursAsSeconds((int) globals.Configuration?.Insurance?.MaxStorageTimeInHour), systemData ); @@ -121,9 +124,9 @@ public class InsuranceService( .InsuranceList.Add( new Insurance { - ScheduledTime = (int)GetInsuranceReturnTimestamp(pmcData, traderBase), + ScheduledTime = (int) GetInsuranceReturnTimestamp(pmcData, traderBase), TraderId = trader.ToString(), - MaxStorageTime = (int)GetMaxInsuranceStorageTime(traderBase), + MaxStorageTime = (int) GetMaxInsuranceStorageTime(traderBase), SystemData = systemData, MessageType = MessageType.INSURANCE_RETURN, MessageTemplateId = _randomUtil.GetArrayValue(dialogueTemplates["insuranceFound"]), @@ -136,8 +139,8 @@ public class InsuranceService( } /// - /// Get a timestamp of when insurance items should be sent to player based on trader used to insure - /// Apply insurance return bonus if found in profile + /// Get a timestamp of when insurance items should be sent to player based on trader used to insure + /// Apply insurance return bonus if found in profile /// /// Player profile /// Trader base used to insure items @@ -148,7 +151,10 @@ public class InsuranceService( if (_insuranceConfig.ReturnTimeOverrideSeconds > 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Insurance override used: returning in {_insuranceConfig.ReturnTimeOverrideSeconds} seconds"); + } + return _timeUtil.GetTimeStamp() + _insuranceConfig.ReturnTimeOverrideSeconds; } @@ -173,11 +179,16 @@ public class InsuranceService( ); if (hasMarkOfUnheard) // Reduce return time by globals multipler value + { randomisedReturnTimeSeconds *= globals.Configuration.Insurance.CoefOfHavingMarkOfUnknown.Value; + } // EoD has 30% faster returns var editionModifier = globals.Configuration.Insurance.EditionSendingMessageTime[pmcData.Info.GameVersion]; - if (editionModifier is not null) randomisedReturnTimeSeconds *= editionModifier.Multiplier.Value; + if (editionModifier is not null) + { + randomisedReturnTimeSeconds *= editionModifier.Multiplier.Value; + } // Calculate the final return time based on our bonus percent var finalReturnTimeSeconds = randomisedReturnTimeSeconds * (1d - insuranceReturnTimeBonusPercent); @@ -188,23 +199,28 @@ public class InsuranceService( { if (_insuranceConfig.StorageTimeOverrideSeconds > 0) // Override exists, use instead of traders value + { return _insuranceConfig.StorageTimeOverrideSeconds; + } - return _timeUtil.GetHoursAsSeconds((int)traderBase.Insurance.MaxStorageTime); + return _timeUtil.GetHoursAsSeconds((int) traderBase.Insurance.MaxStorageTime); } /// - /// Store lost gear post-raid inside profile, ready for later code to pick it up and mail it + /// Store lost gear post-raid inside profile, ready for later code to pick it up and mail it /// /// Gear to store - generated by GetGearLostInRaid() public void StoreGearLostInRaidToSendLater(string sessionID, List equipmentPkg) { // Process all insured items lost in-raid - foreach (var gear in equipmentPkg) AddGearToSend(gear); + foreach (var gear in equipmentPkg) + { + AddGearToSend(gear); + } } /// - /// For the passed in items, find the trader it was insured against + /// For the passed in items, find the trader it was insured against /// /// Session id /// Insured items lost in a raid @@ -224,7 +240,10 @@ public class InsuranceService( continue; } - if (ItemCannotBeLostOnDeath(lostItem, pmcProfile.Inventory.Items)) continue; + if (ItemCannotBeLostOnDeath(lostItem, pmcProfile.Inventory.Items)) + { + continue; + } // Add insured item + details to return array result.Add( @@ -242,23 +261,29 @@ public class InsuranceService( } /// - /// Some items should never be returned in insurance but BSG send them in the request + /// Some items should never be returned in insurance but BSG send them in the request /// /// Item being returned in insurance /// Player inventory /// True if item protected bool ItemCannotBeLostOnDeath(Item lostItem, List inventoryItems) { - if (lostItem.SlotId?.ToLower().StartsWith("specialslot") ?? false) return true; + if (lostItem.SlotId?.ToLower().StartsWith("specialslot") ?? false) + { + return true; + } // We check secure container items even tho they are omitted from lostInsuredItems, just in case - if (_itemHelper.ItemIsInsideContainer(lostItem, "SecuredContainer", inventoryItems)) return true; + if (_itemHelper.ItemIsInsideContainer(lostItem, "SecuredContainer", inventoryItems)) + { + return true; + } return false; } /// - /// Add gear item to InsuredItems list in player profile + /// Add gear item to InsuredItems list in player profile /// /// Gear to send protected void AddGearToSend(InsuranceEquipmentPkg gear) @@ -269,19 +294,31 @@ public class InsuranceService( var traderId = gear.TraderId; // Ensure insurance array is init - if (!InsuranceDictionaryExists(sessionId)) ResetInsurance(sessionId); + if (!InsuranceDictionaryExists(sessionId)) + { + ResetInsurance(sessionId); + } // init trader insurance array - if (!InsuranceTraderArrayExists(sessionId, traderId)) ResetInsuranceTraderArray(sessionId, traderId); + if (!InsuranceTraderArrayExists(sessionId, traderId)) + { + ResetInsuranceTraderArray(sessionId, traderId); + } AddInsuranceItemToArray(sessionId, traderId, itemToReturnToPlayer); // Remove item from insured items array as its been processed - pmcData.InsuredItems = pmcData.InsuredItems.Where(item => { return item.ItemId != itemToReturnToPlayer.Id; }).ToList(); + pmcData.InsuredItems = pmcData.InsuredItems.Where( + item => + { + return item.ItemId != itemToReturnToPlayer.Id; + } + ) + .ToList(); } /// - /// Does insurance exist for a player and by trader + /// Does insurance exist for a player and by trader /// /// Player id (session id) /// Trader items insured with @@ -292,7 +329,7 @@ public class InsuranceService( } /// - /// Empty out list holding insured items by sessionid + traderid + /// Empty out list holding insured items by sessionid + traderid /// /// Player id (session id) /// Trader items insured with @@ -302,7 +339,7 @@ public class InsuranceService( } /// - /// Store insured item + /// Store insured item /// /// Player id (session id) /// Trader item insured with @@ -313,7 +350,7 @@ public class InsuranceService( } /// - /// Get price of insurance * multiplier from config + /// Get price of insurance * multiplier from config /// /// Player profile /// Item to be insured diff --git a/Libraries/Core/Services/ItemBaseClassService.cs b/Libraries/Core/Services/ItemBaseClassService.cs index cc5b99dc..b1bf7e97 100644 --- a/Libraries/Core/Services/ItemBaseClassService.cs +++ b/Libraries/Core/Services/ItemBaseClassService.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -25,11 +25,14 @@ public class ItemBaseClassService( _itemBaseClassesCache = new Dictionary>(); var items = _databaseService.GetItems(); - var filteredDbItems = items.Where((x) => x.Value.Type == "Item"); + var filteredDbItems = items.Where(x => x.Value.Type == "Item"); foreach (var item in filteredDbItems) { var itemIdToUpdate = item.Value.Id; - if (!_itemBaseClassesCache.ContainsKey(item.Value.Id)) _itemBaseClassesCache[item.Value.Id] = []; + if (!_itemBaseClassesCache.ContainsKey(item.Value.Id)) + { + _itemBaseClassesCache[item.Value.Id] = []; + } AddBaseItems(itemIdToUpdate, item.Value); } @@ -47,7 +50,10 @@ public class ItemBaseClassService( _itemBaseClassesCache[itemIdToUpdate].Add(item.Parent); var parent = _databaseService.GetItems()[item.Parent]; - if (!string.IsNullOrEmpty(parent.Parent)) AddBaseItems(itemIdToUpdate, parent); + if (!string.IsNullOrEmpty(parent.Parent)) + { + AddBaseItems(itemIdToUpdate, parent); + } } /** @@ -58,7 +64,10 @@ public class ItemBaseClassService( */ public bool ItemHasBaseClass(string itemTpl, List baseClasses) { - if (!_cacheGenerated) HydrateItemBaseClassCache(); + if (!_cacheGenerated) + { + HydrateItemBaseClassCache(); + } if (string.IsNullOrEmpty(itemTpl)) { @@ -69,18 +78,30 @@ public class ItemBaseClassService( // The cache is only generated for item templates with `_type === "Item"`, so return false for any other type, // including item templates that simply don't exist. - if (!CachedItemIsOfItemType(itemTpl)) return false; + if (!CachedItemIsOfItemType(itemTpl)) + { + return false; + } // No item in cache - if (_itemBaseClassesCache.ContainsKey(itemTpl)) return _itemBaseClassesCache[itemTpl].Any(baseClasses.Contains); + if (_itemBaseClassesCache.ContainsKey(itemTpl)) + { + return _itemBaseClassesCache[itemTpl].Any(baseClasses.Contains); + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug(_localisationService.GetText("baseclass-item_not_found", itemTpl)); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug(_localisationService.GetText("baseclass-item_not_found", itemTpl)); + } // Not found in cache, Hydrate again - some mods add items late HydrateItemBaseClassCache(); // Check for item again, return false if item not found a second time - if (_itemBaseClassesCache.ContainsKey(itemTpl)) return _itemBaseClassesCache[itemTpl].Any(baseClasses.Contains); + if (_itemBaseClassesCache.ContainsKey(itemTpl)) + { + return _itemBaseClassesCache[itemTpl].Any(baseClasses.Contains); + } _logger.Warning(_localisationService.GetText("baseclass-item_not_found_failed", itemTpl)); @@ -104,9 +125,15 @@ public class ItemBaseClassService( */ public List GetItemBaseClasses(string itemTpl) { - if (!_cacheGenerated) HydrateItemBaseClassCache(); + if (!_cacheGenerated) + { + HydrateItemBaseClassCache(); + } - if (!_itemBaseClassesCache.ContainsKey(itemTpl)) return []; + if (!_itemBaseClassesCache.ContainsKey(itemTpl)) + { + return []; + } return _itemBaseClassesCache[itemTpl]; } diff --git a/Libraries/Core/Services/ItemFilterService.cs b/Libraries/Core/Services/ItemFilterService.cs index c4e8d7b1..2921415d 100644 --- a/Libraries/Core/Services/ItemFilterService.cs +++ b/Libraries/Core/Services/ItemFilterService.cs @@ -1,8 +1,8 @@ -using SptCommon.Annotations; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Services; @@ -13,10 +13,10 @@ public class ItemFilterService( ConfigServer _configServer ) { + protected HashSet? _itemBlacklistCache = []; protected ItemConfig _itemConfig = _configServer.GetConfig(); protected HashSet? _lootableItemBlacklistCache = []; - protected HashSet? _itemBlacklistCache = []; /** * Check if the provided template id is blacklisted in config/item.json/blacklist @@ -26,8 +26,12 @@ public class ItemFilterService( public bool ItemBlacklisted(string tpl) { if (_itemBlacklistCache.Count == 0) + { foreach (var item in _itemConfig.Blacklist) + { _itemBlacklistCache.Add(item); + } + } return _itemBlacklistCache.Contains(tpl); } @@ -104,26 +108,38 @@ public class ItemFilterService( */ public bool IsLootableItemBlacklisted(string itemKey) { - if (!_lootableItemBlacklistCache.Any()) HydrateLootableItemBlacklist(); + if (!_lootableItemBlacklistCache.Any()) + { + HydrateLootableItemBlacklist(); + } return _lootableItemBlacklistCache.Contains(itemKey); } public bool IsItemBlacklisted(string tpl) { - if (!_itemBlacklistCache.Any()) HydrateBlacklist(); + if (!_itemBlacklistCache.Any()) + { + HydrateBlacklist(); + } return _itemBlacklistCache.Contains(tpl); } protected void HydrateLootableItemBlacklist() { - foreach (var item in _itemConfig.LootableItemBlacklist) _lootableItemBlacklistCache.Add(item); + foreach (var item in _itemConfig.LootableItemBlacklist) + { + _lootableItemBlacklistCache.Add(item); + } } protected void HydrateBlacklist() { - foreach (var item in _itemConfig.Blacklist) _itemBlacklistCache.Add(item); + foreach (var item in _itemConfig.Blacklist) + { + _itemBlacklistCache.Add(item); + } } /** diff --git a/Libraries/Core/Services/LocaleService.cs b/Libraries/Core/Services/LocaleService.cs index 7217a64d..893cf87a 100644 --- a/Libraries/Core/Services/LocaleService.cs +++ b/Libraries/Core/Services/LocaleService.cs @@ -1,8 +1,8 @@ using System.Globalization; -using SptCommon.Annotations; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; +using SptCommon.Annotations; namespace Core.Services; @@ -22,7 +22,10 @@ public class LocaleService( public Dictionary GetLocaleDb() { var desiredLocale = _databaseServer.GetTables().Locales.Global[GetDesiredGameLocale()]; - if (desiredLocale != null) return desiredLocale.Value; + if (desiredLocale != null) + { + return desiredLocale.Value; + } _logger.Warning( $"Unable to find desired locale file using locale: {GetDesiredGameLocale()} from config/locale.json, falling back to 'en'" @@ -38,7 +41,10 @@ public class LocaleService( */ public string GetDesiredGameLocale() { - if (_localeConfig.GameLocale.ToLower() == "system") return GetPlatformForClientLocale(); + if (_localeConfig.GameLocale.ToLower() == "system") + { + return GetPlatformForClientLocale(); + } return _localeConfig.GameLocale.ToLower(); } @@ -50,7 +56,10 @@ public class LocaleService( */ public string GetDesiredServerLocale() { - if (_localeConfig.ServerLocale.ToLower() == "system") return GetPlatformForServerLocale(); + if (_localeConfig.ServerLocale.ToLower() == "system") + { + return GetPlatformForServerLocale(); + } return _localeConfig.ServerLocale.ToLower(); } @@ -95,14 +104,18 @@ public class LocaleService( { if (baseNameCode == "zh") // Handle edge case of zh + { return "zh-cn"; + } return languageCode; } if (baseNameCode == "pt") // Handle edge case of pt + { return "pt-pt"; + } _logger.Warning($"Unsupported system language found: {baseNameCode}, falling back to english"); @@ -127,10 +140,16 @@ public class LocaleService( var locales = _databaseServer.GetTables().Locales; var baseNameCode = platformLocale.TwoLetterISOLanguageName.ToLower(); - if (locales.Global.ContainsKey(baseNameCode)) return baseNameCode; + if (locales.Global.ContainsKey(baseNameCode)) + { + return baseNameCode; + } var languageCode = platformLocale.Name.ToLower(); - if (locales.Global.ContainsKey(languageCode)) return languageCode; + if (locales.Global.ContainsKey(languageCode)) + { + return languageCode; + } /* const regionCode = platformLocale.region?.toLocaleLowerCase(); @@ -140,7 +159,10 @@ public class LocaleService( */ // BSG map DE to GE some reason - if (baseNameCode == "de") return "ge"; + if (baseNameCode == "de") + { + return "ge"; + } _logger.Warning($"Unsupported system language found: {languageCode}, falling back to english"); return "en"; diff --git a/Libraries/Core/Services/LocalisationService.cs b/Libraries/Core/Services/LocalisationService.cs index b25ec2dc..e47ee3b1 100644 --- a/Libraries/Core/Services/LocalisationService.cs +++ b/Libraries/Core/Services/LocalisationService.cs @@ -1,19 +1,19 @@ -using Core.Utils; -using SptCommon.Annotations; using Core.Models.Utils; using Core.Servers; +using Core.Utils; +using SptCommon.Annotations; namespace Core.Services; [Injectable(InjectionType.Singleton)] public class LocalisationService { - protected ISptLogger _logger; - protected RandomUtil _randomUtil; protected DatabaseServer _databaseServer; - protected LocaleService _localeService; protected I18nService _i18nService; + protected LocaleService _localeService; + protected ISptLogger _logger; + protected RandomUtil _randomUtil; // TODO: turn into primary ctor public LocalisationService( diff --git a/Libraries/Core/Services/LocationLifecycleService.cs b/Libraries/Core/Services/LocationLifecycleService.cs index 6520a7e0..cdf8db46 100644 --- a/Libraries/Core/Services/LocationLifecycleService.cs +++ b/Libraries/Core/Services/LocationLifecycleService.cs @@ -1,7 +1,6 @@ using Core.Context; using Core.Generators; using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Match; @@ -14,6 +13,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -21,39 +21,39 @@ namespace Core.Services; [Injectable(InjectionType.Singleton)] public class LocationLifecycleService { - private readonly ISptLogger _logger; - private readonly RewardHelper _rewardHelper; - private readonly ConfigServer _configServer; - private readonly TimeUtil _timeUtil; - private readonly DatabaseService _databaseService; - private readonly ProfileHelper _profileHelper; - private readonly HashUtil _hashUtil; private readonly ApplicationContext _applicationContext; private readonly BotGenerationCacheService _botGenerationCacheService; - private readonly BotNameService _botNameService; - private readonly PmcConfig _pmcConfig; - private readonly ICloner _cloner; - private readonly LocationConfig _locationConfig; - private readonly RaidTimeAdjustmentService _raidTimeAdjustmentService; - private readonly LocationLootGenerator _locationLootGenerator; - private readonly LocalisationService _localisationService; private readonly BotLootCacheService _botLootCacheService; - private readonly RagfairConfig _ragfairConfig; + private readonly BotNameService _botNameService; + private readonly ICloner _cloner; + private readonly ConfigServer _configServer; + private readonly DatabaseService _databaseService; + private readonly HashUtil _hashUtil; + private readonly HealthHelper _healthHelper; private readonly HideoutConfig _hideoutConfig; - private readonly TraderConfig _traderConfig; - private readonly LootGenerator _lootGenerator; - private readonly MailSendService _mailSendService; - private readonly TraderHelper _traderHelper; - private readonly RandomUtil _randomUtil; private readonly InRaidConfig _inRaidConfig; private readonly InRaidHelper _inRaidHelper; - private readonly PlayerScavGenerator _playerScavGenerator; - private readonly SaveServer _saveServer; - private readonly HealthHelper _healthHelper; - private readonly PmcChatResponseService _pmcChatResponseService; - private readonly QuestHelper _questHelper; private readonly InsuranceService _insuranceService; + private readonly LocalisationService _localisationService; + private readonly LocationConfig _locationConfig; + private readonly LocationLootGenerator _locationLootGenerator; + private readonly ISptLogger _logger; + private readonly LootGenerator _lootGenerator; + private readonly MailSendService _mailSendService; private readonly MatchBotDetailsCacheService _matchBotDetailsCacheService; + private readonly PlayerScavGenerator _playerScavGenerator; + private readonly PmcChatResponseService _pmcChatResponseService; + private readonly PmcConfig _pmcConfig; + private readonly ProfileHelper _profileHelper; + private readonly QuestHelper _questHelper; + private readonly RagfairConfig _ragfairConfig; + private readonly RaidTimeAdjustmentService _raidTimeAdjustmentService; + private readonly RandomUtil _randomUtil; + private readonly RewardHelper _rewardHelper; + private readonly SaveServer _saveServer; + private readonly TimeUtil _timeUtil; + private readonly TraderConfig _traderConfig; + private readonly TraderHelper _traderHelper; public LocationLifecycleService( ISptLogger logger, @@ -121,7 +121,9 @@ public class LocationLifecycleService _pmcConfig = _configServer.GetConfig(); } - /** Handle client/match/local/start */ + /** + * Handle client/match/local/start + */ public StartLocalRaidResponseData StartLocalRaid(string sessionId, StartLocalRaidRequestData request) { _logger.Debug($"Starting: {request.Location}"); @@ -150,7 +152,9 @@ public class LocationLifecycleService // Only has value when transitioning into map from previous one if (request.Transition is not null) // TODO - why doesnt the raid after transit have any transit data? + { result.Transition = request.Transition; + } // Get data stored at end of previous raid (if any) var transitionData = _applicationContext @@ -195,7 +199,9 @@ public class LocationLifecycleService { var playerIsScav = playerSide.ToLower() == "savage"; if (!playerIsScav) + { return; + } // Get relevant extract data for map var mapExtracts = _databaseService.GetLocation(location)?.AllExtracts; @@ -210,7 +216,9 @@ public class LocationLifecycleService var scavExtracts = mapExtracts.Where(extract => extract.Side.ToLower() == "scav").ToList(); if (scavExtracts.Count() > 0) // Scav extracts found, use them + { locationData.Exits.AddRange(scavExtracts); + } } /** @@ -236,9 +244,15 @@ public class LocationLifecycleService // Add new permanent enemies if they don't already exist if (configHostilityChanges.AdditionalEnemyTypes is not null) + { foreach (var enemyTypeToAdd in configHostilityChanges.AdditionalEnemyTypes) + { if (!locationBotHostilityDetails.AlwaysEnemies.Contains(enemyTypeToAdd)) + { locationBotHostilityDetails.AlwaysEnemies.Add(enemyTypeToAdd); + } + } + } // Add/edit chance settings if (configHostilityChanges.ChancedEnemies is not null) @@ -251,10 +265,14 @@ public class LocationLifecycleService ); if (locationBotDetails is not null) // Existing + { locationBotDetails.EnemyChance = chanceDetailsToApply.EnemyChance; + } else // Add new + { locationBotHostilityDetails.ChancedEnemies.Add(chanceDetailsToApply); + } } } @@ -263,22 +281,37 @@ public class LocationLifecycleService { locationBotHostilityDetails.AlwaysFriends = []; foreach (var friendlyTypeToAdd in configHostilityChanges.AdditionalFriendlyTypes) + { if (!locationBotHostilityDetails.AlwaysFriends.Contains(friendlyTypeToAdd)) + { locationBotHostilityDetails.AlwaysFriends.Add(friendlyTypeToAdd); + } + } } // Adjust vs bear hostility chance - if (configHostilityChanges.BearEnemyChance is not null) locationBotHostilityDetails.BearEnemyChance = configHostilityChanges.BearEnemyChance; + if (configHostilityChanges.BearEnemyChance is not null) + { + locationBotHostilityDetails.BearEnemyChance = configHostilityChanges.BearEnemyChance; + } // Adjust vs usec hostility chance - if (configHostilityChanges.UsecEnemyChance is not null) locationBotHostilityDetails.UsecEnemyChance = configHostilityChanges.UsecEnemyChance; + if (configHostilityChanges.UsecEnemyChance is not null) + { + locationBotHostilityDetails.UsecEnemyChance = configHostilityChanges.UsecEnemyChance; + } // Adjust vs savage hostility chance - if (configHostilityChanges.SavageEnemyChance is not null) locationBotHostilityDetails.SavageEnemyChance = configHostilityChanges.SavageEnemyChance; + if (configHostilityChanges.SavageEnemyChance is not null) + { + locationBotHostilityDetails.SavageEnemyChance = configHostilityChanges.SavageEnemyChance; + } // Adjust vs scav hostility behaviour if (configHostilityChanges.SavagePlayerBehaviour is not null) + { locationBotHostilityDetails.SavagePlayerBehaviour = configHostilityChanges.SavagePlayerBehaviour; + } } } @@ -297,13 +330,22 @@ public class LocationLifecycleService locationBaseClone.UnixDateTime = _timeUtil.GetTimeStamp(); // Don't generate loot for hideout - if (name.ToLower() == "hideout") return locationBaseClone; + if (name.ToLower() == "hideout") + { + return locationBaseClone; + } // If new spawn system is enabled, clear the spawn waves to prevent x2 spawns - if (locationBaseClone.NewSpawn is true) locationBaseClone.Waves = []; + if (locationBaseClone.NewSpawn is true) + { + locationBaseClone.Waves = []; + } // Only requested base data, not loot - if (!generateLoot) return locationBaseClone; + if (!generateLoot) + { + return locationBaseClone; + } // Check for a loot multipler adjustment in app context and apply if one is found LocationConfig? locationConfigClone = null; @@ -331,7 +373,10 @@ public class LocationLifecycleService ); // Push chosen spawn points into returned object - foreach (var spawnPoint in dynamicSpawnPoints) locationBaseClone.Loot.Add(spawnPoint); + foreach (var spawnPoint in dynamicSpawnPoints) + { + locationBaseClone.Loot.Add(spawnPoint); + } // Done generating, log results _logger.Success( @@ -352,7 +397,9 @@ public class LocationLifecycleService return locationBaseClone; } - /** Handle client/match/local/end */ + /** + * Handle client/match/local/end + */ public void EndLocalRaid(string sessionId, EndLocalRaidRequestData request) { // Clear bot loot cache @@ -418,7 +465,10 @@ public class LocationLifecycleService ); // Handle car extracts - if (ExtractWasViaCar(request.Results.ExitName)) HandleCarExtract(request.Results.ExitName, pmcProfile, sessionId); + if (ExtractWasViaCar(request.Results.ExitName)) + { + HandleCarExtract(request.Results.ExitName, pmcProfile, sessionId); + } // Handle coop exit if ( @@ -464,9 +514,15 @@ public class LocationLifecycleService protected bool ExtractWasViaCar(string extractName) { // exit name is undefined on death - if (extractName is null) return false; + if (extractName is null) + { + return false; + } - if (extractName.ToLower().Contains("v-ex")) return true; + if (extractName.ToLower().Contains("v-ex")) + { + return true; + } return _inRaidConfig.CarExtracts.Contains(extractName.Trim()); } @@ -495,7 +551,7 @@ public class LocationLifecycleService // Check if new standing has leveled up trader _traderHelper.LevelUp(fenceId, pmcData); - pmcData.TradersInfo[fenceId].LoyaltyLevel = Math.Max((int)pmcData.TradersInfo[fenceId].LoyaltyLevel, 1); + pmcData.TradersInfo[fenceId].LoyaltyLevel = Math.Max((int) pmcData.TradersInfo[fenceId].LoyaltyLevel, 1); _logger.Debug($"Car extract: {extractName} used, total times taken: {pmcData.CarExtractCounts[extractName]}"); @@ -528,7 +584,7 @@ public class LocationLifecycleService // Check if new standing has leveled up trader _traderHelper.LevelUp(fenceId, pmcData); - pmcData.TradersInfo[fenceId].LoyaltyLevel = Math.Max((int)pmcData.TradersInfo[fenceId].LoyaltyLevel, 1); + pmcData.TradersInfo[fenceId].LoyaltyLevel = Math.Max((int) pmcData.TradersInfo[fenceId].LoyaltyLevel, 1); _logger.Debug($"COOP extract: {extractName} used"); @@ -554,7 +610,7 @@ public class LocationLifecycleService fenceStanding += Math.Max(baseGain / extractCount, 0.01); // Ensure fence loyalty level is not above/below the range -7 to 15 - var newFenceStanding = Math.Min(Math.Max((double)fenceStanding, -7), 15); + var newFenceStanding = Math.Min(Math.Max((double) fenceStanding, -7), 15); _logger.Debug($"Old vs new fence standing: {pmcData.TradersInfo[fenceId].Standing}, {newFenceStanding}"); return Math.Round(newFenceStanding, 2); @@ -568,7 +624,10 @@ public class LocationLifecycleService protected bool ExtractTakenWasCoop(string extractName) { // No extract name, not a coop extract - if (extractName is null) return false; + if (extractName is null) + { + return false; + } return _inRaidConfig.CoopExtracts.Contains(extractName.Trim()); } @@ -585,7 +644,9 @@ public class LocationLifecycleService if (isTransfer) // We want scav inventory to persist into next raid when pscav is moving between maps + { _inRaidHelper.SetInventory(sessionId, scavProfile, postRaidProfile, true, isTransfer); + } scavProfile.Info.Level = request.Results.Profile.Info.Level; scavProfile.Skills = request.Results.Profile.Skills; @@ -608,18 +669,22 @@ public class LocationLifecycleService var fenceMax = _traderConfig.Fence.PlayerRepMax; // 15 var fenceMin = _traderConfig.Fence.PlayerRepMin; //-7 var currentFenceStanding = request.Results.Profile.TradersInfo[Traders.FENCE].Standing; - scavProfile.TradersInfo[Traders.FENCE].Standing = Math.Min(Math.Max((double)currentFenceStanding, fenceMin), fenceMax); + scavProfile.TradersInfo[Traders.FENCE].Standing = Math.Min(Math.Max((double) currentFenceStanding, fenceMin), fenceMax); // Successful extract as scav, give some rep if (IsPlayerSurvived(request.Results) && scavProfile.TradersInfo[Traders.FENCE].Standing < fenceMax) + { scavProfile.TradersInfo[Traders.FENCE].Standing += _inRaidConfig.ScavExtractStandingGain; + } // Copy scav fence values to PMC profile pmcProfile.TradersInfo[Traders.FENCE] = scavProfile.TradersInfo[Traders.FENCE]; if (ProfileHasConditionCounters(scavProfile)) // Scav quest progress needs to be moved to pmc so player can see it in menu / hand them in + { MigrateScavQuestProgressToPmcProfile(scavProfile, pmcProfile); + } // Must occur after encyclopedia updated MergePmcAndScavEncyclopedias(scavProfile, pmcProfile); @@ -628,7 +693,10 @@ public class LocationLifecycleService ResetSkillPointsEarnedDuringRaid(scavProfile.Skills.Common); // Scav died, regen scav loadout and reset timer - if (isDead) _playerScavGenerator.Generate(sessionId); + if (isDead) + { + _playerScavGenerator.Generate(sessionId); + } // Update last played property pmcProfile.Info.LastTimePlayedAsSavage = _timeUtil.GetTimeStamp(); @@ -663,10 +731,16 @@ public class LocationLifecycleService counter => counter.Value.SourceId == scavQuest.QId ); - if (matchingCounters is null) continue; + if (matchingCounters is null) + { + continue; + } // insert scav quest counters into pmc profile - foreach (var counter in matchingCounters) pmcProfile.TaskConditionCounters[counter.Value.Id] = counter.Value; + foreach (var counter in matchingCounters) + { + pmcProfile.TaskConditionCounters[counter.Value.Id] = counter.Value; + } // Find Matching PMC Quest // Update Status and StatusTimer properties @@ -682,13 +756,15 @@ public class LocationLifecycleService */ protected bool ProfileHasConditionCounters(PmcData profile) { - if (profile.TaskConditionCounters is null) return false; + if (profile.TaskConditionCounters is null) + { + return false; + } return profile.TaskConditionCounters.Count > 0; } /** - * * @param sessionId Player id * @param pmcProfile Pmc profile * @param scavProfile Scav profile @@ -748,7 +824,7 @@ public class LocationLifecycleService // Clamp fence standing var currentFenceStanding = postRaidProfile.TradersInfo[fenceId].Standing; pmcProfile.TradersInfo[fenceId].Standing = - Math.Min(Math.Max((double)currentFenceStanding, -7), 15); // Ensure it stays between -7 and 15 + Math.Min(Math.Max((double) currentFenceStanding, -7), 15); // Ensure it stays between -7 and 15 // Copy fence values to Scav scavProfile.TradersInfo[fenceId] = pmcProfile.TradersInfo[fenceId]; @@ -767,10 +843,14 @@ public class LocationLifecycleService if (lostQuestItems.Count > 0) // MUST occur AFTER quests have post raid quest data has been merged "processPostRaidQuests()" // Player is dead + had quest items, check and fix any broken find item quests + { CheckForAndFixPickupQuestsAfterDeath(sessionId, lostQuestItems, pmcProfile.Quests); + } if (postRaidProfile.Stats.Eft.Aggressor is not null) + { _pmcChatResponseService.SendKillerResponse(sessionId, pmcProfile, postRaidProfile.Stats.Eft.Aggressor); + } _inRaidHelper.DeleteInventory(pmcProfile, sessionId); @@ -792,7 +872,9 @@ public class LocationLifecycleService .ToList(); if (victims?.Count > 0) // Player killed PMCs, send some mail responses to them + { _pmcChatResponseService.SendVictimResponse(sessionId, victims, pmcProfile); + } HandleInsuredItemLostEvent(sessionId, pmcProfile, request, locationName); } @@ -830,7 +912,9 @@ public class LocationLifecycleService ); if (matchingCondition is null) // Quest doesnt have a matching condition + { return false; + } // We found a condition, save id for later matchingConditionId = matchingCondition.Id; @@ -852,7 +936,9 @@ public class LocationLifecycleService var profileQuestToUpdate = profileQuests.FirstOrDefault(questStatus => questStatus.QId == matchingQuest.Id); if (profileQuestToUpdate is null) // Profile doesnt have a matching quest + { continue; + } // Filter out the matching condition we found profileQuestToUpdate.CompletedConditions = profileQuestToUpdate.CompletedConditions.Where( @@ -892,6 +978,7 @@ public class LocationLifecycleService // Run server complete quest process to ensure player gets rewards foreach (var questToComplete in newlyCompletedLightkeeperQuests) + { _questHelper.CompleteQuest( pmcProfile, new CompleteQuestRequestData @@ -902,6 +989,7 @@ public class LocationLifecycleService }, sessionId ); + } } /* @@ -914,9 +1002,15 @@ public class LocationLifecycleService foreach (var failedQuest in failedQuests) { var dbQuest = _databaseService.GetQuests()[failedQuest.QId]; - if (dbQuest is null) continue; + if (dbQuest is null) + { + continue; + } - if (dbQuest.Restartable is not null) failedQuest.Status = QuestStatusEnum.Fail; + if (dbQuest.Restartable is not null) + { + failedQuest.Status = QuestStatusEnum.Fail; + } } return questsToProcess; @@ -934,11 +1028,16 @@ public class LocationLifecycleService { var serverProfileTrader = tradersServerProfile.FirstOrDefault(x => x.Key == traderId.Key).Value; var clientProfileTrader = tradersClientProfile.FirstOrDefault(x => x.Key == traderId.Key).Value; - if (serverProfileTrader is null || clientProfileTrader is null) continue; + if (serverProfileTrader is null || clientProfileTrader is null) + { + continue; + } if (clientProfileTrader.Standing != serverProfileTrader.Standing) // Difference found, update server profile with values from client profile + { tradersServerProfile[traderId.Key].Standing = clientProfileTrader.Standing; + } } } @@ -959,11 +1058,17 @@ public class LocationLifecycleService List? itemsToSend = null; // if rootId doesnt exist in TransferItems, skip - if (!request?.TransferItems?.TryGetValue(rootId, out itemsToSend) ?? false) continue; + if (!request?.TransferItems?.TryGetValue(rootId, out itemsToSend) ?? false) + { + continue; + } // Filter out the btr container item from transferred items before delivering itemsToSend = itemsToSend?.Where(item => item.Id != Traders.BTR).ToList(); - if (itemsToSend?.Count == 0) continue; + if (itemsToSend?.Count == 0) + { + continue; + } TransferItemDelivery(sessionId, Traders.BTR, itemsToSend); } @@ -1026,7 +1131,10 @@ public class LocationLifecycleService ); // Is possible to have items in lostInsuredItems but removed before reaching mappedItems - if (mappedItems.Count == 0) return; + if (mappedItems.Count == 0) + { + return; + } _insuranceService.StoreGearLostInRaidToSendLater(sessionId, mappedItems); @@ -1067,8 +1175,12 @@ public class LocationLifecycleService // Get an array of root player items foreach (var item in items) + { if (inventorySlots.Contains(item.SlotId)) + { inventoryItems.Add(item); + } + } // Loop through these items and get all of their children var newItems = inventoryItems; @@ -1079,8 +1191,12 @@ public class LocationLifecycleService foreach (var item in newItems) // Find children of this item foreach (var newItem in items) + { if (newItem.ParentId == item.Id) + { foundItems.Add(newItem); + } + } // Add these new found items to our list of inventory items inventoryItems.AddRange(inventoryItems); @@ -1128,7 +1244,10 @@ public class LocationLifecycleService */ protected void ResetSkillPointsEarnedDuringRaid(List commonSkills) { - foreach (var skill in commonSkills) skill.PointsEarnedDuringSession = 0; + foreach (var skill in commonSkills) + { + skill.PointsEarnedDuringSession = 0; + } } /* @@ -1164,11 +1283,13 @@ public class LocationLifecycleService // 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) + achievementsDb.FirstOrDefault(achievementDb => achievementDb.Id == achievementId.Key) ); if (achievements is null) // No achievements found + { return; + } foreach (var achievement in achievements) { @@ -1181,6 +1302,7 @@ public class LocationLifecycleService ); if (rewardItems?.Count > 0) + { _mailSendService.SendLocalisedSystemMessageToPlayer( sessionId, "670547bb5fa0b1a7c30d5836 0", @@ -1188,6 +1310,7 @@ public class LocationLifecycleService [], _timeUtil.GetHoursAsSeconds(24 * 7) ); + } } } } diff --git a/Libraries/Core/Services/MailSendService.cs b/Libraries/Core/Services/MailSendService.cs index c7909ee6..7ea135c3 100644 --- a/Libraries/Core/Services/MailSendService.cs +++ b/Libraries/Core/Services/MailSendService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; @@ -8,6 +7,7 @@ using Core.Models.Utils; using Core.Servers; using Core.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; namespace Core.Services; @@ -58,8 +58,8 @@ public class MailSendService( "mailsend-missing_trader", new { - messageType = messageType, - sessionId = sessionId + messageType, + sessionId } ) ); @@ -85,10 +85,14 @@ public class MailSendService( } if (systemData is not null) + { details.SystemData = systemData; + } if (ragfair is not null) + { details.RagfairDetails = ragfair; + } SendMessageToPlayer(details); } @@ -120,8 +124,8 @@ public class MailSendService( "mailsend-missing_trader", new { - messageType = messageType, - sessionId = sessionId + messageType, + sessionId } ) ); @@ -145,16 +149,24 @@ public class MailSendService( { details.Items.AddRange(items); if (maxStorageTimeSeconds is not null && maxStorageTimeSeconds > 0) + { details.ItemsMaxStorageLifetimeSeconds = maxStorageTimeSeconds; + } else + { details.ItemsMaxStorageLifetimeSeconds = 172800; + } } if (systemData is not null) + { details.SystemData = systemData; + } if (ragfair is not null) + { details.RagfairDetails = ragfair; + } SendMessageToPlayer(details); } @@ -191,7 +203,9 @@ public class MailSendService( } if ((profileChangeEvents?.Count ?? 0) > 0) + { details.ProfileChangeEvents = profileChangeEvents; + } SendMessageToPlayer(details); } @@ -220,7 +234,9 @@ public class MailSendService( } if ((profileChangeEvents?.Count ?? 0) > 0) + { details.ProfileChangeEvents = profileChangeEvents; + } SendMessageToPlayer(details); } @@ -281,13 +297,18 @@ public class MailSendService( var itemsToSendToPlayer = ProcessItemsBeforeAddingToMail(senderDialog.Type, messageDetails); // If there's items to send to player, flag dialog as containing attachments - if ((itemsToSendToPlayer.Data?.Count ?? 0) > 0) senderDialog.AttachmentsNew += 1; + if ((itemsToSendToPlayer.Data?.Count ?? 0) > 0) + { + senderDialog.AttachmentsNew += 1; + } // Store reward items inside message and set appropriate flags inside message AddRewardItemsToMessage(message, itemsToSendToPlayer, messageDetails.ItemsMaxStorageLifetimeSeconds); if (messageDetails.ProfileChangeEvents is not null) + { message.ProfileChangeEvents = messageDetails.ProfileChangeEvents; + } // Add message to dialog senderDialog.Messages.Add(message); @@ -355,18 +376,21 @@ public class MailSendService( if (messageDetails.ReplyTo is not null) { var replyMessage = GetMessageToReplyTo(messageDetails.RecipientId, messageDetails.ReplyTo, dialogId); - if (replyMessage is not null) message.ReplyTo = replyMessage; + if (replyMessage is not null) + { + message.ReplyTo = replyMessage; + } } return message; } /** - * @param recipientId The id of the recipient - * @param replyToId The id of the message to reply to - * @param dialogueId The id of the dialogue (traderId or profileId) - * @returns A new instance with data from the found message, otherwise undefined - */ + * @param recipientId The id of the recipient + * @param replyToId The id of the message to reply to + * @param dialogueId The id of the dialogue (traderId or profileId) + * @returns A new instance with data from the found message, otherwise undefined + */ protected ReplyTo? GetMessageToReplyTo(string recipientId, string replyToId, string dialogueId) { var currentDialogue = _dialogueHelper.GetDialogueFromProfile(recipientId, dialogueId); @@ -378,7 +402,10 @@ public class MailSendService( } var messageToReplyTo = currentDialogue.Messages?.FirstOrDefault(message => message.Id == replyToId); - if (messageToReplyTo is null) return null; + if (messageToReplyTo is null) + { + return null; + } return new ReplyTo { @@ -432,12 +459,15 @@ public class MailSendService( // No parent id, generate random id and add (doesn't need to be actual parentId from db, only unique) if (parentItem?.ParentId is null) + { parentItem.ParentId = _hashUtil.Generate(); + } // Prep return object itemsToSendToPlayer = new MessageItems { - Stash = parentItem.ParentId, Data = new List() + Stash = parentItem.ParentId, + Data = new List() }; // Ensure Ids are unique and cont collide with items in player inventory later @@ -475,11 +505,14 @@ public class MailSendService( if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.AMMO_BOX)) { // look for child cartridge objects - var childItems = itemsToSendToPlayer.Data?.Where((x) => x.ParentId == reward.Id); + var childItems = itemsToSendToPlayer.Data?.Where(x => x.ParentId == reward.Id); if (childItems is null || !childItems.Any()) { // No cartridges found, generate and add to rewards - var boxAndCartridges = new List { reward }; + var boxAndCartridges = new List + { + reward + }; _itemHelper.AddCartridgesToAmmoBox(boxAndCartridges, itemTemplate); // Push box + cartridge children into array @@ -494,7 +527,9 @@ public class MailSendService( else { if (itemTemplate.Properties.StackSlots is not null) + { _logger.Error(_localisationService.GetText("mail-unable_to_give_gift_not_handled", itemTemplate.Id)); + } // Item is sanitised and ready to be pushed into holding array itemsToSendToPlayer.Data.Add(reward); @@ -518,18 +553,24 @@ public class MailSendService( { // Only one item in reward, return it if (items?.Count == 1) + { return items[0]; + } // Find first item with slotId that indicates its a 'base' item var item = items.FirstOrDefault(x => _slotNames.Contains(x.SlotId ?? "")); if (item is not null) + { return item; + } // Not a singlular item + no items have a hideout/main slotid // Look for first item without parent id item = items.FirstOrDefault(x => x.ParentId is null); if (item is not null) + { return item; + } // Just return first item in array return items[0]; @@ -544,13 +585,17 @@ public class MailSendService( private Dialogue GetDialog(SendMessageDetails messageDetails) { var senderId = GetMessageSenderIdByType(messageDetails); - if (senderId is null) throw new Exception(_localisationService.GetText("mail-unable_to_find_message_sender_by_id", messageDetails.Sender)); + if (senderId is null) + { + throw new Exception(_localisationService.GetText("mail-unable_to_find_message_sender_by_id", messageDetails.Sender)); + } var dialogsInProfile = _dialogueHelper.GetDialogsForProfile(messageDetails.RecipientId); // Does dialog exist if (!dialogsInProfile.ContainsKey(senderId)) // Doesn't exist, create + { dialogsInProfile[senderId] = new Dialogue { Id = senderId, @@ -560,6 +605,7 @@ public class MailSendService( New = 0, AttachmentsNew = 0 }; + } return dialogsInProfile[senderId]; } @@ -572,19 +618,29 @@ public class MailSendService( private string? GetMessageSenderIdByType(SendMessageDetails messageDetails) { if (messageDetails.Sender == MessageType.SYSTEM_MESSAGE) + { return _systemSenderId; + } if (messageDetails.Sender == MessageType.NPC_TRADER || messageDetails.DialogType == MessageType.NPC_TRADER) + { return messageDetails.Trader is not null ? _traderHelper.GetValidTraderIdByEnumValue(messageDetails.Trader) : null; + } if (messageDetails.Sender == MessageType.USER_MESSAGE) + { return messageDetails.SenderDetails?.Id; + } if (messageDetails.SenderDetails?.Id is not null) + { return messageDetails.SenderDetails.Id; + } if (messageDetails.Trader is not null) + { return _traderHelper.GetValidTraderIdByEnumValue(messageDetails.Trader); + } _logger.Warning($"Unable to handle message of type: {messageDetails.Sender}"); return null; diff --git a/Libraries/Core/Services/MapMarkerService.cs b/Libraries/Core/Services/MapMarkerService.cs index 10ccc85b..ee682cc4 100644 --- a/Libraries/Core/Services/MapMarkerService.cs +++ b/Libraries/Core/Services/MapMarkerService.cs @@ -1,9 +1,9 @@ using System.Text.RegularExpressions; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Inventory; using Core.Models.Utils; +using SptCommon.Annotations; namespace Core.Services; @@ -13,7 +13,7 @@ public class MapMarkerService( ) { /// - /// Add note to a map item in player inventory + /// Add note to a map item in player inventory /// /// Player profile /// Add marker request @@ -21,10 +21,14 @@ public class MapMarkerService( public Item CreateMarkerOnMap(PmcData pmcData, InventoryCreateMarkerRequestData request) { // Get map from inventory - var mapItem = pmcData?.Inventory?.Items?.FirstOrDefault((i) => i?.Id == request?.Item); + var mapItem = pmcData?.Inventory?.Items?.FirstOrDefault(i => i?.Id == request?.Item); // add marker to map item - mapItem.Upd.Map = mapItem?.Upd?.Map ?? new UpdMap { Markers = new List() }; + mapItem.Upd.Map = mapItem?.Upd?.Map ?? + new UpdMap + { + Markers = new List() + }; // Update request note with text, then add to maps upd request.MapMarker.Note = SanitiseMapMarkerText(request.MapMarker.Note); @@ -34,7 +38,7 @@ public class MapMarkerService( } /// - /// Delete a map marker + /// Delete a map marker /// /// Player profile /// Delete marker request @@ -42,17 +46,23 @@ public class MapMarkerService( public Item DeleteMarkerFromMap(PmcData pmcData, InventoryDeleteMarkerRequestData request) { // Get map from inventory - var mapItem = pmcData.Inventory.Items.FirstOrDefault((item) => item.Id == request.Item); + var mapItem = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item); // remove marker - var markers = mapItem.Upd.Map.Markers.Where((marker) => { return marker.X != request.X && marker.Y != request.Y; }).ToList(); + var markers = mapItem.Upd.Map.Markers.Where( + marker => + { + return marker.X != request.X && marker.Y != request.Y; + } + ) + .ToList(); mapItem.Upd.Map.Markers = markers; return mapItem; } /// - /// Edit an existing map marker + /// Edit an existing map marker /// /// Player profile /// Edit marker request @@ -60,7 +70,7 @@ public class MapMarkerService( public Item? EditMarkerOnMap(PmcData pmcData, InventoryEditMarkerRequestData request) { // Get map from inventory - var mapItem = pmcData.Inventory.Items.FirstOrDefault((item) => item.Id == request.Item); + var mapItem = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item); // edit marker // the only thing that is consistent between the old and edit is the X and Y @@ -81,7 +91,7 @@ public class MapMarkerService( } /// - /// Strip out characters from note string that are not: letter/numbers/unicode/spaces + /// Strip out characters from note string that are not: letter/numbers/unicode/spaces /// /// Marker text to sanitise /// Sanitised map marker text diff --git a/Libraries/Core/Services/MatchBotDetailsCacheService.cs b/Libraries/Core/Services/MatchBotDetailsCacheService.cs index 7dff51ab..3f090baa 100644 --- a/Libraries/Core/Services/MatchBotDetailsCacheService.cs +++ b/Libraries/Core/Services/MatchBotDetailsCacheService.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Utils; +using SptCommon.Annotations; namespace Core.Services; diff --git a/Libraries/Core/Services/MatchLocationService.cs b/Libraries/Core/Services/MatchLocationService.cs index 78080cca..df2089d8 100644 --- a/Libraries/Core/Services/MatchLocationService.cs +++ b/Libraries/Core/Services/MatchLocationService.cs @@ -9,7 +9,7 @@ public class MatchLocationService protected Dictionary _locations = new(); /// - /// DisbandRaidGroup + /// DisbandRaidGroup /// /// public void DeleteGroup(DeleteGroupRequest request) @@ -30,12 +30,20 @@ public class MatchLocationService public class MatchGroup { [JsonPropertyName("groups")] - public List Groups { get; set; } + public List Groups + { + get; + set; + } } public class DeleteGroupRequest { [JsonPropertyName("groupId")] - public string GroupId { get; set; } + public string GroupId + { + get; + set; + } } } diff --git a/Libraries/Core/Services/Mod/CustomItemService.cs b/Libraries/Core/Services/Mod/CustomItemService.cs index 5c4e2627..0bdbcb08 100644 --- a/Libraries/Core/Services/Mod/CustomItemService.cs +++ b/Libraries/Core/Services/Mod/CustomItemService.cs @@ -67,7 +67,10 @@ public class CustomItemService( _itemBaseClassService.HydrateItemBaseClassCache(); - if (_itemHelper.IsOfBaseclass(itemClone.Id, BaseClasses.WEAPON)) AddToWeaponShelf(newItemId); + if (_itemHelper.IsOfBaseclass(itemClone.Id, BaseClasses.WEAPON)) + { + AddToWeaponShelf(newItemId); + } result.Success = true; result.ItemId = newItemId; @@ -108,7 +111,10 @@ public class CustomItemService( _itemBaseClassService.HydrateItemBaseClassCache(); - if (_itemHelper.IsOfBaseclass(newItem.Id, BaseClasses.WEAPON)) AddToWeaponShelf(newItem.Id); + if (_itemHelper.IsOfBaseclass(newItem.Id, BaseClasses.WEAPON)) + { + AddToWeaponShelf(newItem.Id); + } result.ItemId = newItemDetails.NewItem.Id; result.Success = true; @@ -135,7 +141,9 @@ public class CustomItemService( protected void UpdateBaseItemPropertiesWithOverrides(Props? overrideProperties, TemplateItem itemClone) { foreach (var propKey in overrideProperties.GetAllPropsAsDict()) + { itemClone.Properties.GetAllPropsAsDict()[propKey.Key] = overrideProperties.GetAllPropsAsDict()[propKey.Key]; + } } /** @@ -145,7 +153,10 @@ public class CustomItemService( */ protected void AddToItemsDb(string newItemId, TemplateItem itemToAdd) { - if (!_databaseService.GetItems().TryAdd(newItemId, itemToAdd)) _logger.Warning($"Unable to add: {newItemId} To Database"); + if (!_databaseService.GetItems().TryAdd(newItemId, itemToAdd)) + { + _logger.Warning($"Unable to add: {newItemId} To Database"); + } } /** @@ -158,7 +169,14 @@ public class CustomItemService( { _databaseService .GetTemplates() - .Handbook.Items.Add(new HandbookItem { Id = newItemId, ParentId = parentId, Price = priceRoubles }); + .Handbook.Items.Add( + new HandbookItem + { + Id = newItemId, + ParentId = parentId, + Price = priceRoubles + } + ); // TODO: would we want to keep this the same or get them to send a HandbookItem } @@ -168,7 +186,7 @@ public class CustomItemService( * e.g. * en[0] * fr[1] - * + * * No jp provided, so english will be used as a substitute * @param localeDetails key is language, value are the new locale details * @param newItemId id of the item being created @@ -181,7 +199,10 @@ public class CustomItemService( // Get locale details passed in, if not provided by caller use first record in newItemDetails.locales localeDetails.TryGetValue(shortNameKey.Key, out var newLocaleDetails); - if (newLocaleDetails is null) newLocaleDetails = localeDetails[localeDetails.Keys.FirstOrDefault()]; + if (newLocaleDetails is null) + { + newLocaleDetails = localeDetails[localeDetails.Keys.FirstOrDefault()]; + } // Create new record in locale file var globals = _databaseService.GetLocales(); @@ -217,7 +238,10 @@ public class CustomItemService( foreach (var wallId in wallStashIds) { var wall = _itemHelper.GetItem(wallId); - if (wall.Key) wall.Value.Properties.Grids[0].Props.Filters[0].Filter.Add(newItemId); + if (wall.Key) + { + wall.Value.Properties.Grids[0].Props.Filters[0].Filter.Add(newItemId); + } } } @@ -241,7 +265,10 @@ public class CustomItemService( // Get all slots weapon has and create a dictionary of them with possible mods that slot into each var weaponSlots = weapon.Value.Properties.Slots; - foreach (var slot in weaponSlots) baseWeaponModObject[slot.Name] = new HashSet(slot.Props.Filters[0].Filter); + foreach (var slot in weaponSlots) + { + baseWeaponModObject[slot.Name] = new HashSet(slot.Props.Filters[0].Filter); + } // Get PMCs var botTypes = _databaseService.GetBots().Types; diff --git a/Libraries/Core/Services/NotificationService.cs b/Libraries/Core/Services/NotificationService.cs index 6e2fe5c9..81593563 100644 --- a/Libraries/Core/Services/NotificationService.cs +++ b/Libraries/Core/Services/NotificationService.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; using Core.Models.Eft.Ws; +using SptCommon.Annotations; namespace Core.Services; @@ -20,7 +20,10 @@ public class NotificationService public void UpdateMessageOnQueue(string sessionId, List value) { - if (_messageQueue.ContainsKey(sessionId)) _messageQueue[sessionId] = value; + if (_messageQueue.ContainsKey(sessionId)) + { + _messageQueue[sessionId] = value; + } } public bool Has(string sessionID) @@ -29,7 +32,7 @@ public class NotificationService } /// - /// Pop first message from queue. + /// Pop first message from queue. /// public WsNotificationEvent Pop(string sessionID) { @@ -39,7 +42,7 @@ public class NotificationService } /// - /// Add message to queue + /// Add message to queue /// public void Add(string sessionID, WsNotificationEvent message) { @@ -47,14 +50,20 @@ public class NotificationService } /// - /// Get message queue for session + /// Get message queue for session /// /// public List Get(string sessionID) { - if (sessionID is null) throw new Exception("sessionID missing"); + if (sessionID is null) + { + throw new Exception("sessionID missing"); + } - if (!_messageQueue.ContainsKey(sessionID)) _messageQueue[sessionID] = []; + if (!_messageQueue.ContainsKey(sessionID)) + { + _messageQueue[sessionID] = []; + } return _messageQueue[sessionID]; } diff --git a/Libraries/Core/Services/OpenZoneService.cs b/Libraries/Core/Services/OpenZoneService.cs index ac4349a8..38ecfe24 100644 --- a/Libraries/Core/Services/OpenZoneService.cs +++ b/Libraries/Core/Services/OpenZoneService.cs @@ -24,7 +24,10 @@ public class OpenZoneService( { _locationConfig.OpenZones.TryAdd(locationId, []); - if (!_locationConfig.OpenZones[locationId].Contains(zoneToAdd)) _locationConfig.OpenZones[locationId].Add(zoneToAdd); + if (!_locationConfig.OpenZones[locationId].Contains(zoneToAdd)) + { + _locationConfig.OpenZones[locationId].Add(zoneToAdd); + } } /// diff --git a/Libraries/Core/Services/PaymentService.cs b/Libraries/Core/Services/PaymentService.cs index 5edea5da..babe1ac7 100644 --- a/Libraries/Core/Services/PaymentService.cs +++ b/Libraries/Core/Services/PaymentService.cs @@ -1,5 +1,4 @@ using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Inventory; @@ -10,6 +9,7 @@ using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -51,7 +51,7 @@ public class PaymentService( foreach (var itemRequest in request.SchemeItems) { // Find the corresponding item in the player's inventory. - var item = pmcData.Inventory.Items.FirstOrDefault((i) => i.Id == itemRequest.Id); + var item = pmcData.Inventory.Items.FirstOrDefault(i => i.Id == itemRequest.Id); if (item is not null) { if (!_paymentHelper.IsMoneyTpl(item.Template)) @@ -60,7 +60,7 @@ public class PaymentService( _inventoryHelper.RemoveItemByCount( pmcData, item.Id, - (int)itemRequest.Count, + (int) itemRequest.Count, sessionID, output ); @@ -87,7 +87,10 @@ public class PaymentService( // Loop through each type of currency involved in the trade. foreach (var currencyTpl in currencyAmounts) { - if (currencyTpl.Value <= 0) continue; + if (currencyTpl.Value <= 0) + { + continue; + } var currencyAmount = currencyTpl.Value; totalCurrencyAmount += currencyAmount.Value; @@ -96,7 +99,10 @@ public class PaymentService( AddPaymentToOutput(pmcData, currencyTpl.Key, currencyAmount.Value, sessionID, output); // If there are warnings, exit early. - if (output.Warnings?.Count > 0) return; + if (output.Warnings?.Count > 0) + { + return; + } if (payToTrader) { @@ -125,15 +131,24 @@ public class PaymentService( pmcData.TradersInfo[request.TransactionId].SalesSum += costOfPurchaseInCurrency; } - if (payToTrader) _traderHelper.LevelUp(request.TransactionId, pmcData); + if (payToTrader) + { + _traderHelper.LevelUp(request.TransactionId, pmcData); + } - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Item(s) taken. Status OK."); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Item(s) taken. Status OK."); + } } private double? GetTraderItemHandbookPriceRouble(string? traderAssortId, string traderId) { var purchasedAssortItem = _traderHelper.GetTraderAssortItemByAssortId(traderId, traderAssortId); - if (purchasedAssortItem is null) return 1; + if (purchasedAssortItem is null) + { + return 1; + } var assortItemPriceRouble = _handbookHelper.GetTemplatePrice(purchasedAssortItem.Template); if (assortItemPriceRouble == 0) @@ -172,10 +187,16 @@ public class PaymentService( foreach (var item in pmcData.Inventory.Items) { // Item is not currency - if (item.Template != currencyTpl) continue; + if (item.Template != currencyTpl) + { + continue; + } // Item is not in the stash - if (!_inventoryHelper.IsItemInStash(pmcData, item)) continue; + if (!_inventoryHelper.IsItemInStash(pmcData, item)) + { + continue; + } // Found currency item if (item.Upd.StackObjectsCount < currencyMaxStackSize) @@ -183,7 +204,7 @@ public class PaymentService( if (item.Upd.StackObjectsCount + calcAmount > currencyMaxStackSize) { // calculate difference - calcAmount -= (int)(currencyMaxStackSize - item.Upd.StackObjectsCount ?? 0); + calcAmount -= (int) (currencyMaxStackSize - item.Upd.StackObjectsCount ?? 0); item.Upd.StackObjectsCount = currencyMaxStackSize; } else @@ -195,7 +216,10 @@ public class PaymentService( // Inform client of change to items StackObjectsCount output.ProfileChanges[sessionID].Items.ChangedItems.Add(item); - if (skipSendingMoneyToStash) break; + if (skipSendingMoneyToStash) + { + break; + } } } @@ -204,7 +228,10 @@ public class PaymentService( { Id = _hashUtil.Generate(), Template = currencyTpl, - Upd = new Upd { StackObjectsCount = Math.Round((double)calcAmount) } + Upd = new Upd + { + StackObjectsCount = Math.Round((double) calcAmount) + } }; // Ensure money is properly split to follow its max stack size limit @@ -252,11 +279,17 @@ public class PaymentService( ); //Ensure all money items found have a upd - foreach (var moneyStack in moneyItemsInInventory) moneyStack.Upd ??= new Upd { StackObjectsCount = 1 }; + foreach (var moneyStack in moneyItemsInInventory) + { + moneyStack.Upd ??= new Upd + { + StackObjectsCount = 1 + }; + } var amountAvailable = moneyItemsInInventory.Aggregate( 0d, - (accumulator, item) => (accumulator + item.Upd.StackObjectsCount.Value) + (accumulator, item) => accumulator + item.Upd.StackObjectsCount.Value ); // If no money in inventory or amount is not enough we return false @@ -267,8 +300,8 @@ public class PaymentService( "payment-not_enough_money_to_complete_transation", // Typo, needs locale updated if fixed new { - amountToPay = amountToPay, - amountAvailable = amountAvailable + amountToPay, + amountAvailable } ) ); @@ -297,7 +330,10 @@ public class PaymentService( output.ProfileChanges[sessionID].Items.ChangedItems.Add(profileMoneyItem); } - if (leftToPay == 0) break; + if (leftToPay == 0) + { + break; + } } } @@ -312,7 +348,10 @@ public class PaymentService( protected List GetSortedMoneyItemsInInventory(PmcData pmcData, string currencyTpl, string playerStashId) { var moneyItemsInInventory = _itemHelper.FindBarterItems("tpl", pmcData.Inventory.Items, currencyTpl); - if (moneyItemsInInventory.Count == 0) _logger.Debug($"No {currencyTpl} money items found in inventory"); + if (moneyItemsInInventory.Count == 0) + { + _logger.Debug($"No {currencyTpl} money items found in inventory"); + } // Prioritise items in stash to top of array moneyItemsInInventory.Sort((a, b) => PrioritiseStashSort(a, b, pmcData.Inventory.Items, playerStashId)); @@ -332,10 +371,16 @@ public class PaymentService( protected int PrioritiseStashSort(Item a, Item b, List inventoryItems, string playerStashId) { // a in root of stash, prioritise - if (a.ParentId == playerStashId && b.ParentId != playerStashId) return -1; + if (a.ParentId == playerStashId && b.ParentId != playerStashId) + { + return -1; + } // b in root stash, prioritise - if (a.ParentId != playerStashId && b.ParentId == playerStashId) return 1; + if (a.ParentId != playerStashId && b.ParentId == playerStashId) + { + return 1; + } // both in containers if (a.SlotId == "main" && b.SlotId == "main") @@ -345,32 +390,42 @@ public class PaymentService( var bInStash = IsInStash(b.ParentId, inventoryItems, playerStashId); // a in stash in container, prioritise - if (aInStash && !bInStash) return -1; + if (aInStash && !bInStash) + { + return -1; + } // b in stash in container, prioritise - if (!aInStash && bInStash) return 1; + if (!aInStash && bInStash) + { + return 1; + } // Both in stash in containers if (aInStash && bInStash) { // Containers where taking money from would inconvinence player var deprioritisedContainers = _inventoryConfig.DeprioritisedMoneyContainers; - var aImmediateParent = inventoryItems.FirstOrDefault((item) => item.Id == a.ParentId); - var bImmediateParent = inventoryItems.FirstOrDefault((item) => item.Id == b.ParentId); + var aImmediateParent = inventoryItems.FirstOrDefault(item => item.Id == a.ParentId); + var bImmediateParent = inventoryItems.FirstOrDefault(item => item.Id == b.ParentId); // A is not a deprioritised container, B is if ( !deprioritisedContainers.Contains(aImmediateParent.Template) && deprioritisedContainers.Contains(bImmediateParent.Template) ) + { return -1; + } // B is not a deprioritised container, A is if ( deprioritisedContainers.Contains(aImmediateParent.Template) && !deprioritisedContainers.Contains(bImmediateParent.Template) ) + { return 1; + } } } @@ -387,13 +442,19 @@ public class PaymentService( */ protected bool IsInStash(string itemId, List inventoryItems, string playerStashId) { - var itemParent = inventoryItems.FirstOrDefault((item) => item.Id == itemId); + var itemParent = inventoryItems.FirstOrDefault(item => item.Id == itemId); if (itemParent is not null) { - if (itemParent.SlotId == "hideout") return true; + if (itemParent.SlotId == "hideout") + { + return true; + } - if (itemParent.Id == playerStashId) return true; + if (itemParent.Id == playerStashId) + { + return true; + } return IsInStash(itemParent.ParentId, inventoryItems, playerStashId); } diff --git a/Libraries/Core/Services/PlayerService.cs b/Libraries/Core/Services/PlayerService.cs index a6baae99..8a58a826 100644 --- a/Libraries/Core/Services/PlayerService.cs +++ b/Libraries/Core/Services/PlayerService.cs @@ -22,7 +22,10 @@ public class PlayerService( { accExp += expTable[i].Experience ?? 0; - if (pmcData.Info.Experience < accExp) break; + if (pmcData.Info.Experience < accExp) + { + break; + } pmcData.Info.Level = i + 1; } diff --git a/Libraries/Core/Services/PmcChatResponseService.cs b/Libraries/Core/Services/PmcChatResponseService.cs index 2006eef4..fa3b01c0 100644 --- a/Libraries/Core/Services/PmcChatResponseService.cs +++ b/Libraries/Core/Services/PmcChatResponseService.cs @@ -1,14 +1,14 @@ using System.Text.RegularExpressions; -using SptCommon.Annotations; +using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; +using Core.Models.Enums; +using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; -using Core.Helpers; -using Core.Models.Enums; -using Core.Models.Spt.Config; +using SptCommon.Annotations; namespace Core.Services; @@ -26,8 +26,8 @@ public class PmcChatResponseService( MatchBotDetailsCacheService _matchBotDetailsCacheService, ConfigServer _configServer) { - protected PmcChatResponse _pmcResponsesConfig = _configServer.GetConfig(); protected GiftsConfig _giftConfig = _configServer.GetConfig(); + 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 @@ -39,7 +39,10 @@ public class PmcChatResponseService( { foreach (var victim in pmcVictims) { - if (!_randomUtil.GetChance100(_pmcResponsesConfig.Victim.ResponseChancePercent)) continue; + if (!_randomUtil.GetChance100(_pmcResponsesConfig.Victim.ResponseChancePercent)) + { + continue; + } if (string.IsNullOrEmpty(victim.Name)) { @@ -51,12 +54,14 @@ public class PmcChatResponseService( var victimDetails = GetVictimDetails(victim); var message = ChooseMessage(true, pmcData, victim); if (message is not null) + { _notificationSendHelper.SendMessageToPlayer( sessionId, victimDetails, message, MessageType.USER_MESSAGE ); + } } } @@ -68,17 +73,33 @@ public class PmcChatResponseService( */ public void SendKillerResponse(string sessionId, PmcData pmcData, Aggressor killer) { - if (killer is null) return; + if (killer is null) + { + return; + } - if (!_randomUtil.GetChance100(_pmcResponsesConfig.Killer.ResponseChancePercent)) return; + if (!_randomUtil.GetChance100(_pmcResponsesConfig.Killer.ResponseChancePercent)) + { + return; + } // find bot by name in cache var killerDetailsInCache = _matchBotDetailsCacheService.GetBotByNameAndSide(killer.Name, killer.Side); - if (killerDetailsInCache is null) return; + if (killerDetailsInCache is null) + { + return; + } // If killer wasn't a PMC, skip - var pmcTypes = new List { "pmcUSEC", "pmcBEAR" }; - if (!pmcTypes.Contains(killerDetailsInCache.Info.Settings.Role)) return; + var pmcTypes = new List + { + "pmcUSEC", + "pmcBEAR" + }; + if (!pmcTypes.Contains(killerDetailsInCache.Info.Settings.Role)) + { + return; + } var killerDetails = new UserDialogInfo { @@ -95,7 +116,10 @@ public class PmcChatResponseService( }; var message = ChooseMessage(false, pmcData); - if (message is null) return; + if (message is null) + { + return; + } _notificationSendHelper.SendMessageToPlayer(sessionId, killerDetails, message, MessageType.USER_MESSAGE); } @@ -148,9 +172,15 @@ public class PmcChatResponseService( responseText += $"{suffixText}"; } - if (StripCapitalisation(isVictim)) responseText = responseText.ToLower(); + if (StripCapitalisation(isVictim)) + { + responseText = responseText.ToLower(); + } - if (AllCaps(isVictim)) responseText = responseText.ToUpper(); + if (AllCaps(isVictim)) + { + responseText = responseText.ToUpper(); + } return responseText; } @@ -233,7 +263,7 @@ public class PmcChatResponseService( var keyBase = isVictim ? "pmcresponse-victim_" : "pmcresponse-killer_"; var keys = _localisationService.GetKeys(); - return keys.Where((x) => x.StartsWith($"{keyBase}{keyType}")).ToList(); + return keys.Where(x => x.StartsWith($"{keyBase}{keyType}")).ToList(); } /** @@ -244,7 +274,7 @@ public class PmcChatResponseService( { var keys = _localisationService.GetKeys(); - return keys.Where((x) => x.StartsWith("pmcresponse-suffix")).ToList(); + return keys.Where(x => x.StartsWith("pmcresponse-suffix")).ToList(); } /** diff --git a/Libraries/Core/Services/PostDbLoadService.cs b/Libraries/Core/Services/PostDbLoadService.cs index ecc461da..e72ea920 100644 --- a/Libraries/Core/Services/PostDbLoadService.cs +++ b/Libraries/Core/Services/PostDbLoadService.cs @@ -23,13 +23,13 @@ public class PostDbLoadService( ConfigServer _configServer, ICloner _cloner) { + protected BotConfig _botConfig = _configServer.GetConfig(); + protected CoreConfig _coreConfig = _configServer.GetConfig(); protected HideoutConfig _hideoutConfig = _configServer.GetConfig(); + protected ItemConfig _itemConfig = _configServer.GetConfig(); protected LocationConfig _locationConfig = _configServer.GetConfig(); protected LootConfig _lootConfig = _configServer.GetConfig(); - protected BotConfig _botConfig = _configServer.GetConfig(); - protected ItemConfig _itemConfig = _configServer.GetConfig(); protected RagfairConfig _ragfairConfig = _configServer.GetConfig(); - protected CoreConfig _coreConfig = _configServer.GetConfig(); public void PerformPostDbLoadActions() { @@ -42,25 +42,43 @@ public class PostDbLoadService( // Kill the startup if not. // TODO: We can probably remove this in a couple versions _databaseService.ValidateDatabase(); - if (!_databaseService.IsDatabaseValid()) throw new Exception("Server start failure, database invalid"); + if (!_databaseService.IsDatabaseValid()) + { + throw new Exception("Server start failure, database invalid"); + } AddCustomLooseLootPositions(); AdjustMinReserveRaiderSpawnChance(); - if (_coreConfig.Fixes.FixShotgunDispersion) FixShotgunDispersions(); + if (_coreConfig.Fixes.FixShotgunDispersion) + { + FixShotgunDispersions(); + } - if (_locationConfig.AddOpenZonesToAllMaps) _openZoneService.ApplyZoneChangesToAllMaps(); + if (_locationConfig.AddOpenZonesToAllMaps) + { + _openZoneService.ApplyZoneChangesToAllMaps(); + } - if (_locationConfig.AddCustomBotWavesToMaps) _customLocationWaveService.ApplyWaveChangesToAllMaps(); + if (_locationConfig.AddCustomBotWavesToMaps) + { + _customLocationWaveService.ApplyWaveChangesToAllMaps(); + } - if (_locationConfig.EnableBotTypeLimits) AdjustMapBotLimits(); + if (_locationConfig.EnableBotTypeLimits) + { + AdjustMapBotLimits(); + } AdjustLooseLootSpawnProbabilities(); AdjustLocationBotValues(); - if (_locationConfig.RogueLighthouseSpawnTimeSettings.Enabled) FixRoguesSpawningInstantlyOnLighthouse(); + if (_locationConfig.RogueLighthouseSpawnTimeSettings.Enabled) + { + FixRoguesSpawningInstantlyOnLighthouse(); + } AdjustLabsRaiderSpawnRate(); @@ -82,7 +100,10 @@ public class PostDbLoadService( } // Flea bsg blacklist is off - if (!_ragfairConfig.Dynamic.Blacklist.EnableBsgList) SetAllDbItemsAsSellableOnFlea(); + if (!_ragfairConfig.Dynamic.Blacklist.EnableBsgList) + { + SetAllDbItemsAsSellableOnFlea(); + } AddMissingTraderBuyRestrictionMaxValue(); @@ -101,7 +122,7 @@ public class PostDbLoadService( foreach (var craftToAdd in craftsToAdd) { var clonedCraft = _cloner.Clone( - hideoutCraftDb.Recipes.FirstOrDefault((x) => x.Id == craftToAdd.CraftIdToCopy) + hideoutCraftDb.Recipes.FirstOrDefault(x => x.Id == craftToAdd.CraftIdToCopy) ); clonedCraft.Id = _hashUtil.Generate(); clonedCraft.Requirements = craftToAdd.Requirements; @@ -117,18 +138,23 @@ public class PostDbLoadService( var reserveBase = _databaseService.GetLocation(ELocationName.RezervBase.ToString()).Base; // Raiders are bosses, get only those from boss spawn array - foreach (var raiderSpawn in reserveBase.BossLocationSpawn.Where((boss) => boss.BossName == "pmcBot")) + foreach (var raiderSpawn in reserveBase.BossLocationSpawn.Where(boss => boss.BossName == "pmcBot")) { var isTriggered = raiderSpawn.TriggerId.Length > 0; // Empty string if not triggered var newSpawnChance = isTriggered ? _locationConfig.ReserveRaiderSpawnChanceOverrides.Triggered : _locationConfig.ReserveRaiderSpawnChanceOverrides.NonTriggered; - if (newSpawnChance == -1) continue; + if (newSpawnChance == -1) + { + continue; + } if (raiderSpawn.BossChance < newSpawnChance) // Desired chance is bigger than existing, override it + { raiderSpawn.BossChance = newSpawnChance; + } } } @@ -156,7 +182,7 @@ public class PostDbLoadService( { // Exists already, add new items to existing positions pool var existingLootPosition = mapLooseLoot.Spawnpoints.FirstOrDefault( - (x) => x.Template.Id == positionToAdd.Template.Id + x => x.Template.Id == positionToAdd.Template.Id ); if (existingLootPosition is not null) @@ -178,17 +204,29 @@ public class PostDbLoadService( { var itemDb = _databaseService.GetItems(); - var shotguns = new List { Weapons.SHOTGUN_12G_SAIGA_12K, Weapons.SHOTGUN_20G_TOZ_106, Weapons.SHOTGUN_12G_M870 }; + var shotguns = new List + { + Weapons.SHOTGUN_12G_SAIGA_12K, + Weapons.SHOTGUN_20G_TOZ_106, + Weapons.SHOTGUN_12G_M870 + }; foreach (var shotgunId in shotguns) + { if (itemDb[shotgunId].Properties.ShotgunDispersion.HasValue) + { itemDb[shotgunId].Properties.shotgunDispersion = itemDb[shotgunId].Properties.ShotgunDispersion; + } + } } // Apply custom limits on bot types as defined in configs/location.json/botTypeLimits protected void AdjustMapBotLimits() { var mapsDb = _databaseService.GetLocations().GetDictionary(); - if (_locationConfig.BotTypeLimits is null) return; + if (_locationConfig.BotTypeLimits is null) + { + return; + } foreach (var (mapId, limits) in _locationConfig.BotTypeLimits) { @@ -230,7 +268,10 @@ public class PostDbLoadService( protected void AdjustLooseLootSpawnProbabilities() { - if (_lootConfig.LooseLootSpawnPointAdjustments is null) return; + if (_lootConfig.LooseLootSpawnPointAdjustments is null) + { + return; + } foreach (var (mapId, mapAdjustments) in _lootConfig.LooseLootSpawnPointAdjustments) { @@ -245,7 +286,7 @@ public class PostDbLoadService( foreach (var (lootKey, newChanceValue) in mapAdjustments) { var lootPostionToAdjust = mapLooseLootData.Spawnpoints.FirstOrDefault( - (spawnPoint) => spawnPoint.Template.Id == lootKey + spawnPoint => spawnPoint.Template.Id == lootKey ); if (lootPostionToAdjust is null) { @@ -254,8 +295,8 @@ public class PostDbLoadService( "location-unable_to_adjust_loot_position_on_map", new { - lootKey = lootKey, - mapId = mapId + lootKey, + mapId } ) ); @@ -276,7 +317,10 @@ public class PostDbLoadService( foreach (var (key, cap) in _botConfig.MaxBotCap) { // Keys given are like this: "factory4_night" use GetMappedKey to change to "Factory4Night" which the dictionary contains - if (!mapsDict.TryGetValue(mapsDb.GetMappedKey(key), out var map)) continue; + if (!mapsDict.TryGetValue(mapsDb.GetMappedKey(key), out var map)) + { + continue; + } map.Base.BotMaxPvE = cap; map.Base.BotMax = cap; @@ -293,12 +337,17 @@ public class PostDbLoadService( var lighthouse = _databaseService.GetLocations().Lighthouse?.Base; if (lighthouse is null) // Just in case they remove this cursed map + { return; + } // Find Rogues that spawn instantly var instantRogueBossSpawns = lighthouse.BossLocationSpawn - .Where((spawn) => spawn.BossName == "exUsec" && spawn.Time == -1); - foreach (var wave in instantRogueBossSpawns) wave.Time = rogueSpawnDelaySeconds; + .Where(spawn => spawn.BossName == "exUsec" && spawn.Time == -1); + foreach (var wave in instantRogueBossSpawns) + { + wave.Time = rogueSpawnDelaySeconds; + } } // Make non-trigger-spawned raiders spawn earlier + always @@ -308,7 +357,7 @@ public class PostDbLoadService( // Find spawns with empty string for triggerId/TriggerName var nonTriggerLabsBossSpawns = labsBase.BossLocationSpawn.Where( - (bossSpawn) => bossSpawn.TriggerId is null && bossSpawn.TriggerName is null + bossSpawn => bossSpawn.TriggerId is null && bossSpawn.TriggerName is null ); foreach (var boss in nonTriggerLabsBossSpawns) @@ -320,22 +369,32 @@ public class PostDbLoadService( protected void AdjustHideoutCraftTimes(int overrideSeconds) { - if (overrideSeconds == -1) return; + if (overrideSeconds == -1) + { + return; + } foreach (var craft in _databaseService.GetHideout().Production.Recipes) // Only adjust crafts ABOVE the override + { craft.ProductionTime = Math.Min(craft.ProductionTime.Value, overrideSeconds); + } } // Adjust all hideout craft times to be no higher than the override protected void AdjustHideoutBuildTimes(int overrideSeconds) { - if (overrideSeconds == -1) return; + if (overrideSeconds == -1) + { + return; + } foreach (var area in _databaseService.GetHideout().Areas) foreach (var (key, stage) in area.Stages) // Only adjust crafts ABOVE the override + { stage.ConstructionTime = Math.Min(stage.ConstructionTime.Value, overrideSeconds); + } } protected void UnlockHideoutLootCrateCrafts() @@ -349,8 +408,11 @@ public class PostDbLoadService( foreach (var craftId in hideoutLootBoxCraftIds) { - var recipe = _databaseService.GetHideout().Production.Recipes.FirstOrDefault((craft) => craft.Id == craftId); - if (recipe is not null) recipe.Locked = false; + var recipe = _databaseService.GetHideout().Production.Recipes.FirstOrDefault(craft => craft.Id == craftId); + if (recipe is not null) + { + recipe.Locked = false; + } } } @@ -359,7 +421,10 @@ public class PostDbLoadService( { // Iterate over all languages (e.g. "en", "fr") var locales = _databaseService.GetLocales(); - foreach (var localeKvP in locales.Global) locales.Global[localeKvP.Key].Value["61687e2c3e526901fa76baf9"] = ""; + foreach (var localeKvP in locales.Global) + { + locales.Global[localeKvP.Key].Value["61687e2c3e526901fa76baf9"] = ""; + } } // Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json @@ -371,7 +436,10 @@ public class PostDbLoadService( foreach (var (traderId, traderData) in traders) { var traderAssorts = traderData?.Assort; - if (traderAssorts is null) continue; + if (traderAssorts is null) + { + continue; + } // Merge started/success/fail quest assorts into one dictionary var mergedQuestAssorts = new Dictionary(); @@ -383,6 +451,7 @@ public class PostDbLoadService( // Loop over all assorts for trader foreach (var (assortKey, questKey) in mergedQuestAssorts) // Does assort key exist in trader assort file + { if (!traderAssorts.LoyalLevelItems.ContainsKey(assortKey)) { // Reverse lookup of enum key by value @@ -395,6 +464,7 @@ public class PostDbLoadService( _localisationService.GetText("assort-missing_quest_assort_unlock", messageValues) ); } + } } } @@ -406,7 +476,9 @@ public class PostDbLoadService( !item.Properties.CanSellOnRagfair.GetValueOrDefault(false) && !_ragfairConfig.Dynamic.Blacklist.Custom.Contains(item.Id) )) + { item.Properties.CanSellOnRagfair = true; + } } protected void AddMissingTraderBuyRestrictionMaxValue() @@ -421,7 +493,10 @@ public class PostDbLoadService( protected void ApplyFleaPriceOverrides() { var fleaPrices = _databaseService.GetPrices(); - foreach (var (itemTpl, price) in _ragfairConfig.Dynamic.ItemPriceOverrideRouble) fleaPrices[itemTpl] = price; + foreach (var (itemTpl, price) in _ragfairConfig.Dynamic.ItemPriceOverrideRouble) + { + fleaPrices[itemTpl] = price; + } } protected void AddCustomItemPresetsToGlobals() diff --git a/Libraries/Core/Services/ProfileActivityService.cs b/Libraries/Core/Services/ProfileActivityService.cs index bd0f91a7..c0fd9933 100644 --- a/Libraries/Core/Services/ProfileActivityService.cs +++ b/Libraries/Core/Services/ProfileActivityService.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; -using Core.Utils; +using Core.Utils; +using SptCommon.Annotations; namespace Core.Services; @@ -8,7 +8,7 @@ public class ProfileActivityService( TimeUtil _timeUtil ) { - private Dictionary profileActivityTimestamps = new(); + private readonly Dictionary profileActivityTimestamps = new(); /** * Was the requested profile active in the last requested minutes @@ -20,7 +20,9 @@ public class ProfileActivityService( { var currentTimestamp = _timeUtil.GetTimeStamp(); if (!profileActivityTimestamps.TryGetValue(sessionId, out var storedActivityTimestamp)) + { return false; + } return currentTimestamp - storedActivityTimestamp < minutes * 60; } @@ -39,11 +41,15 @@ public class ProfileActivityService( { var lastActivityTimestamp = activity.Value; if (lastActivityTimestamp == null) + { continue; + } // Profile was active in last x minutes, add to return list if (currentTimestamp - lastActivityTimestamp < minutes * 60) + { result.Add(activity.Key); + } } return result; diff --git a/Libraries/Core/Services/ProfileFixerService.cs b/Libraries/Core/Services/ProfileFixerService.cs index adafa1bf..29f52e1a 100644 --- a/Libraries/Core/Services/ProfileFixerService.cs +++ b/Libraries/Core/Services/ProfileFixerService.cs @@ -1,14 +1,14 @@ -using SptCommon.Annotations; +using System.Text.RegularExpressions; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.Profile; using Core.Models.Enums; -using Core.Servers; -using Core.Utils; -using System.Text.RegularExpressions; using Core.Models.Spt.Config; using Core.Models.Utils; +using Core.Servers; +using Core.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -28,10 +28,11 @@ public class ProfileFixerService( InventoryHelper _inventoryHelper ) { + protected List _areas = ["hideout", "main"]; protected CoreConfig _coreConfig = _configServer.GetConfig(); /// - /// Find issues in the pmc profile data that may cause issues and fix them + /// Find issues in the pmc profile data that may cause issues and fix them /// /// profile to check and fix public void CheckForAndFixPmcProfileIssues(PmcData pmcProfile) @@ -41,43 +42,61 @@ public class ProfileFixerService( RemoveOrphanedQuests(pmcProfile); VerifyQuestProductionUnlocks(pmcProfile); - if (pmcProfile.Hideout is not null) AddHideoutEliteSlots(pmcProfile); + if (pmcProfile.Hideout is not null) + { + AddHideoutEliteSlots(pmcProfile); + } - if (pmcProfile.Skills is not null) CheckForSkillsOverMaxLevel(pmcProfile); + if (pmcProfile.Skills is not null) + { + CheckForSkillsOverMaxLevel(pmcProfile); + } } /// - /// Resolve any dialogue attachments that were accidentally created using the player's equipment ID as - /// the stash root object ID + /// Resolve any dialogue attachments that were accidentally created using the player's equipment ID as + /// the stash root object ID /// /// public void CheckForAndFixDialogueAttachments(SptProfile fullProfile) { foreach (var traderDialoguesKvP in fullProfile.DialogueRecords) { - if (traderDialoguesKvP.Value.Messages is null) continue; + if (traderDialoguesKvP.Value.Messages is null) + { + continue; + } var traderDialogues = traderDialoguesKvP.Value; foreach (var message in traderDialogues.Messages) { // Skip any messages without attached items - if (message.Items?.Data is null || message.Items?.Stash is null) continue; + if (message.Items?.Data is null || message.Items?.Stash is null) + { + continue; + } // Skip any messages that don't have a stashId collision with the player's equipment ID - if (message.Items?.Stash != fullProfile.CharacterData?.PmcData?.Inventory?.Equipment) continue; + if (message.Items?.Stash != fullProfile.CharacterData?.PmcData?.Inventory?.Equipment) + { + continue; + } // Otherwise we need to generate a new unique stash ID for this message's attachments message.Items.Stash = _hashUtil.Generate(); message.Items.Data = _itemHelper.AdoptOrphanedItems(message.Items.Stash, message.Items.Data); // Because `adoptOrphanedItems` sets the slotId to `hideout`, we need to re-set it to `main` to work with mail - foreach (var item in message.Items.Data.Where(item => item.SlotId == "hideout")) item.SlotId = "main"; + foreach (var item in message.Items.Data.Where(item => item.SlotId == "hideout")) + { + item.SlotId = "main"; + } } } } /// - /// Attempt to fix common item issues that corrupt profiles + /// Attempt to fix common item issues that corrupt profiles /// /// Profile to check items of public void FixProfileBreakingInventoryItemIssues(PmcData pmcProfile) @@ -90,7 +109,10 @@ public class ProfileFixerService( foreach (var mappingKvP in itemMapping) { // Only one item for this id, not a dupe - if (mappingKvP.Value.Count == 1) continue; + if (mappingKvP.Value.Count == 1) + { + continue; + } _logger.Warning($"{mappingKvP.Value.Count - 1} duplicate(s) found for item: {mappingKvP.Key}"); var itemAJson = _jsonUtil.Serialize(mappingKvP.Value[0]); @@ -106,10 +128,10 @@ public class ProfileFixerService( { // Items are different, replace ID with unique value // Only replace ID if items have no children, we dont want orphaned children - var itemsHaveChildren = pmcProfile.Inventory.Items.Any((x) => x.ParentId == mappingKvP.Key); + var itemsHaveChildren = pmcProfile.Inventory.Items.Any(x => x.ParentId == mappingKvP.Key); if (!itemsHaveChildren) { - var itemToAdjust = pmcProfile.Inventory.Items.FirstOrDefault((x) => x.Id == mappingKvP.Key); + var itemToAdjust = pmcProfile.Inventory.Items.FirstOrDefault(x => x.Id == mappingKvP.Key); itemToAdjust.Id = _hashUtil.Generate(); _logger.Warning($"Replace duplicate item Id: {mappingKvP.Key} with {itemToAdjust.Id}"); } @@ -117,11 +139,13 @@ public class ProfileFixerService( } // Iterate over all inventory items - foreach (var item in pmcProfile.Inventory.Items.Where((x) => x.SlotId is not null)) + foreach (var item in pmcProfile.Inventory.Items.Where(x => x.SlotId is not null)) { if (item.Upd is null) // Ignore items without a upd object + { continue; + } // Check items with a tags for non-alphanumeric characters and remove var regxp = new Regex("[^a-zA-Z0-9 -]"); @@ -148,8 +172,8 @@ public class ProfileFixerService( if (customizationDb[pmcProfile.Customization.Head] is null) { var defaultHead = playerIsUsec - ? customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultUsecHead") - : customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultBearHead"); + ? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecHead") + : customizationDbArray.FirstOrDefault(x => x.Name == "DefaultBearHead"); pmcProfile.Customization.Head = defaultHead.Id; } @@ -157,8 +181,8 @@ public class ProfileFixerService( if (customizationDb[pmcProfile.Customization.Body] is null) { var defaultBody = playerIsUsec - ? customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultUsecBody") - : customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultBearBody"); + ? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecBody") + : customizationDbArray.FirstOrDefault(x => x.Name == "DefaultBearBody"); pmcProfile.Customization.Body = defaultBody.Id; } @@ -166,8 +190,8 @@ public class ProfileFixerService( if (customizationDb[pmcProfile.Customization.Hands] is null) { var defaultHands = playerIsUsec - ? customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultUsecHands") - : customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultBearHands"); + ? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecHands") + : customizationDbArray.FirstOrDefault(x => x.Name == "DefaultBearHands"); pmcProfile.Customization.Hands = defaultHands.Id; } @@ -175,33 +199,41 @@ public class ProfileFixerService( if (customizationDb[pmcProfile.Customization.Feet] is null) { var defaultFeet = playerIsUsec - ? customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultUsecFeet") - : customizationDbArray.FirstOrDefault((x) => x.Name == "DefaultBearFeet"); + ? customizationDbArray.FirstOrDefault(x => x.Name == "DefaultUsecFeet") + : customizationDbArray.FirstOrDefault(x => x.Name == "DefaultBearFeet"); pmcProfile.Customization.Feet = defaultFeet.Id; } } /// - /// TODO - make this non-public - currently used by RepeatableQuestController - /// Remove unused condition counters + /// TODO - make this non-public - currently used by RepeatableQuestController + /// Remove unused condition counters /// /// profile to remove old counters from public void RemoveDanglingConditionCounters(PmcData pmcProfile) { - if (pmcProfile.TaskConditionCounters is null) return; + if (pmcProfile.TaskConditionCounters is null) + { + return; + } foreach (var counterKvP in pmcProfile.TaskConditionCounters .Where(counterKvP => counterKvP.Value.SourceId is null)) + { pmcProfile.TaskConditionCounters.Remove(counterKvP.Key); + } } /// - /// Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them + /// Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them /// /// Player profile to check protected void RemoveDanglingTaskConditionCounters(PmcData pmcProfile) { - if (pmcProfile.TaskConditionCounters is null) return; + if (pmcProfile.TaskConditionCounters is null) + { + return; + } var taskConditionKeysToRemove = new List(); var activeRepeatableQuests = GetActiveRepeatableQuests(pmcProfile.RepeatableQuests); @@ -210,25 +242,34 @@ public class ProfileFixerService( // Loop over TaskConditionCounters objects and add once we want to remove to counterKeysToRemove foreach (var TaskConditionCounterKvP in pmcProfile.TaskConditionCounters) // Only check if profile has repeatable quests + { if (pmcProfile.RepeatableQuests is not null && activeRepeatableQuests.Count > 0) { var existsInActiveRepeatableQuests = activeRepeatableQuests.Any( - (quest) => quest.Id == TaskConditionCounterKvP.Value.SourceId + quest => quest.Id == TaskConditionCounterKvP.Value.SourceId ); var existsInQuests = pmcProfile.Quests.Any( - (quest) => quest.QId == TaskConditionCounterKvP.Value.SourceId + quest => quest.QId == TaskConditionCounterKvP.Value.SourceId ); var isAchievementTracker = achievements.Any( - (quest) => quest.Id == TaskConditionCounterKvP.Value.SourceId + 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 - if (!(existsInActiveRepeatableQuests || existsInQuests || isAchievementTracker)) taskConditionKeysToRemove.Add(TaskConditionCounterKvP.Key); + if (!(existsInActiveRepeatableQuests || existsInQuests || isAchievementTracker)) + { + taskConditionKeysToRemove.Add(TaskConditionCounterKvP.Key); + } } + } foreach (var counterKeyToRemove in taskConditionKeysToRemove) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Removed: {counterKeyToRemove} TaskConditionCounter object"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Removed: {counterKeyToRemove} TaskConditionCounter object"); + } + pmcProfile.TaskConditionCounters.Remove(counterKeyToRemove); } } @@ -238,13 +279,15 @@ public class ProfileFixerService( var activeQuests = new List(); foreach (var repeatableQuest in repeatableQuests.Where(questType => questType.ActiveQuests?.Count > 0)) // daily/weekly collection has active quests in them, add to array and return + { activeQuests.AddRange(repeatableQuest.ActiveQuests); + } return activeQuests; } /// - /// After removing mods that add quests, the quest panel will break without removing these + /// After removing mods that add quests, the quest panel will break without removing these /// /// Profile to remove dead quests from protected void RemoveOrphanedQuests(PmcData pmcProfile) @@ -255,15 +298,17 @@ public class ProfileFixerService( var activeRepeatableQuests = GetActiveRepeatableQuests(pmcProfile.RepeatableQuests); for (var i = profileQuests.Count - 1; i >= 0; i--) - if (!quests.ContainsKey(profileQuests[i].QId) || activeRepeatableQuests.Any((x) => x.Id == profileQuests[i].QId)) + { + if (!quests.ContainsKey(profileQuests[i].QId) || activeRepeatableQuests.Any(x => x.Id == profileQuests[i].QId)) { _logger.Info($"Successfully removed orphaned quest: {profileQuests[i].QId} that doesn't exist in quest data"); profileQuests.RemoveAt(i); } + } } /// - /// Verify that all quest production unlocks have been applied to the PMC Profile + /// Verify that all quest production unlocks have been applied to the PMC Profile /// /// The profile to validate quest productions for protected void VerifyQuestProductionUnlocks(PmcData pmcProfile) @@ -274,36 +319,47 @@ public class ProfileFixerService( foreach (var profileQuest in profileQuests) { var quest = quests.GetValueOrDefault(profileQuest.QId, null); - if (quest is null) continue; + if (quest is null) + { + continue; + } // 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 + reward => reward.Type == RewardType.ProductionScheme ); if (productionRewards is not null) + { foreach (var reward in productionRewards) + { VerifyQuestProductionUnlock(pmcProfile, reward, quest); + } + } } // 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 + reward => reward.Type == RewardType.ProductionScheme ); if (productionRewards is not null) + { foreach (var reward in productionRewards) + { VerifyQuestProductionUnlock(pmcProfile, reward, quest); + } + } } } } /// - /// Validate that the given profile has the given quest reward production scheme unlocked, and add it if not + /// Validate that the given profile has the given quest reward production scheme unlocked, and add it if not /// /// Profile to check /// The quest reward to validate @@ -338,20 +394,22 @@ public class ProfileFixerService( pmcProfile.UnlockedInfo.UnlockedProductionRecipe.Add(matchingProductionId); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug($"Added production: {matchingProductionId} to unlocked production recipes for: {questDetails.QuestName}"); + } } } /// - /// If the profile has elite Hideout Managment skill, add the additional slots from globals - /// NOTE: This seems redundant, but we will leave it here just in case. + /// If the profile has elite Hideout Managment skill, add the additional slots from globals + /// NOTE: This seems redundant, but we will leave it here just in case. /// /// profile to add slots to protected void AddHideoutEliteSlots(PmcData pmcProfile) { var globals = _databaseService.GetGlobals(); - var generator = pmcProfile.Hideout.Areas.FirstOrDefault((area) => area.Type == HideoutAreas.GENERATOR); + var generator = pmcProfile.Hideout.Areas.FirstOrDefault(area => area.Type == HideoutAreas.GENERATOR); if (generator is not null) { var genSlots = generator.Slots.Count; @@ -359,68 +417,97 @@ public class ProfileFixerService( if (genSlots < 6 + extraGenSlots) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Updating generator area slots to a size of 6 + hideout management skill"); - AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.GENERATOR, (int)(6 + extraGenSlots ?? 0), pmcProfile); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Updating generator area slots to a size of 6 + hideout management skill"); + } + + AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.GENERATOR, (int) (6 + extraGenSlots ?? 0), pmcProfile); } } - var waterCollSlots = pmcProfile.Hideout.Areas.FirstOrDefault((x) => x.Type == HideoutAreas.WATER_COLLECTOR) + var waterCollSlots = pmcProfile.Hideout.Areas.FirstOrDefault(x => x.Type == HideoutAreas.WATER_COLLECTOR) .Slots .Count; var extraWaterCollSlots = globals.Configuration.SkillsSettings.HideoutManagement.EliteSlots.WaterCollector.Slots; if (waterCollSlots < 1 + extraWaterCollSlots) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Updating water collector area slots to a size of 1 + hideout management skill"); - AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.WATER_COLLECTOR, (int)(1 + extraWaterCollSlots ?? 0), pmcProfile); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Updating water collector area slots to a size of 1 + hideout management skill"); + } + + AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.WATER_COLLECTOR, (int) (1 + extraWaterCollSlots ?? 0), pmcProfile); } - var filterSlots = pmcProfile.Hideout.Areas.FirstOrDefault((x) => x.Type == HideoutAreas.AIR_FILTERING).Slots.Count; + var filterSlots = pmcProfile.Hideout.Areas.FirstOrDefault(x => x.Type == HideoutAreas.AIR_FILTERING).Slots.Count; var extraFilterSlots = globals.Configuration.SkillsSettings.HideoutManagement.EliteSlots.AirFilteringUnit.Slots; if (filterSlots < 3 + extraFilterSlots) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Updating air filter area slots to a size of 3 + hideout management skill"); - AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.AIR_FILTERING, (int)(3 + extraFilterSlots ?? 0), pmcProfile); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Updating air filter area slots to a size of 3 + hideout management skill"); + } + + AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.AIR_FILTERING, (int) (3 + extraFilterSlots ?? 0), pmcProfile); } - var btcFarmSlots = pmcProfile.Hideout.Areas.FirstOrDefault((x) => x.Type == HideoutAreas.BITCOIN_FARM).Slots.Count; + var btcFarmSlots = pmcProfile.Hideout.Areas.FirstOrDefault(x => x.Type == HideoutAreas.BITCOIN_FARM).Slots.Count; var extraBtcSlots = globals.Configuration.SkillsSettings.HideoutManagement.EliteSlots.BitcoinFarm.Slots; // BTC Farm doesnt have extra slots for hideout management, but we still check for modded stuff!! if (btcFarmSlots < 50 + extraBtcSlots) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Updating bitcoin farm area slots to a size of 50 + hideout management skill"); - AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.BITCOIN_FARM, (int)(50 + extraBtcSlots ?? 0), pmcProfile); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Updating bitcoin farm area slots to a size of 50 + hideout management skill"); + } + + AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.BITCOIN_FARM, (int) (50 + extraBtcSlots ?? 0), pmcProfile); } - var cultistAreaSlots = pmcProfile.Hideout.Areas.FirstOrDefault((x) => x.Type == HideoutAreas.CIRCLE_OF_CULTISTS) + var cultistAreaSlots = pmcProfile.Hideout.Areas.FirstOrDefault(x => x.Type == HideoutAreas.CIRCLE_OF_CULTISTS) .Slots .Count; if (cultistAreaSlots < 1) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug("Updating cultist area slots to a size of 1"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug("Updating cultist area slots to a size of 1"); + } + AddEmptyObjectsToHideoutAreaSlots(HideoutAreas.CIRCLE_OF_CULTISTS, 1, pmcProfile); } } /// - /// add in objects equal to the number of slots + /// add in objects equal to the number of slots /// /// area to check /// area to update /// profile to update protected void AddEmptyObjectsToHideoutAreaSlots(HideoutAreas areaType, int emptyItemCount, PmcData pmcProfile) { - var area = pmcProfile.Hideout.Areas.FirstOrDefault((x) => x.Type == areaType); + var area = pmcProfile.Hideout.Areas.FirstOrDefault(x => x.Type == areaType); area.Slots = AddObjectsToList(emptyItemCount, area.Slots); } protected List AddObjectsToList(int count, List slots) { for (var i = 0; i < count; i++) - if (!slots.Any((x) => x.LocationIndex == i)) - slots.Add(new HideoutSlot { LocationIndex = i }); + { + if (!slots.Any(x => x.LocationIndex == i)) + { + slots.Add( + new HideoutSlot + { + LocationIndex = i + } + ); + } + } return slots; } @@ -433,11 +520,12 @@ public class ProfileFixerService( { var skills = pmcProfile.Skills.Common; - foreach (var skill in skills.Where(skill => skill.Progress > 5100)) skill.Progress = 5100; + foreach (var skill in skills.Where(skill => skill.Progress > 5100)) + { + skill.Progress = 5100; + } } - protected List _areas = ["hideout", "main"]; - /** * Checks profile inventory for items that do not exist inside the items db * @param sessionId Session id @@ -453,7 +541,9 @@ public class ProfileFixerService( var inventoryItemsToCheck = pmcProfile.Inventory.Items.Where(item => _areas.Contains(item.SlotId ?? "")); if (inventoryItemsToCheck is not null) // Check each item in inventory to ensure item exists in itemdb + { foreach (var item in inventoryItemsToCheck) + { if (!itemsDb.ContainsKey(item.Template)) { _logger.Error(_localisationService.GetText("fixer-mod_item_found", item.Template)); @@ -466,32 +556,56 @@ public class ProfileFixerService( _inventoryHelper.RemoveItem(pmcProfile, item.Id, sessionId); } } + } + } if (fullProfile.UserBuildData is not null) { // Remove invalid builds from weapon, equipment and magazine build lists var weaponBuilds = fullProfile.UserBuildData?.WeaponBuilds ?? new List(); fullProfile.UserBuildData.WeaponBuilds = - weaponBuilds.Where(build => { return !ShouldRemoveWeaponEquipmentBuild("weapon", build, itemsDb); }).ToList(); + weaponBuilds.Where( + build => + { + return !ShouldRemoveWeaponEquipmentBuild("weapon", build, itemsDb); + } + ) + .ToList(); var equipmentBuilds = fullProfile.UserBuildData.EquipmentBuilds ?? new List(); fullProfile.UserBuildData.EquipmentBuilds = - equipmentBuilds.Where(build => { return !ShouldRemoveWeaponEquipmentBuild("equipment", build, itemsDb); }).ToList(); + equipmentBuilds.Where( + build => + { + return !ShouldRemoveWeaponEquipmentBuild("equipment", build, itemsDb); + } + ) + .ToList(); var magazineBuild = fullProfile.UserBuildData.MagazineBuilds ?? new List(); - fullProfile.UserBuildData.MagazineBuilds = magazineBuild.Where(build => { return !ShouldRemoveMagazineBuild(build, itemsDb); }).ToList(); + fullProfile.UserBuildData.MagazineBuilds = magazineBuild.Where( + build => + { + return !ShouldRemoveMagazineBuild(build, itemsDb); + } + ) + .ToList(); } // Iterate over dialogs, looking for messages with items not found in item db, remove message if item found foreach (var dialog in fullProfile.DialogueRecords) { if (dialog.Value.Messages is null) + { continue; // Skip dialog with no messages + } foreach (var message in dialog.Value.Messages) { if (message.Items?.Data is null) + { continue; // skip messages with no items + } // Fix message with no items but have the flags to indicate items to collect if (message.Items.Data.Count == 0 && message.HasRewards.GetValueOrDefault(false)) @@ -505,7 +619,10 @@ public class ProfileFixerService( foreach (var item in message.Items.Data) { // Check item exists in itemsDb - if (!itemsDb.ContainsKey(item.Template)) _logger.Error(_localisationService.GetText("fixer-mod_item_found", item.Template)); + if (!itemsDb.ContainsKey(item.Template)) + { + _logger.Error(_localisationService.GetText("fixer-mod_item_found", item.Template)); + } if (_coreConfig.Fixes.RemoveModItemsFromProfile) { @@ -520,6 +637,7 @@ public class ProfileFixerService( var clothing = _databaseService.GetTemplates().Customization; foreach (var suit in fullProfile.Suits) + { if (suit is null) { _logger.Error(_localisationService.GetText("fixer-clothing_item_found", suit)); @@ -529,10 +647,14 @@ public class ProfileFixerService( _logger.Warning($"Non-default suit purchase: {suit} removed from profile"); } } + } foreach (var repeatable in fullProfile.CharacterData.PmcData.RepeatableQuests ?? new List()) { - if (repeatable.ActiveQuests is null) continue; + if (repeatable.ActiveQuests is null) + { + continue; + } foreach (var activeQuest in repeatable.ActiveQuests) { @@ -550,11 +672,15 @@ public class ProfileFixerService( continue; } - if (activeQuest.Rewards?.Success is null) continue; + if (activeQuest.Rewards?.Success is null) + { + continue; + } // Get Item rewards only foreach (var successReward in activeQuest.Rewards.Success.Where(reward => reward.Type == RewardType.Item)) foreach (var item in successReward.Items) + { if (!itemsDb.ContainsKey(item.Template)) { _logger.Warning( @@ -562,10 +688,12 @@ public class ProfileFixerService( ); repeatable.ActiveQuests.Remove(activeQuest); } + } } } foreach (var TraderPurchase in fullProfile.TraderPurchases) + { if (!_traderHelper.TraderEnumHasValue(TraderPurchase.Key)) { _logger.Error(_localisationService.GetText("fixer-trader_found", TraderPurchase.Key)); @@ -575,6 +703,7 @@ public class ProfileFixerService( fullProfile.TraderPurchases.Remove(TraderPurchase.Key); } } + } } /** @@ -590,6 +719,7 @@ public class ProfileFixerService( { if (buildType == "weapon") // Get items not found in items db + { foreach (var item in (build as WeaponBuild).Items.Where(item => !itemsDb.ContainsKey(item.Template))) { _logger.Error(_localisationService.GetText("fixer-mod_item_found", item.Template)); @@ -603,11 +733,13 @@ public class ProfileFixerService( break; } + } // TODO: refactor to be generic if (buildType == "equipment") // Get items not found in items db + { foreach (var item in (build as EquipmentBuild).Items.Where(item => !itemsDb.ContainsKey(item.Template))) { _logger.Error(_localisationService.GetText("fixer-mod_item_found", item.Template)); @@ -622,6 +754,7 @@ public class ProfileFixerService( // Found a broken item break; } + } return false; } @@ -638,7 +771,10 @@ public class ProfileFixerService( foreach (var item in magazineBuild.Items) { // Magazine builds can have undefined items in them, skip those - if (item is null) continue; + if (item is null) + { + continue; + } // Check item exists in itemsDb if (!itemsDb.ContainsKey(item.TemplateId)) @@ -673,24 +809,35 @@ public class ProfileFixerService( var areaType = profileArea.Type; var level = profileArea.Level; - if (level.GetValueOrDefault(0) == 0) continue; + if (level.GetValueOrDefault(0) == 0) + { + continue; + } // Get array of hideout area upgrade levels to check for bonuses // Zero indexed var areaLevelsToCheck = new List(); for (var index = 0; index < level + 1; index++) // Stage key is saved as string in db + { areaLevelsToCheck.Add(index.ToString()); + } // Iterate over area levels, check for bonuses, add if needed - var dbArea = dbHideoutAreas?.FirstOrDefault((area) => area.Type == areaType); - if (dbArea is null) continue; + var dbArea = dbHideoutAreas?.FirstOrDefault(area => area.Type == areaType); + if (dbArea is null) + { + continue; + } foreach (var areaLevel in areaLevelsToCheck) { // Get areas level bonuses from db var levelBonuses = dbArea.Stages?[areaLevel].Bonuses; - if (levelBonuses is null || levelBonuses.Count == 0) continue; + if (levelBonuses is null || levelBonuses.Count == 0) + { + continue; + } // Iterate over each bonus for the areas level foreach (var bonus in levelBonuses) @@ -716,17 +863,20 @@ public class ProfileFixerService( protected Bonus? GetBonusFromProfile(List? profileBonuses, Bonus bonus) { // match by id first, used by "TextBonus" bonuses - if (bonus.Id is null) return profileBonuses?.FirstOrDefault((x) => x.Id == bonus.Id); + if (bonus.Id is null) + { + return profileBonuses?.FirstOrDefault(x => x.Id == bonus.Id); + } return bonus.Type switch { BonusType.StashSize => profileBonuses?.FirstOrDefault( - (x) => x.Type == bonus.Type && x.TemplateId == bonus.TemplateId + 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 + x => x.Type == bonus.Type && x?.Value == bonus?.Value && x?.IsVisible == bonus?.IsVisible ), - _ => profileBonuses?.FirstOrDefault((x) => x.Type == bonus.Type && x.Value == bonus.Value) + _ => profileBonuses?.FirstOrDefault(x => x.Type == bonus.Type && x.Value == bonus.Value) }; } diff --git a/Libraries/Core/Services/RagfairCategoriesService.cs b/Libraries/Core/Services/RagfairCategoriesService.cs index 2e9fcd7e..654bd845 100644 --- a/Libraries/Core/Services/RagfairCategoriesService.cs +++ b/Libraries/Core/Services/RagfairCategoriesService.cs @@ -32,20 +32,31 @@ public class RagfairCategoriesService( var isTraderOffer = offer.User.MemberType == MemberCategory.Trader; // Not level 15 and offer is from player, skip - if (!fleaUnlocked && !isTraderOffer) return false; + if (!fleaUnlocked && !isTraderOffer) + { + return false; + } // Skip items not for currency when `removeBartering` is enabled if ( searchRequestData.RemoveBartering.GetValueOrDefault(false) && (offer.Requirements.Count > 1 || !_paymentHelper.IsMoneyTpl(offer.Requirements.FirstOrDefault().Template)) ) + { return false; + } // Remove when filter set to players only + offer is from trader - if (searchRequestData.OfferOwnerType == OfferOwnerType.PLAYEROWNERTYPE && isTraderOffer) return false; + if (searchRequestData.OfferOwnerType == OfferOwnerType.PLAYEROWNERTYPE && isTraderOffer) + { + return false; + } // Remove when filter set to traders only + offer is not from trader - if (searchRequestData.OfferOwnerType == OfferOwnerType.TRADEROWNERTYPE && !isTraderOffer) return false; + if (searchRequestData.OfferOwnerType == OfferOwnerType.TRADEROWNERTYPE && !isTraderOffer) + { + return false; + } // Passed checks, it's a valid offer to process return true; diff --git a/Libraries/Core/Services/RagfairLinkedItemService.cs b/Libraries/Core/Services/RagfairLinkedItemService.cs index 88e67e1d..13877dd6 100644 --- a/Libraries/Core/Services/RagfairLinkedItemService.cs +++ b/Libraries/Core/Services/RagfairLinkedItemService.cs @@ -1,10 +1,8 @@ -using System.Security.Cryptography; using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common.Tables; using Core.Models.Enums; using Core.Models.Utils; -using SptCommon.Extensions; +using SptCommon.Annotations; namespace Core.Services; @@ -43,9 +41,14 @@ public class RagfairLinkedItemService( { var itemDetails = itemHelper.GetItem(linkedTpl); if (itemDetails.Key) + { result.Add(itemDetails.Value); + } else + { logger.Warning($"Item {itemTpl} has invalid linked item {linkedTpl}"); + } + return result; } ); @@ -69,7 +72,9 @@ public class RagfairLinkedItemService( // Edge case, ensure ammo for revolves is included if (item.Parent == BaseClasses.REVOLVER) // Find magazine for revolver + { AddRevolverCylinderAmmoToLinkedItems(item, itemLinkedSet); + } } linkedItemsCache = linkedItems; @@ -94,7 +99,7 @@ public class RagfairLinkedItemService( */ protected void AddRevolverCylinderAmmoToLinkedItems(TemplateItem cylinder, HashSet itemLinkedSet) { - var cylinderMod = cylinder.Properties.Slots?.FirstOrDefault((x) => x.Name == "mod_magazine"); + var cylinderMod = cylinder.Properties.Slots?.FirstOrDefault(x => x.Name == "mod_magazine"); if (cylinderMod != null) { // Get the first cylinder filter tpl @@ -113,9 +118,15 @@ public class RagfairLinkedItemService( var result = new HashSet(); var slots = item.Properties?.Slots; - if (slots is null) return result; + if (slots is null) + { + return result; + } - foreach (var slot in slots) result.UnionWith(slot.Props?.Filters?.FirstOrDefault()?.Filter); + foreach (var slot in slots) + { + result.UnionWith(slot.Props?.Filters?.FirstOrDefault()?.Filter); + } return result; } @@ -125,9 +136,15 @@ public class RagfairLinkedItemService( var result = new HashSet(); var chambers = item.Properties?.Chambers; - if (chambers is null) return result; + if (chambers is null) + { + return result; + } - foreach (var chamber in chambers) result.UnionWith(chamber.Props?.Filters?.FirstOrDefault()?.Filter); + foreach (var chamber in chambers) + { + result.UnionWith(chamber.Props?.Filters?.FirstOrDefault()?.Filter); + } return result; } @@ -137,9 +154,15 @@ public class RagfairLinkedItemService( var result = new HashSet(); var cartridges = item.Properties?.Cartridges; - if (cartridges is null) return result; + if (cartridges is null) + { + return result; + } - foreach (var cartridge in cartridges) result.UnionWith(cartridge.Props?.Filters?.FirstOrDefault()?.Filter); + foreach (var cartridge in cartridges) + { + result.UnionWith(cartridge.Props?.Filters?.FirstOrDefault()?.Filter); + } return result; } diff --git a/Libraries/Core/Services/RagfairOfferService.cs b/Libraries/Core/Services/RagfairOfferService.cs index 8421e672..c83acd85 100644 --- a/Libraries/Core/Services/RagfairOfferService.cs +++ b/Libraries/Core/Services/RagfairOfferService.cs @@ -26,8 +26,8 @@ public class RagfairOfferService( RagfairOfferHolder ragfairOfferHolder ) { - protected bool _playerOffersLoaded; protected ConcurrentBag _expiredOfferIds = new(); + protected bool _playerOffersLoaded; /** * Get all offers @@ -54,7 +54,7 @@ public class RagfairOfferService( } /// - /// Add a stale offers id to collection for later use + /// Add a stale offers id to collection for later use /// /// Id of offer to add to stale collection public void AddOfferIdToExpired(string staleOfferId) diff --git a/Libraries/Core/Services/RagfairPriceService.cs b/Libraries/Core/Services/RagfairPriceService.cs index 8b26708a..9483ec93 100644 --- a/Libraries/Core/Services/RagfairPriceService.cs +++ b/Libraries/Core/Services/RagfairPriceService.cs @@ -1,13 +1,13 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Common; +using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; +using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Models.Utils; -using Core.Models.Enums; using Core.Servers; using Core.Utils; -using Core.Models.Eft.Common; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Services; @@ -25,11 +25,11 @@ public class RagfairPriceService( ConfigServer _configServer ) { + private readonly RagfairConfig _ragfairConfig = _configServer.GetConfig(); protected Dictionary? _staticPrices; - private RagfairConfig _ragfairConfig = _configServer.GetConfig(); /// - /// Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries + /// Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries /// public void Load() { @@ -43,17 +43,19 @@ public class RagfairPriceService( } /// - /// Iterate over all items of type "Item" in db and get template price, store in cache + /// Iterate over all items of type "Item" in db and get template price, store in cache /// public void RefreshStaticPrices() { _staticPrices = new Dictionary(); foreach (var item in _databaseService.GetItems().Values.Where(item => item.Type == "Item")) + { _staticPrices[item.Id] = _handbookHelper.GetTemplatePrice(item.Id); + } } /// - /// Copy the prices.json data into our dynamic price dictionary + /// Copy the prices.json data into our dynamic price dictionary /// public void RefreshDynamicPrices() { @@ -61,8 +63,8 @@ public class RagfairPriceService( } /// - /// Get the dynamic price for an item. If value doesn't exist, use static (handbook) value. - /// if no static value, return 1 + /// Get the dynamic price for an item. If value doesn't exist, use static (handbook) value. + /// if no static value, return 1 /// /// Item tpl id to get price for /// price in roubles @@ -86,19 +88,26 @@ public class RagfairPriceService( } // If no price in dynamic/static, set to 1 - if (itemPrice == 0) itemPrice = 1; + if (itemPrice == 0) + { + itemPrice = 1; + } + return itemPrice.Value; } /// - /// Get the flea price for an offers items + children + /// Get the flea price for an offers items + children /// /// offer item + children to process /// Rouble price public double GetFleaPriceForOfferItems(List offerItems) { // Preset weapons take the direct prices.json value, otherwise they're massively inflated - if (_itemHelper.IsOfBaseclass(offerItems[0].Template, BaseClasses.WEAPON)) return GetFleaPriceForItem(offerItems[0].Template); + if (_itemHelper.IsOfBaseclass(offerItems[0].Template, BaseClasses.WEAPON)) + { + return GetFleaPriceForItem(offerItems[0].Template); + } return offerItems.Sum(item => GetFleaPriceForItem(item.Template)); } @@ -116,7 +125,7 @@ public class RagfairPriceService( } /// - /// Grab the static (handbook) for an item by its tplId + /// Grab the static (handbook) for an item by its tplId /// /// item template id to look up /// price in roubles @@ -126,8 +135,8 @@ public class RagfairPriceService( } /// - /// Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing - /// This will refresh the caches prior to building the output + /// Get prices for all items on flea, prioritize handbook prices first, use prices from prices.json if missing + /// This will refresh the caches prior to building the output /// /// Dictionary of item tpls and rouble cost public Dictionary GetAllFleaPrices() @@ -142,13 +151,16 @@ public class RagfairPriceService( public Dictionary GetAllStaticPrices() { // Refresh the cache so we include any newly added custom items - if (_staticPrices is null) RefreshStaticPrices(); + if (_staticPrices is null) + { + RefreshStaticPrices(); + } return _staticPrices; } /// - /// Get the percentage difference between two values + /// Get the percentage difference between two values /// /// numerical value a /// numerical value b @@ -159,7 +171,7 @@ public class RagfairPriceService( } /// - /// Get the rouble price for an assorts barter scheme + /// Get the rouble price for an assorts barter scheme /// /// /// Rouble price @@ -167,13 +179,16 @@ public class RagfairPriceService( { var price = 0d; - foreach (var item in barterScheme) price += GetStaticPriceForItem(item.Template).Value * item.Count.Value; + foreach (var item in barterScheme) + { + price += GetStaticPriceForItem(item.Template).Value * item.Count.Value; + } return Math.Round(price); } /// - /// Generate a currency cost for an item and its mods + /// Generate a currency cost for an item and its mods /// /// Item with mods to get price for /// Currency price desired in @@ -188,7 +203,10 @@ public class RagfairPriceService( foreach (var item in offerItems) { // Skip over armor inserts as those are not factored into item prices. - if (_itemHelper.IsOfBaseclass(item.Template, BaseClasses.BUILT_IN_INSERTS)) continue; + if (_itemHelper.IsOfBaseclass(item.Template, BaseClasses.BUILT_IN_INSERTS)) + { + continue; + } price += GetDynamicItemPrice(item.Template, desiredCurrency, item, offerItems, isPackOffer).Value; @@ -200,7 +218,9 @@ public class RagfairPriceService( // This is a weapon preset, which has it's own price calculation that takes into account the mods in the // preset. Since we've already calculated the price for the preset entire preset in // `getDynamicItemPrice`, we can skip the rest of the items in the offer. + { break; + } } return Math.Round(price); @@ -220,13 +240,19 @@ public class RagfairPriceService( var price = GetFleaPriceForItem(itemTemplateId); // Adjust price if below handbook price, based on config. - if (_ragfairConfig.Dynamic.OfferAdjustment.AdjustPriceWhenBelowHandbookPrice) price = AdjustPriceIfBelowHandbook(price, itemTemplateId); + if (_ragfairConfig.Dynamic.OfferAdjustment.AdjustPriceWhenBelowHandbookPrice) + { + price = AdjustPriceIfBelowHandbook(price, itemTemplateId); + } // Use trader price if higher, based on config. if (_ragfairConfig.Dynamic.UseTraderPriceForOffersIfHigher) { var traderPrice = _traderHelper.GetHighestSellToTraderPrice(itemTemplateId); - if (traderPrice > price) price = traderPrice; + if (traderPrice > price) + { + price = traderPrice; + } } // Prices for weapon presets are handled differently. @@ -241,7 +267,10 @@ public class RagfairPriceService( } // Check for existence of manual price adjustment multiplier - if (_ragfairConfig.Dynamic.ItemPriceMultiplier.TryGetValue(itemTemplateId, out var multiplier)) price *= multiplier; + if (_ragfairConfig.Dynamic.ItemPriceMultiplier.TryGetValue(itemTemplateId, out var multiplier)) + { + price *= multiplier; + } // The quality of the item affects the price + not on the ignore list if (item is not null && !_ragfairConfig.Dynamic.IgnoreQualityPriceVarianceBlacklist.Contains(itemTemplateId)) @@ -253,7 +282,10 @@ public class RagfairPriceService( // Make adjustments for unreasonably priced items. foreach (var (key, value) in _ragfairConfig.Dynamic.UnreasonableModPrices) { - if (!_itemHelper.IsOfBaseclass(itemTemplateId, key) || !value.Enabled) continue; + if (!_itemHelper.IsOfBaseclass(itemTemplateId, key) || !value.Enabled) + { + continue; + } price = AdjustUnreasonablePrice( _databaseService.GetHandbook().Items, @@ -269,14 +301,21 @@ public class RagfairPriceService( // Convert to different currency if required. var roublesId = Money.ROUBLES; - if (desiredCurrency != roublesId) price = _handbookHelper.FromRUB(price, desiredCurrency); + if (desiredCurrency != roublesId) + { + price = _handbookHelper.FromRUB(price, desiredCurrency); + } + + if (price < 1) + { + return 1; + } - if (price < 1) return 1; return price; } /// - /// using data from config, adjust an items price to be relative to its handbook price + /// using data from config, adjust an items price to be relative to its handbook price /// /// Prices of items in handbook /// Change object from config @@ -289,14 +328,20 @@ public class RagfairPriceService( string itemTpl, double price) { - var itemHandbookPrice = handbookPrices.FirstOrDefault((handbookItem) => handbookItem.Id == itemTpl); - if (itemHandbookPrice is not null) return price; + var itemHandbookPrice = handbookPrices.FirstOrDefault(handbookItem => handbookItem.Id == itemTpl); + if (itemHandbookPrice is not null) + { + return price; + } // Flea price is over handbook price if (price > itemHandbookPrice.Price * unreasonableItemChange.HandbookPriceOverMultiplier) { // Skip extreme values - if (price <= 1) return price; + if (price <= 1) + { + return price; + } // Price is over limit, adjust return itemHandbookPrice.Price.Value * unreasonableItemChange.NewPriceHandbookMultiplier; @@ -306,7 +351,7 @@ public class RagfairPriceService( } /// - /// Get different min/max price multipliers for different offer types (preset/pack/default) + /// Get different min/max price multipliers for different offer types (preset/pack/default) /// /// Offer is a preset /// Offer is a pack @@ -315,15 +360,21 @@ public class RagfairPriceService( { // Use different min/max values if the item is a preset or pack var priceRanges = _ragfairConfig.Dynamic.PriceRanges; - if (isPreset) return priceRanges.Preset; + if (isPreset) + { + return priceRanges.Preset; + } - if (isPack) return priceRanges.Pack; + if (isPack) + { + return priceRanges.Pack; + } return priceRanges.Default; } /// - /// Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json + /// Check to see if an items price is below its handbook price and adjust according to values set to config/ragfair.json /// /// price of item /// item template Id being checked @@ -342,13 +393,15 @@ public class RagfairPriceService( ) // var itemDetails = this.itemHelper.getItem(itemTpl); // this.logger.debug(`item below handbook price {itemDetails[1]._name} handbook: {itemHandbookPrice} flea: ${itemPrice} {priceDifferencePercent}%`); + { return Math.Round(itemHandbookPrice.Value * offerAdjustmentSettings.HandbookPriceMultiplier); + } return itemPrice; } /// - /// Multiply the price by a randomised curve where n = 2, shift = 2 + /// Multiply the price by a randomised curve where n = 2, shift = 2 /// /// price to alter /// min and max to adjust price by @@ -363,7 +416,7 @@ public class RagfairPriceService( } /// - /// Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset + /// Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset /// /// base weapon /// weapon plus mods @@ -373,7 +426,10 @@ public class RagfairPriceService( { // Get the default preset for this weapon var presetResult = GetWeaponPreset(weaponRootItem); - if (presetResult.IsDefault) return GetFleaPriceForItem(weaponRootItem.Template); + if (presetResult.IsDefault) + { + return GetFleaPriceForItem(weaponRootItem.Template); + } // Get mods on current gun not in default preset var newOrReplacedModsInPresetVsDefault = weaponWithChildren.Where(x => !presetResult.Preset.Items.Any(y => y.Template == x.Template)); @@ -382,20 +438,25 @@ public class RagfairPriceService( var extraModsPrice = 0d; foreach (var mod in newOrReplacedModsInPresetVsDefault) // Use handbook or trader price, whatever is higher (dont use dynamic flea price as purchased item cannot be relisted) + { extraModsPrice += GetHighestHandbookOrTraderPriceAsRouble(mod.Template).Value; + } // Only deduct cost of replaced mods if there's replaced/new mods if (newOrReplacedModsInPresetVsDefault.Any()) { // Add up cost of mods replaced var modsReplacedByNewMods = newOrReplacedModsInPresetVsDefault.Where( - (x) => - presetResult.Preset.Items.Any((y) => y.SlotId == x.SlotId) + x => + presetResult.Preset.Items.Any(y => y.SlotId == x.SlotId) ); // Add up replaced mods price var replacedModsPrice = 0d; - foreach (var replacedMod in modsReplacedByNewMods) replacedModsPrice += GetHighestHandbookOrTraderPriceAsRouble(replacedMod.Template).Value; + foreach (var replacedMod in modsReplacedByNewMods) + { + replacedModsPrice += GetHighestHandbookOrTraderPriceAsRouble(replacedMod.Template).Value; + } // Subtract replaced mods total from extra mods total extraModsPrice -= replacedModsPrice; @@ -406,7 +467,7 @@ public class RagfairPriceService( } /// - /// Get the highest price for an item that is stored in handbook or trader assorts + /// Get the highest price for an item that is stored in handbook or trader assorts /// /// Item to get highest price of /// rouble cost @@ -414,36 +475,62 @@ public class RagfairPriceService( { var price = GetStaticPriceForItem(itemTpl); var traderPrice = _traderHelper.GetHighestSellToTraderPrice(itemTpl); - if (traderPrice > price) price = traderPrice; + if (traderPrice > price) + { + price = traderPrice; + } return price; } /// - /// Attempt to get the default preset for a weapon, failing that get the first preset in the array - /// (assumes default = has encyclopedia entry) + /// Attempt to get the default preset for a weapon, failing that get the first preset in the array + /// (assumes default = has encyclopedia entry) /// /// weapon presets to choose from /// Default preset object protected WeaponPreset GetWeaponPreset(Item weapon) { var defaultPreset = _presetHelper.GetDefaultPreset(weapon.Template); - if (defaultPreset is not null) return new WeaponPreset { IsDefault = true, Preset = defaultPreset }; + if (defaultPreset is not null) + { + return new WeaponPreset + { + IsDefault = true, + Preset = defaultPreset + }; + } + var nonDefaultPresets = _presetHelper.GetPresets(weapon.Template); if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug( nonDefaultPresets.Count == 1 ? $"Item Id: {weapon.Template} has no default encyclopedia entry but only one preset: ({nonDefaultPresets[0].Name}), choosing preset: ({nonDefaultPresets[0].Name})" : $"Item Id: {weapon.Template} has no default encyclopedia entry, choosing first preset({nonDefaultPresets[0].Name}) of {nonDefaultPresets.Count}" ); + } - return new WeaponPreset { IsDefault = false, Preset = nonDefaultPresets[0] }; + return new WeaponPreset + { + IsDefault = false, + Preset = nonDefaultPresets[0] + }; } public record WeaponPreset { - public bool IsDefault { get; set; } - public Preset Preset { get; set; } + public bool IsDefault + { + get; + set; + } + + public Preset Preset + { + get; + set; + } } } diff --git a/Libraries/Core/Services/RagfairRequiredItemsService.cs b/Libraries/Core/Services/RagfairRequiredItemsService.cs index 641ac725..ea0e814f 100644 --- a/Libraries/Core/Services/RagfairRequiredItemsService.cs +++ b/Libraries/Core/Services/RagfairRequiredItemsService.cs @@ -1,7 +1,7 @@ using System.Collections.Concurrent; using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Ragfair; +using SptCommon.Annotations; namespace Core.Services; @@ -26,7 +26,9 @@ public class RagfairRequiredItemsService( { if (_paymentHelper.IsMoneyTpl(requirement.Template)) // This would just be too noisy + { continue; + } // Ensure key is init _requiredItemsCache.TryAdd(requirement.Template, []); diff --git a/Libraries/Core/Services/RagfairTaxService.cs b/Libraries/Core/Services/RagfairTaxService.cs index 0ee95d85..e682c2eb 100644 --- a/Libraries/Core/Services/RagfairTaxService.cs +++ b/Libraries/Core/Services/RagfairTaxService.cs @@ -54,9 +54,15 @@ public class RagfairTaxService( int? offerItemCount, bool sellInOnePiece) { - if (requirementsValue is null) return 0; + if (requirementsValue is null) + { + return 0; + } - if (offerItemCount is null) return 0; + if (offerItemCount is null) + { + return 0; + } var globals = _databaseService.GetGlobals(); @@ -71,9 +77,13 @@ public class RagfairTaxService( var requirementPriceMult = Math.Log10(requirementsPrice.Value / itemWorth); if (requirementsPrice >= itemWorth) + { requirementPriceMult = Math.Pow(requirementPriceMult, 1.08); + } else + { itemPriceMult = Math.Pow(itemPriceMult, 1.08); + } itemPriceMult = Math.Pow(4.0, itemPriceMult); requirementPriceMult = Math.Pow(4.0, requirementPriceMult); @@ -109,7 +119,10 @@ public class RagfairTaxService( var taxValue = Math.Round(discountedTax.Value * itemComissionMult); - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Tax Calculated to be: {taxValue}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Tax Calculated to be: {taxValue}"); + } return taxValue; } @@ -140,7 +153,7 @@ public class RagfairTaxService( worth += CalculateItemWorth( child, _itemHelper.GetItem(child.Template).Value, - (int)(child.Upd.StackObjectsCount ?? 1), + (int) (child.Upd.StackObjectsCount ?? 1), pmcData, false ); @@ -150,7 +163,10 @@ public class RagfairTaxService( var upd = item.Upd ??= new Upd(); - if (upd.Dogtag is not null) worth *= upd.Dogtag.Level.Value; + if (upd.Dogtag is not null) + { + worth *= upd.Dogtag.Level.Value; + } if (itemTemplate.Properties is null) { @@ -160,24 +176,34 @@ public class RagfairTaxService( } if (upd.Key is not null && (itemTemplate.Properties.MaximumNumberOfUsage ?? 0) > 0) + { worth = worth / (itemTemplate.Properties.MaximumNumberOfUsage ?? 1) * ((itemTemplate.Properties.MaximumNumberOfUsage ?? 1) - upd.Key.NumberOfUsages.Value); + } if (upd.Resource is not null && (itemTemplate.Properties.MaxResource ?? 0) > 0) - worth = (double)(worth * 0.1 + - worth * 0.9 / (itemTemplate.Properties.MaxResource ?? 1) * upd.Resource.Value); + { + worth = (double) (worth * 0.1 + + worth * 0.9 / (itemTemplate.Properties.MaxResource ?? 1) * upd.Resource.Value); + } if (upd.SideEffect is not null && (itemTemplate.Properties.MaxResource ?? 0) > 0) - worth = (double)(worth * 0.1 + - worth * 0.9 / (itemTemplate.Properties.MaxResource ?? 1) * upd.SideEffect.Value); + { + worth = (double) (worth * 0.1 + + worth * 0.9 / (itemTemplate.Properties.MaxResource ?? 1) * upd.SideEffect.Value); + } if (upd.MedKit is not null && (itemTemplate.Properties.MaxHpResource ?? 0) > 0) + { worth = worth / (itemTemplate.Properties.MaxHpResource ?? 1) * upd.MedKit.HpResource.Value; + } if (upd.FoodDrink is not null && (itemTemplate.Properties.MaxResource ?? 0) > 0) + { worth = worth / (itemTemplate.Properties.MaxResource ?? 1) * upd.FoodDrink.HpPercent.Value; + } if (upd.Repairable is not null && (itemTemplate.Properties.ArmorClass ?? 0) > 0) { diff --git a/Libraries/Core/Services/RaidTimeAdjustmentService.cs b/Libraries/Core/Services/RaidTimeAdjustmentService.cs index a69f98ae..8ce344db 100644 --- a/Libraries/Core/Services/RaidTimeAdjustmentService.cs +++ b/Libraries/Core/Services/RaidTimeAdjustmentService.cs @@ -1,6 +1,5 @@ using Core.Context; using Core.Helpers; -using SptCommon.Annotations; using Core.Models.Eft.Common; using Core.Models.Eft.Game; using Core.Models.Enums; @@ -9,7 +8,7 @@ using Core.Models.Spt.Location; using Core.Models.Utils; using Core.Servers; using Core.Utils; -using Microsoft.AspNetCore.DataProtection.KeyManagement; +using SptCommon.Annotations; namespace Core.Services; @@ -26,8 +25,8 @@ public class RaidTimeAdjustmentService( protected LocationConfig _locationConfig = _configServer.GetConfig(); /// - /// Make alterations to the base map data passed in - /// Loot multipliers/waves/wave start times + /// Make alterations to the base map data passed in + /// Loot multipliers/waves/wave start times /// /// Changes to process on map /// Map to adjust @@ -44,22 +43,26 @@ public class RaidTimeAdjustmentService( var mapSettings = GetMapSettings(mapBase.Id); if (mapSettings.AdjustWaves) // Make alterations to bot spawn waves now player is simulated spawning later + { AdjustWaves(mapBase, raidAdjustments); + } } /// - /// Adjust the loot multiplier values passed in to be a % of their original value + /// Adjust the loot multiplier values passed in to be a % of their original value /// /// Multipliers to adjust /// Percent to change values to protected void AdjustLootMultipliers(Dictionary mapLootMultiplers, double? loosePercent) { foreach (var location in mapLootMultiplers) + { mapLootMultiplers[location.Key] = _randomUtil.GetPercentOfValue(mapLootMultiplers[location.Key], loosePercent ?? 1); + } } /// - /// Adjust bot waves to act as if player spawned later + /// Adjust bot waves to act as if player spawned later /// /// Map to adjust /// Map adjustments @@ -74,8 +77,8 @@ public class RaidTimeAdjustmentService( foreach (var wave in mapBase.Waves) { // Dont let time fall below 0 - wave.TimeMin -= (int)Math.Max(startSeconds, 0); - wave.TimeMax -= (int)Math.Max(startSeconds, 0); + wave.TimeMin -= (int) Math.Max(startSeconds, 0); + wave.TimeMax -= (int) Math.Max(startSeconds, 0); } _logger.Debug( @@ -84,7 +87,7 @@ public class RaidTimeAdjustmentService( } /// - /// Create a randomised adjustment to the raid based on map data in location.json + /// Create a randomised adjustment to the raid based on map data in location.json /// /// Session id /// Raid adjustment request @@ -105,7 +108,10 @@ public class RaidTimeAdjustmentService( }; // Pmc raid, send default - if (request.Side.ToLower() == "pmc") return result; + if (request.Side.ToLower() == "pmc") + { + return result; + } // We're scav adjust values var mapSettings = GetMapSettings(request.Location); @@ -113,7 +119,9 @@ public class RaidTimeAdjustmentService( // Chance of reducing raid time for scav, not guaranteed if (!_randomUtil.GetChance100(mapSettings.ReducedChancePercent)) // Send default + { return result; + } // Get the weighted percent to reduce the raid time by var chosenRaidReductionPercent = int.Parse( @@ -131,6 +139,7 @@ public class RaidTimeAdjustmentService( if (mapSettings.ReduceLootByPercent) // Store time reduction percent in app context so loot gen can pick it up later + { _applicationContext.AddValue( ContextVariableType.RAID_ADJUSTMENTS, new RaidChanges @@ -140,6 +149,7 @@ public class RaidTimeAdjustmentService( SimulatedRaidStartSeconds = simulatedRaidStartTimeMinutes * 60 } ); + } // Update result object with new time result.RaidTimeMinutes = newRaidTimeMinutes; @@ -153,13 +163,16 @@ public class RaidTimeAdjustmentService( ); var exitAdjustments = GetExitAdjustments(mapBase, newRaidTimeMinutes); - if (exitAdjustments is not null) result.ExitChanges.AddRange(exitAdjustments); + if (exitAdjustments is not null) + { + result.ExitChanges.AddRange(exitAdjustments); + } return result; } /// - /// Get raid start time settings for specific map + /// Get raid start time settings for specific map /// /// Map Location e.g. bigmap /// ScavRaidTimeLocationSettings @@ -176,7 +189,7 @@ public class RaidTimeAdjustmentService( } /// - /// Adjust exit times to handle scavs entering raids part-way through + /// Adjust exit times to handle scavs entering raids part-way through /// /// Map base file player is on /// How long raid is in minutes @@ -187,7 +200,10 @@ public class RaidTimeAdjustmentService( // Adjust train exits only foreach (var exit in mapBase.Exits) { - if (exit.PassageRequirement != RequirementState.Train) continue; + if (exit.PassageRequirement != RequirementState.Train) + { + continue; + } // Prepare train adjustment object var exitChange = new ExtractChange diff --git a/Libraries/Core/Services/RaidWeatherService.cs b/Libraries/Core/Services/RaidWeatherService.cs index 1339af42..a044caf7 100644 --- a/Libraries/Core/Services/RaidWeatherService.cs +++ b/Libraries/Core/Services/RaidWeatherService.cs @@ -1,12 +1,11 @@ -using SptCommon.Annotations; -using Core.Generators; +using Core.Generators; using Core.Helpers; using Core.Models.Eft.Weather; using Core.Models.Enums; using Core.Models.Spt.Config; -using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Services; @@ -23,7 +22,7 @@ public class RaidWeatherService( protected List _weatherForecast = []; /// - /// Generate 24 hours of weather data starting from midnight today + /// Generate 24 hours of weather data starting from midnight today /// public void GenerateWeather(Season currentSeason) { @@ -49,7 +48,7 @@ public class RaidWeatherService( } /// - /// Get a time period to increment by, e.g. 15 or 30 minutes as milliseconds + /// Get a time period to increment by, e.g. 15 or 30 minutes as milliseconds /// /// milliseconds protected long GetWeightedWeatherTimePeriodMs() @@ -64,29 +63,29 @@ public class RaidWeatherService( } /// - /// Find the first matching weather object that applies to the current time + /// Find the first matching weather object that applies to the current time /// public Weather GetCurrentWeather() { var currentSeason = _seasonalEventService.GetActiveWeatherSeason(); ValidateWeatherDataExists(currentSeason); - return _weatherForecast.Find((weather) => weather.Timestamp >= _timeUtil.GetTimeStamp()); + return _weatherForecast.Find(weather => weather.Timestamp >= _timeUtil.GetTimeStamp()); } /// - /// Find all matching weather objects that applies to the current time + future + /// Find all matching weather objects that applies to the current time + future /// public IEnumerable GetUpcomingWeather() { var currentSeason = _seasonalEventService.GetActiveWeatherSeason(); ValidateWeatherDataExists(currentSeason); - return _weatherForecast.Where((weather) => weather.Timestamp >= _timeUtil.GetTimeStamp()); + return _weatherForecast.Where(weather => weather.Timestamp >= _timeUtil.GetTimeStamp()); } /// - /// Ensure future weather data exists + /// Ensure future weather data exists /// protected void ValidateWeatherDataExists(Season currentSeason) { @@ -94,7 +93,10 @@ public class RaidWeatherService( _weatherForecast.RemoveAll(weather => weather.Timestamp < _timeUtil.GetTimeStamp()); // Check data exists for current time - var result = _weatherForecast.Where((weather) => weather.Timestamp >= _timeUtil.GetTimeStamp()); - if (!result.Any()) GenerateWeather(currentSeason); + var result = _weatherForecast.Where(weather => weather.Timestamp >= _timeUtil.GetTimeStamp()); + if (!result.Any()) + { + GenerateWeather(currentSeason); + } } } diff --git a/Libraries/Core/Services/RepairService.cs b/Libraries/Core/Services/RepairService.cs index 4c7af55c..7b4f2456 100644 --- a/Libraries/Core/Services/RepairService.cs +++ b/Libraries/Core/Services/RepairService.cs @@ -52,16 +52,21 @@ public class RepairService( { var itemToRepair = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == repairItemDetails.Id); if (itemToRepair is null) + { _logger.Error( _localisationService.GetText( "repair-unable_to_find_item_in_inventory_cant_repair", repairItemDetails.Id ) ); + } var priceCoef = _traderHelper.GetLoyaltyLevel(traderId, pmcData).RepairPriceCoefficient; var traderRepairDetails = _traderHelper.GetTrader(traderId, sessionID)?.Repair; - if (traderRepairDetails is null) _logger.Error(_localisationService.GetText("repair-unable_to_find_trader_details_by_id", traderId)); + if (traderRepairDetails is null) + { + _logger.Error(_localisationService.GetText("repair-unable_to_find_trader_details_by_id", traderId)); + } var repairQualityMultiplier = traderRepairDetails.Quality; var repairRate = priceCoef <= 0 ? 1 : priceCoef / 100 + 1; @@ -83,9 +88,11 @@ public class RepairService( // get repair price var itemRepairCost = items[itemToRepair.Template].Properties.RepairCost; if (itemRepairCost is null) + { _logger.Error( _localisationService.GetText("repair-unable_to_find_item_repair_cost", itemToRepair.Template) ); + } var repairCost = Math.Round( itemRepairCost.Value * repairItemDetails.Count.Value * repairRate.Value * _repairConfig.PriceMultiplier @@ -127,7 +134,14 @@ public class RepairService( { var options = new ProcessBuyTradeRequestData { - SchemeItems = [new IdWithCount { Count = Math.Round(repairCost), Id = Money.ROUBLES }], + SchemeItems = + [ + new IdWithCount + { + Count = Math.Round(repairCost), + Id = Money.ROUBLES + } + ], TransactionId = traderId, Action = "SptRepair", Type = "", @@ -191,12 +205,14 @@ public class RepairService( var isHeavyArmor = itemDetails.Value.Properties.ArmorType == "Heavy"; var vestSkillToLevel = isHeavyArmor ? SkillTypes.HeavyVests : SkillTypes.LightVests; if (repairDetails.RepairPoints is null) + { _logger.Error( _localisationService.GetText( "repair-item_has_no_repair_points", repairDetails.RepairedItem.Template ) ); + } var pointsToAddToVestSkill = repairDetails.RepairPoints * _repairConfig.ArmorKitSkillPointGainPerRepairPointMultiplier; @@ -225,12 +241,14 @@ public class RepairService( // Limit gain to a max value defined in config.maxIntellectGainPerRepair if (repairDetails.RepairPoints is null) + { _logger.Error( _localisationService.GetText( "repair-item_has_no_repair_points", repairDetails.RepairedItem.Template ) ); + } return Math.Min( repairDetails.RepairPoints.Value * intRepairMultiplier, @@ -265,10 +283,16 @@ public class RepairService( // You can both crit fail and succeed at the same time, for fun (Balances out to 0 with default settings) // Add a random chance to crit-fail - if (random.Next() <= _repairConfig.WeaponTreatment.CritFailureChance) skillPoints -= _repairConfig.WeaponTreatment.CritFailureAmount; + if (random.Next() <= _repairConfig.WeaponTreatment.CritFailureChance) + { + skillPoints -= _repairConfig.WeaponTreatment.CritFailureAmount; + } // Add a random chance to crit-succeed - if (random.Next() <= _repairConfig.WeaponTreatment.CritSuccessChance) skillPoints += _repairConfig.WeaponTreatment.CritSuccessAmount; + if (random.Next() <= _repairConfig.WeaponTreatment.CritSuccessChance) + { + skillPoints += _repairConfig.WeaponTreatment.CritSuccessAmount; + } return Math.Max(skillPoints, 0); } @@ -291,7 +315,10 @@ public class RepairService( { // Find item to repair in inventory var itemToRepair = pmcData.Inventory.Items.FirstOrDefault(x => x.Id == itemToRepairId); - if (itemToRepair is null) _logger.Error(_localisationService.GetText("repair-item_not_found_unable_to_repair", itemToRepairId)); + if (itemToRepair is null) + { + _logger.Error(_localisationService.GetText("repair-item_not_found_unable_to_repair", itemToRepairId)); + } var itemsDb = _databaseService.GetItems(); var itemToRepairDetails = itemsDb[itemToRepair.Template]; @@ -317,9 +344,11 @@ public class RepairService( { var repairKitInInventory = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == repairKit.Id); if (repairKitInInventory is null) + { _logger.Error( _localisationService.GetText("repair-repair_kit_not_found_in_inventory", repairKit.Id) ); + } var repairKitDetails = itemsDb[repairKitInInventory.Template]; var repairKitReductionAmount = repairKit.Count; @@ -419,7 +448,9 @@ public class RepairService( var hasEliteCharisma = _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, pmcData); if (hasEliteCharisma) // 50/50 chance of loss being ignored at elite level + { shouldApplyDurabilityLoss = _randomUtil.GetChance100(50); + } } return shouldApplyDurabilityLoss; @@ -435,12 +466,27 @@ public class RepairService( var maxRepairAmount = repairKitDetails.Properties.MaxRepairResource; if (repairKitInInventory.Upd is null) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"Repair kit: {repairKitInInventory.Id} in inventory lacks upd object, adding"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"Repair kit: {repairKitInInventory.Id} in inventory lacks upd object, adding"); + } - repairKitInInventory.Upd = new Upd { RepairKit = new UpdRepairKit { Resource = maxRepairAmount } }; + repairKitInInventory.Upd = new Upd + { + RepairKit = new UpdRepairKit + { + Resource = maxRepairAmount + } + }; } - if (repairKitInInventory.Upd.RepairKit?.Resource is null) repairKitInInventory.Upd.RepairKit = new UpdRepairKit { Resource = maxRepairAmount }; + if (repairKitInInventory.Upd.RepairKit?.Resource is null) + { + repairKitInInventory.Upd.RepairKit = new UpdRepairKit + { + Resource = maxRepairAmount + }; + } } /// @@ -451,7 +497,10 @@ public class RepairService( public void AddBuffToItem(RepairDetails repairDetails, PmcData pmcData) { // Buffs are repair kit only - if (!repairDetails.RepairedByKit.GetValueOrDefault(false)) return; + if (!repairDetails.RepairedByKit.GetValueOrDefault(false)) + { + return; + } if (ShouldBuffItem(repairDetails, pmcData)) { @@ -520,27 +569,41 @@ public class RepairService( var globals = _databaseService.GetGlobals(); var hasTemplate = _itemHelper.GetItem(repairDetails.RepairedItem.Template); - if (!hasTemplate.Key) return false; + if (!hasTemplate.Key) + { + return false; + } var template = hasTemplate.Value; // Returns SkillTypes.LIGHT_VESTS/HEAVY_VESTS/WEAPON_TREATMENT - var itemSkillType = (SkillTypes)GetItemSkillType(template); - if (itemSkillType == null) return false; + var itemSkillType = (SkillTypes) GetItemSkillType(template); + if (itemSkillType == null) + { + return false; + } // Skill < level 10 + repairing weapon if ( itemSkillType == SkillTypes.WeaponTreatment && _profileHelper.GetSkillFromProfile(pmcData, SkillTypes.WeaponTreatment)?.Progress < 1000 ) + { return false; + } // Skill < level 10 + repairing armor if ( - new List { SkillTypes.LightVests, SkillTypes.HeavyVests }.Contains(itemSkillType) && + new List + { + SkillTypes.LightVests, + SkillTypes.HeavyVests + }.Contains(itemSkillType) && _profileHelper.GetSkillFromProfile(pmcData, itemSkillType)?.Progress < 1000 ) + { return false; + } var skillSettings = globals.Configuration.SkillsSettings.GetAllPropsAsDict(); BuffSettings buffSettings = null; @@ -548,10 +611,10 @@ public class RepairService( { case SkillTypes.LightVests: case SkillTypes.HeavyVests: - buffSettings = ((ArmorSkills)skillSettings[itemSkillType.ToString()]).BuffSettings; + buffSettings = ((ArmorSkills) skillSettings[itemSkillType.ToString()]).BuffSettings; break; case SkillTypes.WeaponTreatment: - buffSettings = ((WeaponTreatment)skillSettings[itemSkillType.ToString()]).BuffSettings; + buffSettings = ((WeaponTreatment) skillSettings[itemSkillType.ToString()]).BuffSettings; break; default: _logger.Error($"Unhandled buff type: {itemSkillType}"); @@ -566,9 +629,11 @@ public class RepairService( Math.Truncate((_profileHelper.GetSkillFromProfile(pmcData, itemSkillType)?.Progress ?? 0) / 100); if (repairDetails.RepairPoints is null) + { _logger.Error( _localisationService.GetText("repair-item_has_no_repair_points", repairDetails.RepairedItem.Template) ); + } var durabilityToRestorePercent = repairDetails.RepairPoints / template.Properties.MaxDurability; var durabilityMultiplier = GetDurabilityMultiplier( @@ -601,14 +666,26 @@ public class RepairService( if (isArmorRelated) { var armorType = itemTemplate.Properties.ArmorType; - if (armorType == "Light") return SkillTypes.LightVests; + if (armorType == "Light") + { + return SkillTypes.LightVests; + } - if (armorType == "Heavy") return SkillTypes.HeavyVests; + if (armorType == "Heavy") + { + return SkillTypes.HeavyVests; + } } - if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.WEAPON)) return SkillTypes.WeaponTreatment; + if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.WEAPON)) + { + return SkillTypes.WeaponTreatment; + } - if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.KNIFE)) return SkillTypes.Melee; + if (_itemHelper.IsOfBaseclass(itemTemplate.Id, BaseClasses.KNIFE)) + { + return SkillTypes.Melee; + } return null; } @@ -631,20 +708,44 @@ public class RepairService( public class RepairDetails { [JsonPropertyName("repairCost")] - public double? RepairCost { get; set; } + public double? RepairCost + { + get; + set; + } [JsonPropertyName("repairPoints")] - public double? RepairPoints { get; set; } + public double? RepairPoints + { + get; + set; + } [JsonPropertyName("repairedItem")] - public Item? RepairedItem { get; set; } + public Item? RepairedItem + { + get; + set; + } [JsonPropertyName("repairedItemIsArmor")] - public bool? RepairedItemIsArmor { get; set; } + public bool? RepairedItemIsArmor + { + get; + set; + } [JsonPropertyName("repairAmount")] - public double? RepairAmount { get; set; } + public double? RepairAmount + { + get; + set; + } [JsonPropertyName("repairedByKit")] - public bool? RepairedByKit { get; set; } + public bool? RepairedByKit + { + get; + set; + } } diff --git a/Libraries/Core/Services/SeasonalEventService.cs b/Libraries/Core/Services/SeasonalEventService.cs index dbb21ede..d0214bf6 100644 --- a/Libraries/Core/Services/SeasonalEventService.cs +++ b/Libraries/Core/Services/SeasonalEventService.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; @@ -7,6 +6,7 @@ using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; using SptCommon.Extensions; namespace Core.Services; @@ -24,15 +24,7 @@ public class SeasonalEventService( ConfigServer _configServer ) { - protected SeasonalEventConfig _seasonalEventConfig = _configServer.GetConfig(); - protected QuestConfig _questConfig = _configServer.GetConfig(); - protected HttpConfig _httpConfig = _configServer.GetConfig(); - protected WeatherConfig _weatherConfig = _configServer.GetConfig(); - protected LocationConfig _locationConfig = _configServer.GetConfig(); - - private List _currentlyActiveEvents = []; - private bool _christmasEventActive = false; - private bool _halloweenEventActive = false; + private bool _christmasEventActive; protected IReadOnlyList _christmasEventItems = [ @@ -61,6 +53,9 @@ public class SeasonalEventService( ItemTpl.FACECOVER_AYBOLIT_MASK ]; + private List _currentlyActiveEvents = []; + private bool _halloweenEventActive; + protected IReadOnlyList _halloweenEventItems = [ ItemTpl.FACECOVER_SPOOKY_SKULL_MASK, @@ -76,8 +71,14 @@ public class SeasonalEventService( ItemTpl.FACECOVER_HOCKEY_PLAYER_MASK_QUIET ]; + protected HttpConfig _httpConfig = _configServer.GetConfig(); + protected LocationConfig _locationConfig = _configServer.GetConfig(); + protected QuestConfig _questConfig = _configServer.GetConfig(); + protected SeasonalEventConfig _seasonalEventConfig = _configServer.GetConfig(); + protected WeatherConfig _weatherConfig = _configServer.GetConfig(); + /// - /// Get an array of christmas items found in bots inventories as loot + /// Get an array of christmas items found in bots inventories as loot /// /// array public IEnumerable GetChristmasEventItems() @@ -86,7 +87,7 @@ public class SeasonalEventService( } /// - /// Get an array of halloween items found in bots inventories as loot + /// Get an array of halloween items found in bots inventories as loot /// /// array public IEnumerable GetHalloweenEventItems() @@ -105,7 +106,7 @@ public class SeasonalEventService( } /// - /// Check if item id exists in christmas or halloween event arrays + /// Check if item id exists in christmas or halloween event arrays /// /// item tpl to check for /// @@ -115,7 +116,7 @@ public class SeasonalEventService( } /// - /// Get active seasonal events + /// Get active seasonal events /// /// Array of active events public List GetActiveEvents() @@ -124,23 +125,29 @@ public class SeasonalEventService( } /// - /// Get an array of seasonal items that should not appear - /// e.g. if halloween is active, only return christmas items - /// or, if halloween and christmas are inactive, return both sets of items + /// Get an array of seasonal items that should not appear + /// e.g. if halloween is active, only return christmas items + /// or, if halloween and christmas are inactive, return both sets of items /// /// array of tpl strings public List GetInactiveSeasonalEventItems() { var items = new List(); - if (!ChristmasEventEnabled()) items.AddRange(_christmasEventItems); + if (!ChristmasEventEnabled()) + { + items.AddRange(_christmasEventItems); + } - if (!HalloweenEventEnabled()) items.AddRange(_halloweenEventItems); + if (!HalloweenEventEnabled()) + { + items.AddRange(_halloweenEventItems); + } return items; } /// - /// Is a seasonal event currently active + /// Is a seasonal event currently active /// /// true if event is active public bool SeasonalEventEnabled() @@ -149,7 +156,7 @@ public class SeasonalEventService( } /// - /// Is christmas event active + /// Is christmas event active /// /// true if active public bool ChristmasEventEnabled() @@ -158,7 +165,7 @@ public class SeasonalEventService( } /// - /// is halloween event active + /// is halloween event active /// /// true if active public bool HalloweenEventEnabled() @@ -167,7 +174,7 @@ public class SeasonalEventService( } /// - /// Is detection of seasonal events enabled (halloween / christmas) + /// Is detection of seasonal events enabled (halloween / christmas) /// /// true if seasonal events should be checked for public bool IsAutomaticEventDetectionEnabled() @@ -176,7 +183,7 @@ public class SeasonalEventService( } /// - /// Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + /// Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween /// /// Name of event to get gear changes for /// bots with equipment changes @@ -186,7 +193,7 @@ public class SeasonalEventService( } /// - /// Get a dictionary of loot changes to apply to bots for a specific event e.g. Christmas/Halloween + /// Get a dictionary of loot changes to apply to bots for a specific event e.g. Christmas/Halloween /// /// Name of event to get gear changes for /// bots with loot changes @@ -196,7 +203,7 @@ public class SeasonalEventService( } /// - /// Get the dates each seasonal event starts and ends at + /// Get the dates each seasonal event starts and ends at /// /// Record with event name + start/end date public List GetEventDetails() @@ -205,7 +212,7 @@ public class SeasonalEventService( } /// - /// Look up quest in configs/quest.json + /// Look up quest in configs/quest.json /// /// Quest to look up /// event type (Christmas/Halloween/None) @@ -213,32 +220,38 @@ public class SeasonalEventService( public bool IsQuestRelatedToEvent(string questId, SeasonalEventType eventType) { var eventQuestData = _questConfig.EventQuests.GetValueOrDefault(questId, null); - if (eventQuestData?.Season == eventType) return true; + if (eventQuestData?.Season == eventType) + { + return true; + } return false; } /// - /// Handle activating seasonal events + /// Handle activating seasonal events /// public void EnableSeasonalEvents() { if (_currentlyActiveEvents.Any()) { var globalConfig = _databaseService.GetGlobals().Configuration; - foreach (var activeEvent in _currentlyActiveEvents) UpdateGlobalEvents(globalConfig, activeEvent); + foreach (var activeEvent in _currentlyActiveEvents) + { + UpdateGlobalEvents(globalConfig, activeEvent); + } } } /// - /// Force a seasonal event to be active + /// Force a seasonal event to be active /// /// Event to force active /// True if event was successfully force enabled public bool ForceSeasonalEvent(SeasonalEventType eventType) { var globalConfig = _databaseService.GetGlobals().Configuration; - var seasonEvent = _seasonalEventConfig.Events.FirstOrDefault((e) => e.Type == eventType); + var seasonEvent = _seasonalEventConfig.Events.FirstOrDefault(e => e.Type == eventType); if (seasonEvent is null) { _logger.Warning($"Unable to force event: {eventType} as it cannot be found in events config"); @@ -251,7 +264,7 @@ public class SeasonalEventService( } /// - /// Store active events inside class list property `currentlyActiveEvents` + set class properties: christmasEventActive/halloweenEventActive + /// Store active events inside class list property `currentlyActiveEvents` + set class properties: christmasEventActive/halloweenEventActive /// public void CacheActiveEvents() { @@ -264,22 +277,32 @@ public class SeasonalEventService( // Add active events to array foreach (var events in seasonalEvents) { - if (!events.Enabled) continue; + if (!events.Enabled) + { + continue; + } - if (DateIsBetweenTwoDates(currentDate, events.StartMonth, events.StartDay, events.EndMonth, events.EndDay)) _currentlyActiveEvents.Add(events); + if (DateIsBetweenTwoDates(currentDate, events.StartMonth, events.StartDay, events.EndMonth, events.EndDay)) + { + _currentlyActiveEvents.Add(events); + } } } /// - /// Get the currently active weather season e.g. SUMMER/AUTUMN/WINTER + /// Get the currently active weather season e.g. SUMMER/AUTUMN/WINTER /// /// Season enum value public Season GetActiveWeatherSeason() { - if (_weatherConfig.OverrideSeason.HasValue) return _weatherConfig.OverrideSeason.Value; + if (_weatherConfig.OverrideSeason.HasValue) + { + return _weatherConfig.OverrideSeason.Value; + } var currentDate = _timeUtil.GetDateTimeNow(); foreach (var seasonRange in _weatherConfig.SeasonDates) + { if ( DateIsBetweenTwoDates( currentDate, @@ -289,7 +312,10 @@ public class SeasonalEventService( seasonRange.EndDay ?? 0 ) ) + { return seasonRange.SeasonType ?? Season.SUMMER; + } + } _logger.Warning(_localisationService.GetText("season-no_matching_season_found_for_date")); @@ -297,9 +323,9 @@ public class SeasonalEventService( } /// - /// Does the provided date fit between the two defined dates? - /// Excludes year - /// Inclusive of end date upto 23 hours 59 minutes + /// Does the provided date fit between the two defined dates? + /// Excludes year + /// Inclusive of end date upto 23 hours 59 minutes /// /// Date to check is between 2 dates /// Lower bound for month @@ -316,7 +342,7 @@ public class SeasonalEventService( } /// - /// Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) + /// Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService) /// /// Bots inventory to iterate over /// the role of the bot being processed @@ -330,16 +356,18 @@ public class SeasonalEventService( foreach (var equipmentSlotKey in equipmentSlotsToFilter) { if (botInventory.Equipment[equipmentSlotKey] is null) + { _logger.Warning( _localisationService.GetText( "seasonal-missing_equipment_slot_on_bot", new { equipmentSlot = equipmentSlotKey, - botRole = botRole + botRole } ) ); + } Dictionary equipment = botInventory.Equipment[equipmentSlotKey]; botInventory.Equipment[equipmentSlotKey] = equipment.Where(i => !_christmasEventItems.Contains(i.Key)).ToDictionary(); @@ -349,34 +377,49 @@ public class SeasonalEventService( var props = botInventory.Items.GetType().GetProperties(); foreach (var lootContainerKey in lootContainersToFilter) { - var prop = (Dictionary?)props.FirstOrDefault(p => p.Name.ToLower() == lootContainerKey.ToLower()).GetValue(botInventory.Items); + var prop = (Dictionary?) props.FirstOrDefault(p => p.Name.ToLower() == lootContainerKey.ToLower()).GetValue(botInventory.Items); if (prop is null) + { _logger.Warning( _localisationService.GetText( "seasonal-missing_loot_container_slot_on_bot", new { lootContainer = lootContainerKey, - botRole = botRole + botRole } ) ); + } List tplsToRemove = []; foreach (var tplKey in prop) + { if (christmasItems.Contains(tplKey.Key)) + { tplsToRemove.Add(tplKey.Key); + } + } - foreach (var tplToRemove in tplsToRemove) prop.Remove(tplToRemove); + foreach (var tplToRemove in tplsToRemove) + { + prop.Remove(tplToRemove); + } // Get non-christmas items var nonChristmasTpls = prop.Where(tpl => !christmasItems.Contains(tpl.Key)); - if (nonChristmasTpls.Count() == 0) continue; + if (nonChristmasTpls.Count() == 0) + { + continue; + } Dictionary intermediaryDict = new(); - foreach (var tpl in nonChristmasTpls) intermediaryDict[tpl.Key] = prop[tpl.Key]; + foreach (var tpl in nonChristmasTpls) + { + intermediaryDict[tpl.Key] = prop[tpl.Key]; + } // Replace the original containerItems with the updated one prop = intermediaryDict; @@ -384,7 +427,7 @@ public class SeasonalEventService( } /// - /// Make adjusted to server code based on the name of the event passed in + /// Make adjusted to server code based on the name of the event passed in /// /// globals.json /// Name of the event to enable. e.g. Christmas @@ -429,7 +472,7 @@ public class SeasonalEventService( { _halloweenEventActive = true; - globalConfig.EventType = globalConfig.EventType.Where((x) => x != EventType.None).ToList(); + globalConfig.EventType = globalConfig.EventType.Where(x => x != EventType.None).ToList(); globalConfig.EventType.Add(EventType.Halloween); globalConfig.EventType.Add(EventType.HalloweenIllumination); globalConfig.Health.ProfileHealthSettings.DefaultStimulatorBuff = "Buffs_Halloween"; @@ -441,14 +484,25 @@ public class SeasonalEventService( AddEventBossesToMaps("halloweensummon"); } - if (eventType.Settings?.ZombieSettings?.Enabled ?? false) ConfigureZombies(eventType.Settings.ZombieSettings); + if (eventType.Settings?.ZombieSettings?.Enabled ?? false) + { + ConfigureZombies(eventType.Settings.ZombieSettings); + } - if (eventType.Settings?.RemoveEntryRequirement is not null) RemoveEntryRequirement(eventType.Settings.RemoveEntryRequirement); + if (eventType.Settings?.RemoveEntryRequirement is not null) + { + RemoveEntryRequirement(eventType.Settings.RemoveEntryRequirement); + } if (eventType.Settings?.ReplaceBotHostility ?? false) + { ReplaceBotHostility(_seasonalEventConfig.HostilitySettingsForEvent.FirstOrDefault(x => x.Key == "zombies").Value); + } - if (eventType.Settings?.AdjustBotAppearances ?? false) AdjustBotAppearanceValues(eventType.Type); + if (eventType.Settings?.AdjustBotAppearances ?? false) + { + AdjustBotAppearanceValues(eventType.Type); + } AddPumpkinsToScavBackpacks(); AdjustTraderIcons(eventType.Type); @@ -460,7 +514,7 @@ public class SeasonalEventService( if (eventType.Settings?.EnableChristmasHideout ?? false) { - globalConfig.EventType = globalConfig.EventType.Where((x) => x != EventType.None).ToList(); + globalConfig.EventType = globalConfig.EventType.Where(x => x != EventType.None).ToList(); globalConfig.EventType.Add(EventType.Christmas); } @@ -474,7 +528,10 @@ public class SeasonalEventService( } EnableDancingTree(); - if (eventType.Settings?.AdjustBotAppearances ?? false) AdjustBotAppearanceValues(eventType.Type); + if (eventType.Settings?.AdjustBotAppearances ?? false) + { + AdjustBotAppearanceValues(eventType.Type); + } } private void ApplyNewYearsEvent(SeasonalEvent eventType, Config globalConfig) @@ -483,7 +540,7 @@ public class SeasonalEventService( if (eventType.Settings?.EnableChristmasHideout ?? false) { - globalConfig.EventType = globalConfig.EventType.Where((x) => x != EventType.None).ToList(); + globalConfig.EventType = globalConfig.EventType.Where(x => x != EventType.None).ToList(); globalConfig.EventType.Add(EventType.Christmas); } @@ -498,18 +555,27 @@ public class SeasonalEventService( EnableDancingTree(); - if (eventType.Settings?.AdjustBotAppearances ?? false) AdjustBotAppearanceValues(SeasonalEventType.Christmas); + if (eventType.Settings?.AdjustBotAppearances ?? false) + { + AdjustBotAppearanceValues(SeasonalEventType.Christmas); + } } private void AdjustBotAppearanceValues(SeasonalEventType season) { var adjustments = _seasonalEventConfig.BotAppearanceChanges[season]; - if (adjustments is null) return; + if (adjustments is null) + { + return; + } foreach (var botTypeKey in adjustments) { var botDb = _databaseService.GetBots().Types[botTypeKey.Key]; - if (botDb is null) continue; + if (botDb is null) + { + continue; + } var botAppearanceAdjustments = botTypeKey.Value; foreach (var appearanceKey in botAppearanceAdjustments) @@ -519,7 +585,7 @@ public class SeasonalEventService( foreach (var itemKey in weightAdjustments) { var prop = props.FirstOrDefault(x => string.Equals(x.Name, appearanceKey.Key, StringComparison.CurrentCultureIgnoreCase)); - var propValue = (Dictionary)prop.GetValue(botDb.BotAppearance); + var propValue = (Dictionary) prop.GetValue(botDb.BotAppearance); propValue[itemKey.Key] = weightAdjustments[itemKey.Key]; prop.SetValue(botDb.BotAppearance, propValue); } @@ -537,13 +603,22 @@ public class SeasonalEventService( foreach (var locationProp in props) { - if (ignoreList.Contains(locationProp.Name)) continue; + if (ignoreList.Contains(locationProp.Name)) + { + continue; + } - var location = (Location)locationProp.GetValue(locations); - if (location?.Base?.BotLocationModifier?.AdditionalHostilitySettings is null) continue; + var location = (Location) locationProp.GetValue(locations); + if (location?.Base?.BotLocationModifier?.AdditionalHostilitySettings is null) + { + continue; + } var newHostilitySettings = useDefault ? new List() : hostilitySettings[locationProp.Name]; - if (newHostilitySettings is null) continue; + if (newHostilitySettings is null) + { + continue; + } location.Base.BotLocationModifier.AdditionalHostilitySettings = new List(); } @@ -561,9 +636,13 @@ public class SeasonalEventService( public void GivePlayerSeasonalGifts(string sessionId) { - if (_currentlyActiveEvents is null) return; + if (_currentlyActiveEvents is null) + { + return; + } foreach (var seasonEvent in _currentlyActiveEvents) + { switch (seasonEvent.Type) { case SeasonalEventType.Christmas: @@ -574,10 +653,11 @@ public class SeasonalEventService( GiveGift(sessionId, "NewYear2024"); break; } + } } /// - /// Force zryachiy to always have a melee weapon + /// Force zryachiy to always have a melee weapon /// protected void AdjustZryachiyMeleeChance() { @@ -599,7 +679,7 @@ public class SeasonalEventService( } /// - /// Enable the halloween zryachiy summon event + /// Enable the halloween zryachiy summon event /// protected void EnableHalloweenSummonEvent() { @@ -619,26 +699,34 @@ public class SeasonalEventService( var mappedLocations = GetLocationFromInfectedLocation(infectedLocationKvP.Key); foreach (var locationKey in mappedLocations) + { _databaseService.GetLocation( locationKey.ToLower() ) .Base.Events.Halloween2024.InfectionPercentage = zombieSettings.MapInfectionAmount[infectedLocationKvP.Key]; + } globalInfectionDict[infectedLocationKvP.Key] = zombieSettings.MapInfectionAmount[infectedLocationKvP.Key]; } - foreach (var locationId in zombieSettings.DisableBosses) _databaseService.GetLocation(locationId).Base.BossLocationSpawn = []; + foreach (var locationId in zombieSettings.DisableBosses) + { + _databaseService.GetLocation(locationId).Base.BossLocationSpawn = []; + } - foreach (var locationId in zombieSettings.DisableWaves) _databaseService.GetLocation(locationId).Base.Waves = []; + foreach (var locationId in zombieSettings.DisableWaves) + { + _databaseService.GetLocation(locationId).Base.Waves = []; + } var locationsWithActiveInfection = GetLocationsWithZombies(zombieSettings.MapInfectionAmount); AddEventBossesToMaps("halloweenzombies", locationsWithActiveInfection); } /// - /// Get location ids of maps with an infection above 0 + /// Get location ids of maps with an infection above 0 /// /// Dict of locations with their infection percentage /// List of location ids @@ -648,17 +736,20 @@ public class SeasonalEventService( // Get only the locations with an infection above 0 var infectionKeys = locationInfections.Where( - (location) => locationInfections[location.Key] > 0 + location => locationInfections[location.Key] > 0 ); // Convert the infected location id into its generic location id - foreach (var location in infectionKeys) result.AddRange(GetLocationFromInfectedLocation(location.Key)); + foreach (var location in infectionKeys) + { + result.AddRange(GetLocationFromInfectedLocation(location.Key)); + } return result; } /// - /// BSG store the location ids differently inside `LocationInfection`, need to convert to matching location IDs + /// BSG store the location ids differently inside `LocationInfection`, need to convert to matching location IDs /// /// Key to convert /// List of locations @@ -692,13 +783,13 @@ public class SeasonalEventService( continue; } - ((Location)locations[map.Key]).Base.Waves = []; - ((Location)locations[map.Key]).Base.Waves.AddRange(wavesToAdd); + ((Location) locations[map.Key]).Base.Waves = []; + ((Location) locations[map.Key]).Base.Waves.AddRange(wavesToAdd); } } /// - /// Add event bosses to maps + /// Add event bosses to maps /// /// Seasonal event, e.g. HALLOWEEN/CHRISTMAS /// OPTIONAL - Maps to add bosses to @@ -721,19 +812,25 @@ public class SeasonalEventService( continue; } - if (mapIdWhitelist is null || !mapIdWhitelist.Contains(key)) continue; + if (mapIdWhitelist is null || !mapIdWhitelist.Contains(key)) + { + continue; + } foreach (var boss in bossesToAdd) { - var mapBosses = ((Location)locations[key]).Base.BossLocationSpawn; + var mapBosses = ((Location) locations[key]).Base.BossLocationSpawn; // If no bosses match by name - if (mapBosses.All(bossSpawn => bossSpawn.BossName != boss.BossName)) ((Location)locations[key]).Base.BossLocationSpawn.AddRange(bossesToAdd); + if (mapBosses.All(bossSpawn => bossSpawn.BossName != boss.BossName)) + { + ((Location) locations[key]).Base.BossLocationSpawn.AddRange(bossesToAdd); + } } } } /// - /// Change trader icons to be more event themed (Halloween only so far) + /// Change trader icons to be more event themed (Halloween only so far) /// /// What event is active protected void AdjustTraderIcons(SeasonalEventType eventType) @@ -770,7 +867,7 @@ public class SeasonalEventService( } /// - /// Add lootable items from backpack into patrol.ITEMS_TO_DROP difficulty property + /// Add lootable items from backpack into patrol.ITEMS_TO_DROP difficulty property /// protected void AddLootItemsToGifterDropItemsList() { @@ -786,7 +883,7 @@ public class SeasonalEventService( } /// - /// Read in data from seasonalEvents.json and add found equipment items to bots + /// Read in data from seasonalEvents.json and add found equipment items to bots /// /// Name of the event to read equipment in from config protected void AddEventGearToBots(SeasonalEventType eventType) @@ -822,7 +919,7 @@ public class SeasonalEventService( // Grab gear to add and loop over it foreach (var itemToAddKvP in equipmentKvP.Value) { - var equipmentSlot = (EquipmentSlots)Enum.Parse(typeof(EquipmentSlots), equipmentKvP.Key); + var equipmentSlot = (EquipmentSlots) Enum.Parse(typeof(EquipmentSlots), equipmentKvP.Key); var equipmentDict = botToUpdate.BotInventory.Equipment[equipmentSlot]; equipmentDict[itemToAddKvP.Key] = equipmentKvP.Value[itemToAddKvP.Key]; } @@ -831,7 +928,7 @@ public class SeasonalEventService( } /// - /// Read in data from seasonalEvents.json and add found loot items to bots + /// Read in data from seasonalEvents.json and add found loot items to bots /// /// Name of the event to read loot in from config protected void AddEventLootToBots(SeasonalEventType eventType) @@ -870,7 +967,7 @@ public class SeasonalEventService( } /// - /// Add pumpkin loot boxes to scavs + /// Add pumpkin loot boxes to scavs /// protected void AddPumpkinsToScavBackpacks() { @@ -889,7 +986,7 @@ public class SeasonalEventService( } /// - /// Set Khorovod(dancing tree) chance to 100% on all maps that support it + /// Set Khorovod(dancing tree) chance to 100% on all maps that support it /// protected void EnableDancingTree() { @@ -898,7 +995,10 @@ public class SeasonalEventService( foreach (var mapKvP in maps.GetDictionary()) { // Skip maps that have no tree - if (mapsToCheck.Contains(mapKvP.Key)) continue; + if (mapsToCheck.Contains(mapKvP.Key)) + { + continue; + } var mapData = mapKvP.Value; if (mapData.Base?.Events?.Khorovod?.Chance is not null) @@ -910,7 +1010,7 @@ public class SeasonalEventService( } /// - /// Add santa to maps + /// Add santa to maps /// protected void AddGifterBotToMaps() { @@ -925,7 +1025,10 @@ public class SeasonalEventService( } // Dont add gifter to map twice - if (mapData.Base.BossLocationSpawn.Any((boss) => boss.BossName == "gifter")) continue; + if (mapData.Base.BossLocationSpawn.Any(boss => boss.BossName == "gifter")) + { + continue; + } mapData.Base.BossLocationSpawn.Add( new BossLocationSpawn @@ -954,19 +1057,26 @@ public class SeasonalEventService( { if (seasonalEvent.Settings?.EnableChristmasHideout ?? false) { - globalConfig.EventType = globalConfig.EventType.Where((x) => x != EventType.None).ToList(); + globalConfig.EventType = globalConfig.EventType.Where(x => x != EventType.None).ToList(); globalConfig.EventType.Add(EventType.Christmas); } if (seasonalEvent.Settings?.EnableHalloweenHideout ?? false) { - globalConfig.EventType = globalConfig.EventType.Where((x) => x != EventType.None).ToList(); + globalConfig.EventType = globalConfig.EventType.Where(x => x != EventType.None).ToList(); globalConfig.EventType.Add(EventType.Halloween); globalConfig.EventType.Add(EventType.HalloweenIllumination); } - if (seasonalEvent.Settings?.AddEventGearToBots ?? false) AddEventGearToBots(seasonalEvent.Type); - if (seasonalEvent.Settings?.AddEventLootToBots ?? false) AddEventLootToBots(seasonalEvent.Type); + if (seasonalEvent.Settings?.AddEventGearToBots ?? false) + { + AddEventGearToBots(seasonalEvent.Type); + } + + if (seasonalEvent.Settings?.AddEventLootToBots ?? false) + { + AddEventLootToBots(seasonalEvent.Type); + } if (seasonalEvent.Settings?.EnableSummoning ?? false) { @@ -974,14 +1084,24 @@ public class SeasonalEventService( AddEventBossesToMaps("halloweensummon"); } - if (seasonalEvent.Settings?.ZombieSettings?.Enabled ?? false) ConfigureZombies(seasonalEvent.Settings.ZombieSettings); - if (seasonalEvent.Settings?.ForceSeason is not null) _weatherConfig.OverrideSeason = seasonalEvent.Settings.ForceSeason; + if (seasonalEvent.Settings?.ZombieSettings?.Enabled ?? false) + { + ConfigureZombies(seasonalEvent.Settings.ZombieSettings); + } - if (seasonalEvent.Settings?.AdjustBotAppearances ?? false) AdjustBotAppearanceValues(seasonalEvent.Type); + if (seasonalEvent.Settings?.ForceSeason is not null) + { + _weatherConfig.OverrideSeason = seasonalEvent.Settings.ForceSeason; + } + + if (seasonalEvent.Settings?.AdjustBotAppearances ?? false) + { + AdjustBotAppearanceValues(seasonalEvent.Type); + } } /// - /// Send gift to player if they have not already received it + /// Send gift to player if they have not already received it /// /// Player to send gift to /// Key of gift to give @@ -989,11 +1109,13 @@ public class SeasonalEventService( { var giftData = _giftService.GetGiftById(giftKey); if (!_profileHelper.PlayerHasRecievedMaxNumberOfGift(playerId, giftKey, giftData.MaxToSendPlayer ?? 5)) + { _giftService.SendGiftToPlayer(playerId, giftKey); + } } /// - /// Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` + /// Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy` /// /// Event bot role type /// Bot role as string @@ -1003,7 +1125,7 @@ public class SeasonalEventService( } /// - /// Force the weather to be snow + /// Force the weather to be snow /// public void EnableSnow() { diff --git a/Libraries/Core/Services/TraderAssortService.cs b/Libraries/Core/Services/TraderAssortService.cs index 028f9efb..4087385a 100644 --- a/Libraries/Core/Services/TraderAssortService.cs +++ b/Libraries/Core/Services/TraderAssortService.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; -using Core.Models.Eft.Common.Tables; using Core.Helpers; +using Core.Models.Eft.Common.Tables; +using SptCommon.Annotations; namespace Core.Services; @@ -19,7 +19,7 @@ public class TraderAssortService( } /// - /// Store trader assorts inside a class property + /// Store trader assorts inside a class property /// /// Trader id to store assorts against /// Assorts to store diff --git a/Libraries/Core/Services/TraderPurchasePersisterService.cs b/Libraries/Core/Services/TraderPurchasePersisterService.cs index 0b3f43f7..60d4518e 100644 --- a/Libraries/Core/Services/TraderPurchasePersisterService.cs +++ b/Libraries/Core/Services/TraderPurchasePersisterService.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Helpers; using Core.Models.Eft.Profile; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Utils; +using SptCommon.Annotations; namespace Core.Services; @@ -30,9 +30,15 @@ public class TraderPurchasePersisterService( { var profile = _profileHelper.GetFullProfile(sessionId); - if (profile.TraderPurchases is null) return null; + if (profile.TraderPurchases is null) + { + return null; + } - if (profile.TraderPurchases.ContainsKey(traderId)) return profile.TraderPurchases[traderId]; + if (profile.TraderPurchases.ContainsKey(traderId)) + { + return profile.TraderPurchases[traderId]; + } return null; } @@ -51,13 +57,22 @@ public class TraderPurchasePersisterService( { var profile = _profileHelper.GetFullProfile(sessionId); - if (profile.TraderPurchases is null) return null; + if (profile.TraderPurchases is null) + { + return null; + } - if (!profile.TraderPurchases.TryGetValue(traderId, out _)) profile.TraderPurchases.TryAdd(traderId, new Dictionary()); + if (!profile.TraderPurchases.TryGetValue(traderId, out _)) + { + profile.TraderPurchases.TryAdd(traderId, new Dictionary()); + } var traderPurchases = profile.TraderPurchases[traderId]; - if (!traderPurchases.TryGetValue(assortId, out _)) traderPurchases.TryAdd(assortId, new TraderPurchaseData()); + if (!traderPurchases.TryGetValue(assortId, out _)) + { + traderPurchases.TryAdd(assortId, new TraderPurchaseData()); + } return traderPurchases[assortId]; } @@ -73,10 +88,16 @@ public class TraderPurchasePersisterService( foreach (var profile in profiles) { // Skip if no purchases - if (profile.Value.TraderPurchases is null) continue; + if (profile.Value.TraderPurchases is null) + { + continue; + } // Skip if no trader-speicifc purchases - if (!profile.Value.TraderPurchases.TryGetValue(traderId, out _)) continue; + if (!profile.Value.TraderPurchases.TryGetValue(traderId, out _)) + { + continue; + } profile.Value.TraderPurchases[traderId] = new Dictionary(); } @@ -97,11 +118,14 @@ public class TraderPurchasePersisterService( // Skip if no purchases or no trader-specific purchases var purchasesFromTrader = profile.TraderPurchases?.GetValueOrDefault(traderId, null); - if (purchasesFromTrader is null) continue; + if (purchasesFromTrader is null) + { + continue; + } foreach (var purchaseKvP in purchasesFromTrader) { - var traderUpdateDetails = _traderConfig.UpdateTime.FirstOrDefault((x) => x.TraderId == traderId); + var traderUpdateDetails = _traderConfig.UpdateTime.FirstOrDefault(x => x.TraderId == traderId); if (traderUpdateDetails is null) { _logger.Error( @@ -110,7 +134,7 @@ public class TraderPurchasePersisterService( new { profileId = profile.ProfileInfo.ProfileId, - traderId = traderId + traderId } ) ); diff --git a/Libraries/Core/Utils/App.cs b/Libraries/Core/Utils/App.cs index 8fb69327..c5f7fb47 100644 --- a/Libraries/Core/Utils/App.cs +++ b/Libraries/Core/Utils/App.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Services; using Server; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Utils; @@ -12,20 +12,20 @@ namespace Core.Utils; [Injectable(InjectionType.Singleton)] public class App { - protected Dictionary _onUpdateLastRun = new(); - protected Timer _timer; - protected CoreConfig _coreConfig; - - protected ISptLogger _logger; - protected TimeUtil _timeUtil; protected readonly RandomUtil _randomUtil; - protected LocalisationService _localisationService; protected ConfigServer _configServer; + protected CoreConfig _coreConfig; + protected DatabaseService _databaseService; protected EncodingUtil _encodingUtil; protected HttpServer _httpServer; - protected DatabaseService _databaseService; + protected LocalisationService _localisationService; + + protected ISptLogger _logger; protected IEnumerable _onLoad; protected IEnumerable _onUpdate; + protected Dictionary _onUpdateLastRun = new(); + protected Timer _timer; + protected TimeUtil _timeUtil; public App( ISptLogger logger, @@ -69,13 +69,21 @@ public class App // _logger.Debug($"RAM: {(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)}GB"); - if (ProgramStatics.BUILD_TIME() is not null) _logger.Debug($"Date: {ProgramStatics.BUILD_TIME()}"); + if (ProgramStatics.BUILD_TIME() is not null) + { + _logger.Debug($"Date: {ProgramStatics.BUILD_TIME()}"); + } - if (ProgramStatics.COMMIT() is not null) _logger.Debug($"Commit: {ProgramStatics.COMMIT()}"); + if (ProgramStatics.COMMIT() is not null) + { + _logger.Debug($"Commit: {ProgramStatics.COMMIT()}"); + } } foreach (var onLoad in _onLoad) + { await onLoad.OnLoad(); + } _timer = new Timer(_ => Update(_onUpdate), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5000)); @@ -84,7 +92,10 @@ public class App protected string GetRandomisedStartMessage() { - if (_randomUtil.GetInt(1, 1000) > 999) return _localisationService.GetRandomTextThatMatchesPartialKey("server_start_meme_"); + if (_randomUtil.GetInt(1, 1000) > 999) + { + return _localisationService.GetRandomTextThatMatchesPartialKey("server_start_meme_"); + } return _localisationService.GetText("server_start_success"); } @@ -94,13 +105,19 @@ public class App try { // If the server has failed to start, skip any update calls - if (!_httpServer.IsStarted() || !_databaseService.IsDatabaseValid()) return; + if (!_httpServer.IsStarted() || !_databaseService.IsDatabaseValid()) + { + return; + } foreach (var updateable in onUpdateComponents) { var success = false; if (!_onUpdateLastRun.TryGetValue(updateable.GetRoute(), out var lastRunTimeTimestamp)) + { lastRunTimeTimestamp = 0; + } + var secondsSinceLastRun = _timeUtil.GetTimeStamp() - lastRunTimeTimestamp; try @@ -122,8 +139,12 @@ public class App const int warnTime = 20 * 60; if (secondsSinceLastRun % warnTime == 0) + { if (_logger.IsLogEnabled(LogLevel.Debug)) + { _logger.Debug(_localisationService.GetText("route_onupdate_no_response", updateable.GetRoute())); + } + } } } } diff --git a/Libraries/Core/Utils/Collections/ExhaustableArray.cs b/Libraries/Core/Utils/Collections/ExhaustableArray.cs index 14db6fc7..2ad3400c 100644 --- a/Libraries/Core/Utils/Collections/ExhaustableArray.cs +++ b/Libraries/Core/Utils/Collections/ExhaustableArray.cs @@ -4,9 +4,9 @@ namespace Core.Utils.Collections; public record ExhaustableArray : IExhaustableArray { - private LinkedList? pool; - private RandomUtil _randomUtil; - private ICloner _cloner; + private readonly ICloner _cloner; + private readonly RandomUtil _randomUtil; + private readonly LinkedList? pool; public ExhaustableArray( T[]? itemPool, @@ -37,7 +37,10 @@ public record ExhaustableArray : IExhaustableArray public T? GetRandomValue() { - if (pool?.Count == 0) return default; + if (pool?.Count == 0) + { + return default; + } var index = _randomUtil.GetInt(0, pool.Count - 1); var element = pool.ElementAt(index); @@ -47,7 +50,10 @@ public record ExhaustableArray : IExhaustableArray public T? GetFirstValue() { - if (pool?.Count == 0) return default; + if (pool?.Count == 0) + { + return default; + } var element = pool.ElementAt(0); pool.Remove(element); diff --git a/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs b/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs index 2bfaded4..ce989d8c 100644 --- a/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs +++ b/Libraries/Core/Utils/Collections/ProbabilityObjectArray.cs @@ -1,30 +1,29 @@ -using Core.Utils.Cloners; using System.Text.Json.Serialization; +using Core.Utils.Cloners; namespace Core.Utils.Collections; /// -/// Array of ProbabilityObjectArray which allow to randomly draw of the contained objects -/// based on the relative probability of each of its elements. -/// The probabilities of the contained element is not required to be normalized. -/// -/// Example: -/// po = new ProbabilityObjectArray( -/// new ProbabilityObject("a", 5), -/// new ProbabilityObject("b", 1), -/// new ProbabilityObject("c", 1) -/// ); -/// res = po.draw(10000); -/// // count the elements which should be distributed according to the relative probabilities -/// res.filter(x => x==="b").reduce((sum, x) => sum + 1 , 0) +/// Array of ProbabilityObjectArray which allow to randomly draw of the contained objects +/// based on the relative probability of each of its elements. +/// The probabilities of the contained element is not required to be normalized. +/// Example: +/// po = new ProbabilityObjectArray( +/// new ProbabilityObject("a", 5), +/// new ProbabilityObject("b", 1), +/// new ProbabilityObject("c", 1) +/// ); +/// res = po.draw(10000); +/// // count the elements which should be distributed according to the relative probabilities +/// res.filter(x => x==="b").reduce((sum, x) => sum + 1 , 0) /// /// /// /// public class ProbabilityObjectArray : List> { - private readonly MathUtil _mathUtil; private readonly ICloner _cloner; + private readonly MathUtil _mathUtil; public ProbabilityObjectArray( MathUtil mathUtil, @@ -37,7 +36,7 @@ public class ProbabilityObjectArray : List> } /// - /// Calculates the normalized cumulative probability of the ProbabilityObjectArray's elements normalized to 1 + /// Calculates the normalized cumulative probability of the ProbabilityObjectArray's elements normalized to 1 /// /// The relative probability values of which to calculate the normalized cumulative sum /// Cumulative Sum normalized to 1 @@ -51,7 +50,7 @@ public class ProbabilityObjectArray : List> } /// - /// Filter What is inside ProbabilityObjectArray + /// Filter What is inside ProbabilityObjectArray /// /// /// Filtered results @@ -59,14 +58,18 @@ public class ProbabilityObjectArray : List> { var result = new ProbabilityObjectArray(_mathUtil, _cloner, new List>()); foreach (var probabilityObject in this) + { if (predicate.Invoke(probabilityObject)) + { result.Add(probabilityObject); + } + } return result; } /// - /// Deep clone this ProbabilityObjectArray + /// Deep clone this ProbabilityObjectArray /// /// Deep Copy of ProbabilityObjectArray public ProbabilityObjectArray Clone() @@ -83,17 +86,17 @@ public class ProbabilityObjectArray : List> } /// - /// Drop an element from the ProbabilityObjectArray + /// Drop an element from the ProbabilityObjectArray /// /// The key of the element to drop /// ProbabilityObjectArray without the dropped element public ProbabilityObjectArray Drop(K key) { - return (ProbabilityObjectArray)this.Where((r) => !r.Key?.Equals(key) ?? false); + return (ProbabilityObjectArray) this.Where(r => !r.Key?.Equals(key) ?? false); } /// - /// Return the data field of an element of the ProbabilityObjectArray + /// Return the data field of an element of the ProbabilityObjectArray /// /// The key of the element whose data shall be retrieved /// Stored data object @@ -104,11 +107,10 @@ public class ProbabilityObjectArray : List> } /// - /// Get the relative probability of an element by its key - /// - /// Example: - /// po = new ProbabilityObjectArray(new ProbabilityObject("a", 5), new ProbabilityObject("b", 1)) - /// po.maxProbability() // returns 5 + /// Get the relative probability of an element by its key + /// Example: + /// po = new ProbabilityObjectArray(new ProbabilityObject("a", 5), new ProbabilityObject("b", 1)) + /// po.maxProbability() // returns 5 /// /// Key of element whose relative probability shall be retrieved /// The relative probability @@ -120,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 - * + * 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() @@ -133,10 +135,10 @@ public class ProbabilityObjectArray : List> } /// - /// Get the minimum relative probability out of a ProbabilityObjectArray - /// * Example: - /// po = new ProbabilityObjectArray(new ProbabilityObject("a", 5), new ProbabilityObject("b", 1)) - /// po.minProbability() // returns 1 + /// Get the minimum relative probability out of a ProbabilityObjectArray + /// * Example: + /// po = new ProbabilityObjectArray(new ProbabilityObject("a", 5), new ProbabilityObject("b", 1)) + /// po.minProbability() // returns 1 /// /// the minimum value of all relative probabilities in this ProbabilityObjectArray public double MinProbability() @@ -155,10 +157,17 @@ public class ProbabilityObjectArray : List> public List Draw(int drawCount = 1, bool removeAfterDraw = true, List? neverRemoveWhitelist = null) { neverRemoveWhitelist ??= []; - if (Count == 0) return []; + if (Count == 0) + { + return []; + } var totals = this.Aggregate( - new { probArray = new List(), keyArray = new List() }, + new + { + probArray = new List(), + keyArray = new List() + }, (acc, x) => { acc.probArray.Add(x.RelativeProbability.Value); @@ -173,7 +182,7 @@ public class ProbabilityObjectArray : List> for (var i = 0; i < drawCount; i++) { var rand = Random.Shared.NextDouble(); - var randomIndex = probCumsum.FindIndex((x) => x > rand); + var randomIndex = probCumsum.FindIndex(x => x > rand); // We cannot put Math.random() directly in the findIndex because then it draws anew for each of its iteration if (removeAfterDraw || neverRemoveWhitelist.Contains(totals.keyArray[randomIndex])) { @@ -190,7 +199,10 @@ public class ProbabilityObjectArray : List> drawnKeys.Add(key); probCumsum = CumulativeProbability(totals.probArray); // If we draw without replacement and the ProbabilityObjectArray is exhausted we need to break - if (totals.keyArray.Count < 1) break; + if (totals.keyArray.Count < 1) + { + break; + } } } @@ -199,8 +211,8 @@ public class ProbabilityObjectArray : List> } /// -/// A ProbabilityObject which is use as an element to the ProbabilityObjectArray array -/// It contains a key, the relative probability as well as optional data. +/// A ProbabilityObject which is use as an element to the ProbabilityObjectArray array +/// It contains a key, the relative probability as well as optional data. /// /// /// @@ -211,11 +223,11 @@ public class ProbabilityObject } /** - * constructor for the ProbabilityObject - * @param {string} key The key of the element - * @param {number} relativeProbability The relative probability of this element - * @param {any} data Optional data attached to the element - */ + * constructor for the ProbabilityObject + * @param {string} key The key of the element + * @param {number} relativeProbability The relative probability of this element + * @param {any} data Optional data attached to the element + */ public ProbabilityObject(K key, double? relativeProbability, V? data) { Key = key; @@ -224,14 +236,26 @@ public class ProbabilityObject } [JsonPropertyName("key")] - public K? Key { get; set; } + public K? Key + { + get; + set; + } /// - /// Weighting of key compared to other ProbabilityObjects + /// Weighting of key compared to other ProbabilityObjects /// [JsonPropertyName("relativeProbability")] - public double? RelativeProbability { get; set; } + public double? RelativeProbability + { + get; + set; + } [JsonPropertyName("data")] - public V? Data { get; set; } + public V? Data + { + get; + set; + } } diff --git a/Libraries/Core/Utils/DatabaseImporter.cs b/Libraries/Core/Utils/DatabaseImporter.cs index cc2df36f..9261538f 100644 --- a/Libraries/Core/Utils/DatabaseImporter.cs +++ b/Libraries/Core/Utils/DatabaseImporter.cs @@ -1,4 +1,3 @@ -using SptCommon.Annotations; using Core.DI; using Core.Models.Eft.Common.Tables; using Core.Models.Spt.Config; @@ -7,6 +6,7 @@ using Core.Models.Utils; using Core.Routers; using Core.Servers; using Core.Services; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Core.Utils; @@ -14,23 +14,23 @@ namespace Core.Utils; [Injectable(InjectionType.Singleton, InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.Database)] public class DatabaseImporter : OnLoad { - private object hashedFile; - private ValidationResult valid = ValidationResult.UNDEFINED; - private string filepath; - private HttpConfig httpConfig; private const string _sptDataPath = "./Assets/"; - - protected ISptLogger _logger; - protected LocalisationService _localisationService; + private readonly HttpConfig httpConfig; + private readonly ValidationResult valid = ValidationResult.UNDEFINED; + protected ConfigServer _configServer; protected DatabaseServer _databaseServer; + protected EncodingUtil _encodingUtil; + protected FileUtil _fileUtil; + protected HashUtil _hashUtil; protected ImageRouter _imageRouter; - protected EncodingUtil _encodingUtil; - protected HashUtil _hashUtil; protected ImporterUtil _importerUtil; - protected ConfigServer _configServer; - protected FileUtil _fileUtil; + protected LocalisationService _localisationService; + + protected ISptLogger _logger; + private string filepath; + private object hashedFile; public DatabaseImporter( ISptLogger logger, @@ -57,15 +57,6 @@ public class DatabaseImporter : OnLoad httpConfig = _configServer.GetConfig(); } - /** - * Get path to spt data - * @returns path to data - */ - public string GetSptDataPath() - { - return _sptDataPath; - } - public async Task OnLoad() { filepath = GetSptDataPath(); @@ -98,6 +89,20 @@ public class DatabaseImporter : OnLoad CreateRouteMapping(imageFilePath, "files"); } + public string GetRoute() + { + return "spt-database"; + } + + /** + * Get path to spt data + * @returns path to data + */ + public string GetSptDataPath() + { + return _sptDataPath; + } + private void CreateRouteMapping(string directory, string newBasePath) { var directoryContent = GetAllFilesInDirectory(directory); @@ -107,7 +112,9 @@ public class DatabaseImporter : OnLoad var fileNameWithNoSPTPath = fileNameWithPath.Replace(directory, ""); var filePathNoExtension = _fileUtil.StripExtension(fileNameWithNoSPTPath, true); if (filePathNoExtension.StartsWith("/") || fileNameWithPath.StartsWith("\\")) + { filePathNoExtension = $"{filePathNoExtension.Substring(1)}"; + } var bsgPath = $"/{newBasePath}/{filePathNoExtension}".Replace("\\", "/"); _imageRouter.AddRoute(bsgPath, fileNameWithPath); @@ -119,7 +126,10 @@ public class DatabaseImporter : OnLoad List result = []; result.AddRange(Directory.GetFiles(directoryPath)); - foreach (var subdirectory in Directory.GetDirectories(directoryPath)) result.AddRange(GetAllFilesInDirectory(subdirectory)); + foreach (var subdirectory in Directory.GetDirectories(directoryPath)) + { + result.AddRange(GetAllFilesInDirectory(subdirectory)); + } return result; } @@ -164,11 +174,6 @@ public class DatabaseImporter : OnLoad //} } - public string GetRoute() - { - return "spt-database"; - } - protected bool ValidateFile(string filePathAndName, object fileData) { /* @@ -220,7 +225,11 @@ public class DatabaseImporter : OnLoad var pathOverride = GetImagePathOverride(imagePath); if (!string.IsNullOrEmpty(pathOverride)) { - if (_logger.IsLogEnabled(LogLevel.Debug)) _logger.Debug($"overrode route: {routeKey} endpoint: {imagePath} with {pathOverride}"); + if (_logger.IsLogEnabled(LogLevel.Debug)) + { + _logger.Debug($"overrode route: {routeKey} endpoint: {imagePath} with {pathOverride}"); + } + imagePath = pathOverride; } @@ -240,7 +249,10 @@ public class DatabaseImporter : OnLoad protected string? GetImagePathOverride(string imagePath) { if (httpConfig.ServerImagePathOverride.TryGetValue(imagePath, out var value)) + { return value; + } + return null; } } diff --git a/Libraries/Core/Utils/FileUtil.cs b/Libraries/Core/Utils/FileUtil.cs index 5f135b6d..ca3b991b 100644 --- a/Libraries/Core/Utils/FileUtil.cs +++ b/Libraries/Core/Utils/FileUtil.cs @@ -12,7 +12,9 @@ public class FileUtil( var files = new List(Directory.GetFiles(path)); if (recursive) + { files.AddRange(Directory.GetDirectories(path).SelectMany(d => GetFiles(d, recursive))); + } return files; } @@ -34,7 +36,10 @@ public class FileUtil( public string StripExtension(string path, bool keepPath = false) { - if (keepPath) return path.StartsWith(".") ? path.Split('.')[1] : path.Split('.').First(); + if (keepPath) + { + return path.StartsWith(".") ? path.Split('.')[1] : path.Split('.').First(); + } return Path.GetFileNameWithoutExtension(path); } @@ -63,7 +68,10 @@ public class FileUtil( public void WriteFile(string filePath, string fileContent) { if (!FileExists(filePath)) + { CreateFile(filePath); + } + File.WriteAllText(filePath, fileContent); } @@ -86,7 +94,7 @@ public class FileUtil( } /// - /// Copy a file from one path to another + /// Copy a file from one path to another /// /// Source file to copy from /// @@ -94,7 +102,10 @@ public class FileUtil( public void CopyFile(string copyFromPath, string destinationFilePath, bool overwrite = false) { // Check it exists first - if (!FileExists(copyFromPath)) _logger.Error($"Source file not found: {copyFromPath}. Cannot copy to: {destinationFilePath}"); + if (!FileExists(copyFromPath)) + { + _logger.Error($"Source file not found: {copyFromPath}. Cannot copy to: {destinationFilePath}"); + } // Ensure dir exists @@ -105,7 +116,7 @@ public class FileUtil( } /// - /// Delete a directory, must be empty unless 'deleteContent' is set to 'true' + /// Delete a directory, must be empty unless 'deleteContent' is set to 'true' /// /// /// diff --git a/Libraries/Core/Utils/HashUtil.cs b/Libraries/Core/Utils/HashUtil.cs index bf377c45..866e0517 100644 --- a/Libraries/Core/Utils/HashUtil.cs +++ b/Libraries/Core/Utils/HashUtil.cs @@ -1,6 +1,6 @@ +using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; -using System.Security.Cryptography; using SptCommon.Annotations; namespace Core.Utils; @@ -8,9 +8,8 @@ namespace Core.Utils; [Injectable(InjectionType.Singleton)] public class HashUtil { - protected Regex MongoIdRegex = new("^[a-fA-F0-9]{24}$"); - protected RandomUtil _randomUtil; + protected Regex MongoIdRegex = new("^[a-fA-F0-9]{24}$"); public HashUtil(RandomUtil randomUtil) { @@ -18,7 +17,7 @@ public class HashUtil } /// - /// Create a 24 character MongoId + /// Create a 24 character MongoId /// /// 24 character objectId public string Generate() @@ -26,7 +25,7 @@ public class HashUtil var objectId = new byte[12]; // Time stamp (4 bytes) - var timestamp = BitConverter.GetBytes((int)DateTimeOffset.UtcNow.ToUnixTimeSeconds()); + var timestamp = BitConverter.GetBytes((int) DateTimeOffset.UtcNow.ToUnixTimeSeconds()); // Convert to big-endian Array.Reverse(timestamp); Array.Copy(timestamp, 0, objectId, 0, 4); @@ -46,7 +45,7 @@ public class HashUtil } /// - /// is the passed in string a valid mongo id + /// is the passed in string a valid mongo id /// /// String to check /// True when string is a valid mongo id @@ -73,12 +72,13 @@ public class HashUtil } /// - /// Create a hash for the data parameter + /// Create a hash for the data parameter /// /// algorithm to use to hash /// data to be hashed /// hash value - /// thrown if the provided algorithm is not implemented> + /// thrown if the provided algorithm is not implemented + /// > public string GenerateHashForData(HashingAlgorithm algorithm, string data) { switch (algorithm) @@ -96,7 +96,7 @@ public class HashUtil } /// - /// Generates an account ID for a profile + /// Generates an account ID for a profile /// /// Generated account ID public int GenerateAccountId() diff --git a/Libraries/Core/Utils/HttpFileUtil.cs b/Libraries/Core/Utils/HttpFileUtil.cs index 6b24c489..a4ecf8ef 100644 --- a/Libraries/Core/Utils/HttpFileUtil.cs +++ b/Libraries/Core/Utils/HttpFileUtil.cs @@ -1,5 +1,5 @@ -using SptCommon.Annotations; using Core.Helpers; +using SptCommon.Annotations; namespace Core.Utils; diff --git a/Libraries/Core/Utils/HttpResponseUtil.cs b/Libraries/Core/Utils/HttpResponseUtil.cs index 4bc9ca19..3c0e9879 100644 --- a/Libraries/Core/Utils/HttpResponseUtil.cs +++ b/Libraries/Core/Utils/HttpResponseUtil.cs @@ -1,27 +1,18 @@ using System.Collections.Immutable; using System.Text.RegularExpressions; -using SptCommon.Annotations; using Core.Models.Eft.HttpResponse; using Core.Models.Eft.ItemEvent; using Core.Models.Enums; using Core.Services; +using SptCommon.Annotations; namespace Core.Utils; [Injectable] public class HttpResponseUtil { - protected readonly LocalisationService _localisationService; protected readonly JsonUtil _jsonUtil; - - public HttpResponseUtil( - JsonUtil jsonUtil, - LocalisationService localisationService - ) - { - _localisationService = localisationService; - _jsonUtil = jsonUtil; - } + protected readonly LocalisationService _localisationService; protected ImmutableList _cleanupRegexList = [ @@ -32,10 +23,22 @@ public class HttpResponseUtil new("[\\t]") ]; + public HttpResponseUtil( + JsonUtil jsonUtil, + LocalisationService localisationService + ) + { + _localisationService = localisationService; + _jsonUtil = jsonUtil; + } + protected string ClearString(string? s) { var value = s ?? ""; - foreach (var regex in _cleanupRegexList) value = regex.Replace(value, string.Empty); + foreach (var regex in _cleanupRegexList) + { + value = regex.Replace(value, string.Empty); + } return value; } @@ -66,7 +69,14 @@ public class HttpResponseUtil public string GetUnclearedBody(T? data, BackendErrorCodes err = BackendErrorCodes.None, string? errmsg = null) { - return _jsonUtil.Serialize(new GetBodyResponseData { Err = err, ErrMsg = errmsg, Data = data }); + return _jsonUtil.Serialize( + new GetBodyResponseData + { + Err = err, + ErrMsg = errmsg, + Data = data + } + ); } public string EmptyResponse() @@ -76,7 +86,7 @@ public class HttpResponseUtil public string NullResponse() { - return ClearString(GetUnclearedBody(null, BackendErrorCodes.None, null)); + return ClearString(GetUnclearedBody(null)); } public string EmptyArrayResponse() @@ -98,8 +108,12 @@ public class HttpResponseUtil ) { if (string.IsNullOrEmpty(message)) + { message = _localisationService.GetText("http-unknown_error"); + } + if (output.Warnings?.Count > 0) + { output.Warnings.Add( new Warning { @@ -108,8 +122,19 @@ public class HttpResponseUtil Code = errorCode } ); + } else - output.Warnings = [new Warning { Index = 0, ErrorMessage = message, Code = errorCode }]; + { + output.Warnings = + [ + new Warning + { + Index = 0, + ErrorMessage = message, + Code = errorCode + } + ]; + } return output; } diff --git a/Libraries/Core/Utils/ImporterUtil.cs b/Libraries/Core/Utils/ImporterUtil.cs index d851a9e1..8c855c5a 100644 --- a/Libraries/Core/Utils/ImporterUtil.cs +++ b/Libraries/Core/Utils/ImporterUtil.cs @@ -1,8 +1,8 @@ using System.Linq.Expressions; using System.Reflection; -using SptCommon.Annotations; using Core.Models.Utils; using Core.Utils.Json; +using SptCommon.Annotations; namespace Core.Utils; @@ -12,9 +12,9 @@ public class ImporterUtil protected FileUtil _fileUtil; protected JsonUtil _jsonUtil; protected ISptLogger _logger; + protected HashSet directoriesToIgnore = ["./Assets/database/locales/server"]; protected HashSet filesToIgnore = ["bearsuits.json", "usecsuits.json", "archivedquests.json"]; - protected HashSet directoriesToIgnore = ["./Assets/database/locales/server"]; public ImporterUtil(ISptLogger logger, FileUtil fileUtil, JsonUtil jsonUtil) { @@ -30,13 +30,14 @@ public class ImporterUtil ) { return LoadRecursiveAsync(filepath, typeof(T), onReadCallback, onObjectDeserialized) - .ContinueWith(res => (T)res.Result); + .ContinueWith(res => (T) res.Result); } /** * Load files into js objects recursively (asynchronous) * @param filepath Path to folder with files - * @returns Promise return T type associated with this class + * @returns Promise + * return T type associated with this class */ protected Task LoadRecursiveAsync( string filepath, @@ -56,15 +57,25 @@ public class ImporterUtil // add file content to result foreach (var file in files) { - if (_fileUtil.GetFileExtension(file) != "json") continue; - if (filesToIgnore.Contains(_fileUtil.GetFileNameAndExtension(file).ToLower())) continue; + if (_fileUtil.GetFileExtension(file) != "json") + { + continue; + } + + if (filesToIgnore.Contains(_fileUtil.GetFileNameAndExtension(file).ToLower())) + { + continue; + } + tasks.Add( Task.Factory.StartNew( () => { var fileData = _fileUtil.ReadFile(file); if (onReadCallback != null) + { onReadCallback(file, fileData); + } var setMethod = GetSetMethod( _fileUtil.StripExtension(file).ToLower(), @@ -94,7 +105,8 @@ public class ImporterUtil Expression.Constant(_jsonUtil), "Deserialize", [], - [Expression.Constant(fileData), Expression.Constant(propertyType.GetGenericArguments()[0])] + Expression.Constant(fileData), + Expression.Constant(propertyType.GetGenericArguments()[0]) ), propertyType.GetGenericArguments()[0] ) @@ -109,7 +121,9 @@ public class ImporterUtil } if (onObjectDeserialized != null) + { onObjectDeserialized(file, fileDeserialized); + } lock (dictionaryLock) { @@ -133,7 +147,11 @@ public class ImporterUtil // deep tree search foreach (var directory in directories) { - if (directoriesToIgnore.Contains(directory)) continue; + if (directoriesToIgnore.Contains(directory)) + { + continue; + } + tasks.Add( Task.Factory.StartNew( () => @@ -158,7 +176,7 @@ public class ImporterUtil // return the result of all async fetch return Task.WhenAll(tasks) .ContinueWith( - (t) => + t => { if (t.IsCanceled || t.IsFaulted) { @@ -176,7 +194,10 @@ public class ImporterUtil t => { if (t.IsFaulted || t.IsCanceled) + { throw t.Exception!; + } + return result; } ); @@ -204,9 +225,12 @@ public class ImporterUtil ) ); if (matchedProperty == null) + { throw new Exception( $"Unable to find property '{_fileUtil.StripExtension(propertyName)}' for type '{type.Name}'" ); + } + propertyType = matchedProperty.PropertyType; setMethod = matchedProperty.GetSetMethod(); } diff --git a/Libraries/Core/Utils/Json/Converters/ArrayToObjectFactoryConverter.cs b/Libraries/Core/Utils/Json/Converters/ArrayToObjectFactoryConverter.cs index 92d6d90b..6f89ba56 100644 --- a/Libraries/Core/Utils/Json/Converters/ArrayToObjectFactoryConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/ArrayToObjectFactoryConverter.cs @@ -12,12 +12,18 @@ public class ArrayToObjectFactoryConverter : JsonConverterFactory public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - return (JsonConverter)Activator.CreateInstance(typeof(ArrayToObjectConverter<>).MakeGenericType(typeToConvert)); + return (JsonConverter) Activator.CreateInstance(typeof(ArrayToObjectConverter<>).MakeGenericType(typeToConvert)); } private class ArrayToObjectConverter : JsonConverter { - public override bool HandleNull => true; + public override bool HandleNull + { + get + { + return true; + } + } public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { @@ -41,9 +47,13 @@ public class ArrayToObjectFactoryConverter : JsonConverterFactory public override void Write(Utf8JsonWriter writer, T? value, JsonSerializerOptions options) { if (value == null) + { JsonSerializer.Serialize(writer, new List(), options); + } else + { JsonSerializer.Serialize(writer, value, options); + } } } } diff --git a/Libraries/Core/Utils/Json/Converters/BaseInteractionRequestDataConverter.cs b/Libraries/Core/Utils/Json/Converters/BaseInteractionRequestDataConverter.cs index 8e4df39f..b57a3fc7 100644 --- a/Libraries/Core/Utils/Json/Converters/BaseInteractionRequestDataConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/BaseInteractionRequestDataConverter.cs @@ -80,21 +80,21 @@ public class BaseInteractionRequestDataConverter : JsonConverter(jsonText); case ItemEventActions.TRADING_CONFIRM: - { - var json = JsonSerializer.Deserialize(jsonText); - - switch (json.Type) { - case ItemEventActions.BUY_FROM_TRADER: - return JsonSerializer.Deserialize(jsonText); - case ItemEventActions.SELL_TO_TRADER: - return JsonSerializer.Deserialize(jsonText); - default: - throw new Exception( - $"Unhandled action type {value.Action}, make sure the BaseInteractionRequestDataConverter has the deserialization for this action handled." - ); + var json = JsonSerializer.Deserialize(jsonText); + + switch (json.Type) + { + case ItemEventActions.BUY_FROM_TRADER: + return JsonSerializer.Deserialize(jsonText); + case ItemEventActions.SELL_TO_TRADER: + return JsonSerializer.Deserialize(jsonText); + default: + throw new Exception( + $"Unhandled action type {value.Action}, make sure the BaseInteractionRequestDataConverter has the deserialization for this action handled." + ); + } } - } case ItemEventActions.RAGFAIR_BUY_OFFER: return JsonSerializer.Deserialize(jsonText); case ItemEventActions.SELL_ALL_FROM_SAVAGE: diff --git a/Libraries/Core/Utils/Json/Converters/DictionaryOfListOrTConverter.cs b/Libraries/Core/Utils/Json/Converters/DictionaryOfListOrTConverter.cs index acc72541..166822cf 100644 --- a/Libraries/Core/Utils/Json/Converters/DictionaryOfListOrTConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/DictionaryOfListOrTConverter.cs @@ -15,7 +15,7 @@ public class DictionaryOfListOrTConverter : JsonConverterFactory public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - return (JsonConverter)Activator.CreateInstance( + return (JsonConverter) Activator.CreateInstance( typeof(DictionaryOfListOrTConverter<,>).MakeGenericType( typeToConvert.GenericTypeArguments[0], typeToConvert.GenericTypeArguments[1].GenericTypeArguments[0] @@ -33,13 +33,11 @@ public class DictionaryOfListOrTConverter : JsonConverter>>(jsonText, options); - } + var jsonText = jsonDocument.RootElement.GetRawText(); + return JsonSerializer.Deserialize>>(jsonText, options); } } diff --git a/Libraries/Core/Utils/Json/Converters/DictionaryOrListConverter.cs b/Libraries/Core/Utils/Json/Converters/DictionaryOrListConverter.cs index f782267e..05fc6a90 100644 --- a/Libraries/Core/Utils/Json/Converters/DictionaryOrListConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/DictionaryOrListConverter.cs @@ -12,7 +12,7 @@ public class DictionaryOrListConverter : JsonConverterFactory public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - return (JsonConverter)Activator.CreateInstance( + return (JsonConverter) Activator.CreateInstance( typeof(DictionaryOrListConverter<,>).MakeGenericType(typeToConvert.GenericTypeArguments[0], typeToConvert.GenericTypeArguments[1]) ); } @@ -46,8 +46,12 @@ public class DictionaryOrListConverter : JsonConverter value, JsonSerializerOptions options) { if (value.IsList) + { JsonSerializer.Serialize(writer, value.List, options); + } else + { JsonSerializer.Serialize(writer, value.Dictionary, options); + } } } diff --git a/Libraries/Core/Utils/Json/Converters/EftEnumConverter.cs b/Libraries/Core/Utils/Json/Converters/EftEnumConverter.cs index 9ebc1d14..0e0cff48 100644 --- a/Libraries/Core/Utils/Json/Converters/EftEnumConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/EftEnumConverter.cs @@ -6,20 +6,26 @@ namespace Core.Utils.Json.Converters; public class EftEnumConverter : JsonConverter { - private static readonly JsonSerializerOptions _options = new() { Converters = { new JsonStringEnumConverter() } }; + private static readonly JsonSerializerOptions _options = new() + { + Converters = + { + new JsonStringEnumConverter() + } + }; public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.String || reader.TokenType == JsonTokenType.PropertyName) { var str = reader.GetString(); - return (T)Enum.Parse(typeof(T), str, true); + return (T) Enum.Parse(typeof(T), str, true); } if (reader.TokenType == JsonTokenType.Number) { var str = reader.GetInt32().ToString(); - return (T)Enum.Parse(typeof(T), str, true); + return (T) Enum.Parse(typeof(T), str, true); } return default; @@ -34,11 +40,17 @@ public class EftEnumConverter : JsonConverter else { if (typeof(T).GetFields().Any(f => f.FieldType == typeof(int))) + { JsonSerializer.Serialize(writer, Convert.ToInt32(value), _options); + } else if (typeof(T).GetFields().Any(f => f.FieldType == typeof(byte))) + { JsonSerializer.Serialize(writer, Convert.ToByte(value), _options); + } else + { throw new Exception($"Could not convert enum {value.GetType()} with value {value}"); + } } } @@ -57,11 +69,17 @@ public class EftEnumConverter : JsonConverter else { if (typeof(T).GetFields().Any(f => f.FieldType == typeof(int))) + { propertyValue = Convert.ToInt32(value); + } else if (typeof(T).GetFields().Any(f => f.FieldType == typeof(byte))) + { propertyValue = Convert.ToByte(value); + } else + { throw new Exception($"Could not convert enum {value.GetType()} with value {value}"); + } } writer.WritePropertyName(propertyValue.ToString()); diff --git a/Libraries/Core/Utils/Json/Converters/EftListEnumConverter.cs b/Libraries/Core/Utils/Json/Converters/EftListEnumConverter.cs index 636dc149..a3fe75d2 100644 --- a/Libraries/Core/Utils/Json/Converters/EftListEnumConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/EftListEnumConverter.cs @@ -1,12 +1,17 @@ -using System.Diagnostics.CodeAnalysis; -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Serialization; namespace Core.Utils.Json.Converters; public class EftListEnumConverter : JsonConverter> { - private static readonly JsonSerializerOptions _options = new() { Converters = { new JsonStringEnumConverter() } }; + private static readonly JsonSerializerOptions _options = new() + { + Converters = + { + new JsonStringEnumConverter() + } + }; public override List? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { @@ -25,10 +30,11 @@ public class EftListEnumConverter : JsonConverter> list.Add(JsonSerializer.Deserialize(newStr, options)); } } + return list; } } - + throw new JsonException(); } @@ -39,7 +45,7 @@ public class EftListEnumConverter : JsonConverter> { JsonSerializer.Serialize(writer, x1, _options); } - + writer.WriteEndArray(); } } diff --git a/Libraries/Core/Utils/Json/Converters/ListOrTConverter.cs b/Libraries/Core/Utils/Json/Converters/ListOrTConverter.cs index 247b45a3..1c72d800 100644 --- a/Libraries/Core/Utils/Json/Converters/ListOrTConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/ListOrTConverter.cs @@ -12,7 +12,7 @@ public class ListOrTConverterFactory : JsonConverterFactory public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - return (JsonConverter)Activator.CreateInstance(typeof(ListOrTConverter<>).MakeGenericType(typeToConvert.GenericTypeArguments[0])); + return (JsonConverter) Activator.CreateInstance(typeof(ListOrTConverter<>).MakeGenericType(typeToConvert.GenericTypeArguments[0])); } } @@ -52,8 +52,12 @@ public class ListOrTConverter : JsonConverter?> public override void Write(Utf8JsonWriter writer, ListOrT value, JsonSerializerOptions options) { if (value.IsItem) + { JsonSerializer.Serialize(writer, value.Item, options); + } else + { JsonSerializer.Serialize(writer, value.List, options); + } } } diff --git a/Libraries/Core/Utils/Json/Converters/StringToNumberFactoryConverter.cs b/Libraries/Core/Utils/Json/Converters/StringToNumberFactoryConverter.cs index 129666e0..c232ca93 100644 --- a/Libraries/Core/Utils/Json/Converters/StringToNumberFactoryConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/StringToNumberFactoryConverter.cs @@ -13,7 +13,7 @@ public class StringToNumberFactoryConverter : JsonConverterFactory public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - return (JsonConverter)Activator.CreateInstance(typeof(StringToNumberConverter<>).MakeGenericType(typeToConvert)); + return (JsonConverter) Activator.CreateInstance(typeof(StringToNumberConverter<>).MakeGenericType(typeToConvert)); } private class StringToNumberConverter : JsonConverter @@ -25,14 +25,20 @@ public class StringToNumberFactoryConverter : JsonConverterFactory case JsonTokenType.String: var value = reader.GetString(); if (string.IsNullOrWhiteSpace(value)) + { return default; + } + var type = typeToConvert; try { if (typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(Nullable<>)) + { type = typeToConvert.GenericTypeArguments[0]; - return (T)type.GetMethods() + } + + return (T) type.GetMethods() .First( m => m.Name == "Parse" && @@ -63,7 +69,10 @@ public class StringToNumberFactoryConverter : JsonConverterFactory public override void Write(Utf8JsonWriter writer, T? value, JsonSerializerOptions options) { if (value == null) + { value = default; + } + JsonSerializer.Serialize(writer, value, options); } } diff --git a/Libraries/Core/Utils/Json/Converters/StringToObjectFactoryConverter.cs b/Libraries/Core/Utils/Json/Converters/StringToObjectFactoryConverter.cs index e3072fed..f9590a6f 100644 --- a/Libraries/Core/Utils/Json/Converters/StringToObjectFactoryConverter.cs +++ b/Libraries/Core/Utils/Json/Converters/StringToObjectFactoryConverter.cs @@ -12,7 +12,7 @@ public class StringToObjectFactoryConverter : JsonConverterFactory public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) { - return (JsonConverter)Activator.CreateInstance(typeof(StringToObjectConverter<>).MakeGenericType(typeToConvert)); + return (JsonConverter) Activator.CreateInstance(typeof(StringToObjectConverter<>).MakeGenericType(typeToConvert)); } public class StringToObjectConverter : JsonConverter @@ -39,7 +39,10 @@ public class StringToObjectFactoryConverter : JsonConverterFactory public override void Write(Utf8JsonWriter writer, T? value, JsonSerializerOptions options) { if (value == null) + { value = default; + } + JsonSerializer.Serialize(writer, value, options); } } diff --git a/Libraries/Core/Utils/Json/DictionaryOrList.cs b/Libraries/Core/Utils/Json/DictionaryOrList.cs index bdcb6ceb..c1e13776 100644 --- a/Libraries/Core/Utils/Json/DictionaryOrList.cs +++ b/Libraries/Core/Utils/Json/DictionaryOrList.cs @@ -2,9 +2,29 @@ namespace Core.Utils.Json; public class DictionaryOrList(Dictionary? dictionary, List? list) { - public Dictionary? Dictionary { get; } = dictionary; - public List? List { get; } = list; + public Dictionary? Dictionary + { + get; + } = dictionary; - public bool IsList => List != null; - public bool IsDictionary => Dictionary != null; + public List? List + { + get; + } = list; + + public bool IsList + { + get + { + return List != null; + } + } + + public bool IsDictionary + { + get + { + return Dictionary != null; + } + } } diff --git a/Libraries/Core/Utils/Json/LazyLoad.cs b/Libraries/Core/Utils/Json/LazyLoad.cs index e3683cee..c6a25bd1 100644 --- a/Libraries/Core/Utils/Json/LazyLoad.cs +++ b/Libraries/Core/Utils/Json/LazyLoad.cs @@ -2,11 +2,11 @@ public class LazyLoad(Func deserialize) { - private T? _result; + private static readonly TimeSpan _autoCleanerTimeout = TimeSpan.FromSeconds(30); private bool _isLoaded; + private T? _result; private Timer? autoCleanerTimeout; - private static readonly TimeSpan _autoCleanerTimeout = TimeSpan.FromSeconds(30); public T? Value { @@ -33,6 +33,9 @@ public class LazyLoad(Func deserialize) autoCleanerTimeout?.Change(_autoCleanerTimeout, Timeout.InfiniteTimeSpan); return _result; } - set => _result = value; + set + { + _result = value; + } } } diff --git a/Libraries/Core/Utils/Json/ListOrT.cs b/Libraries/Core/Utils/Json/ListOrT.cs index bfa0aae4..40697865 100644 --- a/Libraries/Core/Utils/Json/ListOrT.cs +++ b/Libraries/Core/Utils/Json/ListOrT.cs @@ -2,9 +2,29 @@ namespace Core.Utils.Json; public class ListOrT(List? list, T? item) { - public List? List { get; } = list; - public T? Item { get; } = item; + public List? List + { + get; + } = list; - public bool IsItem => Item != null; - public bool IsList => List != null; + public T? Item + { + get; + } = item; + + public bool IsItem + { + get + { + return Item != null; + } + } + + public bool IsList + { + get + { + return List != null; + } + } } diff --git a/Libraries/Core/Utils/JsonUtil.cs b/Libraries/Core/Utils/JsonUtil.cs index 5da414f7..b39c87e5 100644 --- a/Libraries/Core/Utils/JsonUtil.cs +++ b/Libraries/Core/Utils/JsonUtil.cs @@ -3,11 +3,11 @@ using System.Text.Json; using System.Text.Json.Serialization; using Core.Models; using Core.Models.Eft.Common.Tables; -using SptCommon.Annotations; using Core.Models.Eft.Ws; using Core.Models.Enums; using Core.Models.Spt.Dialog; using Core.Utils.Json.Converters; +using SptCommon.Annotations; namespace Core.Utils; @@ -62,7 +62,7 @@ public class JsonUtil /// - /// Convert JSON into an object + /// Convert JSON into an object /// /// The type of the object to deserialize to /// The JSON string to deserialize @@ -73,7 +73,7 @@ public class JsonUtil } /// - /// Convert JSON into an object + /// Convert JSON into an object /// /// The JSON string to deserialize /// The type of the object to deserialize to @@ -84,7 +84,7 @@ public class JsonUtil } /// - /// Convert an object into JSON + /// Convert an object into JSON /// /// Type of the object being serialised /// Object to serialise @@ -96,7 +96,7 @@ public class JsonUtil } /// - /// Convert an object into JSON + /// Convert an object into JSON /// /// Object to serialise /// Type of object being serialsied diff --git a/Libraries/Core/Utils/MathUtil.cs b/Libraries/Core/Utils/MathUtil.cs index a49a8087..57092219 100644 --- a/Libraries/Core/Utils/MathUtil.cs +++ b/Libraries/Core/Utils/MathUtil.cs @@ -6,7 +6,7 @@ namespace Core.Utils; public class MathUtil { /// - /// Helper to create the sum of all list elements + /// Helper to create the sum of all list elements /// /// List of floats to sum /// sum of all values @@ -17,8 +17,8 @@ public class MathUtil } /// - /// Helper to create the cumulative sum of all list elements - /// ListCumSum([1, 2, 3, 4]) = [1, 3, 6, 10] + /// Helper to create the cumulative sum of all list elements + /// ListCumSum([1, 2, 3, 4]) = [1, 3, 6, 10] /// /// The list with numbers of which to calculate the cumulative sum /// cumulative sum of values @@ -37,7 +37,7 @@ public class MathUtil } /// - /// Helper to create the product of each element times factor + /// Helper to create the product of each element times factor /// /// The list of numbers which shall be multiplied by the factor /// Number to multiply each element by @@ -48,7 +48,7 @@ public class MathUtil } /// - /// Helper to add a constant to all list elements + /// Helper to add a constant to all list elements /// /// The list of numbers to which the summand should be added /// @@ -59,13 +59,11 @@ public class MathUtil } /// - /// Maps a value from an input range to an output range linearly. - /// - /// Example: - /// a_min = 0; a_max=1; - /// b_min = 1; b_max=3; - /// MapToRange(0.5, a_min, a_max, b_min, b_max) // returns 2 - /// + /// Maps a value from an input range to an output range linearly. + /// Example: + /// a_min = 0; a_max=1; + /// b_min = 1; b_max=3; + /// MapToRange(0.5, a_min, a_max, b_min, b_max) // returns 2 /// /// The value from the input range to be mapped to the output range. /// Minimum of the input range. @@ -83,8 +81,8 @@ public class MathUtil } /// - /// Linear interpolation - /// e.g. used to do a continuous integration for quest rewards which are defined for specific support centers of pmcLevel + /// Linear interpolation + /// e.g. used to do a continuous integration for quest rewards which are defined for specific support centers of pmcLevel /// /// The point of x at which to interpolate /// Support points in x (of same length as y) @@ -93,13 +91,22 @@ public class MathUtil public double? Interp1(double xp, List x, List y) { if (xp > x[^1]) // ^1 is the last index in C# + { return y[^1]; + } - if (xp < x[0]) return y[0]; + if (xp < x[0]) + { + return y[0]; + } for (var i = 0; i < x.Count - 1; i++) + { if (xp >= x[i] && xp <= x[i + 1]) + { return y[i] + (xp - x[i]) * (y[i + 1] - y[i]) / (x[i + 1] - x[i]); + } + } return null; } diff --git a/Libraries/Core/Utils/ProgramStatics.cs b/Libraries/Core/Utils/ProgramStatics.cs index aa1c1da4..f7f87c64 100644 --- a/Libraries/Core/Utils/ProgramStatics.cs +++ b/Libraries/Core/Utils/ProgramStatics.cs @@ -101,8 +101,27 @@ public class BuildInfo buildTime = 0; } - public EntryType? entryType { get; set; } - public string? sptVersion { get; set; } - public string? commit { get; set; } - public double? buildTime { get; set; } + public EntryType? entryType + { + get; + set; + } + + public string? sptVersion + { + get; + set; + } + + public string? commit + { + get; + set; + } + + public double? buildTime + { + get; + set; + } } diff --git a/Libraries/Core/Utils/ProgressWriter.cs b/Libraries/Core/Utils/ProgressWriter.cs index a709111e..9142b127 100644 --- a/Libraries/Core/Utils/ProgressWriter.cs +++ b/Libraries/Core/Utils/ProgressWriter.cs @@ -2,10 +2,10 @@ namespace Core.Utils; public class ProgressWriter { - protected int _total; - protected int? _maxBarLength; - protected string? _barFillChar; protected string? _barEmptyChar; + protected string? _barFillChar; + protected int? _maxBarLength; + protected int _total; public ProgressWriter(int total, int maxBarLength, string barFillChar, string barEmptyChar) { diff --git a/Libraries/Core/Utils/RagfairOfferHolder.cs b/Libraries/Core/Utils/RagfairOfferHolder.cs index ca008814..107198d6 100644 --- a/Libraries/Core/Utils/RagfairOfferHolder.cs +++ b/Libraries/Core/Utils/RagfairOfferHolder.cs @@ -17,13 +17,13 @@ public class RagfairOfferHolder( LocalisationService _localisationService, ConfigServer configServer) { + protected int _maxOffersPerTemplate = (int) configServer.GetConfig().Dynamic.OfferItemCount.Max; protected Dictionary _offersById = new(); protected object _offersByIdLock = new(); protected Dictionary> _offersByTemplate = new(); // key = tplId, value = list of offerIds protected object _offersByTemplateLock = new(); protected Dictionary> _offersByTrader = new(); // key = traderId, value = list of offerIds protected object _offersByTraderLock = new(); - protected int _maxOffersPerTemplate = (int)configServer.GetConfig().Dynamic.OfferItemCount.Max; public RagfairOffer? GetOfferById(string id) { @@ -94,7 +94,10 @@ public class RagfairOfferHolder( { var sellerId = offer.User.Id; // Keep generating IDs until we get a unique one - while (_offersById.ContainsKey(offer.Id)) offer.Id = hashUtil.Generate(); + while (_offersById.ContainsKey(offer.Id)) + { + offer.Id = hashUtil.Generate(); + } var offerId = offer.Id; var itemTpl = offer.Items?.FirstOrDefault()?.Template; diff --git a/Libraries/Core/Utils/RandomUtil.cs b/Libraries/Core/Utils/RandomUtil.cs index a2c5065a..5148d1a3 100644 --- a/Libraries/Core/Utils/RandomUtil.cs +++ b/Libraries/Core/Utils/RandomUtil.cs @@ -1,6 +1,6 @@ -using SptCommon.Annotations; using Core.Models.Utils; using Core.Utils.Cloners; +using SptCommon.Annotations; using SptCommon.Extensions; namespace Core.Utils; @@ -9,18 +9,19 @@ namespace Core.Utils; [Injectable(InjectionType.Singleton)] public class RandomUtil(ISptLogger _logger, ICloner _cloner) { - public readonly Random Random = new(); private const int DecimalPointRandomPrecision = 6; - private static readonly int DecimalPointRandomPrecisionMultiplier = (int)Math.Pow(10, DecimalPointRandomPrecision); /// - /// The IEEE-754 standard for double-precision floating-point numbers limits the number of digits (including both - /// integer + fractional parts) to about 15–17 significant digits. 15 is a safe upper bound, so we'll use that. + /// The IEEE-754 standard for double-precision floating-point numbers limits the number of digits (including both + /// integer + fractional parts) to about 15–17 significant digits. 15 is a safe upper bound, so we'll use that. /// public const int MaxSignificantDigits = 15; + private static readonly int DecimalPointRandomPrecisionMultiplier = (int) Math.Pow(10, DecimalPointRandomPrecision); + public readonly Random Random = new(); + /// - /// Generates a random integer between the specified minimum and maximum values, inclusive. + /// Generates a random integer between the specified minimum and maximum values, inclusive. /// /// The minimum value (inclusive). /// The maximum value (optional). @@ -29,30 +30,33 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) public int GetInt(int min, int max = int.MaxValue, bool exclusive = false) { // Prevents a potential integer overflow. - if (exclusive && max == int.MaxValue) max -= 1; + if (exclusive && max == int.MaxValue) + { + max -= 1; + } return max > min ? Random.Next(min, exclusive ? max : max + 1) : min; } /// - /// Generates a random floating-point number within the specified range ~15-17 digits (8 bytes). + /// Generates a random floating-point number within the specified range ~15-17 digits (8 bytes). /// /// The minimum value of the range (inclusive). /// The maximum value of the range (exclusive). /// A random floating-point number between `min` (inclusive) and `max` (exclusive). public double GetDouble(double min, double max) { - var realMin = (long)(min * DecimalPointRandomPrecisionMultiplier); - var realMax = (long)(max * DecimalPointRandomPrecisionMultiplier); + var realMin = (long) (min * DecimalPointRandomPrecisionMultiplier); + var realMax = (long) (max * DecimalPointRandomPrecisionMultiplier); return Math.Round( - Random.NextInt64(realMin, realMax) / (double)DecimalPointRandomPrecisionMultiplier, + Random.NextInt64(realMin, realMax) / (double) DecimalPointRandomPrecisionMultiplier, DecimalPointRandomPrecision ); } /// - /// Generates a random boolean value. + /// Generates a random boolean value. /// /// A random boolean value, where the probability of `true` and `false` is approximately equal. public bool GetBool() @@ -61,7 +65,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Calculates the percentage of a given number and returns the result. + /// Calculates the percentage of a given number and returns the result. /// /// The percentage to calculate. /// The number to calculate the percentage of. @@ -75,7 +79,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Reduces a given number by a specified percentage. + /// Reduces a given number by a specified percentage. /// /// The original number to be reduced. /// The percentage by which to reduce the number. @@ -88,7 +92,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Determines if a random event occurs based on the given chance percentage. + /// Determines if a random event occurs based on the given chance percentage. /// /// The percentage chance (0-100) that the event will occur. /// `true` if the event occurs, `false` otherwise. @@ -100,9 +104,8 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Returns a random string from the provided collection of strings. - /// - /// This method is separate from GetCollectionValue so we can use a generic inference with GetCollectionValue. + /// Returns a random string from the provided collection of strings. + /// This method is separate from GetCollectionValue so we can use a generic inference with GetCollectionValue. /// /// The collection of strings to select a random value from. /// A randomly selected string from the array. @@ -112,7 +115,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Returns a random type T from the provided collection of type T. + /// Returns a random type T from the provided collection of type T. /// /// The collection to get the random element from /// The type of elements in the collection. @@ -124,7 +127,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Gets a random key from the given dictionary + /// Gets a random key from the given dictionary /// /// The dictionary from which to retrieve a key. /// Type of key @@ -136,7 +139,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Gets a random val from the given dictionary + /// Gets a random val from the given dictionary /// /// The dictionary from which to retrieve a value. /// Type of key @@ -148,16 +151,16 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Generates a normally distributed random number using the Box-Muller transform. + /// Generates a normally distributed random number using the Box-Muller transform. /// /// The mean (μ) of the normal distribution. /// The standard deviation (σ) of the normal distribution. /// The current attempt count to generate a valid number (default is 0). /// A normally distributed random number. /// - /// This function uses the Box-Muller transform to generate a normally distributed random number. - /// If the generated number is less than 0, it will recursively attempt to generate a valid number up to 100 times. - /// If it fails to generate a valid number after 100 attempts, it will return a random float between 0.01 and twice the mean. + /// This function uses the Box-Muller transform to generate a normally distributed random number. + /// If the generated number is less than 0, it will recursively attempt to generate a valid number up to 100 times. + /// If it fails to generate a valid number after 100 attempts, it will return a random float between 0.01 and twice the mean. /// public double GetNormallyDistributedRandomNumber(double mean, double sigma, int attempt = 0) { @@ -179,15 +182,17 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) // Check if the generated value is valid if (valueDrawn < 0) + { return attempt > 100 ? GetDouble(0.01D, mean * 2D) : GetNormallyDistributedRandomNumber(mean, sigma, attempt + 1); + } return valueDrawn; } /// - /// Generates a random integer between the specified range. + /// Generates a random integer between the specified range. /// /// The lower bound of the range (inclusive). /// The upper bound of the range (exclusive). If not provided, the range will be from 0 to `low`. @@ -195,42 +200,48 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) public int RandInt(int low, int? high = null) { // Return a random integer from 0 to low if high is not provided - if (high is null) return Random.Next(0, low); + if (high is null) + { + return Random.Next(0, low); + } // Return low directly when low and high are equal return low == high ? low - : Random.Next(low, (int)high); + : Random.Next(low, (int) high); } /// - /// Generates a random number between two given values with optional precision. + /// Generates a random number between two given values with optional precision. /// /// The first value to determine the range. /// The second value to determine the range. If not provided, 0 is used. /// - /// The number of decimal places to round the result to. Must be a positive integer between 0 - /// and MaxSignificantDigits(15), inclusive. If not provided, precision is determined by the input values. + /// The number of decimal places to round the result to. Must be a positive integer between 0 + /// and MaxSignificantDigits(15), inclusive. If not provided, precision is determined by the input values. /// /// public double RandNum(double val1, double val2 = 0, int precision = DecimalPointRandomPrecision) { - if (!double.IsFinite(val1) || !double.IsFinite(val2)) throw new ArgumentException("RandNum() parameters 'value1' and 'value2' must be finite numbers."); + if (!double.IsFinite(val1) || !double.IsFinite(val2)) + { + throw new ArgumentException("RandNum() parameters 'value1' and 'value2' must be finite numbers."); + } // Determine the range var min = Math.Min(val1, val2); var max = Math.Max(val1, val2); - var realPrecision = (long)Math.Pow(10, precision); + var realPrecision = (long) Math.Pow(10, precision); - var minInt = (long)(min * realPrecision); - var maxInt = (long)(max * realPrecision); + var minInt = (long) (min * realPrecision); + var maxInt = (long) (max * realPrecision); - return Math.Round(Random.NextInt64(minInt, maxInt) / (double)realPrecision, precision); + return Math.Round(Random.NextInt64(minInt, maxInt) / (double) realPrecision, precision); } /// - /// Draws a specified number of random elements from a given list. + /// Draws a specified number of random elements from a given list. /// /// The list to draw elements from. /// The number of elements to draw. Defaults to 1. @@ -246,7 +257,10 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) { list = _cloner.Clone(originalList); // Adjust drawCount to avoid drawing more elements than available - if (drawCount > list.Count) drawCount = list.Count; + if (drawCount > list.Count) + { + drawCount = list.Count; + } } var results = new List(); @@ -254,16 +268,20 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) { var randomIndex = RandInt(list.Count); if (replacement) + { results.Add(list[randomIndex]); + } else + { results.Add(list.Splice(randomIndex, 1)[0]); + } } return results; } /// - /// Draws a specified number of random keys from a given dictionary. + /// Draws a specified number of random keys from a given dictionary. /// /// The dictionary from which to draw keys. /// The number of keys to draw. Defaults to 1. @@ -279,7 +297,7 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Generates a biased random number within a specified range. + /// Generates a biased random number within a specified range. /// /// The minimum value of the range (inclusive). /// The maximum value of the range (inclusive). @@ -314,7 +332,10 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) return -1; } - if (min == max) return min; + if (min == max) + { + return min; + } if (shift > max - min) { @@ -351,13 +372,16 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) private double GetGaussianRandom(double n) { var rand = 0d; - for (var i = 0; i < n; i += 1) rand += GetSecureRandomNumber(); + for (var i = 0; i < n; i += 1) + { + rand += GetSecureRandomNumber(); + } return rand / n; } /// - /// Shuffles a list in place using the Fisher-Yates algorithm. + /// Shuffles a list in place using the Fisher-Yates algorithm. /// /// The list to shuffle. /// The type of elements in the list. @@ -379,11 +403,10 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Generates a secure random number between 0 (inclusive) and 1 (exclusive). - /// - /// This method uses the `crypto` module to generate a 48-bit random integer, - /// which is then divided by the maximum possible 48-bit integer value to - /// produce a floating-point number in the range [0, 1). + /// Generates a secure random number between 0 (inclusive) and 1 (exclusive). + /// This method uses the `crypto` module to generate a 48-bit random integer, + /// which is then divided by the maximum possible 48-bit integer value to + /// produce a floating-point number in the range [0, 1). /// /// A secure random number between 0 (inclusive) and 1 (exclusive). private double GetSecureRandomNumber() @@ -392,15 +415,15 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) } /// - /// Determines the number of decimal places in a number. + /// Determines the number of decimal places in a number. /// /// The number to analyze. /// The number of decimal places, or 0 if none exist. public int GetNumberPrecision(double num) { - var preciseNum = (decimal)num; + var preciseNum = (decimal) num; var factor = 0; - while ((double)(preciseNum % 1) > double.Epsilon) + while ((double) (preciseNum % 1) > double.Epsilon) { preciseNum *= 10M; factor++; diff --git a/Libraries/Core/Utils/TimeUtil.cs b/Libraries/Core/Utils/TimeUtil.cs index 8967dd58..b3ec3bf5 100644 --- a/Libraries/Core/Utils/TimeUtil.cs +++ b/Libraries/Core/Utils/TimeUtil.cs @@ -8,7 +8,7 @@ public class TimeUtil public const int OneHourAsSeconds = 3600; /// - /// Formats the time part of a date as a UTC string. + /// Formats the time part of a date as a UTC string. /// /// The date to format in UTC. /// The formatted time as 'HH-MM-SS'. @@ -22,7 +22,7 @@ public class TimeUtil } /// - /// Formats the date part of a date as a UTC string. + /// Formats the date part of a date as a UTC string. /// /// The date to format in UTC. /// The formatted date as 'YYYY-MM-DD'. @@ -36,7 +36,7 @@ public class TimeUtil } /// - /// Gets the current date as a formatted UTC string. + /// Gets the current date as a formatted UTC string. /// /// The current date as 'YYYY-MM-DD'. public string GetDate() @@ -50,7 +50,7 @@ public class TimeUtil } /// - /// Gets the current time as a formatted UTC string. + /// Gets the current time as a formatted UTC string. /// /// The current time as 'HH-MM-SS'. public string GetTime() @@ -59,7 +59,7 @@ public class TimeUtil } /// - /// Gets the current timestamp in seconds in UTC. + /// Gets the current timestamp in seconds in UTC. /// /// The current timestamp in seconds since the Unix epoch in UTC. public long GetTimeStamp() @@ -68,7 +68,7 @@ public class TimeUtil } /// - /// Gets the start of day timestamp for the given date + /// Gets the start of day timestamp for the given date /// /// datetime to get the time stamp for, if null it uses current date. /// Unix epoch for the start of day of the calculated date @@ -79,11 +79,11 @@ public class TimeUtil : GetDateTimeNow(); var startOfDay = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0); - return ((DateTimeOffset)startOfDay).ToUnixTimeMilliseconds(); + return ((DateTimeOffset) startOfDay).ToUnixTimeMilliseconds(); } /// - /// Get timestamp of today + passed in day count + /// Get timestamp of today + passed in day count /// /// Days from now /// @@ -93,7 +93,7 @@ public class TimeUtil } /// - /// Get timestamp of today + passed in hour count + /// Get timestamp of today + passed in hour count /// /// /// @@ -103,7 +103,7 @@ public class TimeUtil } /// - /// Gets the current time in UTC in a format suitable for mail in EFT. + /// Gets the current time in UTC in a format suitable for mail in EFT. /// /// The current time as 'HH:MM' in UTC. /// GetTimeMailFormat @@ -113,7 +113,7 @@ public class TimeUtil } /// - /// Gets the current date in UTC in a format suitable for emails in EFT. + /// Gets the current date in UTC in a format suitable for emails in EFT. /// /// The current date as 'DD.MM.YYYY' in UTC. public string GetDateMailFormat() @@ -122,7 +122,7 @@ public class TimeUtil } /// - /// Converts a number of hours into seconds. + /// Converts a number of hours into seconds. /// /// The number of hours to convert. /// The equivalent number of seconds. @@ -132,7 +132,7 @@ public class TimeUtil } /// - /// Gets the time stamp of the start of the next hour in UTC + /// Gets the time stamp of the start of the next hour in UTC /// /// Time stamp of the next hour in unix time seconds public long GetTimeStampOfNextHour() @@ -142,14 +142,14 @@ public class TimeUtil .Subtract(TimeSpan.FromSeconds(now.Second)) .Subtract(TimeSpan.FromMilliseconds(now.Millisecond)); - var time = ((DateTimeOffset)now.Add(timeUntilNextHour)).ToUnixTimeSeconds(); + var time = ((DateTimeOffset) now.Add(timeUntilNextHour)).ToUnixTimeSeconds(); return time; } /// - /// Returns the current days timestamp at 00:00 - /// e.g. current time: 13th March 14:22 will return 13th March 00:00 + /// Returns the current days timestamp at 00:00 + /// e.g. current time: 13th March 14:22 will return 13th March 00:00 /// /// Timestamp public long GetTodayMidnightTimeStamp() @@ -159,16 +159,19 @@ public class TimeUtil var minutes = now.Minute; // If minutes greater than 0, subtract 1 hour - if (hours > 0 && minutes > 0) hours--; + if (hours > 0 && minutes > 0) + { + hours--; + } // Create a new DateTime with the last full hour, 0 minutes, and 0 seconds var lastFullHour = new DateTime(now.Year, now.Month, now.Day, hours, 0, 0); - return ((DateTimeOffset)lastFullHour).ToUnixTimeMilliseconds(); + return ((DateTimeOffset) lastFullHour).ToUnixTimeMilliseconds(); } /// - /// Pads a number with a leading zero if it is less than 10. + /// Pads a number with a leading zero if it is less than 10. /// /// The number to pad. /// The padded number as a string. @@ -178,7 +181,7 @@ public class TimeUtil } /// - /// Takes a timestamp and converts to its date with Epoch + /// Takes a timestamp and converts to its date with Epoch /// /// /// @@ -188,15 +191,15 @@ public class TimeUtil } /// - /// Takes a date and gets difference between Epoch time and time provided resulting in a timestamp (date defaults to utcnow) - /// This attempts to mimic gettime() in js + /// Takes a date and gets difference between Epoch time and time provided resulting in a timestamp (date defaults to utcnow) + /// This attempts to mimic gettime() in js /// /// /// public long GetTimeStampFromEpoch(DateTime? date = null) { var dateToCompare = date ?? DateTime.UtcNow; - return (long)(dateToCompare - DateTime.UnixEpoch).TotalMilliseconds; + return (long) (dateToCompare - DateTime.UnixEpoch).TotalMilliseconds; } public int GetSecondsAsMilliseconds(int seconds) diff --git a/Libraries/Core/Utils/Watermark.cs b/Libraries/Core/Utils/Watermark.cs index 708bbe39..5aa01704 100644 --- a/Libraries/Core/Utils/Watermark.cs +++ b/Libraries/Core/Utils/Watermark.cs @@ -1,10 +1,10 @@ -using SptCommon.Annotations; using Core.Models.Logging; using Core.Models.Spt.Config; using Core.Models.Utils; using Core.Servers; using Core.Services; using Server; +using SptCommon.Annotations; namespace Core.Utils; @@ -12,8 +12,8 @@ namespace Core.Utils; public class WatermarkLocale { protected List description; - protected List warning; protected List modding; + protected List warning; public WatermarkLocale(LocalisationService localisationService) { @@ -65,15 +65,15 @@ public class WatermarkLocale [Injectable] public class Watermark { + protected ConfigServer _configServer; + protected LocalisationService _localisationService; + + protected ISptLogger _logger; + protected WatermarkLocale _watermarkLocale; protected CoreConfig sptConfig; protected List text = []; protected string versionLabel = ""; - protected ISptLogger _logger; - protected ConfigServer _configServer; - protected LocalisationService _localisationService; - protected WatermarkLocale _watermarkLocale; - public Watermark( ISptLogger logger, ConfigServer configServer, @@ -101,13 +101,24 @@ public class Watermark text = [..text, ..description]; - if (ProgramStatics.DEBUG()) text.AddRange(warning); - if (!ProgramStatics.MODS()) text.AddRange(modding); + if (ProgramStatics.DEBUG()) + { + text.AddRange(warning); + } + + if (!ProgramStatics.MODS()) + { + text.AddRange(modding); + } if (sptConfig.CustomWatermarkLocaleKeys?.Count > 0) + { foreach (var key in sptConfig.CustomWatermarkLocaleKeys) + { text.AddRange(["", _localisationService.GetText(key)]); + } + } SetTitle(); ResetCursor(); @@ -148,13 +159,17 @@ public class Watermark return $"{sptConfig.ProjectName} {versionTag}"; } - /** Set window title */ + /** + * Set window title + */ protected void SetTitle() { Console.Title = versionLabel; } - /** Reset console cursor to top */ + /** + * Reset console cursor to top + */ protected void ResetCursor() { /* @@ -164,7 +179,9 @@ public class Watermark */ } - /** Draw the watermark */ + /** + * Draw the watermark + */ protected void Draw() { var result = new List(); @@ -174,7 +191,10 @@ public class Watermark // Create line of - to add top/bottom of watermark var line = ""; - for (var i = 0; i < longestLength; ++i) line += "─"; + for (var i = 0; i < longestLength; ++i) + { + line += "─"; + } // Opening line result.Add($"┌─{line}─┐"); @@ -185,7 +205,10 @@ public class Watermark var spacingSize = longestLength - watermarkText.Length; var textWithRightPadding = watermarkText; - for (var i = 0; i < spacingSize; ++i) textWithRightPadding += " "; + for (var i = 0; i < spacingSize; ++i) + { + textWithRightPadding += " "; + } result.Add($"│ {textWithRightPadding} │"); } @@ -194,6 +217,9 @@ public class Watermark result.Add($"└─{line}─┘"); // Log watermark to screen - foreach (var text in result) _logger.LogWithColor(text, LogTextColor.Yellow); + foreach (var text in result) + { + _logger.LogWithColor(text, LogTextColor.Yellow); + } } } diff --git a/Libraries/SptAssets/SptAssets.csproj b/Libraries/SptAssets/SptAssets.csproj index 8200083d..5e8c5371 100644 --- a/Libraries/SptAssets/SptAssets.csproj +++ b/Libraries/SptAssets/SptAssets.csproj @@ -1,17 +1,17 @@  - - Library - net9.0 - enable - enable - + + Library + net9.0 + enable + enable + - - - PreserveNewest - - + + + PreserveNewest + + diff --git a/Libraries/SptDependencyInjection/DependencyInjectionRegistrator.cs b/Libraries/SptDependencyInjection/DependencyInjectionRegistrator.cs index 6594aba0..ebea23a0 100644 --- a/Libraries/SptDependencyInjection/DependencyInjectionRegistrator.cs +++ b/Libraries/SptDependencyInjection/DependencyInjectionRegistrator.cs @@ -6,6 +6,9 @@ namespace SptDependencyInjection; public static class DependencyInjectionRegistrator { + private static List? _allLoadedTypes; + private static List? _allConstructors; + public static void RegisterModOverrideComponents(IServiceCollection builderServices, List assemblies) { // We get all the services from this assembly first, since mods will override them later @@ -21,16 +24,21 @@ public static class DependencyInjectionRegistrator var groupedTypes = types.SelectMany( t => { - var attributes = (Injectable[])Attribute.GetCustomAttributes(t, typeof(Injectable)); + var attributes = (Injectable[]) Attribute.GetCustomAttributes(t, typeof(Injectable)); var registerableType = t; var registerableComponents = new List(); foreach (var attribute in attributes) { // if we have a type override this takes priority if (attribute.InjectableTypeOverride != null) + { registerableType = attribute.InjectableTypeOverride; + } // if this class only has 1 interface we register it on that interface - else if (registerableType.GetInterfaces().Length == 1) registerableType = registerableType.GetInterfaces()[0]; + else if (registerableType.GetInterfaces().Length == 1) + { + registerableType = registerableType.GetInterfaces()[0]; + } registerableComponents.Add(new RegisterableType(registerableType, t, attribute)); } @@ -42,20 +50,23 @@ public static class DependencyInjectionRegistrator // We get all injectable services to register them on our services foreach (var groupedInjectables in groupedTypes) foreach (var valueTuple in groupedInjectables.OrderBy(t => t.InjectableAttribute.TypePriority)) + { if (valueTuple.TypeToRegister.IsGenericType) + { RegisterGenericComponents(builderServices, valueTuple); + } else + { RegisterComponent( builderServices, valueTuple.InjectableAttribute.InjectionType, valueTuple.RegisterableInterface, valueTuple.TypeToRegister ); + } + } } - private static List? _allLoadedTypes; - private static List? _allConstructors; - private static void RegisterGenericComponents(IServiceCollection builderServices, RegisterableType valueTuple) { _allLoadedTypes ??= AppDomain.CurrentDomain.GetAssemblies().SelectMany(t => t.GetTypes()).ToList(); @@ -73,7 +84,10 @@ public static class DependencyInjectionRegistrator ); var constructorInfos = matchedConstructors.ToList(); - if (constructorInfos.Count == 0) return; + if (constructorInfos.Count == 0) + { + return; + } foreach (var matchedConstructor in constructorInfos) foreach (var parameterInfo in matchedConstructor.GetParameters() @@ -141,8 +155,19 @@ public static class DependencyInjectionRegistrator private class RegisterableType(Type registerableInterface, Type typeToRegister, Injectable injectableAttribute) { - public Type RegisterableInterface { get; } = registerableInterface; - public Type TypeToRegister { get; } = typeToRegister; - public Injectable InjectableAttribute { get; } = injectableAttribute; + public Type RegisterableInterface + { + get; + } = registerableInterface; + + public Type TypeToRegister + { + get; + } = typeToRegister; + + public Injectable InjectableAttribute + { + get; + } = injectableAttribute; } } diff --git a/Libraries/SptDependencyInjection/SptDependencyInjection.csproj b/Libraries/SptDependencyInjection/SptDependencyInjection.csproj index 2fee4d0e..60bfcbe3 100644 --- a/Libraries/SptDependencyInjection/SptDependencyInjection.csproj +++ b/Libraries/SptDependencyInjection/SptDependencyInjection.csproj @@ -1,17 +1,17 @@  - - net9.0 - enable - enable - + + net9.0 + enable + enable + - - - + + + - - - + + + diff --git a/Server/Logger/AbstractFormatter.cs b/Server/Logger/AbstractFormatter.cs index 548e9e58..e8a26864 100644 --- a/Server/Logger/AbstractFormatter.cs +++ b/Server/Logger/AbstractFormatter.cs @@ -5,13 +5,6 @@ namespace Server.Logger; public abstract class AbstractFormatter : ITextFormatter { - protected abstract string ProcessText(string text); - - protected virtual string GetFormattedText(string timestamp, string logLevel, string sourceContext, string message) - { - return $"[{timestamp} {logLevel}][{sourceContext}] {message}"; - } - public void Format(LogEvent logEvent, TextWriter output) { var newLine = Environment.NewLine; @@ -23,4 +16,11 @@ public abstract class AbstractFormatter : ITextFormatter var logMessage = ProcessText(GetFormattedText(timestamp, logLevel, sourceContext, $"{message}{exception}")); output.WriteLine(logMessage); } + + protected abstract string ProcessText(string text); + + protected virtual string GetFormattedText(string timestamp, string logLevel, string sourceContext, string message) + { + return $"[{timestamp} {logLevel}][{sourceContext}] {message}"; + } } diff --git a/Server/Logger/ConsoleFormatter.cs b/Server/Logger/ConsoleFormatter.cs index ceb9ecbe..596d8bbd 100644 --- a/Server/Logger/ConsoleFormatter.cs +++ b/Server/Logger/ConsoleFormatter.cs @@ -2,6 +2,11 @@ namespace Server.Logger; public class ConsoleFormatter : AbstractFormatter { + public static ConsoleFormatter Default + { + get; + } = new(); + protected override string ProcessText(string text) { return text; @@ -11,6 +16,4 @@ public class ConsoleFormatter : AbstractFormatter { return message; } - - public static ConsoleFormatter Default { get; } = new(); } diff --git a/Server/Logger/FileFormatter.cs b/Server/Logger/FileFormatter.cs index 25427abb..02556d25 100644 --- a/Server/Logger/FileFormatter.cs +++ b/Server/Logger/FileFormatter.cs @@ -4,11 +4,18 @@ namespace Server.Logger; public class FileFormatter : AbstractFormatter { + public static FileFormatter Default + { + get; + } = new(); + protected override string ProcessText(string message) { - foreach (Match match in Regex.Matches(message, @"\x1b\[[0-9]{1,2}(;[0-1]{1,2}){0,1}m")) message = message.Replace(match.Value, ""); + foreach (Match match in Regex.Matches(message, @"\x1b\[[0-9]{1,2}(;[0-1]{1,2}){0,1}m")) + { + message = message.Replace(match.Value, ""); + } + return message.Replace("\"", ""); } - - public static FileFormatter Default { get; } = new(); } diff --git a/Server/Logger/WebApplicationLogger.cs b/Server/Logger/WebApplicationLogger.cs index 434823d1..ed7d3478 100644 --- a/Server/Logger/WebApplicationLogger.cs +++ b/Server/Logger/WebApplicationLogger.cs @@ -1,7 +1,6 @@ -using SptCommon.Annotations; -using Core.Models.Eft.ItemEvent; using Core.Models.Logging; using Core.Models.Utils; +using SptCommon.Annotations; using LogLevel = Core.Models.Spt.Logging.LogLevel; namespace Server.Logger; @@ -9,7 +8,7 @@ namespace Server.Logger; [Injectable] public class SptWebApplicationLogger : ISptLogger { - private ILogger _logger; + private readonly ILogger _logger; public SptWebApplicationLogger(ILoggerProvider provider) { @@ -24,27 +23,13 @@ public class SptWebApplicationLogger : ISptLogger ) { if (textColor != null || backgroundColor != null) + { _logger.LogInformation(ex, GetColorizedText(data, textColor, backgroundColor)); + } else + { _logger.LogInformation(ex, data); - } - - private string GetColorizedText( - string data, - LogTextColor? textColor = null, - LogBackgroundColor? backgroundColor = null - ) - { - var colorString = string.Empty; - if (textColor != null) - colorString += ((int)textColor.Value).ToString(); - - if (backgroundColor != null) - colorString += string.IsNullOrEmpty(colorString) - ? ((int)backgroundColor.Value).ToString() - : $";{((int)backgroundColor.Value).ToString()}"; - - return $"\x1b[{colorString}m{data}\x1b[0m"; + } } public void Success(string data, Exception? ex = null) @@ -88,6 +73,28 @@ public class SptWebApplicationLogger : ISptLogger return _logger.IsEnabled(ConvertLogLevel(level)); } + private string GetColorizedText( + string data, + LogTextColor? textColor = null, + LogBackgroundColor? backgroundColor = null + ) + { + var colorString = string.Empty; + if (textColor != null) + { + colorString += ((int) textColor.Value).ToString(); + } + + if (backgroundColor != null) + { + colorString += string.IsNullOrEmpty(colorString) + ? ((int) backgroundColor.Value).ToString() + : $";{((int) backgroundColor.Value).ToString()}"; + } + + return $"\x1b[{colorString}m{data}\x1b[0m"; + } + protected Microsoft.Extensions.Logging.LogLevel ConvertLogLevel(LogLevel level) { return level switch diff --git a/Server/ModDllLoader.cs b/Server/ModDllLoader.cs index b7f3e7fb..6717d370 100644 --- a/Server/ModDllLoader.cs +++ b/Server/ModDllLoader.cs @@ -9,7 +9,10 @@ public class ModDllLoader public static List LoadAllMods() { if (!Directory.Exists(ModPath)) + { Directory.CreateDirectory(ModPath); + } + var mods = new List(); foreach (var file in Directory.GetFiles(ModPath, "*.dll", SearchOption.AllDirectories)) { diff --git a/Server/Program.cs b/Server/Program.cs index 24fbf87e..11bcce4d 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -9,7 +9,6 @@ using Serilog.Events; using Serilog.Exceptions; using Serilog.Extensions.Logging; using SptDependencyInjection; -using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Server; @@ -40,7 +39,11 @@ public static class Program // Initialize PreSptMods var preSptLoadMods = serviceProvider.GetServices(); - foreach (var preSptLoadMod in preSptLoadMods) preSptLoadMod.PreSptLoad(); + foreach (var preSptLoadMod in preSptLoadMods) + { + preSptLoadMod.PreSptLoad(); + } + var appContext = serviceProvider.GetService(); // Add the Loaded Mod Assemblies for later appContext?.AddValue(ContextVariableType.LOADED_MOD_ASSEMBLIES, assemblies); @@ -56,7 +59,9 @@ public static class Program // When we application gets started by the HttpServer it will add into the AppContext the WebApplication // object, which we can use here to start the webapp. if (httpConfig != null) + { appContext?.GetLatestValue(ContextVariableType.WEB_APPLICATION)?.GetValue().Run($"http://{httpConfig.Ip}:{httpConfig.Port}"); + } } catch (Exception ex) { diff --git a/Server/Server.csproj b/Server/Server.csproj index ec65dea3..70c98a64 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -1,40 +1,40 @@  - - true - false - net9.0 - enable - enable - Exe - + + true + false + net9.0 + enable + enable + Exe + - - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - PreserveNewest - - - - Always - - + + + PreserveNewest + + + + Always + + diff --git a/SptCommon/Annotations/Injectable.cs b/SptCommon/Annotations/Injectable.cs index 37ec6981..2d2ac842 100644 --- a/SptCommon/Annotations/Injectable.cs +++ b/SptCommon/Annotations/Injectable.cs @@ -3,9 +3,23 @@ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] public class Injectable(InjectionType injectionType = InjectionType.Scoped, Type? type = null, int typePriority = int.MaxValue) : Attribute { - public InjectionType InjectionType { get; set; } = injectionType; - public Type? InjectableTypeOverride { get; set; } = type; - public int TypePriority { get; set; } = typePriority; + public InjectionType InjectionType + { + get; + set; + } = injectionType; + + public Type? InjectableTypeOverride + { + get; + set; + } = type; + + public int TypePriority + { + get; + set; + } = typePriority; } public enum InjectionType diff --git a/SptCommon/Extensions/ObjectExtensions.cs b/SptCommon/Extensions/ObjectExtensions.cs index e95785d3..3363d571 100644 --- a/SptCommon/Extensions/ObjectExtensions.cs +++ b/SptCommon/Extensions/ObjectExtensions.cs @@ -23,7 +23,7 @@ public static class ObjectExtensions } /// - /// CARE WHEN USING THIS, THIS IS TO GET PROP ON A TYPE + /// CARE WHEN USING THIS, THIS IS TO GET PROP ON A TYPE /// /// /// @@ -32,7 +32,10 @@ public static class ObjectExtensions /// public static bool ContainsJsonProp(this object? obj, T key) { - if (obj == null) throw new ArgumentNullException(nameof(obj)); + if (obj == null) + { + throw new ArgumentNullException(nameof(obj)); + } return TryGetCachedProperty(obj.GetType(), key.ToString(), out _); } @@ -43,8 +46,11 @@ public static class ObjectExtensions ArgumentNullException.ThrowIfNull(toLower); if (!TryGetCachedProperty(obj.GetType(), toLower, out var cachedProperty)) + { return default; - return (T?)cachedProperty.GetValue(obj); + } + + return (T?) cachedProperty.GetValue(obj); } public static List GetAllPropValuesAsList(this object? obj) @@ -54,7 +60,10 @@ public static class ObjectExtensions var list = obj.GetType().GetProperties(); var result = new List(); - foreach (var prop in list) result.Add(prop.GetValue(obj)); + foreach (var prop in list) + { + result.Add(prop.GetValue(obj)); + } return result; } diff --git a/SptCommon/Extensions/StringExtensions.cs b/SptCommon/Extensions/StringExtensions.cs index 44fcff51..7ed4017e 100644 --- a/SptCommon/Extensions/StringExtensions.cs +++ b/SptCommon/Extensions/StringExtensions.cs @@ -37,7 +37,10 @@ public static class StringExtensions matchedString = null; if (!regex.IsMatch(source)) + { return false; + } + matchedString = regex.Match(source); return true; } diff --git a/SptCommon/SptCommon.csproj b/SptCommon/SptCommon.csproj index 17b910f6..125f4c93 100644 --- a/SptCommon/SptCommon.csproj +++ b/SptCommon/SptCommon.csproj @@ -1,9 +1,9 @@  - - net9.0 - enable - enable - + + net9.0 + enable + enable + diff --git a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs index ff65929f..33bf3bae 100644 --- a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs +++ b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs @@ -1,4 +1,3 @@ -using Core.Callbacks; using Core.DI; using Core.Helpers; using Core.Models.Eft.Common.Tables; @@ -24,9 +23,6 @@ public class HideoutCraftQuestIdGenerator( IEnumerable _onLoadComponents ) { - private readonly List _questProductionOutputList = []; - private readonly Dictionary _questProductionMap = new(); - private readonly HashSet _blacklistedProductions = [ "6617cdb6b24b0ea24505f618", // Old event quest production "Radio Repeater" alt recipe @@ -42,6 +38,9 @@ public class HideoutCraftQuestIdGenerator( { "63a571802116d261d2336cd1", "625d6ffaf7308432be1d44c5" } // Network Provider - Part 2 }; + private readonly Dictionary _questProductionMap = new(); + private readonly List _questProductionOutputList = []; + public async Task Run() { // We only need the DB for this, other OnLoad events alter the data @@ -129,7 +128,8 @@ public class HideoutCraftQuestIdGenerator( if (_forcedQuestToProductionAssociations.TryGetValue(production.Id, out var associatedQuestIdToComplete)) { // Found one, move to next production - _logger.Success($"FORCED - Updated: {production.Id} {production.EndProduct} ({_itemHelper.GetItemName(production.EndProduct)}) with quantity: {production.Count} to target quest: {associatedQuestIdToComplete}" + _logger.Success( + $"FORCED - Updated: {production.Id} {production.EndProduct} ({_itemHelper.GetItemName(production.EndProduct)}) with quantity: {production.Count} to target quest: {associatedQuestIdToComplete}" ); questCompleteRequirements[0].QuestId = associatedQuestIdToComplete; @@ -214,7 +214,21 @@ public class HideoutCraftQuestIdGenerator( public class QuestProductionOutput { - public string QuestId { get; set; } - public string ItemTemplate { get; set; } - public double Quantity { get; set; } + public string QuestId + { + get; + set; + } + + public string ItemTemplate + { + get; + set; + } + + public double Quantity + { + get; + set; + } } diff --git a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.csproj b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.csproj index 363a48df..3e9aed02 100644 --- a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.csproj +++ b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs b/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs index 665d85cf..6013a3ac 100644 --- a/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs +++ b/Tools/HideoutCraftQuestIdGenerator/SptBasicLogger.cs @@ -9,11 +9,12 @@ namespace HideoutCraftQuestIdGenerator; public class SptBasicLogger : ISptLogger { private readonly string categoryName; + public SptBasicLogger() { categoryName = typeof(T).Name; } - + public void LogWithColor(string data, LogTextColor? textColor = null, LogBackgroundColor? backgroundColor = null, Exception? ex = null) { diff --git a/Tools/ItemTplGenerator/ItemOverrides.cs b/Tools/ItemTplGenerator/ItemOverrides.cs index c37b6470..708056fd 100644 --- a/Tools/ItemTplGenerator/ItemOverrides.cs +++ b/Tools/ItemTplGenerator/ItemOverrides.cs @@ -5,7 +5,7 @@ namespace ItemTplGenerator; public class ItemOverrides { public static readonly ReadOnlyDictionary ItemOverridesDictionary = new( - new Dictionary() + new Dictionary { // Stashes { "5963866b86f7747bfa1c4462", "QuestOffline" }, diff --git a/Tools/ItemTplGenerator/ItemTplGenerator.cs b/Tools/ItemTplGenerator/ItemTplGenerator.cs index 72165b97..4626578f 100644 --- a/Tools/ItemTplGenerator/ItemTplGenerator.cs +++ b/Tools/ItemTplGenerator/ItemTplGenerator.cs @@ -23,10 +23,10 @@ public class ItemTplGenerator( IEnumerable _onLoadComponents ) { + private readonly HashSet collidedEnumKeys = []; private string enumDir; - private Dictionary items; private IDictionary itemOverrides; - private HashSet collidedEnumKeys = []; + private Dictionary items; public async Task Run() { @@ -35,7 +35,10 @@ public class ItemTplGenerator( foreach (var onLoad in _onLoadComponents) { if (onLoad is HttpCallbacks) + { continue; + } + await onLoad.OnLoad(); } @@ -52,7 +55,10 @@ public class ItemTplGenerator( var itemTplOutPath = Path.Combine(enumDir, "ItemTpl.cs"); WriteEnumsToFile( itemTplOutPath, - new Dictionary>() { { nameof(ItemTpl), orderedItemsObject } } + new Dictionary> + { + { nameof(ItemTpl), orderedItemsObject } + } ); // Handle the weapon type enums @@ -61,7 +67,10 @@ public class ItemTplGenerator( var weaponTypeOutPath = Path.Combine(enumDir, "Weapons.cs"); WriteEnumsToFile( weaponTypeOutPath, - new Dictionary>() { { nameof(Weapons), weaponsObject } } + new Dictionary> + { + { nameof(Weapons), weaponsObject } + } ); _logger.Info("Generating items finished"); @@ -77,7 +86,10 @@ public class ItemTplGenerator( foreach (var item in items.Values) { // Skip invalid items (Non-Item types, and shrapnel) - if (!IsValidItem(item)) continue; + if (!IsValidItem(item)) + { + continue; + } var itemParentName = GetParentName(item); var itemPrefix = GetItemPrefix(item); @@ -90,7 +102,10 @@ public class ItemTplGenerator( itemPrefix == "") { itemName = itemName.Substring(itemParentName.Length + 1); - if (itemName.Length > 0 && itemName[0] != '_') itemName = $"_{itemName}"; + if (itemName.Length > 0 && itemName[0] != '_') + { + itemName = $"_{itemName}"; + } } // Handle the case where the item ends with the parent category name. Avoids things like 'KEY_DORM_ROOM_103_KEY' @@ -99,7 +114,10 @@ public class ItemTplGenerator( { itemName = itemName.Substring(0, itemName.Length - itemParentName.Length); - if (itemName.Substring(itemName.Length - 1) == "_") itemName = itemName.Substring(0, itemName.Length - 1); + if (itemName.Substring(itemName.Length - 1) == "_") + { + itemName = itemName.Substring(0, itemName.Length - 1); + } } var itemKey = $"{itemParentName}{itemPrefix}{itemName}{itemSuffix}"; @@ -133,9 +151,11 @@ public class ItemTplGenerator( // If we still collide, log an error if (itemsObject.ContainsKey(itemKey)) + { _logger.Error( $"After rename, itemsObject already contains {itemKey} {itemsObject[itemKey]} => {item.Id}" ); + } } else { @@ -156,7 +176,6 @@ public class ItemTplGenerator( } /** - * * @param orderedItemsObject The previously generated object of item name to item ID associations * @returns */ @@ -165,19 +184,27 @@ public class ItemTplGenerator( var weaponsObject = new Dictionary(); foreach (var kv /*[itemId, item]*/ in items) { - if (!_itemHelper.IsOfBaseclass(kv.Key, BaseClasses.WEAPON)) continue; + if (!_itemHelper.IsOfBaseclass(kv.Key, BaseClasses.WEAPON)) + { + continue; + } var caliber = CleanCaliber(kv.Value.Properties.AmmoCaliber.ToUpper()); var weaponShortName = _localeService.GetLocaleDb()[$"{kv.Key} ShortName"]?.ToUpper(); // Special case for the weird duplicated grenade launcher - if (kv.Key == "639c3fbbd0446708ee622ee9") weaponShortName = "FN40GL_2"; + if (kv.Key == "639c3fbbd0446708ee622ee9") + { + weaponShortName = "FN40GL_2"; + } // Include any bracketed suffixes that exist, handles the case of colored gun variants var weaponFullName = _localeService.GetLocaleDb()[$"{kv.Key} Name"]?.ToUpper(); if (weaponFullName.RegexMatch(@"\((.+?)\)$", out var itemNameBracketSuffix) && !weaponShortName.EndsWith(itemNameBracketSuffix.Groups[1].Value)) + { weaponShortName += $"_{itemNameBracketSuffix.Groups[1].Value}"; + } var parentName = GetParentName(kv.Value); @@ -218,29 +245,62 @@ public class ItemTplGenerator( private string GetParentName(TemplateItem item) { - if (item.Properties?.QuestItem is true) return "QUEST"; + if (item.Properties?.QuestItem is true) + { + return "QUEST"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.BARTER_ITEM)) return "BARTER"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.BARTER_ITEM)) + { + return "BARTER"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.THROW_WEAPON)) return "GRENADE"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.THROW_WEAPON)) + { + return "GRENADE"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.STIMULATOR)) return "STIM"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.STIMULATOR)) + { + return "STIM"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MAGAZINE)) return "MAGAZINE"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MAGAZINE)) + { + return "MAGAZINE"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.KEY_MECHANICAL)) return "KEY"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.KEY_MECHANICAL)) + { + return "KEY"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MOB_CONTAINER)) return "SECURE"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MOB_CONTAINER)) + { + return "SECURE"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.SIMPLE_CONTAINER)) return "CONTAINER"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.SIMPLE_CONTAINER)) + { + return "CONTAINER"; + } - if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.PORTABLE_RANGE_FINDER)) return "RANGEFINDER"; + if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.PORTABLE_RANGE_FINDER)) + { + return "RANGEFINDER"; + } // Why are flares grenade launcher...? - if (item.Name.StartsWith("weapon_rsp30")) return "FLARE"; + if (item.Name.StartsWith("weapon_rsp30")) + { + return "FLARE"; + } // This is a special case for the signal pistol, I'm not adding it as a Grenade Launcher - if (item.Id == "620109578d82e67e7911abf2") return "SIGNALPISTOL"; + if (item.Id == "620109578d82e67e7911abf2") + { + return "SIGNALPISTOL"; + } var parentId = item.Parent; return items[parentId].Name.ToUpper(); @@ -250,9 +310,15 @@ public class ItemTplGenerator( { var shrapnelId = "5943d9c186f7745a13413ac9"; - if (item.Type != "Item") return false; + if (item.Type != "Item") + { + return false; + } - if (item.Prototype == shrapnelId) return false; + if (item.Prototype == shrapnelId) + { + return false; + } return true; } @@ -268,15 +334,25 @@ public class ItemTplGenerator( // Prefix ammo with its caliber if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.AMMO)) + { prefix = GetAmmoPrefix(item); + } // Prefix ammo boxes with their caliber else if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.AMMO_BOX)) + { prefix = GetAmmoBoxPrefix(item); + } // Prefix magazines with their caliber - else if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MAGAZINE)) prefix = GetMagazinePrefix(item); + else if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MAGAZINE)) + { + prefix = GetMagazinePrefix(item); + } // Make sure there's an underscore separator - if (prefix.Length > 0 && prefix[0] != '_') prefix = $"_{prefix}"; + if (prefix.Length > 0 && prefix[0] != '_') + { + prefix = $"_{prefix}"; + } return prefix; } @@ -287,15 +363,26 @@ public class ItemTplGenerator( // Add mag size for magazines if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.MAGAZINE)) + { suffix = $"{item.Properties?.Cartridges?[0].MaxCount?.ToString()}RND"; + } // Add pack size for ammo boxes - else if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.AMMO_BOX)) suffix = $"{item.Properties.StackSlots[0]?.MaxCount.ToString()}RND"; + else if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.AMMO_BOX)) + { + suffix = $"{item.Properties.StackSlots[0]?.MaxCount.ToString()}RND"; + } // Add "DAMAGED" for damaged items - if (item.Name.ToLower().Contains("damaged")) suffix += "_DAMAGED"; + if (item.Name.ToLower().Contains("damaged")) + { + suffix += "_DAMAGED"; + } // Make sure there's an underscore separator - if (suffix.Length > 0 && suffix[0] != '_') suffix = $"_{suffix}"; + if (suffix.Length > 0 && suffix[0] != '_') + { + suffix = $"_{suffix}"; + } return suffix; } @@ -368,21 +455,32 @@ public class ItemTplGenerator( else if (_itemHelper.IsOfBaseclasses(item.Id, [BaseClasses.AMMO, BaseClasses.AMMO_BOX, BaseClasses.MAGAZINE])) { if (localeDb.TryGetValue($"{item.Id} ShortName", out itemName)) + { itemName = itemName.ToUpper(); + } } // For everything else, use the full name else { if (localeDb.TryGetValue($"{item.Id} Name", out itemName)) + { itemName = itemName.ToUpper(); + } } // Fall back in the event we couldn't find a name if (string.IsNullOrEmpty(itemName)) + { if (localeDb.TryGetValue($"{item.Id} Name", out itemName)) + { itemName = itemName.ToUpper(); + } + } - if (string.IsNullOrEmpty(itemName)) itemName = item.Name?.ToUpper() ?? null; + if (string.IsNullOrEmpty(itemName)) + { + itemName = item.Name?.ToUpper() ?? null; + } if (string.IsNullOrEmpty(itemName)) { @@ -403,7 +501,9 @@ public class ItemTplGenerator( // Add grid size for lootable containers if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.LOOT_CONTAINER)) + { return $"{item.Properties.Grids[0]?.Props.CellsH}X{item.Properties.Grids[0]?.Props.CellsV}"; + } // Add ammo caliber to conflicting weapons if (_itemHelper.IsOfBaseclass(item.Id, BaseClasses.WEAPON)) @@ -411,19 +511,31 @@ public class ItemTplGenerator( var caliber = CleanCaliber(item.Properties.AmmoCaliber.ToUpper()); // If the item has a bracketed section at the end of its name, include that - if (itemName?.RegexMatch(@"\((.+?)\)$", out var itemNameBracketSuffix) ?? false) return $"{caliber}_{itemNameBracketSuffix.Groups[1].Value}"; + if (itemName?.RegexMatch(@"\((.+?)\)$", out var itemNameBracketSuffix) ?? false) + { + return $"{caliber}_{itemNameBracketSuffix.Groups[1].Value}"; + } return caliber; } // Make sure we have a full name - if (string.IsNullOrEmpty(itemName)) return ""; + if (string.IsNullOrEmpty(itemName)) + { + return ""; + } // If the item has a bracketed section at the end of its name, use that - if (itemName.RegexMatch(@"\((.+?)\)$", out var itemNameBracker)) return itemNameBracker.Groups[1].Value; + if (itemName.RegexMatch(@"\((.+?)\)$", out var itemNameBracker)) + { + return itemNameBracker.Groups[1].Value; + } // If the item has a number at the end of its name, use that - if (itemName.RegexMatch("#([0-9]+)$", out var itemNameNumberSuffix)) return itemNameNumberSuffix.Groups[1].Value; + if (itemName.RegexMatch("#([0-9]+)$", out var itemNameNumberSuffix)) + { + return itemNameNumberSuffix.Groups[1].Value; + } return ""; } @@ -432,14 +544,21 @@ public class ItemTplGenerator( { // First generate a mapping of the original enum values to names var originalEnumValues = new Dictionary(); - foreach (var field in originalEnum.GetFields()) originalEnumValues.Add(field.GetValue(null)!.ToString()!, field.Name); + foreach (var field in originalEnum.GetFields()) + { + originalEnumValues.Add(field.GetValue(null)!.ToString()!, field.Name); + } // Loop through our new data, and find any where the given ID's name doesn't match the original enum foreach (var kv in data) + { if (originalEnumValues.ContainsKey(kv.Value) && originalEnumValues[kv.Value] != kv.Key) + { _logger.Warning( $"Enum {enumName} key has changed for {kv.Value}, {originalEnumValues[kv.Value]} => {kv.Key}" ); + } + } } private void WriteEnumsToFile(string outputPath, Dictionary> enumEntries) @@ -451,7 +570,10 @@ public class ItemTplGenerator( { enumFileData += $"\npublic static class {enumName}\n{{\n"; - foreach (var (key, value) in data) enumFileData += $" public const string {key} = \"{value}\";\n"; + foreach (var (key, value) in data) + { + enumFileData += $" public const string {key} = \"{value}\";\n"; + } enumFileData += "}\n"; } diff --git a/Tools/ItemTplGenerator/ItemTplGenerator.csproj b/Tools/ItemTplGenerator/ItemTplGenerator.csproj index 127c24da..6238b565 100644 --- a/Tools/ItemTplGenerator/ItemTplGenerator.csproj +++ b/Tools/ItemTplGenerator/ItemTplGenerator.csproj @@ -1,19 +1,19 @@  - - true - false - net9.0 - enable - enable - Exe - + + true + false + net9.0 + enable + enable + Exe + - - - - - - + + + + + + diff --git a/UnitTests/Mock/MockLogger.cs b/UnitTests/Mock/MockLogger.cs index 57449f47..a15e9fba 100644 --- a/UnitTests/Mock/MockLogger.cs +++ b/UnitTests/Mock/MockLogger.cs @@ -6,16 +6,6 @@ namespace UnitTests.Mock; public class MockLogger : ISptLogger { - public void LogWithColor( - string data, - Exception? ex = null, - LogTextColor? textColor = null, - LogBackgroundColor? backgroundColor = null - ) - { - Console.WriteLine(data); - } - public void LogWithColor(string data, LogTextColor? textColor = null, LogBackgroundColor? backgroundColor = null, Exception? ex = null) { throw new NotImplementedException(); @@ -61,6 +51,16 @@ public class MockLogger : ISptLogger return true; } + public void LogWithColor( + string data, + Exception? ex = null, + LogTextColor? textColor = null, + LogBackgroundColor? backgroundColor = null + ) + { + Console.WriteLine(data); + } + public void WriteToLogFile(object body) { Console.WriteLine(body); diff --git a/UnitTests/Tests/Test.cs b/UnitTests/Tests/Test.cs index f84fcd82..37375c71 100644 --- a/UnitTests/Tests/Test.cs +++ b/UnitTests/Tests/Test.cs @@ -1,4 +1,3 @@ -using Core.Models.Spt.Server; using Core.Models.Spt.Templates; using Core.Utils; using UnitTests.Mock; diff --git a/UnitTests/Tests/Utils/HashUtilTests.cs b/UnitTests/Tests/Utils/HashUtilTests.cs index 7c4e8c5e..b7611a06 100644 --- a/UnitTests/Tests/Utils/HashUtilTests.cs +++ b/UnitTests/Tests/Utils/HashUtilTests.cs @@ -1,6 +1,5 @@ using Core.Utils; using Core.Utils.Cloners; -using System.Net.Mail; using UnitTests.Mock; namespace UnitTests.Tests.Utils; diff --git a/UnitTests/Tests/Utils/JsonUtilTests.cs b/UnitTests/Tests/Utils/JsonUtilTests.cs index 4cc60549..888e4864 100644 --- a/UnitTests/Tests/Utils/JsonUtilTests.cs +++ b/UnitTests/Tests/Utils/JsonUtilTests.cs @@ -11,7 +11,10 @@ public class JsonUtilTests [TestMethod] public void SerializeAndDeserialize_WithDictionaryOfETFEnum_ExpectCorrectParsing() { - var value = new Dictionary { { QuestStatusEnum.AvailableForStart, 1 } }; + var value = new Dictionary + { + { QuestStatusEnum.AvailableForStart, 1 } + }; var result = _jsonUtil.Deserialize>(_jsonUtil.Serialize(value)); Assert.AreEqual(value.Count, result?.Count); Assert.AreEqual(value.First().Key, result?.First().Key); diff --git a/UnitTests/Tests/Utils/MathUtilTests.cs b/UnitTests/Tests/Utils/MathUtilTests.cs index 62f3de4a..e22fb88c 100644 --- a/UnitTests/Tests/Utils/MathUtilTests.cs +++ b/UnitTests/Tests/Utils/MathUtilTests.cs @@ -10,7 +10,12 @@ public class MathUtilTests [TestMethod] public void ListSumTest() { - var test = new List { 1.1f, 2.1f, 3.3f }; + var test = new List + { + 1.1f, + 2.1f, + 3.3f + }; const double expected = 6.5f; var actual = _mathUtil.ListSum(test); @@ -25,40 +30,88 @@ public class MathUtilTests [TestMethod] public void ListCumSumTest() { - var test = new List { 1f, 2f, 3f, 4f }; - var expected = new List { 1f, 3f, 6f, 10f }; + var test = new List + { + 1f, + 2f, + 3f, + 4f + }; + var expected = new List + { + 1f, + 3f, + 6f, + 10f + }; var actual = _mathUtil.ListCumSum(test); for (var i = 0; i < actual.Count; i++) + { if (Math.Abs(expected[i] - actual[i]) > 0.00001f) + { Assert.Fail($"ListCumSum() Expected: {string.Join(", ", expected)}, Actual: {string.Join(", ", actual)}"); + } + } } [TestMethod] public void ListProductTest() { - var test = new List { 1f, 2f, 3f, 4f }; - var expected = new List { 2f, 4f, 6f, 8f }; + var test = new List + { + 1f, + 2f, + 3f, + 4f + }; + var expected = new List + { + 2f, + 4f, + 6f, + 8f + }; var actual = _mathUtil.ListProduct(test, 2); for (var i = 0; i < actual.Count; i++) + { if (Math.Abs(expected[i] - actual[i]) > 0.00001f) + { Assert.Fail($"ListProduct() Expected: {string.Join(", ", expected)}, Actual: {string.Join(", ", actual)}"); + } + } } [TestMethod] public void ListAddTest() { - var test = new List { 1f, 2f, 3f, 4f }; - var expected = new List { 3f, 4f, 5f, 6f }; + var test = new List + { + 1f, + 2f, + 3f, + 4f + }; + var expected = new List + { + 3f, + 4f, + 5f, + 6f + }; var actual = _mathUtil.ListAdd(test, 2); for (var i = 0; i < actual.Count; i++) + { if (Math.Abs(expected[i] - actual[i]) > 0.00001f) + { Assert.Fail($"ListProduct() Expected: {string.Join(", ", expected)}, Actual: {string.Join(", ", actual)}"); + } + } } [TestMethod] diff --git a/UnitTests/Tests/Utils/RandomUtilTests.cs b/UnitTests/Tests/Utils/RandomUtilTests.cs index cc0bbfd2..f052e2e8 100644 --- a/UnitTests/Tests/Utils/RandomUtilTests.cs +++ b/UnitTests/Tests/Utils/RandomUtilTests.cs @@ -1,6 +1,5 @@ using Core.Utils; using Core.Utils.Cloners; -using Newtonsoft.Json.Linq; using UnitTests.Mock; namespace UnitTests.Tests.Utils; @@ -8,7 +7,7 @@ namespace UnitTests.Tests.Utils; [TestClass] public sealed class RandomUtilTests { - private RandomUtil _randomUtil = new(new MockLogger(), new JsonCloner(new JsonUtil())); + private readonly RandomUtil _randomUtil = new(new MockLogger(), new JsonCloner(new JsonUtil())); [TestMethod] public void GetIntTest() @@ -18,7 +17,10 @@ public sealed class RandomUtilTests { var result = _randomUtil.GetInt(0, 10); - if (result < 0 || result > 10) Assert.Fail($"GetInt(0, 10) out of range. Expected range [0, 10] but was {result}."); + if (result < 0 || result > 10) + { + Assert.Fail($"GetInt(0, 10) out of range. Expected range [0, 10] but was {result}."); + } } } @@ -30,7 +32,10 @@ public sealed class RandomUtilTests { var result = _randomUtil.GetInt(1, 10, true); - if (result < 1 || result > 9) Assert.Fail($"GetInt(10) out of range. Expected range [1, 9] but was {result}."); + if (result < 1 || result > 9) + { + Assert.Fail($"GetInt(10) out of range. Expected range [1, 9] but was {result}."); + } } } @@ -42,7 +47,10 @@ public sealed class RandomUtilTests { var result = _randomUtil.GetDouble(0D, 10D); - if (result is < 0d or >= 10d) Assert.Fail($"GetDouble(0d, 10d) out of range. Expected range [0.0d, 9.999d] but was {result}."); + if (result is < 0d or >= 10d) + { + Assert.Fail($"GetDouble(0d, 10d) out of range. Expected range [0.0d, 9.999d] but was {result}."); + } } } @@ -111,14 +119,20 @@ public sealed class RandomUtilTests { var result = _randomUtil.RandInt(0, 10); - if (result < 0 || result > 9) Assert.Fail($"RandInt(0, 10) out of range. Expected range [0, 9] but was {result}."); + if (result < 0 || result > 9) + { + Assert.Fail($"RandInt(0, 10) out of range. Expected range [0, 9] but was {result}."); + } } for (var i = 0; i < 100; i++) { var result = _randomUtil.RandInt(10); - if (result < 0 || result > 9) Assert.Fail($"RandInt(10, null) out of range. Expected range [0, 9] but was {result}."); + if (result < 0 || result > 9) + { + Assert.Fail($"RandInt(10, null) out of range. Expected range [0, 9] but was {result}."); + } } } @@ -129,29 +143,48 @@ public sealed class RandomUtilTests { var result = _randomUtil.RandNum(0, 10, 15); - if (result < 0 || result >= 10) Assert.Fail($"RandNum(0, 10) out of range. Expected range [0, 9.999d] but was {result}."); + if (result < 0 || result >= 10) + { + Assert.Fail($"RandNum(0, 10) out of range. Expected range [0, 9.999d] but was {result}."); + } if (_randomUtil.GetNumberPrecision(result) > RandomUtil.MaxSignificantDigits) + { Assert.Fail($"RandNum(0, 10) precision of {result} exceeds the allowable precision ({RandomUtil.MaxSignificantDigits}) for the given values."); + } } for (var i = 0; i < 10000; i++) { var result = _randomUtil.RandNum(10); - if (result < 0 || result >= 10) Assert.Fail($"RandNum(10) out of range. Expected range [0, 9.999d] but was {result}."); + if (result < 0 || result >= 10) + { + Assert.Fail($"RandNum(10) out of range. Expected range [0, 9.999d] but was {result}."); + } if (_randomUtil.GetNumberPrecision(result) > RandomUtil.MaxSignificantDigits) + { Assert.Fail($"RandNum(10) precision of {result} exceeds the allowable precision ({RandomUtil.MaxSignificantDigits}) for the given values."); + } } } [TestMethod] public void ShuffleTest() { - var testList = new List() + var testList = new List { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 }; var orig = new List(testList); diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index e3610acd..8ddb85ce 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -1,34 +1,34 @@ - - net9.0 - enable - enable - + + net9.0 + enable + enable + - - - - + + + + - - - + + + - - - - - + + + + + - - - PreserveNewest - - + + + PreserveNewest + + - - - + + +