using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5C4ED515-88E6-4D6D-9C16-5AB3E4D2266C")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("TurretSound")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TurretSound")]
[assembly: AssemblyTitle("TurretSound")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace TurretSound
{
[HarmonyPatch(typeof(Turret))]
public class PatchClass
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void turretSoundPatch(ref AudioClip ___turretActivate, ref AudioClip ___turretDeactivate, ref AudioClip ___detectPlayerSFX, ref AudioClip ___firingSFX, ref AudioClip ___bulletsHitWallSFX, ref AudioClip ___firingFarSFX)
{
AudioClip activateSound = Plugin.activateSound;
AudioClip deactivateSound = Plugin.deactivateSound;
AudioClip detectPlayerSound = Plugin.detectPlayerSound;
AudioClip firingSound = Plugin.firingSound;
AudioClip bulletHitWallSound = Plugin.bulletHitWallSound;
AudioClip firingFarSound = Plugin.firingFarSound;
___turretActivate = activateSound;
___turretDeactivate = deactivateSound;
___detectPlayerSFX = detectPlayerSound;
___firingSFX = firingSound;
___bulletsHitWallSFX = bulletHitWallSound;
___firingFarSFX = firingFarSound;
}
}
[BepInPlugin("com.sau6son.UwUTurretSound", "UwUTurret", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private Harmony _harmony;
private static Plugin Instance;
internal static AudioClip activateSound;
internal static AudioClip deactivateSound;
internal static AudioClip detectPlayerSound;
internal static AudioClip firingSound;
internal static AudioClip bulletHitWallSound;
internal static AudioClip firingFarSound;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
if ((Object)Instance == (Object)null)
{
Instance = this;
}
_harmony = new Harmony("com.sau6son.UwUTurretSound");
_harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"sau6son.UwUTurretSound is loading.");
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "TurretSound.dll";
string text2 = location.TrimEnd(text.ToCharArray());
string text3 = text2 + "turretSound-bundle";
AssetBundle val = AssetBundle.LoadFromFile(text3);
if ((Object)val == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load asset bundle!");
return;
}
activateSound = val.LoadAsset<AudioClip>("assets/activate.mp3");
deactivateSound = val.LoadAsset<AudioClip>("assets/deactivate.mp3");
detectPlayerSound = val.LoadAsset<AudioClip>("assets/detectPlayer.mp3");
firingSound = val.LoadAsset<AudioClip>("assets/firing.mp3");
bulletHitWallSound = val.LoadAsset<AudioClip>("assets/bulletsHitWall.mp3");
firingFarSound = val.LoadAsset<AudioClip>("assets/firingFar.mp3");
if ((Object)(object)activateSound == (Object)null || (Object)(object)deactivateSound == (Object)null || (Object)(object)detectPlayerSound == (Object)null || (Object)(object)firingSound == (Object)null || (Object)(object)bulletHitWallSound == (Object)null || (Object)(object)firingFarSound == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load one of the audio assets!");
return;
}
_harmony.PatchAll(typeof(PatchClass));
((BaseUnityPlugin)this).Logger.LogInfo((object)"UwUTurretSound plugin loaded !");
}
}
}