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;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Bljakov")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Bljakov")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef2f0dd0-8da6-4a7e-9932-e5251c0206eb")]
[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 BljakovMod;
[BepInPlugin("bljakov.mod", "Bljakov Mod", "1.0.0")]
public class BljakovModBase : BaseUnityPlugin
{
private const string ModGUID = "bljakov.mod";
private const string ModName = "Bljakov Mod";
private const string ModVersion = "1.0.0";
internal static ManualLogSource Log;
internal static AudioClip[] NewChitterSFX;
private Harmony _harmony;
private void Awake()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Bljakov Mod is loading...");
_harmony = new Harmony("bljakov.mod");
_harmony.PatchAll();
string location = ((BaseUnityPlugin)this).Info.Location;
string text = Path.Combine(Path.GetDirectoryName(location), "bljakovsound");
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val == (Object)null)
{
Log.LogError((object)("Failed to load asset bundle from: " + text));
return;
}
NewChitterSFX = val.LoadAllAssets<AudioClip>();
if (NewChitterSFX == null || NewChitterSFX.Length == 0)
{
Log.LogError((object)"Failed to load any AudioClips from the bundle.");
}
else
{
Log.LogInfo((object)$"Successfully loaded {NewChitterSFX.Length} audio clips.");
}
Log.LogInfo((object)"Bljakov Mod loaded successfully!");
}
}
[HarmonyPatch(typeof(HoarderBugAI), "Start")]
internal static class HoarderBugAIPatch
{
[HarmonyPostfix]
private static void ReplaceChitterSFX(ref AudioClip[] ___chitterSFX)
{
if (BljakovModBase.NewChitterSFX != null && BljakovModBase.NewChitterSFX.Length != 0)
{
___chitterSFX = BljakovModBase.NewChitterSFX;
BljakovModBase.Log.LogInfo((object)"Replaced HoarderBug chitter SFX with Bljakov sounds.");
}
else
{
BljakovModBase.Log.LogWarning((object)"Chitter SFX was not replaced due to missing audio clips.");
}
}
}