using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Systems;
using DysonSphereMods.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Valoneu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyDescription("Hide specific in-game warnings with a toggleable UI.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+31b1750490d034965cde15adfc56e59a7ba9b23f")]
[assembly: AssemblyProduct("DysonSphereMods")]
[assembly: AssemblyTitle("HideWarnings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace DysonSphereMods.Shared
{
public static class Log
{
private static ManualLogSource _logger;
public static void Init(ManualLogSource logger)
{
_logger = logger;
}
public static void Debug(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogDebug(data);
}
}
public static void Info(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogInfo(data);
}
}
public static void Warning(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogWarning(data);
}
}
public static void Error(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogError(data);
}
}
public static void Fatal(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogFatal(data);
}
}
public static void Message(object data)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogMessage(data);
}
}
public static void LogOnce(string msg, ref bool flag, params object[] args)
{
if (flag)
{
return;
}
flag = true;
try
{
string[] array = ((args == null) ? Array.Empty<string>() : args.Select((object arg) => (arg != null) ? ((!(arg is int) && !(arg is string) && !arg.GetType().IsPrimitive) ? JsonUtility.ToJson(arg) : arg.ToString()) : "null").ToArray());
object[] args2 = array;
Info(string.Format(msg, args2));
}
catch (Exception arg2)
{
Warning($"LogOnce failed to format message: {msg}. Exception: {arg2}");
}
}
}
public static class MultiplierService
{
private static readonly Dictionary<string, float> _multipliers = new Dictionary<string, float>();
private static bool _isDirty;
public static event Action OnMultipliersChanged;
public static void SetMultiplier(string key, float value)
{
if (!_multipliers.TryGetValue(key, out var value2) || Math.Abs(value2 - value) > 0.0001f)
{
_multipliers[key] = value;
_isDirty = true;
}
}
public static float GetMultiplier(string key, float defaultValue = 1f)
{
if (!_multipliers.TryGetValue(key, out var value))
{
return defaultValue;
}
return value;
}
public static void CommitChanges()
{
if (_isDirty)
{
_isDirty = false;
MultiplierService.OnMultipliersChanged?.Invoke();
}
}
}
public static class TickManager
{
private static long _lastSlowTick = -1L;
private static long _lastLazyTick = -1L;
private static bool _patched = false;
public static event Action OnSlowTick;
public static event Action OnLazyTick;
public static void Patch(Harmony harmony)
{
if (!_patched)
{
_patched = true;
harmony.PatchAll(typeof(TickManager));
}
}
[HarmonyPatch(typeof(GameMain), "Begin")]
[HarmonyPostfix]
public static void Init()
{
_lastSlowTick = -1L;
_lastLazyTick = -1L;
}
[HarmonyPatch(typeof(GameLogic), "LogicFrame")]
[HarmonyPostfix]
public static void GameTick()
{
long gameTick = GameMain.gameTick;
if (gameTick / 60 > _lastSlowTick)
{
_lastSlowTick = gameTick / 60;
TickManager.OnSlowTick?.Invoke();
}
if (gameTick / 600 > _lastLazyTick)
{
_lastLazyTick = gameTick / 600;
TickManager.OnLazyTick?.Invoke();
}
}
}
public abstract class WindowBase
{
public Rect WindowRect;
protected Vector2 ScrollPos;
private bool _isResizing;
private Rect _resizeRect = new Rect(0f, 0f, 15f, 15f);
public Vector2 MinSize = new Vector2(300f, 200f);
public int WindowId { get; protected set; }
public string Title { get; set; }
public bool IsVisible { get; set; }
protected WindowBase(int windowId, string title, Rect defaultRect)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
WindowId = windowId;
Title = title;
WindowRect = defaultRect;
}
public virtual void OnGUI()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (IsVisible)
{
GUI.backgroundColor = new Color(0.08f, 0.12f, 0.22f, 0.95f);
WindowRect = GUILayout.Window(WindowId, WindowRect, new WindowFunction(DrawWindowInternal), Title, Array.Empty<GUILayoutOption>());
GUI.backgroundColor = Color.white;
((Rect)(ref WindowRect)).x = Mathf.Clamp(((Rect)(ref WindowRect)).x, 0f - ((Rect)(ref WindowRect)).width + 50f, (float)(Screen.width - 50));
((Rect)(ref WindowRect)).y = Mathf.Clamp(((Rect)(ref WindowRect)).y, -20f, (float)(Screen.height - 50));
}
}
private void DrawWindowInternal(int id)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00dd: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Invalid comparison between Unknown and I4
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Invalid comparison between Unknown and I4
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
DrawWindowHeader();
ScrollPos = GUILayout.BeginScrollView(ScrollPos, Array.Empty<GUILayoutOption>());
DrawWindowContent();
GUILayout.EndScrollView();
DrawWindowFooter();
((Rect)(ref _resizeRect)).x = ((Rect)(ref WindowRect)).width - 20f;
((Rect)(ref _resizeRect)).y = ((Rect)(ref WindowRect)).height - 20f;
((Rect)(ref _resizeRect)).width = 20f;
((Rect)(ref _resizeRect)).height = 20f;
GUI.Label(_resizeRect, "↘", new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)4,
fontSize = 20,
normal = new GUIStyleState
{
textColor = new Color(0.6f, 0.6f, 0.6f, 0.8f)
}
});
Event current = Event.current;
bool flag = false;
if ((int)current.type == 0 && ((Rect)(ref _resizeRect)).Contains(current.mousePosition))
{
_isResizing = true;
flag = true;
current.Use();
}
else if ((int)current.type == 1)
{
_isResizing = false;
}
else if ((int)current.type == 3 && _isResizing)
{
ref Rect windowRect = ref WindowRect;
((Rect)(ref windowRect)).width = ((Rect)(ref windowRect)).width + current.delta.x;
ref Rect windowRect2 = ref WindowRect;
((Rect)(ref windowRect2)).height = ((Rect)(ref windowRect2)).height + current.delta.y;
((Rect)(ref WindowRect)).width = Mathf.Max(MinSize.x, ((Rect)(ref WindowRect)).width);
((Rect)(ref WindowRect)).height = Mathf.Max(MinSize.y, ((Rect)(ref WindowRect)).height);
current.Use();
}
if ((int)current.type == 0 && !flag)
{
GUIUtility.keyboardControl = 0;
}
GUI.DragWindow();
}
protected virtual void DrawWindowHeader()
{
}
protected abstract void DrawWindowContent();
protected virtual void DrawWindowFooter()
{
}
public virtual void Toggle()
{
IsVisible = !IsVisible;
}
}
}
namespace HideWarnings
{
[BepInPlugin("com.Valoneu.HideWarnings", "HideWarnings", "1.0.0")]
[BepInProcess("DSPGAME.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[CommonAPISubmoduleDependency(new string[] { "ProtoRegistry", "CustomKeyBindSystem" })]
public class HideWarningsPlugin : BaseUnityPlugin
{
public const string GUID = "com.Valoneu.HideWarnings";
public const string NAME = "HideWarnings";
public const string VERSION = "1.0.0";
public static ConfigEntry<bool> HideVeinDepleted;
public static ConfigEntry<bool> HideNotEnoughResources;
public static ConfigEntry<bool> HidePowerShutdown;
public static ConfigEntry<bool> HidePowerInsufficient;
public static ConfigEntry<bool> HideSorterBlocked;
public static ConfigEntry<bool> HideBuildingDamaged;
public static ConfigEntry<bool> HideDashboardAlerts;
public static ConfigEntry<bool> HideTechCompletion;
private static HideWarningsWindow _window;
private void Awake()
{
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
HideVeinDepleted = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HideVeinDepleted", false, "Hide vein depleted / insufficient resource warnings.");
HideNotEnoughResources = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HideNotEnoughResources", false, "Hide 'needs resources' warnings on unconstructed buildings.");
HidePowerShutdown = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HidePowerShutdown", false, "Hide power shutdown warnings.");
HidePowerInsufficient = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HidePowerInsufficient", false, "Hide power insufficient/low warnings.");
HideSorterBlocked = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HideSorterBlocked", false, "Hide sorter/inserter blocked warnings.");
HideBuildingDamaged = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HideBuildingDamaged", false, "Hide building damaged/repair warnings.");
HideDashboardAlerts = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HideDashboardAlerts", false, "Hide dashboard/statistics plan alerts.");
HideTechCompletion = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "HideTechCompletion", false, "Hide tech research completion popup and banner.");
RegisterKeyBinds();
Harmony val = new Harmony("com.Valoneu.HideWarnings");
val.PatchAll(typeof(WarningPatches));
val.PatchAll(typeof(HideWarningsPlugin));
Log.Info("HideWarnings v1.0.0 loaded!");
}
private void RegisterKeyBinds()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
if (!CustomKeyBindSystem.HasKeyBind("ToggleHideWarningsUI"))
{
BuiltinKey val = default(BuiltinKey);
val.id = 1250;
val.key = new CombineKey(261, (byte)2, (ECombineKeyAction)0, false);
val.conflictGroup = 2052;
val.name = "ToggleHideWarningsUI";
val.canOverride = true;
CustomKeyBindSystem.RegisterKeyBind<PressKeyBind>(val);
}
ProtoRegistry.RegisterString("ToggleHideWarningsUI", "Toggle Hide Warnings UI");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameMain), "Begin")]
public static void GameMain_Begin_Postfix()
{
if (_window == null)
{
_window = new HideWarningsWindow();
}
}
private void Update()
{
if (_window != null && CustomKeyBindSystem.GetKeyBind("ToggleHideWarningsUI").keyValue)
{
_window.Toggle();
}
}
private void OnGUI()
{
if (_window != null)
{
_window.OnGUI();
}
}
public static bool ShouldHideSignal(int signalId)
{
switch (signalId)
{
case 501:
case 502:
return HidePowerInsufficient.Value;
case 503:
return HidePowerShutdown.Value;
case 510:
return HideSorterBlocked.Value;
case 512:
return HideBuildingDamaged.Value;
case 513:
return HideBuildingDamaged.Value;
case 405:
return HideNotEnoughResources.Value;
case 518:
return HideDashboardAlerts.Value;
default:
if (signalId >= 504 && signalId <= 509)
{
return HideVeinDepleted.Value;
}
return false;
}
}
}
[HarmonyPatch]
public static class WarningPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(WarningSystem), "WarningLogic")]
public static void WarningLogic_Postfix(WarningSystem __instance)
{
if (__instance.warningSignalCount <= 0)
{
return;
}
int num = 0;
for (int i = 0; i < __instance.warningSignalCount; i++)
{
int num2 = __instance.warningSignals[i];
if (HideWarningsPlugin.ShouldHideSignal(num2))
{
__instance.warningCounts[num2] = 0;
continue;
}
__instance.warningSignals[num] = num2;
num++;
}
for (int j = num; j < __instance.warningSignalCount; j++)
{
__instance.warningSignals[j] = 0;
}
__instance.warningSignalCount = num;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIGeneralTips), "OnTechUnlocked")]
public static bool OnTechUnlocked_Prefix()
{
return !HideWarningsPlugin.HideTechCompletion.Value;
}
}
public class HideWarningsWindow : WindowBase
{
public HideWarningsWindow()
: base(9930, "Hide Warnings", new Rect((float)Screen.width / 2f - 180f, (float)Screen.height / 2f - 200f, 360f, 400f))
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
MinSize = new Vector2(300f, 300f);
}
protected override void DrawWindowHeader()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
GUIStyle val = new GUIStyle(GUI.skin.label)
{
richText = true,
fontStyle = (FontStyle)1
};
val.normal.textColor = new Color(0.4f, 0.7f, 1f);
GUILayout.Label("WARNING FILTERS", val, Array.Empty<GUILayoutOption>());
GUILayout.Label("<size=11><color=#aaaaaa>Toggle which warnings to suppress</color></size>", new GUIStyle(GUI.skin.label)
{
richText = true
}, Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
}
protected override void DrawWindowContent()
{
DrawToggle("Vein Depleted / Insufficient", HideWarningsPlugin.HideVeinDepleted, "Hides warnings for depleted or low veins");
DrawToggle("Needs Resources (Unconstructed)", HideWarningsPlugin.HideNotEnoughResources, "Hides 'needs resources' on unbuilt buildings");
DrawToggle("Power Insufficient / Low", HideWarningsPlugin.HidePowerInsufficient, "Hides insufficient power warnings");
DrawToggle("Power Shutdown", HideWarningsPlugin.HidePowerShutdown, "Hides full power shutdown warnings");
DrawToggle("Sorter / Inserter Blocked", HideWarningsPlugin.HideSorterBlocked, "Hides sorter/inserter jam warnings");
DrawToggle("Building Damaged / Repair", HideWarningsPlugin.HideBuildingDamaged, "Hides building damage and repair warnings");
DrawToggle("Dashboard / Stat Alerts", HideWarningsPlugin.HideDashboardAlerts, "Hides dashboard and statistics plan alerts");
DrawToggle("Tech Completion Popup", HideWarningsPlugin.HideTechCompletion, "Hides the research completion banner and popup");
}
private void DrawToggle(string label, ConfigEntry<bool> config, string desc)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
config.Value = GUILayout.Toggle(config.Value, " " + label, Array.Empty<GUILayoutOption>());
GUILayout.Label("<size=10><color=#888888>" + desc + "</color></size>", new GUIStyle(GUI.skin.label)
{
richText = true
}, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.Space(2f);
}
protected override void DrawWindowFooter()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
GUI.backgroundColor = new Color(0.8f, 0.4f, 0.1f, 0.8f);
if (GUILayout.Button("CLOSE", Array.Empty<GUILayoutOption>()))
{
base.IsVisible = false;
}
GUI.backgroundColor = Color.white;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.Valoneu.HideWarnings";
public const string PLUGIN_NAME = "HideWarnings";
public const string PLUGIN_VERSION = "1.0.0";
}
}