Decompiled source of MetalPipeItems v1.0.0

MetalPipeItems.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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("BetterTerminal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterTerminal")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f21ce86b-6fe5-4494-bde3-73f6ef518d4d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MetalPipeItems;

[BepInPlugin("SteamBlizzard.MetalPipeItems", "MetalPipeItems", "1.0.0.0")]
public class MetalPipeBase : BaseUnityPlugin
{
	private const string modGUID = "SteamBlizzard.MetalPipeItems";

	private const string modName = "MetalPipeItems";

	private const string modVersion = "1.0.0.0";

	private static MetalPipeBase Instance;

	private readonly Harmony harmony = new Harmony("SteamBlizzard.MetalPipeItems");

	internal ManualLogSource mls;

	public void Awake()
	{
		mls = Logger.CreateLogSource("SteamBlizzard.MetalPipeItems");
		mls.LogInfo((object)"MetalPipeItems loading...");
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		harmony.PatchAll();
		mls.LogInfo((object)"Loaded and patches applied.");
	}
}
[HarmonyPatch(typeof(GrabbableObject))]
internal class PipePatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void AudioPatch(GrabbableObject __instance)
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Invalid comparison between Unknown and I4
		if ((Object)(object)__instance != (Object)null)
		{
			ManualLogSource val = Logger.CreateLogSource("SteamBlizzard.MetalPipeItems");
			val.LogInfo((object)"Patching audio...");
			string text = "file://" + Paths.PluginPath + "\\SteamBlizzard-MetalPipeItems\\metal_pipe.mp3";
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)13);
			audioClip.SendWebRequest();
			val.LogMessage((object)"Accessing...");
			while (!audioClip.isDone)
			{
			}
			val.LogMessage((object)"Accessed.");
			if ((int)audioClip.result == 1)
			{
				__instance.itemProperties.dropSFX = DownloadHandlerAudioClip.GetContent(audioClip);
				val.LogMessage((object)"Audio clip assigned to drop SFX.");
			}
			else
			{
				val.LogError((object)"Failed to access audio clip.");
			}
		}
	}
}