Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Hoardernaro v1.0.0
Hoardernaro.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using HarmonyLib; using Hoardernaro.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("Hoardernaro")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Hoardernaro")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4f245e23-aea5-4054-b401-56047b077a21")] [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 Hoardernaro { [BepInPlugin("arziofox.Hoardernaro", "Hoardernaro", "1.0.0")] public class HoardernaroPlugin : BaseUnityPlugin { private const string modGUID = "arziofox.Hoardernaro"; private const string modName = "Hoardernaro"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("arziofox.Hoardernaro"); private static readonly string[] compatibleChitterMods = new string[1] { "sunnobunno.YippeeMod" }; public static AudioClip[] sfx = null; private void Awake() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "hoardernaro"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Hoardernaro failed to load its bundle :("); return; } sfx = (AudioClip[])(object)new AudioClip[3] { val.LoadAsset<AudioClip>("Assets/crack-1.wav"), val.LoadAsset<AudioClip>("Assets/crack-2.wav"), val.LoadAsset<AudioClip>("Assets/crack-3.wav") }; harmony.PatchAll(typeof(HoarderBugAIPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"All the paralelepidos were loaded!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Meu Twitter/X: @arziofox"); } public static bool HasCompatibleChitterMods() { return Chainloader.PluginInfos.Values.Any((PluginInfo plugin) => compatibleChitterMods.Any((string modGUID) => plugin.Metadata.GUID.Equals(modGUID))); } } } namespace Hoardernaro.Patches { [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugAIPatch { private static readonly Dictionary<int, AudioClip[]> cachedAudios = new Dictionary<int, AudioClip[]>(); private static readonly float bolsonaroChanceWhenUsingOtherMods = 0.65f; [HarmonyPatch("Start")] [HarmonyPostfix] [HarmonyPriority(0)] public static void PatchChitterAudio(ref AudioClip[] ___chitterSFX, HoarderBugAI __instance) { if (HoardernaroPlugin.sfx != null) { int num = (int)(((EnemyAI)__instance).thisNetworkObject.NetworkObjectId % int.MaxValue); Random random = new Random(StartOfRound.Instance.randomMapSeed + num); float num2 = (HoardernaroPlugin.HasCompatibleChitterMods() ? bolsonaroChanceWhenUsingOtherMods : 1f); if (random.NextDouble() < (double)num2) { ___chitterSFX = HoardernaroPlugin.sfx; } } } } }