Decompiled source of MikesTweaks v2.0.2

MikesTweaks.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MikesTweaks.Scripts.Configs;
using MikesTweaks.Scripts.Environment;
using MikesTweaks.Scripts.Input;
using MikesTweaks.Scripts.Inventory;
using MikesTweaks.Scripts.Items;
using MikesTweaks.Scripts.Moons;
using MikesTweaks.Scripts.Networking;
using MikesTweaks.Scripts.Player;
using MikesTweaks.Scripts.Systems;
using MikesTweaks.Scripts.Utilities;
using MikesTweaks.Scripts.World;
using Newtonsoft.Json;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;

[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("MikesTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod for Lethal Company with multiple configurable item weights, item prices, inventory slots amount, inventory/item slot keybinds, flashlight/walkie talkie keybinds, player stamina/sprint values and moons cost to travel to customize your own experience.")]
[assembly: AssemblyFileVersion("2.0.2.0")]
[assembly: AssemblyInformationalVersion("2.0.2")]
[assembly: AssemblyProduct("MikesTweaks")]
[assembly: AssemblyTitle("MikesTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.2.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MikesTweaks
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MikesTweaks";

		public const string PLUGIN_NAME = "MikesTweaks";

		public const string PLUGIN_VERSION = "2.0.2";
	}
}
namespace MikesTweaks.Scripts
{
	[BepInPlugin("mikes.lethalcompany.mikestweaks", "MikesTweaks", "2.0.2")]
	public class MikesTweaks : BaseUnityPlugin
	{
		public static class Compatibility
		{
			public static bool ReservedSlotCoreCompat;

			public static bool ReservedSlotsWalkieCompat;

			public static bool ReservedSlotsFlashlightCompat;

			public static bool LethalThingsCompat;

			public static bool LateGameUpgradesCompat;
		}

		public const string GUID = "mikes.lethalcompany.mikestweaks";

		public const bool DebugMode = false;

		public static ManualLogSource Log;

		public static MikesTweaks Instance { get; private set; }

		public void BindConfig<T>(ref ConfigEntrySettings<T> config, string SectionName)
		{
			config.Entry = ((BaseUnityPlugin)this).Config.Bind<T>(SectionName, config.ConfigName, config.DefaultValue, config.ConfigDesc);
		}

		public void LoadConfigs()
		{
			((BaseUnityPlugin)this).Config.Reload();
			ConfigsSynchronizer.ConfigsReceived = false;
		}

		private void Awake()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			WorldTweaks.RegisterConfigs();
			MoonTweaks.RegisterConfigs();
			PlayerTweaks.RegisterConfigs();
			InventoryTweaks.RegisterConfigs();
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			CheckCompatibilities();
			Harmony val = new Harmony("mikes.lethalcompany.mikestweaks");
			val.PatchAll(typeof(MenuManager_Patches));
			val.PatchAll(typeof(HUDManager_Patches));
			val.PatchAll(typeof(NetworkManager_Patches));
			val.PatchAll(typeof(StartOfRound_Patches));
			val.PatchAll(typeof(TimeOfDay_Patches));
			val.PatchAll(typeof(InteractTrigger_Patches));
			val.PatchAll(typeof(Terminal_Patches));
			val.PatchAll(typeof(PlayerControllerB_Patches));
			val.PatchAll(typeof(GrabbableObject_Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin mikes.lethalcompany.mikestweaks is loaded!");
		}

		private void CheckCompatibilities()
		{
			Compatibility.ReservedSlotCoreCompat = IsModPresent("FlipMods.ReservedItemSlotCore");
			Compatibility.ReservedSlotsWalkieCompat = IsModPresent("FlipMods.ReservedWalkieSlot");
			Compatibility.ReservedSlotsFlashlightCompat = IsModPresent("FlipMods.ReservedFlashlightSlot");
			Compatibility.LethalThingsCompat = IsModPresent("evaisa.lethalthings");
			Compatibility.LateGameUpgradesCompat = IsModPresent("com.malco.lethalcompany.moreshipupgrades");
		}

		public static bool IsModPresent(string name)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				if (name == pluginInfo.Value.Metadata.GUID)
				{
					Log.LogInfo((object)("Found: " + pluginInfo.Value.Metadata.Name));
					return true;
				}
			}
			return false;
		}
	}
}
namespace MikesTweaks.Scripts.World
{
	public class WorldTweaks
	{
		public class Configs
		{
			public static ConfigEntrySettings<float> GlobalTimeSpeedMulti = new ConfigEntrySettings<float>("GlobalTimeSpeedMultiplier", 0.7f, 1.4f, "Think of this as a percentage, the lower it is, the slower the time goes by, the higher it is, the faster time passes.");

			public static ConfigEntrySettings<bool> AllowHotbarKeybinds = new ConfigEntrySettings<bool>("AllowHotbarKeybinds", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the hotbar keybinds and to true if you want them to be able to.");

			public static ConfigEntrySettings<bool> AllowFlashlightKeybind = new ConfigEntrySettings<bool>("AllowFlashlightKeybind", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the Flashlight keybind and to true if you want them to be able to.");

			public static ConfigEntrySettings<bool> AllowWalkieTalkieKeybind = new ConfigEntrySettings<bool>("AllowWalkieTalkieKeybind", defaultValue: true, vanillaValue: false, "Set this to false if you don't want people who join your lobby to be able to use the WalkieTalkie keybind and to true if you want them to be able to.");

			public static ConfigEntrySettings<bool> AllowClientsToUseTerminal = new ConfigEntrySettings<bool>("AllowClientsToUseTerminal", defaultValue: true, vanillaValue: true, "Set this to false if you don't want people who join your lobby to be able to use the terminal and to true if you want them to be able to.\nYou probably want to set this to true if you're hosting a lobby with people you know and trust.");

			public static ConfigEntrySettings<bool> UseVanillaSprintSpeedValues = new ConfigEntrySettings<bool>("UseVanillaSprintSpeedValues", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values tied to sprinting.\nStamina drain related configs not included.");

			public static ConfigEntrySettings<bool> UseVanillaStaminaValues = new ConfigEntrySettings<bool>("UseVanillaStaminaValues", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values tied to stamina.\nSprint speed related configs not included.");

			public static ConfigEntrySettings<bool> UseVanillaToolItemWeights = new ConfigEntrySettings<bool>("UseVanillaToolItemWeights", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the weight of every tool item.");

			public static ConfigEntrySettings<bool> UseVanillaToolItemPrices = new ConfigEntrySettings<bool>("UseVanillaToolItemPrices", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the price of every tool item.");

			public static ConfigEntrySettings<bool> UseVanillaMoonCosts = new ConfigEntrySettings<bool>("UseVanillaMoonCosts", defaultValue: false, vanillaValue: true, "Set this to true if you want to use all the vanilla values for the cost of traveling to the moons.");

			public static string GameRulesSectionHeader => "GameRules";
		}

		public static Terminal TerminalInstance = null;

		public static InteractTrigger TerminalInteractTriggerInstance = null;

		private static readonly MethodInfo TerminalTriggerInUseRPC = typeof(InteractTrigger).GetMethod("UpdateUsedByPlayerServerRpc", BindingFlags.Instance | BindingFlags.NonPublic);

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.GlobalTimeSpeedMulti, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowHotbarKeybinds, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowFlashlightKeybind, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowWalkieTalkieKeybind, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.AllowClientsToUseTerminal, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaSprintSpeedValues, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaStaminaValues, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaToolItemWeights, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaToolItemPrices, Configs.GameRulesSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.UseVanillaMoonCosts, Configs.GameRulesSectionHeader);
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs(TimeOfDay.Instance);
			});
			ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter);
			ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges);
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 9);
		}

		public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			float num = Configs.GlobalTimeSpeedMulti.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			bool flag = Configs.AllowFlashlightKeybind.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.AllowWalkieTalkieKeybind.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.AllowHotbarKeybinds.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.UseVanillaToolItemPrices.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			flag = Configs.UseVanillaMoonCosts.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			return writer;
		}

		public static FastBufferReader ReadConfigChanges(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			float value = default(float);
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.GlobalTimeSpeedMulti.Entry.Value = value;
			bool value2 = default(bool);
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.AllowFlashlightKeybind.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.AllowWalkieTalkieKeybind.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.AllowHotbarKeybinds.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.UseVanillaToolItemPrices.Entry.Value = value2;
			((FastBufferReader)(ref payload)).ReadValue<bool>(ref value2, default(ForPrimitives));
			Configs.UseVanillaMoonCosts.Entry.Value = value2;
			return payload;
		}

		public static void ReapplyConfigs(TimeOfDay timeOfDay)
		{
			timeOfDay.globalTimeSpeedMultiplier = Configs.GlobalTimeSpeedMulti.Value();
		}

		public static bool CanInteractWithTerminal(InteractTrigger __instance)
		{
			if (!NetworkManager.Singleton.IsServer)
			{
				return false;
			}
			if (Configs.AllowClientsToUseTerminal.Value())
			{
				return false;
			}
			return (Object)(object)TerminalInteractTriggerInstance == (Object)(object)__instance;
		}

		public static void MakeTerminalUnusableForAnyoneButHost()
		{
			if (NetworkManager.Singleton.IsServer && !Configs.AllowClientsToUseTerminal.Value())
			{
				object[] parameters = new object[1] { 0 };
				TerminalTriggerInUseRPC.Invoke(TerminalInteractTriggerInstance, parameters);
			}
		}

		public static void ResetValues(InteractTrigger trigger)
		{
			if (trigger.hidePlayerItem && (Object)(object)StartOfRound.Instance.allPlayerScripts[0].currentlyHeldObjectServer != (Object)null)
			{
				StartOfRound.Instance.allPlayerScripts[0].currentlyHeldObjectServer.EnableItemMeshes(true);
				typeof(InteractTrigger).GetField("playerUsingId", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(trigger, -1);
			}
			StartOfRound.Instance.allPlayerScripts[0].currentTriggerInAnimationWith = null;
			trigger.isPlayingSpecialAnimation = false;
		}
	}
}
namespace MikesTweaks.Scripts.Utilities
{
	public static class StringUtils
	{
		public static void RemoveChar(ref string str, char character)
		{
			List<int> list = new List<int>();
			for (int num = str.Length - 1; num >= 0; num--)
			{
				if (str[num] == character)
				{
					list.Add(num);
				}
			}
			for (int i = 0; i < list.Count; i++)
			{
				str = str.Remove(list[i], 1);
			}
		}
	}
}
namespace MikesTweaks.Scripts.Systems
{
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDManager_Patches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake(HUDManager __instance)
		{
			if (NetworkManager.Singleton.IsServer && !MikesTweaks.Compatibility.ReservedSlotCoreCompat && !MikesTweaks.Compatibility.LethalThingsCompat)
			{
				InventoryTweaks.ChangeItemSlotsAmountUI();
			}
		}
	}
	[HarmonyPatch(typeof(IngamePlayerSettings))]
	public class IngamePlayerSettings_Patches
	{
		[HarmonyPatch("RebindKey")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> AllowMouseBinding(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (!(val.opcode != OpCodes.Ldstr) && !((string)val.operand != "Mouse"))
				{
					list.RemoveAt(i + 1);
					list.RemoveAt(i);
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	public class MenuManager_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void MenuManager_Start(MenuManager __instance)
		{
			MikesTweaks.Instance.LoadConfigs();
			CustomNetworking.Instance.UnregisterChannels();
		}
	}
	[HarmonyPatch(typeof(NetworkManager))]
	public static class NetworkManager_Patches
	{
		[HarmonyPatch("StartHost")]
		[HarmonyPostfix]
		private static void StartHost_Post(GameNetworkManager __instance)
		{
			ConfigsSynchronizer.Instance.RegisterMessages();
		}

		[HarmonyPatch("StartClient")]
		[HarmonyPostfix]
		private static void StartClient_Post(GameNetworkManager __instance)
		{
			ConfigsSynchronizer.Instance.RegisterMessages();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class StartOfRound_Patches
	{
		[HarmonyPatch("OnPlayerConnectedClientRpc")]
		[HarmonyPostfix]
		private static void OnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int assignedPlayerObjectId)
		{
			if (!NetworkManager.Singleton.IsServer)
			{
				ConfigsSynchronizer.Instance.RequestConfigs();
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	public class TimeOfDay_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ChangeTimeSpeedMultiplier(TimeOfDay __instance)
		{
			if (NetworkManager.Singleton.IsServer)
			{
				WorldTweaks.ReapplyConfigs(__instance);
			}
		}
	}
}
namespace MikesTweaks.Scripts.Player
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public static class PlayerControllerB_Patches
	{
		private static PlayerInputRedirection inputRedirection;

		public static void SetupKeybinds(PlayerControllerB player)
		{
			if (PlayerTweaks.IsLocallyControlled(player))
			{
				inputRedirection = ((Component)player).gameObject.GetComponent<PlayerInputRedirection>();
				inputRedirection.InitializeKeybinds();
			}
		}

		private static bool InsertStaminaRechargeMovementHinderedWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (instruction.opcode != OpCodes.Ldc_R4)
			{
				return false;
			}
			if (Math.Abs((float)instruction.operand - 0.5f) > 0.01f)
			{
				return false;
			}
			instructions[i - 7] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
			instructions[i - 6] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementHinderedWalking", (Type[])null, (Type[])null);
			instructions[i - 5] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter");
			for (int j = i - 4; j <= i + 6; j++)
			{
				IndexesToRemove.Add(j);
			}
			return true;
		}

		private static bool InsertStaminaRechargeMovementNotHinderedWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (instruction.opcode != OpCodes.Ldc_R4)
			{
				return false;
			}
			if (Math.Abs((float)instruction.operand - 9f) > 0.01f)
			{
				return false;
			}
			instructions[i - 4] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
			instructions[i - 3] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementNotHinderedWalking", (Type[])null, (Type[])null);
			instructions[i - 2] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter");
			for (int j = i - 1; j <= i + 9; j++)
			{
				IndexesToRemove.Add(j);
			}
			return true;
		}

		private static bool InsertStaminaRechargeMovementNotHinderedNotWalking(ref List<CodeInstruction> instructions, CodeInstruction instruction, int i, ref List<int> IndexesToRemove)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			if (instruction.opcode != OpCodes.Ldc_R4)
			{
				return false;
			}
			if (Math.Abs((float)instruction.operand - 4f) > 0.01f)
			{
				return false;
			}
			instructions[i - 4] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
			instructions[i - 3] = CodeInstruction.Call(typeof(PlayerTweaks), "StaminaRechargeMovementNotHinderedNotWalking", (Type[])null, (Type[])null);
			instructions[i - 2] = CodeInstruction.StoreField(typeof(PlayerControllerB), "sprintMeter");
			for (int j = i - 1; j <= i + 9; j++)
			{
				IndexesToRemove.Add(j);
			}
			return true;
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Awake(PlayerControllerB __instance)
		{
			((Component)__instance).gameObject.AddComponent<PlayerInputRedirection>();
			if (NetworkManager.Singleton.IsServer)
			{
				PlayerTweaks.ReapplyConfigs(__instance);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Start(PlayerControllerB __instance)
		{
			PlayerTweaks.RegisterSwitchSlotMessage();
		}

		private static void ModifySprintMultiplierValues(ref List<CodeInstruction> instructions)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Expected O, but got Unknown
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			float num = 2.25f;
			float num2 = 1f;
			float num3 = 1f;
			float num4 = 10f;
			int num5 = -1;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			for (int i = 0; i < instructions.Count; i++)
			{
				CodeInstruction val = instructions[i];
				if (!(val.opcode != OpCodes.Ldc_R4) && !((double)Math.Abs((float)val.operand - num) > 0.1))
				{
					num5 = i;
					instructions[i] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
					instructions.Insert(i, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
					instructions.Insert(i, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
					instructions.Insert(i, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
					instructions.Insert(i, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "MaxSprintSpeed", false));
					break;
				}
			}
			if (num5 == -1)
			{
				return;
			}
			for (int j = num5; j < instructions.Count; j++)
			{
				CodeInstruction val2 = instructions[j];
				if (val2.opcode == OpCodes.Ldc_R4)
				{
					if (flag2 && flag3 && flag)
					{
						break;
					}
					if (!flag && (double)Math.Abs((float)val2.operand - num2) < 0.1)
					{
						instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
						instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
						instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "SprintSpeedIncreasePerFrame", false));
						flag = true;
					}
					else if (!flag2 && (double)Math.Abs((float)val2.operand - num3) < 0.1)
					{
						instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
						instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
						instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "DefaultSprintSpeed", false));
						flag2 = true;
					}
					else if (!flag3 && (double)Math.Abs((float)val2.operand - num4) < 0.1)
					{
						instructions[j] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
						instructions.Insert(j, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
						instructions.Insert(j, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaSprintSpeedValues", false));
						instructions.Insert(j, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "SprintSpeedDecreasePerFrame", false));
						flag3 = true;
					}
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> instructions2 = new List<CodeInstruction>(instructions);
			ModifySprintMultiplierValues(ref instructions2);
			return instructions2.AsEnumerable();
		}

		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void AddHotkeys(PlayerControllerB __instance)
		{
			SetupKeybinds(__instance);
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			if (MikesTweaks.Compatibility.LateGameUpgradesCompat)
			{
				return instructions;
			}
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			List<int> IndexesToRemove = new List<int>();
			List<CodeInstruction> instructions2 = new List<CodeInstruction>(instructions);
			for (int i = 0; i < instructions2.Count; i++)
			{
				CodeInstruction instruction = instructions2[i];
				if (!flag)
				{
					flag = InsertStaminaRechargeMovementHinderedWalking(ref instructions2, instruction, i, ref IndexesToRemove);
				}
				if (!flag3)
				{
					flag3 = InsertStaminaRechargeMovementNotHinderedNotWalking(ref instructions2, instruction, i, ref IndexesToRemove);
				}
				if (!flag2)
				{
					flag2 = InsertStaminaRechargeMovementNotHinderedWalking(ref instructions2, instruction, i, ref IndexesToRemove);
				}
				if (flag && flag3 && flag2)
				{
					break;
				}
			}
			IndexesToRemove.Sort();
			for (int num = IndexesToRemove.Count - 1; num >= 0; num--)
			{
				instructions2.RemoveAt(IndexesToRemove[num]);
			}
			return instructions2.AsEnumerable();
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> ModifyJumpDrain(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			if (MikesTweaks.Compatibility.LateGameUpgradesCompat)
			{
				return instructions;
			}
			float num = 0.08f;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (!(val.opcode != OpCodes.Ldc_R4) && !(Math.Abs((float)val.operand - num) > 0.01f))
				{
					list[i] = CodeInstruction.Call(typeof(ConfigEntrySettings<float>), "Value", (Type[])null, (Type[])null);
					list.Insert(i, CodeInstruction.Call(typeof(ConfigEntrySettings<bool>), "Value", (Type[])null, (Type[])null));
					list.Insert(i, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null));
					list.Insert(i, CodeInstruction.LoadField(typeof(WorldTweaks.Configs), "UseVanillaStaminaValues", false));
					list.Insert(i, CodeInstruction.LoadField(typeof(PlayerTweaks.Configs), "JumpStaminaDrain", false));
					break;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch("Emote1_performed")]
		[HarmonyPrefix]
		private static bool Emote1_performed()
		{
			return false;
		}

		[HarmonyPatch("Emote2_performed")]
		[HarmonyPrefix]
		private static bool Emote2_performed()
		{
			return false;
		}

		[HarmonyPatch("SendNewPlayerValuesClientRpc")]
		[HarmonyPostfix]
		private static void ConnectClientToPlayerObject(PlayerControllerB __instance)
		{
			WorldTweaks.MakeTerminalUnusableForAnyoneButHost();
		}

		[HarmonyPatch("OnEnable")]
		[HarmonyPostfix]
		private static void OnEnable(PlayerControllerB __instance)
		{
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection?.OnEnable();
			}
		}

		[HarmonyPatch("OnDisable")]
		[HarmonyPostfix]
		private static void OnDisable(PlayerControllerB __instance)
		{
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection?.OnDisable();
			}
		}

		[HarmonyPatch("OnDestroy")]
		[HarmonyPrefix]
		public static void OnDestroy(PlayerControllerB __instance)
		{
			if (PlayerTweaks.IsLocallyControlled(__instance))
			{
				inputRedirection?.Destroy();
				inputRedirection = null;
			}
		}
	}
	public class PlayerInputRedirection : MonoBehaviour, MikesTweaksPlayerInput.IHotbarActions, MikesTweaksPlayerInput.IEmotesActions, MikesTweaksPlayerInput.IActionsActions
	{
		private PlayerControllerB owner;

		private MikesTweaksPlayerInput input;

		private MethodInfo SwitchToSlotMethod;

		private WalkieTalkie WalkieTalkieToStop;

		private FlashlightItem FlashlightToStop;

		public void OnHotbar1(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(0);
			}
		}

		public void OnHotbar2(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(1);
			}
		}

		public void OnHotbar3(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(2);
			}
		}

		public void OnHotbar4(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				RequestSlotChange(3);
			}
		}

		public void OnHotbar5(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(4))
			{
				RequestSlotChange(4);
			}
		}

		public void OnHotbar6(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(5))
			{
				RequestSlotChange(5);
			}
		}

		public void OnHotbar7(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(6))
			{
				RequestSlotChange(6);
			}
		}

		public void OnHotbar8(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(7))
			{
				RequestSlotChange(7);
			}
		}

		public void OnHotbar9(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3 && InventoryTweaks.HasEnoughSlots(8))
			{
				RequestSlotChange(8);
			}
		}

		public void OnEmote1(CallbackContext context)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB obj = owner;
			if (obj != null)
			{
				obj.PerformEmote(context, 1);
			}
		}

		public void OnEmote2(CallbackContext context)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB obj = owner;
			if (obj != null)
			{
				obj.PerformEmote(context, 2);
			}
		}

		public void OnFlashlightToggle(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)((CallbackContext)(ref context)).phase == 3)
			{
				ToggleFlashlight();
			}
		}

		public void OnWalkieTalkieSpeak(CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			InputActionPhase phase = ((CallbackContext)(ref context)).phase;
			if ((int)phase != 3)
			{
				if ((int)phase == 4)
				{
					StopUsingWalkieTalkie();
				}
			}
			else
			{
				UseWalkieTalkie();
			}
		}

		public void OnEnable()
		{
			input?.Enable();
		}

		public void OnDisable()
		{
			input?.Disable();
		}

		public void Destroy()
		{
			input?.Dispose();
		}

		public void InitializeKeybinds()
		{
			owner = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			input = new MikesTweaksPlayerInput();
			input.Hotbar.SetCallbacks(this);
			input.Emotes.SetCallbacks(this);
			input.Actions.SetCallbacks(this);
			input.Enable();
			SetupKeybinds();
		}

		public void SetupKeybinds()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			BindingSyntax val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar1, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[0].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar2, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[1].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar3, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[2].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar4, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[3].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar5, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[4].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar6, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[5].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar7, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[6].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar8, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[7].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Hotbar.Hotbar9, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.SlotKeybinds[8].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Emotes.Emote1, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.EmoteKeybinds[0].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Emotes.Emote2, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.EmoteKeybinds[1].Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Actions.FlashlightToggle, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.FlashlightKeybind.Value());
			val = InputActionSetupExtensions.ChangeBinding(input.Actions.WalkieTalkieSpeak, 0);
			((BindingSyntax)(ref val)).WithPath(PlayerTweaks.Configs.WalkieTalkieKeybind.Value());
		}

		private void FindBestFlashlight(ref FlashlightItem BestFlashlight, ref List<FlashlightItem> Flashlights)
		{
			foreach (FlashlightItem Flashlight in Flashlights)
			{
				if ((Object)(object)BestFlashlight == (Object)null)
				{
					BestFlashlight = Flashlight;
				}
				else if (((GrabbableObject)Flashlight).insertedBattery.charge > ((GrabbableObject)BestFlashlight).insertedBattery.charge && ((GrabbableObject)Flashlight).insertedBattery.charge > 0f)
				{
					BestFlashlight = Flashlight;
				}
			}
		}

		private void UseSelectedFlashlight(ref FlashlightItem Flashlight, ref FieldInfo timeSinceSwitchingSlots)
		{
			bool isPocketed = ((GrabbableObject)Flashlight).isPocketed;
			((GrabbableObject)Flashlight).UseItemOnClient(true);
			timeSinceSwitchingSlots.SetValue(owner, 0f);
			FlashlightToStop = Flashlight;
			if (isPocketed)
			{
				((GrabbableObject)Flashlight).playerHeldBy.ChangeHelmetLight(Flashlight.flashlightTypeID, ((GrabbableObject)Flashlight).isBeingUsed);
				((GrabbableObject)Flashlight).PocketItem();
			}
		}

		private void ToggleFlashlight()
		{
			if ((!NetworkManager.Singleton.IsServer && !ConfigsSynchronizer.ConfigsReceived) || !WorldTweaks.Configs.AllowFlashlightKeybind.Value() || MikesTweaks.Compatibility.ReservedSlotsFlashlightCompat || !PlayerTweaks.CanUseItem(owner))
			{
				return;
			}
			FieldInfo timeSinceSwitchingSlots = typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic);
			if ((float)timeSinceSwitchingSlots.GetValue(owner) < 0.075f)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)FlashlightToStop) && (Object)(object)((GrabbableObject)FlashlightToStop).playerHeldBy == (Object)(object)owner && FlashlightToStop.flashlightTypeID == 0 && ((GrabbableObject)FlashlightToStop).insertedBattery.charge > 0f)
			{
				UseSelectedFlashlight(ref FlashlightToStop, ref timeSinceSwitchingSlots);
				return;
			}
			FlashlightItem val = null;
			List<FlashlightItem> Flashlights = new List<FlashlightItem>();
			List<FlashlightItem> Flashlights2 = new List<FlashlightItem>();
			GrabbableObject[] itemSlots = owner.ItemSlots;
			foreach (GrabbableObject obj in itemSlots)
			{
				val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null);
				if (!((Object)(object)val == (Object)null))
				{
					switch (val.flashlightTypeID)
					{
					case 0:
						Flashlights.Add(val);
						break;
					case 1:
						Flashlights2.Add(val);
						break;
					}
				}
			}
			val = null;
			FindBestFlashlight(ref val, ref Flashlights);
			if ((Object)(object)val != (Object)null)
			{
				UseSelectedFlashlight(ref val, ref timeSinceSwitchingSlots);
				return;
			}
			if (Object.op_Implicit((Object)(object)FlashlightToStop) && (Object)(object)((GrabbableObject)FlashlightToStop).playerHeldBy == (Object)(object)owner && FlashlightToStop.flashlightTypeID == 1 && ((GrabbableObject)FlashlightToStop).insertedBattery.charge > 0f)
			{
				UseSelectedFlashlight(ref FlashlightToStop, ref timeSinceSwitchingSlots);
				return;
			}
			FindBestFlashlight(ref val, ref Flashlights2);
			if ((Object)(object)val != (Object)null)
			{
				UseSelectedFlashlight(ref val, ref timeSinceSwitchingSlots);
			}
		}

		private void UseWalkieTalkie()
		{
			if ((!NetworkManager.Singleton.IsServer && !ConfigsSynchronizer.ConfigsReceived) || !WorldTweaks.Configs.AllowWalkieTalkieKeybind.Value() || MikesTweaks.Compatibility.ReservedSlotsWalkieCompat || !PlayerTweaks.CanUseItem(owner))
			{
				return;
			}
			FieldInfo field = typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic);
			if ((float)field.GetValue(owner) < 0.075f)
			{
				return;
			}
			WalkieTalkie val = null;
			List<WalkieTalkie> list = new List<WalkieTalkie>();
			GrabbableObject[] itemSlots = owner.ItemSlots;
			foreach (GrabbableObject obj in itemSlots)
			{
				val = (WalkieTalkie)(object)((obj is WalkieTalkie) ? obj : null);
				if (!((Object)(object)val == (Object)null))
				{
					list.Add(val);
				}
			}
			val = null;
			foreach (WalkieTalkie item in list)
			{
				if ((Object)(object)val == (Object)null)
				{
					val = item;
				}
				else if (((GrabbableObject)item).isBeingUsed && !(((GrabbableObject)item).insertedBattery.charge <= ((GrabbableObject)val).insertedBattery.charge))
				{
					val = item;
				}
			}
			if (!((Object)(object)val == (Object)null))
			{
				((GrabbableObject)val).UseItemOnClient(true);
				field.SetValue(owner, 0f);
				WalkieTalkieToStop = val;
			}
		}

		private void StopUsingWalkieTalkie()
		{
			if (Object.op_Implicit((Object)(object)WalkieTalkieToStop) && !((Object)(object)((GrabbableObject)WalkieTalkieToStop).playerHeldBy != (Object)(object)owner))
			{
				((GrabbableObject)WalkieTalkieToStop).UseItemOnClient(false);
			}
		}

		private void Awake()
		{
			owner = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			SwitchToSlotMethod = typeof(PlayerControllerB).GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
		}

		private void RequestSlotChange(int slot)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerTweaks.CanSwitchSlot(owner) && WorldTweaks.Configs.AllowHotbarKeybinds.Value())
			{
				SwitchToSlot(slot);
				typeof(PlayerControllerB).GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(owner, 0f);
				CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref slot, default(ForPrimitives));
				customMessagingManager.SendNamedMessage(PlayerTweaks.PlayerSwitchSlotRequestChannel, 0uL, val, (NetworkDelivery)2);
			}
		}

		public void SwitchToSlot(int slot)
		{
			ShipBuildModeManager.Instance.CancelBuildMode(true);
			_ = owner.currentItemSlot;
			owner.playerBodyAnimator.SetBool("GrabValidated", false);
			object[] parameters = new object[2] { slot, null };
			SwitchToSlotMethod.Invoke(owner, parameters);
		}
	}
	public class PlayerTweaks
	{
		public static class Configs
		{
			public static ConfigEntrySettings<float> MaxStamina = new ConfigEntrySettings<float>("MaxStamina", 15f, 11f, "This is the maximum amount of time you can run.\nThe higher the number, the longer you can run for.");

			public static ConfigEntrySettings<float> DefaultSprintSpeed = new ConfigEntrySettings<float>("DefaultSprintSpeed", 1.5f, 1f, "This is the floor of your sprint speed.\nEvery frame your sprint speed decreases when you don't run and this is as low as it can go.");

			public static ConfigEntrySettings<float> SprintSpeedIncreasePerFrame = new ConfigEntrySettings<float>("SprintSpeedIncreasePerFrame", 1f, 1f, "The higher this value is, the faster your sprint speed reaches the maximum sprint speed.\nYour sprint speed increments every frame you're running.");

			public static ConfigEntrySettings<float> SprintSpeedDecreasePerFrame = new ConfigEntrySettings<float>("SprintSpeedDecreasePerFrame", 10f, 10f, "The higher this value is, the faster your sprint speed goes to the default sprint speed.\nYour sprint speed decrements every frame you're not running.");

			public static ConfigEntrySettings<float> MaxSprintSpeed = new ConfigEntrySettings<float>("MaxSprintSpeed", 3f, 2.25f, "This is your sprint speed ceiling.\nEvery frame your sprint speed increases and this is how high it can go.");

			public static ConfigEntrySettings<float> StaminaRechargePerFrame = new ConfigEntrySettings<float>("StaminaRechargePerFrame", 5f, 1f, "The bigger number this is the faster your stamina recharges.");

			public static ConfigEntrySettings<float> StaminaWeightWhileWalking = new ConfigEntrySettings<float>("StaminaWeightWhileWalking", 9f, 9f, "The bigger number this is, the slower your stamina recharges while walking.");

			public static ConfigEntrySettings<float> StaminaWeightWhileStandingStill = new ConfigEntrySettings<float>("StaminaWeightWhileStandingStill", 4f, 4f, "The bigger number this is, the slower your stamina recharges while standing still");

			public static ConfigEntrySettings<float> JumpStaminaDrain = new ConfigEntrySettings<float>("JumpStaminaDrain", 0.04f, 0.08f, "The lower this amount is, the less stamina jumping drains.\n");

			public static ConfigEntrySettings<string>[] SlotKeybinds = new ConfigEntrySettings<string>[9]
			{
				new ConfigEntrySettings<string>("Slot1", "<Keyboard>/1", ""),
				new ConfigEntrySettings<string>("Slot2", "<Keyboard>/2", ""),
				new ConfigEntrySettings<string>("Slot3", "<Keyboard>/3", ""),
				new ConfigEntrySettings<string>("Slot4", "<Keyboard>/4", ""),
				new ConfigEntrySettings<string>("Slot5", "<Keyboard>/5", ""),
				new ConfigEntrySettings<string>("Slot6", "<Keyboard>/6", ""),
				new ConfigEntrySettings<string>("Slot7", "<Keyboard>/7", ""),
				new ConfigEntrySettings<string>("Slot8", "<Keyboard>/8", ""),
				new ConfigEntrySettings<string>("Slot9", "<Keyboard>/9", "")
			};

			public static ConfigEntrySettings<string>[] EmoteKeybinds = new ConfigEntrySettings<string>[2]
			{
				new ConfigEntrySettings<string>("Emote1", "<Keyboard>/y", "<Keyboard>/1"),
				new ConfigEntrySettings<string>("Emote2", "<Keyboard>/u", "<Keyboard>/2")
			};

			public static ConfigEntrySettings<string> FlashlightKeybind = new ConfigEntrySettings<string>("Flashlight", "<Keyboard>/f", "");

			public static ConfigEntrySettings<string> WalkieTalkieKeybind = new ConfigEntrySettings<string>("WalkieTalkieKeybind", "<Keyboard>/r", "");

			public static string PlayerTweaksSectionHeader => "PlayerTweaks";

			public static string KeybindsSectionHeader => "Keybinds";
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Func<FastBufferWriter, FastBufferWriter> <0>__WriteConfigsToWriter;

			public static Func<FastBufferReader, FastBufferReader> <1>__ReadConfigChanges;

			public static HandleNamedMessageDelegate <2>__ReceiveSwitchSlot;

			public static HandleNamedMessageDelegate <3>__ReceiveSwitchSlotRequest;
		}

		public static PlayerControllerB LocalPlayerController => GameNetworkManager.Instance.localPlayerController;

		public static string PlayerSwitchSlotChannel => "PlayerChangeSlot";

		public static string PlayerSwitchSlotRequestChannel => "PlayerChangeSlotRequest";

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.MaxStamina, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.DefaultSprintSpeed, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.SprintSpeedIncreasePerFrame, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.SprintSpeedDecreasePerFrame, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.MaxSprintSpeed, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.StaminaRechargePerFrame, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.StaminaWeightWhileWalking, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.StaminaWeightWhileStandingStill, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.JumpStaminaDrain, Configs.PlayerTweaksSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.FlashlightKeybind, Configs.KeybindsSectionHeader);
			MikesTweaks.Instance.BindConfig(ref Configs.WalkieTalkieKeybind, Configs.KeybindsSectionHeader);
			for (int i = 0; i < Configs.SlotKeybinds.Length; i++)
			{
				MikesTweaks.Instance.BindConfig(ref Configs.SlotKeybinds[i], Configs.KeybindsSectionHeader);
			}
			for (int j = 0; j < Configs.EmoteKeybinds.Length; j++)
			{
				MikesTweaks.Instance.BindConfig(ref Configs.EmoteKeybinds[j], Configs.KeybindsSectionHeader);
			}
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs(LocalPlayerController, applyToAllPlayers: true, force: true, updateHud: true);
			});
			ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter);
			ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges);
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 36);
		}

		public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			float num = Configs.DefaultSprintSpeed.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.SprintSpeedIncreasePerFrame.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.SprintSpeedDecreasePerFrame.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.MaxSprintSpeed.Value(WorldTweaks.Configs.UseVanillaSprintSpeedValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.MaxStamina.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.StaminaWeightWhileWalking.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.StaminaWeightWhileStandingStill.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			num = Configs.JumpStaminaDrain.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref num, default(ForPrimitives));
			return writer;
		}

		public static FastBufferReader ReadConfigChanges(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			float value = default(float);
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.DefaultSprintSpeed.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.SprintSpeedIncreasePerFrame.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.SprintSpeedDecreasePerFrame.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.MaxSprintSpeed.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.MaxStamina.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.StaminaRechargePerFrame.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.StaminaWeightWhileWalking.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.StaminaWeightWhileStandingStill.Entry.Value = value;
			((FastBufferReader)(ref payload)).ReadValue<float>(ref value, default(ForPrimitives));
			Configs.JumpStaminaDrain.Entry.Value = value;
			return payload;
		}

		public static void ReapplyConfigs(PlayerControllerB player, bool applyToAllPlayers = false, bool force = false, bool updateHud = false)
		{
			float sprintTime = player.sprintTime;
			int num = player.ItemSlots.Length;
			player.sprintTime = Configs.MaxStamina.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value());
			if (MikesTweaks.Compatibility.ReservedSlotCoreCompat || MikesTweaks.Compatibility.LethalThingsCompat)
			{
				return;
			}
			if (!applyToAllPlayers)
			{
				InventoryTweaks.ChangeItemSlotsAmount(player, force);
			}
			else
			{
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				for (int i = 0; i < allPlayerScripts.Length; i++)
				{
					InventoryTweaks.ChangeItemSlotsAmount(allPlayerScripts[i], force);
				}
			}
			if (updateHud)
			{
				InventoryTweaks.ChangeItemSlotsAmountUI();
			}
		}

		public static void RegisterSwitchSlotMessage()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			CustomNetworking instance = CustomNetworking.Instance;
			string playerSwitchSlotChannel = PlayerSwitchSlotChannel;
			object obj = <>O.<2>__ReceiveSwitchSlot;
			if (obj == null)
			{
				HandleNamedMessageDelegate val = ReceiveSwitchSlot;
				<>O.<2>__ReceiveSwitchSlot = val;
				obj = (object)val;
			}
			instance.RegisterChannel(playerSwitchSlotChannel, (HandleNamedMessageDelegate)obj);
			CustomNetworking instance2 = CustomNetworking.Instance;
			string playerSwitchSlotRequestChannel = PlayerSwitchSlotRequestChannel;
			object obj2 = <>O.<3>__ReceiveSwitchSlotRequest;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = ReceiveSwitchSlotRequest;
				<>O.<3>__ReceiveSwitchSlotRequest = val2;
				obj2 = (object)val2;
			}
			instance2.RegisterChannel(playerSwitchSlotRequestChannel, (HandleNamedMessageDelegate)obj2);
		}

		public static void SwitchSlot_Server(int slot, ulong clientIDOfChangedSlot)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref slot, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientIDOfChangedSlot, default(ForPrimitives));
				customMessagingManager.SendNamedMessageToAll(PlayerSwitchSlotChannel, val, (NetworkDelivery)2);
			}
		}

		public static void ReceiveSwitchSlotRequest(ulong senderID, FastBufferReader payload)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				int slot = default(int);
				((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref slot, default(ForPrimitives));
				SwitchSlot_Server(slot, senderID);
			}
		}

		public static void ReceiveSwitchSlot(ulong senderID, FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			int slot = default(int);
			((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref slot, default(ForPrimitives));
			ulong num = default(ulong);
			((FastBufferReader)(ref payload)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.actualClientId == num)
				{
					((Component)val).gameObject.GetComponent<PlayerInputRedirection>().SwitchToSlot(slot);
					break;
				}
			}
		}

		public static float StaminaRechargeMovementHinderedWalking(PlayerControllerB player, float num2)
		{
			return Mathf.Clamp(player.sprintMeter - Time.deltaTime / player.sprintTime * num2 * 0.5f, 0f, 1f);
		}

		public static float StaminaRechargeMovementNotHinderedWalking(PlayerControllerB player, float num2)
		{
			return Mathf.Clamp(player.sprintMeter + Time.deltaTime * Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()) / (player.sprintTime + Configs.StaminaWeightWhileWalking.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value())) * num2, 0f, 1f);
		}

		public static float StaminaRechargeMovementNotHinderedNotWalking(PlayerControllerB player, float num2)
		{
			return Mathf.Clamp(player.sprintMeter + Time.deltaTime * Configs.StaminaRechargePerFrame.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value()) / (player.sprintTime + Configs.StaminaWeightWhileStandingStill.Value(WorldTweaks.Configs.UseVanillaStaminaValues.Value())) * num2, 0f, 1f);
		}

		public static bool IsLocallyControlled(PlayerControllerB player)
		{
			return (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController;
		}

		public static bool CanSwitchSlot(PlayerControllerB player)
		{
			Type typeFromHandle = typeof(PlayerControllerB);
			bool flag = (bool)typeFromHandle.GetField("throwingObject", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(player);
			float num = (float)typeFromHandle.GetField("timeSinceSwitchingSlots", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(player);
			if (((!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || (((NetworkBehaviour)player).IsServer && !player.isHostPlayerObject)) && !player.isTestingPlayer) || num < 0.3f || player.isGrabbingObjectAnimation || player.inSpecialInteractAnimation || flag || player.isTypingChat || player.twoHanded || player.activatingItem || player.jetpackControls || player.disablingJetpackControls)
			{
				return false;
			}
			return true;
		}

		public static bool CanUseItem(PlayerControllerB player)
		{
			bool flag = true;
			if ((Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				flag = player.currentlyHeldObjectServer.itemProperties.usableInSpecialAnimations;
			}
			if (((((NetworkBehaviour)player).IsOwner && player.isPlayerControlled && (!((NetworkBehaviour)player).IsServer || player.isHostPlayerObject)) || player.isTestingPlayer) && !player.quickMenuManager.isMenuOpen && !player.isPlayerDead)
			{
				if (!flag)
				{
					if (!player.isGrabbingObjectAnimation && !player.inTerminalMenu && !player.isTypingChat)
					{
						if (player.inSpecialInteractAnimation)
						{
							return player.inShockingMinigame;
						}
						return true;
					}
					return false;
				}
				return true;
			}
			return false;
		}
	}
}
namespace MikesTweaks.Scripts.Moons
{
	public class MoonTweaks
	{
		public static class Configs
		{
			public static readonly Dictionary<string, int> DefaultMoonCosts = new Dictionary<string, int>
			{
				{ "Experimentation", 0 },
				{ "Assurance", 0 },
				{ "Vow", 0 },
				{ "Offense", 0 },
				{ "March", 0 },
				{ "Rend", 550 },
				{ "Dine", 600 },
				{ "Titan", 700 }
			};

			public static ConfigEntrySettings<string> MoonPrices = new ConfigEntrySettings<string>("MoonPrices", JsonConvert.SerializeObject((object)DefaultMoonCosts), JsonConvert.SerializeObject((object)DefaultMoonCosts), "To change the cost to go to a planet you can change the amount corresponding to the moon you want to modify.\nYou can also modify the cost of moons from different mods here, by just adding another entry anywhere in the dictionary with the planet's name and the cost you want it to be\nThe value is a json string which is why you see \\ everywhere before \".\nTo add another moon, just add , after Titan's value and write it like so \\\"MoonName\\\":Value");

			public static Dictionary<string, int> MoonPricesDeserialized;

			public static string MoonPricesHeader => "MoonPrices";

			public static int MoonPricesSize => FastBufferWriter.GetWriteSize<byte>(ConfigsSynchronizer.ToBytes(JsonConvert.SerializeObject((object)MoonPricesDeserialized)), -1, 0);
		}

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.MoonPrices, Configs.MoonPricesHeader);
			((BaseUnityPlugin)MikesTweaks.Instance).Config.ConfigReloaded += delegate
			{
				ReadMoonPrices();
				ApplyVanillaMoonCosts(ref Configs.MoonPricesDeserialized, WorldTweaks.Configs.UseVanillaMoonCosts.Value());
			};
			ReadMoonPrices();
			ApplyVanillaMoonCosts(ref Configs.MoonPricesDeserialized, WorldTweaks.Configs.UseVanillaMoonCosts.Value());
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs(WorldTweaks.TerminalInstance);
			});
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => Configs.MoonPricesSize);
			ConfigsSynchronizer.Instance.AddConfigGetter(SendConfigs);
			ConfigsSynchronizer.Instance.AddConfigSetter(OnConfigsReceived);
		}

		public static FastBufferWriter SendConfigs(FastBufferWriter writer)
		{
			//IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = ConfigsSynchronizer.ToBytes(JsonConvert.SerializeObject((object)Configs.MoonPricesDeserialized));
			((FastBufferWriter)(ref writer)).WriteValueSafe<byte>(array, default(ForPrimitives));
			return writer;
		}

		public static FastBufferReader OnConfigsReceived(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			byte[] bytes = default(byte[]);
			((FastBufferReader)(ref payload)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives));
			Configs.MoonPricesDeserialized = JsonConvert.DeserializeObject<Dictionary<string, int>>((string)ConfigsSynchronizer.ToObject(bytes));
			return payload;
		}

		public static void ReapplyConfigs(Terminal terminal)
		{
			if (!Object.op_Implicit((Object)(object)terminal))
			{
				return;
			}
			TerminalKeyword val = Array.Find(terminal.terminalNodes.allKeywords, (TerminalKeyword keyword) => ((Object)keyword).name == "Route");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>(Configs.MoonPricesDeserialized);
			CompatibleNoun[] compatibleNouns = val.compatibleNouns;
			foreach (CompatibleNoun val2 in compatibleNouns)
			{
				foreach (KeyValuePair<string, int> item in dictionary)
				{
					if (!((Object)val2.noun).name.Contains(item.Key))
					{
						continue;
					}
					val2.result.itemCost = item.Value;
					CompatibleNoun[] terminalOptions = val2.result.terminalOptions;
					foreach (CompatibleNoun val3 in terminalOptions)
					{
						if (!((Object)val3.noun).name.ToLower().Contains("deny"))
						{
							val3.result.itemCost = item.Value;
							break;
						}
					}
					dictionary.Remove(item.Key);
					break;
				}
			}
		}

		private static void ApplyVanillaMoonCosts(ref Dictionary<string, int> MoonCosts, bool vanilla)
		{
			if (!vanilla)
			{
				return;
			}
			foreach (KeyValuePair<string, int> defaultMoonCost in Configs.DefaultMoonCosts)
			{
				MoonCosts[defaultMoonCost.Key] = defaultMoonCost.Value;
			}
		}

		private static void ReadMoonPrices()
		{
			Configs.MoonPricesDeserialized = JsonConvert.DeserializeObject<Dictionary<string, int>>(Configs.MoonPrices.Value());
		}
	}
}
namespace MikesTweaks.Scripts.Items
{
	[HarmonyPatch(typeof(GrabbableObject))]
	public class GrabbableObject_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void ChangeTerminalItemWeights(GrabbableObject __instance)
		{
			if (NetworkManager.Singleton.IsServer || ConfigsSynchronizer.ConfigsReceived)
			{
				InventoryTweaks.ModifyItemWeight(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class Terminal_Patches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start(Terminal __instance)
		{
			if (NetworkManager.Singleton.IsServer)
			{
				MoonTweaks.ReapplyConfigs(__instance);
				InventoryTweaks.ApplyItemPrices(__instance);
			}
		}
	}
}
namespace MikesTweaks.Scripts.Inventory
{
	public class InventoryTweaks
	{
		public static class Configs
		{
			public static ConfigEntrySettings<int> ExtraItemSlotsAmount = new ConfigEntrySettings<int>("ExtraItemSlots", 2, 0, "This increases how many slots you have.\n0 Slots means you have the default 4 from the vanilla game, if you increase this number you get additional slots in addition to the original 4.");

			public static ConfigEntrySettings<int>[] ToolItemWeights = new ConfigEntrySettings<int>[13]
			{
				new ConfigEntrySettings<int>("WalkieTalkieWeight", 0, 0),
				new ConfigEntrySettings<int>("FlashlightWeight", 0, 0),
				new ConfigEntrySettings<int>("ShovelWeight", 5, 18),
				new ConfigEntrySettings<int>("LockPickerWeight", 2, 15),
				new ConfigEntrySettings<int>("ProFlashlightWeight", 0, 5),
				new ConfigEntrySettings<int>("StunGrenadeWeight", 2, 5),
				new ConfigEntrySettings<int>("BoomboxWeight", 5, 15),
				new ConfigEntrySettings<int>("TZPInhalantWeight", 0, 0),
				new ConfigEntrySettings<int>("ZapGunWeight", 4, 10),
				new ConfigEntrySettings<int>("JetpackWeight", 10, 50),
				new ConfigEntrySettings<int>("ExtensionLadderWeight", 0, 0),
				new ConfigEntrySettings<int>("RadarBoosterWeight", 5, 18),
				new ConfigEntrySettings<int>("SprayPaintWeight", 1, 1)
			};

			public static ConfigEntrySettings<int>[] ToolItemPrices = new ConfigEntrySettings<int>[13]
			{
				new ConfigEntrySettings<int>("WalkieTalkiePrice", 12, 12),
				new ConfigEntrySettings<int>("FlashlightPrice", 15, 15),
				new ConfigEntrySettings<int>("ShovelPrice", 30, 30),
				new ConfigEntrySettings<int>("LockPickerPrice", 20, 20),
				new ConfigEntrySettings<int>("ProFlashlightPrice", 25, 25),
				new ConfigEntrySettings<int>("StunGrenadePrice", 30, 30),
				new ConfigEntrySettings<int>("BoomboxPrice", 60, 60),
				new ConfigEntrySettings<int>("TZPInhalantPrice", 120, 120),
				new ConfigEntrySettings<int>("ZapGunPrice", 400, 400),
				new ConfigEntrySettings<int>("JetpackPrice", 700, 700),
				new ConfigEntrySettings<int>("ExtensionLadderPrice", 60, 60),
				new ConfigEntrySettings<int>("RadarBoosterPrice", 60, 60),
				new ConfigEntrySettings<int>("SprayPaintPrice", 50, 50)
			};

			public static string InventoryTweaksSectionHeader => "InventoryTweaks";

			public static string TerminalItemProperties => "TerminalItemProperties";
		}

		public static void RegisterConfigs()
		{
			MikesTweaks.Instance.BindConfig(ref Configs.ExtraItemSlotsAmount, Configs.InventoryTweaksSectionHeader);
			for (int i = 0; i < Configs.ToolItemWeights.Length; i++)
			{
				MikesTweaks.Instance.BindConfig(ref Configs.ToolItemWeights[i], Configs.TerminalItemProperties);
				MikesTweaks.Instance.BindConfig(ref Configs.ToolItemPrices[i], Configs.TerminalItemProperties);
			}
			ConfigsSynchronizer.OnConfigsChangedDelegate = (Action)Delegate.Combine(ConfigsSynchronizer.OnConfigsChangedDelegate, (Action)delegate
			{
				ReapplyConfigs();
				ApplyItemPrices(WorldTweaks.TerminalInstance);
			});
			ConfigsSynchronizer.Instance.AddConfigGetter(WriteConfigsToWriter);
			ConfigsSynchronizer.Instance.AddConfigSetter(ReadConfigChanges);
			ConfigsSynchronizer.Instance.AddConfigSizeGetter(() => 4 + 4 * Configs.ToolItemWeights.Length + 4 * Configs.ToolItemPrices.Length);
		}

		public static FastBufferWriter WriteConfigsToWriter(FastBufferWriter writer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			int num = Configs.ExtraItemSlotsAmount.Value();
			((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num, default(ForPrimitives));
			ConfigEntrySettings<int>[] toolItemWeights = Configs.ToolItemWeights;
			foreach (ConfigEntrySettings<int> configEntrySettings in toolItemWeights)
			{
				int num2 = configEntrySettings.Value(WorldTweaks.Configs.UseVanillaToolItemWeights.Value());
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num2, default(ForPrimitives));
			}
			toolItemWeights = Configs.ToolItemPrices;
			foreach (ConfigEntrySettings<int> configEntrySettings2 in toolItemWeights)
			{
				int num2 = configEntrySettings2.Value(WorldTweaks.Configs.UseVanillaToolItemPrices.Value());
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref num2, default(ForPrimitives));
			}
			return writer;
		}

		public static FastBufferReader ReadConfigChanges(FastBufferReader payload)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			int value = default(int);
			((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives));
			Configs.ExtraItemSlotsAmount.Entry.Value = value;
			ConfigEntrySettings<int>[] toolItemWeights = Configs.ToolItemWeights;
			foreach (ConfigEntrySettings<int> obj in toolItemWeights)
			{
				((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives));
				obj.Entry.Value = value;
			}
			toolItemWeights = Configs.ToolItemPrices;
			foreach (ConfigEntrySettings<int> obj2 in toolItemWeights)
			{
				((FastBufferReader)(ref payload)).ReadValueSafe<int>(ref value, default(ForPrimitives));
				obj2.Entry.Value = value;
			}
			return payload;
		}

		public static bool HasEnoughSlots(int slotID)
		{
			return PlayerTweaks.LocalPlayerController.ItemSlots.Length - (slotID + 1) > -1;
		}

		public static void ChangeItemSlotsAmount(PlayerControllerB __instance, bool force = false)
		{
			if (force || Configs.ExtraItemSlotsAmount.Value() != 0)
			{
				List<GrabbableObject> list = new List<GrabbableObject>(__instance.ItemSlots);
				__instance.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[4 + Configs.ExtraItemSlotsAmount.Value()];
				for (int i = 0; i < list.Count; i++)
				{
					__instance.ItemSlots[i] = list[i];
				}
			}
		}

		public static void ReapplyConfigs()
		{
			GrabbableObject[] array = Resources.FindObjectsOfTypeAll<GrabbableObject>();
			for (int i = 0; i < array.Length; i++)
			{
				ModifyItemWeight(array[i]);
			}
			ApplyItemPrices(WorldTweaks.TerminalInstance);
		}

		public static void ApplyItemPrices(Terminal terminal)
		{
			if (!Object.op_Implicit((Object)(object)terminal))
			{
				return;
			}
			TerminalKeyword val = Array.Find(terminal.terminalNodes.allKeywords, (TerminalKeyword keyword) => ((Object)keyword).name.ToLower() == "buy");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			bool vanilla = WorldTweaks.Configs.UseVanillaToolItemPrices.Value();
			CompatibleNoun[] compatibleNouns = val.compatibleNouns;
			foreach (CompatibleNoun val2 in compatibleNouns)
			{
				ConfigEntrySettings<int>[] toolItemPrices = Configs.ToolItemPrices;
				foreach (ConfigEntrySettings<int> configEntrySettings in toolItemPrices)
				{
					string str = ((Object)val2.noun).name.ToLower();
					StringUtils.RemoveChar(ref str, ' ');
					if (!configEntrySettings.ConfigName.ToLower().Contains(str))
					{
						continue;
					}
					val2.result.itemCost = configEntrySettings.Value(vanilla);
					terminal.buyableItemsList[val2.result.buyItemIndex].creditsWorth = configEntrySettings.Value(vanilla);
					CompatibleNoun[] terminalOptions = val2.result.terminalOptions;
					foreach (CompatibleNoun val3 in terminalOptions)
					{
						if (!((Object)val3.noun).name.ToLower().Contains("deny"))
						{
							val3.result.itemCost = configEntrySettings.Value(vanilla);
							break;
						}
					}
					break;
				}
			}
		}

		public static void ModifyItemWeight(GrabbableObject item)
		{
			if (!((Object)(object)item == (Object)null))
			{
				string itemName = ((Object)item.itemProperties).name.ToLower();
				StringUtils.RemoveChar(ref itemName, ' ');
				int num = Array.FindIndex(Configs.ToolItemWeights, (ConfigEntrySettings<int> config) => config.ConfigName.ToLower().Contains(itemName));
				if (num != -1)
				{
					item.itemProperties.weight = (float)Configs.ToolItemWeights[num].Value(WorldTweaks.Configs.UseVanillaToolItemWeights.Value()) / 100f + 1f;
				}
			}
		}

		public static void ChangeItemSlotsAmountUI()
		{
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: 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)
			if (Configs.ExtraItemSlotsAmount.Value() == 0)
			{
				return;
			}
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory");
			List<string> list = new List<string> { "Slot0", "Slot1", "Slot2", "Slot3" };
			for (int i = 0; i < val.transform.childCount; i++)
			{
				Transform child = val.transform.GetChild(i);
				if (!list.Contains(((Object)((Component)child).gameObject).name))
				{
					Object.Destroy((Object)(object)((Component)child).gameObject);
				}
			}
			Image[] array = (Image[])(object)new Image[4 + Configs.ExtraItemSlotsAmount.Value()];
			array[0] = HUDManager.Instance.itemSlotIconFrames[0];
			array[1] = HUDManager.Instance.itemSlotIconFrames[1];
			array[2] = HUDManager.Instance.itemSlotIconFrames[2];
			array[3] = HUDManager.Instance.itemSlotIconFrames[3];
			Image[] array2 = (Image[])(object)new Image[4 + Configs.ExtraItemSlotsAmount.Value()];
			array2[0] = HUDManager.Instance.itemSlotIcons[0];
			array2[1] = HUDManager.Instance.itemSlotIcons[1];
			array2[2] = HUDManager.Instance.itemSlotIcons[2];
			array2[3] = HUDManager.Instance.itemSlotIcons[3];
			GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory/Slot3");
			GameObject val3 = val2;
			for (int j = 0; j < Configs.ExtraItemSlotsAmount.Value(); j++)
			{
				GameObject val4 = Object.Instantiate<GameObject>(val2);
				((Object)val4).name = $"Slot{3 + (j + 1)}";
				val4.transform.parent = val.transform;
				Vector3 localPosition = val3.transform.localPosition;
				val4.transform.SetLocalPositionAndRotation(new Vector3(localPosition.x + 50f, localPosition.y, localPosition.z), val3.transform.localRotation);
				val3 = val4;
				array[3 + (j + 1)] = val4.GetComponent<Image>();
				array2[3 + (j + 1)] = ((Component)val4.transform.GetChild(0)).GetComponent<Image>();
			}
			HUDManager.Instance.itemSlotIconFrames = array;
			HUDManager.Instance.itemSlotIcons = array2;
		}
	}
}
namespace MikesTweaks.Scripts.Input
{
	public class MikesTweaksPlayerInput : IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable, IDisposable
	{
		public struct HotbarActions
		{
			private MikesTweaksPlayerInput m_Wrapper;

			public InputAction Hotbar1 => m_Wrapper.m_Hotbar_Hotbar1;

			public InputAction Hotbar2 => m_Wrapper.m_Hotbar_Hotbar2;

			public InputAction Hotbar3 => m_Wrapper.m_Hotbar_Hotbar3;

			public InputAction Hotbar4 => m_Wrapper.m_Hotbar_Hotbar4;

			public InputAction Hotbar5 => m_Wrapper.m_Hotbar_Hotbar5;

			public InputAction Hotbar6 => m_Wrapper.m_Hotbar_Hotbar6;

			public InputAction Hotbar7 => m_Wrapper.m_Hotbar_Hotbar7;

			public InputAction Hotbar8 => m_Wrapper.m_Hotbar_Hotbar8;

			public InputAction Hotbar9 => m_Wrapper.m_Hotbar_Hotbar9;

			public bool enabled => Get().enabled;

			public HotbarActions(MikesTweaksPlayerInput wrapper)
			{
				m_Wrapper = wrapper;
			}

			public InputActionMap Get()
			{
				return m_Wrapper.m_Hotbar;
			}

			public void Enable()
			{
				Get().Enable();
			}

			public void Disable()
			{
				Get().Disable();
			}

			public static implicit operator InputActionMap(HotbarActions set)
			{
				return set.Get();
			}

			public void AddCallbacks(IHotbarActions instance)
			{
				if (instance != null && !m_Wrapper.m_HotbarActionsCallbackInterfaces.Contains(instance))
				{
					m_Wrapper.m_HotbarActionsCallbackInterfaces.Add(instance);
					Hotbar1.started += instance.OnHotbar1;
					Hotbar1.performed += instance.OnHotbar1;
					Hotbar1.canceled += instance.OnHotbar1;
					Hotbar2.started += instance.OnHotbar2;
					Hotbar2.performed += instance.OnHotbar2;
					Hotbar2.canceled += instance.OnHotbar2;
					Hotbar3.started += instance.OnHotbar3;
					Hotbar3.performed += instance.OnHotbar3;
					Hotbar3.canceled += instance.OnHotbar3;
					Hotbar4.started += instance.OnHotbar4;
					Hotbar4.performed += instance.OnHotbar4;
					Hotbar4.canceled += instance.OnHotbar4;
					Hotbar5.started += instance.OnHotbar5;
					Hotbar5.performed += instance.OnHotbar5;
					Hotbar5.canceled += instance.OnHotbar5;
					Hotbar6.started += instance.OnHotbar6;
					Hotbar6.performed += instance.OnHotbar6;
					Hotbar6.canceled += instance.OnHotbar6;
					Hotbar7.started += instance.OnHotbar7;
					Hotbar7.performed += instance.OnHotbar7;
					Hotbar7.canceled += instance.OnHotbar7;
					Hotbar8.started += instance.OnHotbar8;
					Hotbar8.performed += instance.OnHotbar8;
					Hotbar8.canceled += instance.OnHotbar8;
					Hotbar9.started += instance.OnHotbar9;
					Hotbar9.performed += instance.OnHotbar9;
					Hotbar9.canceled += instance.OnHotbar9;
				}
			}

			private void UnregisterCallbacks(IHotbarActions instance)
			{
				Hotbar1.started -= instance.OnHotbar1;
				Hotbar1.performed -= instance.OnHotbar1;
				Hotbar1.canceled -= instance.OnHotbar1;
				Hotbar2.started -= instance.OnHotbar2;
				Hotbar2.performed -= instance.OnHotbar2;
				Hotbar2.canceled -= instance.OnHotbar2;
				Hotbar3.started -= instance.OnHotbar3;
				Hotbar3.performed -= instance.OnHotbar3;
				Hotbar3.canceled -= instance.OnHotbar3;
				Hotbar4.started -= instance.OnHotbar4;
				Hotbar4.performed -= instance.OnHotbar4;
				Hotbar4.canceled -= instance.OnHotbar4;
				Hotbar5.started -= instance.OnHotbar5;
				Hotbar5.performed -= instance.OnHotbar5;
				Hotbar5.canceled -= instance.OnHotbar5;
				Hotbar6.started -= instance.OnHotbar6;
				Hotbar6.performed -= instance.OnHotbar6;
				Hotbar6.canceled -= instance.OnHotbar6;
				Hotbar7.started -= instance.OnHotbar7;
				Hotbar7.performed -= instance.OnHotbar7;
				Hotbar7.canceled -= instance.OnHotbar7;
				Hotbar8.started -= instance.OnHotbar8;
				Hotbar8.performed -= instance.OnHotbar8;
				Hotbar8.canceled -= instance.OnHotbar8;
				Hotbar9.started -= instance.OnHotbar9;
				Hotbar9.performed -= instance.OnHotbar9;
				Hotbar9.canceled -= instance.OnHotbar9;
			}

			public void RemoveCallbacks(IHotbarActions instance)
			{
				if (m_Wrapper.m_HotbarActionsCallbackInterfaces.Remove(instance))
				{
					UnregisterCallbacks(instance);
				}
			}

			public void SetCallbacks(IHotbarActions instance)
			{
				foreach (IHotbarActions hotbarActionsCallbackInterface in m_Wrapper.m_HotbarActionsCallbackInterfaces)
				{
					UnregisterCallbacks(hotbarActionsCallbackInterface);
				}
				m_Wrapper.m_HotbarActionsCallbackInterfaces.Clear();
				AddCallbacks(instance);
			}
		}

		public struct EmotesActions
		{
			private MikesTweaksPlayerInput m_Wrapper;

			public InputAction Emote1 => m_Wrapper.m_Emotes_Emote1;

			public InputAction Emote2 => m_Wrapper.m_Emotes_Emote2;

			public bool enabled => Get().enabled;

			public EmotesActions(MikesTweaksPlayerInput wrapper)
			{
				m_Wrapper = wrapper;
			}

			public InputActionMap Get()
			{
				return m_Wrapper.m_Emotes;
			}

			public void Enable()
			{
				Get().Enable();
			}

			public void Disable()
			{
				Get().Disable();
			}

			public static implicit operator InputActionMap(EmotesActions set)
			{
				return set.Get();
			}

			public void AddCallbacks(IEmotesActions instance)
			{
				if (instance != null && !m_Wrapper.m_EmotesActionsCallbackInterfaces.Contains(instance))
				{
					m_Wrapper.m_EmotesActionsCallbackInterfaces.Add(instance);
					Emote1.started += instance.OnEmote1;
					Emote1.performed += instance.OnEmote1;
					Emote1.canceled += instance.OnEmote1;
					Emote2.started += instance.OnEmote2;
					Emote2.performed += instance.OnEmote2;
					Emote2.canceled += instance.OnEmote2;
				}
			}

			private void UnregisterCallbacks(IEmotesActions instance)
			{
				Emote1.started -= instance.OnEmote1;
				Emote1.performed -= instance.OnEmote1;
				Emote1.canceled -= instance.OnEmote1;
				Emote2.started -= instance.OnEmote2;
				Emote2.performed -= instance.OnEmote2;
				Emote2.canceled -= instance.OnEmote2;
			}

			public void RemoveCallbacks(IEmotesActions instance)
			{
				if (m_Wrapper.m_EmotesActionsCallbackInterfaces.Remove(instance))
				{
					UnregisterCallbacks(instance);
				}
			}

			public void SetCallbacks(IEmotesActions instance)
			{
				foreach (IEmotesActions emotesActionsCallbackInterface in m_Wrapper.m_EmotesActionsCallbackInterfaces)
				{
					UnregisterCallbacks(emotesActionsCallbackInterface);
				}
				m_Wrapper.m_EmotesActionsCallbackInterfaces.Clear();
				AddCallbacks(instance);
			}
		}

		public struct ActionsActions
		{
			private MikesTweaksPlayerInput m_Wrapper;

			public InputAction FlashlightToggle => m_Wrapper.m_Actions_FlashlightToggle;

			public InputAction WalkieTalkieSpeak => m_Wrapper.m_Actions_WalkieTalkieSpeak;

			public bool enabled => Get().enabled;

			public ActionsActions(MikesTweaksPlayerInput wrapper)
			{
				m_Wrapper = wrapper;
			}

			public InputActionMap Get()
			{
				return m_Wrapper.m_Actions;
			}

			public void Enable()
			{
				Get().Enable();
			}

			public void Disable()
			{
				Get().Disable();
			}

			public static implicit operator InputActionMap(ActionsActions set)
			{
				return set.Get();
			}

			public void AddCallbacks(IActionsActions instance)
			{
				if (instance != null && !m_Wrapper.m_ActionsActionsCallbackInterfaces.Contains(instance))
				{
					m_Wrapper.m_ActionsActionsCallbackInterfaces.Add(instance);
					FlashlightToggle.started += instance.OnFlashlightToggle;
					FlashlightToggle.performed += instance.OnFlashlightToggle;
					FlashlightToggle.canceled += instance.OnFlashlightToggle;
					WalkieTalkieSpeak.started += instance.OnWalkieTalkieSpeak;
					WalkieTalkieSpeak.performed += instance.OnWalkieTalkieSpeak;
					WalkieTalkieSpeak.canceled += instance.OnWalkieTalkieSpeak;
				}
			}

			private void UnregisterCallbacks(IActionsActions instance)
			{
				FlashlightToggle.started -= instance.OnFlashlightToggle;
				FlashlightToggle.performed -= instance.OnFlashlightToggle;
				FlashlightToggle.canceled -= instance.OnFlashlightToggle;
				WalkieTalkieSpeak.started -= instance.OnWalkieTalkieSpeak;
				WalkieTalkieSpeak.performed -= instance.OnWalkieTalkieSpeak;
				WalkieTalkieSpeak.canceled -= instance.OnWalkieTalkieSpeak;
			}

			public void RemoveCallbacks(IActionsActions instance)
			{
				if (m_Wrapper.m_ActionsActionsCallbackInterfaces.Remove(instance))
				{
					UnregisterCallbacks(instance);
				}
			}

			public void SetCallbacks(IActionsActions instance)
			{
				foreach (IActionsActions actionsActionsCallbackInterface in m_Wrapper.m_ActionsActionsCallbackInterfaces)
				{
					UnregisterCallbacks(actionsActionsCallbackInterface);
				}
				m_Wrapper.m_ActionsActionsCallbackInterfaces.Clear();
				AddCallbacks(instance);
			}
		}

		public interface IHotbarActions
		{
			void OnHotbar1(CallbackContext context);

			void OnHotbar2(CallbackContext context);

			void OnHotbar3(CallbackContext context);

			void OnHotbar4(CallbackContext context);

			void OnHotbar5(CallbackContext context);

			void OnHotbar6(CallbackContext context);

			void OnHotbar7(CallbackContext context);

			void OnHotbar8(CallbackContext context);

			void OnHotbar9(CallbackContext context);
		}

		public interface IEmotesActions
		{
			void OnEmote1(CallbackContext context);

			void OnEmote2(CallbackContext context);
		}

		public interface IActionsActions
		{
			void OnFlashlightToggle(CallbackContext context);

			void OnWalkieTalkieSpeak(CallbackContext context);
		}

		private readonly InputActionMap m_Hotbar;

		private List<IHotbarActions> m_HotbarActionsCallbackInterfaces = new List<IHotbarActions>();

		private readonly InputAction m_Hotbar_Hotbar1;

		private readonly InputAction m_Hotbar_Hotbar2;

		private readonly InputAction m_Hotbar_Hotbar3;

		private readonly InputAction m_Hotbar_Hotbar4;

		private readonly InputAction m_Hotbar_Hotbar5;

		private readonly InputAction m_Hotbar_Hotbar6;

		private readonly InputAction m_Hotbar_Hotbar7;

		private readonly InputAction m_Hotbar_Hotbar8;

		private readonly InputAction m_Hotbar_Hotbar9;

		private readonly InputActionMap m_Emotes;

		private List<IEmotesActions> m_EmotesActionsCallbackInterfaces = new List<IEmotesActions>();

		private readonly InputAction m_Emotes_Emote1;

		private readonly InputAction m_Emotes_Emote2;

		private readonly InputActionMap m_Actions;

		private List<IActionsActions> m_ActionsActionsCallbackInterfaces = new List<IActionsActions>();

		private readonly InputAction m_Actions_FlashlightToggle;

		private readonly InputAction m_Actions_WalkieTalkieSpeak;

		public InputActionAsset asset { get; }

		public InputBinding? bindingMask
		{
			get
			{
				return asset.bindingMask;
			}
			set
			{
				asset.bindingMask = value;
			}
		}

		public ReadOnlyArray<InputDevice>? devices
		{
			get
			{
				return asset.devices;
			}
			set
			{
				asset.devices = value;
			}
		}

		public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;

		public IEnumerable<InputBinding> bindings => asset.bindings;

		public HotbarActions Hotbar => new HotbarActions(this);

		public EmotesActions Emotes => new EmotesActions(this);

		public ActionsActions Actions => new ActionsActions(this);

		public MikesTweaksPlayerInput()
		{
			asset = InputActionAsset.FromJson("{\r\n    \"name\": \"MikesTweaksPlayerInput\",\r\n    \"maps\": [\r\n        {\r\n            \"name\": \"Hotbar\",\r\n            \"id\": \"acedaef2-b06f-4287-a2ed-00f0260b63da\",\r\n            \"actions\": [\r\n                {\r\n                    \"name\": \"Hotbar1\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"afdaf0de-d9cb-4835-93df-06ff8a407e18\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar2\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"1cf91964-9e69-4db5-90ae-65b813acbceb\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar3\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"9787ab53-1dcb-439c-91cb-683e0e6e0fc2\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar4\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"a63eb6ea-bced-4246-a625-439815fb3c86\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar5\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"8810962b-a9c4-4244-9202-05886a4dd217\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar6\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"4e4ccd85-b20d-422d-836a-6c30d64e8ada\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar7\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"cc6d7e8c-4c89-4a7f-8f69-07d40af41569\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar8\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"71e7f8d9-ddd6-45de-acdb-0e427b5cf883\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                },\r\n                {\r\n                    \"name\": \"Hotbar9\",\r\n                    \"type\": \"Button\",\r\n                    \"id\": \"9f3aee6a-4474-4e45-895f-4384d31e2651\",\r\n                    \"expectedControlType\": \"Button\",\r\n                    \"processors\": \"\",\r\n                    \"interactions\": \"\",\r\n                    \"initialStateCheck\": false\r\n                }\r\n            ],\r\n            \"bindings\": [\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"75fed245-d23a-4c28-842f-5f5c2e244087\",\r\n                    \"path\": \"<Keyboard>/1\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar1\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"e3020d01-d049-4c17-98a4-c8e7b52e6f7e\",\r\n                    \"path\": \"<Keyboard>/2\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar2\",\r\n                    \"isComposite\": false,\r\n                    \"isPartOfComposite\": false\r\n                },\r\n                {\r\n                    \"name\": \"\",\r\n                    \"id\": \"fd0c3e9e-f967-4970-91eb-611774d404f3\",\r\n                    \"path\": \"<Keyboard>/3\",\r\n                    \"interactions\": \"\",\r\n                    \"processors\": \"\",\r\n                    \"groups\": \"\",\r\n                    \"action\": \"Hotbar3\",\r\n                    \"is