Decompiled source of AutoSkipCredits v1.0.2

AutoSkipCredits.dll

Decompiled 3 months 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.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.GameOver;
using On.EntityStates.GameOver;
using RiskOfOptions;
using RiskOfOptions.Options;
using UnityEngine.Networking;

[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("AutoSkipCredits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b96aea91486d48262e5f97b9bd1e5a3d9e75fb30")]
[assembly: AssemblyProduct("AutoSkipCredits")]
[assembly: AssemblyTitle("AutoSkipCredits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AutoSkipCredits
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.AutoSkipCredits", "AutoSkipCredits", "1.0.1")]
	public class AutoSkipCredits : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__2_0;

			public static hook_FixedUpdate <>9__2_1;

			public static hook_FixedUpdate <>9__2_2;

			internal void <Awake>b__2_0(orig_OnEnter orig, ShowCredits self)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Expected O, but got Unknown
				orig.Invoke(self);
				if (NetworkServer.active && skipCredits.Value)
				{
					((EntityState)self).outer.SetNextState((EntityState)new ShowReport());
				}
			}

			internal void <Awake>b__2_1(orig_FixedUpdate orig, RoR2MainEndingPlayCutscene self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && skipOutro.Value)
				{
					((EntityState)self).outer.SetNextStateToMain();
				}
			}

			internal void <Awake>b__2_2(orig_FixedUpdate orig, VoidEndingPlayCutscene self)
			{
				orig.Invoke(self);
				if (NetworkServer.active && skipOutro.Value)
				{
					((EntityState)self).outer.SetNextStateToMain();
				}
			}
		}

		public static ConfigEntry<bool> skipCredits;

		public static ConfigEntry<bool> skipOutro;

		public void Awake()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			skipCredits = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Skip Credits", true, "Skip the ending credits.");
			skipOutro = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Skip Outro", false, "Skip the ending cutscene.");
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				RiskOfOptionsSupport();
			}
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, ShowCredits self)
				{
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Expected O, but got Unknown
					orig.Invoke(self);
					if (NetworkServer.active && skipCredits.Value)
					{
						((EntityState)self).outer.SetNextState((EntityState)new ShowReport());
					}
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			ShowCredits.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>c.<>9__2_1;
			if (obj2 == null)
			{
				hook_FixedUpdate val2 = delegate(orig_FixedUpdate orig, RoR2MainEndingPlayCutscene self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && skipOutro.Value)
					{
						((EntityState)self).outer.SetNextStateToMain();
					}
				};
				<>c.<>9__2_1 = val2;
				obj2 = (object)val2;
			}
			RoR2MainEndingPlayCutscene.FixedUpdate += (hook_FixedUpdate)obj2;
			object obj3 = <>c.<>9__2_2;
			if (obj3 == null)
			{
				hook_FixedUpdate val3 = delegate(orig_FixedUpdate orig, VoidEndingPlayCutscene self)
				{
					orig.Invoke(self);
					if (NetworkServer.active && skipOutro.Value)
					{
						((EntityState)self).outer.SetNextStateToMain();
					}
				};
				<>c.<>9__2_2 = val3;
				obj3 = (object)val3;
			}
			VoidEndingPlayCutscene.FixedUpdate += (hook_FixedUpdate)obj3;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void RiskOfOptionsSupport()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(skipCredits));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(skipOutro));
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}