0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 16:50:43 -05:00

Merge pull request 'Disabled the practice mode and coop mode toggles with tooltips' (!5) from feature/raid-settings-toggle-disabling into master

Reviewed-on: SPT-AKI/Modules#5
This commit is contained in:
chomp 2023-03-08 17:12:38 +00:00
commit af55bbb4ea
3 changed files with 38 additions and 7 deletions

View File

@ -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();

View File

@ -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<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");
}
}
}