QoL.dll

Decompiled 3 days 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.FSMEdits;
using QoL.Patches;
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("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+a64d37f88be15be153b4829fa24ea8a8218d9652")]
[assembly: AssemblyProduct("QoL")]
[assembly: AssemblyTitle("QoL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 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> InstantLevers { get; private set; }

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

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

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

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

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

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

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

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

		internal static void Bind(ConfigFile config)
		{
			FleaTracked = config.Bind<bool>("Tracker Settings", "Count Fleas", true, "Counts Saved Fleas");
			FasterBellwayTravel = config.Bind<bool>("Bellway Settings", "Faster Bellway Travel Animation", true, "Speed Up Arrival And Departure Animations Of Bellway Travel");
			FasterBellwayBuy = config.Bind<bool>("Bellway Settings", "Faster Bellway Purchase", true, "Speed Up The Animation When Buying Bellway Stations And Calls Bell Beast Afterwards");
			NoBellBeastSleep = config.Bind<bool>("Bellway Settings", "BellBeast Always Awake", true, "Make The Bell Beast Be Always Awake");
			BellBeastFreeWill = config.Bind<bool>("Bellway Settings", "BellBeast Has Free Will", false, "Make Bell Beast Be Always Ready At Your Location");
			FasterBeastlingCall = config.Bind<bool>("Bellway Settings", "Faster Beastling Call", true, "Speed Up Beastling Call Performance And Travelling");
			SkipBeastlingCallPerformance = config.Bind<bool>("Bellway Settings", "Skip Beastling Call Performance", false, "Skip Beastling Call Performance Entirely");
			FasterVentricaTravel = config.Bind<bool>("Ventrica Settings", "Faster Ventrica Travel Animation", true, "Speed Up Arrival And Departure Animations Of Ventrica Travel");
			FasterVentricaBuy = config.Bind<bool>("Ventrica Settings", "Faster Ventrica Purchase", true, "Speed Up The Animation When Buying Ventrica Stations");
			FasterNPC = config.Bind<bool>("NPC Settings", "Faster Npc", true, "Removes Some Dialogue For Introduction Of An NPC");
			FasterBossLoad = config.Bind<bool>("NPC Settings", "(BETA) Faster Boss Start", false, "(BETA) Remove's Dialogue From Bosses");
			InstantLevers = config.Bind<bool>("Global Settings", "Instant Levers", true, "Removes The Delay When Hitting A Lever");
			FasterLifts = config.Bind<bool>("Global Settings", "Faster Lifts", true, "Lifts Now Have Super Speed");
			InstantText = config.Bind<bool>("Global Settings", "Instant Text", true, "Makes the Scroll Speed Of Text and Popup Speed Instant");
			SkipCutscene = config.Bind<bool>("Global Settings", "Skip Cutscenes Faster", true, "Skips Cutscenes Faster");
			SkipWeakness = config.Bind<bool>("Global Settings", "Skip Weakness", true, "Removes Weakness scenes in Moss Grotto And Cogwork Core");
			SmallTweaks = config.Bind<bool>("Global Settings", "Small Tweaks", true, "Fixes Camera Issue In Putrefied Ducts");
			OldPatch = config.Bind<bool>("Global Settings", "Old patch", false, "Patches In Old Features/Skips");
			FastUI = config.Bind<bool>("Global Settings", "Fast Menu", true, "Removes The Fade Delay");
			NoHardFalls = config.Bind<bool>("Global Settings", "No Hard Falls", false, "No More Broken Angles");
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("io.github.vitaxses.qol", "QoL", "1.2.0")]
	public sealed class QoLPlugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("io.github.vitaxses.qol");

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

		public static QoLPlugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "QoL";

		public static string Version => "1.2.0";

		private void Awake()
		{
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Configs.Bind(((BaseUnityPlugin)this).Config);
			SceneManager.sceneLoaded += OnSceneLoadPatch.OnSceneLoad;
			harmony.PatchAll();
			Logger.LogInfo((object)("Plugin " + Name + " (io.github.vitaxses.qol) v" + Version + " has loaded!"));
		}
	}
}
namespace QoL.Patches
{
	[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 = ((name == "Library_11") ? 25f : 150f);
				__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 = 95f;
				__instance.acceleration = 12f;
				__instance.moveDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(UIManager), "Start")]
	internal static class UIManagerPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix(UIManager __instance)
		{
			if (Configs.FastUI.Value)
			{
				__instance.MENU_FADE_SPEED = 100f;
			}
		}
	}
	[HarmonyPatch(typeof(Lever), "Start")]
	internal static class LeverPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void LeverStartPostfix(Lever __instance)
		{
			if (Configs.InstantLevers.Value)
			{
				__instance.openGateDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(Lever_tk2d), "Start")]
	internal static class Lever_tk2dPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void TK2DLeverStartPostfix(Lever_tk2d __instance)
		{
			if (Configs.InstantLevers.Value)
			{
				__instance.openGateDelay = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(PressurePlateBase), "Awake")]
	internal static class PressurePlateBasePatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void TK2DLeverStartPostfix(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 = (__instance.moveDuration = 0f));
			}
		}
	}
	[HarmonyPatch(typeof(DialogueBox), "Start")]
	internal static class DialogueBoxPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix(DialogueBox __instance)
		{
			if (Configs.InstantText.Value)
			{
				__instance.currentRevealSpeed = (__instance.regularRevealSpeed = (__instance.fastRevealSpeed *= 50f));
				__instance.animator.speed = 10f;
			}
		}
	}
	[HarmonyPatch(typeof(HeroController), "ShouldHardLand")]
	internal static class HardLandPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void ShouldHardLandPrefix(ref bool __result)
		{
			if (Configs.NoHardFalls.Value)
			{
				__result = false;
			}
		}
	}
	internal static class OnSceneLoadPatch
	{
		[CompilerGenerated]
		private sealed class <Delay>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float seconds;

			public Action action;

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

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

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

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

			private bool MoveNext()
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(seconds);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					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();
			}
		}

		internal static void OnSceneLoad(Scene scene, LoadSceneMode lsm)
		{
			if (!((Object)(object)HeroController.UnsafeInstance == (Object)null))
			{
				if (Configs.FasterNPC.Value && ((Scene)(ref scene)).name == "Bone_04")
				{
					PlayerData.instance.metMapper = true;
				}
				SkipWeakness(((Scene)(ref scene)).name);
				StartCoroutine(delegate
				{
					string sceneName = GameManager.instance.sceneName;
					OldPatch(sceneName);
					SmallTweaks(sceneName);
				}, 0.3f);
			}
		}

		private static void SmallTweaks(string sceneName)
		{
			if (Configs.SmallTweaks.Value && !(sceneName != "Aqueduct_01"))
			{
				Object.Destroy((Object)(object)GameObject.Find("Camera Locks"));
			}
		}

		private static void OldPatch(string sceneName)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.OldPatch.Value && sceneName == "Under_17")
			{
				GameObject obj = GameObject.Find("terrain collider (15)");
				obj.transform.position = new Vector3(12.25f, 7.64f, 0f);
				Object.Destroy((Object)(object)obj.GetComponent<NonSlider>());
			}
		}

		private static void SkipWeakness(string sceneName)
		{
			string sceneName2 = sceneName;
			if (!Configs.SkipWeakness.Value)
			{
				return;
			}
			if (sceneName2 == "Bonetown" && !PlayerData.instance.churchKeeperIntro)
			{
				PlayerData.instance.churchKeeperIntro = true;
				StartCoroutine(delegate
				{
					FSMUtility.LocateMyFSM(GameObject.Find("Churchkeeper Intro Scene"), "Control").SetState("Set End");
				}, 0.3f);
			}
			StartCoroutine(delegate
			{
				GameObject val = GameObject.Find("Weakness Scene");
				if (sceneName2 == "Cog_09_Destroyed")
				{
					val = GameObject.Find("Weakness Cog Drop Scene");
				}
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
			}, 0.3f);
		}

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

		private static void StartCoroutine(Action action, float seconds)
		{
			if (!((Object)(object)HeroController.UnsafeInstance == (Object)null))
			{
				((MonoBehaviour)HeroController.instance).StartCoroutine(Delay(seconds, action));
			}
		}
	}
	[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
	internal static class PlayMakerFSMPatch
	{
		private static readonly Action<PlayMakerFSM>[] edits = new Action<PlayMakerFSM>[11]
		{
			FasterBossAndNpc.FasterBoss,
			FasterBossAndNpc.FasterNPC,
			Bellway.BellBeast,
			Bellway.Toll,
			Ventrica.Tube,
			Ventrica.Toll,
			FsmLiftControl.Lift,
			BeastlingCall.SilkSpecials,
			BeastlingCall.Beastlings,
			BeastlingCall.Needolin,
			Cutscene.LastDive
		};

		[HarmonyPostfix]
		private static void Postfix(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);
				}
			}
		}
	}
	[HarmonyPatch(typeof(InputHandler), "SetSkipMode")]
	internal static class InputHandlerPatch
	{
		private static readonly string[] UnskipScene = new string[12]
		{
			"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"
		};

		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static bool Prefix(InputHandler __instance, ref SkipPromptMode newMode)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.SkipCutscene.Value || UnskipScene.Contains(GameManager.instance.sceneName))
			{
				return true;
			}
			SkipPromptMode skipMode = (SkipPromptMode)1;
			newMode = (SkipPromptMode)1;
			__instance.SkipMode = skipMode;
			__instance.skipCooldownTime = 0.0;
			__instance.readyToSkipCutscene = true;
			return false;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class SkippableSequencePatch
	{
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static bool Prefix(SkippableSequence __instance, ref bool __result)
		{
			if (!Configs.SkipCutscene.Value)
			{
				return true;
			}
			__instance.AllowSkip();
			__instance.canSkip = (__result = true);
			return false;
		}
	}
	[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(InventoryPaneInput), "OnEnable")]
	internal static class InventoryPaneInputPatch
	{
		private static GameObject FleaCounter;

		private static TMP_Text Counter;

		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void Postfix_OnEnable()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!Configs.FleaTracked.Value)
			{
				if ((Object)(object)FleaCounter != (Object)null)
				{
					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.FSMEdits
{
	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 Cutscene
	{
		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 class FasterBossAndNpc
	{
		internal static void FasterBoss(PlayMakerFSM fsm)
		{
			if (Configs.FasterBossLoad.Value && fsm != null && fsm.FsmName == "Control" && ((Object)fsm).name == "Lace Boss1")
			{
				FsmUtil.ChangeTransition(fsm, "Encountered?", "MEET", "Refight");
			}
		}

		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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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")
				{
					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" && PlayerData.instance.bellShrineEnclave)
				{
					PlayerData.instance.metCaretaker = true;
				}
			}
		}
	}
	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 = 32f;
				}
				FsmFloat fsmFloat2 = fsm.Fsm.GetFsmFloat("Speed Down");
				if (fsmFloat2 != null)
				{
					((NamedVariable)fsmFloat2).RawValue = ((GameManager.instance.sceneName == "Room_Forge") ? (-30f) : (-60f));
				}
			}
		}
	}
	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);
			}
		}
	}
}