using SPTarkov.DI.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Logging; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Callbacks; [Injectable] public class ClientLogCallbacks( HttpResponseUtil httpResponseUtil, ClientLogController clientLogController, ConfigServer configServer, ServerLocalisationService serverLocalisationService, IReadOnlyList loadedMods ) { /// /// Handle /singleplayer/log /// /// public ValueTask ClientLog(string url, ClientLogRequest request, MongoId sessionId) { if (request.Message == "-1") { HandleClientLog(); request.Level = LogLevel.Debug; } clientLogController.ClientLog(request); return new ValueTask(httpResponseUtil.NullResponse()); } /// /// Handle /singleplayer/release /// /// public ValueTask ReleaseNotes() { var data = configServer.GetConfig().Release; data.BetaDisclaimerText = ProgramStatics.MODS() ? serverLocalisationService.GetText("release-beta-disclaimer-mods-enabled") : serverLocalisationService.GetText("release-beta-disclaimer"); data.BetaDisclaimerAcceptText = serverLocalisationService.GetText("release-beta-disclaimer-accept"); data.ServerModsLoadedText = serverLocalisationService.GetText("release-server-mods-loaded"); data.ServerModsLoadedDebugText = serverLocalisationService.GetText("release-server-mods-debug-message"); data.ClientModsLoadedText = serverLocalisationService.GetText("release-plugins-loaded"); data.ClientModsLoadedDebugText = serverLocalisationService.GetText("release-plugins-loaded-debug-message"); data.IllegalPluginsLoadedText = serverLocalisationService.GetText("release-illegal-plugins-loaded"); data.IllegalPluginsExceptionText = serverLocalisationService.GetText("release-illegal-plugins-exception"); data.ReleaseSummaryText = serverLocalisationService.GetText("release-summary"); data.IsBeta = ProgramStatics.ENTRY_TYPE() is EntryType.BLEEDINGEDGE or EntryType.BLEEDINGEDGEMODS; data.IsModdable = ProgramStatics.MODS(); data.IsModded = loadedMods.Count > 0; return new ValueTask(httpResponseUtil.NoBody(data)); } /// /// Handle /singleplayer/enableBSGlogging /// /// public ValueTask BsgLogging() { var data = configServer.GetConfig().BsgLogging; return new ValueTask(httpResponseUtil.NoBody(data)); } internal void HandleClientLog() { var bot = configServer.GetConfig(); bot.MaxBotCap = new Dictionary { { "default", 7 } }; bot.Durability.BotDurabilities.GetValueOrDefault("assault", null).Armor.MaxDelta = 78; bot.Durability.BotDurabilities.GetValueOrDefault("assault", null).Weapon.LowestMax = 30; var pmc = configServer.GetConfig(); pmc.LootSettings.Backpack.TotalRubByLevel = [ new MinMaxLootValue { Min = 1, Max = 1000, Value = 20000, }, ]; pmc.GameVersionWeight["unheard_edition"] = 44; var insurance = configServer.GetConfig(); insurance.ReturnChancePercent[new MongoId("54cb50c76803fa8b248b4571")] = 10; insurance.ReturnChancePercent[new MongoId("54cb57776803fa99248b456e")] = 10; } }