Decompiled source of Invested v2.0.5

elendruin-Invested.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("JGreen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("elendruin-Invested")]
[assembly: AssemblyTitle("elendruin-Invested")]
[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 elendruin_Invested
{
	[BepInPlugin("JGreen.elendruin-Invested", "elendruin_Invested", "1.0")]
	public class elendruin_Invested : BaseUnityPlugin
	{
		internal static elendruin_Invested Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}
namespace Invested
{
	[BepInPlugin("com.invested.pulsewave", "Invested", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ShockwaveMod : BaseUnityPlugin
	{
		public static ConfigEntry<KeyCode> ShockwaveKey;

		public static ConfigEntry<float> ShockwaveCooldown;

		private FileSystemWatcher configWatcher;

		private const string ConfigFileName = "com.invested.pulsewave.cfg";

		private void Awake()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			ShockwaveKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "ShockwaveKey", (KeyCode)114, "Key used to trigger the Shockwave ability.");
			ShockwaveCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "ShockwaveCooldown", 180f, "Cooldown time for the Shockwave ability in seconds.");
			SetupWatcher();
			GameObject val = new GameObject("ShockwaveModObject");
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<ShockwaveBehaviour>();
			Object.DontDestroyOnLoad((Object)(object)val);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ShockwaveMod initialized.");
		}

		private void SetupWatcher()
		{
			configWatcher = new FileSystemWatcher(Paths.ConfigPath, "com.invested.pulsewave.cfg")
			{
				NotifyFilter = (NotifyFilters.Size | NotifyFilters.LastWrite)
			};
			configWatcher.Changed += delegate
			{
				try
				{
					((BaseUnityPlugin)this).Config.Reload();
					((BaseUnityPlugin)this).Logger.LogInfo((object)"[ShockwaveMod] Config reloaded due to change.");
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("[ShockwaveMod] Failed to reload config: " + ex.Message));
				}
			};
			configWatcher.EnableRaisingEvents = true;
		}
	}
	public class ShockwaveBehaviour : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <FlashEnemyRed>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Enemy enemy;

			public float duration;

			public ShockwaveBehaviour <>4__this;

			private Renderer <renderer>5__1;

			private Material <mat>5__2;

			private Color <originalColor>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<renderer>5__1 = null;
				<mat>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Expected O, but got Unknown
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<renderer>5__1 = ((Component)enemy).GetComponentInChildren<Renderer>();
					if ((Object)(object)<renderer>5__1 == (Object)null)
					{
						return false;
					}
					<renderer>5__1.material = new Material(<renderer>5__1.material);
					<mat>5__2 = <renderer>5__1.material;
					if ((Object)(object)<mat>5__2 == (Object)null)
					{
						return false;
					}
					<originalColor>5__3 = <mat>5__2.color;
					<mat>5__2.color = new Color(1f, 0f, 0f, 1f);
					<>2__current = (object)new WaitForSeconds(duration);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<mat>5__2.color = <originalColor>5__3;
					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 <ResetEnemyState>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Enemy enemy;

			public float delay;

			public ShockwaveBehaviour <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)enemy != (Object)null)
					{
						enemy.CurrentState = (EnemyState)1;
						Debug.Log((object)("[ShockwaveMod] Enemy '" + ((Object)enemy).name + "' state reset."));
					}
					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 <SpawnShockwaveRing>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 origin;

			public float maxRadius;

			public ShockwaveBehaviour <>4__this;

			private GameObject <ringObj>5__1;

			private string <path>5__2;

			private Texture2D <ringTex>5__3;

			private Shader <ringShader>5__4;

			private Material <ringMat>5__5;

			private float <duration>5__6;

			private float <timer>5__7;

			private float <t>5__8;

			private float <radius>5__9;

			private float <alpha>5__10;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<ringObj>5__1 = null;
				<path>5__2 = null;
				<ringTex>5__3 = null;
				<ringShader>5__4 = null;
				<ringMat>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004c: 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_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Expected O, but got Unknown
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Expected O, but got Unknown
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0216: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<ringObj>5__1 = GameObject.CreatePrimitive((PrimitiveType)5);
					((Object)<ringObj>5__1).name = "ShockwaveRing";
					<ringObj>5__1.transform.position = origin;
					<ringObj>5__1.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
					<ringObj>5__1.transform.localScale = Vector3.zero;
					Object.Destroy((Object)(object)<ringObj>5__1.GetComponent<Collider>());
					<path>5__2 = Path.Combine(Paths.PluginPath, "elendruin-Invested", "shockwave_ring.png");
					<ringTex>5__3 = new Texture2D(2, 2);
					ImageConversion.LoadImage(<ringTex>5__3, File.ReadAllBytes(<path>5__2));
					<ringShader>5__4 = Shader.Find("Sprites/Default");
					if ((Object)(object)<ringShader>5__4 == (Object)null)
					{
						Debug.LogError((object)"[ShockwaveMod] Could not find a shader for the ring.");
						return false;
					}
					<ringMat>5__5 = new Material(<ringShader>5__4);
					<ringMat>5__5.mainTexture = (Texture)(object)<ringTex>5__3;
					<ringMat>5__5.color = new Color(1f, 1f, 1f, 1f);
					((Renderer)<ringObj>5__1.GetComponent<MeshRenderer>()).material = <ringMat>5__5;
					<duration>5__6 = 0.2f;
					<timer>5__7 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<timer>5__7 < <duration>5__6)
				{
					<t>5__8 = <timer>5__7 / <duration>5__6;
					<radius>5__9 = Mathf.Lerp(0.1f, maxRadius, <t>5__8);
					<alpha>5__10 = Mathf.Lerp(0.6f, 0f, <t>5__8);
					<ringObj>5__1.transform.localScale = new Vector3(<radius>5__9, <radius>5__9, 1f);
					<ringMat>5__5.color = new Color(1f, 1f, 1f, <alpha>5__10);
					<timer>5__7 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				Object.Destroy((Object)(object)<ringObj>5__1);
				return false;
			}

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

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

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

			private object <>2__current;

			public WWW www;

			public ShockwaveBehaviour <>4__this;

			private AudioClip <clip>5__1;

			private GameObject <audioObject>5__2;

			private AudioSource <source>5__3;

			private AudioEchoFilter <echo>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<clip>5__1 = null;
				<audioObject>5__2 = null;
				<source>5__3 = null;
				<echo>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Expected O, but got Unknown
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = www;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!string.IsNullOrEmpty(www.error))
					{
						Debug.LogError((object)("[ShockwaveMod] Failed to load sound: " + www.error));
						return false;
					}
					<clip>5__1 = www.GetAudioClip(false, false, (AudioType)14);
					<audioObject>5__2 = new GameObject("ShockwaveSound");
					<audioObject>5__2.transform.position = ((Component)<>4__this).transform.position;
					<source>5__3 = <audioObject>5__2.AddComponent<AudioSource>();
					<source>5__3.clip = <clip>5__1;
					<source>5__3.volume = 1.5f;
					<source>5__3.spatialBlend = 1f;
					<source>5__3.pitch = 1.2f + Random.Range(-0.1f, 0.1f);
					<echo>5__4 = <audioObject>5__2.AddComponent<AudioEchoFilter>();
					<echo>5__4.delay = 200f;
					<echo>5__4.decayRatio = 0.5f;
					<echo>5__4.wetMix = 1f;
					<echo>5__4.dryMix = 1f;
					<source>5__3.Play();
					Object.Destroy((Object)(object)<audioObject>5__2, <clip>5__1.length + 1.5f);
					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 float cooldown = 60f;

		private float lastUsedTime = -9999f;

		private bool wasInGameplay = false;

		private float gameplayStartTime = -999f;

		private bool showUI = false;

		private Color? cachedAvatarColor = null;

		private void Update()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = IsInGameplayLevel();
			if (flag && !wasInGameplay)
			{
				gameplayStartTime = Time.time;
				showUI = false;
			}
			if (flag && Time.time - gameplayStartTime >= 10f)
			{
				showUI = true;
			}
			if (!flag)
			{
				showUI = false;
			}
			wasInGameplay = flag;
			if (!flag)
			{
				cooldown = 0f;
			}
			else if (Input.GetKeyDown(ShockwaveMod.ShockwaveKey.Value) && Time.time - lastUsedTime > cooldown)
			{
				TriggerShockwave();
				lastUsedTime = Time.time;
			}
		}

		private bool IsInGameplayLevel()
		{
			return (Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && (Object)(object)PlayerController.instance != (Object)null && ((Component)PlayerController.instance).gameObject.activeInHierarchy;
		}

		private void TriggerShockwave()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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_00ab: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			float num = 8f;
			float num2 = 80f;
			float num3 = 5f;
			cooldown = ShockwaveMod.ShockwaveCooldown.Value;
			Vector3 position = ((Component)PlayerController.instance).transform.position;
			((MonoBehaviour)this).StartCoroutine(SpawnShockwaveRing(position + Vector3.up * 0.5f, num));
			EnemyRigidbody[] array = Object.FindObjectsOfType<EnemyRigidbody>();
			int num4 = 0;
			EnemyRigidbody[] array2 = array;
			foreach (EnemyRigidbody val in array2)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val.enemy == (Object)null)
				{
					continue;
				}
				Enemy enemy = val.enemy;
				float num5 = Vector3.Distance(position, ((Component)val).transform.position);
				if (num5 > num)
				{
					continue;
				}
				((MonoBehaviour)this).StartCoroutine(FlashEnemyRed(enemy));
				Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
				if (!((Object)(object)component == (Object)null) && !component.isKinematic)
				{
					EnemyStateStunned component2 = ((Component)enemy).GetComponent<EnemyStateStunned>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.Set(num3);
					}
					Vector3 val2 = ((Component)val).transform.position - position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					component.AddForce(normalized * num2, (ForceMode)1);
					((MonoBehaviour)this).StartCoroutine(FlashEnemyRed(enemy));
					((MonoBehaviour)this).StartCoroutine(ResetEnemyState(enemy, num3));
					num4++;
				}
			}
			PlayCustomShockwaveSound();
			Debug.Log((object)$"[ShockwaveMod] Shockwave triggered at {position}, affected {num4} enemies.");
		}

		[IteratorStateMachine(typeof(<SpawnShockwaveRing>d__9))]
		private IEnumerator SpawnShockwaveRing(Vector3 origin, float maxRadius)
		{
			//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 <SpawnShockwaveRing>d__9(0)
			{
				<>4__this = this,
				origin = origin,
				maxRadius = maxRadius
			};
		}

		[IteratorStateMachine(typeof(<FlashEnemyRed>d__10))]
		private IEnumerator FlashEnemyRed(Enemy enemy, float duration = 0.25f)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FlashEnemyRed>d__10(0)
			{
				<>4__this = this,
				enemy = enemy,
				duration = duration
			};
		}

		[IteratorStateMachine(typeof(<ResetEnemyState>d__11))]
		private IEnumerator ResetEnemyState(Enemy enemy, float delay)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResetEnemyState>d__11(0)
			{
				<>4__this = this,
				enemy = enemy,
				delay = delay
			};
		}

		private void PlayCustomShockwaveSound()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			string[] array = new string[3] { "pulse1.ogg", "pulse2.ogg", "pulse3.ogg" };
			string path = array[Random.Range(0, array.Length)];
			string text = Path.Combine(Paths.PluginPath, "elendruin-Invested", path);
			WWW www = new WWW("file://" + text);
			((MonoBehaviour)this).StartCoroutine(WaitAndPlay(www));
		}

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

		private Color GetPlayerAvatarColor()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			if (cachedAvatarColor.HasValue)
			{
				return cachedAvatarColor.Value;
			}
			GameObject obj = GameObject.Find("PlayerAvatar(Clone)");
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				Transform obj3 = obj.transform.Find("Player Avatar Controller");
				obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
			}
			GameObject val = (GameObject)obj2;
			if ((Object)(object)val != (Object)null)
			{
				Renderer componentInChildren = val.GetComponentInChildren<Renderer>();
				if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.material != (Object)null)
				{
					cachedAvatarColor = componentInChildren.material.color;
					return cachedAvatarColor.Value;
				}
			}
			cachedAvatarColor = Color.cyan;
			return cachedAvatarColor.Value;
		}

		private void OnGUI()
		{
			//IL_0059: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_0125: 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_013b: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_017d: 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_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_01b0: 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_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			if (showUI)
			{
				float num = Time.time - lastUsedTime;
				float num2 = Mathf.Clamp01(num / cooldown);
				float num3 = 200f;
				float num4 = 15f;
				float num5 = 120f;
				float num6 = 330f;
				float num7 = 0.7f;
				float num8 = 2f;
				Color playerAvatarColor = GetPlayerAvatarColor();
				playerAvatarColor.a = num7;
				KeyCode value = ShockwaveMod.ShockwaveKey.Value;
				string text = ((object)(KeyCode)(ref value)).ToString();
				string text2 = ((num2 >= 1f) ? ("[" + text + "] Pulse Ready") : "Charging...");
				GUIStyle val = new GUIStyle(GUI.skin.label);
				val.fontSize = 18;
				val.alignment = (TextAnchor)3;
				Color color = default(Color);
				((Color)(ref color))..ctor(0f, 0f, 0f, num7);
				Vector2[] array = (Vector2[])(object)new Vector2[8]
				{
					new Vector2(-1f, 0f),
					new Vector2(1f, 0f),
					new Vector2(0f, -1f),
					new Vector2(0f, 1f),
					new Vector2(-1f, -1f),
					new Vector2(1f, -1f),
					new Vector2(-1f, 1f),
					new Vector2(1f, 1f)
				};
				Vector2[] array2 = array;
				foreach (Vector2 val2 in array2)
				{
					GUI.color = color;
					GUI.Label(new Rect(num5 + val2.x, num6 - 30f + val2.y, num3, 30f), text2, val);
				}
				GUI.color = new Color(1f, 1f, 1f, num7);
				GUI.Label(new Rect(num5, num6 - 30f, num3, 30f), text2, val);
				GUI.color = new Color(0f, 0f, 0f, num7);
				GUI.DrawTexture(new Rect(num5 - num8, num6 - num8, num3 + 2f * num8, num4 + 2f * num8), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = new Color(0.3f, 0.3f, 0.3f, num7);
				GUI.DrawTexture(new Rect(num5, num6, num3, num4), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = playerAvatarColor;
				GUI.DrawTexture(new Rect(num5, num6, num3 * num2, num4), (Texture)(object)Texture2D.whiteTexture);
			}
		}
	}
}