Decompiled source of PapichTurret v1.0.2

PapichTurret.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 PapichTurret;
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("LTG_Jester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LTG_Jester")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d15d7c33-deab-4a5a-b26f-09ff638477d0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(Turret))]
internal class TurretPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void turretSoundPatch(Turret __instance)
	{
		AudioClip[] songReplace = PapichTurret_Base.SongReplace;
		__instance.detectPlayerSFX = songReplace[0];
		__instance.firingSFX = songReplace[2];
		__instance.firingFarSFX = songReplace[1];
	}
}
namespace PapichTurret;

[BepInPlugin("qenze.PapichTurret", "Papich Turret", "1.0.2")]
public class PapichTurret_Base : BaseUnityPlugin
{
	private const string modGUID = "qenze.PapichTurret";

	private const string modName = "Papich Turret";

	private const string modVersion = "1.0.2";

	private readonly Harmony harmony = new Harmony("qenze.PapichTurret");

	private static PapichTurret_Base Instance;

	internal ManualLogSource mls;

	internal static AudioClip[] SongReplace;

	internal static AssetBundle Bundle;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("qenze.PapichTurret");
		mls.LogInfo((object)"PapichTurret loading");
		harmony.PatchAll(typeof(PapichTurret_Base));
		harmony.PatchAll(typeof(TurretPatch));
		mls = ((BaseUnityPlugin)this).Logger;
		SongReplace = (AudioClip[])(object)new AudioClip[3];
		string location = ((BaseUnityPlugin)Instance).Info.Location;
		location = location.TrimEnd("PapichTurret.dll".ToCharArray());
		Bundle = AssetBundle.LoadFromFile(location + "papichturretaudio");
		if ((Object)(object)Bundle != (Object)null)
		{
			mls.LogInfo((object)"PapichTurret loaded");
			SongReplace = Bundle.LoadAllAssets<AudioClip>();
		}
		else
		{
			mls.LogInfo((object)"Failed to load PapichTurret");
		}
	}
}