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 MrMod.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("MrMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("MrMod")]
[assembly: AssemblyCopyright("Copyright © HP 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("31a6f87b-a186-48fa-820a-7762f8eb2d67")]
[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 MrMod
{
[BepInPlugin("Mr.MrMod", "Mr Mod", "1.0.0.0")]
public class MrModBase : BaseUnityPlugin
{
private const string modGUID = "Mr.MrMod";
private const string modBase = "Mr Mod";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Mr.MrMod");
private static MrModBase Instance;
internal ManualLogSource mls;
internal static List<AudioClip> SoundFX;
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Mr.MrMod");
mls.LogInfo((object)"Mr has awoken.");
harmony.PatchAll(typeof(FlowermanAIPatch));
harmony.PatchAll(typeof(LandminePatch));
harmony.PatchAll(typeof(NutCrackerEnemyAIPatch));
harmony.PatchAll(typeof(MouthDogAIPatch));
harmony.PatchAll(typeof(ShotgunItemPatch));
harmony.PatchAll(typeof(SpringManAIPatch));
SoundFX = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("MrMod.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "mrassetbundle1.0.1");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Succesfully loaded asset bundle");
SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Failed to load asset bundle");
}
}
}
}
namespace MrMod.Patches
{
[HarmonyPatch(typeof(FlowermanAI))]
internal class FlowermanAIPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(FlowermanAI __instance)
{
__instance.crackNeckSFX = MrModBase.SoundFX[0];
}
}
[HarmonyPatch(typeof(Landmine))]
internal class LandminePatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(Landmine __instance)
{
__instance.mineDetonate = MrModBase.SoundFX[1];
}
}
[HarmonyPatch(typeof(MouthDogAI))]
internal class MouthDogAIPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(MouthDogAI __instance)
{
__instance.killPlayerSFX = MrModBase.SoundFX[2];
}
}
[HarmonyPatch(typeof(NutcrackerEnemyAI))]
internal class NutCrackerEnemyAIPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(NutcrackerEnemyAI __instance)
{
__instance.aimSFX = MrModBase.SoundFX[3];
}
}
[HarmonyPatch(typeof(ShotgunItem))]
internal class ShotgunItemPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(ShotgunItem __instance)
{
__instance.gunShootSFX[1] = MrModBase.SoundFX[4];
}
}
[HarmonyPatch(typeof(SpringManAI))]
internal class SpringManAIPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(SpringManAI __instance)
{
__instance.springNoises[1] = MrModBase.SoundFX[5];
}
}
}