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 SilksongDeathSoundMod v1.0.1
SilksongDeathSoundMod.dll
Decompiled 8 months agousing System; 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("SilksongDeathSoundMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SilksongDeathSoundMod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4a104673-ebf0-482f-9b2d-c277c3c12b8d")] [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")] [BepInPlugin("com.chinccw.silksongdeathsound", "Silksong Death Sound Mod", "1.0.0")] public class SilksongDeathSoundMod : BaseUnityPlugin { internal static AudioClip deathClip; internal static AudioSource audioSource; private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"SilksongDeathSoundMod loaded!"); string path = Path.Combine(Paths.PluginPath, "death.mp3"); deathClip = AudioLoader.LoadMP3(path); GameObject val = new GameObject("DeathSoundPlayer"); Object.DontDestroyOnLoad((Object)(object)val); audioSource = val.AddComponent<AudioSource>(); Harmony val2 = new Harmony("com.chinccw.silksongdeathsound"); val2.PatchAll(); } public static void PlayDeathSound() { if ((Object)(object)deathClip != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(deathClip); Debug.Log((object)"\ud83d\udd0a Playing death.mp3!"); } else { Debug.Log((object)"⚠\ufe0f Death sound not loaded."); } } } [HarmonyPatch(typeof(HeroVibrationController), "PlayHeroDeath")] internal class HeroDeathPatch { private static void Postfix() { Debug.Log((object)"✅ Postfix triggered, hero died!"); SilksongDeathSoundMod.PlayDeathSound(); } } public static class AudioLoader { public static AudioClip LoadMP3(string path) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 if (!File.Exists(path)) { Debug.LogError((object)("❌ death.mp3 not found: " + path)); return null; } UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + path, (AudioType)13); try { UnityWebRequestAsyncOperation val = audioClip.SendWebRequest(); while (!((AsyncOperation)val).isDone) { } if ((int)audioClip.result != 1) { Debug.LogError((object)("❌ Failed to load audio: " + audioClip.error)); return null; } return DownloadHandlerAudioClip.GetContent(audioClip); } finally { ((IDisposable)audioClip)?.Dispose(); } } }