Decompiled source of PowerTools v1.1.0

Mods/PowerTools.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using HarmonyLib;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using PowerTools;
using PowerTools.Tools;
using SLZ.Data;
using SLZ.Interaction;
using SLZ.Marrow.Data;
using SLZ.Player;
using SLZ.Props.Weapons;
using SLZ.Rig;
using TMPro;
using UnhollowerBaseLib;
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(null)]
[assembly: AssemblyDescription(null)]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("Power Tools")]
[assembly: AssemblyCopyright("Developed by Bread Soup")]
[assembly: AssemblyTrademark(null)]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: MelonInfo(typeof(Main), "Power Tools", "1.1.0", "Bread Soup", null)]
[assembly: MelonColor(ConsoleColor.Cyan)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.1.0.0")]
namespace PowerTools
{
	internal class Main : MelonMod
	{
		internal const string Name = "Power Tools";

		internal const string Description = null;

		internal const string Author = "Bread Soup";

		internal const string Company = null;

		internal const string Version = "1.1.0";

		internal const string DownloadLink = null;

		public static MenuCategory Category;

		public static readonly string PowerToolsPath = Path.Combine(MelonUtils.UserDataDirectory, "PowerTools");

		public static MelonPreferences_Category MelonPrefCategory { get; private set; }

		public override void OnInitializeMelon()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Hooking.OnLevelInitialized += delegate
			{
				OnSceneAwake();
			};
			MelonPrefCategory = MelonPreferences.CreateCategory("Power Tools");
			DeathTimeCustomizer.MelonPreferencesCreator();
			ReloadOnDeathCustomizer.MelonPreferencesCreator();
			ButtonDisabler.MelonPreferencesCreator();
			RagdollOnDeath.MelonPreferencesCreator();
			VaultingToggle.MelonPreferencesCreator();
			GravityAdjuster.MelonPreferencesCreator();
			InfiniteAmmo.MelonPreferencesCreator();
			Category = MenuManager.CreateCategory("<color=#00FF72>P</color><color=#00FF80>o</color><color=#00FF8D>w</color><color=#00FF99>e</color><color=#00FFA5>r</color><color=#00FFB0> </color><color=#00FFBA>T</color><color=#00FFC3>o</color><color=#00FFCC>o</color><color=#00FFD4>l</color><color=#00FFD4>s</color>", Color.white);
			DeathTimeCustomizer.BoneMenuCreator();
			ReloadOnDeathCustomizer.BoneMenuCreator();
			ButtonDisabler.BoneMenuCreator();
			RagdollOnDeath.BoneMenuCreator();
			VaultingToggle.BoneMenuCreator();
			GravityAdjuster.BoneMenuCreator();
			InfiniteAmmo.BoneMenuCreator();
			RagdollLegs.BoneMenuCreator();
		}

		private static void OnSceneAwake()
		{
			DeathTimeCustomizer.DeathTimeSetter();
			ButtonDisabler.DisableButtons();
			ReloadOnDeathCustomizer.IsDefaultSet = false;
			ReloadOnDeathCustomizer.ReloadOnDeathSetter(ReloadOnDeathCustomizer.ReloadLevel);
			RagdollOnDeath.OnSetEnabled(RagdollOnDeath.RagdollOnDeathIsEnabled);
			GravityAdjuster.GravityAdjust();
		}

		public override void OnUpdate()
		{
		}
	}
}
namespace PowerTools.Tools
{
	public class BrickShooter
	{
		public static void dfgijkhokjnhgrshjikhjiusgihuseg()
		{
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Player.rigManager == (Object)null)
			{
				Debug.Log(Object.op_Implicit("Player.rigManager is null"));
				return;
			}
			if ((Object)(object)((Component)Player.rigManager).gameObject.transform == (Object)null)
			{
				Debug.Log(Object.op_Implicit("Player.rigManager.gameObject is null"));
				return;
			}
			Camera componentInChildren = ((Component)Player.rigManager).GetComponentInChildren<Camera>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.Log(Object.op_Implicit("No Camera component found in the children of Player.rigManager's gameObject"));
				return;
			}
			if (((Object)((Component)componentInChildren).gameObject).name != "Head")
			{
				Debug.Log(Object.op_Implicit("The Camera component found is not named 'Head'"));
				return;
			}
			((Component)componentInChildren).gameObject.transform.rotation = ((Component)componentInChildren).gameObject.transform.rotation * Quaternion.Euler(-1f, 1f, 1f);
			Transform transform = ((Component)componentInChildren).transform;
			Vector3 localScale = transform.localScale;
			localScale.x = -1f;
			transform.localScale = localScale;
		}
	}
	public class BugoSpray
	{
		public static void BugoRemover()
		{
			TextMeshProUGUI[] array = Il2CppArrayBase<TextMeshProUGUI>.op_Implicit(Object.FindObjectsOfType<TextMeshProUGUI>());
			TextMeshPro[] array2 = Il2CppArrayBase<TextMeshPro>.op_Implicit(Object.FindObjectsOfType<TextMeshPro>());
			TextMeshProUGUI[] array3 = array;
			foreach (TextMeshProUGUI val in array3)
			{
				TextMeshProUGUI component = ((Component)val).gameObject.GetComponent<TextMeshProUGUI>();
				if ((Object)(object)component != (Object)null && (((TMP_Text)component).m_text.Contains("BugoBug") || ((TMP_Text)component).m_text.Contains("Budostayheadonarm") || ((TMP_Text)component).m_text.Contains("Bugazzz06")))
				{
					((TMP_Text)component).m_text = ((TMP_Text)component).m_text.Replace(((TMP_Text)component).m_text, "BreadSoup");
					Debug.Log(Object.op_Implicit("TextMeshPro match found and replaced: " + ((TMP_Text)component).m_text));
				}
			}
			TextMeshPro[] array4 = array2;
			foreach (TextMeshPro val2 in array4)
			{
				TextMeshPro component2 = ((Component)val2).gameObject.GetComponent<TextMeshPro>();
				if ((Object)(object)component2 != (Object)null && (((TMP_Text)component2).text.Contains("BugoBug") || ((TMP_Text)component2).text.Contains("Budostayheadonarm") || ((TMP_Text)component2).text.Contains("Bugazzz06")))
				{
					((TMP_Text)component2).text = ((TMP_Text)component2).text.Replace(((TMP_Text)component2).text, "BreadSoup");
					if (((Component)component2).gameObject.active)
					{
						((Component)component2).gameObject.SetActive(false);
						((Component)component2).gameObject.SetActive(true);
					}
					else
					{
						((Component)component2).gameObject.SetActive(true);
						((Component)component2).gameObject.SetActive(false);
					}
				}
			}
		}
	}
	internal static class ButtonDisabler
	{
		private static bool _endOfLevelButton;

		private static MelonPreferences_Entry<bool> MelonPrefEnabled { get; set; }

		private static bool ButtonDisablerIsEnabled { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefEndOfLevelButton { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefEnabled = Main.MelonPrefCategory.CreateEntry<bool>("ButtonDisablerIsEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ButtonDisablerIsEnabled = MelonPrefEnabled.Value;
			MelonPrefEndOfLevelButton = Main.MelonPrefCategory.CreateEntry<bool>("Disable end of level button", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefEndOfLevelButton != null)
			{
				_endOfLevelButton = MelonPrefEndOfLevelButton.Value;
			}
		}

		public static void BoneMenuCreator()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory val = Main.Category.CreateCategory("Button Disabler ", Color.yellow);
			val.CreateBoolElement("Mod Toggle", Color.yellow, ButtonDisablerIsEnabled, (Action<bool>)OnSetEnabled);
			val.CreateBoolElement("Disable Next Level Button", "#ff9900", _endOfLevelButton, (Action<bool>)OnEndOfLevelButtonEnabled);
		}

		public static void DisableButtons()
		{
			Il2CppArrayBase<Transform> val = Object.FindObjectsOfType<Transform>(true);
			foreach (Transform item in val)
			{
				if (!((Object)item).name.Contains("FLOORS") && !((Object)item).name.Contains("LoadButtons") && !((Object)item).name.Contains("prop_bigButton") && !((Object)item).name.Contains("INTERACTION"))
				{
					continue;
				}
				for (int i = 0; i < item.childCount; i++)
				{
					Transform child = item.GetChild(i);
					ButtonToggle component = ((Component)child).GetComponent<ButtonToggle>();
					if ((Object)(object)component != (Object)null && ButtonDisablerIsEnabled)
					{
						if (_endOfLevelButton)
						{
							((Behaviour)component).enabled = false;
						}
						else if (!_endOfLevelButton)
						{
							if (!((Object)child).name.Contains("prop_bigButton_NEXTLEVEL"))
							{
								((Behaviour)component).enabled = false;
							}
							if (((Object)child).name.Contains("prop_bigButton_NEXTLEVEL"))
							{
								((Behaviour)component).enabled = true;
							}
						}
					}
					else if ((Object)(object)component != (Object)null && !ButtonDisablerIsEnabled)
					{
						((Behaviour)component).enabled = true;
					}
				}
			}
		}

		private static void OnSetEnabled(bool value)
		{
			ButtonDisablerIsEnabled = value;
			MelonPrefEnabled.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
			DisableButtons();
		}

		private static void OnEndOfLevelButtonEnabled(bool value)
		{
			_endOfLevelButton = value;
			MelonPrefEndOfLevelButton.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
			DisableButtons();
		}
	}
	internal static class DeathTimeCustomizer
	{
		private static float _deathTime;

		private static MelonPreferences_Entry<bool> MelonPrefEnabled { get; set; }

		private static bool DeathTimeCustomizerIsEnabled { get; set; }

		private static MelonPreferences_Entry<float> MelonPrefDeathTime { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefEnabled = Main.MelonPrefCategory.CreateEntry<bool>("DeathTimeCustomizerIsEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPrefDeathTime = Main.MelonPrefCategory.CreateEntry<float>("Damage Threshold", 3f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefEnabled != null)
			{
				DeathTimeCustomizerIsEnabled = MelonPrefEnabled.Value;
			}
			if (MelonPrefDeathTime != null)
			{
				_deathTime = MelonPrefDeathTime.Value;
			}
		}

		public static void BoneMenuCreator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory val = Main.Category.CreateCategory("Death Time Customizer", "#FC221b");
			val.CreateBoolElement("Mod Toggle", Color.yellow, DeathTimeCustomizerIsEnabled, (Action<bool>)OnSetEnabled);
			val.CreateFloatElement("Death Time", "#FC221b", _deathTime, 1f, 0f, 100f, (Action<float>)delegate(float dt)
			{
				_deathTime = dt;
				MelonPrefDeathTime.Value = dt;
				Main.MelonPrefCategory.SaveToFile(false);
				DeathTimeSetter();
			});
		}

		public static void DeathTimeSetter()
		{
			if ((Object)(object)Player.rigManager != (Object)null && DeathTimeCustomizerIsEnabled)
			{
				Player.rigManager.openControllerRig.playerHealth.deathTimeAmount = _deathTime;
			}
		}

		private static void OnSetEnabled(bool value)
		{
			if (!value)
			{
				Player.rigManager.openControllerRig.playerHealth.deathTimeAmount = 3f;
			}
			DeathTimeCustomizerIsEnabled = value;
			MelonPrefEnabled.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}
	}
	public abstract class GravityAdjuster
	{
		private static float _gravity = -9.81f;

		private static bool _isEnabled;

		private static MelonPreferences_Entry<float> MelonPrefGravityValue { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefGravityValue = Main.MelonPrefCategory.CreateEntry<float>("Gravity Adjuster Value", 9.81f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefGravityValue != null)
			{
				_gravity = MelonPrefGravityValue.Value;
			}
		}

		public static void BoneMenuCreator()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory val = Main.Category.CreateCategory("Gravity Adjuster", "#4555ed");
			val.CreateBoolElement("Mod Toggle", Color.yellow, _isEnabled, (Action<bool>)OnSetEnabled);
			FloatElement one = null;
			FloatElement ten = null;
			FloatElement pointOne = val.CreateFloatElement("Gravity Value (0.1)", "#cc51fc", _gravity, 0.1f, -25f, 25f, (Action<float>)delegate(float r)
			{
				MelonPrefGravityValue.Value = r;
				Main.MelonPrefCategory.SaveToFile(false);
				_gravity = r;
				((GenericElement<float>)(object)one)?.SetValue(r);
				((GenericElement<float>)(object)ten)?.SetValue(r);
				GravityAdjust();
			});
			one = val.CreateFloatElement("Gravity Value (1)", "#cc51fc", _gravity, 1f, -25f, 25f, (Action<float>)delegate(float r)
			{
				MelonPrefGravityValue.Value = r;
				Main.MelonPrefCategory.SaveToFile(false);
				((GenericElement<float>)(object)pointOne)?.SetValue(r);
				((GenericElement<float>)(object)ten)?.SetValue(r);
				_gravity = r;
				GravityAdjust();
			});
			ten = val.CreateFloatElement("Gravity Value (5)", "#cc51fc", _gravity, 5f, -25f, 25f, (Action<float>)delegate(float r)
			{
				MelonPrefGravityValue.Value = r;
				Main.MelonPrefCategory.SaveToFile(false);
				((GenericElement<float>)(object)pointOne)?.SetValue(r);
				((GenericElement<float>)(object)one)?.SetValue(r);
				_gravity = r;
				GravityAdjust();
			});
		}

		private static void OnSetEnabled(bool value)
		{
			_isEnabled = value;
			if (value)
			{
				GravityAdjust();
			}
			else
			{
				GravityReset();
			}
		}

		private static void GravityReset()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Physics.gravity = new Vector3(0f, -9.81f, 0f);
		}

		public static void GravityAdjust()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (_isEnabled)
			{
				Physics.gravity = new Vector3(0f, _gravity, 0f);
			}
		}
	}
	public abstract class InfiniteAmmo
	{
		[HarmonyPatch(typeof(AmmoInventory), "RemoveCartridge")]
		public class TaxReturn
		{
			private static void Prefix(AmmoInventory __instance, CartridgeData cartridge, int count)
			{
				if (InfiniteAmmoIsEnabled)
				{
					__instance.AddCartridge(cartridge, count);
				}
			}
		}

		[HarmonyPatch(typeof(InventoryAmmoReceiver), "OnHandGrab")]
		public class AmmoCheckPatch
		{
			public static void Prefix()
			{
				if (InfiniteAmmoIsEnabled && GiveAmmoWhenEmpty)
				{
					int cartridgeCount = Player.rigManager.AmmoInventory.GetCartridgeCount("light");
					if (cartridgeCount <= 0)
					{
						Bankruptcy(Player.rigManager.AmmoInventory.lightAmmoGroup);
					}
					int cartridgeCount2 = Player.rigManager.AmmoInventory.GetCartridgeCount("medium");
					if (cartridgeCount2 <= 0)
					{
						Bankruptcy(Player.rigManager.AmmoInventory.mediumAmmoGroup);
					}
					int cartridgeCount3 = Player.rigManager.AmmoInventory.GetCartridgeCount("heavy");
					if (cartridgeCount3 <= 25)
					{
						Bankruptcy(Player.rigManager.AmmoInventory.heavyAmmoGroup);
					}
				}
			}

			private static void Bankruptcy(AmmoGroup group)
			{
				Player.rigManager.AmmoInventory.AddCartridge(group, 1);
			}
		}

		[HarmonyPatch(typeof(Magazine), "OnGrab")]
		public class CashBack
		{
			public static void Postfix()
			{
				if (!InfiniteAmmoIsEnabled || !GiveAmmoWhenEmpty)
				{
					return;
				}
				Magazine componentInHand = Player.GetComponentInHand<Magazine>(Player.leftHand);
				Magazine componentInHand2 = Player.GetComponentInHand<Magazine>(Player.rightHand);
				if ((Object)(object)componentInHand != (Object)null)
				{
					int rounds = componentInHand.magazineState.magazineData.rounds;
					int cartridgeCount = Player.rigManager.AmmoInventory.GetCartridgeCount(componentInHand.magazineState.cartridgeData);
					if (cartridgeCount < rounds)
					{
						BankStatement(componentInHand, rounds, cartridgeCount);
					}
				}
				if ((Object)(object)componentInHand2 != (Object)null)
				{
					int rounds2 = componentInHand2.magazineState.magazineData.rounds;
					int cartridgeCount2 = Player.rigManager.AmmoInventory.GetCartridgeCount(componentInHand2.magazineState.cartridgeData);
					if (cartridgeCount2 < rounds2)
					{
						BankStatement(componentInHand2, rounds2, cartridgeCount2);
					}
				}
			}

			private static void BankStatement(Magazine mag, int magMax, int cartridgeCount)
			{
				if (Player.rigManager.AmmoInventory.GetCartridgeCount("light") == cartridgeCount)
				{
					Loan(mag, Player.rigManager.AmmoInventory.lightAmmoGroup, magMax);
				}
				else if (Player.rigManager.AmmoInventory.GetCartridgeCount("medium") == cartridgeCount)
				{
					Loan(mag, Player.rigManager.AmmoInventory.mediumAmmoGroup, magMax);
				}
				else if (Player.rigManager.AmmoInventory.GetCartridgeCount("heavy") == cartridgeCount)
				{
					Loan(mag, Player.rigManager.AmmoInventory.heavyAmmoGroup, magMax);
				}
			}

			private static void Loan(Magazine mag, AmmoGroup group, int amount)
			{
				if (Player.rigManager.AmmoInventory.GetCartridgeCount(group.KeyName) == 1)
				{
					Player.rigManager.AmmoInventory.AddCartridge(group, -1);
				}
				Player.rigManager.AmmoInventory.AddCartridge(group, amount);
				mag.magazineState.Refill();
			}
		}

		[HarmonyPatch(typeof(Gun), "OnFire")]
		public class CreditCard
		{
			public static void Postfix(Gun __instance)
			{
				if (InfiniteAmmoIsEnabled && InfiniteMags && (Object)(object)((Component)__instance).gameObject.GetComponentInChildren<Magazine>() != (Object)null)
				{
					((Component)__instance).gameObject.GetComponentInChildren<Magazine>().magazineState.Refill();
				}
			}
		}

		[HarmonyPatch(typeof(Gun), "AmmoCount")]
		public class ShotgunCreditCard
		{
			public static bool Prefix(Gun __instance, ref int __result)
			{
				if (InfiniteAmmoIsEnabled && InfiniteMags)
				{
					__result = 1;
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Gun), "CheckGunRequirements")]
		public class Paycheck
		{
			public static void Prefix(Gun __instance)
			{
				if (InfiniteAmmoIsEnabled && AutoChamber)
				{
					__instance.Charge();
				}
				if (InfiniteAmmoIsEnabled && AutoLoad && !__instance._hasMagState)
				{
					__instance.InstantLoad();
				}
			}
		}

		[HarmonyPatch(typeof(Gun), "OnTriggerGripAttached")]
		public class DirectDeposit
		{
			public static void Prefix(Gun __instance)
			{
				if (InfiniteAmmoIsEnabled && AutoLoad && !__instance._hasMagState)
				{
					__instance.InstantLoad();
				}
			}
		}

		private static MelonPreferences_Entry<bool> MelonPrefInfiniteAmmo { get; set; }

		private static bool InfiniteAmmoIsEnabled { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefGiveAmmoWhenEmpty { get; set; }

		private static bool GiveAmmoWhenEmpty { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefInfiniteMags { get; set; }

		private static bool InfiniteMags { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefAutoChamber { get; set; }

		private static bool AutoChamber { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefAutoLoad { get; set; }

		private static bool AutoLoad { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefInfiniteAmmo = Main.MelonPrefCategory.CreateEntry<bool>("InfiniteAmmoIsEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPrefGiveAmmoWhenEmpty = Main.MelonPrefCategory.CreateEntry<bool>("GiveAmmoWhenEmpty", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPrefInfiniteMags = Main.MelonPrefCategory.CreateEntry<bool>("InfiniteMags", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPrefAutoChamber = Main.MelonPrefCategory.CreateEntry<bool>("AutoChamber", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPrefAutoLoad = Main.MelonPrefCategory.CreateEntry<bool>("AutoLoad", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefInfiniteAmmo != null)
			{
				InfiniteAmmoIsEnabled = MelonPrefInfiniteAmmo.Value;
			}
			if (MelonPrefGiveAmmoWhenEmpty != null)
			{
				GiveAmmoWhenEmpty = MelonPrefGiveAmmoWhenEmpty.Value;
			}
			if (MelonPrefInfiniteMags != null)
			{
				InfiniteMags = MelonPrefInfiniteMags.Value;
			}
			if (MelonPrefAutoChamber != null)
			{
				AutoChamber = MelonPrefAutoChamber.Value;
			}
			if (MelonPrefAutoLoad != null)
			{
				AutoLoad = MelonPrefAutoLoad.Value;
			}
		}

		public static void BoneMenuCreator()
		{
			MenuCategory val = Main.Category.CreateCategory("Infinite Ammo", "#45ed53");
			val.CreateBoolElement("Infinite Ammo", "#f2ff3b", InfiniteAmmoIsEnabled, (Action<bool>)OnSetEnabled);
			val.CreateBoolElement("Give ammo when mag can't be full", "#ff3700", GiveAmmoWhenEmpty, (Action<bool>)OnGiveAmmoWhenEmpty);
			val.CreateBoolElement("Auto Chamber", "#CD5C5C", AutoChamber, (Action<bool>)OnAutoChamber);
			val.CreateBoolElement("Auto Load Guns", "#ff5436", GiveAmmoWhenEmpty, (Action<bool>)OnGiveAmmoWhenEmpty);
			val.CreateBoolElement("Infinite Mags", "#DAA520", InfiniteMags, (Action<bool>)OnInfiniteMags);
		}

		private static void OnSetEnabled(bool value)
		{
			MelonPrefInfiniteAmmo.Value = value;
			InfiniteAmmoIsEnabled = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}

		private static void OnGiveAmmoWhenEmpty(bool value)
		{
			MelonPrefGiveAmmoWhenEmpty.Value = value;
			GiveAmmoWhenEmpty = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}

		private static void OnInfiniteMags(bool value)
		{
			MelonPrefInfiniteMags.Value = value;
			InfiniteMags = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}

		private static void OnAutoChamber(bool value)
		{
			MelonPrefAutoChamber.Value = value;
			AutoChamber = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}

		private static void OnAutoLoad(bool value)
		{
			MelonPrefAutoLoad.Value = value;
			AutoLoad = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}
	}
	internal static class RagdollLegs
	{
		private static bool _isEnabled;

		private static bool VaultingToggleIsEnabled { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefRagdollLegs { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefRagdollLegs = Main.MelonPrefCategory.CreateEntry<bool>("Vaulting Toggle", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefRagdollLegs != null)
			{
				VaultingToggleIsEnabled = MelonPrefRagdollLegs.Value;
				OnSetEnabled(VaultingToggleIsEnabled);
			}
		}

		public static void BoneMenuCreator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory val = Main.Category.CreateCategory("Ragdoll Legs", "#ffa040");
			val.CreateBoolElement("Mod Toggle", Color.yellow, _isEnabled, (Action<bool>)OnSetEnabled);
		}

		private static void OnSetEnabled(bool value)
		{
			_isEnabled = value;
			if (value)
			{
				Player.physicsRig.PhysicalLegs();
			}
			else
			{
				Player.physicsRig.UnRagdollRig();
			}
		}
	}
	public static class RagdollOnDeath
	{
		private static MelonPreferences_Entry<bool> MelonPrefEnabled { get; set; }

		public static bool RagdollOnDeathIsEnabled { get; private set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefEnabled = Main.MelonPrefCategory.CreateEntry<bool>("RagdollOnDeathIsEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefEnabled != null)
			{
				RagdollOnDeathIsEnabled = MelonPrefEnabled.Value;
			}
		}

		public static void BoneMenuCreator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory val = Main.Category.CreateCategory("Ragdoll On Death", "#00fc82");
			val.CreateBoolElement("Mod Toggle", Color.yellow, RagdollOnDeathIsEnabled, (Action<bool>)OnSetEnabled);
		}

		public static void OnSetEnabled(bool value)
		{
			Player.rigManager.health._testRagdollOnDeath = value;
			RagdollOnDeathIsEnabled = value;
			MelonPrefEnabled.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}
	}
	public static class ReloadOnDeathCustomizer
	{
		public static bool ReloadLevel;

		private static bool _defaultReloadOnDeathSettingValue;

		private static MelonPreferences_Entry<bool> MelonPrefEnabled { get; set; }

		private static bool ReloadOnDeathCustomizerIsEnabled { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefReloadLevelOnDeath { get; set; }

		public static bool IsDefaultSet { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefEnabled = Main.MelonPrefCategory.CreateEntry<bool>("ReloadOnDeathCustomizerIsEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonPrefReloadLevelOnDeath = Main.MelonPrefCategory.CreateEntry<bool>("Reload Level On Death", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefEnabled != null)
			{
				ReloadOnDeathCustomizerIsEnabled = MelonPrefEnabled.Value;
			}
			if (MelonPrefReloadLevelOnDeath != null)
			{
				ReloadLevel = MelonPrefReloadLevelOnDeath.Value;
			}
		}

		public static void BoneMenuCreator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			MenuCategory val = Main.Category.CreateCategory("Reload On Death Customizer", "#ff6f00");
			val.CreateBoolElement("Mod Toggle", Color.yellow, ReloadOnDeathCustomizerIsEnabled, (Action<bool>)OnSetEnabled);
			val.CreateBoolElement("Reload Level On Death", "#ff3700", ReloadLevel, (Action<bool>)ReloadOnDeathSetter);
		}

		public static void ReloadOnDeathSetter(bool value)
		{
			if (!IsDefaultSet)
			{
				_defaultReloadOnDeathSettingValue = Player.rigManager.openControllerRig.playerHealth.reloadLevelOnDeath;
				IsDefaultSet = true;
			}
			if ((Object)(object)Player.rigManager != (Object)null && ReloadOnDeathCustomizerIsEnabled)
			{
				Player.rigManager.openControllerRig.playerHealth.reloadLevelOnDeath = value;
			}
			MelonPrefReloadLevelOnDeath.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}

		private static void OnSetEnabled(bool value)
		{
			ReloadOnDeathCustomizerIsEnabled = value;
			if (!value)
			{
				Player.rigManager.openControllerRig.playerHealth.reloadLevelOnDeath = _defaultReloadOnDeathSettingValue;
			}
			else
			{
				ReloadOnDeathSetter(ReloadLevel);
			}
			MelonPrefEnabled.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}
	}
	[HarmonyPatch(typeof(PhysicsRig), "CheckDangle")]
	public class VaultingToggle
	{
		private static bool VaultingToggleIsEnabled { get; set; }

		private static MelonPreferences_Entry<bool> MelonPrefVaultingToggle { get; set; }

		public static void MelonPreferencesCreator()
		{
			MelonPrefVaultingToggle = Main.MelonPrefCategory.CreateEntry<bool>("Vaulting Toggle", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			if (MelonPrefVaultingToggle != null)
			{
				VaultingToggleIsEnabled = MelonPrefVaultingToggle.Value;
				OnSetEnabled(VaultingToggleIsEnabled);
			}
		}

		public static void BoneMenuCreator()
		{
			MenuCategory val = Main.Category.CreateCategory("Vaulting Toggle", "#7526fc");
			val.CreateBoolElement("Vaulting", "#6d45ff", VaultingToggleIsEnabled, (Action<bool>)OnSetEnabled);
		}

		public static bool Prefix(PhysicsRig __instance, ref bool __result)
		{
			if (!VaultingToggleIsEnabled)
			{
				__result = false;
				return false;
			}
			return true;
		}

		private static void OnSetEnabled(bool value)
		{
			VaultingToggleIsEnabled = value;
			MelonPrefVaultingToggle.Value = value;
			Main.MelonPrefCategory.SaveToFile(false);
		}
	}
}