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 Poshanka v1.0.0
plugins/Poshanka.dll
Decompiled 9 months agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Poshanka")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Poshanka")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4075ce25-ebdc-4b55-b192-5b3311c6018f")] [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.burningphoenix.poshanka", "Poshanka", "1.2.0")] public class Poshanka : BaseUnityPlugin { private static ManualLogSource Log; private static AudioClip OverrideClip; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Poshanka initialized. Loading override sound..."); Harmony.CreateAndPatchAll(typeof(Poshanka), (string)null); string path = Path.Combine(Paths.PluginPath, "Poshanka", "Poshanka.ogg"); ((MonoBehaviour)this).StartCoroutine(LoadClip(path)); } private IEnumerator LoadClip(string path) { string uri = "file://" + path.Replace("\\", "/"); WWW www = new WWW(uri); yield return www; OverrideClip = www.GetAudioClip(false, false); if ((Object)(object)OverrideClip != (Object)null) { Log.LogInfo((object)("Override clip loaded successfully: " + ((Object)OverrideClip).name)); } else { Log.LogWarning((object)"Failed to load override clip."); } } [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip) })] [HarmonyPrefix] private static void Patch_PlayOneShot1(ref AudioClip clip) { if ((Object)(object)OverrideClip != (Object)null) { clip = OverrideClip; } } [HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip), typeof(float) })] [HarmonyPrefix] private static void Patch_PlayOneShot2(ref AudioClip clip) { if ((Object)(object)OverrideClip != (Object)null) { clip = OverrideClip; } } [HarmonyPatch(typeof(AudioSource))] [HarmonyPatch("Play", new Type[] { })] [HarmonyPrefix] private static void Patch_Play(AudioSource __instance) { if ((Object)(object)OverrideClip != (Object)null) { __instance.clip = OverrideClip; } } }