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 NeebsSFX.Patches;
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("SpaceMammoth")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SpaceMammoth")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7fea79ae-b486-4c83-b815-89b73bdc862b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NeebsSFX
{
[BepInPlugin("Ex.NeebsSFXMod", "Ex Neebs Gaming SFX Mod", "1.0.0")]
public class NeebsSFXBase : BaseUnityPlugin
{
private const string modGUID = "Ex.NeebsSFXMod";
private const string modName = "Ex Neebs Gaming SFX Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Ex.NeebsSFXMod");
private static NeebsSFXBase Instance;
internal ManualLogSource mls;
internal static AudioClip newAlarmSFX;
internal static AudioClip newKillSFX;
internal static AudioClip[] newHawkLaughSFX;
internal static AudioClip[] newHawkScreamSFX;
internal static AudioClip newAngerVoiceSFX;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Ex.NeebsSFXMod");
mls.LogInfo((object)"Neebs Gaming SFX mod has initiated");
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "SpaceMammoth.dll";
string text2 = location.TrimEnd(text.ToCharArray());
string text3 = text2 + "NeebsSFX";
AssetBundle val = AssetBundle.LoadFromFile(text3);
if ((Object)(object)val == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
newAlarmSFX = val.LoadAsset<AudioClip>("Assets/Mammoth.mp3");
newKillSFX = val.LoadAsset<AudioClip>("Assets/Appsro.mp3");
newHawkLaughSFX = val.LoadAssetWithSubAssets<AudioClip>("Assets/Promoted2.mp3");
newHawkScreamSFX = val.LoadAssetWithSubAssets<AudioClip>("Assets/Promoted.mp3");
newAngerVoiceSFX = val.LoadAsset<AudioClip>("Assets/AreMan.mp3");
harmony.PatchAll(typeof(NeebsSFXBase));
harmony.PatchAll(typeof(MammothPatch));
harmony.PatchAll(typeof(AppsroPatch));
harmony.PatchAll(typeof(SimonPatch));
harmony.PatchAll(typeof(NeebsHawkPatch));
mls.LogInfo((object)"Neebs Gaming SFX mod has loaded.");
}
}
}
namespace NeebsSFX.Patches
{
[HarmonyPatch(typeof(MaskedPlayerEnemy))]
internal class AppsroPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void AppsroSFXPatch(MaskedPlayerEnemy __instance, MaskedPlayerEnemy inKillAnimation)
{
if (Object.op_Implicit((Object)(object)inKillAnimation))
{
((EnemyAI)__instance).creatureSFX.Stop();
((EnemyAI)__instance).creatureSFX.PlayOneShot(NeebsSFXBase.newKillSFX);
}
}
}
[HarmonyPatch(typeof(BaboonBirdAI))]
internal class NeebsHawkPatch
{
[HarmonyPatch("DoAIInterval")]
[HarmonyPrefix]
public static void NeebsHawkLaughSFXPatch(ref AudioClip[] ___cawLaughSFX)
{
___cawLaughSFX = NeebsSFXBase.newHawkLaughSFX;
}
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static void HawkScreamSFXPatch(ref AudioClip[] ___cawScreamSFX)
{
___cawScreamSFX = NeebsSFXBase.newHawkScreamSFX;
}
}
[HarmonyPatch(typeof(FlowermanAI))]
internal class SimonPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void AreYouAManSFXPatch(FlowermanAI __instance)
{
__instance.creatureAngerVoice.PlayOneShot(NeebsSFXBase.newAngerVoiceSFX);
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class MammothPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void MammothSFXPatch(StartOfRound __instance, ref AudioClip ___alarmSFX)
{
___alarmSFX = NeebsSFXBase.newAlarmSFX;
__instance.shipDoorAudioSource.volume = 1f;
}
}
}