Decompiled source of InnerEigongMac v0.6.5

InnerEigong.dll

Decompiled 3 weeks 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.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.CompilerServices;
using HarmonyLib;
using I2.Loc;
using Microsoft.CodeAnalysis;
using RCGFSM.Animation;
using RCGMaker.Core;
using UnityEngine;
using UnityEngine.Events;
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("InnerEigong")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mods the true final boss to be more difficult.")]
[assembly: AssemblyFileVersion("0.6.5.0")]
[assembly: AssemblyInformationalVersion("0.6.5+382e78438ef374c96168048e7e68b044c84ebff3")]
[assembly: AssemblyProduct("InnerEigong")]
[assembly: AssemblyTitle("InnerEigong")]
[assembly: AssemblyVersion("0.6.5.0")]
[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 InnerEigong
{
	[RequireComponent(typeof(Animator))]
	internal class AnimatorFixer : MonoBehaviour
	{
		private MonsterBase _monster;

		private GameObject _phase2Activator;

		private GameObject[] _activatorChildren;

		private bool[] _previousActiveChildren;

		private void Awake()
		{
			_monster = ((Component)this).GetComponentInParent<MonsterBase>();
			if (!Object.op_Implicit((Object)(object)_monster))
			{
				return;
			}
			_phase2Activator = ((Component)_monster.monsterCore.logicRoot.Find("Phase2 Activator")).gameObject;
			if (Object.op_Implicit((Object)(object)_phase2Activator))
			{
				_activatorChildren = (from child in ((Component)_phase2Activator.transform).GetComponentsInChildren<FxPlayer>(true)
					select ((Component)child).gameObject).ToArray();
				_previousActiveChildren = _activatorChildren.Select((GameObject child) => child.gameObject.activeSelf).ToArray();
			}
		}

		private void Update()
		{
			for (int i = 0; i < _activatorChildren.Length; i++)
			{
				if (_activatorChildren[i].activeSelf != _previousActiveChildren[i])
				{
					_phase2Activator.SetActive(true);
					_previousActiveChildren = _activatorChildren.Select((GameObject child) => child.activeSelf).ToArray();
					break;
				}
			}
		}
	}
	internal static class AssetManager
	{
		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <Load>d__1 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			private Assembly <assembly>5__2;

			private string[] <>7__wrap2;

			private int <>7__wrap3;

			private Stream <stream>5__5;

			private object <>7__wrap5;

			private int <>7__wrap6;

			private AssetBundleRequestAllAssetsAwaiter <>u__1;

			private ValueTaskAwaiter <>u__2;

			private void MoveNext()
			{
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: 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_008b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: 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)
				int num = <>1__state;
				try
				{
					if (num == 0)
					{
						goto IL_0068;
					}
					if (num != 1)
					{
						<assembly>5__2 = Assembly.GetExecutingAssembly();
						<>7__wrap2 = <assembly>5__2.GetManifestResourceNames();
						<>7__wrap3 = 0;
						goto IL_02a4;
					}
					ValueTaskAwaiter awaiter = <>u__2;
					<>u__2 = default(ValueTaskAwaiter);
					num = (<>1__state = -1);
					goto IL_0251;
					IL_0251:
					awaiter.GetResult();
					goto IL_0258;
					IL_0258:
					object obj = <>7__wrap5;
					if (obj != null)
					{
						ExceptionDispatchInfo.Capture((obj as Exception) ?? throw obj).Throw();
					}
					int num2 = <>7__wrap6;
					if (num2 != 1)
					{
						<>7__wrap5 = null;
						<stream>5__5 = null;
					}
					<>7__wrap3++;
					goto IL_02a4;
					IL_02a4:
					if (<>7__wrap3 < <>7__wrap2.Length)
					{
						string name = <>7__wrap2[<>7__wrap3];
						<stream>5__5 = <assembly>5__2.GetManifestResourceStream(name);
						<>7__wrap5 = null;
						<>7__wrap6 = 0;
						goto IL_0068;
					}
					<>7__wrap2 = null;
					goto end_IL_0007;
					IL_0068:
					try
					{
						AssetBundleRequestAllAssetsAwaiter awaiter2;
						if (num == 0)
						{
							awaiter2 = <>u__1;
							<>u__1 = default(AssetBundleRequestAllAssetsAwaiter);
							num = (<>1__state = -1);
							goto IL_00dc;
						}
						if (<stream>5__5 != null)
						{
							AssetBundleRequestAllAssetsAwaiter val = UnityAsyncExtensions.AwaitForAllAssets(AssetBundle.LoadFromStream(<stream>5__5).LoadAllAssetsAsync());
							awaiter2 = ((AssetBundleRequestAllAssetsAwaiter)(ref val)).GetAwaiter();
							if (!((AssetBundleRequestAllAssetsAwaiter)(ref awaiter2)).IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter2;
								((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<AssetBundleRequestAllAssetsAwaiter, <Load>d__1>(ref awaiter2, ref this);
								return;
							}
							goto IL_00dc;
						}
						<>7__wrap6 = 1;
						goto end_IL_0068;
						IL_00dc:
						Object[] result = ((AssetBundleRequestAllAssetsAwaiter)(ref awaiter2)).GetResult();
						foreach (Object val2 in result)
						{
							if (!Object.op_Implicit(val2))
							{
								continue;
							}
							Type type = ((object)val2).GetType();
							if (_assets.ContainsKey(type))
							{
								if (_assets[type].TryAdd(val2.name, val2))
								{
									Log.Info($"Added asset {val2.name} of type {type}");
								}
								else
								{
									Log.Error($"Failed to add {val2.name} of type {type}!");
								}
							}
							else if (_assets.TryAdd(type, new Dictionary<string, Object> { [val2.name] = val2 }))
							{
								Log.Info($"Added new sub-dictionary of type {type} with initial asset {val2.name}");
							}
							else
							{
								Log.Error($"Failed to add new sub-dictionary of type {type} with initial asset {type} {val2.name}!");
							}
						}
						end_IL_0068:;
					}
					catch (object obj2)
					{
						<>7__wrap5 = obj2;
					}
					if (<stream>5__5 != null)
					{
						awaiter = <stream>5__5.DisposeAsync().GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__2 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ValueTaskAwaiter, <Load>d__1>(ref awaiter, ref this);
							return;
						}
						goto IL_0251;
					}
					goto IL_0258;
					end_IL_0007:;
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					<assembly>5__2 = null;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				<assembly>5__2 = null;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

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

		[AsyncStateMachine(typeof(<Load>d__1))]
		internal static UniTask Load()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			<Load>d__1 <Load>d__ = default(<Load>d__1);
			<Load>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<Load>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <Load>d__.<>t__builder)).Start<<Load>d__1>(ref <Load>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <Load>d__.<>t__builder)).Task;
		}

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

		internal static bool TryGet<T>(string assetName, out T? asset) where T : Object
		{
			if (_assets.TryGetValue(typeof(T), out Dictionary<string, Object> value))
			{
				if (value.TryGetValue(assetName, out var value2))
				{
					asset = (T)(object)((value2 is T) ? value2 : null);
					return true;
				}
				Log.Error("Failed to get asset " + assetName);
				asset = default(T);
				return false;
			}
			Log.Error($"Failed to get sub-dictionary of type {typeof(T)}");
			asset = default(T);
			return false;
		}

		internal static T? Inst<T>(string assetName, Transform? parent) where T : Object
		{
			if (TryGet<T>(assetName, out T asset))
			{
				return Object.Instantiate<T>(asset, parent);
			}
			throw new NullReferenceException("Failed to get asset " + assetName + ": asset is null!");
		}

		internal static T? Inst<T>(string assetName, Vector2 position) where T : Object
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (TryGet<T>(assetName, out T asset))
			{
				return Object.Instantiate<T>(asset, Vector2.op_Implicit(position), Quaternion.identity);
			}
			throw new NullReferenceException("Failed to get asset " + assetName + ": asset is null!");
		}
	}
	[RequireComponent(typeof(SpriteRenderer))]
	internal class ColorKeyOverlayer : MonoBehaviour
	{
		private SpriteRenderer _spriteRenderer;

		private static readonly int OverlayScaleID = Shader.PropertyToID("_OverlayScale");

		private static readonly int ToleranceID = Shader.PropertyToID("_Tolerance");

		private static readonly int SmoothingID = Shader.PropertyToID("_Smoothing");

		private Material _spriteMaterial => ((Renderer)_spriteRenderer).material;

		internal float Tolerance
		{
			get
			{
				return _spriteMaterial.GetFloat(ToleranceID);
			}
			set
			{
				_spriteMaterial.SetFloat(ToleranceID, value);
			}
		}

		internal float Smoothing
		{
			get
			{
				return _spriteMaterial.GetFloat(SmoothingID);
			}
			set
			{
				_spriteMaterial.SetFloat(SmoothingID, value);
			}
		}

		internal float OverlayScale
		{
			get
			{
				return _spriteMaterial.GetFloat(OverlayScaleID);
			}
			set
			{
				_spriteMaterial.SetFloat(OverlayScaleID, value);
			}
		}

		private void Awake()
		{
			((Component)this).TryGetComponent<SpriteRenderer>(ref _spriteRenderer);
			if (AssetManager.TryGet<Material>("_2dxFX_ColorKeyOverlay", out Material asset))
			{
				((Renderer)_spriteRenderer).material = asset;
			}
		}
	}
	internal static class ConfigManager
	{
		private static readonly string BossModifierSectionName = "Boss.Modifiers";

		private static ConfigEntry<int>? _numberOfPhantoms;

		private static ConfigEntry<float>? _phantomSpawnChance;

		internal static int NumberOfPhantoms => _numberOfPhantoms.Value;

		internal static float PhantomSpawnChance => _phantomSpawnChance.Value;

		internal static void Initialize(ConfigFile config)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			_numberOfPhantoms = config.Bind<int>(BossModifierSectionName, "Number of Phantoms", 1, new ConfigDescription("The number of Eigong phantoms to possibly spawn for certain attacks. Capped at 4 phantoms.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
			_phantomSpawnChance = config.Bind<float>(BossModifierSectionName, "Phantom Spawn Chance", 0.5f, new ConfigDescription("The chance that a phantom may spawn for any of a certain number of attacks. Ranges from 0 (never spawn) to 1 (always spawn).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}
	}
	internal static class Constants
	{
		internal const string BossSceneName = "A11_S0_Boss_YiGung";

		internal const string BossName = "Boss_Yi Gung";

		internal const States GunMonsterState = 132;

		internal const string GunMonsterAnimation = "Gun Prepare";
	}
	[RequireComponent(typeof(StealthGameMonster))]
	internal class Eigong : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__FadeOutAllPhantoms;
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <FireLaser>d__20 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			public Eigong <>4__this;

			private CancellationToken <fireLaserCancelToken>5__2;

			private float <halfDt>5__3;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: 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_023e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0245: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0350: Unknown result type (might be due to invalid IL or missing references)
				//IL_0355: Unknown result type (might be due to invalid IL or missing references)
				//IL_035c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: 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_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0292: Unknown result type (might be due to invalid IL or missing references)
				//IL_0296: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0317: Unknown result type (might be due to invalid IL or missing references)
				//IL_031c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0320: Unknown result type (might be due to invalid IL or missing references)
				//IL_0325: 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_01a8: 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_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_02af: 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_0339: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: 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_0105: 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)
				int num = <>1__state;
				Eigong eigong = <>4__this;
				try
				{
					UniTask val;
					Awaiter awaiter;
					float num2;
					switch (num)
					{
					default:
					{
						((PhysicsMover)eigong._monster).Velocity = Vector2.zero;
						Transform obj = ((Component)eigong.Anim).transform.Find("View/YiGung/Head");
						obj.Find("Hair").localPosition = Vector3.zero;
						((Component)obj).gameObject.SetActive(true);
						eigong._fireLaserCancelTokenSrc?.Cancel();
						eigong._fireLaserCancelTokenSrc?.Dispose();
						eigong._fireLaserCancelTokenSrc = new CancellationTokenSource();
						<fireLaserCancelToken>5__2 = eigong._fireLaserCancelTokenSrc.Token;
						eigong.Anim.runtimeAnimatorController = eigong._newController;
						((MonsterBase)eigong._monster).FacePlayer();
						eigong.RestartArmFollow();
						val = UniTask.Delay(TimeSpan.FromSeconds(eigong._laserFireEventTimes[0]), false, (PlayerLoopTiming)8, <fireLaserCancelToken>5__2);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FireLaser>d__20>(ref awaiter, ref this);
							return;
						}
						goto IL_013a;
					}
					case 0:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_013a;
					case 1:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_01dc;
					case 2:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_0254;
					case 3:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_02e4;
					case 4:
						{
							awaiter = <>u__1;
							<>u__1 = default(Awaiter);
							num = (<>1__state = -1);
							break;
						}
						IL_013a:
						((Awaiter)(ref awaiter)).GetResult();
						num2 = eigong._laserFireEventTimes[1] - eigong._laserFireEventTimes[0];
						eigong.StopArmFollow();
						((MonsterBase)eigong._monster).FacePlayer();
						<halfDt>5__3 = num2 / 2f;
						val = UniTask.Delay(TimeSpan.FromSeconds(<halfDt>5__3), false, (PlayerLoopTiming)8, <fireLaserCancelToken>5__2);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FireLaser>d__20>(ref awaiter, ref this);
							return;
						}
						goto IL_01dc;
						IL_02e4:
						((Awaiter)(ref awaiter)).GetResult();
						num2 = eigong._laserFireEventTimes[3] - eigong._laserFireEventTimes[2];
						((MonsterBase)eigong._monster).FacePlayer();
						val = UniTask.Delay(TimeSpan.FromSeconds(num2), false, (PlayerLoopTiming)8, <fireLaserCancelToken>5__2);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 4);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FireLaser>d__20>(ref awaiter, ref this);
							return;
						}
						break;
						IL_01dc:
						((Awaiter)(ref awaiter)).GetResult();
						eigong.RestartArmFollow();
						val = UniTask.Delay(TimeSpan.FromSeconds(<halfDt>5__3), false, (PlayerLoopTiming)8, <fireLaserCancelToken>5__2);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 2);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FireLaser>d__20>(ref awaiter, ref this);
							return;
						}
						goto IL_0254;
						IL_0254:
						((Awaiter)(ref awaiter)).GetResult();
						num2 = eigong._laserFireEventTimes[2] - eigong._laserFireEventTimes[1];
						eigong.StopArmFollow();
						((MonsterBase)eigong._monster).FacePlayer();
						val = UniTask.Delay(TimeSpan.FromSeconds(num2), false, (PlayerLoopTiming)8, <fireLaserCancelToken>5__2);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 3);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FireLaser>d__20>(ref awaiter, ref this);
							return;
						}
						goto IL_02e4;
					}
					((Awaiter)(ref awaiter)).GetResult();
					eigong.ResetAnimator();
					((MonsterBase)eigong._monster).ChangeStateIfValid((States)3);
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					<fireLaserCancelToken>5__2 = default(CancellationToken);
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				<fireLaserCancelToken>5__2 = default(CancellationToken);
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		private StealthGameMonster _monster;

		private AnimatorOverrideController _originalController;

		private RuntimeAnimatorController _newController;

		private float[] _laserFireEventTimes;

		private DamageDealer[] _damageDealers;

		private OldPivotRotate _armRotate;

		private LaserAttackController _laserAttack;

		private static States[] _gunPrevStates;

		private CancellationTokenSource? _fireLaserCancelTokenSrc;

		private Animator Anim => ((Actor)_monster).animator;

		private void Awake()
		{
			((Component)this).TryGetComponent<StealthGameMonster>(ref _monster);
			((MonsterBase)_monster).OverrideWanderingIdleTime(0f);
			ref AnimatorOverrideController originalController = ref _originalController;
			RuntimeAnimatorController runtimeAnimatorController = Anim.runtimeAnimatorController;
			originalController = (AnimatorOverrideController)(object)((runtimeAnimatorController is AnimatorOverrideController) ? runtimeAnimatorController : null);
			AssetManager.TryGet<RuntimeAnimatorController>("Inner Eigong Controller", out _newController);
			RuntimeAnimatorController newController = _newController;
			AnimationClip val = ((newController != null) ? ((IEnumerable<AnimationClip>)newController.animationClips).FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip clip) => ((Object)clip).name == "Gun Prepare")) : null);
			_laserFireEventTimes = val.events.Select((AnimationEvent animEvent) => animEvent.time).ToArray();
			PreSetupGunAttack();
			ResetMonster();
		}

		private async void Start()
		{
			await UniTask.WaitUntil((Func<bool>)(() => ((MonsterBase)_monster).fsm != null), (PlayerLoopTiming)8, default(CancellationToken));
			PostSetupGunAttack();
			SetupTrackingSlashes();
			((Component)Anim).gameObject.AddComponent<AnimatorFixer>();
		}

		private void OnDestroy()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			((MonsterBase)_monster).fsm.Changed -= CheckCreateTrackingSlashes;
			UnityEvent onPostureEmpty = ((MonsterBase)_monster).postureSystem.OnPostureEmpty;
			onPostureEmpty.RemoveListener(new UnityAction(ResetAnimator));
			object obj = <>O.<0>__FadeOutAllPhantoms;
			if (obj == null)
			{
				UnityAction val = PhantomManager.FadeOutAllPhantoms;
				<>O.<0>__FadeOutAllPhantoms = val;
				obj = (object)val;
			}
			onPostureEmpty.RemoveListener((UnityAction)obj);
		}

		private void SetupTrackingSlashes()
		{
			Object.Destroy((Object)(object)((Component)((Component)Anim).transform.Find("View/YiGung/Attack Effect/ThurstDelay")).gameObject);
			_damageDealers = ((Component)((MonsterBase)_monster).monsterCore.logicRoot).GetComponentsInChildren<DamageDealer>(true);
			((MonsterBase)_monster).fsm.Changed += CheckCreateTrackingSlashes;
		}

		private void CheckCreateTrackingSlashes(States state)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			if ((int)state == 105)
			{
				DamageDealer[] damageDealers = _damageDealers;
				for (int i = 0; i < damageDealers.Length; i++)
				{
					((Behaviour)damageDealers[i]).enabled = false;
				}
				AssetManager.Inst<GameObject>("Tracking Slashes", (Transform?)null);
			}
			else
			{
				DamageDealer[] damageDealers = _damageDealers;
				for (int i = 0; i < damageDealers.Length; i++)
				{
					((Behaviour)damageDealers[i]).enabled = true;
				}
			}
		}

		private void PreSetupGunAttack()
		{
			//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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//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_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Component)Anim).transform.Find("View/YiGung/Body");
			GameObject val = AssetManager.Inst<GameObject>("Arm", parent);
			((Object)val).name = ((Object)val).name.Replace("(Clone)", "");
			val.transform.localPosition = Vector2.op_Implicit(new Vector2(20f, -23f));
			SpriteRenderer component = val.GetComponent<SpriteRenderer>();
			((Renderer)component).sortingLayerName = "Monster";
			_armRotate = val.AddComponent<OldPivotRotate>();
			_armRotate.inverseAngle = true;
			_armRotate.KeepLookAtPlayer = true;
			_armRotate.minRotate = -60f;
			_armRotate.maxRotate = 75f;
			_armRotate.offset = 0f;
			_armRotate.referenceActor = (Actor)(object)_monster;
			if (PreloadManager.TryGet("Sniper", out GameObject obj))
			{
				Transform val2 = obj.transform.Find("Dragon_Sniper/DragonSniper/RotateRArm/RArm/Bow");
				GameObject val3 = Object.Instantiate<GameObject>(((Component)((Component)val2).transform.Find("SniperLaserCore")).gameObject, val.transform);
				((Object)val3).name = ((Object)val3).name.Replace("(Clone)", "");
				val3.transform.localPosition = Vector2.op_Implicit(new Vector2(-38f, 5.3f));
				val3.transform.localScale = new Vector3(-1f, 1f, 1f);
				Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer obj2 in componentsInChildren)
				{
					obj2.sortingLayerName = "Monster";
					obj2.sortingOrder = ((Renderer)component).sortingOrder - 100;
				}
				Traverse.Create((object)val3.AddComponent<GeneralParriableOwner>()).Field<MonsterBase>("bindMonster").Value = (MonsterBase)(object)_monster;
				SpawnAtPoint val4 = ((IEnumerable<SpawnAtPoint>)val3.GetComponentsInChildren<SpawnAtPoint>(true)).FirstOrDefault((Func<SpawnAtPoint, bool>)((SpawnAtPoint child) => ((Object)child).name == "ShootPos"));
				if (Object.op_Implicit((Object)(object)val4))
				{
					Transform transform = ((Component)val4).transform;
					transform.localPosition += Vector3.right;
					Transform obj3 = Object.Instantiate<Transform>(val2.Find("BowHead/512 fade inner circle blurred"), ((Component)val4).transform);
					((Object)obj3).name = "Anticipation Sphere";
					Vector3 val5 = Vector3.right * 24f;
					Transform transform2 = ((Component)obj3).transform;
					transform2.localPosition += val5;
					((Component)obj3).gameObject.SetActive(true);
					Transform obj4 = ((Component)val4).transform.Find("ShootExplosion");
					obj4.localPosition += val5;
				}
				_laserAttack = val3.GetComponentInChildren<LaserAttackController>(true);
				ParriableAttackEffect val6 = ((Component)_laserAttack).gameObject.AddComponent<ParriableAttackEffect>();
				val6.param = new ParryParam
				{
					knockBackType = (KnockBackType)3,
					knockBackValue = 500f,
					LiftYForce = 100f,
					hurtLiftType = (HurtType)3
				};
				((Component)_laserAttack).gameObject.SetActive(true);
				DamageDealer componentInChildren = ((Component)_laserAttack).GetComponentInChildren<DamageDealer>(true);
				componentInChildren.damageAmount = 100f;
				componentInChildren.attacker = ((Component)this).GetComponentInChildren<Health>();
				componentInChildren.bindingParry = val6;
				val6.bindDamage = componentInChildren;
				((MonoBehaviour)((Component)_laserAttack).GetComponentInChildren<TriggerDetector>(true)).Invoke("Awake", 0f);
				val3.SetActive(true);
				((Component)val3.GetComponentInChildren<LaserViewController>(true)).gameObject.SetActive(true);
				val.SetActive(false);
				Transform parent2 = ((Component)this).transform.Find("States/Attacks");
				GameObject val7 = new GameObject($"[{132}] Gun");
				val7.transform.SetParent(parent2);
				BossGeneralState val8 = val7.AddComponent<BossGeneralState>();
				((MonsterState)val8).BindingAnimation = "Gun Prepare";
				((MonsterState)val8).BindingAnimation = "Gun Prepare";
				val8.state = (States)132;
				val8.ToCloseTransitionState = (States)109;
				AssetManager.TryGet<AnimationClip>("Gun Prepare", out ((MonsterState)val8).clip);
				val8.EnterLevelReset();
				GameObject obj5 = Object.Instantiate<GameObject>(((Component)obj.transform.Find("LogicRoot/Audio/EnemySFX_Sniper_Attack")).gameObject, ((MonsterBase)_monster).monsterCore.logicRoot.Find("Audio"));
				((Object)obj5).name = ((Object)obj5).name.Replace("(Clone)", "");
				SoundPlayer component2 = obj5.GetComponent<SoundPlayer>();
				AkBankManager.LoadBank("Dragon_Sniper", false, false, (MonoBehaviour)(object)component2);
				component2.EnterLevelReset();
			}
		}

		private void PostSetupGunAttack()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0073: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			MonsterState val = ((MonsterBase)_monster).FindState((States)132);
			Transform transform = ((Component)val).transform;
			GameObject val2 = new GameObject("weight");
			val2.transform.SetParent(transform);
			LinkNextMoveStateWeight obj = val2.AddComponent<LinkNextMoveStateWeight>();
			AttackWeight item = new AttackWeight
			{
				state = val,
				weight = 1
			};
			StealthEngaging componentInChildren = ((Component)_monster).GetComponentInChildren<StealthEngaging>(true);
			AttackWeight item2 = new AttackWeight
			{
				state = (MonsterState)(object)componentInChildren,
				weight = 1
			};
			obj.stateWeightList = new List<AttackWeight>(1) { item2 };
			States[] gunPrevStates = _gunPrevStates;
			foreach (States val3 in gunPrevStates)
			{
				LinkNextMoveStateWeight[] componentsInChildren = ((Component)((MonsterBase)_monster).FindState(val3)).GetComponentsInChildren<LinkNextMoveStateWeight>(true);
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					componentsInChildren[j].stateWeightList.Add(item);
				}
			}
			UnityEvent onPostureEmpty = ((MonsterBase)_monster).postureSystem.OnPostureEmpty;
			onPostureEmpty.AddListener(new UnityAction(ResetAnimator));
			object obj2 = <>O.<0>__FadeOutAllPhantoms;
			if (obj2 == null)
			{
				UnityAction val4 = PhantomManager.FadeOutAllPhantoms;
				<>O.<0>__FadeOutAllPhantoms = val4;
				obj2 = (object)val4;
			}
			onPostureEmpty.AddListener((UnityAction)obj2);
		}

		private void StopArmFollow()
		{
			_armRotate.KeepLookAtPlayer = false;
		}

		private void RestartArmFollow()
		{
			_armRotate.KeepLookAtPlayer = true;
		}

		[AsyncStateMachine(typeof(<FireLaser>d__20))]
		internal UniTask FireLaser()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			<FireLaser>d__20 <FireLaser>d__ = default(<FireLaser>d__20);
			<FireLaser>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<FireLaser>d__.<>4__this = this;
			<FireLaser>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <FireLaser>d__.<>t__builder)).Start<<FireLaser>d__20>(ref <FireLaser>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <FireLaser>d__.<>t__builder)).Task;
		}

		private void ResetAnimator()
		{
			_fireLaserCancelTokenSrc?.Cancel();
			_fireLaserCancelTokenSrc = null;
			Anim.runtimeAnimatorController = (RuntimeAnimatorController)(object)_originalController;
			((Component)_armRotate).gameObject.SetActive(false);
		}

		private void ResetMonster()
		{
			AutoAttributeManager.AutoReferenceAllChildren(((Component)this).gameObject);
			Traverse.Create((object)_monster).Field("_inited").SetValue((object)false);
			((MonoBehaviour)_monster).Invoke("CheckInit", 0f);
			((PhysicsMover)_monster).EnterLevelReset();
		}

		static Eigong()
		{
			States[] array = new States[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			_gunPrevStates = (States[])(object)array;
		}
	}
	internal class FireTrail : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Start>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FireTrail <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				int num = <>1__state;
				FireTrail CS$<>8__locals0 = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)delegate
					{
						CS$<>8__locals0._firePool = ((IEnumerable<ObjectPool>)SingletonBehaviour<PoolManager>.Instance.allPools).FirstOrDefault((Func<ObjectPool, bool>)((ObjectPool pool) => ((Object)pool._prefab).name == "Fire_FX_damage_Long jiechuan"));
						return CS$<>8__locals0._firePool != null;
					});
					<>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();
			}
		}

		internal float flameSpacing = 35f;

		private ActorBody _body;

		private Collider2D _collider;

		private ObjectPool _firePool;

		private readonly List<PoolObject> _flames = new List<PoolObject>();

		private void Awake()
		{
			_body = ((Component)this).GetComponentInChildren<ActorBody>(true);
			_collider = ((Component)_body).GetComponent<Collider2D>();
		}

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

		private void Update()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0088: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (!_body.actor.IsOnGround || _firePool == null)
			{
				return;
			}
			Bounds bounds = _collider.bounds;
			float x = ((Bounds)(ref bounds)).center.x;
			bounds = _collider.bounds;
			float y = ((Bounds)(ref bounds)).min.y;
			if (_flames.Count > 0)
			{
				PoolObject val = _flames.Aggregate(_flames[0], delegate(PoolObject closest, PoolObject nextFlame)
				{
					//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_002c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					float num4 = Mathf.Abs(((Component)nextFlame).transform.position.x - ((Component)this).transform.position.x);
					float num5 = Mathf.Abs(((Component)closest).transform.position.x - ((Component)this).transform.position.x);
					return (!(num4 < num5)) ? closest : nextFlame;
				});
				float num = ((Component)this).transform.position.x - ((Component)val).transform.position.x;
				if (!(Mathf.Abs(num) <= flameSpacing))
				{
					float num2 = Mathf.Sign(num);
					float num3 = ((Component)val).transform.position.x + flameSpacing * num2;
					bool flag = ((num2 > 0f) ? (num3 <= x) : (num3 >= x));
					Vector2 position = default(Vector2);
					while (flag)
					{
						((Vector2)(ref position))..ctor(num3, y);
						SpawnFlame(position);
						num3 += flameSpacing * num2;
						flag = ((num2 > 0f) ? (num3 <= x) : (num3 >= x));
					}
				}
			}
			else
			{
				Vector2 position2 = default(Vector2);
				((Vector2)(ref position2))..ctor(x, y);
				SpawnFlame(position2);
			}
		}

		internal void SpawnFlame(Vector2 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			PoolObject val = _firePool.Borrow(Vector2.op_Implicit(position), Quaternion.identity, (Transform)null, (Action<PoolObject>)null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			((UnityEvent<PoolObject>)(object)val.OnReturnEvent).AddListener((UnityAction<PoolObject>)delegate(PoolObject obj)
			{
				if (_flames.Contains(obj))
				{
					_flames.Remove(obj);
				}
			});
			_flames.Add(val);
		}

		internal void ResetFlames()
		{
			_flames.Clear();
		}
	}
	internal static class Log
	{
		private static ManualLogSource? logSource;

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

		internal static void Debug(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogError(data);
			}
		}

		internal static void Fatal(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogFatal(data);
			}
		}

		internal static void Info(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogWarning(data);
			}
		}
	}
	[BepInPlugin("InnerEigong", "InnerEigong", "0.6.5")]
	public class Mod : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass3_0
		{
			public GeneralFSMContext fsmContext;

			internal bool <StartEigongFight>b__1()
			{
				return Object.op_Implicit((Object)(object)((StateMachineContext<GeneralState, GeneralState>)(object)fsmContext).currentStateType);
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <InitializeAssets>d__5 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: 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_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					Awaiter awaiter;
					if (num != 0)
					{
						UniTask val = AssetManager.Load();
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <InitializeAssets>d__5>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
					}
					((Awaiter)(ref awaiter)).GetResult();
					if (AssetManager.TryGet<GameObject>("Tracking Slashes", out GameObject asset) && asset != null)
					{
						asset.AddComponent<TrackingSlashes>();
					}
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <StartEigongFight>d__3 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			private <>c__DisplayClass3_0 <>8__1;

			private Awaiter <>u__1;

			private Awaiter<bool> <>u__2;

			private AsyncOperationAwaiter <>u__3;

			private void MoveNext()
			{
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: 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_0208: Unknown result type (might be due to invalid IL or missing references)
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0214: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01da: 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//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_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: 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)
				int num = <>1__state;
				try
				{
					UniTask val;
					Awaiter awaiter;
					Awaiter<bool> awaiter3;
					AsyncOperationAwaiter awaiter2;
					StateMachineOwner val2;
					SaveManager instance;
					switch (num)
					{
					default:
						<>8__1 = new <>c__DisplayClass3_0();
						RuntimeInitHandler.LoadCore();
						ScriptableObjectSingleton<GameConfig>.Instance.InstantiateGameCore();
						val = UniTask.WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)SingletonBehaviour<SaveManager>.Instance)), (PlayerLoopTiming)8, default(CancellationToken));
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <StartEigongFight>d__3>(ref awaiter, ref this);
							return;
						}
						goto IL_00b8;
					case 0:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_00b8;
					case 1:
						awaiter3 = <>u__2;
						<>u__2 = default(Awaiter<bool>);
						num = (<>1__state = -1);
						goto IL_0125;
					case 2:
						awaiter2 = <>u__3;
						<>u__3 = default(AsyncOperationAwaiter);
						num = (<>1__state = -1);
						goto IL_0188;
					case 3:
						{
							awaiter = <>u__1;
							<>u__1 = default(Awaiter);
							num = (<>1__state = -1);
							break;
						}
						IL_0188:
						((AsyncOperationAwaiter)(ref awaiter2)).GetResult();
						val2 = MonoNodeExtension.TryGetComp<StateMachineOwner>(GameObject.Find("General Boss Fight FSM Object Variant"));
						<>8__1.fsmContext = val2.FsmContext;
						val = UniTask.WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)((StateMachineContext<GeneralState, GeneralState>)(object)<>8__1.fsmContext).currentStateType)), (PlayerLoopTiming)8, default(CancellationToken));
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 3);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <StartEigongFight>d__3>(ref awaiter, ref this);
							return;
						}
						break;
						IL_00b8:
						((Awaiter)(ref awaiter)).GetResult();
						instance = SingletonBehaviour<SaveManager>.Instance;
						instance.SavePlayerPref();
						awaiter3 = instance.LoadSaveAtSlot(4).GetAwaiter();
						if (!awaiter3.IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__2 = awaiter3;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<bool>, <StartEigongFight>d__3>(ref awaiter3, ref this);
							return;
						}
						goto IL_0125;
						IL_0125:
						awaiter3.GetResult();
						awaiter2 = UnityAsyncExtensions.GetAwaiter(SceneManager.LoadSceneAsync("A11_S0_Boss_YiGung"));
						if (!((AsyncOperationAwaiter)(ref awaiter2)).IsCompleted)
						{
							num = (<>1__state = 2);
							<>u__3 = awaiter2;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<AsyncOperationAwaiter, <StartEigongFight>d__3>(ref awaiter2, ref this);
							return;
						}
						goto IL_0188;
					}
					((Awaiter)(ref awaiter)).GetResult();
					ICutScene cutscene = ((Component)((StateMachineContext<GeneralState, GeneralState>)(object)<>8__1.fsmContext).currentStateType).GetComponentInChildren<CutScenePlayAction>(true).cutscene;
					SimpleCutsceneManager val3 = (SimpleCutsceneManager)(object)((cutscene is SimpleCutsceneManager) ? cutscene : null);
					if (val3 != null)
					{
						val3.TrySkip();
					}
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					<>8__1 = null;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				<>8__1 = null;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		private static Harmony _harmony;

		private void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
			_harmony = new Harmony("InnerEigong");
			_harmony.PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin InnerEigong is loaded!");
		}

		private async void Start()
		{
			await InitializeAssets();
			await PreloadManager.Initialize();
		}

		[AsyncStateMachine(typeof(<StartEigongFight>d__3))]
		private static UniTask StartEigongFight()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			<StartEigongFight>d__3 <StartEigongFight>d__ = default(<StartEigongFight>d__3);
			<StartEigongFight>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<StartEigongFight>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <StartEigongFight>d__.<>t__builder)).Start<<StartEigongFight>d__3>(ref <StartEigongFight>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <StartEigongFight>d__.<>t__builder)).Task;
		}

		private void OnDestroy()
		{
			AssetManager.Unload();
			PhantomManager.Unload();
			PreloadManager.Unload();
			_harmony.UnpatchSelf();
		}

		[AsyncStateMachine(typeof(<InitializeAssets>d__5))]
		private static UniTask InitializeAssets()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			<InitializeAssets>d__5 <InitializeAssets>d__ = default(<InitializeAssets>d__5);
			<InitializeAssets>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<InitializeAssets>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <InitializeAssets>d__.<>t__builder)).Start<<InitializeAssets>d__5>(ref <InitializeAssets>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <InitializeAssets>d__.<>t__builder)).Task;
		}
	}
	internal static class Patches
	{
		private static States[] _phantomSpawnAttacks;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameLevel), "Awake")]
		private static void ModifyEigong(GameLevel __instance)
		{
			if (!(__instance.SceneName != "A11_S0_Boss_YiGung"))
			{
				GameObject obj = GameObject.Find("Boss_Yi Gung");
				obj.AddComponent<Eigong>();
				PhantomManager.Initialize(obj, ConfigManager.NumberOfPhantoms);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MonsterBase), "ChangeStateIfValid", new Type[]
		{
			typeof(States),
			typeof(States)
		})]
		private static async void CheckSpawnPhantom(MonsterBase __instance)
		{
			if (!(((Object)__instance).name != "Boss_Yi Gung") && new Random((int)Time.timeSinceLevelLoad).Next((int)(1f / ConfigManager.PhantomSpawnChance)) == 0)
			{
				States state = __instance.fsm.State;
				StealthGameMonster val = (StealthGameMonster)(object)((__instance is StealthGameMonster) ? __instance : null);
				if (val != null && _phantomSpawnAttacks.Contains(state))
				{
					await PhantomManager.SpawnPhantoms((MonsterBase)(object)val);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TeleportBinding), "Teleport")]
		private static void ResetFlamesOnTeleport(TeleportBinding __instance)
		{
			((Component)((Component)__instance).transform.root).GetComponentInChildren<FireTrail>()?.ResetFlames();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(LocalizationManager), "GetTranslation")]
		private static void GetInnerEigongTranslation(string Term, ref string __result)
		{
			if (Term != "Characters/NameTag_YiKong")
			{
				return;
			}
			string currentLanguageCode = LocalizationManager.CurrentLanguageCode;
			if (currentLanguageCode == null)
			{
				goto IL_0280;
			}
			int length = currentLanguageCode.Length;
			string text;
			if (length != 2)
			{
				if (length != 5)
				{
					if (length != 7 || !(currentLanguageCode == "fr-FR  "))
					{
						goto IL_0280;
					}
					text = __result + ", Vision";
				}
				else
				{
					switch (currentLanguageCode[3])
					{
					case 'D':
						break;
					case 'U':
						goto IL_00c1;
					case 'E':
						goto IL_00e6;
					case 'B':
						goto IL_00fb;
					case 'C':
						if (currentLanguageCode == "zh-CN")
						{
							goto IL_0271;
						}
						goto IL_0280;
					case 'T':
						if (currentLanguageCode == "zh-TW")
						{
							goto IL_0271;
						}
						goto IL_0280;
					default:
						goto IL_0280;
						IL_0271:
						text = "心中的" + __result;
						goto IL_0283;
					}
					if (!(currentLanguageCode == "de-DE"))
					{
						goto IL_0280;
					}
					text = __result;
				}
			}
			else
			{
				switch (currentLanguageCode[0])
				{
				case 'i':
					break;
				case 'j':
					goto IL_0164;
				case 'k':
					goto IL_0179;
				case 'p':
					goto IL_018e;
				case 'r':
					goto IL_01a3;
				case 'u':
					goto IL_01b8;
				default:
					goto IL_0280;
				}
				if (!(currentLanguageCode == "it"))
				{
					goto IL_0280;
				}
				text = __result + " interiore";
			}
			goto IL_0283;
			IL_00e6:
			if (currentLanguageCode == "es-ES")
			{
				goto IL_01e7;
			}
			goto IL_0280;
			IL_01e7:
			text = __result + " interior";
			goto IL_0283;
			IL_018e:
			if (!(currentLanguageCode == "pl"))
			{
				goto IL_0280;
			}
			text = "Wewnętrzny " + __result;
			goto IL_0283;
			IL_0280:
			text = __result;
			goto IL_0283;
			IL_00fb:
			if (!(currentLanguageCode == "pt-BR"))
			{
				goto IL_0280;
			}
			text = __result + " Interior";
			goto IL_0283;
			IL_01b8:
			if (!(currentLanguageCode == "uk"))
			{
				goto IL_0280;
			}
			text = "Інакша " + __result;
			goto IL_0283;
			IL_01a3:
			if (!(currentLanguageCode == "ru"))
			{
				goto IL_0280;
			}
			text = "Иная " + __result;
			goto IL_0283;
			IL_00c1:
			if (!(currentLanguageCode == "en-US"))
			{
				if (currentLanguageCode == "es-US")
				{
					goto IL_01e7;
				}
				goto IL_0280;
			}
			text = "Inner " + __result;
			goto IL_0283;
			IL_0179:
			if (!(currentLanguageCode == "ko"))
			{
				goto IL_0280;
			}
			text = "마음속" + __result;
			goto IL_0283;
			IL_0164:
			if (!(currentLanguageCode == "ja"))
			{
				goto IL_0280;
			}
			text = "心中の" + __result;
			goto IL_0283;
			IL_0283:
			__result = text;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MonsterBase), "ChangeStateIfValid", new Type[]
		{
			typeof(States),
			typeof(States)
		})]
		private static async void HandleLaserFire(MonsterBase __instance, States targetState)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Eigong eigong = default(Eigong);
			if (((Component)__instance).TryGetComponent<Eigong>(ref eigong) && (int)targetState == 132)
			{
				await eigong.FireLaser();
			}
		}

		static Patches()
		{
			States[] array = new States[8];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			_phantomSpawnAttacks = (States[])(object)array;
		}
	}
	[RequireComponent(typeof(MonsterBase))]
	internal class Phantom : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass5_0
		{
			public Phantom <>4__this;

			public States currentState;

			internal bool <Spawn>b__0()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				return <>4__this._monster.CurrentState != currentState;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass6_0
		{
			public Phantom <>4__this;

			public float alpha;

			public float fadeStartTime;

			public float fadeTimeSec;

			internal bool <FadeIn>b__0()
			{
				_2dxFX_ColorRGB[] componentsInChildren = ((Component)<>4__this).GetComponentsInChildren<_2dxFX_ColorRGB>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i]._Alpha = alpha;
				}
				_2dxFX_Negative[] componentsInChildren2 = ((Component)<>4__this).GetComponentsInChildren<_2dxFX_Negative>(true);
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					componentsInChildren2[i]._Alpha = alpha;
				}
				alpha = (Time.timeSinceLevelLoad - fadeStartTime) / fadeTimeSec;
				return alpha >= 1f;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass7_0
		{
			public Phantom <>4__this;

			public float alpha;

			public float fadeStartTime;

			public float fadeTimeSec;

			internal bool <FadeOut>b__0()
			{
				_2dxFX_ColorRGB[] componentsInChildren = ((Component)<>4__this).GetComponentsInChildren<_2dxFX_ColorRGB>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i]._Alpha = alpha;
				}
				_2dxFX_Negative[] componentsInChildren2 = ((Component)<>4__this).GetComponentsInChildren<_2dxFX_Negative>(true);
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					componentsInChildren2[i]._Alpha = alpha;
				}
				alpha = 1f - (Time.timeSinceLevelLoad - fadeStartTime) / fadeTimeSec;
				return alpha <= 0f;
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <FadeIn>d__6 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			public Phantom <>4__this;

			public float fadeTimeSec;

			public CancellationToken fadeCancelToken;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: 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_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: 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_0071: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					Awaiter awaiter;
					if (num != 0)
					{
						UniTask val = UniTask.WaitUntil((Func<bool>)new <>c__DisplayClass6_0
						{
							<>4__this = <>4__this,
							fadeTimeSec = fadeTimeSec,
							fadeStartTime = Time.timeSinceLevelLoad,
							alpha = 0f
						}.<FadeIn>b__0, (PlayerLoopTiming)8, fadeCancelToken);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FadeIn>d__6>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
					}
					((Awaiter)(ref awaiter)).GetResult();
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <FadeOut>d__7 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			public Phantom <>4__this;

			public float fadeTimeSec;

			public CancellationToken fadeCancelToken;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_008e: 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_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: 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_0077: 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)
				int num = <>1__state;
				Phantom phantom = <>4__this;
				try
				{
					Awaiter awaiter;
					if (num != 0)
					{
						UniTask val = UniTask.WaitUntil((Func<bool>)new <>c__DisplayClass7_0
						{
							<>4__this = <>4__this,
							fadeTimeSec = fadeTimeSec,
							alpha = 1f,
							fadeStartTime = Time.timeSinceLevelLoad
						}.<FadeOut>b__0, (PlayerLoopTiming)8, fadeCancelToken);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <FadeOut>d__7>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
					}
					((Awaiter)(ref awaiter)).GetResult();
					phantom._monster.Hide();
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <Spawn>d__5 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			public Phantom <>4__this;

			public MonsterBase refMonster;

			public float spawnDelaySeconds;

			public CancellationToken spawnCancelToken;

			private <>c__DisplayClass5_0 <>8__1;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: 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_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: 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_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0085: 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_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: 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_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				//IL_021c: 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_0224: 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)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0238: 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)
				int num = <>1__state;
				Phantom phantom = <>4__this;
				try
				{
					UniTask val;
					Awaiter awaiter;
					switch (num)
					{
					default:
						<>8__1 = new <>c__DisplayClass5_0();
						<>8__1.<>4__this = <>4__this;
						((Component)phantom).transform.position = ((Component)refMonster).transform.position;
						<>8__1.currentState = refMonster.CurrentState;
						val = UniTask.Delay(TimeSpan.FromSeconds(spawnDelaySeconds), false, (PlayerLoopTiming)8, spawnCancelToken);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Spawn>d__5>(ref awaiter, ref this);
							return;
						}
						goto IL_00db;
					case 0:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_00db;
					case 1:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_018e;
					case 2:
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_0203;
					case 3:
						{
							awaiter = <>u__1;
							<>u__1 = default(Awaiter);
							num = (<>1__state = -1);
							break;
						}
						IL_018e:
						((Awaiter)(ref awaiter)).GetResult();
						val = UniTask.WaitUntil((Func<bool>)(() => <>8__1.<>4__this._monster.CurrentState != <>8__1.currentState), (PlayerLoopTiming)8, spawnCancelToken);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 2);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Spawn>d__5>(ref awaiter, ref this);
							return;
						}
						goto IL_0203;
						IL_00db:
						((Awaiter)(ref awaiter)).GetResult();
						phantom._monster.Show();
						phantom._monster.health.SetReceiversActivate(false);
						phantom._monster.health.BecomeInvincible((Object)(object)phantom._monster);
						phantom._monster.ChangeStateIfValid(<>8__1.currentState);
						val = phantom.FadeIn(spawnCancelToken, spawnDelaySeconds);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Spawn>d__5>(ref awaiter, ref this);
							return;
						}
						goto IL_018e;
						IL_0203:
						((Awaiter)(ref awaiter)).GetResult();
						val = phantom.FadeOut(spawnCancelToken, spawnDelaySeconds);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 3);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Spawn>d__5>(ref awaiter, ref this);
							return;
						}
						break;
					}
					((Awaiter)(ref awaiter)).GetResult();
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					<>8__1 = null;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				<>8__1 = null;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		private MonsterBase _monster;

		private Animator Anim => ((Actor)_monster).animator;

		private void Start()
		{
			AutoAttributeManager.AutoReferenceAllChildren(((Component)this).gameObject);
			((Component)this).TryGetComponent<MonsterBase>(ref _monster);
			((PhysicsMover)_monster).EnterLevelAwake();
			((PhysicsMover)_monster).EnterLevelReset();
			MonsterDecreasePostureReceiver[] damageReceivers = _monster.damageReceivers;
			for (int i = 0; i < damageReceivers.Length; i++)
			{
				EffectReceiver[] value = Traverse.Create((object)damageReceivers[i]).Field<EffectReceiver[]>("effectReceivers").Value;
				for (int j = 0; j < value.Length; j++)
				{
					Object.Destroy((Object)(object)((Component)value[j]).gameObject);
				}
			}
			Transform obj = ((Component)Anim).transform.Find("View/YiGung");
			Transform obj2 = obj.Find("Body");
			((Component)obj2).gameObject.AddComponent<_2dxFX_Negative>();
			Object.Destroy((Object)(object)((Component)obj2).GetComponent<_2dxFX_ColorRGB>());
			((Component)obj2.Find("Arm")).gameObject.AddComponent<_2dxFX_Negative>();
			((Component)obj.Find("Weapon/Sword/Sword Sprite")).gameObject.AddComponent<_2dxFX_Negative>();
			_monster.Hide();
		}

		internal void ScrambleGuid(Random random)
		{
			GuidComponent guidComponent = GuidExtension.GetGuidComponent(((Component)this).gameObject);
			Type type = ((object)guidComponent).GetType();
			byte[] array = new byte[16];
			random.NextBytes(array);
			Guid value = new Guid(array);
			Traverse obj = Traverse.Create(type);
			obj.Field<Guid>("guid").Value = value;
			obj.Field<byte[]>("serializedGuid").Value = value.ToByteArray();
			((MonoBehaviour)guidComponent).Invoke("CreateGuid", 0f);
		}

		[AsyncStateMachine(typeof(<Spawn>d__5))]
		internal UniTask Spawn(MonsterBase refMonster, CancellationToken spawnCancelToken, float spawnDelaySeconds = 0.25f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			<Spawn>d__5 <Spawn>d__ = default(<Spawn>d__5);
			<Spawn>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<Spawn>d__.<>4__this = this;
			<Spawn>d__.refMonster = refMonster;
			<Spawn>d__.spawnCancelToken = spawnCancelToken;
			<Spawn>d__.spawnDelaySeconds = spawnDelaySeconds;
			<Spawn>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <Spawn>d__.<>t__builder)).Start<<Spawn>d__5>(ref <Spawn>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <Spawn>d__.<>t__builder)).Task;
		}

		[AsyncStateMachine(typeof(<FadeIn>d__6))]
		private UniTask FadeIn(CancellationToken fadeCancelToken, float fadeTimeSec = 0.25f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			<FadeIn>d__6 <FadeIn>d__ = default(<FadeIn>d__6);
			<FadeIn>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<FadeIn>d__.<>4__this = this;
			<FadeIn>d__.fadeCancelToken = fadeCancelToken;
			<FadeIn>d__.fadeTimeSec = fadeTimeSec;
			<FadeIn>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <FadeIn>d__.<>t__builder)).Start<<FadeIn>d__6>(ref <FadeIn>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <FadeIn>d__.<>t__builder)).Task;
		}

		[AsyncStateMachine(typeof(<FadeOut>d__7))]
		internal UniTask FadeOut(CancellationToken fadeCancelToken, float fadeTimeSec = 0.25f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			<FadeOut>d__7 <FadeOut>d__ = default(<FadeOut>d__7);
			<FadeOut>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<FadeOut>d__.<>4__this = this;
			<FadeOut>d__.fadeCancelToken = fadeCancelToken;
			<FadeOut>d__.fadeTimeSec = fadeTimeSec;
			<FadeOut>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <FadeOut>d__.<>t__builder)).Start<<FadeOut>d__7>(ref <FadeOut>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <FadeOut>d__.<>t__builder)).Task;
		}
	}
	internal static class PhantomManager
	{
		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <SpawnPhantoms>d__3 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			public float spawnLengthSec;

			public MonsterBase refMonster;

			private float <spawnInterval>5__2;

			private List<UniTask> <spawnTasks>5__3;

			private int <i>5__4;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: 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_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					Awaiter awaiter;
					if (num != 0)
					{
						if (num != 1)
						{
							<spawnInterval>5__2 = spawnLengthSec / (float)_phantoms.Count;
							<spawnTasks>5__3 = new List<UniTask>(_phantoms.Count);
							<i>5__4 = 0;
							goto IL_018d;
						}
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
						goto IL_01fc;
					}
					awaiter = <>u__1;
					<>u__1 = default(Awaiter);
					num = (<>1__state = -1);
					goto IL_0174;
					IL_0174:
					((Awaiter)(ref awaiter)).GetResult();
					<i>5__4++;
					goto IL_018d;
					IL_018d:
					UniTask val;
					if (<i>5__4 < _phantoms.Count)
					{
						Phantom phantom = _phantoms[<i>5__4];
						CancellationTokenSource cancellationTokenSource;
						if (_spawnCancelSrcs.Count > <i>5__4)
						{
							cancellationTokenSource = _spawnCancelSrcs[<i>5__4];
							if (cancellationTokenSource != null)
							{
								cancellationTokenSource.Cancel();
								_spawnCancelSrcs.Remove(cancellationTokenSource);
							}
						}
						cancellationTokenSource = new CancellationTokenSource();
						_spawnCancelSrcs.Insert(<i>5__4, cancellationTokenSource);
						try
						{
							<spawnTasks>5__3.Add(phantom.Spawn(refMonster, cancellationTokenSource.Token, <spawnInterval>5__2));
						}
						catch (OperationCanceledException)
						{
							cancellationTokenSource.Cancel();
							<spawnTasks>5__3.RemoveAt(<i>5__4);
							<spawnTasks>5__3.Add(phantom.FadeOut(cancellationTokenSource.Token, <spawnInterval>5__2));
						}
						val = UniTask.Delay(TimeSpan.FromSeconds(<spawnInterval>5__2), false, (PlayerLoopTiming)8, cancellationTokenSource.Token);
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <SpawnPhantoms>d__3>(ref awaiter, ref this);
							return;
						}
						goto IL_0174;
					}
					val = UniTask.WhenAll((IEnumerable<UniTask>)<spawnTasks>5__3);
					awaiter = ((UniTask)(ref val)).GetAwaiter();
					if (!((Awaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 1);
						<>u__1 = awaiter;
						((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <SpawnPhantoms>d__3>(ref awaiter, ref this);
						return;
					}
					goto IL_01fc;
					IL_01fc:
					((Awaiter)(ref awaiter)).GetResult();
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					<spawnTasks>5__3 = null;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				<spawnTasks>5__3 = null;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		private static List<Phantom> _phantoms;

		private static List<CancellationTokenSource> _spawnCancelSrcs = new List<CancellationTokenSource>();

		internal static void Initialize(GameObject refObj, int numPhantoms = 1)
		{
			//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)
			_phantoms = new List<Phantom>(numPhantoms);
			Random random = new Random((int)Time.timeSinceLevelLoad);
			for (int i = 0; i < numPhantoms; i++)
			{
				GameObject obj = Object.Instantiate<GameObject>(refObj, refObj.transform.position, Quaternion.identity);
				obj.SetActive(false);
				((Object)obj).name = "Phantom " + i;
				Phantom phantom = obj.AddComponent<Phantom>();
				phantom.ScrambleGuid(random);
				obj.SetActive(true);
				_phantoms.Add(phantom);
			}
		}

		[AsyncStateMachine(typeof(<SpawnPhantoms>d__3))]
		internal static UniTask SpawnPhantoms(MonsterBase refMonster, float spawnLengthSec = 0.25f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			<SpawnPhantoms>d__3 <SpawnPhantoms>d__ = default(<SpawnPhantoms>d__3);
			<SpawnPhantoms>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create();
			<SpawnPhantoms>d__.refMonster = refMonster;
			<SpawnPhantoms>d__.spawnLengthSec = spawnLengthSec;
			<SpawnPhantoms>d__.<>1__state = -1;
			((AsyncUniTaskMethodBuilder)(ref <SpawnPhantoms>d__.<>t__builder)).Start<<SpawnPhantoms>d__3>(ref <SpawnPhantoms>d__);
			return ((AsyncUniTaskMethodBuilder)(ref <SpawnPhantoms>d__.<>t__builder)).Task;
		}

		internal static void FadeOutAllPhantoms()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < _phantoms.Count; i++)
			{
				CancellationTokenSource cancellationTokenSource = _spawnCancelSrcs[i];
				UniTaskExtensions.Forget(_phantoms[i].FadeOut(cancellationTokenSource.Token));
			}
		}

		internal static void Unload()
		{
			foreach (Phantom phantom in _phantoms)
			{
				Object.DestroyImmediate((Object)(object)phantom);
			}
			_phantoms.Clear();
		}
	}
	internal class PreloadManager
	{
		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <Initialize>d__2 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

			private Awaiter <>u__1;

			private void MoveNext()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: 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_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					Awaiter awaiter;
					if (num != 0)
					{
						UniTask val = Preload();
						awaiter = ((UniTask)(ref val)).GetAwaiter();
						if (!((Awaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Initialize>d__2>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(Awaiter);
						num = (<>1__state = -1);
					}
					((Awaiter)(ref awaiter)).GetResult();
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <Preload>d__5 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder <>t__builder;

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

			private Awaiter<bool> <>u__1;

			private AsyncOperationAwaiter <>u__2;

			private void MoveNext()
			{
				//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_0129: 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)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: 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_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				try
				{
					string key;
					if ((uint)num > 1u)
					{
						DestroyAllGameObjects.DestroyingAll = true;
						Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>();
						Dictionary<string, (string, string)>.Enumerator enumerator = PreloadedObjectMap.GetEnumerator();
						try
						{
							while (enumerator.MoveNext())
							{
								enumerator.Current.Deconstruct(out key, out var value);
								(string, string) tuple = value;
								string text = key;
								var (key2, value2) = tuple;
								if (dictionary.ContainsKey(key2))
								{
									dictionary[key2].Add(text, value2);
									continue;
								}
								Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
								key = text;
								dictionary2[key] = value2;
								dictionary.Add(key2, dictionary2);
							}
						}
						finally
						{
							if (num < 0)
							{
								((IDisposable)enumerator).Dispose();
							}
						}
						<>7__wrap1 = dictionary.GetEnumerator();
					}
					try
					{
						AsyncOperationAwaiter awaiter;
						if (num != 0)
						{
							if (num != 1)
							{
								goto IL_019d;
							}
							awaiter = <>u__2;
							<>u__2 = default(AsyncOperationAwaiter);
							num = (<>1__state = -1);
							goto IL_0196;
						}
						Awaiter<bool> awaiter2 = <>u__1;
						<>u__1 = default(Awaiter<bool>);
						num = (<>1__state = -1);
						goto IL_0138;
						IL_0138:
						awaiter2.GetResult();
						awaiter = UnityAsyncExtensions.GetAwaiter(Resources.UnloadUnusedAssets());
						if (!((AsyncOperationAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__2 = awaiter;
							((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<AsyncOperationAwaiter, <Preload>d__5>(ref awaiter, ref this);
							return;
						}
						goto IL_0196;
						IL_0196:
						((AsyncOperationAwaiter)(ref awaiter)).GetResult();
						goto IL_019d;
						IL_019d:
						if (<>7__wrap1.MoveNext())
						{
							<>7__wrap1.Current.Deconstruct(out key, out Dictionary<string, string> value3);
							string sceneName = key;
							Dictionary<string, string> objMap = value3;
							awaiter2 = PreloadScene(sceneName, objMap).GetAwaiter();
							if (!awaiter2.IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter2;
								((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<bool>, <Preload>d__5>(ref awaiter2, ref this);
								return;
							}
							goto IL_0138;
						}
					}
					finally
					{
						if (num < 0)
						{
							((IDisposable)<>7__wrap1).Dispose();
						}
					}
					<>7__wrap1 = default(Dictionary<string, Dictionary<string, string>>.Enumerator);
					DestroyAllGameObjects.DestroyingAll = false;
				}
				catch (Exception exception)
				{
					<>1__state = -2;
					((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}

			void IAsyncStateMachine.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				this.MoveNext();
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
			}

			void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine)
			{
				//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
				this.SetStateMachine(stateMachine);
			}
		}

		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <PreloadScene>d__4 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncUniTaskMethodBuilder<bool> <>t__builder;

			public string sceneName;

			public Dictionary<string, string> objMap;

			private AsyncOperationAwaiter <>u__1;

			private void MoveNext()
			{
				//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_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				bool result;
				try
				{
					AsyncOperationAwaiter awaiter;
					if (num == 0)
					{
						awaiter = <>u__1;
						<>u__1 = default(AsyncOperationAwaiter);
						num = (<>1__state = -1);
						goto IL_0088;
					}
					AsyncOperation val = SceneManager.LoadSceneAsync(sceneName, (LoadSceneMode)1);
					if (val != null)
					{
						awaiter = UnityAsyncExtensions.GetAwaiter(val);
						if (!((AsyncOperationAwai