Decompiled source of LostSinner v0.4.0

LostSinner.dll

Decompiled 4 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 BepInEx.Logging;
using GlobalEnums;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using LostSinner.Behaviours;
using LostSinner.Patches;
using Microsoft.CodeAnalysis;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LostSinner")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0+393a75bbfd44234246eb8cf97cb4703397227e0d")]
[assembly: AssemblyProduct("LostSinner")]
[assembly: AssemblyTitle("LostSinner")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LostSinner
{
	internal static class AssetManager
	{
		private static string[] _bundleNames = new string[1] { "localpoolprefabs_assets_laceboss" };

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

		private static string[] _assetNames = new string[4] { "Abyss Vomit Glob", "Audio Player Actor Simple", "Lost Lace Ground Tendril", "mini_mawlek_spit" };

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

		private static bool _initialized;

		internal static IEnumerator Initialize()
		{
			if (_initialized)
			{
				yield break;
			}
			_initialized = true;
			foreach (AssetBundle bundle in AssetBundle.GetAllLoadedAssetBundles())
			{
				string[] allAssetNames = bundle.GetAllAssetNames();
				foreach (string assetPath in allAssetNames)
				{
					if (!_assetNames.Any((string objName) => assetPath.Contains(objName)))
					{
						continue;
					}
					AssetBundleRequest assetLoadHandle = bundle.LoadAssetAsync(assetPath);
					yield return assetLoadHandle;
					Object asset = assetLoadHandle.asset;
					if (!(asset != (Object)null))
					{
						continue;
					}
					Type type = ((object)asset).GetType();
					string name = asset.name;
					if (Assets.ContainsKey(type))
					{
						Dictionary<string, Object> dictionary = Assets[type];
						if (dictionary != null)
						{
							if (dictionary.ContainsKey(name))
							{
								if (dictionary[name] != (Object)null)
								{
									Log.Warn($"There is already an asset \"{name}\" of type \"{type}\"!");
									continue;
								}
								Log.Info($"Key \"{name}\" for sub-dictionary of type \"{type}\" exists, but its value is null; Replacing with new asset...");
								Assets[type][name] = asset;
							}
							else
							{
								Log.Debug($"Adding asset {name} of type {type}...");
								Assets[type].Add(name, asset);
							}
						}
						else
						{
							Assets.Add(type, new Dictionary<string, Object>());
						}
					}
					else
					{
						Assets.Add(type, new Dictionary<string, Object> { [name] = asset });
						Log.Debug($"Added new sub-dictionary of type {type} with initial asset {name}.");
					}
				}
			}
		}

		internal static IEnumerator ManuallyLoadBundles()
		{
			string[] bundleNames = _bundleNames;
			foreach (string bundleName in bundleNames)
			{
				if (AssetBundle.GetAllLoadedAssetBundles().Any((AssetBundle bundle) => ((Object)bundle).name == bundleName))
				{
					continue;
				}
				RuntimePlatform platform = Application.platform;
				string text = (((int)platform == 1) ? "StandaloneOSX" : (((int)platform == 2) ? "StandaloneWindows64" : (((int)platform != 13) ? "" : "StandaloneLinux64")));
				string path = text;
				string text2 = Path.Combine(Addressables.RuntimePath, path, bundleName + ".bundle");
				AssetBundleCreateRequest bundleLoadRequest = AssetBundle.LoadFromFileAsync(text2);
				yield return bundleLoadRequest;
				AssetBundle assetBundle = bundleLoadRequest.assetBundle;
				_manuallyLoadedBundles.Add(assetBundle);
				string[] allAssetNames = assetBundle.GetAllAssetNames();
				foreach (string text3 in allAssetNames)
				{
					string[] assetNames = _assetNames;
					foreach (string assetName in assetNames)
					{
						if (!text3.Contains(assetName))
						{
							continue;
						}
						AssetBundleRequest assetLoadRequest = assetBundle.LoadAssetAsync(text3);
						((AsyncOperation)assetLoadRequest).completed += delegate
						{
							Object asset = assetLoadRequest.asset;
							GameObject val = (GameObject)(object)((asset is GameObject) ? asset : null);
							if (val != null && asset.name == "Lost Lace Ground Tendril")
							{
								ConstrainPosition component = val.GetComponent<ConstrainPosition>();
								component.xMax = 100f;
								component.yMin = 0f;
								component.yMax = 100f;
								FsmState[] fsmStates = FSMUtility.LocateMyFSM(val, "Control").FsmStates;
								foreach (FsmState val2 in fsmStates)
								{
									if (val2.Name == "Antic")
									{
										FsmStateAction[] actions = val2.Actions;
										FsmStateAction[] array = actions;
										foreach (FsmStateAction val3 in array)
										{
											SetFloatValue val4 = (SetFloatValue)(object)((val3 is SetFloatValue) ? val3 : null);
											if (val4 == null)
											{
												EaseFloat val5 = (EaseFloat)(object)((val3 is EaseFloat) ? val3 : null);
												if (val5 != null)
												{
													val5.fromValue.Value = 11f;
													val5.toValue.Value = 13f;
												}
											}
											else
											{
												val4.floatValue.Value = 11f;
											}
										}
										val2.Actions = actions;
									}
									else if (val2.Name == "Recycle")
									{
										FsmStateAction[] actions2 = val2.Actions;
										FsmStateAction[] array = actions2;
										foreach (FsmStateAction obj in array)
										{
											SetPosition2D val6 = (SetPosition2D)(object)((obj is SetPosition2D) ? obj : null);
											if (val6 != null)
											{
												val6.Y.Value = 11f;
											}
										}
										val2.Actions = actions2;
									}
								}
							}
							Type type = ((object)asset).GetType();
							if (Assets.ContainsKey(type) && Assets[type] != null)
							{
								Dictionary<string, Object> dictionary = Assets[type];
								if (dictionary.ContainsKey(assetName))
								{
									if (!Object.op_Implicit(dictionary[assetName]))
									{
										Log.Info($"Asset \"{assetName}\" of type \"{type}\" already exists but is null, replacing it with the newly-loaded asset.");
										dictionary[assetName] = asset;
									}
									else
									{
										Log.Warn($"There is already an asset \"{assetName}\" of type \"{type}\"!");
									}
								}
								else
								{
									Log.Debug($"Adding asset {assetName} of type {type}");
									dictionary.Add(assetName, asset);
								}
							}
							else
							{
								Assets.Add(type, new Dictionary<string, Object> { [assetName] = asset });
								Log.Debug($"Added new sub-dictionary of type {type} with initial asset {assetName}");
							}
						};
					}
				}
			}
		}

		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;
				((AsyncOperation)manuallyLoadedBundle.UnloadAsync(true)).completed += delegate
				{
					Log.Info("Successfully unloaded bundle \"" + bundleName + "\"");
				};
			}
			_manuallyLoadedBundles.Clear();
			foreach (KeyValuePair<string, Object> item in Assets[typeof(GameObject)])
			{
				item.Deconstruct(out var _, out var value);
				GameObject val = (GameObject)(object)((value is GameObject) ? value : null);
				if (val != null && val.activeSelf)
				{
					Log.Info("Recycling all instances of prefab \"" + ((Object)val).name + "\"");
					ObjectPoolExtensions.RecycleAll(val);
				}
			}
		}

		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);
						}
						Log.Error("Failed to get asset \"" + assetName + "\"; asset is null!");
						return default(T);
					}
					Log.Error($"Sub-dictionary for type \"{typeFromHandle}\" does not contain key \"{assetName}\"!");
					return default(T);
				}
				Log.Error($"Failed to get asset \"{assetName}\"; sub-dictionary of key \"{typeFromHandle}\" is null!");
				return default(T);
			}
			Log.Error($"Could not find a sub-dictionary of type \"{typeFromHandle}\"!");
			return default(T);
		}
	}
	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();
		}
	}
	internal static class Log
	{
		private static ManualLogSource? _logSource;

		private static string LogPrefix => $"[{Assembly.GetExecutingAssembly().GetName().Version}] ";

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object debug)
		{
			ManualLogSource? logSource = _logSource;
			if (logSource != null)
			{
				logSource.LogDebug((object)(LogPrefix + debug));
			}
		}

		internal static void Error(object error)
		{
			ManualLogSource? logSource = _logSource;
			if (logSource != null)
			{
				logSource.LogError((object)(LogPrefix + error));
			}
		}

		internal static void Fatal(object fatal)
		{
			ManualLogSource? logSource = _logSource;
			if (logSource != null)
			{
				logSource.LogFatal((object)(LogPrefix + fatal));
			}
		}

		internal static void Info(object info)
		{
			ManualLogSource? logSource = _logSource;
			if (logSource != null)
			{
				logSource.LogInfo((object)(LogPrefix + info));
			}
		}

		internal static void Message(object message)
		{
			ManualLogSource? logSource = _logSource;
			if (logSource != null)
			{
				logSource.LogMessage((object)(LogPrefix + message));
			}
		}

		internal static void Warn(object warning)
		{
			ManualLogSource? logSource = _logSource;
			if (logSource != null)
			{
				logSource.LogWarning((object)(LogPrefix + warning));
			}
		}
	}
	[BepInPlugin("LostSinner", "LostSinner", "0.4.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony _harmony = null;

		internal static Texture2D[] AtlasTextures = (Texture2D[])(object)new Texture2D[2];

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			LoadSinnerTextures();
			_harmony = new Harmony("LostSinner");
			SceneManager.activeSceneChanged += OnSceneChange;
		}

		private void OnSceneChange(Scene oldScene, Scene newScene)
		{
			if (!(((Scene)(ref oldScene)).name != "Menu_Title"))
			{
				_harmony.UnpatchSelf();
				if (GameManager.GetSaveStatsFromData(GameManager.instance.GetSaveGameData(PlayerData.instance.profileID)).IsAct3)
				{
					_harmony.PatchAll(typeof(SinnerPatches));
				}
			}
		}

		private void LoadSinnerTextures()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				using Stream stream = executingAssembly.GetManifestResourceStream(text);
				if (stream != null)
				{
					if (text.Contains("atlas0"))
					{
						byte[] array = new byte[stream.Length];
						stream.Read(array, 0, array.Length);
						Texture2D val = new Texture2D(2, 2);
						ImageConversion.LoadImage(val, array);
						AtlasTextures[0] = val;
					}
					else if (text.Contains("atlas1"))
					{
						byte[] array2 = new byte[stream.Length];
						stream.Read(array2, 0, array2.Length);
						Texture2D val2 = new Texture2D(2, 2);
						ImageConversion.LoadImage(val2, array2);
						AtlasTextures[1] = val2;
					}
				}
			}
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
			AssetManager.UnloadAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LostSinner";

		public const string PLUGIN_NAME = "LostSinner";

		public const string PLUGIN_VERSION = "0.4.0";
	}
}
namespace LostSinner.Patches
{
	internal static class DebugPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(HeroController), "Awake")]
		private static void ForceInvincible()
		{
			CheatManager.Invincibility = (InvincibilityStates)3;
		}
	}
	internal static class SinnerPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		private static void ModifySinner(PlayMakerFSM __instance)
		{
			if (((Object)__instance).name == "First Weaver" && __instance.FsmName == "Control" && ((Component)__instance).gameObject.layer == LayerMask.NameToLayer("Enemies"))
			{
				((Component)__instance).gameObject.AddComponent<Sinner>();
			}
			else if (((Object)__instance).name == "Pin Projectiles")
			{
				((Component)__instance).gameObject.AddComponent<PinProjectiles>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Language), "Get", new Type[]
		{
			typeof(string),
			typeof(string)
		})]
		private static void ChangeSinnerTitle(string key, string sheetTitle, ref string __result)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_0092: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Invalid comparison between Unknown and I4
			string text2;
			LanguageCode val;
			string text;
			if (!(key == "FIRST_WEAVER_SUPER"))
			{
				if (key == "FIRST_WEAVER_SUB")
				{
					val = Language.CurrentLanguage();
					if ((int)val <= 82)
					{
						if ((int)val != 57)
						{
							if ((int)val != 82)
							{
								goto IL_00cf;
							}
							text = "Déchue";
						}
						else
						{
							text = "Perdida";
						}
					}
					else if ((int)val != 105)
					{
						if ((int)val != 147)
						{
							goto IL_00cf;
						}
						text = "Perdida";
					}
					else
					{
						text = "Perduta";
					}
					goto IL_00d2;
				}
				text2 = __result;
				goto IL_00d9;
			}
			val = Language.CurrentLanguage();
			if ((int)val <= 109)
			{
				if ((int)val != 37)
				{
					if ((int)val != 44)
					{
						if ((int)val != 109)
						{
							goto IL_0082;
						}
						text = "漆黒の";
					}
					else
					{
						text = "Lost";
					}
				}
				else
				{
					text = "Verlorene";
				}
			}
			else if ((int)val != 117)
			{
				if ((int)val != 154)
				{
					if ((int)val != 199)
					{
						goto IL_0082;
					}
					text = "失心";
				}
				else
				{
					text = "Пропащая";
				}
			}
			else
			{
				text = "광기에 빠진";
			}
			goto IL_0085;
			IL_00d2:
			text2 = text;
			goto IL_00d9;
			IL_00d9:
			__result = text2;
			return;
			IL_0082:
			text = __result;
			goto IL_0085;
			IL_00cf:
			text = __result;
			goto IL_00d2;
			IL_0085:
			text2 = text;
			goto IL_00d9;
		}
	}
}
namespace LostSinner.Behaviours
{
	internal class PinProjectiles : MonoBehaviour
	{
		private const int AdditionalPins = 32;

		private void Awake()
		{
			CreateMorePins();
			ModifyFsm();
		}

		private void CreateMorePins()
		{
			for (int i = 0; i < 32; i++)
			{
				Object.Instantiate<GameObject>(((Component)((Component)this).transform.GetChild(0)).gameObject, ((Component)this).transform);
			}
		}

		private void ModifyFsm()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0024: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Expected O, but got Unknown
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Expected O, but got Unknown
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Expected O, but got Unknown
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Expected O, but got Unknown
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Expected O, but got Unknown
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Expected O, but got Unknown
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_063e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Expected O, but got Unknown
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Expected O, but got Unknown
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Expected O, but got Unknown
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b4: Expected O, but got Unknown
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Expected O, but got Unknown
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Expected O, but got Unknown
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Expected O, but got Unknown
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Expected O, but got Unknown
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Expected O, but got Unknown
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Expected O, but got Unknown
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Expected O, but got Unknown
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Expected O, but got Unknown
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a5: Expected O, but got Unknown
			//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Expected O, but got Unknown
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07de: Expected O, but got Unknown
			//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ff: Expected O, but got Unknown
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_082c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Expected O, but got Unknown
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0847: Unknown result type (might be due to invalid IL or missing references)
			//IL_084f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0864: Expected O, but got Unknown
			//IL_0866: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0872: Unknown result type (might be due to invalid IL or missing references)
			//IL_087f: Expected O, but got Unknown
			//IL_0881: Unknown result type (might be due to invalid IL or missing references)
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Expected O, but got Unknown
			PlayMakerFSM val = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Pattern Control");
			Fsm fsm = val.Fsm;
			FsmOwnerDefault gameObject = new FsmOwnerDefault
			{
				ownerOption = (OwnerDefaultOption)0
			};
			FsmGameObject fsmGameObject = fsm.GetFsmGameObject("Next Pin");
			FsmOwnerDefault gameObject2 = new FsmOwnerDefault
			{
				gameObject = fsmGameObject
			};
			FsmFloat fsmFloat = fsm.GetFsmFloat("Pos X");
			FsmFloat fsmFloat2 = fsm.GetFsmFloat("Rotation");
			FsmFloat fsmFloat3 = fsm.GetFsmFloat("Scene Centre X");
			FsmState[] fsmStates = val.FsmStates;
			foreach (FsmState val2 in fsmStates)
			{
				switch (val2.name)
				{
				case "Rain 1":
				{
					FsmStateAction[] actions = val2.Actions;
					foreach (FsmStateAction obj5 in actions)
					{
						SetIntValue val8 = (SetIntValue)(object)((obj5 is SetIntValue) ? obj5 : null);
						if (val8 != null)
						{
							val8.intValue = FsmInt.op_Implicit(8);
							break;
						}
					}
					break;
				}
				case "Rain 2":
				{
					FsmStateAction[] actions = val2.Actions;
					foreach (FsmStateAction obj4 in actions)
					{
						FloatAdd val7 = (FloatAdd)(object)((obj4 is FloatAdd) ? obj4 : null);
						if (val7 != null)
						{
							val7.add = FsmFloat.op_Implicit(3f);
							break;
						}
					}
					break;
				}
				case "Sweep Dir":
				{
					val2.Actions = (FsmStateAction[])(object)new FsmStateAction[1] { (FsmStateAction)new SendEventByName
					{
						eventTarget = FsmEventTarget.Self,
						sendEvent = FsmString.op_Implicit("FINISHED")
					} };
					FsmState val10 = ((IEnumerable<FsmState>)val.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState s) => s.name == "Sweep R"));
					if (val10 != null)
					{
						val2.Transitions = (FsmTransition[])(object)new FsmTransition[1]
						{
							new FsmTransition
							{
								toFsmState = val10,
								toState = val10.Name,
								FsmEvent = FsmEvent.Finished
							}
						};
					}
					break;
				}
				case "Sweep R":
				{
					FsmState val5 = ((IEnumerable<FsmState>)val.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState s) => s.name == "Sweep L"));
					if (val5 != null)
					{
						val2.Transitions[0].toFsmState = val5;
						val2.Transitions[0].toState = val5.Name;
					}
					FsmStateAction obj3 = val2.Actions[5];
					SetPosition val6 = (SetPosition)(object)((obj3 is SetPosition) ? obj3 : null);
					if (val6 != null)
					{
						val6.x = FsmFloat.op_Implicit(fsmFloat3.Value - 15f);
					}
					break;
				}
				case "Sweep L":
				{
					FsmStateAction obj6 = val2.Actions[5];
					SetPosition val11 = (SetPosition)(object)((obj6 is SetPosition) ? obj6 : null);
					if (val11 != null)
					{
						val11.x = FsmFloat.op_Implicit(fsmFloat3.Value + 15f);
					}
					break;
				}
				case "Claw R":
				{
					List<FsmStateAction> list2 = val2.Actions.ToList();
					Vector2[] array3 = (Vector2[])(object)new Vector2[2]
					{
						new Vector2(28f, 18.7f),
						new Vector2(35f, 19.7f)
					};
					float[] array4 = new float[2] { -62f, -47f };
					for (int l = 0; l < array3.Length; l++)
					{
						Vector2 val9 = array3[l];
						float num3 = array4[l];
						list2.Add((FsmStateAction)new GetRandomChild
						{
							gameObject = gameObject,
							storeResult = fsmGameObject
						});
						list2.Add((FsmStateAction)new GameObjectIsNull
						{
							isNull = FsmEvent.Finished
						});
						list2.Add((FsmStateAction)new FloatOperator
						{
							float1 = FsmFloat.op_Implicit(val9.x),
							storeResult = fsmFloat
						});
						list2.Add((FsmStateAction)new RandomFloat
						{
							min = FsmFloat.op_Implicit(num3),
							max = FsmFloat.op_Implicit(num3),
							storeResult = fsmFloat2
						});
						list2.Add((FsmStateAction)new SetPosition
						{
							gameObject = gameObject2,
							x = fsmFloat,
							y = FsmFloat.op_Implicit(val9.y)
						});
						list2.Add((FsmStateAction)new SetRotation
						{
							gameObject = gameObject2,
							zAngle = fsmFloat2
						});
						list2.Add((FsmStateAction)new SendEventByName
						{
							eventTarget = new FsmEventTarget
							{
								target = (EventTarget)1,
								gameObject = gameObject2
							},
							sendEvent = FsmString.op_Implicit("ATTACK")
						});
					}
					val2.Actions = list2.ToArray();
					break;
				}
				case "Claw L":
				{
					List<FsmStateAction> list3 = val2.Actions.ToList();
					Vector2[] array5 = (Vector2[])(object)new Vector2[2]
					{
						new Vector2(48f, 18.7f),
						new Vector2(40f, 19.7f)
					};
					float[] array6 = new float[2] { 242f, 228f };
					for (int m = 0; m < array5.Length; m++)
					{
						Vector2 val12 = array5[m];
						float num4 = array6[m];
						list3.Add((FsmStateAction)new GetRandomChild
						{
							gameObject = new FsmOwnerDefault(),
							storeResult = fsmGameObject
						});
						list3.Add((FsmStateAction)new GameObjectIsNull
						{
							isNull = FsmEvent.Finished
						});
						list3.Add((FsmStateAction)new FloatOperator
						{
							float1 = FsmFloat.op_Implicit(val12.x),
							storeResult = fsmFloat
						});
						list3.Add((FsmStateAction)new RandomFloat
						{
							min = FsmFloat.op_Implicit(num4),
							max = FsmFloat.op_Implicit(num4),
							storeResult = fsmFloat2
						});
						list3.Add((FsmStateAction)new SetPosition
						{
							gameObject = gameObject2,
							x = fsmFloat,
							y = FsmFloat.op_Implicit(val12.y)
						});
						list3.Add((FsmStateAction)new SetRotation
						{
							gameObject = gameObject2,
							zAngle = fsmFloat2
						});
						list3.Add((FsmStateAction)new SendEventByName
						{
							eventTarget = new FsmEventTarget
							{
								target = (EventTarget)1,
								gameObject = gameObject2
							},
							sendEvent = FsmString.op_Implicit("ATTACK")
						});
					}
					val2.Actions = list3.ToArray();
					break;
				}
				case "Pincer":
				{
					List<FsmStateAction> list = val2.Actions.ToList();
					FsmStateAction obj = list[4];
					RandomFloat val3 = (RandomFloat)(object)((obj is RandomFloat) ? obj : null);
					if (val3 != null)
					{
						val3.min = FsmFloat.op_Implicit(-122f);
						val3.max = FsmFloat.op_Implicit(-118f);
					}
					FsmStateAction obj2 = list[12];
					RandomFloat val4 = (RandomFloat)(object)((obj2 is RandomFloat) ? obj2 : null);
					if (val4 != null)
					{
						val4.min = FsmFloat.op_Implicit(-62f);
						val4.max = FsmFloat.op_Implicit(-58f);
					}
					float[] array = new float[3] { -15f, 0f, 15f };
					float[] array2 = new float[3] { -30f, -90f, -150f };
					for (int j = 0; j < array.Length; j++)
					{
						float num = array[j];
						float num2 = array2[j];
						list.Add((FsmStateAction)new GetRandomChild
						{
							storeResult = fsmGameObject
						});
						list.Add((FsmStateAction)new GameObjectIsNull
						{
							gameObject = fsmGameObject,
							isNull = FsmEvent.Finished
						});
						list.Add((FsmStateAction)new GetPosition
						{
							gameObject = gameObject,
							x = fsmFloat
						});
						list.Add((FsmStateAction)new FloatAdd
						{
							floatVariable = fsmFloat,
							add = FsmFloat.op_Implicit(num)
						});
						list.Add((FsmStateAction)new RandomFloat
						{
							min = FsmFloat.op_Implicit(num2 - 2f),
							max = FsmFloat.op_Implicit(num2 + 2f),
							storeResult = fsmFloat2
						});
						list.Add((FsmStateAction)new SetPosition
						{
							gameObject = gameObject2,
							x = fsmFloat,
							y = FsmFloat.op_Implicit(18f)
						});
						list.Add((FsmStateAction)new SetRotation
						{
							gameObject = gameObject2,
							zAngle = fsmFloat2
						});
						list.Add((FsmStateAction)new SendEventByName
						{
							sendEvent = FsmString.op_Implicit("ATTACK")
						});
					}
					val2.Actions = list.ToArray();
					break;
				}
				}
			}
		}
	}
	[RequireComponent(typeof(tk2dSpriteAnimator))]
	[RequireComponent(typeof(Rigidbody2D))]
	[RequireComponent(typeof(PlayMakerFSM))]
	internal class Sinner : MonoBehaviour
	{
		private const float GroundY = 13f;

		private tk2dSpriteAnimator _anim;

		private Rigidbody2D _body;

		private PlayMakerFSM _control;

		private Transform _heroTransform;

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine(SetupBoss());
		}

		private IEnumerator SetupBoss()
		{
			yield return AssetManager.ManuallyLoadBundles();
			yield return AssetManager.Initialize();
			GetComponents();
			ChangeBlackThreadVoice();
			ChangeTextures();
			ModifyDamage();
			IncreaseHealth();
			RemoveStuns();
			ModifyFsm();
		}

		private void GetComponents()
		{
			_anim = ((Component)this).GetComponent<tk2dSpriteAnimator>();
			_body = ((Component)this).GetComponent<Rigidbody2D>();
			_control = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Control");
			_heroTransform = HeroController.instance.transform;
		}

		private void ChangeBlackThreadVoice()
		{
			AudioSource component = ((Component)((Component)this).transform.Find("Audio Loop Voice")).GetComponent<AudioSource>();
			AudioMixerGroup[] array = component.outputAudioMixerGroup.audioMixer.FindMatchingGroups("Actors VoiceBlackThread");
			component.outputAudioMixerGroup = array[0];
		}

		private void ChangeTextures()
		{
			tk2dSpriteCollectionData collection = ((tk2dBaseSprite)((Component)this).GetComponent<tk2dSprite>()).Collection;
			collection.materials[0].mainTexture = (Texture)(object)Plugin.AtlasTextures[0];
			collection.materials[1].mainTexture = (Texture)(object)Plugin.AtlasTextures[1];
		}

		private void ModifyDamage()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			DamagePropertyFlags damagePropertyFlags = (DamagePropertyFlags)8;
			DamageHero[] componentsInChildren = ((Component)this).GetComponentsInChildren<DamageHero>(true);
			foreach (DamageHero val in componentsInChildren)
			{
				PlayMakerFSM val2 = FSMUtility.LocateMyFSM(((Component)val).gameObject, "hornet_multi_wounder");
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.Fsm.GetFsmBool("z3 Force Black Threaded").Value = true;
					continue;
				}
				val.damageDealt = 2;
				val.damagePropertyFlags = damagePropertyFlags;
			}
		}

		private void IncreaseHealth()
		{
			((Component)this).GetComponent<HealthManager>().hp = 2000;
		}

		private void RemoveStuns()
		{
			Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)this).gameObject, "Stun Control"));
		}

		private void ModifyFsm()
		{
			AddAbyssTendrilsToCharge();
			AddVomitGlobAttack();
			MakeFacingSecondSlash();
			ShortenBindTime();
			ModifyPhase2();
		}

		private void AddAbyssTendrilsToCharge()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00ae: Expected O, but got Unknown
			GameObject val = AssetManager.Get<GameObject>("Lost Lace Ground Tendril");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			FsmState[] fsmStates = _control.FsmStates;
			foreach (FsmState val2 in fsmStates)
			{
				if (val2.Name == "Slice Charge")
				{
					List<FsmStateAction> list = val2.Actions.ToList();
					list.Insert(0, (FsmStateAction)new SpawnObjectFromGlobalPoolOverTime
					{
						gameObject = FsmGameObject.op_Implicit(val),
						spawnPoint = FsmGameObject.op_Implicit(((Component)this).gameObject),
						position = FsmVector3.op_Implicit(Vector3.up * 1.8000002f),
						rotation = FsmVector3.op_Implicit(Vector3.one),
						frequency = FsmFloat.op_Implicit(0.25f)
					});
					val2.Actions = list.ToArray();
				}
			}
		}

		private void AddVomitGlobAttack()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			FsmState val = new FsmState(_control.Fsm);
			val.Name = "Vomit Routine";
			val.Actions = (FsmStateAction[])(object)new FsmStateAction[1]
			{
				new InvokeCoroutine(VomitGlobAttack, wait: true)
			};
			_control.Fsm.States = _control.FsmStates.Append(val).ToArray();
			FsmEvent val2 = new FsmEvent("VOMIT");
			FsmTransition element = new FsmTransition
			{
				ToFsmState = val,
				ToState = val.Name,
				FsmEvent = val2
			};
			FsmState toFsmState = _control.FsmStates.First((FsmState state) => state.Name == "Idle");
			FsmTransition val3 = new FsmTransition
			{
				ToFsmState = toFsmState,
				ToState = "Idle",
				FsmEvent = FsmEvent.Finished
			};
			val.Transitions = (FsmTransition[])(object)new FsmTransition[1] { val3 };
			FsmInt val4 = new FsmInt("Ct Vomit");
			val4.Value = 0;
			FsmInt val5 = new FsmInt("Vomit Max");
			val5.Value = 2;
			FsmInt val6 = new FsmInt("Ms Vomit");
			val6.Value = 0;
			FsmInt val7 = new FsmInt("Ms Vomit");
			val7.Value = 3;
			_control.FsmVariables.IntVariables = _control.FsmVariables.IntVariables.Append(val4).ToArray();
			FsmState[] fsmStates = _control.FsmStates;
			foreach (FsmState val8 in fsmStates)
			{
				bool flag;
				switch (val8.Name)
				{
				case "P1 Early":
				case "P1":
				case "P2":
				case "No Tele Event":
				case "Tele Event":
					flag = true;
					break;
				default:
					flag = false;
					break;
				}
				if (flag)
				{
					val8.Transitions = val8.Transitions.Append(element).ToArray();
					int num = 0;
					string name = val8.Name;
					if ((name == "P1 Early" || name == "P1") ? true : false)
					{
						num = 1;
					}
					FsmStateAction obj = val8.Actions[num];
					SendRandomEventV3 val9 = (SendRandomEventV3)(object)((obj is SendRandomEventV3) ? obj : null);
					if (val9 != null)
					{
						val9.events = val9.events.Append(val2).ToArray();
						val9.weights = val9.weights.Append(FsmFloat.op_Implicit(0.5f)).ToArray();
						val9.trackingInts = val9.trackingInts.Append(val4).ToArray();
						val9.eventMax = val9.eventMax.Append(val5).ToArray();
						val9.trackingIntsMissed = val9.trackingIntsMissed.Append(val6).ToArray();
						val9.missedMax = val9.missedMax.Append(val7).ToArray();
					}
				}
			}
		}

		private void MakeFacingSecondSlash()
		{
			FsmState val = ((IEnumerable<FsmState>)_control.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState state) => state.Name == "Slash 3"));
			if (val != null)
			{
				List<FsmStateAction> list = val.Actions.ToList();
				list.Insert(0, (FsmStateAction)(object)new InvokeMethod(FaceHero));
				val.Actions = list.ToArray();
			}
		}

		private void ShortenBindTime()
		{
			FsmState val = ((IEnumerable<FsmState>)_control.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState state) => state.Name == "Bind Silk"));
			if (val == null)
			{
				return;
			}
			FsmStateAction[] actions = val.Actions;
			foreach (FsmStateAction obj in actions)
			{
				Wait val2 = (Wait)(object)((obj is Wait) ? obj : null);
				if (val2 != null)
				{
					val2.time = FsmFloat.op_Implicit(1f);
					break;
				}
			}
		}

		private void ModifyPhase2()
		{
			FsmState val = ((IEnumerable<FsmState>)_control.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState state) => state.name == "P2 Start"));
			if (val != null)
			{
				val.Actions = val.Actions.Append((FsmStateAction)(object)new InvokeMethod(IncreaseChargeSliceSpeed)).Append((FsmStateAction)(object)new InvokeMethod(SpeedUpPhase2Pins)).Append((FsmStateAction)(object)new InvokeMethod(SlashToCharge))
					.ToArray();
			}
		}

		private void SlashToCharge()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			FsmState val = null;
			FsmState val2 = null;
			FsmState[] fsmStates = _control.FsmStates;
			foreach (FsmState val3 in fsmStates)
			{
				if (val3.Name == "After Slash")
				{
					val = val3;
				}
				else if (val3.Name == "Slice Charge Antic")
				{
					val2 = val3;
				}
			}
			if (val != null && val2 != null)
			{
				val.Transitions = (FsmTransition[])(object)new FsmTransition[1]
				{
					new FsmTransition
					{
						toFsmState = val2,
						toState = val.Name,
						FsmEvent = FsmEvent.Finished
					}
				};
			}
		}

		private void IncreaseChargeSliceSpeed()
		{
			FsmStateAction[] actions = _control.FsmStates.First((FsmState state) => state.Name == "Slice Charge").Actions;
			FsmStateAction obj = actions[1];
			SetVelocityByScale val = (SetVelocityByScale)(object)((obj is SetVelocityByScale) ? obj : null);
			if (val != null)
			{
				val.speed = FsmFloat.op_Implicit(-12f);
			}
			FsmStateAction obj2 = actions[2];
			AccelerateToXByScale val2 = (AccelerateToXByScale)(object)((obj2 is AccelerateToXByScale) ? obj2 : null);
			if (val2 != null)
			{
				val2.accelerationFactor = FsmFloat.op_Implicit(0.65f);
				val2.targetSpeed = FsmFloat.op_Implicit(40f);
			}
			FsmStateAction obj3 = actions[6];
			Wait val3 = (Wait)(object)((obj3 is Wait) ? obj3 : null);
			if (val3 != null)
			{
				val3.time = FsmFloat.op_Implicit(1f);
			}
		}

		private void SpeedUpPhase2Pins()
		{
			foreach (PlayMakerFSM item in from fsm in Object.FindObjectsByType<PlayMakerFSM>((FindObjectsSortMode)0)
				where ((Object)fsm).name.Contains("FW Pin Projectile")
				select fsm)
			{
				FsmStateAction obj = item.FsmStates.First((FsmState state) => state.Name == "Fire").Actions.First((FsmStateAction action) => action is SetVelocityAsAngle);
				((SetVelocityAsAngle)((obj is SetVelocityAsAngle) ? obj : null)).speed = FsmFloat.op_Implicit(180f);
				FsmStateAction obj2 = item.FsmStates.First((FsmState state) => state.Name == "Thread Pull").Actions[3];
				Wait val = (Wait)(object)((obj2 is Wait) ? obj2 : null);
				if (val != null)
				{
					val.time = FsmFloat.op_Implicit(0.4f);
				}
			}
		}

		private IEnumerator VomitGlobAttack()
		{
			GameObject abyssGlobPrefab = AssetManager.Get<GameObject>("Abyss Vomit Glob");
			if ((Object)(object)abyssGlobPrefab == (Object)null)
			{
				yield break;
			}
			GameObject audioPlayerPrefab = AssetManager.Get<GameObject>("Audio Player Actor Simple");
			if ((Object)(object)audioPlayerPrefab == (Object)null)
			{
				yield break;
			}
			AudioClip spitClip = AssetManager.Get<AudioClip>("mini_mawlek_spit");
			if (!((Object)(object)spitClip == (Object)null))
			{
				_anim.Play("Cast");
				FaceHero();
				_body.linearVelocity = new Vector2(0f, 15f);
				float riseTime = 0.25f;
				float riseTimer = 0f;
				yield return (object)new WaitUntil((Func<bool>)delegate
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Unknown result type (might be due to invalid IL or missing references)
					riseTimer += Time.deltaTime;
					float num = _body.linearVelocity.y * 0.85f;
					_body.linearVelocity = new Vector2(_body.linearVelocity.x, num);
					return riseTimer >= riseTime;
				});
				_body.linearVelocity = new Vector2(_body.linearVelocity.x, 0f);
				int shots = Random.Range(5, 8);
				for (int i = 0; i < shots; i++)
				{
					Config val = default(Config);
					val.Prefab = abyssGlobPrefab;
					val.SpeedMin = 20f;
					val.SpeedMax = 30f;
					val.AngleMin = 45f;
					val.AngleMax = 135f;
					val.AmountMin = 1;
					val.AmountMax = 1;
					FlingUtils.SpawnAndFling(val, ((Component)this).transform, Vector3.up * 2f, (List<GameObject>)null, -1f);
					AudioSource component = ObjectPoolExtensions.Spawn(audioPlayerPrefab, ((Component)this).transform.position).GetComponent<AudioSource>();
					component.pitch = Random.Range(0.85f, 1.15f);
					component.PlayOneShot(spitClip);
					yield return (object)new WaitForSeconds(0.05f);
				}
				_control.SendEvent("FINISHED");
			}
		}

		private void FaceHero()
		{
			//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_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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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)
			if ((_heroTransform.position.x > ((Component)this).transform.position.x && ((Component)this).transform.localScale.x > 0f) || (_heroTransform.position.x < ((Component)this).transform.position.x && ((Component)this).transform.localScale.x < 0f))
			{
				Vector3 localScale = ((Component)this).transform.localScale;
				localScale.x *= -1f;
				((Component)this).transform.localScale = localScale;
			}
		}

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