Decompiled source of SkipFacts v1.0.1

SkipFacts.dll

Decompiled a week 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("SkipFacts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Trombone Champ skip loading facts screen")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+a65d5fd2aad07204cd8e67d4337a7832f92e3bc3")]
[assembly: AssemblyProduct("SkipFacts")]
[assembly: AssemblyTitle("SkipFacts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 SkipFacts
{
	[BepInPlugin("SkipFacts", "SkipFacts", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("SkipFacts").PatchAll();
		}
	}
	[HarmonyPatch(typeof(LevelSelectController), "clickPlay")]
	public class LevelSelectControllerPlayPatch : MonoBehaviour
	{
		private static bool Prefix(LevelSelectController __instance)
		{
			if (__instance.back_clicked)
			{
				return false;
			}
			if (IsConnectedToMultiplayer())
			{
				return true;
			}
			__instance.back_clicked = true;
			__instance.bgmus.Stop();
			__instance.clipPlayer.cancelCrossfades();
			__instance.doSfx(__instance.sfx_musend, 1f, 1f);
			if (__instance.alltrackslist[__instance.songindex].json_format)
			{
				GlobalVariables.playing_custom_track = true;
				GlobalVariables.customtrack_paths = null;
			}
			else
			{
				GlobalVariables.playing_custom_track = false;
			}
			GlobalVariables.levelselect_index = __instance.songindex;
			GlobalVariables.chosen_track = __instance.alltrackslist[__instance.songindex].trackref;
			GlobalVariables.chosen_track_data = __instance.alltrackslist[__instance.songindex];
			__instance.fadeOut("gameplay", 0.4f);
			return false;
		}

		private static bool IsConnectedToMultiplayer()
		{
			Type type = Type.GetType("TootTallyMultiplayer.MultiplayerManager, TootTallyMultiplayer");
			if (type == null)
			{
				return false;
			}
			PropertyInfo property = type.GetProperty("IsConnectedToMultiplayer");
			return property != null && (bool)property.GetValue(type, null);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SkipFacts";

		public const string PLUGIN_NAME = "SkipFacts";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}