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 UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("JesterWindUp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JesterWindUp")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("96128a46-bd69-45b0-b376-a9c9566448b0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace JesterWindUp
{
[BepInPlugin("oe.tweaks.sounds.jester", "Jester Wind Up Sound", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("oe.tweaks.sounds.jester");
private const string GUID = "oe.tweaks.sounds.jester";
private const string NAME = "Jester Wind Up Sound";
private const string VERSION = "1.0.0";
internal static Plugin instance;
internal static ManualLogSource log;
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
log.LogInfo((object)"'Jester Wind Up Sound' is loading...");
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
harmony.PatchAll();
log.LogInfo((object)"'Jester Wind Up Sound' loaded!");
}
}
}
namespace JesterWindUp.Patches
{
[HarmonyPatch(typeof(JesterAI))]
internal class JesterAIPatch
{
private static AudioClip jesterWindUp;
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void patchJesterWindUpSound(JesterAI __instance)
{
Plugin.log.LogInfo((object)"Patching JesterAI...");
if ((Object)(object)jesterWindUp == (Object)null)
{
AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames()[0]));
if ((Object)(object)val == (Object)null)
{
Plugin.log.LogError((object)"Failed to load jestersounds asset bundle");
return;
}
jesterWindUp = val.LoadAsset<AudioClip>("jester_wind_up.mp3");
}
__instance.popGoesTheWeaselTheme = jesterWindUp;
}
}
}