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 Boltzap augh meme v1.0.1
BepInEx\plugins\BoltzapAughMod\BoltzapAughMod.dll
Decompiled 3 hours agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("BoltzapAughMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BoltzapAughMod")] [assembly: AssemblyTitle("BoltzapAughMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BoltzapAughMod { [BepInPlugin("alibium.repo.boltzapaugh", "Boltzap augh", "2.0.1")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "alibium.repo.boltzapaugh"; public const string PluginName = "Boltzap augh"; public const string PluginVersion = "2.0.1"; private const string TargetClipNameFragment = "item stun gun shoot"; private ConfigEntry<float> volumeConfig; private AudioClip sourceClip; internal static AudioClip ReplacementClip { get; private set; } internal static ManualLogSource Log { get; private set; } internal static bool LogClipNames { get; private set; } private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; volumeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 0.3f, new ConfigDescription("Volume of the AUUGHHH replacement. 0.00 is silent and 1.00 is full volume.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); LogClipNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogAllClipNames", false, "Logs every AudioClip name seen by AudioSource.").Value; volumeConfig.SettingChanged += delegate { if ((Object)(object)sourceClip != (Object)null) { RebuildReplacementClip(); Log.LogInfo((object)$"Boltzap augh volume changed to {volumeConfig.Value:0.00}."); } }; new Harmony("alibium.repo.boltzapaugh").PatchAll(Assembly.GetExecutingAssembly()); ((MonoBehaviour)this).StartCoroutine(LoadReplacementClip()); Log.LogInfo((object)"Boltzap augh v2.0.1 loaded."); } private IEnumerator LoadReplacementClip() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "AUUGHHH.wav"); if (!File.Exists(text)) { Log.LogError((object)("Replacement sound not found at '" + text + "'.")); yield break; } string text2 = "file://" + text.Replace("\\", "/"); UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)20); try { yield return req.SendWebRequest(); if (req.isNetworkError || req.isHttpError) { Log.LogError((object)("Failed to decode AUUGHHH.wav: " + req.error)); yield break; } sourceClip = DownloadHandlerAudioClip.GetContent(req); ((Object)sourceClip).name = "AUUGHHH_source"; RebuildReplacementClip(); Log.LogInfo((object)($"Replacement clip ready ({ReplacementClip.length:0.00}s), " + $"volume {volumeConfig.Value:0.00}.")); } finally { ((IDisposable)req)?.Dispose(); } } private void RebuildReplacementClip() { if ((Object)(object)sourceClip == (Object)null) { return; } float num = Mathf.Clamp01(volumeConfig.Value); float[] array = new float[sourceClip.samples * sourceClip.channels]; if (!sourceClip.GetData(array, 0)) { Log.LogError((object)"Could not read AUUGHHH.wav sample data."); return; } for (int i = 0; i < array.Length; i++) { array[i] *= num; } AudioClip val = AudioClip.Create("AUUGHHH_replacement", sourceClip.samples, sourceClip.channels, sourceClip.frequency, false); if (!val.SetData(array, 0)) { Log.LogError((object)"Could not write volume-adjusted audio data."); Object.Destroy((Object)(object)val); return; } AudioClip replacementClip = ReplacementClip; ReplacementClip = val; if ((Object)(object)replacementClip != (Object)null) { Object.Destroy((Object)(object)replacementClip); } } internal static bool ShouldReplace(AudioClip clip) { if ((Object)(object)clip == (Object)null) { return false; } if (LogClipNames) { Log.LogInfo((object)("[BoltzapAugh] AudioClip seen: \"" + ((Object)clip).name + "\"")); } if ((Object)(object)ReplacementClip != (Object)null) { return ((Object)clip).name.IndexOf("item stun gun shoot", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } } [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip) })] internal static class PlayOneShotPatch { private static void Prefix(ref AudioClip clip) { if (Plugin.ShouldReplace(clip)) { clip = Plugin.ReplacementClip; } } } [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip), typeof(float) })] internal static class PlayOneShotVolumePatch { private static void Prefix(ref AudioClip clip) { if (Plugin.ShouldReplace(clip)) { clip = Plugin.ReplacementClip; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class ClipSetterPatch { private static void Prefix(ref AudioClip value) { if (Plugin.ShouldReplace(value)) { value = Plugin.ReplacementClip; } } } }