using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using HolyMolyPuffer.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("HolyMolyPuffer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HolyMolyPuffer")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ae765140-c9eb-4f3f-bc54-1291eaf60d62")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HolyMolyPuffer
{
[BepInPlugin("BeepBoop.HolyMolyPuffer", "HolyMolyPuffer", "1.0.0")]
public class HolyMolyModBase : BaseUnityPlugin
{
private const string modGUID = "BeepBoop.HolyMolyPuffer";
private const string modName = "HolyMolyPuffer";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("BeepBoop.HolyMolyPuffer");
private static HolyMolyModBase Instance;
internal ManualLogSource mls;
internal static List<AudioClip> SoundFX;
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("BeepBoop.HolyMolyPuffer");
mls.LogInfo((object)"HolyMolyPuffer has awaken");
harmony.PatchAll(typeof(PufferPatch));
SoundFX = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("HolyMolyPuffer.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "holymoly");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Sucessfully loaded asset bundle");
SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Failed to load asset bundle");
}
}
}
}
namespace HolyMolyPuffer.Patches
{
[HarmonyPatch(typeof(PufferAI))]
internal class PufferPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(PufferAI __instance)
{
__instance.frightenSFX[0] = HolyMolyModBase.SoundFX[0];
__instance.frightenSFX[1] = HolyMolyModBase.SoundFX[0];
}
}
}