Decompiled source of ParryNoise v1.0.0

ParryNoisePlugin.dll

Decompiled a day 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 HarmonyLib;
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("ParryNoisePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ParryNoisePlugin")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8df2bcad-5899-40ae-bfca-ba5aa3ecf878")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("org.intdependent.ultrakill.parrynoise", "ParryNoise", "1.0.0")]
public class ParryNoisePlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(TimeController), "TimeIsStopped")]
	private class BigHitStopPatch
	{
		private static bool wasStopped;

		private static void Prefix(bool trueStop)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)customClip == (Object)null) && trueStop && !wasStopped)
			{
				wasStopped = true;
				AudioSource.PlayClipAtPoint(customClip, ((Component)Camera.main).transform.position, 1f);
			}
		}

		private static void Postfix(bool trueStop)
		{
			if (trueStop)
			{
				wasStopped = false;
			}
		}
	}

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

		private object <>2__current;

		public ParryNoisePlugin <>4__this;

		private string <pluginFolder>5__1;

		private string <path>5__2;

		private string <url>5__3;

		private WWW <www>5__4;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<pluginFolder>5__1 = null;
			<path>5__2 = null;
			<url>5__3 = null;
			<www>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<pluginFolder>5__1 = Path.GetDirectoryName(((BaseUnityPlugin)<>4__this).Info.Location);
				<path>5__2 = Path.Combine(<pluginFolder>5__1, "parry.ogg");
				if (!File.Exists(<path>5__2))
				{
					((BaseUnityPlugin)<>4__this).Logger.LogError((object)("parry.ogg not found! Location: " + <path>5__2));
					return false;
				}
				<url>5__3 = "file:///" + <path>5__2.Replace("\\", "/");
				<www>5__4 = new WWW(<url>5__3);
				<>2__current = <www>5__4;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				customClip = <www>5__4.GetAudioClip(false, false);
				((Object)customClip).name = "parry_custom";
				((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Custom parry sound loaded!");
				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 customClip;

	private void Awake()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		((MonoBehaviour)this).StartCoroutine(LoadCustomSound());
		Harmony val = new Harmony("org.intdependent.ultrakill.parrynoise");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"ParryNoise loaded!");
	}

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