Decompiled source of GoAwayModList v1.0.1

GoAwayModList.dll

Decompiled 9 months 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LC_API;
using LC_API.GameInterfaceAPI.Features;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Go Away ModList")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Go Away ModList")]
[assembly: AssemblyCopyright("Copyright © RTPoogle 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6e7bde11-075e-4589-8140-a0065ee617f8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace FacilityMeltdownPatch
{
	[BepInPlugin("xyz.poogle.goml", "Go Away ModList", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class GOMLPlugin : BaseUnityPlugin
	{
		public const string GUID = "xyz.poogle.goml";

		public const string NAME = "Go Away ModList";

		public const string VER = "1.0.1";

		public readonly Harmony harmony = new Harmony("xyz.poogle.goml");

		public ManualLogSource LogSrc;

		public static GOMLPlugin Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			LogSrc = Logger.CreateLogSource("xyz.poogle.goml");
			Patches.InitPatches();
			LogSrc.LogInfo((object)"Initialized!");
		}
	}
	internal class Patches
	{
		[HarmonyPatch]
		public static class CheatDatabase_OtherPlayerCheatDetector_Patch
		{
			private static readonly MethodInfo QueueTip = AccessTools.Method(typeof(Player), "QueueTip", (Type[])null, (Type[])null);

			private static readonly MethodInfo LocalPlayer = AccessTools.PropertyGetter(typeof(Player), "LocalPlayer");

			private static readonly MethodInfo Nop_With_Params = CreateDynamicNop();

			private static readonly int LookAhead = ((MethodBase)QueueTip).GetParameterTypes().Length + 1;

			private static MethodInfo CreateDynamicNop()
			{
				DynamicMethod dynamicMethod = new DynamicMethod("Nop", null, ((MethodBase)QueueTip).GetParameterTypes(), typeof(Player));
				dynamicMethod.GetILGenerator().Emit(OpCodes.Ret);
				return dynamicMethod;
			}

			public static IEnumerable<MethodBase> TargetMethods()
			{
				return AccessTools.GetDeclaredMethods(typeof(CheatDatabase)).Cast<MethodBase>();
			}

			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, MethodBase original)
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Expected O, but got Unknown
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Expected O, but got Unknown
				GOMLPlugin.Instance.LogSrc.LogInfo((object)("Patching " + original.Name));
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				for (int i = 0; i < list.Count - LookAhead; i++)
				{
					if (CodeInstructionExtensions.Calls(list[i], LocalPlayer) && CodeInstructionExtensions.Calls(list[i + LookAhead], QueueTip))
					{
						list[i] = new CodeInstruction(OpCodes.Nop, (object)null);
						list[i + LookAhead] = new CodeInstruction(OpCodes.Callvirt, (object)Nop_With_Params);
					}
				}
				GOMLPlugin.Instance.LogSrc.LogInfo((object)("Patched " + original.Name));
				return list;
			}
		}

		internal static void InitPatches()
		{
			GOMLPlugin.Instance.harmony.PatchAll();
		}
	}
}