Decompiled source of AhhhDeath v1.0.1

AhhhDeath.dll

Decompiled a day ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AhhhDeath.Patches;
using BepInEx;
using BepInEx.Logging;
using DeathFart;
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("DeathFart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeathFart")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e489b754-5271-48a3-a173-cb9ef214c576")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DeathFart
{
	[BepInPlugin("pudack.AhhhDeath", "AhhhDeath", "1.0.0")]
	public class AhhhDeathBase : BaseUnityPlugin
	{
		private const string modGUID = "pudack.AhhhDeath";

		private const string modName = "AhhhDeath";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("pudack.AhhhDeath");

		internal static AhhhDeathBase instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> sounds;

		internal static AssetBundle bundle;

		public void Awake()
		{
			if (instance == null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("pudack.AhhhDeath");
			mls.LogInfo((object)"AhhhDeath Loading");
			harmony.PatchAll(typeof(AhhhDeathBase));
			harmony.PatchAll(typeof(PlayerAvatarPatch));
			harmony.PatchAll(typeof(PlayerDeathEffectsPatch));
			sounds = new List<AudioClip>();
			string location = ((BaseUnityPlugin)instance).Info.Location;
			location = location.TrimEnd("AhhhDeath.dll".ToCharArray());
			bundle = AssetBundle.LoadFromFile(location + "ahhhfx");
			if (bundle == null)
			{
				mls.LogError((object)"Failed to load audio asset!");
				return;
			}
			sounds = bundle.LoadAllAssets<AudioClip>().ToList();
			mls.LogInfo((object)("Loaded " + sounds.Count + " sounds from asset bundle! First sounds: " + ((Object)sounds[0]).name));
			mls.LogInfo((object)"Successfully loaded AhhhDeath mod");
		}
	}
}
namespace AhhhDeath.Patches
{
	[HarmonyPatch(typeof(PlayerAvatar))]
	public class PlayerAvatarPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Postfix(PlayerAvatar __instance)
		{
			__instance.deathSound.Sounds = AhhhDeathBase.sounds.ToArray();
		}
	}
	[HarmonyPatch(typeof(PlayerDeathEffects))]
	public class PlayerDeathEffectsPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Postfix(PlayerDeathEffects __instance)
		{
			__instance.deathSound.Sounds = AhhhDeathBase.sounds.ToArray();
		}
	}
}