0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 22:10:45 -05:00

Disabled the practice mode and coop mode toggles with tooltips

This commit is contained in:
Terkoiz 2023-03-08 19:07:46 +02:00
parent 9362113bb0
commit 45c18fecd4
3 changed files with 38 additions and 7 deletions

View File

@ -24,6 +24,7 @@ namespace Aki.Custom
new BotDifficultyPatch().Enable(); new BotDifficultyPatch().Enable();
new CoreDifficultyPatch().Enable(); new CoreDifficultyPatch().Enable();
new OfflineRaidMenuPatch().Enable(); new OfflineRaidMenuPatch().Enable();
new OfflineRaidSettingsMenuPatch().Enable();
new SessionIdPatch().Enable(); new SessionIdPatch().Enable();
new VersionLabelPatch().Enable(); new VersionLabelPatch().Enable();
new IsEnemyPatch().Enable(); new IsEnemyPatch().Enable();

View File

@ -18,8 +18,8 @@ namespace Aki.Custom.Patches
var desiredType = typeof(MatchmakerOfflineRaidScreen); var desiredType = typeof(MatchmakerOfflineRaidScreen);
var desiredMethod = desiredType.GetMethod(nameof(MatchmakerOfflineRaidScreen.Show)); var desiredMethod = desiredType.GetMethod(nameof(MatchmakerOfflineRaidScreen.Show));
Logger.LogDebug($"{this.GetType().Name} Type: {desiredType?.Name}"); Logger.LogDebug($"{GetType().Name} Type: {desiredType?.Name}");
Logger.LogDebug($"{this.GetType().Name} Method: {desiredMethod?.Name}"); Logger.LogDebug($"{GetType().Name} Method: {desiredMethod?.Name}");
return desiredMethod; return desiredMethod;
} }
@ -44,13 +44,9 @@ namespace Aki.Custom.Patches
{ {
raidSettings.BotSettings.BotAmount = settings.AiAmount; raidSettings.BotSettings.BotAmount = settings.AiAmount;
raidSettings.WavesSettings.BotAmount = settings.AiAmount; raidSettings.WavesSettings.BotAmount = settings.AiAmount;
raidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty; raidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty;
raidSettings.WavesSettings.IsBosses = settings.BossEnabled; raidSettings.WavesSettings.IsBosses = settings.BossEnabled;
raidSettings.BotSettings.IsScavWars = false; raidSettings.BotSettings.IsScavWars = false;
raidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed; raidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed;
} }
} }
@ -58,12 +54,16 @@ namespace Aki.Custom.Patches
[PatchPostfix] [PatchPostfix]
private static void 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 offlineRaidScreenContent = GameObject.Find("Matchmaker Offline Raid Screen").transform.Find("Content").transform;
var warningPanel = offlineRaidScreenContent.Find("WarningPanelHorLayout"); var warningPanel = offlineRaidScreenContent.Find("WarningPanelHorLayout");
warningPanel.gameObject.SetActive(false); warningPanel.gameObject.SetActive(false);
var spacer = offlineRaidScreenContent.Find("Space (1)"); var spacer = offlineRaidScreenContent.Find("Space (1)");
spacer.gameObject.SetActive(false); spacer.gameObject.SetActive(false);
// Disable "Enable practice mode for this raid" toggle
var practiceModeComponent = GameObject.Find("SoloModeCheckmarkBlocker").GetComponent<UiElementBlocker>();
practiceModeComponent.SetBlock(true, "Raids in SPT are always Offline raids. Don't worry - your progress will be saved!");
} }
} }
} }

View File

@ -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<UiElementBlocker>();
coopModeComponent.SetBlock(true, "SPT will never support Co-op");
}
}
}