Decompiled source of EmployeeBenefits v1.3.0

plugins/EmployeeBenefits/aj.QuickSlots.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using QuickSlots.Configuration;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering;
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("aj.QuickSlots")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0")]
[assembly: AssemblyProduct("EmployeeBenefits")]
[assembly: AssemblyTitle("aj.QuickSlots")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was created with the assistance of generative AI (code); see the README credits for which assets.")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")]
[assembly: AssemblyVersion("1.3.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 QuickSlots
{
	[HarmonyPatch]
	internal static class Burst
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__Received;
		}

		private const string Message = "EmployeeBenefits.Burst";

		private const int PuffCount = 22;

		private const int JetCount = 6;

		private const float PuffSpeedMin = 1f;

		private const float PuffSpeedMax = 3f;

		private const float PuffLifeMin = 0.9f;

		private const float PuffLifeMax = 1.4f;

		private const float PuffSizeMin = 0.16f;

		private const float PuffSizeMax = 0.32f;

		private const float PuffGrowth = 4f;

		private const float PuffAlphaMin = 0.32f;

		private const float PuffAlphaMax = 0.52f;

		private const float PuffSpin = 70f;

		private const float PuffWander = 0.35f;

		private const float JetSpeed = 7f;

		private const float JetLife = 0.12f;

		private const float JetSize = 0.05f;

		private const float JetStretch = 2f;

		private const float JetAlpha = 0.22f;

		private static readonly Color SmokeColour = new Color(0.92f, 0.93f, 0.95f);

		private const float ConeAngle = 62f;

		private const float ConeRadius = 0.14f;

		private const float FeetHeight = 0.15f;

		private const float Lifetime = 2f;

		private const float Volume = 0.75f;

		private const float HearingDistance = 22f;

		private const float ClipSeconds = 0.42f;

		private static AudioClip? clip;

		private static Material? material;

		private static bool lookedForMaterial;

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void Listen()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			NetworkManager singleton = NetworkManager.Singleton;
			CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null);
			if (val != null)
			{
				val.UnregisterNamedMessageHandler("EmployeeBenefits.Burst");
				object obj = <>O.<0>__Received;
				if (obj == null)
				{
					HandleNamedMessageDelegate val2 = Received;
					<>O.<0>__Received = val2;
					obj = (object)val2;
				}
				val.RegisterNamedMessageHandler("EmployeeBenefits.Burst", (HandleNamedMessageDelegate)obj);
			}
		}

		internal static void Send(PlayerControllerB player)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			Vector3 position = ((Component)player).transform.position;
			Play(position);
			NetworkManager net = NetworkManager.Singleton;
			if ((Object)(object)net == (Object)null || !net.IsListening || net.CustomMessagingManager == null)
			{
				return;
			}
			int id = (int)player.playerClientId;
			if (net.IsServer)
			{
				foreach (ulong item in net.ConnectedClientsIds.Where((ulong c) => c != net.LocalClientId))
				{
					Write(item, id, position);
				}
				return;
			}
			Write(0uL, id, position);
		}

		private static void Received(ulong sender, FastBufferReader reader)
		{
			//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)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			int id = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref id, default(ForPrimitives));
			Vector3 val = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref val);
			NetworkManager net = NetworkManager.Singleton;
			if (net.IsServer)
			{
				foreach (ulong item in net.ConnectedClientsIds.Where((ulong c) => c != net.LocalClientId && c != sender))
				{
					Write(item, id, val);
				}
			}
			Play(val);
		}

		private unsafe static void Write(ulong to, int id, Vector3 at)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(32, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref id, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe(ref at);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("EmployeeBenefits.Burst", to, val, (NetworkDelivery)0);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose();
			}
		}

		internal static void Play(Vector3 feet)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			GameObject val = new GameObject("EmployeeBenefitsBurst");
			val.transform.position = feet + Vector3.up * 0.15f;
			val.transform.rotation = Quaternion.LookRotation(Vector3.down);
			AddPuff(val);
			AddJets(val);
			AudioSource obj = val.AddComponent<AudioSource>();
			obj.spatialBlend = 1f;
			obj.rolloffMode = (AudioRolloffMode)1;
			obj.maxDistance = 22f;
			obj.PlayOneShot(Clip(), 0.75f);
			Object.Destroy((Object)val, 2f);
		}

		private static void AddPuff(GameObject root)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0038: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_0204: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = NewSystem(root, "Puff", 22, (ParticleSystemRenderMode)0);
			MainModule main = val.main;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.9f, 1.4f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(1f, 3f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.16f, 0.32f);
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
			((MainModule)(ref main)).startColor = new MinMaxGradient(Faded(0.32f), Faded(0.52f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.06f);
			LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val.limitVelocityOverLifetime;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(0.3f);
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.12f;
			RotationOverLifetimeModule rotationOverLifetime = val.rotationOverLifetime;
			((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
			((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-1.2217305f, 1.2217305f);
			NoiseModule noise = val.noise;
			((NoiseModule)(ref noise)).enabled = true;
			((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.35f);
			((NoiseModule)(ref noise)).frequency = 0.8f;
			((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.4f);
			SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			AnimationCurve val2 = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 1f, 0f, 9f),
				new Keyframe(0.35f, 2.8f),
				new Keyframe(1f, 4f)
			});
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val2);
			Fade(val, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.08f),
				new GradientAlphaKey(0.55f, 0.45f),
				new GradientAlphaKey(0f, 1f)
			});
		}

		private static void AddJets(GameObject root)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0053: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem obj = NewSystem(root, "Jets", 6, (ParticleSystemRenderMode)1);
			MainModule main = obj.main;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.12f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(7f);
			((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.05f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Faded(0.22f));
			ParticleSystemRenderer component = ((Component)obj).GetComponent<ParticleSystemRenderer>();
			component.lengthScale = 2f;
			component.velocityScale = 0.02f;
			Fade(obj, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0f, 1f)
			});
		}

		private static Color Faded(float alpha)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			return new Color(SmokeColour.r, SmokeColour.g, SmokeColour.b, alpha);
		}

		private static void Fade(ParticleSystem ps, GradientAlphaKey[] alpha)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_001e: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, alpha);
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val);
		}

		private static ParticleSystem NewSystem(GameObject root, string name, int count, ParticleSystemRenderMode mode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0029: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_007c: 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_008c: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(root.transform, false);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).duration = 0.1f;
			((MainModule)(ref main)).loop = false;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
			{
				new Burst(0f, (short)count)
			});
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = 62f;
			((ShapeModule)(ref shape)).radius = 0.14f;
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			component.renderMode = mode;
			((Renderer)component).material = FindMaterial();
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			val2.Play();
			return val2;
		}

		private static Material? FindMaterial()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			if (lookedForMaterial)
			{
				return material;
			}
			lookedForMaterial = true;
			List<ParticleSystemRenderer> source = (from r in Resources.FindObjectsOfTypeAll<ParticleSystemRenderer>()
				where (Object)(object)((Renderer)r).sharedMaterial != (Object)null && (Object)(object)((Renderer)r).sharedMaterial.shader != (Object)null
				select r).ToList();
			string[] array = new string[6] { "steam", "smoke", "dust", "puff", "cloud", "fog" };
			foreach (string want in array)
			{
				ParticleSystemRenderer val = ((IEnumerable<ParticleSystemRenderer>)source).FirstOrDefault((Func<ParticleSystemRenderer, bool>)((ParticleSystemRenderer r) => ((Object)((Renderer)r).sharedMaterial).name.ToLowerInvariant().Contains(want)));
				if ((Object)(object)val != (Object)null)
				{
					material = new Material(((Renderer)val).sharedMaterial)
					{
						name = "EmployeeBenefitsBurst"
					};
					Plugin.Logger.LogInfo((object)("Burst material from '" + ((Object)((Renderer)val).sharedMaterial).name + "' (" + ((Object)((Renderer)val).sharedMaterial.shader).name + ") on " + ((Object)val).name));
					return material;
				}
			}
			Plugin.Logger.LogWarning((object)"No smoke particle material found; the burst uses the default.");
			return null;
		}

		private static AudioClip Clip()
		{
			if ((Object)(object)clip != (Object)null)
			{
				return clip;
			}
			int num = 18522;
			float[] array = new float[num];
			Random random = new Random(7);
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num5 = (float)i / 44100f;
				float num6 = (float)(random.NextDouble() * 2.0 - 1.0);
				float num7 = Mathf.Lerp(8000f, 3000f, num5 / 0.42f);
				float num8 = Mathf.Exp(MathF.PI * -2f * num7 / 44100f);
				num2 = num2 * num8 + num6 * (1f - num8);
				float num9 = Mathf.Exp(-0.07123793f);
				num3 = num3 * num9 + num2 * (1f - num9);
				float num10 = Mathf.Min(1f, num5 / 0.004f) * Mathf.Exp((0f - num5) / 0.09f);
				array[i] = (num2 - num3) * num10;
				num4 = Mathf.Max(num4, Mathf.Abs(array[i]));
			}
			for (int j = 0; j < num; j++)
			{
				array[j] *= 0.85f / Mathf.Max(num4, 0.0001f);
			}
			clip = AudioClip.Create("EmployeeBenefitsPssht", num, 1, 44100, false);
			clip.SetData(array, 0);
			return clip;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class DoubleJump
	{
		private static readonly Func<PlayerControllerB, bool> IsPlayerNearGround = AccessTools.MethodDelegate<Func<PlayerControllerB, bool>>(AccessTools.Method(typeof(PlayerControllerB), "IsPlayerNearGround", (Type[])null, (Type[])null), (object)null, true);

		private static readonly Action<PlayerControllerB> PlayJumpAudio = AccessTools.MethodDelegate<Action<PlayerControllerB>>(AccessTools.Method(typeof(PlayerControllerB), "PlayJumpAudio", (Type[])null, (Type[])null), (object)null, true);

		private static readonly Action<PlayerControllerB> PlayerHitGroundEffects = AccessTools.MethodDelegate<Action<PlayerControllerB>>(AccessTools.Method(typeof(PlayerControllerB), "PlayerHitGroundEffects", (Type[])null, (Type[])null), (object)null, true);

		private static readonly FieldRef<PlayerControllerB, bool> IsJumping = AccessTools.FieldRefAccess<PlayerControllerB, bool>("isJumping");

		private static readonly FieldRef<PlayerControllerB, Coroutine?> JumpCoroutine = AccessTools.FieldRefAccess<PlayerControllerB, Coroutine>("jumpCoroutine");

		private const float MostSinking = 0.73f;

		private static float readyAt;

		private static bool usedThisFall;

		internal static bool Enabled => Plugin.BoundConfig.DoubleJump.Value;

		internal static float Recharge => Plugin.BoundConfig.DoubleJumpRecharge.Value;

		internal static float Charge
		{
			get
			{
				if (!(Recharge <= 0f))
				{
					return Mathf.Clamp01(1f - (readyAt - Time.time) / Recharge);
				}
				return 1f;
			}
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyPrefix]
		private static bool JumpPressed(PlayerControllerB __instance, CallbackContext context)
		{
			if (!((CallbackContext)(ref context)).performed || !Enabled || __instance.thisController.isGrounded || IsPlayerNearGround(__instance) || !CanJumpInAir(__instance) || usedThisFall || Time.time < readyAt)
			{
				return true;
			}
			Jump(__instance);
			return false;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Landed(PlayerControllerB __instance)
		{
			if (usedThisFall && ((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && __instance.thisController.isGrounded)
			{
				usedThisFall = false;
			}
		}

		private static bool CanJumpInAir(PlayerControllerB p)
		{
			if (((NetworkBehaviour)p).IsOwner && p.isPlayerControlled && (!((NetworkBehaviour)p).IsServer || p.isHostPlayerObject) && !p.isPlayerDead && !p.quickMenuManager.isMenuOpen && !p.isTypingChat && !p.inTerminalMenu && !p.inSpecialInteractAnimation && !p.isClimbingLadder && !p.jetpackControls && !p.isUnderwater && p.sinkingValue < 0.73f)
			{
				return !IsJumping.Invoke(p);
			}
			return false;
		}

		internal static void Jump(PlayerControllerB p)
		{
			usedThisFall = true;
			readyAt = Time.time + Recharge;
			if (JumpCoroutine.Invoke(p) != null)
			{
				((MonoBehaviour)p).StopCoroutine(JumpCoroutine.Invoke(p));
			}
			p.fallValue = p.jumpForce;
			p.fallValueUncapped = p.jumpForce;
			p.takingFallDamage = false;
			p.isFallingNoJump = false;
			p.isFallingFromJump = true;
			p.playerBodyAnimator.SetBool("Jumping", true);
			JumpCoroutine.Invoke(p) = ((MonoBehaviour)p).StartCoroutine(Land(p));
			PlayJumpAudio(p);
			if (StartOfRound.Instance.connectedPlayersAmount != 0)
			{
				p.PlayerJumpedServerRpc();
			}
			Burst.Send(p);
		}

		private static IEnumerator Land(PlayerControllerB p)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)p == (Object)null || p.thisController.isGrounded));
			if (!((Object)(object)p == (Object)null))
			{
				p.playerBodyAnimator.SetBool("Jumping", false);
				p.isFallingFromJump = false;
				PlayerHitGroundEffects(p);
				JumpCoroutine.Invoke(p) = null;
			}
		}

		internal static void Refill()
		{
			readyAt = Time.time;
			usedThisFall = false;
		}
	}
	[HarmonyPatch]
	internal class JumpMeter : MonoBehaviour
	{
		private static readonly string[] IconRows = new string[16]
		{
			"................", ".......##.......", "......#..#......", ".....#....#.....", "....#......#....", ".......##.......", "......#..#......", ".....#....#.....", "....#......#....", "................",
			"....####........", "....#..#........", "....#..#####....", "....#......##...", "....#########...", "................"
		};

		private const float IconSize = 16f;

		private const float BarWidth = 28f;

		private const float BarHeight = 2f;

		private const float BarGap = 3f;

		private const float Below = 5f;

		private const float DimAlpha = 0.35f;

		private const float TrackAlpha = 0.15f;

		private const float FillAlpha = 0.6f;

		private const float PulseSeconds = 0.35f;

		private const float PulseScale = 1.3f;

		private static Sprite? iconSprite;

		private Image sprintMeter;

		private RectTransform? weight;

		private Image icon;

		private Image track;

		private Image fill;

		private RectTransform iconRect;

		private RectTransform fillRect;

		private Color tint;

		private float lastCharge = 1f;

		private float pulse;

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void Attach(PlayerControllerB __instance)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Image sprintMeterUI = __instance.sprintMeterUI;
			if (!((Object)(object)sprintMeterUI == (Object)null) && !((Object)(object)((Component)sprintMeterUI).transform.parent == (Object)null) && !((Object)(object)((Component)((Component)sprintMeterUI).transform.parent).GetComponentInChildren<JumpMeter>(true) != (Object)null))
			{
				GameObject val = new GameObject("EmployeeBenefitsJumpMeter", new Type[1] { typeof(RectTransform) });
				val.transform.SetParent(((Component)sprintMeterUI).transform.parent, false);
				val.AddComponent<JumpMeter>().Build(sprintMeterUI);
			}
		}

		private void Build(Image meter)
		{
			//IL_0040: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			sprintMeter = meter;
			weight = (((Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.weightCounter != (Object)null) ? ((TMP_Text)HUDManager.Instance.weightCounter).rectTransform : null);
			tint = ((Graphic)meter).color;
			RectTransform val = (RectTransform)((Component)this).transform;
			val.pivot = new Vector2(0f, 1f);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			val.anchorMax = val2;
			val.anchorMin = val2;
			val.sizeDelta = new Vector2(47f, 16f);
			icon = Part("Icon", new Vector2(0f, 0f), new Vector2(16f, 16f), out iconRect);
			icon.sprite = Icon();
			iconRect.pivot = new Vector2(0.5f, 0.5f);
			iconRect.anchoredPosition = new Vector2(8f, 8f);
			float num = 7f;
			track = Part("Track", new Vector2(19f, num), new Vector2(28f, 2f), out RectTransform _);
			fill = Part("Fill", new Vector2(19f, num), new Vector2(28f, 2f), out fillRect);
		}

		private Image Part(string name, Vector2 at, Vector2 size, out RectTransform rect)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)this).transform, false);
			rect = (RectTransform)val.transform;
			RectTransform obj = rect;
			Vector2 anchorMin = (rect.anchorMax = Vector2.zero);
			obj.anchorMin = anchorMin;
			rect.pivot = new Vector2(0f, 0f);
			rect.anchoredPosition = at;
			rect.sizeDelta = size;
			Image obj2 = val.AddComponent<Image>();
			((Graphic)obj2).raycastTarget = false;
			return obj2;
		}

		private static Sprite Icon()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)iconSprite != (Object)null)
			{
				return iconSprite;
			}
			int num = IconRows.Length;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					bool flag = IconRows[num - 1 - i][j] == '#';
					val.SetPixel(j, i, flag ? Color.white : Color.clear);
				}
			}
			val.Apply();
			iconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f);
			return iconSprite;
		}

		private void Place()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Component)this).transform.parent;
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			((Graphic)sprintMeter).rectTransform.GetWorldCorners(array);
			float num = (parent.InverseTransformPoint(array[0]).x + parent.InverseTransformPoint(array[2]).x) / 2f;
			float y = parent.InverseTransformPoint(array[0]).y;
			if ((Object)(object)weight != (Object)null)
			{
				Bounds textBounds = ((Component)weight).GetComponent<TMP_Text>().textBounds;
				if (((Bounds)(ref textBounds)).size.y > 0f)
				{
					y = parent.InverseTransformPoint(((Transform)weight).TransformPoint(((Bounds)(ref textBounds)).center - new Vector3(0f, ((Bounds)(ref textBounds)).extents.y, 0f))).y;
				}
			}
			((Component)this).transform.localPosition = new Vector3(num - ((RectTransform)((Component)this).transform).sizeDelta.x / 2f, y - 5f, 0f);
		}

		private void LateUpdate()
		{
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null);
			bool flag = DoubleJump.Enabled && Plugin.BoundConfig.ShowDoubleJumpMeter.Value && (Object)(object)val != (Object)null && !val.isPlayerDead;
			Image obj = icon;
			Image obj2 = track;
			bool flag2 = (((Behaviour)fill).enabled = flag);
			bool enabled = (((Behaviour)obj2).enabled = flag2);
			((Behaviour)obj).enabled = enabled;
			if (flag)
			{
				Place();
				float charge = DoubleJump.Charge;
				bool flag5 = charge >= 1f;
				if (flag5 && lastCharge < 1f)
				{
					pulse = 0.35f;
				}
				lastCharge = charge;
				pulse = Mathf.Max(0f, pulse - Time.deltaTime);
				float num = 1f + 0.29999995f * (pulse / 0.35f);
				((Transform)iconRect).localScale = new Vector3(num, num, 1f);
				((Graphic)icon).color = WithAlpha(flag5 ? 1f : 0.35f);
				((Graphic)track).color = WithAlpha(0.15f);
				((Graphic)fill).color = WithAlpha(flag5 ? 1f : 0.6f);
				((Transform)fillRect).localScale = new Vector3(charge, 1f, 1f);
			}
		}

		private Color WithAlpha(float alpha)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			return new Color(tint.r, tint.g, tint.b, tint.a * alpha);
		}
	}
	public class Keys : LcInputActions
	{
		[InputAction("<Keyboard>/1", Name = "Slot 1")]
		public InputAction Slot1 { get; set; }

		[InputAction("<Keyboard>/2", Name = "Slot 2")]
		public InputAction Slot2 { get; set; }

		[InputAction("<Keyboard>/3", Name = "Slot 3")]
		public InputAction Slot3 { get; set; }

		[InputAction("<Keyboard>/4", Name = "Slot 4")]
		public InputAction Slot4 { get; set; }

		[InputAction("<Keyboard>/5", Name = "Dance")]
		public InputAction Dance { get; set; }

		[InputAction("<Keyboard>/6", Name = "Point")]
		public InputAction Point { get; set; }

		internal InputAction[] Slots => (InputAction[])(object)new InputAction[4] { Slot1, Slot2, Slot3, Slot4 };
	}
	internal static class LethalConfigSupport
	{
		internal const string Guid = "ainavt.lc.lethalconfig";

		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void Register(PluginConfig config)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_007b: 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)
			//IL_008b: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			ConfigEntry<float> staminaMultiplier = config.StaminaMultiplier;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = 1f;
			((BaseRangeOptions<float>)val).Max = 3f;
			((BaseOptions)val).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(staminaMultiplier, val));
			ConfigEntry<float> staminaRefillMultiplier = config.StaminaRefillMultiplier;
			FloatSliderOptions val2 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val2).Min = 1f;
			((BaseRangeOptions<float>)val2).Max = 3f;
			((BaseOptions)val2).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(staminaRefillMultiplier, val2));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.DoubleJump, false));
			ConfigEntry<float> doubleJumpRecharge = config.DoubleJumpRecharge;
			FloatSliderOptions val3 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val3).Min = 1f;
			((BaseRangeOptions<float>)val3).Max = 60f;
			((BaseOptions)val3).RequiresRestart = false;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(doubleJumpRecharge, val3));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ShowDoubleJumpMeter, false));
		}
	}
	[BepInPlugin("EmployeeBenefits", "EmployeeBenefits", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			//IL_0045: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
			{
				LethalConfigSupport.Register(BoundConfig);
			}
			SlotKeys.Listen(new Keys());
			Harmony val = new Harmony("EmployeeBenefits");
			val.PatchAll(typeof(SlotKeys));
			val.PatchAll(typeof(Stamina));
			val.PatchAll(typeof(DoubleJump));
			val.PatchAll(typeof(Burst));
			val.PatchAll(typeof(JumpMeter));
			Logger.LogInfo((object)"Plugin EmployeeBenefits is loaded!");
		}
	}
	public class QuickSlotsTest : MonoBehaviour
	{
		private class RefillTimer : MonoBehaviour
		{
			private float elapsed;

			private bool running;

			internal void Begin()
			{
				elapsed = 0f;
				running = true;
			}

			private void Update()
			{
				PlayerControllerB local = Local;
				if (running && !((Object)(object)local == (Object)null))
				{
					elapsed += Time.deltaTime;
					if (local.sprintMeter >= 0.99f)
					{
						running = false;
						string text = $"Refilled in {elapsed:0.0} s (refill multiplier {Plugin.BoundConfig.StaminaRefillMultiplier.Value:0.##}; " + $"the normal game is about {local.sprintTime + 4f:0} s standing still).";
						Plugin.Logger.LogInfo((object)("QSTEST " + text));
						HUDManager.Instance.DisplayTip("EmployeeBenefits test", text, false, false, "LC_Tip1");
					}
				}
			}
		}

		private class SprintTimer : MonoBehaviour
		{
			private float sprinting;

			private bool running;

			internal void Begin()
			{
				sprinting = 0f;
				running = true;
			}

			private void Update()
			{
				PlayerControllerB local = Local;
				if (running && !((Object)(object)local == (Object)null))
				{
					if (local.isSprinting)
					{
						sprinting += Time.deltaTime;
					}
					if (local.sprintMeter <= 0.01f || local.isExhausted)
					{
						running = false;
						string text = $"Sprinted {sprinting:0.0} s on a full bar (multiplier {Plugin.BoundConfig.StaminaMultiplier.Value:0.##}; " + $"the normal game is about {local.sprintTime / Mathf.Max(local.carryWeight, 1f):0.0} s at this weight).";
						Plugin.Logger.LogInfo((object)("QSTEST " + text));
						HUDManager.Instance.DisplayTip("EmployeeBenefits test", text, false, false, "LC_Tip1");
					}
				}
			}
		}

		private const int ItemsToDrop = 4;

		private const float StandingRefillExtraSeconds = 4f;

		private static PlayerControllerB? Local
		{
			get
			{
				if (!((Object)(object)GameNetworkManager.Instance != (Object)null))
				{
					return null;
				}
				return GameNetworkManager.Instance.localPlayerController;
			}
		}

		private static void DropFourItems()
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB local = Local;
			if ((Object)(object)local == (Object)null || !NetworkManager.Singleton.IsServer || (Object)(object)RoundManager.Instance == (Object)null)
			{
				HUDManager instance = HUDManager.Instance;
				if (instance != null)
				{
					instance.DisplayTip("EmployeeBenefits test", "Only the host can drop items.", false, false, "LC_Tip1");
				}
				return;
			}
			List<Item> list = (from _ in StartOfRound.Instance.allItemsList.itemsList
				where _.isScrap && !_.twoHanded && (Object)(object)_.spawnPrefab != (Object)null
				orderby Random.value
				select _).Take(4).ToList();
			for (int num = 0; num < list.Count; num++)
			{
				Vector3 val = ((Component)local).transform.position + ((Component)local).transform.forward * 1.2f + ((Component)local).transform.right * ((float)num - 1.5f) * 0.5f + Vector3.up * 0.5f;
				GameObject obj = Object.Instantiate<GameObject>(list[num].spawnPrefab, val, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer);
				obj.GetComponent<GrabbableObject>().fallTime = 0f;
				obj.GetComponent<NetworkObject>().Spawn(false);
			}
			HUDManager.Instance.DisplayTip("EmployeeBenefits test", "Pick them up, then try keys 1-4.", false, false, "LC_Tip1");
		}

		private static void DoubleJumpNow()
		{
			PlayerControllerB local = Local;
			if (!((Object)(object)local == (Object)null))
			{
				if (!DoubleJump.Enabled)
				{
					HUDManager.Instance.DisplayTip("EmployeeBenefits test", "Double jump is off in the settings.", false, false, "LC_Tip1");
				}
				else if (DoubleJump.Charge < 1f)
				{
					HUDManager.Instance.DisplayTip("EmployeeBenefits test", $"Still recharging ({DoubleJump.Charge * 100f:0}%).", false, false, "LC_Tip1");
				}
				else
				{
					DoubleJump.Jump(local);
				}
			}
		}

		private static void RechargeDoubleJump()
		{
			DoubleJump.Refill();
		}

		private static void ToggleDoubleJumpMeter()
		{
			ConfigEntry<bool> showDoubleJumpMeter = Plugin.BoundConfig.ShowDoubleJumpMeter;
			showDoubleJumpMeter.Value = !showDoubleJumpMeter.Value;
			HUDManager instance = HUDManager.Instance;
			if (instance != null)
			{
				instance.DisplayTip("EmployeeBenefits test", showDoubleJumpMeter.Value ? "Double jump meter shown." : "Double jump meter hidden.", false, false, "LC_Tip1");
			}
		}

		private static void ShowBurstOnMe()
		{
			if ((Object)(object)Local != (Object)null)
			{
				Burst.Send(Local);
			}
		}

		private static void EmptyStamina()
		{
			if ((Object)(object)Local != (Object)null)
			{
				Local.sprintMeter = 0f;
			}
		}

		private static void FillStamina()
		{
			if ((Object)(object)Local != (Object)null)
			{
				Local.sprintMeter = 1f;
			}
		}

		private static void TimeASprint()
		{
			PlayerControllerB local = Local;
			if (!((Object)(object)local == (Object)null))
			{
				local.sprintMeter = 1f;
				(((Component)local).gameObject.GetComponent<SprintTimer>() ?? ((Component)local).gameObject.AddComponent<SprintTimer>()).Begin();
				HUDManager.Instance.DisplayTip("EmployeeBenefits test", "Stamina full: sprint until it runs out.", false, false, "LC_Tip1");
			}
		}

		private static void TimeARefill()
		{
			PlayerControllerB local = Local;
			if (!((Object)(object)local == (Object)null))
			{
				local.sprintMeter = 0f;
				(((Component)local).gameObject.GetComponent<RefillTimer>() ?? ((Component)local).gameObject.AddComponent<RefillTimer>()).Begin();
				HUDManager.Instance.DisplayTip("EmployeeBenefits test", "Stamina empty: stand still until it's full.", false, false, "LC_Tip1");
			}
		}
	}
	[HarmonyPatch]
	internal static class SlotKeys
	{
		private const float SwitchCooldown = 0.3f;

		private const int JetpackItemId = 13;

		private static readonly FieldRef<PlayerControllerB, float> TimeSinceSwitchingSlots = AccessTools.FieldRefAccess<PlayerControllerB, float>("timeSinceSwitchingSlots");

		private static readonly FieldRef<PlayerControllerB, bool> ThrowingObject = AccessTools.FieldRefAccess<PlayerControllerB, bool>("throwingObject");

		private static readonly Action<PlayerControllerB, int, GrabbableObject?> SwitchToItemSlot = AccessTools.MethodDelegate<Action<PlayerControllerB, int, GrabbableObject>>(AccessTools.Method(typeof(PlayerControllerB), "SwitchToItemSlot", (Type[])null, (Type[])null), (object)null, true);

		private static readonly Action<PlayerControllerB, int> SwitchToSlotServerRpc = AccessTools.MethodDelegate<Action<PlayerControllerB, int>>(AccessTools.Method(typeof(PlayerControllerB), "SwitchToSlotServerRpc", (Type[])null, (Type[])null), (object)null, true);

		private static Keys keys = null;

		private static PlayerControllerB? Local
		{
			get
			{
				if (!((Object)(object)GameNetworkManager.Instance != (Object)null))
				{
					return null;
				}
				return GameNetworkManager.Instance.localPlayerController;
			}
		}

		internal static void Listen(Keys bound)
		{
			keys = bound;
			InputAction[] slots = keys.Slots;
			for (int i = 0; i < slots.Length; i++)
			{
				int slot = i;
				slots[i].performed += delegate
				{
					Switch(slot);
				};
			}
			keys.Dance.performed += delegate(CallbackContext context)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Emote(context, 1);
			};
			keys.Point.performed += delegate(CallbackContext context)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Emote(context, 2);
			};
		}

		internal static void Switch(int slot)
		{
			PlayerControllerB local = Local;
			if (!((Object)(object)local == (Object)null) && CanSwitch(local) && slot < local.ItemSlots.Length && slot != local.currentItemSlot)
			{
				ShipBuildModeManager.Instance.CancelBuildMode(true);
				local.playerBodyAnimator.SetBool("GrabValidated", false);
				SwitchToItemSlot(local, slot, null);
				SwitchToSlotServerRpc(local, slot);
				if ((Object)(object)local.currentlyHeldObjectServer != (Object)null)
				{
					((Component)local.currentlyHeldObjectServer).gameObject.GetComponent<AudioSource>().PlayOneShot(local.currentlyHeldObjectServer.itemProperties.grabSFX, 0.6f);
				}
				TimeSinceSwitchingSlots.Invoke(local) = 0f;
			}
		}

		private static bool CanSwitch(PlayerControllerB p)
		{
			if (((NetworkBehaviour)p).IsOwner && p.isPlayerControlled && (!((NetworkBehaviour)p).IsServer || p.isHostPlayerObject) && !p.inTerminalMenu && !p.isTypingChat && !p.quickMenuManager.isMenuOpen && TimeSinceSwitchingSlots.Invoke(p) >= 0.3f && !p.isGrabbingObjectAnimation && !p.inSpecialInteractAnimation && !ThrowingObject.Invoke(p) && !p.twoHanded && !p.activatingItem)
			{
				if ((p.jetpackControls || p.disablingJetpackControls) && !((Object)(object)p.currentlyHeldObjectServer == (Object)null))
				{
					return p.currentlyHeldObjectServer.itemProperties.itemId != 13;
				}
				return true;
			}
			return false;
		}

		private static void Emote(CallbackContext context, int emote)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB local = Local;
			if ((Object)(object)local != (Object)null)
			{
				local.PerformEmote(context, emote);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Emote1_performed")]
		[HarmonyPatch(typeof(PlayerControllerB), "Emote2_performed")]
		[HarmonyPrefix]
		private static bool NotOnSlotKeys(CallbackContext context)
		{
			//IL_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (keys == null || ((CallbackContext)(ref context)).control == null)
			{
				return true;
			}
			InputAction[] slots = keys.Slots;
			for (int i = 0; i < slots.Length; i++)
			{
				Enumerator<InputControl> enumerator = slots[i].controls.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						if (enumerator.Current == ((CallbackContext)(ref context)).control)
						{
							return false;
						}
					}
				}
				finally
				{
					((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class Stamina
	{
		[HarmonyPatch("LateUpdate")]
		[HarmonyPatch("Jump_performed")]
		[HarmonyPrefix]
		private static void Before(PlayerControllerB __instance, out float __state)
		{
			__state = __instance.sprintMeter;
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyPatch("Jump_performed")]
		[HarmonyPostfix]
		private static void After(PlayerControllerB __instance, float __state)
		{
			float num = __instance.sprintMeter - __state;
			if (num != 0f && ((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				PluginConfig boundConfig = Plugin.BoundConfig;
				__instance.sprintMeter = ((num < 0f) ? (__state + num / boundConfig.StaminaMultiplier.Value) : Mathf.Min(1f, __state + num * boundConfig.StaminaRefillMultiplier.Value));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "EmployeeBenefits";

		public const string PLUGIN_NAME = "EmployeeBenefits";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
namespace QuickSlots.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<float> StaminaMultiplier;

		public ConfigEntry<float> StaminaRefillMultiplier;

		public ConfigEntry<bool> DoubleJump;

		public ConfigEntry<float> DoubleJumpRecharge;

		public ConfigEntry<bool> ShowDoubleJumpMeter;

		private static readonly float[] PreviousStaminaMultipliers = new float[2] { 1.2f, 2f };

		private const float MostStamina = 3f;

		public PluginConfig(ConfigFile cfg)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			StaminaMultiplier = cfg.Bind<float>("Stamina", "Stamina multiplier", 3f, new ConfigDescription("How much longer your stamina lasts: sprinting, walking while slowed and jumping use it this many times slower. 1 is the normal game. Only your own stamina.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>()));
			float[] previousStaminaMultipliers = PreviousStaminaMultipliers;
			foreach (float num in previousStaminaMultipliers)
			{
				if (Mathf.Abs(StaminaMultiplier.Value - num) < 0.001f)
				{
					StaminaMultiplier.Value = (float)((ConfigEntryBase)StaminaMultiplier).DefaultValue;
					break;
				}
			}
			StaminaRefillMultiplier = cfg.Bind<float>("Stamina", "Stamina refill multiplier", 2f, new ConfigDescription("How much faster your stamina comes back while you're not sprinting. 1 is the normal game. Only your own stamina.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>()));
			DoubleJump = cfg.Bind<bool>("Double jump", "Double jump", true, "Press jump again in the air for a second jump, with a puff of smoke from your boots. Only for you.");
			DoubleJumpRecharge = cfg.Bind<float>("Double jump", "Double jump recharge", 10f, new ConfigDescription("Seconds before you can double jump again.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			ShowDoubleJumpMeter = cfg.Bind<bool>("Double jump", "Show double jump meter", true, "Show the small boot icon and bar under the stamina meter that shows when the double jump is ready.");
			ClearUnusedEntries(cfg);
		}

		private void ClearUnusedEntries(ConfigFile cfg)
		{
			((Dictionary<ConfigDefinition, string>)((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(cfg, null)).Clear();
			cfg.Save();
		}
	}
}