using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using ShovelPanMod.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("ShovelPanMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShovelPanMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e0ef071f-1981-42df-8725-1809b0183fa8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShovelPanMod
{
[BepInPlugin("pudack.ShovelPan", "ShovelPan", "1.0.0")]
public class ShovelPanBase : BaseUnityPlugin
{
private const string modGUID = "pudack.ShovelPan";
private const string modName = "ShovelPan";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("pudack.ShovelPan");
private static ShovelPanBase Instance;
internal ManualLogSource mls;
internal static AudioClip[] newHitSFX;
internal static List<AudioClip> SoundFX;
internal static AssetBundle Bundle;
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
mls = Logger.CreateLogSource("pudack.ShovelPan");
mls.LogInfo((object)"ShovelPan Loading");
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "ShovelPanMod.dll";
string text2 = location.TrimEnd(text.ToCharArray());
string text3 = text2 + "pansfx";
AssetBundle val = AssetBundle.LoadFromFile(text3);
if (val == null)
{
mls.LogError((object)"Failed to load audio asset!");
return;
}
newHitSFX = val.LoadAssetWithSubAssets<AudioClip>("Assets/pansfx.wav");
harmony.PatchAll(typeof(ShovelPanPatch));
mls.LogInfo((object)"pudack.shovelpan is loaded.");
SoundFX = new List<AudioClip>();
string location2 = ((BaseUnityPlugin)Instance).Info.Location;
location2 = location2.TrimEnd("ShovelPanMod.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location2 + "_shovelpan");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Rick was successfully loaded");
SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Rick was unsuccessful");
}
harmony.PatchAll(typeof(StartOfRoundPatch));
}
}
}
namespace ShovelPanMod.Patches
{
[HarmonyPatch(typeof(Shovel))]
internal class ShovelPanPatch
{
[HarmonyPatch("HitShovelClientRpc")]
[HarmonyPatch("HitShovel")]
[HarmonyPrefix]
public static void shovelPanPatch(ref AudioClip[] ___hitSFX)
{
AudioClip[] newHitSFX = ShovelPanBase.newHitSFX;
___hitSFX = newHitSFX;
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void OverrdieAudiio(StartOfRound __instance)
{
__instance.shipIntroSpeechSFX = ShovelPanBase.SoundFX[0];
}
}
}