Decompiled source of ShutUp v1.5.1

plugins/ShutUp.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.IO;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ShutUp")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+616d3bbeee30a6256d928e9710a888f35bbd65a4")]
[assembly: AssemblyProduct("ShutUp")]
[assembly: AssemblyTitle("ShutUp")]
[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 ShutUp
{
	[BepInPlugin("IngoH.WrestlingEmpire.ShutUp", "ShutUp", "1.5.1")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "IngoH.WrestlingEmpire.ShutUp";

		public const string PluginName = "ShutUp";

		public const string PluginVer = "1.5.1";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("IngoH.WrestlingEmpire.ShutUp");

		internal static ConfigEntry<bool> LockAfterSkip;

		internal static ConfigEntry<int> LockDelay;

		internal static ConfigEntry<int> FirstPageDelay;

		internal static string PluginPath;

		private static bool _lock = false;

		private static long _lastSkip = 0L;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			LockAfterSkip = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "LockAfterSkip", true, "Prevents skipping dialog too fast by holding the skip button.");
			LockDelay = ((BaseUnityPlugin)this).Config.Bind<int>("General", "LockDelay", 500, "Delay in milliseconds after skipping dialog before the skip button can be used again if LockAfterSkip is enabled and the skip button is held down.");
			FirstPageDelay = ((BaseUnityPlugin)this).Config.Bind<int>("General", "FirstPageDelay", 45, "Delay in frames before the first page can be skipped. Set to -15 to disable. (Pages start at -15 to delay showing the first page.)");
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded ShutUp!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded ShutUp!");
		}

		[HarmonyPatch(typeof(NEGAFEHECNL), "GPPKMBAODNL")]
		[HarmonyPostfix]
		private static void NEGAFEHECNL_GPPKMBAODNL()
		{
			if ((NEGAFEHECNL.IMJHCHECCED < (float)FirstPageDelay.Value && NEGAFEHECNL.ODOAPLMOJPD == 1) || (NEGAFEHECNL.ODOAPLMOJPD == 6 && NEGAFEHECNL.IMJHCHECCED <= 25f && NEGAFEHECNL.LODPJDDLEKI >= 801 && NEGAFEHECNL.LODPJDDLEKI < 850))
			{
				return;
			}
			try
			{
				BJMGCKGNCHO val = HKJOAJOKOIJ.NAADDLFFIHG[HKJOAJOKOIJ.EMLDNFEIKCK];
				if (NEGAFEHECNL.NNMDEFLLNBF > 0 && LIPNHOMGGHF.FAKHAFKOBPB == 50 && NJBJIIIACEP.OAAMGFLINOB[NEGAFEHECNL.NNMDEFLLNBF].NLOOBNDGIKO.BPJFLJPKKJK >= 5)
				{
					val = NJBJIIIACEP.OAAMGFLINOB[NEGAFEHECNL.NNMDEFLLNBF].NLOOBNDGIKO;
				}
				if (NEGAFEHECNL.EJFHLGMHAHB != 0)
				{
					return;
				}
				int num = 0;
				if (val.IOIJFFLMBCH[1] != 0 || val.IOIJFFLMBCH[2] != 0 || val.IOIJFFLMBCH[3] != 0 || val.IOIJFFLMBCH[4] != 0 || val.FHBEOIPFFDA != 0 || val.OHEIJEDGKLJ != 0)
				{
					num = 1;
				}
				if (((Math.Abs(HKJOAJOKOIJ.EOOBMIDCKIF - 1f) < 0.0001f && HKJOAJOKOIJ.MINFPCEENFN < (float)Screen.height * 0.3f) || num != 0 || Input.GetKey((KeyCode)27) || Input.GetMouseButton(0)) && HKJOAJOKOIJ.LMADDGDMBGB == 0f)
				{
					if (!LockAfterSkip.Value || !_lock || DateTime.Now.Ticks / 10000 - _lastSkip > LockDelay.Value)
					{
						NEGAFEHECNL.ODOAPLMOJPD++;
						NEGAFEHECNL.IMJHCHECCED = 0f;
						if (LockAfterSkip.Value)
						{
							_lock = true;
							_lastSkip = DateTime.Now.Ticks / 10000;
						}
					}
				}
				else if (LockAfterSkip.Value)
				{
					_lock = false;
				}
			}
			catch (Exception)
			{
				_lock = false;
			}
		}
	}
}