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 YippeeBug v1.0.0
YippeeBug.dll
Decompiled 4 hours agousing System.Collections.Generic; 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("Plugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Plugin")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8b70c69a-b812-4f2e-88bd-d17080b65771")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace YippeeBug; internal static class MyPluginInfo { public const string PLUGIN_GUID = "com.tuNombre.yippeebug"; public const string PLUGIN_NAME = "YippeeBug"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("com.tuNombre.yippeebug", "YippeeBug", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ManualLogSource Log; public static AudioClip ClipYippee; public static AudioClip ClipAngry; private void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"YippeeBug cargando..."); ClipYippee = LoadWav("YippeeBug.Resources.yippee.wav", "yippee"); ClipAngry = LoadWav("YippeeBug.Resources.angry.wav", "angry"); new Harmony("com.tuNombre.yippeebug").PatchAll(); Log.LogInfo((object)"YippeeBug listo!"); } private static AudioClip LoadWav(string resource, string clipName) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resource); if (stream == null) { Log.LogError((object)("Recurso no encontrado: " + resource)); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); AudioClip val = WavToAudioClip(array, clipName); if ((Object)(object)val != (Object)null) { Log.LogInfo((object)("Audio OK: " + clipName)); } else { Log.LogError((object)("Error convirtiendo: " + clipName)); } return val; } private static AudioClip WavToAudioClip(byte[] wav, string name) { int num = wav[22]; int num2 = wav[24] | (wav[25] << 8) | (wav[26] << 16) | (wav[27] << 24); int num3 = wav[34] | (wav[35] << 8); int num4 = 44; int num5 = (wav.Length - num4) / (num3 / 8); float[] array = new float[num5]; switch (num3) { case 16: { for (int j = 0; j < num5; j++) { short num6 = (short)(wav[num4 + j * 2] | (wav[num4 + j * 2 + 1] << 8)); array[j] = (float)num6 / 32768f; } break; } case 8: { for (int i = 0; i < num5; i++) { array[i] = (float)(wav[num4 + i] - 128) / 128f; } break; } default: Log.LogError((object)("Bit depth no soportado: " + num3)); return null; } AudioClip val = AudioClip.Create(name, num5 / num, num, num2, false); val.SetData(array, 0); return val; } } [HarmonyPatch(typeof(HoarderBugAI), "Update")] public class PatchChitter { private static Dictionary<int, float> _timers = new Dictionary<int, float>(); [HarmonyPostfix] private static void Postfix(HoarderBugAI __instance) { if ((Object)(object)Plugin.ClipYippee == (Object)null || ((EnemyAI)__instance).currentBehaviourStateIndex == 2) { return; } int instanceID = ((Object)__instance).GetInstanceID(); if (!_timers.ContainsKey(instanceID)) { _timers[instanceID] = 0f; } _timers[instanceID] -= Time.deltaTime; if (!(_timers[instanceID] > 0f)) { _timers[instanceID] = Random.Range(4f, 8f); AudioSource creatureVoice = ((EnemyAI)__instance).creatureVoice; if (!((Object)(object)creatureVoice == (Object)null)) { Plugin.Log.LogInfo((object)("Reproduciendo yippee en bug " + instanceID)); creatureVoice.PlayOneShot(Plugin.ClipYippee); } } } } [HarmonyPatch(typeof(HoarderBugAI), "Update")] public class PatchAngry { private static Dictionary<int, int> _lastStates = new Dictionary<int, int>(); [HarmonyPostfix] private static void Postfix(HoarderBugAI __instance) { if ((Object)(object)Plugin.ClipAngry == (Object)null) { return; } int instanceID = ((Object)__instance).GetInstanceID(); int currentBehaviourStateIndex = ((EnemyAI)__instance).currentBehaviourStateIndex; if (!_lastStates.ContainsKey(instanceID)) { _lastStates[instanceID] = -1; } if (currentBehaviourStateIndex == 2 && _lastStates[instanceID] != 2) { AudioSource creatureVoice = ((EnemyAI)__instance).creatureVoice; if ((Object)(object)creatureVoice != (Object)null) { creatureVoice.Stop(); creatureVoice.PlayOneShot(Plugin.ClipAngry); Plugin.Log.LogInfo((object)("Reproduciendo angry en bug " + instanceID)); } } _lastStates[instanceID] = currentBehaviourStateIndex; } }