Decompiled source of No Cheating v1.0.1

NoCheating.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
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("NoCheating")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoCheating")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("12de9e83-4a57-472a-8f3e-6314fc4d1f60")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoCheating;

[BepInPlugin("spapi.etg.nocheating", "No Cheating", "1.0.0")]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "spapi.etg.nocheating";

	public const string NAME = "No Cheating";

	public const string VERSION = "1.0.0";

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("spapi.etg.nocheating").PatchAll();
	}

	[HarmonyPatch(typeof(ETGModGUI), "Update")]
	[HarmonyPrefix]
	public static void SaveState(ref MenuOpened __state)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected I4, but got Unknown
		__state = (MenuOpened)(int)ETGModGUI.CurrentMenu;
	}

	[HarmonyPatch(typeof(ETGModGUI), "Update")]
	[HarmonyPostfix]
	public static void ReadState(MenuOpened __state)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Invalid comparison between Unknown and I4
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		if ((int)ETGModGUI.CurrentMenu == 3)
		{
			if ((int)__state == 3)
			{
				ETGModGUI.CurrentMenu = (MenuOpened)0;
				ETGModGUI.UpdateTimeScale();
				ETGModGUI.UpdatePlayerState();
			}
			else
			{
				ETGModGUI.CurrentMenu = __state;
				ETGModGUI.UpdateTimeScale();
				ETGModGUI.UpdatePlayerState();
			}
		}
	}
}