Decompiled source of Vitax Quality of Life v1.0.0

QoL.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
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 BepInEx.Configuration;
using BepInEx.Logging;
using GlobalEnums;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using QoL.Patches;
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("QoL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0.0+87a2d8ff5fa4aa18d5a96c49d3d1f130a8278694")]
[assembly: AssemblyProduct("QoL")]
[assembly: AssemblyTitle("vitaxses.qol")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.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 QoL
{
	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();
		}
	}
	public static class Helper
	{
		[CompilerGenerated]
		private sealed class <delay>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Action action;

			public float time;

			public bool realtime;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <delay>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (realtime)
					{
						<>2__current = (object)new WaitForSeconds(time);
						<>1__state = 1;
						return true;
					}
					<>2__current = (object)new WaitForSecondsRealtime(time);
					<>1__state = 2;
					return true;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					break;
				}
				action();
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static Fsm GetFsm(this GameObject obj, string wantedFSM = "")
		{
			PlayMakerFSM[] components = obj.GetComponents<PlayMakerFSM>();
			if (Extensions.IsNullOrEmpty<PlayMakerFSM>((ICollection<PlayMakerFSM>)components))
			{
				Debug.LogWarning((object)("Getting FSM on Object (obj: " + ((Object)obj).name + " has no PlayMakerFSM component)"));
				return null;
			}
			PlayMakerFSM[] array = components;
			foreach (PlayMakerFSM val in array)
			{
				if (val.FsmName.Equals(wantedFSM, StringComparison.OrdinalIgnoreCase))
				{
					return val.Fsm;
				}
			}
			return components[0].Fsm;
		}

		public static void Delay(Action action, float time, bool realtime = false)
		{
			if (!((Object)(object)GameManager.instance == (Object)null))
			{
				((MonoBehaviour)GameManager.instance).StartCoroutine(delay(action, time, realtime));
			}
		}

		[IteratorStateMachine(typeof(<delay>d__2))]
		private static IEnumerator delay(Action action, float time, bool realtime)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <delay>d__2(0)
			{
				action = action,
				time = time,
				realtime = realtime
			};
		}

		public static GameObject SpawnPlatform(Vector3 pos, bool isDusty, GameObject reference, Vector3? size = null, float spriteAlpha = 0.7f)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(reference);
			((Object)val).name = "QOL Skip-Helper";
			Transform transform = val.transform;
			Vector3 position = (val.transform.localPosition = pos);
			transform.position = position;
			val.transform.localScale = (Vector3)(((??)size) ?? reference.transform.localScale);
			val.GetComponent<SpriteRenderer>().color = new Color(1f, 0.5f, 0.5f, spriteAlpha);
			if (isDusty)
			{
				Object.DestroyImmediate((Object)(object)val.GetComponent<DustyPlatform>());
			}
			return val;
		}
	}
	[BepInPlugin("vitaxses.qol", "QoL", "0.2.0.0")]
	public class QoLPlugin : BaseUnityPlugin
	{
		private const string ID = "vitaxses.qol";

		private Harmony harmony = new Harmony("vitaxses.qol");

		public const string Id = "vitaxses.qol";

		public static ManualLogSource Logger { get; private set; }

		public static ConfigEntry<bool> SkipWeakness { get; private set; }

		public static ConfigEntry<bool> FastMenu { get; private set; }

		public static ConfigEntry<bool> FasterLevers { get; private set; }

		public static ConfigEntry<bool> InstantText { get; private set; }

		public static ConfigEntry<bool> FastPickup { get; private set; }

		public static ConfigEntry<bool> SeePercentage { get; private set; }

		public static ConfigEntry<bool> NoCutscenes { get; private set; }

		public static ConfigEntry<bool> SkipPlatforms { get; private set; }

		public static ConfigEntry<bool> FastNPC { get; private set; }

		public static ConfigEntry<bool> OldPatch { get; private set; }

		public static ConfigEntry<bool> NoHardFalls { get; private set; }

		public static ConfigEntry<bool> NoBump { get; private set; }

		public static string Name => "QoL";

		public static string Version => "0.2.0.0";

		private void Awake()
		{
			harmony.PatchAll();
			SceneChangePatch.Setup();
			Logger = ((BaseUnityPlugin)this).Logger;
			RegisterConfiguration();
			Logger.LogInfo((object)"vitaxses.qol loaded!");
		}

		private void RegisterConfiguration()
		{
			SkipWeakness = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "SkipWeakness", true, (ConfigDescription)null);
			FastMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "FastMenu", true, (ConfigDescription)null);
			FasterLevers = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "FasterLevers", true, (ConfigDescription)null);
			InstantText = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "InstantText", true, (ConfigDescription)null);
			FastPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "FastPickup", true, (ConfigDescription)null);
			NoCutscenes = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "NoCutscenes", true, (ConfigDescription)null);
			SeePercentage = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "SeePercentage", false, (ConfigDescription)null);
			SkipPlatforms = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "SkipPlatforms", true, (ConfigDescription)null);
			FastNPC = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "FastNPC", true, (ConfigDescription)null);
			OldPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "OldPatch", true, (ConfigDescription)null);
			NoHardFalls = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "NoHardFalls", false, (ConfigDescription)null);
			NoBump = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "NoBump", false, (ConfigDescription)null);
		}
	}
}
namespace QoL.Patches
{
	[HarmonyPatch(typeof(CharacterBumpCheck), "CheckForBump")]
	internal class CharacterBumpCheckPatch
	{
		[HarmonyPrefix]
		private static bool CheckForBumpPrefix()
		{
			return !QoLPlugin.NoBump.Value;
		}
	}
	[HarmonyPatch(typeof(DialogueBox))]
	internal class DialogueBoxPatch
	{
		[HarmonyPatch(typeof(DialogueBox), "Start")]
		private static void Postfix(DialogueBox __instance)
		{
			if (QoLPlugin.InstantText.Value)
			{
				__instance.currentRevealSpeed = (__instance.regularRevealSpeed = (__instance.fastRevealSpeed *= 4f));
			}
		}
	}
	[HarmonyPatch(typeof(HeroController))]
	internal class HardLandPatch
	{
		[HarmonyPatch(typeof(HeroController), "ShouldHardLand")]
		[HarmonyPrefix]
		private static bool ShouldHardLandPrefix(ref bool __result)
		{
			if (QoLPlugin.NoHardFalls.Value)
			{
				return __result = false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(InventoryPaneInput))]
	internal class InventoryPatch
	{
		[HarmonyPatch(typeof(InventoryPaneInput), "Start")]
		[HarmonyPostfix]
		private static void StartPostfix(InventoryPaneInput __instance)
		{
			Fsm fsm = ((Component)__instance).gameObject.GetFsm("UI Inventory");
			FsmState state = fsm.GetState("Completion Rate");
			if (state != null)
			{
				FsmStateAction[] actions = state.Actions;
				FsmStateAction obj = actions[0];
				PlayerDataBoolTest val = (PlayerDataBoolTest)(object)((obj is PlayerDataBoolTest) ? obj : null);
				if (val != null)
				{
					val.boolName = FsmString.op_Implicit(PlayerDataPatch.boolName);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Lever))]
	internal class LeverPatch
	{
		[HarmonyPatch(typeof(Lever), "Start")]
		[HarmonyPostfix]
		private static void LeverStartPostfix(Lever __instance)
		{
			if (QoLPlugin.FasterLevers.Value)
			{
				__instance.openGateDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(Lever_tk2d))]
	internal class Lever_tk2dPatch
	{
		[HarmonyPatch(typeof(Lever_tk2d), "Start")]
		[HarmonyPostfix]
		private static void TK2DLeverStartPostfix(Lever_tk2d __instance)
		{
			if (QoLPlugin.FasterLevers.Value)
			{
				__instance.openGateDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(PressurePlateBase))]
	internal class PressurePlatePatch
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		private static bool GateDelayPrefix(PressurePlateBase __instance, ref float __result)
		{
			if (QoLPlugin.FasterLevers.Value)
			{
				__instance.gateOpenDelay = (__instance.waitTime = (__result = 0f));
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerData))]
	internal class PlayerDataPatch
	{
		public static string boolName = "Vitax's QOL CanSeePercentage";

		[HarmonyPatch(typeof(PlayerData), "GetBool")]
		[HarmonyPrefix]
		private static bool StartPrefix(PlayerData __instance, ref string boolName, ref bool __result)
		{
			if (boolName == PlayerDataPatch.boolName && (__instance.ConstructedFarsight || QoLPlugin.SeePercentage.Value))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	public class SceneChangePatch
	{
		public static void Setup()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private static void OnSceneLoaded(Scene scene, LoadSceneMode lsm)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)HeroController.instance == (Object)null))
			{
				FastNPC(scene);
				Helper.Delay(delegate
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_001a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					SkipWeakness(scene);
					FastPickup(scene);
					OldPatch(scene);
					CreateSkipPlatforms(scene);
				}, 0.5f);
			}
		}

		private static void OldPatch(Scene to)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!QoLPlugin.OldPatch.Value)
			{
				return;
			}
			string name = ((Scene)(ref to)).name;
			string text = name;
			if (text == "Under_17")
			{
				GameObject val = GameObject.Find("terrain collider (15)");
				if (!((Object)(object)val == (Object)null))
				{
					Transform transform = val.transform;
					Transform transform2 = val.transform;
					Vector3 val2 = default(Vector3);
					((Vector3)(ref val2))..ctor(12.25f, 7.64f, 0f);
					transform2.localPosition = val2;
					transform.position = val2;
					Object.Destroy((Object)(object)val.GetComponent<NonSlider>());
				}
			}
		}

		private static void FastNPC(Scene to)
		{
			if (QoLPlugin.FastNPC.Value && ((Scene)(ref to)).name == "Bone_04")
			{
				PlayerData.instance.metMapper = true;
			}
		}

		private static void CreateSkipPlatforms(Scene to)
		{
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			if (!QoLPlugin.SkipPlatforms.Value)
			{
				return;
			}
			string text = ((Scene)(ref to)).name.ToLower();
			switch (text)
			{
			case "bone_east_08_boss_golem":
				if (PlayerData.instance.hasDash && !PlayerData.instance.defeatedSongGolem && PlayerData.instance.hasBrolly)
				{
					Helper.SpawnPlatform(new Vector3(48.5f, 6.5f, 0f), isDusty: false, GameObject.Find("bone_plat_02"), (Vector3?)new Vector3(1.1f, 0.8f, 1f), 0.7f);
				}
				break;
			case "bone_01":
				if (!PlayerData.instance.bone01shortcutPlat)
				{
					Helper.SpawnPlatform(new Vector3(104.5f, 69.5f, -0.09f), isDusty: true, GameObject.Find("bone_plat_03 (2)"));
				}
				break;
			case "crawl_01":
				if (!PlayerData.instance.hasDash && !PlayerData.instance.hasDoubleJump)
				{
					Helper.SpawnPlatform(new Vector3(65f, 47f, -0.09f), isDusty: true, GameObject.Find("bone_plat_02"), (Vector3?)new Vector3(0.8f, 0.7f), 0.7f);
				}
				break;
			case "crawl_03b":
				if (!PlayerData.instance.hasDash && !PlayerData.instance.hasDoubleJump)
				{
					Helper.SpawnPlatform(new Vector3(17f, 10.5f, -0.09f), isDusty: true, GameObject.Find("bone_plat_03"));
				}
				break;
			case "aspid_01":
				if (!PlayerData.instance.hasDash && !PlayerData.instance.hasDoubleJump && !PlayerData.instance.hasWalljump)
				{
					Helper.SpawnPlatform(new Vector3(47f, 200f, -0.09f), isDusty: true, GameObject.Find("bone_plat_03"));
				}
				break;
			case "bellway_03":
				if (!PlayerData.instance.hasBrolly && !PlayerData.instance.hasDoubleJump && PlayerData.instance.hasWalljump && !PlayerData.instance.hasSuperJump)
				{
					Helper.SpawnPlatform(new Vector3(110f, 6f, -0.09f), isDusty: true, GameObject.Find("bone_plat_01 (2)"), (Vector3?)new Vector3(1.0325f, 0.9829f, 1.0346f), 1f);
				}
				break;
			case "peak_01":
			case "peak_07":
				if (!PlayerData.instance.hasHarpoonDash && PlayerData.instance.hasDash && !PlayerData.instance.hasDoubleJump && ((ToolItemManager.IsToolEquipped("Silk Charge") && PlayerData.instance.hasBrolly) || (ToolItemManager.IsToolEquipped("Thread Sphere") && ToolItemManager.IsToolEquipped("Flea Brew") && ToolItemManager.IsToolEquipped("Lifeblood Syringe") && PlayerData.instance.hasBrolly)))
				{
					GameObject reference = GameObject.Find("crumble_plat_peak_small (2)");
					if (text.Equals("peak_01"))
					{
						Helper.SpawnPlatform(new Vector3(36f, 62f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(20.5602f, 123f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(28.5f, 154f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(27f, 162f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(60.9638f, 283.9561f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(51.9965f, 286.0029f, 0.004f), isDusty: false, reference, null, 1f);
					}
					else
					{
						Helper.SpawnPlatform(new Vector3(32.4671f, 14f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(43.7945f, 40.2256f, 0.004f), isDusty: false, reference, null, 1f);
						Helper.SpawnPlatform(new Vector3(63.7128f, 48f, 0.004f), isDusty: false, reference, null, 1f);
					}
				}
				break;
			}
		}

		private static void FastPickup(Scene to)
		{
			if (!QoLPlugin.FastPickup.Value)
			{
				return;
			}
			switch (((Scene)(ref to)).name.ToLower())
			{
			case "mosstown_02":
			{
				Fsm fsm6 = GameObject.Find("Shrine Weaver Ability").GetFsm();
				if (fsm6 == null)
				{
					break;
				}
				FsmTransition transition5 = fsm6.GetState("Idle").GetTransition(0);
				transition5.toState = "Bind Prepare";
				transition5.toFsmState = fsm6.GetState("Bind Prepare");
				fsm6.GetState("End").Actions = CollectionExtensions.AddItem<FsmStateAction>((IEnumerable<FsmStateAction>)fsm6.GetState("End").Actions, (FsmStateAction)(object)new CallActionFsm(delegate
				{
					if (QoLPlugin.FastNPC.Value)
					{
						PlayerData.instance.SetBool("encounteredBellBeast", true);
						PlayerData.instance.SetBool("seenBellBeast", true);
					}
				})).ToArray();
				break;
			}
			case "bone_east_05":
			{
				Fsm fsm5 = GameObject.Find("Shrine Weaver Ability").GetFsm();
				if (fsm5 == null)
				{
					break;
				}
				FsmTransition transition4 = fsm5.GetState("Idle").GetTransition(0);
				transition4.toState = "Bind Prepare";
				transition4.toFsmState = fsm5.GetState("Bind Prepare");
				fsm5.GetState("End").Actions = CollectionExtensions.AddItem<FsmStateAction>((IEnumerable<FsmStateAction>)fsm5.GetState("End").Actions, (FsmStateAction)(object)new CallActionFsm(delegate
				{
					if (QoLPlugin.FastNPC.Value)
					{
						PlayerData.instance.SetBool("encounteredLace1", true);
					}
				})).ToArray();
				break;
			}
			case "shellwood_10":
			{
				Fsm fsm3 = GameObject.Find("Shrine Weaver Ability").GetFsm();
				if (fsm3 != null)
				{
					FsmTransition transition2 = fsm3.GetState("Idle").GetTransition(0);
					transition2.toState = "Bind Prepare";
					transition2.toFsmState = fsm3.GetState("Bind Prepare");
				}
				break;
			}
			case "bone_05_boss":
			{
				GameObject obj = GameObject.Find("Boss Scene");
				Fsm fsm4 = obj.GetFsm("Battle End");
				FsmState state2 = fsm4.GetState("End Pause");
				FsmTransition transition3 = fsm4.GetState("Idle").GetTransition(0);
				transition3.toState = "End Pause";
				transition3.toFsmState = state2;
				state2.Actions = CollectionExtensions.AddItem<FsmStateAction>((IEnumerable<FsmStateAction>)state2.Actions, (FsmStateAction)(object)new CallActionFsm(delegate
				{
					PlayerData.instance.SetBool("HasSeenSilkHearts", true);
					HeroController.instance.AddToMaxSilkRegen(1);
					PlayerData.instance.SetBool("UnlockedFastTravel", true);
					GameManager.instance.CheckAllAchievements();
				})).ToArray();
				break;
			}
			case "under_18":
			{
				Fsm fsm2 = GameObject.Find("Ability Scene/Shrine Weaver Ability").GetFsm();
				if (fsm2 != null)
				{
					FsmTransition transition = fsm2.GetState("Idle").GetTransition(0);
					transition.toState = "Bind Prepare";
					transition.toFsmState = fsm2.GetState("Bind Prepare");
				}
				break;
			}
			case "song_tower_01":
			{
				Transform bossScene2 = GameObject.Find("Boss Scene").transform;
				Object.Destroy((Object)(object)((Component)bossScene2.GetChild(8)).gameObject);
				Fsm fsm = ((Component)bossScene2.GetChild(6)).gameObject.GetFsm("Control");
				FsmState state = fsm.GetState("Death");
				state.Actions = CollectionExtensions.AddItem<FsmStateAction>((IEnumerable<FsmStateAction>)state.Actions, (FsmStateAction)(object)new CallActionFsm(delegate
				{
					PlayerData.instance.SetBool("HasSeenSilkHearts", true);
					HeroController.instance.AddToMaxSilkRegen(1);
					PlayerData.instance.defeatedLaceTower = true;
					GameObject.Find("State Control/song_tower_right_gate").GetFsm().SetState("Init");
					GameManager.instance.CheckAllAchievements();
					((Component)((Component)bossScene2).transform.GetChild(8)).gameObject.GetFsm().SetState("Silk Quest?");
				})).ToArray();
				break;
			}
			}
		}

		private static void SkipWeakness(Scene to)
		{
			if (!QoLPlugin.SkipWeakness.Value)
			{
				return;
			}
			string text = ((Scene)(ref to)).name.ToLower();
			bool flag = false;
			if (text.Equals("bonetown"))
			{
				flag = true;
				PlayerData.instance.completedTutorial = true;
				GameObject.Find("Churchkeeper Intro Scene").GetFsm().SetState("Set End");
			}
			if (text.Equals("tut_03") || text.Equals("tut_01"))
			{
				flag = true;
			}
			if (flag)
			{
				GameObject val = GameObject.Find("Weakness Scene");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				val.SetActive(false);
				PlayerData.instance.churchKeeperIntro = true;
			}
			if (text.Equals("cog_09_destroyed"))
			{
				GameObject val2 = GameObject.Find("Weakness Cog Drop Scene");
				if (!((Object)(object)val2 == (Object)null))
				{
					val2.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(SkippableSequence))]
	internal class SkippableSequencePatch
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		private static bool Prefix(SkippableSequence __instance, ref bool __result)
		{
			if (!QoLPlugin.NoCutscenes.Value)
			{
				return true;
			}
			__instance.AllowSkip();
			__instance.canSkip = (__result = true);
			return false;
		}
	}
	[HarmonyPatch(typeof(InputHandler), "SetSkipMode")]
	internal class InputHandlerPatch
	{
		[HarmonyPrefix]
		private static bool Prefix(InputHandler __instance, ref SkipPromptMode newMode)
		{
			string sceneName = GameManager.instance.sceneName;
			if (!QoLPlugin.NoCutscenes.Value || sceneName.Equals("End_Game_Completion") || sceneName.Equals("PermaDeath"))
			{
				return true;
			}
			if ((int)newMode == 2 && !sceneName.Equals("End_Credits") && !sceneName.Equals("Opening_Sequence") && !sceneName.Equals("Bone_East_Umbrella") && !sceneName.Equals("Cinematic_Stag_travel") && !sceneName.Equals("Opening_Sequence_Act3"))
			{
				return true;
			}
			newMode = (SkipPromptMode)(sceneName.Equals("End_Credits") ? 1 : 0);
			__instance.readyToSkipCutscene = true;
			__instance.skipCooldownTime = 0.0;
			__instance.SkipMode = newMode;
			return false;
		}
	}
	[HarmonyPatch(typeof(UIManager))]
	internal class UIManagerPatch
	{
		[HarmonyPatch(typeof(UIManager), "Start")]
		[HarmonyPostfix]
		private static void Postfix(UIManager __instance)
		{
			if (QoLPlugin.FastMenu.Value)
			{
				__instance.MENU_FADE_SPEED *= 7f;
			}
		}
	}
}