Decompiled source of PulsarSkipIntro v1.1.1

BepInEx/plugins/PulsarSkipIntro.dll

Decompiled 4 hours 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 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("PulsarSkipIntro")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PulsarSkipIntro")]
[assembly: AssemblyTitle("PulsarSkipIntro")]
[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 PulsarSkipIntro
{
	[BepInPlugin("com.pulsar.skipintro", "Pulsar Skip Intro", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Pulsar Skip Intro loaded successfully.");
			new Harmony("com.pulsar.skipintro").PatchAll();
		}
	}
	[HarmonyPatch(typeof(PLIntro), "Update")]
	internal class SkipPatch
	{
		private static readonly FieldRef<PLIntro, bool> m_LevelLoadRequestMade = AccessTools.FieldRefAccess<PLIntro, bool>("LevelLoadRequestMade");

		private static readonly FieldRef<PLGlobal, bool> m_SteamCloudSyncComplete = AccessTools.FieldRefAccess<PLGlobal, bool>("InitialSteamCloudSyncComplete_AIData");

		private static bool IsSystemReady => (Object)(object)PLGlobal.Instance != (Object)null && (Object)(object)PLNetworkManager.Instance != (Object)null && (Object)(object)PLLocalize.Instance != (Object)null && (Object)(object)PLUIMainMenu.Instance != (Object)null && (Object)(object)PLUIPawnAppearanceMenu.Instance != (Object)null && PLLocalize.LanguageVersionCurrent > 0f && m_SteamCloudSyncComplete.Invoke(PLGlobal.Instance);

		private static bool Prefix(PLIntro __instance)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			if (m_LevelLoadRequestMade.Invoke(__instance))
			{
				return false;
			}
			if (!IsSystemReady)
			{
				return true;
			}
			m_LevelLoadRequestMade.Invoke(__instance) = true;
			PLGlobal.IntroFinished = true;
			if ((Object)(object)PLLoader.Instance != (Object)null)
			{
				PLLoader.Instance.LoadThis(new PLLoadRequest(PLGlobal.MainMenuLevelID));
			}
			return false;
		}
	}
}