diff --git a/project/SPT.SinglePlayer/Patches/MainMenu/RaidSettingsScreenPatch.cs b/project/SPT.SinglePlayer/Patches/MainMenu/RaidSettingsScreenPatch.cs new file mode 100644 index 0000000..1f250b6 --- /dev/null +++ b/project/SPT.SinglePlayer/Patches/MainMenu/RaidSettingsScreenPatch.cs @@ -0,0 +1,34 @@ +using EFT.UI; +using EFT.UI.Matchmaker; +using HarmonyLib; +using SPT.Reflection.Patching; +using System.Linq; +using System.Reflection; + +namespace SPT.SinglePlayer.Patches.MainMenu +{ + public class RaidSettingsScreenPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.FirstMethod(typeof(MatchmakerOfflineRaidScreen), IsTargetMethod); + } + + private bool IsTargetMethod(MethodInfo method) + { + ParameterInfo[] parameters = method.GetParameters(); + + return parameters.Length == 2 + && parameters[0].Name == "profileInfo" + && parameters[1].Name == "raidSettings"; + } + + [PatchPostfix] + private static void PatchPostfix(MatchmakerOfflineRaidScreen __instance, DefaultUIButton ____changeSettingsButton, UiElementBlocker ____onlineBlocker) + { + ____onlineBlocker.gameObject.SetActive(false); + ____changeSettingsButton.Interactable = true; + __instance.transform.Find("Content/WarningPanelHorLayout").gameObject.SetActive(false); + } + } +} diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs index 565b22b..52a644d 100644 --- a/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs +++ b/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs @@ -22,11 +22,6 @@ namespace SPT.SinglePlayer.Patches.ScavMode [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; @@ -41,11 +36,6 @@ namespace SPT.SinglePlayer.Patches.ScavMode [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/SPTSingleplayerPlugin.cs b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs index f58fb89..059ebdc 100644 --- a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs +++ b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs @@ -77,6 +77,7 @@ namespace SPT.SinglePlayer new EnableRefForPVEPatch().Enable(); new EnableRefIntermScreenPatch().Enable(); new EnablePlayerScavPatch().Enable(); + new RaidSettingsScreenPatch().Enable(); } catch (Exception ex) {