From 95639b9d03d9101b3f4cc5d707da006d5afd8d2e Mon Sep 17 00:00:00 2001 From: Kaeno Date: Mon, 24 Jul 2023 13:33:22 +0000 Subject: [PATCH] Added functionality to allow player to not go missing in raid after extract timer hits 0 using server config MIAOnRaidEnd (!15) Co-authored-by: Kaeno Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Modules/pulls/15 Co-authored-by: Kaeno Co-committed-by: Kaeno --- .../Patches/Quests/EndByTimerPatch.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/project/Aki.SinglePlayer/Patches/Quests/EndByTimerPatch.cs b/project/Aki.SinglePlayer/Patches/Quests/EndByTimerPatch.cs index d529c4a..10586bc 100644 --- a/project/Aki.SinglePlayer/Patches/Quests/EndByTimerPatch.cs +++ b/project/Aki.SinglePlayer/Patches/Quests/EndByTimerPatch.cs @@ -2,7 +2,6 @@ using Aki.Common.Http; using Aki.Reflection.Patching; using Aki.Reflection.Utils; using EFT; -using System; using System.Linq; using System.Reflection; @@ -42,13 +41,16 @@ namespace Aki.SinglePlayer.Patches.Quests [PatchPrefix] private static bool PrefixPatch(object __instance, ref ExitStatus exitStatus, ref string exitName) { - // No extract name and successful, its a MIA - if (string.IsNullOrEmpty(exitName?.Trim()) && exitStatus == ExitStatus.Survived) + var isParsed = bool.TryParse(RequestHandler.GetJson("/singleplayer/settings/raid/endstate"), out bool MIAOnRaidEnd); + if (isParsed) { - exitStatus = ExitStatus.MissingInAction; - exitName = null; + // No extract name and successful, its a MIA + if (MIAOnRaidEnd == true && string.IsNullOrEmpty(exitName?.Trim()) && exitStatus == ExitStatus.Survived) + { + exitStatus = ExitStatus.MissingInAction; + exitName = null; + } } - return true; // Do original } }