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 FulingLaughReplacer v1.0.1
FulingLaughReplacer.dll
Decompiled a month 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("FulingLaughReplacer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FulingLaughReplacer")] [assembly: AssemblyTitle("FulingLaughReplacer")] [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 FulingLaughReplacer { [BepInPlugin("com.niclas.fulinglaughreplacer", "Fuling Laugh Replacer", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.niclas.fulinglaughreplacer"; public const string PluginName = "Fuling Laugh Replacer"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; internal static AudioClip ReplacementClip; internal static ConfigEntry<string> MatchKeywords; internal static ConfigEntry<bool> DebugLogClipNames; internal static ConfigEntry<string> ReplacementFileName; private Harmony _harmony; private void Awake() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; MatchKeywords = ((BaseUnityPlugin)this).Config.Bind<string>("General", "MatchKeywords", "laugh,goblin,fuling", "Kommagetrennte Liste von Teilstrings (Groß-/Kleinschreibung egal). Jeder AudioClip, dessen Name einen dieser Teilstrings enthaelt, wird durch deine WAV-Datei ersetzt. Standard erfasst moeglichst breit alles, was mit Fuling zu tun haben koennte (Laute, Treffer, Tod)."); DebugLogClipNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogAllClipNames", false, "Wenn true: JEDER abgespielte AudioClip-Name wird ins BepInEx-Log (BepInEx/LogOutput.log) geschrieben. Hilft, weitere Fuling-Clipnamen zu finden, falls die Standardfilter oben nicht alles abdecken."); ReplacementFileName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ReplacementFileName", "hehehe.wav", "Dateiname deiner Ersatz-Audiodatei. Muss im selben Ordner wie diese DLL liegen."); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? ".", ReplacementFileName.Value); if (!File.Exists(text)) { Log.LogError((object)("[FulingLaughReplacer] Datei nicht gefunden: " + text + ". Bitte hehehe.wav in denselben Ordner wie die Plugin-DLL legen.")); } else { ((MonoBehaviour)this).StartCoroutine(LoadReplacementClip(text)); } _harmony = new Harmony("com.niclas.fulinglaughreplacer"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)"[FulingLaughReplacer] geladen."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private IEnumerator LoadReplacementClip(string path) { string text = "file://" + path.Replace("\\", "/"); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)20); try { yield return request.SendWebRequest(); if (request.isNetworkError || request.isHttpError) { Log.LogError((object)("[FulingLaughReplacer] Fehler beim Laden von " + path + ": " + request.error)); yield break; } ReplacementClip = DownloadHandlerAudioClip.GetContent(request); ((Object)ReplacementClip).name = "FulingLaughReplacer_Custom"; Log.LogInfo((object)("[FulingLaughReplacer] '" + ReplacementFileName.Value + "' erfolgreich geladen " + $"({ReplacementClip.length:0.00}s, {ReplacementClip.channels} Kanal/Kanaele).")); } finally { ((IDisposable)request)?.Dispose(); } } internal static bool ShouldReplace(AudioClip clip) { if ((Object)(object)clip == (Object)null || (Object)(object)ReplacementClip == (Object)null) { return false; } if (clip == ReplacementClip) { return false; } if (DebugLogClipNames.Value) { Log.LogInfo((object)("[FulingLaughReplacer] Clip abgespielt: '" + ((Object)clip).name + "'")); } string text = ((Object)clip).name.ToLowerInvariant(); string[] array = MatchKeywords.Value.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim().ToLowerInvariant(); if (text2.Length > 0 && text.Contains(text2)) { return true; } } return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class AudioSource_SetClip_Patch { private static void Prefix(ref AudioClip value) { if (Plugin.ShouldReplace(value)) { value = Plugin.ReplacementClip; } } } [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip), typeof(float) })] internal static class AudioSource_PlayOneShot_Patch { private static void Prefix(ref AudioClip clip) { if (Plugin.ShouldReplace(clip)) { clip = Plugin.ReplacementClip; } } } }