using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CaptainLoot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CaptainLoot")]
[assembly: AssemblyTitle("CaptainLoot")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CaptainLoot;
[HarmonyPatch(typeof(BoomboxItem))]
internal class BoomboxPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void BoomboxAudioPatch(ref AudioClip[] ___musicAudios)
{
AudioClip[] newMusicAudios = CaptainLootMod.newMusicAudios;
___musicAudios = newMusicAudios;
}
}
[HarmonyPatch(typeof(SandWormAI))]
internal class SandwormPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void SandWormAudioPatch(ref AudioClip[] ___roarSFX)
{
AudioClip[] newRoarSFX = CaptainLootMod.newRoarSFX;
___roarSFX = newRoarSFX;
}
}
[HarmonyPatch(typeof(WhoopieCushionItem))]
internal class WhoopieItemPatch
{
[HarmonyPatch("Fart")]
[HarmonyPostfix]
public static void WhoopieAudioPatch(ref AudioClip[] ___fartAudios)
{
AudioClip[] newFartSFX = CaptainLootMod.newFartSFX;
___fartAudios = newFartSFX;
}
}
[BepInPlugin("CaptainLoot.WhoopieMod", "Whoopie Loot Mod", "1.0.0")]
public class CaptainLootMod : BaseUnityPlugin
{
private const string modGUID = "CaptainLoot.WhoopieMod";
private const string modName = "Whoopie Loot Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("CaptainLoot.WhoopieMod");
private static CaptainLootMod Instance;
internal ManualLogSource mls;
internal static AudioClip[] newFartSFX;
internal static AudioClip[] newRoarSFX;
internal static AudioClip[] newMusicAudios;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("CaptainLoot.WhoopieMod");
mls.LogInfo((object)"CaptainLoot.WhoopieMod is loading.");
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "CaptainLog.dll";
string text2 = location.TrimEnd(text.ToCharArray());
string text3 = text2 + "captainlootaudio";
string text4 = text2 + "captainlootworm";
string text5 = text2 + "captainlootmusic";
AssetBundle val = AssetBundle.LoadFromFile(text3);
if ((Object)(object)val == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
newFartSFX = val.LoadAllAssets<AudioClip>();
AssetBundle val2 = AssetBundle.LoadFromFile(text4);
if ((Object)(object)val2 == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
newRoarSFX = val2.LoadAssetWithSubAssets<AudioClip>("assets/imjerrod.wav");
harmony.PatchAll(typeof(WhoopieItemPatch));
harmony.PatchAll(typeof(SandwormPatch));
AssetBundle val3 = AssetBundle.LoadFromFile(text5);
if ((Object)(object)val3 == (Object)null)
{
mls.LogError((object)"Failed to load audio assets!");
return;
}
newMusicAudios = val3.LoadAssetWithSubAssets<AudioClip>("assets/jerrod.wav");
harmony.PatchAll(typeof(WhoopieItemPatch));
harmony.PatchAll(typeof(SandwormPatch));
harmony.PatchAll(typeof(BoomboxPatch));
mls.LogInfo((object)"CaptainLoot.WhoopieMod is loaded. Loot Away!!!");
}
}