0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/SPT.Custom/Patches/DisablePvEPatch.cs

30 lines
860 B
C#
Raw Normal View History

2024-05-21 19:10:17 +01:00
using SPT.Common.Http;
using SPT.Reflection.Patching;
using System.Reflection;
using EFT;
using EFT.UI;
using HarmonyLib;
using UnityEngine;
using TMPro;
using System.Linq;
2024-05-21 19:10:17 +01:00
namespace SPT.Custom.Patches
{
public class DisablePvEPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(ChangeGameModeButton), nameof(ChangeGameModeButton.Show));
}
[PatchPrefix]
private static bool PatchPrefix(ESessionMode sessionMode, Profile profile, ref GameObject ____notAvailableState)
{
____notAvailableState.SetActive(true);
Object.FindObjectsOfType<HoverTooltipArea>().Where(o => o.name == "Locked").SingleOrDefault()?.SetMessageText("<color=#51c6db>SPT</color> is already PvE.");
return false;
}
}
}