diff --git a/Fika.Core/FikaPlugin.cs b/Fika.Core/FikaPlugin.cs index a06ce8a2..2c5bc402 100644 --- a/Fika.Core/FikaPlugin.cs +++ b/Fika.Core/FikaPlugin.cs @@ -212,6 +212,7 @@ protected void Awake() new InventoryScroll_Patch().Enable(); new AbstractGame_InRaid_Patch().Enable(); new DisconnectButton_Patch().Enable(); + new ChangeGameModeButton_Patch().Enable(); #if GOLDMASTER new TOS_Patch().Enable(); #endif @@ -483,6 +484,7 @@ private void DisableSPTPatches() new DogtagPatch().Disable(); new OfflineSaveProfilePatch().Disable(); // We handle this with our own exit manager new ScavRepAdjustmentPatch().Disable(); + new DisablePvEPatch().Disable(); new BTRInteractionPatch().Disable(); new BTRExtractPassengersPatch().Disable(); diff --git a/Fika.Core/UI/Patches/ChangeGameModeButton_Patch.cs b/Fika.Core/UI/Patches/ChangeGameModeButton_Patch.cs new file mode 100644 index 00000000..7bc27dad --- /dev/null +++ b/Fika.Core/UI/Patches/ChangeGameModeButton_Patch.cs @@ -0,0 +1,28 @@ +using EFT.UI; +using SPT.Reflection.Patching; +using System.Reflection; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace Fika.Core.UI.Patches +{ + public class ChangeGameModeButton_Patch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return typeof(ChangeGameModeButton).GetMethod(nameof(ChangeGameModeButton.Show)); + } + + [PatchPrefix] + private static bool PrefixChange(TextMeshProUGUI ____buttonLabel, TextMeshProUGUI ____buttonDescription, Image ____buttonDescriptionIcon, + GameObject ____availableState) + { + ____buttonLabel.text = "PvE"; + ____buttonDescription.text = "Fika will always be PvE"; + ____buttonDescriptionIcon.gameObject.SetActive(false); + ____availableState.SetActive(true); + return false; + } + } +} \ No newline at end of file diff --git a/Fika.Core/UI/Patches/DisableInsuranceReadyButton_Patch.cs b/Fika.Core/UI/Patches/DisableInsuranceReadyButton_Patch.cs index 3e26628c..e7ff801a 100644 --- a/Fika.Core/UI/Patches/DisableInsuranceReadyButton_Patch.cs +++ b/Fika.Core/UI/Patches/DisableInsuranceReadyButton_Patch.cs @@ -1,9 +1,9 @@ // © 2024 Lacyway All Rights Reserved using EFT.UI; +using EFT.UI.Matchmaker; using SPT.Reflection.Patching; using System.Reflection; -using UnityEngine; namespace Fika.Core.UI.Patches { @@ -12,28 +12,18 @@ namespace Fika.Core.UI.Patches /// public class DisableInsuranceReadyButton_Patch : ModulePatch { - protected override MethodBase GetTargetMethod() => typeof(MainMenuController).GetMethod(nameof(MainMenuController.method_42)); + protected override MethodBase GetTargetMethod() + { + return typeof(MatchmakerInsuranceScreen).GetMethod(nameof(MatchmakerInsuranceScreen.Awake)); + } [PatchPostfix] - static void PatchPostfix() + static void Postfix(DefaultUIButton ____readyButton) { - var readyButton = GameObject.Find("ReadyButton"); - - if (readyButton != null) - { - readyButton.SetActive(false); - DefaultUIButton uiButton = readyButton.GetComponent(); - if (uiButton != null) - { - uiButton.SetDisabledTooltip("Disabled with Fika"); - uiButton.SetEnabledTooltip("Disabled with Fika"); + ____readyButton.SetDisabledTooltip("Disabled with Fika"); + ____readyButton.SetEnabledTooltip("Disabled with Fika"); - if (uiButton.Interactable == true) - { - uiButton.Interactable = false; - } - } - } + ____readyButton.Interactable = false; } } } \ No newline at end of file diff --git a/Fika.Core/UI/Patches/DisableMatchSettingsReadyButton_Patch.cs b/Fika.Core/UI/Patches/DisableMatchSettingsReadyButton_Patch.cs index 3bf4be04..e933ab4d 100644 --- a/Fika.Core/UI/Patches/DisableMatchSettingsReadyButton_Patch.cs +++ b/Fika.Core/UI/Patches/DisableMatchSettingsReadyButton_Patch.cs @@ -4,7 +4,6 @@ using EFT.UI.Matchmaker; using SPT.Reflection.Patching; using System.Reflection; -using UnityEngine; namespace Fika.Core.UI { @@ -13,28 +12,18 @@ namespace Fika.Core.UI /// public class DisableMatchSettingsReadyButton_Patch : ModulePatch { - protected override MethodBase GetTargetMethod() => typeof(MatchmakerOfflineRaidScreen).GetMethod(nameof(MatchmakerOfflineRaidScreen.Awake)); + protected override MethodBase GetTargetMethod() + { + return typeof(MatchmakerOfflineRaidScreen).GetMethod(nameof(MatchmakerOfflineRaidScreen.Awake)); + } [PatchPostfix] - static void PatchPostfix() + static void Postfix(DefaultUIButton ____readyButton) { - var readyButton = GameObject.Find("ReadyButton"); - - if (readyButton != null) - { - readyButton.SetActive(false); - DefaultUIButton uiButton = readyButton.GetComponent(); - if (uiButton != null) - { - uiButton.SetDisabledTooltip("Disabled with Fika"); - uiButton.SetEnabledTooltip("Disabled with Fika"); + ____readyButton.SetDisabledTooltip("Disabled with Fika"); + ____readyButton.SetEnabledTooltip("Disabled with Fika"); - if (uiButton.Interactable == true) - { - uiButton.Interactable = false; - } - } - } + ____readyButton.Interactable = false; } } } \ No newline at end of file diff --git a/Fika.Core/UI/Patches/DisableReadyButton_Patch.cs b/Fika.Core/UI/Patches/DisableReadyButton_Patch.cs index b2adb8c3..f55aa9a2 100644 --- a/Fika.Core/UI/Patches/DisableReadyButton_Patch.cs +++ b/Fika.Core/UI/Patches/DisableReadyButton_Patch.cs @@ -13,28 +13,18 @@ namespace Fika.Core.UI /// public class DisableReadyButton_Patch : ModulePatch { - protected override MethodBase GetTargetMethod() => typeof(MatchMakerSelectionLocationScreen).GetMethod("method_7", BindingFlags.Public | BindingFlags.Instance); + protected override MethodBase GetTargetMethod() + { + return typeof(MatchMakerSelectionLocationScreen).GetMethod(nameof(MatchMakerSelectionLocationScreen.Awake)); + } [PatchPostfix] - static void PatchPostfix() + static void Postfix(DefaultUIButton ____readyButton) { - var readyButton = GameObject.Find("ReadyButton"); - - if (readyButton != null) - { - readyButton.SetActive(false); - DefaultUIButton uiButton = readyButton.GetComponent(); - if (uiButton != null) - { - uiButton.SetDisabledTooltip("Disabled with Fika"); - uiButton.SetEnabledTooltip("Disabled with Fika"); + ____readyButton.SetDisabledTooltip("Disabled with Fika"); + ____readyButton.SetEnabledTooltip("Disabled with Fika"); - if (uiButton.Interactable == true) - { - uiButton.Interactable = false; - } - } - } + ____readyButton.Interactable = false; } } } \ No newline at end of file