Decompiled source of MetalPipeHeadshot v0.0.0

MetalPipeHeadshot.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using MetalPipeHeadshot.Classes;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RepoCaosMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ReviOS 11 24.12")]
[assembly: AssemblyProduct("RepoCaosMod")]
[assembly: AssemblyCopyright("Copyright © ReviOS 11 24.12 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b62091cf-1bc7-4d0e-be7b-011b6b98bf30")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MetalPipeHeadshot
{
	[BepInPlugin("duviz.ultrakill.metalpipeheadshot", "MetalPipeHeadshot", "0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static Plugin instance;

		public static ConfigEntry<string> Url;

		public void Awake()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			((Object)ThreadingHelper.Instance).hideFlags = (HideFlags)61;
			((ConfigEntry<bool>)AccessTools.Field(typeof(Chainloader), "ConfigHideBepInExGOs").GetValue(null)).Value = true;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello, the Instagram community!");
			new Harmony("duviz.ultrakill.metalpipeheadshot").PatchAll();
			Url = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Url", "https://duviz.xyz/static/audio/jixaw-metal-pipe-falling-sound.mp3", "Change the url for the sfx :3");
			instance = this;
		}

		public void Start()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new GameObject("MetalpipeHeadshots").AddComponent<MetalpipeHeadshots>();
		}

		public void Update()
		{
		}

		public void LateUpdate()
		{
		}

		public static T Ass<T>(string path)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public static void LogInfo(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo(data);
		}

		public static void LogError(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogError(data);
		}
	}
}
namespace MetalPipeHeadshot.Patches
{
	[HarmonyPatch(typeof(StyleCalculator))]
	[HarmonyPatch("AddPoints")]
	internal class StyleCalculatorPatch
	{
		public static bool Prefix(int points, string pointName, EnemyIdentifier eid, GameObject sourceWeapon = null)
		{
			if ((Object)(object)MetalpipeHeadshots.audioSource != (Object)null && pointName.Contains("headshot"))
			{
				MetalpipeHeadshots.audioSource.PlayOneShot(MetalpipeHeadshots.audioSource.clip);
			}
			return true;
		}
	}
}
namespace MetalPipeHeadshot.Classes
{
	internal class MetalpipeHeadshots : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <LoadAudio>d__2 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			private UnityWebRequest <www>5__2;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)13);
						<>1__state = -3;
						<>2__current = <www>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__2.result != 1)
						{
							Debug.LogError((object)("Failed to download audio: " + <www>5__2.error));
						}
						else
						{
							AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
							audioSource.clip = content;
						}
						<>m__Finally1();
						<www>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			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 (<www>5__2 != null)
				{
					((IDisposable)<www>5__2).Dispose();
				}
			}

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

		public static AudioSource audioSource;

		private void Start()
		{
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			((MonoBehaviour)this).StartCoroutine(LoadAudio(Plugin.Url.Value));
		}

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