Decompiled source of IronVerdict v1.0.0

IronVerdictSpell.dll

Decompiled a month 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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BlackMagicAPI.Enums;
using BlackMagicAPI.Helpers;
using BlackMagicAPI.Managers;
using BlackMagicAPI.Modules.Spells;
using IronVerdictMod;
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: AssemblyTitle("IronVerdictSpell")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IronVerdictSpell")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5b3721e8-b0ed-4af5-8261-52185725bef0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
[BepInPlugin("com.yourname.ironverdictmod", "IronVerdictMod", "1.0.0")]
[BepInProcess("MageArena.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class IronVerdictPlugin : BaseUnityPlugin
{
	public static string modsync = "all";

	public static IronVerdictPlugin Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
		SpellManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(IronVerdictSpellData), typeof(IronVerdictSpellLogic));
	}
}
namespace IronVerdictMod
{
	internal class IronVerdictSpellData : SpellData
	{
		public override SpellType SpellType => (SpellType)0;

		public override string Name => "Iron Verdict";

		public override float Cooldown => 50f;

		public override Color GlowColor => Color.gray;

		public override bool CanSpawnInTeamChest => false;

		public override Texture2D? GetMainTexture()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "IronVerdict_Main.png");
			Texture2D val = Utils.LoadTextureFromDisk(text);
			if ((Object)(object)val == (Object)null)
			{
				val = Utils.LoadTextureFromResources(Assembly.GetExecutingAssembly(), "IronVerdictMod.Resources.IronVerdictMain.png");
			}
			if ((Object)(object)val == (Object)null)
			{
				return new Texture2D(1, 1);
			}
			return val;
		}

		public override Texture2D? GetEmissionTexture()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "IronVerdict_Emission.png");
			Texture2D val = Utils.LoadTextureFromDisk(text);
			if ((Object)(object)val == (Object)null)
			{
				val = Utils.LoadTextureFromResources(Assembly.GetExecutingAssembly(), "IronVerdictMod.Resources.IronVerdictEmission.png");
			}
			if ((Object)(object)val == (Object)null)
			{
				return new Texture2D(1, 1);
			}
			return val;
		}
	}
	internal class IronVerdictSpellLogic : SpellLogic
	{
		[CompilerGenerated]
		private sealed class <CreateWall>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject casterObj;

			public Vector3 targetPoint;

			public IronVerdictSpellLogic <>4__this;

			private GameObject <wall>5__1;

			private Collider <collider>5__2;

			private Renderer <renderer>5__3;

			private Material <material>5__4;

			private string <modPath>5__5;

			private string <texturePath>5__6;

			private Texture2D <texture>5__7;

			private Rigidbody <rb>5__8;

			private string <fallingSoundPath>5__9;

			private string <clankSoundPath>5__10;

			private RaycastHit <groundHit>5__11;

			private float <sinkDuration>5__12;

			private float <sinkSpeed>5__13;

			private Shader[] <shaders>5__14;

			private AudioClip <loadedSound>5__15;

			private GameObject <audioObj>5__16;

			private AudioSource <source>5__17;

			private AudioClip <loadedSound>5__18;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<wall>5__1 = null;
				<collider>5__2 = null;
				<renderer>5__3 = null;
				<material>5__4 = null;
				<modPath>5__5 = null;
				<texturePath>5__6 = null;
				<texture>5__7 = null;
				<rb>5__8 = null;
				<fallingSoundPath>5__9 = null;
				<clankSoundPath>5__10 = null;
				<shaders>5__14 = null;
				<loadedSound>5__15 = null;
				<audioObj>5__16 = null;
				<source>5__17 = null;
				<loadedSound>5__18 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0662: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_013f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0149: Expected O, but got Unknown
				//IL_0413: Unknown result type (might be due to invalid IL or missing references)
				//IL_0418: Unknown result type (might be due to invalid IL or missing references)
				//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05be: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f4: 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)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0174: Expected O, but got Unknown
				//IL_0631: Unknown result type (might be due to invalid IL or missing references)
				//IL_063b: Expected O, but got Unknown
				//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0604: Unknown result type (might be due to invalid IL or missing references)
				//IL_0687: Unknown result type (might be due to invalid IL or missing references)
				//IL_068c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0697: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0282: 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_058e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0486: Unknown result type (might be due to invalid IL or missing references)
				//IL_0556: Unknown result type (might be due to invalid IL or missing references)
				//IL_031f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: Expected O, but got Unknown
				//IL_033f: Unknown result type (might be due to invalid IL or missing references)
				Vector3 velocity;
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (!shadersLogged)
					{
						shadersLogged = true;
						<shaders>5__14 = Resources.FindObjectsOfTypeAll<Shader>();
						<shaders>5__14 = null;
					}
					<wall>5__1 = GameObject.CreatePrimitive((PrimitiveType)3);
					<wall>5__1.transform.position = targetPoint + Vector3.up * 80f;
					<wall>5__1.transform.localScale = new Vector3(20f, 15f, 3f);
					<wall>5__1.transform.rotation = casterObj.transform.rotation;
					<collider>5__2 = <wall>5__1.GetComponent<Collider>();
					<collider>5__2.isTrigger = false;
					<wall>5__1.layer = 8;
					<renderer>5__3 = <wall>5__1.GetComponent<Renderer>();
					<material>5__4 = new Material(Shader.Find("HDRP/Lit"));
					if ((Object)(object)<material>5__4.shader == (Object)null)
					{
						<material>5__4 = new Material(Shader.Find("Standard"));
					}
					<material>5__4.color = Color.gray;
					<material>5__4.SetFloat("_Metallic", 0.8f);
					<material>5__4.SetFloat("_Smoothness", 0.6f);
					<modPath>5__5 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
					<texturePath>5__6 = Path.Combine(<modPath>5__5, "Texture.png");
					<texture>5__7 = Utils.LoadTextureFromDisk(<texturePath>5__6);
					if ((Object)(object)<texture>5__7 == (Object)null)
					{
						<texture>5__7 = Utils.LoadTextureFromResources(Assembly.GetExecutingAssembly(), "IronVerdictMod.Resources.Texture.png");
					}
					if ((Object)(object)<texture>5__7 != (Object)null)
					{
						<material>5__4.mainTexture = (Texture)(object)<texture>5__7;
					}
					<renderer>5__3.material = <material>5__4;
					<rb>5__8 = <wall>5__1.AddComponent<Rigidbody>();
					<rb>5__8.mass = 100f;
					<rb>5__8.useGravity = true;
					<rb>5__8.velocity = Vector3.down * 10f;
					<rb>5__8.constraints = (RigidbodyConstraints)80;
					<fallingSoundPath>5__9 = Path.Combine(<modPath>5__5, "FallingSound.wav");
					if (File.Exists(<fallingSoundPath>5__9))
					{
						<loadedSound>5__15 = Utils.LoadWavFromDisk(<fallingSoundPath>5__9);
						if ((Object)(object)<loadedSound>5__15 != (Object)null && <loadedSound>5__15.length > 0f)
						{
							fallingSound = <loadedSound>5__15;
							<audioObj>5__16 = new GameObject("FallingAudio");
							<audioObj>5__16.transform.position = <wall>5__1.transform.position;
							<audioObj>5__16.transform.parent = <wall>5__1.transform;
							<source>5__17 = <audioObj>5__16.AddComponent<AudioSource>();
							<source>5__17.clip = fallingSound;
							<source>5__17.volume = 1.5f;
							<source>5__17.spatialBlend = 1f;
							<source>5__17.rolloffMode = (AudioRolloffMode)1;
							<source>5__17.minDistance = 5f;
							<source>5__17.maxDistance = 50f;
							<source>5__17.loop = true;
							<source>5__17.Play();
							goto IL_040d;
						}
						goto IL_0455;
					}
					if (!isLoading)
					{
						isLoading = true;
						<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(LoadAndPlayFallingSound(<wall>5__1.transform.position));
						<>1__state = 2;
						return true;
					}
					goto IL_04c6;
				case 1:
					<>1__state = -1;
					goto IL_040d;
				case 2:
					<>1__state = -1;
					goto IL_04c6;
				case 3:
					<>1__state = -1;
					goto IL_04c6;
				case 4:
					<>1__state = -1;
					goto IL_05b3;
				case 5:
					<>1__state = -1;
					<sinkDuration>5__12 = 2f;
					<sinkSpeed>5__13 = <wall>5__1.transform.localScale.y / <sinkDuration>5__12;
					break;
				case 6:
					{
						<>1__state = -1;
						break;
					}
					IL_05b3:
					if (Physics.Raycast(<wall>5__1.transform.position, Vector3.down, ref <groundHit>5__11, 60f))
					{
						<wall>5__1.transform.position = ((RaycastHit)(ref <groundHit>5__11)).point - Vector3.up * 0.5f;
					}
					<rb>5__8.isKinematic = true;
					<rb>5__8.constraints = (RigidbodyConstraints)126;
					<>2__current = (object)new WaitForSeconds(20f);
					<>1__state = 5;
					return true;
					IL_0455:
					<loadedSound>5__15 = null;
					goto IL_04c6;
					IL_040d:
					velocity = <rb>5__8.velocity;
					if (((Vector3)(ref velocity)).magnitude > 0.1f)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<source>5__17.Stop();
					Object.Destroy((Object)(object)<audioObj>5__16);
					<audioObj>5__16 = null;
					<source>5__17 = null;
					goto IL_0455;
					IL_04c6:
					velocity = <rb>5__8.velocity;
					if (((Vector3)(ref velocity)).magnitude > 0.1f)
					{
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					<clankSoundPath>5__10 = Path.Combine(<modPath>5__5, "IronClank.wav");
					if (File.Exists(<clankSoundPath>5__10))
					{
						<loadedSound>5__18 = Utils.LoadWavFromDisk(<clankSoundPath>5__10);
						if ((Object)(object)<loadedSound>5__18 != (Object)null && <loadedSound>5__18.length > 0f)
						{
							clankSound = <loadedSound>5__18;
							PlaySpatialSoundAtPosition(targetPoint, clankSound);
						}
						<loadedSound>5__18 = null;
					}
					else if (!isLoading)
					{
						isLoading = true;
						<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(LoadAndPlayClankSound(targetPoint));
						<>1__state = 4;
						return true;
					}
					goto IL_05b3;
				}
				if (<wall>5__1.transform.position.y > targetPoint.y - <wall>5__1.transform.localScale.y)
				{
					Transform transform = <wall>5__1.transform;
					transform.position += Vector3.down * <sinkSpeed>5__13 * Time.deltaTime;
					<>2__current = null;
					<>1__state = 6;
					return true;
				}
				Object.Destroy((Object)(object)<wall>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 <LoadAndPlayClankSound>d__8 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 position;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					clankSound = Resources.Load<AudioClip>("IronVerdictMod.Resources.IronClank.wav");
					if ((Object)(object)clankSound != (Object)null && clankSound.length > 0f)
					{
						PlaySpatialSoundAtPosition(position, clankSound);
					}
					isLoading = false;
					<>2__current = 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();
			}
		}

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

			private object <>2__current;

			public Vector3 position;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					fallingSound = Resources.Load<AudioClip>("IronVerdictMod.Resources.FallingSound.wav");
					if ((Object)(object)fallingSound != (Object)null && fallingSound.length > 0f)
					{
						PlaySpatialSoundAtPosition(position, fallingSound);
					}
					isLoading = false;
					<>2__current = 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();
			}
		}

		private static AudioClip fallingSound;

		private static AudioClip clankSound;

		private static bool isLoading;

		private static bool shadersLogged;

		public override void CastSpell(GameObject casterObj, Vector3 spawnPos, Vector3 direction, int level)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_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_0029: 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_0036: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			float num = 100f;
			Vector3 val = ((spawnPos != Vector3.zero) ? spawnPos : (casterObj.transform.position + Vector3.up * 1.5f));
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, direction, ref val2, num))
			{
				Vector3 point = ((RaycastHit)(ref val2)).point;
				((MonoBehaviour)this).StartCoroutine(CreateWall(casterObj, point));
			}
		}

		[IteratorStateMachine(typeof(<CreateWall>d__5))]
		private IEnumerator CreateWall(GameObject casterObj, Vector3 targetPoint)
		{
			//IL_0015: 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)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CreateWall>d__5(0)
			{
				<>4__this = this,
				casterObj = casterObj,
				targetPoint = targetPoint
			};
		}

		private static void PlaySpatialSoundAtPosition(Vector3 position, AudioClip clip)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clip == (Object)null) && !(clip.length <= 0f))
			{
				GameObject val = new GameObject("IronClankAudio");
				val.transform.position = position;
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = clip;
				val2.volume = 1.5f;
				val2.spatialBlend = 1f;
				val2.rolloffMode = (AudioRolloffMode)1;
				val2.minDistance = 5f;
				val2.maxDistance = 50f;
				val2.Play();
				Object.Destroy((Object)(object)val, clip.length + 0.1f);
			}
		}

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

		[IteratorStateMachine(typeof(<LoadAndPlayClankSound>d__8))]
		private static IEnumerator LoadAndPlayClankSound(Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadAndPlayClankSound>d__8(0)
			{
				position = position
			};
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.yourname.ironverdictmod";

		public const string PLUGIN_NAME = "IronVerdictMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}