Decompiled source of No Handcuff Escapes v1.0.0

NoHandcuffEscapes.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("NoHandcuffEscapes")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("An example mod that works on both IL2CPP and Mono game branches")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eeed22640ccc7cb11f68a8b621d1df6dbac39896")]
[assembly: AssemblyProduct("NoHandcuffEscapes")]
[assembly: AssemblyTitle("NoHandcuffEscapes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 NoHandcuffEscapes
{
	[BepInPlugin("NoHandcuffEscapes", "NoHandcuffEscapes", "1.0.0")]
	public class NoHandcuffEscapesPlugin : BasePlugin
	{
		public static ConfigEntry<float> HoursToLockFor;

		public static ConfigEntry<bool> NeverRelease;

		private static NoHandcuffEscapesPlugin instance;

		public static ManualLogSource PluginLogger;

		public override void Load()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			PluginLogger = ((BasePlugin)this).Log;
			instance = this;
			HoursToLockFor = ((BasePlugin)this).Config.Bind<float>("General", "handcuff_lock_time", 24f, "How many hours should handcuffs stay locked for? (Restart required)");
			NeverRelease = ((BasePlugin)this).Config.Bind<bool>("General", "handcuff_never_unlock", false, "Handcuffs never release? (Overrides the number of hours)");
			ManualLogSource pluginLogger = PluginLogger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("NoHandcuffEscapes");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			pluginLogger.LogInfo(val);
			Harmony val2 = new Harmony("NoHandcuffEscapes");
			val2.PatchAll();
			ManualLogSource pluginLogger2 = PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("NoHandcuffEscapes");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
			}
			pluginLogger2.LogInfo(val);
		}
	}
	[HarmonyPatch(typeof(GameplayControls), "Awake")]
	public class GameplayControls_Awake
	{
		public static void Postfix()
		{
			GameplayControls.Instance.restrainedTimer = ((NoHandcuffEscapesPlugin.HoursToLockFor.Value > 0f) ? NoHandcuffEscapesPlugin.HoursToLockFor.Value : 2f);
		}
	}
	[HarmonyPatch(typeof(NewAIController), "FrequentUpdate")]
	public class NewAIController_FrequentUpdate
	{
		public static void Prefix(NewAIController __instance)
		{
			if (NoHandcuffEscapesPlugin.NeverRelease.Value)
			{
				__instance.restrainTime = SessionData.Instance.gameTime + 1f;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NoHandcuffEscapes";

		public const string PLUGIN_NAME = "NoHandcuffEscapes";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}