Decompiled source of ZentreyaBulletsSFX v1.0.0

ZentreyaBullets.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 HarmonyLib;
using UnityEngine;
using ZentreyaBullets.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZentreyaBullets")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZentreyaBullets")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4fa8b8c2-8574-4ed6-ab73-efb4075081df")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ZentreyaBullets
{
	[BepInPlugin("Ex.ZentreyaBullets", "Ex Zentreya Turret SFX Replacer Mod", "1.0.0")]
	public class ZentreyaBulletsBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.ZentreyaBullets";

		private const string modName = "Ex Zentreya Turret SFX Replacer Mod";

		private const string modVersion = "1.0.0";

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

		private static ZentreyaBulletsBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newTurretSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.ZentreyaBullets");
			mls.LogInfo((object)"Zentreya Bullets SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "ZentreyaBullets.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "zenassets";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newTurretSFX = val.LoadAsset<AudioClip>("Assets/ZenBullets.mp3");
			harmony.PatchAll(typeof(ZentreyaBulletsBase));
			harmony.PatchAll(typeof(ZenPatch));
			mls.LogInfo((object)"Zentreya Bullets mod has loaded.");
		}
	}
}
namespace ZentreyaBullets.Patches
{
	[HarmonyPatch(typeof(Turret))]
	internal class ZenPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TurretSFXPatch(ref AudioClip ___chargingSFX)
		{
			___chargingSFX = ZentreyaBulletsBase.newTurretSFX;
		}
	}
}