QoL.dll

Decompiled a week 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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GlobalEnums;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using InControl;
using Microsoft.CodeAnalysis;
using QoL.FSMEdits;
using Silksong.FsmUtil;
using TMProOld;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("QoL")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("3.0.2.0")]
[assembly: AssemblyInformationalVersion("3.0.2+0eec0078f65155719996eb6efa7a1b5a6aacb80d")]
[assembly: AssemblyProduct("QoL")]
[assembly: AssemblyTitle("QoL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.2.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 static class Configs
	{
		public static ConfigEntry<bool> FleaTracked { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		internal static void Bind(ConfigFile config)
		{
			FleaTracked = config.Bind<bool>("Tracker Settings", "Count Fleas", false, "Counts saved fleas.");
			FasterBellwayTravel = config.Bind<bool>("Bellway Settings", "Faster Bellway Travel Animation", true, "Speeds up arrival and departure animations for Bellway travel.");
			FasterBellwayBuy = config.Bind<bool>("Bellway Settings", "Faster Bellway Purchase", true, "Speeds up the animation when buying Bellway stations and calls the Bell Beast afterwards.");
			NoBellBeastSleep = config.Bind<bool>("Bellway Settings", "BellBeast Always Awake", true, "Keeps the Bell Beast always awake.");
			BellBeastFreeWill = config.Bind<bool>("Bellway Settings", "BellBeast Has Free Will", false, "Makes the Bell Beast always ready at your location.");
			FasterBeastlingCall = config.Bind<bool>("Bellway Settings", "Faster Beastling Call", true, "Speeds up Beastling call performance and travel.");
			SkipBeastlingCallPerformance = config.Bind<bool>("Bellway Settings", "Skip Beastling Call Performance", false, "Skips the Beastling call performance entirely.");
			FasterVentricaTravel = config.Bind<bool>("Ventrica Settings", "Faster Ventrica Travel Animation", true, "Speeds up arrival and departure animations for Ventrica travel.");
			FasterVentricaBuy = config.Bind<bool>("Ventrica Settings", "Faster Ventrica Purchase", true, "Speeds up the animation when buying Ventrica stations.");
			FasterNPC = config.Bind<bool>("NPC Settings", "Faster NPC", true, "Removes some introductory dialogue for NPCs.");
			FasterBossLoad = config.Bind<bool>("NPC Settings", "Faster Boss Start", false, "Removes first-time events for bosses.");
			OldFloat = config.Bind<bool>("Old Patch Settings", "Drifters Cloak Override", false, "Re-adds float override input (Down + Jump).");
			CloaklessClawline = config.Bind<bool>("Old Patch Settings", "Cloakless Clawline", false, "Wall requiring the Drifter's Cloak in Underworks is now clingable.");
			OldVoltVessels = config.Bind<bool>("Old Patch Settings", "Old Volt Vessels", false, "Allows Volt Vessels to be pogoed with tools and break the one-way floor in the Putrified Ducts.");
			BeastBoosts = config.Bind<bool>("Old Patch Settings", "Beast Boosts", false, "The Beast's Crest Needle Art occasionally grants extra height.");
			OldScuttlebrace = config.Bind<bool>("Old Patch Settings", "Old Scuttlebrace", false, "Scuttlebrace Allows wall-jumping off unclingable walls.");
			OldMist = config.Bind<bool>("Old Patch Settings", "Old Mist", false, "Enables room juggling in the Mist.");
			TrobbioSkip = config.Bind<bool>("Old Patch Settings", "Trobbio Skip", false, "Allows tools to hit the slide platforms in the Whispering Vaults.");
			SkipCutscene = config.Bind<bool>("Cutscene Settings", "Skip Cutscenes Faster", true, "Skips cutscenes faster.");
			SkipDreamCutscene = config.Bind<bool>("Cutscene Settings", "Skip Dream Cutscenes", true, "Skips dream cutscenes (Needolin & First Sinner).");
			SkipDreamCutsceneFully = config.Bind<bool>("Cutscene Settings", "Fully Skip Dream Scenes", false, "Skips dream scenes entirely.");
			SkipTutorialToolMsg = config.Bind<bool>("Cutscene Settings", "Skip Tool Pickup Tutorial", true, "Skips the first tool pickup tutorial.");
			SkipWeakness = config.Bind<bool>("Cutscene Settings", "Skip Weakness", true, "Removes weakness scenes in Moss Grotto and the Cradle.");
			InstantLevers = config.Bind<bool>("Fast Settings", "Instant Levers", true, "Removes the delay when hitting a lever.");
			InstantText = config.Bind<bool>("Fast Settings", "Instant Text", true, "Makes text scroll speed and popup speed instant.");
			FasterLifts = config.Bind<bool>("Fast Settings", "Faster Lifts", true, "Makes lifts faster.");
			FastUI = config.Bind<bool>("Fast Settings", "Fast Menu", true, "Removes the menu fade delay.");
			SlowerOptions = config.Bind<bool>("Fast Settings", "Soften Fast Settings", false, "Makes some Fast Settings less extreme.");
		}
	}
	public static class ModCompatibility
	{
		public const string ModMenuGuid = "org.silksong-modding.modmenu";

		public const string SupportedModMenuVersion = "0.2.0";

		private static Type FactoryType;

		private static Type BuilderType;

		private static Type TextButtonType;

		private static Type MenuNavType;

		public static void Init()
		{
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			if (Chainloader.PluginInfos.TryGetValue("org.silksong-modding.modmenu", out var value) && !(value.Metadata.Version > Version.Parse("0.2.0")))
			{
				Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(((object)value.Instance).GetType().Assembly);
				BuilderType = typesFromAssembly.First((Type t) => t.Name == "PaginatedMenuScreenBuilder");
				TextButtonType = typesFromAssembly.First((Type t) => t.Name == "TextButton");
				MenuNavType = typesFromAssembly.First((Type t) => t.Name == "MenuScreenNavigation");
				FactoryType = typesFromAssembly.First((Type t) => t.Name == "ConfigEntryFactory");
				MethodInfo methodInfo = AccessTools.Method(FactoryType, "GenerateEntryButton", (Type[])null, (Type[])null);
				MethodInfo methodInfo2 = AccessTools.Method(typesFromAssembly.First((Type t) => t.Name == "StringUtil"), "UnCamelCase", (Type[])null, (Type[])null);
				Harmony val = new Harmony("vitaxses.qol.modmenu.patch");
				val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(ModCompatibility), "Postfix_UnCamelCase", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				val.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ModCompatibility).GetMethod("Prefix_GenerateEntryButton")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static void Postfix_UnCamelCase(ref string __result)
		{
			if (__result == "Qo L")
			{
				__result = "QoL";
			}
		}

		public static bool Prefix_GenerateEntryButton(object __instance, string name, BaseUnityPlugin plugin, ref object selectableElement, ref bool __result)
		{
			if (plugin.Info.Metadata.GUID != "io.github.vitaxses.qol")
			{
				return true;
			}
			List<IGrouping<string, KeyValuePair<ConfigDefinition, ConfigEntryBase>>> list = (from e in (IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)plugin.Config
				group e by e.Value.Definition.Section into g
				where g.Any()
				select g).ToList();
			object obj = Activator.CreateInstance(BuilderType, name, 8);
			foreach (IGrouping<string, KeyValuePair<ConfigDefinition, ConfigEntryBase>> item in list)
			{
				object obj2 = Activator.CreateInstance(BuilderType, item.Key, 8);
				foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item2 in item)
				{
					object[] array = new object[2] { item2.Value, null };
					if ((bool)AccessTools.Method(FactoryType, "GenerateMenuElement", (Type[])null, (Type[])null).Invoke(__instance, array))
					{
						BuilderType.GetMethod("Add").Invoke(obj2, new object[1] { array[1] });
					}
				}
				object sectionMenu = BuilderType.GetMethod("Build").Invoke(obj2, null);
				object obj3 = Activator.CreateInstance(TextButtonType, item.Key);
				TextButtonType.GetField("OnSubmit").SetValue(obj3, (Action)delegate
				{
					MenuNavType.GetMethod("Show").Invoke(null, new object[2] { sectionMenu, 0 });
				});
				BuilderType.GetMethod("Add").Invoke(obj, new object[1] { obj3 });
			}
			object rootMenu = BuilderType.GetMethod("Build").Invoke(obj, null);
			object obj4 = Activator.CreateInstance(TextButtonType, name);
			TextButtonType.GetField("OnSubmit").SetValue(obj4, (Action)delegate
			{
				MenuNavType.GetMethod("Show").Invoke(null, new object[2] { rootMenu, 0 });
			});
			selectableElement = obj4;
			__result = true;
			return false;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("io.github.vitaxses.qol", "QoL", "3.0.2")]
	public sealed class QoLPlugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("io.github.vitaxses.qol");

		public const string Id = "io.github.vitaxses.qol";

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "QoL";

		public static string Version => "3.0.2";

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Configs.Bind(((BaseUnityPlugin)this).Config);
			harmony.PatchAll();
			ModCompatibility.Init();
			Logger.LogInfo((object)("Plugin " + Name + " (io.github.vitaxses.qol) v" + Version + " has loaded!"));
		}
	}
}
namespace QoL.Patches
{
	[HarmonyPatch(typeof(Lever), "Start")]
	internal static class LeverPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(Lever __instance)
		{
			if (Configs.InstantLevers.Value)
			{
				__instance.openGateDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(Lever_tk2d), "Start")]
	internal static class Lever_tk2dPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(Lever_tk2d __instance)
		{
			if (Configs.InstantLevers.Value)
			{
				__instance.openGateDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(PressurePlateBase), "Awake")]
	internal static class PressurePlateBasePatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(PressurePlateBase __instance)
		{
			if (Configs.InstantLevers.Value)
			{
				__instance.gateOpenDelay = (__instance.waitTime = (__instance.dropTime = 0f));
			}
		}
	}
	[HarmonyPatch(typeof(DialDoorBridge), "Start")]
	internal static class DialDoorBridgePatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(DialDoorBridge __instance)
		{
			if (Configs.InstantLevers.Value)
			{
				__instance.doorOpenDelay = (__instance.moveDelay = 0f);
				__instance.moveDuration = (Configs.SlowerOptions.Value ? 1f : 0f);
			}
		}
	}
	[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
	internal static class PlayMakerFSMPatch
	{
		private static readonly Action<PlayMakerFSM>[] edits = new Action<PlayMakerFSM>[25]
		{
			FsmFasterBoss.FasterBoss,
			FasterNpc.FasterNPC,
			Bellway.BellBeast,
			Bellway.Toll,
			Ventrica.Tube,
			Ventrica.Toll,
			FsmLiftControl.Lift,
			BeastlingCall.SilkSpecials,
			BeastlingCall.Beastlings,
			BeastlingCall.Needolin,
			FsmCutscene.LastDive,
			FsmCutscene.Lace2,
			FsmCutscene.FleaTravel,
			FsmCutscene.ShermaAct3Intro,
			FsmCutscene.DivingBell,
			DreamCutscene.Widow,
			DreamCutscene.FirstSinner,
			DreamCutscene.MemoryThread,
			DreamCutscene.SilkHeart,
			ToolPatch.VoltVessel,
			ToolPatch.Scuttlebrace,
			Abilities.NeedleStrike,
			SkipWeakness.SkipWeaknessPatch,
			FastMenu.ShopUI,
			FastMenu.QuestUIPrompt
		};

		[HarmonyPostfix]
		private static void Postfix_Start(PlayMakerFSM __instance)
		{
			Action<PlayMakerFSM>[] array = edits;
			foreach (Action<PlayMakerFSM> action in array)
			{
				try
				{
					action(__instance);
				}
				catch (Exception ex)
				{
					QoLPlugin.Logger.LogError((object)("Exception thrown when editing FSM " + __instance.FsmName + " on " + ((Object)__instance).name));
					QoLPlugin.Logger.LogError((object)ex);
				}
			}
		}
	}
}
namespace QoL.Patches.Tracker
{
	[HarmonyPatch(typeof(InventoryPaneInput), "OnEnable")]
	internal static class InventoryPaneInputPatch
	{
		private static GameObject FleaCounter;

		private static TMP_Text Counter;

		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_OnEnable()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.FleaTracked.Value)
			{
				if ((Object)(object)FleaCounter != (Object)null && FleaCounter.activeSelf)
				{
					FleaCounter.SetActive(false);
				}
				return;
			}
			if ((Object)(object)FleaCounter == (Object)null)
			{
				GameObject gameObject = ((Component)GameObject.Find("_GameCameras/HudCamera/In-game/Inventory/Inv").transform.GetChild(6)).gameObject;
				FleaCounter = Object.Instantiate<GameObject>(gameObject, gameObject.transform.GetParent(), false);
				FleaCounter.transform.localPosition = new Vector3(-8f, -15.25f, -3.3f);
				Object.DestroyImmediate((Object)(object)FleaCounter.GetComponent<SetTextMeshProGameText>());
				FleaCounter.GetComponent<TMP_Text>().text = "Saved Fleas: ";
				GameObject gameObject2 = ((Component)FleaCounter.transform.GetChild(0)).gameObject;
				((Object)gameObject2).name = "Counter";
				Counter = gameObject2.GetComponent<TMP_Text>();
				((Object)FleaCounter).name = "FleaCounter";
				FleaCounter.SetActive(true);
			}
			if (!FleaCounter.activeSelf)
			{
				FleaCounter.SetActive(true);
			}
			int num = PlayerData.instance.SavedFleasCount;
			if (PlayerData.instance.CaravanLechSaved)
			{
				num++;
			}
			if (PlayerData.instance.MetTroupeHunterWild)
			{
				num++;
			}
			if (PlayerData.instance.tamedGiantFlea)
			{
				num++;
			}
			string text = num.ToString();
			if (num >= 30)
			{
				text += " (Max)";
			}
			Counter.text = text;
		}
	}
}
namespace QoL.Patches.OldPatch
{
	[HarmonyPatch(typeof(NonSlider), "Awake")]
	internal static class CloaklessClawline
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Awake(NonSlider __instance)
		{
			//IL_001d: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)__instance).gameObject;
			if (gameObject != null && ((Object)gameObject).name == "terrain collider (15)")
			{
				Scene scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Under_17" && Configs.CloaklessClawline.Value)
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying Cloakless Clawline Wall Grab");
					((Component)__instance).transform.position = new Vector3(12.22f, 7.64f, 0f);
					Object.Destroy((Object)(object)__instance);
				}
			}
		}
	}
	[HarmonyPatch(typeof(HeroController), "CanDoubleJump")]
	internal static class OldFloat
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_CanDoubleJump(HeroController __instance, ref bool __result)
		{
			if (Configs.OldFloat.Value && __result)
			{
				__result = !((OneAxisInputControl)__instance.inputHandler.inputActions.Down).IsPressed;
			}
		}
	}
	[HarmonyPatch(typeof(MazeController), "SubscribeDoorEntered")]
	internal static class OldMist
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static bool Prefix_SubscribeDoorEntered(MazeController __instance, TransitionPoint door)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			MazeController __instance2 = __instance;
			TransitionPoint door2 = door;
			if (!Configs.OldMist.Value)
			{
				return true;
			}
			door2.OnBeforeTransition += (BeforeTransitionEvent)delegate
			{
				OnBeforeTransition(__instance2, door2);
			};
			return false;
		}

		internal static void OnBeforeTransition(MazeController controller, TransitionPoint door)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Object)door).name;
			PlayerData instance = PlayerData.instance;
			Scene scene;
			if (controller.isCapScene)
			{
				instance.PreviousMazeTargetDoor = door.entryPoint;
				scene = ((Component)door).gameObject.scene;
				instance.PreviousMazeScene = ((Scene)(ref scene)).name;
				instance.PreviousMazeDoor = name;
				return;
			}
			bool num = door.targetScene == controller.restSceneName;
			bool flag = instance.PreviousMazeTargetDoor != name;
			if (num)
			{
				instance.EnteredMazeRestScene = true;
				instance.CorrectMazeDoorsEntered = controller.neededCorrectDoors - controller.restScenePoint;
				instance.IncorrectMazeDoorsEntered = 0;
			}
			else if (flag)
			{
				if (controller.correctDoors.Contains(door))
				{
					instance.CorrectMazeDoorsEntered++;
					instance.IncorrectMazeDoorsEntered = 0;
				}
				else
				{
					instance.CorrectMazeDoorsEntered = 0;
					instance.IncorrectMazeDoorsEntered++;
					instance.EnteredMazeRestScene = false;
					if (instance.IncorrectMazeDoorsEntered >= controller.allowedIncorrectDoors && name.StartsWith("right"))
					{
						door.SetTargetScene("Dust_Maze_09_entrance");
						door.entryPoint = "left1";
					}
				}
			}
			instance.PreviousMazeTargetDoor = door.entryPoint;
			scene = ((Component)door).gameObject.scene;
			instance.PreviousMazeScene = ((Scene)(ref scene)).name;
			instance.PreviousMazeDoor = name;
		}
	}
	[HarmonyPatch(typeof(HeroDownAttack), "IsNonBounce")]
	internal static class OldVoltVesselsPogoPatch
	{
		[HarmonyPostfix]
		private static void Postfix_IsNonBounce(GameObject obj, ref bool __result)
		{
			if (!__result && Configs.OldVoltVessels.Value && ((Object)obj).name.StartsWith("Lightning Bola Ball"))
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(HitSlidePlatform), "Awake")]
	internal static class TrobbioSkip
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Awake(HitSlidePlatform __instance)
		{
			if (Configs.TrobbioSkip.Value)
			{
				TinkEffect[] tinkers = __instance.tinkers;
				for (int i = 0; i < tinkers.Length; i++)
				{
					tinkers[i].onlyReactToNail = false;
				}
			}
		}
	}
}
namespace QoL.Patches.Fast
{
	[HarmonyPatch(typeof(LiftControl), "Start")]
	internal static class LiftControlPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(LiftControl __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Scene scene = ((Component)__instance).gameObject.scene;
			string name = ((Scene)(ref scene)).name;
			if (Configs.FasterLifts.Value && !(name == "Ward_01"))
			{
				__instance.moveSpeed = 25f;
				if (name != "Library_11")
				{
					__instance.moveSpeed = (Configs.SlowerOptions.Value ? 35 : 100);
				}
				__instance.moveDelay = 0f;
				__instance.endDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(ManualLift), "Start")]
	internal static class ManualLiftPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(ManualLift __instance)
		{
			if (Configs.FasterLifts.Value)
			{
				__instance.moveSpeed = (Configs.SlowerOptions.Value ? 40 : 75);
				__instance.acceleration = 12f;
				__instance.moveDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(UIManager), "Start")]
	internal static class UIManagerPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start()
		{
			Configs.FastUI.SettingChanged += delegate
			{
				Adjust();
			};
			Adjust();
		}

		internal static void Adjust()
		{
			if (Configs.FastUI.Value)
			{
				UIManager.instance.MENU_FADE_SPEED = (Configs.SlowerOptions.Value ? 13 : 14);
			}
			else
			{
				UIManager.instance.MENU_FADE_SPEED = 3.2f;
			}
		}
	}
	[HarmonyPatch(typeof(DialogueBox), "Start")]
	internal static class DialogueBoxPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_Start(DialogueBox __instance)
		{
			if (Configs.InstantText.Value)
			{
				__instance.currentRevealSpeed = (__instance.regularRevealSpeed = (__instance.fastRevealSpeed *= 50f));
				__instance.animator.speed = (Configs.SlowerOptions.Value ? 2f : 10f);
			}
		}
	}
}
namespace QoL.Patches.Cutscene
{
	[HarmonyPatch(typeof(CreditsHelper), "Start")]
	internal static class CreditsHelperPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static void Prefix_Start(CreditsHelper __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.SkipCutscene.Value)
			{
				CutsceneHelper cutSceneHelper = __instance.cutSceneHelper;
				cutSceneHelper.startSkipLocked = false;
				__instance.startPause = (cutSceneHelper.waitBeforeFadeIn = 0f);
				cutSceneHelper.skipMode = (SkipPromptMode)1;
				cutSceneHelper.UnlockSkip();
			}
		}
	}
	[HarmonyPatch(typeof(CutsceneHelper), "Start")]
	internal static class CutsceneHelperPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static void Prefix_Start(CutsceneHelper __instance)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.SkipCutscene.Value && !(GameManager.instance.sceneName != "End_Credits_Scroll"))
			{
				__instance.startSkipLocked = false;
				__instance.waitBeforeFadeIn = 0f;
				__instance.skipMode = (SkipPromptMode)1;
				__instance.UnlockSkip();
			}
		}
	}
	[HarmonyPatch(typeof(InputHandler), "SetSkipMode")]
	internal static class InputHandlerPatch
	{
		private static readonly string[] UnskipScene = new string[14]
		{
			"Bone_East_Umbrella", "Belltown", "Room_Pinstress", "Belltown_Room_pinsmith", "Belltown_Room_doctor", "End_Credits_Scroll", "End_Credits", "Menu_Credits", "End_Game_Completion", "PermaDeath",
			"Bellway_City", "City_Lace_cutscene", "Opening_Sequence_Act3", "Belltown_Room_Spare"
		};

		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static bool Prefix_SetSkipMode(InputHandler __instance, ref SkipPromptMode newMode)
		{
			if (Configs.SkipCutscene.Value && !UnskipScene.Contains(GameManager.instance.sceneName))
			{
				newMode = (SkipPromptMode)1;
			}
			return true;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class SkippableSequencePatch
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static bool Prefix_CanSkip(SkippableSequence __instance)
		{
			if (Configs.SkipCutscene.Value)
			{
				__instance.AllowSkip();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StartManager), "Start")]
	internal static class StartManagerPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static void Prefix_Start(StartManager __instance)
		{
			if (Configs.SkipCutscene.Value)
			{
				Animator startManagerAnimator = __instance.startManagerAnimator;
				if (startManagerAnimator != null)
				{
					startManagerAnimator.speed = 1000f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(ToolItem), "Unlock")]
	internal static class SkipTutorialTool
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static void Prefix_Unlock()
		{
			if (Configs.SkipTutorialToolMsg.Value)
			{
				PlayerData instance = PlayerData.instance;
				instance.SeenToolGetPrompt = (instance.SeenToolWeaponGetPrompt = true);
			}
		}
	}
}
namespace QoL.FSMEdits
{
	internal static class Abilities
	{
		internal static void NeedleStrike(PlayMakerFSM fsm)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			PlayMakerFSM fsm2 = fsm;
			if (Configs.BeastBoosts.Value && fsm2 != null && fsm2.FsmName == "Nail Arts")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Needle Strike FSM");
				FsmState state = FsmUtil.GetState(fsm2, "Warrior2 Leap");
				FsmFloat val = FsmUtil.FindFloatVariable(fsm2, "Velocity Y");
				FsmBool wasGroundedBool = FsmUtil.GetBoolVariable(fsm2, "QoL Beast Was Grounded");
				FsmUtil.InsertAction(state, (FsmStateAction)new ConvertBoolToFloat
				{
					boolVariable = wasGroundedBool,
					floatVariable = val,
					falseValue = val,
					trueValue = FsmUtil.GetFirstActionOfType<ConvertBoolToFloat>(state).trueValue
				}, 4);
				FsmUtil.AddMethod(state, (Action<FsmStateAction>)delegate
				{
					((NamedVariable)wasGroundedBool).RawValue = (Configs.BeastBoosts.Value ? ((NamedVariable)FsmUtil.FindBoolVariable(fsm2, "Is Grounded")).RawValue : ((object)false));
				});
			}
		}
	}
	internal static class BeastlingCall
	{
		internal static void SilkSpecials(PlayMakerFSM fsm)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.FasterBeastlingCall.Value || fsm == null || !(fsm.FsmName == "Silk Specials"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsm).gameObject;
			if (gameObject != null && ((Object)gameObject).name == "Hero_Hornet(Clone)")
			{
				Scene scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "DontDestroyOnLoad")
				{
					FsmUtil.DisableActions(fsm, "Hornet Jump Antic", new int[3] { 1, 4, 5 });
					FsmUtil.DisableActions(fsm, "Hornet Jump", new int[8] { 1, 2, 3, 4, 5, 6, 7, 8 });
					FsmUtil.AddTransition(fsm, "Hornet Jump", FsmEvent.Finished.Name, "Hornet Fall");
					FsmUtil.DisableActions(fsm, "Hornet Fall", new int[5] { 0, 3, 5, 6, 7 });
					FsmUtil.AddTransition(fsm, "Hornet Fall", FsmEvent.Finished.Name, "Children Leave Fade");
					FsmUtil.GetAction<ScreenFader>(fsm, "Children Leave Fade", 6).duration = FsmFloat.op_Implicit(0.25f);
					FsmUtil.GetAction<Wait>(fsm, "Children Leave Fade", 7).time = FsmFloat.op_Implicit(0.25f);
				}
			}
		}

		internal static void Beastlings(PlayMakerFSM fsm)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			PlayMakerFSM fsm2 = fsm;
			if (!Configs.FasterBeastlingCall.Value || fsm2 == null || !(fsm2.FsmName == "bellbeast_child_teleport_arrive"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsm2).gameObject;
			if (gameObject == null || !(((Object)gameObject).name == "Bone Beast Children Teleport(Clone)"))
			{
				return;
			}
			Scene scene = gameObject.scene;
			if (((Scene)(ref scene)).name == "DontDestroyOnLoad")
			{
				FsmUtil.AddMethod(fsm2, "Init", (Action<FsmStateAction>)delegate
				{
					MirrorTk2dAnimDelayed component = ((Component)fsm2).GetComponent<MirrorTk2dAnimDelayed>();
					component.mirrorAnimator.PlayFromFrame(0);
					component.animator.PlayFromFrame(0);
					component.animator.Stop();
				});
			}
		}

		internal static void Needolin(PlayMakerFSM fsmSilkSpecials)
		{
			//IL_004b: 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)
			if ((!Configs.FasterBeastlingCall.Value && !Configs.SkipBeastlingCallPerformance.Value) || fsmSilkSpecials == null || !(fsmSilkSpecials.FsmName == "Silk Specials"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsmSilkSpecials).gameObject;
			if (gameObject != null && ((Object)gameObject).name == "Hero_Hornet(Clone)")
			{
				Scene scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "DontDestroyOnLoad")
				{
					Fsm runFsm = ((RunFSMAction)FsmUtil.GetAction<RunFSM>(fsmSilkSpecials, "Needolin Sub", 2)).runFsm;
					FsmUtil.GetAction<BoolTestDelay>(runFsm, "Needolin FT Wait", 4).delay = FsmFloat.op_Implicit(0f);
					FsmUtil.GetAction<Wait>(runFsm, "Can Fast Travel?", 1).time = FsmFloat.op_Implicit(0f);
					FsmUtil.GetAction<Wait>(runFsm, "Needolin FT Antic", 5).time = FsmFloat.op_Implicit(Configs.SkipBeastlingCallPerformance.Value ? 0f : 1.5f);
				}
			}
		}
	}
	internal static class Bellway
	{
		private static bool IsInBellwayScene(Component component)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<FastTravelLocations, string> scenes = FastTravelScenes._scenes;
			Scene scene = component.gameObject.scene;
			return scenes.ContainsValue(GameManager.InternalBaseSceneName(((Scene)(ref scene)).name));
		}

		internal static void BellBeast(PlayMakerFSM fsm)
		{
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			if (fsm == null || !(fsm.FsmName == "Interaction") || !(((Object)fsm).name == "Bone Beast NPC") || !IsInBellwayScene((Component)(object)fsm))
			{
				return;
			}
			QoLPlugin.Logger.LogDebug((object)"Modifying Bell Beast FSM");
			if (Configs.FasterBellwayTravel.Value)
			{
				FsmUtil.GetAction<Wait>(fsm, "Travel Arrive Start", 7).time = FsmFloat.op_Implicit(0f);
				FsmUtil.AddMethod(fsm, "Wait Finished Entering", (Action<FsmStateAction>)delegate
				{
					if (!HudCanvas.IsVisible)
					{
						HudCanvas instance = HudCanvas.instance;
						instance.targetFsm.SendEvent("IN");
						FSMUtility.SendEventToGameObject(((Component)instance).gameObject, "INVENTORY OPEN COMPLETE", true);
					}
				});
				FsmUtil.GetAction<ScreenFader>(fsm, "Hero Jump", 0).duration = FsmFloat.op_Implicit(0.25f);
				FsmUtil.DisableAction(fsm, "Hero Jump", 5);
				FsmUtil.ChangeTransition(fsm, "Hero Jump", FsmEvent.Finished.Name, "Time Passes");
				FsmUtil.ChangeTransition(fsm, "First Enter?", FsmEvent.Finished.Name, "Idle");
			}
			if (Configs.BellBeastFreeWill.Value)
			{
				EnumCompare actionCompareLocation = FsmUtil.GetAction<EnumCompare>(fsm, "Is Already Present?", 1);
				actionCompareLocation.notEqualEvent = actionCompareLocation.equalEvent;
				FsmUtil.InsertMethod(fsm, "First Enter?", 0, (Action<FsmStateAction>)delegate
				{
					//IL_0015: 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)
					PlayerData.instance.FastTravelNPCLocation = (FastTravelLocations)(object)actionCompareLocation.compareTo.Value;
				});
			}
			if (Configs.NoBellBeastSleep.Value)
			{
				FsmUtil.ChangeTransition(fsm, "Start State", "SLEEP", "Wake Up");
			}
			if (Configs.SkipCutscene.Value)
			{
				FsmUtil.DisableAction(fsm, "Choose Scene", 3);
				FsmUtil.ReplaceAction(fsm, "Go To Stag Cutscene", 7, (FsmStateAction)new BeginSceneTransition
				{
					sceneName = fsm.FsmVariables.GetFsmString("To Scene"),
					entryGateName = FsmString.op_Implicit("door_fastTravelExit"),
					entryDelay = FsmFloat.op_Implicit(0f),
					visualization = FsmEnum.op_Implicit((Enum)(object)(SceneLoadVisualizations)0),
					preventCameraFadeOut = true
				});
			}
			if (Configs.FasterBellwayBuy.Value)
			{
				FsmUtil.ChangeTransition(fsm, "Can Appear 2", "TRUE", "Appear Delay");
				FsmUtil.DisableAction(fsm, "Appear Delay", 5);
				FsmUtil.DisableAction(fsm, "Start Shake", 8);
			}
		}

		internal static void Toll(PlayMakerFSM fsm)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			PlayMakerFSM fsm2 = fsm;
			if (Configs.FasterBellwayBuy.Value && fsm2 != null && fsm2.FsmName == "Unlock Behaviour" && ((Object)fsm2).name == "Bellway Toll Machine" && IsInBellwayScene((Component)(object)fsm2))
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Bellway Toll FSM");
				FsmUtil.DisableAction(fsm2, "Return Control", 5);
				FsmUtil.AddAction(fsm2, "Return Control", (FsmStateAction)new SetAnimator
				{
					target = new FsmOwnerDefault(),
					active = FsmBool.op_Implicit(true)
				});
				FsmUtil.AddMethod(fsm2, "Return Control", (Action<FsmStateAction>)delegate
				{
					((Component)fsm2).GetComponent<Animator>().speed = 20f;
				});
				FsmUtil.DisableAction(fsm2, "Sequence Strum", 0);
				FsmUtil.DisableAction(fsm2, "Stop", 1);
				FsmUtil.DisableActions(fsm2, "Open Floor", new int[2] { 3, 5 });
				FsmUtil.GetAction<CallMethodProper>(fsm2, "Open Floor", 0).gameObject.GameObject.Value.GetComponent<Animator>().speed = 10f;
			}
		}
	}
	internal static class FsmCutscene
	{
		internal static void LastDive(PlayMakerFSM fsm)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.SkipCutscene.Value || fsm == null || !(fsm.FsmName == "Dive Cutscene"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsm).gameObject;
			if (gameObject != null && ((Object)gameObject).name == "Abyss Dive Cutscene")
			{
				Scene scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Abyss_05")
				{
					FsmUtil.DisableAction(fsm, "Preload Scene", 3);
					BeginSceneTransition action = FsmUtil.GetAction<BeginSceneTransition>(fsm, "Dive End", 9);
					action.sceneName = FsmString.op_Implicit("Abyss_Cocoon");
					action.entryGateName = FsmString.op_Implicit("door_entry");
				}
			}
		}

		internal static void Lace2(PlayMakerFSM fsm)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			if (!Configs.SkipCutscene.Value)
			{
				return;
			}
			if (fsm != null && ((Object)fsm).name == "door_cutsceneEndLaceTower" && fsm.FsmName == "Travel Control")
			{
				FsmState state = FsmUtil.GetState(fsm, "Lift Arrive?");
				FsmState state2 = FsmUtil.GetState(fsm, "Lift Already Here");
				PlayerDataBoolTest firstActionOfType = FsmUtil.GetFirstActionOfType<PlayerDataBoolTest>(state);
				firstActionOfType.isTrue = firstActionOfType.isFalse;
				FsmUtil.ChangeTransition(fsm, state.Name, "FALSE", state2.Name);
				if (PlayerData.instance.encounteredLaceTower)
				{
					FsmUtil.GetFirstActionOfType<SendEventToRegister>(state2).eventName = FsmString.op_Implicit("BATTLE START REFIGHT");
				}
				FsmUtil.ChangeTransition(fsm, "Lift Active", "INTERACT", "Transition");
				FsmState state3 = FsmUtil.GetState(fsm, "Transition");
				FsmUtil.InsertAction(state3, 0, (FsmStateAction)new ToolsCutsceneControl
				{
					SetInCutscene = FsmBool.op_Implicit(true)
				});
				FsmUtil.GetFirstActionOfType<BeginSceneTransition>(state3).preventCameraFadeOut = true;
			}
			else
			{
				if (fsm == null || !(fsm.FsmName == "Sequence") || !(((Object)fsm).name == "Boss Scene"))
				{
					return;
				}
				GameObject gameObject = ((Component)fsm).gameObject;
				if (gameObject != null)
				{
					Scene scene = gameObject.scene;
					if (((Scene)(ref scene)).name == "Cog_Dancers")
					{
						FsmUtil.ChangeTransition(fsm, "Idle Unlocked", "LIFT INSPECTED", "Travel Instant");
						FsmState state4 = FsmUtil.GetState(fsm, "Travel Instant");
						FsmUtil.InsertAction(state4, 0, (FsmStateAction)new ToolsCutsceneControl
						{
							SetInCutscene = FsmBool.op_Implicit(true)
						});
						FsmUtil.GetFirstActionOfType<ScreenFader>(state4).duration = FsmFloat.op_Implicit(0.2f);
						FsmUtil.ChangeTransition(fsm, "Door Entry", "TRUE", "Hero Exited");
						FsmState state5 = FsmUtil.GetState(fsm, "Hero Exited");
						((FsmStateAction)FsmUtil.GetFirstActionOfType<Tk2dPlayAnimationWait>(state5)).Enabled = false;
						FsmUtil.AddAction(state5, (FsmStateAction)new AnimatorPlay
						{
							gameObject = FsmUtil.GetFirstActionOfType<AnimatorPlay>(FsmUtil.GetState(fsm, "Move Down")).gameObject,
							stateName = FsmString.op_Implicit("Open"),
							layer = FsmInt.op_Implicit(0),
							normalizedTime = FsmFloat.op_Implicit(3f)
						});
					}
				}
			}
		}

		internal static void FleaTravel(PlayMakerFSM fsm)
		{
			if (Configs.SkipCutscene.Value)
			{
				if (fsm != null && fsm.FsmName == "Quest End Sequence" && ((Object)fsm).name == "Caravan")
				{
					FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Fade Down")).time = FsmFloat.op_Implicit(1.5f);
					FsmState state = FsmUtil.GetState(fsm, "Sound With");
					((FsmStateAction)FsmUtil.GetFirstActionOfType<StartPreloadingScene>(state)).Enabled = false;
					((FsmStateAction)FsmUtil.GetFirstActionOfType<PlayAudioEvent>(state)).Enabled = false;
					FsmUtil.GetFirstActionOfType<Wait>(state).time = FsmFloat.op_Implicit(1.5f);
					FsmState state2 = FsmUtil.GetState(fsm, "Sound Without");
					((FsmStateAction)FsmUtil.GetFirstActionOfType<PlayAudioEvent>(state2)).Enabled = false;
					FsmUtil.GetFirstActionOfType<Wait>(state2).time = FsmFloat.op_Implicit(1.5f);
				}
				else if (fsm != null && fsm.FsmName == "Cutscene Control" && ((Object)fsm).name == "_SceneManager")
				{
					FsmState state3 = FsmUtil.GetState(fsm, "Wait");
					FsmUtil.GetLastActionOfType<Wait>(state3).time = FsmFloat.op_Implicit(3f);
					FsmUtil.GetFirstActionOfType<Wait>(state3).time = FsmFloat.op_Implicit(0.5f);
					FsmUtil.GetFirstActionOfType<ScreenFader>(state3).duration = FsmFloat.op_Implicit(0.5f);
					FsmState state4 = FsmUtil.GetState(fsm, "Fade Out");
					FsmUtil.GetFirstActionOfType<Wait>(state4).time = FsmFloat.op_Implicit(0.3f);
					FsmUtil.GetFirstActionOfType<ScreenFader>(state4).duration = FsmFloat.op_Implicit(0.3f);
					((FsmStateAction)FsmUtil.GetFirstActionOfType<PlayAudioEvent>(state4)).Enabled = false;
					((FsmStateAction)FsmUtil.GetLastActionOfType<Wait>(state4)).Enabled = false;
				}
			}
		}

		internal static void ShermaAct3Intro(PlayMakerFSM fsm)
		{
			if (Configs.SkipCutscene.Value && fsm != null && fsm.FsmName == "Cutscene Control" && ((Object)fsm).name == "door_act3_wakeUp")
			{
				FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Fade Pause"));
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Sherma Start")).time = FsmFloat.op_Implicit(1.5f);
				FsmState state = FsmUtil.GetState(fsm, "Fade In");
				FsmUtil.GetFirstActionOfType<ScreenFader>(state).duration = FsmFloat.op_Implicit(2.5f);
				FsmUtil.GetFirstActionOfType<CameraBlurPlaneFade>(state).Duration = FsmFloat.op_Implicit(2f);
				FsmUtil.GetFirstActionOfType<Wait>(state).time = FsmFloat.op_Implicit(4f);
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Get Up")).time = FsmFloat.op_Implicit(0.5f);
			}
		}

		internal static void DivingBell(PlayMakerFSM fsm)
		{
			//IL_004b: 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)
			if (!Configs.SkipCutscene.Value)
			{
				return;
			}
			if (fsm != null && fsm.FsmName == "Dialogue" && ((Object)fsm).name == "Wake Up Scene")
			{
				GameObject gameObject = ((Component)fsm).gameObject;
				if (gameObject != null)
				{
					Scene scene = gameObject.scene;
					if (((Scene)(ref scene)).name == "Room_Diving_Bell_Abyss")
					{
						FsmUtil.ChangeTransition(fsm, "Wait", FsmEvent.Finished.Name, "Fade Up");
						FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Wait")).time = FsmFloat.op_Implicit(1f);
						FsmState state = FsmUtil.GetState(fsm, "Fade Up");
						FsmUtil.GetFirstActionOfType<ScreenFaderAlpha>(state).Duration = FsmFloat.op_Implicit(1f);
						FsmUtil.GetFirstActionOfType<Wait>(state).time = FsmFloat.op_Implicit(1.5f);
						FsmUtil.ChangeTransition(fsm, "Fade Up", FsmEvent.Finished.Name, "Get Up");
						FsmUtil.AddMethod(FsmUtil.GetState(fsm, "Get Up"), (Action<FsmStateAction>)delegate
						{
							HeroController.instance.RegainControl();
						});
					}
				}
			}
			if (fsm != null && fsm.FsmName == "Sequence" && ((Object)fsm).name == "Travel Sequence Control")
			{
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Depressed")).time = FsmFloat.op_Implicit(0.5f);
				FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Hornet Grab"));
				FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Descend Sequence Fixed"));
				FsmState state2 = FsmUtil.GetState(fsm, "Fade To Black");
				FsmUtil.DisableActionsOfType<Wait>(state2);
				Wait lastActionOfType = FsmUtil.GetLastActionOfType<Wait>(state2);
				lastActionOfType.time = FsmFloat.op_Implicit(1.5f);
				((FsmStateAction)lastActionOfType).Enabled = true;
				FsmState state3 = FsmUtil.GetState(fsm, "Cut To Cinematic");
				FsmUtil.GetFirstActionOfType<ScreenFader>(state3).duration = (FsmUtil.GetFirstActionOfType<Wait>(state3).time = FsmFloat.op_Implicit(1f));
				FsmUtil.GetLastActionOfType<Wait>(state3).time = FsmFloat.op_Implicit(1.5f);
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Fade To End")).time = FsmFloat.op_Implicit(1.5f);
				FsmState state4 = FsmUtil.GetState(fsm, "Fade Up");
				FsmUtil.DisableActionsOfType<Wait>(state4);
				Wait lastActionOfType2 = FsmUtil.GetLastActionOfType<Wait>(state4);
				lastActionOfType2.time = FsmFloat.op_Implicit(0.5f);
				((FsmStateAction)lastActionOfType2).Enabled = true;
			}
		}
	}
	internal static class DreamCutscene
	{
		internal static void Widow(PlayMakerFSM fsm)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if (!Configs.SkipDreamCutscene.Value)
			{
				return;
			}
			Scene scene;
			if (fsm != null && fsm.FsmName == "Control" && ((Object)fsm).name == "Spinner Boss")
			{
				PlayerData instance = PlayerData.instance;
				if (!Configs.SkipDreamCutsceneFully.Value || !instance.hasWalljump || (!instance.hasDash && !instance.hasHarpoonDash && !instance.hasBrolly && !instance.hasDoubleJump))
				{
					return;
				}
				BeginSceneTransition firstActionOfType = FsmUtil.GetFirstActionOfType<BeginSceneTransition>(FsmUtil.GetState(fsm, "To Memory Scene"));
				scene = ((Component)fsm).gameObject.scene;
				firstActionOfType.sceneName = FsmString.op_Implicit(((Scene)(ref scene)).name);
			}
			scene = ((Component)fsm).gameObject.scene;
			if (!(((Scene)(ref scene)).name != "Memory_Needolin"))
			{
				if (fsm != null && fsm.FsmName == "Memory Control")
				{
					FsmUtil.ChangeTransition(fsm, "End Pause", FsmEvent.Finished.Name, "Wait");
				}
				MemorySkipCutscene(fsm);
			}
		}

		internal static void FirstSinner(PlayMakerFSM fsm)
		{
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			PlayMakerFSM fsm2 = fsm;
			if (!Configs.SkipDreamCutscene.Value)
			{
				return;
			}
			Scene scene;
			if (fsm2 != null && fsm2.FsmName == "Inspection" && ((Object)fsm2).name == "Shrine First Weaver NPC")
			{
				PlayerData instance = PlayerData.instance;
				if (!Configs.SkipDreamCutsceneFully.Value || !instance.hasWalljump || !instance.hasDoubleJump || !instance.hasHarpoonDash)
				{
					return;
				}
				FsmState state = FsmUtil.GetState(fsm2, "To First Sinner Memory");
				BeginSceneTransition firstActionOfType = FsmUtil.GetFirstActionOfType<BeginSceneTransition>(state);
				scene = ((Component)fsm2).gameObject.scene;
				firstActionOfType.sceneName = FsmString.op_Implicit(((Scene)(ref scene)).name);
				FsmUtil.GetFirstActionOfType<Wait>(state).time = FsmFloat.op_Implicit(1.5f);
				FsmUtil.InsertMethod(state, (Action<FsmStateAction>)delegate
				{
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: Expected O, but got Unknown
					PlayerData.instance.hasSilkBomb = (PlayerData.instance.defeatedFirstWeaver = true);
					ToolItemManager.AutoEquip((ToolItem)fsm2.Fsm.Variables.FindFsmObject("Equip Tool").Value);
				}, 1);
				SpawnSkillGetMsg firstActionOfType2 = FsmUtil.GetFirstActionOfType<SpawnSkillGetMsg>(FsmUtil.GetState(fsm2, "Skill Msg"));
				FsmUtil.InsertAction(state, (FsmStateAction)new SpawnSkillGetMsg
				{
					MsgPrefab = firstActionOfType2.MsgPrefab,
					Skill = firstActionOfType2.Skill
				}, 2);
			}
			scene = ((Component)fsm2).gameObject.scene;
			if (!(((Scene)(ref scene)).name != "Memory_First_Sinner"))
			{
				if (fsm2 != null && fsm2.FsmName == "Memory Control")
				{
					FsmUtil.ChangeTransition(fsm2, "End Pause", FsmEvent.Finished.Name, "Get Rune Bomb");
				}
				MemorySkipCutscene(fsm2);
			}
		}

		internal static void MemorySkipCutscene(PlayMakerFSM fsm)
		{
			if (fsm != null && fsm.FsmName == "Control" && ((Object)fsm).name == "memory_orb_inspect")
			{
				FsmUtil.ChangeTransition(fsm, "Fade To Black", FsmEvent.Finished.Name, "End Memory");
			}
		}

		internal static void MemoryThread(PlayMakerFSM fsm)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			if (Configs.SkipDreamCutscene.Value)
			{
				if (fsm != null && fsm.FsmName == "FSM" && ((Object)fsm).name == "thread_memory")
				{
					FsmUtil.ChangeTransition(fsm, "Burst? Hold.", "TRUE", "Deep Memory Enter Fall");
					FsmState state = FsmUtil.GetState(fsm, "Collapse");
					FsmUtil.AddAction(state, (FsmStateAction)new Wait
					{
						time = FsmFloat.op_Implicit(0.7f)
					});
					FsmUtil.DisableActionsOfType<ListenForAnimationEvent>(state);
				}
				else if (fsm != null && fsm.FsmName == "To Memory" && ((Object)fsm).name == "Memory Group")
				{
					FsmUtil.GetFirstActionOfType<ScreenFader>(FsmUtil.GetState(fsm, "Transition Scene")).duration = FsmFloat.op_Implicit(0.3f);
				}
			}
		}

		internal static void SilkHeart(PlayMakerFSM fsm)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.SkipDreamCutscene.Value)
			{
				return;
			}
			Scene scene2;
			if (fsm.FsmName == "Memory Control")
			{
				scene2 = ((Component)fsm).gameObject.scene;
				if (((Scene)(ref scene2)).name.StartsWith("Memory_Silk_Heart"))
				{
					FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "To White")).time = FsmFloat.op_Implicit(1f);
					FsmUtil.ChangeTransition(fsm, "To White", FsmEvent.Finished.Name, "To Black");
				}
			}
			if (!Configs.SkipDreamCutsceneFully.Value || fsm == null || !(fsm.FsmName == "Control") || !(((Object)fsm).name == "Silk Heart"))
			{
				return;
			}
			scene2 = ((Component)fsm).gameObject.scene;
			string scene = ((Scene)(ref scene2)).name.Replace("_boss", "");
			if (scene != "Bone_05" && scene != "Ward_02" && scene != "Song_Tower_01")
			{
				return;
			}
			FsmUtil.AddMethod(FsmUtil.GetState(fsm, "Set Data"), (Action<FsmStateAction>)delegate
			{
				switch (scene)
				{
				case "Bone_05":
					PlayerData.instance.defeatedBellBeast = (PlayerData.instance.bonebottomQuestBoardFixed = true);
					break;
				case "Ward_02":
					PlayerData.instance.wardBossDefeated = true;
					break;
				case "Song_Tower_01":
					PlayerData.instance.defeatedLaceTower = true;
					break;
				}
			});
			FsmUtil.FindStringVariable(fsm, "Memory Scene").Value = scene;
			FsmUtil.DisableActionsOfType<StringCompare>(FsmUtil.GetState(fsm, "Memory?"));
			FsmState state = FsmUtil.GetState(fsm, "Memory Scene");
			FsmUtil.ChangeTransition(fsm, "Drop To Place", FsmEvent.Finished.Name, state.Name);
			FsmUtil.DisableAction(state, 0);
			FsmUtil.GetFirstActionOfType<BeginSceneTransition>(state).entryGateName = FsmString.op_Implicit("door_cinematicEnd");
		}
	}
	public static class FsmFasterBoss
	{
		internal static void FasterBoss(PlayMakerFSM fsm)
		{
			if (Configs.FasterBossLoad.Value)
			{
				FasterLace(fsm);
				FasterGMS(fsm);
				FasterTrobbio(fsm);
				FasterWidow(fsm);
				FasterLastJudge(fsm);
				FasterUnravelled(fsm);
			}
		}

		private static void FasterUnravelled(PlayMakerFSM fsm)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			PlayMakerFSM fsm2 = fsm;
			if (fsm2 == null || !(fsm2.FsmName == "Control") || !(((Object)fsm2).name == "Boss Scene"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsm2).gameObject;
			if (gameObject == null)
			{
				return;
			}
			Scene scene = gameObject.scene;
			if (((Scene)(ref scene)).name == "Ward_02_boss")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying TheUnravelled Boss FSM");
				FsmState state = FsmUtil.GetState(fsm2, "Arena Start");
				FsmUtil.DisableAction(state, 2);
				FsmUtil.InsertMethod(state, 2, (Action<FsmStateAction>)delegate
				{
					((NamedVariable)FsmUtil.FindBoolVariable(fsm2, "Boss Encountered")).RawValue = true;
				});
				FsmUtil.GetFirstActionOfType<WaitBool>(state).time = FsmFloat.op_Implicit(1f);
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm2, "Encountered Start")).time = FsmFloat.op_Implicit(0.5f);
				FsmUtil.GetFirstActionOfType<WaitBool>(FsmUtil.GetState(fsm2, "P2 Pause")).time = FsmFloat.op_Implicit(0.5f);
				FsmUtil.GetFirstActionOfType<WaitBool>(FsmUtil.GetState(fsm2, "P2 Setup")).time = FsmFloat.op_Implicit(1f);
				FsmUtil.DisableAction(FsmUtil.GetState(fsm2, "P3 Pause"), 0);
			}
		}

		internal static void FasterLastJudge(PlayMakerFSM fsm)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (fsm.FsmName != "Control")
			{
				return;
			}
			Scene scene = ((Component)fsm).gameObject.scene;
			if (((Scene)(ref scene)).name != "Coral_Judge_Arena")
			{
				return;
			}
			if (((Object)fsm).name == "Boss Scene" && PlayerData.instance.bellShrineBellhart && PlayerData.instance.bellShrineBoneForest && PlayerData.instance.bellShrineGreymoor && PlayerData.instance.bellShrineShellwood && PlayerData.instance.bellShrineWilds)
			{
				FsmUtil.ChangeTransition(fsm, "Init", "UNENCOUNTERED", "Encountered");
				QoLPlugin.Logger.LogDebug((object)"Modifying LastJudge Boss Door FSM");
			}
			else if (((Object)fsm).name == "Last Judge")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying LastJudge Boss FSM");
				FsmUtil.AddMethod(FsmUtil.GetState(fsm, "Intro Roar"), (Action<FsmStateAction>)delegate
				{
					PlayerData.instance.encounteredLastJudge = true;
				});
			}
		}

		internal static void FasterLace(PlayMakerFSM fsm)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (fsm.FsmName != "Control")
			{
				return;
			}
			GameObject gameObject = ((Component)fsm).gameObject;
			Scene scene;
			if (gameObject != null && ((Object)gameObject).name == "Lace Boss1")
			{
				scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Bone_East_12")
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying Lace1 Boss FSM");
					FsmUtil.ChangeTransition(fsm, "Encountered?", "MEET", "Refight");
					return;
				}
			}
			gameObject = ((Component)fsm).gameObject;
			if (gameObject != null && ((Object)gameObject).name == "Intro Control")
			{
				scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Abyss_Cocoon")
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying LostLace Boss FSM");
					FsmUtil.ChangeTransition(fsm, "Check Encountered", FsmEvent.Finished.Name, "Encountered");
					return;
				}
			}
			if (fsm == null || !(((Object)fsm).name == "door_entry") || !(fsm.FsmName == "Control"))
			{
				return;
			}
			gameObject = ((Component)fsm).gameObject;
			if (gameObject != null)
			{
				scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Abyss_Cocoon")
				{
					PlayerDataBoolTest firstActionOfType = FsmUtil.GetFirstActionOfType<PlayerDataBoolTest>(FsmUtil.GetState(fsm, "Silk Darkness?"));
					firstActionOfType.isFalse = firstActionOfType.isTrue;
					PlayerDataBoolTest firstActionOfType2 = FsmUtil.GetFirstActionOfType<PlayerDataBoolTest>(FsmUtil.GetState(fsm, "Return Control"));
					firstActionOfType2.isFalse = firstActionOfType2.isTrue;
				}
			}
		}

		internal static void FasterGMS(PlayMakerFSM fsm)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (fsm == null || !(fsm.FsmName == "First Challenge") || !(((Object)fsm).name == "Intro Sequence"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsm).gameObject;
			if (gameObject != null)
			{
				Scene scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Cradle_03")
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying GMS Boss FSM");
					FsmUtil.ChangeTransition(fsm, "Challenge Cam", "CHALLENGE", "Quick Start");
				}
			}
		}

		internal static void FasterTrobbio(PlayMakerFSM fsm)
		{
			PlayMakerFSM fsm2 = fsm;
			if (fsm2 != null && fsm2.FsmName == "Control" && ((Object)fsm2).name == "Trobbio")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Trobbio Boss FSM");
				FsmUtil.ChangeTransition(fsm2, "Init", FsmEvent.Finished.Name, "Wait Refight");
				FsmUtil.DisableAction(FsmUtil.GetState(fsm2, "Start Pause"), 0);
				FsmUtil.ChangeTransition(fsm2, "Start Pause", FsmEvent.Finished.Name, "Quick Entrance 1");
			}
			else if (fsm2 != null && fsm2.FsmName == "Control" && ((Object)fsm2).name == "Tormented Trobbio")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying TormentedTrobbio Boss FSM");
				FsmUtil.ChangeTransition(fsm2, "State", "MEET", "Start Pause");
				FsmState state = FsmUtil.GetState(fsm2, "State");
				FsmUtil.DisableAction(state, 1);
				FsmUtil.InsertMethod(state, 1, (Action<FsmStateAction>)delegate
				{
					((NamedVariable)FsmUtil.FindBoolVariable(fsm2, "Encountered")).RawValue = true;
				});
				FsmUtil.GetFirstActionOfType<ConvertBoolToFloat>(FsmUtil.GetState(fsm2, "Trobbio Rise")).trueValue = FsmFloat.op_Implicit(0.2f);
				FsmUtil.GetFirstActionOfType<ConvertBoolToFloat>(FsmUtil.GetState(fsm2, "Rise End")).trueValue = FsmFloat.op_Implicit(0f);
			}
		}

		internal static void FasterWidow(PlayMakerFSM fsm)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (fsm == null || !(fsm.FsmName == "Control") || !(((Object)fsm).name == "Boss Scene"))
			{
				return;
			}
			GameObject gameObject = ((Component)fsm).gameObject;
			if (gameObject != null)
			{
				Scene scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Belltown_Shrine")
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying Widow Boss FSM");
					FsmUtil.ChangeTransition(fsm, "Check State", "UNENCOUNTERED", "State 1");
					FsmUtil.DisableAction(FsmUtil.GetState(fsm, "Spinner Look"), 2);
				}
			}
		}
	}
	internal static class FasterNpc
	{
		internal static void FasterNPC(PlayMakerFSM fsm)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.FasterNPC.Value || fsm.FsmName != "Dialogue")
			{
				return;
			}
			GameObject gameObject = ((Component)fsm).gameObject;
			Scene scene;
			if (gameObject != null && ((Object)gameObject).name == "Seamstress")
			{
				scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Bone_East_Umbrella")
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying Seamstress Dialogue");
					FsmUtil.DisableAction(FsmUtil.GetState(fsm, "DLG After Dress"), 0);
					((Component)fsm).gameObject.transform.Find("Exit Lore Wall").localPosition = new Vector3(-30f, 1.91f, 0f);
					return;
				}
			}
			gameObject = ((Component)fsm).gameObject;
			if (gameObject != null && ((Object)gameObject).name == "Enclave Caretaker FirstMeet")
			{
				scene = gameObject.scene;
				if (((Scene)(ref scene)).name == "Song_Enclave")
				{
					QoLPlugin.Logger.LogDebug((object)"Modifying Caretaker Dialogue");
					if (PlayerData.instance.bellShrineEnclave)
					{
						PlayerData.instance.metCaretaker = true;
					}
					return;
				}
			}
			if (((Object)((Component)fsm).gameObject).name == "Mapper NPC")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Shakra Dialogue");
				PlayerData.instance.metMapper = true;
			}
		}
	}
	public static class FastMenu
	{
		internal static void ShopUI(PlayMakerFSM fsm)
		{
			if (Configs.FastUI.Value && !Configs.SlowerOptions.Value)
			{
				FsmFloat val = FsmUtil.FindFloatVariable(fsm, "Fade Time");
				if (val != null)
				{
					((NamedVariable)val).RawValue = 0.1f;
				}
				if (fsm.FsmName == "ui_list_item" && (((Object)fsm).name == "No" || ((Object)fsm).name == "Yes"))
				{
					FsmUtil.GetLastActionOfType<Wait>(FsmUtil.GetState(fsm, "Chosen")).time = FsmFloat.op_Implicit(0f);
				}
				else if (fsm.FsmName == "shop_control")
				{
					FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Down"));
					FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Open"));
				}
				else if (fsm.FsmName == "Confirm Control" && ((Object)fsm).name == "UI List")
				{
					FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Particles")).time = FsmFloat.op_Implicit(0.1f);
				}
				else if (fsm.FsmName == "Shift_pos")
				{
					FsmFloat time = FsmUtil.GetFirstActionOfType<iTweenMoveTo>(FsmUtil.GetState(fsm, "Tween")).time;
					time.Value *= 0.13f;
				}
			}
		}

		internal static void QuestUIPrompt(PlayMakerFSM fsm)
		{
			if (Configs.FastUI.Value && !(fsm.FsmName != "Control") && (!(((Object)fsm).name != "Wish Granted Prompt New(Clone)") || !(((Object)fsm).name != "Wish Promised Prompt(Clone)")))
			{
				((Component)((Component)fsm).gameObject.transform.GetChild(1)).GetComponent<Animator>().speed = 2f;
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Idle")).time = FsmFloat.op_Implicit(1f);
				FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Fade Down"));
				FsmUtil.DisableActionsOfType<Wait>(FsmUtil.GetState(fsm, "Explainer Up"));
				if (((Object)fsm).name == "Wish Granted Prompt New(Clone)")
				{
					((FsmStateAction)FsmUtil.GetFirstActionOfType<ActivateGameObject>(FsmUtil.GetState(fsm, "Press"))).Enabled = false;
				}
			}
		}
	}
	internal static class FsmLiftControl
	{
		private static bool IsInLiftScene(Component component)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Scene scene = component.gameObject.scene;
			string text = GameManager.InternalBaseSceneName(((Scene)(ref scene)).name);
			switch (text)
			{
			default:
				return text == "Dock_01";
			case "Bonetown":
			case "Belltown_06":
			case "Room_Forge":
				return true;
			}
		}

		internal static void Lift(PlayMakerFSM fsm)
		{
			if (Configs.FasterLifts.Value && IsInLiftScene((Component)(object)fsm) && fsm != null && fsm.FsmName == "Lift Control")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Lift FSM");
				FsmFloat fsmFloat = fsm.Fsm.GetFsmFloat("Speed");
				if (fsmFloat != null)
				{
					((NamedVariable)fsmFloat).RawValue = (Configs.SlowerOptions.Value ? 20f : 32f);
				}
				float num = ((GameManager.instance.sceneName == "Room_Forge") ? (-30f) : (-60f));
				if (Configs.SlowerOptions.Value)
				{
					num *= 0.75f;
				}
				FsmFloat fsmFloat2 = fsm.Fsm.GetFsmFloat("Speed Down");
				if (fsmFloat2 != null)
				{
					((NamedVariable)fsmFloat2).RawValue = num;
				}
			}
		}
	}
	internal static class SkipWeakness
	{
		internal static void SkipWeaknessPatch(PlayMakerFSM fsm)
		{
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.SkipWeakness.Value)
			{
				return;
			}
			if (!PlayerData.instance.churchKeeperIntro && fsm != null && ((Object)fsm).name == "Churchkeeper Intro Scene" && fsm.FsmName == "Control")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Churchkeeper Dialogue");
				PlayerData.instance.churchKeeperIntro = true;
				FsmUtil.ChangeTransition(fsm, "Pause", FsmEvent.Finished.Name, "Set End");
			}
			else if (fsm != null && ((Object)fsm).name == "Weakness Scene" && fsm.FsmName == "Control")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Weakness Scene");
				FsmUtil.ChangeTransition(fsm, "Check PD Bool", FsmEvent.Finished.Name, "Activated");
			}
			else if (fsm != null && ((Object)fsm).name == "Weakness Cog Drop Scene" && fsm.FsmName == "Control")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Weakness Scene");
				FsmUtil.ChangeTransition(fsm, "Init", FsmEvent.Finished.Name, "Activated");
			}
			else if (fsm != null && ((Object)fsm).name == "Weakness Scene Act3 Final" && fsm.FsmName == "Control")
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Weakness Scene");
				Trigger2dEvent firstActionOfType = FsmUtil.GetFirstActionOfType<Trigger2dEvent>(FsmUtil.GetState(fsm, "Dormant"));
				Trigger2dEvent lastActionOfType = FsmUtil.GetLastActionOfType<Trigger2dEvent>(FsmUtil.GetState(fsm, "Walk R"));
				firstActionOfType.gameObject = lastActionOfType.gameObject;
				firstActionOfType.trigger = (Trigger2DType)1;
				firstActionOfType.sendEvent = lastActionOfType.sendEvent;
				firstActionOfType.storeCollider = lastActionOfType.storeCollider;
				FsmUtil.InsertAction(FsmUtil.GetState(fsm, "Weak Fall"), (FsmStateAction)new AddHeroInputBlocker
				{
					Blocker = FsmUtil.GetFirstActionOfType<AddHeroInputBlocker>(FsmUtil.GetState(fsm, "First Land")).Blocker
				}, 0);
				FsmUtil.GetFirstActionOfType<Wait>(FsmUtil.GetState(fsm, "Weak Fall Land")).time = FsmFloat.op_Implicit(0.5f);
				FsmState state = FsmUtil.GetState(fsm, "Fade Out");
				FsmUtil.GetFirstActionOfType<ScreenFader>(state).duration = FsmFloat.op_Implicit(0.6f);
				FsmUtil.GetFirstActionOfType<Wait>(state).time = FsmFloat.op_Implicit(0.6f);
				FsmUtil.ChangeTransition(fsm, "Get Up To Kneel", FsmEvent.Finished.Name, "Fade Out");
				FsmUtil.InsertAction(FsmUtil.GetState(fsm, "To Enclave Scene"), (FsmStateAction)new RemoveHeroInputBlocker
				{
					Blocker = FsmUtil.GetFirstActionOfType<RemoveHeroInputBlocker>(FsmUtil.GetState(fsm, "Release Lock")).Blocker
				}, 4);
			}
			else
			{
				if (fsm == null || !(fsm.FsmName == "Control") || !(((Object)fsm).name == "Hatch"))
				{
					return;
				}
				GameObject gameObject = ((Component)fsm).gameObject;
				if (gameObject != null)
				{
					Scene scene = gameObject.scene;
					if (((Scene)(ref scene)).name == "Song_25")
					{
						FsmUtil.GetFirstActionOfType<SetFloatValue>(FsmUtil.GetState(fsm, "Wait for Call")).floatValue = FsmFloat.op_Implicit(0.1f);
					}
				}
			}
		}
	}
	public static class ToolPatch
	{
		internal static void VoltVessel(PlayMakerFSM fsm)
		{
			if (Configs.OldVoltVessels.Value && !(fsm.FsmName != "Control") && ((Object)fsm).name.StartsWith("Lightning Bola Ball"))
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Throwable Volt Vessel Tool");
				NonBouncer val = default(NonBouncer);
				if (((Component)fsm).gameObject.TryGetComponent<NonBouncer>(ref val))
				{
					Object.Destroy((Object)(object)val);
				}
			}
		}

		internal static void Scuttlebrace(PlayMakerFSM fsm)
		{
			if (Configs.OldScuttlebrace.Value && !(fsm.FsmName != "Tool Attacks"))
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Scuttlebrace Tool");
				FsmUtil.GetFirstActionOfType<ListenForJump>(FsmUtil.GetState(fsm, "Scuttle End")).activeBool = FsmBool.op_Implicit(true);
			}
		}
	}
	internal static class Ventrica
	{
		private static bool IsInVentricaScene(Component component)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<TubeTravelLocations, string> tubeScenes = FastTravelScenes._tubeScenes;
			Scene scene = component.gameObject.scene;
			return tubeScenes.ContainsValue(GameManager.InternalBaseSceneName(((Scene)(ref scene)).name));
		}

		internal static void Tube(PlayMakerFSM fsm)
		{
			if (fsm != null && fsm.FsmName == "Tube Travel" && ((Object)fsm).name == "City Travel Tube" && IsInVentricaScene((Component)(object)fsm))
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Ventrica FSM");
				if (Configs.FasterVentricaTravel.Value)
				{
					FsmUtil.DisableAction(fsm, "Tube Start Away", 3);
					FsmUtil.GetAction<SendEventByName>(fsm, "Tube Start Away", 4).sendEvent = FsmString.op_Implicit("START OPEN");
					FsmUtil.ChangeTransition(fsm, "Start In Tube", FsmEvent.Finished.Name, "Break Items");
					FsmUtil.AddTransition(fsm, "Break Items", FsmEvent.Finished.Name, "Open");
					FsmUtil.DisableAction(fsm, "Open", 3);
					FsmUtil.AddTransition(fsm, "Open", FsmEvent.Finished.Name, "Hop Out Antic");
					FsmUtil.ChangeTransition(fsm, "Preload Scene", FsmEvent.Finished.Name, "Close");
					FsmUtil.AddTransition(fsm, "Close", FsmEvent.Finished.Name, "Save State");
					FsmUtil.GetAction<ScreenFader>(fsm, "Fade Out", 2).duration = FsmFloat.op_Implicit(0.25f);
					FsmUtil.GetAction<Wait>(fsm, "Fade Out", 3).time = FsmFloat.op_Implicit(0.25f);
				}
				if (Configs.FasterVentricaBuy.Value)
				{
					FsmUtil.GetAction<SendEventByName>(fsm, "Unlock Open", 1).sendEvent = FsmString.op_Implicit("START OPEN");
					FsmUtil.AddTransition(fsm, "Unlock Open", FsmEvent.Finished.Name, "Unlock");
				}
			}
		}

		internal static void Toll(PlayMakerFSM fsm)
		{
			PlayMakerFSM fsm2 = fsm;
			if (Configs.FasterVentricaBuy.Value && fsm2 != null && fsm2.FsmName == "Unlock Behaviour" && ((Object)fsm2).name == "tube_toll_machine" && IsInVentricaScene((Component)(object)fsm2))
			{
				QoLPlugin.Logger.LogDebug((object)"Modifying Ventrica Toll FSM");
				FsmUtil.DisableAction(fsm2, "Retract Animation", 0);
				FsmUtil.AddLambdaMethod(fsm2, "Retract Animation", (Action<Action>)delegate(Action finish)
				{
					((Component)fsm2).GetComponent<Animator>().speed = 100f;
					finish();
				});
				FsmUtil.DisableAction(fsm2, "After Retract Pause", 1);
			}
		}
	}
}