The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of IronDeficiency v0.1.0
plugins/Ryocery-IronDeficiency/com.github.Ryocery.IronDeficiency.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.Ryocery.IronDeficiency")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("com.github.Ryocery.IronDeficiency")] [assembly: AssemblyTitle("IronDeficiency")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace IronDeficiency { [BepInPlugin("com.github.Ryocery.IronDeficiency", "IronDeficiency", "0.1.0")] public class Plugin : BaseUnityPlugin { public const string Id = "com.github.Ryocery.IronDeficiency"; internal static ManualLogSource Log { get; private set; } internal static ConfigEntry<bool> EnableRandomTrips { get; private set; } internal static ConfigEntry<float> TripChancePerSecond { get; private set; } internal static ConfigEntry<float> MinMovementSpeed { get; private set; } internal static ConfigEntry<bool> EnableRandomFaints { get; private set; } internal static ConfigEntry<float> FaintChancePerSecond { get; private set; } internal static ConfigEntry<bool> CanFaintWhileClimbing { get; private set; } public static string Name => "IronDeficiency"; public static string Version => "0.1.0"; private void Awake() { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Plugin " + Name + " is loaded!")); EnableRandomTrips = ((BaseUnityPlugin)this).Config.Bind<bool>("Tripping", "EnableRandomTrips", true, "Enable random tripping."); TripChancePerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Tripping", "TripChancePerSecond", 0.02f, "Chance per second to trip (0.01 = 1% per second)"); MinMovementSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Tripping", "MinMovementSpeed", 1.5f, "Minimum movement speed to be able to trip."); EnableRandomFaints = ((BaseUnityPlugin)this).Config.Bind<bool>("Fainting", "EnableRandomFaints", true, "Enable random fainting."); FaintChancePerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Fainting", "FaintChancePerSecond", 0.006f, "Chance per second to faint (0.005 = 0.5% per second)"); CanFaintWhileClimbing = ((BaseUnityPlugin)this).Config.Bind<bool>("Fainting", "CanFaintWhileClimbing", true, "Whether you can faint while climbing."); Harmony val = new Harmony("com.github.RandomTripMod"); try { val.PatchAll(); } catch (Exception arg) { Log.LogError((object)$"Mod failed to load: {arg}"); } } } public class IronDeficiencyRPCHandler : MonoBehaviourPun { private Character? character; private void Start() { character = ((Component)this).GetComponent<Character>(); } [PunRPC] public void PlayTripSound() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) AudioClip tripSound = IronDeficiencyPatch.GetTripSound(); if ((Object)(object)tripSound != (Object)null && (Object)(object)character != (Object)null) { AudioSource.PlayClipAtPoint(tripSound, character.Center, 0.7f); } } [PunRPC] public void PlayFaintSound() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) AudioClip faintSound = IronDeficiencyPatch.GetFaintSound(); if ((Object)(object)faintSound != (Object)null && (Object)(object)character != (Object)null) { AudioSource.PlayClipAtPoint(faintSound, character.Center, 0.7f); } } } [HarmonyPatch(typeof(Character))] public class IronDeficiencyPatch { private static AudioClip? faintSound; private static AudioClip? tripSound; [HarmonyPostfix] [HarmonyPatch("Awake")] public static void AwakePostfix(Character __instance) { ((Component)__instance).gameObject.AddComponent<IronDeficiencyRPCHandler>(); } [HarmonyPostfix] [HarmonyPatch("Update")] public static void UpdatePostfix(Character __instance) { if (__instance.IsLocal) { if (Plugin.EnableRandomTrips.Value) { ProcessRandomTrips(__instance); } if (Plugin.EnableRandomFaints.Value) { ProcessRandomFaints(__instance); } } } private static void ProcessRandomTrips(Character character) { if (character.data.isGrounded && !(((Vector3)(ref character.data.avarageVelocity)).magnitude < Plugin.MinMovementSpeed.Value) && !character.data.dead && !character.data.fullyPassedOut && !character.data.isClimbing && !character.data.isRopeClimbing && !character.data.isVineClimbing) { float num = Plugin.TripChancePerSecond.Value * Time.deltaTime; if (Random.Range(0f, 1f) < num) { TriggerTrip(character); } } } private static void ProcessRandomFaints(Character character) { if (!character.data.dead && !character.data.fullyPassedOut && !character.data.passedOut && (Plugin.CanFaintWhileClimbing.Value || (!character.data.isClimbing && !character.data.isRopeClimbing && !character.data.isVineClimbing))) { float num = Plugin.FaintChancePerSecond.Value * Time.deltaTime; if (Random.Range(0f, 1f) < num) { TriggerFaint(character); } } } private static void TriggerTrip(Character character) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) try { Plugin.Log.LogInfo((object)("Random trip triggered for " + character.characterName + "!")); IronDeficiencyRPCHandler component = ((Component)character).GetComponent<IronDeficiencyRPCHandler>(); if ((Object)(object)component != (Object)null) { ((MonoBehaviourPun)component).photonView.RPC("PlayTripSound", (RpcTarget)0, Array.Empty<object>()); } else { AudioClip val = GetTripSound(); if ((Object)(object)val != (Object)null) { AudioSource.PlayClipAtPoint(val, character.Center, 0.7f); } } MethodInfo method = typeof(Character).GetMethod("GetBodypartRig", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(Character).GetMethod("Fall", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null && method2 != null) { object? obj = method.Invoke(character, new object[1] { (object)(BodypartType)16 }); Rigidbody val2 = (Rigidbody)((obj is Rigidbody) ? obj : null); object? obj2 = method.Invoke(character, new object[1] { (object)(BodypartType)13 }); Rigidbody val3 = (Rigidbody)((obj2 is Rigidbody) ? obj2 : null); object? obj3 = method.Invoke(character, new object[1] { (object)(BodypartType)0 }); Rigidbody val4 = (Rigidbody)((obj3 is Rigidbody) ? obj3 : null); object? obj4 = method.Invoke(character, new object[1] { (object)(BodypartType)4 }); Rigidbody val5 = (Rigidbody)((obj4 is Rigidbody) ? obj4 : null); method2.Invoke(character, new object[2] { 2f, 0f }); Vector3 lookDirection_Flat = character.data.lookDirection_Flat; if (val2 != null) { val2.AddForce((lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1); } if (val3 != null) { val3.AddForce((lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1); } if (val4 != null) { val4.AddForce(Vector3.up * 1500f, (ForceMode)1); } if (val5 != null) { val5.AddForce(lookDirection_Flat * -300f, (ForceMode)1); } } } catch (Exception arg) { Plugin.Log.LogError((object)$"Exception in random trip: {arg}"); } } private static void TriggerFaint(Character character) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) try { Plugin.Log.LogInfo((object)("Random faint triggered for " + character.characterName + "!")); IronDeficiencyRPCHandler component = ((Component)character).GetComponent<IronDeficiencyRPCHandler>(); if ((Object)(object)component != (Object)null) { ((MonoBehaviourPun)component).photonView.RPC("PlayFaintSound", (RpcTarget)0, Array.Empty<object>()); } else { AudioClip val = GetFaintSound(); if ((Object)(object)val != (Object)null) { AudioSource.PlayClipAtPoint(val, character.Center, 0.7f); } } character.PassOutInstantly(); } catch (Exception arg) { Plugin.Log.LogError((object)$"Exception in random faint: {arg}"); } } public static AudioClip? GetFaintSound() { if ((Object)(object)faintSound == (Object)null) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (directoryName != null) { string path = Path.Combine(directoryName, "sounds", "faint_sound.wav"); if (File.Exists(path)) { try { byte[] fileBytes = File.ReadAllBytes(path); faintSound = WavUtility.ToAudioClip(fileBytes, "faint_sound"); if ((Object)(object)faintSound != (Object)null) { return faintSound; } } catch (Exception arg) { Plugin.Log.LogError((object)$"Failed to load custom sound: {arg}"); } } } } return faintSound; } public static AudioClip? GetTripSound() { if ((Object)(object)tripSound == (Object)null) { AudioClip[] source = Resources.FindObjectsOfTypeAll<AudioClip>(); tripSound = ((IEnumerable<AudioClip>)source).FirstOrDefault((Func<AudioClip, bool>)((AudioClip clip) => ((Object)clip).name == "Au_Slip1")); } return tripSound; } } public static class WavUtility { public static AudioClip? ToAudioClip(byte[] fileBytes, string name = "wav") { try { int num = BitConverter.ToInt32(fileBytes, 24); int num2 = BitConverter.ToInt16(fileBytes, 22); int num3 = BitConverter.ToInt16(fileBytes, 34); int num4 = 44; int num5 = num3 / 8; int num6 = (fileBytes.Length - num4) / num5; int num7 = num6 / num2; float[] array = new float[num6]; for (int i = 0; i < num6; i++) { short num8 = (short)((fileBytes[num4 + i * 2 + 1] << 8) | fileBytes[num4 + i * 2]); array[i] = (float)num8 / 32768f; } AudioClip val = AudioClip.Create(name, num7, num2, num, false); val.SetData(array, 0); return val; } catch (Exception arg) { Plugin.Log.LogError((object)$"Failed to convert WAV data: {arg}"); return null; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }