using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using ProiProiJester.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("ProiProiJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProiProiJester")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1a686615-667b-4c48-9c65-b045cbe2cb9c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ProiProiJester
{
[BepInPlugin("tunanan.ProiProiJester", "ProiProiJester", "1.0.0")]
public class JesterModBase : BaseUnityPlugin
{
private const string modGUID = "tunanan.ProiProiJester";
private const string modName = "ProiProiJester";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("tunanan.ProiProiJester");
internal static JesterModBase Instance;
internal ManualLogSource mls;
internal static Dictionary<string, AudioClip> SoundFXDict = new Dictionary<string, AudioClip>();
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("ProiProiJester");
mls.LogInfo((object)"ProiProiJester is awake!");
mls = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll(typeof(JesterModBase));
harmony.PatchAll(typeof(JesterAIPatch));
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.Substring(0, location.LastIndexOf(Path.DirectorySeparatorChar) + 1);
Bundle = AssetBundle.LoadFromFile(location + "proiproi");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Succesfully loaded asset bundle");
AudioClip[] array = Bundle.LoadAllAssets<AudioClip>();
foreach (AudioClip val in array)
{
SoundFXDict[((Object)val).name] = val;
mls.LogInfo((object)("Loaded " + ((Object)val).name));
}
}
else
{
mls.LogError((object)"Failed to load asset bundle");
}
}
}
}
namespace ProiProiJester.Patches
{
[HarmonyPatch(typeof(JesterAI))]
internal class JesterAIPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(JesterAI __instance)
{
if (JesterModBase.SoundFXDict.TryGetValue("weasel", out var value))
{
__instance.popGoesTheWeaselTheme = value;
}
if (JesterModBase.SoundFXDict.TryGetValue("popup", out var value2))
{
__instance.popUpSFX = value2;
}
if (JesterModBase.SoundFXDict.TryGetValue("scream", out var value3))
{
__instance.screamingSFX = value3;
}
}
}
}