Decompiled source of NoDoorCheese v0.0.3

NoDoorCheese.dll

Decompiled 6 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using GTFO.API;
using HarmonyLib;
using Il2CppSystem;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("NoDoorCheese")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoDoorCheese")]
[assembly: AssemblyTitle("NoDoorCheese")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace NoDoorCheese
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("hirnukuono-NoDoorCheese", "hirnukuono-NoDoorCheese", "0.0.3")]
	public class Plugin : BasePlugin
	{
		public class NoDoorCheese : MonoBehaviour
		{
			[CompilerGenerated]
			private sealed class <AntiCheese>d__5 : IEnumerator<object>, IDisposable, IEnumerator
			{
				private int <>1__state;

				private object <>2__current;

				private List<LG_WeakDoor>.Enumerator <>7__wrap1;

				private LG_WeakDoor <door>5__3;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <AntiCheese>d__5(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					int num = <>1__state;
					if (num == -3 || num == 1)
					{
						try
						{
						}
						finally
						{
							<>m__Finally1();
						}
					}
				}

				private bool MoveNext()
				{
					//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0066: Invalid comparison between Unknown and I4
					//IL_0122: Unknown result type (might be due to invalid IL or missing references)
					//IL_012c: Expected O, but got Unknown
					//IL_0083: Unknown result type (might be due to invalid IL or missing references)
					//IL_008d: Expected O, but got Unknown
					try
					{
						switch (<>1__state)
						{
						default:
							return false;
						case 0:
							<>1__state = -1;
							goto IL_002b;
						case 1:
							<>1__state = -3;
							<door>5__3.TriggerOperate(true);
							<door>5__3.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
							Log.LogInfo((object)"door cheese prevented. how u like dem apples?");
							unche.Add(<door>5__3);
							goto IL_00f3;
						case 2:
							<>1__state = -1;
							goto IL_002b;
						case 3:
							{
								<>1__state = -1;
								break;
							}
							IL_002b:
							<>7__wrap1 = doors.GetEnumerator();
							<>1__state = -3;
							goto IL_00fa;
							IL_00fa:
							if (<>7__wrap1.MoveNext())
							{
								<door>5__3 = <>7__wrap1.Current;
								if ((int)<door>5__3.LastStatus == 11 && !unche.Contains(<door>5__3))
								{
									<>2__current = (object)new WaitForSeconds(3f);
									<>1__state = 1;
									return true;
								}
								goto IL_00f3;
							}
							<>m__Finally1();
							<>7__wrap1 = default(List<LG_WeakDoor>.Enumerator);
							<>2__current = (object)new WaitForSeconds(1f);
							<>1__state = 2;
							return true;
							IL_00f3:
							<door>5__3 = null;
							goto IL_00fa;
						}
					}
					catch
					{
						//try-fault
						((IDisposable)this).Dispose();
						throw;
					}
					((IDisposable)this).Dispose();
					return true;
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				private void <>m__Finally1()
				{
					<>1__state = -1;
					((IDisposable)<>7__wrap1).Dispose();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			public static ManualLogSource Log;

			public static List<LG_WeakDoor> doors = new List<LG_WeakDoor>();

			public static List<LG_WeakDoor> unche = new List<LG_WeakDoor>();

			private void Start()
			{
				Log.LogInfo((object)"Plugin is loaded!");
			}

			public void Initialize()
			{
				doors.Clear();
				unche.Clear();
				foreach (LG_WeakDoor item in Object.FindObjectsOfType<LG_WeakDoor>())
				{
					doors.Add(item);
				}
				Log.LogInfo((object)("found weakdoors to monitor and anticheese: " + doors.Count()));
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(AntiCheese()), (Action)null);
			}

			public static IEnumerator AntiCheese()
			{
				try
				{
					int num = default(int);
					List<LG_WeakDoor>.Enumerator enumerator = default(List<LG_WeakDoor>.Enumerator);
					switch (num)
					{
					case 0:
					case 2:
						enumerator = doors.GetEnumerator();
						break;
					case 1:
					{
						LG_WeakDoor door = default(LG_WeakDoor);
						door.TriggerOperate(true);
						door.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
						Log.LogInfo((object)"door cheese prevented. how u like dem apples?");
						unche.Add(door);
						break;
					}
					case 3:
						goto end_IL_0000;
					default:
						yield break;
					}
					while (enumerator.MoveNext())
					{
						LG_WeakDoor door = enumerator.Current;
						if ((int)door.LastStatus == 11 && !unche.Contains(door))
						{
							new WaitForSeconds(3f);
							/*Error near IL_015c: Unexpected return in MoveNext()*/;
						}
					}
					((<AntiCheese>d__5)/*Error near IL_010a: stateMachine*/).<>m__Finally1();
					new WaitForSeconds(1f);
					/*Error near IL_015c: Unexpected return in MoveNext()*/;
					end_IL_0000:;
				}
				catch
				{
					//try-fault
					((IDisposable)/*Error near IL_014c: stateMachine*/).Dispose();
					throw;
				}
				((IDisposable)/*Error near IL_0153: stateMachine*/).Dispose();
				/*Error near IL_015c: Unexpected return in MoveNext()*/;
			}
		}

		public override void Load()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("NoDoorCheese").PatchAll();
			NoDoorCheese @object = ((BasePlugin)this).AddComponent<NoDoorCheese>();
			NoDoorCheese.Log = ((BasePlugin)this).Log;
			EventAPI.OnExpeditionStarted += @object.Initialize;
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "NoDoorCheese";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}