Decompiled source of FastFastTravel v0.4.3

FastFastTravel.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 FastFastTravel.FsmActions;
using GlobalEnums;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using InControl;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
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("FastFastTravel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 Clazex")]
[assembly: AssemblyDescription("Skips fast travel animations, and let the Bell Beast be standby everywhere.")]
[assembly: AssemblyFileVersion("0.4.3.0")]
[assembly: AssemblyInformationalVersion("0.4.3")]
[assembly: AssemblyProduct("FastFastTravel")]
[assembly: AssemblyTitle("FastFastTravel")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Clazex/Silksong.FastFastTravel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.3.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 System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
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 FastFastTravel
{
	internal static class ConfigEntries
	{
		internal static class SkipBeastlingCall
		{
			internal static ConfigEntry<bool> Enabled { get; set; }

			internal static ConfigEntry<Key> KeyboardBinding { get; set; }

			internal static ConfigEntry<InputControlType> ControllerBinding { get; set; }
		}

		internal sealed class AcceptableKeyCodes : AcceptableValueBase
		{
			private static readonly Dictionary<Key, Key> mappings;

			private static readonly HashSet<Key> validKeyCodes;

			public AcceptableKeyCodes()
				: base(typeof(KeyCode))
			{
			}

			static AcceptableKeyCodes()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: 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)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				mappings = new Dictionary<Key, Key>();
				KeyMapping[] keyMappings = UnityKeyboardProvider.KeyMappings;
				foreach (KeyMapping val in keyMappings)
				{
					mappings[val.target0] = val.source;
					mappings[val.target1] = val.source;
				}
				mappings[(Key)0] = (Key)0;
				HashSet<Key> hashSet = new HashSet<Key>();
				foreach (Key key in mappings.Keys)
				{
					hashSet.Add(key);
				}
				validKeyCodes = hashSet;
			}

			internal static Key ToKey(Key keyCode)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return mappings[keyCode];
			}

			public override bool IsValid(object value)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				if (value is Key item)
				{
					return validKeyCodes.Contains(item);
				}
				return false;
			}

			public override object Clamp(object value)
			{
				if (!((AcceptableValueBase)this).IsValid(value))
				{
					return (object)(Key)0;
				}
				return value;
			}

			public override string ToDescriptionString()
			{
				return "# Acceptable keys: " + string.Join(", ", validKeyCodes);
			}
		}

		internal static void Bind(ConfigFile config)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			SkipBeastlingCall.Enabled = config.Bind<bool>("SkipBeastlingCall", "Enabled", true, "Whether to enable skipping Beastling Call performance");
			SkipBeastlingCall.KeyboardBinding = config.Bind<Key>("SkipBeastlingCall", "KeyboardBinding", (Key)0, new ConfigDescription("Keyboard binding, uses the Down binding when set to \"None\"", (AcceptableValueBase)(object)new AcceptableKeyCodes(), Array.Empty<object>()));
			SkipBeastlingCall.ControllerBinding = config.Bind<InputControlType>("SkipBeastlingCall", "ControllerBinding", (InputControlType)5, "Controller binding");
		}
	}
	[BepInPlugin("dev.clazex.fastfasttravel", "FastFastTravel", "0.4.3")]
	public class FastFastTravelPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static FastFastTravelPlugin <Instance>k__BackingField;

		[CompilerGenerated]
		private static ManualLogSource <Logger>k__BackingField;

		public const string Id = "dev.clazex.fastfasttravel";

		public static FastFastTravelPlugin Instance
		{
			get
			{
				if (!((Object)(object)<Instance>k__BackingField != (Object)null))
				{
					throw new InvalidOperationException("instance not present");
				}
				return <Instance>k__BackingField;
			}
			[CompilerGenerated]
			private set
			{
				<Instance>k__BackingField = value;
			}
		}

		internal static ManualLogSource Logger
		{
			get
			{
				return <Logger>k__BackingField ?? throw new InvalidOperationException("instance not present");
			}
			[CompilerGenerated]
			private set
			{
				<Logger>k__BackingField = value;
			}
		}

		private static Harmony Harmony { get; } = new Harmony("dev.clazex.fastfasttravel");


		public static string Name => "FastFastTravel";

		public static string Version => "0.4.3";

		internal static event Action? ConfigChanged;

		private static void InvokeConfigChanged(object sender, EventArgs args)
		{
			Logger.LogDebug((object)"Config changed");
			FastFastTravelPlugin.ConfigChanged?.Invoke();
		}

		private void Awake()
		{
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			ConfigEntries.Bind(((BaseUnityPlugin)this).Config);
			((BaseUnityPlugin)this).Config.ConfigReloaded += InvokeConfigChanged;
			((BaseUnityPlugin)this).Config.SettingChanged += InvokeConfigChanged;
			Harmony.PatchAll(typeof(Patches));
			Logger.LogInfo((object)("Plugin " + Name + " (dev.clazex.fastfasttravel) v" + Version + " has loaded!"));
		}

		private void OnDestroy()
		{
			Logger.LogWarning((object)"Unload called in release build");
			Harmony.UnpatchSelf();
			Logger.LogInfo((object)("Plugin " + Name + " has unloaded!"));
		}
	}
	internal static class Patches
	{
		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static void (PlayMakerFSM __instance)
		{
			if (!FastTravelScenes._scenes.ContainsValue(__instance.GetBaseSceneName<PlayMakerFSM>()))
			{
				return;
			}
			if (__instance != null && ((Object)__instance).name == "Bone Beast NPC" && __instance.FsmName == "Interaction")
			{
				Fsm fsm = __instance.Fsm;
				OvO ovo = ((Component)__instance).gameObject.AddComponent<OvO>();
				fsm.InsertAction("Hit End", 1, (FsmStateAction)(object)new OvO.oOvO(ovo, fsm.Variables.FindFsmInt("Hit Count")));
			}
			else if (((Object)__instance).name.StartsWith("Bellbeast Children") && __instance.FsmName == "bellbeast_children_control")
			{
				Fsm fsm2 = __instance.Fsm;
				FsmGameObject OuO = fsm2.GetAction<CreateObject>("Do Spawn", 1).storeObject;
				fsm2.InsertAction("Do Spawn", 3, (FsmStateAction)(object)new InvokeAction(delegate
				{
					GameObject value = OuO.Value;
					Utils.AddAction(action: (FsmStateAction)(object)new OvO.OvOo(value.AddComponent<OvO>()), fsm: FSMUtility.LocateMyFSM(value, "Control").Fsm, stateName: "Air");
				}));
			}
		}

		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		private static void ModifyFsm(PlayMakerFSM __instance)
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (FastTravelScenes._scenes.ContainsValue(__instance.GetBaseSceneName<PlayMakerFSM>()))
			{
				if (__instance != null && ((Object)__instance).name == "Bone Beast NPC" && __instance.FsmName == "Interaction")
				{
					ModifyBellBeastFsm(__instance.Fsm);
					return;
				}
				if (__instance != null && ((Object)__instance).name == "Bellway Toll Machine" && __instance.FsmName == "Unlock Behaviour")
				{
					ModifyBellwayTollFsm(__instance.Fsm);
					return;
				}
			}
			if (FastTravelScenes._tubeScenes.ContainsValue(__instance.GetBaseSceneName<PlayMakerFSM>()))
			{
				if (__instance != null && ((Object)__instance).name == "City Travel Tube" && __instance.FsmName == "Tube Travel")
				{
					ModifyTubeFsm(__instance.Fsm);
					return;
				}
				if (__instance != null && ((Object)__instance).name == "tube_toll_machine" && __instance.FsmName == "Unlock Behaviour")
				{
					ModifyTubeTollFsm(__instance.Fsm);
					return;
				}
			}
			Scene scene = ((Component)__instance).gameObject.scene;
			if (((Scene)(ref scene)).name == "DontDestroyOnLoad")
			{
				if (__instance != null && ((Object)__instance).name == "Hero_Hornet(Clone)" && __instance.FsmName == "Silk Specials")
				{
					ModifySilkSpecialsFsm(__instance.Fsm);
				}
				else if (__instance != null && ((Object)__instance).name == "Bone Beast Children Teleport(Clone)" && __instance.FsmName == "bellbeast_child_teleport_arrive")
				{
					ModifySummonedChildrenFsm(__instance.Fsm);
				}
			}
		}

		private static void ModifyBellBeastFsm(Fsm fsm)
		{
			//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)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Bell Beast FSM");
			EnumCompare actionCompareLocation = fsm.GetAction<EnumCompare>("Is Already Present?", 1);
			actionCompareLocation.notEqualEvent = actionCompareLocation.equalEvent;
			fsm.InsertAction("First Enter?", 0, (FsmStateAction)(object)new InvokeAction(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;
			}));
			fsm.ChangeTransition("Start State", "SLEEP", "Wake Up");
			fsm.GetAction<Wait>("Travel Arrive Start", 7).time = FsmFloat.op_Implicit(0f);
			fsm.AddAction("Wait Finished Entering", (FsmStateAction)(object)new InvokeAction(delegate
			{
				if (!HudCanvas.IsVisible)
				{
					HudCanvas instance = HudCanvas.instance;
					instance.targetFsm.SendEvent("IN");
					FSMUtility.SendEventToGameObject(((Component)instance).gameObject, "INVENTORY OPEN COMPLETE", true);
				}
			}));
			fsm.GetAction<ScreenFader>("Hero Jump", 0).duration = FsmFloat.op_Implicit(0.25f);
			fsm.DisableAction("Hero Jump", 5);
			fsm.ChangeTransition("Hero Jump", FsmEvent.Finished.Name, "Time Passes");
			fsm.DisableAction("Choose Scene", 3);
			fsm.ReplaceAction("Go To Stag Cutscene", 7, (FsmStateAction)new BeginSceneTransition
			{
				sceneName = fsm.Variables.GetFsmString("To Scene"),
				entryGateName = FsmString.op_Implicit("door_fastTravelExit"),
				entryDelay = FsmFloat.op_Implicit(0f),
				visualization = FsmEnum.op_Implicit((Enum)(object)(SceneLoadVisualizations)0),
				preventCameraFadeOut = true
			});
			fsm.ChangeTransition("First Enter?", FsmEvent.Finished.Name, "Idle");
			fsm.ChangeTransition("Can Appear 2", "TRUE", "Appear Delay");
			fsm.DisableAction("Appear Delay", 5);
			fsm.DisableAction("Start Shake", 8);
		}

		private static void ModifyBellwayTollFsm(Fsm fsm)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Bellway Toll FSM");
			fsm.DisableAction("Return Control", 5);
			fsm.AddAction("Return Control", (FsmStateAction)new SetAnimator
			{
				target = new FsmOwnerDefault(),
				active = FsmBool.op_Implicit(true)
			});
			fsm.AddAction("Return Control", (FsmStateAction)(object)new ChangeAnimatorSpeed(20f));
			fsm.DisableAction("Sequence Strum", 0);
			fsm.DisableAction("Stop", 1);
			fsm.DisableActions("Open Floor", 3, 5);
			fsm.GetAction<CallMethodProper>("Open Floor", 0).gameObject.GameObject.Value.GetComponent<Animator>().speed = 10f;
		}

		private static void ModifyTubeFsm(Fsm fsm)
		{
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Tube FSM");
			fsm.DisableAction("Tube Start Away", 3);
			fsm.GetAction<SendEventByName>("Tube Start Away", 4).sendEvent = FsmString.op_Implicit("START OPEN");
			fsm.ChangeTransition("Start In Tube", FsmEvent.Finished.Name, "Break Items");
			fsm.AddTransition("Break Items", FsmEvent.Finished, "Open");
			fsm.DisableAction("Open", 3);
			fsm.AddTransition("Open", FsmEvent.Finished, "Hop Out Antic");
			fsm.ChangeTransition("Preload Scene", FsmEvent.Finished.Name, "Close");
			fsm.AddTransition("Close", FsmEvent.Finished, "Save State");
			fsm.GetAction<ScreenFader>("Fade Out", 2).duration = FsmFloat.op_Implicit(0.25f);
			fsm.GetAction<Wait>("Fade Out", 3).time = FsmFloat.op_Implicit(0.25f);
			fsm.GetAction<SendEventByName>("Unlock Open", 1).sendEvent = FsmString.op_Implicit("START OPEN");
			fsm.AddTransition("Unlock Open", FsmEvent.Finished, "Unlock");
		}

		private static void ModifyTubeTollFsm(Fsm fsm)
		{
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Tube Toll FSM");
			fsm.DisableAction("Retract Animation", 0);
			fsm.AddAction("Retract Animation", (FsmStateAction)(object)new ChangeAnimatorSpeed(100f));
			fsm.DisableAction("After Retract Pause", 1);
		}

		private static void ModifySilkSpecialsFsm(Fsm fsm)
		{
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Hornet Silk Specials FSM");
			fsm.DisableActions("Hornet Jump Antic", 1, 4, 5);
			fsm.DisableActions("Hornet Jump", 1, 2, 3, 4, 5, 6, 7, 8);
			fsm.AddTransition("Hornet Jump", FsmEvent.Finished, "Hornet Fall");
			fsm.DisableActions("Hornet Fall", 0, 3, 5, 6, 7);
			fsm.AddTransition("Hornet Fall", FsmEvent.Finished, "Children Leave Fade");
			fsm.GetAction<ScreenFader>("Children Leave Fade", 6).duration = FsmFloat.op_Implicit(0.25f);
			fsm.GetAction<Wait>("Children Leave Fade", 7).time = FsmFloat.op_Implicit(0.25f);
			ModifyNeedolinFsm(fsm.GetAction<RunFSM>("Needolin Sub", 2).fsmTemplateControl.RunFsm);
		}

		private static void ModifyNeedolinFsm(Fsm fsm)
		{
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Hornet Needolin SubFSM");
			fsm.GetAction<BoolTestDelay>("Needolin FT Wait", 4).delay = FsmFloat.op_Implicit(0f);
			fsm.GetAction<Wait>("Can Fast Travel?", 1).time = FsmFloat.op_Implicit(0f);
			fsm.GetAction<Wait>("Needolin FT Antic", 5).time = FsmFloat.op_Implicit(2f);
			fsm.AddAction("Needolin FT Antic", (FsmStateAction)(object)new ListenForSkipBeastlingCall(FsmEvent.Finished));
		}

		private static void ModifySummonedChildrenFsm(Fsm fsm)
		{
			Fsm fsm2 = fsm;
			FastFastTravelPlugin.Logger.LogDebug((object)"Modifying Summoned Bell Beast Childern FSM");
			fsm2.AddAction("Init", (FsmStateAction)(object)new InvokeAction(delegate
			{
				MirrorTk2dAnimDelayed component = ((Component)fsm2.FsmComponent).GetComponent<MirrorTk2dAnimDelayed>();
				component.mirrorAnimator.PlayFromFrame(0);
				component.animator.PlayFromFrame(0);
				component.animator.Stop();
			}));
		}
	}
	[RequireComponent(typeof(tk2dSprite))]
	internal sealed class OvO : MonoBehaviour
	{
		internal class XwX : FsmStateAction
		{
			protected readonly OvO ovo;

			public XwX(OvO ovo)
			{
				this.ovo = ovo;
				((FsmStateAction)this)..ctor();
			}

			public override void OnEnter()
			{
				((FsmStateAction)this).BlocksFinish = false;
			}

			protected bool OAO()
			{
				if (((Behaviour)ovo).enabled)
				{
					((FsmStateAction)this).Finish();
					return true;
				}
				return false;
			}

			protected void Ssssssss()
			{
				((Behaviour)ovo).enabled = true;
				FastFastTravelPlugin.Logger.LogInfo((object)"OvO");
				((FsmStateAction)this).Finish();
			}
		}

		internal sealed class OvOo : XwX
		{
			private const float おまつり = 8.4f;

			private float sitBackAndRelax;

			public OvOo(OvO ovo)
				: base(ovo)
			{
			}

			public override void OnEnter()
			{
				base.OnEnter();
				OAO();
			}

			public override void OnFixedUpdate()
			{
				sitBackAndRelax += Time.fixedDeltaTime;
				if (sitBackAndRelax >= 8.4f)
				{
					Ssssssss();
				}
			}
		}

		internal sealed class oOvO : XwX
		{
			private const int ゆらまんぼ = 38;

			private readonly FsmInt opo;

			private int ono;

			public oOvO(OvO ovo, FsmInt opo)
			{
				this.opo = opo;
				base..ctor(ovo);
			}

			public override void OnEnter()
			{
				base.OnEnter();
				if (!OAO())
				{
					ono += opo.Value;
					if (ono >= 38)
					{
						Ssssssss();
					}
					else
					{
						((FsmStateAction)this).Finish();
					}
				}
			}
		}

		private const float はちみ = 0.5f;

		private const float あしが = 0.75f;

		private tk2dSprite I_I;

		private void Awake()
		{
			I_I = ((Component)this).GetComponent<tk2dSprite>();
			((Behaviour)this).enabled = false;
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			float num2 = default(float);
			float num3 = default(float);
			float num = default(float);
			Color.RGBToHSV(((tk2dBaseSprite)I_I).color, ref num, ref num2, ref num3);
			num += 0.5f * Time.unscaledDeltaTime;
			((tk2dBaseSprite)I_I).color = Color.HSVToRGB(num, 0.75f, num3);
		}
	}
	internal static class Utils
	{
		internal static string GetBaseSceneName<T>(this T component) where T : 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)
			Scene scene = ((Component)component).gameObject.scene;
			return GameManager.InternalBaseSceneName(((Scene)(ref scene)).name);
		}

		internal static T GetAction<T>(this Fsm fsm, string stateName, int index) where T : FsmStateAction
		{
			return (T)(object)fsm.GetState(stateName).Actions[index];
		}

		internal static void DisableAction(this Fsm fsm, string stateName, int index)
		{
			fsm.GetState(stateName).Actions[index].Enabled = false;
		}

		internal static void DisableActions(this Fsm fsm, string stateName, params int[] indices)
		{
			FsmStateAction[] actions = fsm.GetState(stateName).Actions;
			foreach (int num in indices)
			{
				actions[num].Enabled = false;
			}
		}

		internal static void AddAction(this Fsm fsm, string stateName, FsmStateAction action)
		{
			FsmState state = fsm.GetState(stateName);
			FsmStateAction[] actions = state.Actions;
			int num = 0;
			FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[1 + actions.Length];
			ReadOnlySpan<FsmStateAction> readOnlySpan = new ReadOnlySpan<FsmStateAction>(actions);
			readOnlySpan.CopyTo(new Span<FsmStateAction>(array).Slice(num, readOnlySpan.Length));
			num += readOnlySpan.Length;
			array[num] = action;
			state.Actions = array;
		}

		internal static void ReplaceAction(this Fsm fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).Actions[index] = action;
		}

		internal static void InsertAction(this Fsm fsm, string stateName, int index, FsmStateAction action)
		{
			FsmState state = fsm.GetState(stateName);
			FsmStateAction[] subArray = state.Actions[0..index];
			FsmStateAction[] subArray2 = state.Actions[index..];
			int num = 0;
			FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[1 + (subArray.Length + subArray2.Length)];
			ReadOnlySpan<FsmStateAction> readOnlySpan = new ReadOnlySpan<FsmStateAction>(subArray);
			readOnlySpan.CopyTo(new Span<FsmStateAction>(array).Slice(num, readOnlySpan.Length));
			num += readOnlySpan.Length;
			array[num] = action;
			num++;
			ReadOnlySpan<FsmStateAction> readOnlySpan2 = new ReadOnlySpan<FsmStateAction>(subArray2);
			readOnlySpan2.CopyTo(new Span<FsmStateAction>(array).Slice(num, readOnlySpan2.Length));
			num += readOnlySpan2.Length;
			state.Actions = array;
		}

		internal static void ChangeTransition(this Fsm fsm, string stateName, string eventName, string toStateName)
		{
			string eventName2 = eventName;
			FsmTransition obj = fsm.GetState(stateName).Transitions.First((FsmTransition i) => i.EventName == eventName2);
			obj.ToFsmState = fsm.GetState(toStateName);
			obj.ToState = toStateName;
		}

		internal static void AddTransition(this Fsm fsm, string stateName, FsmEvent fsmEvent, string toStateName)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			FsmState state = fsm.GetState(stateName);
			FsmTransition[] transitions = state.Transitions;
			int num = 0;
			FsmTransition[] array = (FsmTransition[])(object)new FsmTransition[1 + transitions.Length];
			ReadOnlySpan<FsmTransition> readOnlySpan = new ReadOnlySpan<FsmTransition>(transitions);
			readOnlySpan.CopyTo(new Span<FsmTransition>(array).Slice(num, readOnlySpan.Length));
			num += readOnlySpan.Length;
			array[num] = new FsmTransition
			{
				FsmEvent = fsmEvent,
				ToFsmState = fsm.GetState(toStateName),
				ToState = toStateName
			};
			state.Transitions = array;
		}
	}
}
namespace FastFastTravel.FsmActions
{
	internal sealed class ChangeAnimatorSpeed : FsmStateAction
	{
		public float speed;

		public ChangeAnimatorSpeed(float speed)
		{
			this.speed = speed;
			((FsmStateAction)this)..ctor();
		}

		public override void OnEnter()
		{
			((Component)base.fsmComponent).GetComponent<Animator>().speed = speed;
			((FsmStateAction)this).Finish();
		}
	}
	internal sealed class InvokeAction : FsmStateAction
	{
		public Action action;

		public InvokeAction(Action action)
		{
			this.action = action;
			((FsmStateAction)this)..ctor();
		}

		public override void OnEnter()
		{
			action();
			((FsmStateAction)this).Finish();
		}
	}
	internal sealed class ListenForSkipBeastlingCall : FsmStateAction
	{
		private sealed class ActionSet : PlayerActionSet
		{
			internal readonly PlayerAction keyboard;

			internal readonly PlayerAction controller;

			internal static ActionSet Instance { get; private set; }

			internal bool IsPressed
			{
				get
				{
					if (!((OneAxisInputControl)keyboard).IsPressed)
					{
						return ((OneAxisInputControl)controller).IsPressed;
					}
					return true;
				}
			}

			static ActionSet()
			{
				Instance = new ActionSet();
				FastFastTravelPlugin.ConfigChanged += delegate
				{
					Instance = new ActionSet();
				};
			}

			private ActionSet()
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Expected I4, but got Unknown
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				FastFastTravelPlugin.Logger.LogDebug((object)"Creating skip beastling call action set");
				Key value = ConfigEntries.SkipBeastlingCall.KeyboardBinding.Value;
				if ((int)value != 0)
				{
					keyboard = new PlayerAction("Keyboard Skip Beastling Call", (PlayerActionSet)(object)this);
					keyboard.AddDefaultBinding((Key[])(object)new Key[1] { (Key)(int)ConfigEntries.AcceptableKeyCodes.ToKey(value) });
				}
				else
				{
					keyboard = ManagerSingleton<InputHandler>.Instance.inputActions.Down;
				}
				controller = new PlayerAction("Controller Skip Beastling Call", (PlayerActionSet)(object)this);
				controller.AddDefaultBinding(ConfigEntries.SkipBeastlingCall.ControllerBinding.Value);
			}
		}

		public FsmEvent skipEvent;

		public ListenForSkipBeastlingCall(FsmEvent skipEvent)
		{
			((FsmStateAction)this).BlocksFinish = false;
			this.skipEvent = skipEvent;
		}

		public override void OnUpdate()
		{
			if (ConfigEntries.SkipBeastlingCall.Enabled.Value && ActionSet.Instance.IsPressed)
			{
				FastFastTravelPlugin.Logger.LogDebug((object)"Beastling call skip triggered");
				((FsmStateAction)this).Fsm.Event(skipEvent);
				((FsmStateAction)this).Finish();
			}
		}
	}
}