Decompiled source of Fart Grenade v1.0.0

FartGrenade.dll

Decompiled 12 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace FartGrenade
{
	[BepInPlugin("Eteli.FartGrenade", "Fart Grenade", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "Eteli.FartGrenade";

		public const string modName = "Fart Grenade";

		public const string modVersion = "0.0.1";

		private static Harmony _harmony;

		internal static ManualLogSource Log;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		public void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Eteli.FartGrenade has awoken!");
			_harmony = new Harmony("Eteli.FartGrenade");
			_harmony.PatchAll();
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)this).Info.Location;
			location = location.TrimEnd("FartGrenade.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "fartgrenade");
			if ((Object)(object)Bundle != (Object)null)
			{
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
				Log.LogInfo((object)"Successfully loaded thge asset bundle");
			}
			else
			{
				Log.LogError((object)"Failed to load asset bundle!");
			}
		}
	}
}
namespace FartGrenade.Patches
{
	[HarmonyPatch(typeof(ItemGrenadeExplosive), "Start")]
	public class ItemGrenadeExplosivePatch
	{
		[HarmonyPostfix]
		public static void Postfix(ParticleScriptExplosion ___particleScriptExplosion)
		{
			___particleScriptExplosion.explosionPreset.explosionSoundBig.Sounds = Plugin.SoundFX.ToArray();
			___particleScriptExplosion.explosionPreset.explosionSoundBigGlobal.Sounds = Plugin.SoundFX.ToArray();
		}
	}
}