Decompiled source of NeruPlush v1.0.0

Neruplushvorias.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using LethalLib.Modules;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Neruplushvorias")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Neruplushvorias")]
[assembly: AssemblyTitle("Neruplushvorias")]
[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;
		}
	}
}
namespace NeruPlushVorias
{
	public class FlopSoundScrap : MonoBehaviour
	{
		public AudioSource audioSource;
	}
	[HarmonyPatch(typeof(GrabbableObject), "ItemActivate")]
	public static class ItemActivatePatch
	{
		private static void Postfix(GrabbableObject __instance, bool buttonDown)
		{
			if (!buttonDown)
			{
				return;
			}
			FlopSoundScrap component = ((Component)__instance).GetComponent<FlopSoundScrap>();
			if (!((Object)(object)component == (Object)null) && !((Object)(object)component.audioSource == (Object)null))
			{
				if (component.audioSource.isPlaying)
				{
					component.audioSource.Stop();
				}
				else
				{
					component.audioSource.Play();
				}
			}
		}
	}
	[BepInPlugin("malco.NeruPlushVorias", "Neru Plush", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "malco.NeruPlushVorias";

		private const string NAME = "Neru Plush";

		private const string VERSION = "0.0.1";

		public static AudioClip flopClip;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("malco.NeruPlushVorias");
			val.PatchAll();
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemvorias");
			AssetBundle val2 = AssetBundle.LoadFromFile(text);
			Item val3 = val2.LoadAsset<Item>("Assets/NeruS/NeruSItem.asset");
			flopClip = val2.LoadAsset<AudioClip>("Assets/NeruS/floperajp.mp3");
			GameObject spawnPrefab = val3.spawnPrefab;
			FlopSoundScrap flopSoundScrap = spawnPrefab.AddComponent<FlopSoundScrap>();
			AudioSource val4 = spawnPrefab.AddComponent<AudioSource>();
			val4.clip = flopClip;
			val4.playOnAwake = false;
			val4.spatialBlend = 1f;
			val4.maxDistance = 15f;
			val4.rolloffMode = (AudioRolloffMode)1;
			val4.volume = 0.4f;
			flopSoundScrap.audioSource = val4;
			NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab);
			Utilities.FixMixerGroups(spawnPrefab);
			Items.RegisterScrap(val3, 20, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Neru Plush loaded with sound");
		}
	}
}