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 ImmersiveFarting v1.0.1
BepInEx/plugins/ImmersiveFarting/ImmersiveFarting.dll
Decompiled a year agousing System; using System.Collections.Generic; 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.Configuration; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; 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("FartMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FartMod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3957ca4f-90cd-4cac-afdc-3a9a0bf5b8b5")] [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 ImmersiveFarting; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.yourname.immersivefarting", "Immersive Farting", "1.0.0")] public class ImmersiveFartingMod : BaseUnityPlugin { private class SyncFartMessage : INetMessage, ISerializableObject { private int index; private Vector3 position; public SyncFartMessage() { } public SyncFartMessage(int index, Vector3 position) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) this.index = index; this.position = position; } public void Serialize(NetworkWriter writer) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) writer.Write(index); writer.Write(position); } public void Deserialize(NetworkReader reader) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) index = reader.ReadInt32(); position = reader.ReadVector3(); } public void OnReceived() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) PlayFart(index, position); } } private static List<AudioClip> fartClips = new List<AudioClip>(); private static float lastFartTime; private const float COOLDOWN = 5f; private const string SOUNDS_FOLDER = "BepInEx/plugins/ImmersiveFarting/Sounds/"; private static ConfigEntry<KeyboardShortcut> fartKey; private static ConfigEntry<float> fartVolume; public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) fartKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "FartKey", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Key to trigger fart"); fartVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 0.7f, "Fart sound volume"); NetworkingAPI.RegisterMessageType<SyncFartMessage>(); LoadSounds(); RoR2Application.onUpdate += delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = fartKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { TryFart(); } }; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Immersive Farting loaded!"); } private void TryFart() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - lastFartTime < 5f) && fartClips.Count != 0) { lastFartTime = Time.time; int index = Random.Range(0, fartClips.Count); LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); Vector3? obj; if (firstLocalUser == null) { obj = null; } else { CharacterBody cachedBody = firstLocalUser.cachedBody; obj = ((cachedBody != null) ? new Vector3?(cachedBody.corePosition) : null); } Vector3 position = (Vector3)(((??)obj) ?? Vector3.zero); NetMessageExtensions.Send((INetMessage)(object)new SyncFartMessage(index, position), (NetworkDestination)1); PlayFart(index, position); } } public static void PlayFart(int index, Vector3 position) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (index >= 0 && index < fartClips.Count) { GameObject val = new GameObject("FartSound"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = fartClips[index]; val2.spatialBlend = 1f; val2.maxDistance = 50f; val2.volume = fartVolume.Value; val2.Play(); Object.Destroy((Object)(object)val, fartClips[index].length + 0.1f); } } private void LoadSounds() { if (!Directory.Exists("BepInEx/plugins/ImmersiveFarting/Sounds/")) { Directory.CreateDirectory("BepInEx/plugins/ImmersiveFarting/Sounds/"); ((BaseUnityPlugin)this).Logger.LogWarning((object)"Created sounds folder at: BepInEx/plugins/ImmersiveFarting/Sounds/"); return; } string[] files = Directory.GetFiles("BepInEx/plugins/ImmersiveFarting/Sounds/", "*.wav"); foreach (string text in files) { try { AudioClip val = LoadWav(text); if (Object.op_Implicit((Object)(object)val)) { fartClips.Add(val); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Error loading " + text + ": " + ex.Message)); } } } private AudioClip LoadWav(string path) { using FileStream fileStream = new FileStream(path, FileMode.Open); using BinaryReader binaryReader = new BinaryReader(fileStream); binaryReader.ReadBytes(44); byte[] array = binaryReader.ReadBytes((int)(fileStream.Length - 44)); AudioClip val = AudioClip.Create(Path.GetFileName(path), array.Length / 2, 1, 44100, false); float[] array2 = new float[array.Length / 2]; for (int i = 0; i < array2.Length; i++) { array2[i] = (float)(array[i * 2] | (array[i * 2 + 1] << 8)) / 32768f; } val.SetData(array2, 0); return val; } }