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 MemeEnemySoundsMod v1.0.0
MemeEnemySoundsMod.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LCSoundTool; 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("MemeEnemySoundsMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MemeEnemySoundsMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("688f1790-107b-4707-9b3a-b49ab4adcd26")] [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 MemeEnemySoundsMod; [BepInPlugin("RCOM.MemeEnemySoundsMod", "Meme Enemy Sounds Mod", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string pluginGUID = "RCOM.MemeEnemySoundsMod"; private const string pluginName = "Meme Enemy Sounds Mod"; private const string pluginVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("RCOM.MemeEnemySoundsMod"); private static Plugin Instance; internal ManualLogSource logger; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("RCOM.MemeEnemySoundsMod"); logger.LogInfo((object)"Plugin RCOM.MemeEnemySoundsMod started loading!"); harmony.PatchAll(typeof(Plugin)); } private async void Start() { string newAngeredSoundPath = Path.Combine(Paths.PluginPath, "Fileek-MemeEnemySoundsMod", "CustomSound", "the_fuq_r_u_lookin_at.wav"); string newSpringSoundPath = Path.Combine(Paths.PluginPath, "Fileek-MemeEnemySoundsMod", "CustomSound", "fart.wav"); AudioClip newAngeredSound = await LoadClip(newAngeredSoundPath); AudioClip newSpringSound = await LoadClip(newSpringSoundPath); SoundTool.ReplaceAudioClip("Angered", newAngeredSound); if ((Object)(object)newAngeredSound != (Object)null) { logger.LogInfo((object)"Plugin RCOM.MemeEnemySoundsMod replaced sound for Bracken!"); } SoundTool.ReplaceAudioClip("Spring1", newSpringSound); SoundTool.ReplaceAudioClip("Spring2", newSpringSound); SoundTool.ReplaceAudioClip("Spring3", newSpringSound); if ((Object)(object)newSpringSound != (Object)null) { logger.LogInfo((object)"Plugin RCOM.MemeEnemySoundsMod replaced sound for Coil-head!"); } } private async Task<AudioClip> LoadClip(string path) { AudioClip clip = null; UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(path, (AudioType)20); try { uwr.SendWebRequest(); try { while (!uwr.isDone) { await Task.Delay(5); } if ((int)uwr.result == 2 || (int)uwr.result == 3 || (int)uwr.result == 4) { logger.LogError((object)("Plugin RCOM.MemeEnemySoundsMod got an error: " + uwr.error)); } else { clip = DownloadHandlerAudioClip.GetContent(uwr); } } catch (Exception ex) { Exception err = ex; logger.LogError((object)("Plugin RCOM.MemeEnemySoundsMod got an error: " + err.Message + ", " + err.StackTrace)); } } finally { ((IDisposable)uwr)?.Dispose(); } return clip; } }