using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BugMems.Patch;
using GameNetcodeStuff;
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("BugMems")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BugMems")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0d51e190-baa3-450b-b79b-54fb1f2f433a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BugMems
{
[BepInPlugin("IllegalArgumentException.BugMems", "BugMems", "1.0.0")]
public class BugMems : BaseUnityPlugin
{
private const string modGUID = "IllegalArgumentException.BugMems";
private const string modName = "BugMems";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("IllegalArgumentException.BugMems");
private static BugMems instance;
internal ManualLogSource mls;
internal static AudioClip[] newSFX;
internal static AudioClip[] newAngrySFX;
internal static AudioClip[] newDeadSFX;
internal static AudioClip newFlySFX;
internal static PlayerControllerB playerControllerB;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("IllegalArgumentException.BugMems");
mls.LogInfo((object)"IllegalArgumentException.BugMems is loading.");
string location = ((BaseUnityPlugin)instance).Info.Location;
string text = "BugMems.dll";
string text2 = location.TrimEnd(text.ToCharArray());
AssetBundle val = AssetBundle.LoadFromFile(text2 + "bugsound");
AssetBundle val2 = AssetBundle.LoadFromFile(text2 + "flysound");
AssetBundle val3 = AssetBundle.LoadFromFile(text2 + "bugangry");
AssetBundle val4 = AssetBundle.LoadFromFile(text2 + "deadsound");
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
newSFX = val.LoadAllAssets<AudioClip>();
newFlySFX = val2.LoadAsset<AudioClip>("Stalker_Clear_Sky_-_Bandit_Camp_Radio_Music_64889679");
newAngrySFX = val3.LoadAllAssets<AudioClip>();
newDeadSFX = val4.LoadAllAssets<AudioClip>();
harmony.PatchAll(typeof(HoarderBugPatch));
mls.LogInfo((object)"IllegalArgumentException.BugMems is loaded");
}
}
}
namespace BugMems.Patch
{
[HarmonyPatch(typeof(HoarderBugAI))]
internal class HoarderBugPatch
{
[HarmonyPatch("KillEnemy")]
[HarmonyPostfix]
public static void hoarderBugDeadAudioPatch(ref AudioSource ___creatureVoice)
{
AudioClip[] newDeadSFX = BugMems.newDeadSFX;
RoundManager.PlayRandomClip(___creatureVoice, newDeadSFX, true, 1f, 0, 1000);
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX, ref AudioClip ___bugFlySFX, ref AudioClip[] ___angryScreechSFX, ref PlayerControllerB ___watchingPlayer)
{
AudioClip[] newSFX = BugMems.newSFX;
AudioClip[] newAngrySFX = BugMems.newAngrySFX;
AudioClip newFlySFX = BugMems.newFlySFX;
___chitterSFX = newSFX;
___bugFlySFX = newFlySFX;
___angryScreechSFX = newAngrySFX;
}
[HarmonyPatch(typeof(RoundManager), "PlayRandomClip")]
[HarmonyPrefix]
public static void HoarderBugStopChitter(ref AudioSource audioSource)
{
audioSource.Stop();
}
}
}