diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs
new file mode 100644
index 0000000..565b22b
--- /dev/null
+++ b/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs
@@ -0,0 +1,54 @@
+using EFT;
+using HarmonyLib;
+using SPT.Reflection.Patching;
+using System.Reflection;
+
+namespace SPT.SinglePlayer.Patches.ScavMode
+{
+ internal class EnablePlayerScavPatch : ModulePatch
+ {
+ public static ERaidMode storedRaidMode;
+ public static ESideType storedSide;
+ public static bool storedOnlineRaidInPVE;
+
+ ///
+ /// Temporarily trick client into thinking we are PMC and in offline mode to allow loading of scavs in PVE mode
+ ///
+ protected override MethodBase GetTargetMethod()
+ {
+ return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_22));
+ }
+
+ [PatchPrefix]
+ private static void PatchPrefix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession)
+ {
+ if (!___raidSettings_0.IsScav)
+ {
+ return;
+ }
+
+ // Store old settings to restore them later in postfix
+ storedRaidMode = ___raidSettings_0.RaidMode;
+ storedSide = ___raidSettings_0.Side;
+ storedOnlineRaidInPVE = ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE;
+
+
+ ___raidSettings_0.RaidMode = ERaidMode.Online;
+ ___raidSettings_0.Side = ESideType.Pmc;
+ ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = false;
+ }
+
+ [PatchPostfix]
+ private static void PatchPostfix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession)
+ {
+ if (!___raidSettings_0.IsScav)
+ {
+ return;
+ }
+
+ ___raidSettings_0.RaidMode = storedRaidMode;
+ ___raidSettings_0.Side = storedSide;
+ ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = storedOnlineRaidInPVE;
+ }
+ }
+}
diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs
index 805e3a6..dc2c361 100644
--- a/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs
+++ b/project/SPT.SinglePlayer/Patches/ScavMode/LoadOfflineRaidScreenPatch.cs
@@ -117,7 +117,6 @@ namespace SPT.SinglePlayer.Patches.ScavMode
// Get fields from MainMenuController.cs
var raidSettings = Traverse.Create(menuController).Field("raidSettings_0").GetValue();
- raidSettings.RaidMode = ERaidMode.Local;
// Find the private field of type `MatchmakerPlayerControllerClass`
var matchmakerPlayersController = menuController.GetType()
@@ -144,8 +143,6 @@ namespace SPT.SinglePlayer.Patches.ScavMode
raidSettings.WavesSettings.IsBosses = true;
}
- raidSettings.RaidMode = ERaidMode.Local;
-
// Set offline raid values
_isLocalField.SetValue(menuController, raidSettings.Local);
diff --git a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs
index 3b50377..f58fb89 100644
--- a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs
+++ b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs
@@ -76,6 +76,7 @@ namespace SPT.SinglePlayer
new DisableMatchmakerPlayerPreviewButtonsPatch().Enable();
new EnableRefForPVEPatch().Enable();
new EnableRefIntermScreenPatch().Enable();
+ new EnablePlayerScavPatch().Enable();
}
catch (Exception ex)
{