Decompiled source of ZaWarudo v1.0.2

ZaWarudo.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using BlackMagicAPI.Enums;
using BlackMagicAPI.Helpers;
using BlackMagicAPI.Managers;
using BlackMagicAPI.Modules.Spells;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModFramework;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZaWarudo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZaWarudo")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0380a24f-892e-4817-9ae5-bb73aafbab55")]
[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;
		}
	}
}
namespace ZaWarudoMod
{
	[HarmonyPatch(typeof(PlayerMovement), "NonRpcDamagePlayer")]
	public static class Patch_NonRpcDamagePlayer
	{
		private static void Prefix(ref float dmg, GameObject sauce, string type)
		{
			if (ZaWarudoSpellLogic.IsZaWarudoFreezeActive)
			{
				dmg = 0f;
			}
		}
	}
	public class ZaWarudoSpellLogic : SpellLogicBase
	{
		[CompilerGenerated]
		private sealed class <LoadSoundIfNeeded>d__9 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public ZaWarudoSpellLogic <>4__this;

			private Assembly <asm>5__1;

			private string <dir>5__2;

			private string <diskPath>5__3;

			private string <embeddedName>5__4;

			private UnityWebRequest <req>5__5;

			private Stream <stream>5__6;

			private byte[] <buffer>5__7;

			private string <temp>5__8;

			private UnityWebRequest <req>5__9;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				switch (num)
				{
				case -3:
				case 1:
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
					break;
				case -5:
				case -4:
				case 2:
					try
					{
						if (num == -5 || num == 2)
						{
							try
							{
							}
							finally
							{
								<>m__Finally3();
							}
						}
					}
					finally
					{
						<>m__Finally2();
					}
					break;
				}
				<asm>5__1 = null;
				<dir>5__2 = null;
				<diskPath>5__3 = null;
				<embeddedName>5__4 = null;
				<req>5__5 = null;
				<stream>5__6 = null;
				<buffer>5__7 = null;
				<temp>5__8 = null;
				<req>5__9 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0108: Invalid comparison between Unknown and I4
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Invalid comparison between Unknown and I4
				bool result;
				try
				{
					switch (<>1__state)
					{
					default:
						result = false;
						goto end_IL_0000;
					case 0:
						<>1__state = -1;
						if ((Object)(object)_timeStop != (Object)null || _loading)
						{
							result = false;
						}
						else
						{
							_loading = true;
							<asm>5__1 = Assembly.GetExecutingAssembly();
							<dir>5__2 = Path.GetDirectoryName(<asm>5__1.Location) ?? string.Empty;
							<diskPath>5__3 = Path.Combine(<dir>5__2, "TimeStop.wav");
							if (!File.Exists(<diskPath>5__3))
							{
								goto IL_0197;
							}
							<req>5__5 = UnityWebRequestMultimedia.GetAudioClip("file://" + <diskPath>5__3, (AudioType)20);
							<>1__state = -3;
							<>2__current = <req>5__5.SendWebRequest();
							<>1__state = 1;
							result = true;
						}
						goto end_IL_0000;
					case 1:
					{
						<>1__state = -3;
						if ((int)<req>5__5.result != 1)
						{
							ManualLogSource log4 = FrameworkContext.Log;
							if (log4 != null)
							{
								log4.LogWarning((object)("[Za Warudo] Disk audio load failed: " + <req>5__5.error));
							}
							<>m__Finally1();
							<req>5__5 = null;
							goto IL_0197;
						}
						_timeStop = DownloadHandlerAudioClip.GetContent(<req>5__5);
						((Object)_timeStop).name = "TimeStop";
						ManualLogSource log5 = FrameworkContext.Log;
						if (log5 != null)
						{
							log5.LogInfo((object)"[Za Warudo] Audio loaded from disk.");
						}
						_loading = false;
						result = false;
						<>m__Finally1();
						goto end_IL_0000;
					}
					case 2:
						{
							<>1__state = -5;
							if ((int)<req>5__9.result == 1)
							{
								_timeStop = DownloadHandlerAudioClip.GetContent(<req>5__9);
								((Object)_timeStop).name = "TimeStop";
								ManualLogSource log = FrameworkContext.Log;
								if (log != null)
								{
									log.LogInfo((object)"[Za Warudo] Audio loaded from embedded resource.");
								}
							}
							else
							{
								ManualLogSource log2 = FrameworkContext.Log;
								if (log2 != null)
								{
									log2.LogWarning((object)("[Za Warudo] Embedded audio load failed: " + <req>5__9.error));
								}
							}
							<>m__Finally3();
							<req>5__9 = null;
							try
							{
								File.Delete(<temp>5__8);
							}
							catch
							{
							}
							<buffer>5__7 = null;
							<temp>5__8 = null;
							break;
						}
						IL_0197:
						<embeddedName>5__4 = "ZaWarudo.Resources.TimeStop.wav";
						<stream>5__6 = <asm>5__1.GetManifestResourceStream(<embeddedName>5__4);
						<>1__state = -4;
						if (<stream>5__6 == null)
						{
							ManualLogSource log3 = FrameworkContext.Log;
							if (log3 != null)
							{
								log3.LogWarning((object)"[Za Warudo] TimeStop.wav not found on disk or embedded.");
							}
							break;
						}
						<buffer>5__7 = new byte[<stream>5__6.Length];
						<stream>5__6.Read(<buffer>5__7, 0, <buffer>5__7.Length);
						<temp>5__8 = Path.Combine(<dir>5__2, "__TimeStopTemp.wav");
						File.WriteAllBytes(<temp>5__8, <buffer>5__7);
						<req>5__9 = UnityWebRequestMultimedia.GetAudioClip("file://" + <temp>5__8, (AudioType)20);
						<>1__state = -5;
						<>2__current = <req>5__9.SendWebRequest();
						<>1__state = 2;
						result = true;
						goto end_IL_0000;
					}
					<>m__Finally2();
					<stream>5__6 = null;
					_loading = false;
					result = false;
					end_IL_0000:;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<req>5__5 != null)
				{
					((IDisposable)<req>5__5).Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -1;
				if (<stream>5__6 != null)
				{
					((IDisposable)<stream>5__6).Dispose();
				}
			}

			private void <>m__Finally3()
			{
				<>1__state = -4;
				if (<req>5__9 != null)
				{
					((IDisposable)<req>5__9).Dispose();
				}
			}

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

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

			private object <>2__current;

			public Vector3 center;

			private GameObject <sphere>5__1;

			private Material <mat>5__2;

			private Renderer <rend>5__3;

			private float <t>5__4;

			private float <s>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Expected O, but got Unknown
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<sphere>5__1 = GameObject.CreatePrimitive((PrimitiveType)0);
					<sphere>5__1.transform.position = center;
					<sphere>5__1.transform.localScale = Vector3.zero;
					<mat>5__2 = new Material(Shader.Find("HDRP/Lit"));
					<mat>5__2.SetFloat("_SurfaceType", 1f);
					<mat>5__2.SetFloat("_BlendMode", 0f);
					<mat>5__2.SetFloat("_AlphaCutoffEnable", 0f);
					<mat>5__2.SetColor("_BaseColor", new Color(1f, 0.85f, 0f, 0.25f));
					<rend>5__3 = <sphere>5__1.GetComponent<Renderer>();
					<rend>5__3.material = <mat>5__2;
					Object.Destroy((Object)(object)<sphere>5__1.GetComponent<Collider>());
					<t>5__4 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<t>5__4 < 1f)
				{
					<t>5__4 += Time.deltaTime;
					<s>5__5 = Mathf.Lerp(0f, 50f, <t>5__4 / 1f);
					<sphere>5__1.transform.localScale = new Vector3(<s>5__5, <s>5__5, <s>5__5);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				Object.Destroy((Object)(object)<sphere>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();
			}
		}

		private static AudioClip _timeStop;

		private static bool _loading;

		public static bool IsZaWarudoFreezeActive = false;

		internal static readonly Dictionary<int, float> SuppressDamageUntil = new Dictionary<int, float>();

		private const float FreezeRadius = 25f;

		private const int FreezeLevel = 5;

		private const float SphereDuration = 1f;

		private const float SphereMaxScale = 50f;

		public override void CastSpell(GameObject casterObj, PageController page, Vector3 spawnPos, Vector3 direction, int level)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_006b: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource log = FrameworkContext.Log;
			if (log != null)
			{
				log.LogInfo((object)"[Za Warudo]");
			}
			SpellLogicBase.StartRoutine(SpellLogicBase.LoadAndPlaySound(casterObj.transform.position, LoadSoundIfNeeded, () => _timeStop));
			Vector3 val = ((spawnPos != Vector3.zero) ? spawnPos : casterObj.transform.position);
			Collider[] array = Physics.OverlapSphere(val, 25f, -1, (QueryTriggerInteraction)1);
			Collider[] array2 = array;
			foreach (Collider val2 in array2)
			{
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				IsZaWarudoFreezeActive = true;
				PlayerMovement component = ((Component)val2).GetComponent<PlayerMovement>();
				if (Object.op_Implicit((Object)(object)component) && (Object)(object)((Component)val2).gameObject != (Object)(object)casterObj)
				{
					SuppressDamageUntil[((Object)((Component)component).gameObject).GetInstanceID()] = Time.time + 0.5f;
					component.CallSummonIceBox(5, (GameObject)null);
					continue;
				}
				ShadowWizardAI component2 = ((Component)val2).GetComponent<ShadowWizardAI>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					SuppressDamageUntil[((Object)((Component)component2).gameObject).GetInstanceID()] = Time.time + 0.5f;
					component2.CallSummonIceBox(5);
				}
				else
				{
					IsZaWarudoFreezeActive = false;
				}
			}
			SpellLogicBase.StartRoutine(SpawnExpandingSphere(val));
		}

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

		[IteratorStateMachine(typeof(<SpawnExpandingSphere>d__10))]
		private static IEnumerator SpawnExpandingSphere(Vector3 center)
		{
			//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 <SpawnExpandingSphere>d__10(0)
			{
				center = center
			};
		}
	}
	public class ZaWarudoSpellData : SpellDataBase
	{
		public override SpellType SpellType => (SpellType)0;

		public override string Name => "Za Warudo";

		public override float Cooldown => 30f;

		public override Color GlowColor => new Color(1f, 0.85f, 0f);

		public override bool CanSpawnInTeamChest => false;

		protected override string ResourcePrefix => "ZaWarudo.Resources";

		protected override string MainPngName => "ZaWarudo_Main.png";

		protected override string EmissionPngName => "ZaWarudo_Emission.png";

		public override string[] SubNames => new string[4] { "za warudo", "the world", "za warldo", "zah waldo" };

		public override Task<SpellLogic?> GetLogicPrefab()
		{
			return Task.FromResult<SpellLogic>(null);
		}
	}
	[BepInPlugin("ZaWarudoMod", "Za Warudo", "1.0.2")]
	[BepInProcess("MageArena.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ZaWarudoPlugin : ModPluginBase
	{
		public static string modsync = "all";

		protected override void OnPluginAwake()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(ZaWarudoSpellData), typeof(ZaWarudoSpellLogic));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[Za Warudo] ready");
			new Harmony("ZaWarudoMod.Patches").PatchAll();
		}

		private bool InvokeIfExists(Type t, string name, object[] args)
		{
			MethodInfo[] array = (from m in t.GetMethods(BindingFlags.Static | BindingFlags.Public)
				where m.Name == name
				select m).ToArray();
			MethodInfo[] array2 = array;
			foreach (MethodInfo methodInfo in array2)
			{
				Type[] array3 = (from x in methodInfo.GetParameters()
					select x.ParameterType).ToArray();
				if (array3.Length != args.Length)
				{
					continue;
				}
				bool flag = true;
				for (int j = 0; j < array3.Length; j++)
				{
					if (!array3[j].IsInstanceOfType(args[j]) && (!(array3[j] == typeof(Type)) || !(args[j] is Type)))
					{
						flag = false;
						break;
					}
				}
				if (!flag)
				{
					continue;
				}
				try
				{
					methodInfo.Invoke(null, args);
					((BaseUnityPlugin)this).Logger.LogInfo((object)("[Za Warudo] " + name + " overload succeeded: (" + string.Join(", ", array3.Select((Type z) => z.Name)) + ")"));
					return true;
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogDebug((object)("[Za Warudo] " + name + " overload failed: " + ex.Message));
				}
			}
			return false;
		}
	}
}
namespace ModFramework
{
	public static class FrameworkContext
	{
		public static ManualLogSource Log { get; internal set; }

		public static BaseUnityPlugin Host { get; internal set; }
	}
	public abstract class ModPluginBase : BaseUnityPlugin
	{
		public static string ModSyncPolicy { get; protected set; } = "all";


		protected void Awake()
		{
			FrameworkContext.Log = ((BaseUnityPlugin)this).Logger;
			FrameworkContext.Host = (BaseUnityPlugin)(object)this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ModSync found! Initializing mod...");
			OnPluginAwake();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + ((BaseUnityPlugin)this).Info.Metadata.GUID + " is loaded!"));
		}

		protected abstract void OnPluginAwake();
	}
	public abstract class SpellDataBase : SpellData
	{
		public override SpellType SpellType => (SpellType)0;

		public override string Name => ((object)this).GetType().Name;

		public override float Cooldown => 25f;

		public override Color GlowColor => Color.white;

		public override bool CanSpawnInTeamChest => false;

		protected virtual string MainPngName => ShortId + "_Main.png";

		protected virtual string EmissionPngName => ShortId + "_Emission.png";

		protected abstract string ResourcePrefix { get; }

		protected virtual string ShortId
		{
			get
			{
				string name = ((object)this).GetType().Name;
				return name.EndsWith("Data") ? name.Substring(0, name.Length - 4) : name;
			}
		}

		public override Texture2D GetMainTexture()
		{
			return LoadTextureFlexible(MainPngName, ResourcePrefix + "." + ShortId + "Main.png");
		}

		public override Texture2D GetEmissionTexture()
		{
			return LoadTextureFlexible(EmissionPngName, ResourcePrefix + "." + ShortId + "Emission.png");
		}

		protected Texture2D LoadTextureFlexible(string diskFileName, string embeddedResourceFullName)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string path = Path.GetDirectoryName(executingAssembly.Location) ?? string.Empty;
			string text = Path.Combine(path, diskFileName);
			Texture2D val = Utils.LoadTextureFromDisk(text);
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource log = FrameworkContext.Log;
				if (log != null)
				{
					log.LogWarning((object)("[" + ShortId + "] Texture '" + diskFileName + "' not found on disk - trying embedded '" + embeddedResourceFullName + "'."));
				}
				val = Utils.LoadTextureFromResources(executingAssembly, embeddedResourceFullName);
			}
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource log2 = FrameworkContext.Log;
				if (log2 != null)
				{
					log2.LogWarning((object)("[" + ShortId + "] No texture found - using 1x1 fallback."));
				}
				val = new Texture2D(1, 1);
			}
			return val;
		}
	}
	public abstract class SpellLogicBase : SpellLogic
	{
		[CompilerGenerated]
		private sealed class <LoadAndPlaySound>d__3 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Vector3 position;

			public Func<IEnumerator> loadRoutine;

			public Func<AudioClip> getLoadedClip;

			private AudioClip <clip>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (loadRoutine != null)
					{
						<>2__current = loadRoutine();
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				<clip>5__1 = getLoadedClip?.Invoke();
				PlaySpatialSoundAtPosition(position, <clip>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();
			}
		}

		protected bool TryRaycastFrom(GameObject casterObj, Vector3 spawnPos, Vector3 direction, out RaycastHit hit, float maxDistance = 100f, float eyeOffset = 1.5f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((spawnPos != Vector3.zero) ? spawnPos : (casterObj.transform.position + Vector3.up * eyeOffset));
			return Physics.Raycast(val, direction, ref hit, maxDistance);
		}

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

		protected static Coroutine StartRoutine(IEnumerator routine)
		{
			BaseUnityPlugin host = FrameworkContext.Host;
			return (host != null) ? ((MonoBehaviour)host).StartCoroutine(routine) : null;
		}

		[IteratorStateMachine(typeof(<LoadAndPlaySound>d__3))]
		protected static IEnumerator LoadAndPlaySound(Vector3 position, Func<IEnumerator> loadRoutine, Func<AudioClip> getLoadedClip)
		{
			//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 <LoadAndPlaySound>d__3(0)
			{
				position = position,
				loadRoutine = loadRoutine,
				getLoadedClip = getLoadedClip
			};
		}
	}
}