Decompiled source of BrackenRickrollSFX v1.0.0

BrackenRickroll.dll

Decompiled 11 months 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 BrackenRickroll.Patches;
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("BrackenRickroll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BrackenRickroll")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("37082376-d723-4b00-b31e-6661840da2c4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BrackenRickroll
{
	[BepInPlugin("Ex.BrackenRickrollMod", "Ex Bracken Rickroll SFX Mod", "1.0.0")]
	public class BrackenRickrollBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.BrackenRickrollMod";

		private const string modName = "Ex Bracken Rickroll SFX Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Ex.BrackenRickrollMod");

		private static BrackenRickrollBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newBrackenDieSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.BrackenRickrollMod");
			mls.LogInfo((object)"Bracken Rickroll SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "BrackenRickroll.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "BrackenRickrollSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newBrackenDieSFX = val.LoadAsset<AudioClip>("Assets/Rickroll.mp3");
			harmony.PatchAll(typeof(BrackenRickrollBase));
			harmony.PatchAll(typeof(RickrollPatch));
			mls.LogInfo((object)"Hoarder SFX mod has loaded.");
		}
	}
}
namespace BrackenRickroll.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class RickrollPatch
	{
		[HarmonyPatch("KillEnemy")]
		[HarmonyPostfix]
		public static void RickrollSFXPatch(EnemyAI __instance)
		{
			__instance.dieSFX = BrackenRickrollBase.newBrackenDieSFX;
			__instance.creatureVoice.PlayOneShot(__instance.dieSFX);
		}
	}
}