Decompiled source of MuckedBeastfly v0.2.1

Bilefly.dll

Decompiled 3 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 Bilefly.Behaviours;
using Bilefly.Patches;
using GlobalSettings;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
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("Bilefly")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyInformationalVersion("0.2.1+ac4fbfb505542625b82cc33eab4da153f4f73825")]
[assembly: AssemblyProduct("Bilefly")]
[assembly: AssemblyTitle("Bilefly")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Bilefly
{
	internal static class ArenaBounds
	{
		internal const float XMin = 47f;

		internal const float XMax = 76f;

		internal const float YMin = 7f;

		internal const float YMax = 20f;

		internal const float XCenter = 61.5f;

		internal const float YCenter = 13.5f;
	}
	internal static class AssetManager
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass5_0
		{
			public string prefabName;

			internal bool <LoadScenePrefabs>b__0(Transform obj)
			{
				return ((Object)obj).name == prefabName;
			}
		}

		[CompilerGenerated]
		private sealed class <Init>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = LoadScenePrefabs();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadBundleAssets>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private string <bundlesPath>5__2;

			private Dictionary<string, string[]>.Enumerator <>7__wrap2;

			private string <bundleName>5__4;

			private string[] <assetNames>5__5;

			private bool <bundleAlreadyLoaded>5__6;

			private AssetBundleCreateRequest <bundleLoadRequest>5__7;

			private AssetBundle <bundle>5__8;

			private IEnumerator<AssetBundle> <>7__wrap8;

			private AssetBundle <loadedBundle>5__10;

			private string[] <>7__wrap10;

			private int <>7__wrap11;

			private AssetBundleRequest <loadAssetRequest>5__13;

			private string <assetPath>5__14;

			private string[] <>7__wrap14;

			private int <>7__wrap15;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 2u)
				{
					try
					{
						if (num == -4 || num == 1)
						{
							try
							{
							}
							finally
							{
								<>m__Finally2();
							}
						}
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<bundlesPath>5__2 = null;
				<>7__wrap2 = default(Dictionary<string, string[]>.Enumerator);
				<bundleName>5__4 = null;
				<assetNames>5__5 = null;
				<bundleLoadRequest>5__7 = null;
				<bundle>5__8 = null;
				<>7__wrap8 = null;
				<loadedBundle>5__10 = null;
				<>7__wrap10 = null;
				<loadAssetRequest>5__13 = null;
				<assetPath>5__14 = null;
				<>7__wrap14 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//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_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Invalid comparison between Unknown and I4
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Invalid comparison between Unknown and I4
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Invalid comparison between Unknown and I4
				try
				{
					string key;
					string[] value;
					string text4;
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						RuntimePlatform platform = Application.platform;
						key = (((int)platform == 1) ? "StandaloneOSX" : (((int)platform == 2) ? "StandaloneWindows64" : (((int)platform != 13) ? "" : "StandaloneLinux64")));
						string path = key;
						<bundlesPath>5__2 = Path.Combine(Addressables.RuntimePath, path);
						<>7__wrap2 = BundleAssets.GetEnumerator();
						<>1__state = -3;
						goto IL_03f4;
					}
					case 1:
					{
						<>1__state = -4;
						Object asset2 = <loadAssetRequest>5__13.asset;
						GameObject val2 = (GameObject)(object)((asset2 is GameObject) ? asset2 : null);
						if (val2 != null)
						{
							CheckSpecialBehaviour(val2);
						}
						else if (Object.op_Implicit(asset2))
						{
							AssetManager.TryAdd<Object>(asset2);
						}
						goto IL_01c3;
					}
					case 2:
						<>1__state = -3;
						<bundle>5__8 = <bundleLoadRequest>5__7.assetBundle;
						_manuallyLoadedBundles.Add(<bundle>5__8);
						<>7__wrap10 = <bundle>5__8.GetAllAssetNames();
						<>7__wrap11 = 0;
						goto IL_03be;
					case 3:
						{
							<>1__state = -3;
							Object asset = <loadAssetRequest>5__13.asset;
							GameObject val = (GameObject)(object)((asset is GameObject) ? asset : null);
							if (val != null)
							{
								CheckSpecialBehaviour(val);
							}
							AssetManager.TryAdd<Object>(asset);
							<loadAssetRequest>5__13 = null;
							goto IL_0381;
						}
						IL_03f4:
						if (<>7__wrap2.MoveNext())
						{
							<>7__wrap2.Current.Deconstruct(out key, out value);
							<bundleName>5__4 = key;
							<assetNames>5__5 = value;
							<bundleAlreadyLoaded>5__6 = false;
							<>7__wrap8 = AssetBundle.GetAllLoadedAssetBundles().GetEnumerator();
							<>1__state = -4;
							goto IL_0202;
						}
						<>m__Finally1();
						<>7__wrap2 = default(Dictionary<string, string[]>.Enumerator);
						return false;
						IL_01c3:
						if (!<bundleAlreadyLoaded>5__6)
						{
							<>7__wrap11++;
							goto IL_01d9;
						}
						goto IL_01ec;
						IL_03be:
						if (<>7__wrap11 < <>7__wrap10.Length)
						{
							<assetPath>5__14 = <>7__wrap10[<>7__wrap11];
							<>7__wrap14 = <assetNames>5__5;
							<>7__wrap15 = 0;
							goto IL_038f;
						}
						<>7__wrap10 = null;
						<bundleLoadRequest>5__7 = null;
						<bundle>5__8 = null;
						<bundleName>5__4 = null;
						<assetNames>5__5 = null;
						goto IL_03f4;
						IL_038f:
						if (<>7__wrap15 < <>7__wrap14.Length)
						{
							string text = <>7__wrap14[<>7__wrap15];
							if (<assetPath>5__14.GetAssetRoot() == text)
							{
								<loadAssetRequest>5__13 = <bundle>5__8.LoadAssetAsync(<assetPath>5__14);
								<>2__current = <loadAssetRequest>5__13;
								<>1__state = 3;
								return true;
							}
							goto IL_0381;
						}
						<>7__wrap14 = null;
						<assetPath>5__14 = null;
						<>7__wrap11++;
						goto IL_03be;
						IL_0202:
						if (<>7__wrap8.MoveNext())
						{
							<loadedBundle>5__10 = <>7__wrap8.Current;
							<>7__wrap10 = <loadedBundle>5__10.GetAllAssetNames();
							<>7__wrap11 = 0;
							goto IL_01d9;
						}
						goto IL_0212;
						IL_01d9:
						if (<>7__wrap11 < <>7__wrap10.Length)
						{
							string text2 = <>7__wrap10[<>7__wrap11];
							value = <assetNames>5__5;
							foreach (string text3 in value)
							{
								if (text2.GetAssetRoot() == text3)
								{
									<bundleAlreadyLoaded>5__6 = true;
									<loadAssetRequest>5__13 = <loadedBundle>5__10.LoadAssetAsync(text2);
									<>2__current = <loadAssetRequest>5__13;
									<>1__state = 1;
									return true;
								}
							}
							goto IL_01c3;
						}
						goto IL_01ec;
						IL_01ec:
						<>7__wrap10 = null;
						if (!<bundleAlreadyLoaded>5__6)
						{
							<loadedBundle>5__10 = null;
							goto IL_0202;
						}
						goto IL_0212;
						IL_0381:
						<>7__wrap15++;
						goto IL_038f;
						IL_0212:
						<>m__Finally2();
						<>7__wrap8 = null;
						if (<bundleAlreadyLoaded>5__6)
						{
							Log.Warn("Bundle " + <bundleName>5__4 + " already loaded!");
							goto IL_03f4;
						}
						text4 = Path.Combine(<bundlesPath>5__2, <bundleName>5__4 + ".bundle");
						<bundleLoadRequest>5__7 = AssetBundle.LoadFromFileAsync(text4);
						<>2__current = <bundleLoadRequest>5__7;
						<>1__state = 2;
						return true;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>7__wrap2).Dispose();
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				if (<>7__wrap8 != null)
				{
					<>7__wrap8.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadScenePrefabs>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Dictionary<string, string[]>.Enumerator <>7__wrap1;

			private string[] <prefabNames>5__3;

			private AsyncOperationHandle<SceneInstance> <loadSceneHandle>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = default(Dictionary<string, string[]>.Enumerator);
				<prefabNames>5__3 = null;
				<loadSceneHandle>5__4 = default(AsyncOperationHandle<SceneInstance>);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Invalid comparison between Unknown and I4
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						AudioManager.BlockAudioChange = true;
						<>7__wrap1 = ScenePrefabs.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
					{
						<>1__state = -3;
						if ((int)<loadSceneHandle>5__4.Status == 1)
						{
							SceneInstance result = <loadSceneHandle>5__4.Result;
							Scene scene = ((SceneInstance)(ref result)).Scene;
							GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
							foreach (GameObject val in rootGameObjects)
							{
								string[] array = <prefabNames>5__3;
								for (int j = 0; j < array.Length; j++)
								{
									<>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0
									{
										prefabName = array[j]
									};
									Transform? obj2 = ((IEnumerable<Transform>)val.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform obj) => ((Object)obj).name == CS$<>8__locals0.prefabName));
									GameObject val2 = ((obj2 != null) ? ((Component)obj2).gameObject : null);
									if (Object.op_Implicit((Object)(object)val2))
									{
										val2.SetActive(false);
										GameObject obj3 = Object.Instantiate<GameObject>(val2);
										((Object)obj3).name = CS$<>8__locals0.prefabName;
										Object.DontDestroyOnLoad((Object)(object)obj3);
										CheckSpecialBehaviour(obj3);
										AssetManager.TryAdd<GameObject>(obj3);
									}
								}
							}
						}
						else
						{
							Log.Error(<loadSceneHandle>5__4.OperationException);
						}
						AsyncOperationHandle<SceneInstance> val3 = Addressables.UnloadSceneAsync(<loadSceneHandle>5__4, true);
						<>2__current = val3;
						<>1__state = 2;
						return true;
					}
					case 2:
						<>1__state = -3;
						<loadSceneHandle>5__4 = default(AsyncOperationHandle<SceneInstance>);
						<prefabNames>5__3 = null;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						<>7__wrap1.Current.Deconstruct(out string key, out string[] array);
						string text = key;
						<prefabNames>5__3 = array;
						string text2 = "Scenes/" + text;
						<loadSceneHandle>5__4 = Addressables.LoadSceneAsync((object)text2, (LoadSceneMode)1, true, 100, (SceneReleaseMode)0);
						<>2__current = <loadSceneHandle>5__4;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = default(Dictionary<string, string[]>.Enumerator);
					AudioManager.BlockAudioChange = false;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>7__wrap1).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly Dictionary<string, string[]> ScenePrefabs = new Dictionary<string, string[]>
		{
			["Aqueduct_02"] = new string[1] { "Swamp Mosquito Skinny" },
			["Bone_East_08_boss_beastfly"] = new string[1] { "Boss Scene Beastfly" },
			["Shadow_12"] = new string[1] { "moss_crumble_plat" }
		};

		private static readonly Dictionary<string, string[]> BundleAssets = new Dictionary<string, string[]>
		{
			["audiocuesdynamic_assets_areaantareaboneareacoralareamossareawilds"] = new string[1] { "RipAndShred" },
			["sfxstatic_assets_areaantareaboneareacoralareamossareawilds"] = new string[1] { "RIP AND SHRED" },
			["enemycorpses_assets_areaswamp"] = new string[1] { "Corpse Swamp Mosquito Skinny" },
			["localpoolprefabs_assets_areaaqueduct"] = new string[2] { "Skinny Mosquito Bullet", "Skinny Mosquito Bullet Void" },
			["tk2danimations_assets_areaswamp"] = new string[1] { "Swamp Mosquito Anim" }
		};

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

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

		[IteratorStateMachine(typeof(<Init>d__4))]
		internal static IEnumerator Init()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Init>d__4(0);
		}

		[IteratorStateMachine(typeof(<LoadScenePrefabs>d__5))]
		private static IEnumerator LoadScenePrefabs()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadScenePrefabs>d__5(0);
		}

		[IteratorStateMachine(typeof(<LoadBundleAssets>d__6))]
		internal static IEnumerator LoadBundleAssets()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadBundleAssets>d__6(0);
		}

		private static bool Has(string assetName)
		{
			foreach (KeyValuePair<Type, Dictionary<string, Object>> asset in Assets)
			{
				asset.Deconstruct(out var _, out var value);
				foreach (var (text2, val2) in value)
				{
					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))
			{
				Log.Warn("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))
					{
						if (dictionary[name] != (Object)null)
						{
							Log.Warn($"There is already an asset \"{name}\" of type \"{type}\"!");
							return;
						}
						Log.Info($"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
					{
						Log.Debug($"Adding asset \"{name}\" of type \"{type}\".");
						Assets[type].Add(name, (Object)(object)asset);
					}
				}
				else
				{
					Log.Error($"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 });
				Log.Debug($"Added new sub-dictionary of type \"{type}\" with initial asset \"{name}\".");
			}
		}

		private static void CheckSpecialBehaviour(GameObject prefab)
		{
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Expected O, but got Unknown
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Expected O, but got Unknown
			switch (((Object)prefab).name)
			{
			case "Boss Scene Beastfly":
			{
				Transform transform = prefab.transform;
				RepositionScene(transform);
				ModifyTriggers(transform);
				Transform val7 = transform.Find("Beastfly States");
				ForceEnableBeastfly(val7);
				ReplaceBeastflySummonedEnemies(transform.Find("Summon Enemies"));
				GameObject gameObject = ((Component)val7.Find("Active/Bone Flyer Giant")).gameObject;
				gameObject.AddComponent<Beastfly>();
				((EnemyDeathEffects)gameObject.GetComponent<EnemyDeathEffectsRegular>()).CorpsePrefab.AddComponent<BeastflyCorpse>();
				{
					foreach (PlayMakerFSM item in from t in gameObject.GetComponentsInChildren<PlayMakerFSM>(true)
						where ((Component)t).gameObject.layer == 26
						select t)
					{
						((Component)item).gameObject.AddComponent<BeastflyCorpse>();
					}
					break;
				}
			}
			case "Swamp Mosquito Skinny":
				prefab.AddComponent<Mosquito>();
				break;
			case "Corpse Swamp Mosquito Skinny":
			{
				if (!TryGetBeastflyScene(out GameObject beastflyScene2))
				{
					break;
				}
				EnemyDeathEffects[] componentsInChildren = ((Component)beastflyScene2.transform.Find("Summon Enemies")).GetComponentsInChildren<EnemyDeathEffects>();
				foreach (EnemyDeathEffects val3 in componentsInChildren)
				{
					if (((Object)val3).name.Contains("Swamp Mosquito Skinny"))
					{
						val3.corpsePrefab = prefab;
					}
				}
				break;
			}
			case "Swamp Mosquito Anim":
			{
				if (!TryGetBeastflyScene(out GameObject beastflyScene4))
				{
					break;
				}
				tk2dSpriteAnimation component = prefab.GetComponent<tk2dSpriteAnimation>();
				{
					foreach (Transform item2 in ((Component)beastflyScene4.transform.Find("Summon Enemies")).transform)
					{
						Transform val6 = item2;
						if (((Object)val6).name.Contains("Swamp Mosquito Skinny"))
						{
							((Component)val6).GetComponent<tk2dSpriteAnimator>().Library = component;
						}
					}
					break;
				}
			}
			case "Skinny Mosquito Bullet":
			{
				if (!TryGetBeastflyScene(out GameObject beastflyScene3))
				{
					break;
				}
				{
					foreach (Transform item3 in ((Component)beastflyScene3.transform.Find("Summon Enemies")).transform)
					{
						Transform val4 = item3;
						if (((Object)val4).name.Contains("Swamp Mosquito Skinny"))
						{
							FsmStateAction obj2 = FSMUtility.LocateMyFSM(((Component)val4).gameObject, "Shoot").Fsm.GetState("Shoot Aim").Actions[5];
							BoolTestToGameObject val5 = (BoolTestToGameObject)(object)((obj2 is BoolTestToGameObject) ? obj2 : null);
							if (val5 != null)
							{
								val5.FalseGameObject.Value = prefab;
							}
						}
					}
					break;
				}
			}
			case "Skinny Mosquito Bullet Void":
			{
				if (!TryGetBeastflyScene(out GameObject beastflyScene))
				{
					break;
				}
				{
					foreach (Transform item4 in ((Component)beastflyScene.transform.Find("Summon Enemies")).transform)
					{
						Transform val = item4;
						if (((Object)val).name.Contains("Swamp Mosquito Skinny"))
						{
							FsmStateAction obj = FSMUtility.LocateMyFSM(((Component)val).gameObject, "Shoot").Fsm.GetState("Shoot Aim").Actions[5];
							BoolTestToGameObject val2 = (BoolTestToGameObject)(object)((obj is BoolTestToGameObject) ? obj : null);
							if (val2 != null)
							{
								val2.TrueGameObject.Value = prefab;
							}
						}
					}
					break;
				}
			}
			}
		}

		private static void RepositionScene(Transform sceneTransform)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//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_0035: 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)
			sceneTransform.position = Vector2.op_Implicit(new Vector2(-20f, 11f));
			Transform obj = sceneTransform.Find("Beastfly States/Active/Bone Flyer Giant");
			obj.position += Vector3.down * 8f;
		}

		private static void ModifyTriggers(Transform sceneTransform)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(63f, 18f);
			Vector2 size = default(Vector2);
			((Vector2)(ref size))..ctor(36f, 20f);
			Vector2 zero = Vector2.zero;
			Transform obj = sceneTransform.Find("CamLock Boss");
			Object.Destroy((Object)(object)((Component)obj.Find("CamLock Boss (1)")).gameObject);
			obj.position = Vector2.op_Implicit(Vector2.zero);
			Transform obj2 = obj.Find("CamLock Boss");
			obj2.position = Vector2.op_Implicit(val);
			BoxCollider2D component = ((Component)obj2).GetComponent<BoxCollider2D>();
			component.size = size;
			((Collider2D)component).offset = zero;
			CameraLockArea component2 = ((Component)obj2).GetComponent<CameraLockArea>();
			component2.cameraXMin = 60f;
			component2.cameraXMax = 66f;
			component2.cameraYMin = 15f;
			component2.cameraYMax = 22f;
		}

		private static void ForceEnableBeastfly(Transform statesTransform)
		{
			Object.Destroy((Object)(object)((Component)statesTransform).GetComponent<TestGameObjectActivator>());
		}

		private static void ReplaceBeastflySummonedEnemies(Transform summonEnemiesParent)
		{
			GameObject val = AssetManager.Get<GameObject>("Swamp Mosquito Skinny");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to get Swamp Mosquito Skinny!");
				return;
			}
			Object.Destroy((Object)(object)((Component)summonEnemiesParent.Find("Bone Spitter")).gameObject);
			GameObject obj = Object.Instantiate<GameObject>(val, summonEnemiesParent);
			obj.SetActive(true);
			((Object)obj).name = "Swamp Mosquito Skinny";
			Object.Destroy((Object)(object)((Component)summonEnemiesParent.Find("Bone Spitter (1)")).gameObject);
			GameObject obj2 = Object.Instantiate<GameObject>(val, summonEnemiesParent);
			obj2.SetActive(true);
			((Object)obj2).name = "Swamp Mosquito Skinny (1)";
			GameObject obj3 = Object.Instantiate<GameObject>(val, summonEnemiesParent);
			obj3.SetActive(true);
			((Object)obj3).name = "Swamp Mosquito Skinny (2)";
		}

		private static bool TryGetBeastflyScene(out GameObject? beastflyScene)
		{
			GameObject val = AssetManager.Get<GameObject>("Boss Scene Beastfly");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to get Boss Scene Beastfly prefab!");
				beastflyScene = null;
				return false;
			}
			beastflyScene = val;
			return true;
		}

		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);
		}
	}
	internal static class Extensions
	{
		internal static string GetAssetRoot(this string assetPath)
		{
			return assetPath.Split("/").Last().Replace(".asset", "")
				.Replace(".prefab", "")
				.Replace(".wav", "");
		}
	}
	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("io.github.silksong_bilefly", "Bilefly", "0.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony _harmony;

		public const string Id = "io.github.silksong_bilefly";

		public static string Name => "Bilefly";

		public static string Version => "0.2.1";

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			_harmony = new Harmony("io.github.silksong_bilefly");
			MainPatches.Init();
			_harmony.PatchAll(typeof(MainPatches));
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
			AssetManager.UnloadAll();
		}
	}
}
namespace Bilefly.Patches
{
	internal static class BeastflyPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Language), "Get", new Type[]
		{
			typeof(string),
			typeof(string)
		})]
		private static void ChangeBeastflyTitle(string key, string sheetTitle, ref string __result)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			string text2;
			if (key == "GIANT_BONE_FLYER_SUPER")
			{
				string text = (((int)Language.CurrentLanguage() != 44) ? __result : "Mucked");
				text2 = text;
			}
			else
			{
				text2 = __result;
			}
			__result = text2;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BlackThreadState), "Awake")]
		private static void DisableVoid(BlackThreadState __instance)
		{
			if ((GameManager.instance.sceneName == "Shadow_18" && ((Object)__instance).name == "Bone Flyer Giant") || ((Object)__instance).name.Contains("Swamp Mosquito Skinny"))
			{
				__instance.hasAwaken = true;
			}
		}
	}
	internal static class DebugPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(HeroController), "Awake")]
		private static void ForceInvincible()
		{
			CheatManager.Invincibility = (InvincibilityStates)3;
		}
	}
	internal static class MainPatches
	{
		private static Harmony _harmony;

		internal static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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());
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BattleScene), "Awake")]
		private static void CheckPatchBeastfly(BattleScene __instance)
		{
			if (!(__instance.setPDBoolOnEnd != "DefeatedSwampShaman"))
			{
				_harmony.PatchAll(typeof(BeastflyPatches));
				((Component)__instance).gameObject.AddComponent<BileflyLoader>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BattleScene), "OnDisable")]
		private static void CheckUnpatchBeastfly(BattleScene __instance)
		{
			_harmony.UnpatchSelf();
		}
	}
}
namespace Bilefly.Behaviours
{
	internal class Beastfly : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static DeathEvent <>9__5_0;

			public static Func<FsmTransition, bool> <>9__7_0;

			public static Func<FsmTransition, bool> <>9__7_1;

			public static Func<GameObject, bool> <>9__8_0;

			public static Func<GameObject, bool> <>9__9_0;

			public static UnityAction <>9__10_0;

			internal void <ModifyHealth>b__5_0()
			{
				PlayMakerFSM.BroadcastEvent("ZERO HP");
			}

			internal bool <ModifyControlFSM>b__7_0(FsmTransition t)
			{
				if (t.EventName != "GO HOME")
				{
					return t.EventName != "DOOR SLAM";
				}
				return false;
			}

			internal bool <ModifyControlFSM>b__7_1(FsmTransition t)
			{
				return t.EventName != "GO HOME";
			}

			internal bool <AddIdleMaggotParticles>b__8_0(GameObject obj)
			{
				return ((Object)obj).name == "hero_maggoted_effect";
			}

			internal bool <AddBurstMaggotParticles>b__9_0(GameObject obj)
			{
				return ((Object)obj).name == "particle_maggot_main (5)";
			}

			internal void <SetMaggotedOnDamage>b__10_0()
			{
				HeroController instance = HeroController.instance;
				if (((ToolBase)Gameplay.MaggotCharm).IsEquipped && instance.playerData.MaggotCharmHits < 3)
				{
					instance.DidMaggotCharmHit();
				}
				else
				{
					MaggotRegion.SetIsMaggoted(true);
				}
			}
		}

		private Color _bileColor = new Color(0.7206f, 0.7045f, 0.4875f);

		private GameObject? _ptMaggotBurst;

		private void Awake()
		{
			ModifyComponents();
			AddIdleMaggotParticles();
			AddBurstMaggotParticles();
			ModifyControlFSM();
			SetMaggotedOnDamage();
		}

		private void ModifyComponents()
		{
			ModifyPositionConstraints();
			ModifyHealth();
			RecolorParticles();
		}

		private void ModifyPositionConstraints()
		{
			ConstrainPosition component = ((Component)this).GetComponent<ConstrainPosition>();
			component.xMin = 47f;
			component.xMax = 76f;
			component.yMin = 7f;
		}

		private void ModifyHealth()
		{
			//IL_0033: 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_003e: Expected O, but got Unknown
			HealthManager component = ((Component)this).GetComponent<HealthManager>();
			component.hp = 950;
			component.hasSpecialDeath = false;
			component.immuneToWater = true;
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				DeathEvent val = delegate
				{
					PlayMakerFSM.BroadcastEvent("ZERO HP");
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			component.OnDeath += (DeathEvent)obj;
		}

		private void RecolorParticles()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			((tk2dBaseSprite)((Component)this).GetComponent<tk2dSprite>()).VertexColor = _bileColor;
			ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren<ParticleSystem>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
				((MinMaxGradient)(ref startColor)).color = _bileColor;
				((MainModule)(ref main)).startColor = startColor;
			}
		}

		private void ModifyControlFSM()
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Expected O, but got Unknown
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Expected O, but got Unknown
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: 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_0434: Expected O, but got Unknown
			//IL_0459: 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_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Expected O, but got Unknown
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Expected O, but got Unknown
			PlayMakerFSM obj = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Control");
			Fsm fsm = obj.Fsm;
			FsmFloat[] floatVariables = obj.FsmVariables.FloatVariables;
			foreach (FsmFloat val in floatVariables)
			{
				switch (((NamedVariable)val).Name)
				{
				case "Lava Y":
					val.Value = 7f;
					break;
				case "Low Y Point":
					val.Value = 11.5f;
					break;
				case "Rematch Arena X Max":
					val.Value = 76f;
					break;
				case "Rematch Arena X Min":
					val.Value = 47f;
					break;
				case "High Y Pos":
					val.Value = 15.5f;
					break;
				}
			}
			GameObject value = fsm.GetFsmGameObject("Pt LavaAntic").Value;
			Transform transform = value.transform;
			transform.position += Vector3.down * 7f;
			MainModule main = value.GetComponent<ParticleSystem>().main;
			MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
			((MinMaxGradient)(ref startColor)).color = new Color(0.7206f, 0.7045f, 0.4875f);
			((MainModule)(ref main)).startColor = startColor;
			MinMaxCurve startSpeed = default(MinMaxCurve);
			((MinMaxCurve)(ref startSpeed)).mode = (ParticleSystemCurveMode)3;
			((MinMaxCurve)(ref startSpeed)).constantMin = 30f;
			((MinMaxCurve)(ref startSpeed)).constantMax = 60f;
			((MainModule)(ref main)).startSpeed = startSpeed;
			Object.Destroy((Object)(object)((Component)transform.Find("Flame")).gameObject);
			MusicCue val2 = AssetManager.Get<MusicCue>("RipAndShred");
			if (!Object.op_Implicit((Object)(object)val2))
			{
				Log.Error("Failed to get Incisive Battle music cue!");
				return;
			}
			AudioClip clip = AssetManager.Get<AudioClip>("RIP AND SHRED");
			val2.channelInfos[0].clip = clip;
			FsmStateAction obj2 = fsm.GetState("Rematch Start").Actions[0];
			ApplyMusicCue val3 = (ApplyMusicCue)(object)((obj2 is ApplyMusicCue) ? obj2 : null);
			if (val3 != null)
			{
				val3.musicCue = FsmObject.op_Implicit((Object)(object)val2);
			}
			FsmState state = fsm.GetState("Rematch Ready");
			List<FsmStateAction> list = state.Actions.ToList();
			list.RemoveAt(12);
			state.Actions = list.ToArray();
			FsmStateAction obj3 = fsm.GetState("Intro Recover").Actions[4];
			ApplyMusicCue val4 = (ApplyMusicCue)(object)((obj3 is ApplyMusicCue) ? obj3 : null);
			if (val4 != null)
			{
				val4.musicCue = FsmObject.op_Implicit((Object)(object)val2);
			}
			FsmStateAction[] actions = fsm.GetState("Charge").Actions;
			FsmStateAction obj4 = actions[20];
			CheckXPosition val5 = (CheckXPosition)(object)((obj4 is CheckXPosition) ? obj4 : null);
			if (val5 != null)
			{
				val5.compareTo = FsmFloat.op_Implicit(41f);
			}
			FsmStateAction obj5 = actions[21];
			CheckXPosition val6 = (CheckXPosition)(object)((obj5 is CheckXPosition) ? obj5 : null);
			if (val6 != null)
			{
				val6.compareTo = FsmFloat.op_Implicit(82f);
			}
			FsmState state2 = fsm.GetState("Choice");
			state2.Transitions = state2.Transitions.Where((FsmTransition t) => t.EventName != "GO HOME" && t.EventName != "DOOR SLAM").ToArray();
			List<FsmStateAction> list2 = state2.Actions.ToList();
			list2.RemoveAt(2);
			list2.RemoveAt(4);
			state2.Actions = list2.ToArray();
			FsmState state3 = fsm.GetState("Stomp Pos");
			state3.Transitions = state3.Transitions.Where((FsmTransition t) => t.EventName != "GO HOME").ToArray();
			List<FsmStateAction> list3 = state3.Actions.ToList();
			list3.RemoveAt(2);
			state3.Actions = list3.ToArray();
			FsmState state4 = fsm.GetState("Stomp R");
			state4.Actions = state4.Actions.Append((FsmStateAction)new CheckYPosition
			{
				gameObject = new FsmOwnerDefault(),
				compareTo = FsmFloat.op_Implicit(7f),
				compareToOffset = FsmFloat.op_Implicit(0f),
				tolerance = FsmFloat.op_Implicit(0f),
				equal = null,
				lessThan = FsmEvent.Finished,
				greaterThan = null,
				everyFrame = true,
				activeBool = FsmBool.op_Implicit(true)
			}).ToArray();
			FsmState state5 = fsm.GetState("Get Next Target");
			state4.Transitions = state4.Transitions.Append(new FsmTransition
			{
				FsmEvent = FsmEvent.Finished,
				ToFsmState = state5,
				ToState = state5.Name
			}).ToArray();
			FsmState state6 = fsm.GetState("Lava Burst");
			List<FsmStateAction> list4 = state6.Actions.ToList();
			list4.Insert(0, (FsmStateAction)new PlayParticleEmitter
			{
				gameObject = new FsmOwnerDefault
				{
					OwnerOption = (OwnerDefaultOption)1,
					GameObject = FsmGameObject.op_Implicit(_ptMaggotBurst)
				},
				emit = FsmInt.op_Implicit(20000),
				resetIfPlaying = true
			});
			state6.Actions = list4.ToArray();
		}

		private void AddIdleMaggotParticles()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => ((Object)obj).name == "hero_maggoted_effect"));
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to find hero_maggoted_effect!");
				return;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)this).transform);
			val2.transform.localPosition = Vector3.zero;
			PlayParticleEffects component = val2.GetComponent<PlayParticleEffects>();
			ParticleSystem[] particleEffects = component.particleEffects;
			foreach (ParticleSystem val3 in particleEffects)
			{
				if (Object.op_Implicit((Object)(object)val3))
				{
					MainModule main = val3.main;
					((MainModule)(ref main)).maxParticles = 32;
					MinMaxCurve val4 = default(MinMaxCurve);
					((MinMaxCurve)(ref val4)).mode = (ParticleSystemCurveMode)3;
					MinMaxCurve val5 = ((MainModule)(ref main)).startLifetime;
					((MinMaxCurve)(ref val4)).constantMin = ((MinMaxCurve)(ref val5)).constantMin * 2f;
					val5 = ((MainModule)(ref main)).startLifetime;
					((MinMaxCurve)(ref val4)).constantMax = ((MinMaxCurve)(ref val5)).constantMax * 2f;
					((MainModule)(ref main)).startLifetime = val4;
					EmissionModule emission = val3.emission;
					val4 = default(MinMaxCurve);
					((MinMaxCurve)(ref val4)).mode = (ParticleSystemCurveMode)3;
					val5 = ((EmissionModule)(ref emission)).rateOverTime;
					((MinMaxCurve)(ref val4)).constantMin = ((MinMaxCurve)(ref val5)).constantMin * 2f;
					val5 = ((EmissionModule)(ref emission)).rateOverTime;
					((MinMaxCurve)(ref val4)).constantMax = ((MinMaxCurve)(ref val5)).constantMax * 2f;
					((EmissionModule)(ref emission)).rateOverTime = val4;
					ShapeModule shape = val3.shape;
					((ShapeModule)(ref shape)).radius = ((ShapeModule)(ref shape)).radius * 4f;
				}
			}
			((Object)val2).name = "Pt Maggots Idle";
			component.PlayParticleSystems();
		}

		private void AddBurstMaggotParticles()
		{
			//IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => ((Object)obj).name == "particle_maggot_main (5)"));
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to find particle_maggot_main (5)!");
				return;
			}
			_ptMaggotBurst = Object.Instantiate<GameObject>(val, ((Component)this).transform);
			((Object)_ptMaggotBurst).name = "Pt Maggot Burst";
			MainModule main = _ptMaggotBurst.GetComponent<ParticleSystem>().main;
			((MainModule)(ref main)).maxParticles = 128;
			MinMaxCurve startSpeed = default(MinMaxCurve);
			((MinMaxCurve)(ref startSpeed)).mode = (ParticleSystemCurveMode)3;
			((MinMaxCurve)(ref startSpeed)).constantMin = 16f;
			((MinMaxCurve)(ref startSpeed)).constantMax = 32f;
			((MainModule)(ref main)).startSpeed = startSpeed;
		}

		private void SetMaggotedOnDamage()
		{
			//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_002a: Expected O, but got Unknown
			UnityEvent onDamagedHero = ((Component)this).GetComponent<DamageHero>().OnDamagedHero;
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					HeroController instance = HeroController.instance;
					if (((ToolBase)Gameplay.MaggotCharm).IsEquipped && instance.playerData.MaggotCharmHits < 3)
					{
						instance.DidMaggotCharmHit();
					}
					else
					{
						MaggotRegion.SetIsMaggoted(true);
					}
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			onDamagedHero.AddListener((UnityAction)obj);
		}
	}
	internal class BeastflyCorpse : MonoBehaviour
	{
		private Color _bileColor = new Color(0.7206f, 0.7045f, 0.4875f);

		private void Awake()
		{
			RecolorSprites();
			ModifyPositionConstraints();
		}

		private void RecolorSprites()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			tk2dSprite[] componentsInChildren = ((Component)this).GetComponentsInChildren<tk2dSprite>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((tk2dBaseSprite)componentsInChildren[i]).VertexColor = _bileColor;
			}
		}

		private void ModifyPositionConstraints()
		{
			ConstrainPosition[] componentsInChildren = ((Component)this).GetComponentsInChildren<ConstrainPosition>(true);
			foreach (ConstrainPosition obj in componentsInChildren)
			{
				obj.xMin = 47f;
				obj.xMax = 76f;
				obj.yMin = 7f;
			}
		}
	}
	internal class BileflyLoader : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Start>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BileflyLoader <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				BileflyLoader bileflyLoader = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = AssetManager.LoadBundleAssets();
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					GameObject val = AssetManager.Get<GameObject>("Boss Scene Beastfly");
					if (!Object.op_Implicit((Object)(object)val))
					{
						Log.Error("Failed to get Boss Scene Beastfly prefab!");
						return false;
					}
					GameObject obj = Object.Instantiate<GameObject>(val);
					Transform transform = obj.transform;
					((Component)transform.Find("Beastfly States/Active")).gameObject.SetActive(true);
					bileflyLoader.SetBattleScene(transform);
					bileflyLoader.DisableExistingPlatforms();
					bileflyLoader.ReplacePlatforms(transform.Find("Lava Plats"));
					bileflyLoader.DisableBench();
					obj.SetActive(true);
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<Start>d__0))]
		private IEnumerator Start()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Start>d__0(0)
			{
				<>4__this = this
			};
		}

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

		private void SetBattleScene(Transform sceneTransform)
		{
			BattleWave val = ((Component)sceneTransform.Find("Beastfly States/Active")).gameObject.AddComponent<BattleWave>();
			BattleScene component = GameObject.Find("Battle Scene").GetComponent<BattleScene>();
			component.battleStartClip = null;
			component.completed = false;
			component.battleEndPause = 8f;
			component.musicCueStart = null;
			component.setPDBoolOnEnd = "no";
			component.openGatesOnEnd = true;
			component.toggleWavesAwake = true;
			component.waves = new List<BattleWave> { val };
			val.Init(component);
			((Behaviour)((Component)component).GetComponent<BoxCollider2D>()).enabled = true;
		}

		private void DisableExistingPlatforms()
		{
			//IL_0084: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			GameObject.Find("Bellshrine Sequence Swamp").SetActive(false);
			foreach (GameObject item in Object.FindObjectsByType<GameObject>((FindObjectsInactive)0, (FindObjectsSortMode)0).Where(delegate(GameObject obj)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				Vector3 position = obj.transform.position;
				float x = position.x;
				float y = position.y;
				return (((Object)obj).name.Contains("swamp_plats_basic") || ((Object)obj).name.Contains("terrain collider")) && x > 45f && x < 78f && y > 3f && y < 24f;
			}))
			{
				item.SetActive(false);
			}
			GameObject.Find("terrain collider non slider (2)").SetActive(false);
			BoxCollider2D component = GameObject.Find("terrain collider (1)").GetComponent<BoxCollider2D>();
			component.size -= Vector2.right * 4f;
			((Collider2D)component).offset = ((Collider2D)component).offset + Vector2.left * 2f;
			BoxCollider2D component2 = GameObject.Find("terrain collider (2)").GetComponent<BoxCollider2D>();
			component2.size -= Vector2.right * 4.5f;
			((Collider2D)component2).offset = ((Collider2D)component2).offset + Vector2.right * 2.25f;
		}

		private void ReplacePlatforms(Transform lavaPlats)
		{
			//IL_0020: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = AssetManager.Get<GameObject>("moss_crumble_plat");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to get moss_crumble_plat!");
				return;
			}
			lavaPlats.position += Vector3.down * 8f;
			Sprite sprite2 = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite sprite) => ((Object)sprite).name == "moss_collapse_plat"));
			for (int i = 1; i <= 6; i++)
			{
				Transform val2 = ((Component)lavaPlats).transform.Find($"Song Golem Floor {i}");
				if (Object.op_Implicit((Object)(object)val2))
				{
					GameObject obj = Object.Instantiate<GameObject>(val, lavaPlats);
					obj.SetActive(true);
					obj.tag = "Target";
					Extensions.SetPosition2D(obj.transform, Vector2.op_Implicit(val2.position));
					((Component)obj.transform.Find("Sprite")).GetComponentInChildren<SpriteRenderer>().sprite = sprite2;
					Object.Destroy((Object)(object)((Component)val2).gameObject);
				}
			}
		}

		private void DisableBench()
		{
			GameObject.Find("RestBench").SetActive(false);
		}
	}
	internal class Mosquito : MonoBehaviour
	{
		private void Awake()
		{
			ModifyComponents();
		}

		private void ModifyComponents()
		{
			//IL_0015: 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)
			((Component)((Component)this).transform.Find("Alert Range")).GetComponent<BoxCollider2D>().size = Vector2.one * 64f;
			ModifyFSMs();
		}

		private void ModifyFSMs()
		{
			ModifyControlFSM();
			ModifyShootFSM();
		}

		private void ModifyControlFSM()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			//IL_0259: 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_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Expected O, but got Unknown
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: 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_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Expected O, but got Unknown
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Expected O, but got Unknown
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Expected O, but got Unknown
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Expected O, but got Unknown
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Expected O, but got Unknown
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Expected O, but got Unknown
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Expected O, but got Unknown
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Expected O, but got Unknown
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Expected O, but got Unknown
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: 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_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Expected O, but got Unknown
			//IL_051c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Expected O, but got Unknown
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Expected O, but got Unknown
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Expected O, but got Unknown
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Expected O, but got Unknown
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Expected O, but got Unknown
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Expected O, but got Unknown
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Expected O, but got Unknown
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Expected O, but got Unknown
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Expected O, but got Unknown
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Expected O, but got Unknown
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Expected O, but got Unknown
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Expected O, but got Unknown
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Expected O, but got Unknown
			//IL_0699: Unknown result type (might be due to invalid IL or missing references)
			//IL_069e: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Expected O, but got Unknown
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Expected O, but got Unknown
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Expected O, but got Unknown
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Expected O, but got Unknown
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0732: Unknown result type (might be due to invalid IL or missing references)
			//IL_0740: Expected O, but got Unknown
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_075a: Expected O, but got Unknown
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0775: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Unknown result type (might be due to invalid IL or missing references)
			//IL_0780: Expected O, but got Unknown
			//IL_0781: Expected O, but got Unknown
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			//IL_0795: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b6: Expected O, but got Unknown
			//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f8: Expected O, but got Unknown
			//IL_0087: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			PlayMakerFSM val = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Control");
			Fsm fsm = val.Fsm;
			FsmVariables fsmVariables = val.FsmVariables;
			List<FsmVector2> list = fsmVariables.Vector2Variables.ToList();
			List<FsmGameObject> list2 = fsmVariables.GameObjectVariables.ToList();
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(61.5f, 13.5f);
			if (((Object)this).name.Contains("(1)"))
			{
				val2 += Vector2.left * 8f;
			}
			else if (((Object)this).name.Contains("(2)"))
			{
				val2 += Vector2.right * 8f;
			}
			FsmVector2 val3 = new FsmVector2("Summon Position")
			{
				Value = val2
			};
			list.Add(val3);
			FsmGameObject val4 = new FsmGameObject("Hero");
			list2.Add(val4);
			List<FsmState> list3 = fsm.States.ToList();
			FsmState state = fsm.GetState("Start Idle");
			GameObject val5 = GameObject.Find("Summon Enemies");
			FsmEvent fsmEvent = FsmEvent.GetFsmEvent("SUMMON");
			FsmFloat val6 = new FsmFloat("")
			{
				UseVariable = true
			};
			FsmState val7 = new FsmState(fsm);
			val7.Name = "Activate";
			val7.Actions = (FsmStateAction[])(object)new FsmStateAction[2]
			{
				(FsmStateAction)new SetCollider
				{
					gameObject = new FsmOwnerDefault(),
					active = FsmBool.op_Implicit(true),
					resetOnExit = false
				},
				(FsmStateAction)new Tk2dSpriteSetColor
				{
					gameObject = new FsmOwnerDefault(),
					color = FsmColor.op_Implicit(Color.white),
					everyframe = false
				}
			};
			val7.Transitions = (FsmTransition[])(object)new FsmTransition[1]
			{
				new FsmTransition
				{
					FsmEvent = FsmEvent.Finished,
					ToFsmState = state,
					ToState = state.Name
				}
			};
			FsmState val8 = val7;
			list3.Add(val8);
			val7 = new FsmState(fsm);
			val7.Name = "Fly In";
			val7.Actions = (FsmStateAction[])(object)new FsmStateAction[8]
			{
				(FsmStateAction)new Tk2dPlayAnimation
				{
					gameObject = new FsmOwnerDefault(),
					animLibName = FsmString.op_Implicit(""),
					clipName = FsmString.op_Implicit("Shift Fly")
				},
				(FsmStateAction)new SetPosition2d
				{
					gameObject = new FsmOwnerDefault(),
					vector = val3,
					x = val6,
					y = val6,
					space = (Space)0,
					everyFrame = false,
					lateUpdate = false
				},
				(FsmStateAction)new Translate
				{
					gameObject = new FsmOwnerDefault(),
					vector = new FsmVector3("")
					{
						UseVariable = true
					},
					x = FsmFloat.op_Implicit(0f),
					y = FsmFloat.op_Implicit(10f),
					z = FsmFloat.op_Implicit(20f),
					space = (Space)0,
					perSecond = false,
					everyFrame = false,
					lateUpdate = false,
					fixedUpdate = false
				},
				(FsmStateAction)new GetHero
				{
					storeResult = val4
				},
				(FsmStateAction)new FaceObjectV2
				{
					objectA = new FsmOwnerDefault(),
					objectB = val4,
					spriteFacesRight = FsmBool.op_Implicit(false),
					playNewAnimation = false,
					newAnimationClip = FsmString.op_Implicit(""),
					resetFrame = false,
					everyFrame = false,
					pauseBetweenTurns = 0.5f
				},
				(FsmStateAction)new SetMeshRenderer
				{
					gameObject = new FsmOwnerDefault(),
					active = FsmBool.op_Implicit(true)
				},
				(FsmStateAction)new AnimatePositionBy
				{
					gameObject = new FsmOwnerDefault(),
					shiftBy = FsmVector3.op_Implicit(new Vector3(0f, -10f, -20f)),
					time = FsmFloat.op_Implicit(0.75f),
					speed = val6,
					delay = val6,
					easeType = (EaseType)13,
					reverse = FsmBool.op_Implicit(false),
					finishEvent = FsmEvent.Finished,
					realTime = false
				},
				(FsmStateAction)new Tk2dSpriteTweenColor
				{
					gameObject = new FsmOwnerDefault(),
					color = FsmColor.op_Implicit(Color.white),
					duration = FsmFloat.op_Implicit(0.75f)
				}
			};
			val7.Transitions = (FsmTransition[])(object)new FsmTransition[1]
			{
				new FsmTransition
				{
					FsmEvent = FsmEvent.Finished,
					ToFsmState = val8,
					ToState = val8.Name
				}
			};
			FsmState val9 = val7;
			list3.Add(val9);
			val7 = new FsmState(fsm);
			val7.Name = "Set Summoned";
			val7.Actions = (FsmStateAction[])(object)new FsmStateAction[2]
			{
				(FsmStateAction)new SetParent
				{
					gameObject = new FsmOwnerDefault(),
					parent = null,
					resetLocalPosition = FsmBool.op_Implicit(false),
					resetLocalRotation = FsmBool.op_Implicit(false)
				},
				(FsmStateAction)new WaitRandom
				{
					timeMin = FsmFloat.op_Implicit(0.4f),
					timeMax = FsmFloat.op_Implicit(0.8f),
					finishEvent = FsmEvent.Finished,
					realTime = false
				}
			};
			val7.Transitions = (FsmTransition[])(object)new FsmTransition[1]
			{
				new FsmTransition
				{
					FsmEvent = FsmEvent.Finished,
					ToFsmState = val9,
					ToState = val9.Name
				}
			};
			FsmState val10 = val7;
			list3.Add(val10);
			val7 = new FsmState(fsm);
			val7.Name = "Fly In Ready";
			val7.Actions = (FsmStateAction[])(object)new FsmStateAction[3]
			{
				(FsmStateAction)new SetMeshRenderer
				{
					gameObject = new FsmOwnerDefault(),
					active = FsmBool.op_Implicit(false)
				},
				(FsmStateAction)new SetCollider
				{
					gameObject = new FsmOwnerDefault(),
					active = FsmBool.op_Implicit(false),
					resetOnExit = false
				},
				(FsmStateAction)new Tk2dSpriteSetColor
				{
					gameObject = new FsmOwnerDefault(),
					color = FsmColor.op_Implicit(new Color(0f, 0f, 0f, 0f)),
					everyframe = false
				}
			};
			val7.Transitions = (FsmTransition[])(object)new FsmTransition[1]
			{
				new FsmTransition
				{
					FsmEvent = fsmEvent,
					ToFsmState = val10,
					ToState = val10.Name
				}
			};
			FsmState val11 = val7;
			list3.Add(val11);
			HealthManager component = ((Component)this).GetComponent<HealthManager>();
			component.deathReset = true;
			component.hasSpecialDeath = true;
			component.shellShardDrops = 0;
			val7 = new FsmState(fsm);
			val7.Name = "Reset";
			val7.Actions = (FsmStateAction[])(object)new FsmStateAction[4]
			{
				(FsmStateAction)new SetHP
				{
					target = new FsmOwnerDefault(),
					hp = FsmInt.op_Implicit(component.initHp)
				},
				(FsmStateAction)new SetParent
				{
					gameObject = new FsmOwnerDefault(),
					parent = FsmGameObject.op_Implicit(val5),
					resetLocalPosition = FsmBool.op_Implicit(true),
					resetLocalRotation = FsmBool.op_Implicit(false)
				},
				(FsmStateAction)new SetVelocity2d
				{
					gameObject = new FsmOwnerDefault(),
					vector = FsmVector2.op_Implicit(Vector2.zero),
					x = FsmFloat.op_Implicit(0f),
					y = FsmFloat.op_Implicit(0f),
					everyFrame = false
				},
				(FsmStateAction)new AudioStopV2
				{
					gameObject = new FsmOwnerDefault(),
					fadeTime = FsmFloat.op_Implicit(0f),
					cancelOnEarlyExit = false
				}
			};
			val7.Transitions = (FsmTransition[])(object)new FsmTransition[1]
			{
				new FsmTransition
				{
					FsmEvent = FsmEvent.Finished,
					ToFsmState = val11,
					ToState = val11.Name
				}
			};
			FsmState val12 = val7;
			list3.Add(val12);
			val7 = new FsmState(fsm);
			val7.Name = "Death";
			val7.Actions = (FsmStateAction[])(object)new FsmStateAction[1] { (FsmStateAction)new SimulateDeath
			{
				target = new FsmOwnerDefault()
			} };
			val7.Transitions = (FsmTransition[])(object)new FsmTransition[1]
			{
				new FsmTransition
				{
					FsmEvent = FsmEvent.Finished,
					ToFsmState = val12,
					ToState = val12.Name
				}
			};
			FsmState val13 = val7;
			list3.Add(val13);
			FsmEvent fsmEvent2 = FsmEvent.GetFsmEvent("ZERO HP");
			FsmTransition element = new FsmTransition
			{
				FsmEvent = fsmEvent2,
				ToFsmState = val13,
				ToState = val13.Name
			};
			fsmVariables.GameObjectVariables = list2.ToArray();
			fsmVariables.Vector2Variables = list.ToArray();
			fsm.States = list3.ToArray();
			fsm.Events = fsm.Events.Append(fsmEvent).ToArray();
			fsm.GlobalTransitions = fsm.GlobalTransitions.Append(element).ToArray();
			val.SetState(val11.Name);
		}

		private void ModifyShootFSM()
		{
			//IL_002c: 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_004c: Expected O, but got Unknown
			Fsm fsm = FSMUtility.LocateMyFSM(((Component)this).gameObject, "Shoot").Fsm;
			FsmState state = fsm.GetState("Idle");
			FsmEvent fsmEvent = FsmEvent.GetFsmEvent("ZERO HP");
			fsm.GlobalTransitions = Enumerable.Append(element: new FsmTransition
			{
				FsmEvent = fsmEvent,
				ToFsmState = state,
				ToState = state.Name
			}, source: fsm.GlobalTransitions).ToArray();
		}
	}
}