using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NotFunnyDidntLaugh")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NotFunnyDidntLaugh")] [assembly: AssemblyTitle("NotFunnyDidntLaugh")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace AngelDev.NotFunnyDidntLaugh { [BepInPlugin("angeldev.notfunnydidntlaugh", "NotFunnyDidntLaugh", "1.0.2")] public class NotFunnyDidntLaugh : BaseUnityPlugin { private static AudioClip[]? fartSounds; private static string? pluginPath; private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown pluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); LoadFartSounds(); Harmony val = new Harmony("angeldev.notfunnydidntlaugh"); MethodInfo method = typeof(PlayerAvatar).GetMethod("StandToCrouch", BindingFlags.Instance | BindingFlags.Public); if (method == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"'oh fiddlesticks, what now?'"); ((BaseUnityPlugin)this).Logger.LogError((object)"this is a residual debug message that juniveriel — the mod author — wasn't sure how to remove without risking breaking the mod."); ((BaseUnityPlugin)this).Logger.LogError((object)"if you're seeing this message, something has gone horribly wrong, and NotFunnyDidntLaugh couldn't find the PlayerAvatar.StandToCrouch method!"); ((BaseUnityPlugin)this).Logger.LogError((object)"please double check that the mod is updated and properly installed, then report this issue to juniveriel."); } else { MethodInfo method2 = typeof(NotFunnyDidntLaugh).GetMethod("PatchCrouchSound", BindingFlags.Static | BindingFlags.NonPublic); val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"yippie! NotFunnyDidntLaugh patched successfully!"); } ManualLogSource val2 = Logger.CreateLogSource("NotFunnyDidntLaugh"); val2.LogInfo((object)"fun fact! did you know it's not against the thunderstore TOS to write silly little text in your bepinex console? :)"); } private static void LoadFartSounds() { string text = Path.Combine(pluginPath ?? "", "peepeepoopoo"); if (!Directory.Exists(text)) { Logger.CreateLogSource("NotFunnyDidntLaugh").LogError((object)("what? there's meant to be an assets folder named 'peepeepoopoo' at " + text + "but there's not one. what did you do? put that back.")); return; } string[] files = Directory.GetFiles(text, "*.ogg"); fartSounds = (AudioClip[]?)(object)new AudioClip[files.Length]; for (int i = 0; i < files.Length; i++) { AudioClip val = LoadOggFile(files[i]); if ((Object)(object)val != (Object)null) { fartSounds[i] = val; } } ManualLogSource val2 = Logger.CreateLogSource("NotFunnyDidntLaugh"); val2.LogInfo((object)$"to-do: find a funny way to log that there are {fartSounds.Length} registered fart sounds in the 'peepeepoopoo' directory"); val2.LogInfo((object)"(yes, that's the name of the folder, and yes, it's meant to be funny. no, i don't know why i thought that was a good idea)"); } private static AudioClip? LoadOggFile(string filePath) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file:///" + filePath, (AudioType)14); try { audioClip.SendWebRequest(); while (!audioClip.isDone) { } if ((int)audioClip.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); ((Object)content).name = Path.GetFileNameWithoutExtension(filePath); return content; } Logger.CreateLogSource("NotFunnyDidntLaugh").LogError((object)("failed to load " + filePath + ":(")); return null; } finally { ((IDisposable)audioClip)?.Dispose(); } } [HarmonyPatch(typeof(PlayerAvatar), "StandToCrouch")] [HarmonyPrefix] private static void PatchCrouchSound(PlayerAvatar __instance) { if (fartSounds == null || fartSounds.Length == 0) { Logger.CreateLogSource("NotFunnyDidntLaugh").LogInfo((object)"there's no fart sounds to load :("); return; } Traverse val = Traverse.Create((object)__instance).Field("standToCrouchSound"); Sound value = val.GetValue(); if (value != null) { value.Sounds = fartSounds; } } } }