Decompiled source of BadgerTurret v1.0.0

BadgerTurret.dll

Decompiled 7 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BadgerTurret.Patches;
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: AssemblyTitle("BadgerTurret")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BadgerTurret")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0743030e-6c33-4642-8c86-82a51eb4d8ad")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BadgerTurret
{
	[BepInPlugin("Ex.RussianBadgerTurretSFXMod", "Ex Russian Badger Turret SFX Mod", "1.0.0")]
	public class BadgerTurretBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.RussianBadgerTurretSFXMod";

		private const string modName = "Ex Russian Badger Turret SFX Mod";

		private const string modVersion = "1.0.0";

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

		private static BadgerTurretBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newTurretShootSFX;

		internal static AudioClip newTurretSeekSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.RussianBadgerTurretSFXMod");
			mls.LogInfo((object)"Russian Badger Turret SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "BadgerTurret.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "badger";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newTurretShootSFX = val.LoadAsset<AudioClip>("Assets/Audio/swaws.mp3");
			newTurretSeekSFX = val.LoadAsset<AudioClip>("Assets/Audio/Warning.mp3");
			harmony.PatchAll(typeof(BadgerTurretBase));
			harmony.PatchAll(typeof(BadgerPatch));
			mls.LogInfo((object)"Sir, this is an M32 grenade launcher.");
		}
	}
}
namespace BadgerTurret.Patches
{
	[HarmonyPatch(typeof(Turret))]
	internal class BadgerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void JojoTBCSFXPatch(ref AudioClip ___firingSFX, ref AudioClip ___detectPlayerSFX)
		{
			___firingSFX = BadgerTurretBase.newTurretShootSFX;
			___detectPlayerSFX = BadgerTurretBase.newTurretSeekSFX;
		}
	}
}