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 REPOCustomsSounds v0.0.1
plugins/REPOCustomSounds/REPOCustomSounds.dll
Decompiled 7 months agousing System; using System.Collections; using 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 HarmonyLib; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPOCustomSounds")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("REPOCustomSounds")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("193e1d4f-70ae-43c8-8fc6-61d2075973f3")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.REPOCustomSounds", "REPOCustomSounds", "1.0.0")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <LoadAllSound>d__4 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private string <duckPath>5__1; private string <hunterPath1>5__2; private string <hunterPath2>5__3; private UnityWebRequest <www>5__4; private UnityWebRequest <www>5__5; private UnityWebRequest <www>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadAllSound>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: try { } finally { <>m__Finally2(); } break; case -5: case 3: try { } finally { <>m__Finally3(); } break; } <duckPath>5__1 = null; <hunterPath1>5__2 = null; <hunterPath2>5__3 = null; <www>5__4 = null; <www>5__5 = null; <www>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Invalid comparison between Unknown and I4 //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Invalid comparison between Unknown and I4 //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <duckPath>5__1 = Path.Combine(Paths.PluginPath, "REPOCustomSounds", "HeyNa.wav"); <hunterPath1>5__2 = Path.Combine(Paths.PluginPath, "REPOCustomSounds", "WoSeidIhr.wav"); <hunterPath2>5__3 = Path.Combine(Paths.PluginPath, "REPOCustomSounds", "Riechen.wav"); <www>5__4 = UnityWebRequestMultimedia.GetAudioClip("file://" + <duckPath>5__1, (AudioType)20); <>1__state = -3; <>2__current = <www>5__4.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)<www>5__4.result == 1) { meinDuckSound = DownloadHandlerAudioClip.GetContent(<www>5__4); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Duck Sound erfolgreich geladen!"); } else { ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Fehler Ente: " + <www>5__4.error)); } <>m__Finally1(); <www>5__4 = null; <www>5__5 = UnityWebRequestMultimedia.GetAudioClip("file://" + <hunterPath1>5__2, (AudioType)20); <>1__state = -4; <>2__current = <www>5__5.SendWebRequest(); <>1__state = 2; return true; case 2: <>1__state = -4; if ((int)<www>5__5.result == 1) { hunterSound1 = DownloadHandlerAudioClip.GetContent(<www>5__5); ((Object)hunterSound1).name = "WoSeidIhr"; ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Hunter Sound 1 erfolgreich geladen!"); } else { ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Fehler Hunter 1: " + <www>5__5.error)); } <>m__Finally2(); <www>5__5 = null; <www>5__6 = UnityWebRequestMultimedia.GetAudioClip("file://" + <hunterPath2>5__3, (AudioType)20); <>1__state = -5; <>2__current = <www>5__6.SendWebRequest(); <>1__state = 3; return true; case 3: <>1__state = -5; if ((int)<www>5__6.result == 1) { hunterSound2 = DownloadHandlerAudioClip.GetContent(<www>5__6); ((Object)hunterSound2).name = "Riechen"; ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Hunter Sound 2 erfolgreich geladen!"); } else { ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)("Fehler Hunter 2: " + <www>5__6.error)); } <>m__Finally3(); <www>5__6 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<www>5__4 != null) { ((IDisposable)<www>5__4).Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (<www>5__5 != null) { ((IDisposable)<www>5__5).Dispose(); } } private void <>m__Finally3() { <>1__state = -1; if (<www>5__6 != null) { ((IDisposable)<www>5__6).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static AudioClip meinDuckSound; public static AudioClip hunterSound1; public static AudioClip hunterSound2; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.REPOCustomSounds"); val.PatchAll(); ((MonoBehaviour)this).StartCoroutine(LoadAllSound()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPOCustomSounds wurde geladen!"); } [IteratorStateMachine(typeof(<LoadAllSound>d__4))] private IEnumerator LoadAllSound() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadAllSound>d__4(0) { <>4__this = this }; } } [HarmonyPatch(typeof(EnemyDuckAnim), "Quack")] public class DuckPatch { [HarmonyPatch(typeof(EnemyHunterAnim), "Awake")] public class HunterPatch { [HarmonyPostfix] private static void Postfix(EnemyHunterAnim __instance) { if (__instance.soundHumming != null) { List<AudioClip> list = new List<AudioClip>(); if (__instance.soundHumming.Sounds != null && __instance.soundHumming.Sounds.Length != 0) { list.Add(__instance.soundHumming.Sounds[0]); } if ((Object)(object)Plugin.hunterSound1 != (Object)null) { list.Add(Plugin.hunterSound1); } if ((Object)(object)Plugin.hunterSound2 != (Object)null) { list.Add(Plugin.hunterSound2); } if (list.Count > 0) { int index = Random.Range(0, list.Count); AudioClip val = list[index]; __instance.soundHumming.Sounds = (AudioClip[])(object)new AudioClip[1] { val }; Debug.Log((object)$"Hunter-Pool: Ausgewählt wurde '{((Object)val).name}' aus {list.Count} Optionen."); } } } } [HarmonyPrefix] private static bool Prefix(EnemyDuckAnim __instance) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, 101); if (num < 20 && (Object)(object)Plugin.meinDuckSound != (Object)null) { AudioSource component = ((Component)__instance).GetComponent<AudioSource>(); if ((Object)(object)component != (Object)null) { component.PlayOneShot(Plugin.meinDuckSound); Debug.Log((object)"Sound über Enten-AudioSource abgespielt!"); } else { AudioSource.PlayClipAtPoint(Plugin.meinDuckSound, ((Component)__instance).transform.position); } return false; } return true; } }