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 OofCrab.Patches;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OofCrab")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OofCrab")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5cb28395-b6bb-4443-a3dd-d663bf3b5513")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OofCrab
{
[BepInPlugin("mattplays-oofcrab", "OofCrab", "1.0.0")]
public class OofCrab : BaseUnityPlugin
{
private const string modGUID = "mattplays-oofcrab";
private const string modName = "OofCrab";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("mattplays-oofcrab");
private static string audioFile = "oof.mp3";
private static string uPath = Path.Combine(Paths.PluginPath + "\\mattplays-oofcrab\\");
private static OofCrab instance;
internal ManualLogSource mls;
internal static AudioClip newSFX;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("mattplays-oofcrab");
mls.LogInfo((object)"OofCrab Loading...");
newSFX = LoadAudioClip(uPath + audioFile);
if ((Object)(object)newSFX == (Object)null)
{
mls.LogError((object)"Failed to load audio clip");
}
harmony.PatchAll(typeof(OofCrabPatch));
mls.LogInfo((object)"OofCrab 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-oofcrab");
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 OofCrab.Patches
{
[HarmonyPatch(typeof(CentipedeAI))]
internal class OofCrabPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OofCrabAudioPatch(ref AudioClip ___hitCentipede)
{
AudioClip newSFX = OofCrab.newSFX;
___hitCentipede = newSFX;
}
}
}