Decompiled source of FraudLace v1.0.2

FraudLace.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FraudLace.Modifiers;
using FraudLace.Patches;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Silksong.FsmUtil.Actions;
using TMProOld;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FraudLace")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+92e32360203136bec4d205f6b438d295b2ed6f9e")]
[assembly: AssemblyProduct("FraudLace")]
[assembly: AssemblyTitle("FraudLace")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 Silksong.FsmUtil.Actions
{
	public class DelegateAction<TArg> : FsmStateAction
	{
		public Action<TArg>? Method;

		public TArg? Arg;

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

		public override void OnEnter()
		{
			if (Method != null && Arg != null)
			{
				Method(Arg);
			}
			if (!(Arg is Action action) || action != new Action(base.Finish))
			{
				((FsmStateAction)this).Finish();
			}
		}
	}
}
namespace FraudLace
{
	internal static class AssetManager
	{
		private static readonly Dictionary<string, string[]> ScenePrefabs = new Dictionary<string, string[]>
		{
			["Cradle_03"] = new string[1] { "Boss Scene" },
			["Bone_Steel_Servant"] = new string[1] { "Abyss Mass" }
		};

		private static readonly Dictionary<string, string[]> BundleAssets = new Dictionary<string, string[]>
		{
			["blackthread_assets_all"] = new string[1] { "Black Thread Start Enemy Effect" },
			["animations_assets_areacradle"] = new string[1] { "abyss_water_70_percent0001" },
			["tk2danimations_assets_areabone"] = new string[1] { "Abyss Mass Anim" },
			["sfxstatic_assets_areacradle"] = new string[2] { "silk_boss_web_attack_buildup", "silk_boss_web_attack_burst" }
		};

		private static List<AssetBundle> _manuallyLoadedBundles = new List<AssetBundle>();

		private static readonly Dictionary<Type, Dictionary<string, Object>> Assets = new Dictionary<Type, Dictionary<string, Object>>();

		internal static string GetAssetRoot(this string assetPath)
		{
			return assetPath.Split("/").Last().Replace(".asset", "")
				.Replace(".prefab", "")
				.Replace(".wav", "")
				.Replace(".controller", "");
		}

		internal static IEnumerator Init()
		{
			yield return LoadScenePrefabs();
		}

		private static IEnumerator LoadScenePrefabs()
		{
			AudioManager.BlockAudioChange = true;
			foreach (KeyValuePair<string, string[]> scenePrefab in ScenePrefabs)
			{
				scenePrefab.Deconstruct(out var key, out var value);
				string sceneName = key;
				string[] prefabNames = value;
				string loadScenePath = "Scenes/" + sceneName;
				AsyncOperationHandle<SceneInstance> loadSceneHandle = Addressables.LoadSceneAsync((object)loadScenePath, (LoadSceneMode)1, true, 100, (SceneReleaseMode)0);
				yield return loadSceneHandle;
				if ((int)loadSceneHandle.Status == 1)
				{
					SceneInstance sceneInstance = loadSceneHandle.Result;
					Scene scene = ((SceneInstance)(ref sceneInstance)).Scene;
					GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
					foreach (GameObject rootObj in rootGameObjects)
					{
						string[] array = prefabNames;
						foreach (string prefabName in array)
						{
							Transform? obj = ((IEnumerable<Transform>)rootObj.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform val) => ((Object)val).name == prefabName));
							GameObject prefab = ((obj != null) ? ((Component)obj).gameObject : null);
							if (Object.op_Implicit((Object)(object)prefab))
							{
								prefab.SetActive(false);
								GameObject prefabCopy = Object.Instantiate<GameObject>(prefab);
								((Object)prefabCopy).name = prefabName;
								Object.DontDestroyOnLoad((Object)(object)prefabCopy);
								TryAdd<GameObject>(prefabCopy);
							}
						}
					}
					sceneInstance = default(SceneInstance);
				}
				else
				{
					Debug.Log((object)loadSceneHandle.OperationException);
				}
				AsyncOperationHandle<SceneInstance> unloadSceneHandle = Addressables.UnloadSceneAsync(loadSceneHandle, true);
				yield return unloadSceneHandle;
			}
			AudioManager.BlockAudioChange = false;
		}

		internal static IEnumerator LoadBundleAssets()
		{
			RuntimePlatform platform = Application.platform;
			if (1 == 0)
			{
			}
			RuntimePlatform val = platform;
			string key = (((int)val == 1) ? "StandaloneOSX" : (((int)val == 2) ? "StandaloneWindows64" : (((int)val != 13) ? "" : "StandaloneLinux64")));
			if (1 == 0)
			{
			}
			string bundlesPath = Path.Combine(path2: key, path1: Addressables.RuntimePath);
			foreach (KeyValuePair<string, string[]> bundleAsset in BundleAssets)
			{
				bundleAsset.Deconstruct(out key, out var value);
				string bundleName = key;
				string[] assetNames = value;
				bool bundleAlreadyLoaded = false;
				foreach (AssetBundle loadedBundle in AssetBundle.GetAllLoadedAssetBundles())
				{
					string[] allAssetNames = loadedBundle.GetAllAssetNames();
					foreach (string assetPath in allAssetNames)
					{
						string[] array = assetNames;
						foreach (string assetName in array)
						{
							if (assetPath.GetAssetRoot() == assetName)
							{
								bundleAlreadyLoaded = true;
								AssetBundleRequest loadAssetRequest = loadedBundle.LoadAssetAsync(assetPath);
								yield return loadAssetRequest;
								Object loadedAsset = loadAssetRequest.asset;
								TryAdd<Object>(loadedAsset);
								Debug.Log((object)loadedAsset.name);
								break;
							}
						}
						if (bundleAlreadyLoaded)
						{
							break;
						}
					}
					if (bundleAlreadyLoaded)
					{
						break;
					}
				}
				if (bundleAlreadyLoaded)
				{
					Debug.Log((object)("Bundle " + bundleName + " already loaded!"));
					continue;
				}
				string bundlePath = Path.Combine(bundlesPath, bundleName + ".bundle");
				AssetBundleCreateRequest bundleLoadRequest = AssetBundle.LoadFromFileAsync(bundlePath);
				yield return bundleLoadRequest;
				AssetBundle bundle = bundleLoadRequest.assetBundle;
				_manuallyLoadedBundles.Add(bundle);
				string[] allAssetNames2 = bundle.GetAllAssetNames();
				foreach (string assetPath2 in allAssetNames2)
				{
					string[] array2 = assetNames;
					foreach (string assetName2 in array2)
					{
						if (assetPath2.GetAssetRoot() == assetName2)
						{
							AssetBundleRequest assetLoadRequest = bundle.LoadAssetAsync(assetPath2);
							yield return assetLoadRequest;
							Object loadedAsset2 = assetLoadRequest.asset;
							TryAdd<Object>(loadedAsset2);
						}
					}
				}
			}
		}

		private static bool Has(string assetName)
		{
			foreach (var (_, dictionary2) in Assets)
			{
				foreach (var (text2, val2) in dictionary2)
				{
					if (assetName == text2 && Object.op_Implicit(val2))
					{
						return true;
					}
				}
			}
			return false;
		}

		private static void TryAdd<T>(T asset) where T : Object
		{
			string name = ((Object)asset).name;
			if (Has(name))
			{
				Debug.Log((object)("Asset \"" + name + "\" has already been loaded!"));
				return;
			}
			Type type = ((object)asset).GetType();
			if (Assets.ContainsKey(type))
			{
				Dictionary<string, Object> dictionary = Assets[type];
				if (dictionary != null)
				{
					if (dictionary.ContainsKey(name))
					{
						Object val = dictionary[name];
						if (val != (Object)null)
						{
							Debug.Log((object)$"There is already an asset \"{name}\" of type \"{type}\"!");
							return;
						}
						Debug.Log((object)$"Key \"{name}\" for sub-dictionary of type \"{type}\" exists, but its value is null; Replacing with new asset...");
						Assets[type][name] = (Object)(object)asset;
					}
					else
					{
						Debug.Log((object)$"Adding asset \"{name}\" of type \"{type}\".");
						Assets[type].Add(name, (Object)(object)asset);
					}
				}
				else
				{
					Debug.Log((object)$"Failed to get sub-dictionary of type \"{type}\"!");
					Assets.Add(type, new Dictionary<string, Object>());
				}
			}
			else
			{
				Assets.Add(type, new Dictionary<string, Object> { [name] = (Object)(object)asset });
				Debug.Log((object)$"Added new sub-dictionary of type \"{type}\" with initial asset \"{name}\".");
			}
		}

		internal static void UnloadAll()
		{
			foreach (Dictionary<string, Object> value in Assets.Values)
			{
				foreach (Object value2 in value.Values)
				{
					Object.DestroyImmediate(value2);
				}
			}
			Assets.Clear();
			GC.Collect();
		}

		internal static void UnloadManualBundles()
		{
			foreach (AssetBundle manuallyLoadedBundle in _manuallyLoadedBundles)
			{
				string bundleName = ((Object)manuallyLoadedBundle).name;
				AssetBundleUnloadOperation val = manuallyLoadedBundle.UnloadAsync(true);
				((AsyncOperation)val).completed += delegate
				{
					Debug.Log((object)("Successfully unloaded bundle \"" + bundleName + "\""));
				};
			}
			_manuallyLoadedBundles.Clear();
			foreach (KeyValuePair<string, Object> item in Assets[typeof(GameObject)])
			{
				item.Deconstruct(out var _, out var value);
				Object val2 = value;
				GameObject val3 = (GameObject)(object)((val2 is GameObject) ? val2 : null);
				if (val3 != null && val3.activeSelf)
				{
					Debug.Log((object)("Recycling all instances of prefab \"" + ((Object)val3).name + "\""));
					ObjectPoolExtensions.RecycleAll(val3);
				}
			}
		}

		internal static T? Get<T>(string assetName) where T : Object
		{
			Type typeFromHandle = typeof(T);
			if (Assets.ContainsKey(typeFromHandle))
			{
				Dictionary<string, Object> dictionary = Assets[typeFromHandle];
				if (dictionary != null)
				{
					if (dictionary.ContainsKey(assetName))
					{
						Object val = dictionary[assetName];
						if (val != (Object)null)
						{
							return (T)(object)((val is T) ? val : null);
						}
						Debug.Log((object)("Failed to get asset \"" + assetName + "\"; asset is null!"));
						return default(T);
					}
					Debug.Log((object)$"Sub-dictionary for type \"{typeFromHandle}\" does not contain key \"{assetName}\"!");
					return default(T);
				}
				Debug.Log((object)$"Failed to get asset \"{assetName}\"; sub-dictionary of key \"{typeFromHandle}\" is null!");
				return default(T);
			}
			Debug.Log((object)$"Could not find a sub-dictionary of type \"{typeFromHandle}\"!");
			return default(T);
		}
	}
	public static class Constants
	{
		public static int LLHP1 => 2800;

		public static int LLHP2 => 2400;

		public static int LLHP3 => 1600;

		public static int LLHP4 => 800;

		public static int globcount => 7;

		public static int tendrilcount => 6;

		public static float commondelay => 0.1f;

		public static float chargedelay => 0.4f;

		public static float bulletdelay => 0.02f;

		public static float fasterfall => 3f;

		public static string FraudLaceNotes_EN => "This pretentious child covered herself in void and claims herself to be the final boss. I shall beat her out of this emo phase.";
	}
	internal static class ActionUtil
	{
		public static FsmOwnerDefault GOtoFOD(FsmGameObject target)
		{
			//IL_0001: 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)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			return new FsmOwnerDefault
			{
				ownerOption = (OwnerDefaultOption)1,
				gameObject = target
			};
		}

		public static void ClearActionsAfter(this FsmState source, int index)
		{
			FsmStateAction[] array = source.Actions;
			if (index < 0 || index >= array.Length)
			{
				throw new ArgumentOutOfRangeException("index", "Index is out of range of the actions array.");
			}
			Array.Resize(ref array, index + 1);
			source.Actions = array;
		}

		public static void CloneActionsAndTransitions(FsmState source, FsmState target)
		{
			FsmStateAction[] actions = source.Actions;
			FsmTransition[] transitions = source.Transitions;
			target.Actions = (FsmStateAction[])(object)new FsmStateAction[actions.Length];
			target.Transitions = (FsmTransition[])(object)new FsmTransition[transitions.Length];
			for (int i = 0; i < actions.Length; i++)
			{
				FsmStateAction originalActions = actions[i];
				target.Actions[i] = CloneAction(originalActions);
			}
			for (int j = 0; j < transitions.Length; j++)
			{
				FsmTransition originaltransitions = transitions[j];
				target.Transitions[j] = CloneTransition(originaltransitions);
			}
		}

		internal static FsmStateAction CloneAction(FsmStateAction originalActions)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			Type type = ((object)originalActions).GetType();
			FsmStateAction val = (FsmStateAction)Activator.CreateInstance(type);
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				fieldInfo.SetValue(val, fieldInfo.GetValue(originalActions));
			}
			return val;
		}

		private static FsmTransition CloneTransition(FsmTransition originaltransitions)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			Type type = ((object)originaltransitions).GetType();
			FsmTransition val = (FsmTransition)Activator.CreateInstance(type);
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				fieldInfo.SetValue(val, fieldInfo.GetValue(originaltransitions));
			}
			return val;
		}

		internal static FsmStateAction RandomFloatAdder(FsmFloat target, float min, float max)
		{
			//IL_0001: 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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			return (FsmStateAction)new FloatAddRandom
			{
				floatVariable = target,
				addMin = FsmFloat.op_Implicit(min),
				addMax = FsmFloat.op_Implicit(max)
			};
		}

		internal static FsmStateAction RandomFloatSetter(FsmFloat target, float min, float max)
		{
			//IL_0001: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			return (FsmStateAction)new RandomFloat
			{
				min = FsmFloat.op_Implicit(min),
				max = FsmFloat.op_Implicit(max),
				storeResult = target
			};
		}

		internal static FsmStateAction FloatAdder(FsmFloat target, float value)
		{
			//IL_0001: 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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			return (FsmStateAction)new FloatAdd
			{
				floatVariable = target,
				add = FsmFloat.op_Implicit(value)
			};
		}

		internal static FsmStateAction FloatSetter(FsmFloat target, FsmFloat value)
		{
			//IL_0001: 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)
			//IL_000d: 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)
			//IL_001c: Expected O, but got Unknown
			return (FsmStateAction)new SetFloatValue
			{
				floatVariable = target,
				floatValue = value,
				everyFrame = false
			};
		}

		internal static FsmStateAction RandomIntSetter(FsmInt target, int min, int max)
		{
			//IL_0001: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			return (FsmStateAction)new RandomInt
			{
				min = FsmInt.op_Implicit(min),
				max = FsmInt.op_Implicit(max),
				storeResult = target
			};
		}

		internal static FsmStateAction IntAdder(FsmInt target, int value)
		{
			//IL_0001: 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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			return (FsmStateAction)new IntAdd
			{
				intVariable = target,
				add = FsmInt.op_Implicit(value)
			};
		}

		internal static FsmStateAction IntSetter(FsmInt target, FsmInt value)
		{
			//IL_0001: 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)
			//IL_000d: 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)
			//IL_001c: Expected O, but got Unknown
			return (FsmStateAction)new SetIntValue
			{
				intVariable = target,
				intValue = value,
				everyFrame = false
			};
		}

		internal static FsmStateAction IntComparer(FsmInt Int1, FsmInt Int2, FsmEvent greatevent, FsmEvent equalevent, FsmEvent lessevent)
		{
			//IL_0001: 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)
			//IL_000d: 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)
			//IL_001b: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			return (FsmStateAction)new IntCompare
			{
				integer1 = Int1,
				integer2 = Int2,
				equal = equalevent,
				greaterThan = greatevent,
				lessThan = lessevent,
				everyFrame = false
			};
		}

		internal static FsmStateAction BoolSetter(FsmBool target, bool value)
		{
			//IL_0001: 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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			return (FsmStateAction)new SetBoolValue
			{
				boolVariable = target,
				boolValue = FsmBool.op_Implicit(value),
				everyFrame = false
			};
		}

		internal static FsmStateAction BoolSender(GameObject target, string name, FsmBool value)
		{
			//IL_0001: 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)
			//IL_0017: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			return (FsmStateAction)new SetFsmBool
			{
				gameObject = GOtoFOD(FsmGameObject.op_Implicit(target)),
				fsmName = FsmString.op_Implicit("Control"),
				variableName = FsmString.op_Implicit(name),
				setValue = value,
				everyFrame = false
			};
		}

		internal static FsmStateAction FloatSender(GameObject target, string name, FsmFloat num)
		{
			//IL_0001: 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)
			//IL_0017: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			return (FsmStateAction)new SetFsmFloat
			{
				gameObject = GOtoFOD(FsmGameObject.op_Implicit(target)),
				fsmName = FsmString.op_Implicit("Control"),
				variableName = FsmString.op_Implicit(name),
				setValue = num,
				everyFrame = false
			};
		}

		internal static FsmStateAction EventSender(FsmGameObject target, FsmString pinevent)
		{
			return EventSenderWithDelay(target, pinevent, 0f);
		}

		internal static FsmStateAction EventSenderWithDelay(FsmGameObject target, FsmString pinevent, float delay)
		{
			//IL_0001: 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)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003f: Expected O, but got Unknown
			return (FsmStateAction)new SendEventByName
			{
				eventTarget = new FsmEventTarget
				{
					target = (EventTarget)1,
					gameObject = GOtoFOD(target)
				},
				sendEvent = pinevent,
				delay = FsmFloat.op_Implicit(delay),
				everyFrame = false
			};
		}

		internal static FsmStateAction SelfEventSender(FsmString pinevent)
		{
			//IL_0001: 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)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_0018: Expected O, but got Unknown
			//IL_0018: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			return (FsmStateAction)new SendEventByName
			{
				eventTarget = new FsmEventTarget
				{
					target = (EventTarget)0
				},
				sendEvent = pinevent,
				delay = FsmFloat.op_Implicit(0f),
				everyFrame = false
			};
		}

		internal static FsmStateAction SelfAnimatorPosition(FsmFloat x, FsmFloat y, FsmFloat z)
		{
			//IL_0001: 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)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			return (FsmStateAction)new AnimatePositionTo
			{
				gameObject = new FsmOwnerDefault
				{
					OwnerOption = (OwnerDefaultOption)0
				},
				toValue = new FsmVector3
				{
					UseVariable = true,
					Value = new Vector3(x.value, y.value, z.value)
				},
				objectTransform = null,
				localSpace = false,
				time = FsmFloat.op_Implicit(2f),
				finishEvent = FsmEvent.Finished
			};
		}

		internal static FsmStateAction Waiter(float seconds)
		{
			//IL_0001: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			return (FsmStateAction)new Wait
			{
				time = FsmFloat.op_Implicit(seconds),
				finishEvent = FsmEvent.Finished
			};
		}

		internal static FsmStateAction WaiterWithEvent(float seconds, FsmEvent waitevent)
		{
			//IL_0001: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			return (FsmStateAction)new Wait
			{
				time = FsmFloat.op_Implicit(seconds),
				finishEvent = waitevent
			};
		}

		internal static FsmStateAction PositionGetter(FsmGameObject target, FsmFloat x, FsmFloat y)
		{
			//IL_0001: 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)
			//IL_0012: 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_0031: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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)
			//IL_005e: Expected O, but got Unknown
			return (FsmStateAction)new GetPosition
			{
				gameObject = GOtoFOD(target),
				vector = FsmVector3.op_Implicit(new Vector3(0f, 0f, 0f)),
				x = x,
				y = y,
				z = FsmFloat.op_Implicit(0f),
				everyFrame = false,
				space = (Space)0
			};
		}

		internal static FsmStateAction GOActivator(GameObject target, bool sw)
		{
			//IL_0001: 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)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return (FsmStateAction)new ActivateGameObject
			{
				gameObject = GOtoFOD(FsmGameObject.op_Implicit(target)),
				activate = FsmBool.op_Implicit(sw),
				recursive = FsmBool.op_Implicit(false),
				resetOnExit = false,
				everyFrame = false
			};
		}

		internal static FsmStateAction SimpleRandomEvent(FsmEvent[] events, FsmFloat[] weights, FsmInt[] eventmax, FsmInt[] missedmax, FsmBool active)
		{
			//IL_0001: 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)
			//IL_000d: 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)
			//IL_001b: 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_002b: Expected O, but got Unknown
			return (FsmStateAction)new SendRandomEventV4
			{
				events = events,
				weights = weights,
				eventMax = eventmax,
				missedMax = missedmax,
				activeBool = active
			};
		}
	}
	public static class FsmUtil
	{
		[PublicAPI]
		public static PlayMakerFSM? GetFsmPreprocessed(this GameObject go, string fsmName)
		{
			PlayMakerFSM[] components = go.GetComponents<PlayMakerFSM>();
			foreach (PlayMakerFSM val in components)
			{
				if (val.FsmName == fsmName)
				{
					val.Preprocess();
					return val;
				}
			}
			return null;
		}

		private static TVal? GetItemFromArray<TVal>(TVal[] origArray, Func<TVal, bool> isItemCheck) where TVal : class
		{
			foreach (TVal val in origArray)
			{
				if (isItemCheck(val))
				{
					return val;
				}
			}
			return null;
		}

		private static TVal[] GetItemsFromArray<TVal>(TVal[] origArray, Func<TVal, bool> isItemCheck) where TVal : class
		{
			int num = 0;
			foreach (TVal arg in origArray)
			{
				if (isItemCheck(arg))
				{
					num++;
				}
			}
			if (num == origArray.Length)
			{
				return origArray;
			}
			if (num == 0)
			{
				return Array.Empty<TVal>();
			}
			TVal[] array = new TVal[num];
			int num2 = 0;
			foreach (TVal val in origArray)
			{
				if (isItemCheck(val))
				{
					array[num2] = val;
					num2++;
				}
			}
			return array;
		}

		[PublicAPI]
		public static FsmState? GetState(this PlayMakerFSM fsm, string stateName)
		{
			return GetItemFromArray(fsm.FsmStates, (FsmState x) => x.Name == stateName);
		}

		[PublicAPI]
		public static FsmState? GetState(this Fsm fsm, string stateName)
		{
			return GetItemFromArray(fsm.States, (FsmState x) => x.Name == stateName);
		}

		[PublicAPI]
		public static FsmTransition? GetTransition(this PlayMakerFSM fsm, string stateName, string eventName)
		{
			return fsm.GetState(stateName).GetTransition(eventName);
		}

		[PublicAPI]
		public static FsmTransition? GetTransition(this Fsm fsm, string stateName, string eventName)
		{
			return fsm.GetState(stateName).GetTransition(eventName);
		}

		[PublicAPI]
		public static FsmTransition? GetTransition(this FsmState state, string eventName)
		{
			return GetItemFromArray(state.Transitions, (FsmTransition x) => x.EventName == eventName);
		}

		[PublicAPI]
		public static FsmTransition? GetGlobalTransition(this PlayMakerFSM fsm, string globalEventName)
		{
			return fsm.Fsm.GetGlobalTransition(globalEventName);
		}

		[PublicAPI]
		public static FsmTransition? GetGlobalTransition(this Fsm fsm, string globalEventName)
		{
			return GetItemFromArray(fsm.GlobalTransitions, (FsmTransition x) => x.EventName == globalEventName);
		}

		[PublicAPI]
		public static TAction? GetAction<TAction>(this PlayMakerFSM fsm, string stateName, int index) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetAction<TAction>(index);
		}

		[PublicAPI]
		public static TAction? GetAction<TAction>(this Fsm fsm, string stateName, int index) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetAction<TAction>(index);
		}

		[PublicAPI]
		public static TAction? GetAction<TAction>(this FsmState state, int index) where TAction : FsmStateAction
		{
			FsmStateAction obj = state.Actions[index];
			return (TAction)(object)((obj is TAction) ? obj : null);
		}

		[PublicAPI]
		public static FsmStateAction? GetStateAction(this PlayMakerFSM fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).GetStateAction(index);
		}

		[PublicAPI]
		public static FsmStateAction? GetStateAction(this Fsm fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).GetStateAction(index);
		}

		[PublicAPI]
		public static FsmStateAction? GetStateAction(this FsmState state, int index)
		{
			return state.Actions[index];
		}

		[PublicAPI]
		public static TAction[] GetActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetActionsOfType<TAction>();
		}

		[PublicAPI]
		public static TAction[] GetActionsOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetActionsOfType<TAction>();
		}

		[PublicAPI]
		public static TAction[] GetActionsOfType<TAction>(this FsmState state) where TAction : FsmStateAction
		{
			return Array.ConvertAll(GetItemsFromArray(state.Actions, (FsmStateAction x) => x is TAction), (FsmStateAction x) => (TAction)(object)x);
		}

		[PublicAPI]
		public static TAction? GetFirstActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetFirstActionOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetFirstActionOfType<TAction>(this FsmState state) where TAction : FsmStateAction
		{
			int num = -1;
			for (int i = 0; i < state.Actions.Length; i++)
			{
				if (state.Actions[i] is TAction)
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				return default(TAction);
			}
			return state.GetAction<TAction>(num);
		}

		[PublicAPI]
		public static TAction? GetLastActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetLastActionOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction
		{
			return fsm.GetState(stateName).GetLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static TAction? GetLastActionOfType<TAction>(this FsmState state) where TAction : FsmStateAction
		{
			int num = -1;
			for (int num2 = state.Actions.Length - 1; num2 >= 0; num2--)
			{
				if (state.Actions[num2] is TAction)
				{
					num = num2;
					break;
				}
			}
			if (num == -1)
			{
				return default(TAction);
			}
			return state.GetAction<TAction>(num);
		}

		private static TVal[] AddItemToArray<TVal>(TVal[] origArray, TVal value)
		{
			TVal[] array = new TVal[origArray.Length + 1];
			origArray.CopyTo(array, 0);
			array[origArray.Length] = value;
			return array;
		}

		[PublicAPI]
		public static FsmState AddState(this PlayMakerFSM fsm, string stateName)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			return fsm.Fsm.AddState(new FsmState(fsm.Fsm)
			{
				Name = stateName
			});
		}

		[PublicAPI]
		public static FsmState AddState(this Fsm fsm, string stateName)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			return fsm.AddState(new FsmState(fsm)
			{
				Name = stateName
			});
		}

		[PublicAPI]
		public static FsmState AddState(this PlayMakerFSM fsm, FsmState state)
		{
			return fsm.Fsm.AddState(state);
		}

		[PublicAPI]
		public static FsmState AddState(this Fsm fsm, FsmState state)
		{
			FsmState[] states = fsm.States;
			FsmState[] array = (fsm.States = AddItemToArray(states, state));
			fsm.SaveActions();
			return array[states.Length];
		}

		[PublicAPI]
		public static FsmState CopyState(this PlayMakerFSM fsm, string fromState, string toState)
		{
			return fsm.Fsm.CopyState(fromState, toState);
		}

		[PublicAPI]
		public static FsmState CopyState(this Fsm fsm, string fromState, string toState)
		{
			//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_0024: Expected O, but got Unknown
			FsmState state = fsm.GetState(fromState);
			if (state != null)
			{
				state.SaveActions();
			}
			FsmState val = new FsmState(state)
			{
				Name = toState
			};
			FsmTransition[] transitions = val.Transitions;
			foreach (FsmTransition val2 in transitions)
			{
				val2.ToFsmState = fsm.GetState(val2.ToState);
			}
			fsm.AddState(val);
			return val;
		}

		[PublicAPI]
		public static FsmEvent AddTransition(this PlayMakerFSM fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).AddTransition(eventName, toState);
		}

		[PublicAPI]
		public static FsmEvent AddTransition(this Fsm fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).AddTransition(eventName, toState);
		}

		[PublicAPI]
		public static FsmEvent AddTransition(this FsmState state, string eventName, string toState)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			FsmEvent fsmEvent = FsmEvent.GetFsmEvent(eventName);
			FsmTransition[] transitions = AddItemToArray(state.Transitions, new FsmTransition
			{
				ToState = toState,
				ToFsmState = state.Fsm.GetState(toState),
				FsmEvent = fsmEvent
			});
			state.Transitions = transitions;
			return fsmEvent;
		}

		[PublicAPI]
		public static FsmEvent AddGlobalTransition(this PlayMakerFSM fsm, string globalEventName, string toState)
		{
			return fsm.Fsm.AddGlobalTransition(globalEventName, toState);
		}

		[PublicAPI]
		public static FsmEvent AddGlobalTransition(this Fsm fsm, string globalEventName, string toState)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//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_0023: 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)
			//IL_003e: Expected O, but got Unknown
			FsmEvent val = new FsmEvent(globalEventName)
			{
				IsGlobal = true
			};
			FsmTransition[] globalTransitions = AddItemToArray(fsm.GlobalTransitions, new FsmTransition
			{
				ToState = toState,
				ToFsmState = fsm.GetState(toState),
				FsmEvent = val
			});
			fsm.GlobalTransitions = globalTransitions;
			return val;
		}

		[PublicAPI]
		public static void AddAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action)
		{
			fsm.GetState(stateName).AddAction(action);
		}

		[PublicAPI]
		public static void AddAction(this Fsm fsm, string stateName, FsmStateAction action)
		{
			fsm.GetState(stateName).AddAction(action);
		}

		[PublicAPI]
		public static void AddAction(this FsmState state, FsmStateAction action)
		{
			FsmStateAction[] actions = AddItemToArray(state.Actions, action);
			state.Actions = actions;
			action.Init(state);
		}

		[PublicAPI]
		public static void AddActions(this PlayMakerFSM fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).AddActions(actions);
		}

		[PublicAPI]
		public static void AddActions(this Fsm fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).AddActions(actions);
		}

		[PublicAPI]
		public static void AddActions(this FsmState state, params FsmStateAction[] actions)
		{
			foreach (FsmStateAction action in actions)
			{
				state.AddAction(action);
			}
		}

		[PublicAPI]
		public static void AddMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).AddMethod(method);
		}

		[PublicAPI]
		public static void AddMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).AddMethod(method);
		}

		[PublicAPI]
		public static void AddMethod(this FsmState state, Action<FsmStateAction> method)
		{
			DelegateAction<FsmStateAction> delegateAction = new DelegateAction<FsmStateAction>
			{
				Method = method
			};
			delegateAction.Arg = (FsmStateAction?)(object)delegateAction;
			state.AddAction((FsmStateAction)(object)delegateAction);
		}

		[PublicAPI]
		public static void AddLambdaMethod(this PlayMakerFSM fsm, string stateName, Action<Action> method)
		{
			fsm.GetState(stateName).AddLambdaMethod(method);
		}

		[PublicAPI]
		public static void AddLambdaMethod(this Fsm fsm, string stateName, Action<Action> method)
		{
			fsm.GetState(stateName).AddLambdaMethod(method);
		}

		[PublicAPI]
		public static void AddLambdaMethod(this FsmState state, Action<Action> method)
		{
			DelegateAction<Action> delegateAction = new DelegateAction<Action>
			{
				Method = method
			};
			delegateAction.Arg = ((FsmStateAction)delegateAction).Finish;
			state.AddAction((FsmStateAction)(object)delegateAction);
		}

		private static TVal[] InsertItemIntoArray<TVal>(TVal[] origArray, TVal value, int index)
		{
			int num = origArray.Length;
			if (index < 0 || index > num + 1)
			{
				throw new ArgumentOutOfRangeException($"Index {index} was out of range for array with length {num}!");
			}
			TVal[] array = new TVal[num + 1];
			for (int i = 0; i < index; i++)
			{
				array[i] = origArray[i];
			}
			array[index] = value;
			for (int i = index; i < num; i++)
			{
				array[i + 1] = origArray[i];
			}
			return array;
		}

		[PublicAPI]
		public static void InsertAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this PlayMakerFSM fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this Fsm fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this Fsm fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this FsmState state, FsmStateAction action, int index)
		{
			state.InsertAction(index, action);
		}

		[PublicAPI]
		public static void InsertAction(this FsmState state, int index, FsmStateAction action)
		{
			FsmStateAction[] actions = InsertItemIntoArray(state.Actions, action, index);
			state.Actions = actions;
			action.Init(state);
		}

		[PublicAPI]
		public static void InsertActions(this PlayMakerFSM fsm, string stateName, int index, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).InsertActions(index, actions);
		}

		[PublicAPI]
		public static void InsertActions(this Fsm fsm, string stateName, int index, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).InsertActions(index, actions);
		}

		[PublicAPI]
		public static void InsertActions(this FsmState state, int index, params FsmStateAction[] actions)
		{
			foreach (FsmStateAction action in actions)
			{
				state.InsertAction(action, index);
				index++;
			}
		}

		[PublicAPI]
		public static void InsertMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method, int index)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this PlayMakerFSM fsm, string stateName, int index, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method, int index)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this Fsm fsm, string stateName, int index, Action<FsmStateAction> method)
		{
			fsm.GetState(stateName).InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this FsmState state, Action<FsmStateAction> method, int index)
		{
			state.InsertMethod(index, method);
		}

		[PublicAPI]
		public static void InsertMethod(this FsmState state, int index, Action<FsmStateAction> method)
		{
			DelegateAction<FsmStateAction> delegateAction = new DelegateAction<FsmStateAction>
			{
				Method = method
			};
			delegateAction.Arg = (FsmStateAction?)(object)delegateAction;
			state.InsertAction((FsmStateAction)(object)delegateAction, index);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this PlayMakerFSM fsm, string stateName, Action<Action> method, int index)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this PlayMakerFSM fsm, string stateName, int index, Action<Action> method)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this Fsm fsm, string stateName, Action<Action> method, int index)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this Fsm fsm, string stateName, int index, Action<Action> method)
		{
			fsm.GetState(stateName).InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this FsmState state, Action<Action> method, int index)
		{
			state.InsertLambdaMethod(index, method);
		}

		[PublicAPI]
		public static void InsertLambdaMethod(this FsmState state, int index, Action<Action> method)
		{
			DelegateAction<Action> delegateAction = new DelegateAction<Action>
			{
				Method = method
			};
			delegateAction.Arg = ((FsmStateAction)delegateAction).Finish;
			state.InsertAction((FsmStateAction)(object)delegateAction, index);
		}

		[PublicAPI]
		public static void ReplaceAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index)
		{
			fsm.GetState(stateName).ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this PlayMakerFSM fsm, string stateName, int index, FsmStateAction action)
		{
			fsm.GetState(stateName).ReplaceAction(index, action);
		}

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

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

		[PublicAPI]
		public static void ReplaceAction(this FsmState state, FsmStateAction action, int index)
		{
			state.ReplaceAction(index, action);
		}

		[PublicAPI]
		public static void ReplaceAction(this FsmState state, int index, FsmStateAction action)
		{
			state.Actions[index] = action;
			action.Init(state);
		}

		[PublicAPI]
		public static void ReplaceAllActions(this PlayMakerFSM fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).ReplaceAllActions(actions);
		}

		[PublicAPI]
		public static void ReplaceAllActions(this Fsm fsm, string stateName, params FsmStateAction[] actions)
		{
			fsm.GetState(stateName).ReplaceAllActions(actions);
		}

		[PublicAPI]
		public static void ReplaceAllActions(this FsmState state, params FsmStateAction[] actions)
		{
			state.Actions = actions;
			foreach (FsmStateAction val in actions)
			{
				val.Init(state);
			}
		}

		[PublicAPI]
		public static bool ChangeTransition(this PlayMakerFSM fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).ChangeTransition(eventName, toState);
		}

		[PublicAPI]
		public static bool ChangeTransition(this Fsm fsm, string stateName, string eventName, string toState)
		{
			return fsm.GetState(stateName).ChangeTransition(eventName, toState);
		}

		[PublicAPI]
		public static bool ChangeTransition(this FsmState state, string eventName, string toState)
		{
			FsmTransition transition = state.GetTransition(eventName);
			if (transition == null)
			{
				return false;
			}
			transition.ToState = toState;
			transition.ToFsmState = state.Fsm.GetState(toState);
			return true;
		}

		[PublicAPI]
		public static bool ChangeGlobalTransition(this PlayMakerFSM fsm, string globalEventName, string toState)
		{
			return fsm.Fsm.ChangeGlobalTransition(globalEventName, toState);
		}

		[PublicAPI]
		public static bool ChangeGlobalTransition(this Fsm fsm, string globalEventName, string toState)
		{
			FsmTransition globalTransition = fsm.GetGlobalTransition(globalEventName);
			if (globalTransition == null)
			{
				return false;
			}
			globalTransition.ToState = toState;
			globalTransition.ToFsmState = fsm.GetState(toState);
			return true;
		}

		private static TVal[] RemoveItemsFromArray<TVal>(TVal[] origArray, Func<TVal, bool> shouldBeRemovedCallback)
		{
			int num = 0;
			foreach (TVal arg in origArray)
			{
				if (shouldBeRemovedCallback(arg))
				{
					num++;
				}
			}
			if (num == 0)
			{
				return origArray;
			}
			TVal[] array = new TVal[origArray.Length - num];
			for (int num2 = origArray.Length - 1; num2 >= 0; num2--)
			{
				TVal val = origArray[num2];
				if (shouldBeRemovedCallback(val))
				{
					num--;
				}
				else
				{
					array[num2 - num] = val;
				}
			}
			return array;
		}

		[PublicAPI]
		public static void RemoveState(this PlayMakerFSM fsm, string stateName)
		{
			fsm.Fsm.RemoveState(stateName);
		}

		[PublicAPI]
		public static void RemoveState(this Fsm fsm, string stateName)
		{
			fsm.States = RemoveItemsFromArray(fsm.States, (FsmState x) => x.Name == stateName);
		}

		[PublicAPI]
		public static void RemoveTransition(this PlayMakerFSM fsm, string stateName, string eventName)
		{
			fsm.GetState(stateName).RemoveTransition(eventName);
		}

		[PublicAPI]
		public static void RemoveTransition(this Fsm fsm, string stateName, string eventName)
		{
			fsm.GetState(stateName).RemoveTransition(eventName);
		}

		[PublicAPI]
		public static void RemoveTransition(this FsmState state, string eventName)
		{
			state.Transitions = RemoveItemsFromArray(state.Transitions, (FsmTransition x) => x.EventName == eventName);
		}

		[PublicAPI]
		public static void RemoveGlobalTransition(this PlayMakerFSM fsm, string globalEventName)
		{
			fsm.Fsm.RemoveGlobalTransition(globalEventName);
		}

		[PublicAPI]
		public static void RemoveGlobalTransition(this Fsm fsm, string globalEventName)
		{
			fsm.GlobalTransitions = RemoveItemsFromArray(fsm.GlobalTransitions, (FsmTransition x) => x.EventName == globalEventName);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this PlayMakerFSM fsm, string toState)
		{
			fsm.Fsm.RemoveTransitionsTo(toState);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this Fsm fsm, string toState)
		{
			FsmState[] states = fsm.States;
			foreach (FsmState state in states)
			{
				state.RemoveTransitionsTo(toState);
			}
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this PlayMakerFSM fsm, string stateName, string toState)
		{
			fsm.GetState(stateName).RemoveTransitionsTo(toState);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this Fsm fsm, string stateName, string toState)
		{
			fsm.GetState(stateName).RemoveTransitionsTo(toState);
		}

		[PublicAPI]
		public static void RemoveTransitionsTo(this FsmState state, string toState)
		{
			state.Transitions = RemoveItemsFromArray(state.Transitions, (FsmTransition x) => x.ToState == toState);
		}

		[PublicAPI]
		public static void RemoveTransitions(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveTransitions();
		}

		[PublicAPI]
		public static void RemoveTransitions(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveTransitions();
		}

		[PublicAPI]
		public static void RemoveTransitions(this FsmState state)
		{
			state.Transitions = Array.Empty<FsmTransition>();
		}

		[PublicAPI]
		public static bool RemoveAction(this PlayMakerFSM fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).RemoveAction(index);
		}

		[PublicAPI]
		public static bool RemoveAction(this Fsm fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).RemoveAction(index);
		}

		[PublicAPI]
		public static bool RemoveAction(this FsmState state, int index)
		{
			FsmStateAction[] actions = state.Actions;
			if (index < 0 || index >= actions.Length)
			{
				return false;
			}
			FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[actions.Length - 1];
			int num = array.Length;
			for (int i = 0; i < index; i++)
			{
				array[i] = actions[i];
			}
			for (int i = index; i < num; i++)
			{
				array[i] = actions[i + 1];
			}
			state.Actions = array;
			return true;
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this PlayMakerFSM fsm)
		{
			fsm.Fsm.RemoveActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this Fsm fsm)
		{
			FsmState[] states = fsm.States;
			foreach (FsmState state in states)
			{
				state.RemoveActionsOfType<TAction>();
			}
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveActionsOfType<TAction>(this FsmState state)
		{
			state.Actions = RemoveItemsFromArray(state.Actions, (FsmStateAction x) => x is TAction);
		}

		[PublicAPI]
		public static void RemoveFirstActionOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveFirstActionOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveFirstActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveFirstActionOfType<TAction>(this FsmState state)
		{
			int num = -1;
			for (int i = 0; i < state.Actions.Length; i++)
			{
				if (state.Actions[i] is TAction)
				{
					num = i;
					break;
				}
			}
			if (num != -1)
			{
				state.RemoveAction(num);
			}
		}

		[PublicAPI]
		public static void RemoveLastActionOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveLastActionOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).RemoveLastActionOfType<TAction>();
		}

		[PublicAPI]
		public static void RemoveLastActionOfType<TAction>(this FsmState state)
		{
			int num = -1;
			for (int num2 = state.Actions.Length - 1; num2 >= 0; num2--)
			{
				if (state.Actions[num2] is TAction)
				{
					num = num2;
					break;
				}
			}
			if (num != -1)
			{
				state.RemoveAction(num);
			}
		}

		[PublicAPI]
		public static bool DisableAction(this PlayMakerFSM fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).DisableAction(index);
		}

		[PublicAPI]
		public static bool DisableAction(this Fsm fsm, string stateName, int index)
		{
			return fsm.GetState(stateName).DisableAction(index);
		}

		[PublicAPI]
		public static bool DisableAction(this FsmState state, int index)
		{
			if (index < 0 || index >= state.Actions.Length)
			{
				return false;
			}
			state.Actions[index].Enabled = false;
			return true;
		}

		[PublicAPI]
		public static bool DisableActions(this PlayMakerFSM fsm, string stateName, params int[] indices)
		{
			return fsm.GetState(stateName).DisableActions(indices);
		}

		[PublicAPI]
		public static bool DisableActions(this Fsm fsm, string stateName, params int[] indices)
		{
			return fsm.GetState(stateName).DisableActions(indices);
		}

		[PublicAPI]
		public static bool DisableActions(this FsmState state, params int[] indices)
		{
			bool flag = true;
			foreach (int index in indices)
			{
				flag = flag && state.DisableAction(index);
			}
			return flag;
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this PlayMakerFSM fsm)
		{
			fsm.Fsm.DisableActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this Fsm fsm)
		{
			FsmState[] states = fsm.States;
			foreach (FsmState state in states)
			{
				state.DisableActionsOfType<TAction>();
			}
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName)
		{
			fsm.GetState(stateName).DisableActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this Fsm fsm, string stateName)
		{
			fsm.GetState(stateName).DisableActionsOfType<TAction>();
		}

		[PublicAPI]
		public static void DisableActionsOfType<TAction>(this FsmState state)
		{
			FsmStateAction[] actions = state.Actions;
			foreach (FsmStateAction val in actions)
			{
				if (val is TAction)
				{
					val.Enabled = false;
				}
			}
		}

		private static TVar[] MakeNewVariableArray<TVar>(TVar[] orig, string name) where TVar : NamedVariable, new()
		{
			TVar[] array = new TVar[orig.Length + 1];
			orig.CopyTo(array, 0);
			int num = orig.Length;
			TVar val = new TVar();
			((NamedVariable)val).name = name;
			array[num] = val;
			return array;
		}

		[PublicAPI]
		public static FsmFloat AddFloatVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddFloatVariable(name);
		}

		[PublicAPI]
		public static FsmFloat AddFloatVariable(this Fsm fsm, string name)
		{
			FsmFloat[] array = MakeNewVariableArray<FsmFloat>(fsm.Variables.FloatVariables, name);
			fsm.Variables.FloatVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmInt AddIntVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddIntVariable(name);
		}

		[PublicAPI]
		public static FsmInt AddIntVariable(this Fsm fsm, string name)
		{
			FsmInt[] array = MakeNewVariableArray<FsmInt>(fsm.Variables.IntVariables, name);
			fsm.Variables.IntVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmBool AddBoolVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddBoolVariable(name);
		}

		[PublicAPI]
		public static FsmBool AddBoolVariable(this Fsm fsm, string name)
		{
			FsmBool[] array = MakeNewVariableArray<FsmBool>(fsm.Variables.BoolVariables, name);
			fsm.Variables.BoolVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmString AddStringVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddStringVariable(name);
		}

		[PublicAPI]
		public static FsmString AddStringVariable(this Fsm fsm, string name)
		{
			FsmString[] array = MakeNewVariableArray<FsmString>(fsm.Variables.StringVariables, name);
			fsm.Variables.StringVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmVector2 AddVector2Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector2 AddVector2Variable(this Fsm fsm, string name)
		{
			FsmVector2[] array = MakeNewVariableArray<FsmVector2>(fsm.Variables.Vector2Variables, name);
			fsm.Variables.Vector2Variables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmVector3 AddVector3Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddVector3Variable(name);
		}

		[PublicAPI]
		public static FsmVector3 AddVector3Variable(this Fsm fsm, string name)
		{
			FsmVector3[] array = MakeNewVariableArray<FsmVector3>(fsm.Variables.Vector3Variables, name);
			fsm.Variables.Vector3Variables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmColor AddColorVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddColorVariable(name);
		}

		[PublicAPI]
		public static FsmColor AddColorVariable(this Fsm fsm, string name)
		{
			FsmColor[] array = MakeNewVariableArray<FsmColor>(fsm.Variables.ColorVariables, name);
			fsm.Variables.ColorVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmRect AddRectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddRectVariable(name);
		}

		[PublicAPI]
		public static FsmRect AddRectVariable(this Fsm fsm, string name)
		{
			FsmRect[] array = MakeNewVariableArray<FsmRect>(fsm.Variables.RectVariables, name);
			fsm.Variables.RectVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmQuaternion AddQuaternionVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion AddQuaternionVariable(this Fsm fsm, string name)
		{
			FsmQuaternion[] array = MakeNewVariableArray<FsmQuaternion>(fsm.Variables.QuaternionVariables, name);
			fsm.Variables.QuaternionVariables = array;
			return array[^1];
		}

		[PublicAPI]
		public static FsmGameObject AddGameObjectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.AddGameObjectVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject AddGameObjectVariable(this Fsm fsm, string name)
		{
			FsmGameObject[] array = MakeNewVariableArray<FsmGameObject>(fsm.Variables.GameObjectVariables, name);
			fsm.Variables.GameObjectVariables = array;
			return array[^1];
		}

		private static TVar? FindInVariableArray<TVar>(TVar[] orig, string name) where TVar : NamedVariable, new()
		{
			foreach (TVar val in orig)
			{
				if (((NamedVariable)val).Name == name)
				{
					return val;
				}
			}
			return default(TVar);
		}

		[PublicAPI]
		public static FsmFloat? FindFloatVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindFloatVariable(name);
		}

		[PublicAPI]
		public static FsmFloat? FindFloatVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmFloat>(fsm.Variables.FloatVariables, name);
		}

		[PublicAPI]
		public static FsmInt? FindIntVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindIntVariable(name);
		}

		[PublicAPI]
		public static FsmInt? FindIntVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmInt>(fsm.Variables.IntVariables, name);
		}

		[PublicAPI]
		public static FsmBool? FindBoolVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindBoolVariable(name);
		}

		[PublicAPI]
		public static FsmBool? FindBoolVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmBool>(fsm.Variables.BoolVariables, name);
		}

		[PublicAPI]
		public static FsmString? FindStringVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindStringVariable(name);
		}

		[PublicAPI]
		public static FsmString? FindStringVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmString>(fsm.Variables.StringVariables, name);
		}

		[PublicAPI]
		public static FsmVector2? FindVector2Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector2? FindVector2Variable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmVector2>(fsm.Variables.Vector2Variables, name);
		}

		[PublicAPI]
		public static FsmVector3? FindVector3Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindVector3Variable(name);
		}

		[PublicAPI]
		public static FsmVector3? FindVector3Variable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmVector3>(fsm.Variables.Vector3Variables, name);
		}

		[PublicAPI]
		public static FsmColor? FindColorVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindColorVariable(name);
		}

		[PublicAPI]
		public static FsmColor? FindColorVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmColor>(fsm.Variables.ColorVariables, name);
		}

		[PublicAPI]
		public static FsmRect? FindRectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindRectVariable(name);
		}

		[PublicAPI]
		public static FsmRect? FindRectVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmRect>(fsm.Variables.RectVariables, name);
		}

		[PublicAPI]
		public static FsmQuaternion? FindQuaternionVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion? FindQuaternionVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmQuaternion>(fsm.Variables.QuaternionVariables, name);
		}

		[PublicAPI]
		public static FsmGameObject? FindGameObjectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.FindGameObjectVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject? FindGameObjectVariable(this Fsm fsm, string name)
		{
			return FindInVariableArray<FsmGameObject>(fsm.Variables.GameObjectVariables, name);
		}

		[PublicAPI]
		public static FsmFloat GetFloatVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetFloatVariable(name);
		}

		[PublicAPI]
		public static FsmFloat GetFloatVariable(this Fsm fsm, string name)
		{
			FsmFloat val = fsm.FindFloatVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddFloatVariable(name);
		}

		[PublicAPI]
		public static FsmInt GetIntVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetIntVariable(name);
		}

		[PublicAPI]
		public static FsmInt GetIntVariable(this Fsm fsm, string name)
		{
			FsmInt val = fsm.FindIntVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddIntVariable(name);
		}

		[PublicAPI]
		public static FsmBool GetBoolVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetBoolVariable(name);
		}

		[PublicAPI]
		public static FsmBool GetBoolVariable(this Fsm fsm, string name)
		{
			FsmBool val = fsm.FindBoolVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddBoolVariable(name);
		}

		[PublicAPI]
		public static FsmString GetStringVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetStringVariable(name);
		}

		[PublicAPI]
		public static FsmString GetStringVariable(this Fsm fsm, string name)
		{
			FsmString val = fsm.FindStringVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddStringVariable(name);
		}

		[PublicAPI]
		public static FsmVector2 GetVector2Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector2 GetVector2Variable(this Fsm fsm, string name)
		{
			FsmVector2 val = fsm.FindVector2Variable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddVector2Variable(name);
		}

		[PublicAPI]
		public static FsmVector3 GetVector3Variable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetVector3Variable(name);
		}

		[PublicAPI]
		public static FsmVector3 GetVector3Variable(this Fsm fsm, string name)
		{
			FsmVector3 val = fsm.FindVector3Variable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddVector3Variable(name);
		}

		[PublicAPI]
		public static FsmColor GetColorVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetColorVariable(name);
		}

		[PublicAPI]
		public static FsmColor GetColorVariable(this Fsm fsm, string name)
		{
			FsmColor val = fsm.FindColorVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddColorVariable(name);
		}

		[PublicAPI]
		public static FsmRect GetRectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetRectVariable(name);
		}

		[PublicAPI]
		public static FsmRect GetRectVariable(this Fsm fsm, string name)
		{
			FsmRect val = fsm.FindRectVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddRectVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion GetQuaternionVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmQuaternion GetQuaternionVariable(this Fsm fsm, string name)
		{
			FsmQuaternion val = fsm.FindQuaternionVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddQuaternionVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject GetGameObjectVariable(this PlayMakerFSM fsm, string name)
		{
			return fsm.Fsm.GetGameObjectVariable(name);
		}

		[PublicAPI]
		public static FsmGameObject GetGameObjectVariable(this Fsm fsm, string name)
		{
			FsmGameObject val = fsm.FindGameObjectVariable(name);
			if (val != null)
			{
				return val;
			}
			return fsm.AddGameObjectVariable(name);
		}
	}
	internal static class ImageUtil
	{
		public static byte[] GetBytesFromResources(this Assembly asm, string fileName)
		{
			string[] manifestResourceNames = asm.GetManifestResourceNames();
			string[] array = manifestResourceNames;
			foreach (string text in array)
			{
				if (!text.EndsWith(fileName))
				{
					continue;
				}
				using Stream stream = asm.GetManifestResourceStream(text);
				if (stream == null)
				{
					continue;
				}
				byte[] array2 = new byte[stream.Length];
				stream.Read(array2, 0, array2.Length);
				stream.Dispose();
				return array2;
			}
			return null;
		}

		public static Texture2D GetTextureFromResources(string fileName)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			Texture2D val = new Texture2D(2, 2);
			byte[] bytesFromResources = Assembly.GetCallingAssembly().GetBytesFromResources(fileName);
			if (bytesFromResources == null)
			{
				return null;
			}
			ImageConversion.LoadImage(val, bytesFromResources);
			val.Apply();
			return val;
		}
	}
	public class InvokeCoroutine : FsmStateAction
	{
		private readonly Func<IEnumerator> _coroutine;

		private readonly bool _wait;

		public InvokeCoroutine(Func<IEnumerator> coroutine, bool wait)
		{
			_coroutine = coroutine;
			_wait = wait;
		}

		private IEnumerator Coroutine()
		{
			yield return _coroutine();
			((FsmStateAction)this).Finish();
		}

		public override void OnEnter()
		{
			((FsmStateAction)this).Fsm.Owner.StartCoroutine(_wait ? Coroutine() : _coroutine());
			if (!_wait)
			{
				((FsmStateAction)this).Finish();
			}
		}
	}
	public class InvokeMethod : FsmStateAction
	{
		private readonly Action _action;

		public InvokeMethod(Action action)
		{
			_action = action;
		}

		public override void OnEnter()
		{
			_action();
			((FsmStateAction)this).Finish();
		}
	}
	public class Audioplayer
	{
		public void PlayOneShotDelay(GameObject audio, Vector3 origin, AudioClip clip, float delay)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)GameManager.instance).StartCoroutine(PlayAndRecycle());
			IEnumerator PlayAndRecycle()
			{
				GameObject audioPlayer = ObjectPoolExtensions.Spawn(audio, origin);
				AudioSource audioSource = audioPlayer.GetComponent<AudioSource>();
				audioSource.clip = clip;
				audioSource.pitch = 1f;
				audioSource.volume = 2f;
				yield return (object)new WaitForSeconds(delay);
				audioSource.Play();
				yield return (object)new WaitForSeconds(clip.length);
				audioSource.clip = null;
			}
		}

		public void PlayOneShot(GameObject audio, Vector3 origin, AudioClip clip)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			PlayOneShotDelay(audio, origin, clip, 0.1f);
		}
	}
	[RequireComponent(typeof(tk2dSpriteAnimator))]
	[RequireComponent(typeof(PlayMakerFSM))]
	internal class FraudLaceBoss : MonoBehaviour
	{
		private tk2dSpriteAnimator? LLaceAnim;

		private PlayMakerFSM? _control;

		private PlayMakerFSM? _bullet;

		private PlayMakerFSM? _phase;

		private PlayMakerFSM? _title;

		private GameObject? LLace;

		private GameObject? title;

		private GameObject? scene;

		private GameObject? abysswave;

		private GameObject? whipG;

		private GameObject? whipA;

		private GameObject? glob;

		private GameObject? voidhole1;

		private GameObject? web;

		private List<ModifierBase>? AllModifiers;

		private void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.transform.localScale = new Vector3(1.2f, 1.2f, 1.2f);
			ComponentGetter();
			((MonoBehaviour)this).StartCoroutine(Health());
			ApplyAllModifiers();
		}

		private void ComponentGetter()
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			LLaceAnim = ((Component)this).GetComponent<tk2dSpriteAnimator>();
			_control = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Control");
			_bullet = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Summon Bullets");
			_phase = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Death Control");
			scene = ((Component)((Component)this).gameObject.transform.parent).gameObject;
			LLace = ((Component)this).gameObject;
			whipG = ((Component)((Component)this).gameObject.transform.Find("Whip Attack G")).gameObject;
			whipA = ((Component)((Component)this).gameObject.transform.Find("Whip Attack A")).gameObject;
			web = ((Component)scene.transform.Find("Black Thread Attack (deprecated)")).gameObject;
			FsmState? state = _control.GetState("Vomit Fire");
			glob = ((state != null) ? state.GetAction<SpawnObjectFromGlobalPool>(4).gameObject.Value : null);
			voidhole1 = VoidholeSetup(new Vector3(30f, 16f, 0f));
			title = ((Component)scene.transform.Find("Boss Title")).gameObject;
			abysswave = ((Component)scene.transform.Find("Abyss Wave")).gameObject;
			_title = FSMUtility.LocateMyFSM(title, "Title Control");
		}

		private GameObject VoidholeSetup(Vector3 pos)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0094: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(ImportLoader.GetVoidHole(), pos, Quaternion.Euler(0f, 0f, -90f));
			val.transform.localScale = new Vector3(2.5f, 2.5f, 2.5f);
			GameObject val2 = Object.Instantiate<GameObject>(ImportLoader.GetVoidAura(), pos + new Vector3(-2f, 2.5f, 0f), Quaternion.Euler(0f, 0f, 180f));
			GameObject val3 = Object.Instantiate<GameObject>(ImportLoader.GetVoidAura(), pos + new Vector3(-2f, -2f, 0f), Quaternion.identity);
			GameObject[] array = (GameObject[])(object)new GameObject[2] { val2, val3 };
			foreach (GameObject val4 in array)
			{
				val4.transform.localScale = new Vector3(0.23f, 2f, 2f);
				Object.Destroy((Object)(object)((Component)val4.transform.Find("Edge R")).gameObject);
				Object.Destroy((Object)(object)((Component)val4.transform.Find("Edge L")).gameObject);
				val4.transform.SetParent(val.transform);
				val4.SetActive(true);
			}
			return val;
		}

		private void ApplyAllModifiers()
		{
			AllModifiers = new List<ModifierBase>(14)
			{
				new SpeedModifier(_control, LLaceAnim),
				new TripleSlashModifier(_control, voidhole1),
				new WhipsModifier(_control, whipG, whipA, voidhole1),
				new GroundTendrilsModifier(_control),
				new AttackChoiceModifier(_control),
				new JumpSlashModifier(_control, LLace, glob),
				new ChargeModifier(_control, voidhole1),
				new CircleSlashModifier(_control, _bullet),
				new SpitModifier(_control, voidhole1),
				new ShootModifier(_control, _bullet, voidhole1),
				new TitleModifier(_title, title),
				new VoidHole(voidhole1),
				new VoidRain(_control, glob, abysswave),
				new VoidWebs(_control, web)
			};
			foreach (ModifierBase allModifier in AllModifiers)
			{
				allModifier.StartModifier();
			}
			_control.GetState("P2 Shift 1").AddMethod(delegate
			{
				foreach (ModifierBase allModifier2 in AllModifiers)
				{
					allModifier2.Phase2Modifier();
				}
			});
			_control.GetState("P3 Roar").AddMethod(delegate
			{
				foreach (ModifierBase allModifier3 in AllModifiers)
				{
					allModifier3.Phase3Modifier();
				}
			});
			_control.GetState("P4 Shift 1").AddMethod(delegate
			{
				foreach (ModifierBase allModifier4 in AllModifiers)
				{
					allModifier4.Phase4Modifier();
				}
			});
		}

		private IEnumerator Health()
		{
			yield return (object)new WaitForSeconds(0.5f);
			((Component)this).gameObject.GetComponent<HealthManager>().hp = Constants.LLHP1;
			_control.fsm.GetFsmInt("P2 HP").Value = Constants.LLHP2;
			_control.fsm.GetFsmInt("P3 HP").Value = Constants.LLHP3;
			_control.fsm.GetFsmInt("P4 HP").Value = Constants.LLHP4;
			_phase.fsm.GetFsmInt("P2 HP").Value = Constants.LLHP2;
			_phase.fsm.GetFsmInt("P3 HP").Value = Constants.LLHP3;
			_phase.GetState("Can Die?").AddMethod(delegate
			{
				if (Object.op_Implicit((Object)(object)voidhole1))
				{
					Object.Destroy((Object)(object)voidhole1);
				}
			});
		}
	}
	internal class ImportLoader : MonoBehaviour
	{
		internal static GameObject? voidaura;

		internal static GameObject? voidsound;

		internal static GameObject? voidhole;

		internal static GameObject voidholeanim;

		internal static AudioClip webaudio;

		internal static AudioClip webaudio2;

		internal static RuntimeAnimatorController voidauraanim;

		internal static Texture2D holeTex = ImageUtil.GetTextureFromResources("voidhole.png");

		private IEnumerator Start()
		{
			yield return AssetManager.LoadBundleAssets();
			voidaura = ((Component)AssetManager.Get<GameObject>("Boss Scene").transform.Find("Soul_Snare").Find("Void Portal").Find("Hole")).gameObject;
			voidsound = AssetManager.Get<GameObject>("Black Thread Start Enemy Effect");
			voidhole = AssetManager.Get<GameObject>("Abyss Mass");
			voidholeanim = AssetManager.Get<GameObject>("Abyss Mass Anim");
			webaudio = AssetManager.Get<AudioClip>("silk_boss_web_attack_buildup");
			webaudio2 = AssetManager.Get<AudioClip>("silk_boss_web_attack_burst");
			Object.Destroy((Object)(object)((Component)voidaura.transform.Find("Hole")).gameObject);
			Object.Destroy((Object)(object)((Component)voidaura.transform.Find("Pt Shade")).gameObject);
			Object.Destroy((Object)(object)((Component)voidaura.transform.Find("abyss_water_top")).gameObject);
			Object.Destroy((Object)(object)((Component)voidhole.transform.Find("Enemy Physics Pusher (Abyss Mass)")).gameObject);
			Object.Destroy((Object)(object)voidhole.GetComponent<Recoil>());
			voidauraanim = AssetManager.Get<RuntimeAnimatorController>("abyss_water_70_percent0001");
			voidaura.GetComponent<Animator>().runtimeAnimatorController = voidauraanim;
			voidhole.GetComponent<tk2dSpriteAnimator>().Library = voidholeanim.GetComponent<tk2dSpriteAnimation>();
			ApplyTextureToTk2dSprite(voidhole, holeTex);
			Debug.Log((object)"EVERYTHING loaded in!");
		}

		internal static GameObject GetVoidAura()
		{
			return voidaura;
		}

		internal static GameObject GetVoidSound()
		{
			return voidsound;
		}

		internal static GameObject GetVoidHole()
		{
			return voidhole;
		}

		internal static AudioClip GetWebAudio()
		{
			return webaudio;
		}

		internal static AudioClip GetWebAudio2()
		{
			return webaudio2;
		}

		private void OnDestroy()
		{
			AssetManager.UnloadManualBundles();
		}

		private void ChangeTextures(GameObject target, Texture2D texture)
		{
			tk2dSprite component = ((Component)this).GetComponent<tk2dSprite>();
			tk2dSpriteCollectionData collection = ((tk2dBaseSprite)component).Collection;
			for (int i = 0; i < collection.materials.Length; i++)
			{
				collection.materials[i].mainTexture = (Texture)(object)AssetManager.Get<Texture2D>($"atlas{i}");
			}
		}

		public void ApplyTextureToTk2dSprite(GameObject target, Texture2D texture)
		{
			//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_0039: Expected O, but got Unknown
			tk2dSprite component = target.GetComponent<tk2dSprite>();
			tk2dSpriteCollectionSize component2 = ((Component)component).GetComponent<tk2dSpriteCollectionSize>();
			((tk2dBaseSprite)component).CurrentSprite.material.mainTexture = (Texture)(object)texture;
			Material material = new Material(Shader.Find("tk2d/BlendVertexColor"))
			{
				mainTexture = (Texture)(object)texture
			};
			((Component)component).GetComponent<Renderer>().material = material;
			((tk2dBaseSprite)component).ForceBuild();
		}
	}
	[BepInPlugin("FraudLace", "FraudLace", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony _harmony;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Debug.Log((object)"Plugin FraudLace (1.0.0) has loaded!");
			_harmony = new Harmony("1.0.0");
			MainPatches.Initialize();
			_harmony.PatchAll(typeof(MainPatches));
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
			AssetManager.UnloadAll();
		}
	}
}
namespace FraudLace.Patches
{
	internal static class LanguagePatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Language), "Get", new Type[]
		{
			typeof(string),
			typeof(string)
		})]
		private static void ChangeLLaceTitle(string key, string sheetTitle, ref string __result)
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			if (1 == 0)
			{
			}
			string text2;
			if (!(key == "LOST_LACE_MAIN"))
			{
				if (key == "LOST_LACE_SUPER")
				{
					LanguageCode val = Language.CurrentLanguage();
					if (1 == 0)
					{
					}
					string text = (((int)val != 117) ? __result : "중2병에 빠진");
					if (1 == 0)
					{
					}
					text2 = text;
				}
				else
				{
					text2 = __result;
				}
			}
			else
			{
				LanguageCode val2 = Language.CurrentLanguage();
				if (1 == 0)
				{
				}
				string text = (((int)val2 == 44) ? "Fraud Lace" : (((int)val2 != 117) ? __result : "레이스"));
				if (1 == 0)
				{
				}
				text2 = text;
			}
			if (1 == 0)
			{
			}
			__result = text2;
		}
	}
	internal static class MainPatches
	{
		private static Harmony _harmony;

		internal static GameObject mothersilk;

		internal static GameObject LostLace;

		internal static GameObject bullet;

		internal static GameObject gtendril;

		internal static void Initialize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("MainPatches");
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameManager), "Awake")]
		private static void InitAssetManager(GameManager __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(AssetManager.Init());
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[]
		{
			typeof(SaveGameData),
			typeof(int)
		})]
		private static void PatchLostLace(GameManager __instance)
		{
			__instance.GetSaveStatsForSlot(PlayerData.instance.profileID, (Action<SaveStats, string>)delegate
			{
				((Component)__instance).gameObject.AddComponent<ImportLoader>();
				_harmony.PatchAll(typeof(LanguagePatches));
			});
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		private static void ModifyLace(PlayMakerFSM __instance)
		{
			if (((Object)__instance).name == "Lost Lace Boss" && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<FraudLaceBoss>()))
			{
				((Component)__instance).gameObject.AddComponent<FraudLaceBoss>();
				LostLace = ((Component)__instance).gameObject;
				mothersilk = ((Component)((Component)__instance).gameObject.transform.parent.Find("Abyss_Cocoon_Silk")).gameObject;
			}
			if (((Object)__instance).name.Contains("Lost Lace Summon Bullet") && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<Bullets>()))
			{
				bullet = ((Component)__instance).gameObject;
				((Component)__instance).gameObject.AddComponent<Bullets>();
			}
			if (((Object)__instance).name.Contains("Lost Lace Ground Tendril") && !Object.op_Implicit((Object)(object)gtendril))
			{
				gtendril = ((Component)__instance).gameObject;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameManager), "ReturnToMainMenu")]
		private static IEnumerator Unpatch(IEnumerator result)
		{
			while (result.MoveNext())
			{
				yield return result.Current;
			}
			_harmony.UnpatchSelf();
		}
	}
}
namespace FraudLace.Modifiers
{
	internal class AttackChoiceModifier(PlayMakerFSM _control) : ModifierBase()
	{
		internal override void StartModifier()
		{
			FsmState state = _control.GetState("Attack Choice");
			state.RemoveAction(11);
			state.GetAction<SendRandomEventV4>(10).activeBool = FsmBool.op_Implicit(false);
		}

		internal override void Phase2Modifier()
		{
		}

		internal override void Phase3Modifier()
		{
		}

		internal override void Phase4Modifier()
		{
		}
	}
	internal class ChargeModifier(PlayMakerFSM _control, GameObject voidhole) : ModifierBase()
	{
		internal override void StartModifier()
		{
			FsmInt intVariable = _control.GetIntVariable("Charges Performed");
			FsmInt val = _control.AddIntVariable("Charge Count");
			FsmFloat val2 = _control.AddFloatVariable("Charge Speed");
			FsmFloat floatVariable = _control.GetFloatVariable("Charge Time");
			val.value = 4;
			FsmState state = _control.GetState("Charge Break");
			FsmState state2 = _control.AddState("Long Charge");
			FsmState state3 = _control.AddState("Quick Charge");
			state2.AddTransition("FINISHED", "Charge");
			state3.AddTransition("FINISHED", "Charge");
			FsmEvent val3 = state.AddTransition("L", "Long Charge");
			FsmEvent val4 = state.AddTransition("R", "Quick Charge");
			state.InsertAction(1, ActionUtil.SimpleRandomEvent((FsmEvent[])(object)new FsmEvent[2] { val3, val4 }, (FsmFloat[])(object)new FsmFloat[2]
			{
				FsmFloat.op_Implicit(0.5f),
				FsmFloat.op_Implicit(0.5f)
			}, (FsmInt[])(object)new FsmInt[2]
			{
				FsmInt.op_Implicit(1),
				FsmInt.op_Implicit(1)
			}, (FsmInt[])(object)new FsmInt[2]
			{
				FsmInt.op_Implicit(1),
				FsmInt.op_Implicit(1)
			}, _control.GetBoolVariable("Phase 2")));
			state2.AddActions(ActionUtil.IntSetter(val, FsmInt.op_Implicit(4)), ActionUtil.FloatSetter(floatVariable, FsmFloat.op_Implicit(0.5f)));
			state3.AddActions(ActionUtil.IntSetter(val, FsmInt.op_Implicit(8)), ActionUtil.FloatSetter(floatVariable, FsmFloat.op_Implicit(0.15f)));
			FsmEvent fsmEvent = FsmEvent.GetFsmEvent("COMBO");
			FsmEvent fsmEvent2 = FsmEvent.GetFsmEvent("FINISHED");
			_control.GetState("Charge Crossup?").RemoveAction(2);
			_control.GetState("Cross To New Move?").RemoveAction(0);
			_control.GetState("Charge Crossup?").InsertAction(2, ActionUtil.IntComparer(intVariable, val, fsmEvent, fsmEvent, null));
			_control.GetState("Cross To New Move?").InsertAction(0, ActionUtil.IntComparer(intVariable, val, fsmEvent2, null, fsmEvent2));
			_control.GetState("Charge").GetAction<SetVelocityByScale>(0).speed = FsmFloat.op_Implicit(100f);
			_control.GetState("Crossup Antic").RemoveAction(3);
			Debug.Log((object)"Charge Edit Done!");
		}

		internal override void Phase2Modifier()
		{
		}

		internal override void Phase3Modifier()
		{
			_control.GetState("Will Counter?").AddMethod(delegate
			{
				//IL_000b: 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_005b: Unknown result type (might be due to invalid IL or missing references)
				float x = HeroController.instance.transform.position.x;
				float x2 = voidhole.transform.position.x;
				voidhole.GetComponent<Rigidbody2D>().linearDamping = 0.5f;
				voidhole.GetComponent<Rigidbody2D>().AddForce(new Vector2((x - x2) * 0.5f, 0f), (ForceMode2D)1);
			});
		}

		internal override void Phase4Modifier()
		{
		}
	}
	internal class CircleSlashModifier : ModifierBase
	{
		private GameObject circle;

		internal int phase;

		public CircleSlashModifier(PlayMakerFSM _control, PlayMakerFSM _bullet)
		{
			<_bullet>P = _bullet;
			base..ctor();
		}

		internal override void StartModifier()
		{
			<_bullet>P.GetState("Catcher Start").InsertAction(4, (FsmStateAction)(object)new InvokeMethod(BlackSlash));
			<_bullet>P.GetState("Remaining Catchers").InsertAction(10, (FsmStateAction)(object)new InvokeMethod(BlackSlash));
			<_bullet>P.GetState("Remaining Catchers").InsertAction(6, (FsmStateAction)(object)new InvokeMethod(BlackSlash));
			<_bullet>P.GetState("Remaining Catchers").InsertAction(2, (FsmStateAction)(object)new InvokeMethod(BlackSlash));
			void BlackSlash()
			{
				GameObject value = <_bullet>P.fsm.GetFsmGameObject("Projectile").value;
				if (!Object.op_Implicit((Object)(object)value.GetComponent<BlackSlasher>()))
				{
					value.AddComponent<BlackSlasher>();
				}
				if (Object.op_Implicit((Object)(object)value.GetComponent<BlackSlasher>()))
				{
					value.GetComponent<BlackSlasher>().Dimmer(phase);
				}
			}
		}

		internal override void Phase2Modifier()
		{
			phase++;
		}

		internal override void Phase3Modifier()
		{
			phase++;
		}

		internal override void Phase4Modifier()
		{
			phase++;
		}
	}
	internal class BlackSlasher : MonoBehaviour
	{
		private SpriteRenderer circle1;

		private SpriteRenderer circle2;

		private SpriteRenderer circle3;

		private void Awake()
		{
			//IL_0080: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			circle1 = ((Component)((Component)this).gameObject.transform.Find("pointer glow")).gameObject.GetComponent<SpriteRenderer>();
			circle2 = ((Component)((Component)this).gameObject.transform.Find("pointer glow").Find("haze2")).gameObject.GetComponent<SpriteRenderer>();
			circle3 = ((Component)((Component)this).gameObject.transform.Find("cross slash range")).gameObject.GetComponent<SpriteRenderer>();
			circle1.color = Color.black;
			circle2.color = Color.black;
			circle3.color = Color.black;
			Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.Find("pointer glow").Find("Burst")).gameObject);
		}

		internal void Dimmer(int phase)
		{
			if (phase == 1)
			{
				((Component)((Component)this).gameObject.transform.Find("pointer glow")).gameObject.SetActive(false);
			}
			if (phase == 2)
			{
				((Component)((Component)this).gameObject.transform.Find("pointer glow")).gameObject.SetActive(true);
				((Component)((Component)this).gameObject.transform.Find("cross slash range")).gameObject.SetActive(false);
			}
			if (phase == 3)
			{
				((Component)((Component)this).gameObject.transform.Find("cross slash range")).gameObject.SetActive(false);
				((Component)((Component)this).gameObject.transform.Find("pointer glow")).gameObject.SetActive(false);
			}
		}
	}
	internal class SpitModifier(PlayMakerFSM _control, GameObject voidhole) : ModifierBase()
	{
		private FsmState? Fire;

		internal override void StartModifier()
		{
			FsmState? state = _control.GetState("Vomit Start");
			if (state != null)
			{
				state.GetAction<SetIntValue>(3).intValue = FsmInt.op_Implicit(Constants.globcount);
			}
			Fire = _control.GetState("Vomit Fire");
			Fire.GetAction<FloatAdd>(8).add = FsmFloat.op_Implicit(4.5f);
			Fire.GetAction<FloatAdd>(9).add = FsmFloat.op_Implicit(-4.5f);
			Fire.GetAction<Wait>(11).time = FsmFloat.op_Implicit(0.03f);
		}

		internal override void Phase2Modifier()
		{
			Fire.InsertAction(0, ActionUtil.RandomFloatSetter(_control.fsm.GetFsmFloat("Velocity Y"), 18f, 28f));
			Debug.Log((object)"GlobSpit P2");
		}

		internal override void Phase3Modifier()
		{
			Fire.AddActions(ActionUtil.EventSender(FsmGameObject.op_Implicit(voidhole), FsmString.op_Implicit("VOMIT")));
		}

		internal override void Phase4Modifier()
		{
		}
	}
	internal class GroundTendrilsModifier(PlayMakerFSM _control) : ModifierBase()
	{
		private FsmBool T2;

		internal override void StartModifier()
		{
			FsmState? state = _control.GetState("Summon Tendril");
			if (state != null)
			{
				state.GetAction<SetIntValue>(1).intValue = FsmInt.op_Implicit(Constants.tendrilcount);
			}
			FsmState? state2 = _control.GetState("Summon Loop");
			if (state2 != null)
			{
				state2.GetAction<FloatAddRandom>(0).addMin = FsmFloat.op_Implicit(-7f);
			}
			FsmState? state3 = _control.GetState("Summon Loop");
			if (state3 != null)
			{
				state3.GetAction<FloatAddRandom>(0).addMax = FsmFloat.op_Implicit(-7f);
			}
			FsmState? state4 = _control.GetState("Summon Loop");
			if (state4 != null)
			{
				state4.GetAction<FloatAddRandom>(3).addMin = FsmFloat.op_Implicit(7f);
			}
			FsmState? state5 = _control.GetState("Summon Loop");
			if (state5 != null)
			{
				state5.GetAction<FloatAddRandom>(3).addMax = FsmFloat.op_Implicit(7f);
			}
			FsmState state6 = _control.AddState("Tendril Again?");
			FsmState state7 = _control.AddState("Tendril Again Delay");
			T2 = _control.fsm.AddBoolVariable("Tendril Two");
			T2.value = true;
			FsmEvent val = state6.AddTransition("FINISHED", "Attack Choice");
			FsmEvent val2 = state6.AddTransition("RETENDRIL", "Tendril Again Delay");
			FsmEvent val3 = state7.AddTransition("FINISHED", "Summon Tendril");
			_control.ChangeTransition("Summon Thwip", "FINISHED", "Tendril Again?");
			state6.AddActions(ActionUtil.SimpleRandomEvent((FsmEvent[])(object)new FsmEvent[2] { val, val2 }, (FsmFloat[])(object)new FsmFloat[2]
			{
				FsmFloat.op_Implicit(0.5f),
				FsmFloat.op_Implicit(0.5f)
			}, (FsmInt[])(object)new FsmInt[2]
			{
				FsmInt.op_Implicit(1),
				FsmInt.op_Implicit(1)
			}, (FsmInt[])(object)new FsmInt[2]
			{
				FsmInt.op_Implicit(1),
				FsmInt.op_Implicit(1)
			}, T2));
			state7.AddAction(ActionUtil.Waiter(0.75f));
		}

		internal override void Phase2Modifier()
		{
			T2.value = true;
		}

		internal override void Phase3Modifier()
		{
		}

		internal override void Phase4Modifier()
		{
		}
	}
	internal class JumpSlashModifier(PlayMakerFSM _control, GameObject lace, GameObject glob) : ModifierBase()
	{
		internal override void StartModifier()
		{
			FsmState state = _control.GetState("J Slash Multi");
			state.GetAction<SetVelocityAsAngle>(7).speed = FsmFloat.op_Implicit(100f);
			state.AddAction((FsmStateAction)(object)new InvokeCoroutine(JumpGlobspawn, wait: false));
			_control.GetState("Downstab").GetAction<SetVelocityAsAngle>(0).speed = FsmFloat.op_Implicit(80f);
		}

		internal override void Phase2Modifier()
		{
			_control.GetState("Downstab Land").ChangeTransition("FINISHED", "Slam");
		}

		internal override void Phase3Modifier()
		{
		}

		internal override void Phase4Modifier()
		{
		}

		private IEnumerator JumpGlobspawn()
		{
			for (int i = 0; i < 4; i++)
			{
				yield return (object)new WaitForSeconds(0.2f);
				GameObject dropglob = Object.Instantiate<GameObject>(glob, lace.transform.position, Quaternion.identity);
				dropglob.SetActive(true);
			}
		}
	}
	internal class ShootModifier(PlayMakerFSM _control, PlayMakerFSM _bullet, GameObject voidhole) : ModifierBase()
	{
		private int bulletcount = 20;

		internal override void StartModifier()
		{
			_bullet.GetState("Set Amount").GetAction<SetIntValue>(0).intValue = FsmInt.op_Implicit(bulletcount);
			_bullet.GetState("Start Pause").GetAction<Wait>(0).time = FsmFloat.op_Implicit(Constants.bulletdelay);
			_bullet.GetState("Repeat Pause").GetAction<Wait>(0).time = FsmFloat.op_Implicit(Constants.bulletdelay);
		}

		internal override void Phase2Modifier()
		{
			bulletcount = 15;
			_bullet.GetState("Set Pos").GetAction<RandomFloat>(0).min = FsmFloat.op_Implicit(8f);
		}

		internal override void Phase3Modifier()
		{
			_control.GetState("Bullet S Type").RemoveAction(1);
			_control.GetState("Bullet S Type").InsertAction(0, ActionUtil.EventSender(FsmGameObject.op_Implicit(voidhole), FsmString.op_Implicit("SHOT")));
		}

		internal override void Phase4Modifier()
		{
		}
	}
	[RequireComponent(typeof(PlayMakerFSM))]
	internal class Bullets : MonoBehaviour
	{
		private void Awake()
		{
			FsmState state = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Control").GetState("Antic");
			state.GetAction<Wait>(1).time = FsmFloat.op_Implicit(0.5f);
			state.GetAc