Decompiled source of GustavoMine v1.0.1

BepInEx/plugins/Gustavo Mine/GustavoMine.dll

Decompiled 9 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 Gustavo_Mine.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("Gustavo Mine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Gustavo Mine")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("da5b63ee-652d-4f20-9541-627cb9d531a2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Gustavo_Mine
{
	[BepInPlugin("shiz.gustavolandmine", "Gustavo Land Mine", "1.0.0")]
	public class GustavoMineBase : BaseUnityPlugin
	{
		private const string modGUID = "shiz.gustavolandmine";

		private const string modName = "Gustavo Land Mine";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("shiz.gustavolandmine");

		private static GustavoMineBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newMineDetonate;

		internal static AudioClip[] newMineDetonateFar;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("shiz.gustavolandmine");
			mls.LogInfo((object)"Gustavo mine mod is loading");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "GustavoLandMine.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "gustavomine";
			mls.LogInfo((object)text3);
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newMineDetonate = val.LoadAssetWithSubAssets<AudioClip>("Assets/AssetBundlesWanted/gustavomine.mp3");
			newMineDetonateFar = val.LoadAssetWithSubAssets<AudioClip>("Assets/AssetBundlesWanted/gustavomine.mp3");
			harmony.PatchAll(typeof(LandminePatch));
			mls.LogInfo((object)"LandMineGustavo is loaded.");
		}
	}
}
namespace Gustavo_Mine.Patches
{
	[HarmonyPatch(typeof(Landmine))]
	internal class LandminePatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void GustavoMineAudioPatch(ref AudioClip ___mineDetonate, ref AudioClip ___mineDetonateFar)
		{
			AudioClip val = GustavoMineBase.newMineDetonate[0];
			___mineDetonate = val;
			AudioClip val2 = GustavoMineBase.newMineDetonateFar[0];
			___mineDetonateFar = val2;
		}
	}
}