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 UnityEngine;
using UnityEngine.Networking;
using WhenICatchYouRicky.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("WhenICatchYouRicky")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WhenICatchYouRicky")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("39e04e1d-2930-484f-91be-bc018a266e3d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WhenICatchYouRicky
{
[BepInPlugin("mattplays.WhenICatchYouRicky", "WhenICatchYouRicky", "1.0.0")]
public class WhenICatchYouRicky : BaseUnityPlugin
{
private const string modGUID = "mattplays.WhenICatchYouRicky";
private const string modName = "WhenICatchYouRicky";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("mattplays.WhenICatchYouRicky");
private static string audioFile = "ricky.mp3";
private static string uPath = Path.Combine(Paths.PluginPath + "\\mattplays-WhenICatchYouRicky\\");
private static WhenICatchYouRicky instance;
internal ManualLogSource mls;
internal static AudioClip newSFX;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("mattplays.WhenICatchYouRicky");
mls.LogInfo((object)"WhenICatchYouRicky Loading...");
newSFX = LoadAudioClip(uPath + audioFile);
if ((Object)(object)newSFX == (Object)null)
{
mls.LogError((object)"Failed to load audio clip");
}
harmony.PatchAll(typeof(HoardingBugAudioPatch));
mls.LogInfo((object)"WhenICatchYouRicky Loaded!");
}
private static AudioClip LoadAudioClip(string filepath)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Invalid comparison between Unknown and I4
ManualLogSource val = Logger.CreateLogSource("mattplays.WhenICatchYouRicky");
val.LogInfo((object)("Loading audio clip from " + filepath));
UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(filepath, (AudioType)13);
audioClip.SendWebRequest();
while (!audioClip.isDone)
{
}
if (audioClip.error != null)
{
val.LogError((object)"Failed to load audio clip");
}
AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
if (Object.op_Implicit((Object)(object)content) && (int)content.loadState == 2)
{
val.LogInfo((object)"Loaded audio clip successfully!");
return content;
}
return null;
}
}
}
namespace WhenICatchYouRicky.Patches
{
[HarmonyPatch(typeof(HoarderBugAI))]
internal class HoardingBugAudioPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void audioPatch(ref AudioClip ___bugFlySFX)
{
AudioClip newSFX = WhenICatchYouRicky.newSFX;
___bugFlySFX = newSFX;
}
}
}