Decompiled source of MoreSpells v1.6.2

BepInEx/plugins/MoreSpells/MoreSpells.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using BlackMagicAPI.Helpers;
using BlackMagicAPI.Managers;
using BlackMagicAPI.Modules.Spells;
using BlackMagicAPI.Network;
using FishNet.Object;
using FishUtilities.Attributes;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreSpells.Spells.EchoLocation;
using MoreSpells.Spells.Hellfire;
using MoreSpells.Spells.MagicShield;
using MoreSpells.Spells.Resurrection;
using MoreSpells.Spells.TheEyeOfHell;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("MoreSpells")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4c196145703bcaf40e7352020f4b7bdedebfd72e")]
[assembly: AssemblyProduct("MoreSpells")]
[assembly: AssemblyTitle("MoreSpells")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreSpells
{
	[BepInProcess("MageArena")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.d1gq.morespells", "MoreSpells", "1.6.2")]
	public class MSPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "com.d1gq.morespells";

		internal const string PluginName = "MoreSpells";

		private const string VersionString = "1.6.2";

		private static Harmony? Harmony;

		private ManualLogSource? _log;

		public static string modsync = "all";

		internal static AssetBundle? SpellsAssets;

		internal static MSPlugin Instance { get; private set; }

		internal static ManualLogSource Log => Instance._log;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			_log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Harmony = new Harmony("com.d1gq.morespells");
			Harmony.PatchAll();
			SpellsAssets = Utils.LoadAssetBundleFromResources(Assembly.GetExecutingAssembly(), "MoreSpells.Resources.spells");
			BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(MagicShieldData), typeof(MagicShieldLogic));
			BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(EchoLocationData), typeof(EchoLocationLogic));
			BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(ResurrectionData), typeof(ResurrectionLogic));
			BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(TheEyeOfHellData), typeof(TheEyeOfHellLogic));
			BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(HellfireData), typeof(HellfireLogic));
		}
	}
}
namespace MoreSpells.Spells.TheEyeOfHell
{
	internal class TheEyeOfHellData : SpellData
	{
		public override string Name => "The Eye Of Hell";

		public override string[] SubNames => new string[1] { "Eye Of Hell" };

		public override float Cooldown => 5f;

		public override Color GlowColor => Color.red;
	}
	internal class TheEyeOfHellLogic : SpellLogic
	{
		[CompilerGenerated]
		private sealed class <CoCooldown>d__8 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public TheEyeOfHellLogic <>4__this;

			private float <time>5__2;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				TheEyeOfHellLogic theEyeOfHellLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<time>5__2 = 300f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<time>5__2 > 0f)
				{
					<time>5__2 -= Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				active = false;
				((SpellLogic)theEyeOfHellLogic).DisposeSpell();
				return false;
			}

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

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

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

			private object <>2__current;

			public Light sun;

			public Light moon;

			public (Color sunColor, Color moonColor, float sunIntensity) backto;

			public TheEyeOfHellLogic <>4__this;

			private float <time>5__2;

			private Color <startSunColor>5__3;

			private Color <startMoonColor>5__4;

			private float <startSunIntensity>5__5;

			private float <elapsedTime>5__6;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: 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_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Expected O, but got Unknown
				int num = <>1__state;
				TheEyeOfHellLogic theEyeOfHellLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<time>5__2 = 3f;
					<startSunColor>5__3 = sun.color;
					<startMoonColor>5__4 = moon.color;
					<startSunIntensity>5__5 = sun.intensity;
					<elapsedTime>5__6 = 0f;
					goto IL_0119;
				case 1:
					<>1__state = -1;
					goto IL_0119;
				case 2:
					{
						<>1__state = -1;
						theEyeOfHellLogic.Cooldown();
						return false;
					}
					IL_0119:
					if (<elapsedTime>5__6 < <time>5__2)
					{
						<elapsedTime>5__6 += Time.deltaTime;
						float num2 = Mathf.Clamp01(<elapsedTime>5__6 / <time>5__2);
						sun.color = Color.Lerp(<startSunColor>5__3, backto.sunColor, num2);
						moon.color = Color.Lerp(<startMoonColor>5__4, backto.moonColor, num2);
						sun.intensity = Mathf.Lerp(<startSunIntensity>5__5, backto.sunIntensity, num2);
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					sun.color = backto.sunColor;
					moon.color = backto.moonColor;
					sun.intensity = backto.sunIntensity;
					<>2__current = (object)new WaitForSeconds(3.5f);
					<>1__state = 2;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public Light sun;

			public Light moon;

			public TheEyeOfHellLogic <>4__this;

			private Color <sunColor>5__2;

			private Color <moonColor>5__3;

			private float <sunIntensity>5__4;

			private float <time>5__5;

			private Color <targetColor>5__6;

			private float <targetIntensity>5__7;

			private float <elapsedTime>5__8;

			private float <wait>5__9;

			private PlayerMovement[] <players>5__10;

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

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

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

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

			private bool MoveNext()
			{
				//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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: 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_0142: 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_0259: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				TheEyeOfHellLogic theEyeOfHellLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					active = true;
					<sunColor>5__2 = sun.color;
					<moonColor>5__3 = moon.color;
					<sunIntensity>5__4 = sun.intensity;
					<time>5__5 = 3f;
					<targetColor>5__6 = Color.red;
					<targetIntensity>5__7 = 3000f;
					<elapsedTime>5__8 = 0f;
					goto IL_012a;
				case 1:
					<>1__state = -1;
					goto IL_012a;
				case 2:
					<>1__state = -1;
					goto IL_023a;
				case 3:
					{
						<>1__state = -1;
						return false;
					}
					IL_012a:
					if (<elapsedTime>5__8 < <time>5__5)
					{
						<elapsedTime>5__8 += Time.deltaTime;
						float num2 = Mathf.Clamp01(<elapsedTime>5__8 / <time>5__5);
						sun.color = Color.Lerp(<sunColor>5__2, <targetColor>5__6, num2);
						moon.color = Color.Lerp(<moonColor>5__3, <targetColor>5__6, num2);
						sun.intensity = Mathf.Lerp(<sunIntensity>5__4, <targetIntensity>5__7, num2);
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					sun.color = <targetColor>5__6;
					moon.color = <targetColor>5__6;
					sun.intensity = <targetIntensity>5__7;
					<wait>5__9 = 60f;
					<players>5__10 = (from obj in GameObject.FindGameObjectsWithTag("Player")
						select obj.GetComponent<PlayerMovement>()).ToArray();
					goto IL_023a;
					IL_023a:
					if (<wait>5__9 > 0f)
					{
						<wait>5__9 -= Time.deltaTime;
						PlayerMovement[] array = <players>5__10;
						foreach (PlayerMovement val in array)
						{
							if (!((Object)(object)val == (Object)null) && !val.isDead && val.fireTimer < 0.25f && val.playerHealth > 15f)
							{
								val.fireTimer = 0.25f;
							}
						}
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<>2__current = theEyeOfHellLogic.CoFadeIn(sun, moon, (<sunColor>5__2, <moonColor>5__3, <sunIntensity>5__4));
					<>1__state = 3;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public WeatherCycle weather;

			private float <lastRot>5__2;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
				}
				else
				{
					<>1__state = -1;
					<lastRot>5__2 = weather.rot;
				}
				weather.rot = <lastRot>5__2;
				<>2__current = null;
				<>1__state = 1;
				return true;
			}

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

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

		private static bool active;

		private static AudioClip? clip;

		public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
		{
			NightAudioSwap val = Object.FindFirstObjectByType<NightAudioSwap>();
			if ((Object)(object)val != (Object)null)
			{
				PlayerInventory component = ((Component)caster).GetComponent<PlayerInventory>();
				if (((NetworkBehaviour)component).IsOwner)
				{
					component.canSwapItem = true;
				}
				if (active)
				{
					((SpellLogic)this).DisposeSpell();
					return false;
				}
				if (((NetworkBehaviour)component).IsOwner)
				{
					component.destroyHandItem();
				}
				WeatherCycle nightday = val.nightday;
				PlayClip();
				((MonoBehaviour)this).StartCoroutine(StopWeatherCycle(nightday));
				((MonoBehaviour)this).StartCoroutine(CoFadeOut(nightday.Sun, nightday.Moon));
			}
			return true;
		}

		private void PlayClip()
		{
			AudioSource obj = ((Component)this).gameObject.AddComponent<AudioSource>();
			obj.clip = clip;
			obj.spatialBlend = 0f;
			obj.volume = 0.3f;
			obj.playOnAwake = false;
			obj.loop = false;
			obj.minDistance = 0.01f;
			obj.maxDistance = 1000f;
			obj.rolloffMode = (AudioRolloffMode)1;
			obj.pitch = 0.84f;
			obj.Play();
		}

		[IteratorStateMachine(typeof(<StopWeatherCycle>d__4))]
		private IEnumerator StopWeatherCycle(WeatherCycle weather)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <StopWeatherCycle>d__4(0)
			{
				weather = weather
			};
		}

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

		[IteratorStateMachine(typeof(<CoFadeIn>d__6))]
		private IEnumerator CoFadeIn(Light sun, Light moon, (Color sunColor, Color moonColor, float sunIntensity) backto)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CoFadeIn>d__6(0)
			{
				<>4__this = this,
				sun = sun,
				moon = moon,
				backto = backto
			};
		}

		private void Cooldown()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(CoCooldown());
		}

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

		public override void WriteData(DataWriter dataWriter, PageController page, PlayerMovement caster, Vector3 spawnPos, Vector3 viewDirectionVector, int level)
		{
			PlayerInventory component = ((Component)caster).GetComponent<PlayerInventory>();
			if (((NetworkBehaviour)component).IsOwner)
			{
				component.canSwapItem = false;
			}
		}

		public override void OnPrefabCreatedAutomatically(GameObject prefab)
		{
			clip = Utils.LoadWavFromResources(Assembly.GetExecutingAssembly(), "MoreSpells.Resources.Sounds.TheEyeOfHell.wav");
		}

		protected override void OnDestroy()
		{
			((SpellLogic)this).OnDestroy();
			((MonoBehaviour)this).StopAllCoroutines();
			active = false;
		}
	}
}
namespace MoreSpells.Spells.Resurrection
{
	public class ResurrectionData : SpellData
	{
		public override string Name => "Resurrection";

		public override float Cooldown => 60f;

		public override Color GlowColor => Color.cyan;
	}
	public class ResurrectionLogic : SpellLogic
	{
		[StructLayout(LayoutKind.Auto)]
		[CompilerGenerated]
		private struct <>c__DisplayClass5_0
		{
			public PlayerMovement player;

			public ResurrectionLogic <>4__this;
		}

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

			private object <>2__current;

			public PlayerMovement player;

			public ResurrectionLogic <>4__this;

			private <>c__DisplayClass5_0 <>8__1;

			private float <riseTime>5__2;

			private float <riseDuration>5__3;

			private float <fallTime>5__4;

			private float <fallDuration>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_022b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c0: Expected O, but got Unknown
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0361: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				ResurrectionLogic resurrectionLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1.player = player;
					<>8__1.<>4__this = <>4__this;
					resurrectingPlayers.Add(<>8__1.player);
					if (((NetworkBehaviour)<>8__1.player).IsOwner && !<>8__1.player.prm.gameover)
					{
						((MonoBehaviour)<>8__1.player.prm).StopAllCoroutines();
						((Component)<>8__1.player.prm.covershite).gameObject.SetActive(false);
						((Renderer)<>8__1.player.prm.youdied).enabled = false;
						GameObject[] digit = <>8__1.player.prm.digit1;
						for (int i = 0; i < digit.Length; i++)
						{
							digit[i].SetActive(false);
						}
					}
					<>8__1.player.portalSource.PlayOneShot(<>8__1.player.recall);
					<riseTime>5__2 = 0f;
					<riseDuration>5__3 = 2.5f;
					goto IL_01f6;
				case 1:
					<>1__state = -1;
					goto IL_01f6;
				case 2:
					<>1__state = -1;
					<fallTime>5__4 = 0f;
					<fallDuration>5__5 = 1f;
					break;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_01f6:
					if (<riseTime>5__2 < <riseDuration>5__3)
					{
						if (!<>8__1.player.isDead || <>8__1.player.prm.gameover)
						{
							resurrectionLogic.<CoResurrection>g__EndSpell|5_0(ref <>8__1);
							return false;
						}
						float num2 = <riseTime>5__2 / <riseDuration>5__3;
						((Renderer)<>8__1.player.recallmesh).material.SetVector("_tiling", new Vector4(1f, Mathf.Lerp(-1.5f, -1.05f, num2)));
						<riseTime>5__2 += Time.deltaTime;
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					((Renderer)<>8__1.player.recallmesh).material.SetVector("_tiling", new Vector4(1f, -1.05f));
					if (((NetworkBehaviour)<>8__1.player).IsOwner)
					{
						<>8__1.player.RespawnPlayer();
						<>8__1.player.EnableCols();
						<>8__1.player.vbt.IsMuted = false;
						<>8__1.player.canRecall = false;
						<>8__1.player.canMove = false;
						<>8__1.player.canJump = false;
					}
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				}
				if (<fallTime>5__4 < <fallDuration>5__5)
				{
					if (<>8__1.player.isDead || <>8__1.player.prm.gameover)
					{
						resurrectionLogic.<CoResurrection>g__EndSpell|5_0(ref <>8__1);
						return false;
					}
					float num3 = <fallTime>5__4 / <fallDuration>5__5;
					((Renderer)<>8__1.player.recallmesh).material.SetVector("_tiling", new Vector4(1f, Mathf.Lerp(-1.05f, -1.5f, num3)));
					<fallTime>5__4 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 3;
					return true;
				}
				if (((NetworkBehaviour)<>8__1.player).IsOwner)
				{
					<>8__1.player.canRecall = true;
					<>8__1.player.canMove = true;
					<>8__1.player.canJump = true;
				}
				resurrectionLogic.<CoResurrection>g__EndSpell|5_0(ref <>8__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();
			}
		}

		private static readonly List<PlayerMovement> resurrectingPlayers = new List<PlayerMovement>();

		private PlayerMovement? Target;

		public static PlayerMovement[] ResurrectingPlayers => resurrectingPlayers.ToArray();

		public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
		{
			PlayerInventory component = ((Component)caster).GetComponent<PlayerInventory>();
			component.canSwapItem = true;
			if ((Object)(object)Target == (Object)null || (Object)(object)Target == (Object)(object)caster)
			{
				((SpellLogic)this).DisposeSpell();
				return true;
			}
			if (((NetworkBehaviour)component).IsOwner)
			{
				component.destroyHandItem();
			}
			((MonoBehaviour)this).StartCoroutine(CoResurrection(Target));
			return true;
		}

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

		private PlayerMovement? TryGetTarget(PlayerMovement caster, Vector3 spawnPos, Vector3 viewDirectionVector, int level)
		{
			//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_00c6: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			PlayerMovement[] array = (from player in GameObject.FindGameObjectsWithTag("Player")
				select player.GetComponent<PlayerMovement>()).ToArray();
			PlayerMovement result = null;
			float num = float.MaxValue;
			float num2 = 40f + 5f * (float)(level - 1);
			float num3 = 5f + 0.5f * (float)(level - 1);
			Vector3 normalized = ((Vector3)(ref viewDirectionVector)).normalized;
			PlayerMovement[] array2 = array;
			RaycastHit val3 = default(RaycastHit);
			foreach (PlayerMovement val in array2)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)caster) && val.playerTeam == caster.playerTeam && val.isDead && !resurrectingPlayers.Contains(val))
				{
					Vector3 val2 = ((Component)val).transform.position - spawnPos;
					Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
					float num4 = Vector3.Distance(spawnPos, ((Component)val).transform.position);
					if (!(num4 > num3) && Vector3.Angle(normalized, normalized2) <= num2 && (!Physics.Raycast(spawnPos, normalized2, ref val3, num4) || !((Object)(object)((Component)((RaycastHit)(ref val3)).collider).gameObject != (Object)(object)((Component)val).gameObject)) && num4 < num)
					{
						num = num4;
						result = val;
					}
				}
			}
			return result;
		}

		public override void WriteData(DataWriter dataWriter, PageController page, PlayerMovement caster, Vector3 spawnPos, Vector3 viewDirectionVector, int level)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			PlayerMovement val = TryGetTarget(caster, spawnPos, viewDirectionVector, level);
			if ((Object)(object)val != (Object)null)
			{
				dataWriter.Write<int>(0);
				dataWriter.Write<GameObject>(((Component)val).gameObject);
				PlayerInventory component = ((Component)caster).GetComponent<PlayerInventory>();
				if (((NetworkBehaviour)component).IsOwner)
				{
					component.canSwapItem = false;
				}
			}
			else
			{
				dataWriter.Write<int>(1);
			}
		}

		public override void SyncData(object[] values)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)values[0] == 0)
			{
				Target = ((GameObject)values[1]).GetComponent<PlayerMovement>();
			}
			else
			{
				Target = null;
			}
		}

		[CompilerGenerated]
		private void <CoResurrection>g__EndSpell|5_0(ref <>c__DisplayClass5_0 P_0)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			resurrectingPlayers.Remove(P_0.player);
			((Renderer)P_0.player.recallmesh).material.SetVector("_tiling", new Vector4(1f, -1.5f));
			P_0.player.portalSource.Stop();
			((SpellLogic)this).DisposeSpell();
		}
	}
}
namespace MoreSpells.Spells.MagicShield
{
	public class MagicShieldData : SpellData
	{
		public override string Name => "Magic Shield";

		public override string[] SubNames => new string[2] { "Magic", "Shield" };

		public override float Cooldown => 35f;

		public override Color GlowColor => Color.blue;
	}
	public class MagicShieldLogic : SpellLogic
	{
		[CompilerGenerated]
		private sealed class <CoProtect>d__4 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerMovement player;

			public MagicShieldLogic <>4__this;

			private float <lastHealth>5__2;

			private float <healthRecoveryRate>5__3;

			private float <shieldDamagePenalty>5__4;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0214: Unknown result type (might be due to invalid IL or missing references)
				//IL_021e: Expected O, but got Unknown
				int num = <>1__state;
				MagicShieldLogic magicShieldLogic = <>4__this;
				GameObject? orb;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)player == (Object)null)
					{
						return false;
					}
					<lastHealth>5__2 = player.playerHealth;
					<healthRecoveryRate>5__3 = 3f;
					<shieldDamagePenalty>5__4 = 0.2f;
					goto IL_01c8;
				case 1:
					<>1__state = -1;
					goto IL_01c8;
				case 2:
					{
						<>1__state = -1;
						Object.Destroy((Object)(object)magicShieldLogic.orb);
						((SpellLogic)magicShieldLogic).DisposeSpell();
						return false;
					}
					IL_01c8:
					if (magicShieldLogic.shieldLife > 0f && (Object)(object)player != (Object)null && !player.isDead)
					{
						magicShieldLogic.shieldLife -= Time.deltaTime;
						if (player.isFrozen)
						{
							player.breakoutFireball = true;
							return false;
						}
						if (player.playerHealth < <lastHealth>5__2)
						{
							float num2 = <lastHealth>5__2 - player.playerHealth;
							player.playerHealth = <lastHealth>5__2 - num2 * 0.75f;
							magicShieldLogic.shieldLife -= num2 * <shieldDamagePenalty>5__4;
						}
						else if (player.playerHealth < 100f)
						{
							float num3 = <healthRecoveryRate>5__3 * Time.deltaTime;
							player.playerHealth = Mathf.Min(player.playerHealth + num3, 100f);
							magicShieldLogic.shieldLife -= num3 * 0.2f;
						}
						if (player.fireTimer > 1f)
						{
							player.fireTimer = 1f;
						}
						if (player.stamina > 0f)
						{
							PlayerMovement obj = player;
							obj.stamina -= 3f * player.stamina * 0.1f * Time.deltaTime;
						}
						<lastHealth>5__2 = player.playerHealth;
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					orb = magicShieldLogic.orb;
					if (orb != null)
					{
						orb.GetComponent<Animator>().SetTrigger("Break");
					}
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				}
			}

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

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

		private static GameObject? OrbPrefab;

		private GameObject? orb;

		private float shieldLife = 15f;

		public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
		{
			orb = Object.Instantiate<GameObject>(OrbPrefab);
			if ((Object)(object)orb != (Object)null)
			{
				orb.SetActive(true);
				orb.transform.SetParent(((Component)caster).transform, false);
				((MonoBehaviour)this).StartCoroutine(CoProtect(caster));
			}
			return true;
		}

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

		public override void OnPrefabCreatedAutomatically(GameObject prefab)
		{
			AssetBundle? spellsAssets = MSPlugin.SpellsAssets;
			OrbPrefab = ((spellsAssets != null) ? spellsAssets.LoadAsset<GameObject>("Assets/SpellAssets/Spells/MagicShield.prefab") : null);
			Object.DontDestroyOnLoad((Object)(object)OrbPrefab);
		}
	}
}
namespace MoreSpells.Spells.Hellfire
{
	internal class HellfireData : SpellData
	{
		public override string Name => "Hellfire";

		public override float Cooldown => 40f;

		public override Color GlowColor => Color.yellow;
	}
	internal class HellfireLogic : SpellLogic
	{
		[CompilerGenerated]
		private sealed class <CoHellfire>d__7 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject caster;

			public Vector3 viewDirectionVector;

			private float <endTime>5__2;

			private Vector3 <centerPoint>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0037: 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_0052: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: 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)
				//IL_0106: 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_0127: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<endTime>5__2 = Time.time + duration;
					<centerPoint>5__3 = caster.transform.position + ((Vector3)(ref viewDirectionVector)).normalized * (rangeDistance / 2f);
					<centerPoint>5__3.y = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (Time.time < <endTime>5__2)
				{
					float num = Random.Range(0f, 360f);
					float num2 = Random.Range(0f, rangeWidth / 2f);
					Vector3 val = default(Vector3);
					((Vector3)(ref val))..ctor(Mathf.Cos(num * ((float)Math.PI / 180f)) * num2, 0f, Mathf.Sin(num * ((float)Math.PI / 180f)) * num2);
					Vector3 val2 = <centerPoint>5__3 + val;
					Vector3 val3 = val2 + new Vector3(0f, 125f, 0f);
					Vector3 val4 = val2 - val3;
					Vector3 normalized = ((Vector3)(ref val4)).normalized;
					RpcSpawnFireball(caster, val3, normalized);
					<>2__current = (object)new WaitForSeconds(Random.Range(0.8f, 1f));
					<>1__state = 1;
					return true;
				}
				return false;
			}

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

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

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

			private object <>2__current;

			public HellfireLogic <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				int num = <>1__state;
				HellfireLogic hellfireLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(duration + 5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((SpellLogic)hellfireLogic).DisposeSpell();
					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();
			}
		}

		private static FireballController? firePrefab;

		private static readonly float duration = 12f;

		private static readonly float rangeWidth = 50f;

		private static readonly float rangeDistance = 35f;

		public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)caster).IsOwner)
			{
				CmdHellfireRoutine(((Component)caster).gameObject, viewDirectionVector);
				((MonoBehaviour)this).StartCoroutine(CoWaitDisposeSpell());
			}
			return true;
		}

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

		[FishCmd]
		private static void CmdHellfireRoutine(GameObject caster, Vector3 viewDirectionVector)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)caster.GetComponent<PlayerMovement>()).StartCoroutine(CoHellfire(caster, viewDirectionVector * 50f));
		}

		[IteratorStateMachine(typeof(<CoHellfire>d__7))]
		private static IEnumerator CoHellfire(GameObject caster, Vector3 viewDirectionVector)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CoHellfire>d__7(0)
			{
				caster = caster,
				viewDirectionVector = viewDirectionVector
			};
		}

		[FishRpc]
		private static void RpcSpawnFireball(GameObject caster, Vector3 spawnPos, Vector3 direction)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			FireballController val = Object.Instantiate<FireballController>(firePrefab);
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).transform.position = spawnPos;
				val.level = 0;
				val.playerOwner = caster;
				val.rb.AddForce(direction * 50f, (ForceMode)2);
				((MonoBehaviour)val).StartCoroutine(val.Shoott());
			}
		}

		public override void OnPrefabCreatedAutomatically(GameObject prefab)
		{
			firePrefab = Resources.FindObjectsOfTypeAll<FireballController>()[1];
		}
	}
}
namespace MoreSpells.Spells.EchoLocation
{
	public class EchoLocationData : SpellData
	{
		public override string Name => "Echo Location";

		public override float Cooldown => 30f;

		public override Color GlowColor => Color.gray;
	}
	public class EchoLocationLogic : SpellLogic
	{
		[CompilerGenerated]
		private sealed class <CoCastSpell>d__3 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerMovement[] players;

			public PlayerMovement owner;

			public int castingLevel;

			public EchoLocationLogic <>4__this;

			private float <reveal>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				EchoLocationLogic echoLocationLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<reveal>5__2 = 0f;
					goto IL_0107;
				case 1:
					<>1__state = -1;
					goto IL_0107;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_0107:
					if (!(echoLocationLogic.duration > 0f) || !((Object)(object)owner != (Object)null) || owner.isDead)
					{
						break;
					}
					if (<reveal>5__2 <= 0f)
					{
						PlayerMovement[] array = players;
						foreach (PlayerMovement val in array)
						{
							if (!((Object)(object)val == (Object)null) && Vector3.Distance(((Component)owner).transform.position, ((Component)val).transform.position) < 15f + (float)(2 * (castingLevel - 1)))
							{
								((MonoBehaviour)echoLocationLogic).StartCoroutine(echoLocationLogic.CoRevealLocation(val, owner.playerTeam, castingLevel));
							}
						}
						<reveal>5__2 = 2f;
					}
					echoLocationLogic.duration -= Time.deltaTime;
					<reveal>5__2 -= Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (echoLocationLogic.busyWithReveal > 0)
				{
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				((SpellLogic)echoLocationLogic).DisposeSpell();
				return false;
			}

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

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

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

			private object <>2__current;

			public EchoLocationLogic <>4__this;

			public PlayerMovement player;

			public int castingLevel;

			public int team;

			private GameObject <dupe>5__2;

			private Material[] <playerMaterials>5__3;

			private float <time>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<dupe>5__2 = null;
				<playerMaterials>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_006a: 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_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				EchoLocationLogic echoLocationLogic = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					echoLocationLogic.busyWithReveal++;
					<dupe>5__2 = Object.Instantiate<GameObject>(((Component)((Component)player).transform.Find("wizardtrio")).gameObject);
					<dupe>5__2.transform.position = ((Component)player).transform.position;
					<dupe>5__2.transform.rotation = ((Component)player).transform.rotation;
					<playerMaterials>5__3 = <dupe>5__2.GetComponentsInChildren<SkinnedMeshRenderer>().SelectMany((SkinnedMeshRenderer smr) => ((Renderer)smr).materials).ToArray() ?? Array.Empty<Material>();
					Material[] array = <playerMaterials>5__3;
					foreach (Material val in array)
					{
						if (!((Object)(object)val == (Object)null))
						{
							val.shader = shaderPefab;
						}
					}
					<time>5__4 = 2f + 0.5f * (float)(castingLevel - 1);
					break;
				}
				case 1:
					<>1__state = -1;
					break;
				}
				if (<time>5__4 > 0f)
				{
					<time>5__4 -= Time.deltaTime;
					Material[] array = <playerMaterials>5__3;
					foreach (Material val2 in array)
					{
						if (!((Object)(object)val2 == (Object)null))
						{
							Color val3 = ((player.playerTeam == team) ? Color.cyan : Color.red);
							val2.SetColor("_XRayColor", val3);
							val2.SetFloat("_XRayIntensity", <time>5__4 * 0.5f);
						}
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				Object.Destroy((Object)(object)<dupe>5__2);
				echoLocationLogic.busyWithReveal--;
				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();
			}
		}

		private static Shader? shaderPefab;

		private float duration = 10f;

		private int busyWithReveal;

		public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
		{
			PlayerMovement caster2 = caster;
			if (!((NetworkBehaviour)caster2).IsOwner)
			{
				return true;
			}
			PlayerMovement[] source = (from obj in GameObject.FindGameObjectsWithTag("Player")
				select obj.GetComponent<PlayerMovement>()).ToArray();
			((MonoBehaviour)this).StartCoroutine(CoCastSpell(caster2, source.Where((PlayerMovement p) => (Object)(object)p != (Object)(object)caster2).ToArray(), castingLevel));
			return true;
		}

		[IteratorStateMachine(typeof(<CoCastSpell>d__3))]
		private IEnumerator CoCastSpell(PlayerMovement owner, PlayerMovement[] players, int castingLevel)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CoCastSpell>d__3(0)
			{
				<>4__this = this,
				owner = owner,
				players = players,
				castingLevel = castingLevel
			};
		}

		[IteratorStateMachine(typeof(<CoRevealLocation>d__5))]
		private IEnumerator CoRevealLocation(PlayerMovement player, int team, int castingLevel)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CoRevealLocation>d__5(0)
			{
				<>4__this = this,
				player = player,
				team = team,
				castingLevel = castingLevel
			};
		}

		public override void OnPrefabCreatedAutomatically(GameObject prefab)
		{
			AssetBundle? spellsAssets = MSPlugin.SpellsAssets;
			shaderPefab = ((spellsAssets != null) ? spellsAssets.LoadAsset<Shader>("Assets/SpellAssets/Spells/XRayShader.shader") : null);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}