Decompiled source of WearableItemsAPI v0.1.9

WearableItemsAPI/Snowlance.WearableItemsAPI.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using Snowlance.WearableItemsAPI.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("snowlance7")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A customizable API for wearable items for Lethal Company")]
[assembly: AssemblyFileVersion("0.1.9.0")]
[assembly: AssemblyInformationalVersion("0.1.9+ed8a4d068319eeef56f70480e0939fb01a195c79")]
[assembly: AssemblyProduct("WearableItemsAPI")]
[assembly: AssemblyTitle("Snowlance.WearableItemsAPI")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/snowlance7/WearableItemsAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WearableItemsAPI
{
	[HarmonyPatch]
	internal class Patches
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")]
		private static bool OpenQuickMenuPatch()
		{
			//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)
			if ((Object)(object)WearableUIController.Instance == (Object)null)
			{
				return true;
			}
			if (WearableUIController.Instance.veMain == null)
			{
				logger.LogError((object)"veMain is null!");
				return true;
			}
			if (WearableUIController.Instance.veMain.style.display == StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0))
			{
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void AwakePostfix()
		{
			WearableUIController.Init();
		}
	}
	[BepInPlugin("Snowlance.WearableItemsAPI", "WearableItemsAPI", "0.1.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		internal static Plugin PluginInstance;

		internal static ManualLogSource LoggerInstance;

		private readonly Harmony harmony = new Harmony("Snowlance.WearableItemsAPI");

		public static AssetBundle? ModAssets;

		public static ConfigEntry<int> configUIPositionX;

		public static ConfigEntry<int> configUIPositionY;

		public static ConfigEntry<int> configUIWidth;

		public static ConfigEntry<int> configUIHeight;

		public static ConfigEntry<bool> configArmSpacing;

		public static ConfigEntry<int> configSpaceBetweenArms;

		public static ConfigEntry<int> configSpaceBetweenHeadAndChest;

		public static ConfigEntry<int> configSpaceBetweenChestAndLegs;

		public static ConfigEntry<int> configSpaceBetweenLegsAndFeet;

		internal static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			WearableItemsInputs.Init();
			configUIPositionX = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "UIPositionX", 0, "X Position of the UI");
			configUIPositionY = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "UIPositionY", 100, "Y Position of the UI");
			configUIWidth = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "UIWidth", 55, "Width of the UI");
			configUIHeight = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "UIHeight", 55, "Height of the UI");
			configArmSpacing = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Settings", "ArmSpacing", false, "Whether to add a gap between arm buttons");
			configSpaceBetweenArms = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "SpaceBetweenArms", 2, "Extra spacing between arm buttons");
			configSpaceBetweenHeadAndChest = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "SpaceBetweenHeadAndChest", 0, "Space between head and chest");
			configSpaceBetweenChestAndLegs = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "SpaceBetweenChestAndLegs", 0, "Space between chest and legs");
			configSpaceBetweenLegsAndFeet = ((BaseUnityPlugin)this).Config.Bind<int>("UI Settings", "SpaceBetweenLegsAndFeet", 0, "Space between legs and feet");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "wearable_items_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "wearable_items_assets")));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"WearableItemsAPI v0.1.9 has loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	public class WearableItem : PhysicsProp
	{
		public enum WearableSlot
		{
			None,
			Head,
			Chest,
			RightArm,
			LeftArm,
			BothArms,
			Legs,
			Feet
		}

		public PlayerControllerB? playerWornBy;

		private Transform? wornPos;

		public WearableSlot WearSlot;

		public Vector3 wearablePositionOffset;

		public Vector3 wearableRotationOffset;

		public bool showWearable;

		public bool showWearableOnClient;

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if ((Object)(object)playerWornBy != (Object)null && playerWornBy.isPlayerDead)
			{
				UnWear(grabItem: false);
			}
		}

		public override void LateUpdate()
		{
			//IL_0032: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((GrabbableObject)this).parentObject != (Object)null && (Object)(object)playerWornBy != (Object)null)
			{
				((Component)this).transform.rotation = ((GrabbableObject)this).parentObject.rotation;
				((Component)this).transform.Rotate(wearableRotationOffset);
				((Component)this).transform.position = ((GrabbableObject)this).parentObject.position;
				Vector3 val = wearablePositionOffset;
				val = ((GrabbableObject)this).parentObject.rotation * val;
				Transform transform = ((Component)this).transform;
				transform.position += val;
				if ((Object)(object)((GrabbableObject)this).radarIcon != (Object)null)
				{
					((GrabbableObject)this).radarIcon.position = ((Component)this).transform.position;
				}
			}
			else
			{
				((GrabbableObject)this).LateUpdate();
			}
		}

		public virtual void Wear()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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)
			Plugin.LoggerInstance.LogDebug((object)("Wearing " + ((GrabbableObject)this).itemProperties.itemName));
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				playerWornBy = ((GrabbableObject)this).playerHeldBy;
				if (!SetWearSlot(WearSlot, (GrabbableObject?)(object)this))
				{
					HUDManager.Instance.DisplayTip("Cant wear item", "You are already wearing an item of that type", true, false, "LC_Tip1");
					return;
				}
				((GrabbableObject)this).playerHeldBy.DiscardHeldObject(false, ((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).NetworkObject, default(Vector3), true);
				((GrabbableObject)this).parentObject = wornPos;
				((Component)this).gameObject.GetComponent<Collider>().enabled = false;
				((GrabbableObject)this).EnableItemMeshes(showWearableOnClient);
				WearServerRpc(playerWornBy.actualClientId, WearSlot, showWearable, wearablePositionOffset, wearableRotationOffset);
			}
			else
			{
				Plugin.LoggerInstance.LogError((object)"No player holding object found and no player was provided");
			}
		}

		public virtual void UnWear(bool grabItem = true)
		{
			UnwearServerRpc(grabItem);
		}

		public bool SetWearSlot(WearableSlot slot, GrabbableObject? itemToSlot = null)
		{
			if ((Object)(object)playerWornBy == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)"PlayerWornBy is null");
				return false;
			}
			WearSlot = slot;
			wornPos = null;
			switch (WearSlot)
			{
			case WearableSlot.Head:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = playerWornBy.bodyParts[0];
				}
				if (!((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer))
				{
					break;
				}
				if ((Object)(object)itemToSlot == (Object)null)
				{
					WearableUIController.Instance.HeadItem = itemToSlot;
					break;
				}
				if ((Object)(object)WearableUIController.Instance.HeadItem == (Object)null)
				{
					WearableUIController.Instance.HeadItem = itemToSlot;
					break;
				}
				return false;
			case WearableSlot.RightArm:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = playerWornBy.bodyParts[1];
				}
				if (!((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer))
				{
					break;
				}
				if ((Object)(object)itemToSlot == (Object)null)
				{
					WearableUIController.Instance.RightArmItem = itemToSlot;
					break;
				}
				if ((Object)(object)WearableUIController.Instance.RightArmItem == (Object)null)
				{
					WearableUIController.Instance.RightArmItem = itemToSlot;
					break;
				}
				return false;
			case WearableSlot.LeftArm:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = playerWornBy.bodyParts[2];
				}
				if (!((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer))
				{
					break;
				}
				if ((Object)(object)itemToSlot == (Object)null)
				{
					WearableUIController.Instance.LeftArmItem = itemToSlot;
					break;
				}
				if ((Object)(object)WearableUIController.Instance.LeftArmItem == (Object)null)
				{
					WearableUIController.Instance.LeftArmItem = itemToSlot;
					break;
				}
				return false;
			case WearableSlot.Chest:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = playerWornBy.bodyParts[5];
				}
				if (!((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer))
				{
					break;
				}
				if ((Object)(object)itemToSlot == (Object)null)
				{
					WearableUIController.Instance.ChestItem = itemToSlot;
					break;
				}
				if ((Object)(object)WearableUIController.Instance.ChestItem == (Object)null)
				{
					WearableUIController.Instance.ChestItem = itemToSlot;
					break;
				}
				return false;
			case WearableSlot.Legs:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = playerWornBy.bodyParts[8];
				}
				if (!((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer))
				{
					break;
				}
				if ((Object)(object)itemToSlot == (Object)null)
				{
					WearableUIController.Instance.LegsItem = itemToSlot;
					break;
				}
				if ((Object)(object)WearableUIController.Instance.LegsItem == (Object)null)
				{
					WearableUIController.Instance.LegsItem = itemToSlot;
					break;
				}
				return false;
			case WearableSlot.Feet:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = playerWornBy.bodyParts[6];
				}
				if (!((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer))
				{
					break;
				}
				if ((Object)(object)itemToSlot == (Object)null)
				{
					WearableUIController.Instance.FeetItem = itemToSlot;
					break;
				}
				if ((Object)(object)WearableUIController.Instance.FeetItem == (Object)null)
				{
					WearableUIController.Instance.FeetItem = itemToSlot;
					break;
				}
				return false;
			case WearableSlot.None:
				if ((Object)(object)itemToSlot != (Object)null)
				{
					wornPos = ((Component)playerWornBy).transform;
				}
				((GrabbableObject)this).EnableItemMeshes(false);
				break;
			default:
				Plugin.LoggerInstance.LogError((object)"Wearslot not found");
				break;
			case WearableSlot.BothArms:
				break;
			}
			return true;
		}

		[ServerRpc(RequireOwnership = false)]
		private void WearServerRpc(ulong clientId, WearableSlot slot, bool _showWearable, Vector3 _wearablePositionOffset, Vector3 _wearableRotationOffset)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_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_00a5: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1675537684u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<WearableSlot>(ref slot, default(ForEnums));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref _showWearable, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref _wearablePositionOffset);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref _wearableRotationOffset);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1675537684u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost))
				{
					WearClientRpc(clientId, slot, _showWearable, _wearablePositionOffset, _wearableRotationOffset);
				}
			}
		}

		[ClientRpc]
		private void WearClientRpc(ulong clientId, WearableSlot slot, bool _showWearable, Vector3 _wearablePositionOffset, Vector3 _wearableRotationOffset)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_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_00a5: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3939660845u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<WearableSlot>(ref slot, default(ForEnums));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref _showWearable, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref _wearablePositionOffset);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref _wearableRotationOffset);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3939660845u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			ulong clientId2 = clientId;
			if (Plugin.localPlayer.actualClientId != clientId2)
			{
				playerWornBy = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == clientId2).First();
				SetWearSlot(slot, (GrabbableObject?)(object)this);
				((GrabbableObject)this).EnableItemMeshes(_showWearable);
				wearablePositionOffset = _wearablePositionOffset;
				wearableRotationOffset = _wearableRotationOffset;
				((GrabbableObject)this).parentObject = wornPos;
				((Component)this).gameObject.GetComponent<Collider>().enabled = false;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void UnwearServerRpc(bool grabItem = true)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3216208453u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref grabItem, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3216208453u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost))
				{
					UnwearClientRpc(grabItem);
				}
			}
		}

		[ClientRpc]
		private void UnwearClientRpc(bool grabItem = true)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2970454903u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref grabItem, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2970454903u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if ((Object)(object)playerWornBy != (Object)null)
			{
				SetWearSlot(WearSlot);
				if (playerWornBy.isPlayerDead || !grabItem)
				{
					Plugin.LoggerInstance.LogDebug((object)"Player is dead");
					((GrabbableObject)this).parentObject = null;
					if (playerWornBy.isInElevator)
					{
						((Component)this).transform.SetParent(playerWornBy.playersManager.elevatorTransform, true);
					}
					else
					{
						((Component)this).transform.SetParent(playerWornBy.playersManager.propsContainer, true);
					}
					playerWornBy.SetItemInElevator(playerWornBy.isInHangarShipRoom, playerWornBy.isInElevator, (GrabbableObject)(object)this);
					((GrabbableObject)this).EnablePhysics(true);
					((GrabbableObject)this).EnableItemMeshes(true);
					((GrabbableObject)this).startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(((Component)this).transform.position);
					((GrabbableObject)this).FallToGround(true);
					((GrabbableObject)this).fallTime = 0f;
				}
				if ((Object)(object)playerWornBy == (Object)(object)Plugin.localPlayer && !playerWornBy.isPlayerDead && grabItem)
				{
					Plugin.LoggerInstance.LogDebug((object)("Grabbing " + ((GrabbableObject)this).itemProperties.itemName));
					playerWornBy.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)this).NetworkObject));
					((GrabbableObject)this).parentObject = playerWornBy.localItemHolder;
					((GrabbableObject)this).GrabItemOnClient();
				}
			}
			((Component)this).gameObject.GetComponent<Collider>().enabled = true;
			((GrabbableObject)this).EnableItemMeshes(true);
			playerWornBy = null;
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_WearableItem()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1675537684u, new RpcReceiveHandler(__rpc_handler_1675537684));
			NetworkManager.__rpc_func_table.Add(3939660845u, new RpcReceiveHandler(__rpc_handler_3939660845));
			NetworkManager.__rpc_func_table.Add(3216208453u, new RpcReceiveHandler(__rpc_handler_3216208453));
			NetworkManager.__rpc_func_table.Add(2970454903u, new RpcReceiveHandler(__rpc_handler_2970454903));
		}

		private static void __rpc_handler_1675537684(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				WearableSlot slot = default(WearableSlot);
				((FastBufferReader)(ref reader)).ReadValueSafe<WearableSlot>(ref slot, default(ForEnums));
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				Vector3 val = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref val);
				Vector3 val2 = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref val2);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WearableItem)(object)target).WearServerRpc(clientId, slot, flag, val, val2);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3939660845(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				WearableSlot slot = default(WearableSlot);
				((FastBufferReader)(ref reader)).ReadValueSafe<WearableSlot>(ref slot, default(ForEnums));
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				Vector3 val = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref val);
				Vector3 val2 = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref val2);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((WearableItem)(object)target).WearClientRpc(clientId, slot, flag, val, val2);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3216208453(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool grabItem = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref grabItem, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WearableItem)(object)target).UnwearServerRpc(grabItem);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2970454903(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool grabItem = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref grabItem, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((WearableItem)(object)target).UnwearClientRpc(grabItem);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "WearableItem";
		}
	}
	internal class WearableItemsInputs : LcInputActions
	{
		public static WearableItemsInputs Instance;

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction OpenUIKey { get; set; }

		public static void Init()
		{
			Instance = new WearableItemsInputs();
		}
	}
	public class WearableUIController : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static WearableUIController Instance;

		internal VisualElement veMain;

		internal VisualElement veUIContainer;

		private Button btnHead;

		private Button btnRightArm;

		private Button btnLeftArm;

		private Button btnChest;

		private Button btnLegs;

		private Button btnFeet;

		public GrabbableObject HeadItem;

		public GrabbableObject RightArmItem;

		public GrabbableObject LeftArmItem;

		public GrabbableObject BothArmsItem;

		public GrabbableObject ChestItem;

		public GrabbableObject LegsItem;

		public GrabbableObject FeetItem;

		internal static void Init()
		{
			logger.LogDebug((object)"UIController: Init()");
			GameObject val = Plugin.ModAssets.LoadAsset<GameObject>("Assets/ModAssets/WearableItemsUIHandler.prefab");
			if ((Object)(object)val == (Object)null)
			{
				logger.LogError((object)"WearableItemsUIHandler not found.");
				return;
			}
			val.AddComponent<WearableUIController>();
			val = Object.Instantiate<GameObject>(val);
		}

		private void Start()
		{
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"UIController: Start()");
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger.LogDebug((object)"Getting UIDocument");
			UIDocument component = ((Component)this).GetComponent<UIDocument>();
			if ((Object)(object)component == (Object)null)
			{
				logger.LogError((object)"uiDocument not found.");
				return;
			}
			logger.LogDebug((object)"Getting visual tree asset");
			if ((Object)(object)component.visualTreeAsset == (Object)null)
			{
				logger.LogError((object)"visualTreeAsset not found.");
				return;
			}
			VisualElement val = (VisualElement)(object)component.visualTreeAsset.Instantiate();
			if (val == null)
			{
				logger.LogError((object)"root is null!");
				return;
			}
			logger.LogDebug((object)"Adding root");
			component.rootVisualElement.Add(val);
			if (component.rootVisualElement == null)
			{
				logger.LogError((object)"uiDocument.rootVisualElement not found.");
				return;
			}
			logger.LogDebug((object)"Got root");
			val = component.rootVisualElement;
			veMain = UQueryExtensions.Q<VisualElement>(val, "veMain", (string)null);
			if (veMain == null)
			{
				logger.LogError((object)"veMain not found.");
				return;
			}
			veMain.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
			veUIContainer = UQueryExtensions.Q<VisualElement>(val, "veUIContainer", (string)null);
			if (veUIContainer == null)
			{
				logger.LogError((object)"veUIContainer not found.");
				return;
			}
			veUIContainer.style.bottom = StyleLength.op_Implicit((float)Plugin.configUIPositionY.Value);
			veUIContainer.style.left = StyleLength.op_Implicit((float)Plugin.configUIPositionX.Value);
			VisualElement val2 = UQueryExtensions.Q<VisualElement>(val, "veHead", (string)null);
			if (val2 == null)
			{
				logger.LogError((object)"veHead not found.");
				return;
			}
			val2.style.marginBottom = StyleLength.op_Implicit((float)Plugin.configSpaceBetweenHeadAndChest.Value);
			VisualElement val3 = UQueryExtensions.Q<VisualElement>(val, "veChest", (string)null);
			if (val3 == null)
			{
				logger.LogError((object)"veChest not found.");
				return;
			}
			val3.style.marginBottom = StyleLength.op_Implicit((float)Plugin.configSpaceBetweenChestAndLegs.Value);
			if (Plugin.configArmSpacing.Value)
			{
				val3.style.justifyContent = StyleEnum<Justify>.op_Implicit((Justify)4);
			}
			VisualElement val4 = UQueryExtensions.Q<VisualElement>(val, "veLegs", (string)null);
			if (val4 == null)
			{
				logger.LogError((object)"veLegs not found.");
				return;
			}
			val4.style.marginBottom = StyleLength.op_Implicit((float)Plugin.configSpaceBetweenLegsAndFeet.Value);
			btnHead = UQueryExtensions.Q<Button>(val, "btnHead", (string)null);
			if (btnHead == null)
			{
				logger.LogError((object)"btnHead not found.");
				return;
			}
			((VisualElement)btnHead).style.width = StyleLength.op_Implicit((float)Plugin.configUIWidth.Value);
			((VisualElement)btnHead).style.height = StyleLength.op_Implicit((float)Plugin.configUIHeight.Value);
			btnRightArm = UQueryExtensions.Q<Button>(val, "btnRightArm", (string)null);
			if (btnRightArm == null)
			{
				logger.LogError((object)"btnRightArm not found.");
				return;
			}
			((VisualElement)btnRightArm).style.width = StyleLength.op_Implicit((float)Plugin.configUIWidth.Value);
			((VisualElement)btnRightArm).style.height = StyleLength.op_Implicit((float)Plugin.configUIHeight.Value);
			((VisualElement)btnRightArm).style.marginRight = StyleLength.op_Implicit((float)Plugin.configSpaceBetweenArms.Value);
			btnLeftArm = UQueryExtensions.Q<Button>(val, "btnLeftArm", (string)null);
			if (btnLeftArm == null)
			{
				logger.LogError((object)"btnLeftArm not found.");
				return;
			}
			((VisualElement)btnLeftArm).style.width = StyleLength.op_Implicit((float)Plugin.configUIWidth.Value);
			((VisualElement)btnLeftArm).style.height = StyleLength.op_Implicit((float)Plugin.configUIHeight.Value);
			((VisualElement)btnLeftArm).style.marginLeft = StyleLength.op_Implicit((float)Plugin.configSpaceBetweenArms.Value);
			btnChest = UQueryExtensions.Q<Button>(val, "btnChest", (string)null);
			if (btnChest == null)
			{
				logger.LogError((object)"btnChest not found.");
				return;
			}
			((VisualElement)btnChest).style.width = StyleLength.op_Implicit((float)Plugin.configUIWidth.Value);
			((VisualElement)btnChest).style.height = StyleLength.op_Implicit((float)Plugin.configUIHeight.Value);
			btnLegs = UQueryExtensions.Q<Button>(val, "btnLegs", (string)null);
			if (btnLegs == null)
			{
				logger.LogError((object)"btnLegs not found.");
				return;
			}
			((VisualElement)btnLegs).style.width = StyleLength.op_Implicit((float)Plugin.configUIWidth.Value);
			((VisualElement)btnLegs).style.height = StyleLength.op_Implicit((float)Plugin.configUIHeight.Value);
			btnFeet = UQueryExtensions.Q<Button>(val, "btnFeet", (string)null);
			if (btnFeet == null)
			{
				logger.LogError((object)"btnFeet not found.");
				return;
			}
			((VisualElement)btnFeet).style.width = StyleLength.op_Implicit((float)Plugin.configUIWidth.Value);
			((VisualElement)btnFeet).style.height = StyleLength.op_Implicit((float)Plugin.configUIHeight.Value);
			logger.LogDebug((object)"Got Controls for UI");
			btnHead.clickable.clicked += delegate
			{
				ButtonHeadClicked();
			};
			btnRightArm.clickable.clicked += delegate
			{
				ButtonRightArmClicked();
			};
			btnLeftArm.clickable.clicked += delegate
			{
				ButtonLeftArmClicked();
			};
			btnChest.clickable.clicked += delegate
			{
				ButtonChestClicked();
			};
			btnLegs.clickable.clicked += delegate
			{
				ButtonLegsClicked();
			};
			btnFeet.clickable.clicked += delegate
			{
				ButtonFeetClicked();
			};
			logger.LogDebug((object)"UIControllerScript: Start() complete");
		}

		private void Update()
		{
			//IL_000c: 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_007f: 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)
			if (veMain.style.display == StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0) && (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame || ((ButtonControl)Keyboard.current.tabKey).wasPressedThisFrame))
			{
				HideUI();
			}
			if (WearableItemsInputs.Instance.OpenUIKey.WasPressedThisFrame() && Plugin.localPlayer.CheckConditionsForEmote())
			{
				if (veMain.style.display == StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1))
				{
					ShowUI();
				}
				else
				{
					HideUI();
				}
			}
		}

		public void ShowUI()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"Showing UI");
			veMain.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0);
			if ((Object)(object)HeadItem != (Object)null)
			{
				((TextElement)btnHead).text = HeadItem.itemProperties.itemName;
				((VisualElement)btnHead).style.backgroundImage = new StyleBackground(HeadItem.itemProperties.itemIcon);
			}
			else
			{
				((TextElement)btnHead).text = "Head";
				((VisualElement)btnHead).style.backgroundImage = StyleBackground.op_Implicit((Texture2D)null);
			}
			if ((Object)(object)BothArmsItem == (Object)null)
			{
				if ((Object)(object)RightArmItem != (Object)null)
				{
					((TextElement)btnRightArm).text = RightArmItem.itemProperties.itemName;
					((VisualElement)btnRightArm).style.backgroundImage = new StyleBackground(RightArmItem.itemProperties.itemIcon);
				}
				else
				{
					((TextElement)btnRightArm).text = "Arm";
					((VisualElement)btnRightArm).style.backgroundImage = StyleBackground.op_Implicit((Texture2D)null);
				}
				if ((Object)(object)LeftArmItem != (Object)null)
				{
					((TextElement)btnLeftArm).text = LeftArmItem.itemProperties.itemName;
					((VisualElement)btnLeftArm).style.backgroundImage = new StyleBackground(LeftArmItem.itemProperties.itemIcon);
				}
				else
				{
					((TextElement)btnLeftArm).text = "Arm";
					((VisualElement)btnLeftArm).style.backgroundImage = StyleBackground.op_Implicit((Texture2D)null);
				}
			}
			else
			{
				((VisualElement)btnLeftArm).style.backgroundImage = new StyleBackground(BothArmsItem.itemProperties.itemIcon);
				((TextElement)btnLeftArm).text = BothArmsItem.itemProperties.itemName;
				((VisualElement)btnRightArm).style.backgroundImage = new StyleBackground(BothArmsItem.itemProperties.itemIcon);
				((TextElement)btnRightArm).text = BothArmsItem.itemProperties.itemName;
			}
			if ((Object)(object)ChestItem != (Object)null)
			{
				((TextElement)btnChest).text = ChestItem.itemProperties.itemName;
				((VisualElement)btnChest).style.backgroundImage = new StyleBackground(ChestItem.itemProperties.itemIcon);
			}
			else
			{
				((TextElement)btnChest).text = "Chest";
				((VisualElement)btnChest).style.backgroundImage = StyleBackground.op_Implicit((Texture2D)null);
			}
			if ((Object)(object)LegsItem != (Object)null)
			{
				((TextElement)btnLegs).text = LegsItem.itemProperties.itemName;
				((VisualElement)btnLegs).style.backgroundImage = new StyleBackground(LegsItem.itemProperties.itemIcon);
			}
			else
			{
				((TextElement)btnLegs).text = "Legs";
				((VisualElement)btnLegs).style.backgroundImage = StyleBackground.op_Implicit((Texture2D)null);
			}
			if ((Object)(object)FeetItem != (Object)null)
			{
				((TextElement)btnFeet).text = FeetItem.itemProperties.itemName;
				((VisualElement)btnFeet).style.backgroundImage = new StyleBackground(FeetItem.itemProperties.itemIcon);
			}
			else
			{
				((TextElement)btnFeet).text = "Feet";
				((VisualElement)btnFeet).style.backgroundImage = StyleBackground.op_Implicit((Texture2D)null);
			}
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			StartOfRound.Instance.localPlayerController.disableMoveInput = true;
			StartOfRound.Instance.localPlayerController.disableInteract = true;
			StartOfRound.Instance.localPlayerController.disableLookInput = true;
		}

		public void HideUI()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"Hiding UI");
			veMain.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
			Cursor.lockState = (CursorLockMode)1;
			Cursor.visible = false;
			StartOfRound.Instance.localPlayerController.disableMoveInput = false;
			StartOfRound.Instance.localPlayerController.disableInteract = false;
			StartOfRound.Instance.localPlayerController.disableLookInput = false;
		}

		private void ButtonHeadClicked()
		{
			logger.LogDebug((object)"Button Head clicked");
			if (!((Object)(object)HeadItem == (Object)null))
			{
				((Component)HeadItem).GetComponent<WearableItem>().UnWear();
				HideUI();
			}
		}

		private void ButtonRightArmClicked()
		{
			logger.LogDebug((object)"Button Right Arm clicked");
			if ((Object)(object)BothArmsItem == (Object)null)
			{
				if (!((Object)(object)RightArmItem == (Object)null))
				{
					((Component)RightArmItem).GetComponent<WearableItem>().UnWear();
					HideUI();
				}
			}
			else
			{
				((Component)BothArmsItem).GetComponent<WearableItem>().UnWear();
				HideUI();
			}
		}

		private void ButtonLeftArmClicked()
		{
			logger.LogDebug((object)"Button Left Arm clicked");
			if ((Object)(object)BothArmsItem == (Object)null)
			{
				if (!((Object)(object)LeftArmItem == (Object)null))
				{
					((Component)LeftArmItem).GetComponent<WearableItem>().UnWear();
					HideUI();
				}
			}
			else
			{
				((Component)BothArmsItem).GetComponent<WearableItem>().UnWear();
				HideUI();
			}
		}

		private void ButtonChestClicked()
		{
			logger.LogDebug((object)"Button Chest clicked");
			if (!((Object)(object)ChestItem == (Object)null))
			{
				((Component)ChestItem).GetComponent<WearableItem>().UnWear();
				HideUI();
			}
		}

		private void ButtonLegsClicked()
		{
			logger.LogDebug((object)"Button Legs clicked");
			if (!((Object)(object)LegsItem == (Object)null))
			{
				((Component)LegsItem).GetComponent<WearableItem>().UnWear();
				HideUI();
			}
		}

		private void ButtonFeetClicked()
		{
			logger.LogDebug((object)"Button Feet clicked");
			if (!((Object)(object)FeetItem == (Object)null))
			{
				((Component)FeetItem).GetComponent<WearableItem>().UnWear();
				HideUI();
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Snowlance.WearableItemsAPI";

		public const string PLUGIN_NAME = "WearableItemsAPI";

		public const string PLUGIN_VERSION = "0.1.9";
	}
}
namespace Snowlance.WearableItemsAPI.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}