Decompiled source of CheaterBypass v0.0.3

CheaterBypass.dll

Decompiled 16 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CheaterBypass")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CheaterBypass")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9e389e8-8445-4d77-8a54-11c8354f00a4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CheaterBypass;

[BepInPlugin("mtsukn.CheaterBypass", "CheaterBypass", "0.0.3")]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Achievements), "IsCheatedAtAll")]
	private static class IsCheatedAtAll_Patch
	{
		private static void Postfix(ref bool __result)
		{
			__result = false;
		}
	}

	[HarmonyPatch(typeof(Achievements), "CanGetAchievements")]
	private static class CanGetAchievements_Patch
	{
		private static void Postfix(ref bool __result)
		{
			Achievements.m_cheatCheckCache = false;
			__result = true;
		}
	}

	[HarmonyPatch(typeof(Achievements), "IsWorldCheated")]
	private static class IsWorldCheated_Patch
	{
		private static void Postfix(ref bool __result)
		{
			__result = false;
		}
	}

	[HarmonyPatch(typeof(ItemDrop), "OnCreateNew", new Type[]
	{
		typeof(GameObject),
		typeof(bool)
	})]
	private static class OnCreateGo_Patch
	{
		private static bool Prefix(ref bool cheated)
		{
			cheated = false;
			return true;
		}
	}

	[HarmonyPatch(typeof(ItemDrop), "OnCreateNew", new Type[]
	{
		typeof(ItemDrop),
		typeof(bool)
	})]
	private static class OnCreateItem_Patch
	{
		private static bool Prefix(ref bool cheated)
		{
			cheated = false;
			return true;
		}
	}

	[HarmonyPatch(typeof(Inventory), "Changed")]
	private static class Changed_Patch
	{
		private static bool Prefix(ref bool cheatedStateChanged)
		{
			cheatedStateChanged = false;
			return true;
		}
	}

	[HarmonyPatch(typeof(CharacterDrop), "DropItems")]
	private static class DropItems_Patch
	{
		private static bool Prefix(ref bool cheated)
		{
			cheated = false;
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerProfile), "LoadPlayerFromDisk")]
	private static class LoadPlayer_Patch
	{
		private static void Postfix(PlayerProfile __instance)
		{
			__instance.m_usedCheats = false;
		}
	}

	[HarmonyPatch]
	private static class AddItem_Patch
	{
		public static IEnumerable<MethodBase> TargetMethods()
		{
			string targetArgumentName = "cheated";
			return from m in AccessTools.GetDeclaredMethods(typeof(Inventory))
				where m.Name == "AddItem" && m.GetParameters().Any((ParameterInfo p) => p.Name == targetArgumentName)
				select m;
		}

		public static bool Prefix(ref bool cheated)
		{
			cheated = false;
			return true;
		}
	}

	[HarmonyPatch(typeof(ConsoleCommand), "RunAction")]
	private static class RunAction_Patch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldarg_0 && ((object)list[i + 1]).ToString() == "ldfld bool Terminal+ConsoleCommand::IsCheat")
				{
					list[i] = new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
					list.RemoveAt(i + 1);
				}
			}
			return list.AsEnumerable();
		}
	}

	private const string pluginGUID = "mtsukn.CheaterBypass";

	private const string pluginName = "CheaterBypass";

	private const string pluginVersion = "0.0.3";

	private readonly Harmony HarmonyInstance = new Harmony("mtsukn.CheaterBypass");

	public static ManualLogSource logger = Logger.CreateLogSource("CheaterBypass");

	public void Awake()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		HarmonyInstance.PatchAll(executingAssembly);
		logger.LogInfo((object)"BYPASSING CHEATER CHECKS BEEPBOOPBEEP");
	}
}