From 45c18fecd47839729b57ed5f2c00cfcd8be828dc Mon Sep 17 00:00:00 2001 From: Terkoiz Date: Wed, 8 Mar 2023 19:07:46 +0200 Subject: [PATCH] Disabled the practice mode and coop mode toggles with tooltips --- project/Aki.Custom/AkiCustomPlugin.cs | 1 + .../Patches/OfflineRaidMenuPatch.cs | 14 ++++----- .../Patches/OfflineRaidSettingsMenuPatch.cs | 30 +++++++++++++++++++ 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 project/Aki.Custom/Patches/OfflineRaidSettingsMenuPatch.cs diff --git a/project/Aki.Custom/AkiCustomPlugin.cs b/project/Aki.Custom/AkiCustomPlugin.cs index c389ca5..1c045d4 100644 --- a/project/Aki.Custom/AkiCustomPlugin.cs +++ b/project/Aki.Custom/AkiCustomPlugin.cs @@ -24,6 +24,7 @@ namespace Aki.Custom new BotDifficultyPatch().Enable(); new CoreDifficultyPatch().Enable(); new OfflineRaidMenuPatch().Enable(); + new OfflineRaidSettingsMenuPatch().Enable(); new SessionIdPatch().Enable(); new VersionLabelPatch().Enable(); new IsEnemyPatch().Enable(); diff --git a/project/Aki.Custom/Patches/OfflineRaidMenuPatch.cs b/project/Aki.Custom/Patches/OfflineRaidMenuPatch.cs index d5bb7ea..9346db7 100644 --- a/project/Aki.Custom/Patches/OfflineRaidMenuPatch.cs +++ b/project/Aki.Custom/Patches/OfflineRaidMenuPatch.cs @@ -18,8 +18,8 @@ namespace Aki.Custom.Patches var desiredType = typeof(MatchmakerOfflineRaidScreen); var desiredMethod = desiredType.GetMethod(nameof(MatchmakerOfflineRaidScreen.Show)); - Logger.LogDebug($"{this.GetType().Name} Type: {desiredType?.Name}"); - Logger.LogDebug($"{this.GetType().Name} Method: {desiredMethod?.Name}"); + Logger.LogDebug($"{GetType().Name} Type: {desiredType?.Name}"); + Logger.LogDebug($"{GetType().Name} Method: {desiredMethod?.Name}"); return desiredMethod; } @@ -44,13 +44,9 @@ namespace Aki.Custom.Patches { raidSettings.BotSettings.BotAmount = settings.AiAmount; raidSettings.WavesSettings.BotAmount = settings.AiAmount; - raidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty; - raidSettings.WavesSettings.IsBosses = settings.BossEnabled; - raidSettings.BotSettings.IsScavWars = false; - raidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed; } } @@ -58,12 +54,16 @@ namespace Aki.Custom.Patches [PatchPostfix] private static void PatchPostfix() { - // disable "no progression save" panel + // Hide "no progression save" panel var offlineRaidScreenContent = GameObject.Find("Matchmaker Offline Raid Screen").transform.Find("Content").transform; var warningPanel = offlineRaidScreenContent.Find("WarningPanelHorLayout"); warningPanel.gameObject.SetActive(false); var spacer = offlineRaidScreenContent.Find("Space (1)"); spacer.gameObject.SetActive(false); + + // Disable "Enable practice mode for this raid" toggle + var practiceModeComponent = GameObject.Find("SoloModeCheckmarkBlocker").GetComponent(); + practiceModeComponent.SetBlock(true, "Raids in SPT are always Offline raids. Don't worry - your progress will be saved!"); } } } diff --git a/project/Aki.Custom/Patches/OfflineRaidSettingsMenuPatch.cs b/project/Aki.Custom/Patches/OfflineRaidSettingsMenuPatch.cs new file mode 100644 index 0000000..a27f76c --- /dev/null +++ b/project/Aki.Custom/Patches/OfflineRaidSettingsMenuPatch.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using Aki.Reflection.Patching; +using EFT.UI; +using EFT.UI.Matchmaker; +using UnityEngine; + +namespace Aki.Custom.Patches +{ + public class OfflineRaidSettingsMenuPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + var desiredType = typeof(RaidSettingsWindow); + var desiredMethod = desiredType.GetMethod(nameof(RaidSettingsWindow.Show)); + + Logger.LogDebug($"{GetType().Name} Type: {desiredType.Name}"); + Logger.LogDebug($"{GetType().Name} Method: {desiredMethod?.Name}"); + + return desiredMethod; + } + + [PatchPostfix] + private static void PatchPostfix() + { + // Always disable the Coop Mode checkbox + var coopModeComponent = GameObject.Find("CoopModeCheckmarkBlocker").GetComponent(); + coopModeComponent.SetBlock(true, "SPT will never support Co-op"); + } + } +} \ No newline at end of file