Decompiled source of CheatyRuns v1.0.0

WKCheats.dll

Decompiled 3 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WKCheats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WKCheats")]
[assembly: AssemblyTitle("WKCheats")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 WKCheats
{
	[BepInPlugin("com.kryzeragon.cheatyruns", "CheatyRuns", "1.0.0")]
	public class WKCheatsPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.kryzeragon.cheatyruns";

		public const string PluginName = "CheatyRuns";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("com.kryzeragon.cheatyruns");
			val.PatchAll(typeof(CheatFlagPatches));
			Log.LogInfo((object)"CheatyRuns loaded.");
		}

		private void Update()
		{
			CheatFlagPatches.ClearCheatFlag();
		}
	}
	internal static class CheatFlagPatches
	{
		internal static void ClearCheatFlag()
		{
			if (CommandConsole.hasCheated)
			{
				CommandConsole.hasCheated = false;
			}
			CL_UIManager instance = CL_UIManager.instance;
			if ((Object)(object)instance != (Object)null && (Object)(object)instance.cheatTracker != (Object)null && instance.cheatTracker.activeSelf)
			{
				instance.cheatTracker.SetActive(false);
			}
		}

		[HarmonyPatch(typeof(CommandConsole), "ExecuteCommand", new Type[]
		{
			typeof(string),
			typeof(bool),
			typeof(bool)
		})]
		[HarmonyPostfix]
		private static void ExecuteCommand_Postfix()
		{
			ClearCheatFlag();
		}

		[HarmonyPatch(typeof(CommandConsole), "EnableCheatsCommand")]
		[HarmonyPostfix]
		private static void EnableCheats_Postfix()
		{
			ClearCheatFlag();
		}

		[HarmonyPatch(typeof(CL_SaveManager), "LoadSession")]
		[HarmonyPostfix]
		private static void LoadSession_Postfix()
		{
			ClearCheatFlag();
		}

		[HarmonyPatch(typeof(UT_CheatTrigger), "Update")]
		[HarmonyPrefix]
		private static bool CheatTrigger_Update_Prefix()
		{
			return false;
		}
	}
}