Decompiled source of SkipIntro v2.0.0

BepInEx/plugins/SkipIntro2.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using <StartupCode$SkipIntro2>;
using BaboonAPI.Hooks.Initializer;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.FSharp.Core;
using SkipIntro2;
using SkipIntro2.Patch;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SkipIntro2")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("SkipIntro")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("SkipIntro2")]
[assembly: AssemblyTitle("SkipIntro2")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/tc-mods/SkipIntro2")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default)]
[assembly: AssemblyVersion("2.0.0.0")]
namespace SkipIntro2.Patch
{
	[Serializable]
	[HarmonyPatch(typeof(BrandingController), "Start")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class BrandingControllerPatch
	{
		public static void Postfix(BrandingController __instance)
		{
			if (BaboonInitializer.IsInitialized())
			{
				((MonoBehaviour)__instance).CancelInvoke();
				((MonoBehaviour)__instance).Invoke("killandload", 0f);
			}
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(SaveSlotController), "Start")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class SaveSlotControllerPatch
	{
		internal static int saveIndex@;

		internal static int init@17;

		internal static int saveIndex
		{
			[CompilerGenerated]
			[DebuggerNonUserCode]
			get
			{
				if (init@17 < 1)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				return saveIndex@;
			}
			[CompilerGenerated]
			[DebuggerNonUserCode]
			set
			{
				if (init@17 < 1)
				{
					IntrinsicFunctions.FailStaticInit();
				}
				saveIndex@ = value;
			}
		}

		public static void Postfix(SaveSlotController __instance)
		{
			SaverLoader.global_saveindex = saveIndex;
			SaverLoader.loadSavedGame();
			MethodInfo method = ((object)__instance).GetType().GetMethod("checkScores", BindingFlags.Instance | BindingFlags.NonPublic);
			object obj = method.Invoke(__instance, null);
			AchievementSetter.checkAllCheevos();
			SceneManager.LoadScene("home");
		}

		static SaveSlotControllerPatch()
		{
			$Patches.init@ = 0;
			_ = $Patches.init@;
		}
	}
}
namespace SkipIntro2
{
	[Serializable]
	[BepInPlugin("SkipIntro", "SkipIntro", "2.0.0")]
	[BepInDependency("ch.offbeatwit.baboonapi.plugin", "2.5.0")]
	[CompilationMapping(/*Could not decode attribute arguments.*/)]
	public class SkipIntroPlugin : BaseUnityPlugin, Listener
	{
		internal Harmony harmony;

		public SkipIntroPlugin()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			harmony = new Harmony("ch.offbeatwit.skipintro.harmony");
		}

		public void Awake()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			GameInitializationEvent.EVENT.Register((Listener)(object)this);
			try
			{
				harmony.PatchAll((Type)(object)typeof(BrandingControllerPatch));
			}
			catch (object obj)
			{
				Exception ex = (Exception)obj;
				((BaseUnityPlugin)this).Logger.LogError((object)"Could not patch BrandingController, oh no");
				((BaseUnityPlugin)this).Logger.LogError((object)ex);
			}
			ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>("Default", "SaveSlot", 0, new ConfigDescription("Save slot to load", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2), Array.Empty<object>()));
			SaveSlotControllerPatch.saveIndex = val.Value;
		}

		public void TryInitialize()
		{
			harmony.PatchAll((Type)(object)typeof(SaveSlotControllerPatch));
		}

		virtual FSharpResult<Unit, LoadError> Listener.Initialize()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return GameInitializationEvent.attempt(((BaseUnityPlugin)this).Info, (FSharpFunc<Unit, Unit>)new $SkipIntro.BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@40(this));
		}
	}
}
namespace <StartupCode$SkipIntro2>
{
	internal static class $SkipIntro
	{
		[Serializable]
		internal sealed class BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@40 : FSharpFunc<Unit, Unit>
		{
			public SkipIntroPlugin @this;

			[CompilerGenerated]
			[DebuggerNonUserCode]
			internal BaboonAPI-Hooks-Initializer-GameInitializationEvent-Listener-Initialize@40(SkipIntroPlugin @this)
			{
				this.@this = @this;
			}

			public override Unit Invoke(Unit unitVar)
			{
				this.@this.harmony.PatchAll((Type)(object)typeof(SaveSlotControllerPatch));
				return null;
			}
		}
	}
	internal static class $Patches
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		[CompilerGenerated]
		[DebuggerNonUserCode]
		internal static int init@;

		static $Patches()
		{
			SaveSlotControllerPatch.saveIndex@ = 0;
			SaveSlotControllerPatch.init@17 = 1;
		}
	}
}
namespace <StartupCode$SkipIntro2>.$SkipIntro2
{
	internal static class AssemblyInfo
	{
	}
}
namespace <StartupCode$SkipIntro2>.$.NETFramework,Version=v4.7.2
{
	internal static class AssemblyAttributes
	{
	}
}