Decompiled source of UnmoddedFix v1.0.0

UnmoddedFix.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using RoR2;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UnmoddedFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnmoddedFix")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("546f2a2e-b1eb-4060-9a1a-d7cc77f54d9d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UnmoddedFix;

[BepInPlugin("com.fiocher.UnmoddedFix", "UnmoddedFix", "1.0.0")]
public class UnmoddedFixPlugin : BaseUnityPlugin
{
	public const string PluginGUID = "com.fiocher.UnmoddedFix";

	public const string PluginName = "UnmoddedFix";

	public const string PluginVersion = "1.0.0";

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		_harmony = new Harmony("com.fiocher.UnmoddedFix");
		_harmony.PatchAll(typeof(Patches));
		RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ForceUnmoddedState));
		RoR2Application.onStart = (Action)Delegate.Combine(RoR2Application.onStart, new Action(ForceUnmoddedState));
		SceneManager.sceneLoaded += delegate
		{
			ForceUnmoddedState();
		};
		ForceUnmoddedState();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"UnmoddedFix 1.0.0 Loaded.");
	}

	private void LateUpdate()
	{
		if (RoR2Application.isModded)
		{
			ForceUnmoddedState();
		}
	}

	public static void ForceUnmoddedState()
	{
		RoR2Application.isModded = false;
		NetworkModCompatibilityHelper.networkModList = Array.Empty<string>();
	}

	private void OnDestroy()
	{
		Harmony harmony = _harmony;
		if (harmony != null)
		{
			harmony.UnpatchSelf();
		}
	}
}
public static class Patches
{
	[HarmonyPatch(typeof(RoR2Application), "Awake")]
	[HarmonyPostfix]
	[HarmonyPriority(0)]
	public static void RoR2Application_Awake_Postfix()
	{
		UnmoddedFixPlugin.ForceUnmoddedState();
	}

	[HarmonyPatch(typeof(RoR2Application), "GetBuildId")]
	[HarmonyPrefix]
	[HarmonyPriority(800)]
	public static void GetBuildId_Prefix()
	{
		UnmoddedFixPlugin.ForceUnmoddedState();
	}
}