using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("MassChangerMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MassChangerMod")] [assembly: AssemblyTitle("MassChangerMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace MassChangerMenuMod; [BepInPlugin("com.MassChangerMenuMod.massmenu", "Mass Changer Menu", "1.0.0")] public class Plugin : BaseUnityPlugin { private bool showMenu = false; private Rect menuRect = new Rect(300f, 20f, 260f, 150f); private Dictionary originalMasses = new Dictionary(); private ConfigEntry targetMassConfig; private void Awake() { targetMassConfig = ((BaseUnityPlugin)this).Config.Bind("General", "TargetMass", 1f, "The mass to apply to objects (in kg). Edit this value to change how heavy objects become."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mass Changer Menu loaded! Press P to open."); } private void Update() { if (Input.GetKeyDown((KeyCode)112)) { showMenu = !showMenu; } } private void OnGUI() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (showMenu) { menuRect = GUI.Window(1, menuRect, new WindowFunction(DrawMenu), "Super Strength (P)"); } } private void DrawMenu(int windowID) { GUILayout.Label("Object Mass Control:", Array.Empty()); GUILayout.Label("Target Mass: " + targetMassConfig.Value + " kg", Array.Empty()); GUILayout.Label("(Edit in BepInEx config file)", Array.Empty()); if (GUILayout.Button("Apply Mass", Array.Empty())) { ((BaseUnityPlugin)this).Config.Reload(); MakeObjectsLight(); } if (GUILayout.Button("Restore Normal Mass", Array.Empty())) { RestoreMasses(); } GUI.DragWindow(); } private void MakeObjectsLight() { Rigidbody[] array = Object.FindObjectsOfType(); Rigidbody[] array2 = array; foreach (Rigidbody val in array2) { string text = ((Object)((Component)val).transform.root).name.ToLower(); if (!text.Contains("human") && !text.Contains("player")) { int instanceID = ((Object)val).GetInstanceID(); if (!originalMasses.ContainsKey(instanceID)) { originalMasses[instanceID] = val.mass; } val.mass = targetMassConfig.Value; } } } private void RestoreMasses() { Rigidbody[] array = Object.FindObjectsOfType(); Rigidbody[] array2 = array; foreach (Rigidbody val in array2) { int instanceID = ((Object)val).GetInstanceID(); if (originalMasses.ContainsKey(instanceID)) { val.mass = originalMasses[instanceID]; } } originalMasses.Clear(); } }