using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HideNotifications")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HideNotifications")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b45e3bb5-ec3b-4126-8d50-61041c07dd63")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HideNotifications;
[BepInPlugin("com.toshizuno.hidenotifications", "Hide Notifications", "1.0.0")]
public class HideNotificationsPlugin : BaseUnityPlugin
{
public static class Configuration
{
public static bool collectedScrap;
public static bool criticallyInjured;
public static bool globalNotifications;
public static bool meteorShowerWarnings;
public static bool radiationWarnings;
public static bool regularTips;
public static bool spectatorTips;
public static bool spectatorVotingTip;
public static bool statusEffects;
public static bool warningTips;
}
public static class HUDManager
{
public static bool DisplayTip(bool isWarning)
{
if (!isWarning && Configuration.regularTips)
{
return false;
}
if (isWarning && Configuration.warningTips)
{
return false;
}
return true;
}
public static bool UpdateHealthUI(ref bool ___playerIsCriticallyInjured, int health, bool hurtPlayer)
{
if (hurtPlayer && health > 0 && health < 20)
{
___playerIsCriticallyInjured = true;
return false;
}
return true;
}
}
private ConfigEntry<bool> collectedScrap;
private ConfigEntry<bool> criticallyInjured;
private ConfigEntry<bool> globalNotifications;
private readonly Type HUDManagerType = typeof(HUDManager);
private static HideNotificationsPlugin instance;
private ConfigEntry<bool> meteorShowerWarnings;
private readonly Harmony patcher = new Harmony("com.toshizuno.hidenotifications");
private readonly HarmonyMethod PrefixHarmonyMethod = new HarmonyMethod(typeof(HideNotificationsPlugin).GetMethod("Prefix"));
private readonly BindingFlags privateBindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;
private ConfigEntry<bool> radiationWarnings;
private ConfigEntry<bool> regularTips;
private ConfigEntry<bool> spectatorTips;
private ConfigEntry<bool> spectatorVotingTip;
private ConfigEntry<bool> statusEffects;
private ConfigEntry<bool> warningTips;
private void Awake()
{
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Expected O, but got Unknown
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Expected O, but got Unknown
instance = instance ?? this;
collectedScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideCollectedScrap", true, "Hides the collected scrap notification.");
Configuration.collectedScrap = collectedScrap.Value;
criticallyInjured = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideCriticallyInjured", true, "Hides the critical injury warning.");
Configuration.criticallyInjured = criticallyInjured.Value;
globalNotifications = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideGlobalNotifications", true, "Hides the scanned creatures and story logs notifications.");
Configuration.globalNotifications = globalNotifications.Value;
meteorShowerWarnings = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideMeteorShowerWarnings", true, "Hides the meteor shower warning.");
Configuration.meteorShowerWarnings = meteorShowerWarnings.Value;
radiationWarnings = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideRadiationWarning", true, "Hides the radiation warning.");
Configuration.radiationWarnings = radiationWarnings.Value;
regularTips = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideRegularTips", true, "Hides the yellow tips on the right side of the HUD.");
Configuration.regularTips = regularTips.Value;
spectatorTips = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideSpectatorTips", true, "Hides the spectator tips.");
Configuration.spectatorTips = spectatorTips.Value;
spectatorVotingTip = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideSpectatorVotingTip", true, "Hides the spectator voting tip.");
Configuration.spectatorVotingTip = spectatorVotingTip.Value;
statusEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideStatusEffects", true, "Hides the status effects that show up on the top right of the HUD.");
Configuration.statusEffects = statusEffects.Value;
warningTips = ((BaseUnityPlugin)this).Config.Bind<bool>("Configurations", "hideWarningTips", true, "Hides the red tip on the right side of the HUD.");
Configuration.warningTips = warningTips.Value;
if (Configuration.collectedScrap)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("AddNewScrapFoundToDisplay"), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
patcher.Patch((MethodBase)HUDManagerType.GetMethod("DisplayNewScrapFound"), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (Configuration.criticallyInjured)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("UpdateHealthUI"), new HarmonyMethod(typeof(HUDManager).GetMethod("UpdateHealthUI")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (Configuration.globalNotifications)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("DisplayGlobalNotification", privateBindingFlags), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (Configuration.meteorShowerWarnings)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("MeteorShowerWarningHUD"), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (Configuration.radiationWarnings)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("RadiationWarningHUD"), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
patcher.Patch((MethodBase)HUDManagerType.GetMethod("DisplayTip"), new HarmonyMethod(typeof(HUDManager).GetMethod("DisplayTip")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
if (Configuration.spectatorTips)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("DisplaySpectatorTip", privateBindingFlags), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (Configuration.spectatorVotingTip)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("DisplaySpectatorVoteTip", privateBindingFlags), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
if (Configuration.statusEffects)
{
patcher.Patch((MethodBase)HUDManagerType.GetMethod("DisplayStatusEffect"), PrefixHarmonyMethod, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
}
public static bool Prefix()
{
return false;
}
}