Decompiled source of CutEnding v0.1.0

SSCutEnding.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using CutEnding.Patches;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[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("SSCutEnding")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("SSCutEnding")]
[assembly: AssemblyTitle("SSCutEnding")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace CutEnding
{
	public class CallActionFsm : FsmStateAction
	{
		public Action? action;

		public CallActionFsm(Action action)
		{
			this.action = action;
		}

		public override void Reset()
		{
			action = null;
			((FsmStateAction)this).Reset();
		}

		public override void OnEnter()
		{
			action?.Invoke();
			((FsmStateAction)this).Finish();
		}
	}
	[BepInPlugin("github.vitaxses.sscutending", "SSCutEnding", "0.1.0")]
	public class SSCutEndingPlugin : BaseUnityPlugin
	{
		public const string ID = "github.vitaxses.sscutending";

		public const string Id = "github.vitaxses.sscutending";

		public static string Name => "SSCutEnding";

		public static string Version => "0.1.0";

		private void Awake()
		{
			SceneManager.sceneLoaded += SceneChangedPatch.OnSceneChanged;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (github.vitaxses.sscutending) has loaded!"));
		}
	}
}
namespace CutEnding.Patches
{
	public class SceneChangedPatch
	{
		public static void OnSceneChanged(Scene to, LoadSceneMode lsm)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			if (!((Scene)(ref to)).name.Equals("Cradle_03"))
			{
				return;
			}
			GameObject val = GameObject.Find("Boss Scene");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GameObject deathSequence = ((Component)val.transform.GetChild(11)).gameObject;
			Fsm fsm = FSMUtility.GetFSM(deathSequence).Fsm;
			FsmState state = fsm.GetState("Bind Or Needolin");
			if (state == null)
			{
				return;
			}
			FsmFloat val2 = new FsmFloat("Time")
			{
				Value = 2f
			};
			fsm.Variables.FloatVariables = CollectionExtensions.AddItem<FsmFloat>((IEnumerable<FsmFloat>)fsm.Variables.FloatVariables, val2).ToArray();
			FsmEvent val3 = new FsmEvent("FAILED_INPUT");
			fsm.Events = CollectionExtensions.AddItem<FsmEvent>((IEnumerable<FsmEvent>)fsm.Events, val3).ToArray();
			state.Actions = CollectionExtensions.AddItem<FsmStateAction>((IEnumerable<FsmStateAction>)state.Actions, (FsmStateAction)new Wait
			{
				time = val2,
				finishEvent = val3
			}).ToArray();
			FsmState state2 = fsm.GetState("Death Slashes Up E");
			if (state2 != null)
			{
				state.Transitions = CollectionExtensions.AddItem<FsmTransition>((IEnumerable<FsmTransition>)state.Transitions, new FsmTransition
				{
					FsmEvent = val3,
					ToState = state2.Name,
					ToFsmState = state2
				}).ToArray();
				state2.Actions = CollectionExtensions.AddItem<FsmStateAction>((IEnumerable<FsmStateAction>)state2.Actions, (FsmStateAction)(object)new CallActionFsm(delegate
				{
					((Component)deathSequence.transform.GetChild(0)).gameObject.SetActive(false);
				})).ToArray();
			}
		}
	}
}