Decompiled source of YouDiedSkip v1.0.0

YouDiedSkip.dll

Decompiled 5 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("YouDiedSkip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("YouDiedSkip")]
[assembly: AssemblyTitle("YouDiedSkip")]
[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 YouDiedSkip
{
	[BepInPlugin("YouDiedSkip", "YouDiedSkip", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<bool> blockScoreScreen;

		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			blockScoreScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("Conf", "blockScoreReadout", false, "Skip the score readout?");
			Harmony val = new Harmony("YouDiedSkip");
			Type type = AccessTools.FirstInner(typeof(UI_ScoreScreen), (Func<Type, bool>)((Type Type) => Type.FullName == "UI_ScoreScreen+<<ShowScreen>g__ScreenAnimation|19_0>d"));
			val.Patch((MethodBase)AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(UI_ScoreScreen), "ShowScreen", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "Glog", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static void Glog(UI_ScoreScreen __instance)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			__instance.scoreInfoButton.SetActive(__instance.showScoreWindow);
			if (!blockScoreScreen.Value)
			{
				return;
			}
			((UnityEvent)__instance.scoreInfoButton.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				if (!(((Graphic)__instance.scoringWindow.loadingTextAnimator.TMProComponent).color == __instance.scoringWindow.titleColor))
				{
					__instance.scoringWindow.StartAnimation();
				}
			});
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < instructions.Count(); i++)
			{
				CodeInstruction val = instructions.ElementAt(i);
				string text = ((object)val).ToString();
				string text2 = text;
				string text3 = text2;
				if (!(text3 == "ldfld bool UI_ScoreScreen::isDeathScreen"))
				{
					if (text3 == "ldfld bool UI_ScoreScreen::showScoreWindow" && blockScoreScreen.Value && !(list[i - 1].opcode != OpCodes.Ldloc_1))
					{
						list[i - 1] = new CodeInstruction(OpCodes.Nop, (object)null);
						list[i] = new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
					}
				}
				else
				{
					list[i - 1] = new CodeInstruction(OpCodes.Nop, (object)null);
					list[i] = new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
				}
			}
			return list.AsEnumerable();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "YouDiedSkip";

		public const string PLUGIN_NAME = "YouDiedSkip";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}